code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import torch import networkx as nx import numpy as np from sklearn.manifold import TSNE from sklearn.decomposition import PCA import pickle as pkl import scipy.sparse as sp import torch.utils.data import itertools from collections import Counter from random import shuffle import json # from networkx.readwrite import js...
[ "networkx.barabasi_albert_graph", "networkx.connected_component_subgraphs", "numpy.random.rand", "numpy.exp2", "numpy.log", "numpy.array", "networkx.grid_2d_graph", "numpy.arange", "networkx.from_dict_of_lists", "numpy.mean", "numpy.less", "numpy.where", "networkx.is_connected", "numpy.sor...
[((602, 613), 'numpy.zeros', 'np.zeros', (['l'], {}), '(l)\n', (610, 613), True, 'import numpy as np\n'), ((643, 672), 'numpy.array', 'np.array', (['mask'], {'dtype': 'np.bool'}), '(mask, dtype=np.bool)\n', (651, 672), True, 'import numpy as np\n'), ((1587, 1597), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1595, ...
from numpy import cumprod, array def readf(filename, items): """ Read IDL arrays from a file filename - path of the file items - iterable of (func, shape) where func is applied to each split string of the file, then made into an array e.g. snaps, vels = readf('sfr.dat', [(...
[ "numpy.cumprod" ]
[((511, 525), 'numpy.cumprod', 'cumprod', (['shape'], {}), '(shape)\n', (518, 525), False, 'from numpy import cumprod, array\n')]
import torch import numpy as np import matplotlib.pyplot as plt def convert_tensor_to_RGB(network_output): x = torch.FloatTensor([[.0, .0, .0], [1.0, .0, .0], [.0, .0, 1.0], [.0, 1.0, .0]]) converted_tensor = torch.nn.functional.embedding(network_output, x).permute(2,0,1) return converted_tensor def dic...
[ "numpy.mean", "numpy.logical_and", "numpy.average", "torch.mean", "numpy.std", "torch.max", "numpy.max", "torch.min", "numpy.array", "torch.functional.F.softmax", "torch.reshape", "numpy.zeros", "numpy.sum", "torch.nn.functional.embedding", "numpy.min", "numpy.shape", "torch.std", ...
[((117, 208), 'torch.FloatTensor', 'torch.FloatTensor', (['[[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0]]'], {}), '([[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0,\n 1.0, 0.0]])\n', (134, 208), False, 'import torch\n'), ((875, 896), 'numpy.array', 'np.array', (['dice_scores'], {}), '(...
import numpy as np import networkx as nx import torch as th with open('1997.txt', 'r') as f: l = [[float(num) for num in line.split(' ')[:-1]] for line in f] mat=np.matrix(l) mat.resize((15, 15)) #print(mat.shape) G=nx.from_numpy_matrix(mat, create_using=nx.DiGraph)
[ "networkx.from_numpy_matrix", "numpy.matrix" ]
[((167, 179), 'numpy.matrix', 'np.matrix', (['l'], {}), '(l)\n', (176, 179), True, 'import numpy as np\n'), ((221, 271), 'networkx.from_numpy_matrix', 'nx.from_numpy_matrix', (['mat'], {'create_using': 'nx.DiGraph'}), '(mat, create_using=nx.DiGraph)\n', (241, 271), True, 'import networkx as nx\n')]
""" """ import copy import random, sys, time import torch import numpy as np from gmpy2 import mpz, powmod, invert, is_prime, random_state, mpz_urandomb, rint_round, log2, gcd, f_mod, f_div, sub, \ mul, add rand = random_state(random.randrange(sys.maxsize)) digits = 10e8 b = 10 class PrivateKey(obj...
[ "random.randrange", "gmpy2.gcd", "torch.Tensor", "gmpy2.powmod", "torch.from_numpy", "gmpy2.sub", "gmpy2.log2", "gmpy2.mpz_urandomb", "gmpy2.invert", "gmpy2.mul", "gmpy2.is_prime", "time.time", "gmpy2.mpz", "numpy.arange" ]
[((241, 270), 'random.randrange', 'random.randrange', (['sys.maxsize'], {}), '(sys.maxsize)\n', (257, 270), False, 'import random, sys, time\n'), ((1744, 1776), 'gmpy2.powmod', 'powmod', (['cipher', 'priv.l', 'pub.n_sq'], {}), '(cipher, priv.l, pub.n_sq)\n', (1750, 1776), False, 'from gmpy2 import mpz, powmod, invert, ...
import numpy as np import vrep import buffer class Script: def __init__(self, my_robot): self.robot = my_robot self.buffer = buffer.ReplayMemory(100) self.client_id = self.robot.client_id self.states = [] self.object_position = None self.euler_angles2 = None ...
[ "vrep.simxSynchronousTrigger", "vrep.simxGetPingTime", "vrep.simxSetObjectOrientation", "numpy.asarray", "numpy.floor", "vrep.simxGetObjectPosition", "numpy.array", "vrep.simxSetObjectPosition", "numpy.random.uniform", "numpy.linalg.norm", "vrep.simxGetObjectOrientation", "buffer.ReplayMemory"...
[((147, 171), 'buffer.ReplayMemory', 'buffer.ReplayMemory', (['(100)'], {}), '(100)\n', (166, 171), False, 'import buffer\n'), ((811, 928), 'vrep.simxGetObjectPosition', 'vrep.simxGetObjectPosition', (['self.robot.client_id', 'self.robot.sawyer_target_handle', '(-1)', 'vrep.simx_opmode_blocking'], {}), '(self.robot.cli...
import numpy as np def xr_merge(ds1, ds2, on, how='left', dim1='dim_0', dim2='dim_0', fill_value=np.nan): if how != 'left': raise NotImplementedError ds1 = ds1.copy() ds1 = ds1.reset_coords().set_coords(on) ds2 = ds2.reset_coords().set_coords(on) ds2 = ds2.rename({dim2: dim1})...
[ "numpy.array", "numpy.isfinite" ]
[((666, 683), 'numpy.isfinite', 'np.isfinite', (['idx2'], {}), '(idx2)\n', (677, 683), True, 'import numpy as np\n'), ((1160, 1174), 'numpy.array', 'np.array', (['fill'], {}), '(fill)\n', (1168, 1174), True, 'import numpy as np\n')]
##################################################################################### # MIT License # # # # Copyright (C) 2019 <NAME> ...
[ "python_speech_features.base.mfcc", "python_speech_features.delta", "python_speech_features.base.logfbank", "numpy.concatenate" ]
[((2554, 2595), 'python_speech_features.base.mfcc', 'mfcc', (['signal', 'rate'], {'numcep': 'filters_number'}), '(signal, rate, numcep=filters_number)\n', (2558, 2595), False, 'from python_speech_features.base import mfcc, logfbank\n'), ((2681, 2704), 'python_speech_features.delta', 'delta', (['mfcc_features', '(2)'], ...
from solvers.evolution.Chromosome_RandKey import Chromosome_RK import numpy as np import random, bisect class Population(object): def __init__(self, graph, size): self.specimen = list() self.graph = graph self.edgeList = list() for edge in graph.edgeList: self.edgeList....
[ "solvers.evolution.Chromosome_RandKey.Chromosome_RK", "numpy.argsort", "bisect.insort_left", "random.randint" ]
[((954, 990), 'bisect.insort_left', 'bisect.insort_left', (['self.specimen', 'x'], {}), '(self.specimen, x)\n', (972, 990), False, 'import random, bisect\n'), ((416, 435), 'solvers.evolution.Chromosome_RandKey.Chromosome_RK', 'Chromosome_RK', (['self'], {}), '(self)\n', (429, 435), False, 'from solvers.evolution.Chromo...
''' root/problems/problem_multiGaussian.py ''' ### packages import os import numpy as np import logging ### sys relative to root dir import sys from os.path import dirname, realpath sys.path.append(dirname(dirname(realpath(__file__)))) ### absolute imports wrt root from problems.problem_definition import ProblemDefi...
[ "misc.fake_mixturegauss.XLocations", "numpy.array", "logging.info", "misc.fake_mixturegauss.main", "matplotlib.pyplot.close", "os.path.isdir", "data.data_tools.ezData.ezData", "post_process.plot_things.plot_regression", "post_process.save_things.save_fitness_scores", "numpy.abs", "logging.warnin...
[((2961, 2985), 'misc.fake_mixturegauss.main', 'fake_mixturegauss.main', ([], {}), '()\n', (2983, 2985), False, 'from misc import fake_mixturegauss\n'), ((2998, 3029), 'misc.fake_mixturegauss.XLocations', 'fake_mixturegauss.XLocations', (['x'], {}), '(x)\n', (3026, 3029), False, 'from misc import fake_mixturegauss\n'),...
import math import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm, binom from kmeans import kmeans ######################### def adc_range(adc): # make sure you pick the right type, zeros_like copies type. adc_low = np.zeros_like(adc, dtype=np.float32) adc_high = np.zeros_like(...
[ "numpy.mean", "numpy.ceil", "numpy.reshape", "numpy.sqrt", "numpy.absolute", "kmeans.kmeans", "numpy.sum", "numpy.zeros", "numpy.array", "numpy.all", "numpy.zeros_like", "numpy.arange" ]
[((254, 290), 'numpy.zeros_like', 'np.zeros_like', (['adc'], {'dtype': 'np.float32'}), '(adc, dtype=np.float32)\n', (267, 290), True, 'import numpy as np\n'), ((306, 342), 'numpy.zeros_like', 'np.zeros_like', (['adc'], {'dtype': 'np.float32'}), '(adc, dtype=np.float32)\n', (319, 342), True, 'import numpy as np\n'), ((6...
import io import numpy as np import pdb import sys import tensorflow as tf import tensorflow_addons as tfa import tensorflow_datasets as tfds ''' Q: what is variables? ''' def get_char_LSTM(batch_size, vocab_size=11, embedding_size=512, variables=1, bidirectional=True, share_embeddings=True): lstm_features = 512 ...
[ "tensorflow.unstack", "tensorflow.keras.layers.Input", "numpy.round", "tensorflow.keras.losses.SparseCategoricalCrossentropy", "tensorflow.keras.optimizers.Adam", "tensorflow.keras.layers.Embedding", "tensorflow.GradientTape", "numpy.random.randint", "tensorflow.keras.layers.Dense", "numpy.sum", ...
[((4705, 4768), 'tensorflow.keras.losses.SparseCategoricalCrossentropy', 'tf.keras.losses.SparseCategoricalCrossentropy', ([], {'from_logits': '(True)'}), '(from_logits=True)\n', (4750, 4768), True, 'import tensorflow as tf\n'), ((4789, 4820), 'tensorflow.keras.optimizers.Adam', 'tf.keras.optimizers.Adam', (['(0.001)']...
#!/usr/bin/env python3 """Detect vanishing points in non-Manhattan world. Usage: eval_nyu.py [options] <yaml-config> <checkpoint> eval_nyu.py ( -h | --help ) Arguments: <yaml-config> Path to the yaml hyper-parameter file <checkpoint> Path to the checkpoint Options: -h...
[ "vpd.config.M.update", "numpy.arccos", "vpd.config.C.io.dataset.upper", "torch.cuda.device_count", "numpy.argsort", "numpy.array", "torch.cuda.is_available", "pprint.pprint", "docopt.docopt", "vpd.models.VanishingNet", "numpy.searchsorted", "numpy.random.seed", "numpy.concatenate", "numpy....
[((1383, 1402), 'numpy.argsort', 'np.argsort', (['(-scores)'], {}), '(-scores)\n', (1393, 1402), True, 'import numpy as np\n'), ((2287, 2316), 'numpy.searchsorted', 'np.searchsorted', (['x', 'threshold'], {}), '(x, threshold)\n', (2302, 2316), True, 'import numpy as np\n'), ((2325, 2365), 'numpy.concatenate', 'np.conca...
from sklearn.metrics import mean_squared_error from matplotlib import pyplot as plt from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from math import sqrt import numpy as np from P2_get_data import get_data epochs = 150 batch_size = 100 time_steps = 3 def LSTM_train(x_...
[ "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "P2_get_data.get_data", "keras.models.Sequential", "sklearn.metrics.mean_squared_error", "keras.layers.LSTM", "numpy.concatenate", "keras.layers.Dense", "matplotlib.pyplot.legend", "matplotlib.pyp...
[((365, 377), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (375, 377), False, 'from keras.models import Sequential\n'), ((712, 760), 'matplotlib.pyplot.plot', 'plt.plot', (["history.history['loss']"], {'label': '"""train"""'}), "(history.history['loss'], label='train')\n", (720, 760), True, 'from matplotl...
import numpy as np from sklearn.metrics import r2_score as sklearn_r2_score from tensorflow import convert_to_tensor from scikeras.wrappers import KerasRegressor from .mlp_models import dynamic_regressor def test_kerasregressor_r2_correctness(): """Test custom R^2 implementation against scikit-learn's.""" ...
[ "numpy.random.random_sample", "scikeras.wrappers.KerasRegressor", "numpy.random.randint", "numpy.testing.assert_almost_equal", "tensorflow.convert_to_tensor", "scikeras.wrappers.KerasRegressor.r_squared", "sklearn.metrics.r2_score", "numpy.arange" ]
[((367, 400), 'numpy.arange', 'np.arange', (['n_samples'], {'dtype': 'float'}), '(n_samples, dtype=float)\n', (376, 400), True, 'import numpy as np\n'), ((506, 548), 'numpy.random.random_sample', 'np.random.random_sample', ([], {'size': 'y_true.shape'}), '(size=y_true.shape)\n', (529, 548), True, 'import numpy as np\n'...
from .conftest import base_config import numpy as np from numpy.testing import assert_allclose, assert_array_equal import openamundsen as oa import openamundsen.errors as errors import pandas as pd import pytest import xarray as xr @pytest.mark.parametrize('fmt', ['netcdf', 'csv', 'memory']) def test_formats(fmt, tmp...
[ "pandas.Series", "openamundsen.OpenAmundsen", "pandas.read_csv", "numpy.testing.assert_allclose", "pytest.mark.parametrize", "numpy.issubdtype", "pytest.raises", "numpy.all", "xarray.open_dataset", "numpy.testing.assert_array_equal" ]
[((235, 294), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""fmt"""', "['netcdf', 'csv', 'memory']"], {}), "('fmt', ['netcdf', 'csv', 'memory'])\n", (258, 294), False, 'import pytest\n'), ((2693, 2758), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""write_freq"""', "['M', '7H', '3H', '10min']"...
from matplotlib.pyplot import figure, show from PIL import ImageDraw from numpy import array, linspace, meshgrid, pi, cos, sin def cylinderize(text:str) -> None: w,h = (len(max(text.split("\n"), key=len))+1)*6,(text.count("\n")+1)*15 im=ImageDraw.Image.new("L",(w,h)) ImageDraw.Draw(im).text((0,0),text...
[ "PIL.ImageDraw.Image.new", "numpy.linspace", "PIL.ImageDraw.Draw", "matplotlib.pyplot.figure", "numpy.cos", "numpy.array", "numpy.sin", "matplotlib.pyplot.show" ]
[((250, 282), 'PIL.ImageDraw.Image.new', 'ImageDraw.Image.new', (['"""L"""', '(w, h)'], {}), "('L', (w, h))\n", (269, 282), False, 'from PIL import ImageDraw\n'), ((565, 571), 'matplotlib.pyplot.show', 'show', ([], {}), '()\n', (569, 571), False, 'from matplotlib.pyplot import figure, show\n'), ((354, 376), 'numpy.lins...
import sys sys.path.insert(0, '.') import os import argparse import torch import torch.nn as nn from PIL import Image import numpy as np import cv2 import time import lib.transform_cv2 as T from lib.models import model_factory from configs import cfg_factory from lib.cityscapes_labels import trainId2color torch.set_...
[ "os.path.exists", "lib.transform_cv2.ToTensor", "sys.path.insert", "cv2.imwrite", "argparse.ArgumentParser", "os.path.makedirs", "torch.load", "torch.tensor", "numpy.random.randint", "numpy.random.seed", "time.time", "torch.set_grad_enabled", "cv2.resize", "cv2.imread", "torch.ones" ]
[((12, 35), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (27, 35), False, 'import sys\n'), ((310, 339), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (332, 339), False, 'import torch\n'), ((340, 359), 'numpy.random.seed', 'np.random.seed', (['(123)'...
# -*- coding: utf-8 -*- """ Created on Sat Jul 20 12:07:57 2019 @author: johnmount """ import numpy import pandas import vtreat.util import vtreat.transform class VarTransform: """build a treatment plan for a numeric outcome (regression)""" def __init__(self, incoming_column_name, derived_column_names, tr...
[ "numpy.mean", "numpy.sqrt", "pandas.merge", "numpy.log", "numpy.asarray", "pandas.SparseArray", "numpy.logical_not", "numpy.max", "numpy.isnan", "numpy.min", "pandas.DataFrame", "pandas.concat" ]
[((4277, 4299), 'numpy.sqrt', 'numpy.sqrt', (["sf['_var']"], {}), "(sf['_var'])\n", (4287, 4299), False, 'import numpy\n'), ((7099, 7142), 'pandas.DataFrame', 'pandas.DataFrame', (['{incoming_column_name: x}'], {}), '({incoming_column_name: x})\n', (7115, 7142), False, 'import pandas\n'), ((7766, 7792), 'pandas.DataFra...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 9 16:11:56 2019 @author: sjmoneyboss """ import pandas as pd import statsmodels from statsmodels.tsa.stattools import adfuller import statsmodels.api as sm import datetime import math import pandas_datareader.data as web import datetime as dt from...
[ "datetime.datetime", "numpy.roll", "statsmodels.tsa.stattools.adfuller", "pandas.read_csv", "pandas_datareader.data.DataReader", "numpy.log", "numpy.subtract", "math.log", "matplotlib.pyplot.axhline", "statsmodels.api.add_constant", "numpy.std", "statsmodels.api.OLS", "matplotlib.pyplot.lege...
[((1820, 1842), 'pandas.read_csv', 'pd.read_csv', (['filename1'], {}), '(filename1)\n', (1831, 1842), True, 'import pandas as pd\n'), ((1849, 1871), 'pandas.read_csv', 'pd.read_csv', (['filename2'], {}), '(filename2)\n', (1860, 1871), True, 'import pandas as pd\n'), ((2202, 2217), 'statsmodels.tsa.stattools.adfuller', ...
from __future__ import print_function import pickle import numpy import theano numpy.random.seed(42) def prepare_data(seqs, labels): """Create the matrices from the datasets. This pad each sequence to the same lenght: the lenght of the longuest sequence or maxlen. if maxlen is set, we will cut all ...
[ "numpy.ones", "numpy.round", "pickle.load", "numpy.max", "numpy.zeros", "numpy.random.seed", "numpy.arange", "numpy.random.shuffle" ]
[((80, 101), 'numpy.random.seed', 'numpy.random.seed', (['(42)'], {}), '(42)\n', (97, 101), False, 'import numpy\n'), ((496, 514), 'numpy.max', 'numpy.max', (['lengths'], {}), '(lengths)\n', (505, 514), False, 'import numpy\n'), ((1850, 1865), 'pickle.load', 'pickle.load', (['f1'], {}), '(f1)\n', (1861, 1865), False, '...
import math from collections import OrderedDict import logging logger = logging.getLogger(__name__) import numpy as np import torch import tensorflow as tf from paragen.generators import AbstractGenerator, register_generator from paragen.utils.io import remove from paragen.utils.runtime import Environment @register...
[ "logging.getLogger", "paragen.utils.runtime.Environment", "collections.OrderedDict", "tensorflow.device", "tensorflow.io.gfile.GFile", "operator.attrgetter", "tensorflow.math.cos", "tensorflow.math.sin", "torch.from_numpy", "h5py.File", "tensorflow.range", "numpy.concatenate", "paragen.utils...
[((72, 99), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (89, 99), False, 'import logging\n'), ((9774, 10507), 'collections.OrderedDict', 'OrderedDict', (["{'multihead_norm_scale': 'self_attn_norm.weight', 'multihead_norm_bias':\n 'self_attn_norm.bias', 'multihead_project_kernel_qkv'...
""" test_fitting_tanh.py Author: <NAME> Affiliation: University of Colorado at Boulder Created on: Mon May 12 14:19:33 MDT 2014 Description: Can run this in parallel. """ import time, ares import numpy as np import matplotlib.pyplot as pl # These go to every calculation base_pars = \ { 'problem_type': 101, 'tan...
[ "ares.inference.Priors.UniformPrior", "ares.inference.PriorSet", "ares.inference.FitGlobal21cm", "ares.inference.Priors.GaussianPrior", "time.time", "numpy.arange" ]
[((544, 585), 'ares.inference.FitGlobal21cm', 'ares.inference.FitGlobal21cm', ([], {}), '(**base_pars)\n', (572, 585), False, 'import time, ares\n'), ((857, 882), 'ares.inference.PriorSet', 'ares.inference.PriorSet', ([], {}), '()\n', (880, 882), False, 'import time, ares\n'), ((1365, 1376), 'time.time', 'time.time', (...
#-*- coding:utf-8 -*- """ GLSZM Copyright (c) 2016 <NAME> This software is released under the MIT License. http://opensource.org/licenses/mit-license.php Date: 2016/01/31 """ import numpy as np from matplotlib import pyplot as plt from TextureAnalysis.Utils import normalize from scipy.ndi...
[ "numpy.unique", "numpy.hstack", "scipy.ndimage.measurements.label", "TextureAnalysis.Utils.normalize", "numpy.array", "numpy.zeros", "numpy.vstack" ]
[((856, 903), 'TextureAnalysis.Utils.normalize', 'normalize', (['img', 'level_min', 'level_max', 'threshold'], {}), '(img, level_min, level_max, threshold)\n', (865, 903), False, 'from TextureAnalysis.Utils import normalize\n'), ((1528, 1558), 'numpy.vstack', 'np.vstack', (['((j,) * mat.shape[0])'], {}), '((j,) * mat.s...
import matplotlib matplotlib.use('Agg') import numpy as np import matplotlib.pyplot as plt import scipy.interpolate import tecplot as tp import wake_config as conf import matplotlib.ticker as ticker width = 3 #from helpers.setup_plot import * #plot_style = 'THESIS' #line_style, markers = setup_plot('THESIS', width, w...
[ "matplotlib.pyplot.savefig", "numpy.sqrt", "matplotlib.pyplot.ylabel", "matplotlib.use", "numpy.flipud", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.gca", "numpy.squeeze", "matplotlib.pyplot.close", "numpy.linspace", "matplotlib.pyplot.scatter", "matplotlib.pyplo...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((384, 414), 'numpy.linspace', 'np.linspace', (['(0)', '(2.0 / 9.0)', '(300)'], {}), '(0, 2.0 / 9.0, 300)\n', (395, 414), True, 'import numpy as np\n'), ((485, 516), 'numpy.linspace', 'np.linspace'...
""" ColorMatch RGB Colourspace ========================== Defines the *ColorMatch RGB* colourspace: - :attr:`colour.models.RGB_COLOURSPACE_COLOR_MATCH_RGB`. References ---------- - :cite:`Lindbloom2014a` : <NAME>. (2014). RGB Working Space Information. Retrieved April 11, 2014, from http://www.brucelindb...
[ "numpy.array", "colour.models.rgb.normalised_primary_matrix", "functools.partial", "numpy.linalg.inv" ]
[((1153, 1208), 'numpy.array', 'np.array', (['[[0.63, 0.34], [0.295, 0.605], [0.15, 0.075]]'], {}), '([[0.63, 0.34], [0.295, 0.605], [0.15, 0.075]])\n', (1161, 1208), True, 'import numpy as np\n'), ((1650, 1738), 'colour.models.rgb.normalised_primary_matrix', 'normalised_primary_matrix', (['PRIMARIES_COLOR_MATCH_RGB', ...
import networkit as nw from dwave_qbsolv import QBSolv import matplotlib.pyplot as plt import random from datetime import datetime import argparse import time import numpy as np import networkx as nx from qiskit import BasicAer from qiskit import QuantumCircuit, execute, Aer from qiskit.optimization.applications.ising ...
[ "networkit.nxadapter.nx2nk", "QAOAKit.qaoa.get_maxcut_qaoa_circuit", "qiskit.algorithms.optimizers.L_BFGS_B", "random.randint", "random.shuffle", "argparse.ArgumentParser", "numpy.full", "time.perf_counter", "networkit.nxadapter.nk2nx", "dwave_qbsolv.QBSolv", "numpy.random.seed", "numpy.random...
[((670, 695), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (693, 695), False, 'import argparse\n'), ((27983, 28002), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (28000, 28002), False, 'import time\n'), ((28103, 28122), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n'...
import time import numpy as np from airobot import Robot from airobot import log_warn from airobot.utils.common import euler2quat def main(): """ This function shows an example of block stacking. """ np.set_printoptions(precision=4, suppress=True) robot = Robot('franka') success = robot.arm....
[ "time.sleep", "numpy.zeros", "airobot.utils.common.euler2quat", "airobot.Robot", "airobot.log_warn", "numpy.set_printoptions" ]
[((220, 267), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'suppress': '(True)'}), '(precision=4, suppress=True)\n', (239, 267), True, 'import numpy as np\n'), ((280, 295), 'airobot.Robot', 'Robot', (['"""franka"""'], {}), "('franka')\n", (285, 295), False, 'from airobot import Robot\n'), ...
""" Copyright (c) 2020 Intel Corporation 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 in wri...
[ "torch.onnx.symbolic_helper.parse_args", "numpy.uint8", "PIL.Image.fromarray", "torch.onnx.symbolic_opset9.reshape", "scripts.default_config.get_default_config", "numpy.random.rand", "argparse.ArgumentParser", "torch.onnx.symbolic_registry.register_op", "torch.onnx.export", "torchreid.utils.load_p...
[((997, 1037), 'torch.onnx.symbolic_helper.parse_args', 'parse_args', (['"""v"""', '"""i"""', '"""v"""', '"""v"""', '"""f"""', '"""i"""'], {}), "('v', 'i', 'v', 'v', 'f', 'i')\n", (1007, 1037), False, 'from torch.onnx.symbolic_helper import parse_args\n'), ((2395, 2414), 'numpy.uint8', 'np.uint8', (['(img * 255)'], {})...
import sys import os import torch import yaml from easydict import EasyDict as edict from pytorch_transformers.tokenization_bert import BertTokenizer from vilbert.datasets import ConceptCapLoaderTrain, ConceptCapLoaderVal from vilbert.vilbert import VILBertForVLTasks, BertConfig, BertForMultiModalPreTraining from vilb...
[ "maskrcnn_benchmark.config.cfg.merge_from_file", "torch.from_numpy", "torch.full_like", "numpy.array", "maskrcnn_benchmark.modeling.detector.build_detection_model", "torch.nn.functional.softmax", "numpy.save", "matplotlib.pyplot.imshow", "numpy.repeat", "argparse.ArgumentParser", "numpy.max", ...
[((10870, 10885), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (10880, 10885), True, 'import matplotlib.pyplot as plt\n'), ((10895, 10904), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (10902, 10904), True, 'import matplotlib.pyplot as plt\n'), ((11540, 11592), 'matplotlib.pyplot.subplot...
""" Routines for Fourier transform. """ from __future__ import division from ..datatable.wrapping import wrap from ..datatable import column from . import waveforms, specfunc import numpy as np import numpy.fft as fft def truncate_len_pow2(trace, truncate_power=None): """ Truncate trace length to t...
[ "numpy.sqrt", "numpy.fft.fft", "numpy.column_stack", "numpy.real", "numpy.zeros", "numpy.array", "numpy.concatenate", "numpy.fft.ifft" ]
[((8192, 8212), 'numpy.fft.ifft', 'fft.ifft', (['ft_ordered'], {}), '(ft_ordered)\n', (8200, 8212), True, 'import numpy.fft as fft\n'), ((11132, 11149), 'numpy.real', 'np.real', (['ft[0, 1]'], {}), '(ft[0, 1])\n', (11139, 11149), True, 'import numpy as np\n'), ((5181, 5202), 'numpy.fft.fft', 'fft.fft', (['trace_values'...
# Copyright 2021 Institute of Advanced Research in Artificial Intelligence (IARAI) GmbH. # IARAI licenses this file to You 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/li...
[ "numpy.clip", "tempfile.TemporaryDirectory", "util.h5_util.write_data_to_h5", "util.h5_util.load_h5_file", "pathlib.Path", "numpy.random.random", "numpy.zeros", "numpy.argwhere" ]
[((942, 983), 'numpy.zeros', 'np.zeros', ([], {'shape': '(5, 5, 5)', 'dtype': 'np.uint8'}), '(shape=(5, 5, 5), dtype=np.uint8)\n', (950, 983), True, 'import numpy as np\n'), ((1002, 1023), 'numpy.clip', 'np.clip', (['data', '(0)', '(255)'], {}), '(data, 0, 255)\n', (1009, 1023), True, 'import numpy as np\n'), ((1078, 1...
import numpy as np class Channel: def __init__(self, inst): """Initializes a new device. Args: inst -- instrument in which the channels are """ self.inst = inst self.inst.write(":WAV:FORM BYTE") self.inst.write(":WAV:POIN:MODE MAX") def get_time_scale(...
[ "numpy.frombuffer" ]
[((5029, 5063), 'numpy.frombuffer', 'np.frombuffer', (['rawdata[10:-1]', '"""B"""'], {}), "(rawdata[10:-1], 'B')\n", (5042, 5063), True, 'import numpy as np\n')]
import numpy as np import utils def mk_training_matrices(pairs, en_dimension, cat_dimension, english_space, catalan_space): en_mat = np.zeros((len(pairs),en_dimension)) cat_mat = np.zeros((len(pairs),cat_dimension)) c = 0 for p in pairs: en_word,cat_word = p.split() en_mat[c] = englis...
[ "utils.readDM", "utils.neighbours", "numpy.dot", "numpy.linalg.lstsq" ]
[((661, 699), 'utils.readDM', 'utils.readDM', (['"""data/english.subset.dm"""'], {}), "('data/english.subset.dm')\n", (673, 699), False, 'import utils\n'), ((716, 754), 'utils.readDM', 'utils.readDM', (['"""data/catalan.subset.dm"""'], {}), "('data/catalan.subset.dm')\n", (728, 754), False, 'import utils\n'), ((1678, 1...
import tensorflow as tf import numpy as np from models.tf_model import TFModel class RNN(TFModel): def input_layer(self): ''' Data and Hyperparameters ''' with tf.variable_scope("input_layer"): # Tensor containing word ids # shape = (batch size, max leng...
[ "tensorflow.shape", "tensorflow.nn.bidirectional_dynamic_rnn", "tensorflow.boolean_mask", "tensorflow.nn.sparse_softmax_cross_entropy_with_logits", "tensorflow.contrib.rnn.GRUCell", "tensorflow.contrib.rnn.LSTMCell", "tensorflow.reduce_mean", "tensorflow.nn.embedding_lookup", "tensorflow.placeholder...
[((12229, 12251), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (12249, 12251), True, 'import tensorflow as tf\n'), ((202, 234), 'tensorflow.variable_scope', 'tf.variable_scope', (['"""input_layer"""'], {}), "('input_layer')\n", (219, 234), True, 'import tensorflow as tf\n'), ((373, 434), 't...
import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.cm as cm from matplotlib.lines import Line2D def plotMeasurement(L, indices, measurements, s=0.25, filename=None, title=None, url=None): fig = plt.figure() axes = fig.add_subplot(111, pro...
[ "matplotlib.pyplot.figure", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.get_cmap" ]
[((272, 284), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (282, 284), True, 'import matplotlib.pyplot as plt\n'), ((420, 442), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""plasma"""'], {}), "('plasma')\n", (432, 442), True, 'import matplotlib.pyplot as plt\n'), ((1026, 1048), 'numpy.arange', 'np....
from scipy.spatial.distance import cdist import matplotlib.pyplot as plt from numpy.linalg import eig from PIL import Image import numpy as np import argparse import glob import time import os parser = argparse.ArgumentParser() parser.add_argument("--kernel-type", type=str, default="rbf", help="k...
[ "numpy.uint8", "numpy.sqrt", "numpy.argsort", "numpy.array", "numpy.count_nonzero", "numpy.save", "os.path.exists", "argparse.ArgumentParser", "os.path.normpath", "numpy.exp", "os.path.isdir", "os.mkdir", "matplotlib.pyplot.scatter", "numpy.min", "numpy.argmin", "glob.glob", "matplot...
[((205, 230), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (228, 230), False, 'import argparse\n'), ((1472, 1499), 'numpy.array', 'np.array', (['coor'], {'dtype': 'float'}), '(coor, dtype=float)\n', (1480, 1499), True, 'import numpy as np\n'), ((2256, 2282), 'os.path.normpath', 'os.path.normp...
# Copyright 2018 DeepMind Technologies Limited. All rights reserved. # # 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 ...
[ "numpy.prod", "acme.tf.networks.ClipToSpec", "acme.tf.utils.create_variables", "acme.tf.networks.MultivariateNormalDiagHead", "acme.tf.networks.GaussianMixtureHead", "acme.tf.utils.to_sonnet_module", "acme.tf.networks.LayerNormMLP" ]
[((1395, 1429), 'numpy.prod', 'np.prod', (['act_spec.shape'], {'dtype': 'int'}), '(act_spec.shape, dtype=int)\n', (1402, 1429), True, 'import numpy as np\n'), ((1573, 1620), 'acme.tf.utils.to_sonnet_module', 'tf2_utils.to_sonnet_module', (['observation_network'], {}), '(observation_network)\n', (1599, 1620), True, 'fro...
#Script Goal: it will predict the annotations and send back (letter,confidence,(x,y,w,h)) for a set of images #run this script in cmd by locating into the darknet folder import cv2 import numpy as np import glob2 from pandas import DataFrame import darknet import sys import itertools from tqdm import tqdm sys.path....
[ "itertools.chain", "glob2.glob", "darknet.network_width", "sys.path.insert", "darknet.free_image", "darknet.draw_boxes", "darknet.load_network", "numpy.array", "darknet.detect_image", "darknet.make_image", "cv2.cvtColor", "pandas.DataFrame", "darknet.network_height", "cv2.resize", "cv2.i...
[((311, 362), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/mekeneocr/myUniverse/darknet"""'], {}), "(0, '/mekeneocr/myUniverse/darknet')\n", (326, 362), False, 'import sys\n'), ((620, 677), 'darknet.load_network', 'darknet.load_network', (['config', 'data', 'weights'], {'batch_size': '(1)'}), '(config, data, wei...
# python3.6 import random import base64 from paho.mqtt import client as mqtt_client broker = '172.16.58.3' port = 1883 topic = "info/12340000000000" # generate client ID with pub prefix randomly client_id = f'python-mqtt-{random.randint(0, 100)}' # username = 'emqx' # password = '<PASSWORD>' def ecg(mensagem): ...
[ "paho.mqtt.client.Client", "numpy.core.fromnumeric.size", "random.randint" ]
[((1923, 1952), 'paho.mqtt.client.Client', 'mqtt_client.Client', (['client_id'], {}), '(client_id)\n', (1941, 1952), True, 'from paho.mqtt import client as mqtt_client\n'), ((226, 248), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (240, 248), False, 'import random\n'), ((1084, 1100), 'numpy...
from pudding.clustering import kmeans import pytest import numpy as np from sklearn.datasets import make_blobs import pudding def testKmeansToyData(): ''' Test KMeans uisng a toy dataset ''' X = [[0.0, 0.0], [0.5, 0.0], [0.5, 1.0], [1.0, 1.0]] initial_centers = [[0.0, 0.0], [1.0, 1.0]] expecte...
[ "pytest.approx", "sklearn.datasets.make_blobs", "numpy.array", "numpy.random.seed", "pudding.clustering.KMeans" ]
[((1473, 1493), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1487, 1493), True, 'import numpy as np\n'), ((1575, 1647), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n_examples', 'centers': 'truth_centers', 'cluster_std': '(0.7)'}), '(n_samples=n_examples, centers=truth_centers...
import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras.layers import Dense, Flatten, Conv2D, Input, BatchNormalization, Activation, Add import os import math from typing import Optional, Dict, Tuple, Any from game import Game, State import constants as c os.environ['TF_CPP_MIN_L...
[ "tensorflow.keras.layers.Input", "numpy.flip", "tensorflow.keras.Model", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.Add", "tensorflow.keras.layers.BatchNormalization", "numpy.array", "numpy.zeros", "game.Game.get_legal_moves", "tensorflow.keras.layers.Dense", "tensorflow.optimize...
[((7261, 7300), 'game.Game', 'Game', (['"""8/1P3k2/8/8/8/8/4K3/8 w - - 0 1"""'], {}), "('8/1P3k2/8/8/8/8/4K3/8 w - - 0 1')\n", (7265, 7300), False, 'from game import Game, State\n'), ((382, 407), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (397, 407), False, 'import os\n'), ((1099, 1142), ...
import pandas as pd import matplotlib.pyplot as plt import datetime import torch import torch.nn as nn import numpy as np from torch.utils.data import Dataset, DataLoader def generate_df_affect_by_n_days(series, n, index=False): if len(series) <= n: raise Exception("The Length of series is %d, while affec...
[ "torch.squeeze", "numpy.mean", "pandas.read_csv", "torch.utils.data.DataLoader", "torch.nn.LSTM", "torch.unsqueeze", "torch.load", "matplotlib.pyplot.plot", "torch.Tensor", "numpy.array", "torch.nn.MSELoss", "torch.save", "numpy.std", "pandas.DataFrame", "torch.nn.Linear", "matplotlib....
[((2113, 2158), 'matplotlib.pyplot.plot', 'plt.plot', (['df_index', 'df_all'], {'label': '"""real-data"""'}), "(df_index, df_all, label='real-data')\n", (2121, 2158), True, 'import matplotlib.pyplot as plt\n'), ((2171, 2183), 'numpy.array', 'np.array', (['df'], {}), '(df)\n', (2179, 2183), True, 'import numpy as np\n')...
import numpy from neural_network import NeuralNetwork NR_INPUT_NODES = 784 NR_HIDDEN_NODES = 200 NR_OUTPUT_NODES = 10 LEARNING_RATE = 0.1 EPOCH = 5 neural_network = NeuralNetwork(NR_INPUT_NODES, NR_HIDDEN_NODES, NR_OUTPUT_NODES, LEARNING_RATE) training_data_file = open('dataset/training/mnist_train.csv') training_...
[ "neural_network.NeuralNetwork", "numpy.asarray", "numpy.argmax", "numpy.asfarray", "numpy.zeros" ]
[((169, 247), 'neural_network.NeuralNetwork', 'NeuralNetwork', (['NR_INPUT_NODES', 'NR_HIDDEN_NODES', 'NR_OUTPUT_NODES', 'LEARNING_RATE'], {}), '(NR_INPUT_NODES, NR_HIDDEN_NODES, NR_OUTPUT_NODES, LEARNING_RATE)\n', (182, 247), False, 'from neural_network import NeuralNetwork\n'), ((1386, 1410), 'numpy.asarray', 'numpy....
# notes for this course can be found at: # https://deeplearningcourses.com/c/data-science-linear-regression-in-python # https://www.udemy.com/data-science-linear-regression-in-python import numpy as np import matplotlib.pyplot as plt def make_poly(X, deg): n = len(X) data = [np.ones(n)] for d in xrange(...
[ "numpy.ones", "numpy.random.choice", "matplotlib.pyplot.plot", "numpy.linspace", "numpy.vstack", "matplotlib.pyplot.scatter", "numpy.sin", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((526, 553), 'numpy.random.choice', 'np.random.choice', (['N', 'sample'], {}), '(N, sample)\n', (542, 553), True, 'import numpy as np\n'), ((611, 638), 'matplotlib.pyplot.scatter', 'plt.scatter', (['Xtrain', 'Ytrain'], {}), '(Xtrain, Ytrain)\n', (622, 638), True, 'import matplotlib.pyplot as plt\n'), ((643, 653), 'mat...
""" 预测3 BY 李说啥都对 2018.3 """ import os import numpy as np import tensorflow as tf from PIL import Image from cfg_3 import MAX_CAPTCHA, CHAR_SET_LEN, model_path_3_1, model_path_3_2, model_path_3_3 from cnn_sys_3 import crack_captcha_cnn, X, keep_prob from utils_3 import vec2text, get_clear_bin_image from PyQt...
[ "os.listdir", "PIL.Image.open", "tensorflow.Session", "tensorflow.train.Saver", "utils_3.vec2text", "numpy.array", "numpy.zeros", "PyQt5.QtWidgets.QApplication.processEvents", "utils_3.get_clear_bin_image", "tensorflow.reshape", "tensorflow.train.latest_checkpoint", "cnn_sys_3.crack_captcha_cn...
[((536, 572), 'numpy.zeros', 'np.zeros', (['(MAX_CAPTCHA * CHAR_SET_LEN)'], {}), '(MAX_CAPTCHA * CHAR_SET_LEN)\n', (544, 572), True, 'import numpy as np\n'), ((674, 690), 'utils_3.vec2text', 'vec2text', (['vector'], {}), '(vector)\n', (682, 690), False, 'from utils_3 import vec2text, get_clear_bin_image\n'), ((767, 786...
# -*- coding: utf-8 -*- # # anim_sequence_EI_networks_spont_stim.py # # Copyright 2019 <NAME> # The MIT License import numpy as np import pylab as pl import lib.protocol as protocol import lib.animation_image as ai import datetime landscapes = [ {'mode': 'symmetric'}, {'mode': 'homogeneous', 'specs': {'phi': ...
[ "numpy.max", "lib.protocol.get_or_simulate", "datetime.datetime.now", "lib.protocol.get_parameters", "pylab.subplots", "numpy.arange", "pylab.show" ]
[((601, 645), 'lib.protocol.get_or_simulate', 'protocol.get_or_simulate', (['simulation', 'params'], {}), '(simulation, params)\n', (625, 645), True, 'import lib.protocol as protocol\n'), ((776, 806), 'numpy.arange', 'np.arange', (['(500.0)', '(2500.0)', '(10.0)'], {}), '(500.0, 2500.0, 10.0)\n', (785, 806), True, 'imp...
import cv2 import numpy as np import glob # Load previously saved data with np.load('1. Camera Calibration\camera.py') as X: mtx, dist, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]
[ "numpy.load" ]
[((77, 120), 'numpy.load', 'np.load', (['"""1. Camera Calibration\\\\camera.py"""'], {}), "('1. Camera Calibration\\\\camera.py')\n", (84, 120), True, 'import numpy as np\n')]
""" Data loader for TUM RGBD benchmark @author: <NAME> @date: March 2019 """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import sys, os, random import pickle import numpy as np import os.path as osp import torch...
[ "numpy.clip", "torch.utils.data.replace", "numpy.array", "torchvision.utils.make_grid", "numpy.searchsorted", "numpy.asarray", "scipy.misc.imread", "numpy.eye", "random.choice", "pickle.load", "os.path.isfile", "cv2.resize", "matplotlib.pyplot.show", "numpy.roll", "pickle.dump", "os.pa...
[((12246, 12258), 'numpy.array', 'np.array', (['tq'], {}), '(tq)\n', (12254, 12258), True, 'import numpy as np\n'), ((12267, 12276), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (12273, 12276), True, 'import numpy as np\n'), ((12554, 12607), 'os.path.join', 'osp.join', (['local_dir', 'dataset', 'subject_name', '"""rg...
import rospy import actionlib from math import radians import numpy as np import scipy.signal import time import dynamic_reconfigure.client from robot_localization.srv import SetPose from pyquaternion import Quaternion as qt from std_srvs.srv import Empty from gazebo_msgs.msg import ModelState from geometry_msgs.msg ...
[ "numpy.sqrt", "numpy.column_stack", "numpy.array", "numpy.arctan2", "geometry_msgs.msg.PoseWithCovarianceStamped", "numpy.sin", "geometry_msgs.msg.Pose", "rospy.ServiceProxy", "numpy.asarray", "geometry_msgs.msg.Quaternion", "numpy.matmul", "rospy.Subscriber", "move_base_msgs.msg.MoveBaseGoa...
[((750, 764), 'move_base_msgs.msg.MoveBaseGoal', 'MoveBaseGoal', ([], {}), '()\n', (762, 764), False, 'from move_base_msgs.msg import MoveBaseGoal, MoveBaseAction\n'), ((1115, 1149), 'geometry_msgs.msg.Quaternion', 'Quaternion', (['e[1]', 'e[2]', 'e[3]', 'e[0]'], {}), '(e[1], e[2], e[3], e[0])\n', (1125, 1149), False, ...
# pylint: disable=invalid-name from __future__ import absolute_import, division __license__ = """MIT License Copyright (c) 2014-2019 <NAME> and <NAME> 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 So...
[ "numpy.atleast_2d", "numpy.sqrt", "numpy.ones", "numpy.random.choice", "numpy.array", "numpy.zeros", "warnings.warn" ]
[((2245, 2265), 'numpy.atleast_2d', 'n.atleast_2d', (['points'], {}), '(points)\n', (2257, 2265), True, 'import numpy as n\n'), ((2356, 2376), 'numpy.array', 'n.array', (['self.values'], {}), '(self.values)\n', (2363, 2376), True, 'import numpy as n\n'), ((2625, 2643), 'numpy.atleast_2d', 'n.atleast_2d', (['data'], {})...
import numpy as np def CIS(occ, F, C, VeeMOspin): # Make the spin MO fock matrix Fspin = np.zeros((len(F)*2,len(F)*2)) Cspin = np.zeros((len(F)*2,len(F)*2)) for p in range(1,len(F)*2+1): for q in range(1,len(F)*2+1): Fspin[p-1,q-1] = F[(p+1)//2-1,(q+1)//2-1] * (p%2 == q%2) ...
[ "numpy.linalg.eigvalsh", "numpy.dot", "numpy.transpose" ]
[((1072, 1093), 'numpy.linalg.eigvalsh', 'np.linalg.eigvalsh', (['H'], {}), '(H)\n', (1090, 1093), True, 'import numpy as np\n'), ((411, 430), 'numpy.transpose', 'np.transpose', (['Cspin'], {}), '(Cspin)\n', (423, 430), True, 'import numpy as np\n'), ((431, 451), 'numpy.dot', 'np.dot', (['Fspin', 'Cspin'], {}), '(Fspin...
# michaelpeterswa # kulo.py import csv import geojson import datetime import numpy as np from shapely.geometry import shape, MultiPolygon, Polygon, Point from keras.models import Sequential from keras.layers import Dense from keras.callbacks import TensorBoard input_file = "..\data\Washington_Large_Fires_1973-2019.g...
[ "csv.writer", "numpy.array", "shapely.geometry.Polygon", "shapely.geometry.shape", "geojson.load" ]
[((950, 965), 'shapely.geometry.Polygon', 'Polygon', (['points'], {}), '(points)\n', (957, 965), False, 'from shapely.geometry import shape, MultiPolygon, Polygon, Point\n'), ((1960, 1984), 'numpy.array', 'np.array', (['fire_data_list'], {}), '(fire_data_list)\n', (1968, 1984), True, 'import numpy as np\n'), ((454, 469...
import numpy as np import theano import theano.tensor as T from nose.tools import assert_true from numpy.testing import assert_equal, assert_array_equal from smartlearner.interfaces.dataset import Dataset floatX = theano.config.floatX ALL_DTYPES = np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float'] def te...
[ "numpy.testing.assert_equal", "theano.function", "theano.tensor.sum", "smartlearner.interfaces.dataset.Dataset", "numpy.array", "numpy.sum", "nose.tools.assert_true", "numpy.random.RandomState" ]
[((368, 395), 'numpy.random.RandomState', 'np.random.RandomState', (['(1234)'], {}), '(1234)\n', (389, 395), True, 'import numpy as np\n'), ((558, 582), 'smartlearner.interfaces.dataset.Dataset', 'Dataset', (['inputs', 'targets'], {}), '(inputs, targets)\n', (565, 582), False, 'from smartlearner.interfaces.dataset impo...
import tornado.web import json import cStringIO from collections import defaultdict import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_agg import FigureCanvasAgg from status.util import dthandler, SafeHandler #TODO - Have date slider to select range #TODO - Ask if anyone uses i...
[ "numpy.median", "cStringIO.StringIO", "matplotlib.figure.Figure", "collections.defaultdict", "matplotlib.backends.backend_agg.FigureCanvasAgg" ]
[((1641, 1658), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1652, 1658), False, 'from collections import defaultdict\n'), ((3703, 3723), 'matplotlib.backends.backend_agg.FigureCanvasAgg', 'FigureCanvasAgg', (['fig'], {}), '(fig)\n', (3718, 3723), False, 'from matplotlib.backends.backend_agg i...
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import tensorflow as tf import time import numpy as np import os root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..') import sys sys.path.append(root_dir) from adversarial_robustness.cnns import * from adversarial_robustness.da...
[ "matplotlib.pyplot.ylabel", "tensorflow.gradients", "adversarial_robustness.datasets.mnist.MNIST", "tensorflow.nn.softmax", "sys.path.append", "adversarial_robustness.datasets.notmnist.notMNIST", "argparse.ArgumentParser", "tensorflow.Session", "matplotlib.pyplot.plot", "matplotlib.pyplot.xlabel",...
[((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((222, 247), 'sys.path.append', 'sys.path.append', (['root_dir'], {}), '(root_dir)\n', (237, 247), False, 'import sys\n'), ((502, 527), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}...
import os, sys import numpy as np import time import argparse import traceback import glob import trimesh import math import shutil import json import open3d as o3d from tqdm import tqdm import ctypes import logging from contextlib import closing import multiprocessing as mp from multiprocessing import Pool sys.path...
[ "multiprocessing.Array", "numpy.array", "multiprocessing.freeze_support", "open3d.io.read_triangle_mesh", "numpy.isfinite", "os.path.exists", "multiprocessing.log_to_stderr", "numpy.max", "multiprocessing.get_logger", "os.path.isdir", "trimesh.Trimesh.export", "open3d.geometry.TriangleMesh.cre...
[((455, 470), 'multiprocessing.get_logger', 'mp.get_logger', ([], {}), '()\n', (468, 470), True, 'import multiprocessing as mp\n'), ((519, 537), 'multiprocessing.log_to_stderr', 'mp.log_to_stderr', ([], {}), '()\n', (535, 537), True, 'import multiprocessing as mp\n'), ((626, 658), 'multiprocessing.Array', 'mp.Array', (...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from ..networks.deeplab.aspp import build_aspp, ASPP from ..networks.deeplab.backbone.resnet import SEResNet50 class NET_GAmap(nn.Module): # with Indicator encoder def __init__(self, pretrained=1, resfix=False,): ...
[ "torch.nn.ReLU", "torch.nn.Dropout", "torch.max", "torch.exp", "torch.sum", "torch.nn.functional.interpolate", "torch.bmm", "torch.nn.functional.softmax", "torch.nn.BatchNorm2d", "torch.nn.Sigmoid", "torch.mean", "torch.unsqueeze", "torch.nn.AdaptiveAvgPool2d", "numpy.abs", "torch.nn.fun...
[((4173, 4196), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1)'], {}), '(1)\n', (4193, 4196), True, 'import torch.nn as nn\n'), ((4736, 4799), 'torch.nn.Conv2d', 'nn.Conv2d', (['(3)', '(64)'], {'kernel_size': '(7)', 'stride': '(2)', 'padding': '(3)', 'bias': '(True)'}), '(3, 64, kernel_size=7, stride=2, p...
#!/usr/bin/env python # coding: utf-8 # ### IMPORTING LIBRARIES AND DATASET # In[1]: import os import cv2 import tensorflow as tf import numpy as np from tensorflow.keras import layers, optimizers from tensorflow.keras.applications.resnet50 import ResNet50 from tensorflow.keras.layers import Input, Add, Dense, Acti...
[ "matplotlib.pyplot.ylabel", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "tensorflow.keras.callbacks.EarlyStopping", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.AveragePooling2D", "numpy.arange", "tensorflow.keras.layers.Input", "os.listdir", "matplotlib.pyplot.xlabel", ...
[((891, 917), 'os.listdir', 'os.listdir', (['XRay_Directory'], {}), '(XRay_Directory)\n', (901, 917), False, 'import os\n'), ((1066, 1125), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255)', 'validation_split': '(0.2)'}), '(rescale=1.0 / 255, validation_spli...
import numpy as np import cv2 from mlpipe.processors.i_processor import IPreProcessor class PreProcessData(IPreProcessor): def process(self, raw_data, input_data, ground_truth, piped_params=None): ground_truth = np.zeros(10) ground_truth[raw_data["label"]] = 1.0 png_binary = raw_data["img...
[ "numpy.frombuffer", "numpy.zeros", "cv2.imdecode" ]
[((226, 238), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (234, 238), True, 'import numpy as np\n'), ((341, 376), 'numpy.frombuffer', 'np.frombuffer', (['png_binary', 'np.uint8'], {}), '(png_binary, np.uint8)\n', (354, 376), True, 'import numpy as np\n'), ((398, 437), 'cv2.imdecode', 'cv2.imdecode', (['png_img...
import sys sys.path.append('/home/jwalker/dynamics/python/atmos-tools') sys.path.append('/home/jwalker/dynamics/python/atmos-read') sys.path.append('/home/jwalker/dynamics/python/monsoon-onset') import os import numpy as np import xarray as xray import pandas as pd import matplotlib.pyplot as plt import collections i...
[ "atmos.mean_over_files", "utils.daily_rel2onset", "atmos.homedir", "xarray.Dataset", "os.path.isfile", "atmos.expand_dims", "xarray.concat", "utils.wrapyear", "atmos.subset", "xarray.open_dataset", "sys.path.append", "atmos.season_days", "numpy.arange" ]
[((11, 71), 'sys.path.append', 'sys.path.append', (['"""/home/jwalker/dynamics/python/atmos-tools"""'], {}), "('/home/jwalker/dynamics/python/atmos-tools')\n", (26, 71), False, 'import sys\n'), ((72, 131), 'sys.path.append', 'sys.path.append', (['"""/home/jwalker/dynamics/python/atmos-read"""'], {}), "('/home/jwalker/d...
import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from scipy.spatial.transform import Rotation from tadataka.matrix import motion_matrix from tadataka.rigid_transform import (inv_transform_all, transform_all, transform_each, Transform, tra...
[ "tadataka.matrix.motion_matrix", "tadataka.rigid_transform.transform_all", "numpy.random.random", "tadataka.rigid_transform.Transform", "numpy.array", "numpy.dot", "tadataka.rigid_transform.transform_each", "tadataka.rigid_transform.transform_se3", "numpy.random.uniform", "tadataka.rigid_transform...
[((374, 407), 'numpy.array', 'np.array', (['[[1, 2, 5], [4, -2, 3]]'], {}), '([[1, 2, 5], [4, -2, 3]])\n', (382, 407), True, 'import numpy as np\n'), ((448, 534), 'numpy.array', 'np.array', (['[[[1, 0, 0], [0, 0, -1], [0, 1, 0]], [[0, 0, -1], [0, 1, 0], [1, 0, 0]]]'], {}), '([[[1, 0, 0], [0, 0, -1], [0, 1, 0]], [[0, 0,...
#!/usr/bin/env python """ Evaluate the stability (i.e. agreement) between a set of partitions generated on the same dataset, using Pairwise Normalized Mutual Information (PNMI). Sample usage: python eval-partition-stability.py models/base/*partition*.pkl """ import os, sys import logging as log from optparse import O...
[ "logging.basicConfig", "prettytable.PrettyTable", "os.path.exists", "numpy.median", "logging.debug", "numpy.digitize", "os.walk", "os.path.join", "optparse.OptionParser", "numpy.array", "sklearn.metrics.cluster.normalized_mutual_info_score", "os.path.isdir", "sys.exit", "logging.info", "...
[((584, 659), 'optparse.OptionParser', 'OptionParser', ([], {'usage': '"""usage: %prog [options] partition_file1|directory1 ..."""'}), "(usage='usage: %prog [options] partition_file1|directory1 ...')\n", (596, 659), False, 'from optparse import OptionParser\n'), ((1152, 1199), 'logging.basicConfig', 'log.basicConfig', ...
# USAGE # python detection.py --input videos/sample1.mp4 --yolo yolo-coco import numpy as np import argparse import imutils import time import cv2 import os ap = argparse.ArgumentParser() ap.add_argument("-i", "--input", required=True, help="path to input video") ap.add_argument("-y", "--yolo", default="yolo-coco", h...
[ "cv2.rectangle", "imutils.is_cv2", "numpy.int32", "cv2.imshow", "numpy.array", "os.path.sep.join", "cv2.warpPerspective", "cv2.destroyAllWindows", "cv2.dnn.NMSBoxes", "cv2.setMouseCallback", "argparse.ArgumentParser", "numpy.random.seed", "cv2.VideoWriter_fourcc", "cv2.perspectiveTransform...
[((164, 189), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (187, 189), False, 'import argparse\n'), ((632, 678), 'os.path.sep.join', 'os.path.sep.join', (["[args['yolo'], 'coco.names']"], {}), "([args['yolo'], 'coco.names'])\n", (648, 678), False, 'import os\n'), ((733, 751), 'numpy.random.se...
# summary function for drawing graph # ref : https://github.com/yunjey/pytorch-tutorial/blob/master/tutorials/04-utils/tensorboard/logger.py # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514 import os import tensorflow as tf import numpy as np import scipy.misc import torch from to...
[ "StringIO.StringIO", "numpy.prod", "numpy.histogram", "tensorflow.Summary", "tensorflow.HistogramProto", "os.makedirs", "torch.utils.data.DataLoader", "torch.max", "io.BytesIO", "numpy.max", "numpy.sum", "ImageLoader.ImageLoader", "torchvision.transforms.transforms.Normalize", "torchvision...
[((1700, 1731), 'tensorflow.Summary', 'tf.Summary', ([], {'value': 'img_summaries'}), '(value=img_summaries)\n', (1710, 1731), True, 'import tensorflow as tf\n'), ((1964, 1995), 'numpy.histogram', 'np.histogram', (['values'], {'bins': 'bins'}), '(values, bins=bins)\n', (1976, 1995), True, 'import numpy as np\n'), ((206...
# -*- coding:utf-8 -*- """ """ import re import time import numpy as np import pandas as pd from lightgbm import LGBMRegressor, LGBMClassifier from sklearn.impute import SimpleImputer from sklearn.metrics import log_loss, mean_squared_error from sklearn.model_selection import train_test_split from sklearn.preprocessi...
[ "numpy.clip", "sklearn.preprocessing.LabelEncoder", "numpy.log", "lightgbm.LGBMRegressor", "lightgbm.LGBMClassifier", "numpy.iinfo", "numpy.array", "numpy.searchsorted", "tabular_toolbox.utils.logging.get_logger", "numpy.stack", "numpy.min", "pandas.DataFrame", "sklearn.utils.validation.chec...
[((662, 690), 'tabular_toolbox.utils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (680, 690), False, 'from tabular_toolbox.utils import logging, infer_task_type\n'), ((887, 997), 'sklearn.metrics.mean_squared_error', 'mean_squared_error', (['y_true', 'y_pred'], {'sample_weight': 'sampl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np def calculate_daylight(day: int, latitude: float = 53.551086) -> float: """ Calculate number of hours of daylight in a day Parameters ---------- day : integer (required) day of the week by number, starting at 0 (Monday) ...
[ "numpy.sin", "numpy.tan", "numpy.cos" ]
[((1056, 1083), 'numpy.cos', 'np.cos', (['(latitude * pi / 180)'], {}), '(latitude * pi / 180)\n', (1062, 1083), True, 'import numpy as np\n'), ((1086, 1095), 'numpy.cos', 'np.cos', (['P'], {}), '(P)\n', (1092, 1095), True, 'import numpy as np\n'), ((998, 1025), 'numpy.sin', 'np.sin', (['(latitude * pi / 180)'], {}), '...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # File : pad.py # Author : <NAME> <<EMAIL>> # Date : 01.11.2020 # Last Modified Date: 09.11.2021 # Last Modified By : <NAME> <<EMAIL>> # # Copyright (c) 2020, Imperial College, London # All rights reserved. # Redistribution and use in ...
[ "numpy.issubdtype", "numpy.full", "numpy.asarray", "numpy.max" ]
[((3091, 3158), 'numpy.full', 'np.full', (['((total_samples, maxlen) + sample_shape)', 'value'], {'dtype': 'dtype'}), '((total_samples, maxlen) + sample_shape, value, dtype=dtype)\n', (3098, 3158), True, 'import numpy as np\n'), ((2685, 2700), 'numpy.max', 'np.max', (['lengths'], {}), '(lengths)\n', (2691, 2700), True,...
from collections import defaultdict from copy import deepcopy from time import time from flatland.envs.agent_utils import RailAgentStatus from flatland.envs.rail_env import RailEnv, RailEnvActions import numpy as np from flatlander.agents.heuristic_agent import HeuristicPriorityAgent from flatlander.submission.helper ...
[ "flatlander.submission.helper.get_agent_pos", "numpy.random.random", "numpy.flatnonzero", "numpy.min", "numpy.count_nonzero", "collections.defaultdict", "copy.deepcopy", "flatlander.submission.helper.is_done", "flatlander.agents.heuristic_agent.HeuristicPriorityAgent", "time.time" ]
[((588, 612), 'flatlander.agents.heuristic_agent.HeuristicPriorityAgent', 'HeuristicPriorityAgent', ([], {}), '()\n', (610, 612), False, 'from flatlander.agents.heuristic_agent import HeuristicPriorityAgent\n'), ((629, 635), 'time.time', 'time', ([], {}), '()\n', (633, 635), False, 'from time import time\n'), ((834, 84...
# load packages import random import yaml from munch import Munch import numpy as np import torch from torch import nn import torch.nn.functional as F import torchaudio import librosa import soundfile import argparse import shutil import os from Utils.ASR.models import ASRCNN from Utils.JDC.model import JDCNet from mo...
[ "torch.from_numpy", "soundfile.write", "librosa.resample", "librosa.effects.trim", "librosa.load", "argparse.ArgumentParser", "models.MappingNetwork", "parallel_wavegan.utils.load_model", "Utils.JDC.model.JDCNet", "torch.randn", "numpy.abs", "random.choice", "shutil.copy", "munch.Munch", ...
[((411, 507), 'torchaudio.transforms.MelSpectrogram', 'torchaudio.transforms.MelSpectrogram', ([], {'n_mels': '(80)', 'n_fft': '(2048)', 'win_length': '(1200)', 'hop_length': '(300)'}), '(n_mels=80, n_fft=2048, win_length=1200,\n hop_length=300)\n', (447, 507), False, 'import torchaudio\n'), ((765, 784), 'munch.Munc...
import os import numpy as np import matplotlib.pyplot as plt from shape import Shape from visualize import visualize from normalize import normalize_data, normalize_shape from dataLoader import import_dataset, import_normalised_data from featureExtraction import * from featureMatching import * from utils import pick_f...
[ "os.getcwd", "visualize.visualize", "shape.Shape", "utils.pick_file", "normalize.normalize_shape", "numpy.load" ]
[((1420, 1442), 'normalize.normalize_shape', 'normalize_shape', (['shape'], {}), '(shape)\n', (1435, 1442), False, 'from normalize import normalize_data, normalize_shape\n'), ((2178, 2197), 'visualize.visualize', 'visualize', (['n_shapes'], {}), '(n_shapes)\n', (2187, 2197), False, 'from visualize import visualize\n'),...
from plantcv.plantcv import fatal_error from plantcv.plantcv import params import os from spectral import * from osgeo import gdal from osgeo.gdalconst import * import numpy as np def reference2array(path): """this function allows you read in hyperspectral reference in raw format and returns it as array that is av...
[ "osgeo.gdal.Open", "numpy.reshape", "os.path.isfile" ]
[((991, 1019), 'osgeo.gdal.Open', 'gdal.Open', (['path', 'GA_ReadOnly'], {}), '(path, GA_ReadOnly)\n', (1000, 1019), False, 'from osgeo import gdal\n'), ((2495, 2533), 'numpy.reshape', 'np.reshape', (['output_list', '(bands, cols)'], {}), '(output_list, (bands, cols))\n', (2505, 2533), True, 'import numpy as np\n'), ((...
""" AutoCal Automatic analysis of Calcium imaging data <NAME> 2017 <EMAIL> """ def savitzky_golay(y, window_size, order, deriv=0, rate=1): """ Smooth (and optionally differentiate) data with a Savitzky-Golay filter. Modified from Scipy cookbook by <NAME> The Savitzky-Golay filter removes high frequ...
[ "numpy.abs", "numpy.convolve", "numpy.linalg.pinv", "math.factorial", "numpy.concatenate" ]
[((2257, 2299), 'numpy.concatenate', 'np.concatenate', (['(first_vals, y, last_vals)'], {}), '((first_vals, y, last_vals))\n', (2271, 2299), True, 'import numpy as np\n'), ((2348, 2385), 'numpy.convolve', 'np.convolve', (['m[::-1]', 'y'], {'mode': '"""valid"""'}), "(m[::-1], y, mode='valid')\n", (2359, 2385), True, 'im...
import numpy as np import cv2 class Ellipse(): def __init__(self): """ A partial ellipse """ startAngle = np.random.rand()*360.0 arclength = 60 + np.sum(np.random.rand(2))*140.0 direction = np.random.choice([-1, 1]) self._shape = 'ellipse' self...
[ "numpy.random.rand", "numpy.random.choice", "cv2.imshow", "numpy.zeros", "numpy.random.randint", "cv2.destroyAllWindows", "cv2.waitKey" ]
[((3370, 3403), 'numpy.zeros', 'np.zeros', (['(500, 500, 3)', 'np.uint8'], {}), '((500, 500, 3), np.uint8)\n', (3378, 3403), True, 'import numpy as np\n'), ((4008, 4031), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (4029, 4031), False, 'import cv2\n'), ((245, 270), 'numpy.random.choice', 'np.ran...
import os import sys import numpy as np from glob import glob from skimage.io import imread from skimage.transform import resize import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import tensorflow_addons as tfa from tensorflow.keras.utils import to_categorical from tensorflow.ke...
[ "tensorflow.keras.losses.MeanSquaredError", "numpy.array_split", "tensorflow.keras.preprocessing.image.array_to_img", "tensorflow.keras.optimizers.Adam", "numpy.concatenate", "tensorflow.ones_like", "tensorflow.zeros_like", "numpy.load" ]
[((5504, 5535), 'tensorflow.keras.losses.MeanSquaredError', 'keras.losses.MeanSquaredError', ([], {}), '()\n', (5533, 5535), False, 'from tensorflow import keras\n'), ((4116, 4148), 'numpy.array_split', 'np.array_split', (['x', 'nside'], {'axis': '(1)'}), '(x, nside, axis=1)\n', (4130, 4148), True, 'import numpy as np\...
from typing import List, Optional import numpy as np import pandas as pd from temporis.dataset.ts_dataset import AbstractTimeSeriesDataset def variance_information( dataset: AbstractTimeSeriesDataset, features: Optional[List[str]] = None, ) -> pd.DataFrame: """ Return mean and max null proportion for...
[ "pandas.DataFrame", "numpy.mean", "numpy.max", "numpy.min" ]
[((1622, 1695), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['Feature', 'Min std', 'Mean std', 'Max std']"}), "(data, columns=['Feature', 'Min std', 'Mean std', 'Max std'])\n", (1634, 1695), True, 'import pandas as pd\n'), ((1439, 1467), 'numpy.min', 'np.min', (['std_per_life[column]'], {}), '(std_per_l...
""" Leer los datos del archivo /M1/CLASE_03/Data/sales_data_sample_excercise.csv Este archivo tiene algunos datos numéricos y otros de tipo cadena de caracteres. Las columnas son: ORDERNUMBER: int, id de la orden SALES: float, monto abonado MONTH_ID: int, mes YEAR_ID: int, año PRODUCTLINE: str, producto COUNTRY...
[ "seaborn.set", "numpy.median", "numpy.random.default_rng", "seaborn.distplot", "seaborn.set_style", "numpy.genfromtxt" ]
[((712, 776), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': '"""\t"""', 'skip_header': '(True)', 'dtype': 'str'}), "(file, delimiter='\\t', skip_header=True, dtype=str)\n", (725, 776), True, 'import numpy as np\n'), ((828, 892), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': '"""\t"""', '...
import numpy as np import torch import inspect from collections import OrderedDict from data_loader import Dataset, get_loader import config def random_candidates(test_users, n_candidates=101, seed=37, validate=False): if not validate: np.random.seed(seed) train_data = Dataset.train_val t...
[ "torch.LongTensor", "inspect.signature", "data_loader.get_loader", "numpy.random.seed", "torch.no_grad", "numpy.log2" ]
[((251, 271), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (265, 271), True, 'import numpy as np\n'), ((1776, 1913), 'data_loader.get_loader', 'get_loader', (['requires'], {'batch_size': '(100)', 'users': 'users', 'num_workers': '(2)', 'process_mode': '(1 if self.validate else 2)', 'shuffle': '(Fa...
# -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, <NAME> <<EMAIL>> 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...
[ "fluids.numerics.linspace", "fluids.numerics.derivative", "numpy.log", "numpy.array", "pytest.raises" ]
[((3229, 3251), 'fluids.numerics.linspace', 'linspace', (['(300)', '(350)', '(10)'], {}), '(300, 350, 10)\n', (3237, 3251), False, 'from fluids.numerics import linspace, assert_close, derivative, assert_close1d\n'), ((5721, 5765), 'fluids.numerics.linspace', 'linspace', (['(0.7 * Tmin)', '(Tmin * (1 - 1e-10))', '(10)']...
from ..spacegroup import expand_spacegroup import numpy as np def test_expand_spacegroup(): """test for expand_spacegroup function""" # try non-integer input a_float = 31.1 a_string = 'a' a_list = [1, 2] # try all non-integer inputs try: expand_spacegroup(a_float) except Excepti...
[ "numpy.random.randint" ]
[((782, 807), 'numpy.random.randint', 'np.random.randint', (['(1)', '(230)'], {}), '(1, 230)\n', (799, 807), True, 'import numpy as np\n')]
import os import numpy as np import matplotlib.image as mpimg def listdir_nohidden(path: str, jpg_only=False) -> list: """ returns an alphabetically sorted list of filenames of the unhidden files of a directory optionnal arg : jpg_only. Set on True for only .jpg or .JPG """ if jpg_only: ret...
[ "os.listdir", "numpy.asarray", "os.path.join", "os.getcwd", "numpy.empty", "cv2.resize", "os.remove" ]
[((9871, 9882), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (9880, 9882), False, 'import os\n'), ((1312, 1342), 'os.path.join', 'os.path.join', (['directory_', 'zord'], {}), '(directory_, zord)\n', (1324, 1342), False, 'import os\n'), ((6749, 6775), 'os.path.join', 'os.path.join', (['path', 'classe'], {}), '(path, clas...
# calculating the intragroup average distance, showing that is is significantly increases with age, # TRF is lower than 24-month-old AL. Make a figure # note about scaling - the metabolom matrix has the metabolites in rows (animals col), # and scaling normalizes the columns, so we need to scale the transpose o...
[ "pandas.read_csv", "matplotlib.pyplot.show", "sklearn.preprocessing.StandardScaler", "numpy.array", "numpy.sum", "statistics.pstdev", "matplotlib.pyplot.subplots", "numpy.arange", "numpy.random.permutation" ]
[((8529, 8573), 'pandas.read_csv', 'pd.read_csv', (['"""mergedpolarlipid"""'], {'header': 'None'}), "('mergedpolarlipid', header=None)\n", (8540, 8573), True, 'import pandas as pd\n'), ((8726, 8742), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (8740, 8742), False, 'from sklearn.preproces...
# SYNCS Hackathon 2020 # jadaj - Circular import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm import cv2 from PIL import Image import io import base64 # Inputs: # image (2d array-like): Will consider all non-zero entries in array as part of circle # centre ((float, float)) # Outputs: # (i...
[ "numpy.sqrt", "numpy.polyfit", "io.BytesIO", "numpy.argsort", "numpy.array", "numpy.arctan2", "numpy.linalg.norm", "numpy.sin", "matplotlib.pyplot.arrow", "numpy.where", "matplotlib.pyplot.close", "numpy.stack", "numpy.linspace", "numpy.exp", "matplotlib.pyplot.axis", "matplotlib.pyplo...
[((442, 460), 'numpy.argwhere', 'np.argwhere', (['image'], {}), '(image)\n', (453, 460), True, 'import numpy as np\n'), ((603, 620), 'numpy.argsort', 'np.argsort', (['theta'], {}), '(theta)\n', (613, 620), True, 'import numpy as np\n'), ((682, 755), 'statsmodels.api.nonparametric.lowess', 'sm.nonparametric.lowess', (['...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "logging.basicConfig", "argparse.ArgumentParser", "mxnet.io.NDArrayIter", "mxnet.symbol.Variable", "mxnet.sym.Variable", "mxnet.sym.LinearRegressionOutput", "mxnet.init.Uniform", "numpy.array", "numpy.random.randint", "mxnet.kv.create", "mxnet.metric.create", "mxnet.sym.FullyConnected", "mxn...
[((1521, 1542), 'mxnet.kv.create', 'mx.kv.create', (['"""local"""'], {}), "('local')\n", (1533, 1542), True, 'import mxnet as mx\n'), ((1655, 1678), 'mxnet.metric.create', 'mx.metric.create', (['"""mse"""'], {}), "('mse')\n", (1671, 1678), True, 'import mxnet as mx\n'), ((3092, 3144), 'logging.basicConfig', 'logging.ba...
import numpy as np import collections from ..utils.utils_def import FlopyBinaryData from ..utils.reference import SpatialReference class MfGrdFile(FlopyBinaryData): def __init__(self, filename, precision='double', verbose=False): """ Class constructor. """ super(MfGrdFile, sel...
[ "numpy.array", "collections.OrderedDict", "numpy.column_stack" ]
[((467, 492), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (490, 492), False, 'import collections\n'), ((518, 543), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (541, 543), False, 'import collections\n'), ((4101, 4124), 'numpy.column_stack', 'np.column_stack', (['(x...
"""Test cases for evaluation scripts.""" import json import os import unittest import numpy as np from PIL import Image from ..common.utils import DEFAULT_COCO_CONFIG from .ins_seg import evaluate_ins_seg class TestBDD100KInsSegEval(unittest.TestCase): """Test cases for BDD100K detection evaluation.""" def...
[ "PIL.Image.fromarray", "os.makedirs", "os.path.join", "os.path.isfile", "numpy.array", "numpy.zeros", "os.path.isdir", "unittest.main", "os.path.abspath", "json.dump" ]
[((3555, 3570), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3568, 3570), False, 'import unittest\n'), ((1444, 1469), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1459, 1469), False, 'import os\n'), ((1660, 1682), 'os.path.isdir', 'os.path.isdir', (['gt_base'], {}), '(gt_base)\n', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Functionality for finite element approximations. This file is part of Fieldosophy, a toolkit for random fields. Copyright (C) 2021 <NAME> <<EMAIL>> This Source Code is subject to the terms of the BSD 3-Clause License. If a copy of the license was not distributed with ...
[ "numpy.sqrt", "numpy.log", "numpy.array", "ctypes.CDLL", "numpy.linalg.norm", "numpy.sin", "numpy.uintc", "numpy.arange", "numpy.mean", "numpy.repeat", "numpy.cross", "numpy.isscalar", "scipy.sparse.eye", "ctypes.c_uint", "numpy.ix_", "numpy.max", "numpy.exp", "scipy.sparse.diags",...
[((1272, 1303), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_double'], {}), '(ctypes.c_double)\n', (1286, 1303), False, 'import ctypes\n'), ((1322, 1351), 'ctypes.POINTER', 'ctypes.POINTER', (['ctypes.c_uint'], {}), '(ctypes.c_uint)\n', (1336, 1351), False, 'import ctypes\n'), ((31682, 31713), 'ctypes.POINTER', 'cty...
from .Beamline import StructuredBeamline import numpy as np from scipy.constants import c from re import findall # lengths: mm # quad strength: T/m # bend angles: deg # Need to handle elements that can have different number of parameters depending on mode class BeamlineParser(object): """ Class that will par...
[ "numpy.max", "re.findall", "numpy.abs", "numpy.min" ]
[((4982, 5030), 're.findall', 'findall', (['"""[-+]?\\\\d*\\\\.\\\\d+|\\\\d+"""', 'line[val_end:]'], {}), "('[-+]?\\\\d*\\\\.\\\\d+|\\\\d+', line[val_end:])\n", (4989, 5030), False, 'from re import findall\n'), ((6325, 6338), 'numpy.min', 'np.min', (['lines'], {}), '(lines)\n', (6331, 6338), True, 'import numpy as np\n...
import matplotlib.pyplot as plt import numpy as np import math import time import sys def input_coordinates(filename, showmap=False): with open(filename, 'r') as fin: X = [] Y = [] while True: line = fin.readline() if not line: break x, y ...
[ "numpy.random.rand", "matplotlib.pyplot.ylabel", "math.sqrt", "numpy.array", "math.exp", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.asarray", "matplotlib.pyplot.yticks", "numpy.random.seed", "matplotlib.pyplot.scatter", "sys.stdout.flush", "numpy.random.permutation", "num...
[((1218, 1270), 'math.sqrt', 'math.sqrt', (['((X[0] - X[-1]) ** 2 + (Y[0] - Y[-1]) ** 2)'], {}), '((X[0] - X[-1]) ** 2 + (Y[0] - Y[-1]) ** 2)\n', (1227, 1270), False, 'import math\n'), ((1557, 1581), 'numpy.random.permutation', 'np.random.permutation', (['n'], {}), '(n)\n', (1578, 1581), True, 'import numpy as np\n'), ...
import numpy as np from sklearn.model_selection import train_test_split import seaborn as sns from sklearn.neural_network import MLPRegressor from sklearn.ensemble import ( AdaBoostRegressor, GradientBoostingRegressor, RandomForestRegressor) from sklearn.linear_model import Lasso, OrthogonalMatchingPursuit from roo...
[ "sklearn.neural_network.MLPRegressor", "intervals.openclosed", "intervals.closedopen", "sklearn.linear_model.Lasso", "rootcp.models.ridge", "sklearn.ensemble.AdaBoostRegressor", "seaborn.set_style", "intervals.closed", "numpy.linalg.norm", "numpy.arange", "seaborn.set", "sklearn.ensemble.Rando...
[((557, 589), 'numpy.quantile', 'np.quantile', (['residual', '(1 - alpha)'], {}), '(residual, 1 - alpha)\n', (568, 589), True, 'import numpy as np\n'), ((767, 809), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X[:-1]', 'y'], {'test_size': '(0.5)'}), '(X[:-1], y, test_size=0.5)\n', (783, 809), Fals...
""" Copyright 2019 <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 applicablNe law or agreed to in writing, software distribu...
[ "logging.getLogger", "numpy.abs", "gs_quant.api.gs.hedges.GsHedgeApi.calculate_hedge", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.asarray", "numpy.sum", "numpy.cumsum", "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.subplots", ...
[((784, 811), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (801, 811), False, 'import logging\n'), ((6011, 6040), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (6023, 6040), True, 'import matplotlib.pyplot as plt\n'), ((10498, 10512),...
from concurrent.futures import ProcessPoolExecutor from functools import partial import numpy as np import os import audio import csv from hparams import hparams import traceback def build_from_path(in_dir, out_dir, speakers, num_workers=1, tqdm=lambda x: x): executor = ProcessPoolExecutor(max_workers=num_workers...
[ "traceback.format_exc", "numpy.abs", "os.path.join", "audio.melspectrogram", "audio.load_wav", "functools.partial", "concurrent.futures.ProcessPoolExecutor", "audio.spectrogram", "csv.reader" ]
[((277, 321), 'concurrent.futures.ProcessPoolExecutor', 'ProcessPoolExecutor', ([], {'max_workers': 'num_workers'}), '(max_workers=num_workers)\n', (296, 321), False, 'from concurrent.futures import ProcessPoolExecutor\n'), ((1233, 1257), 'audio.load_wav', 'audio.load_wav', (['wav_path'], {}), '(wav_path)\n', (1247, 12...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # 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 applica...
[ "os.path.exists", "tensorflow.image.decode_png", "os.listdir", "tensorflow.image.resize_images", "os.makedirs", "argparse.ArgumentParser", "tensorflow.Session", "numpy.array", "tensorflow.read_file" ]
[((1598, 1616), 'os.listdir', 'os.listdir', (['imgdir'], {}), '(imgdir)\n', (1608, 1616), False, 'import os\n'), ((2933, 2958), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2956, 2958), False, 'import argparse\n'), ((3405, 3449), 'os.path.exists', 'os.path.exists', (["(config.bin_input_dir +...
# caclculate the cost bw import os import pandas as pd import numpy as np import time # store the matrix A def store_bw_e2u(df_ct, store_path, n): user_path = store_path + '/user_' + str(n) if not os.path.exists(user_path): os.makedirs(user_path) df_ct.to_csv(user_path + '/cost_e.csv', index=Fals...
[ "os.path.exists", "os.makedirs", "numpy.asarray", "numpy.core.defchararray.add", "time.time" ]
[((620, 631), 'time.time', 'time.time', ([], {}), '()\n', (629, 631), False, 'import time\n'), ((1225, 1236), 'time.time', 'time.time', ([], {}), '()\n', (1234, 1236), False, 'import time\n'), ((1380, 1422), 'numpy.core.defchararray.add', 'np.core.defchararray.add', (['ct_col_name', 'cts'], {}), '(ct_col_name, cts)\n',...
import cv2 import numpy as np frameWidth = 640 framHeight = 480 cap = cv2.VideoCapture(0) cap.set(3, frameWidth) cap.set(4, framHeight) cap.set(10, 150) # Unfortunately depend of your camera quality, # you need to adjust different values for different illuminations # to be use during the night myColors = [[0, 120, ...
[ "cv2.drawContours", "cv2.inRange", "cv2.imshow", "cv2.contourArea", "numpy.array", "cv2.VideoCapture", "cv2.cvtColor", "cv2.findContours", "cv2.waitKey" ]
[((72, 91), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (88, 91), False, 'import cv2\n'), ((542, 578), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (554, 578), False, 'import cv2\n'), ((805, 868), 'cv2.findContours', 'cv2.findContours', (['img', '...
# This code is part of Qiskit. # # (C) Copyright IBM 2020, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
[ "typing.cast", "numpy.abs", "qiskit.opflow.list_ops.composed_op.ComposedOp", "numpy.sum" ]
[((2419, 2433), 'numpy.abs', 'np.abs', (['coeffs'], {}), '(coeffs)\n', (2425, 2433), True, 'import numpy as np\n'), ((2450, 2465), 'numpy.sum', 'np.sum', (['weights'], {}), '(weights)\n', (2456, 2465), True, 'import numpy as np\n'), ((2178, 2218), 'typing.cast', 'cast', (['List[PrimitiveOp]', 'operator.oplist'], {}), '...
import sys import os import numpy as np #this_name=sys.argv[0] #var=sys.argv[1] #print('argv[0] is ' + this_name + '; argv[1] is ' + var + '\n') if len(sys.argv) > 1: npy_txt_path=sys.argv[1] # it should contain files ./name.npy.txt else: print("should provide source directory name\n") exit() #npy_txt_path...
[ "os.path.exists", "os.listdir", "os.makedirs", "numpy.loadtxt", "numpy.save" ]
[((691, 715), 'os.listdir', 'os.listdir', (['npy_txt_path'], {}), '(npy_txt_path)\n', (701, 715), False, 'import os\n'), ((624, 648), 'os.path.exists', 'os.path.exists', (['npy_path'], {}), '(npy_path)\n', (638, 648), False, 'import os\n'), ((654, 675), 'os.makedirs', 'os.makedirs', (['npy_path'], {}), '(npy_path)\n', ...
import numpy as np def score1(q, doc): return np.dot(q, doc) def score2(q, doc): return np.dot(q, doc) / (np.linalg.norm(q) * np.linalg.norm(doc)) def retrieval(collection, query, func_score): result = [] for i in range(len(collection)): sim = func_score(query, collection[i]) ...
[ "numpy.array", "numpy.dot", "numpy.linalg.norm" ]
[((697, 784), 'numpy.array', 'np.array', (['[0, 1.345, 1.453, 1.987, 0, 2.133, 0, 0, 0, 0, 0, 0, 3.452, 0, 0, 4.234]'], {}), '([0, 1.345, 1.453, 1.987, 0, 2.133, 0, 0, 0, 0, 0, 0, 3.452, 0, 0, \n 4.234])\n', (705, 784), True, 'import numpy as np\n'), ((54, 68), 'numpy.dot', 'np.dot', (['q', 'doc'], {}), '(q, doc)\n'...
#!/usr/bin/env python3 import sys import argparse import numpy as np import yaml DESC = "Prints total number of parameters in model.npz" S2S_SPECIAL_NODE = "special:model.yml" def main(): args = parse_args() print("Loading {}".format(args.model)) model = np.load(args.model) count = 0 for key ...
[ "numpy.load", "argparse.ArgumentParser" ]
[((273, 292), 'numpy.load', 'np.load', (['args.model'], {}), '(args.model)\n', (280, 292), True, 'import numpy as np\n'), ((567, 608), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESC'}), '(description=DESC)\n', (590, 608), False, 'import argparse\n')]
import numpy as np from .utils.augmentations import letterbox from .models.experimental import attempt_load import cv2 as cv from .utils.general import (check_img_size, non_max_suppression, set_logging) import argparse import os import sys from pathlib import Path import random import torch...
[ "cv2.rectangle", "cv2.imwrite", "os.listdir", "pathlib.Path", "pathlib.Path.cwd", "os.path.join", "torch.from_numpy", "numpy.ascontiguousarray", "torch.cuda.is_available", "cv2.VideoCapture", "torch.no_grad", "cv2.imread" ]
[((1387, 1402), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1400, 1402), False, 'import torch\n'), ((3308, 3341), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""test_video.avi"""'], {}), "('test_video.avi')\n", (3323, 3341), True, 'import cv2 as cv\n'), ((3496, 3520), 'os.listdir', 'os.listdir', (['test_pic_dir'...