code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import mysql.connector import json import numpy as np cnx = mysql.connector.connect(user='shohdi', password='<PASSWORD>', host='127.0.0.1', database='forex_db') cnx._open_connection() cursor = cnx.cursor() #cursor.execute('create table numpy(id int primary...
[ "numpy.random.rand", "numpy.array", "json.loads", "json.dumps" ]
[((344, 364), 'numpy.random.rand', 'np.random.rand', (['(3)', '(2)'], {}), '(3, 2)\n', (358, 364), True, 'import numpy as np\n'), ((392, 405), 'json.dumps', 'json.dumps', (['b'], {}), '(b)\n', (402, 405), False, 'import json\n'), ((634, 658), 'json.loads', 'json.loads', (['result[0][1]'], {}), '(result[0][1])\n', (644,...
import ast import json import logging import math import os import random import h5py from dataclasses import dataclass import braceexpand import numpy as np import pandas as pd import torch import torchvision.datasets as datasets import webdataset as wds from PIL import Image from torch.utils.data import Dataset, Dat...
[ "webdataset.tarfile_to_samples", "numpy.load", "os.remove", "numpy.sum", "open_clip.tokenize", "pandas.read_csv", "random.shuffle", "webdataset.batched", "pathlib.Path", "numpy.random.randint", "webdataset.to_tuple", "os.path.join", "random.randint", "torch.utils.data.DataLoader", "rando...
[((855, 901), 'numpy.load', 'np.load', (['_AUDIOSET_MAP_PATH'], {'allow_pickle': '(True)'}), '(_AUDIOSET_MAP_PATH, allow_pickle=True)\n', (862, 901), True, 'import numpy as np\n'), ((9665, 9776), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': 'args.batch_size', 'num_workers':...
""" Imageutils unit tests. """ from __future__ import division import unittest import numpy as np from astraviso import imageutils as iu class imageutilstests(unittest.TestCase): """ Imageutils unit test class. """ def setUp(self): pass def tearDown(self): pass class test_poisson_...
[ "astraviso.imageutils.apply_gaussian_quantum_efficiency", "astraviso.imageutils.gaussian_noise", "astraviso.imageutils.poisson_noise", "numpy.zeros", "astraviso.imageutils.vismag2photon", "numpy.ones", "numpy.array", "astraviso.imageutils.conv2", "numpy.all" ]
[((540, 553), 'numpy.zeros', 'np.zeros', (['(512)'], {}), '(512)\n', (548, 553), True, 'import numpy as np\n'), ((599, 636), 'astraviso.imageutils.poisson_noise', 'iu.poisson_noise', (['image', '(0)', '(1200)', '(200)'], {}), '(image, 0, 1200, 200)\n', (615, 636), True, 'from astraviso import imageutils as iu\n'), ((11...
from __future__ import division from builtins import object import numpy as np from sporco.admm import cbpdn import sporco_cuda.cbpdn as cucbpdn import sporco.metric as sm import sporco.signal as ss class TestSet01(object): def setup_method(self, method): np.random.seed(12345) def test_01(self):...
[ "sporco.admm.cbpdn.ConvBPDN", "numpy.random.seed", "sporco.admm.cbpdn.ConvBPDN.Options", "sporco.admm.cbpdn.AddMaskSim", "numpy.random.randn", "sporco.admm.cbpdn.ConvBPDNGradReg.Options", "sporco.signal.rndmask", "sporco_cuda.cbpdn.cbpdnmsk", "sporco.metric.mse", "numpy.zeros", "sporco_cuda.cbpd...
[((274, 295), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (288, 295), True, 'import numpy as np\n'), ((530, 627), 'sporco.admm.cbpdn.ConvBPDN.Options', 'cbpdn.ConvBPDN.Options', (["{'Verbose': False, 'MaxMainIter': 50, 'AutoRho': {'Enabled': False}}"], {}), "({'Verbose': False, 'MaxMainIter':...
import numpy as np import cv2 import face_alignment # Initialize the chip resolution chipSize = 300 chipCorners = np.float32([[0,0], [chipSize,0], [0,chipSize], [chipSize,chipSize]]) # Initialize the face alignment tracker fa = face_alignme...
[ "cv2.warpPerspective", "face_alignment.FaceAlignment", "cv2.waitKey", "cv2.getPerspectiveTransform", "numpy.float32", "cv2.imshow", "cv2.VideoCapture", "numpy.mean", "numpy.linalg.norm", "cv2.destroyAllWindows" ]
[((115, 187), 'numpy.float32', 'np.float32', (['[[0, 0], [chipSize, 0], [0, chipSize], [chipSize, chipSize]]'], {}), '([[0, 0], [chipSize, 0], [0, chipSize], [chipSize, chipSize]])\n', (125, 187), True, 'import numpy as np\n'), ((308, 407), 'face_alignment.FaceAlignment', 'face_alignment.FaceAlignment', (['face_alignme...
import numpy as np import pickle import os import torch from torch.utils.data import TensorDataset from torchvision.datasets import ImageFolder import torchvision.transforms as transforms from sklearn.model_selection import train_test_split import scipy.io as sio from vdvae.data.celebahq import CelebAHQDataset from vd...
[ "numpy.isin", "numpy.random.seed", "os.makedirs", "torch.as_tensor", "sklearn.model_selection.train_test_split", "numpy.asarray", "pickle.load", "torch.cuda.is_available", "numpy.reshape", "vdvae.data.noise_dataset.NoiseDataset", "torchvision.transforms.CenterCrop", "numpy.random.permutation",...
[((846, 871), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (869, 871), False, 'import torch\n'), ((6497, 6529), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (6508, 6529), False, 'import os\n'), ((6670, 6703), 'pickle.load', 'pickle.load', (['fo'...
from __future__ import print_function import unittest import numpy import irbasis from irbasis_util.regression import * class TestMethods(unittest.TestCase): def __init__(self, *args, **kwargs): super(TestMethods, self).__init__(*args, **kwargs) def test_lsqr(self): numpy.random.seed(...
[ "unittest.main", "numpy.random.seed", "numpy.abs", "numpy.allclose", "numpy.exp", "numpy.random.rand", "numpy.sqrt" ]
[((1440, 1455), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1453, 1455), False, 'import unittest\n'), ((302, 324), 'numpy.random.seed', 'numpy.random.seed', (['(100)'], {}), '(100)\n', (319, 324), False, 'import numpy\n'), ((550, 576), 'numpy.random.rand', 'numpy.random.rand', (['(N1 * N2)'], {}), '(N1 * N2)\n...
import io import sys import uuid import zipfile import collections import numpy as np from .. import util from .. import graph from ..constants import log try: import networkx as nx except BaseException as E: # create a dummy module which will raise the ImportError # or other exception only when someone...
[ "io.BytesIO", "uuid.uuid4", "zipfile.ZipFile", "lxml.etree.Element", "networkx.MultiDiGraph", "lxml.etree.xmlfile", "collections.defaultdict", "lxml.etree.iterparse", "numpy.array", "numpy.eye" ]
[((1526, 1555), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1549, 1555), False, 'import collections\n'), ((1862, 1915), 'lxml.etree.iterparse', 'etree.iterparse', (['model'], {'tag': "('{*}object', '{*}build')"}), "(model, tag=('{*}object', '{*}build'))\n", (1877, 1915), False, 'f...
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. import numpy as np import popart import test_util as tu def test_basic(): builder = popart.Builder() shape = popart.TensorInfo("FLOAT", [3]) i1 = builder.addInputTensor(shape) i2 = builder.addInputTensor(shape) a1 = builder.aiOnnx.add([i1,...
[ "popart.Builder", "popart.AnchorReturnType", "test_util.create_test_device", "numpy.array", "popart.TensorInfo", "popart.PyStepIO", "popart.SessionOptions" ]
[((147, 163), 'popart.Builder', 'popart.Builder', ([], {}), '()\n', (161, 163), False, 'import popart\n'), ((177, 208), 'popart.TensorInfo', 'popart.TensorInfo', (['"""FLOAT"""', '[3]'], {}), "('FLOAT', [3])\n", (194, 208), False, 'import popart\n'), ((606, 629), 'popart.SessionOptions', 'popart.SessionOptions', ([], {...
import numpy as np import matplotlib.pyplot as plt class Bandit(): def __init__(self, arms: int): """ Base bandit constructor :param amrs: probability distribution of each arm """ # quantity of arms self.narms = arms # times each arm was used self.na...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.ones", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((328, 347), 'numpy.ones', 'np.ones', (['self.narms'], {}), '(self.narms)\n', (335, 347), True, 'import numpy as np\n'), ((410, 430), 'numpy.zeros', 'np.zeros', (['self.narms'], {}), '(self.narms)\n', (418, 430), True, 'import numpy as np\n'), ((1331, 1358), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '...
import numpy as np ub = 2 ** 31 - 1; with open("data.txt","w") as f: for i in range(128): x = np.random.randint(0, ub) x=hex(x)[2:].zfill(8) print(x[0:2],x[2:4],x[4:6],x[6:8],file=f) s= "00 00 00 3f\n" + \ "00 00 00 06\n" + \ "00 00 00 5b\n" + \ "00 00 ...
[ "numpy.random.randint" ]
[((110, 134), 'numpy.random.randint', 'np.random.randint', (['(0)', 'ub'], {}), '(0, ub)\n', (127, 134), True, 'import numpy as np\n')]
# Importing the Keras libraries and packages from keras.models import load_model model = load_model('Resources/CNNModel/fashionModel.h5') import numpy as np # import os import urllib.request # import gzip # import shutil # import matplotlib.pyplot as plt from tkinter import filedialog from tkinter import * from PIL imp...
[ "keras.models.load_model", "os.getcwd", "PIL.Image.open", "numpy.nonzero", "numpy.array" ]
[((89, 137), 'keras.models.load_model', 'load_model', (['"""Resources/CNNModel/fashionModel.h5"""'], {}), "('Resources/CNNModel/fashionModel.h5')\n", (99, 137), False, 'from keras.models import load_model\n'), ((1363, 1376), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (1371, 1376), True, 'import numpy as np\n'...
# Modifications copyright 2022 AI Singapore # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
[ "torch.nn.ReLU", "torch.nn.ConvTranspose2d", "torch.nn.Sequential", "numpy.log2", "torch.nn.Conv2d", "torch.nn.BatchNorm2d", "numpy.array", "peekingduck.pipeline.nodes.model.fairmotv1.fairmot_files.network_blocks.Tree", "peekingduck.pipeline.nodes.model.fairmotv1.fairmot_files.network_blocks.DeformC...
[((6939, 7008), 'peekingduck.pipeline.nodes.model.fairmotv1.fairmot_files.network_blocks.Tree', 'Tree', (['levels[2]', 'block', 'channels[1]', 'channels[2]', '(2)'], {'level_root': '(False)'}), '(levels[2], block, channels[1], channels[2], 2, level_root=False)\n', (6943, 7008), False, 'from peekingduck.pipeline.nodes.m...
import numpy as np import itertools # compute exact distribution from weight matrices def compute_probabilities(num_nodes, num_classes, A): num_states = num_classes ** num_nodes probs = np.zeros(num_states) dim0 = num_nodes * num_classes Atr = np.array(A).transpose(0, 2, 1, 3).reshape(dim0, dim0) ...
[ "numpy.sum", "numpy.random.binomial", "numpy.zeros", "numpy.ones", "numpy.base_repr", "numpy.random.randint", "numpy.arange", "numpy.array", "numpy.random.rand", "numpy.eye", "numpy.sqrt" ]
[((197, 217), 'numpy.zeros', 'np.zeros', (['num_states'], {}), '(num_states)\n', (205, 217), True, 'import numpy as np\n'), ((332, 362), 'numpy.eye', 'np.eye', (['num_classes'], {'dtype': 'int'}), '(num_classes, dtype=int)\n', (338, 362), True, 'import numpy as np\n'), ((660, 673), 'numpy.sum', 'np.sum', (['probs'], {}...
# -*- coding: utf-8 -*- """ Created on Sat Aug 31 20:44:36 2019 @author: Excalibur """ import numpy as np def typeNode(lams): lam1, lam2, lam3 = lams if any(lam == 0 for lam in lams): return "Non hyperbolic!" elif all(np.isreal(lam) for lam in lams): signs = list(map(np.sign,list(lams...
[ "numpy.isreal" ]
[((245, 259), 'numpy.isreal', 'np.isreal', (['lam'], {}), '(lam)\n', (254, 259), True, 'import numpy as np\n'), ((609, 623), 'numpy.isreal', 'np.isreal', (['lam'], {}), '(lam)\n', (618, 623), True, 'import numpy as np\n')]
# <NAME> # 2019 Edgise #!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import tensorflow as tf import keras from keras.applications.mobilenetv2 import MobileNetV2, preprocess_input, decode_predictions import os #import cv2 import PIL import time execution_path = os.getcwd() print("tf version : " + ...
[ "keras.applications.mobilenetv2.MobileNetV2", "keras.applications.mobilenetv2.decode_predictions", "os.getcwd", "numpy.asarray", "keras.applications.mobilenetv2.preprocess_input", "numpy.expand_dims", "PIL.Image.open", "time.sleep", "time.time", "os.path.join" ]
[((284, 295), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (293, 295), False, 'import os\n'), ((429, 478), 'keras.applications.mobilenetv2.MobileNetV2', 'MobileNetV2', ([], {'weights': '"""imagenet"""', 'include_top': '(True)'}), "(weights='imagenet', include_top=True)\n", (440, 478), False, 'from keras.applications.mob...
#!/usr/bin/python # # Simple class to emulate SoapySDR devices locally. # This is an initial version and needs improvement. # It can only really be used to quickly test SoapySDR code. # # It is lacking any sort of timestamp or streaming ability, or any notion of sample rate. # It could probably be done much m...
[ "numpy.random.uniform", "numpy.abs", "numpy.copy", "numpy.zeros", "numpy.clip", "numpy.random.randint", "numpy.arange", "numpy.random.normal" ]
[((1954, 1988), 'numpy.clip', 'np.clip', (['a.real', '(-m)', 'm'], {'out': 'a.real'}), '(a.real, -m, m, out=a.real)\n', (1961, 1988), True, 'import numpy as np\n'), ((1993, 2027), 'numpy.clip', 'np.clip', (['a.imag', '(-m)', 'm'], {'out': 'a.imag'}), '(a.imag, -m, m, out=a.imag)\n', (2000, 2027), True, 'import numpy as...
import numpy as np import tensorflow as tf from ..utils import shape_list def maximum_path(value, mask, max_neg_val=-np.inf): """ Numpy-friendly version. It's about 4 times faster than torch version. value: [b, t_x, t_y] mask: [b, t_x, t_y] """ value = value * mask dtype = value.dtype mas...
[ "numpy.pad", "tensorflow.ones", "tensorflow.range", "tensorflow.reshape", "numpy.zeros", "tensorflow.zeros_like", "tensorflow.reduce_max", "tensorflow.ones_like", "tensorflow.pad", "tensorflow.cast", "tensorflow.tile", "numpy.where", "numpy.arange", "tensorflow.zeros", "tensorflow.sequen...
[((392, 429), 'numpy.zeros', 'np.zeros', (['value.shape'], {'dtype': 'np.int64'}), '(value.shape, dtype=np.int64)\n', (400, 429), True, 'import numpy as np\n'), ((438, 474), 'numpy.zeros', 'np.zeros', (['(b, t_x)'], {'dtype': 'np.float32'}), '((b, t_x), dtype=np.float32)\n', (446, 474), True, 'import numpy as np\n'), (...
# Copyright (c) xiaoxuan : https://github.com/shawnau/kaggle-HPA # modified by sailfish009 import sys sys.path.append('../') import os import math import operator from functools import reduce from collections import Counter import numpy as np import pandas as pd from .ml_stratifiers import MultilabelStratifiedShuffle...
[ "sys.path.append", "pickle.dump", "numpy.zeros", "collections.Counter", "operator.itemgetter", "os.path.join", "pandas.concat" ]
[((103, 125), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (118, 125), False, 'import sys\n'), ((498, 532), 'pandas.concat', 'pd.concat', (['[df_train, df_external]'], {}), '([df_train, df_external])\n', (507, 532), True, 'import pandas as pd\n'), ((851, 863), 'numpy.zeros', 'np.zeros', (['(2...
import numpy as np from timer import Timer def sparsify(M, n): # sparsify for i in range(n): print('sparsify ({})'.format(i)) S = np.random.randint(0, high=2, size=M.shape, dtype=np.uint8) M = np.multiply(M, S) return M def make_matrix(C, G, spars=0): """ TODO: IMPLEMENT...
[ "numpy.random.randint", "numpy.multiply", "timer.Timer" ]
[((623, 680), 'numpy.random.randint', 'np.random.randint', (['(0)'], {'high': '(2)', 'size': '(C, G)', 'dtype': 'np.uint8'}), '(0, high=2, size=(C, G), dtype=np.uint8)\n', (640, 680), True, 'import numpy as np\n'), ((157, 215), 'numpy.random.randint', 'np.random.randint', (['(0)'], {'high': '(2)', 'size': 'M.shape', 'd...
"""Train Glow on CIFAR-10. Train script adapted from: https://github.com/kuangliu/pytorch-cifar/ """ import argparse import numpy as np import os import random import torch import torch.optim as optim import torch.optim.lr_scheduler as sched import torch.backends.cudnn as cudnn import torch.utils.data as data import t...
[ "wandb.log", "numpy.random.seed", "argparse.ArgumentParser", "torch.randn", "util.clip_grad_norm", "util.AverageMeter", "torch.no_grad", "os.path.join", "torch.load", "util.NLLLoss", "random.seed", "util.bits_per_dim", "torch.manual_seed", "torch.cuda.is_available", "torch.enable_grad", ...
[((491, 546), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Glow on CIFAR-10"""'}), "(description='Glow on CIFAR-10')\n", (514, 546), False, 'import argparse\n'), ((2803, 2867), 'wandb.init', 'wandb.init', ([], {'project': 'args.project', 'name': 'args.wb_name', 'config': 'args'}), '(pr...
import numpy as np import circlehough.hough_transformation as ht import math def test_apply_triangular_evaluation(): ring_radius = 5 r_point = 4.5 amplitude = 1 hough_epsilon = 1 result_value = ht.py_apply_triangular_evaluation( r_point, hough_epsilon, ring_radius, amplitude) assert res...
[ "math.sqrt", "numpy.argmax", "numpy.float32", "circlehough.hough_transformation.hough_transform_ring", "circlehough.hough_transformation.py_calculate_point_distance", "circlehough.hough_transformation.py_sum_point_contributions", "numpy.array", "circlehough.hough_transformation.py_apply_triangular_eva...
[((215, 300), 'circlehough.hough_transformation.py_apply_triangular_evaluation', 'ht.py_apply_triangular_evaluation', (['r_point', 'hough_epsilon', 'ring_radius', 'amplitude'], {}), '(r_point, hough_epsilon, ring_radius,\n amplitude)\n', (248, 300), True, 'import circlehough.hough_transformation as ht\n'), ((454, 52...
#!/usr/bin/env python from __future__ import division import numpy as np import pytest from chanjo._compat import text_type from chanjo.utils import ( average, _RawInterval, bed_to_interval, completeness, id_generator, BaseInterval, serialize_interval, validate_bed_format ) def test_RawInterval(): ...
[ "chanjo.utils.BaseInterval", "chanjo.utils._RawInterval", "pytest.raises", "chanjo.utils.average", "numpy.array", "chanjo.utils.id_generator", "chanjo.utils.serialize_interval", "chanjo.utils.bed_to_interval" ]
[((484, 507), 'chanjo.utils._RawInterval', '_RawInterval', (['*interval'], {}), '(*interval)\n', (496, 507), False, 'from chanjo.utils import average, _RawInterval, bed_to_interval, completeness, id_generator, BaseInterval, serialize_interval, validate_bed_format\n'), ((852, 875), 'chanjo.utils.BaseInterval', 'BaseInte...
import numpy as np from bab.mcmc import get_mcmc, get_stan_model from bab.make_data import make_data from bab.power import get_power from bab.model import BayesAB y1, y2 = make_data(0, 1, 1, 2, 10, percent_outliers=0, sd_outlier_factor=2.0, rand_seed=1) stan_model = get_stan_model() mcmc = get_mcmc(stan_model, y1, y...
[ "numpy.random.randn", "bab.model.BayesAB", "bab.mcmc.get_stan_model", "bab.mcmc.get_mcmc", "bab.power.get_power", "bab.make_data.make_data" ]
[((175, 260), 'bab.make_data.make_data', 'make_data', (['(0)', '(1)', '(1)', '(2)', '(10)'], {'percent_outliers': '(0)', 'sd_outlier_factor': '(2.0)', 'rand_seed': '(1)'}), '(0, 1, 1, 2, 10, percent_outliers=0, sd_outlier_factor=2.0,\n rand_seed=1)\n', (184, 260), False, 'from bab.make_data import make_data\n'), ((2...
import numpy as np import pickle from sklearn import datasets import lightgbm as lgb from sklearn.model_selection import train_test_split data = datasets.load_iris() X = data['data'] y = data['target'] y[y > 0] = 1 X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) n_estimators ...
[ "sklearn.datasets.load_iris", "lightgbm.train", "lightgbm.Dataset", "sklearn.model_selection.train_test_split", "numpy.savetxt" ]
[((147, 167), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (165, 167), False, 'from sklearn import datasets\n'), ((252, 305), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'random_state': '(0)'}), '(X, y, test_size=0.2, random_state=0)\n', (...
import sys import numpy as np def make_predictions(model, X, fname, verbose=2): """ Makes predictions on data array X using model and saves it to fname """ print('Making predictions.') sys.stdout.flush() scores = model.predict(X, batch_size = 128, verbose=verbose) np.save(fname, scores) return scores ...
[ "numpy.save", "sys.stdout.flush" ]
[((196, 214), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (212, 214), False, 'import sys\n'), ((281, 303), 'numpy.save', 'np.save', (['fname', 'scores'], {}), '(fname, scores)\n', (288, 303), True, 'import numpy as np\n')]
#!/usr/bin/env python3 import sys import numpy N = int(input()) arr = [] for _ in range(0, N): temp = list(map(int, input().split())) arr.append(temp) n = numpy.array(arr) arr = [] for _ in range(0, N): temp = list(map(int, input().split())) arr.append(temp) m = numpy.array(arr) print(numpy.dot(n, m))...
[ "numpy.dot", "numpy.array" ]
[((164, 180), 'numpy.array', 'numpy.array', (['arr'], {}), '(arr)\n', (175, 180), False, 'import numpy\n'), ((281, 297), 'numpy.array', 'numpy.array', (['arr'], {}), '(arr)\n', (292, 297), False, 'import numpy\n'), ((304, 319), 'numpy.dot', 'numpy.dot', (['n', 'm'], {}), '(n, m)\n', (313, 319), False, 'import numpy\n')...
import argparse import os import numpy as np import pandas as pd from matplotlib import pyplot as plt methods = ["vpg", "rrpg", "qmcpg"] def main(): parser = argparse.ArgumentParser(description="Run a classic control benchmark.") parser.add_argument("--log_dir", type=str, default="./runs") parser.add_arg...
[ "matplotlib.pyplot.yscale", "argparse.ArgumentParser", "matplotlib.pyplot.clf", "pandas.read_csv", "numpy.isnan", "matplotlib.pyplot.style.use", "matplotlib.pyplot.fill_between", "os.path.join", "numpy.nanmean", "matplotlib.pyplot.set_cmap", "numpy.linspace", "matplotlib.pyplot.legend", "mat...
[((165, 236), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run a classic control benchmark."""'}), "(description='Run a classic control benchmark.')\n", (188, 236), False, 'import argparse\n'), ((646, 683), 'numpy.linspace', 'np.linspace', (['(0)', 'max_frame', '(n_mesh + 1)'], {}), '(...
# Treat all division as float division even in python2 from __future__ import division from collections import Counter import numpy as np from annotypes import TYPE_CHECKING from malcolm.core import Info if TYPE_CHECKING: from typing import Tuple, Dict, Sequence, Optional, Set # All possible PMAC CS axis assi...
[ "numpy.isclose", "numpy.sqrt" ]
[((4163, 4180), 'numpy.isclose', 'np.isclose', (['op', '(0)'], {}), '(op, 0)\n', (4173, 4180), True, 'import numpy as np\n'), ((5719, 5781), 'numpy.sqrt', 'np.sqrt', (['((2 * acceleration * distance + v1 * v1 + v2 * v2) / 2)'], {}), '((2 * acceleration * distance + v1 * v1 + v2 * v2) / 2)\n', (5726, 5781), True, 'impor...
#!/usr/bin/env python #Copyright (c) 2011, 2012 <NAME> # # 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. # # This progra...
[ "numpy.fft.rfft", "plugins.audio_sensors.audiograb.AudioGrab", "plugins.audio_sensors.ringbuffer.RingBuffer1d", "logging.getLogger", "gettext.gettext" ]
[((1354, 1414), 'logging.getLogger', 'logging.getLogger', (['"""turtleart-activity audio sensors plugin"""'], {}), "('turtleart-activity audio sensors plugin')\n", (1371, 1414), False, 'import logging\n'), ((10801, 10858), 'plugins.audio_sensors.audiograb.AudioGrab', 'AudioGrab', (['self.new_buffer', 'self', 'mode', 'b...
# ------------------------------------------------------------------ # Compute residual VLM from alt-tg # This program has 2 modes: # First mode: # Compute alt-tg for provisional region list for during TG QC # Compute alt-tg for final region list # ------------------------------------------------------------------ impo...
[ "os.mkdir", "numpy.load", "numpy.abs", "numpy.argmax", "numpy.ones", "numpy.isnan", "numpy.arange", "glob.glob", "os.chdir", "numpy.prod", "numpy.nanmean", "netCDF4.Dataset", "os.uname", "numpy.transpose", "numpy.isfinite", "numpy.save", "numpy.in1d", "numpy.corrcoef", "shutil.co...
[((965, 986), 'numpy.arange', 'np.arange', (['(1900)', '(2019)'], {}), '(1900, 2019)\n', (974, 986), True, 'import numpy as np\n'), ((4063, 4108), 'numpy.in1d', 'np.in1d', (["settings['years']", "altimetry['time']"], {}), "(settings['years'], altimetry['time'])\n", (4070, 4108), True, 'import numpy as np\n'), ((9928, 9...
import numpy as np def StandardMap(t_initial, u_initial, PARAMETERS=[0.3, 1]): """ Chirikov standard map for initial conditions in a unit square, centred at the origin (as used in [1]_). The map is defined in a perioidic manner, but maps points outside the unit square (periodic domain). The Lagrangian ...
[ "numpy.sin", "numpy.column_stack" ]
[((1616, 1649), 'numpy.column_stack', 'np.column_stack', (['[x_next, y_next]'], {}), '([x_next, y_next])\n', (1631, 1649), True, 'import numpy as np\n'), ((3354, 3387), 'numpy.column_stack', 'np.column_stack', (['[x_next, y_next]'], {}), '([x_next, y_next])\n', (3369, 3387), True, 'import numpy as np\n'), ((4439, 4472)...
import networkx as nx import numpy as np from scipy import sparse def barabasi(n, mean_degree): """ Adjacency matrix for a Barabasi-Albert preferential attachment network. Each node is added with `mean_degree` edges. Parameters mean_degree (int): average edges per node. Must be an even ...
[ "scipy.sparse.random", "numpy.ceil", "networkx.erdos_renyi_graph", "networkx.watts_strogatz_graph", "networkx.random_geometric_graph", "networkx.barabasi_albert_graph", "scipy.sparse.dok_matrix" ]
[((1448, 1510), 'scipy.sparse.random', 'sparse.random', (['n', 'n'], {'density': 'p', 'data_rvs': 'np.ones', 'format': '"""csc"""'}), "(n, n, density=p, data_rvs=np.ones, format='csc')\n", (1461, 1510), False, 'from scipy import sparse\n'), ((2619, 2639), 'scipy.sparse.dok_matrix', 'sparse.dok_matrix', (['A'], {}), '(A...
import magic import numpy as np import scanpy as sc import torch from datasets.np import NpDataset from models.ae import AE from models.api import * from utils.plot import plot_gene_expression, generate_plot_embeddings from utils.preprocess import preprocess_recipe, run_pca from utils.trainer import AETrainer, AEMixup...
[ "utils.plot.plot_gene_expression", "numpy.random.seed", "magic.MAGIC", "torch.manual_seed", "scanpy.read", "utils.preprocess.preprocess_recipe", "models.ae.AE", "utils.preprocess.run_pca", "utils.trainer.AEMixupTrainer", "numpy.array", "utils.plot.generate_plot_embeddings", "datasets.np.NpData...
[((373, 400), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (387, 400), True, 'import numpy as np\n'), ((401, 431), 'torch.manual_seed', 'torch.manual_seed', (['random_seed'], {}), '(random_seed)\n', (418, 431), False, 'import torch\n'), ((541, 584), 'scanpy.read', 'sc.read', (['data_...
#!/usr/bin/env python3 import numpy as np from scipy import misc, ndimage, signal # def cool_effect(img, k): # img_c = np.zeros_like(img) # for c in range(img.shape[2]): # img_c[:, :, c] = signal.convolve2d(img[:, :, c], k[:, :, c], mode='same') # return np.sum(img_c, axis=2) def translate(img, ...
[ "numpy.zeros_like", "scipy.signal.convolve2d", "numpy.array", "scipy.misc.imsave", "scipy.ndimage.imread", "numpy.all" ]
[((716, 743), 'scipy.ndimage.imread', 'ndimage.imread', (['"""house.jpg"""'], {}), "('house.jpg')\n", (730, 743), False, 'from scipy import misc, ndimage, signal\n'), ((749, 875), 'numpy.array', 'np.array', (['[[[0, 1, -1], [1, -1, 0], [0, 0, 0]], [[-1, 0, -1], [1, -1, 0], [1, 0, 0]],\n [[1, -1, 0], [1, 0, 1], [-1, ...
""" Runner for system_simulator.py Written by <NAME> Adapted from the India5G repository. January 2022 """ import os import sys import configparser import csv import math import fiona from shapely.geometry import shape, Point, LineString, mapping import numpy as np from random import choice from rtree import index...
[ "shapely.geometry.Point", "numpy.meshgrid", "numpy.random.seed", "csv.writer", "os.makedirs", "math.sqrt", "os.path.dirname", "shapely.geometry.mapping", "os.path.exists", "random.choice", "dice.generate_hex.produce_sites_and_site_areas", "numpy.percentile", "shapely.geometry.LineString", ...
[((471, 489), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (485, 489), True, 'import numpy as np\n'), ((500, 527), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (525, 527), False, 'import configparser\n'), ((672, 711), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""...
""" Match two sets of on-sky coordinates to each other. I.e., find nearest neighbor of one that's in the other. Similar in purpose to IDL's spherematch, but totally different implementation. Requires numpy and scipy. <NAME> https://gist.github.com/eteq/4599814 """ from __future__ import division import numpy as np t...
[ "numpy.radians", "numpy.arctan2", "numpy.empty", "numpy.hypot", "numpy.sin", "numpy.array", "numpy.arange", "scipy.spatial.KDTree", "numpy.cos" ]
[((1800, 1825), 'numpy.array', 'np.array', (['ra1'], {'copy': '(False)'}), '(ra1, copy=False)\n', (1808, 1825), True, 'import numpy as np\n'), ((1837, 1863), 'numpy.array', 'np.array', (['dec1'], {'copy': '(False)'}), '(dec1, copy=False)\n', (1845, 1863), True, 'import numpy as np\n'), ((1874, 1899), 'numpy.array', 'np...
import dash from dash.dependencies import Input, Output, State import dash_core_components as dcc import dash_html_components as html import dash_table from app import app import numpy as np import pandas as pd import plotly.graph_objs as go import json, codecs import csv from functions import keel_solve, sac_solve, s...
[ "plotly.graph_objs.layout.YAxis", "json.loads", "codecs.open", "pandas.read_csv", "plotly.graph_objs.Scatter", "plotly.graph_objs.layout.XAxis", "numpy.float", "dash.dependencies.Input", "numpy.int", "dash.dependencies.Output", "plotly.graph_objs.Bar" ]
[((1126, 1179), 'pandas.read_csv', 'pd.read_csv', (['"""assets/data/optimizationresistance.csv"""'], {}), "('assets/data/optimizationresistance.csv')\n", (1137, 1179), True, 'import pandas as pd\n'), ((2087, 2111), 'json.loads', 'json.loads', (['gaconfig_obj'], {}), '(gaconfig_obj)\n', (2097, 2111), False, 'import json...
#%% import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import seaborn as sns import pandas as pd import scipy.stats import phd.viz import phd.stats colors, palette = phd.viz.phd_style() # Load in the MCMC data. data = pd.read_csv('../../data/ch9_mscl_si/complete_mcmc_traces.csv') ...
[ "seaborn.kdeplot", "numpy.sum", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig" ]
[((257, 319), 'pandas.read_csv', 'pd.read_csv', (['"""../../data/ch9_mscl_si/complete_mcmc_traces.csv"""'], {}), "('../../data/ch9_mscl_si/complete_mcmc_traces.csv')\n", (268, 319), True, 'import pandas as pd\n'), ((327, 353), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 3)'}), '(figsize=(6, 3))\n', ...
import glob import os import random import numpy as np import pandas as pd import torch import torch.nn as nn from torch.utils.data import Dataset import matplotlib.pyplot as plt import cv2 import scipy.ndimage as ndimage import torch.optim as optim import time import shutil from sklearn.metrics import roc_curve, auc f...
[ "matplotlib.pyplot.title", "os.mkdir", "argparse.ArgumentParser", "torchio.RandomNoise", "pandas.read_csv", "wandb.watch", "matplotlib.pyplot.figure", "numpy.mean", "torch.nn.Softmax", "torchio.RandomAffine", "torch.device", "shutil.rmtree", "torch.no_grad", "os.path.join", "torch.utils....
[((931, 944), 'time.gmtime', 'time.gmtime', ([], {}), '()\n', (942, 944), False, 'import time\n'), ((1070, 1090), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1084, 1090), False, 'import os\n'), ((15894, 15931), 'torch.max', 'torch.max', (['input'], {'dim': '(1)', 'keepdim': '(True)'}), '(input, dim...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 14 10:34:31 2020 @author: alan """ import matplotlib.pyplot as plt import pandas as pd import numpy as np from glob import glob from stable_baselines.results_plotter import load_results, ts2xy def moving_average(values, window): """ Smoot...
[ "matplotlib.pyplot.ylim", "stable_baselines.results_plotter.load_results", "stable_baselines.results_plotter.ts2xy", "matplotlib.pyplot.sca", "numpy.convolve", "matplotlib.pyplot.subplots", "numpy.repeat" ]
[((635, 671), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(48, 50)'}), '(2, 2, figsize=(48, 50))\n', (647, 671), True, 'import matplotlib.pyplot as plt\n'), ((505, 541), 'numpy.convolve', 'np.convolve', (['values', 'weights', '"""same"""'], {}), "(values, weights, 'same')\n", (516, 541),...
""" This is a script that implement the SNOPT optimization package to minimize nonlinear constrained optimization problem in SDOGS. References: <NAME>, <NAME>, <NAME>, <NAME>. SNOPT 7.7 User's Manual. CCoM Technical Report 18-1, Center for Computational Mathematics, University of California, San Diego. ...
[ "numpy.sum", "numpy.empty", "numpy.ones", "numpy.argmin", "numpy.shape", "numpy.mean", "numpy.linalg.norm", "numpy.tile", "dogs.Utils.search_simplex_bounds", "os.path.join", "numpy.copy", "os.path.dirname", "numpy.max", "dogs.exterior_uncertainty.exterior_uncertainty_eval", "optimize.sno...
[((2887, 2915), 'numpy.zeros', 'np.zeros', (['sdogs.tri.shape[0]'], {}), '(sdogs.tri.shape[0])\n', (2895, 2915), True, 'import numpy as np\n'), ((2942, 2970), 'numpy.zeros', 'np.zeros', (['sdogs.tri.shape[0]'], {}), '(sdogs.tri.shape[0])\n', (2950, 2970), True, 'import numpy as np\n'), ((2997, 3025), 'numpy.zeros', 'np...
from numpy import linalg as LA import numpy as np MAX_SIG_VALUE = 10000000 def get_avg_gradient(gradient_list, num_of_workers): summed_gradient = gradient_list[0] i = 0 for gradient in gradient_list: i += 1 if i == 1: continue j = 0 for gradient_part in gradien...
[ "numpy.subtract", "numpy.amin", "numpy.ravel", "numpy.argpartition", "numpy.linalg.norm", "numpy.add" ]
[((1359, 1383), 'numpy.linalg.norm', 'LA.norm', (['l2_norm_list', '(2)'], {}), '(l2_norm_list, 2)\n', (1366, 1383), True, 'from numpy import linalg as LA\n'), ((5902, 5920), 'numpy.linalg.norm', 'LA.norm', (['thresh', '(2)'], {}), '(thresh, 2)\n', (5909, 5920), True, 'from numpy import linalg as LA\n'), ((1270, 1288), ...
import os import json from pathlib import Path import numpy as np import matplotlib.pyplot as plt from matplotlib import colors import torch.nn.functional as F def get_task(data_path='data', subset='train', index=0, print_path=False): """ gets a task for the needed subset :subset: subset of the task trai...
[ "os.listdir", "matplotlib.pyplot.tight_layout", "json.load", "matplotlib.pyplot.show", "numpy.abs", "matplotlib.colors.Normalize", "numpy.zeros", "pathlib.Path", "numpy.array", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.subplots", "matplotlib.colors.ListedColormap" ]
[((527, 542), 'pathlib.Path', 'Path', (['data_path'], {}), '(data_path)\n', (531, 542), False, 'from pathlib import Path\n'), ((1361, 1498), 'matplotlib.colors.ListedColormap', 'colors.ListedColormap', (["['#000000', '#0074D9', '#FF4136', '#2ECC40', '#FFDC00', '#AAAAAA',\n '#F012BE', '#FF851B', '#7FDBFF', '#870C25']...
''' Parameter comparison (photometric v. kinematic) ''' ################################################################################ # Import modules #------------------------------------------------------------------------------- from astropy.table import Table import numpy as np import matplotlib.pyplot as pl...
[ "astropy.table.Table.read", "matplotlib.pyplot.savefig", "numpy.logical_or.reduce", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.tight_layout", "matplotlib.py...
[((718, 793), 'astropy.table.Table.read', 'Table.read', (['(data_directory + data_filename)'], {'format': '"""ascii.commented_header"""'}), "(data_directory + data_filename, format='ascii.commented_header')\n", (728, 793), False, 'from astropy.table import Table\n'), ((1854, 1982), 'numpy.logical_or.reduce', 'np.logica...
# -*- coding: utf-8 -*- import pandas as pd import sqlite3 as lite import numpy as np import ee import os from treecover.sentinel import stmt, date_ranges, funs, val_cols, gen_fetch_stmt_and_headers, fetch_and_write_sqlite """ The methods in this file are not used anymore. compute_features is used in a similar manner ...
[ "pandas.DataFrame", "treecover.sentinel.fetch_and_write_sqlite", "pandas.read_csv", "pandas.unique", "os.path.isfile", "numpy.max", "sqlite3.connect", "pandas.read_parquet", "numpy.min", "treecover.sentinel.gen_fetch_stmt_and_headers", "ee.Initialize" ]
[((352, 393), 'pandas.read_csv', 'pd.read_csv', (['"""data/bastin_db_cleaned.csv"""'], {}), "('data/bastin_db_cleaned.csv')\n", (363, 393), True, 'import pandas as pd\n'), ((908, 954), 'pandas.unique', 'pd.unique', (['bastin_db.dryland_assessment_region'], {}), '(bastin_db.dryland_assessment_region)\n', (917, 954), Tru...
import sys from caffe.io import load_image from skimage.util import view_as_windows import os import numpy as np from .kMeansFeatureExtractor import * from .lmdbWriter import open_csv imageDim = (512,512,3) rfSize = 16 numPatches = 50 images = os.listdir('../data/resized/trainOriginal') labels_dict = o...
[ "caffe.io.load_image", "numpy.diagflat", "numpy.zeros", "numpy.ones", "numpy.linalg.eig", "numpy.mean", "numpy.random.randint", "numpy.reshape", "numpy.cov", "numpy.dot", "skimage.util.view_as_windows", "numpy.var", "os.listdir", "numpy.sqrt" ]
[((258, 301), 'os.listdir', 'os.listdir', (['"""../data/resized/trainOriginal"""'], {}), "('../data/resized/trainOriginal')\n", (268, 301), False, 'import os\n'), ((522, 571), 'numpy.zeros', 'np.zeros', (['(total_numPatches, rfSize * rfSize * 3)'], {}), '((total_numPatches, rfSize * rfSize * 3))\n', (530, 571), True, '...
#!/usr/bin/env python """ MIT License Copyright (c) 2020-2021 <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 Software without restriction, including without limitation the rights to use, copy, mo...
[ "astropy.coordinates.get_body", "astropy.coordinates.solar_system_ephemeris.set", "numpy.arcsin", "yaml.safe_load", "multiprocessing.Pool" ]
[((2006, 2039), 'astropy.coordinates.solar_system_ephemeris.set', 'solar_system_ephemeris.set', (['ephem'], {}), '(ephem)\n', (2032, 2039), False, 'from astropy.coordinates import solar_system_ephemeris, get_body\n'), ((3886, 3937), 'astropy.coordinates.get_body', 'get_body', (['solar_body_name', 'spacecraft_frame.obst...
from Kfold import k_fold import numpy as np def cv_estimate(fit_fn, pred_fn, loss_fn, X, y, n_folds, **varargin): """ Input: model = fit_fn(X_train, y_train) y_hat = pred_fn(X_test) L = loss_fn(y_hat, y_test) X, 设计矩阵, shape=(n_sampels,dim) y, 类标签, shape=(n_samples,) n_f...
[ "numpy.std", "numpy.power", "numpy.zeros", "numpy.mean", "Kfold.k_fold" ]
[((989, 1011), 'numpy.zeros', 'np.zeros', (['(n_samples,)'], {}), '((n_samples,))\n', (997, 1011), True, 'import numpy as np\n'), ((1372, 1385), 'numpy.mean', 'np.mean', (['loss'], {}), '(loss)\n', (1379, 1385), True, 'import numpy as np\n'), ((783, 826), 'Kfold.k_fold', 'k_fold', (['n_samples', 'n_folds', 'randomize_o...
import argparse import os os.environ["MKL_NUM_THREADS"] = "1" os.environ["NUMEXPR_NUM_THREADS"] = "1" os.environ["OMP_NUM_THREADS"] = "1" import random from functools import partial from multiprocessing.pool import Pool import cv2 import numpy as np import tqdm from albumentations.augmentations.functional import rando...
[ "functools.partial", "numpy.sum", "os.makedirs", "argparse.ArgumentParser", "random.random", "multiprocessing.pool.Pool", "os.path.join", "albumentations.augmentations.functional.random_crop" ]
[((444, 479), 'os.makedirs', 'os.makedirs', (['img_dir'], {'exist_ok': '(True)'}), '(img_dir, exist_ok=True)\n', (455, 479), False, 'import os\n'), ((627, 690), 'os.path.join', 'os.path.join', (['"""/home/selim/datasets/spacenet/train_mask_binned"""'], {}), "('/home/selim/datasets/spacenet/train_mask_binned')\n", (639,...
import os import numpy as np import torchio as tio from natsort import natsorted from pydicom import dcmread from scipy import interpolate from skimage import morphology from skimage.measure import find_contours class Mask: """ Class that hold any structures aligned with a reference CT. :param tio.LABEL...
[ "pydicom.dcmread", "skimage.morphology.remove_small_holes", "torchio.LabelMap", "scipy.interpolate.splprep", "torchio.OneHot", "skimage.measure.find_contours", "numpy.array", "scipy.interpolate.splev", "os.path.join", "os.listdir" ]
[((888, 900), 'torchio.OneHot', 'tio.OneHot', ([], {}), '()\n', (898, 900), True, 'import torchio as tio\n'), ((761, 779), 'torchio.LabelMap', 'tio.LabelMap', (['mask'], {}), '(mask)\n', (773, 779), True, 'import torchio as tio\n'), ((1815, 1881), 'skimage.morphology.remove_small_holes', 'morphology.remove_small_holes'...
# bestballsim/tests/test_byes.py # -*- coding: utf-8 -*- # Copyright (C) 2021 <NAME> # Licensed under the MIT License import numpy as np from numpy.core.numeric import ones import pandas as pd import pytest from bestballsim.byes import * def onesie_data(n=2, w=16): return np.random.randint(low=1, high=30, siz...
[ "pandas.read_csv", "numpy.zeros", "pytest.raises", "numpy.random.randint", "numpy.array", "numpy.array_equal" ]
[((283, 329), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(1)', 'high': '(30)', 'size': '(n, w)'}), '(low=1, high=30, size=(n, w))\n', (300, 329), True, 'import numpy as np\n'), ((392, 439), 'pandas.read_csv', 'pd.read_csv', (["(test_directory / 'season_data.csv')"], {}), "(test_directory / 'season_data....
import numpy as np import pandas as pd from typing import List from mcos.covariance_transformer import AbstractCovarianceTransformer from mcos.error_estimator import AbstractErrorEstimator from mcos.observation_simulator import AbstractObservationSimulator, MuCovLedoitWolfObservationSimulator, \ MuCovObservationSi...
[ "mcos.utils.convert_price_history", "mcos.observation_simulator.MuCovJackknifeObservationSimulator", "numpy.std", "numpy.mean", "mcos.observation_simulator.MuCovObservationSimulator", "mcos.observation_simulator.MuCovLedoitWolfObservationSimulator" ]
[((2011, 2047), 'mcos.utils.convert_price_history', 'convert_price_history', (['price_history'], {}), '(price_history)\n', (2032, 2047), False, 'from mcos.utils import convert_price_history\n'), ((2115, 2175), 'mcos.observation_simulator.MuCovLedoitWolfObservationSimulator', 'MuCovLedoitWolfObservationSimulator', (['mu...
import os import sys import numpy as np import ConfigParser from mpi4py import MPI from rexfw.communicators.mpi import MPICommunicator from rexfw.convenience import create_directories from cPickle import dump from ensemble_hic.setup_functions import make_replica_schedule, parse_config_file mpicomm = MPI.COMM_WORLD r...
[ "numpy.load", "ensemble_hic.setup_functions.make_posterior", "rexfw.communicators.mpi.MPICommunicator", "scipy.stats.norm.pdf", "numpy.cumsum", "isd2.samplers.gibbs.GibbsSampler", "ensemble_hic.setup_functions.setup_default_re_master", "ensemble_hic.setup_functions.parse_config_file", "ensemble_hic....
[((430, 460), 'ensemble_hic.setup_functions.parse_config_file', 'parse_config_file', (['config_file'], {}), '(config_file)\n', (447, 460), False, 'from ensemble_hic.setup_functions import make_replica_schedule, parse_config_file\n'), ((469, 486), 'rexfw.communicators.mpi.MPICommunicator', 'MPICommunicator', ([], {}), '...
#!/usr/bin/env python import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np soa = np.array([[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, -1, 0, 0]]) X, Y, Z, U, V, W = zip(*soa) fig = plt.figure() ax = fig.add_subplot(111, projection='3d'...
[ "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.show" ]
[((122, 217), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0, 0, -1, \n 0, 0]]'], {}), '([[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0], [0, 0,\n 0, -1, 0, 0]])\n', (130, 217), True, 'import numpy as np\n'), ((266, 278), 'matplotlib.pyplot.figure', 'p...
import json import argparse from operator import itemgetter from collections import namedtuple import subprocess import os import numpy as np import matplotlib.pyplot as plt import sklearn from sklearn.tree import export_graphviz import kite.ranking.ranklearning as ranklearning from logging import getLogger, DEBU...
[ "kite.ranking.ranklearning.Rbf", "argparse.ArgumentParser", "matplotlib.pyplot.clf", "kite.ranking.ranklearning.LinearRankLearner", "matplotlib.pyplot.subplot2grid", "logging.getLogger", "numpy.mean", "os.path.join", "subprocess.check_call", "kite.ranking.ranklearning.Dataset", "kite.ranking.ran...
[((377, 398), 'logging.StreamHandler', 'StreamHandler', (['stdout'], {}), '(stdout)\n', (390, 398), False, 'from logging import getLogger, DEBUG, INFO, StreamHandler\n'), ((408, 419), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (417, 419), False, 'from logging import getLogger, DEBUG, INFO, StreamHandler\n'), (...
from __future__ import print_function, absolute_import, division import glob import os import numpy as np from .utils import expand_path class BaseDatasetLoader(object): short_name = None def load(self): raise NotImplementedError('should be implemented in subclass') class MSMBuilderDatasetLoader(B...
[ "os.path.abspath", "numpy.load", "mdtraj.load", "sklearn.externals.joblib.load", "msmbuilder.dataset.dataset" ]
[((585, 649), 'msmbuilder.dataset.dataset', 'dataset', (['self.path'], {'mode': '"""r"""', 'fmt': 'self.fmt', 'verbose': 'self.verbose'}), "(self.path, mode='r', fmt=self.fmt, verbose=self.verbose)\n", (592, 649), False, 'from msmbuilder.dataset import dataset\n'), ((1137, 1147), 'numpy.load', 'np.load', (['f'], {}), '...
import numpy as np import unittest import xarray as xr import xinterp da_2d_real = xr.DataArray( np.array(((0, 0.5, 1), (1, 1.5, 2))), coords={'x': [0, 1], 'y': [0, 0.5, 1]}, dims=('x', 'y') ) da_2d_singular = xr.DataArray( np.array(((0, 0.5, 1), )), coords={'x': [0, ], 'y': [0, 0.5, 1]}, dims...
[ "numpy.array" ]
[((102, 138), 'numpy.array', 'np.array', (['((0, 0.5, 1), (1, 1.5, 2))'], {}), '(((0, 0.5, 1), (1, 1.5, 2)))\n', (110, 138), True, 'import numpy as np\n'), ((242, 266), 'numpy.array', 'np.array', (['((0, 0.5, 1),)'], {}), '(((0, 0.5, 1),))\n', (250, 266), True, 'import numpy as np\n'), ((610, 712), 'numpy.array', 'np.a...
import itertools import functools import numpy as np import pandas as pd import pickle from scipy import integrate import scipy.optimize import timeit import global_PATHs from dataset_handling import filter_dataset, prepare_data from PINN_RK import PinnModel from power_system_functions import create_system...
[ "pickle.dump", "numpy.abs", "power_system_functions.create_system_matrices", "dataset_handling.filter_dataset", "numpy.around", "pickle.load", "numpy.sin", "numpy.tile", "pandas.DataFrame", "power_system_functions.create_SMIB_system", "numpy.transpose", "itertools.product", "numpy.repeat", ...
[((3625, 3645), 'power_system_functions.create_SMIB_system', 'create_SMIB_system', ([], {}), '()\n', (3643, 3645), False, 'from power_system_functions import create_system_matrices, ode_right_hand_side_solve, create_SMIB_system\n'), ((3676, 3725), 'power_system_functions.create_system_matrices', 'create_system_matrices...
import numpy as np import pandas as pd from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from sklearn.linear_model import SGDClassifier from sklearn.model_selection import train_test_split from stop_words import get_stop_words class ClassifierBuilder: def __init__(self): self._...
[ "stop_words.get_stop_words", "sklearn.linear_model.SGDClassifier", "pandas.read_csv", "sklearn.model_selection.train_test_split", "numpy.mean", "sklearn.feature_extraction.text.TfidfTransformer", "numpy.unique" ]
[((5263, 5306), 'pandas.read_csv', 'pd.read_csv', (['"""news_lenta.csv"""'], {'nrows': '(500000)'}), "('news_lenta.csv', nrows=500000)\n", (5274, 5306), True, 'import pandas as pd\n'), ((1498, 1516), 'sklearn.feature_extraction.text.TfidfTransformer', 'TfidfTransformer', ([], {}), '()\n', (1514, 1516), False, 'from skl...
from os import listdir import numpy from sklearn.model_selection import StratifiedKFold from CR_WOA_DEF import CRWOA from LIN_WOA_DEF import LINWOA import scipy.io from multiprocessing import Pool from functools import partial from KNNCV import KNNCrossValidation from NNCV import NNCrossValidation from NB import NBCros...
[ "CR_WOA_DEF.CRWOA", "functools.partial", "numpy.zeros", "NB.NBCrossValidation", "LIN_WOA_DEF.LINWOA", "numpy.max", "sklearn.model_selection.StratifiedKFold", "multiprocessing.Pool", "KNNCV.KNNCrossValidation", "NNCV.NNCrossValidation", "os.listdir" ]
[((493, 500), 'multiprocessing.Pool', 'Pool', (['(2)'], {}), '(2)\n', (497, 500), False, 'from multiprocessing import Pool\n'), ((689, 729), 'numpy.zeros', 'numpy.zeros', (['reruns'], {'dtype': 'numpy.float64'}), '(reruns, dtype=numpy.float64)\n', (700, 729), False, 'import numpy\n'), ((736, 781), 'numpy.zeros', 'numpy...
""" Main program """ import numpy as np from mpi4py import MPI import sys from src.os_util import my_mkdir from src.input_parser import get_input_variables, get_c_list import src.parallel_util as put from src.snr import opt_pulsar_snr import src.signals as signals import src.snr as snr import src.generate_sim_qua...
[ "src.generate_sim_quants.gen_velocities", "src.generate_sim_quants.gen_dhats", "src.signals.subtract_signal", "src.signals.dphi_dop_chunked_vec", "src.generate_sim_quants.set_num_objects", "numpy.zeros", "numpy.einsum", "src.input_parser.get_c_list", "src.os_util.my_mkdir", "numpy.array", "numpy...
[((863, 895), 'src.input_parser.get_input_variables', 'get_input_variables', (['in_filename'], {}), '(in_filename)\n', (882, 895), False, 'from src.input_parser import get_input_variables, get_c_list\n'), ((1772, 1819), 'numpy.linspace', 'np.linspace', (['(0)', '(dt * Nt)'], {'num': 'Nt', 'endpoint': '(False)'}), '(0, ...
# As usual, a bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.cnn import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient_array, eval_numerical_gradient from cs231n.layers import * from cs231n.fast_layers import * from cs2...
[ "numpy.abs", "cs231n.data_utils.get_CIFAR10_data", "numpy.array", "numpy.linspace", "numpy.prod" ]
[((683, 701), 'cs231n.data_utils.get_CIFAR10_data', 'get_CIFAR10_data', ([], {}), '()\n', (699, 701), False, 'from cs231n.data_utils import get_CIFAR10_data\n'), ((940, 969), 'numpy.linspace', 'np.linspace', (['(-0.1)', '(0.2)'], {'num': '(3)'}), '(-0.1, 0.2, num=3)\n', (951, 969), True, 'import numpy as np\n'), ((1071...
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and # Technical University of Darmstadt. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code mus...
[ "pyrado.sampling.parallel_rollout_sampler.ParallelRolloutSampler", "torch.testing.assert_allclose", "random.shuffle", "numpy.random.normal", "pyrado.sampling.hyper_sphere.sample_from_hyper_sphere_surface", "pytest.mark.parametrize", "pyrado.domain_randomization.default_randomizers.create_default_randomi...
[((3428, 3542), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""arg"""', '[[1], [2, 3], [4, 6, 2, 88, 3, 45, 7, 21, 22, 23, 24, 44, 45, 56, 67, 78, 89]]'], {}), "('arg', [[1], [2, 3], [4, 6, 2, 88, 3, 45, 7, 21, 22,\n 23, 24, 44, 45, 56, 67, 78, 89]])\n", (3451, 3542), False, 'import pytest\n'), ((3970, ...
"""Miscellaneous functions that do not fit into other modules. You can find here for example functions for train / test split, function for rolling windows, function that clean the dataframe for print in table or function that will add gaps to time series data where are no data so two remote points are not joined in pl...
[ "pandas.DataFrame", "textwrap.fill", "json.dumps", "numpy.lib.stride_tricks.as_strided", "numpy.diff", "pandas.api.types.is_numeric_dtype", "mylogging.traceback", "pandas.concat" ]
[((1118, 1185), 'numpy.lib.stride_tricks.as_strided', 'np.lib.stride_tricks.as_strided', (['data'], {'shape': 'shape', 'strides': 'strides'}), '(data, shape=shape, strides=strides)\n', (1149, 1185), True, 'import numpy as np\n'), ((5745, 5780), 'pandas.api.types.is_numeric_dtype', 'pd.api.types.is_numeric_dtype', (['df...
from pepnet import SequenceInput, Output, Predictor import numpy as np from collections import Counter from sklearn.metrics import roc_auc_score from sklearn.model_selection import StratifiedKFold import random from helpers import to_ic50, from_ic50 from data import ( load_iedb_binding_data, load_mass_spec, ...
[ "pepnet.Output", "numpy.zeros_like", "random.shuffle", "pepnet.SequenceInput", "data.generate_negatives_from_proteome", "numpy.zeros", "numpy.isnan", "data.load_iedb_binding_data", "sklearn.metrics.roc_auc_score", "numpy.argsort", "data.load_pseudosequences", "sklearn.model_selection.Stratifie...
[((700, 885), 'pepnet.SequenceInput', 'SequenceInput', ([], {'length': '(34)', 'name': '"""mhc"""', 'encoding': '"""index"""', 'variable_length': '(True)', 'embedding_dim': '(20)', 'embedding_mask_zero': '(False)', 'dense_layer_sizes': '[64]', 'dense_batch_normalization': '(True)'}), "(length=34, name='mhc', encoding='...
__all__ = ['Evaluator'] from collections import defaultdict from itertools import chain import numpy as np from typing import List, Union, Any from continual_learning.datasets.base import DatasetSplits from continual_learning.eval.metrics import Metric, ClassificationMetric, ContinualLearningMetric def default_to_...
[ "collections.defaultdict", "numpy.asarray", "numpy.zeros", "itertools.chain" ]
[((6844, 6919), 'itertools.chain', 'chain', (['self._classification_metrics', 'self._cl_metrics', 'self._others_metrics'], {}), '(self._classification_metrics, self._cl_metrics, self._others_metrics)\n', (6849, 6919), False, 'from itertools import chain\n'), ((7035, 7110), 'itertools.chain', 'chain', (['self._classific...
################# ## plotters.py ## ################# import matplotlib.pyplot as plt import numpy as np from decimal import Decimal from sklearn.metrics import mean_squared_error from sklearn.model_selection import learning_curve ################################### ## mnist_digit_pretty_printer() ## ##############...
[ "matplotlib.pyplot.title", "decimal.Decimal", "numpy.std", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "matplotlib.pyplot.scatter", "numpy.mean", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots", "sklearn.model_selection.learning...
[((1393, 1404), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (1402, 1404), True, 'import matplotlib.pyplot as plt\n'), ((1409, 1467), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x1', 'y1'], {'color': '"""red"""', 'marker': '"""o"""', 'label': 'label1'}), "(x1, y1, color='red', marker='o', label=label1)\...
import numpy as np def load_mp4(vid_path): import av container = av.open(vid_path) ims = [frame.to_image() for frame in container.decode(video=0)] ims_c = np.array([np.array(im) for im in ims]) return ims_c def load_mp4_ffmpeg(vid_path, grey=1, resolution=None): import ffmpeg prob...
[ "numpy.frombuffer", "numpy.expand_dims", "PIL.Image.fromarray", "numpy.array", "ffmpeg.probe", "ffmpeg.input", "av.open" ]
[((77, 94), 'av.open', 'av.open', (['vid_path'], {}), '(vid_path)\n', (84, 94), False, 'import av\n'), ((324, 346), 'ffmpeg.probe', 'ffmpeg.probe', (['vid_path'], {}), '(vid_path)\n', (336, 346), False, 'import ffmpeg\n'), ((1230, 1259), 'numpy.expand_dims', 'np.expand_dims', (['ims_c'], {'axis': '(3)'}), '(ims_c, axis...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 13 12:08:07 2021 @author: zihan """ import requests from bs4 import BeautifulSoup as soup import numpy as np web = 'https://www.aeaweb.org' base = 'https://www.aeaweb.org/journals/aer/issues' root = requests.get(base) leaf = soup(root.text,'lxml'...
[ "bs4.BeautifulSoup", "numpy.save", "numpy.array", "requests.get" ]
[((273, 291), 'requests.get', 'requests.get', (['base'], {}), '(base)\n', (285, 291), False, 'import requests\n'), ((299, 322), 'bs4.BeautifulSoup', 'soup', (['root.text', '"""lxml"""'], {}), "(root.text, 'lxml')\n", (303, 322), True, 'from bs4 import BeautifulSoup as soup\n'), ((1281, 1299), 'numpy.array', 'np.array',...
# Copyright 2022 Google. # # 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, soft...
[ "absl.testing.absltest.main", "unittest.mock.create_autospec", "numpy.full_like", "jax.jit", "numpy.testing.assert_array_equal", "jax.numpy.arange", "numpy.testing.assert_allclose", "numpy.asarray", "numpy.ones", "prompt_tuning.train.prompts.Prompt", "jax.numpy.asarray", "absl.testing.paramete...
[((2435, 2510), 'absl.testing.parameterized.product', 'parameterized.product', ([], {'decoder_only': '[True, False]', 'before_eos': '[True, False]'}), '(decoder_only=[True, False], before_eos=[True, False])\n', (2456, 2510), False, 'from absl.testing import parameterized\n'), ((5613, 5628), 'absl.testing.absltest.main'...
import folium import numpy as np def plot_circle(lat, lon, radii, map=None, **kwargs): """ Plot a circle on a map (creating a new folium map instance if necessary). Parameters ---------- lat: float latitude of circle to plot (degrees) lon: float longitude of circle to plot (d...
[ "folium.Popup", "folium.Circle", "numpy.sin", "numpy.cos", "folium.Map", "folium.PolyLine", "folium.Icon" ]
[((1718, 1807), 'folium.PolyLine', 'folium.PolyLine', ([], {'locations': '[[lat, lon], [lat + dx_lat, lon - dx_lon]]', 'color': '"""black"""'}), "(locations=[[lat, lon], [lat + dx_lat, lon - dx_lon]], color\n ='black')\n", (1733, 1807), False, 'import folium\n'), ((4076, 4150), 'folium.PolyLine', 'folium.PolyLine', ...
import logging import click import numpy as np from os.path import abspath, dirname, join from gym.spaces import Tuple from mae_envs.viewer.env_viewer import EnvViewer from mae_envs.wrappers.multi_agent import JoinMultiAgentActions from mujoco_worldgen.util.envs import examine_env, load_env from mujoco_worldgen.util.t...
[ "os.path.dirname", "numpy.random.randint", "numpy.zeros", "mae_envs.envs.search_and_rescue.make_env" ]
[((1391, 1468), 'mae_envs.envs.search_and_rescue.make_env', 'make_env', ([], {'agent_types': 'agent_types', 'visualize_lidar': '(True)', 'n_lidar_per_agent': '(30)'}), '(agent_types=agent_types, visualize_lidar=True, n_lidar_per_agent=30)\n', (1399, 1468), False, 'from mae_envs.envs.search_and_rescue import make_env\n'...
import sys,traceback import os import math import numpy as np import logging import collections import time import re import random from classes.highlighter import Highlighter from classes.jogwidget import JogWidget from classes.commandlineedit import CommandLineEdit from classes.simulatordialog import SimulatorDialo...
[ "PyQt5.QtGui.QKeySequence", "PyQt5.QtWidgets.QFileDialog.getOpenFileName", "gcode_machine.gcode_machine.GcodeMachine", "sys.exc_info", "lib.compiler.receiver", "PyQt5.QtWidgets.QAction", "PyQt5.QtWidgets.QMenuBar", "collections.deque", "PyQt5.QtWidgets.QLabel", "traceback.print_exc", "PyQt5.QtWi...
[((1212, 1250), 'logging.getLogger', 'logging.getLogger', (['"""cnctoolbox.window"""'], {}), "('cnctoolbox.window')\n", (1229, 1250), False, 'import logging\n'), ((2158, 2199), 'collections.deque', 'collections.deque', ([], {'maxlen': '_logbuffer_size'}), '(maxlen=_logbuffer_size)\n', (2175, 2199), False, 'import colle...
# -*- coding: utf-8 -*- """ Created on Wed Jan 11 22:31:03 2017 @author: Mihailo """ import cv2 import numpy as np import math def thresholdImage(img): grayImg = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # retval, threshImg = cv2.threshold(grayImg,0,255,cv2.THRESH_OTSU) threshImg = cv2.adaptiveThr...
[ "numpy.ones", "cv2.transpose", "cv2.adaptiveThreshold", "cv2.warpAffine", "cv2.boxPoints", "cv2.minAreaRect", "cv2.imshow", "cv2.getRotationMatrix2D", "cv2.dilate", "cv2.cvtColor", "cv2.imwrite", "cv2.copyMakeBorder", "cv2.drawContours", "cv2.destroyAllWindows", "numpy.int0", "math.sqr...
[((179, 216), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (191, 216), False, 'import cv2\n'), ((305, 404), 'cv2.adaptiveThreshold', 'cv2.adaptiveThreshold', (['grayImg', '(255)', 'cv2.ADAPTIVE_THRESH_GAUSSIAN_C', 'cv2.THRESH_BINARY', '(99)', '(10)'], {}), '(grayIm...
""" Household ref person microsynthesis """ import numpy as np import pandas as pd import ukcensusapi.Nomisweb as Api import humanleague import household_microsynth.utils as Utils class ReferencePerson: """ Household ref person microsynthesis """ # Placeholders for unknown or non-applicable category values UN...
[ "pandas.DataFrame", "numpy.sum", "humanleague.flatten", "numpy.ones", "household_microsynth.utils.remap", "ukcensusapi.Nomisweb.Nomisweb", "numpy.array", "household_microsynth.utils.unmap" ]
[((540, 563), 'ukcensusapi.Nomisweb.Nomisweb', 'Api.Nomisweb', (['cache_dir'], {}), '(cache_dir)\n', (552, 563), True, 'import ukcensusapi.Nomisweb as Api\n'), ((1132, 1164), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'categories'}), '(columns=categories)\n', (1144, 1164), True, 'import pandas as pd\n'), ((20...
#! /usr/bin/env python2 from __future__ import print_function, division import numpy as np, cv2, sys, os, math, random, time, torch, torch.nn as nn, collections, tensorboardX, gym, termcolor, datetime, colored_traceback.always sys.dont_write_bytecode = True from agent import Experience #============================...
[ "os.mkdir", "numpy.std", "torch.load", "os.path.exists", "agent.Experience", "numpy.mean", "numpy.array" ]
[((3726, 3749), 'os.path.exists', 'os.path.exists', (['""".ckpt"""'], {}), "('.ckpt')\n", (3740, 3749), False, 'import numpy as np, cv2, sys, os, math, random, time, torch, torch.nn as nn, collections, tensorboardX, gym, termcolor, datetime, colored_traceback.always\n'), ((3751, 3768), 'os.mkdir', 'os.mkdir', (['""".ck...
""" This module implements the search-based refactoring with various search strategy using pymoo framework. Gene, RefactoringOperation: One refactoring with params Individual: A list of RefactoringOperation SudoRandomInitialization: Population, list of Individual ## References [1] https://pymoo.org/customization/cust...
[ "numpy.full", "sbse.config.logger.info", "pymoo.factory.get_reference_directions", "numpy.full_like", "pymoo.optimize.minimize", "pymoo.factory.get_crossover", "metrics.testability_prediction.main", "sbse.config.logger.debug", "utilization.directory_utils.git_restore", "numpy.random.random", "nu...
[((17789, 17838), 'pymoo.factory.get_reference_directions', 'get_reference_directions', (['"""energy"""', '(8)', '(90)'], {'seed': '(1)'}), "('energy', 8, 90, seed=1)\n", (17813, 17838), False, 'from pymoo.factory import get_reference_directions, get_crossover\n'), ((18901, 19027), 'pymoo.optimize.minimize', 'minimize'...
#!/usr/bin/env python # # test_fnirt.py - # # Author: <NAME> <<EMAIL>> # import os.path as op import itertools as it import numpy as np import nibabel as nib import pytest import fsl.data.image as fslimage import fsl.utils.tempdir as tempdir import fsl.data.constants as constants import fsl.tran...
[ "nibabel.load", "fsl.transform.nonlinear.convertDeformationSpace", "os.path.dirname", "itertools.permutations", "numpy.isnan", "fsl.transform.fnirt.toFnirt", "fsl.data.image.Image", "pytest.raises", "numpy.isclose", "numpy.random.randint", "fsl.transform.affine.transform", "numpy.array", "fs...
[((500, 520), 'os.path.dirname', 'op.dirname', (['__file__'], {}), '(__file__)\n', (510, 520), True, 'import os.path as op\n'), ((583, 606), 'os.path.join', 'op.join', (['datadir', '"""src"""'], {}), "(datadir, 'src')\n", (590, 606), True, 'import os.path as op\n'), ((618, 641), 'os.path.join', 'op.join', (['datadir', ...
import pickle import numpy as np class Glove: def __init__(self, fname): self.fname = fname self.embeddings_dim = 300 self._read_data() self._build_embeddings() def __getitem__(self, value): try: return self.embeddings[value] except KeyError: ...
[ "numpy.random.uniform", "numpy.array" ]
[((1151, 1207), 'numpy.random.uniform', 'np.random.uniform', (['(-0.25)', '(0.25)'], {'size': 'self.embeddings_dim'}), '(-0.25, 0.25, size=self.embeddings_dim)\n', (1168, 1207), True, 'import numpy as np\n'), ((1055, 1119), 'numpy.array', 'np.array', (['splitted_line[-self.embeddings_dim:]'], {'dtype': 'np.float32'}), ...
# type: ignore import math import matplotlib.pyplot as plt import numpy as np from common import Fitness def print_summary(history, algorithm): max, average_fitness, entropy, baseline, _ = history.keys() print(algorithm, 'summary statistics') print(f'Max: {history[max][-1]:>10.3f}') prin...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.tight_layout", "math.log2", "matplotlib.pyplot.plot", "common.Fitness.sine_fitness", "matplotlib.pyplot.close", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "numpy.sin", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.x...
[((595, 609), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (607, 609), True, 'import matplotlib.pyplot as plt\n'), ((1283, 1294), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (1292, 1294), True, 'import matplotlib.pyplot as plt\n'), ((1394, 1409), 'matplotlib.pyplot.xlabel', 'plt.xlabel'...
# Copyright (c) <NAME> (<EMAIL>). All Rights Reserved. # # Please cite "4D Spatio-Temporal ConvNets: Minkowski Convolutional Neural # Networks", CVPR'19 (https://arxiv.org/abs/1904.08755) if you use any part of # the code. import logging import warnings import os import numpy as np import torch import torch.nn as nn f...
[ "ipdb.set_trace", "torch.cat", "os.path.isfile", "lib.utils.get_torch_device", "torch.no_grad", "torch.isnan", "numpy.nanmean", "lib.utils.per_class_iu", "warnings.simplefilter", "torch.load", "warnings.catch_warnings", "sklearn.metrics.average_precision_score", "MinkowskiEngine.SparseTensor...
[((1971, 1994), 'logging.info', 'logging.info', (['debug_str'], {}), '(debug_str)\n', (1983, 1994), False, 'import logging\n'), ((2437, 2469), 'lib.utils.get_torch_device', 'get_torch_device', (['config.is_cuda'], {}), '(config.is_cuda)\n', (2453, 2469), False, 'from lib.utils import Timer, AverageMeter, precision_at_o...
import argparse import logging import numpy as np import random import torch logger = logging.getLogger("SemEval") def set_seed(args): random.seed(args.seed) np.random.seed(args.seed) torch.manual_seed(args.seed) if args.n_gpu > 0: torch.cuda.manual_seed_all(args.seed) def bool_flag(v): ...
[ "argparse.Namespace", "numpy.random.seed", "torch.manual_seed", "torch.cuda.manual_seed_all", "random.seed", "logging.getLogger", "argparse.ArgumentTypeError" ]
[((88, 116), 'logging.getLogger', 'logging.getLogger', (['"""SemEval"""'], {}), "('SemEval')\n", (105, 116), False, 'import logging\n'), ((143, 165), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (154, 165), False, 'import random\n'), ((170, 195), 'numpy.random.seed', 'np.random.seed', (['args.see...
""" Undersaturated (Volatile and Non-volatile) Oil Material Balance @author: <NAME> @email: <EMAIL> """ import numpy as np import matplotlib.pyplot as plt class mbplot(): """ Undersaturated Oil Material Balance Plot Ideal Data """ def plot1(self, p, Bg, Bo, Np, Gp, Gi, cf, cw, swi, Rs, Rv, output...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((1192, 1205), 'numpy.array', 'np.array', (['Bto'], {}), '(Bto)\n', (1200, 1205), True, 'import numpy as np\n'), ((1218, 1229), 'numpy.array', 'np.array', (['F'], {}), '(F)\n', (1226, 1229), True, 'import numpy as np\n'), ((2735, 2748), 'numpy.array', 'np.array', (['Bto'], {}), '(Bto)\n', (2743, 2748), True, 'import n...
# -*- coding: utf-8 -*- import sys sys.path.append('/Users/SeongHwanKim/tensorflow3/caffe-master/python') from caffe.proto import caffe_pb2 import numpy as np import json import copy global mdlnet global inlayername # calculate output dimension size for all layer def layerDim(mdlnet, inname, indim, sizelist): te...
[ "sys.path.append", "copy.deepcopy", "json.loads", "numpy.ceil", "caffe.proto.caffe_pb2.SolverParameter", "caffe.proto.caffe_pb2.NetStateRule", "caffe.proto.caffe_pb2.NetParameter" ]
[((36, 106), 'sys.path.append', 'sys.path.append', (['"""/Users/SeongHwanKim/tensorflow3/caffe-master/python"""'], {}), "('/Users/SeongHwanKim/tensorflow3/caffe-master/python')\n", (51, 106), False, 'import sys\n'), ((16246, 16270), 'caffe.proto.caffe_pb2.NetParameter', 'caffe_pb2.NetParameter', ([], {}), '()\n', (1626...
from config import * from data import * from utils import * from constant import * from nn import * from torch.autograd import Variable from tqdm import tqdm import numpy as np import os from datetime import datetime import pytz model_name = 'nn_xnn_time_diff_v2' torch.backends.cudnn.deterministic = True seed_...
[ "numpy.argsort", "torch.autograd.Variable", "tqdm.tqdm", "numpy.mean" ]
[((3210, 3234), 'numpy.mean', 'np.mean', (['validation_loss'], {}), '(validation_loss)\n', (3217, 3234), True, 'import numpy as np\n'), ((4668, 4686), 'tqdm.tqdm', 'tqdm', (['train_loader'], {}), '(train_loader)\n', (4672, 4686), False, 'from tqdm import tqdm\n'), ((7371, 7389), 'numpy.argsort', 'np.argsort', (['scores...
# Copyright (c) 2018 PaddlePaddle 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 applic...
[ "tarfile.open", "numpy.std", "numpy.transpose", "PIL.ImageOps.expand", "numpy.random.randint", "numpy.mean", "absl.flags.DEFINE_boolean", "itertools.izip", "numpy.array", "PIL.Image.fromarray", "numpy.sqrt" ]
[((1118, 1204), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""random_flip_left_right"""', '(True)', '"""random flip left and right"""'], {}), "('random_flip_left_right', True,\n 'random flip left and right')\n", (1138, 1204), False, 'from absl import flags\n'), ((1222, 1299), 'absl.flags.DEFINE_boolean'...
#************************************************** #Python import numpy as np import pandas as pd import os.path import subprocess import math import datetime import matplotlib import os.path from copy import copy, deepcopy from matplotlib import pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from ...
[ "matplotlib.backends.backend_pdf.PdfPages", "numpy.sum", "matplotlib.pyplot.clf", "pandas.read_csv", "numpy.empty", "numpy.isnan", "numpy.mean", "numpy.exp", "pandas.DataFrame", "numpy.full", "matplotlib.pyplot.axvline", "matplotlib.pyplot.close", "numpy.append", "datetime.timedelta", "m...
[((378, 399), 'datetime.datetime', 'datetime', (['(2014)', '(12)', '(1)'], {}), '(2014, 12, 1)\n', (386, 399), False, 'from datetime import datetime, timedelta\n'), ((4682, 4894), 'pandas.read_csv', 'pd.read_csv', (['"""../data/raw/samedan_2014_2015.dat"""'], {'header': 'None', 'encoding': '"""latin-1"""', 'skiprows': ...
from pathlib import Path from functools import cmp_to_key import attr import math import json import torch import torch.nn.functional as F import torchvision.transforms as transforms import numpy as np from PIL import Image device = torch.device("cuda" if torch.cuda.is_available() else "cpu") @attr.s(auto_attribs=T...
[ "torch.ones", "math.exp", "torch.LongTensor", "attr.s", "torch.FloatTensor", "torch.cat", "PIL.Image.open", "pathlib.Path", "torchvision.transforms.Compose", "numpy.array", "torch.cuda.is_available", "torch.nn.functional.log_softmax", "torch.zeros", "torchvision.transforms.Normalize", "f...
[((299, 324), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (305, 324), False, 'import attr\n'), ((1649, 1671), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_path)\n', (1659, 1671), False, 'from PIL import Image\n'), ((1715, 1728), 'numpy.array', 'np.array', (['img'], {}...
#!/usr/bin/env python3 import numpy as np import copy import utilities as utils """ matlab stores data by column order, numpy stores by row order q matlab: (4, 8, 2) python: (2, 4, 8) Structure of HHMM PI matlab: (8, 8, 3) python: (3, 8, 8) Initial state distribution (Vertical) A matlab: (8, 8,...
[ "copy.deepcopy", "numpy.set_printoptions", "numpy.random.seed", "numpy.sum", "numpy.nan_to_num", "numpy.random.random_sample", "numpy.zeros", "utilities.HHMM_EM", "numpy.append", "numpy.cumsum", "numpy.where", "numpy.array" ]
[((531, 601), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)', 'linewidth': 'np.nan', 'threshold': 'np.nan'}), '(suppress=True, linewidth=np.nan, threshold=np.nan)\n', (550, 601), True, 'import numpy as np\n'), ((699, 726), 'numpy.zeros', 'np.zeros', (['(2, depth, width)'], {}), '((2, depth,...
import numpy as np import pytest from abmarl.sim.corridor import MultiCorridor as Corridor from abmarl.managers import TurnBasedManager def test_init(): sim = Corridor() wrapped_sim = TurnBasedManager(sim) assert wrapped_sim.sim == sim assert wrapped_sim.agents == sim.agents assert next(wrapped_s...
[ "pytest.raises", "numpy.random.seed", "abmarl.managers.TurnBasedManager", "abmarl.sim.corridor.MultiCorridor" ]
[((166, 176), 'abmarl.sim.corridor.MultiCorridor', 'Corridor', ([], {}), '()\n', (174, 176), True, 'from abmarl.sim.corridor import MultiCorridor as Corridor\n'), ((195, 216), 'abmarl.managers.TurnBasedManager', 'TurnBasedManager', (['sim'], {}), '(sim)\n', (211, 216), False, 'from abmarl.managers import TurnBasedManag...
# Copyright (C) 2020 GreenWaves Technologies, SAS # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This progr...
[ "utils.sparse_list.SparseList", "numpy.abs", "quantization.multiplicative.mult_quantization.MultQuantizationRecord", "numpy.resize", "quantization.multiplicative.symmetric.symmetric_mult_biases_qtype.SymmetricMultBiasesQType", "quantization.multiplicative.symmetric.symmetric_mult_qtype.SymmetricMultQType"...
[((3866, 3905), 'logging.getLogger', 'logging.getLogger', (["('nntool.' + __name__)"], {}), "('nntool.' + __name__)\n", (3883, 3905), False, 'import logging\n'), ((4901, 4914), 'graph.dim.PadDim.same', 'PadDim.same', ([], {}), '()\n', (4912, 4914), False, 'from graph.dim import Conv2DFilterDim, Dim, FcFilterDim, PadDim...
# Author: <NAME> # Purpose: Train a Neural Network to mimic the funcitonality of adding # two numbers together. # # Results: # Numbers between 1 and 100 gives perfect accuracy. # # Numbers between 1 and 500 gives 0.42 error. # # Numbers between 1 and 1000 gives 0.87 error. # # With numbers between 1 and 500, the output...
[ "sklearn.cross_validation.train_test_split", "tensorflow.contrib.skflow.TensorFlowEstimator.restore", "sklearn.metrics.accuracy_score", "numpy.zeros", "trainingFunctions.addThem", "numpy.rint", "numpy.random.randint", "numpy.array", "numpy.reshape", "tensorflow.contrib.skflow.TensorFlowDNNRegresso...
[((2459, 2527), 'tensorflow.contrib.skflow.TensorFlowEstimator.restore', 'skflow.TensorFlowEstimator.restore', (['"""/home/derrowap/models/addThem1"""'], {}), "('/home/derrowap/models/addThem1')\n", (2493, 2527), False, 'from tensorflow.contrib import skflow\n'), ((1513, 1532), 'numpy.zeros', 'np.zeros', (['(size, 2)']...
from __future__ import print_function from __future__ import division import torch import numpy as np import pandas as pd from torchvision import transforms import os from tqdm import tqdm import joblib from utils import CollectionsDataset, CollectionsDatasetTest from model import find_best_fixed_threshold import argpa...
[ "tqdm.tqdm", "nnet.model_ft.to", "nnet.model_ft.parameters", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "os.path.join", "pandas.read_csv", "torch.from_numpy", "torchvision.transforms.CenterCrop", "utils.CollectionsDataset", "torchvision.transforms.ToTensor", "numpy.arange", "u...
[((360, 385), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (383, 385), False, 'import argparse\n'), ((1154, 1176), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (1166, 1176), False, 'import torch\n'), ((1613, 1789), 'utils.CollectionsDataset', 'CollectionsDataset', (...
#! /usr/bin/env python import gym import numpy as np import rospy import utils.warning_ignore import drone_goto from stable_baselines.deepq import DQN, MlpPolicy def callback(lcl, _glb): """ The callback function for logging and saving :param lcl: (dict) the local variables :param _glb: (dict) the ...
[ "stable_baselines.deepq.DQN", "gym.make", "numpy.mean", "rospy.init_node" ]
[((719, 764), 'rospy.init_node', 'rospy.init_node', (['"""train_node"""'], {'anonymous': '(True)'}), "('train_node', anonymous=True)\n", (734, 764), False, 'import rospy\n'), ((775, 799), 'gym.make', 'gym.make', (['"""DroneGoto-v0"""'], {}), "('DroneGoto-v0')\n", (783, 799), False, 'import gym\n'), ((812, 940), 'stable...
"""Simulation box utilities """ import numpy as np import math def pbc_place_inside(box: np.ndarray, r_out: np.ndarray) -> np.ndarray: """Places point inside simulation box applying periodic boundary condition. :param box Simulation box. :param r_out Point possibly outside box. :return r_in Point ins...
[ "numpy.rint", "numpy.array", "math.floor" ]
[((355, 395), 'numpy.array', 'np.array', (['[r_out[0], r_out[1], r_out[2]]'], {}), '([r_out[0], r_out[1], r_out[2]])\n', (363, 395), True, 'import numpy as np\n'), ((845, 870), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (853, 870), True, 'import numpy as np\n'), ((986, 1000), 'numpy.ri...
# created by Minghan from __future__ import print_function import argparse import os import random import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data from torch.autograd import Variable import torch.nn.functional as F impo...
[ "torch.manual_seed", "utils.preprocess.get_transform", "torch.load", "torch.cuda.manual_seed", "torch.autograd.Variable", "torch.FloatTensor", "time.time", "torch.squeeze", "torch.cuda.is_available", "numpy.reshape", "numpy.lib.pad", "torch.nn.DataParallel", "torch.no_grad" ]
[((703, 736), 'torch.manual_seed', 'torch.manual_seed', (['self.args.seed'], {}), '(self.args.seed)\n', (720, 736), False, 'import torch\n'), ((1109, 1152), 'torch.nn.DataParallel', 'nn.DataParallel', (['self.model'], {'device_ids': '[0]'}), '(self.model, device_ids=[0])\n', (1124, 1152), True, 'import torch.nn as nn\n...
# -*- coding: utf-8 -*- """ Created on Sun Dec 4 18:14:29 2016 @author: becker """ import numpy as np import scipy.linalg as linalg import scipy.sparse as sparse try: from simfempy.meshes.simplexmesh import SimplexMesh except ModuleNotFoundError: from simfempy.meshes.simplexmesh import SimplexMesh import sim...
[ "numpy.sum", "numpy.empty", "numpy.einsum", "numpy.ones", "numpy.mean", "numpy.arange", "numpy.tile", "numpy.add.at", "numpy.unique", "numpy.zeros_like", "numpy.append", "scipy.sparse.coo_matrix", "scipy.sparse.dia_matrix", "scipy.sparse.dok_matrix", "numpy.union1d", "numpy.repeat", ...
[((15635, 15688), 'simfempy.meshes.simplexmesh.SimplexMesh', 'SimplexMesh', ([], {'geomname': '"""backwardfacingstep"""', 'hmean': '(0.3)'}), "(geomname='backwardfacingstep', hmean=0.3)\n", (15646, 15688), False, 'from simfempy.meshes.simplexmesh import SimplexMesh\n'), ((15793, 15829), 'plotmesh.meshWithBoundaries', '...
import csv import os import sys import cv2 import subprocess import re import numpy # import tensorflow as tf import math import numpy as np import h5py # In OpenCV3.X, this is available as cv2.CAP_PROP_POS_MSEC # In OpenCV2.X, this is available as cv2.cv.CV_CAP_PROP_POS_MSEC CAP_PROP_POS_MSEC = 0 class Extractor: ...
[ "cv2.resize", "subprocess.Popen", "h5py.File", "h5py.special_dtype", "math.ceil", "numpy.clip", "cv2.VideoCapture", "numpy.array", "numpy.vstack" ]
[((541, 646), 'subprocess.Popen', 'subprocess.Popen', (["['ffmpeg', '-i', self.video_path]"], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), "(['ffmpeg', '-i', self.video_path], stdout=subprocess.PIPE,\n stderr=subprocess.STDOUT)\n", (557, 646), False, 'import subprocess\n'), ((1336, 1398), 'math.cei...
''' DistCalc2: estimates the distance to the supernova from the neutrino data by constraining the progenitor assuming one-to-one correspondence bt f_delta and N50_exp (expected 0-50ms count) (f_delta = m*N50_exp + b) Data assumptions: - 1 ms binning - first 100 bins of each data have no SN emission (for backgr...
[ "numpy.mean", "numpy.sum", "numpy.sqrt" ]
[((2023, 2062), 'numpy.mean', 'np.mean', (['data[self.in_field][0:self.t0]'], {}), '(data[self.in_field][0:self.t0])\n', (2030, 2062), True, 'import numpy as np\n'), ((2125, 2136), 'numpy.sqrt', 'np.sqrt', (['bg'], {}), '(bg)\n', (2132, 2136), True, 'import numpy as np\n'), ((2151, 2200), 'numpy.sum', 'np.sum', (['data...