code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# SPADE # Copyright (c) 2021-present NAVER Corp. # Apache License v2.0 import collections from copy import deepcopy from pprint import pprint import numpy as np import torch import torch.nn.functional as F import spade.utils.general_utils as gu def pred_label(task, score, method, n_fields, l_units, return_tensor=F...
[ "spade.utils.general_utils.get_key_from_single_key_dict", "copy.deepcopy", "torch.zeros_like", "torch.cat", "torch.nn.functional.softmax", "numpy.nonzero", "numpy.where", "numpy.array", "collections.OrderedDict" ]
[((788, 822), 'torch.cat', 'torch.cat', (['pr_label_tensors'], {'dim': '(1)'}), '(pr_label_tensors, dim=1)\n', (797, 822), False, 'import torch\n'), ((2006, 2045), 'torch.nn.functional.softmax', 'F.softmax', (['score[:, st:ed, :, :]'], {'dim': '(1)'}), '(score[:, st:ed, :, :], dim=1)\n', (2015, 2045), True, 'import tor...
import numpy as np import tensorflow_encrypted as tfe from tensorflow_encrypted.protocol import Pond config = tfe.LocalConfig([ 'server0', 'server1', 'crypto_producer' ]) prot = Pond(*config.get_players('server0, server1, crypto_producer')) # a = prot.define_constant(np.array([4, 3, 2, 1]).reshape(2,2)) ...
[ "numpy.array", "numpy.zeros", "tensorflow_encrypted.LocalConfig", "tensorflow_encrypted.run" ]
[((111, 169), 'tensorflow_encrypted.LocalConfig', 'tfe.LocalConfig', (["['server0', 'server1', 'crypto_producer']"], {}), "(['server0', 'server1', 'crypto_producer'])\n", (126, 169), True, 'import tensorflow_encrypted as tfe\n'), ((691, 707), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (699, 707), True, ...
import numpy as np import lasagne.nonlinearities import lasagne.layers from base import DataLoader from utils.misc import flush_last_line from config import Configuration as Cfg class Normal_DataLoader(DataLoader): def __init__(self): DataLoader.__init__(self) self.dataset_name = "normal" ...
[ "numpy.random.seed", "numpy.ceil", "numpy.zeros", "utils.misc.flush_last_line", "numpy.arange", "numpy.random.normal", "base.DataLoader.__init__" ]
[((252, 277), 'base.DataLoader.__init__', 'DataLoader.__init__', (['self'], {}), '(self)\n', (271, 277), False, 'from base import DataLoader\n'), ((1981, 2006), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (1995, 2006), True, 'import numpy as np\n'), ((2032, 2081), 'numpy.random.normal',...
import logging from datetime import datetime from typing import Any, Dict, Optional, Union, List import requests import json from pytz import timezone from sentry_sdk import capture_exception from app import crud from app.core.security import get_password_hash, verify_password from app.crud.base import CRUDBase from ...
[ "numpy.random.dirichlet", "app.schemas.user.UserUpdate", "logging.basicConfig", "app.crud.deck.assign_viewer", "app.core.security.get_password_hash", "app.core.security.verify_password", "app.crud.history.create", "app.schemas.Repetition.select_model", "sentry_sdk.capture_exception", "pytz.timezon...
[((632, 671), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (651, 671), False, 'import logging\n'), ((681, 708), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (698, 708), False, 'import logging\n'), ((721, 748), 'sys.setrecursion...
import json import numpy as np import pandas as pd from sklearn.feature_extraction.text import CountVectorizer class TFIDF: """ Generate a class-based TF-IDF score for each movie. In other words, it will generate the most important words for a single movie compared to all other movies. C-TF-IDF c...
[ "json.dump", "numpy.divide", "sklearn.feature_extraction.text.CountVectorizer", "json.load", "numpy.multiply" ]
[((3533, 3556), 'numpy.divide', 'np.divide', (['(t + 1)', '(w + 1)'], {}), '(t + 1, w + 1)\n', (3542, 3556), True, 'import numpy as np\n'), ((3677, 3697), 'numpy.multiply', 'np.multiply', (['tf', 'idf'], {}), '(tf, idf)\n', (3688, 3697), True, 'import numpy as np\n'), ((1612, 1624), 'json.load', 'json.load', (['f'], {}...
from gurobipy import * import numpy as np def eurovision_instance_opt_voting(n, m, prefs, contesters_ids): dct = {} i = 0 for id in contesters_ids: dct[id] = i i += 1 results = np.ones((m, m)) for a in contesters_ids: for b in contesters_ids: if (a == b): ...
[ "numpy.max", "numpy.ones" ]
[((214, 229), 'numpy.ones', 'np.ones', (['(m, m)'], {}), '((m, m))\n', (221, 229), True, 'import numpy as np\n'), ((1560, 1583), 'numpy.max', 'np.max', (['results'], {'axis': '(1)'}), '(results, axis=1)\n', (1566, 1583), True, 'import numpy as np\n')]
import cv2 as cv import numpy as np # -------------------------------------------------------- # 打开摄像头 cap = cv.VideoCapture(1,cv.CAP_DSHOW) #更改API设置 flag = cap.isOpened() cap.set(3, 1280) cap.set(4, 720) # -------------------------------------------------------- # 定义棋盘 chessboard_size = (15,13) a = np.prod(chess...
[ "cv2.findChessboardCorners", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.cornerSubPix", "cv2.VideoCapture", "cv2.drawChessboardCorners", "cv2.destroyAllWindows", "numpy.prod" ]
[((112, 144), 'cv2.VideoCapture', 'cv.VideoCapture', (['(1)', 'cv.CAP_DSHOW'], {}), '(1, cv.CAP_DSHOW)\n', (127, 144), True, 'import cv2 as cv\n'), ((307, 331), 'numpy.prod', 'np.prod', (['chessboard_size'], {}), '(chessboard_size)\n', (314, 331), True, 'import numpy as np\n'), ((1946, 1968), 'cv2.destroyAllWindows', '...
import csv from torch.utils.data import Dataset, DataLoader import numpy as np from base.torchvision_dataset import TorchvisionDataset import torchvision.transforms as transforms from .preprocessing import get_target_label_idx import torch from torch.utils.data import Subset import pickle import torchvision class _2nH...
[ "torch.utils.data.Subset", "pickle.load", "numpy.array", "numpy.random.shuffle" ]
[((1040, 1075), 'torch.utils.data.Subset', 'Subset', (['train_set', 'train_idx_normal'], {}), '(train_set, train_idx_normal)\n', (1046, 1075), False, 'from torch.utils.data import Subset\n'), ((2168, 2191), 'pickle.load', 'pickle.load', (['label_dict'], {}), '(label_dict)\n', (2179, 2191), False, 'import pickle\n'), ((...
import numpy as np def read_motion(key_frames): key_motion = open("key_data_collection/Talk_05_Key.bvh", "a") key_motion.write("Frames: "+str(len(key_frames))+"\n") key_motion.write("Frame Time: 0.016667\n") whole_motion = open("key_data_collection/NaturalTalking_005.bvh", "r") check = False ...
[ "numpy.array" ]
[((607, 1162), 'numpy.array', 'np.array', (['[1, 48, 98, 187, 262, 290, 340, 690, 700, 710, 717, 786, 847, 1044, 1250, \n 1469, 1600, 1653, 1735, 1916, 2364, 2419, 2605, 2619, 2635, 2676, 2967,\n 3578, 3591, 3616, 3764, 4097, 4210, 5047, 5179, 5311, 5320, 5346, 5396,\n 5770, 5824, 6086, 6135, 6157, 6171, 6746,...
import numpy as np import pandas as pd from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix, f1_score, accuracy_score import matplotlib.pyplot as plt class NaiveBayesClassifier: """ Class to represent a Naive Bayes ...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "sklearn.model_selection.train_test_split", "sklearn.datasets.load_breast_cancer", "matplotlib.pyplot.figure", "pandas.Series", "numpy.exp", "pandas.concat", "numpy.sqrt" ]
[((5916, 5936), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (5934, 5936), False, 'from sklearn.datasets import load_breast_cancer\n'), ((5956, 6016), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'cancer.data', 'columns': 'cancer.feature_names'}), '(data=cancer.data, columns=cance...
import time import numpy from matplotlib import pyplot as plt def plot_and_show_matrix(numpy_2d_array, treshhold=0.7): t0 = time.time() arr = numpy_2d_array rowI = 0 for row in arr: colI = 0 for el in row: if colI == rowI: row[colI] = 0 elif el ...
[ "numpy.array", "matplotlib.pyplot.imshow", "matplotlib.pyplot.show", "time.time" ]
[((131, 142), 'time.time', 'time.time', ([], {}), '()\n', (140, 142), False, 'import time\n'), ((727, 768), 'matplotlib.pyplot.imshow', 'plt.imshow', (['data'], {'interpolation': '"""nearest"""'}), "(data, interpolation='nearest')\n", (737, 768), True, 'from matplotlib import pyplot as plt\n'), ((773, 783), 'matplotlib...
import os from glob import glob from typing import Optional import cv2 import numpy as np from fire import Fire from tqdm import tqdm from hubconf import DeblurGANv2 from util.predictor import Predictor, load_model def main(img_pattern: str, mask_pattern: Optional[str] = None, pretrained_model=Non...
[ "fire.Fire", "os.makedirs", "os.path.basename", "cv2.cvtColor", "numpy.hstack", "hubconf.DeblurGANv2", "util.predictor.Predictor", "util.predictor.load_model", "glob.glob", "os.path.join" ]
[((924, 955), 'util.predictor.Predictor', 'Predictor', (['model'], {'device': 'device'}), '(model, device=device)\n', (933, 955), False, 'from util.predictor import Predictor, load_model\n'), ((961, 996), 'os.makedirs', 'os.makedirs', (['out_dir'], {'exist_ok': '(True)'}), '(out_dir, exist_ok=True)\n', (972, 996), Fals...
import os os.environ["OMP_NUM_THREADS"] = '8' os.environ["OPENBLAS_NUM_THREADS"] = '8' os.environ["MKL_NUM_THREADS"] = '8' import numpy as np import numpy.ma as ma from netCDF4 import Dataset, date2num from pickle import load from glob import glob from datetime import datetime from scipy import stats from numpy import ...
[ "numpy.absolute", "numpy.triu", "numpy.sum", "numpy.mean", "numpy.arange", "numpy.tile", "numpy.exp", "numpy.diag", "netCDF4.Dataset", "numpy.std", "numpy.transpose", "scipy.stats.norm.cdf", "numpy.cumsum", "numpy.append", "scipy.stats.linregress", "numpy.diagonal", "scipy.stats.norm...
[((383, 400), 'netCDF4.Dataset', 'Dataset', (['filename'], {}), '(filename)\n', (390, 400), False, 'from netCDF4 import Dataset, date2num\n'), ((2420, 2434), 'numpy.arange', 'np.arange', (['nxy'], {}), '(nxy)\n', (2429, 2434), True, 'import numpy as np\n'), ((4440, 4453), 'numpy.arange', 'np.arange', (['nz'], {}), '(nz...
# Write your k-means unit tests here import numpy as np import pytest from cluster import * @pytest.fixture def test_clusters(): """ Construct test clusters for k-means testing """ return np.array([[2, 4], [2, 6], [-2, 4], [-2, 6], ...
[ "numpy.array", "numpy.random.RandomState" ]
[((206, 292), 'numpy.array', 'np.array', (['[[2, 4], [2, 6], [-2, 4], [-2, 6], [2, -4], [2, -6], [-2, -4], [-2, -6]]'], {}), '([[2, 4], [2, 6], [-2, 4], [-2, 6], [2, -4], [2, -6], [-2, -4], [-2,\n -6]])\n', (214, 292), True, 'import numpy as np\n'), ((733, 767), 'numpy.array', 'np.array', (['[0, 0, 0, 0, 1, 1, 1, 1]...
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider #Para mayor precisión np.finfo(np.float128) #Para excepciones np.seterr(all='raise') ''' Se define la función T(m,n,o,mat,params) donde: * m es la posición del arreglo que equivale al desplazamiento en 'x' * n es la posic...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "numpy.abs", "numpy.seterr", "matplotlib.pyplot.axes", "matplotlib.widgets.Slider", "numpy.finfo", "numpy.exp", "numpy.format_float_scientific" ]
[((112, 133), 'numpy.finfo', 'np.finfo', (['np.float128'], {}), '(np.float128)\n', (120, 133), True, 'import numpy as np\n'), ((152, 174), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (161, 174), True, 'import numpy as np\n'), ((4381, 4398), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y'],...
""" Water infiltration of an initially dry soil column with seepage boundary conditions at the right side of the domain This is an implementation of the so-called seepage boundary conditions for variable saturated domains. Common situations where this type of boundary condition is relevant include the stability analys...
[ "numpy.abs", "mdunsat.ad_utils.ad_utils.ArithmeticAverageAd", "numpy.ones", "porepy.ad.Function", "numpy.linalg.norm", "porepy.set_iterate", "numpy.round", "mdunsat.ad_utils.ad_utils.vanGenuchten", "porepy.ad.EquationManager", "porepy.ad.MpfaAd", "porepy.BoundaryCondition", "scipy.sparse.linal...
[((5567, 5626), 'porepy.meshing.cart_grid', 'pp.meshing.cart_grid', (['[]'], {'nx': '[50, 100]', 'physdims': '[200, 100]'}), '([], nx=[50, 100], physdims=[200, 100])\n', (5587, 5626), True, 'import porepy as pp\n'), ((7668, 7683), 'porepy.set_state', 'pp.set_state', (['d'], {}), '(d)\n', (7680, 7683), True, 'import por...
import math import numpy as np """ This module implements a core class Structure for lammps data file i/o and adding strain to structure. lna has the form: [a,b,c,alpha,beta,gamma]. The lattice vectors have the form of [[x,0,0],[xy,y,0],[xz,yz,z]], and the cartesian coordinates is arranged accordingly. """ __author...
[ "math.sqrt", "math.sin", "numpy.linalg.inv", "math.cos", "numpy.dot" ]
[((3549, 3588), 'math.sqrt', 'math.sqrt', (['(c ** 2 - b31 ** 2 - b32 ** 2)'], {}), '(c ** 2 - b31 ** 2 - b32 ** 2)\n', (3558, 3588), False, 'import math\n'), ((9094, 9126), 'numpy.dot', 'np.dot', (['self.lattice', 'def_tensor'], {}), '(self.lattice, def_tensor)\n', (9100, 9126), True, 'import numpy as np\n'), ((2546, ...
# Copyright (c) 2019 Microsoft Corporation # Distributed under the MIT software license import pytest import numpy as np import pandas as pd from .. import gen_feat_val_list, gen_name_from_class from .. import reverse_map, unify_data, unify_vector @pytest.fixture def fixture_feat_val_list(): return [("race", 3),...
[ "pandas.DataFrame", "pytest.raises", "numpy.array", "numpy.all" ]
[((398, 428), 'numpy.array', 'np.array', (['[[0], [1], [2], [3]]'], {}), '([[0], [1], [2], [3]])\n', (406, 428), True, 'import numpy as np\n'), ((444, 466), 'numpy.array', 'np.array', (['[0, 1, 2, 3]'], {}), '([0, 1, 2, 3])\n', (452, 466), True, 'import numpy as np\n'), ((506, 531), 'numpy.all', 'np.all', (['(new_y == ...
# ======================================================================== # # Imports # # ======================================================================== import argparse import os import numpy as np import scipy.spatial.qhull as qhull import pandas as pd from mpi4py import MPI import stk import utilities # ...
[ "numpy.trapz", "argparse.ArgumentParser", "os.path.basename", "os.path.dirname", "stk.Parallel.initialize", "numpy.hstack", "utilities.p0_printer", "stk.StkMesh", "os.path.join", "numpy.vstack" ]
[((542, 618), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""An post-processing tool for a sideset"""'}), "(description='An post-processing tool for a sideset')\n", (565, 618), False, 'import argparse\n'), ((961, 988), 'os.path.dirname', 'os.path.dirname', (['args.mfile'], {}), '(args.mf...
import torch import pandas as pd import numpy as np import pyEDM as edm class PredictionModelInterface: def __init__(self): pass def predict(self, input, target): raise NotImplementedError class SMapLegacy(PredictionModelInterface): def __init__(self, libsize: int, pre...
[ "pandas.DataFrame", "numpy.array", "numpy.hstack" ]
[((921, 947), 'numpy.hstack', 'np.hstack', (['(input, target)'], {}), '((input, target))\n', (930, 947), True, 'import numpy as np\n'), ((970, 994), 'pandas.DataFrame', 'pd.DataFrame', (['multi_data'], {}), '(multi_data)\n', (982, 994), True, 'import pandas as pd\n'), ((1978, 1999), 'numpy.array', 'np.array', (['predic...
#!/usr/bin/env python #coding:utf-8 #from http://blog.csdn.net/u011762313/article/details/49851795 ##### desc ########## #export parameters in caffe trained model #by liu:2018-2-13 ################### import caffe import numpy as np # 使输出的参数完全显示 # 若没有这一句,因为参数太多,中间会以省略号“……”的形式代替 np.set_printoptions(threshold='nan') ...
[ "caffe.Net", "numpy.set_printoptions" ]
[((282, 318), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': '"""nan"""'}), "(threshold='nan')\n", (301, 318), True, 'import numpy as np\n'), ((558, 606), 'caffe.Net', 'caffe.Net', (['MODEL_FILE', 'PRETRAIN_FILE', 'caffe.TEST'], {}), '(MODEL_FILE, PRETRAIN_FILE, caffe.TEST)\n', (567, 606), False, '...
#!/usr/bin/env python3 from matplotlib import pyplot as plt import numpy as np import pandas as pd from time import time from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import train_test_split from user_processing import get_users def example_all_ratings(): seed = int(time()) ...
[ "sklearn.ensemble.RandomForestClassifier", "numpy.random.seed", "matplotlib.pyplot.show", "pandas.read_csv", "numpy.std", "sklearn.model_selection.train_test_split", "user_processing.get_users", "time.time", "numpy.argsort", "numpy.mean", "numpy.array", "matplotlib.pyplot.tight_layout" ]
[((328, 348), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (342, 348), True, 'import numpy as np\n'), ((364, 375), 'user_processing.get_users', 'get_users', ([], {}), '()\n', (373, 375), False, 'from user_processing import get_users\n'), ((601, 637), 'pandas.read_csv', 'pd.read_csv', (['"""data/ra...
import numpy as np import matplotlib.pyplot as plt def plot_matrix(scores, stddevs, classes, title=None, cmap=plt.cm.viridis): print(scores) fig, ax = plt.subplots() im = ax.imshow(scores, interpolation='nearest', cmap=cmap, vmin=0, vmax=25) ax.figure.colorbar(im, ax=ax) # We want to show all ti...
[ "numpy.array", "numpy.arange", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((1226, 1479), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.013], [0.0, \n 0.0, 2.123, 0.796, 1.39, 0.979], [0.0, 0.0, 0.796, 18.746, 1.757, \n 14.682], [0.0, 0.0, 1.39, 1.757, 1.258, 1.301], [0.0, 0.013, 0.979, \n 14.682, 1.301, 17.137]]'], {}), '([[0.0, 0.0, 0.0...
########################################################################## # MediPy - Copyright (C) Universite de Strasbourg # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for de...
[ "itk.template", "vtk.vtkFloatArray", "numpy.sum", "numpy.subtract", "vtk.vtkPoints", "vtk.vtkAppendPolyData", "fiber_clustering.local_skeleton_clustering", "fiber_clustering.most_similar_track_mam", "numpy.diff", "vtk.vtkPolyData", "vtk.vtkCellArray" ]
[((4121, 4144), 'vtk.vtkAppendPolyData', 'vtk.vtkAppendPolyData', ([], {}), '()\n', (4142, 4144), False, 'import vtk\n'), ((9715, 9745), 'numpy.subtract', 'numpy.subtract', (['image.shape', '(1)'], {}), '(image.shape, 1)\n', (9729, 9745), False, 'import numpy\n'), ((4461, 4476), 'vtk.vtkPoints', 'vtk.vtkPoints', ([], {...
import beammech as bm import numpy as np import matplotlib.pyplot as plt beam = {} beam['length'] = 15000 beam['supports'] = (0, 15000) L1 = bm.Load(force=-2, pos=5000) L2 = bm.Load(force=-4, pos=10000) L3 = bm.MomentLoad(moment=5000, pos=0) beam['loads'] = [L1, L2,L3] x=np.linspace(0,15,15001) y=np.zeros(15001) print...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "beammech.Load", "beammech.solve", "numpy.zeros", "numpy.linspace", "beammech.MomentLoad" ]
[((142, 169), 'beammech.Load', 'bm.Load', ([], {'force': '(-2)', 'pos': '(5000)'}), '(force=-2, pos=5000)\n', (149, 169), True, 'import beammech as bm\n'), ((175, 203), 'beammech.Load', 'bm.Load', ([], {'force': '(-4)', 'pos': '(10000)'}), '(force=-4, pos=10000)\n', (182, 203), True, 'import beammech as bm\n'), ((209, ...
"""insolation.py This module contains general-purpose routines for computing incoming solar radiation at the top of the atmosphere. Currently, only daily average insolation is computed. Ported and modified from MATLAB code daily_insolation.m Original authors: <NAME> and <NAME>, Harvard University, August 2006 Av...
[ "numpy.deg2rad", "numpy.seterr", "numpy.expand_dims", "numpy.where", "numpy.array", "numpy.tile", "numpy.sin", "numpy.tan", "numpy.squeeze", "numpy.cos" ]
[((3354, 3367), 'numpy.array', 'np.array', (['lat'], {}), '(lat)\n', (3362, 3367), True, 'import numpy as np\n'), ((3380, 3393), 'numpy.array', 'np.array', (['day'], {}), '(day)\n', (3388, 3393), True, 'import numpy as np\n'), ((3406, 3426), 'numpy.array', 'np.array', (["orb['ecc']"], {}), "(orb['ecc'])\n", (3414, 3426...
import pandas as pd import numpy as np from ..dfcheck.dfcheck import column_names_check from ..dfcheck.dfcheck import dups_check from ..dfclean.dfclean import na_clean class Comparison(): def __init__(self): self.exceptions = None self.results = None self.comparison = None def compare...
[ "pandas.DataFrame", "numpy.select", "pandas.concat" ]
[((6035, 6063), 'numpy.select', 'np.select', (['conditions', 'names'], {}), '(conditions, names)\n', (6044, 6063), True, 'import numpy as np\n'), ((7420, 7591), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['rec_chk_pass', 'rec_count_x', 'rec_count_y', 'rec_count_z',\n 'rec_count_same', 'rec_count_not...
#!/usr/bin/env python import numpy as np import kepler as kp import datetime from mayavi import mlab import random from .Environment import Environment def plot_n_orbits(orbits,environment,show_plot=True,save_plot=False,title='No Title' ,show_body=True): ''' creates a 3D plot from the input rs li...
[ "mayavi.mlab.figure", "numpy.abs", "numpy.arctan2", "numpy.sin", "numpy.linalg.norm", "mayavi.mlab.quiver3d", "mayavi.mlab.axes", "mayavi.mlab.pipeline.surface", "mayavi.mlab.points3d", "numpy.max", "mayavi.sources.builtin_surface.BuiltinSurface", "datetime.timedelta", "numpy.tan", "numpy....
[((365, 440), 'mayavi.mlab.figure', 'mlab.figure', (['(1)'], {'bgcolor': '(0, 0, 0)', 'fgcolor': '(0.8, 0.8, 0.8)', 'size': '(800, 400)'}), '(1, bgcolor=(0, 0, 0), fgcolor=(0.8, 0.8, 0.8), size=(800, 400))\n', (376, 440), False, 'from mayavi import mlab\n'), ((442, 452), 'mayavi.mlab.clf', 'mlab.clf', ([], {}), '()\n',...
#!/usr/bin/python import numpy as np import pandas from nltk.corpus import stopwords from sklearn.cluster import KMeans from sklearn.decomposition import TruncatedSVD from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.decomposition import PCA...
[ "sklearn.metrics.pairwise.cosine_similarity", "sklearn.utils.extmath.randomized_svd", "warnings.filterwarnings", "sklearn.feature_extraction.text.TfidfVectorizer", "numpy.savetxt", "numpy.zeros", "time.time", "nltk.corpus.stopwords.words" ]
[((440, 473), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (463, 473), False, 'import warnings\n'), ((662, 757), 'sklearn.feature_extraction.text.TfidfVectorizer', 'TfidfVectorizer', ([], {'stop_words': 'stopset', 'min_df': '(1)', 'max_df': '(0.7)', 'use_idf': '(True)', ...
from hevc_predictor import Predictor import numpy as np from tqdm import tqdm import random import cv2 def offline_augmenter(odp_batch=None, output_path = None, mode_data=False): """ Computes structural similarity and mse metrics to return X best augmentation patches. specify X as multiplier. ...
[ "tqdm.tqdm", "hevc_predictor.Predictor", "cv2.imwrite", "random.choice", "cv2.imread", "numpy.random.choice" ]
[((2561, 2598), 'hevc_predictor.Predictor', 'Predictor', ([], {'odp': 'odp', 'diskpath': 'diskpath'}), '(odp=odp, diskpath=diskpath)\n', (2570, 2598), False, 'from hevc_predictor import Predictor\n'), ((3255, 3273), 'hevc_predictor.Predictor', 'Predictor', ([], {'odp': 'odp'}), '(odp=odp)\n', (3264, 3273), False, 'from...
# Copyright 2017 Battelle Energy Alliance, 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
[ "numpy.absolute", "warnings.simplefilter", "numpy.asarray", "crowTestUtils.findCrowModule", "numpy.linalg.eig", "numpy.argsort", "numpy.reshape", "crowTestUtils.checkArrayAllClose", "sys.exit" ]
[((895, 947), 'warnings.simplefilter', 'warnings.simplefilter', (['"""default"""', 'DeprecationWarning'], {}), "('default', DeprecationWarning)\n", (916, 947), False, 'import warnings\n'), ((1101, 1139), 'crowTestUtils.findCrowModule', 'utils.findCrowModule', (['"""distribution1D"""'], {}), "('distribution1D')\n", (112...
import numpy as np import argparse import yaml import torch import glo import utils import os # Arguments parser = argparse.ArgumentParser( description='Train GLANN.' ) parser.add_argument('config', type=str, help='Path to cofig file.') args = parser.parse_args() try: from yaml import CLoader as Loader, CDum...
[ "numpy.load", "yaml.load", "utils.GLOParams", "argparse.ArgumentParser", "glo.GLOTrainer", "utils.OptParams" ]
[((116, 167), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train GLANN."""'}), "(description='Train GLANN.')\n", (139, 167), False, 'import argparse\n'), ((764, 783), 'numpy.load', 'np.load', (['train_path'], {}), '(train_path)\n', (771, 783), True, 'import numpy as np\n'), ((836, 887)...
""" """ import numpy as np from ..prebuilt_model_factory import HodModelFactory from ...occupation_models.occupation_model_template import OccupationComponent from ....sim_manager import FakeSim class DummyCLF(OccupationComponent): """ Bare bones class used to verify that HodMockFactory supports CLF-style models...
[ "numpy.dtype", "numpy.zeros_like" ]
[((853, 917), 'numpy.dtype', 'np.dtype', (["[('luminosity', 'f4'), ('halo_num_' + gal_type, 'i4')]"], {}), "([('luminosity', 'f4'), ('halo_num_' + gal_type, 'i4')])\n", (861, 917), True, 'import numpy as np\n'), ((1041, 1060), 'numpy.zeros_like', 'np.zeros_like', (['mass'], {}), '(mass)\n', (1054, 1060), True, 'import ...
"""Interactive correlogram. Shamelessly pilfered from https://towardsdatascience.com/altair-plot-deconstruction-visualizing-the-correlation-structure-of-weather-data-38fb5668c5b1 """ import re import altair as alt import numpy as np import pandas as pd def compute_2d_histogram( df: pd.DataFrame, var1: str,...
[ "pandas.DataFrame", "numpy.histogram2d", "altair.Chart", "altair.EncodingSortField", "altair.selection_single", "altair.value", "pandas.Series", "altair.Scale", "re.sub", "altair.Color" ]
[((567, 644), 'numpy.histogram2d', 'np.histogram2d', (['df.loc[notnull, var1]', 'df.loc[notnull, var2]'], {'density': 'density'}), '(df.loc[notnull, var1], df.loc[notnull, var2], density=density)\n', (581, 644), True, 'import numpy as np\n'), ((772, 815), 'pandas.Series', 'pd.Series', (["[f'{num:.4g}' for num in xedges...
import pandas as pd from dateutil.relativedelta import relativedelta import scipy.fft import numpy as np import pywt from spoef.utils import ( prepare_data_yearly, prepare_data_quarterly, ) def compute_list_featuretypes( data, list_featuretypes, fourier_n_largest_frequencies, wavelet_depth, ...
[ "pandas.DataFrame", "pywt.wavedec", "pywt.dwt", "dateutil.relativedelta.relativedelta", "numpy.argsort", "numpy.imag", "spoef.utils.prepare_data_yearly", "spoef.utils.prepare_data_quarterly", "numpy.real", "pandas.Series", "pandas.concat" ]
[((1701, 1715), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1713, 1715), True, 'import pandas as pd\n'), ((1739, 1753), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1751, 1753), True, 'import pandas as pd\n'), ((1777, 1791), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1789, 1791), True, ...
# Copyright 2018 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
[ "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.imshow", "numpy.zeros", "numpy.transpose", "absl.flags.DEFINE_string", "matplotlib.pyplot.draw", "numpy.shape", "matplotlib.use", "absl.flags.DEFINE_integer", "pdb.set_trace", "absl.app.run", "numpy.arange", "numpy.squeeze" ]
[((1079, 1102), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (1093, 1102), False, 'import matplotlib\n'), ((1431, 1586), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""data_location"""', '"""/home/retina_data/datasets/2016-04-21-1/data006(2016-04-21-1_data006_data006)/"""', '"""wh...
import numpy as np from PuzzleLib.Backend import gpuarray, Blas from PuzzleLib.Backend.gpuarray import memoryPool as memPool from PuzzleLib.Backend.Kernels.ElementWise import l1gradKer from PuzzleLib.Cost.Cost import Cost class Abs(Cost): def calcGrad(self, pred, target): grad = gpuarray.empty(pred.shape, dtype=...
[ "numpy.random.randn", "PuzzleLib.Backend.gpuarray.empty", "PuzzleLib.Backend.Blas.vectorL1Norm", "PuzzleLib.Backend.Kernels.ElementWise.l1gradKer", "numpy.prod" ]
[((287, 350), 'PuzzleLib.Backend.gpuarray.empty', 'gpuarray.empty', (['pred.shape'], {'dtype': 'np.float32', 'allocator': 'memPool'}), '(pred.shape, dtype=np.float32, allocator=memPool)\n', (301, 350), False, 'from PuzzleLib.Backend import gpuarray, Blas\n'), ((391, 426), 'PuzzleLib.Backend.Kernels.ElementWise.l1gradKe...
# -*- coding: utf-8 -*- """ Created on Thu Feb 28 11:21:09 2019 @author: lwg """ import numpy as np import matplotlib.pyplot as plt # 导数定义 def numerical_diff(f, x): h = 1e-4 # 0.0001 return (f(x+h) - f(x-h)) / (2*h) # 函数 y=0.01*x^2 + 0.1*x def function_1(x): return 0.01*x**2 + 0.1*x # 画直线 def tangent_l...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((436, 461), 'numpy.arange', 'np.arange', (['(0.0)', '(20.0)', '(0.1)'], {}), '(0.0, 20.0, 0.1)\n', (445, 461), True, 'import numpy as np\n'), ((537, 552), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""x"""'], {}), "('x')\n", (547, 552), True, 'import matplotlib.pyplot as plt\n'), ((553, 568), 'matplotlib.pyplot.yla...
#!/usr/bin/env python # coding: utf-8 # In[8]: import matplotlib.pyplot as plt import numpy as np x = np.loadtxt('random_number.txt') y = np.loadtxt('using_equation.txt') plt.title('Visualization') plt.plot(x,y) plt.xlabel('x') plt.ylabel('y') plt.savefig('Visualization.jpg') # In[ ]:
[ "matplotlib.pyplot.title", "matplotlib.pyplot.plot", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((106, 137), 'numpy.loadtxt', 'np.loadtxt', (['"""random_number.txt"""'], {}), "('random_number.txt')\n", (116, 137), True, 'import numpy as np\n'), ((142, 174), 'numpy.loadtxt', 'np.loadtxt', (['"""using_equation.txt"""'], {}), "('using_equation.txt')\n", (152, 174), True, 'import numpy as np\n'), ((176, 202), 'matpl...
''' Created on Sep 18, 2019 @author: Anik ''' from matplotlib import style from numpy import ones, vstack from numpy.linalg import lstsq, norm from os import listdir from os.path import isfile, join from PIL import Image, ImageEnhance from skimage.color import rgb2gray from sklearn.cluster import KMeans from skimage....
[ "PIL.Image.new", "matplotlib.style.use", "pygame.event.get", "pygame.display.update", "numpy.linalg.norm", "pygame.draw.lines", "os.path.join", "colorsys.rgb_to_hsv", "skimage.color.rgb2gray", "sklearn.cluster.KMeans", "pygame.display.set_mode", "pygame.transform.scale", "pygame.display.set_...
[((608, 621), 'pygame.init', 'pygame.init', ([], {}), '()\n', (619, 621), False, 'import colorsys, matplotlib.pyplot, numpy, os, pygame, sys\n'), ((22702, 22745), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'img.size', '(255, 255, 255)'], {}), "('RGB', img.size, (255, 255, 255))\n", (22711, 22745), False, 'from PIL im...
import io import numpy as np import sys src_path = sys.argv[1] src_word = sys.argv[2] tgt_word = sys.argv[3] def load_vec(emb_path, nmax=50000): vectors = [] word2id = {} with io.open(emb_path, 'r', encoding='utf-8', newline='\n', errors='ignore') as f: next(f) for i, line in enumerate(f):...
[ "numpy.fromstring", "numpy.vstack", "io.open" ]
[((678, 696), 'numpy.vstack', 'np.vstack', (['vectors'], {}), '(vectors)\n', (687, 696), True, 'import numpy as np\n'), ((190, 261), 'io.open', 'io.open', (['emb_path', '"""r"""'], {'encoding': '"""utf-8"""', 'newline': '"""\n"""', 'errors': '"""ignore"""'}), "(emb_path, 'r', encoding='utf-8', newline='\\n', errors='ig...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns def filter_data(data, condition): """ Remove elements that do not match the condition provided. Takes a data list as input and returns a filtered list. Conditions should be a list of strings of the following fo...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.hist", "matplotlib.pyplot.bar", "numpy.floor", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((4162, 4188), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 6)'}), '(figsize=(8, 6))\n', (4172, 4188), True, 'import matplotlib.pyplot as plt\n'), ((6292, 6312), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['key_name'], {}), '(key_name)\n', (6302, 6312), True, 'import matplotlib.pyplot as plt\n'), ((...
# -*- coding: utf-8 -*- """ Data augmentation usage ======================= Credit: <NAME> A simple example on how to use a data augmentation. More specifically, learn how to use a set of tools to efficiently augment 3D MRI images. It includes random affine/non linear transformations, simulation of intensity artifact...
[ "brainrise.ToTensor", "brainrise.Rescale", "matplotlib.pyplot.show", "brainrise.RandomAffine", "torch.utils.data.DataLoader", "numpy.asarray", "brainrise.RandomNoise", "brainrise.get_augmentations", "brainrise.datasets.MRIToyDataset", "torchvision.utils.make_grid", "torchvision.transforms.functi...
[((875, 904), 'brainrise.get_augmentations', 'brainrise.get_augmentations', ([], {}), '()\n', (902, 904), False, 'import brainrise\n'), ((905, 917), 'pprint.pprint', 'pprint', (['trfs'], {}), '(trfs)\n', (911, 917), False, 'from pprint import pprint\n'), ((1644, 1691), 'brainrise.datasets.MRIToyDataset', 'MRIToyDataset...
import cv2 import numpy as np from tqdm import tqdm from time import time from scipy.signal import medfilt import pdb # block of size in mesh PIXELS = 16 # motion propogation radius RADIUS = 300 # RADIUS = 30 def point_transform(H, pt): """ @param: H is homography matrix of dimension (3x3) @param: pt i...
[ "numpy.median", "numpy.asarray", "numpy.zeros", "numpy.expand_dims", "scipy.signal.medfilt", "cv2.remap", "time.time", "numpy.array", "cv2.findHomography" ]
[((1836, 1890), 'cv2.findHomography', 'cv2.findHomography', (['old_points', 'new_points', 'cv2.RANSAC'], {}), '(old_points, new_points, cv2.RANSAC)\n', (1854, 1890), False, 'import cv2\n'), ((1925, 1931), 'time.time', 'time', ([], {}), '()\n', (1929, 1931), False, 'from time import time\n'), ((2208, 2214), 'time.time',...
# -*- coding: utf-8 -*- # Author:Joe-BU # Date: 2019-04-09 import pandas as pd import numpy as np import json from datetime import datetime, timedelta import sys import os import argparse pd.set_option("display.width", 1000) from MaxDataEvaluator import MaxDataEvaluator from model_config import base_con...
[ "json.load", "os.makedirs", "argparse.ArgumentParser", "os.path.exists", "datetime.timedelta", "numpy.array", "MaxDataEvaluator.MaxDataEvaluator", "pandas.set_option" ]
[((202, 238), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(1000)'], {}), "('display.width', 1000)\n", (215, 238), True, 'import pandas as pd\n'), ((426, 447), 'os.path.exists', 'os.path.exists', (['path1'], {}), '(path1)\n', (440, 447), False, 'import os\n'), ((485, 543), 'argparse.ArgumentParser', ...
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
[ "matplotlib.pyplot.title", "numpy.sum", "seaborn.heatmap", "re.finditer", "networkx.connected_components", "matplotlib.pyplot.figure", "pandas.DataFrame", "gzip.GzipFile", "collections.Counter", "pandas.concat", "matplotlib.pyplot.show", "pandas.DataFrame.from_dict", "matplotlib.pyplot.ylabe...
[((1171, 1248), 'collections.namedtuple', 'collections.namedtuple', (['"""Read"""', "['title', 'title_aux', 'sequence', 'quality']"], {}), "('Read', ['title', 'title_aux', 'sequence', 'quality'])\n", (1193, 1248), False, 'import collections\n'), ((5390, 5411), 'collections.Counter', 'collections.Counter', ([], {}), '()...
# notam-mapper.py # # Copyright 2020 ravi <<EMAIL>> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # T...
[ "matplotlib.pyplot.show", "numpy.arctan2", "pathlib.Path", "numpy.sin", "re.findall", "numpy.cos", "cartopy.crs.PlateCarree", "matplotlib.pyplot.subplots", "numpy.sqrt" ]
[((5482, 5498), 'numpy.arctan2', 'np.arctan2', (['Y', 'X'], {}), '(Y, X)\n', (5492, 5498), True, 'import numpy as np\n'), ((5506, 5528), 'numpy.sqrt', 'np.sqrt', (['(X * X + Y * Y)'], {}), '(X * X + Y * Y)\n', (5513, 5528), True, 'import numpy as np\n'), ((5536, 5554), 'numpy.arctan2', 'np.arctan2', (['Z', 'hyp'], {}),...
from numbers import Number from typing import List, Union import numpy as np from bayesian_testing.metrics.posteriors import ( beta_posteriors_all, lognormal_posteriors, normal_posteriors, dirichlet_posteriors, ) from bayesian_testing.utilities import get_logger logger = get_logger("bayesian_testing"...
[ "bayesian_testing.metrics.posteriors.lognormal_posteriors", "bayesian_testing.metrics.posteriors.beta_posteriors_all", "bayesian_testing.metrics.posteriors.dirichlet_posteriors", "numpy.argmax", "bayesian_testing.utilities.get_logger", "numpy.random.SeedSequence", "bayesian_testing.metrics.posteriors.no...
[((291, 321), 'bayesian_testing.utilities.get_logger', 'get_logger', (['"""bayesian_testing"""'], {}), "('bayesian_testing')\n", (301, 321), False, 'from bayesian_testing.utilities import get_logger\n'), ((1045, 1068), 'numpy.argmax', 'np.argmax', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (1054, 1068), True, 'im...
#!/usr/bin/env python u""" shift_shapefiles.py <NAME> Shift centerlines to fix the point mode / area mode geotiff shift http://geotiff.maptools.org/spec/geotiff2.5.html """ import os import sys import getopt import numpy as np import pandas as pd import geopandas as gpd from rasterio.crs import CRS from shapely.geome...
[ "getopt.getopt", "os.path.join", "numpy.array", "rasterio.crs.CRS.from_dict", "os.path.expanduser", "os.listdir" ]
[((493, 546), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', '"""D:F:X:Y:"""', 'long_options'], {}), "(sys.argv[1:], 'D:F:X:Y:', long_options)\n", (506, 546), False, 'import getopt\n'), ((1137, 1153), 'os.listdir', 'os.listdir', (['ddir'], {}), '(ddir)\n', (1147, 1153), False, 'import os\n'), ((593, 616), 'os.path...
from cloudmosh.components.io import ReadImage,SaveImage,ReadVideoOrGIF,SaveGIF import nutsflow import pytest import numpy as np #TODO: Test transparent PNGs #TODO: Test load image-as-binary and conversion to RGB. def test_ReadImage_PNG(): result = ReadImage("test/testdata/colorbars.png") >> nutsflow.Collect() asser...
[ "cloudmosh.components.io.ReadVideoOrGIF", "nutsflow.Collect", "pytest.raises", "cloudmosh.components.io.ReadImage", "numpy.array_equal" ]
[((1635, 1706), 'cloudmosh.components.io.ReadImage', 'ReadImage', (['"""test/testdata/colorbars.png"""', '"""test/testdata/colorbars.jpg"""'], {}), "('test/testdata/colorbars.png', 'test/testdata/colorbars.jpg')\n", (1644, 1706), False, 'from cloudmosh.components.io import ReadImage, SaveImage, ReadVideoOrGIF, SaveGIF\...
""" This module contains functions for tensors Notes: * The functions are for tensors defined as numpy.array objects. """ import numpy as np def delta(shape): """ Return delta tensor of given shape, i.e. element values of 1 when all non-dummy indices are equal, 0 otherwise. :param shape: Shape of ten...
[ "numpy.any", "numpy.ndindex", "numpy.array", "numpy.ones" ]
[((470, 495), 'numpy.ones', 'np.ones', (['shape'], {'dtype': 'int'}), '(shape, dtype=int)\n', (477, 495), True, 'import numpy as np\n'), ((538, 555), 'numpy.array', 'np.array', (['n.shape'], {}), '(n.shape)\n', (546, 555), True, 'import numpy as np\n'), ((618, 637), 'numpy.ndindex', 'np.ndindex', (['n.shape'], {}), '(n...
# ----------------------------------------------------------------------------------------------------- # CONDOR # Simulator for diffractive single-particle imaging experiments with X-ray lasers # http://xfel.icm.uu.se/condor/ # -------------------------------------------------------------------------------------------...
[ "condor.utils.log.log_execution_time", "condor.utils.log.log_and_raise_error", "numpy.arctan2", "distutils.version.StrictVersion", "spsim.simulate_shot", "numpy.angle", "condor.utils.log.log_info", "numpy.exp", "spsim.free_output_in_options", "spsim.write_pdb_from_mol", "spsim.write_options_file...
[((2327, 2354), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2344, 2354), False, 'import logging\n'), ((7250, 7276), 'condor.utils.log.log_execution_time', 'log_execution_time', (['logger'], {}), '(logger)\n', (7268, 7276), False, 'from condor.utils.log import log, log_execution_time\n...
#!/usr/bin/env python #=============================================================================# # # # NAME: do_RMclean_1D.py # # ...
[ "numpy.abs", "argparse.ArgumentParser", "numpy.sum", "RMutils.util_RM.measure_fdf_complexity", "matplotlib.pyplot.figure", "RMutils.util_RM.measure_FDF_parms", "numpy.power", "matplotlib.ticker.MaxNLocator", "os.path.exists", "matplotlib.pyplot.draw", "numpy.loadtxt", "numpy.squeeze", "sys.e...
[((4184, 4213), 'numpy.power', 'np.power', (['(C / freqArr_Hz)', '(2.0)'], {}), '(C / freqArr_Hz, 2.0)\n', (4192, 4213), True, 'import numpy as np\n'), ((4697, 4708), 'time.time', 'time.time', ([], {}), '()\n', (4706, 4708), False, 'import time\n'), ((6215, 6226), 'time.time', 'time.time', ([], {}), '()\n', (6224, 6226...
import logging import os from functools import lru_cache from typing import Dict import numpy as np import pandas as pd from pandas_ml_utils.constants import * from pandas_ml_utils.summary.summary import Summary from sklearn.metrics import f1_score from pandas_ml_utils.utils.functions import unique, unique_top_level...
[ "matplotlib.pyplot.subplot", "os.path.abspath", "matplotlib.pyplot.close", "pandas_ml_utils.utils.functions.unique_top_level_columns", "pandas.plotting.register_matplotlib_converters", "sklearn.metrics.f1_score", "matplotlib.pyplot.figure", "numpy.array", "pandas.Series", "matplotlib.gridspec.Grid...
[((337, 364), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (354, 364), False, 'import logging\n'), ((2511, 2543), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (2541, 2543), False, 'from pandas.plotting import register_matplotlib_c...
import os import torch import torch.nn as nn from torch.nn import functional as F import torch.optim as optim import numpy as np from transformer_split.encoders import PoseEncoder from transformer_split.decoder import Decoder from transformer_split.discriminator import Discriminator def kl_divergence(mu, logvar): ...
[ "torch.ones", "os.path.join", "torch.rand", "torch.sum", "transformer_split.discriminator.Discriminator", "torch.load", "torch.split", "transformer_split.encoders.PoseEncoder", "numpy.ones", "torch.cat", "torch.nn.functional.cross_entropy", "torch.normal", "torch.max", "torch.device", "t...
[((535, 551), 'numpy.ones', 'np.ones', (['n_epoch'], {}), '(n_epoch)\n', (542, 551), True, 'import numpy as np\n'), ((961, 1295), 'transformer_split.encoders.PoseEncoder', 'PoseEncoder', ([], {'root_size': 'args.root_size', 'feature_size': 'args.dim_per_limb', 'latent_size': 'args.latent_dim', 'batch_size': 'args.batch...
#! /usr/bin/env python """Tests for ``catalog_seed_generator.py`` module Authors ------- <NAME> Use --- These tests can be run via the command line: :: pytest -s test_catalog_seed_generator.py """ from astropy.table import Table import numpy as np import os import webbpsf from mirage.seed_im...
[ "mirage.seed_image.catalog_seed_image.Catalog_seed", "astropy.table.Table", "os.path.join", "os.path.expandvars", "numpy.arange", "webbpsf.NIRCam", "os.path.expanduser", "numpy.repeat" ]
[((420, 443), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (438, 443), False, 'import os\n'), ((473, 508), 'os.path.expandvars', 'os.path.expandvars', (['"""$CONDA_PREFIX"""'], {}), "('$CONDA_PREFIX')\n", (491, 508), False, 'import os\n'), ((542, 586), 'os.path.join', 'os.path.join', (['env...
import sys import re from shapely.wkt import loads as load_wkt from shapely import affinity from matplotlib.patches import PathPatch from matplotlib.path import Path import matplotlib.pyplot as plt import numpy as np import time,math #from progressbar import ProgressBar from sklearn.preprocessing import LabelEncoder, O...
[ "random.randint", "numpy.copy", "shapely.affinity.translate", "numpy.asarray", "numpy.zeros", "sklearn.preprocessing.OneHotEncoder", "numpy.ones", "shapely.affinity.scale", "sklearn.preprocessing.LabelEncoder", "matplotlib.path.Path", "matplotlib.pyplot.figure", "numpy.array", "numpy.arange"...
[((3969, 3990), 'numpy.array', 'np.array', (['p_sequences'], {}), '(p_sequences)\n', (3977, 3990), True, 'import numpy as np\n'), ((4009, 4030), 'numpy.array', 'np.array', (['n_sequences'], {}), '(n_sequences)\n', (4017, 4030), True, 'import numpy as np\n'), ((4326, 4342), 'numpy.array', 'np.array', (['labels'], {}), '...
import os, os.path import random import numpy as np import matplotlib.pyplot as plt import time import math import itertools import tensorflow as tf from collections import deque from tensorflow.keras.optimizers import Adam from tensorflow.keras.layers import Dense, Conv1D, MaxPooling1D, Flatten, concatenate, Conv2D, M...
[ "tensorflow.keras.layers.MaxPooling2D", "numpy.sum", "tensorflow.clip_by_value", "tensorflow.keras.layers.Dense", "random.sample", "numpy.argmax", "numpy.clip", "tensorflow.keras.losses.CategoricalCrossentropy", "tensorflow.keras.layers.concatenate", "numpy.round", "collections.deque", "tensor...
[((675, 772), 'tensorflow.keras.layers.Conv2D', 'Conv2D', ([], {'filters': '(16)', 'kernel_size': '(3)', 'activation': '"""relu"""', 'padding': '"""valid"""', 'input_shape': 'state_size'}), "(filters=16, kernel_size=3, activation='relu', padding='valid',\n input_shape=state_size)\n", (681, 772), False, 'from tensorf...
import copy import numpy as np import matplotlib.pyplot as plt class MazeEnv(object): def __init__(self, dim, probability, fix_start=False): self.STATE_DIM = dim self.ACTION_DIM = 4 self.MAX_STEP = 40 self.PROBABILITY = probability self.FIX_START = fix_start self.W...
[ "copy.deepcopy", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "copy.copy", "matplotlib.pyplot.ion", "numpy.reshape", "numpy.random.rand", "numpy.squeeze", "matplotlib.pyplot.pause", "numpy.random.random_integers" ]
[((438, 480), 'numpy.zeros', 'np.zeros', (['[self.STATE_DIM, self.STATE_DIM]'], {}), '([self.STATE_DIM, self.STATE_DIM])\n', (446, 480), True, 'import numpy as np\n'), ((1021, 1107), 'copy.deepcopy', 'copy.deepcopy', (['[self.map_matrix, self.car_location, self.current_step, self.done]'], {}), '([self.map_matrix, self....
import matplotlib.pyplot as plt import numpy as np __all__ = [ 'calculate_enrichment_factor', 'convert_label_to_zero_or_one', 'plot_predictiveness_curve', ] def _normalize(arr): return (arr-arr.min()) / (arr.max()-arr.min()) def _set_axes(ax, lim, fontsize): ax.set_xlim(left=lim[0], right=lim[1...
[ "numpy.count_nonzero", "numpy.floor", "numpy.argsort", "numpy.sort", "matplotlib.pyplot.figure", "numpy.frompyfunc", "numpy.array", "numpy.append", "numpy.linspace", "numpy.any", "numpy.array_equal", "numpy.unique" ]
[((2747, 2762), 'numpy.array', 'np.array', (['risks'], {}), '(risks)\n', (2755, 2762), True, 'import numpy as np\n'), ((2776, 2792), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (2784, 2792), True, 'import numpy as np\n'), ((2857, 2886), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(points + 1)'], {}...
import chainer import chainer.links as L import chainer.functions as F from lda2vec import utils, dirichlet_likelihood import numpy as np class NSLDA(chainer.Chain): def __init__(self, counts, n_docs, n_topics, n_dim, n_vocab, n_samples=5): factors = np.random.random((n_topics, n_dim)).astype('float32')...
[ "chainer.links.EmbedID", "chainer.functions.softmax", "numpy.random.randn", "chainer.links.Parameter", "lda2vec.utils.move", "chainer.links.NegativeSampling", "numpy.random.random", "lda2vec.dirichlet_likelihood", "numpy.prod" ]
[((341, 385), 'chainer.links.NegativeSampling', 'L.NegativeSampling', (['n_dim', 'counts', 'n_samples'], {}), '(n_dim, counts, n_samples)\n', (359, 385), True, 'import chainer.links as L\n'), ((419, 459), 'numpy.random.randn', 'np.random.randn', (['*loss_func.W.data.shape'], {}), '(*loss_func.W.data.shape)\n', (434, 45...
import re import os import sys import numpy as np import pandas as pd import tensorflow as tf import tensorflow.keras as keras import tensorflow.keras.backend as K from tqdm import tqdm from tensorflow.keras.utils import plot_model from tensorflow.keras.optimizers import Adam from tensorflow.keras.losses import mean_s...
[ "numpy.load", "numpy.sum", "scipy.spatial.distance_matrix", "numpy.argsort", "utils.npytar.NpyTarReader", "numpy.mean", "tensorflow.gather", "os.path.exists", "tensorflow.keras.utils.plot_model", "tensorflow.keras.optimizers.Adam", "tensorflow.norm", "numpy.save", "re.split", "numpy.asarra...
[((710, 736), 'utils.npytar.NpyTarReader', 'npytar.NpyTarReader', (['fname'], {}), '(fname)\n', (729, 736), False, 'from utils import npytar\n'), ((2049, 2125), 'tensorflow.keras.utils.plot_model', 'plot_model', (['encoder'], {'to_file': '"""results_gae/gae_encoder.pdf"""', 'show_shapes': '(True)'}), "(encoder, to_file...
"""Utilities for loading and processing experiment results.""" # pylint:disable=missing-docstring,unsubscriptable-object from __future__ import annotations import itertools import json import logging import os from ast import literal_eval from collections import namedtuple from functools import reduce from typing impo...
[ "pandas.DataFrame", "numpy.less_equal", "json.load", "itertools.groupby", "json.loads", "pandas.read_csv", "numpy.asarray", "numpy.isnan", "numpy.max", "numpy.min", "collections.namedtuple", "functools.reduce", "logging.getLogger" ]
[((394, 421), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (411, 421), False, 'import logging\n'), ((469, 536), 'collections.namedtuple', 'namedtuple', (['"""ExperimentData"""', "['progress', 'params', 'flat_params']"], {}), "('ExperimentData', ['progress', 'params', 'flat_params'])\n",...
import numpy as np import pandas as pd import collections from datetime import datetime from datetime import timedelta import os ''' THIS CLASS HAS MULTIPLE FUNCTIONS FOR DATA LOADING AND STORING ''' class DataHandler(object): ''' This function splits the data in train/test/dev sets and slices it into "game ...
[ "pandas.DataFrame", "pandas.read_csv", "os.getcwd", "datetime.datetime", "pandas.to_datetime", "numpy.array", "datetime.timedelta", "datetime.datetime.now" ]
[((631, 685), 'datetime.datetime', 'datetime', (['start_year', 'start_month', 'start_day', '(12)', '(0)', '(0)'], {}), '(start_year, start_month, start_day, 12, 0, 0)\n', (639, 685), False, 'from datetime import datetime\n'), ((1118, 1207), 'pandas.read_csv', 'pd.read_csv', (['"""data/data_prices_daycat_2.csv"""'], {'s...
import numpy as np import cv2 import torch from torch.utils.data import DataLoader, Dataset from utils import run_length_decode import pickle import os import pywt def get_decomosition(img, mean, std): coeffs = pywt.dwt2(img, 'haar') LL, (LH, HL, HH) = coeffs wavelet_decomp = np.zeros(LL.shape+(2,), dtype=...
[ "utils.run_length_decode", "numpy.zeros", "numpy.transpose", "cv2.imread", "pickle.load", "pywt.dwt2", "numpy.round", "os.path.join", "torch.from_numpy" ]
[((216, 238), 'pywt.dwt2', 'pywt.dwt2', (['img', '"""haar"""'], {}), "(img, 'haar')\n", (225, 238), False, 'import pywt\n'), ((290, 333), 'numpy.zeros', 'np.zeros', (['(LL.shape + (2,))'], {'dtype': 'np.float32'}), '(LL.shape + (2,), dtype=np.float32)\n', (298, 333), True, 'import numpy as np\n'), ((1272, 1321), 'os.pa...
# -*- coding: utf-8 -*- # @Time : 2020/2/16 10:50 下午 # @Author : 徐缘 # @FileName: tf_distribute_strategy.py # @Software: PyCharm """ https://tensorflow.google.cn/api_docs/python/tf/distribute/experimental/ParameterServerStrategy """ from __future__ import absolute_import, division, print_function, unicode_literal...
[ "numpy.load", "tensorflow.keras.layers.Dropout", "tensorflow.keras.layers.Dense", "json.dumps", "tensorflow.data.Dataset.from_tensor_slices", "tensorflow.distribute.experimental.MultiWorkerMirroredStrategy", "tensorflow.keras.layers.Flatten" ]
[((1126, 1246), 'json.dumps', 'json.dumps', (["{'cluster': {'worker': ['localhost:12345', 'localhost:23456']}, 'tasks': {\n 'type': 'worker', 'index': 0}}"], {}), "({'cluster': {'worker': ['localhost:12345', 'localhost:23456']},\n 'tasks': {'type': 'worker', 'index': 0}})\n", (1136, 1246), False, 'import json\n')...
"""Demonstration of how to use the API. """ import matplotlib import matplotlib.pyplot as plt import numpy as np from stock_trading_backend import api, train, backtest agent = api.get_agent_object("q_learning_agent", "generated_1", "net_worth_ratio", "neural_network") reward_history, loss...
[ "stock_trading_backend.api.get_agent_object", "numpy.ones", "matplotlib.pyplot.subplots", "numpy.array", "stock_trading_backend.backtest.backtest_agent", "stock_trading_backend.train.train_agent", "matplotlib.pyplot.savefig" ]
[((178, 274), 'stock_trading_backend.api.get_agent_object', 'api.get_agent_object', (['"""q_learning_agent"""', '"""generated_1"""', '"""net_worth_ratio"""', '"""neural_network"""'], {}), "('q_learning_agent', 'generated_1', 'net_worth_ratio',\n 'neural_network')\n", (198, 274), False, 'from stock_trading_backend im...
import dataclasses from typing import Dict, List import numpy as onp import pytest from jax import numpy as jnp import jax_dataclasses def test_copy_and_mutate(): # frozen=True should do nothing @jax_dataclasses.pytree_dataclass(frozen=True) class Foo: array: jnp.ndarray @jax_dataclasses.py...
[ "numpy.zeros", "numpy.ones", "jax_dataclasses.static_field", "pytest.raises", "jax_dataclasses.pytree_dataclass", "jax_dataclasses.copy_and_mutate" ]
[((208, 253), 'jax_dataclasses.pytree_dataclass', 'jax_dataclasses.pytree_dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (240, 253), False, 'import jax_dataclasses\n'), ((635, 681), 'pytest.raises', 'pytest.raises', (['dataclasses.FrozenInstanceError'], {}), '(dataclasses.FrozenInstanceError)\n', (648, 681)...
from ast import copy_location import numpy as np from numpy.testing._private.utils import assert_ # from .board import ConwayBoard class ConwayCanvan: def __init__(self, size, scale=1): self._bgd_color = None self._fgd_color = None self._scale = scale self._size = size[:2] de...
[ "numpy.full", "numpy.empty", "numpy.where" ]
[((1274, 1328), 'numpy.where', 'np.where', (['temp_state', 'self._fgd_color', 'self._bgd_color'], {}), '(temp_state, self._fgd_color, self._bgd_color)\n', (1282, 1328), True, 'import numpy as np\n'), ((2007, 2104), 'numpy.full', 'np.full', (['(self._size[0] * self._scale, self._size[1] * self._scale, 3)', 'color'], {'d...
#!/usr/bin/env python3 # Pipeline: # Input from arduino sensors (blocking) and pi camera # Output to UI (on udp client) # Output to nav (on queue) # Output to obstacle avoidance (on queue) import sys, serial, json, socket, datetime, time, threading, copy, math, sys import numpy as np import cv2 import imutil...
[ "serial.Serial", "threading.Thread", "copy.deepcopy", "imutils.video.VideoStream", "socket.socket", "numpy.zeros", "json.dumps", "time.sleep", "threading.Lock", "help_lib.myput", "cv2.imencode", "imutils.resize", "help_lib.create_logger", "datetime.datetime.now" ]
[((582, 608), 'help_lib.create_logger', 'hl.create_logger', (['__name__'], {}), '(__name__)\n', (598, 608), True, 'import help_lib as hl\n'), ((1015, 1031), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1029, 1031), False, 'import sys, serial, json, socket, datetime, time, threading, copy, math, sys\n'), ((743...
""" This module provides unit tests for the functions in ofco.warping. """ import numpy as np from scipy.signal import correlate2d from ofco.warping import * def test_bilinear_interpolate(): """ Tests for the bilinear interpolation function. """ img = np.zeros((50, 50)) img[10:15, 20:30] = 1 ...
[ "numpy.allclose", "numpy.floor", "numpy.zeros", "numpy.ones", "numpy.isnan", "numpy.arange", "numpy.array" ]
[((272, 290), 'numpy.zeros', 'np.zeros', (['(50, 50)'], {}), '((50, 50))\n', (280, 290), True, 'import numpy as np\n'), ((326, 343), 'numpy.ones', 'np.ones', (['(50, 50)'], {}), '((50, 50))\n', (333, 343), True, 'import numpy as np\n'), ((352, 370), 'numpy.zeros', 'np.zeros', (['(50, 50)'], {}), '((50, 50))\n', (360, 3...
import time, datetime, argparse, os, sys, pickle, psutil import numpy as np np.set_printoptions(precision=2) import matplotlib.pyplot as plt import casadi as cas import copy as cp PROJECT_PATHS = ['/home/nbuckman/Dropbox (MIT)/DRL/2020_01_cooperative_mpc/mpc-multiple-vehicles/', '/Users/noambuckman/mpc-multiple-vehicle...
[ "psutil.virtual_memory", "src.multiagent_mpc.generate_warm_u", "src.solver_helper.initialize_cars", "numpy.random.seed", "src.solver_helper.solve_warm_starts", "numpy.floor", "numpy.mean", "numpy.tile", "sys.path.append", "numpy.set_printoptions", "src.solver_helper.extend_last_mpc_ctrl", "src...
[((76, 108), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (95, 108), True, 'import numpy as np\n'), ((1195, 1222), 'src.TrafficWorld.TrafficWorld', 'tw.TrafficWorld', (['(2)', '(0)', '(1000)'], {}), '(2, 0, 1000)\n', (1210, 1222), True, 'import src.TrafficWorld as tw\n...
import pytest import numpy from thinc_bigendian_ops.bigendian_ops import BigEndianOps def test_endian_conversion(): ops = BigEndianOps() ndarr_tst = numpy.ndarray((1, 5), dtype="<f") out = ops.asarray(ndarr_tst) assert out.dtype.byteorder == ">" #add hash test
[ "numpy.ndarray", "thinc_bigendian_ops.bigendian_ops.BigEndianOps" ]
[((128, 142), 'thinc_bigendian_ops.bigendian_ops.BigEndianOps', 'BigEndianOps', ([], {}), '()\n', (140, 142), False, 'from thinc_bigendian_ops.bigendian_ops import BigEndianOps\n'), ((159, 192), 'numpy.ndarray', 'numpy.ndarray', (['(1, 5)'], {'dtype': '"""<f"""'}), "((1, 5), dtype='<f')\n", (172, 192), False, 'import n...
import json import numpy as np from collections import Counter import matplotlib as plt # ms = [] # for i in range(10): # with open(f'{i}_keep_masks.txt', 'r') as f: # # for j in range(20): # # if j < 18: # # f.readline() # # else: # for j in range(2): # ...
[ "collections.Counter", "numpy.array", "json.loads" ]
[((1552, 1562), 'collections.Counter', 'Counter', (['a'], {}), '(a)\n', (1559, 1562), False, 'from collections import Counter\n'), ((1404, 1425), 'json.loads', 'json.loads', (['masks_str'], {}), '(masks_str)\n', (1414, 1425), False, 'import json\n'), ((1505, 1525), 'numpy.array', 'np.array', (['masks_list'], {}), '(mas...
import os from options.test_options import TestOptions from data import create_dataset from models import create_model import numpy as np from util.util import tensor2im from torch.utils.tensorboard import SummaryWriter if __name__ == "__main__": opt = TestOptions().parse() # get test options # hard-code some...
[ "numpy.stack", "util.util.tensor2im", "options.test_options.TestOptions", "models.create_model", "torch.utils.tensorboard.SummaryWriter", "data.create_dataset" ]
[((721, 740), 'data.create_dataset', 'create_dataset', (['opt'], {}), '(opt)\n', (735, 740), False, 'from data import create_dataset\n'), ((828, 845), 'models.create_model', 'create_model', (['opt'], {}), '(opt)\n', (840, 845), False, 'from models import create_model\n'), ((1282, 1304), 'torch.utils.tensorboard.Summary...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright 2020 Huawei Technologies Co., Ltd 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 requir...
[ "acl.media.dvpp_malloc", "numpy.dtype", "numpy.transpose", "numpy.ones", "acl.util.numpy_to_ptr", "resource.context.Context", "pdb.set_trace", "acl.util.ptr_to_numpy", "numpy.prod" ]
[((19560, 19573), 'resource.context.Context', 'Context', (['{12}'], {}), '({12})\n', (19567, 19573), False, 'from resource.context import Context\n'), ((19608, 19635), 'acl.media.dvpp_malloc', 'acl.media.dvpp_malloc', (['size'], {}), '(size)\n', (19629, 19635), False, 'import acl\n'), ((19640, 19655), 'pdb.set_trace', ...
import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as plticker import matplotlib import sys import itertools import operator #usage python eval.py GT_FILE_LASER_1 EX_FILE_LASER_1 ... from numpy import genfromtxt matplotlib.rcParams.update({'font.size': 22}) fig=plt.figure() args_num=len(sy...
[ "matplotlib.pyplot.xlim", "numpy.abs", "numpy.std", "matplotlib.rcParams.update", "numpy.asarray", "numpy.square", "numpy.genfromtxt", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.ticker.MultipleLocator", "operator.itemgetter", "matplotlib.pyplot.savefig" ]
[((240, 285), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 22}"], {}), "({'font.size': 22})\n", (266, 285), False, 'import matplotlib\n'), ((290, 302), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (300, 302), True, 'import matplotlib.pyplot as plt\n'), ((2514, 2564), 'matp...
# import datetime import logging import os import sys import numpy as np import pickle import csv import datetime as dt import pandas as pd import matplotlib.pylab as plt import pickle file_dir = os.path.dirname(__file__) sys.path.append(file_dir) logger = logging.getLogger(__name__) logger.setLevel...
[ "csv.reader", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.model_selection.cross_val_score", "pickle.load", "numpy.arange", "sklearn.neural_network.MLPClassifier", "sklearn.svm.SVC", "sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis", "os.path.join", "sys.pa...
[((211, 236), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (226, 236), False, 'import os\n'), ((238, 263), 'sys.path.append', 'sys.path.append', (['file_dir'], {}), '(file_dir)\n', (253, 263), False, 'import sys\n'), ((276, 303), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}),...
import os import pickle from sklearn.neighbors import NearestNeighbors import numpy as np from params import * from utils import create_coco_dict def create_knn_model(): img_feature_path = os.path.join(save_features_path, 'all_npy_dict.npy') with open(img_feature_path, 'rb') as f: features_dict = n...
[ "numpy.load", "sklearn.neighbors.NearestNeighbors", "os.path.join", "pickle.dump" ]
[((197, 249), 'os.path.join', 'os.path.join', (['save_features_path', '"""all_npy_dict.npy"""'], {}), "(save_features_path, 'all_npy_dict.npy')\n", (209, 249), False, 'import os\n'), ((571, 602), 'sklearn.neighbors.NearestNeighbors', 'NearestNeighbors', ([], {'n_neighbors': '(1)'}), '(n_neighbors=1)\n', (587, 602), Fal...
import numpy as np ''' Coordinates of the locations and the related places Supermarket dimensions = (675, 943, 3) ''' # Locations: entrance = np.array([600,770]) fruit = np.array([250,770]) spices = np.array([250,550]) dairy = np.array([250,315]) drinks = np.array([250,85]) # Checkouts fruit_check = np.array([600,500...
[ "numpy.array_equal", "numpy.array" ]
[((143, 163), 'numpy.array', 'np.array', (['[600, 770]'], {}), '([600, 770])\n', (151, 163), True, 'import numpy as np\n'), ((171, 191), 'numpy.array', 'np.array', (['[250, 770]'], {}), '([250, 770])\n', (179, 191), True, 'import numpy as np\n'), ((200, 220), 'numpy.array', 'np.array', (['[250, 550]'], {}), '([250, 550...
import numpy as np from park.envs.circuit.simulator.utility.misc import AttrDict __all__ = ['Rater'] class Rater(object): __SCALES__ = { 'linear': lambda a, b: a / b, 'log': lambda a, b: np.log10(a) / np.log10(b) } def __init__(self, score_fail, *, centralized_target=False): sel...
[ "numpy.log10", "park.envs.circuit.simulator.utility.misc.AttrDict" ]
[((846, 936), 'park.envs.circuit.simulator.utility.misc.AttrDict', 'AttrDict', ([], {'scale': 'scale', 'direction': 'direction', 'constrained': 'constrained', 'targeted': 'targeted'}), '(scale=scale, direction=direction, constrained=constrained,\n targeted=targeted)\n', (854, 936), False, 'from park.envs.circuit.sim...
""" act.utils.data_utils -------------------- Module containing utilities for the data. """ import numpy as np import scipy.stats as stats import xarray as xr import pint def assign_coordinates(ds, coord_list): """ This procedure will create a new ACT dataset whose coordinates are designated to be the v...
[ "pint.UnitRegistry", "scipy.stats.mode", "numpy.asarray", "numpy.iinfo", "numpy.nanmin", "xarray.Dataset", "numpy.insert", "numpy.mod", "numpy.where", "numpy.timedelta64", "xarray.DataArray", "numpy.array", "numpy.nanmax" ]
[((1921, 1966), 'xarray.Dataset', 'xr.Dataset', (['new_ds_dict'], {'coords': 'my_coord_dict'}), '(new_ds_dict, coords=my_coord_dict)\n', (1931, 1966), True, 'import xarray as xr\n'), ((2825, 2859), 'numpy.where', 'np.where', (['(diff.values > 2.0 * mode)'], {}), '(diff.values > 2.0 * mode)\n', (2833, 2859), True, 'impo...
from __future__ import print_function import os import time import json import argparse import densenet import numpy as np import keras.backend as K from keras.optimizers import Adam, SGD from keras.utils import np_utils from keras.preprocessing.image import ImageDataGenerator DATASET_DIR = '/home/zixuan/neurocompan...
[ "keras.preprocessing.image.ImageDataGenerator", "json.dump", "numpy.average", "keras.optimizers.SGD", "densenet.DenseNetImageNet121", "argparse.ArgumentParser", "numpy.std", "keras.backend.image_data_format", "os.makedirs", "numpy.float32", "os.path.exists", "time.time", "keras.backend.get_v...
[((811, 840), 'numpy.average', 'np.average', (['per_frame_latency'], {}), '(per_frame_latency)\n', (821, 840), True, 'import numpy as np\n'), ((865, 890), 'numpy.std', 'np.std', (['per_frame_latency'], {}), '(per_frame_latency)\n', (871, 890), True, 'import numpy as np\n'), ((3558, 3664), 'densenet.DenseNetImageNet121'...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Python version: 3.6 import numpy as np from torchvision import datasets, transforms import pdb def mnist_iid(dataset, num_users): """ Sample I.I.D. client data from MNIST dataset :param dataset: :param num_users: :return: dict of image index """...
[ "numpy.array", "numpy.arange", "numpy.random.choice", "numpy.vstack", "torchvision.transforms.Normalize", "numpy.concatenate", "torchvision.transforms.ToTensor" ]
[((952, 984), 'numpy.arange', 'np.arange', (['(num_shards * num_imgs)'], {}), '(num_shards * num_imgs)\n', (961, 984), True, 'import numpy as np\n'), ((1057, 1082), 'numpy.vstack', 'np.vstack', (['(idxs, labels)'], {}), '((idxs, labels))\n', (1066, 1082), True, 'import numpy as np\n'), ((2404, 2436), 'numpy.arange', 'n...
import numpy as np from scipy.linalg import svd as scipy_svd from collections import Counter class DisCCA(): def __init__(self): self.wy=None self.wy=None self.output_dimensions=None self.C_B=0 self.C_W=0 ''' Preprocess X and Y to nd array and get all t...
[ "numpy.diag", "collections.Counter", "numpy.zeros", "numpy.identity", "numpy.ones", "numpy.linalg.eigh", "scipy.linalg.svd", "numpy.array", "numpy.matmul", "numpy.dot", "numpy.vstack" ]
[((671, 683), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (679, 683), True, 'import numpy as np\n'), ((928, 940), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (936, 940), True, 'import numpy as np\n'), ((2070, 2082), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (2078, 2082), True, 'import numpy as np...
import numpy as np def SMA(k, x): n = x.size y = np.zeros(n) for i in range(1, n+1): e = n - i + k + 1 if e > n: e = n y[n-i] = np.average(x[n-i:e]) return y def Sigma(k, x): n = x.size d = x - SMA(k, x) y = np.zeros(n) for i in range(1, n+1): e = n - i + k + 1 if e > n: ...
[ "numpy.average", "numpy.sum", "numpy.zeros", "numpy.max", "numpy.min", "numpy.where", "numpy.sqrt" ]
[((55, 66), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (63, 66), True, 'import numpy as np\n'), ((243, 254), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (251, 254), True, 'import numpy as np\n'), ((383, 393), 'numpy.sqrt', 'np.sqrt', (['y'], {}), '(y)\n', (390, 393), True, 'import numpy as np\n'), ((432, 451...
############################################################################### # Copyright (c) Lawrence Livermore National Security, LLC and other Ascent # Project developers. See top-level LICENSE AND COPYRIGHT files for dates and # other details. No copyright assignment is required to contribute to Ascent. #########...
[ "ascent.Ascent", "ascent_tutorial_py_utils.tutorial_gyre_example", "conduit.Node", "numpy.zeros" ]
[((601, 616), 'ascent.Ascent', 'ascent.Ascent', ([], {}), '()\n', (614, 616), False, 'import ascent\n'), ((653, 667), 'conduit.Node', 'conduit.Node', ([], {}), '()\n', (665, 667), False, 'import conduit\n'), ((1532, 1546), 'conduit.Node', 'conduit.Node', ([], {}), '()\n', (1544, 1546), False, 'import conduit\n'), ((266...
import re import numpy as np LINE_REGEX = re.compile(r"position=<(.*?),(.*?)> velocity=<(.*?),(.*?)>") def parse_line(line): match = LINE_REGEX.match(line) x = match.group(1) y = match.group(2) vx = match.group(3) vy = match.group(4) return (int(x), int(y), int(vx), int(vy)) def simulate(p...
[ "numpy.copy", "numpy.zeros", "numpy.min", "numpy.max", "numpy.array", "re.compile" ]
[((43, 102), 're.compile', 're.compile', (['"""position=<(.*?),(.*?)> velocity=<(.*?),(.*?)>"""'], {}), "('position=<(.*?),(.*?)> velocity=<(.*?),(.*?)>')\n", (53, 102), False, 'import re\n'), ((1215, 1263), 'numpy.zeros', 'np.zeros', (['(max_x - min_x + 1, max_y - min_y + 1)'], {}), '((max_x - min_x + 1, max_y - min_y...
"""monthly or yearly temperature range""" import calendar import datetime import numpy as np from pandas.io.sql import read_sql from pyiem.plot.use_agg import plt from pyiem.util import get_autoplot_context, get_dbconn from pyiem.exceptions import NoDataFound PDICT = {'monthly': 'Plot Single Month', 'yearly'...
[ "pandas.io.sql.read_sql", "datetime.date.today", "pyiem.exceptions.NoDataFound", "numpy.mean", "pyiem.plot.use_agg.plt.subplots", "pyiem.util.get_dbconn" ]
[((786, 807), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (805, 807), False, 'import datetime\n'), ((2056, 2074), 'pyiem.util.get_dbconn', 'get_dbconn', (['"""coop"""'], {}), "('coop')\n", (2066, 2074), False, 'from pyiem.util import get_autoplot_context, get_dbconn\n'), ((3084, 3131), 'pyiem.plot.u...
import numpy from numpy.testing import assert_allclose import theano from fuel.datasets import IterableDataset from theano import tensor from blocks.algorithms import GradientDescent, Scale from blocks.extensions import FinishAfter from blocks.extensions.training import SharedVariableModifier from blocks.main_loop im...
[ "blocks.utils.shared_floatx", "blocks.extensions.FinishAfter", "numpy.array", "theano.tensor.vector", "numpy.testing.assert_allclose", "blocks.algorithms.Scale", "theano.tensor.scalar", "blocks.algorithms.GradientDescent" ]
[((457, 491), 'numpy.array', 'numpy.array', (['[-1, 1]'], {'dtype': 'floatX'}), '([-1, 1], dtype=floatX)\n', (468, 491), False, 'import numpy\n'), ((741, 766), 'theano.tensor.vector', 'tensor.vector', (['"""features"""'], {}), "('features')\n", (754, 766), False, 'from theano import tensor\n'), ((775, 799), 'theano.ten...
""" Now the user can read in a file I want to find what make a model which uses the price, class and gender Author : AstroDave Date : 18th September, 2012 """ import csv as csv import numpy as np csv_file_object = csv.reader(open('train.csv', 'rb')) #Load in the csv file header = csv_file_object.next() #Skip the fis...
[ "numpy.zeros", "numpy.array" ]
[((522, 536), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (530, 536), True, 'import numpy as np\n'), ((1274, 1339), 'numpy.zeros', 'np.zeros', (['[2, number_of_classes, number_of_price_brackets]', 'float'], {}), '([2, number_of_classes, number_of_price_brackets], float)\n', (1282, 1339), True, 'import numpy ...
# Some implementation details regarding PyBullet: # # Each joint has a velocity motor. To disable the motor, enter velocity control mode and # set the max force to 0. This allows the joint to be controlled via torques. # # In each simulation step, the physics engine will simulate the motors to reach the # given target ...
[ "numpy.abs", "numpy.copy", "coffee.ik.ik_solver.IKSolver", "dm_robotics.geometry.geometry.Pose", "time.time", "numpy.array", "coffee.structs.JointState", "coffee.utils.geometry_utils.l2_normalize" ]
[((4329, 4534), 'coffee.ik.ik_solver.IKSolver', 'IKSolver', ([], {'pb_client': 'pb_client', 'joints': 'self._joints', 'ik_point_joint_id': 'self._model_params.link_id', 'joint_damping': 'control_params.joint_damping', 'nullspace_reference': 'control_params.nullspace_reference'}), '(pb_client=pb_client, joints=self._joi...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : Max_PJB @ date : 2021/3/23 15:41 @ IDE : PyCharm @ GitHub : https://github.com/JackyPJB @ Contact : <EMAIL> -------------------------------...
[ "cv2.undistort", "cv2.findChessboardCorners", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.cvtColor", "numpy.zeros", "cv2.cornerSubPix", "cv2.imread", "cv2.calibrateCamera", "glob.glob", "cv2.drawChessboardCorners", "cv2.imshow", "cv2.getOptimalNewCameraMatrix" ]
[((633, 665), 'numpy.zeros', 'np.zeros', (['(6 * 8, 3)', 'np.float32'], {}), '((6 * 8, 3), np.float32)\n', (641, 665), True, 'import numpy as np\n'), ((842, 870), 'glob.glob', 'glob.glob', (['"""calibrate/*.jpg"""'], {}), "('calibrate/*.jpg')\n", (851, 870), False, 'import glob\n'), ((1655, 1684), 'cv2.imread', 'cv2.im...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Main functions for getting latent ordering through the spectral embedding of a similarity matrix, as in arXiv ... """ from time import time import numpy as np from scipy.sparse.csgraph import connected_components from .spectral_embedding_ import make_laplacian_emb, che...
[ "numpy.divide", "time.time", "numpy.shape", "numpy.argsort", "numpy.where", "numpy.array", "scipy.sparse.csgraph.connected_components", "numpy.argwhere", "numpy.arctan" ]
[((690, 713), 'numpy.shape', 'np.shape', (['new_embedding'], {}), '(new_embedding)\n', (698, 713), True, 'import numpy as np\n'), ((954, 977), 'numpy.argsort', 'np.argsort', (['first_eigen'], {}), '(first_eigen)\n', (964, 977), True, 'import numpy as np\n'), ((1337, 1373), 'numpy.divide', 'np.divide', (['second_eigen',...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by <NAME> | 18/11/21 | https://y-research.github.io """Description The following implementation builds upon the library of XGBoost: https://github.com/dmlc/xgboost """ import os import sys import pickle import datetime import numpy as np from itertools import p...
[ "org.archive.ranking.run.test_l2r_tao.get_data_dir", "numpy.divide", "pickle.dump", "os.makedirs", "xgboost.train", "torch.add", "os.path.exists", "org.archive.eval.metric.tor_nDCG_at_ks", "org.archive.data.data_ms.load_data_xgboost", "xgboost.DMatrix", "sklearn.datasets.load_svmlight_file", "...
[((2275, 2289), 'torch.zeros', 'torch.zeros', (['(1)'], {}), '(1)\n', (2286, 2289), False, 'import torch\n'), ((4266, 4289), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (4287, 4289), False, 'import datetime\n'), ((7684, 7707), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (...
# """ # filters_with_sp.py: Demonstrate applying filters and fft on the Stream Processor # Author: <NAME> - Quantum Machines # Created: 31/12/2020 # Created on QUA version: 0.7.411 # """ import matplotlib.pyplot as plt import numpy as np import scipy.signal as signal from qm import LoopbackInterface from qm...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "scipy.signal.dimpulse", "matplotlib.pyplot.plot", "qm.LoopbackInterface", "matplotlib.pyplot.axis", "matplotlib.pyplot.figure", "numpy.arange", "numpy.squeeze", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.tig...
[((1920, 1944), 'qm.QuantumMachinesManager.QuantumMachinesManager', 'QuantumMachinesManager', ([], {}), '()\n', (1942, 1944), False, 'from qm.QuantumMachinesManager import QuantumMachinesManager\n'), ((3707, 3723), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(211)'], {}), '(211)\n', (3718, 3723), True, 'import matpl...
""" Functions for using frequency-domain FRI method for spike inference. Authors: <NAME>, <NAME> """ import numpy as np from numpy.fft import fft, fftshift, ifft from math import pi from scipy.linalg import toeplitz, svd, pinv, inv from scipy.optimize import golden from scipy.signal import hamming from scipy.ndimage ...
[ "numpy.roots", "numpy.zeros_like", "numpy.maximum", "scipy.ndimage.gaussian_filter1d", "numpy.fft.fft", "utils.Cadzow", "numpy.zeros", "numpy.ones", "numpy.argmin", "numpy.clip", "numpy.fft.fftshift", "numpy.arange", "numpy.exp", "numpy.linspace", "scipy.optimize.golden", "scipy.linalg...
[((2348, 2369), 'numpy.zeros_like', 'np.zeros_like', (['signal'], {}), '(signal)\n', (2361, 2369), True, 'import numpy as np\n'), ((4570, 4581), 'numpy.fft.fft', 'fft', (['signal'], {}), '(signal)\n', (4573, 4581), False, 'from numpy.fft import fft, fftshift, ifft\n'), ((4820, 4874), 'numpy.linspace', 'np.linspace', ([...
import numpy as np from typing import Tuple from IMLearn.metalearners.adaboost import AdaBoost from IMLearn.learners.classifiers import DecisionStump from IMLearn.learners.classifiers import DecisionStump from utils import * import plotly.graph_objects as go from plotly.subplots import make_subplots def generate_dat...
[ "plotly.graph_objects.Scatter", "numpy.random.seed", "numpy.sum", "numpy.random.rand", "numpy.ones", "numpy.argmin", "IMLearn.metalearners.adaboost.AdaBoost", "numpy.where", "numpy.array", "numpy.arange", "numpy.max", "plotly.graph_objects.Layout", "plotly.subplots.make_subplots" ]
[((1354, 1379), 'numpy.array', 'np.array', (["['circle', 'x']"], {}), "(['circle', 'x'])\n", (1362, 1379), True, 'import numpy as np\n'), ((1392, 1418), 'numpy.where', 'np.where', (['(test_y < 0)', '(1)', '(0)'], {}), '(test_y < 0, 1, 0)\n', (1400, 1418), True, 'import numpy as np\n'), ((1507, 1542), 'IMLearn.metalearn...
""" Utilities used in the package. """ import numpy as np import pickle # quick save and load def pkl_dump(path_write, data): """ Dump a data into a pikle file Parameters ---------- path_write : dir A valid directory in the system name_data : str The full name of the file to be...
[ "pickle.dump", "pickle.load", "numpy.arange", "numpy.log" ]
[((413, 440), 'pickle.dump', 'pickle.dump', (['data', 'pkl_file'], {}), '(data, pkl_file)\n', (424, 440), False, 'import pickle\n'), ((737, 758), 'pickle.load', 'pickle.load', (['pkl_file'], {}), '(pkl_file)\n', (748, 758), False, 'import pickle\n'), ((1183, 1216), 'numpy.arange', 'np.arange', (['(0)', 'self.size', '(1...
import os import re import cv2 import ast import sys import json import time import shutil import pickle import argparse import traceback import numpy as np from glob import glob from tqdm import tqdm import subprocess as sp from os.path import join from pathlib import Path from os.path import exists from os.path impor...
[ "os.remove", "cv2.bitwise_and", "cv2.vconcat", "json.dumps", "os.path.isfile", "yaml.safe_load", "cv2.rectangle", "cv2.VideoWriter", "shutil.rmtree", "cv2.imshow", "os.path.join", "pandas.set_option", "shutil.copy", "argparse.ArgumentTypeError", "shutil.make_archive", "cv2.cvtColor", ...
[((827, 866), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (840, 866), True, 'import pandas as pd\n'), ((871, 907), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', 'None'], {}), "('display.width', None)\n", (884, 907), True, 'import panda...