code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import copy
import numpy as np
import os
import torch
import pickle
from detectron2.data import MetadataCatalog
from detectron2.data import detection_utils as utils
from detectron2.structures import (
BitMasks,
Boxes,
BoxMode,
Instances,
PolygonMasks,
polygons_to_bitmask,
)
import pycocotools.ma... | [
"pycocotools.mask.decode",
"pickle.load",
"detectron2.structures.Instances",
"os.path.join",
"detectron2.structures.polygons_to_bitmask",
"detectron2.structures.PolygonMasks",
"os.path.exists",
"torchvision.transforms.Compose",
"copy.deepcopy",
"numpy.asarray",
"detectron2.structures.Boxes",
"... | [((1016, 1033), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (1026, 1033), True, 'import numpy as np\n'), ((2086, 2107), 'detectron2.structures.Instances', 'Instances', (['image_size'], {}), '(image_size)\n', (2095, 2107), False, 'from detectron2.structures import BitMasks, Boxes, BoxMode, Instances, Po... |
from datetime import datetime
from multiprocessing import Array
from queue import Empty, Full
# except AttributeError:
# from multiprocessing import Queue
import numpy as np
# try:
from arrayqueues.portable_queue import PortableQueue # as Queue
class ArrayView:
def __init__(self, array, max_bytes, dtype, el_sh... | [
"multiprocessing.Array",
"arrayqueues.portable_queue.PortableQueue",
"numpy.floor",
"numpy.product",
"datetime.datetime.now"
] | [((1929, 1954), 'multiprocessing.Array', 'Array', (['"""c"""', 'self.maxbytes'], {}), "('c', self.maxbytes)\n", (1934, 1954), False, 'from multiprocessing import Array\n'), ((2001, 2016), 'arrayqueues.portable_queue.PortableQueue', 'PortableQueue', ([], {}), '()\n', (2014, 2016), False, 'from arrayqueues.portable_queue... |
'''
์ ๋ต : ํ๋ฃจ์ ์ฃผ๊ฐ๋ฅผ ๋๊ณ ๋ณด๋ฉด ์ค๋ฅธ ๊ฒฝ์ฐ๊ฐ 42%, ๋ด๋ฆฐ ๊ฒฝ์ฐ๊ฐ 46%, ๋๋จธ์ง 12%๋ ๋ณ๋์ด ์๋ค. ์ฆ๋ช
์๊ณ ๋ฆฌ์ฆ : PyportfolioOpt ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ด์ฉํ ์ต์ ํ
(max sharp, risk, return, fund remaining)
'''
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import FinanceDataReader as fdr
import datetime
from pykrx import stock
import requests
from pypfop... | [
"pandas.DataFrame",
"pypfopt.risk_models.sample_cov",
"pykrx.stock.get_market_fundamental_by_ticker",
"datetime.datetime.today",
"pypfopt.efficient_frontier.EfficientFrontier",
"pypfopt.discrete_allocation.get_latest_prices",
"numpy.array",
"pypfopt.expected_returns.mean_historical_return",
"pypfopt... | [((2378, 2398), 'numpy.array', 'np.array', (['symbol_udz'], {}), '(symbol_udz)\n', (2386, 2398), True, 'import numpy as np\n'), ((2454, 2468), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2466, 2468), True, 'import pandas as pd\n'), ((2596, 2646), 'pypfopt.expected_returns.mean_historical_return', 'expected_r... |
# pylint: disable=invalid-name,protected-access
from copy import deepcopy
from unittest import TestCase
import codecs
import gzip
import logging
import os
import shutil
from keras import backend as K
import numpy
from numpy.testing import assert_allclose
from deep_qa.common.checks import log_keras_version_info
from d... | [
"copy.deepcopy",
"gzip.open",
"os.makedirs",
"logging.basicConfig",
"codecs.open",
"numpy.testing.assert_allclose",
"numpy.zeros",
"deep_qa.common.params.Params",
"deep_qa.common.checks.log_keras_version_info",
"shutil.rmtree",
"shutil.copyfileobj",
"keras.backend.clear_session"
] | [((1030, 1143), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'level': 'logging.DEBUG'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', level=logging.DEBUG\n )\n", (1049, 1143), False, 'import logging\n'), ((1170, ... |
import torch
import random
import socket
import os
import numpy as np
def get_device(device):
assert device in (
'cpu', 'cuda'), 'device {} should be in (cpu, cuda)'.format(device)
if socket.gethostname() == 'gemini' or not torch.cuda.is_available():
device = 'cpu'
else:
device = '... | [
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed",
"socket.gethostname",
"torch.set_num_threads",
"random.seed",
"torch.cuda.is_available",
"os.path.join"
] | [((416, 433), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (427, 433), False, 'import random\n'), ((438, 458), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (452, 458), True, 'import numpy as np\n'), ((463, 486), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (48... |
import torch
import pandas as pd
import numpy as np
from os import path
from torch.utils.data import Dataset, sampler
from scipy.ndimage.filters import gaussian_filter
class MRIDataset(Dataset):
"""Dataset of MRI organized in a CAPS folder."""
def __init__(self, img_dir, data_file, preprocessing='linear', tr... | [
"pandas.DataFrame",
"scipy.ndimage.filters.gaussian_filter",
"numpy.nan_to_num",
"pandas.read_csv",
"torch.load",
"copy.copy",
"os.path.join",
"pandas.concat",
"torch.from_numpy"
] | [((4592, 4606), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4604, 4606), True, 'import pandas as pd\n'), ((4622, 4636), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4634, 4636), True, 'import pandas as pd\n'), ((5913, 5927), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (5925, 5927), True, ... |
# Copyright 2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.conj",
"numpy.outer",
"numpy.abs",
"cirq.inverse",
"cirq.unitary",
"cirq.to_valid_state_vector",
"numpy.identity",
"cirq.num_qubits",
"qsp.to_r_z_from_wx",
"cirq.Circuit",
"numpy.linspace",
"numpy.real",
"cirq.LineQubit.range"
] | [((2056, 2076), 'cirq.inverse', 'cirq.inverse', (['self.u'], {}), '(self.u)\n', (2068, 2076), False, 'import cirq\n'), ((2209, 2232), 'cirq.num_qubits', 'cirq.num_qubits', (['self.u'], {}), '(self.u)\n', (2224, 2232), False, 'import cirq\n'), ((2865, 2902), 'cirq.LineQubit.range', 'cirq.LineQubit.range', (['self.num_qu... |
from ...isa.inst import *
import numpy as np
class Vmfeq_vf(Inst):
name = 'vmfeq.vf'
def golden(self):
if 'vs2' in self:
result = np.unpackbits( self['orig'], bitorder='little' )
if 'vstart' in self:
vstart = self['vstart']
else:
v... | [
"numpy.packbits",
"numpy.ones",
"numpy.unpackbits"
] | [((161, 207), 'numpy.unpackbits', 'np.unpackbits', (["self['orig']"], {'bitorder': '"""little"""'}), "(self['orig'], bitorder='little')\n", (174, 207), True, 'import numpy as np\n'), ((782, 820), 'numpy.packbits', 'np.packbits', (['result'], {'bitorder': '"""little"""'}), "(result, bitorder='little')\n", (793, 820), Tr... |
from typing import List, Tuple
import numpy as np
from evobench.benchmark import Benchmark
# from evobench.linkage import DependencyStructureMatrix
from evobench.model import Population, Solution
from ..operator import Operator
class RestrictedMixing(Operator):
def __init__(self, benchmark: Benchmark):
... | [
"numpy.zeros"
] | [((911, 959), 'numpy.zeros', 'np.zeros', (['self.benchmark.genome_size'], {'dtype': 'bool'}), '(self.benchmark.genome_size, dtype=bool)\n', (919, 959), True, 'import numpy as np\n')] |
from unittest import TestCase
import os
import tempfile
import numpy as np
from keras_trans_mask.backend import keras
from keras_trans_mask import CreateMask, RemoveMask, RestoreMask
class TestMasks(TestCase):
def test_over_fit(self):
input_layer = keras.layers.Input(shape=(None,))
embed_layer ... | [
"keras_trans_mask.RestoreMask",
"keras_trans_mask.RemoveMask",
"keras_trans_mask.backend.keras.layers.Embedding",
"tempfile.gettempdir",
"keras_trans_mask.backend.keras.layers.Input",
"keras_trans_mask.backend.keras.models.Model",
"keras_trans_mask.CreateMask",
"numpy.array",
"keras_trans_mask.backe... | [((266, 299), 'keras_trans_mask.backend.keras.layers.Input', 'keras.layers.Input', ([], {'shape': '(None,)'}), '(shape=(None,))\n', (284, 299), False, 'from keras_trans_mask.backend import keras\n'), ((970, 1029), 'keras_trans_mask.backend.keras.models.Model', 'keras.models.Model', ([], {'inputs': 'input_layer', 'outpu... |
import numpy as np
from scipy.stats import entropy
from bisect import bisect
from scipy import stats
from scipy.stats import median_absolute_deviation as mad
from sklearn.metrics import r2_score, mean_squared_error
from pyapprox.multivariate_polynomials import conditional_moments_of_polynomial_chaos_expansion as cond_m... | [
"numpy.quantile",
"pyapprox.multivariate_polynomials.conditional_moments_of_polynomial_chaos_expansion",
"numpy.copy",
"numpy.zeros",
"scipy.stats.ks_2samp",
"numpy.sqrt"
] | [((7295, 7340), 'numpy.quantile', 'np.quantile', (['results_fix_resample', 'conf_level'], {}), '(results_fix_resample, conf_level)\n', (7306, 7340), True, 'import numpy as np\n'), ((7374, 7427), 'scipy.stats.ks_2samp', 'stats.ks_2samp', (['y_true_resample', 'results_fix_resample'], {}), '(y_true_resample, results_fix_r... |
import numpy as np
import gpflow
import matplotlib.pyplot as plt
import matplotlib.pylab as pl
from mpl_toolkits.mplot3d import axes3d, Axes3D
from BoManifolds.Riemannian_utils.sphere_utils import logmap
from BoManifolds.kernel_utils.kernels_sphere_tf import SphereGaussianKernel, SphereLaplaceKernel
from BoManifolds.p... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"numpy.sum",
"BoManifolds.Riemannian_utils.sphere_utils.logmap",
"matplotlib.pyplot.figure",
"numpy.linalg.norm",
"gpflow.kernels.RBF",
"numpy.diag",
"numpy.linalg.det",
"matplotlib.pylab.cm.inferno",
"matplotlib.pyplot.show",
"mpl_toolkits.mplot... | [((1336, 1397), 'numpy.array', 'np.array', (['[[0.6, 0.2, 0], [0.2, 0.3, -0.01], [0, -0.01, 0.2]]'], {}), '([[0.6, 0.2, 0], [0.2, 0.3, -0.01], [0, -0.01, 0.2]])\n', (1344, 1397), True, 'import numpy as np\n'), ((1423, 1452), 'numpy.linalg.inv', 'np.linalg.inv', (['sigma_test_fct'], {}), '(sigma_test_fct)\n', (1436, 145... |
import os, logging, json, re
import pandas as pd
import numpy as np
from BarSeqPy.translate_R_to_pandas import *
def data_prep_1(data_dir, FEBA_dir, debug_bool=False, meta_ix=7, cfg=None):
""" The first phase of data preparation for the BarSeqR Computations
Args:
data_dir: (str) Path to directory whic... | [
"logging.debug",
"numpy.copy",
"logging.info",
"os.path.isfile",
"pandas.Series",
"re.search",
"os.access",
"pandas.read_table",
"pandas.isna",
"os.path.join",
"os.listdir",
"re.sub"
] | [((8321, 8341), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (8331, 8341), False, 'import os, logging, json, re\n'), ((8648, 8687), 'os.path.join', 'os.path.join', (['data_dir', '"""all.poolcount"""'], {}), "(data_dir, 'all.poolcount')\n", (8660, 8687), False, 'import os, logging, json, re\n'), ((870... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018 herrlich10
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights... | [
"subprocess.Popen",
"multiprocessing.Array",
"numpy.frombuffer",
"numpy.dtype",
"shlex.split",
"time.sleep",
"numpy.any",
"time.time",
"multiprocessing.Process",
"numpy.prod",
"multiprocessing.cpu_count"
] | [((5724, 5735), 'time.time', 'time.time', ([], {}), '()\n', (5733, 5735), False, 'import sys, shlex, time\n'), ((6640, 6653), 'numpy.any', 'np.any', (['codes'], {}), '(codes)\n', (6646, 6653), True, 'import numpy as np\n'), ((8430, 8445), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (8438, 8445), True, 'imp... |
import numpy as np
from pommerman import constants
from pommerman.constants import Item
from util.data import calc_dist
def staying_alive_reward(nobs, agent_id):
"""
Return a reward if the agent with the given id is alive.
:param nobs: The game state
:param agent_id: The agent to check
... | [
"numpy.isin",
"numpy.asarray",
"numpy.where",
"util.data.calc_dist"
] | [((1392, 1418), 'util.data.calc_dist', 'calc_dist', (['agent_ind', 'nobs'], {}), '(agent_ind, nobs)\n', (1401, 1418), False, 'from util.data import calc_dist\n'), ((4096, 4122), 'numpy.where', 'np.where', (['(wood_bitmap == 1)'], {}), '(wood_bitmap == 1)\n', (4104, 4122), True, 'import numpy as np\n'), ((5017, 5037), '... |
import numpy as np
import pandas as pd
def intersection_cartesian(L1: pd.DataFrame, L2: pd.DataFrame):
"""
Compute cartesian coordinates of intersection points given two list of lines in general form.
General form for a line: Ax+By+C=0
:param L1:
:param L2:
:return:
"""
if not {'A', '... | [
"pandas.DataFrame",
"numpy.abs",
"numpy.floor",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.cos",
"numpy.round"
] | [((1209, 1221), 'numpy.array', 'np.array', (['p1'], {}), '(p1)\n', (1217, 1221), True, 'import numpy as np\n'), ((1231, 1243), 'numpy.array', 'np.array', (['p2'], {}), '(p2)\n', (1239, 1243), True, 'import numpy as np\n'), ((2246, 2261), 'numpy.array', 'np.array', (['lines'], {}), '(lines)\n', (2254, 2261), True, 'impo... |
# -*- coding: utf-8 -*-
#code adapted from https://github.com/analyticalmindsltd/smote_variants
import numpy as np
import time
import logging
import itertools
from sklearn.neighbors import NearestNeighbors
# setting the _logger format
_logger = logging.getLogger('smote_variants')
_logger.setLevel(loggin... | [
"numpy.random.seed",
"numpy.copy",
"logging.StreamHandler",
"logging.getLogger",
"time.time",
"logging.Formatter",
"numpy.random.RandomState",
"numpy.hstack",
"sklearn.neighbors.NearestNeighbors",
"itertools.product",
"numpy.squeeze",
"numpy.vstack",
"numpy.unique"
] | [((260, 295), 'logging.getLogger', 'logging.getLogger', (['"""smote_variants"""'], {}), "('smote_variants')\n", (277, 295), False, 'import logging\n'), ((343, 366), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (364, 366), False, 'import logging\n'), ((392, 450), 'logging.Formatter', 'logging.Form... |
"""
"""
# IMPORT modules. Must have unittest, and probably coast.
import coast
from coast import general_utils
import unittest
import numpy as np
import os.path as path
import xarray as xr
import matplotlib.pyplot as plt
import unit_test_files as files
class test_transect_methods(unittest.TestCase):
def test_de... | [
"coast.TransectT",
"matplotlib.pyplot.close",
"coast.TransectF",
"numpy.isclose",
"coast.Gridded"
] | [((377, 481), 'coast.Gridded', 'coast.Gridded', (['files.fn_nemo_grid_t_dat'], {'fn_domain': 'files.fn_nemo_dom', 'config': 'files.fn_config_t_grid'}), '(files.fn_nemo_grid_t_dat, fn_domain=files.fn_nemo_dom, config\n =files.fn_config_t_grid)\n', (390, 481), False, 'import coast\n'), ((4641, 4752), 'coast.Gridded', ... |
import numpy as np
from csv import reader
from decimal import *
def SDM(datalist):
"""
้ๅทฎๆณ
:param datalist:
:return:
"""
length = len(datalist)
resultlist = []
halfLen = int(length/2)
for i in range(0, halfLen):
resultlist.append((Decimal(datalist[i+halfLen])... | [
"numpy.array",
"csv.reader"
] | [((566, 597), 'csv.reader', 'reader', (['raw_data'], {'delimiter': '""","""'}), "(raw_data, delimiter=',')\n", (572, 597), False, 'from csv import reader\n'), ((653, 668), 'numpy.array', 'np.array', (['overx'], {}), '(overx)\n', (661, 668), True, 'import numpy as np\n')] |
import pretty_midi
import numpy as np
'''
Note class: represent note, including:
1. the note pitch
2. the note duration
3. downbeat
4. intensity of note sound
'''
class Note:
def __init__(self):
self.pitch = 0
self.length = 0
self.downbeat = False
self.force = 0
... | [
"numpy.save",
"pretty_midi.PrettyMIDI"
] | [((1240, 1264), 'pretty_midi.PrettyMIDI', 'pretty_midi.PrettyMIDI', ([], {}), '()\n', (1262, 1264), False, 'import pretty_midi\n'), ((1277, 1305), 'pretty_midi.PrettyMIDI', 'pretty_midi.PrettyMIDI', (['path'], {}), '(path)\n', (1299, 1305), False, 'import pretty_midi\n'), ((613, 647), 'pretty_midi.PrettyMIDI', 'pretty_... |
"""Utility functions and classes for visualization and logging."""
import os
from datetime import datetime
import cv2
import imageio
import numpy as np
from allenact_plugins.manipulathor_plugin.manipulathor_utils import initialize_arm
from allenact_plugins.manipulathor_plugin.manipulathor_utils import (
reset_env... | [
"numpy.stack",
"allenact_plugins.manipulathor_plugin.manipulathor_utils.transport_wrapper",
"os.makedirs",
"cv2.imwrite",
"numpy.zeros",
"os.path.exists",
"datetime.datetime.now",
"allenact_plugins.manipulathor_plugin.manipulathor_utils.initialize_arm",
"allenact_plugins.manipulathor_plugin.manipula... | [((11803, 11834), 'os.path.join', 'os.path.join', (['gif_dir', 'gif_name'], {}), '(gif_dir, gif_name)\n', (11815, 11834), False, 'import os\n'), ((11896, 11931), 'numpy.zeros', 'np.zeros', (['(seq_len, w, h * cols, c)'], {}), '((seq_len, w, h * cols, c))\n', (11904, 11931), True, 'import numpy as np\n'), ((602, 616), '... |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from utils import read_ZINC_smiles, smiles_to_onehot, convert_to_graph
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
import sys
import time
# execution) python gcn_logP.py 3 64 256 0.001 gsc
# Def... | [
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.reduce_sum",
"utils.read_ZINC_smiles",
"numpy.abs",
"tensorflow.reshape",
"tensorflow.train.AdamOptimizer",
"tensorflow.matmul",
"matplotlib.pyplot.figure",
"tensorflow.Variable",
"numpy.arange",
"numpy.mean",
"tensorflow.multiply",
... | [((75, 100), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (93, 100), True, 'import matplotlib.pyplot as plt\n'), ((955, 978), 'utils.read_ZINC_smiles', 'read_ZINC_smiles', (['(50000)'], {}), '(50000)\n', (971, 978), False, 'from utils import read_ZINC_smiles, smiles_to_one... |
import numpy as np
from ROI_Arrival import ROI_Arrival,ROI_Location
#prefined imports
import sys,time,winsound
import numpy as np
from PyQt5.QtWidgets import (QApplication, QPushButton,QWidget,QGridLayout,
QSizePolicy,QLineEdit,
QMainWindow,QAction,QVBoxLayout
... | [
"PyQt5.QtWidgets.QLabel",
"ROI_Arrival.ROI_Arrival",
"ROI_Arrival.ROI_Location",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtGui.QFont",
"time.time",
"matplotlib.backends.backend_qt5agg.FigureCanvas",
"matplotlib.... | [((1247, 1254), 'PyQt5.QtGui.QFont', 'QFont', ([], {}), '()\n', (1252, 1254), False, 'from PyQt5.QtGui import QFont\n'), ((1611, 1636), 'PyQt5.QtWidgets.QAction', 'QAction', (['"""&Save Spectrum"""'], {}), "('&Save Spectrum')\n", (1618, 1636), False, 'from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QGri... |
from corner import corner
import numpy as np
CORNER_KWARGS = dict(
smooth=0.9,
label_kwargs=dict(fontsize=30),
title_kwargs=dict(fontsize=16),
color="tab:blue",
truth_color="tab:orange",
quantiles=[0.16, 0.84],
levels=(1 - np.exp(-0.5), 1 - np.exp(-2), 1 - np.exp(-9.0 / 2.0)),
plot_dens... | [
"corner.corner",
"numpy.exp"
] | [((742, 784), 'corner.corner', 'corner', (['df'], {'labels': 'labels'}), '(df, labels=labels, **CORNER_KWARGS)\n', (748, 784), False, 'from corner import corner\n'), ((252, 264), 'numpy.exp', 'np.exp', (['(-0.5)'], {}), '(-0.5)\n', (258, 264), True, 'import numpy as np\n'), ((270, 280), 'numpy.exp', 'np.exp', (['(-2)']... |
#Ref: <NAME>
"""
# TTA - Should be called prediction time augmentation
#We can augment each input image, predict augmented images and average all predictions
"""
import os
import cv2
from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
import random
model = tf.ker... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"tensorflow.keras.models.load_model",
"random.randint",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.flipud",
"numpy.expand_dims",
"numpy.fliplr",
"matplotlib.pyplot.figure",
"cv2.imread",
"numpy.array",
"PIL.Image.froma... | [((314, 416), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""mitochondria_load_from_disk_focal_dice_50epochs.hdf5"""'], {'compile': '(False)'}), "(\n 'mitochondria_load_from_disk_focal_dice_50epochs.hdf5', compile=False)\n", (340, 416), True, 'import tensorflow as tf\n'), ((564, 591), 'os.... |
import pandas as pd
import numpy as np
dataset_name = "Caltech"
relative = "../../../"
df = pd.read_csv(relative + "datasets/" + dataset_name + '/'+ dataset_name + '.csv', sep=";", header=None)
df = df.drop(0, 1)
print(df.describe())
print(df.nunique())
print(df.head())
print(df.shape)
df[11] = pd.Categorical... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"numpy.savetxt",
"umap.UMAP",
"pandas.Categorical"
] | [((96, 202), 'pandas.read_csv', 'pd.read_csv', (["(relative + 'datasets/' + dataset_name + '/' + dataset_name + '.csv')"], {'sep': '""";"""', 'header': 'None'}), "(relative + 'datasets/' + dataset_name + '/' + dataset_name +\n '.csv', sep=';', header=None)\n", (107, 202), True, 'import pandas as pd\n'), ((306, 328),... |
import data
import numpy as np
# TODO: split tests 1 test per assert statement
# TODO: move repeating constants out of functions
class TestHAPT:
def test_get_train_data(self):
d = data.HAPT()
assert d._train_attrs is None
d.get_train_data()
assert len(d._train_attrs) > 0
a... | [
"data.HAPT",
"numpy.array"
] | [((195, 206), 'data.HAPT', 'data.HAPT', ([], {}), '()\n', (204, 206), False, 'import data\n'), ((404, 415), 'data.HAPT', 'data.HAPT', ([], {}), '()\n', (413, 415), False, 'import data\n'), ((616, 627), 'data.HAPT', 'data.HAPT', ([], {}), '()\n', (625, 627), False, 'import data\n'), ((820, 831), 'data.HAPT', 'data.HAPT'... |
import numpy as np
from collections import namedtuple
from util import (
vec3d_to_array,
quat_to_array,
array_to_vec3d_pb,
array_to_quat_pb,
)
from radar_data_streamer import RadarData
from data_pb2 import Image
Extrinsic = namedtuple('Extrinsic', ['position', 'attitude'])
class RadarImage(RadarData)... | [
"util.array_to_quat_pb",
"util.quat_to_array",
"data_pb2.Image",
"numpy.frombuffer",
"util.vec3d_to_array",
"numpy.linalg.norm",
"collections.namedtuple",
"util.array_to_vec3d_pb"
] | [((241, 290), 'collections.namedtuple', 'namedtuple', (['"""Extrinsic"""', "['position', 'attitude']"], {}), "('Extrinsic', ['position', 'attitude'])\n", (251, 290), False, 'from collections import namedtuple\n'), ((1371, 1431), 'numpy.frombuffer', 'np.frombuffer', (['image_pb.cartesian.data.data'], {'dtype': 'np.uint3... |
import csv
import cv2
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from keras.models import Sequential
from keras.layers import Convolution2D,Flatten,Dense,Lambda
from keras import o... | [
"matplotlib.pyplot.title",
"keras.regularizers.l2",
"csv.reader",
"sklearn.model_selection.train_test_split",
"csv.Sniffer",
"matplotlib.pyplot.figure",
"keras.layers.Flatten",
"numpy.max",
"datetime.datetime.now",
"cv2.resize",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"keras.op... | [((1728, 1755), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(14, 7)'}), '(figsize=(14, 7))\n', (1738, 1755), True, 'import matplotlib.pyplot as plt\n'), ((1759, 1778), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Count"""'], {}), "('Count')\n", (1769, 1778), True, 'import matplotlib.pyplot as plt\n')... |
from keras.models import Sequential, load_model
from keras.callbacks import History, EarlyStopping, Callback
from keras.layers.recurrent import LSTM
from keras.layers import Bidirectional
from keras.losses import mse, binary_crossentropy,cosine
from keras.layers.core import Dense, Activation, Dropout
import numpy as np... | [
"keras.layers.core.Dense",
"keras.callbacks.History",
"keras.layers.core.Activation",
"tensorflow.keras.losses.CosineSimilarity",
"numpy.append",
"keras.callbacks.EarlyStopping",
"keras.layers.core.Dropout",
"keras.layers.recurrent.LSTM",
"keras.models.Sequential"
] | [((887, 899), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (897, 899), False, 'from keras.models import Sequential, load_model\n'), ((2012, 2024), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2022, 2024), False, 'from keras.models import Sequential, load_model\n'), ((784, 793), 'keras.callb... |
"""Module containing the CLI programs for histoprint."""
import numpy as np
import click
from histoprint import *
import histoprint.formatter as formatter
@click.command()
@click.argument("infile", type=click.Path(exists=True, dir_okay=False, allow_dash=True))
@click.option(
"-b",
"--bins",
type=str,
... | [
"click.version_option",
"click.option",
"click.echo",
"numpy.nanmin",
"click.command",
"click.open_file",
"numpy.histogram",
"numpy.linspace",
"click.Path",
"uproot.open",
"numpy.nanmax"
] | [((159, 174), 'click.command', 'click.command', ([], {}), '()\n', (172, 174), False, 'import click\n'), ((265, 375), 'click.option', 'click.option', (['"""-b"""', '"""--bins"""'], {'type': 'str', 'default': '"""10"""', 'help': '"""Number of bins or space-separated bin edges."""'}), "('-b', '--bins', type=str, default='... |
import unittest
import libpysal
from libpysal.common import pandas, RTOL, ATOL
from esda.geary_local_mv import Geary_Local_MV
import numpy as np
PANDAS_EXTINCT = pandas is None
class Geary_Local_MV_Tester(unittest.TestCase):
def setUp(self):
np.random.seed(100)
self.w = libpysal.io.open(libpysal.e... | [
"numpy.random.seed",
"unittest.TextTestRunner",
"unittest.TestSuite",
"esda.geary_local_mv.Geary_Local_MV",
"numpy.array",
"unittest.TestLoader",
"libpysal.examples.get_path"
] | [((803, 823), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (821, 823), False, 'import unittest\n'), ((1009, 1034), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (1032, 1034), False, 'import unittest\n'), ((256, 275), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(10... |
import pytorch_lightning as pl
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
from typing import List, Tuple, Dict, Any, Union, Iterable
try:
import genomics_gans
except:
exec(open('__init__.py').read())
import genomics_gans
from genomics_gans.prepare_data.data_module... | [
"pytorch_lightning.metrics.functional.classification.multiclass_auroc",
"matplotlib.pyplot.show",
"numpy.abs",
"torch.argmax",
"pytorch_lightning.metrics.functional.f1",
"pytorch_lightning.metrics.functional.accuracy",
"torch.nn.NLLLoss",
"torch.Tensor",
"numpy.arange",
"torch.zeros",
"matplotli... | [((917, 929), 'torch.nn.NLLLoss', 'nn.NLLLoss', ([], {}), '()\n', (927, 929), True, 'import torch.nn as nn\n'), ((7044, 7077), 'torch.argmax', 'torch.argmax', ([], {'input': 'logits', 'dim': '(1)'}), '(input=logits, dim=1)\n', (7056, 7077), False, 'import torch\n'), ((7707, 7751), 'pytorch_lightning.metrics.functional.... |
import os
import pickle
from collections import defaultdict
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats
def add_capitals(dico):
return {**dico, **{key[0].capitalize() + key[1:]: item for key, item in dico.items()}}
COLORS = {
'causal': 'blue',
'anti': 'red',
... | [
"collections.defaultdict",
"os.path.isfile",
"pickle.load",
"numpy.arange",
"os.path.join",
"matplotlib.pyplot.hlines",
"os.path.abspath",
"numpy.set_printoptions",
"matplotlib.pyplot.close",
"os.path.dirname",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.ylim",
"numpy.percentile",
"ma... | [((3201, 3248), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': 'figsize'}), '(nrows=1, ncols=1, figsize=figsize)\n', (3213, 3248), True, 'import matplotlib.pyplot as plt\n'), ((4291, 4338), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)'... |
# -*- coding: utf-8 -*-
"""
CW, FGSM, and IFGSM Attack CNN
"""
import torch._utils
try:
torch._utils._rebuild_tensor_v2
except AttributeError:
def _rebuild_tensor_v2(storage, storage_offset, size, stride, requires_grad, backward_hooks):
tensor = torch._utils._rebuild_tensor(storage, storage_offset, size... | [
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torch.autograd.Variable",
"torch.load",
"torch.nn.Conv2d",
"os.path.dirname",
"torch.nn.CrossEntropyLoss",
"torch._utils._rebuild_tensor",
"torch.cuda.FloatTensor",
"os.path.isfile",
"torch.clamp",
"numpy.array",
"torch.optim.Adam",
... | [((1203, 1255), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fool EnResNet"""'}), "(description='Fool EnResNet')\n", (1226, 1255), False, 'import argparse\n'), ((3100, 3189), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'paddi... |
# encoding: utf-8
__author__ = "<NAME>"
# Parts of the code have been taken from https://github.com/facebookresearch/fastMRI
import numpy as np
import pytest
import torch
from tests.collections.reconstruction.fastmri.create_temp_data import create_temp_data
# these are really slow - skip by default
SKIP_INTEGRATION... | [
"numpy.product",
"tests.collections.reconstruction.fastmri.create_temp_data.create_temp_data",
"pytest.fixture",
"torch.from_numpy"
] | [((632, 663), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (646, 663), False, 'import pytest\n'), ((927, 949), 'tests.collections.reconstruction.fastmri.create_temp_data.create_temp_data', 'create_temp_data', (['path'], {}), '(path)\n', (943, 949), False, 'from tests.coll... |
# TODOS
#--------------------------------------
# imports
import matplotlib.pyplot as plt
from atalaia.atalaia import Atalaia
import numpy as np
import networkx as nx
class Explore:
"""Explore is used for text exploratory tasks.
"""
def __init__(self, language:str):
"""
Parameters
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.bar",
"atalaia.atalaia.Atalaia",
"numpy.percentile",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((585, 607), 'atalaia.atalaia.Atalaia', 'Atalaia', (['self.language'], {}), '(self.language)\n', (592, 607), False, 'from atalaia.atalaia import Atalaia\n'), ((1116, 1133), 'numpy.array', 'np.array', (['lengths'], {}), '(lengths)\n', (1124, 1133), True, 'import numpy as np\n'), ((1854, 1890), 'matplotlib.pyplot.hist',... |
'''
gather redshift info across all observations for a given target type; for now from a single tile
'''
#test
#standard python
import sys
import os
import shutil
import unittest
from datetime import datetime
import json
import numpy as np
import fitsio
import glob
import argparse
from astropy.table import Table,join... | [
"os.mkdir",
"argparse.ArgumentParser",
"os.walk",
"os.path.exists",
"astropy.table.join",
"astropy.table.vstack",
"fitsio.read",
"numpy.unique"
] | [((383, 408), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (406, 408), False, 'import argparse\n'), ((1314, 1354), 'os.path.exists', 'os.path.exists', (["(svdir + 'redshift_comps')"], {}), "(svdir + 'redshift_comps')\n", (1328, 1354), False, 'import os\n'), ((1358, 1392), 'os.mkdir', 'os.mkdi... |
"""
This module constructs network of streets.
"""
import numpy as np
import json
# Adobe flat UI colour scheme
DARK_BLUE = "#2C3E50"
MEDIUM_BLUE = "#2980B9"
LIGHT_BLUE = "#3498DB"
RED = "#E74C3C"
WHITE = "#ECF0F1"
# Colour parameters
STROKE_COLOUR = DARK_BLUE
STREET_COLOUR = DARK_BLUE
JUNCTION_COLOUR = MEDIUM_BLUE
... | [
"json.dump",
"numpy.zeros",
"numpy.array",
"numpy.log10",
"numpy.delete"
] | [((2673, 2725), 'numpy.zeros', 'np.zeros', (['(self.__nodes, self.__nodes)'], {'dtype': 'np.int'}), '((self.__nodes, self.__nodes), dtype=np.int)\n', (2681, 2725), True, 'import numpy as np\n'), ((3291, 3318), 'numpy.zeros', 'np.zeros', (['(self.__nodes, 2)'], {}), '((self.__nodes, 2))\n', (3299, 3318), True, 'import n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#This script scores results from each student
#Drawn images are downloaded from a .csv file, converted from string base64 encoding,
#and scored against machine learning models saved to disk
import csv
import os
#import file
import cv2
import re
import base64
import nump... | [
"os.remove",
"csv.reader",
"csv.writer",
"tkinter.Button",
"csv.field_size_limit",
"tkinter.filedialog.askopenfilename",
"base64.b64decode",
"tkinter.filedialog.askdirectory",
"tkinter.simpledialog.askstring",
"cv2.imread",
"keras.models.model_from_json",
"numpy.array",
"numpy.amax",
"re.f... | [((741, 770), 'csv.field_size_limit', 'csv.field_size_limit', (['(2 ** 30)'], {}), '(2 ** 30)\n', (761, 770), False, 'import csv\n'), ((10354, 10361), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (10359, 10361), True, 'import tkinter as tk\n'), ((10412, 10481), 'tkinter.Button', 'tk.Button', (['root'], {'text': '"""Select ... |
from glob import glob
import os
import os.path as op
from shutil import copyfile
from nose.tools import assert_raises
import numpy as np
from numpy.testing import assert_array_almost_equal
import mne
from mne.datasets import testing
from mne.transforms import (Transform, apply_trans, rotation, translation,
... | [
"mne.coreg.fit_matched_points",
"os.remove",
"mne.utils._TempDir",
"mne.utils.run_tests_if_main",
"mne.setup_volume_source_space",
"mne.coreg.coregister_fiducials",
"glob.glob",
"numpy.testing.assert_array_almost_equal",
"os.path.join",
"mne.read_source_spaces",
"mne.source_space.write_source_sp... | [((6417, 6436), 'mne.utils.run_tests_if_main', 'run_tests_if_main', ([], {}), '()\n', (6434, 6436), False, 'from mne.utils import _TempDir, run_tests_if_main\n'), ((950, 1084), 'numpy.array', 'np.array', (['[[-0.08061612, -0.02908875, -0.04131077], [0.00146763, 0.08506715, -\n 0.03483611], [0.08436285, -0.02850276, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
#########
Reporting
#########
*Created on Thu Jun 8 14:40 2017 by <NAME>*
Tools for creating HTML Reports."""
import time
import base64
import os
import gc
import os.path as op
from string import Template
from io import BytesIO as IO
import pandas as pd
from rdkit... | [
"PIL.ImageChops.difference",
"cellpainting2.tools.load_config",
"PIL.Image.new",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.bar",
"IPython.core.display.HTML",
"gc.collect",
"os.path.isfile",
"matplotlib.pyplot.style.use",
"numpy.arange",
"cellpainting2.tools.parameters_from_act_profile_by_val",... | [((607, 632), 'cellpainting2.tools.load_config', 'cpt.load_config', (['"""config"""'], {}), "('config')\n", (622, 632), True, 'from cellpainting2 import tools as cpt\n'), ((684, 712), 'cellpainting2.tools.is_interactive_ipython', 'cpt.is_interactive_ipython', ([], {}), '()\n', (710, 712), True, 'from cellpainting2 impo... |
import numpy as np
import torch
# https://github.com/sfujim/TD3/blob/ade6260da88864d1ab0ed592588e090d3d97d679/utils.py
class ReplayBuffer(object):
def __init__(self, state_dim, action_dim, max_size=int(1e6)):
self.max_size = max_size
self.ptr = 0
self.size = 0
self.state = np.zero... | [
"numpy.load",
"numpy.save",
"numpy.float32",
"numpy.zeros",
"numpy.random.randint",
"torch.cuda.is_available",
"torch.from_numpy"
] | [((313, 344), 'numpy.zeros', 'np.zeros', (['(max_size, state_dim)'], {}), '((max_size, state_dim))\n', (321, 344), True, 'import numpy as np\n'), ((367, 399), 'numpy.zeros', 'np.zeros', (['(max_size, action_dim)'], {}), '((max_size, action_dim))\n', (375, 399), True, 'import numpy as np\n'), ((426, 457), 'numpy.zeros',... |
# Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"tensorflow.test.main",
"iree.tf.support.tf_utils.check_same",
"iree.tf.support.tf_utils.to_mlir_type",
"iree.tf.support.tf_utils.apply_function",
"numpy.array",
"absl.testing.parameterized.named_parameters",
"iree.tf.support.tf_utils.save_input_values"
] | [((823, 1008), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["[('int8_to_i8', np.int8, 'i8'), ('int32_to_i32', np.int32, 'i32'), (\n 'float32_to_f32', np.float32, 'f32'), ('float64_to_f64', np.float64, 'f64')\n ]"], {}), "([('int8_to_i8', np.int8, 'i8'), (\n 'int32_to_i32',... |
#!/usr/bin/env python
"""
Standard BOX 2D module with single joint
"""
import gym_rem2D.morph.module_utility as mu
from gym_rem.utils import Rot
from enum import Enum
import numpy as np
from Controller import m_controller
import random
import math
from gym_rem2D.morph import abstract_module
from gym_rem2D.morph i... | [
"gym_rem.utils.Rot.from_axis",
"gym_rem2D.morph.module_utility.create_joint",
"random.uniform",
"Box2D.b2RevoluteJoint",
"math.sin",
"numpy.array",
"math.cos",
"Box2D.b2CircleShape",
"random.gauss",
"Controller.m_controller.Controller"
] | [((770, 784), 'numpy.array', 'np.array', (['size'], {}), '(size)\n', (778, 784), True, 'import numpy as np\n'), ((981, 1006), 'numpy.array', 'np.array', (['[0.0, 0.0, 1.0]'], {}), '([0.0, 0.0, 1.0])\n', (989, 1006), True, 'import numpy as np\n'), ((1025, 1089), 'gym_rem.utils.Rot.from_axis', 'Rot.from_axis', (['self.co... |
import numpy as np
from multiprocessing import Pool
from ..bbox import bbox_overlaps
# https://zhuanlan.zhihu.com/p/34655990
def calc_PR_curve(pred, label):
pos = label[label == 1] # ๆญฃๆ ทๆฌ
threshold = np.sort(pred)[::-1] # predๆฏๆฏไธชๆ ทๆฌ็ๆญฃไพ้ขๆตๆฆ็ๅผ,้ๅบ
label = label[pred.argsort()[::-1]]
precision = []
rec... | [
"numpy.maximum",
"numpy.sum",
"numpy.zeros",
"numpy.ones",
"numpy.hstack",
"numpy.argsort",
"numpy.sort",
"numpy.cumsum",
"numpy.finfo",
"numpy.where",
"numpy.arange",
"numpy.array",
"multiprocessing.Pool",
"numpy.vstack"
] | [((934, 970), 'numpy.zeros', 'np.zeros', (['num_dets'], {'dtype': 'np.float32'}), '(num_dets, dtype=np.float32)\n', (942, 970), True, 'import numpy as np\n'), ((980, 1016), 'numpy.zeros', 'np.zeros', (['num_dets'], {'dtype': 'np.float32'}), '(num_dets, dtype=np.float32)\n', (988, 1016), True, 'import numpy as np\n'), (... |
"""
B-Complement
Input:
part point clouds: B x P x N x 3
Output:
R and T: B x P x(3 + 4)
Losses:
Center L2 Loss, Rotation L2 Loss, Rotation Chamder-Distance Loss
"""
import torch
from torch import nn
import torch.nn.functional as F
import sys, os
import numpy... | [
"torch.mean",
"os.path.abspath",
"cd.chamfer.chamfer_distance",
"torch.nn.BatchNorm1d",
"torch.nn.Conv1d",
"numpy.zeros",
"quaternion.qrot",
"torch.cat",
"numpy.random.normal",
"torch.nn.Linear",
"torch.zeros",
"torch.no_grad",
"os.path.join",
"torch.tensor"
] | [((355, 380), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (370, 380), False, 'import sys, os\n'), ((398, 432), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""../utils"""'], {}), "(BASE_DIR, '../utils')\n", (410, 432), False, 'import sys, os\n'), ((718, 737), 'torch.nn.Conv1d', 'nn.Conv1... |
import unittest
import os
import matplotlib.pyplot as plt
import numpy as np
from lorenz.lorenz import make_dataset, plot_3d
import lorenz.dataset
class TestDataset(unittest.TestCase):
def setUp(self):
self.path = os.path.join(os.path.split(os.path.split(os.path.dirname(__file__))[0])[0], 'data', 'lorenz... | [
"matplotlib.pyplot.show",
"lorenz.lorenz.plot_3d",
"os.path.dirname",
"numpy.random.RandomState",
"numpy.linspace"
] | [((380, 407), 'numpy.random.RandomState', 'np.random.RandomState', (['(1729)'], {}), '(1729)\n', (401, 407), True, 'import numpy as np\n'), ((684, 711), 'numpy.random.RandomState', 'np.random.RandomState', (['(1729)'], {}), '(1729)\n', (705, 711), True, 'import numpy as np\n'), ((595, 605), 'matplotlib.pyplot.show', 'p... |
from utilities import load_stf
import numpy as np
from scipy.spatial.distance import cosine
import time
#vsm = load_stf('glove.840B.300d.sample.txt',300)
#csm = np.load('centroids').item()
#distrib = np.zeros((100000,10))
#oFile = open('f_distrib','w+')
def dot_product(v1,v2):
total = 0
if len(v1) != len(v2):
thr... | [
"numpy.power",
"numpy.zeros"
] | [((788, 808), 'numpy.power', 'np.power', (['v1c', 'gamma'], {}), '(v1c, gamma)\n', (796, 808), True, 'import numpy as np\n'), ((1221, 1233), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (1229, 1233), True, 'import numpy as np\n'), ((1242, 1254), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (1250, 1254),... |
from data_collection.read_sentinel import pair_imagenames
from utils.set_user_input import set_arguments_pipeline
from utils.raster_helper import read_url_image, read_input_geometry, array2raster
import numpy as np
import rasterio
def compute_ndvi(band_inf, bands=["red", "nir"]):
"""
This function computes t... | [
"data_collection.read_sentinel.pair_imagenames",
"utils.raster_helper.array2raster",
"numpy.empty",
"utils.set_user_input.set_arguments_pipeline",
"numpy.where",
"utils.raster_helper.read_url_image",
"numpy.logical_or"
] | [((663, 698), 'data_collection.read_sentinel.pair_imagenames', 'pair_imagenames', (['red_band', 'nir_band'], {}), '(red_band, nir_band)\n', (678, 698), False, 'from data_collection.read_sentinel import pair_imagenames\n'), ((1229, 1283), 'numpy.empty', 'np.empty', (['band_red_image.shape'], {'dtype': 'rasterio.float32'... |
# -*- coding: utf-8 -*-
"""
Created on January 24, 2018
@author: neerbek
"""
# -*- coding: utf-8 -*-
import os
os.chdir("../../taboo-core")
from numpy.random import RandomState # type: ignore
from sklearn.cluster import KMeans # type: ignore
import ai_util
import confusion_matrix
import kmeans_cluster_util as kut... | [
"confusion_matrix.read_embeddings",
"ai_util.Timer",
"matplotlib.pyplot.plot",
"sklearn.cluster.KMeans",
"matplotlib.pyplot.legend",
"kmeans_cluster_util.get_base_accuracy",
"numpy.random.RandomState",
"kmeans_cluster_util.get_cluster_sen_ratios",
"importlib.reload",
"confusion_matrix.new_graph",
... | [((114, 142), 'os.chdir', 'os.chdir', (['"""../../taboo-core"""'], {}), "('../../taboo-core')\n", (122, 142), False, 'import os\n'), ((473, 507), 'importlib.reload', 'importlib.reload', (['confusion_matrix'], {}), '(confusion_matrix)\n', (489, 507), False, 'import importlib\n'), ((2524, 2553), 'ai_util.Timer', 'ai_util... |
"""
Tests for package pytools.viz.dendrogram
"""
# noinspection PyPackageRequirements
import hashlib
import logging
from io import StringIO
import numpy as np
# noinspection PyPackageRequirements
import pytest
# noinspection PyPackageRequirements
import scipy.cluster.hierarchy as hc
from pytools.viz.dendrogram imp... | [
"io.StringIO",
"pytools.viz.dendrogram.DendrogramReportStyle",
"scipy.cluster.hierarchy.linkage",
"pytest.raises",
"numpy.array",
"pytools.viz.dendrogram.LinkageTree",
"logging.getLogger"
] | [((384, 411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'import logging\n'), ((509, 558), 'numpy.array', 'np.array', (['[[i] for i in [2, 8, 0, 4, 1, 9, 9, 0]]'], {}), '([[i] for i in [2, 8, 0, 4, 1, 9, 9, 0]])\n', (517, 558), True, 'import numpy as np\n'), ((570, ... |
#!/usr/bin/python3
import sys
#sys.path.insert(0, "/usr/local/opencv3/lib/python2.7/site-packages/")
import argparse
#import commands
import cv2
import fnmatch
import numpy as np
import os.path
import random
import navpy
sys.path.append('../lib')
import AC3D
import Pose
import ProjectMgr
import SRTM
import transform... | [
"sys.path.append",
"argparse.ArgumentParser",
"numpy.linalg.inv",
"numpy.linspace",
"SRTM.NEDGround",
"AC3D.generate",
"ProjectMgr.ProjectMgr"
] | [((224, 249), 'sys.path.append', 'sys.path.append', (['"""../lib"""'], {}), "('../lib')\n", (239, 249), False, 'import sys\n'), ((617, 685), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Set the initial camera poses."""'}), "(description='Set the initial camera poses.')\n", (640, 685), ... |
import gc
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import torch
import torch.nn as nn
import torchvision
import sys
# To view tensorboard metrics
# tensorboard --logdir=logs --port=6006 --bind_all
from torch.utils.tensorboard import SummaryWriter
from functools import partial
fr... | [
"numpy.moveaxis",
"numpy.ones",
"ignite.engine.create_supervised_evaluator",
"torch.nn.NLLLoss",
"numpy.mean",
"landcover_dataloader.get_landcover_dataloaders",
"cuda_utils.maybe_get_cuda_device",
"torch.no_grad",
"cuda_utils.clear_cuda",
"os.path.join",
"numpy.std",
"torch.load",
"evolver.V... | [((1006, 1017), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1015, 1017), False, 'import os\n'), ((1065, 1111), 'os.path.join', 'os.path.join', (['base_dir', "('data/' + dataset_name)"], {}), "(base_dir, 'data/' + dataset_name)\n", (1077, 1111), False, 'import os\n'), ((1249, 1314), 'os.path.join', 'os.path.join', (['b... |
"""original source: https://github.com/chainer/chainerrl/pull/480
MIT License
Copyright (c) Preferred Networks, Inc.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import *
from future import stand... | [
"numpy.abs",
"argparse.ArgumentParser",
"chainerrl.explorers.Greedy",
"future.standard_library.install_aliases",
"q_functions.CNNBranchingQFunction",
"numpy.random.randint",
"expert_converter.choose_top_experts",
"expert_converter.fill_buffer",
"os.path.join",
"chainerrl.links.to_factorized_noisy"... | [((332, 366), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (364, 366), False, 'from future import standard_library\n'), ((1390, 1415), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1413, 1415), False, 'import argparse\n'), ((7221, 7248), 'lo... |
#!/usr/bin/env python3
import numpy as np
import matching.cr_search_validation_matcher
import utils.data_format_keys as dfk
import sys
from evaluation.link_metrics import LinkMetricsResults
from multiprocessing import Pool
from utils.utils import read_json, save_json
def modify_simple_threshold(dataset, threshold):... | [
"utils.utils.read_json",
"numpy.arange",
"utils.utils.save_json",
"multiprocessing.Pool"
] | [((1193, 1224), 'utils.utils.save_json', 'save_json', (['dataset', 'sys.argv[2]'], {}), '(dataset, sys.argv[2])\n', (1202, 1224), False, 'from utils.utils import read_json, save_json\n'), ((852, 874), 'utils.utils.read_json', 'read_json', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (861, 874), False, 'from utils.utils im... |
#!/usr/bin/env python3
#
# visualize_contingency_tables.py: Visualizes all contingency tables
# obtained by our method in the form of a diagram in the plane.
#
# Input: JSON file with shapelets
#
# Output: A set of points in the plane, each representing one table,
# such that the distance to the origin refers ... | [
"json.load",
"argparse.ArgumentParser",
"numpy.sign"
] | [((909, 979), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Contingency Table Visualization"""'}), "(description='Contingency Table Visualization')\n", (932, 979), False, 'import argparse\n'), ((1572, 1584), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1581, 1584), False, 'import js... |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # This is a data-parallelized Neural Network # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
############################################################################################################
#############################... | [
"numpy.zeros_like",
"warnings.filterwarnings",
"pandas.read_csv",
"numpy.power",
"numpy.zeros",
"functools.reduce",
"time.time",
"numpy.split",
"numpy.where",
"numpy.array",
"pandas.Series",
"numpy.exp",
"numpy.random.rand",
"numpy.dot",
"pandas.concat"
] | [((3562, 3584), 'numpy.dot', 'np.dot', (['inputs', 'theta1'], {}), '(inputs, theta1)\n', (3568, 3584), True, 'import numpy as np\n'), ((3617, 3635), 'numpy.dot', 'np.dot', (['a2', 'theta2'], {}), '(a2, theta2)\n', (3623, 3635), True, 'import numpy as np\n'), ((3702, 3728), 'numpy.where', 'np.where', (['(a3 >= 0.5)', '(... |
from cgbind.log import logger
from copy import deepcopy
import numpy as np
from cgbind.constants import Constants
from rdkit.Chem import AllChem
from scipy.optimize import minimize, Bounds
from scipy.spatial import distance_matrix
from cgbind import geom
from cgbind.atoms import get_vdw_radii
from cgbind.geom import ro... | [
"copy.deepcopy",
"numpy.outer",
"numpy.sum",
"cgbind.log.logger.info",
"cgbind.geom.rotation_matrix",
"rdkit.Chem.AllChem.ComputeMolVolume",
"cgbind.utils.copy_func",
"numpy.identity",
"numpy.zeros",
"scipy.spatial.distance_matrix",
"scipy.optimize.Bounds",
"numpy.array",
"numpy.exp",
"num... | [((8114, 8168), 'cgbind.utils.copy_func', 'copy_func', (['cage_subst_repulsion_and_electrostatic_func'], {}), '(cage_subst_repulsion_and_electrostatic_func)\n', (8123, 8168), False, 'from cgbind.utils import copy_func\n'), ((1265, 1307), 'scipy.spatial.distance_matrix', 'distance_matrix', (['cage_coords', 'subst_coords... |
from rdkit import Chem
import pandas as pd
import numpy as np
from tqdm import tqdm
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import RobustScaler
tqdm.pandas()
GLOBAL_SCALE = ['partial_charge', 'fukui_neu', 'fukui_elec']
ATOM_SCALE = ['NMR']
def check_chemprop_out(df):
invalid = ... | [
"pandas.DataFrame",
"sklearn.preprocessing.MinMaxScaler",
"tqdm.tqdm.pandas",
"numpy.finfo",
"numpy.array",
"rdkit.Chem.AddHs",
"pandas.isna",
"rdkit.Chem.MolFromSmiles"
] | [((179, 192), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (190, 192), False, 'from tqdm import tqdm\n'), ((4407, 4433), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['smiles'], {}), '(smiles)\n', (4425, 4433), False, 'from rdkit import Chem\n'), ((4443, 4456), 'rdkit.Chem.AddHs', 'Chem.AddHs', (['m'], {}... |
import pickle
import numpy as np
import pandas as pd
from numpy import linalg as LA
from scipy import stats
import sys
def compute_rmse(target, prediction):
"""Compute rmse between the ground truth and forecasts
Args:
target: a numpy array with ground truth
forecasts: a numpy array with forecasted val... | [
"numpy.quantile",
"numpy.sum",
"numpy.median",
"numpy.zeros",
"scipy.stats.gaussian_kde",
"numpy.percentile",
"numpy.mean",
"numpy.linalg.norm",
"scipy.stats.sem",
"numpy.dot",
"numpy.concatenate",
"numpy.sqrt"
] | [((1232, 1262), 'numpy.sum', 'np.sum', (['((y_true - y_pred) ** 2)'], {}), '((y_true - y_pred) ** 2)\n', (1238, 1262), True, 'import numpy as np\n'), ((1271, 1301), 'numpy.sum', 'np.sum', (['((y_true - y_mean) ** 2)'], {}), '((y_true - y_mean) ** 2)\n', (1277, 1301), True, 'import numpy as np\n'), ((2691, 2710), 'numpy... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 4 11:19:57 2018
@author: rwilson
"""
import pygmsh
import meshio
import numpy as np
import pickle
class utilities():
'''A collection of functions for interacting with the mesh object
'''
def meshOjfromDisk(meshObjectPath='cly.Mesh')... | [
"pickle.dump",
"pygmsh.generate_mesh",
"meshio.write",
"pickle.load",
"numpy.array",
"pygmsh.opencascade.Geometry",
"meshio.Mesh"
] | [((2184, 2213), 'pygmsh.opencascade.Geometry', 'pygmsh.opencascade.Geometry', ([], {}), '()\n', (2211, 2213), False, 'import pygmsh\n'), ((2589, 2615), 'pygmsh.generate_mesh', 'pygmsh.generate_mesh', (['geom'], {}), '(geom)\n', (2609, 2615), False, 'import pygmsh\n'), ((3385, 3447), 'meshio.Mesh', 'meshio.Mesh', (['sel... |
import itertools
from typing import List, DefaultDict, Tuple
import numpy as np
import pandas as pd
from sklearn.base import clone
from sklearn.metrics import roc_auc_score
# from sklearn.metrics import recall_score, accuracy_score, confusion_matrix
from sklearn.model_selection import KFold
from .categorical_encoders... | [
"pandas.DataFrame",
"pandas.get_dummies",
"sklearn.model_selection.KFold",
"sklearn.metrics.roc_auc_score",
"numpy.mean",
"pandas.concat",
"sklearn.base.clone"
] | [((1195, 1209), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1207, 1209), True, 'import pandas as pd\n'), ((4373, 4435), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'self.n_folds', 'shuffle': '(False)', 'random_state': 'None'}), '(n_splits=self.n_folds, shuffle=False, random_state=None)\n', (4... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 8 22:09:19 2017
@author: LinZhang
"""
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves impo... | [
"numpy.argmax",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.Variable",
"numpy.arange",
"tensorflow.nn.conv2d",
"tensorflow.truncated_normal",
"tensorflow.nn.softmax",
"tensorflow.nn.relu",
"six.moves.range",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.placeholder"... | [((2536, 2546), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2544, 2546), True, 'import tensorflow as tf\n'), ((844, 882), 'tensorflow.truncated_normal', 'tf.truncated_normal', (['shape'], {'stddev': '(0.1)'}), '(shape, stddev=0.1)\n', (863, 882), True, 'import tensorflow as tf\n'), ((894, 914), 'tensorflow.Varia... |
import os
import random
from contextlib import contextmanager
from typing import Generator
import numpy as np
import tensorflow as tf
from tensorflow.python.eager import context
from tensorflow.python.framework import config, ops
DIGITS = frozenset(str(i) for i in range(10))
@contextmanager
def tensorflow_random... | [
"tensorflow.random.set_seed",
"tensorflow.python.framework.config.is_op_determinism_enabled",
"numpy.random.seed",
"numpy.random.get_state",
"tensorflow.python.framework.config.enable_op_determinism",
"tensorflow.python.eager.context.global_seed",
"tensorflow.python.framework.ops.get_default_graph",
"... | [((409, 453), 'os.environ.get', 'os.environ.get', (['"""TF_DETERMINISTIC_OPS"""', 'None'], {}), "('TF_DETERMINISTIC_OPS', None)\n", (423, 453), False, 'import os\n'), ((478, 495), 'random.getstate', 'random.getstate', ([], {}), '()\n', (493, 495), False, 'import random\n'), ((523, 544), 'numpy.random.get_state', 'np.ra... |
"""
Search using NASA CMR
"""
from __future__ import division, unicode_literals, print_function, absolute_import
import json
import logging
import requests
import numpy as np
_logger = logging.getLogger(__name__)
from podpac.core.utils import _get_from_url
CMR_URL = r"https://cmr.earthdata.nasa.gov/search/"
def ... | [
"numpy.any",
"podpac.core.utils._get_from_url",
"logging.getLogger"
] | [((188, 215), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'import logging\n'), ((3485, 3632), 'numpy.any', 'np.any', (["[(m not in kwargs) for m in ['provider', 'provider_id', 'concept_id',\n 'collection_concept_id', 'short_name', 'version', 'entry_title']]"], {})... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by <NAME> <<EMAIL>>, January 2017
import os
import numpy as np
import pandas as pd
import scipy.io as sio
import util... | [
"pandas.DataFrame",
"scipy.io.loadmat",
"numpy.hstack",
"utils.datasets.load_data_from_pickle",
"os.path.split"
] | [((717, 759), 'utils.datasets.load_data_from_pickle', 'utils.load_data_from_pickle', (['__pickle_path'], {}), '(__pickle_path)\n', (744, 759), True, 'import utils.datasets as utils\n'), ((1102, 1126), 'scipy.io.loadmat', 'sio.loadmat', (['__data_path'], {}), '(__data_path)\n', (1113, 1126), True, 'import scipy.io as si... |
#!/usr/bin/env python3
import numpy as np
import pickle
from PIL import Image
w = pickle.load(open("weights1000.pkl", "rb"))
def Classify(example):
return w.dot(example)
#Seems to get 2, 3, 4 correct...
for i in range(0, 5):
image = Image.open("test_images/{}.jpg".format(i)).convert("L")
x = np.asarray(i... | [
"numpy.argmax"
] | [((464, 476), 'numpy.argmax', 'np.argmax', (['y'], {}), '(y)\n', (473, 476), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
#
# Tests for ``sim.py``
# These tests were hand calculated by <NAME>: <EMAIL>
#
from clusim.clustering import Clustering
import clusim.sim as sim
from clusim.dag import DAG
import clusim.clusimelement as clusimelement
from numpy.testing import assert_approx_equal
from numpy import mean
def ... | [
"clusim.sim.expected_mi",
"clusim.sim.expected_rand_index",
"clusim.clusimelement.element_sim_elscore",
"clusim.dag.DAG",
"clusim.clustering.Clustering",
"numpy.testing.assert_approx_equal",
"clusim.sim.count_pairwise_cooccurence"
] | [((499, 539), 'clusim.clustering.Clustering', 'Clustering', ([], {'elm2clu_dict': 'c1_elm2clu_dict'}), '(elm2clu_dict=c1_elm2clu_dict)\n', (509, 539), False, 'from clusim.clustering import Clustering\n'), ((549, 589), 'clusim.clustering.Clustering', 'Clustering', ([], {'elm2clu_dict': 'c2_elm2clu_dict'}), '(elm2clu_dic... |
import numpy as np
import scipy as sp
import scipy.spatial
import matplotlib as mpl
import matplotlib.path
from ..kernels.high_level.cauchy import Cauchy_Layer_Apply
from ..point_set import PointSet
def find_interior_points(source, target, boundary_acceptable=False):
"""
quick finding of which points in targe... | [
"numpy.zeros_like",
"numpy.abs",
"numpy.logical_not",
"numpy.zeros",
"numpy.logical_and.reduce",
"numpy.isnan",
"numpy.isinf",
"numpy.ones",
"numpy.logical_or",
"numpy.column_stack"
] | [((530, 626), 'numpy.logical_and.reduce', 'np.logical_and.reduce', (['[target.x > xmin, target.x < xmax, target.y > ymin, target.y < ymax]'], {}), '([target.x > xmin, target.x < xmax, target.y > ymin, \n target.y < ymax])\n', (551, 626), True, 'import numpy as np\n'), ((692, 723), 'numpy.logical_not', 'np.logical_no... |
import os.path as osp
import os
import time
from collections import defaultdict
import numpy as np
import tensorflow as tf
import moviepy.editor as mpy
import tqdm
from contextlib import contextmanager
from mpi4py import MPI
import imageio
from baselines import logger
import baselines.common.tf_util as U
from baselin... | [
"baselines.common.mpi_adam.MpiAdam",
"baselines.common.tf_util.get_session",
"baselines.common.tf_util.initialize",
"collections.defaultdict",
"tensorflow.assign",
"tensorflow.Variable",
"numpy.mean",
"numpy.linalg.norm",
"os.path.join",
"imageio.mimsave",
"baselines.common.tf_util.function",
... | [((847, 914), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'name': '"""global_step"""', 'dtype': 'tf.int64', 'trainable': '(False)'}), "(0, name='global_step', dtype=tf.int64, trainable=False)\n", (858, 914), True, 'import tensorflow as tf\n'), ((950, 999), 'tensorflow.assign', 'tf.assign', (['self.global_step', '(... |
import pymc as pm
import matplotlib.pyplot as plt
import numpy as np
plt.rc('font', family='Malgun Gothic')
lambda_ = pm.Exponential("poisson_param", 1)
data_generator = pm.Poisson("data_generater", lambda_)
data_plus_one = data_generator + 1
print(lambda_.children)
print(data_generator.parents)
# value
print(lambda... | [
"pymc.Poisson",
"matplotlib.pyplot.bar",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"pymc.rexponential",
"pymc.rpoisson",
"matplotlib.pyplot.rc",
"pymc.DiscreteUniform",
"pymc.Exponential",
"matplotlib.pyplot.show",
"pymc.Uniform",
"matplotlib.pyplot.legend",
"matplotlib.pyp... | [((70, 108), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""Malgun Gothic"""'}), "('font', family='Malgun Gothic')\n", (76, 108), True, 'import matplotlib.pyplot as plt\n'), ((119, 153), 'pymc.Exponential', 'pm.Exponential', (['"""poisson_param"""', '(1)'], {}), "('poisson_param', 1)\n", (133, 153), ... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib2tikz.save as tikz_save
import math
def derivative(y, h, n: int=1):
if n == 1:
return lambda x: (y(x + h) - y(x - h)) / (2 * h)
else:
return derivative(derivative(y, h, n - 1), h, 1)
def integral(y, h, a, b):
ret = 0
sgn = 1
if a > b:
... | [
"matplotlib.pyplot.title",
"numpy.vectorize",
"matplotlib.pyplot.axis",
"numpy.sin",
"numpy.arange",
"numpy.cos",
"matplotlib.pyplot.grid",
"numpy.sqrt"
] | [((1563, 1585), 'numpy.arange', 'np.arange', (['(-4)', '(4)', '(0.01)'], {}), '(-4, 4, 0.01)\n', (1572, 1585), True, 'import numpy as np\n'), ((1926, 1950), 'matplotlib.pyplot.axis', 'plt.axis', (['[-4, 4, -5, 5]'], {}), '([-4, 4, -5, 5])\n', (1934, 1950), True, 'import matplotlib.pyplot as plt\n'), ((1952, 1971), 'mat... |
# -*- coding: utf-8 -*-
'''
Custom theano class to query the search engine.
'''
import numpy as np
import theano
from theano import gof
from theano import tensor
import parameters as prm
import utils
import average_precision
import random
class Search(theano.Op):
__props__ = ()
def __init__(self,options):
... | [
"theano.tensor.as_tensor_variable",
"numpy.log",
"theano.tensor.itensor3",
"theano.Apply",
"theano.tensor.imatrix",
"theano.tensor.zeros_like",
"numpy.arange",
"theano.tensor.fmatrix",
"numpy.random.choice"
] | [((554, 583), 'theano.tensor.as_tensor_variable', 'tensor.as_tensor_variable', (['x1'], {}), '(x1)\n', (579, 583), False, 'from theano import tensor\n'), ((597, 626), 'theano.tensor.as_tensor_variable', 'tensor.as_tensor_variable', (['x2'], {}), '(x2)\n', (622, 626), False, 'from theano import tensor\n'), ((640, 669), ... |
"""Helper methods for Module 2."""
import errno
import glob
import os.path
import pickle
import time
import calendar
import numpy
import pandas
import matplotlib.colors
import matplotlib.pyplot as pyplot
import sklearn.metrics
import sklearn.linear_model
import sklearn.tree
import sklearn.ensemble
from module_4 import... | [
"matplotlib.pyplot.title",
"numpy.absolute",
"pickle.dump",
"numpy.sum",
"pandas.read_csv",
"module_4.attributes_diagrams.plot_attributes_diagram",
"numpy.mean",
"module_4.roc_curves.plot_roc_curve",
"glob.glob",
"pandas.DataFrame",
"numpy.std",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot... | [((1929, 1962), 'matplotlib.pyplot.rc', 'pyplot.rc', (['"""font"""'], {'size': 'FONT_SIZE'}), "('font', size=FONT_SIZE)\n", (1938, 1962), True, 'import matplotlib.pyplot as pyplot\n'), ((1963, 2001), 'matplotlib.pyplot.rc', 'pyplot.rc', (['"""axes"""'], {'titlesize': 'FONT_SIZE'}), "('axes', titlesize=FONT_SIZE)\n", (1... |
import cv2
import numpy as np
from pyzbar.pyzbar import decode
#This is the barcode testing phase. This allowed me to create the validation of the accounts.
img = cv2.imread('/home/pi/Resources12/frame (1).png')
cap = cv2.VideoCapture(0)
cap.set(3, 640)
cap.set(4, 480)
with open('/home.pi/Resources12\myDataFile.text... | [
"cv2.putText",
"cv2.polylines",
"cv2.waitKey",
"pyzbar.pyzbar.decode",
"cv2.VideoCapture",
"cv2.imread",
"numpy.array",
"cv2.imshow"
] | [((165, 213), 'cv2.imread', 'cv2.imread', (['"""/home/pi/Resources12/frame (1).png"""'], {}), "('/home/pi/Resources12/frame (1).png')\n", (175, 213), False, 'import cv2\n'), ((220, 239), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (236, 239), False, 'import cv2\n'), ((432, 443), 'pyzbar.pyzbar.decod... |
import requests, json, os, pickle
import networkx as nx
import GOSTnets as gn
import matplotlib.pyplot as plt
from matplotlib import gridspec
from time import sleep
import pandas as pd
import geopandas as gpd
import rasterio
from rasterio.windows import Window
from rasterio.plot import *
from rasterio.mask import *
i... | [
"pickle.dump",
"osmnx.pois_from_polygon",
"geopandas.sjoin",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"osmnx.pois_from_place",
"matplotlib.pyplot.Normalize",
"shapely.geometry.box",
"pandas.DataFrame",
"shapely.geometry.Point",
"contextily.add_basemap",
"GOSTnets.pandana_sn... | [((1396, 1410), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1408, 1410), True, 'import pandas as pd\n'), ((2279, 2294), 'numpy.arange', 'np.arange', (['olen'], {}), '(olen)\n', (2288, 2294), True, 'import numpy as np\n'), ((3901, 3957), 'geopandas.sjoin', 'gpd.sjoin', (['origins', 'bounds'], {'how': '"""inne... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 31 09:24:17 2017
@author: gao
ๅพๅฐ่ฏญ้ณๅๅชๅฃฐ็ๆททๅๆฐๆฎ ไปฅ.pkl็ๅฝขๅผๅญๆพๅจmix_dataไธญ
"""
import librosa as lr
import numpy as np
import os
import pickle
import matplotlib.pyplot as plt
from ams_extract import ams_extractor
resample_rate=16000
nfft = 512
offset = int(nfft/2)
def genAndSave... | [
"librosa.zero_crossings",
"pickle.dump",
"numpy.abs",
"numpy.angle",
"numpy.ones",
"librosa.resample",
"numpy.exp",
"librosa.feature.mfcc",
"numpy.std",
"librosa.core.db_to_amplitude",
"librosa.core.pitch_tuning",
"numpy.median",
"librosa.core.pitch.piptrack",
"librosa.load",
"librosa.co... | [((4283, 4303), 'os.listdir', 'os.listdir', (['filepath'], {}), '(filepath)\n', (4293, 4303), False, 'import os\n'), ((4356, 4377), 'os.listdir', 'os.listdir', (['filepath1'], {}), '(filepath1)\n', (4366, 4377), False, 'import os\n'), ((375, 408), 'librosa.load', 'lr.load', (['speech_fileName'], {'sr': 'None'}), '(spee... |
"""Compute stats on the results."""
import arviz as az
from datetime import datetime
import numpy as np
import pandas as pd
from pathlib import Path
from pystan.misc import _summary
from scipy.stats import nbinom
from tqdm.auto import tqdm
from warnings import warn
from .io import extract_samples
def get_rhat(fit) ... | [
"pandas.DataFrame",
"arviz.from_pystan",
"numpy.sum",
"pandas.read_csv",
"numpy.zeros",
"tqdm.auto.tqdm",
"numpy.shape",
"datetime.datetime.strptime",
"numpy.mean",
"pathlib.Path",
"numpy.exp",
"pandas.Series",
"numpy.where",
"arviz.waic",
"warnings.warn",
"arviz.loo",
"numpy.var",
... | [((523, 550), 'pystan.misc._summary', '_summary', (['fit', "['lp__']", '[]'], {}), "(fit, ['lp__'], [])\n", (531, 550), False, 'from pystan.misc import _summary\n'), ((565, 656), 'pandas.DataFrame', 'pd.DataFrame', (["x['summary']"], {'columns': "x['summary_colnames']", 'index': "x['summary_rownames']"}), "(x['summary'... |
import os
import sys
import numpy as np
import qcdb
from ..utils import *
@using("nwchem")
def test_grad():
h2o = qcdb.set_molecule(
"""
O 0.00000000 0.00000000 0.00000000
H 0.00000000 1.93042809 -1.10715266
H 0.00000000 -1.93042809 -1.10715266
... | [
"qcdb.variable",
"qcdb.set_options",
"numpy.array",
"qcdb.gradient",
"qcdb.set_molecule"
] | [((123, 337), 'qcdb.set_molecule', 'qcdb.set_molecule', (['"""\n O 0.00000000 0.00000000 0.00000000\n H 0.00000000 1.93042809 -1.10715266\n H 0.00000000 -1.93042809 -1.10715266\n units au"""'], {}), '(\n """\n O 0.00000000 0.00000000 0.00000... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: fnels
"""
import numpy as np
import maze
import random
import cv2
class EnvCleaner(object):
def __init__(self, N_agent, map_size, seed):
self.map_size = map_size
self.seed = seed
self.occupancy = self.generate_maze(seed)
... | [
"random.randint",
"cv2.waitKey",
"numpy.zeros",
"numpy.ones",
"cv2.rectangle",
"cv2.imshow"
] | [((4161, 4204), 'numpy.zeros', 'np.zeros', (['(self.map_size, self.map_size, 3)'], {}), '((self.map_size, self.map_size, 3))\n', (4169, 4204), True, 'import numpy as np\n'), ((5213, 5275), 'numpy.ones', 'np.ones', (['(self.map_size * enlarge, self.map_size * enlarge, 3)'], {}), '((self.map_size * enlarge, self.map_size... |
from collections import deque
import random
import numpy as np
import gym
from gym.wrappers import AtariPreprocessing
class Game():
def __init__(self, game_name, start_noop=2, last_n_frames=4, frameskip=4, grayscale_obs=True, scale_obs=False):
self.start_noop = start_noop
self.last_n_frames = ... | [
"random.randint",
"gym.make",
"gym.wrappers.AtariPreprocessing",
"numpy.clip",
"collections.deque"
] | [((392, 421), 'collections.deque', 'deque', (['[]', 'self.last_n_frames'], {}), '([], self.last_n_frames)\n', (397, 421), False, 'from collections import deque\n'), ((442, 461), 'gym.make', 'gym.make', (['game_name'], {}), '(game_name)\n', (450, 461), False, 'import gym\n'), ((778, 888), 'gym.wrappers.AtariPreprocessin... |
"""
Build ensemble models from ensemble of RandomForestRegressor models
"""
import sys
import numpy as np
import pandas as pd
import xarray as xr
import datetime as datetime
import sklearn as sk
from sklearn.ensemble import RandomForestRegressor
import glob
# import AC_tools (https://github.com/tsherwen/AC_tools.git)... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.externals.joblib.dump",
"os.remove",
"numpy.random.seed",
"sparse2spatial.RFRanalysis.add_ensemble_avg_std_to_dataset",
"sklearn.model_selection.train_test_split",
"gc.collect",
"sparse2spatial.utils.mk_da_of_predicted_values",
"glob.glob",
"AC_tool... | [((2564, 2601), 'sparse2spatial.utils.get_file_locations', 'utils.get_file_locations', (['"""data_root"""'], {}), "('data_root')\n", (2588, 2601), True, 'import sparse2spatial.utils as utils\n'), ((3096, 3127), 'sparse2spatial.utils.get_hyperparameter_dict', 'utils.get_hyperparameter_dict', ([], {}), '()\n', (3125, 312... |
# coding: utf-8
#
import numpy as np
import json
from socket import *
import select
import pygame
from pygame.locals import *
import sys
HOST = gethostname()
PORT = 1113
BUFSIZE = 1024
ADDR = ("127.0.0.1", PORT)
USER = 'Server'
INTERVAL=0.01
VEROCITY=100
LIFETIME=1000
#Window.fullscreen=True
class DataReceiver:
d... | [
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"numpy.frombuffer",
"numpy.zeros",
"pygame.init",
"numpy.isnan",
"pygame.time.wait",
"pygame.display.update",
"pygame.display.set_caption",
"sys.exit"
] | [((1600, 1613), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1611, 1613), False, 'import pygame\n'), ((1630, 1665), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(600, 400)'], {}), '((600, 400))\n', (1653, 1665), False, 'import pygame\n'), ((1667, 1708), 'pygame.display.set_caption', 'pygame.display.set_... |
# -*- coding: utf-8 -*-
import os,sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../../utility'))
sys.path.append(os.path.join(os.path.dirname(__file__), '../../network'))
import numpy as np
import tensorflow as tf
from agent import Agent
from eager_nn import ActorNet, CriticNet
from optimizer import *
fr... | [
"tensorflow.random.normal",
"eager_nn.ActorNet",
"eager_nn.CriticNet",
"os.path.dirname",
"OU_noise.OrnsteinUhlenbeckProcess",
"tensorflow.train.get_or_create_global_step",
"tensorflow.device",
"tensorflow.stop_gradient",
"tensorflow.minimum",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tens... | [((67, 92), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (82, 92), False, 'import os, sys\n'), ((141, 166), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (156, 166), False, 'import os, sys\n'), ((539, 591), 'OU_noise.OrnsteinUhlenbeckProcess', 'OrnsteinUhlenbeckP... |
# Author by CRS-club and wizard
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import numpy as np
import datetime
import logging
logger = logging.getLogger(__name__)
class MetricsCalculator():
def __init__(sel... | [
"numpy.argsort",
"numpy.zeros",
"numpy.array",
"logging.getLogger"
] | [((243, 270), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (260, 270), False, 'import logging\n'), ((2244, 2291), 'numpy.zeros', 'np.zeros', (['(batch_size, top_k)'], {'dtype': 'np.float32'}), '((batch_size, top_k), dtype=np.float32)\n', (2252, 2291), True, 'import numpy as np\n'), ((24... |
import numpy as np
from scipy.stats.mstats import theilslopes
from scipy.interpolate import CubicSpline
import matplotlib.pyplot as plt
# define constants
_c = 299792.458 # speed of light in km s^-1
class SpecAnalysis:
'''Analyse astronomy spectra.
'''
def __init__(self, wavelength, flux, flux_err=None)... | [
"matplotlib.pyplot.axvline",
"numpy.sum",
"matplotlib.pyplot.show",
"numpy.abs",
"numpy.polyfit",
"numpy.polyval",
"numpy.median",
"scipy.interpolate.CubicSpline",
"matplotlib.pyplot.legend",
"numpy.argmax",
"numpy.std",
"numpy.min",
"numpy.mean",
"numpy.array",
"numpy.max",
"numpy.lin... | [((8851, 8862), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (8859, 8862), True, 'import numpy as np\n'), ((8871, 8882), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (8879, 8882), True, 'import numpy as np\n'), ((8909, 8919), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (8916, 8919), True, 'import numpy as np... |
import numpy as np
#
class Rollout:
def __init__(self):
self.dict_obs = []
self.dict_next_obs = []
self.actions = []
self.rewards = []
self.terminals = []
self.agent_infos = []
self.env_infos = {}
self.path_length = 0
def __len__(self):
r... | [
"numpy.array",
"numpy.expand_dims"
] | [((909, 931), 'numpy.array', 'np.array', (['self.actions'], {}), '(self.actions)\n', (917, 931), True, 'import numpy as np\n'), ((1143, 1165), 'numpy.array', 'np.array', (['self.rewards'], {}), '(self.rewards)\n', (1151, 1165), True, 'import numpy as np\n'), ((1000, 1031), 'numpy.expand_dims', 'np.expand_dims', (['self... |
print('importing packages...')
import numpy as np
import cv2
import math
import random
import time
import rotate_brush as rb
import gradient
from thready import amap
import os
import threading
canvaslock = threading.Lock()
canvaslock.acquire()
canvaslock.release()
def lockgen(canvas,ym,yp,xm,xp):
# given roi, kno... | [
"os.mkdir",
"numpy.maximum",
"numpy.sum",
"numpy.mean",
"cv2.imshow",
"rotate_brush.get_brush",
"os.path.exists",
"threading.Lock",
"cv2.destroyAllWindows",
"cv2.resize",
"json.dump",
"cv2.waitKey",
"random.random",
"json.load",
"cv2.blur",
"time.time",
"gradient.get_phase",
"cv2.i... | [((207, 223), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (221, 223), False, 'import threading\n'), ((722, 742), 'cv2.imread', 'cv2.imread', (['filename'], {}), '(filename)\n', (732, 742), False, 'import cv2\n'), ((1378, 1393), 'random.random', 'random.random', ([], {}), '()\n', (1391, 1393), False, 'import r... |
import numpy as np
from numpy import vectorize
import scipy.optimize as so
@vectorize
def U(c, h, kappa, nu):
if c<=0:
u = -np.inf
elif c>0:
u = np.log(c) - (kappa*h**(1+1/nu))/((1+1/nu))
return u
class rep_ag:
def __init__(self, theta, beta, delta, kappa, nu, kmin, kmax, ... | [
"scipy.optimize.minimize",
"numpy.vectorize",
"numpy.flip",
"numpy.log",
"numpy.abs",
"numpy.arange",
"numpy.array",
"numpy.cos",
"numpy.linalg.inv",
"numpy.vstack"
] | [((732, 757), 'numpy.vectorize', 'np.vectorize', (['(lambda x: 1)'], {}), '(lambda x: 1)\n', (744, 757), True, 'import numpy as np\n'), ((774, 799), 'numpy.vectorize', 'np.vectorize', (['(lambda x: x)'], {}), '(lambda x: x)\n', (786, 799), True, 'import numpy as np\n'), ((1378, 1395), 'numpy.arange', 'np.arange', (['(0... |
import os
import sqlite3
import pandas as pd
import numpy as np
from .pybash import get_file_info
def connect_to_db(path):
"""
Interact with a SQLite database
Parameters
----------
path: str
Location of the SQLite database
Returns
-------
conn: Connector
The SQLite co... | [
"pandas.read_csv",
"sqlite3.connect",
"os.path.exists",
"numpy.ceil"
] | [((1773, 1801), 'os.path.exists', 'os.path.exists', (['path_to_file'], {}), '(path_to_file)\n', (1787, 1801), False, 'import os\n'), ((486, 506), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (500, 506), False, 'import os\n'), ((574, 595), 'sqlite3.connect', 'sqlite3.connect', (['path'], {}), '(path)\... |
"""
script to matrix normalization
"""
from functools import reduce
import math as m
import numpy as np
def minmax_normalization(x, type):
"""
:param x: column of matrix data
:param type: type of normalization
:return: min max normalized column of matrix data
"""
if min(x) == max(x):
... | [
"functools.reduce",
"numpy.log",
"numpy.ones",
"math.log"
] | [((1453, 1482), 'functools.reduce', 'reduce', (['(lambda a, b: a * b)', 'x'], {}), '(lambda a, b: a * b, x)\n', (1459, 1482), False, 'from functools import reduce\n'), ((328, 344), 'numpy.ones', 'np.ones', (['x.shape'], {}), '(x.shape)\n', (335, 344), True, 'import numpy as np\n'), ((1577, 1586), 'numpy.log', 'np.log',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
data4models.py
# Sentiment Indentification for Roman Urdu
'''
import numpy as np
import pandas as pd
class Data:
# Constructor
def __init__( self, config ):
self.config = config
def split( self, df ):
'''
Sp... | [
"numpy.shape",
"numpy.arange",
"numpy.delete",
"numpy.random.choice"
] | [((927, 947), 'numpy.arange', 'np.arange', (['n_dataset'], {}), '(n_dataset)\n', (936, 947), True, 'import numpy as np\n'), ((976, 1031), 'numpy.random.choice', 'np.random.choice', (['index_data', 'n_training'], {'replace': '(False)'}), '(index_data, n_training, replace=False)\n', (992, 1031), True, 'import numpy as np... |
# ---------------------------------------------------------------------------- #
# World Cup: Stats scanner
# Ver: 0.01
# ---------------------------------------------------------------------------- #
#
# Code by <NAME>
#
# ---------------------------------------------------------------------------- #
import os
impor... | [
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"numpy.load",
"numpy.save",
"pandas.isnull",
"time.sleep",
"selenium.webdriver.Chrome",
"os.chdir"
] | [((897, 1001), 'os.chdir', 'os.chdir', (['"""/mnt/aec0936f-d983-44c1-99f5-0f5b36390285/Dropbox/Python/Predictive Analytics FIFA"""'], {}), "(\n '/mnt/aec0936f-d983-44c1-99f5-0f5b36390285/Dropbox/Python/Predictive Analytics FIFA'\n )\n", (905, 1001), False, 'import os\n'), ((3265, 3308), 'selenium.webdriver.Chrome... |
# coding=utf-8
# Copyright (c) DIRECT Contributors
from typing import List, Optional, Tuple, Union
import numpy as np
from scipy.stats import multivariate_normal as normal
def simulate_sensitivity_maps(
shape: Union[List[int], Tuple[int]], num_coils: int, var: float = 1, seed: Optional[int] = None
) -> np.ndarr... | [
"numpy.stack",
"numpy.random.uniform",
"numpy.conj",
"numpy.random.seed",
"numpy.zeros",
"numpy.ones",
"scipy.stats.multivariate_normal",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"numpy.diag"
] | [((1211, 1238), 'numpy.stack', 'np.stack', (['meshgrid'], {'axis': '(-1)'}), '(meshgrid, axis=-1)\n', (1219, 1238), True, 'import numpy as np\n'), ((1262, 1291), 'numpy.zeros', 'np.zeros', (['(num_coils, *shape)'], {}), '((num_coils, *shape))\n', (1270, 1291), True, 'import numpy as np\n'), ((1405, 1417), 'numpy.diag',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 13:17:41 2018
@author: laurenwalters
"""
import numpy as np
import matplotlib.pyplot as plt
import random
#For saving/importing data
from numpy import asarray
from numpy import save
from numpy import load
#Created by <NAME>, 2018-2020
#Contribut... | [
"matplotlib.pyplot.subplot",
"numpy.load",
"numpy.save",
"matplotlib.pyplot.show",
"numpy.log",
"numpy.asarray",
"numpy.zeros",
"random.random",
"matplotlib.pyplot.figure",
"numpy.sort",
"numpy.array",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"nump... | [((734, 753), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (742, 753), True, 'import numpy as np\n'), ((10420, 10437), 'numpy.zeros', 'np.zeros', (['(65, 8)'], {}), '((65, 8))\n', (10428, 10437), True, 'import numpy as np\n'), ((27784, 27811), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1, 4)'], {}), ... |
# test bin, analyze, and plot functions
# imports
import os
from os.path import join
from os import listdir
import matplotlib.pyplot as plt
# imports
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
import filter
import analyze
from correction import correct
from utils import fit, function... | [
"utils.plotting.lighten_color",
"utils.functions.line",
"utils.io.read_calib_coords",
"utils.plotting.scatter_3d_and_spline",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"numpy.round",
"utils.bin.bin_by_list",
"matplotlib.pyplot.close",
"utils.plotting.plot_f... | [((681, 729), 'matplotlib.pyplot.style.use', 'plt.style.use', (["['science', 'ieee', 'std-colors']"], {}), "(['science', 'ieee', 'std-colors'])\n", (694, 729), True, 'import matplotlib.pyplot as plt\n'), ((740, 754), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (752, 754), True, 'import matplotlib.py... |
import pyart
import pydda
from matplotlib import pyplot as plt
import numpy as np
berr_grid = pyart.io.read_grid("berr_Darwin_hires.nc")
cpol_grid = pyart.io.read_grid("cpol_Darwin_hires.nc")
sounding = pyart.io.read_arm_sonde(
"/home/rjackson/data/soundings/twpsondewnpnC3.b1.20060119.231600.custom.cdf")
print(be... | [
"pyart.io.read_arm_sonde",
"matplotlib.pyplot.clabel",
"matplotlib.pyplot.show",
"matplotlib.pyplot.interactive",
"pyart.io.read_grid",
"matplotlib.pyplot.barbs",
"matplotlib.pyplot.colorbar",
"pydda.retrieval.get_dd_wind_field",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.pco... | [((95, 137), 'pyart.io.read_grid', 'pyart.io.read_grid', (['"""berr_Darwin_hires.nc"""'], {}), "('berr_Darwin_hires.nc')\n", (113, 137), False, 'import pyart\n'), ((150, 192), 'pyart.io.read_grid', 'pyart.io.read_grid', (['"""cpol_Darwin_hires.nc"""'], {}), "('cpol_Darwin_hires.nc')\n", (168, 192), False, 'import pyart... |
import numpy as np
# use nanmean from bottleneck if it's installed, otherwise use the numpy one
# bottleneck nanmean is ~2.5x faster
try:
import bottleneck as bn
nanmean = bn.nanmean
except ImportError:
nanmean = np.nanmean
from pytplot import get_data, store_data, options
from ...utilities.tnames import tn... | [
"pytplot.store_data",
"numpy.argmin",
"pytplot.get_data",
"numpy.isnan",
"pytplot.options",
"numpy.unique"
] | [((3932, 3952), 'numpy.argmin', 'np.argmin', (['time_size'], {}), '(time_size)\n', (3941, 3952), True, 'import numpy as np\n'), ((4035, 4057), 'numpy.argmin', 'np.argmin', (['energy_size'], {}), '(energy_size)\n', (4044, 4057), True, 'import numpy as np\n'), ((4408, 4443), 'pytplot.get_data', 'get_data', (['omni_vars[r... |
'''
tournament to rank refiners + discriminators for simgan
'''
import numpy as np
import pandas as pd
import torch
def get_graph_ratings(refiners,
discriminators,
validation_data,
device,
starting_rating=1500,
... | [
"pandas.DataFrame",
"torch.ones",
"numpy.sum",
"numpy.array",
"numpy.exp",
"torch.zeros",
"torch.round",
"torch.tensor"
] | [((2232, 2296), 'torch.zeros', 'torch.zeros', (['samples_per_match'], {'dtype': 'torch.float', 'device': 'device'}), '(samples_per_match, dtype=torch.float, device=device)\n', (2243, 2296), False, 'import torch\n'), ((2318, 2381), 'torch.ones', 'torch.ones', (['samples_per_match'], {'dtype': 'torch.float', 'device': 'd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.