code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Licensing: This code is distributed under the GNU LGPL license. Authors: Original FORTRAN77 version of i4_sobol by <NAME>. MATLAB version by <NAME>. PYTHON version by <NAME> Original Python version of is_prime by <NAME> Original MATLAB versions of other functions by <NAME>....
[ "math.ceil", "numpy.zeros", "numpy.transpose", "math.floor", "numpy.mod" ]
[((1780, 1793), 'math.floor', 'math.floor', (['n'], {}), '(n)\n', (1790, 1793), False, 'import math\n'), ((3043, 3056), 'math.floor', 'math.floor', (['n'], {}), '(n)\n', (3053, 3056), False, 'import math\n'), ((3560, 3579), 'numpy.zeros', 'numpy.zeros', (['(m, n)'], {}), '((m, n))\n', (3571, 3579), False, 'import numpy...
# Copyright 2019,2020,2021 Sony Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
[ "nnabla.Variable.from_numpy_array", "numpy.allclose", "librosa.istft", "test_stft.ref_stft", "pytest.mark.parametrize", "numpy.random.randn", "torch.view_as_complex", "numpy.random.RandomState", "nbla_test_utils.list_context", "pytest.raises", "numpy.reshape", "nbla_test_utils.function_tester"...
[((4230, 4270), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ctx"""', 'ctx_list'], {}), "('ctx', ctx_list)\n", (4253, 4270), False, 'import pytest\n'), ((4272, 4310), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""seed"""', '[313]'], {}), "('seed', [313])\n", (4295, 4310), False, 'import pyt...
""" Useful tools for various situations """ import numpy as np import scipy import sys ang_2_bohr = 1.0/0.52917721067 hart_2_ev = 27.21138602 def is_number(s): try: float(s) return True except ValueError: return False eval_region_description = ( "Specify evaluation region limits ...
[ "numpy.abs", "numpy.min", "numpy.max", "numpy.array", "scipy.interpolate.RegularGridInterpolator", "numpy.linspace", "sys.exit" ]
[((3069, 3102), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'array.shape[0]'], {}), '(0, 1, array.shape[0])\n', (3080, 3102), True, 'import numpy as np\n'), ((3115, 3148), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'array.shape[1]'], {}), '(0, 1, array.shape[1])\n', (3126, 3148), True, 'import numpy as np\n'...
import numpy as np from pymoo.factory import get_problem from pymoo.optimize import minimize def generate_test_data(): for str_problem in ["osy"]: problem = get_problem(str_problem) X = [] # define a callback function that prints the X and F value of the best individual def my_c...
[ "pymoo.factory.get_problem", "numpy.concatenate" ]
[((172, 196), 'pymoo.factory.get_problem', 'get_problem', (['str_problem'], {}), '(str_problem)\n', (183, 196), False, 'from pymoo.factory import get_problem\n'), ((796, 821), 'numpy.concatenate', 'np.concatenate', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (810, 821), True, 'import numpy as np\n')]
import cv2 import torch import torch.nn as nn import torch.nn.functional as F import torchvision from torchvision import models, transforms, utils import numpy as np import copy class FeatureExtractor(): def __init__(self, model, use_cuda=True, padding=True): self.model = copy.deepcopy(model) self...
[ "copy.deepcopy", "numpy.sum", "torch.nn.functional.reshape", "numpy.zeros", "torch.nn.functional.flatten", "numpy.max", "numpy.where", "numpy.linalg.norm", "numpy.array" ]
[((287, 307), 'copy.deepcopy', 'copy.deepcopy', (['model'], {}), '(model)\n', (300, 307), False, 'import copy\n'), ((1977, 2038), 'numpy.zeros', 'np.zeros', (['(c, M.shape[-2] - h_f, M.shape[-1] - w_f, h_f, w_f)'], {}), '((c, M.shape[-2] - h_f, M.shape[-1] - w_f, h_f, w_f))\n', (1985, 2038), True, 'import numpy as np\n...
import sys import os from torch.utils.data import dataloader import tqdm import numpy as np import cv2 import torch import torch.nn as nn from torch.autograd import Variable import torch.utils.data as data from torch.utils.data import DataLoader from torchvision import transforms torch.cuda.set_device(7) batch_size = ...
[ "os.path.isfile", "torch.no_grad", "os.path.join", "torch.utils.data.DataLoader", "torch.load", "os.path.dirname", "os.path.exists", "torch.nn.Linear", "torch.cuda.set_device", "cv2.resize", "torch.topk", "torch.autograd.Variable", "torch.nn.Conv2d", "os.listdir", "torch.nn.PReLU", "to...
[((282, 306), 'torch.cuda.set_device', 'torch.cuda.set_device', (['(7)'], {}), '(7)\n', (303, 306), False, 'import torch\n'), ((3273, 3294), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (3292, 3294), True, 'import torch.nn as nn\n'), ((4882, 4910), 'torch.load', 'torch.load', (['train_model_pat...
#!/usr/bin/env python3 # This file is covered by the LICENSE file in the root of this project. import torch import torch.nn as nn import torch.optim as optim import torch.backends.cudnn as cudnn import torchvision.transforms as transforms import imp import yaml import time from PIL import Image import __init__ as boog...
[ "torch.cuda.device_count", "torch.no_grad", "os.path.join", "collections.deque", "torch.ones", "cv2.imwrite", "copy.deepcopy", "imp.load_source", "torch.cuda.is_available", "common.oneshot.OneShot_LR", "numpy.concatenate", "common.sync_batchnorm.batchnorm.convert_model", "os.makedirs", "co...
[((1138, 1162), 'common.logger.Logger', 'Logger', (["(self.log + '/tb')"], {}), "(self.log + '/tb')\n", (1144, 1162), False, 'from common.logger import Logger\n'), ((1667, 1804), 'imp.load_source', 'imp.load_source', (['"""parserModule"""', "(booger.TRAIN_PATH + '/tasks/segmentation/dataset/' + self.CFG['dataset'][\n ...
import numpy as np #lax-Wendroff Scheme for 1d Burgers equation #版本1为详细版,版本2为简化版 #介绍:https://zhuanlan.zhihu.com/p/331771977 nmax = 8 tmax = 100 dx = 1.0 / nmax dt = 1.0 / tmax U = np.zeros((tmax,nmax)) F = np.zeros((tmax,nmax)) upredp = np.zeros((tmax,nmax))#plus 1/2 upredm = np.zeros((tmax,nmax))#minus 1/2 fpredp = np...
[ "numpy.zeros" ]
[((180, 202), 'numpy.zeros', 'np.zeros', (['(tmax, nmax)'], {}), '((tmax, nmax))\n', (188, 202), True, 'import numpy as np\n'), ((206, 228), 'numpy.zeros', 'np.zeros', (['(tmax, nmax)'], {}), '((tmax, nmax))\n', (214, 228), True, 'import numpy as np\n'), ((237, 259), 'numpy.zeros', 'np.zeros', (['(tmax, nmax)'], {}), '...
# Copyright (c) 2022 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 appli...
[ "numpy.random.seed", "paddle.enable_static", "paddle.fluid.layers.data", "numpy.allclose", "op_test.OpTest.np_dtype_to_fluid_dtype", "numpy.exp", "sys.path.append", "unittest.main", "paddle.CPUPlace", "paddle.fluid.dygraph.guard", "numpy.log10", "paddle.static.default_main_program", "paddle....
[((697, 718), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (712, 718), False, 'import sys\n'), ((790, 812), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '()\n', (810, 812), False, 'import paddle\n'), ((6743, 6758), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6756, 6758), F...
from typing import Tuple, Union import numpy as np from utilities.matlabutils import labels2intervals from utilities.numpyutils import is_numpy_matrix, is_numpy_vector def merge_gaps(intervals: np.ndarray, max_gap: float, return_durations: bool = False) \ -> Union[np.ndarray, Tuple[np.ndarray, np.ndarray]]:...
[ "numpy.array", "utilities.numpyutils.is_numpy_matrix", "utilities.matlabutils.labels2intervals", "utilities.numpyutils.is_numpy_vector" ]
[((521, 555), 'utilities.numpyutils.is_numpy_matrix', 'is_numpy_matrix', (['intervals'], {'cols': '(2)'}), '(intervals, cols=2)\n', (536, 555), False, 'from utilities.numpyutils import is_numpy_matrix, is_numpy_vector\n'), ((1111, 1127), 'numpy.array', 'np.array', (['merged'], {}), '(merged)\n', (1119, 1127), True, 'im...
""" Copyright (c) 2021, NVIDIA CORPORATION. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
[ "os.path.abspath", "tensorflow.size", "tensorflow.debugging.assert_equal", "tensorflow.gather_nd", "tensorflow.transpose", "tensorflow.shape", "tensorflow.sparse.split", "numpy.random.randint", "tensorflow.distribute.get_replica_context", "tensorflow.where", "tensorflow.python.distribute.values....
[((1215, 1315), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(1)', 'high': '(100)', 'size': '[self.global_batch_size * rows_num_per_sample, max_nnz]'}), '(low=1, high=100, size=[self.global_batch_size *\n rows_num_per_sample, max_nnz])\n', (1232, 1315), True, 'import numpy as np\n'), ((1332, 1430), 'nu...
"""Nearest neighbour classifiers""" from __future__ import annotations from typing import Callable, List import numpy as np from frlearn.base import DataDescriptor, MultiClassClassifier, MultiLabelClassifier from frlearn.data_descriptors import NND from frlearn.neighbour_search_methods import NeighbourSearchMethod, ...
[ "frlearn.parametrisations.multiple", "numpy.minimum", "numpy.sum", "numpy.maximum", "frlearn.data_descriptors.NND", "frlearn.array_functions.soft_max", "frlearn.neighbour_search_methods.KDTree", "frlearn.weights.ExponentialWeights", "frlearn.weights.LinearWeights", "numpy.max", "numpy.mean", "...
[((6749, 6764), 'frlearn.weights.LinearWeights', 'LinearWeights', ([], {}), '()\n', (6762, 6764), False, 'from frlearn.weights import ExponentialWeights, LinearWeights\n'), ((6894, 6909), 'frlearn.weights.LinearWeights', 'LinearWeights', ([], {}), '()\n', (6907, 6909), False, 'from frlearn.weights import ExponentialWei...
import os import time import numpy as np import dtlpy as dl from nsfw_detector import predict # import keras # ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' from tensorflow import keras class ModelAdapter(dl.BaseModelAdapter): """ Specific Model adapter. The class bi...
[ "nsfw_detector.predict.load_model", "os.remove", "os.stat", "nsfw_detector.predict.classify_nd", "dtlpy.ml.predictions_utils.add_classification", "time.sleep", "cv2.VideoCapture", "os.path.isfile", "numpy.array", "skimage.transform.resize", "os.path.join" ]
[((1484, 1515), 'os.path.join', 'os.path.join', (['local_path', 'fname'], {}), '(local_path, fname)\n', (1496, 1515), False, 'import os\n'), ((1905, 1935), 'nsfw_detector.predict.load_model', 'predict.load_model', (['model_path'], {}), '(model_path)\n', (1923, 1935), False, 'from nsfw_detector import predict\n'), ((330...
#! /usr/bin/env python from __future__ import print_function from timeit import default_timer as time import sys import numpy as np import numba from numba import dppl, njit, prange from numba.dppl.testing import unittest from numba.dppl.testing import DPPLTestCase from numba.tests.support import captured_stdout cla...
[ "numba.njit", "numpy.ones", "numba.tests.support.captured_stdout", "numba.dppl.testing.unittest.skip", "numpy.testing.assert_equal", "numba.prange", "numba.dppl.testing.unittest.main", "numpy.all" ]
[((3175, 3220), 'numba.dppl.testing.unittest.skip', 'unittest.skip', (['"""NRT required but not enabled"""'], {}), "('NRT required but not enabled')\n", (3188, 3220), False, 'from numba.dppl.testing import unittest\n'), ((4102, 4117), 'numba.dppl.testing.unittest.main', 'unittest.main', ([], {}), '()\n', (4115, 4117), ...
import sys import os from six.moves import urllib import tarfile import pickle import numpy as np import tensorflow as tf from load_mnist import MNIST CHANNELS = 1 HEIGHT = 28 WIDTH = 28 def get_data_generator(data_dir, is_training, normalize=True): """ Gets a generator function that will be used for the inp...
[ "numpy.multiply", "tensorflow.global_variables_initializer", "tensorflow.nn.l2_normalize", "tensorflow.Session", "numpy.transpose", "tensorflow.TensorShape", "tensorflow.train.start_queue_runners", "tensorflow.local_variables_initializer", "numpy.reshape", "load_mnist.MNIST" ]
[((1247, 1294), 'numpy.reshape', 'np.reshape', (['data', '(-1, CHANNELS, HEIGHT, WIDTH)'], {}), '(data, (-1, CHANNELS, HEIGHT, WIDTH))\n', (1257, 1294), True, 'import numpy as np\n'), ((1306, 1343), 'numpy.transpose', 'np.transpose', (['data'], {'axes': '(0, 2, 3, 1)'}), '(data, axes=(0, 2, 3, 1))\n', (1318, 1343), Tru...
#!/usr/bin/env python # -*- coding: utf-8 -*- import dask.array as da import numpy as np import pytest import dask_image.ndfilters cupy = pytest.importorskip("cupy", minversion="7.7.0") @pytest.fixture def array(): s = (10, 10) a = da.from_array(cupy.arange(int(np.prod(s)), dtype=cupy...
[ "pytest.mark.parametrize", "pytest.importorskip", "numpy.ones", "numpy.prod" ]
[((141, 188), 'pytest.importorskip', 'pytest.importorskip', (['"""cupy"""'], {'minversion': '"""7.7.0"""'}), "('cupy', minversion='7.7.0')\n", (160, 188), False, 'import pytest\n'), ((386, 487), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func"""', '[dask_image.ndfilters.convolve, dask_image.ndfilters.c...
import os, glob, sys,time import numpy as np import matplotlib.pyplot as plt # biopython imports from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio.Blast.Applications import NcbiblastnCommandline from Bio.Blast import NCBIXML # other packages from . import LibraryDesigner as ld ...
[ "os.remove", "Bio.Seq.Seq", "Bio.SeqIO.write", "os.path.isfile", "matplotlib.pyplot.figure", "os.path.join", "os.path.dirname", "os.path.exists", "Bio.SeqUtils.GC", "Bio.SeqIO.parse", "matplotlib.pyplot.show", "os.path.basename", "os.system", "re.match", "os.makedirs", "matplotlib.pypl...
[((1721, 1742), 'Bio.Seq.Seq', 'Seq', (['input_seq_string'], {}), '(input_seq_string)\n', (1724, 1742), False, 'from Bio.Seq import Seq\n'), ((8680, 8719), 'os.path.join', 'os.path.join', (['readout_folder', 'save_name'], {}), '(readout_folder, save_name)\n', (8692, 8719), False, 'import glob, os\n'), ((13202, 13241), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################## # Copyright (C) 2014 by codeskyblue #============================================= ''' Some snippets of opencv2 ## Resize image ref: <http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#void resize(Inpu...
[ "cv2.floodFill", "cv2.minMaxLoc", "cv2.imshow", "numpy.ndarray", "cv2.matchTemplate", "cv2.line", "cv2.cvtColor", "numpy.append", "cv2.split", "cv2.destroyAllWindows", "cv2.Canny", "cv2.circle", "cv2.waitKey", "cv2.SIFT", "cv2.resizeWindow", "numpy.float32", "cv2.imread", "cv2.xfea...
[((1734, 1783), 'cv2.circle', 'cv2.circle', (['img', '(x, y)', 'radius', '(255)'], {'thickness': '(2)'}), '(img, (x, y), radius, 255, thickness=2)\n', (1744, 1783), False, 'import cv2\n'), ((1787, 1839), 'cv2.line', 'cv2.line', (['img', '(x - radius, y)', '(x + radius, y)', '(100)'], {}), '(img, (x - radius, y), (x + r...
''' Object loader to pyrender <NAME> (<EMAIL>) Last revision: Sept 2021 ''' import os from os import path as osp import numpy as np import trimesh import pyrender class ObjectLoader: def __init__(self, obj_path): obj_trimesh = trimesh.load(obj_path) # get object's mesh, vertices, normals ...
[ "numpy.array", "pyrender.Mesh.from_trimesh", "trimesh.load", "os.path.join" ]
[((777, 843), 'os.path.join', 'osp.join', (['""".."""', '"""data"""', 'obj_name', '"""google_512k"""', '"""nontextured.stl"""'], {}), "('..', 'data', obj_name, 'google_512k', 'nontextured.stl')\n", (785, 843), True, 'from os import path as osp\n'), ((243, 265), 'trimesh.load', 'trimesh.load', (['obj_path'], {}), '(obj_...
# Main.py import cv2 import numpy as np import os import sys import time import DetectChars import DetectPlates import PossiblePlate from PIL import ImageFont, ImageDraw, Image from database import * from database.insert_data_register import check_plate_in_db from database.save_timstamp import insert_licenplat as lic...
[ "linebot_lpr.send_message.pushMessageTo_User_On_Line", "database.save_timstamp.insert_licenplat", "DetectChars.loadKNNDataAndTrainKNN", "cv2.waitKey", "DetectChars.detectCharsInPlates", "cv2.getTextSize", "database.insert_data_register.check_plate_in_db", "PIL.ImageFont.truetype", "cv2.VideoCapture"...
[((649, 685), 'DetectChars.loadKNNDataAndTrainKNN', 'DetectChars.loadKNNDataAndTrainKNN', ([], {}), '()\n', (683, 685), False, 'import DetectChars\n'), ((1179, 1208), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_input'], {}), '(video_input)\n', (1195, 1208), False, 'import cv2\n'), ((4595, 4643), 'cv2.boxPoints', '...
import h5py import numpy as np import os import pickle as pkl import compressed_sensing_recon as cr import fastMRI_reader as r import time def recon_all(src, dst, accel=2): times = [] if not os.path.exists(dst): os.mkdir(dst) for item in os.listdir(src): original_name = os.path.abspath(os.p...
[ "os.mkdir", "os.path.exists", "time.time", "compressed_sensing_recon.image_undersampled_recon", "numpy.array", "fastMRI_reader.readImage", "os.path.join", "os.listdir", "fastMRI_reader.read_h5_unsafe" ]
[((259, 274), 'os.listdir', 'os.listdir', (['src'], {}), '(src)\n', (269, 274), False, 'import os\n'), ((1741, 1756), 'os.listdir', 'os.listdir', (['src'], {}), '(src)\n', (1751, 1756), False, 'import os\n'), ((2133, 2148), 'os.listdir', 'os.listdir', (['dst'], {}), '(dst)\n', (2143, 2148), False, 'import os\n'), ((200...
from statsmodels.stats.contingency_tables import mcnemar import numpy as np import argparse from sklearn.preprocessing import MultiLabelBinarizer from statsmodels.stats.api import SquareTable import pandas as pd import codecs import os import glob def mcnemar_test(metrA, metrB, gold): metAmetB_correct = 0 ...
[ "pandas.DataFrame", "numpy.matrix", "pandas.crosstab", "argparse.ArgumentParser", "os.path.basename", "statsmodels.stats.contingency_tables.mcnemar", "sklearn.preprocessing.MultiLabelBinarizer", "pandas.read_json", "numpy.array", "statsmodels.stats.api.SquareTable", "glob.glob" ]
[((970, 1014), 'statsmodels.stats.contingency_tables.mcnemar', 'mcnemar', (['table'], {'exact': '(False)', 'correction': '(True)'}), '(table, exact=False, correction=True)\n', (977, 1014), False, 'from statsmodels.stats.contingency_tables import mcnemar\n'), ((1408, 1423), 'pandas.DataFrame', 'pd.DataFrame', (['d'], {}...
''' ''' import copy import json import logging import os import random import lmdb import numpy as np import tensorpack.dataflow as td import torch from torch.utils.data import Dataset from torch.utils.data.sampler import Sampler import torch.distributed as dist import sys import pdb # import torchaudio log...
[ "json.dump", "copy.deepcopy", "numpy.load", "numpy.sum", "json.loads", "logging.basicConfig", "tensorpack.dataflow.MapData", "random.randint", "numpy.concatenate", "tensorpack.dataflow.LMDBSerializer.load", "torch.tensor", "numpy.zeros", "numpy.expand_dims", "random.random", "torch.cuda....
[((317, 460), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=l...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import shutil import numpy as np import time import argparse import functools import reader import paddle import paddle.fluid as fluid import paddle.fluid.profiler as profiler from pyramidbox import ...
[ "numpy.sum", "argparse.ArgumentParser", "paddle.fluid.core.LoDTensor", "paddle.fluid.profiler.profiler", "paddle.fluid.io.load_vars", "os.path.join", "paddle.fluid.Executor", "os.path.exists", "functools.partial", "paddle.fluid.CUDAPlace", "reader.train_batch_reader", "paddle.fluid.CPUPlace", ...
[((392, 436), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (415, 436), False, 'import argparse\n'), ((447, 497), 'functools.partial', 'functools.partial', (['add_arguments'], {'argparser': 'parser'}), '(add_arguments, argparser=parser)\n', (464, 497)...
import taichi as ti import numpy as np m_fluid_color = ti.Vector(list(np.random.rand(3) * 0.7 + 0.3)) m_dye_decay = 0.99 m_f_gravity = ti.Vector([0.0, -9.8])
[ "numpy.random.rand", "taichi.Vector" ]
[((137, 159), 'taichi.Vector', 'ti.Vector', (['[0.0, -9.8]'], {}), '([0.0, -9.8])\n', (146, 159), True, 'import taichi as ti\n'), ((71, 88), 'numpy.random.rand', 'np.random.rand', (['(3)'], {}), '(3)\n', (85, 88), True, 'import numpy as np\n')]
import numpy as np class BaselineAverageReward(object): def fit(self, paths): self.temp = 0 def predict(self, path): rewards = path["rewards"] mean_rewards = np.mean(rewards) return mean_rewards
[ "numpy.mean" ]
[((193, 209), 'numpy.mean', 'np.mean', (['rewards'], {}), '(rewards)\n', (200, 209), True, 'import numpy as np\n')]
# Utilities for plotting import numpy as np from matplotlib import pyplot as plt def plot(X, Y=None, xlabel=None, ylabel=None, legend=[], loc=None, title=None, xlim=None, ylim=None, xscale='linear', yscale='linear', xticks=None, yticks=None, xhide=False, yhide=False, yrot=False, yzero=False, yflip=F...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "numpy.arange", "numpy.exp", "matplotlib.pyplot.gca", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((2576, 2594), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (2592, 2594), True, 'from matplotlib import pyplot as plt\n'), ((5566, 5584), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (5582, 5584), True, 'from matplotlib import pyplot as plt\n'), ((6906, 6916), 'mat...
import logging import argparse import torch import json import numpy as np import sys # optimal hyperparameter of ARS2 teacher_hyper_params = { 'agnews': { '1': { 'linear_ratio': 3, 'score_threshold': 0.3, }, '10': { 'linear_ratio': 1, 'score...
[ "sys.path.append", "numpy.load", "json.load", "wrench.logging.LoggingHandler", "argparse.ArgumentParser", "numpy.std", "ars2.EndClassifierModel", "numpy.mean", "torch.device", "wrench.dataset.load_dataset", "logging.getLogger" ]
[((3110, 3135), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3133, 3135), False, 'import argparse\n'), ((4258, 4285), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (4275, 4285), False, 'import logging\n'), ((4291, 4325), 'sys.path.append', 'sys.path.append', (...
#!/home/bren/miniconda3/bin/python3.7 # encoding: utf-8 ''' runWhOpt run genetic algorithm to find inventory stocking that minimizes distance traveled to pick orders examples: runWhOPt 5 5 # run simulation of warehouse with 5 racks of 5 bins on each side @author: user_name @copyright: 2019 TLA. All rig...
[ "numpy.isin", "pickle.dump", "numpy.random.seed", "argparse.ArgumentParser", "time.ctime", "os.path.isfile", "Warehouse.Individual.Individual.default_fitness", "numpy.arange", "pickle.load", "doctest.testmod", "Warehouse.Order.Order", "heapq.heapify", "pstats.Stats", "Warehouse.PickRoute.P...
[((1586, 1615), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (1602, 1615), False, 'import os\n'), ((1547, 1568), 'sys.argv.extend', 'sys.argv.extend', (['argv'], {}), '(argv)\n', (1562, 1568), False, 'import sys\n'), ((2243, 2336), 'argparse.ArgumentParser', 'ArgumentParser', ([], {...
import sharppy.databases.sars as sars import sharppy.sharptab as tab from sharppy.io.spc_decoder import SPCDecoder import numpy as np from datetime import datetime import os def get_profile(fname, sars_type): # Create a convective profile object # fname - filename/SARS sounding string to load in # sars_typ...
[ "sharppy.sharptab.utils.mag", "sharppy.sharptab.params.lapse_rate", "sharppy.io.spc_decoder.SPCDecoder", "sharppy.sharptab.thermo.mixratio", "numpy.asarray", "os.path.dirname", "sharppy.sharptab.profile.ConvectiveProfile.copy", "sharppy.databases.sars.supercell", "sharppy.databases.sars.hail", "nu...
[((606, 628), 'sharppy.io.spc_decoder.SPCDecoder', 'SPCDecoder', (['sars_fname'], {}), '(sars_fname)\n', (616, 628), False, 'from sharppy.io.spc_decoder import SPCDecoder\n'), ((1540, 1572), 'sharppy.sharptab.interp.temp', 'tab.interp.temp', (['new_prof', '(500.0)'], {}), '(new_prof, 500.0)\n', (1555, 1572), True, 'imp...
import numpy as _np from mpi4py import MPI as _MPI from jax import core from jax.core import Primitive from jax.interpreters import xla from jax.lax import create_token from jax.lib import xla_client from ..utils import ( HashableMPIType, default_primitive_impl, to_dtype_handle, to_mpi_handle, unp...
[ "jax.lax.create_token", "jax.core.Primitive", "jax.lib.xla_client.Shape.token_shape", "numpy.intc", "jax.lib.xla_client.ops.GetTupleElement", "jax.lib.xla_client.ops.CustomCall", "numpy.prod" ]
[((623, 644), 'jax.core.Primitive', 'Primitive', (['"""send_mpi"""'], {}), "('send_mpi')\n", (632, 644), False, 'from jax.core import Primitive\n'), ((2028, 2053), 'numpy.prod', '_np.prod', (['dims'], {'dtype': 'int'}), '(dims, dtype=int)\n', (2036, 2053), True, 'import numpy as _np\n'), ((2644, 2682), 'jax.lib.xla_cli...
import bdpy import numpy as np # Data settings voxel_data = np.array([np.arange(10), np.arange(10) + 10, np.arange(10) + 20, np.arange(10) + 30, np.arange(10) + 40, np.arange(10) + 50]) roi_v1 = [1, 1, 1...
[ "numpy.arange", "numpy.array", "bdpy.BData" ]
[((635, 647), 'bdpy.BData', 'bdpy.BData', ([], {}), '()\n', (645, 647), False, 'import bdpy\n'), ((430, 458), 'numpy.array', 'np.array', (['[1, 1, 1, 2, 2, 2]'], {}), '([1, 1, 1, 2, 2, 2])\n', (438, 458), True, 'import numpy as np\n'), ((477, 505), 'numpy.array', 'np.array', (['[2, 1, 3, 1, 3, 2]'], {}), '([2, 1, 3, 1,...
import random import unittest from typing import List import numpy as np import pandas as pd import pytest import torch import torch.nn as nn from snorkel.analysis import Scorer from snorkel.classification import ( DictDataLoader, DictDataset, MultitaskClassifier, Operation, Task, Trainer, ) f...
[ "numpy.random.seed", "snorkel.slicing.PandasSFApplier", "pandas.DataFrame", "unittest.main", "random.seed", "torch.nn.Linear", "snorkel.classification.MultitaskClassifier", "snorkel.classification.DictDataLoader", "torch.manual_seed", "snorkel.classification.Trainer", "snorkel.analysis.Scorer", ...
[((530, 548), 'snorkel.slicing.slicing_function', 'slicing_function', ([], {}), '()\n', (546, 548), False, 'from snorkel.slicing import PandasSFApplier, add_slice_labels, convert_to_slice_tasks, slicing_function\n'), ((725, 743), 'snorkel.slicing.slicing_function', 'slicing_function', ([], {}), '()\n', (741, 743), Fals...
"""Defines all the performance metrics that may be displayed on the website. Metrics are stored in the dict "all_metrics" with the following syntax: all_metrics = { "key-for-metric-1": { "description": str, a label to put on the x/y axes. "worst": float, typically float("inf") or floa...
[ "numpy.median", "numpy.max", "numpy.mean", "numpy.sum" ]
[((2155, 2168), 'numpy.max', 'np.max', (['norms'], {}), '(norms)\n', (2161, 2168), True, 'import numpy as np\n'), ((2206, 2220), 'numpy.mean', 'np.mean', (['norms'], {}), '(norms)\n', (2213, 2220), True, 'import numpy as np\n'), ((2260, 2276), 'numpy.median', 'np.median', (['norms'], {}), '(norms)\n', (2269, 2276), Tru...
# Copyright (c) 2017, <NAME> import typing import unittest import time import numpy as np import pymodm.fields as fields from arvet.config.path_manager import PathManager import arvet.database.tests.database_connection as dbconn import arvet.core.tests.mock_types as mock_types import arvet.metadata.image_metadata as i...
[ "arvet.database.tests.database_connection.tear_down_image_manager", "numpy.random.randint", "arvet.core.trial_result.TrialResult._mongometa.collection.drop", "arvet.core.image.Image._mongometa.collection.drop", "arvet.batch_analysis.task_manager.get_run_system_task", "arvet.core.system.VisionSystem.object...
[((2658, 2704), 'unittest.skip', 'unittest.skip', (['"""Not running performance tests"""'], {}), "('Not running performance tests')\n", (2671, 2704), False, 'import unittest\n'), ((2523, 2542), 'pymodm.fields.FloatField', 'fields.FloatField', ([], {}), '()\n', (2540, 2542), True, 'import pymodm.fields as fields\n'), ((...
""" Functions implementing the shell10x element. """ import numpy as nm from sfepy.linalg import norm_l2_along_axis as norm from sfepy.linalg import dot_sequences as ddot def create_elastic_tensor(young, poisson, shear_correction=True): """ Create the elastic tensor with the applied shear correction (the defa...
[ "numpy.eye", "numpy.empty", "sfepy.linalg.dot_sequences", "numpy.zeros", "numpy.cross", "numpy.einsum", "numpy.ones", "numpy.array", "numpy.linalg.inv", "numpy.arange", "numpy.linalg.norm", "numpy.linalg.det", "sfepy.mechanics.matcoefs.stiffness_from_youngpoisson", "numpy.concatenate", "...
[((494, 556), 'sfepy.mechanics.matcoefs.stiffness_from_youngpoisson', 'stiffness_from_youngpoisson', (['(3)', 'young', 'poisson'], {'plane': '"""stress"""'}), "(3, young, poisson, plane='stress')\n", (521, 556), False, 'from sfepy.mechanics.matcoefs import stiffness_from_youngpoisson\n'), ((1671, 1687), 'numpy.cross', ...
import abc from collections import defaultdict, OrderedDict import numpy as np from .utils import deserialize_class __all__ = ['BaseHighLevelWCS', 'HighLevelWCSMixin'] def rec_getattr(obj, att): for a in att.split('.'): obj = getattr(obj, a) return obj def default_order(components): order = [...
[ "collections.OrderedDict", "collections.defaultdict", "numpy.asarray" ]
[((4896, 4909), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (4907, 4909), False, 'from collections import defaultdict, OrderedDict\n'), ((9559, 9576), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (9570, 9576), False, 'from collections import defaultdict, OrderedDict\n'), ((9590,...
#!/usr/bin/env python """ Test module for surface tension """ from builtins import range from builtins import object from proteus.iproteus import * from proteus import Comm comm = Comm.get() Profiling.logLevel=1 Profiling.verbose=True import os import numpy as np import tables import pytest from proteus import default_...
[ "os.path.dirname", "proteus.Comm.get", "numpy.array", "tables.open_file", "os.path.join" ]
[((180, 190), 'proteus.Comm.get', 'Comm.get', ([], {}), '()\n', (188, 190), False, 'from proteus import Comm\n'), ((1692, 1717), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1707, 1717), False, 'import os\n'), ((1839, 1874), 'tables.open_file', 'tables.open_file', (["(name + '.h5')", '"""r...
''' Output : Image processing operation using matplotlib Reference : https://matplotlib.org/stable/tutorials/introductory/images.html ''' import numpy as np from PIL import Image import matplotlib.pyplot as plt from matplotlib import image # Read an image : It's a 24-bit RGB PNG image (8 bits for each of R, G, B) => (...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.image.imread", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "matplotlib.pyplot.colorbar", "PIL.Image.open", "matplotlib.pyplot.figure", "numpy.min", "numpy.max" ]
[((438, 487), 'matplotlib.image.imread', 'image.imread', (['"""../Images and Videos/stinkbug.png"""'], {}), "('../Images and Videos/stinkbug.png')\n", (450, 487), False, 'from matplotlib import image\n'), ((488, 503), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (498, 503), True, 'import matplotl...
import numpy as np import obspy.io.segy.core as segy __all__ = ['read_model'] def read_model(fname): """ Reads a model in segy format and returns it as an array.""" # data = segy.readSEGY(fname) data = segy._read_segy(fname) return np.array([tr.data for tr in data.traces])
[ "numpy.array", "obspy.io.segy.core._read_segy" ]
[((218, 240), 'obspy.io.segy.core._read_segy', 'segy._read_segy', (['fname'], {}), '(fname)\n', (233, 240), True, 'import obspy.io.segy.core as segy\n'), ((253, 294), 'numpy.array', 'np.array', (['[tr.data for tr in data.traces]'], {}), '([tr.data for tr in data.traces])\n', (261, 294), True, 'import numpy as np\n')]
import numpy import argparse parser = argparse.ArgumentParser(description="Convert the ASCII-based matrix files to a more efficient binary format") parser.add_argument("input", type=str, help="The ASCII matrix to convert") parser.add_argument("output", type=str, help="The name of the output file") args = parser.pars...
[ "numpy.dstack", "numpy.loadtxt", "argparse.ArgumentParser" ]
[((39, 153), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert the ASCII-based matrix files to a more efficient binary format"""'}), "(description=\n 'Convert the ASCII-based matrix files to a more efficient binary format')\n", (62, 153), False, 'import argparse\n'), ((455, 505),...
from stable_baselines3.common.callbacks import BaseCallback import os.path as osp import os from sb_code.Logger import Logger import numpy as np import math from stable_baselines3.common.vec_env import sync_envs_normalization from gym_duckietown.envs.duckietown_env import DuckietownEnv from stable_baselines3.common.env...
[ "numpy.std", "numpy.mean", "os.path.join", "os.makedirs" ]
[((1879, 1919), 'os.path.join', 'osp.join', (['logger.output_dir', 'name_prefix'], {}), '(logger.output_dir, name_prefix)\n', (1887, 1919), True, 'import os.path as osp\n'), ((2591, 2633), 'os.makedirs', 'os.makedirs', (['self.save_path'], {'exist_ok': '(True)'}), '(self.save_path, exist_ok=True)\n', (2602, 2633), Fals...
import tensorflow as tf # import tensorflow import numpy as np from PIL import Image from matplotlib import pyplot as plt from typing import List import os import json import sys # sys.path.append((os.path.dirname(os.path.dirname(__file__)))) import viz_utils from etiltWav import etiltWav import base64 class inferen...
[ "viz_utils.visualize_boxes_and_labels_on_image_array", "os.mkdir", "json.load", "matplotlib.pyplot.show", "os.path.join", "os.path.basename", "etiltWav.etiltWav", "matplotlib.pyplot.close", "numpy.asarray", "os.path.dirname", "os.path.isdir", "numpy.expand_dims", "PIL.Image.open", "etiltWa...
[((567, 598), 'tensorflow.saved_model.load', 'tf.saved_model.load', (['model_path'], {}), '(model_path)\n', (586, 598), True, 'import tensorflow as tf\n'), ((2031, 2074), 'etiltWav.etiltWav.check_wav_file_type', 'etiltWav.check_wav_file_type', (['wav_file_path'], {}), '(wav_file_path)\n', (2059, 2074), False, 'from eti...
# Copyright 2020 The DDSP 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 applicable law or agreed to in wri...
[ "tensorflow.compat.v2.test.main", "ddsp.spectral_ops_test.gen_np_sinusoid", "numpy.isfinite", "ddsp.training.eval_util.compute_audio_features", "absl.testing.parameterized.named_parameters" ]
[((1475, 1676), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('16k_2.1secs', 16000, 2.1)", "('24k_2.1secs', 24000, 2.1)", "('48k_2.1secs', 48000, 2.1)", "('16k_4secs', 16000, 4)", "('24k_4secs', 24000, 4)", "('48k_4secs', 48000, 4)"], {}), "(('16k_2.1secs', 16000, 2.1), ('24k_2.1s...
# Copyright 2016 Google Inc. 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 applicable law or ...
[ "numpy.random.seed", "numpy.zeros", "tensorflow.Session", "time.time", "time.sleep" ]
[((935, 953), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (949, 953), True, 'import numpy as np\n'), ((4120, 4156), 'numpy.zeros', 'np.zeros', (['(sample_count, output_dim)'], {}), '((sample_count, output_dim))\n', (4128, 4156), True, 'import numpy as np\n'), ((3825, 3837), 'tensorflow.Session', 't...
from re import A from zipfile import ZIP_BZIP2 from colloidoscope.deepcolloid import DeepColloid import napari import numpy as np import matplotlib.pyplot as plt def make_proj(test_array, test_label): array_projection = np.max(test_array, axis=0) label_projection = np.max(test_label, axis=0)*255 if label_projecti...
[ "numpy.zeros_like", "colloidoscope.deepcolloid.DeepColloid", "numpy.max", "matplotlib.pyplot.imsave", "numpy.concatenate" ]
[((835, 860), 'colloidoscope.deepcolloid.DeepColloid', 'DeepColloid', (['dataset_path'], {}), '(dataset_path)\n', (846, 860), False, 'from colloidoscope.deepcolloid import DeepColloid\n'), ((1263, 1304), 'matplotlib.pyplot.imsave', 'plt.imsave', (['"""output/test.png"""', 'sidebyside'], {}), "('output/test.png', sideby...
import numpy as np try: from layer import Layer except: from nndrone.layers.layer import Layer class Flatten(Layer): def __init__(self, input_shape = None): self.input_shape = input_shape def output_shape(self): return np.prod(self.input_shape) def forward_pass(self, inputs): ...
[ "numpy.asarray", "numpy.ndim", "numpy.reshape", "numpy.prod" ]
[((254, 279), 'numpy.prod', 'np.prod', (['self.input_shape'], {}), '(self.input_shape)\n', (261, 279), True, 'import numpy as np\n'), ((353, 392), 'numpy.reshape', 'np.reshape', (['inpts', '(inpts.shape[0], -1)'], {}), '(inpts, (inpts.shape[0], -1))\n', (363, 392), True, 'import numpy as np\n'), ((513, 554), 'numpy.res...
import copy import random import torch import torchvision.transforms as transforms from fcos_core.config import cfg import numpy as np from fcos_core.structures.segmentation_mask import SegmentationMask from fcos_core.augmentations.box_level_augs.gaussian_maps import _gaussian_map _MAX_LEVEL = 10.0 pixel_mean = cfg.IN...
[ "copy.deepcopy", "torch.stack", "torchvision.transforms.functional.to_tensor", "random.random", "torch.Tensor", "numpy.array", "fcos_core.augmentations.box_level_augs.gaussian_maps._gaussian_map" ]
[((646, 676), 'torch.Tensor', 'torch.Tensor', (['[y1, x1, y2, x2]'], {}), '([y1, x1, y2, x2])\n', (658, 676), False, 'import torch\n'), ((3369, 3385), 'copy.deepcopy', 'copy.deepcopy', (['x'], {}), '(x)\n', (3382, 3385), False, 'import copy\n'), ((1231, 1246), 'random.random', 'random.random', ([], {}), '()\n', (1244, ...
from __future__ import annotations from .basis import Basis, _gaps2x from . import grid from .util import roarray, input_as_list, compute_angles, qhull_interpolation_driver, _piece2bounds from .attrs import check_vectors_inv, convert_vectors_inv, convert_coordinates, check_coordinates, convert_values,\ check_value...
[ "attr.attrib", "numpy.argmax", "numpy.gcd", "numpy.empty", "numpy.argmin", "numpy.around", "numpy.arange", "numpy.linalg.norm", "numpy.unique", "scipy.spatial.Delaunay", "attr.attrs", "numpy.random.rand", "numpy.gcd.reduce", "numpy.linalg.det", "numpy.ones_like", "numpy.roll", "numpy...
[((618, 646), 'attr.attrs', 'attrs', ([], {'frozen': '(True)', 'eq': '(False)'}), '(frozen=True, eq=False)\n', (623, 646), False, 'from attr import attrs, attrib\n'), ((717, 821), 'attr.attrib', 'attrib', ([], {'type': 'Union[ndarray, list, tuple]', 'converter': 'convert_coordinates', 'validator': 'check_coordinates'})...
# -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ A robust ANTs T1-to-MNI registration workflow with fallback retry """ from __future__ import print_function, division, absolute_import, unicode_literals from os import path as o...
[ "nibabel.Nifti1Image", "os.path.abspath", "pkg_resources.resource_listdir", "nibabel.load", "numpy.logical_and", "pkg_resources.resource_filename", "packaging.version.Version", "os.path.join", "multiprocessing.cpu_count" ]
[((914, 934), 'packaging.version.Version', 'Version', (['__version__'], {}), '(__version__)\n', (921, 934), False, 'from packaging.version import Version\n'), ((10221, 10237), 'nibabel.load', 'nb.load', (['in_file'], {}), '(in_file)\n', (10228, 10237), True, 'import nibabel as nb\n'), ((10253, 10271), 'nibabel.load', '...
# 1. model from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.normalization import BatchNormalization from keras.utils import np_utils from keras.callbacks import ModelCheckpoint from sklearn.preprocessing import LabelEncoder from sklearn.model_selection impo...
[ "os.mkdir", "keras.layers.core.Dense", "numpy.random.seed", "pandas.read_csv", "sklearn.model_selection.train_test_split", "keras.callbacks.ModelCheckpoint", "keras.layers.core.Activation", "os.path.exists", "sklearn.preprocessing.LabelEncoder", "tensorflow.set_random_seed", "keras.utils.np_util...
[((583, 603), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (597, 603), True, 'import numpy as np\n'), ((604, 628), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (622, 628), True, 'import tensorflow as tf\n'), ((658, 701), 'pandas.read_csv', 'pd.read_csv', (['""".....
import os import cv2 import matplotlib.pyplot as plt import numpy as np import torch from torch.utils.tensorboard import SummaryWriter import find_nearest from datasets.mnist_dataset import MnistBags from helpers import makedir from model import construct_PPNet from save import load_model_from_train_state from settin...
[ "numpy.amin", "torch.argmax", "numpy.around", "matplotlib.pyplot.figure", "torch.device", "matplotlib.pyplot.imread", "os.path.join", "torch.no_grad", "matplotlib.pyplot.Normalize", "torch.utils.data.DataLoader", "datasets.mnist_dataset.MnistBags", "model.construct_PPNet", "find_nearest.find...
[((551, 574), 'os.path.join', 'os.path.join', (['model_dir'], {}), '(model_dir)\n', (563, 574), False, 'import os\n'), ((589, 781), 'find_nearest.find_k_nearest_patches_to_prototypes', 'find_nearest.find_k_nearest_patches_to_prototypes', ([], {'dataloader': 'push_dataloader', 'ppnet': 'ppnet', 'k': 'k', 'full_save': '(...
import yaml import seaborn as sns import matplotlib.pyplot as plt import numpy as np from typing import * from pathlib import Path from matplotlib.colors import ListedColormap, LinearSegmentedColormap import matplotlib.patches as mpatches from collections import OrderedDict from abbrs import prefix_abbr, setting_abbr...
[ "matplotlib.colors.LinearSegmentedColormap.from_list", "yaml.load", "seaborn.heatmap", "numpy.empty", "matplotlib.pyplot.close", "utils.stat_significance", "numpy.transpose", "pathlib.Path", "matplotlib.pyplot.figure", "collections.OrderedDict", "matplotlib.patches.Patch" ]
[((485, 498), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (496, 498), False, 'from collections import OrderedDict\n'), ((439, 471), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.Loader'}), '(f, Loader=yaml.Loader)\n', (448, 471), False, 'import yaml\n'), ((640, 672), 'yaml.load', 'yaml.load', (['f'...
import cProfile import time import numpy as np from canmotorlib import CanMotorController # Motor ID motor_id = 0x01 can_port = 'can0' motor_controller = CanMotorController(can_port, motor_id) def motor_send_n_commands(numTimes): for i in range(numTimes): pos, vel, curr = motor_controller.send_deg_comman...
[ "cProfile.Profile", "canmotorlib.CanMotorController", "numpy.linspace", "time.time" ]
[((155, 193), 'canmotorlib.CanMotorController', 'CanMotorController', (['can_port', 'motor_id'], {}), '(can_port, motor_id)\n', (173, 193), False, 'from canmotorlib import CanMotorController\n'), ((420, 446), 'numpy.linspace', 'np.linspace', (['(1000)', '(1000)', '(1)'], {}), '(1000, 1000, 1)\n', (431, 446), True, 'imp...
# -*- coding: utf-8 -*- """ Created on Thu Sep 27 23:39:12 2012 @author: j """ import numpy N = 20 E = numpy.zeros([N,N]) E[0][0] = (2.0/3.0) E[0][1] = (1.0/6.0) E[N-1][N-2] = (1.0/6.0) E[N-1][N-1] = (2.0/3.0) for p in range(1,N-1,1) : E[p][p-1] = (1.0/6.0) E[p][p] = (2.0/3.0) E[p][p+1] = (1.0/6.0...
[ "numpy.zeros", "numpy.linalg.lstsq" ]
[((106, 125), 'numpy.zeros', 'numpy.zeros', (['[N, N]'], {}), '([N, N])\n', (117, 125), False, 'import numpy\n'), ((327, 346), 'numpy.zeros', 'numpy.zeros', (['[1, N]'], {}), '([1, N])\n', (338, 346), False, 'import numpy\n'), ((533, 557), 'numpy.linalg.lstsq', 'numpy.linalg.lstsq', (['E', 'e'], {}), '(E, e)\n', (551, ...
import matplotlib.pyplot as plt import numpy as np import os from catalyst.exchange.utils.stats_utils import extract_transactions from logbook import Logger from kryptos import logger_group from kryptos.settings import PERF_DIR log = Logger("VIZ") logger_group.add_logger(log) def show_plot(): """Prevents crashi...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "logbook.Logger", "os.makedirs", "matplotlib.pyplot.legend", "os.path.exists", "kryptos.logger_group.add_logger", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "os.path.join", "catalyst.exchange.utils.stats_utils.extract_transa...
[((236, 249), 'logbook.Logger', 'Logger', (['"""VIZ"""'], {}), "('VIZ')\n", (242, 249), False, 'from logbook import Logger\n'), ((250, 278), 'kryptos.logger_group.add_logger', 'logger_group.add_logger', (['log'], {}), '(log)\n', (273, 278), False, 'from kryptos import logger_group\n'), ((589, 622), 'os.path.join', 'os....
import numpy as np from cython_sandbox import c_mat_mult, cython_mat_mult, cython_slow_mat_mult import time """ This is a simple demo of multiplication of two matrices using 1. Loops in python (Py loops) 2. Naively coded cython without variable types (Bad Cython) 3. Cython with proper variable types (Cyt...
[ "numpy.sum", "numpy.empty", "time.time", "numpy.random.randint", "numpy.dot" ]
[((1424, 1468), 'numpy.empty', 'np.empty', (['(n_rows, n_cols)'], {'dtype': 'np.float32'}), '((n_rows, n_cols), dtype=np.float32)\n', (1432, 1468), True, 'import numpy as np\n'), ((2521, 2533), 'numpy.dot', 'np.dot', (['A', 'B'], {}), '(A, B)\n', (2527, 2533), True, 'import numpy as np\n'), ((2869, 2880), 'time.time', ...
import numpy as np import matplotlib.pyplot as plt class KB_Game: def __init__(self, *args, **kwargs): self.rewards = np.array([0.0, 0.0, 0.0]) self.action_counts = np.array([0, 0, 0]) self.actions = [0, 1, 2] self.counts = 0 self.counts_history = [] self.current_cu...
[ "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.argmax", "numpy.log", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.random.random", "numpy.array", "numpy.random.randint", "numpy.random.normal", "numpy.exp", "numpy.where", "matplotlib.pyplot....
[((3118, 3135), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (3132, 3135), True, 'import numpy as np\n'), ((3188, 3201), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (3198, 3201), True, 'import matplotlib.pyplot as plt\n'), ((3282, 3395), 'matplotlib.pyplot.plot', 'plt.plot', (['k...
#!/usr/bin/env python """Calculate total number of fully bound staples for a simulation set""" import argparse import os.path import numpy as np from origamipy import biases from origamipy import conditions from origamipy import config_process from origamipy import datatypes from origamipy import files from origam...
[ "origamipy.datatypes.OrderParams.from_file", "numpy.sum", "argparse.ArgumentParser", "origamipy.conditions.ConditionsFileformatter", "origamipy.outputs.create_sim_collections", "origamipy.files.JSONStructInpFile", "numpy.array", "origamipy.files.TxtTrajInpFile", "origamipy.conditions.ConditionsFilef...
[((464, 509), 'origamipy.files.JSONStructInpFile', 'files.JSONStructInpFile', (['args.system_filename'], {}), '(args.system_filename)\n', (487, 509), False, 'from origamipy import files\n'), ((763, 834), 'origamipy.outputs.create_sim_collections', 'outputs.create_sim_collections', (['inp_filebase', 'all_conditions', 'a...
# -*- coding: utf-8 -*- """ ====================================================================== A demo of Robust Classification on real dataset "diabetes" from OpenML ====================================================================== In this example we compare the RobustWeightedCLassifier for classification on t...
[ "matplotlib.pyplot.show", "warnings.simplefilter", "sklearn.linear_model.SGDClassifier", "sklearn.preprocessing.RobustScaler", "numpy.random.RandomState", "sklearn_extra.robust.RobustWeightedClassifier", "sklearn.metrics.make_scorer", "numpy.mean", "numpy.array", "matplotlib.pyplot.ylabel", "skl...
[((835, 897), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (856, 897), False, 'import warnings\n'), ((906, 952), 'sklearn.datasets.fetch_openml', 'fetch_openml', ([], {'name': '"""diabetes"""', 'return_X_y...
import numpy as np import pytest import dnnv.nn.operations as operations from dnnv.nn.graph import OperationGraph from dnnv.properties.expressions import * def test_new(): N = Network("N") assert N.identifier == "N" assert str(N) == "N" N_ = Network("N") assert N_ is N N = Network("DNN") ...
[ "dnnv.nn.operations.Relu", "dnnv.nn.operations.Mul", "numpy.dtype", "dnnv.nn.graph.OperationGraph", "dnnv.nn.operations.Add" ]
[((923, 952), 'dnnv.nn.operations.Mul', 'operations.Mul', (['input_op', '(2.0)'], {}), '(input_op, 2.0)\n', (937, 952), True, 'import dnnv.nn.operations as operations\n'), ((966, 994), 'dnnv.nn.operations.Add', 'operations.Add', (['mul_op', '(-1.0)'], {}), '(mul_op, -1.0)\n', (980, 994), True, 'import dnnv.nn.operation...
""" Prepare vocabulary and initial word vectors. """ import json import pickle import argparse import numpy as np from collections import Counter from utils import vocab, constant, helper # python3 prepare_vocab.py dataset/tacred dataset/vocab --glove_dir dataset/glove def parse_args(): parser = argparse.Argumen...
[ "pickle.dump", "numpy.save", "argparse.ArgumentParser", "utils.helper.ensure_dir", "bert_serving.client.BertClient" ]
[((304, 381), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Prepare vocab for relation extraction."""'}), "(description='Prepare vocab for relation extraction.')\n", (327, 381), False, 'import argparse\n'), ((1040, 1073), 'utils.helper.ensure_dir', 'helper.ensure_dir', (['args.vocab_dir...
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from . import file_load as fl from .utils import get_unit_scale, get_scale_factor, get_factor_from_unit # --------------------------- # Functions for plotting data # --------------------------- def plot_ocv(datadir, filter_func=None, f...
[ "os.listdir", "os.path.join", "numpy.min", "numpy.max", "numpy.arange", "numpy.log10", "matplotlib.pyplot.subplots", "pandas.concat" ]
[((1357, 1371), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1369, 1371), True, 'import matplotlib.pyplot as plt\n'), ((1455, 1488), 'pandas.concat', 'pd.concat', (['dfs'], {'ignore_index': '(True)'}), '(dfs, ignore_index=True)\n', (1464, 1488), True, 'import pandas as pd\n'), ((2245, 2259), 'matplo...
import numpy as np from numba import cuda, int32 maxThread = 512 @cuda.jit('void(int32[:])') def idx_kernel(arr): s = cuda.shared.array(shape=maxThread, dtype=int32) idx = cuda.grid(1) if idx < arr.shape[0]: s[cuda.threadIdx.x] = 1 cuda.syncthreads() if idx < arr.shape[0]: cuda....
[ "numba.cuda.atomic.add", "numba.cuda.shared.array", "numpy.zeros", "numba.cuda.to_device", "numba.cuda.syncthreads", "numpy.arange", "numba.cuda.jit", "numba.cuda.grid" ]
[((68, 94), 'numba.cuda.jit', 'cuda.jit', (['"""void(int32[:])"""'], {}), "('void(int32[:])')\n", (76, 94), False, 'from numba import cuda, int32\n'), ((124, 171), 'numba.cuda.shared.array', 'cuda.shared.array', ([], {'shape': 'maxThread', 'dtype': 'int32'}), '(shape=maxThread, dtype=int32)\n', (141, 171), False, 'from...
import copy import numpy as np import math import open3d as o3d #from lib.eval import find_nn_cpu def make_open3d_point_cloud(xyz, color=None): pcd = o3d.geometry.PointCloud() pcd.points = o3d.utility.Vector3dVector(xyz) if color is not None: pcd.colors = o3d.utility.Vector3dVector(color) return pcd de...
[ "numpy.random.uniform", "copy.deepcopy", "numpy.power", "numpy.asarray", "open3d.io.read_point_cloud", "open3d.geometry.PointCloud", "open3d.geometry.KDTreeFlann", "numpy.zeros", "math.sin", "numpy.mean", "numpy.linalg.inv", "math.cos", "open3d.registration.Feature", "numpy.dot", "open3d...
[((155, 180), 'open3d.geometry.PointCloud', 'o3d.geometry.PointCloud', ([], {}), '()\n', (178, 180), True, 'import open3d as o3d\n'), ((196, 227), 'open3d.utility.Vector3dVector', 'o3d.utility.Vector3dVector', (['xyz'], {}), '(xyz)\n', (222, 227), True, 'import open3d as o3d\n'), ((372, 398), 'open3d.registration.Featu...
""" 2.5D DC inversion of with Topography ==================================== This is an example for 2.5D DC inversion. Earth includes a topography, and below the topography conductive and resistive cylinders are embedded. Sensitivity weighting is used for the inversion. Approximate depth of investigation is computed ...
[ "numpy.random.seed", "SimPEG.electromagnetics.static.resistivity.IO", "numpy.ones", "SimPEG.inversion.BaseInversion", "SimPEG.directives.UpdatePreconditioner", "matplotlib.pyplot.figure", "SimPEG.electromagnetics.static.resistivity.Simulation2DNodal", "matplotlib.colors.LogNorm", "SimPEG.directives....
[((1100, 1117), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1114, 1117), True, 'import numpy as np\n'), ((1159, 1166), 'SimPEG.electromagnetics.static.resistivity.IO', 'DC.IO', ([], {}), '()\n', (1164, 1166), True, 'from SimPEG.electromagnetics.static import resistivity as DC\n'), ((1283, 1333), 'nu...
import os import math import json import shutil import random import numpy as np from typing import List ### Utility functions ### def idx(str) -> int: return int(str.lstrip("0")) def calc_bbox(center,side_length): length_split = int(math.ceil(side_length/2)) upleft = (center[0] - length_spl...
[ "os.mkdir", "os.remove", "json.dump", "math.ceil", "os.path.isdir", "os.path.isfile", "shutil.copyfile", "os.path.join", "os.listdir", "numpy.sqrt" ]
[((1695, 1739), 'os.path.join', 'os.path.join', (['visdrone_export_path', '"""images"""'], {}), "(visdrone_export_path, 'images')\n", (1707, 1739), False, 'import os\n'), ((1761, 1804), 'os.path.join', 'os.path.join', (['visdrone_export_path', '"""jsons"""'], {}), "(visdrone_export_path, 'jsons')\n", (1773, 1804), Fals...
#!/usr/bin/env python3 import unittest from numpy.testing import assert_array_almost_equal import autograd.numpy as np from autograd.test_util import check_grads from copy import deepcopy import itertools import paragami def get_test_pattern(): # autograd will pass invalid values, so turn off value checking. ...
[ "paragami.PatternDict", "autograd.numpy.isin", "paragami.PSDSymmetricMatrixPattern", "numpy.testing.assert_array_almost_equal", "unittest.main", "paragami.SimplexArrayPattern", "paragami.TransformFunctionInput", "paragami.TransformFunctionOutput", "paragami.NumericArrayPattern", "autograd.test_uti...
[((332, 354), 'paragami.PatternDict', 'paragami.PatternDict', ([], {}), '()\n', (352, 354), False, 'import paragami\n'), ((378, 455), 'paragami.NumericArrayPattern', 'paragami.NumericArrayPattern', (['(2, 3, 4)'], {'lb': '(-1)', 'ub': '(20)', 'default_validate': '(False)'}), '((2, 3, 4), lb=-1, ub=20, default_validate=...
def check_congruence(oe): assert (oe.FHIT_C == 1) assert (oe.FSHAPE == 1) assert (oe.F_REFLEC == 0) assert (oe.FMIRR == 5) assert (oe.F_GRATING == 0) assert (oe.F_CRYSTAL == 0) if __name__ == "__main__": import numpy from srxraylib.plot.gol import set_qt set_qt() from shadow...
[ "numpy.radians", "shadow4.syned.shape.Rectangle", "shadow4.beam.beam.Beam.initialize_from_array", "shadow4tests.compatibility.compare_beams.check_almost_equal", "shadow4.tools.graphics.plotxy", "shadow4tests.oasys_workspaces.mirrors_branch1_twomirrors.run_beamline", "shadow4tests.oasys_workspaces.mirror...
[((295, 303), 'srxraylib.plot.gol.set_qt', 'set_qt', ([], {}), '()\n', (301, 303), False, 'from srxraylib.plot.gol import set_qt\n'), ((688, 703), 'shadow4tests.oasys_workspaces.mirrors_branch1_twomirrors.define_source', 'define_source', ([], {}), '()\n', (701, 703), False, 'from shadow4tests.oasys_workspaces.mirrors_b...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy from copy import deepcopy import itertools import logging import json import math import os import random import shutil import GPy import numpy as np import pandas as pd from scipy.optimize import m...
[ "numpy.argmax", "numpy.clip", "json.dumps", "numpy.mean", "ray.tune.error.TuneError", "os.path.join", "pandas.DataFrame", "ray.tune.schedulers.FIFOScheduler.__init__", "dppy.finite_dpps.FiniteDPP", "numpy.std", "os.path.exists", "sklearn.metrics.pairwise.euclidean_distances", "numpy.max", ...
[((809, 836), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (826, 836), False, 'import logging\n'), ((1537, 1557), 'numpy.clip', 'np.clip', (['data', '(-2)', '(2)'], {}), '(data, -2, 2)\n', (1544, 1557), True, 'import numpy as np\n'), ((1700, 1715), 'numpy.sqrt', 'np.sqrt', (['beta_t'], ...
from typing import Tuple, Dict import numba as nb import numpy as np from scipy.sparse import coo_matrix from scipy.sparse.csgraph import minimum_spanning_tree from lin_kernighan.algorithms.structures.heap import Heap from lin_kernighan.algorithms.utils.utils import make_pair def one_tree(adjacency_matrix: np.ndarr...
[ "lin_kernighan.algorithms.structures.heap.Heap", "numba.njit", "numpy.zeros", "scipy.sparse.csgraph.minimum_spanning_tree", "numpy.append", "lin_kernighan.algorithms.utils.utils.make_pair" ]
[((867, 886), 'numba.njit', 'nb.njit', ([], {'cache': '(True)'}), '(cache=True)\n', (874, 886), True, 'import numba as nb\n'), ((1682, 1708), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'bool'}), '(size, dtype=bool)\n', (1690, 1708), True, 'import numpy as np\n'), ((807, 829), 'numpy.append', 'np.append', (['src', ...
import os from abc import ABCMeta, abstractmethod from future.utils import with_metaclass import numpy as np from neurokernel.LPU.utils.simpleio import * class Image2D(with_metaclass(ABCMeta, object)): # __metaclass__ = ABCMeta def __init__(self, config, dt, retina_index = 0): self.dt = dt s...
[ "matplotlib.pyplot.figaspect", "numpy.random.seed", "scipy.io.loadmat", "future.utils.with_metaclass", "numpy.empty", "neurokernel.tools.timing.Timer", "numpy.ones", "numpy.sin", "os.path.join", "numpy.round", "numpy.set_printoptions", "numpy.random.randn", "numpy.linspace", "numpy.log10",...
[((171, 202), 'future.utils.with_metaclass', 'with_metaclass', (['ABCMeta', 'object'], {}), '(ABCMeta, object)\n', (185, 202), False, 'from future.utils import with_metaclass\n'), ((10994, 11009), 'matplotlib.pyplot.hold', 'plt.hold', (['(False)'], {}), '(False)\n', (11002, 11009), True, 'import matplotlib.pyplot as pl...
from numpy.testing import * import numpy from algopy.utpm import * from algopy.utpm.algorithms import * # explicitly import some of the helpers that have underscores from algopy.utpm.algorithms import _plus_const from algopy.utpm.algorithms import _taylor_polynomials_of_ode_solutions class Test_Helper_Functions(Tes...
[ "numpy.zeros_like", "numpy.log", "algopy.utpm.algorithms._taylor_polynomials_of_ode_solutions", "numpy.random.randn", "numpy.power", "numpy.empty_like", "numpy.zeros", "numpy.expm1", "numpy.exp", "numpy.random.rand", "numpy.dot", "numpy.log1p" ]
[((565, 587), 'numpy.zeros', 'numpy.zeros', (['(P, N, N)'], {}), '((P, N, N))\n', (576, 587), False, 'import numpy\n'), ((699, 724), 'numpy.zeros', 'numpy.zeros', (['(D, P, N, N)'], {}), '((D, P, N, N))\n', (710, 724), False, 'import numpy\n'), ((996, 1025), 'numpy.random.rand', 'numpy.random.rand', (['D', 'P', 'N', 'M...
# -*- coding: utf-8 -*- """ Created on Thu Jan 26 16:39:18 2017 @author: jarbona """ import numpy as np from cpolymer.polymer import Polymer from cpolymer.lsimu import LSimu from cpolymer.constrain import Sphere, Point from cpolymer.halley.constrain import Spherical from cpolymer.halley.vectors import V len_chrom ...
[ "cpolymer.lsimu.LSimu", "cpolymer.halley.vectors.V", "cpolymer.constrain.Point", "cpolymer.constrain.Sphere", "numpy.sqrt" ]
[((1110, 1117), 'cpolymer.lsimu.LSimu', 'LSimu', ([], {}), '()\n', (1115, 1117), False, 'from cpolymer.lsimu import LSimu\n'), ((1167, 1208), 'cpolymer.constrain.Sphere', 'Sphere', ([], {'position': '[0, 0, 0]', 'radius': 'Radius'}), '(position=[0, 0, 0], radius=Radius)\n', (1173, 1208), False, 'from cpolymer.constrain...
""" tests for recurrence class """ import numpy as np import theano import agentnet from agentnet.memory import RNNCell,GRUCell, LSTMCell import lasagne from lasagne.layers import * def test_recurrence(): """minimalstic test""" sequence = InputLayer((None, None, 3), name='input sequence') initial = InputL...
[ "numpy.random.seed", "agentnet.memory.GRUCell", "agentnet.memory.RNNCell", "numpy.random.randn", "lasagne.init.Constant", "numpy.zeros", "numpy.diff", "agentnet.Recurrence", "agentnet.memory.LSTMCell", "collections.OrderedDict" ]
[((451, 485), 'agentnet.memory.GRUCell', 'GRUCell', (['prev_gru', 'inp'], {'name': '"""rnn"""'}), "(prev_gru, inp, name='rnn')\n", (458, 485), False, 'from agentnet.memory import RNNCell, GRUCell, LSTMCell\n'), ((498, 633), 'agentnet.Recurrence', 'agentnet.Recurrence', ([], {'input_sequences': '{inp: sequence}', 'state...
""" This is an adaptation of the work by <NAME> https://github.com/wjbladek/SilentSpeechClassifier, used for automated data handling for the KARA ONE open source EEG data on imagined speech. The original intent was to have this handle all data preprocessing, however this was separated out to speed up implementati...
[ "os.path.abspath", "mne.preprocessing.ICA", "mne.io.read_raw_fif", "os.makedirs", "scipy.signal.filtfilt", "scipy.io.loadmat", "mne.preprocessing.read_ica", "pyts.image.GramianAngularField", "pathlib.Path", "glob.glob", "mne.io.read_raw_cnt", "os.path.join", "os.chdir", "numpy.all", "sci...
[((2375, 2415), 'os.makedirs', 'os.makedirs', (['figures_path'], {'exist_ok': '(True)'}), '(figures_path, exist_ok=True)\n', (2386, 2415), False, 'import os\n'), ((2331, 2356), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (2346, 2356), False, 'import os\n'), ((7581, 7604), 'os.chdir', 'os.c...
import numpy as np import gensim import json class Embedding: def __init__(self, vocab_size, embedding_dim, word2id, id2word, embedding, max_document_length, position_size, mention_size): self.vocab_size = vocab_size self.embedding_dim = embedding_dim self.word2id = word2id self.id2word = id2word self.em...
[ "numpy.random.uniform", "numpy.load", "numpy.save", "numpy.random.seed", "json.load", "json.dump", "numpy.zeros", "numpy.clip", "gensim.models.KeyedVectors.load_word2vec_format" ]
[((582, 616), 'numpy.load', 'np.load', (["(inpath + '_embedding.npy')"], {}), "(inpath + '_embedding.npy')\n", (589, 616), True, 'import numpy as np\n'), ((1322, 1363), 'numpy.zeros', 'np.zeros', (['(vocab_size + 2, embedding_dim)'], {}), '((vocab_size + 2, embedding_dim))\n', (1330, 1363), True, 'import numpy as np\n'...
import os import numpy as np import pytest from pyvista.plotting import system_supports_plotting from pyvista.plotting.renderer import CameraPosition from ansys.mapdl import reader as pymapdl_reader from ansys.mapdl.reader import examples from ansys.mapdl.reader.cyclic_reader import CyclicResult HAS_FFMPEG = True t...
[ "numpy.abs", "numpy.allclose", "numpy.ones", "os.path.isfile", "pytest.mark.skipif", "pytest.mark.parametrize", "ansys.mapdl.reader.cyclic_reader.CyclicResult", "os.path.join", "numpy.unique", "os.path.abspath", "ansys.mapdl.reader.rst.Result", "pytest.raises", "pytest.fixture", "numpy.hst...
[((450, 481), 'os.path.join', 'os.path.join', (['path', '"""testfiles"""'], {}), "(path, 'testfiles')\n", (462, 481), False, 'import os\n'), ((506, 541), 'os.path.join', 'os.path.join', (['path', '"""cyclic_reader"""'], {}), "(path, 'cyclic_reader')\n", (518, 541), False, 'import os\n'), ((555, 592), 'os.path.join', 'o...
import argparse import logging import os import pathlib import sys from typing import Tuple import numpy as np import pandas as pd import rdkit from rdkit import Chem from sqlalchemy import create_engine logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) run_id = 'stable_radical_optimizatio...
[ "sys.path.append", "rdkit.Chem.MolToSmiles", "tensorflow.keras.models.load_model", "rlmolecule.tree_search.reward.RankedRewardFactory", "logging.basicConfig", "argparse.ArgumentParser", "preprocess_inputs.preprocessor.construct_feature_matrices", "os.path.join", "rdkit.Chem.CanonicalRankAtoms", "n...
[((206, 245), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (225, 245), False, 'import logging\n'), ((255, 282), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (272, 282), False, 'import logging\n'), ((1293, 1361), 'sys.path.appen...
""" Copyright 2020 The OneFlow 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 applicable law or agr...
[ "unittest.main", "oneflow.as_tensor", "numpy.ones", "oneflow.randn", "oneflow.unittest.skip_unless_1n1d", "oneflow.device", "os.getenv" ]
[((959, 991), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (989, 991), True, 'import oneflow as flow\n'), ((1009, 1043), 'os.getenv', 'os.getenv', (['"""ONEFLOW_TEST_CPU_ONLY"""'], {}), "('ONEFLOW_TEST_CPU_ONLY')\n", (1018, 1043), False, 'import os\n'), ((5210, 5225), 'unitte...
""" To test the quality of the estimators, we generate data both from a semilinear Choo and Siow model and from a semilinear nested logit model. We use both the Poisson estimator and the minimum-distance estimator on the former model, and only the minimum-distance estimator of course on the latter. """ import nump...
[ "pandas.DataFrame", "numpy.full", "utils.nprepeat_row", "numpy.concatenate", "model_classes.ChooSiowPrimitives", "pandas.read_csv", "numpy.logspace", "numpy.zeros", "utils.nprepeat_col", "nested_logit.setup_standard_nested_logit", "model_classes.NestedLogitPrimitives", "numpy.arange", "numpy...
[((1662, 1691), 'model_classes.ChooSiowPrimitives', 'ChooSiowPrimitives', (['Phi', 'n', 'm'], {}), '(Phi, n, m)\n', (1680, 1691), False, 'from model_classes import ChooSiowPrimitives, NestedLogitPrimitives\n'), ((3442, 3527), 'model_classes.NestedLogitPrimitives', 'NestedLogitPrimitives', (['Phi', 'n', 'm', 'nests_for_...
# -*- coding: utf-8 -*- # Torch import torch.nn as nn import torch.nn.functional as F import torch import torch.optim as optim from torch.nn import init # utils import math import os import datetime import numpy as np from sklearn.externals import joblib from tqdm import tqdm from utils import grouper, sliding_window, ...
[ "torch.nn.Dropout", "sklearn.externals.joblib.dump", "torch.nn.init.uniform_", "torch.nn.MaxPool1d", "torch.cat", "torch.nn.init.constant_", "utils.sliding_window", "torch.device", "torch.nn.MaxPool3d", "torch.no_grad", "torch.ones", "torch.nn.BatchNorm3d", "torch.nn.init.kaiming_normal_", ...
[((936, 957), 'torch.ones', 'torch.ones', (['n_classes'], {}), '(n_classes)\n', (946, 957), False, 'import torch\n'), ((40650, 40669), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (40662, 40669), False, 'import torch\n'), ((47123, 47161), 'numpy.zeros', 'np.zeros', (['(img.shape[:2] + (n_classes,))...
__all__ = ['TrendClassifier', 'TrendNormalizer', 'BaselineNormalizer', 'SpikeNormalizer', 'SmoothingNormalizer', 'LogNormalizer'] from collections import OrderedDict import numpy as np from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.base im...
[ "numpy.array_equal", "numpy.log", "sklearn.utils.array2d", "numpy.array", "sklearn.utils.check_arrays", "sklearn.utils.column_or_1d", "collections.OrderedDict", "numpy.unique" ]
[((814, 855), 'sklearn.utils.check_arrays', 'check_arrays', (['X', 'y'], {'sparse_format': '"""dense"""'}), "(X, y, sparse_format='dense')\n", (826, 855), False, 'from sklearn.utils import array2d, column_or_1d, check_arrays\n'), ((1108, 1120), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (1117, 1120), True, 'imp...
#神经网络出口,神经元可以建立与出口的连接。出口有自己的运行逻辑以区别与普通的神经元节点。 from neuron import States import packet from configure import config import copy import neuron from logger import logger import numpy as np class sinkNode(neuron.neuronNode): def __init__(self, id) -> None: self.id = 0 # 默认SN就是ID为0的节点 self.nodeID =...
[ "copy.deepcopy", "logger.logger.logger.info", "numpy.array" ]
[((1309, 1324), 'numpy.array', 'np.array', (['value'], {}), '(value)\n', (1317, 1324), True, 'import numpy as np\n'), ((1030, 1051), 'copy.deepcopy', 'copy.deepcopy', (['packet'], {}), '(packet)\n', (1043, 1051), False, 'import copy\n'), ((2151, 2211), 'logger.logger.logger.info', 'logger.logger.info', (['"""----------...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "tvm.relay.op.multiply", "tvm.relay.frontend.common.infer_channels", "numpy.clip", "tvm.relay.op.sign", "numpy.prod", "tvm.relay.op.nn.bias_add", "tvm.relay.op.nn.batch_norm", "tvm.relay.op.floor", "tvm.relay.op.nn.dense", "tvm.relay.op.nn.conv2d", "numpy.finfo", "tvm.relay.op.copy", "tvm.re...
[((900, 943), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL'}), '(level=logging.CRITICAL)\n', (919, 943), False, 'import logging\n'), ((6716, 6742), 'tvm.relay.op.cast', '_op.cast', (['input', '"""float32"""'], {}), "(input, 'float32')\n", (6724, 6742), True, 'from tvm.relay import op a...
import pickle from glob import glob import os import networkx as nx from model.min_cut import MinCut import numpy as np dirs = glob('../data_temp/test_I/*.p') dirs.sort(key=os.path.abspath) graph = pickle.load(open('../data_temp/test_I/graph_cycle_nn9_0000001.p', 'rb')) J = graph['J'].todense() G = nx.from_numpy_arr...
[ "model.min_cut.MinCut", "networkx.from_numpy_array", "numpy.concatenate", "glob.glob" ]
[((128, 159), 'glob.glob', 'glob', (['"""../data_temp/test_I/*.p"""'], {}), "('../data_temp/test_I/*.p')\n", (132, 159), False, 'from glob import glob\n'), ((303, 325), 'networkx.from_numpy_array', 'nx.from_numpy_array', (['J'], {}), '(J)\n', (322, 325), True, 'import networkx as nx\n'), ((408, 447), 'numpy.concatenate...
import numpy as np from numpy import where from sklearn.datasets import make_classification from matplotlib import pyplot from sklearn import datasets from sklearn.cluster import KMeans, MeanShift, DBSCAN, Birch from sklearn import metrics from sklearn.cluster import AffinityPropagation from matplotlib import pyplot fr...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "sklearn.datasets.make_blobs", "numpy.where", "numpy.mean", "numpy.unique" ]
[((886, 951), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n_samples', 'centers': 'centers', 'random_state': '(15)'}), '(n_samples=n_samples, centers=centers, random_state=15)\n', (896, 951), False, 'from sklearn.datasets import make_blobs\n'), ((1569, 1582), 'matplotlib.pyplot.show', 'pyplot.show',...
from __future__ import division import numpy as np from keras.callbacks import EarlyStopping, TensorBoard, ModelCheckpoint from keras.layers import Input, Dropout, Dense, concatenate from keras.models import Model from keras.optimizers import Adam from keras.regularizers import l2 from keras_gat import GraphAttention...
[ "keras.regularizers.l2", "keras.callbacks.ModelCheckpoint", "keras.layers.Dropout", "keras_gat.utils.load_protein_function", "keras.optimizers.Adam", "keras.models.Model", "keras_gat.utils.preprocess_features", "keras.callbacks.EarlyStopping", "keras.callbacks.TensorBoard", "keras.layers.Input", ...
[((558, 588), 'keras_gat.utils.load_protein_function', 'load_protein_function', (['"""yeast"""'], {}), "('yeast')\n", (579, 588), False, 'from keras_gat.utils import load_data, preprocess_features, load_protein_function\n'), ((1267, 1289), 'keras_gat.utils.preprocess_features', 'preprocess_features', (['X'], {}), '(X)\...
import numpy as np import scipy.sparse as sp import torch import pickle as pkl import networkx as nx import sys from sklearn.model_selection import train_test_split from scipy.sparse.csgraph import connected_components def encode_onehot(labels): classes = set(labels) classes_dict = {c: np.identity(len(classes)...
[ "numpy.load", "numpy.random.seed", "numpy.abs", "sklearn.model_selection.train_test_split", "numpy.ones", "numpy.argsort", "pickle.load", "numpy.arange", "scipy.sparse.csgraph.connected_components", "scipy.sparse.eye", "numpy.full", "numpy.power", "numpy.bincount", "scipy.sparse.diags", ...
[((2696, 2725), 'numpy.arange', 'np.arange', (['arrays[0].shape[0]'], {}), '(arrays[0].shape[0])\n', (2705, 2725), True, 'import numpy as np\n'), ((2760, 2886), 'sklearn.model_selection.train_test_split', 'train_test_split', (['idx'], {'random_state': 'random_state', 'train_size': '(train_size + val_size)', 'test_size'...
#!/usr/bin/env python # coding: utf-8 # @author: <NAME> # @rollno: 17CS30033 import numpy as np import pandas as pd import matplotlib.pyplot as plt class NeuralNetwork: def __init__(self, num_hidden, num_neurons_per_layer, activation_func_hidden, ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "pandas.read_csv", "numpy.array_equal", "matplotlib.pyplot.legend", "numpy.argmax", "numpy.zeros", "numpy.arange", "numpy.exp", "numpy.random.rand", "matplotlib.pyplot.ylabe...
[((1601, 1661), 'matplotlib.pyplot.plot', 'plt.plot', (['iterations', 'self.train_accuracy[1:]'], {'label': '"""Train"""'}), "(iterations, self.train_accuracy[1:], label='Train')\n", (1609, 1661), True, 'import matplotlib.pyplot as plt\n'), ((1670, 1728), 'matplotlib.pyplot.plot', 'plt.plot', (['iterations', 'self.test...
import numpy as _np import RationalAlgebra as _ra from math import factorial as _factorial from math import gcd as _gcd def parseStringInputs(stencilString, dimensionString): try: stencilInts = _makeStencilInts(stencilString) stencilSuccess = True except: latexString = ("$$\\text{Please...
[ "RationalAlgebra.RationalVector", "numpy.zeros", "RationalAlgebra.inv", "math.gcd", "numpy.array", "math.factorial", "RationalAlgebra.RationalMatrix" ]
[((1454, 1469), 'numpy.array', '_np.array', (['nums'], {}), '(nums)\n', (1463, 1469), True, 'import numpy as _np\n'), ((4426, 4447), 'RationalAlgebra.RationalVector', '_ra.RationalVector', (['A'], {}), '(A)\n', (4444, 4447), True, 'import RationalAlgebra as _ra\n'), ((4459, 4480), 'RationalAlgebra.RationalMatrix', '_ra...
import os, sys import numpy as np import argparse import time from scipy import stats import cvxpy as cp from create_datasets import data_loader_cal_housing, data_loader_abalone, data_loader_drug def compute_gradients_l1(theta, X, y, gamma): # L1 loss with a L2 regularizer (as in the paper) grad = (np.dot(X.T,...
[ "argparse.ArgumentParser", "cvxpy.exp", "create_datasets.data_loader_cal_housing", "create_datasets.data_loader_abalone", "numpy.array", "numpy.exp", "cvxpy.Problem", "numpy.sign", "numpy.linalg.norm", "numpy.dot", "create_datasets.data_loader_drug", "cvxpy.norm", "cvxpy.huber", "cvxpy.sum...
[((463, 479), 'numpy.dot', 'np.dot', (['X', 'theta'], {}), '(X, theta)\n', (469, 479), True, 'import numpy as np\n'), ((536, 572), 'numpy.dot', 'np.dot', (['X[ind].T', '(pred[ind] - y[ind])'], {}), '(X[ind].T, pred[ind] - y[ind])\n', (542, 572), True, 'import numpy as np\n'), ((1084, 1109), 'argparse.ArgumentParser', '...
import unittest import numpy as np from pysound.buffer import BufferParams from pysound.mixers import modulator, adder, sequencer class TestBuffer(unittest.TestCase): def test_modulator_0_sources(self): params = BufferParams(length=10) result = modulator() expected = np.array([], np.float...
[ "pysound.mixers.modulator", "pysound.mixers.sequencer", "pysound.buffer.BufferParams", "numpy.array", "numpy.array_equal", "pysound.mixers.adder" ]
[((227, 250), 'pysound.buffer.BufferParams', 'BufferParams', ([], {'length': '(10)'}), '(length=10)\n', (239, 250), False, 'from pysound.buffer import BufferParams\n'), ((268, 279), 'pysound.mixers.modulator', 'modulator', ([], {}), '()\n', (277, 279), False, 'from pysound.mixers import modulator, adder, sequencer\n'),...
#!/usr/bin/env python # Import modules import numpy as np import sklearn from sklearn.preprocessing import LabelEncoder import pickle from sensor_stick.srv import GetNormals from sensor_stick.features import compute_color_histograms from sensor_stick.features import compute_normal_histograms from visualization_msgs.ms...
[ "rospy.Subscriber", "sensor_stick.features.compute_color_histograms", "yaml.dump", "rospy.ServiceProxy", "numpy.mean", "numpy.asscalar", "sensor_stick.features.compute_normal_histograms", "sklearn.preprocessing.LabelEncoder", "rospy_message_converter.message_converter.convert_ros_message_to_dictiona...
[((856, 920), 'rospy.ServiceProxy', 'rospy.ServiceProxy', (['"""/feature_extractor/get_normals"""', 'GetNormals'], {}), "('/feature_extractor/get_normals', GetNormals)\n", (874, 920), False, 'import rospy\n'), ((1313, 1375), 'rospy_message_converter.message_converter.convert_ros_message_to_dictionary', 'message_convert...
# -*- coding: utf-8 -*- import operator import numpy as np import pandas as pd import pytest from pandas.testing import assert_frame_equal from pandas_select import Anywhere, Everywhere @pytest.fixture def where_df(): """ A B pos 1 1 neg -1 -1 mixed -1 1 """ return pd.Dat...
[ "pandas.DataFrame", "pandas.testing.assert_frame_equal", "numpy.asarray", "pandas_select.Anywhere", "pytest.raises", "pandas_select.Everywhere", "pytest.mark.parametrize" ]
[((1281, 1414), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""op, expected"""', "[(operator.and_, ['neg']), (operator.or_, ['neg', 'mixed']), (operator.xor,\n ['mixed'])]"], {}), "('op, expected', [(operator.and_, ['neg']), (\n operator.or_, ['neg', 'mixed']), (operator.xor, ['mixed'])])\n", (1304, ...
# System import keras import numpy as np # import data.data_utils_v2 as ut def load_data(mag, train_spec_len=250, test_spec_len=250, mode="train"): freq, time = mag.shape if mode == "train": if time - train_spec_len > 0: randtime = np.random.randint(0, time - train_spec_len) s...
[ "numpy.std", "numpy.mean", "numpy.random.randint", "numpy.random.shuffle" ]
[((497, 532), 'numpy.mean', 'np.mean', (['spec_mag', '(0)'], {'keepdims': '(True)'}), '(spec_mag, 0, keepdims=True)\n', (504, 532), True, 'import numpy as np\n'), ((543, 577), 'numpy.std', 'np.std', (['spec_mag', '(0)'], {'keepdims': '(True)'}), '(spec_mag, 0, keepdims=True)\n', (549, 577), True, 'import numpy as np\n'...
#Include dependencies import numpy as np from numpy import exp, pi from numpy.linalg import norm from . import signal as sig from . signal import RECT def simulate_phs(platform, points = [[0,0,0]], amplitudes = [1]): ############################################################################## # ...
[ "numpy.zeros", "numpy.array", "numpy.tile", "numpy.linalg.norm", "numpy.exp", "numpy.linspace" ]
[((2512, 2546), 'numpy.exp', 'exp', (['(-1.0j * pi * f_t ** 2 / gamma)'], {}), '(-1.0j * pi * f_t ** 2 / gamma)\n', (2515, 2546), False, 'from numpy import exp, pi\n'), ((2550, 2576), 'numpy.tile', 'np.tile', (['S_c', '[npulses, 1]'], {}), '(S_c, [npulses, 1])\n', (2557, 2576), True, 'import numpy as np\n'), ((3716, 37...
import numpy as np class Optimizer(): def __init__(self, dataset): self.dataset = dataset def step(self, model, learning_rate): m = len(self.dataset.y) errors = model.predict(self.dataset.x) - self.dataset.y bias = errors.sum() / m weights = np.dot(self.dataset.x.T...
[ "numpy.dot" ]
[((297, 329), 'numpy.dot', 'np.dot', (['self.dataset.x.T', 'errors'], {}), '(self.dataset.x.T, errors)\n', (303, 329), True, 'import numpy as np\n')]
''' Import packages ''' import glob import json import tqdm import time import argparse import numpy as np import tensorflow as tf from collections import defaultdict import lucid.optvis.render as render import lucid.modelzoo.vision_models as models from keras.applications.inception_v3 import preprocess_input import os...
[ "argparse.ArgumentParser", "tensorflow.train.Int64List", "numpy.ones", "numpy.argsort", "collections.defaultdict", "glob.glob", "lucid.optvis.render.import_model", "tensorflow.get_default_graph", "keras.applications.inception_v3.preprocess_input", "tensorflow.parse_single_example", "tensorflow.t...
[((558, 578), 'lucid.modelzoo.vision_models.InceptionV1', 'models.InceptionV1', ([], {}), '()\n', (576, 578), True, 'import lucid.modelzoo.vision_models as models\n'), ((804, 853), 'glob.glob', 'glob.glob', (['"""/raid/hpark407/imagenet-tf-records/*"""'], {}), "('/raid/hpark407/imagenet-tf-records/*')\n", (813, 853), F...
import numpy as np from collections import Counter class KNN(): def __init__(self, k, distance_function): self.k = k self.distance_function = distance_function self.__version__ = "2021.07.04" def get_k_neighbors(self, point): dist = [] for train in self.features...
[ "numpy.argsort", "collections.Counter", "numpy.array" ]
[((399, 415), 'numpy.argsort', 'np.argsort', (['dist'], {}), '(dist)\n', (409, 415), True, 'import numpy as np\n'), ((1042, 1059), 'collections.Counter', 'Counter', (['k_labels'], {}), '(k_labels)\n', (1049, 1059), False, 'from collections import Counter\n'), ((539, 560), 'numpy.array', 'np.array', (['self.labels'], {}...