code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"""The tournament module decides which pmems to pick from the ring in order to apply updates to the population.""" import numpy as np from kaplan.ring import RingEmptyError from kaplan.mutations import generate_children def run_tournament(t_size, num_muts, num_swaps, ring, current_mev): """Run...
[ "kaplan.ring.RingEmptyError", "kaplan.mutations.generate_children", "numpy.argpartition", "numpy.random.randint", "numpy.array" ]
[((1348, 1404), 'kaplan.mutations.generate_children', 'generate_children', (['parent1', 'parent2', 'num_muts', 'num_swaps'], {}), '(parent1, parent2, num_muts, num_swaps)\n', (1365, 1404), False, 'from kaplan.mutations import generate_children\n'), ((2520, 2571), 'numpy.array', 'np.array', (['[ring[i].fitness for i in ...
import chainer import numpy as np import models def main(): model = models.load_resnet50() optimizer = chainer.optimizers.Adam() optimizer.setup(model) x = np.zeros((1, 3, model.insize, model.insize), dtype=np.float32) t = np.zeros((1,), dtype=np.int32) optimizer.update(model, x, t) if __n...
[ "models.load_resnet50", "chainer.optimizers.Adam", "numpy.zeros" ]
[((75, 97), 'models.load_resnet50', 'models.load_resnet50', ([], {}), '()\n', (95, 97), False, 'import models\n'), ((114, 139), 'chainer.optimizers.Adam', 'chainer.optimizers.Adam', ([], {}), '()\n', (137, 139), False, 'import chainer\n'), ((176, 238), 'numpy.zeros', 'np.zeros', (['(1, 3, model.insize, model.insize)'],...
import os import math import argparse import numpy as np from black_box import FourierBlackBox from bayes_opt import BayesianOptimization from QuantumAnnealing.Three_SAT import get_3sat_problem from QuantumAnnealing.GroverSearch import get_gs_problem from tqdm import tqdm def get_split(param_list): value_list = so...
[ "os.mkdir", "numpy.save", "argparse.ArgumentParser", "bayes_opt.BayesianOptimization", "black_box.FourierBlackBox", "os.path.exists", "numpy.array", "os.path.join" ]
[((657, 682), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (680, 682), False, 'import argparse\n'), ((1261, 1461), 'black_box.FourierBlackBox', 'FourierBlackBox', (['get_3sat_problem'], {'n_qubit': 'args.n_qubit', 'cutoff': 'args.cutoff', 'time_final': 'args.time_final', 'time_step': 'args.ti...
import os from PIL import Image import numpy as np import lodgepole.image_tools as lit # The examples are pulled from images taken by the Mars Curiosity Rover. # https://mars.nasa.gov/msl/multimedia/ training_path = os.path.join("data", "training") tuning_path = os.path.join("data", "tuning") evaluation_path = os.pat...
[ "numpy.pad", "numpy.ceil", "numpy.isnan", "numpy.random.randint", "numpy.random.choice", "os.path.join", "os.listdir", "lodgepole.image_tools.rgb2gray_approx", "numpy.random.sample" ]
[((218, 250), 'os.path.join', 'os.path.join', (['"""data"""', '"""training"""'], {}), "('data', 'training')\n", (230, 250), False, 'import os\n'), ((265, 295), 'os.path.join', 'os.path.join', (['"""data"""', '"""tuning"""'], {}), "('data', 'tuning')\n", (277, 295), False, 'import os\n'), ((314, 348), 'os.path.join', 'o...
import os import argparse import numpy as np import matplotlib.pyplot as plt parser = argparse.ArgumentParser(description='Plotting') parser.add_argument('--file_name1',default='FINAL_script_local1-20200414_105220.log', type=str,help='path-name of the log file to be read') parser.add_argument('--file_name2',default='F...
[ "argparse.ArgumentParser", "matplotlib.pyplot.close", "matplotlib.pyplot.bar", "matplotlib.pyplot.yticks", "matplotlib.pyplot.legend", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xticks", "matplotlib.pyplot.s...
[((87, 134), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plotting"""'}), "(description='Plotting')\n", (110, 134), False, 'import argparse\n'), ((2469, 2497), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (2479, 2497), True, 'import m...
import numpy as np from numpy.linalg import norm, lstsq def regression(dict_list,data): d_data = data.shape[1] #dimension of data weights_list = [0]*d_data for i_d,dict_cur in enumerate(dict_list): data_cur = data[:,i_d] #select one dimension of data print('dictionary shape:',dict_cur.sha...
[ "numpy.linalg.norm", "numpy.linalg.lstsq", "numpy.linalg.cond" ]
[((355, 392), 'numpy.linalg.lstsq', 'lstsq', (['dict_cur', 'data_cur'], {'rcond': 'None'}), '(dict_cur, data_cur, rcond=None)\n', (360, 392), False, 'from numpy.linalg import norm, lstsq\n'), ((430, 454), 'numpy.linalg.cond', 'np.linalg.cond', (['dict_cur'], {}), '(dict_cur)\n', (444, 454), True, 'import numpy as np\n'...
""" Some functions that deal with the geometry of clusters. Author: <NAME> Date: 7/18/2015 """ __all__ = ['sample_coordinates', 'sample_many_coordinates', 'get_distance_matrices', 'usample', 'floyd', 'mme', 'usample_many'] import numpy as np import scipy.spatial as spt import sys ...
[ "sys.stdout.write", "numpy.sum", "scipy.spatial.distance.squareform", "numpy.zeros", "numpy.linalg.eig", "scipy.spatial.distance_matrix", "numpy.array", "sys.stdout.flush", "scipy.spatial.distance.pdist", "numpy.random.rand", "numpy.ndarray", "numpy.sqrt" ]
[((956, 969), 'numpy.array', 'np.array', (['box'], {}), '(box)\n', (964, 969), True, 'import numpy as np\n'), ((978, 996), 'numpy.ndarray', 'np.ndarray', (['(n, 3)'], {}), '((n, 3))\n', (988, 996), True, 'import numpy as np\n'), ((1265, 1286), 'numpy.ndarray', 'np.ndarray', (['(s, n, 3)'], {}), '((s, n, 3))\n', (1275, ...
import re import os from json import JSONEncoder from .lc_material import LCMaterial import bpm_backend as bpm import dtmm dtmm.conf.set_verbose(2) from vtk import vtkImageData, vtkXMLImageDataReader, vtkXMLImageDataWriter from vtk.util import numpy_support as vn import numpy as np import multiprocessing import py...
[ "numpy.abs", "dtmm.transfer_field", "vtk.util.numpy_support.numpy_to_vtk", "numpy.sum", "numpy.ones", "pyfftw.empty_aligned", "os.path.isfile", "numpy.sin", "numpy.imag", "numpy.tile", "vtk.vtkImageData", "multiprocessing.cpu_count", "warnings.simplefilter", "bpm_backend.run_backend_with_m...
[((125, 149), 'dtmm.conf.set_verbose', 'dtmm.conf.set_verbose', (['(2)'], {}), '(2)\n', (146, 149), False, 'import dtmm\n'), ((361, 414), 'warnings.simplefilter', 'simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (373, 414), False, 'from warnin...
from __future__ import division import os import cv2 import numpy as np import tensorflow as tf from TensorflowToolbox.utility import file_loader from TensorflowToolbox.data_flow import data_arg class InputLayer(object): def __init__(self, file_name, params, is_train): self.file_name = file_name ...
[ "TensorflowToolbox.data_flow.data_arg.DataArg", "tensorflow.py_func", "os.path.exists", "numpy.expand_dims", "numpy.amax", "cv2.imread", "numpy.tile", "TensorflowToolbox.utility.file_loader.TextFileLoader", "cv2.resize" ]
[((339, 367), 'TensorflowToolbox.utility.file_loader.TextFileLoader', 'file_loader.TextFileLoader', ([], {}), '()\n', (365, 367), False, 'from TensorflowToolbox.utility import file_loader\n'), ((570, 588), 'TensorflowToolbox.data_flow.data_arg.DataArg', 'data_arg.DataArg', ([], {}), '()\n', (586, 588), False, 'from Ten...
"""Base model framework.""" import math import random import pickle import argparse import datetime from datetime import timedelta from timeit import default_timer as timer import numpy as np from mindspore import context, save_checkpoint, load_checkpoint, load_param_into_net import mindspore.nn as nn from utils.mind...
[ "mindspore.context.set_context", "math.isnan", "numpy.random.seed", "argparse.ArgumentParser", "mindspore.load_checkpoint", "mindspore.load_param_into_net", "timeit.default_timer", "utils.mindspore_helper.GradWrap", "utils.evaluation.compute_retrieval_precision", "random.choice", "utils.data.Lab...
[((535, 603), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.PYNATIVE_MODE', 'device_target': '"""CPU"""'}), "(mode=context.PYNATIVE_MODE, device_target='CPU')\n", (554, 603), False, 'from mindspore import context, save_checkpoint, load_checkpoint, load_param_into_net\n'), ((814, 882), '...
import numpy as np from matplotlib import pyplot as plt from scipy.optimize import curve_fit from configs import input_ProtoConfig def f(x, argInverse): if argInverse == False: return np.log(x + 1) else: return np.exp(x) - 1 def _make_hallem_dataset(file, N_ORNS_TOTAL = 50, arg_positive=True,...
[ "numpy.sum", "numpy.log", "matplotlib.pyplot.imshow", "configs.input_ProtoConfig", "numpy.zeros", "numpy.unravel_index", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "numpy.mean", "numpy.random.multivariate_normal", "numpy.reshape", "numpy.exp", "numpy.random.choice", "numpy.c...
[((670, 713), 'numpy.reshape', 'np.reshape', (['vec', '(N_ODORS + 1, N_ORNS)', '"""F"""'], {}), "(vec, (N_ODORS + 1, N_ORNS), 'F')\n", (680, 713), True, 'import numpy as np\n'), ((1263, 1281), 'matplotlib.pyplot.subplots', 'plt.subplots', (['r', 'c'], {}), '(r, c)\n', (1275, 1281), True, 'from matplotlib import pyplot ...
# -*- coding: utf-8 -*- """ author: <NAME> email: <EMAIL> license: MIT Please feel free to use and modify this, but keep the above information. Thanks! """ import numpy as np from numpy import sin, cos, tan def phiThetaPsiDotToPQR(phi, theta, psi, phidot, thetadot, psidot): p = -sin(theta)*psidot + phidot ...
[ "numpy.sin", "numpy.array", "numpy.cos" ]
[((455, 474), 'numpy.array', 'np.array', (['[p, q, r]'], {}), '([p, q, r])\n', (463, 474), True, 'import numpy as np\n'), ((938, 957), 'numpy.array', 'np.array', (['[u, v, w]'], {}), '([u, v, w])\n', (946, 957), True, 'import numpy as np\n'), ((1147, 1178), 'numpy.array', 'np.array', (['[uFlat, vFlat, wFlat]'], {}), '(...
from collections import OrderedDict import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from gym import spaces from rl.policies.distributions import FixedCategorical, FixedNormal, \ MixedDistribution, FixedGumbelSoftmax from rl.policies.utils import MLP from util.pytorch import t...
[ "rl.policies.distributions.MixedDistribution", "rl.policies.distributions.FixedCategorical", "torch.zeros_like", "ipdb.set_trace", "numpy.log", "collections.OrderedDict", "rl.policies.distributions.FixedNormal", "torch.nn.functional.softplus", "util.pytorch.to_tensor", "torch.tensor", "torch.tan...
[((762, 796), 'util.pytorch.to_tensor', 'to_tensor', (['ob', 'self._config.device'], {}), '(ob, self._config.device)\n', (771, 796), False, 'from util.pytorch import to_tensor\n'), ((874, 887), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (885, 887), False, 'from collections import OrderedDict\n'), ((145...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # CODE NAME HERE # CODE DESCRIPTION HERE Created on 2019-07-09 at 13:42 @author: cook """ import numpy as np from astropy.table import Table from astropy import constants as cc from astropy import units as uu import os import warnings from apero import core from ape...
[ "apero.science.extract.berv.add_berv_keys", "apero.science.calib.general.add_calibs_to_header", "numpy.nanpercentile", "numpy.sum", "apero.science.calib.localisation.load_orderp", "apero.io.drs_path.copyfile", "numpy.ones", "numpy.isnan", "apero.science.calib.flat_blaze.get_blaze", "numpy.arange",...
[((1092, 1122), 'apero.core.constants.load', 'constants.load', (['__INSTRUMENT__'], {}), '(__INSTRUMENT__)\n', (1106, 1122), False, 'from apero.core import constants\n'), ((1735, 1755), 'astropy.constants.c.to', 'cc.c.to', (['(uu.m / uu.s)'], {}), '(uu.m / uu.s)\n', (1742, 1755), True, 'from astropy import constants as...
import numpy as np import pandas as pd from IMLearn.learners.classifiers import Perceptron, LDA, GaussianNaiveBayes from typing import Tuple from IMLearn.metrics import accuracy from utils import * import plotly.graph_objects as go from plotly.subplots import make_subplots from math import atan2, pi def load_dataset...
[ "numpy.load", "numpy.random.seed", "IMLearn.learners.classifiers.Perceptron", "math.atan2", "numpy.column_stack", "numpy.linalg.eigvalsh", "numpy.sin", "numpy.linspace", "numpy.cos", "plotly.subplots.make_subplots", "numpy.diag", "IMLearn.metrics.accuracy" ]
[((885, 902), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (892, 902), True, 'import numpy as np\n'), ((3117, 3144), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * pi)', '(100)'], {}), '(0, 2 * pi, 100)\n', (3128, 3144), True, 'import numpy as np\n'), ((6635, 6652), 'numpy.random.seed', 'np.random.seed...
#Copyright (c) 2020 Ocado. All Rights Reserved. import sys, os, pygame, argparse from PIL import Image import numpy as np sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))) from amrrt.space import StateSpace from amrrt.diffusion_map import DiffusionMap, GridGraph fr...
[ "amrrt.metrics.GeodesicMetric", "amrrt.diffusion_map.DiffusionMap", "amrrt.diffusion_map.GridGraph", "pygame.draw.line", "argparse.ArgumentParser", "pygame.event.get", "pygame.display.set_mode", "os.path.realpath", "amrrt.planners.AMRRTPlanner", "pygame.init", "amrrt.space.StateSpace.from_image"...
[((1503, 1526), 'pygame.display.update', 'pygame.display.update', ([], {}), '()\n', (1524, 1526), False, 'import sys, os, pygame, argparse\n'), ((1583, 1596), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1594, 1596), False, 'import sys, os, pygame, argparse\n'), ((1614, 1630), 'amrrt.diffusion_map.GridGraph', 'Grid...
import numpy as np import copy from pprint import pprint from fractions import Fraction frac = True denom_lim = 100000 num_dec = 12 def toFrac(arg): return Fraction(arg).limit_denominator(denom_lim) def chkFrac(fra, arg): return abs(float(fra) - arg) < 10**(-14) def floatformat(arg): if frac: fra = toFrac(a...
[ "numpy.asarray", "copy.copy", "numpy.array", "numpy.exp", "pprint.pprint", "fractions.Fraction" ]
[((740, 761), 'copy.copy', 'copy.copy', (['prevpoints'], {}), '(prevpoints)\n', (749, 761), False, 'import copy\n'), ((160, 173), 'fractions.Fraction', 'Fraction', (['arg'], {}), '(arg)\n', (168, 173), False, 'from fractions import Fraction\n'), ((475, 484), 'numpy.exp', 'np.exp', (['(1)'], {}), '(1)\n', (481, 484), Tr...
# -*- coding: utf-8 -*- #!/usr/bin/env python __author__ = """Prof. <NAME>, Ph.D. <<EMAIL>>""" import os os.system('clear') print('.-------------------------------.') print('| |#') print('| By.: Prof. <NAME> |#') print('| |#') print('| ...
[ "matplotlib.pyplot.loglog", "matplotlib.pyplot.show", "numpy.random.binomial", "matplotlib.pyplot.axis", "os.system", "numpy.append", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((108, 126), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (117, 126), False, 'import os\n'), ((577, 595), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (586, 595), False, 'import os\n'), ((2047, 2081), 'matplotlib.pyplot.loglog', 'pl.loglog', (['x', 'y', '"""."""'], {'color': '"""g...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Training routine for 3D object detection with SUN RGB-D or ScanNet. Sample usage: python train.py --dataset sunrgbd --log_dir log_sunrgb...
[ "models.loss_helper.get_loss", "tensorboardX.SummaryWriter", "omegaconf.OmegaConf.save", "numpy.random.seed", "warnings.simplefilter", "torch.no_grad", "models.ap_helper.APCalculator", "torch.load", "datetime.datetime.now", "torch.save", "logging.info", "os.path.isfile", "models.dump_helper....
[((882, 944), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (903, 944), False, 'import warnings\n'), ((3735, 3828), 'models.ap_helper.APCalculator', 'APCalculator', ([], {'ap_iou_thresh': '(0.5)', 'class2ty...
import collections import logging import numpy as np import gym import cv2 from core.log import do_logging from utility.utils import infer_dtype, convert_dtype from utility.typing import AttrDict from env.typing import EnvOutput, GymOutput # stop using GPU cv2.ocl.setUseOpenCL(False) logger = logging.getLogger(__name...
[ "utility.utils.convert_dtype", "numpy.ones", "numpy.clip", "numpy.isnan", "numpy.tile", "utility.utils.infer_dtype", "collections.deque", "core.log.do_logging", "numpy.zeros_like", "cv2.cvtColor", "numpy.isfinite", "env.typing.GymOutput", "matplotlib.pyplot.subplots", "numpy.stack", "mat...
[((259, 286), 'cv2.ocl.setUseOpenCL', 'cv2.ocl.setUseOpenCL', (['(False)'], {}), '(False)\n', (279, 286), False, 'import cv2\n'), ((296, 323), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (313, 323), False, 'import logging\n'), ((1874, 1934), 'numpy.zeros', 'np.zeros', (['((2,) + env.ob...
import numpy as np import numba as nb import mcmc.util as util import mcmc.util_2D as u2 import mcmc.fourier as fourier fourier_type = nb.deferred_type() fourier_type.define(fourier.FourierAnalysis.class_type.instance_type) spec = [ ('fourier',fourier_type), ('sqrt_beta',nb.float64), ('current_L',nb.comp...
[ "mcmc.util.matMulti", "numba.jitclass", "numpy.zeros", "numba.deferred_type", "numpy.linalg.slogdet", "numpy.all" ]
[((136, 154), 'numba.deferred_type', 'nb.deferred_type', ([], {}), '()\n', (152, 154), True, 'import numba as nb\n'), ((388, 405), 'numba.jitclass', 'nb.jitclass', (['spec'], {}), '(spec)\n', (399, 405), True, 'import numba as nb\n'), ((592, 697), 'numpy.zeros', 'np.zeros', (['(2 * self.fourier.basis_number - 1, 2 * se...
# Copyright (c) Jack.Wang. All rights reserved. import os import cv2 import numpy as np from loguru import logger from argparse import ArgumentParser import torch from mmcls.apis import init_model from mmcv.parallel import collate, scatter from mmcls.datasets.pipelines import Compose from tools.custom_tools.utils imp...
[ "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "numpy.argmax", "tools.custom_tools.utils.mkdir", "os.path.isfile", "mmcls.apis.init_model", "torch.no_grad", "os.path.join", "cv2.imwrite", "mmcv.parallel.scatter", "numpy.max", "cv2.resize", "mmcls.datasets.pipelines.Compose", "mmcv.pa...
[((912, 943), 'mmcls.datasets.pipelines.Compose', 'Compose', (['cfg.data.test.pipeline'], {}), '(cfg.data.test.pipeline)\n', (919, 943), False, 'from mmcls.datasets.pipelines import Compose\n'), ((986, 1020), 'mmcv.parallel.collate', 'collate', (['[data]'], {'samples_per_gpu': '(1)'}), '([data], samples_per_gpu=1)\n', ...
"""This script transforms MNIST dataset provided available at http://yann.lecun.com/exdb/mnist/ into a pickled version optimised for the neural network.""" import numpy as np import pickle from Dataset import OriginalMNISTDataset, OptimizedDataset def generateOptimizedDataSet(): origin = OriginalMNISTDataset() ...
[ "pickle.dump", "Dataset.OptimizedDataset", "numpy.zeros", "Dataset.OriginalMNISTDataset", "numpy.array" ]
[((296, 318), 'Dataset.OriginalMNISTDataset', 'OriginalMNISTDataset', ([], {}), '()\n', (316, 318), False, 'from Dataset import OriginalMNISTDataset, OptimizedDataset\n'), ((1656, 1674), 'Dataset.OptimizedDataset', 'OptimizedDataset', ([], {}), '()\n', (1672, 1674), False, 'from Dataset import OriginalMNISTDataset, Opt...
import starry import numpy as np import matplotlib.pyplot as plt import time import os from tqdm import tqdm starry.config.quiet = True ntimes = 100 alpha = 0.05 def timeit(ydeg=10, nt=10, nw=100, vsini=50000.0): wav = np.linspace(642.85, 643.15, nw) wav0 = np.linspace(642.00, 644.00, nw) map = starry.D...
[ "numpy.random.randn", "numpy.median", "numpy.logspace", "numpy.zeros", "time.time", "numpy.random.random", "numpy.arange", "starry.DopplerMap", "numpy.linspace", "matplotlib.pyplot.subplots", "os.getenv" ]
[((712, 759), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'sharey': '(True)', 'figsize': '(8, 4)'}), '(2, 2, sharey=True, figsize=(8, 4))\n', (724, 759), True, 'import matplotlib.pyplot as plt\n'), ((874, 890), 'numpy.arange', 'np.arange', (['(1)', '(21)'], {}), '(1, 21)\n', (883, 890), True, 'impor...
import numpy as np from src.decision_tree import DecisionTree class Stacking: def __init__(self, tuples = [(DecisionTree(), 2)]): self.tuples = tuples def cross_validation_split(self, X,y, folds=3): dataset_split = list() dataset_splity = list() dataset_copy = list(X) dataset_copyy = list(y) fold_size ...
[ "numpy.array", "src.decision_tree.DecisionTree" ]
[((1853, 1875), 'numpy.array', 'np.array', (['pred.mode[0]'], {}), '(pred.mode[0])\n', (1861, 1875), True, 'import numpy as np\n'), ((111, 125), 'src.decision_tree.DecisionTree', 'DecisionTree', ([], {}), '()\n', (123, 125), False, 'from src.decision_tree import DecisionTree\n')]
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization # Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved. # Released under the modified BSD license. See COPYING.md for more details. from unittest.mock import Mock import numpy as np from miplearn.classifiers import Cl...
[ "miplearn.classifiers.threshold.MinPrecisionThreshold", "unittest.mock.Mock", "numpy.array" ]
[((444, 465), 'unittest.mock.Mock', 'Mock', ([], {'spec': 'Classifier'}), '(spec=Classifier)\n', (448, 465), False, 'from unittest.mock import Mock\n'), ((705, 735), 'numpy.array', 'np.array', (['[[0], [1], [2], [3]]'], {}), '([[0], [1], [2], [3]])\n', (713, 735), True, 'import numpy as np\n'), ((823, 893), 'numpy.arra...
import numpy as np import math class Camera: ''' Camera class ''' def __init__(self, blender_cam, width, height, matrix=None, angle=None): # create the camera vectors from the data # note that we can override the camera matrix for viewport rendering aspect_ratio = width / height ...
[ "math.tan", "numpy.array" ]
[((499, 520), 'math.tan', 'math.tan', (['(theta / 2.0)'], {}), '(theta / 2.0)\n', (507, 520), False, 'import math\n'), ((613, 668), 'numpy.array', 'np.array', (['[cam_mat[0][3], cam_mat[1][3], cam_mat[2][3]]'], {}), '([cam_mat[0][3], cam_mat[1][3], cam_mat[2][3]])\n', (621, 668), True, 'import numpy as np\n'), ((686, 7...
from typing import Sequence, Union, cast import numpy as np import pymap3d as pm import transforms3d def compute_agent_pose(agent_centroid_m: np.ndarray, agent_yaw_rad: float) -> np.ndarray: """Return the agent pose as a 3x3 matrix. This corresponds to world_from_agent matrix. Args: agent_centroid_m...
[ "transforms3d.euler.mat2euler", "numpy.transpose", "numpy.expand_dims", "transforms3d.euler.euler2mat", "pymap3d.geodetic2ecef", "numpy.sin", "numpy.matmul", "numpy.cos", "numpy.eye", "pymap3d.ecef2geodetic" ]
[((1488, 1527), 'transforms3d.euler.euler2mat', 'transforms3d.euler.euler2mat', (['(0)', '(0)', 'yaw'], {}), '(0, 0, yaw)\n', (1516, 1527), False, 'import transforms3d\n'), ((1858, 1867), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (1864, 1867), True, 'import numpy as np\n'), ((1899, 1920), 'numpy.matmul', 'np.matmu...
# This allows for running the example when the repo has been cloned import sys from os.path import abspath sys.path.extend([abspath(".")]) import recolo import numpy as np import matplotlib.pyplot as plt import os cwd = os.path.dirname(os.path.realpath(__file__)) # Minimal example of pressure load reconstruction ba...
[ "recolo.solver_VFM.calc_pressure_thin_elastic_plate", "matplotlib.pyplot.tight_layout", "os.path.join", "recolo.make_plate", "os.path.abspath", "recolo.deflectomerty.disp_from_grids", "recolo.virtual_fields.Hermite16", "recolo.kinematic_fields_from_deflections", "matplotlib.pyplot.show", "matplotl...
[((922, 976), 'recolo.make_plate', 'recolo.make_plate', (['mat_E', 'mat_nu', 'density', 'plate_thick'], {}), '(mat_E, mat_nu, density, plate_thick)\n', (939, 976), False, 'import recolo\n'), ((3445, 3612), 'recolo.slope_integration.disp_from_slopes', 'recolo.slope_integration.disp_from_slopes', (['slopes_x', 'slopes_y'...
"""Code common to all toolkits""" from collections import deque import numpy as np from .spatial import dihedral, distance def detect_secondary_structure(res_dict): """Detect alpha helices and beta sheets in res_dict by phi and psi angles""" first = res_dict[:-1] second = res_dict[1:] psi = dihedral(...
[ "numpy.argwhere", "numpy.diff", "numpy.abs", "collections.deque" ]
[((651, 678), 'numpy.argwhere', 'np.argwhere', (['res_mask_alpha'], {}), '(res_mask_alpha)\n', (662, 678), True, 'import numpy as np\n'), ((712, 739), 'numpy.argwhere', 'np.argwhere', (['res_mask_alpha'], {}), '(res_mask_alpha)\n', (723, 739), True, 'import numpy as np\n'), ((1030, 1139), 'numpy.abs', 'np.abs', (["(res...
import os import numpy as np from preprocess import preprocess def load_data(): dir_path = os.path.dirname(os.path.realpath(__file__)) file_path = os.path.abspath(os.path.join(dir_path, '..', 'raw_data')) directories = os.listdir(file_path) raw_training_set = [] for directory in directories: ...
[ "os.path.join", "os.path.realpath", "numpy.array", "os.listdir" ]
[((234, 255), 'os.listdir', 'os.listdir', (['file_path'], {}), '(file_path)\n', (244, 255), False, 'import os\n'), ((950, 976), 'numpy.array', 'np.array', (['raw_training_set'], {}), '(raw_training_set)\n', (958, 976), True, 'import numpy as np\n'), ((113, 139), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}...
''' Created on May 20, 2019 @author: <NAME>, <NAME> ''' from ScopeFoundry.data_browser import DataBrowser, DataBrowserView from qtpy import QtWidgets, QtCore, QtGui import numpy as np import h5py from ScopeFoundry.widgets import RegionSlicer from FoundryDataBrowser.viewers.plot_n_fit import PlotNFit, MonoExponentia...
[ "FoundryDataBrowser.viewers.plot_n_fit.SemiLogYPolyFitter", "h5py.File", "numpy.roll", "qtpy.QtWidgets.QLabel", "ScopeFoundry.data_browser.DataBrowser", "qtpy.QtWidgets.QSpacerItem", "FoundryDataBrowser.viewers.plot_n_fit.MonoExponentialFitter", "numpy.apply_along_axis", "qtpy.QtGui.QColor", "nump...
[((4079, 4092), 'qtpy.QtCore.Slot', 'QtCore.Slot', ([], {}), '()\n', (4090, 4092), False, 'from qtpy import QtWidgets, QtCore, QtGui\n'), ((7778, 7819), 'numpy.apply_along_axis', 'np.apply_along_axis', (['bin_1Darray', 'axis', 'y'], {}), '(bin_1Darray, axis, y)\n', (7797, 7819), True, 'import numpy as np\n'), ((8473, 8...
try: # Try to use setuptools so as to enable support of the special # "Microsoft Visual C++ Compiler for Python 2.7" (http://aka.ms/vcpython27) # for building under Windows. # Note setuptools >= 6.0 is required for this. from setuptools import setup, Extension except ImportError: from distutils....
[ "versioneer.get_version", "numpy.distutils.misc_util.get_info", "versioneer.get_cmdclass", "os.environ.get", "distutils.core.Extension", "numpy.get_include", "os.path.join", "os.listdir" ]
[((651, 676), 'versioneer.get_cmdclass', 'versioneer.get_cmdclass', ([], {}), '()\n', (674, 676), False, 'import versioneer\n'), ((819, 852), 'os.environ.get', 'os.environ.get', (['"""NUMBA_GCC_FLAGS"""'], {}), "('NUMBA_GCC_FLAGS')\n", (833, 852), False, 'import os\n'), ((1168, 1195), 'numpy.distutils.misc_util.get_inf...
import numpy as np from mxnet.gluon.loss import Loss class Tanimoto(Loss): def __init__(self, _smooth=1.0e-5, _axis=[2,3], _weight = None, _batch_axis= 0, **kwards): Loss.__init__(self,weight=_weight, batch_axis = _batch_axis, **kwards) self.axis = _axis self.smooth = _smooth def h...
[ "numpy.float", "mxnet.gluon.loss.Loss.__init__" ]
[((182, 251), 'mxnet.gluon.loss.Loss.__init__', 'Loss.__init__', (['self'], {'weight': '_weight', 'batch_axis': '_batch_axis'}), '(self, weight=_weight, batch_axis=_batch_axis, **kwards)\n', (195, 251), False, 'from mxnet.gluon.loss import Loss\n'), ((2489, 2558), 'mxnet.gluon.loss.Loss.__init__', 'Loss.__init__', (['s...
import numpy as np from common.utils import * class StringSimilaritySorter: def __init__(self, metric, metric_range_percentage=False, return_similarity=False): self.metric = metric self.metric_range_percentage = metric_range_percentage self.return_similarity = return_similarity @profi...
[ "numpy.lexsort", "numpy.array" ]
[((851, 885), 'numpy.array', 'np.array', (['candidates'], {'dtype': 'object'}), '(candidates, dtype=object)\n', (859, 885), True, 'import numpy as np\n'), ((901, 967), 'numpy.lexsort', 'np.lexsort', (['(candidates_distance[:, 0], candidates_distance[:, 1])'], {}), '((candidates_distance[:, 0], candidates_distance[:, 1]...
from bdgtools.bedgraph import BedGraph, BedGraphArray from bdgtools.regions import Regions import numpy as np import pytest @pytest.fixture def bedgraph(): return BedGraph([0, 10, 15, 25, 40], [0, 1, 2, 3, 4], size=50) @pytest.fixture def bedgrapharray(): return BedGraphArray([0, 10, 0, 10, 25], [0, 1, 2, 3, ...
[ "bdgtools.bedgraph.BedGraphArray", "bdgtools.bedgraph.BedGraphArray.from_bedgraphs", "bdgtools.bedgraph.BedGraphArray.vstack", "numpy.array", "bdgtools.regions.Regions", "bdgtools.bedgraph.BedGraph", "bdgtools.bedgraph.BedGraph.concatenate" ]
[((168, 223), 'bdgtools.bedgraph.BedGraph', 'BedGraph', (['[0, 10, 15, 25, 40]', '[0, 1, 2, 3, 4]'], {'size': '(50)'}), '([0, 10, 15, 25, 40], [0, 1, 2, 3, 4], size=50)\n', (176, 223), False, 'from bdgtools.bedgraph import BedGraph, BedGraphArray\n'), ((273, 344), 'bdgtools.bedgraph.BedGraphArray', 'BedGraphArray', (['...
import unittest as ut import os import numpy as np np.set_printoptions(threshold=np.nan) class TestGLSLCPU(ut.TestCase): def setUp(self): self.maxDiff = None # todo: add standalone tests
[ "numpy.set_printoptions" ]
[((52, 89), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (71, 89), True, 'import numpy as np\n')]
# Copyright (c) 2020 Sony Corporation. 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 applicabl...
[ "os.path.join", "os.path.basename", "os.path.isdir", "random.shuffle", "random.random", "numpy.fliplr", "numpy.array", "numpy.arange", "numpy.random.choice", "nnabla.logger.info", "os.listdir", "numpy.random.shuffle" ]
[((1032, 1051), 'os.path.isdir', 'os.path.isdir', (['name'], {}), '(name)\n', (1045, 1051), False, 'import os\n'), ((2036, 2056), 'os.listdir', 'os.listdir', (['root_dir'], {}), '(root_dir)\n', (2046, 2056), False, 'import os\n'), ((3480, 3525), 'nnabla.logger.info', 'logger.info', (['f"""using data in {self.root_dir}"...
import sys import pandas as pd import numpy as np def topsis(file,weight,impact,output): ## Handling invalid file type exception if(file.split('.')[-1]!='csv'): print("[ERROR]File extension not supported! Must be csv flie") exit(0) ## Handling File not present exception try: ...
[ "pandas.DataFrame", "pandas.read_csv", "numpy.max", "numpy.min", "sys.exit" ]
[((4680, 4725), 'pandas.DataFrame', 'pd.DataFrame', (['final'], {'columns': 'cols', 'index': 'None'}), '(final, columns=cols, index=None)\n', (4692, 4725), True, 'import pandas as pd\n'), ((326, 350), 'pandas.read_csv', 'pd.read_csv', (['f"""./{file}"""'], {}), "(f'./{file}')\n", (337, 350), True, 'import pandas as pd\...
import numpy as np import matplotlib.pyplot as plt import torch from iflow.utils.generic import to_numpy class TestClass(): def __init__(self, dynamics): self.dynamics = dynamics self.N = 100 self.dim = dynamics.dim def points_evolution(self): x0 = torch.ones(1, self.dim) ...
[ "torch.mean", "torch.ones", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "torch.randn", "iflow.utils.generic.to_numpy", "numpy.linspace", "matplotlib.pyplot.subplots", "numpy.sqrt" ]
[((292, 315), 'torch.ones', 'torch.ones', (['(1)', 'self.dim'], {}), '(1, self.dim)\n', (302, 315), False, 'import torch\n'), ((405, 420), 'iflow.utils.generic.to_numpy', 'to_numpy', (['trj_n'], {}), '(trj_n)\n', (413, 420), False, 'from iflow.utils.generic import to_numpy\n'), ((441, 463), 'matplotlib.pyplot.subplots'...
import numpy as np import scipy.sparse as sp import torch import random from sklearn.feature_extraction.text import TfidfTransformer def clean_dblp(path='./data/dblp/',new_path='./data/dblp2/'): label_file = "author_label" PA_file = "PA" PC_file = "PC" PT_file = "PT" PA = np.genfromtxt("{}{}.txt...
[ "numpy.sum", "random.sample", "numpy.asarray", "numpy.ones", "scipy.sparse.coo_matrix", "numpy.max", "numpy.vstack", "numpy.concatenate" ]
[((2188, 2220), 'numpy.concatenate', 'np.concatenate', (['(PA, PC)'], {'axis': '(0)'}), '((PA, PC), axis=0)\n', (2202, 2220), True, 'import numpy as np\n'), ((6997, 7016), 'numpy.asarray', 'np.asarray', (['APA_emb'], {}), '(APA_emb)\n', (7007, 7016), True, 'import numpy as np\n'), ((8385, 8406), 'numpy.asarray', 'np.as...
import sys sys.path.insert(0, '../../../src/') import random import numpy as np import json import os import time from datetime import datetime from util import * from nnett import * from lp import * def ssc_pair(nnet, I, J, K, test_data, di): index=-1 tot=len(test_data[0].eval()) ordering=list(range(tot)) ...
[ "json.load", "sys.path.insert", "numpy.random.shuffle", "time.time" ]
[((12, 47), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../src/"""'], {}), "(0, '../../../src/')\n", (27, 47), False, 'import sys\n'), ((322, 349), 'numpy.random.shuffle', 'np.random.shuffle', (['ordering'], {}), '(ordering)\n', (339, 349), True, 'import numpy as np\n'), ((552, 563), 'time.time', 'time.tim...
import calendar from datetime import date import matplotlib.pyplot as plt import numpy as np import pandas as pd def transform_data(data): time_data = data[month][::-1].stack().reset_index().iloc[:, 2] dt = [] for i, _ in enumerate(time_data): dt.append(date(2007 + i // 12, i % 12 + 1...
[ "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "pandas.read_csv", "datetime.date", "matplotlib.pyplot.figure", "numpy.where", "calendar.isleap", "numpy.arange", "calendar.monthrange", "matplotlib.pyplot.ylabel", "pandas.PeriodIndex", "matplotlib.pyplot.xlabel", "m...
[((344, 389), 'pandas.DataFrame', 'pd.DataFrame', (["{'date': dt, 'data': time_data}"], {}), "({'date': dt, 'data': time_data})\n", (356, 389), True, 'import pandas as pd\n'), ((412, 440), 'pandas.PeriodIndex', 'pd.PeriodIndex', (['dt'], {'freq': '"""M"""'}), "(dt, freq='M')\n", (426, 440), True, 'import pandas as pd\n...
from __future__ import print_function try: import cPickle as thepickle except ImportError: import _pickle as thepickle from keras.callbacks import LambdaCallback from new_model import create_model, create_model_2d import keras.backend.tensorflow_backend as ktf import tensorflow as tf import os from keras.mod...
[ "argparse.ArgumentParser", "random.shuffle", "keras.models.Model", "keras.callbacks.LambdaCallback", "tensorflow.ConfigProto", "pickle.load", "numpy.arange", "numpy.linalg.norm", "keras.layers.Input", "tensorflow.GPUOptions", "keras.optimizers.SGD", "numpy.random.choice", "new_model.create_m...
[((642, 667), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (665, 667), False, 'import argparse\n'), ((1501, 1579), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'per_process_gpu_memory_fraction': 'gpu_fraction', 'allow_growth': '(True)'}), '(per_process_gpu_memory_fraction=gpu_fraction, all...
'''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' from __future__ import print_function import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES...
[ "matplotlib.pyplot.switch_backend", "numpy.ones_like", "argparse.ArgumentParser", "sklearn.metrics.roc_curve", "matplotlib.pyplot.legend", "tensorflow.Session", "os.system", "keras.models.Model", "tensorflow.ConfigProto", "matplotlib.pyplot.figure", "numpy.append", "keras.layers.Average", "s...
[((668, 693), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (686, 693), True, 'import matplotlib.pyplot as plt\n'), ((702, 718), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (716, 718), True, 'import tensorflow as tf\n'), ((839, 864), 'argparse.ArgumentPars...
# Import python libraries import numpy as np import cv2 # set to 1 for pipeline images debug = 0 class Segmentation(object): # Segmentation class to detect objects def __init__(self): self.fgbg = cv2.createBackgroundSubtractorMOG2() def detect(self, frame): '''Detect objects in video fra...
[ "cv2.createBackgroundSubtractorMOG2", "cv2.Canny", "cv2.minEnclosingCircle", "cv2.circle", "cv2.dilate", "cv2.cvtColor", "cv2.threshold", "numpy.ones", "numpy.array", "cv2.imshow", "numpy.round", "cv2.findContours" ]
[((215, 251), 'cv2.createBackgroundSubtractorMOG2', 'cv2.createBackgroundSubtractorMOG2', ([], {}), '()\n', (249, 251), False, 'import cv2\n'), ((937, 976), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2GRAY'], {}), '(frame, cv2.COLOR_BGR2GRAY)\n', (949, 976), False, 'import cv2\n'), ((1136, 1165), 'cv2.Can...
import argparse import os import numpy as np import math import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch...
[ "torch.nn.Dropout", "argparse.ArgumentParser", "numpy.argmax", "torch.nn.Embedding", "torch.nn.init.constant_", "torch.nn.Softmax", "numpy.random.randint", "numpy.random.normal", "torchvision.transforms.Normalize", "torch.nn.BCELoss", "torch.nn.Linear", "torch.nn.Tanh", "torch.nn.Conv2d", ...
[((331, 356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (354, 356), False, 'import argparse\n'), ((1588, 1641), 'os.makedirs', 'os.makedirs', (["('images/%s' % opt.version)"], {'exist_ok': '(True)'}), "('images/%s' % opt.version, exist_ok=True)\n", (1599, 1641), False, 'import os\n'), ((16...
# Step 4 # Matrix Reordering using GPU # push high values to the diagonal line """ while True: randomly detect swapable pairs (choices) on GPU sort choices by the gains, remove the conflicted choices swap remain pairs if not many pairs found at this step: doulbe the search scale up to 8192. """ ...
[ "wandb.log", "numpy.load", "numpy.random.seed", "argparse.ArgumentParser", "tools.core.swap_inplace", "numpy.argsort", "numpy.arange", "numpy.random.shuffle", "tools.images.save_pic", "tools.core.loss_gpu", "numpy.all", "os.makedirs", "numba.cuda.random.create_xoroshiro128p_states", "wandb...
[((632, 644), 'numba.cuda.grid', 'cuda.grid', (['(1)'], {}), '(1)\n', (641, 644), False, 'from numba import cuda\n'), ((1360, 1426), 'numba.cuda.random.create_xoroshiro128p_states', 'create_xoroshiro128p_states', (['(threads_per_block * blocks)'], {'seed': 'seed'}), '(threads_per_block * blocks, seed=seed)\n', (1387, 1...
# --------------------------------------------------------------------- # Project "Track 3D-Objects Over Time" # Copyright (C) 2020, Dr. <NAME> / Dr. <NAME>. # # Purpose of this file : Kalman filter class # # You should have received a copy of the Udacity license together with this program. # # https://www.udacity.com/...
[ "os.path.expanduser", "numpy.matrix", "numpy.fill_diagonal", "os.getcwd", "numpy.zeros", "numpy.identity", "os.path.join" ]
[((723, 763), 'os.path.join', 'os.path.join', (['SCRIPT_DIR', 'PACKAGE_PARENT'], {}), '(SCRIPT_DIR, PACKAGE_PARENT)\n', (735, 763), False, 'import os\n'), ((1187, 1199), 'numpy.matrix', 'np.matrix', (['F'], {}), '(F)\n', (1196, 1199), True, 'import numpy as np\n'), ((1467, 1513), 'numpy.zeros', 'np.zeros', (['(params.d...
# -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = ["BasicSolver"] import numpy as np from scipy.linalg import cholesky, cho_solve class BasicSolver(object): """ This is the most basic solver built using :func:`scipy.linalg.cholesky`. kernel (george.kernels.Kernel): A su...
[ "numpy.diag_indices_from", "scipy.linalg.cholesky", "scipy.linalg.cho_solve", "numpy.dot", "numpy.diag" ]
[((2446, 2494), 'scipy.linalg.cho_solve', 'cho_solve', (['self._factor', 'y'], {'overwrite_b': 'in_place'}), '(self._factor, y, overwrite_b=in_place)\n', (2455, 2494), False, 'from scipy.linalg import cholesky, cho_solve\n'), ((3130, 3156), 'numpy.dot', 'np.dot', (['r', 'self._factor[0]'], {}), '(r, self._factor[0])\n'...
# Copyright 2020 trueto # 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 writi...
[ "numpy.random.seed", "torch.utils.data.RandomSampler", "numpy.argmax", "bertology_sklearn.models.BertologyForClassification", "torch.cuda.device_count", "torch.nn.MultiLabelSoftMarginLoss", "bertology_sklearn.data_utils.text_load_and_cache_examples", "gc.collect", "numpy.mean", "ignite.contrib.han...
[((1733, 1760), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1750, 1760), False, 'import logging\n'), ((4354, 4497), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'leve...
import cv2 as cv import numpy as np import math import time cv.startWindowThread() cap = cv.VideoCapture('video/Sentry_2.mkv') img= cv.imread("Sample2.png") fourcc = cv.VideoWriter_fourcc(*'mp4v') out = cv.VideoWriter('output2.mp4', fourcc, 15.0, (449,809),True) scale_percent = 40 # percent of original size width = i...
[ "cv2.VideoWriter_fourcc", "cv2.bitwise_and", "cv2.getPerspectiveTransform", "numpy.ones", "cv2.boxPoints", "numpy.sin", "cv2.minAreaRect", "cv2.startWindowThread", "cv2.VideoWriter", "cv2.imshow", "cv2.dilate", "cv2.cvtColor", "cv2.drawContours", "cv2.resize", "numpy.int0", "cv2.waitKe...
[((61, 83), 'cv2.startWindowThread', 'cv.startWindowThread', ([], {}), '()\n', (81, 83), True, 'import cv2 as cv\n'), ((90, 127), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""video/Sentry_2.mkv"""'], {}), "('video/Sentry_2.mkv')\n", (105, 127), True, 'import cv2 as cv\n'), ((133, 157), 'cv2.imread', 'cv.imread', (['"""...
# Copyright (c) 2013, Preferred Infrastructure, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this l...
[ "numpy.random.seed", "json.dumps", "functools.wraps", "itertools.product" ]
[((3289, 3319), 'functools.wraps', 'functools.wraps', (['callback_body'], {}), '(callback_body)\n', (3304, 3319), False, 'import functools\n'), ((5168, 5198), 'functools.wraps', 'functools.wraps', (['callback_body'], {}), '(callback_body)\n', (5183, 5198), False, 'import functools\n'), ((6451, 6477), 'itertools.product...
import os import glob import random import numpy as np import cv2 from tqdm.auto import tqdm import torch from torch.autograd import Variable import torchvision.transforms as transforms class ImageChunker(object): def __init__(self, rows, cols, overlap): self.rows = rows self.cols = cols ...
[ "os.getcwd", "cv2.waitKey", "numpy.zeros", "numpy.ones", "tqdm.auto.tqdm", "cv2.imread", "numpy.array", "os.path.splitext", "glob.glob", "cv2.imshow", "os.path.join", "os.chdir", "numpy.concatenate" ]
[((6931, 6945), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (6939, 6945), False, 'import os\n'), ((7001, 7016), 'tqdm.auto.tqdm', 'tqdm', (['file_list'], {}), '(file_list)\n', (7005, 7016), False, 'from tqdm.auto import tqdm\n'), ((5406, 5426), 'cv2.imread', 'cv2.imread', (['filename'], {}), '(filename)\n', (54...
from scipy.signal import argrelmin from scipy.optimize import minimize from scipy.integrate import trapz, cumtrapz import pleque.utils.surfaces as surf from pleque.utils.surfaces import points_inside_curve, find_contour import numpy as np import xarray as xa def is_monotonic(f, x0, x1, n_test=10): """ Test wh...
[ "numpy.abs", "numpy.sum", "numpy.ones", "numpy.argsort", "numpy.shape", "pleque.utils.surfaces.points_inside_curve", "pleque.utils.surfaces.intersection", "pleque.utils.surfaces.curve_is_closed", "numpy.prod", "scipy.optimize.minimize", "numpy.zeros_like", "scipy.signal.argrelmin", "numpy.ma...
[((600, 633), 'numpy.linspace', 'np.linspace', (['x0[0]', 'x1[0]', 'n_test'], {}), '(x0[0], x1[0], n_test)\n', (611, 633), True, 'import numpy as np\n'), ((645, 678), 'numpy.linspace', 'np.linspace', (['x0[1]', 'x1[1]', 'n_test'], {}), '(x0[1], x1[1], n_test)\n', (656, 678), True, 'import numpy as np\n'), ((1431, 1494)...
# -*- coding: UTF-8 -*- import functools import hasher import numpy as np import scipy.spatial.distance as distance from pyspark.mllib.linalg import SparseVector def distance_metric(kv): """ Generates a pairwise, summed Jaccard distance metric for all the elements in a cluster/bucket. Returns a <k...
[ "functools.partial", "numpy.array", "numpy.random.random_integers", "numpy.long" ]
[((3179, 3238), 'functools.partial', 'functools.partial', (['hasher.minhash'], {'a': 's[0]', 'b': 's[1]', 'p': 'p', 'm': 'm'}), '(hasher.minhash, a=s[0], b=s[1], p=p, m=m)\n', (3196, 3238), False, 'import functools\n'), ((856, 867), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (864, 867), True, 'import numpy as np\...
from typing import Tuple import numpy as np import pandas as pd import pytest from sklearn.datasets import load_iris from sklearn.linear_model import LogisticRegression from sklearn.pipeline import Pipeline from ml_tooling import Model from ml_tooling.data import Dataset, load_demo_dataset from ml_tooling.transformer...
[ "pandas.DataFrame", "sklearn.datasets.load_iris", "pandas.testing.assert_frame_equal", "ml_tooling.data.load_demo_dataset", "sklearn.linear_model.LogisticRegression", "ml_tooling.transformers.DFStandardScaler", "numpy.array_equal" ]
[((494, 519), 'ml_tooling.data.load_demo_dataset', 'load_demo_dataset', (['"""iris"""'], {}), "('iris')\n", (511, 519), False, 'from ml_tooling.data import Dataset, load_demo_dataset\n'), ((584, 595), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (593, 595), False, 'from sklearn.datasets import load_iris...
# --------------------------------------------------------------- # dense_reppoints_target.py # Set-up time: 2020/9/24 22:40 # Copyright (c) 2020 ICT # Licensed under The MIT License [see LICENSE for details] # Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT # Contact: <EMAIL> [OR] <EMAIL> # -------------------...
[ "numpy.maximum", "torch.cat", "numpy.ones", "cv2.line", "mmdet.core.utils.multi_apply", "numpy.random.choice", "numpy.stack", "torch.zeros_like", "torch.split", "mmdet.core.bbox.assign_and_sample", "numpy.random.permutation", "mmdet.core.bbox.PseudoSampler", "cv2.distanceTransform", "numpy...
[((2797, 3109), 'mmdet.core.utils.multi_apply', 'multi_apply', (['dense_reppoints_target_sinle', 'proposals_list', 'proposals_pts_list', 'num_level_proposals_list', 'valid_flag_list', 'gt_bboxes_list', 'gt_masks_list', 'gt_bboxes_ignore_list', 'gt_labels_list'], {'num_pts': 'num_pts', 'cfg': 'cfg', 'label_channels': 'l...
#from planenet code is adapted for planercnn code import cv2 import numpy as np WIDTH = 640 HEIGHT = 480 ALL_TITLES = ['PlaneNet'] ALL_METHODS = [('sample_np10_hybrid3_bl0_dl0_ds0_crfrnn5_sm0', '', 0, 2)] def predict3D(folder, index, image, depth, segmentation, planes, info): writePLYFile(folder, index, ima...
[ "numpy.stack", "numpy.full", "numpy.load", "numpy.minimum", "numpy.maximum", "numpy.deg2rad", "cv2.waitKey", "cv2.imwrite", "cv2.destroyAllWindows", "numpy.argmax", "cv2.imread", "numpy.linalg.norm", "numpy.array", "numpy.arange", "numpy.dot", "cv2.imshow", "cv2.resize" ]
[((995, 1043), 'cv2.imwrite', 'cv2.imwrite', (["(folder + '/' + imageFilename)", 'image'], {}), "(folder + '/' + imageFilename, image)\n", (1006, 1043), False, 'import cv2\n'), ((1695, 1722), 'numpy.stack', 'np.stack', (['[X, Y, Z]'], {'axis': '(2)'}), '([X, Y, Z], axis=2)\n', (1703, 1722), True, 'import numpy as np\n'...
from tqdm import tqdm import pandas as pd import numpy as np import sys from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.svm import LinearSVC from sklearn.model_selection import train_test_spl...
[ "numpy.isin", "sklearn.decomposition.FastICA", "sklearn.preprocessing.StandardScaler", "sklearn.feature_extraction.text.TfidfVectorizer", "pandas.read_csv", "numpy.arange", "numpy.array", "sklearn.decomposition.PCA", "numpy.random.shuffle" ]
[((1037, 1053), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (1051, 1053), False, 'from sklearn.preprocessing import StandardScaler\n'), ((1061, 1070), 'sklearn.decomposition.PCA', 'PCA', (['(0.99)'], {}), '(0.99)\n', (1064, 1070), False, 'from sklearn.decomposition import PCA\n'), ((2178...
from PIL import Image import numpy as np def getAreaAverage(arr, startRow, startCol): average = 0 for row in range(startRow, startRow + cell_size[0]): for col in range(startCol, startCol + cell_size[1]): n1 = int(arr[row][col][0]) n2 = int(arr[row][col][1]) n3 = int...
[ "PIL.Image.fromarray", "numpy.array", "PIL.Image.open" ]
[((1328, 1350), 'PIL.Image.open', 'Image.open', (['"""img2.jpg"""'], {}), "('img2.jpg')\n", (1338, 1350), False, 'from PIL import Image\n'), ((889, 902), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (897, 902), True, 'import numpy as np\n'), ((1276, 1296), 'PIL.Image.fromarray', 'Image.fromarray', (['arr'], {})...
import torch import torch.utils.data as data_utl from torch.utils.data.dataloader import default_collate from PIL import Image import numpy as np import json import csv import h5py import os import os.path import cv2 import pdb def video_to_tensor(pic): """Convert a ``numpy.ndarray`` to tensor. Converts a nu...
[ "json.load", "numpy.zeros", "os.path.join" ]
[((2219, 2231), 'json.load', 'json.load', (['f'], {}), '(f)\n', (2228, 2231), False, 'import json\n'), ((3331, 3383), 'numpy.zeros', 'np.zeros', (['[self.num_classes, num_frames]', 'np.float32'], {}), '([self.num_classes, num_frames], np.float32)\n', (3339, 3383), True, 'import numpy as np\n'), ((6177, 6189), 'json.loa...
"""Plot to test line styles""" import matplotlib.pyplot as plt import numpy as np import mpld3 def create_plot(): fig, ax = plt.subplots() np.random.seed(0) numPoints = 10 xx = np.arange(numPoints, dtype=float) xx[6] = np.nan yy = np.random.normal(size=numPoints) yy[3] = np.nan ax....
[ "numpy.random.seed", "mpld3.fig_to_html", "matplotlib.pyplot.close", "numpy.arange", "numpy.random.normal", "matplotlib.pyplot.subplots" ]
[((130, 144), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (142, 144), True, 'import matplotlib.pyplot as plt\n'), ((150, 167), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (164, 167), True, 'import numpy as np\n'), ((197, 230), 'numpy.arange', 'np.arange', (['numPoints'], {'dtype':...
import cv2 import numpy as np def answer1(x): if 0<=x<=90: ans ="a" if 90<x<=180: ans ="b" if 180<x<=270: ans ="c" if 270<x<=400: ans ="d" return ans def answer2(x): if 0<=x<=144: ans ="a" if 144<x<=216: ans ="b" ...
[ "numpy.uint8", "cv2.morphologyEx", "cv2.threshold", "cv2.moments", "numpy.zeros", "numpy.ones", "cv2.erode", "cv2.findContours" ]
[((727, 779), 'cv2.threshold', 'cv2.threshold', (['crop', '(220)', '(255)', 'cv2.THRESH_BINARY_INV'], {}), '(crop, 220, 255, cv2.THRESH_BINARY_INV)\n', (740, 779), False, 'import cv2\n'), ((932, 957), 'numpy.ones', 'np.ones', (['(5, 5)', 'np.uint8'], {}), '((5, 5), np.uint8)\n', (939, 957), True, 'import numpy as np\n'...
import numpy as np # import comet_ml in the top of your file from comet_ml import Experiment # Add the following code anywhere in your machine learning file experiment = Experiment(api_key="<KEY>") from keras.models import Model from keras.layers import Dense, Dropout, Activation, Flatten, BatchNormalization, Conv2D...
[ "numpy.load", "sklearn.model_selection.train_test_split", "keras.layers.Flatten", "keras.models.Model", "comet_ml.Experiment", "keras.layers.Dense", "numpy.array", "keras.layers.Conv2D", "keras.layers.Input" ]
[((172, 199), 'comet_ml.Experiment', 'Experiment', ([], {'api_key': '"""<KEY>"""'}), "(api_key='<KEY>')\n", (182, 199), False, 'from comet_ml import Experiment\n'), ((806, 821), 'numpy.array', 'np.array', (['new_X'], {}), '(new_X)\n', (814, 821), True, 'import numpy as np\n'), ((884, 921), 'sklearn.model_selection.trai...
import numpy as np import pandas as pd import os import faiss from .fast_similarity_matching import FSM from .utils import m_estimate, dim_estimate, apply_dim_reduct, apply_dim_reduct_inference, preprocess, evaluate_clusters from sklearn.metrics.pairwise import euclidean_distances, cosine_similarity from sklearn.metric...
[ "sklearn.preprocessing.StandardScaler", "numpy.nan_to_num", "numpy.sum", "sklearn.metrics.adjusted_mutual_info_score", "numpy.ones", "numpy.argsort", "numpy.linalg.norm", "numpy.exp", "sklearn.svm.SVC", "sklearn.metrics.adjusted_rand_score", "numpy.unique", "pandas.DataFrame", "faiss.Kmeans"...
[((591, 624), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (614, 624), False, 'import warnings\n'), ((2893, 2914), 'numpy.zeros', 'np.zeros', (['(1, cn + 2)'], {}), '((1, cn + 2))\n', (2901, 2914), True, 'import numpy as np\n'), ((2963, 2984), 'numpy.zeros', 'np.zeros', ...
import sys import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.tree import export_graphviz import pydot import json features = pd.read_csv("dataset2.csv") labels = np.array(features['hired']) features= features.dro...
[ "json.loads", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.ensemble.RandomForestRegressor", "numpy.array" ]
[((232, 259), 'pandas.read_csv', 'pd.read_csv', (['"""dataset2.csv"""'], {}), "('dataset2.csv')\n", (243, 259), True, 'import pandas as pd\n'), ((270, 297), 'numpy.array', 'np.array', (["features['hired']"], {}), "(features['hired'])\n", (278, 297), True, 'import numpy as np\n'), ((390, 408), 'numpy.array', 'np.array',...
""" Collection of I/O functions to post-process the numerical solution from a PetIBM simulation. """ import os import sys import struct import numpy sys.path.append(os.path.join(os.environ['PETSC_DIR'], 'bin')) import PetscBinaryIO # reduce is no longer a builtin in Python 3 # but has been added to the functools pac...
[ "os.makedirs", "numpy.logical_and", "os.getcwd", "os.path.isdir", "numpy.savetxt", "numpy.ones", "numpy.cumsum", "PetscBinaryIO.PetscBinaryIO", "numpy.loadtxt", "os.path.join", "os.listdir" ]
[((167, 211), 'os.path.join', 'os.path.join', (["os.environ['PETSC_DIR']", '"""bin"""'], {}), "(os.environ['PETSC_DIR'], 'bin')\n", (179, 211), False, 'import os\n'), ((986, 997), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (995, 997), False, 'import os\n'), ((1805, 1816), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1...
from pathlib import Path import os import json import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches import matplotlib from gym_recording_modified.playback import get_recordings import seaborn as sns from scipy.stats import sem def plot_timesteps(params: np.array, data: np.array, row...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.tight_layout", "matplotlib.rc", "matplotlib.pyplot.yscale", "numpy.ones", "numpy.hstack", "numpy.mean", "numpy.array", "scipy.stats.sem", "numpy.where", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotli...
[((1052, 1138), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': 'nrows', 'ncols': 'ncols', 'sharex': '(False)', 'sharey': '(False)', 'squeeze': '(False)'}), '(nrows=nrows, ncols=ncols, sharex=False, sharey=False, squeeze=\n False)\n', (1064, 1138), True, 'import matplotlib.pyplot as plt\n'), ((1172, 119...
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import json from traceback import format_exc import warnings _additional_convert = [] # Only add conversions if the modules exist. # This way, we do not add unnecessary dependencies try: import numpy as np...
[ "numpy.asscalar", "traceback.format_exc" ]
[((484, 500), 'numpy.asscalar', 'np.asscalar', (['obj'], {}), '(obj)\n', (495, 500), True, 'import numpy as np\n'), ((907, 919), 'traceback.format_exc', 'format_exc', ([], {}), '()\n', (917, 919), False, 'from traceback import format_exc\n')]
import json import numpy as np from keras import optimizers import keras_custom import netw_models def model_train(file_train, file_val, model_name='u_net_model', act_func='elu', regularizer='dropout', dropoutrate=0.1, weighted_loss=True, class_weights=[1, 1, 1], ...
[ "json.dump", "numpy.load", "keras_custom.plot_acc_loss", "netw_models.u_net_model", "keras_custom.custom_categorical_crossentropy", "keras.optimizers.RMSprop" ]
[((2532, 2584), 'netw_models.u_net_model', 'netw_models.u_net_model', (['*model_args'], {}), '(*model_args, **model_kwargs)\n', (2555, 2584), False, 'import netw_models\n'), ((3237, 3398), 'keras_custom.plot_acc_loss', 'keras_custom.plot_acc_loss', (["model_fit.history['acc']", "model_fit.history['val_acc']", "model_fi...
import json from collections import defaultdict import numpy as np from habitat import Env, logger from habitat.config.default import Config from habitat.core.agent import Agent from habitat.sims.habitat_simulator.actions import HabitatSimActions from tqdm import tqdm from robo_vln_baselines.common.continuous_path_fol...
[ "json.dump", "robo_vln_baselines.common.env_utils.construct_env", "json.load", "habitat.logger.info", "os.path.join", "gzip.open", "os.makedirs", "os.path.exists", "habitat.utils.visualizations.maps.colorize_draw_agent_and_fit_to_height", "habitat_sim.physics.VelocityControl", "random.random", ...
[((747, 824), 'habitat.utils.visualizations.maps.colorize_draw_agent_and_fit_to_height', 'maps.colorize_draw_agent_and_fit_to_height', (["info['top_down_map']", 'output_size'], {}), "(info['top_down_map'], output_size)\n", (789, 824), False, 'from habitat.utils.visualizations import maps\n'), ((962, 1003), 'habitat.uti...
#! /home/lyjslay/py3env/bin python # coding=utf-8 #================================================================ # Copyright (C) 2019 * Ltd. All rights reserved. # # File name : detector.py # Author : <NAME> # E-Mail : <EMAIL> # Description : Object detection based on deeplearning # #==========...
[ "cv2.putText", "cv2.waitKey", "tensorflow.Session", "cv2.imshow", "time.time", "cv2.VideoCapture", "tensorflow.ConfigProto", "numpy.where", "tensorflow.gfile.GFile", "numpy.array", "tensorflow.Graph", "cv2.rectangle", "tensorflow.import_graph_def", "tensorflow.GraphDef", "cv2.destroyAllW...
[((1982, 1995), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (1993, 1995), True, 'import tensorflow as tf\n'), ((2297, 2307), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2305, 2307), True, 'import tensorflow as tf\n'), ((2617, 2633), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (2631,...
# BSD 2-Clause License # Copyright (c) 2022, <NAME> # 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 must retain the above copyright notice, this # list of cond...
[ "numpy.array" ]
[((1907, 1928), 'numpy.array', 'numpy.array', (['msg.data'], {}), '(msg.data)\n', (1918, 1928), False, 'import numpy\n')]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 27 18:08:30 2020 @author: mohammad """ import numpy as np from tensorflow.keras.utils import to_categorical import tensorflow.keras from tensorflow.keras.optimizers import Adam import os from tensorflow.keras.callbacks import ModelCheckpoint from s...
[ "os.remove", "tensorflow.keras.utils.to_categorical", "functions.utils.aug_dataset", "os.path.realpath", "functions.utils.build_model", "tensorflow.keras.callbacks.ModelCheckpoint", "numpy.shape", "numpy.array", "sklearn.model_selection.StratifiedKFold", "functions.utils.read_test_data", "numpy....
[((460, 485), 'os.listdir', 'os.listdir', (['original_path'], {}), '(original_path)\n', (470, 485), False, 'import os\n'), ((400, 420), 'os.path.realpath', 'os.path.realpath', (['""""""'], {}), "('')\n", (416, 420), False, 'import os\n'), ((610, 637), 'os.remove', 'os.remove', (['"""results_ResNet"""'], {}), "('results...
import pandas as pd import numpy as np from keras import Input, layers, regularizers, losses from keras.models import Model from keras.optimizers import SGD, Adam from keras.callbacks import EarlyStopping import STRING from sklearn.feature_selection import VarianceThreshold from sklearn.model_selection import t...
[ "matplotlib.pyplot.title", "numpy.random.seed", "seaborn.heatmap", "sklearn.preprocessing.StandardScaler", "pandas.read_csv", "sklearn.model_selection.train_test_split", "keras.models.Model", "matplotlib.pyplot.figure", "keras.regularizers.l1", "os.chdir", "pandas.DataFrame", "sklearn.metrics....
[((5395, 5415), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (5409, 5415), True, 'import numpy as np\n'), ((5421, 5445), 'os.chdir', 'os.chdir', (['STRING.path_db'], {}), '(STRING.path_db)\n', (5429, 5445), False, 'import os\n'), ((5479, 5532), 'pandas.read_csv', 'pd.read_csv', (['"""normal.csv"""...
# import appropriate python modules to the program import numpy as np import cv2 from matplotlib import pyplot as plt import freenect # capturing video from Kinect Xbox 360 def get_video(): array, _ = freenect.sync_get_video() array = cv2.cvtColor(array, cv2.COLOR_RGB2BGR) return array # callback functi...
[ "cv2.getPerspectiveTransform", "cv2.solvePnP", "numpy.mean", "cv2.imshow", "cv2.warpPerspective", "cv2.cvtColor", "numpy.std", "cv2.BFMatcher", "cv2.setMouseCallback", "numpy.int32", "cv2.destroyAllWindows", "cv2.circle", "cv2.waitKey", "cv2.ORB_create", "cv2.putText", "numpy.float32",...
[((7035, 7114), 'numpy.array', 'np.array', (['[[514.04093664, 0.0, 320], [0.0, 514.87476583, 240], [0.0, 0.0, 1.0]]'], {}), '([[514.04093664, 0.0, 320], [0.0, 514.87476583, 240], [0.0, 0.0, 1.0]])\n', (7043, 7114), True, 'import numpy as np\n'), ((7136, 7221), 'numpy.array', 'np.array', (['[0.268661165, -1.31720458, -0...
# Copyright 2022 <NAME>, <NAME>, <NAME>. # Licensed under the BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause) # This file may not be copied, modified, or distributed # except according to those terms. import sys from collections import defaultdict, namedtuple from enum import Enum from itertools im...
[ "dnachisel.biotools.translate", "pysam.FastaFile", "dnachisel.biotools.get_backtranslation_table", "pysam.VariantFile", "collections.defaultdict", "numpy.array", "requests.get", "pysam.VariantHeader", "itertools.product", "gffutils.create_db", "numpy.unique" ]
[((765, 802), 'dnachisel.biotools.get_backtranslation_table', 'get_backtranslation_table', (['"""Standard"""'], {}), "('Standard')\n", (790, 802), False, 'from dnachisel.biotools import get_backtranslation_table, translate\n'), ((809, 872), 'gffutils.create_db', 'gffutils.create_db', (['snakemake.input.annotation'], {'...
#!/usr/bin/python # -*- coding: UTF-8 -*- import numpy as np class Normalizer: """ MLP 相关的数据标准化器(归一化) 标准化处理对于计算距离的机器学习方法是非常重要的,因为特征的尺度不同会导致计算出来的距离倾向于尺度大的特征, 为保证距离对每一列特征都是公平的,必须将所有特征缩放到同一尺度范围内 Author: xrh Date: 2021-07-10 """ @staticmethod def tow_norm_normalize(X): """ ...
[ "numpy.std", "numpy.max", "numpy.mean", "numpy.linalg.norm", "numpy.min" ]
[((559, 606), 'numpy.linalg.norm', 'np.linalg.norm', (['X'], {'ord': '(2)', 'axis': '(1)', 'keepdims': '(True)'}), '(X, ord=2, axis=1, keepdims=True)\n', (573, 606), True, 'import numpy as np\n'), ((1041, 1059), 'numpy.mean', 'np.mean', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (1048, 1059), True, 'import numpy as np\...
''' Calculates LSF, instrument background and transmission ''' import logging import numpy as np from scipy.interpolate import interp1d, interp2d import scipy.constants as sp from astropy.convolution import Gaussian1DKernel from astropy.io import fits from src.config import * from src.modules.misc_utils import path_s...
[ "numpy.zeros_like", "logging.debug", "numpy.ones_like", "numpy.sum", "numpy.copy", "logging.warning", "numpy.median", "numpy.convolve", "numpy.savetxt", "logging.info", "scipy.interpolate.interp2d", "numpy.linspace", "astropy.convolution.Gaussian1DKernel", "scipy.interpolate.interp1d", "...
[((371, 433), 'src.modules.misc_utils.path_setup', 'path_setup', (["('../../' + config_data['data_dir'] + 'throughput/')"], {}), "('../../' + config_data['data_dir'] + 'throughput/')\n", (381, 433), False, 'from src.modules.misc_utils import path_setup\n'), ((444, 498), 'src.modules.misc_utils.path_setup', 'path_setup'...
''' figures.py ========================= AIM: Provide several specific functions to save beautiful figures INPUT: function depend OUTPUT: function depend CMD: To include: import resources.figures as figures ISSUES: <none known> REQUIRES: standard python libraries, specific libraries in resources/ REMARKS: in gene...
[ "matplotlib.rc", "numpy.vectorize", "subprocess.check_output", "datetime.date.today", "os.system", "time.strftime", "numpy.log10" ]
[((1313, 1329), 'numpy.vectorize', 'np.vectorize', (['cd'], {}), '(cd)\n', (1325, 1329), True, 'import numpy as np\n'), ((935, 1003), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'serif', 'serif': ['Palatino'], 'size': 16})\n", (937, 1003), False, 'from matplotlib import rc\n'), ((999, 1022), 'ma...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import tools as tls X = np.loadtxt('X14_SIM.txt', delimiter=',') Y = np.loadtxt('Y14_SIM.txt', delimiter=',') Z = np.loadtxt('Z14_SIM.txt', delimiter=',') dx_vector = np.zeros( (1,) ) dz_vector = np.zeros( (1,) ) radius_vect...
[ "numpy.zeros", "numpy.max", "numpy.min", "numpy.loadtxt", "tools.maxpointsXYZ" ]
[((117, 157), 'numpy.loadtxt', 'np.loadtxt', (['"""X14_SIM.txt"""'], {'delimiter': '""","""'}), "('X14_SIM.txt', delimiter=',')\n", (127, 157), True, 'import numpy as np\n'), ((162, 202), 'numpy.loadtxt', 'np.loadtxt', (['"""Y14_SIM.txt"""'], {'delimiter': '""","""'}), "('Y14_SIM.txt', delimiter=',')\n", (172, 202), Tr...
import numpy as np class Detection(object): def __init__(self): self.img = None self.bbox = None self.XZ = None self.fvec = np.array([1, 2, 3, 4], np.float64) # init in case not needed self.frame_id = None self.num_misses = 0 self.has_match = False ...
[ "numpy.array", "numpy.hstack" ]
[((162, 196), 'numpy.array', 'np.array', (['[1, 2, 3, 4]', 'np.float64'], {}), '([1, 2, 3, 4], np.float64)\n', (170, 196), True, 'import numpy as np\n'), ((663, 739), 'numpy.hstack', 'np.hstack', (['(self.frame_id, self.bbox, self.det_class, self.score, self.fvec)'], {}), '((self.frame_id, self.bbox, self.det_class, se...
import pytest import fenicsmechanics as fm problem_classes = ("MechanicsProblem", "SolidMechanicsProblem", "FluidMechanicsProblem") _EXPRESSIONS = { 'body_force': ["np.log(1.0 + t)", "np.exp(t)", "1.0 - t"], 'displacement': ["1.0 + 2.0*t", "3.0*t", "1.0"], 'velocity'...
[ "sys.path.append", "numpy.zeros", "numpy.ones", "dolfin.Expression", "numpy.arange", "numpy.array", "pytest.mark.parametrize", "re.sub", "numpy.all" ]
[((464, 1347), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""class_name, field_name"""', "(('MechanicsProblem', 'formulation/body_force'), ('MechanicsProblem',\n 'formulation/bcs/dirichlet/displacement'), ('MechanicsProblem',\n 'formulation/bcs/dirichlet/velocity'), ('MechanicsProblem',\n 'formul...
""" Classes and functions for element-level operations """ import numpy as np import h5py import astropy.units as u import plasmapy import fiasco __all__ = ['Element'] class Element(fiasco.IonCollection): """ Object containing all ions for a particular element. The Element object provides a way to logi...
[ "astropy.units.Quantity", "plasmapy.atomic.element_name", "numpy.sum", "fiasco.Ion", "plasmapy.atomic.atomic_symbol", "plasmapy.atomic.atomic_number", "numpy.zeros", "numpy.linalg.svd", "numpy.fabs" ]
[((1174, 1217), 'plasmapy.atomic.atomic_symbol', 'plasmapy.atomic.atomic_symbol', (['element_name'], {}), '(element_name)\n', (1203, 1217), False, 'import plasmapy\n'), ((1247, 1290), 'plasmapy.atomic.atomic_number', 'plasmapy.atomic.atomic_number', (['element_name'], {}), '(element_name)\n', (1276, 1290), False, 'impo...
#! /usr/bin/env python3 """ monte-carlo-liquid.py This script runs the Monte Carlo uncertainty analysis for a liquid fuel in the University of Connecticut RCM. This script is associated with the work "On the Uncertainty of Temperature Estimation in a Rapid Compression Machine" by <NAME>, <NAME>, and <NAME>, Combustion...
[ "itertools.repeat", "scipy.stats.norm", "numpy.random.random_sample", "numpy.polyfit", "numpy.append", "numpy.histogram", "numpy.arange", "numpy.exp", "cantera.Solution", "multiprocessing.Pool", "sys.exit", "scipy.special.lambertw" ]
[((849, 860), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (857, 860), False, 'import sys\n'), ((1550, 1579), 'cantera.Solution', 'ct.Solution', (['"""therm-data.xml"""'], {}), "('therm-data.xml')\n", (1561, 1579), True, 'import cantera as ct\n'), ((1900, 1934), 'scipy.stats.norm', 'norm_dist', ([], {'loc': 'T_a', '...
import sys import os import time import numpy as np import torch from tqdm import tqdm from torch.utils import data from pytorch_pretrained_bert.modeling import BertForTokenClassification from pytorch_pretrained_bert.optimization import BertAdam from pytorch_pretrained_bert.tokenization import BertTokenizer from NER_...
[ "torch.masked_select", "numpy.random.seed", "pytorch_pretrained_bert.optimization.BertAdam", "pytorch_pretrained_bert.tokenization.BertTokenizer.from_pretrained", "NER_src.NER_utils.evaluate", "NER_src.NER_utils.write_test", "NER_src.NER_dataset.CoNLLDataProcessor", "NER_src.NER_dataset.NerDataset", ...
[((517, 550), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (540, 550), False, 'import warnings\n'), ((1155, 1173), 'numpy.random.seed', 'np.random.seed', (['(44)'], {}), '(44)\n', (1169, 1173), True, 'import numpy as np\n'), ((1174, 1195), 'torch.manual_seed', 'torch.man...
import copy import functools import os import blobfile as bf import torch as th import torch.distributed as dist from guided_diffusion.two_parts_model import TwoPartsUNetModel from torch.nn.parallel.distributed import DistributedDataParallel as DDP from torch.optim import AdamW from torchvision.utils import make_grid ...
[ "wandb.log", "numpy.empty", "torch.optim.AdamW", "torch.cat", "numpy.mean", "torch.distributed.get_world_size", "torch.no_grad", "os.path.join", "guided_diffusion.dist_util.sync_params", "torch.distributed.get_rank", "numpy.histogram2d", "matplotlib.pyplot.imshow", "os.uname", "guided_diff...
[((16168, 16180), 'torch.no_grad', 'th.no_grad', ([], {}), '()\n', (16178, 16180), True, 'import torch as th\n'), ((17921, 17933), 'torch.no_grad', 'th.no_grad', ([], {}), '()\n', (17931, 17933), True, 'import torch as th\n'), ((21159, 21171), 'torch.no_grad', 'th.no_grad', ([], {}), '()\n', (21169, 21171), True, 'impo...
from typing import Iterable import numpy as np from pynwb.misc import Units import ipywidgets as widgets from .misc import RasterWidget, PSTHWidget, RasterGridWidget from .view import default_neurodata_vis_spec from .utils.pynwb import robust_unique from .controllers import GroupAndSortController class AllenRaster...
[ "numpy.where", "numpy.unique", "numpy.argmax" ]
[((1268, 1340), 'numpy.where', 'np.where', (["(self.trials['stimulus_name'][:] != self.stimulus_type_dd.value)"], {}), "(self.trials['stimulus_name'][:] != self.stimulus_type_dd.value)\n", (1276, 1340), True, 'import numpy as np\n'), ((1417, 1481), 'numpy.where', 'np.where', (["(self.trials['stimulus_name'][:] != 'drif...
import copy import math import logging import numpy as np import matplotlib.pyplot as plt from abc import ABCMeta, abstractmethod #from neupy.algorithms import GRNN as grnn from sklearn.neural_network import MLPRegressor as mlpr from sklearn.linear_model import LinearRegression from sklearn.cluster import KMeans as KM...
[ "tensorflow.reduce_sum", "numpy.ones", "numpy.shape", "tensorflow.matmul", "numpy.mean", "numpy.linalg.norm", "logging.error", "neupy.algorithms.GRNN", "logging.warning", "numpy.std", "sklearn.cluster.KMeans", "tensorflow.cast", "tensorflow.placeholder", "tensorflow.initialize_all_variable...
[((416, 462), 'logging.warning', 'logging.warning', (['"""Could not import tensorflow"""'], {}), "('Could not import tensorflow')\n", (431, 462), False, 'import logging\n'), ((4642, 4774), 'sklearn.neural_network.MLPRegressor', 'mlpr', ([], {'solver': '"""lbfgs"""', 'hidden_layer_sizes': 'self._hidden_layers', 'activat...
# -*- coding: utf-8 -*- ################################################################# # File : camera_compare.py # Version : 0.0.1 # Author : sebi06 # Date : 21.10.2021 # # # This code probably does not reflect the latest new technologies # of microscope cameras anymore but is hopefully stil...
[ "PyQt5.QtGui.QColor", "PyQt5.uic.loadUi", "numpy.array", "numpy.arange", "PyQt5.QtWidgets.QApplication", "numpy.round", "numpy.sqrt" ]
[((21315, 21351), 'numpy.arange', 'np.arange', (['(0)', '(500)', '(1)'], {'dtype': 'np.int16'}), '(0, 500, 1, dtype=np.int16)\n', (21324, 21351), True, 'import numpy as np\n'), ((22396, 22435), 'numpy.array', 'np.array', (["[cp1['flux'], cp1['flux'], 0]"], {}), "([cp1['flux'], cp1['flux'], 0])\n", (22404, 22435), True,...
from django.shortcuts import render, redirect from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from .form import ImageForm , CreateUserForm from .models import * from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.decorators import login_required fro...
[ "numpy.argmax", "django.contrib.messages.error", "django.contrib.messages.info", "django.contrib.auth.login", "django.contrib.auth.decorators.login_required", "json.loads", "django.http.HttpResponse", "django.utils.timezone.now", "tensorflow.compat.v1.Session", "django.contrib.auth.logout", "ten...
[((791, 817), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {}), '()\n', (815, 817), True, 'import tensorflow as tf\n'), ((962, 979), 'json.loads', 'json.loads', (['label'], {}), '(label)\n', (972, 979), False, 'import json\n'), ((993, 1000), 'tensorflow.Graph', 'Graph', ([], {}), '()\n', (998, 1...
from pydex.core.designer import Designer import numpy as np def simulate(ti_controls, model_parameters): return np.array([ model_parameters[0] + model_parameters[1] * np.exp(model_parameters[2] * ti_controls[0]) + model_parameters[3] * np.exp(model_parameters[4] * ti_controls[1]) ]) d...
[ "numpy.array", "numpy.exp", "pydex.core.designer.Designer" ]
[((330, 340), 'pydex.core.designer.Designer', 'Designer', ([], {}), '()\n', (338, 340), False, 'from pydex.core.designer import Designer\n'), ((589, 615), 'numpy.array', 'np.array', (['[1, 2, 2, 10, 2]'], {}), '([1, 2, 2, 10, 2])\n', (597, 615), True, 'import numpy as np\n'), ((266, 310), 'numpy.exp', 'np.exp', (['(mod...
""" Converts Aviv.dat files into numpy files for NRC capped homopolymer repeats. """ import numpy as np import pandas as pd import ntpath # Good for path manipulations on a PC? import glob # Allows for unix-like specifications paths, using *, ?, etc. import os import json import time start = time.time() PATH = os....
[ "pandas.DataFrame", "json.dump", "os.path.abspath", "ntpath.basename", "time.time", "numpy.array", "os.path.join" ]
[((297, 308), 'time.time', 'time.time', ([], {}), '()\n', (306, 308), False, 'import time\n'), ((376, 406), 'os.path.join', 'os.path.join', (['PATH', '"""NRC_data"""'], {}), "(PATH, 'NRC_data')\n", (388, 406), False, 'import os\n'), ((711, 781), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['denat', 'signal', ...
import pandas import PIL.Image from cStringIO import StringIO import IPython.display import numpy as np import trace.common as com import trace.sampling as samp import trace.train as train import trace.train.hooks as hooks import trace.evaluation as eva def showarray(a, fmt='png'): a = np.uint8(a) f = StringI...
[ "numpy.absolute", "numpy.uint8", "trace.train.hooks.LossHook", "numpy.asarray", "trace.evaluation.rand_error_from_prediction", "trace.train.hooks.ValidationHook", "trace.train.hooks.ImageVisualizationHook", "trace.train.Learner", "cStringIO.StringIO", "trace.sampling.EMDatasetSampler", "numpy.ro...
[((293, 304), 'numpy.uint8', 'np.uint8', (['a'], {}), '(a)\n', (301, 304), True, 'import numpy as np\n'), ((313, 323), 'cStringIO.StringIO', 'StringIO', ([], {}), '()\n', (321, 323), False, 'from cStringIO import StringIO\n'), ((936, 951), 'numpy.round', 'np.round', (['preds'], {}), '(preds)\n', (944, 951), True, 'impo...
# -*- coding: utf-8 -*- import pandas as pd import matplotlib as mpl from sklearn.ensemble import RandomForestRegressor from sklearn import metrics from sklearn.metrics import accuracy_score from merf.utils import MERFDataGenerator from merf.merf import MERF from merf.viz import plot_merf_training_stats from sklearn.me...
[ "sklearn.ensemble.RandomForestClassifier", "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "merf.viz.plot_merf_training_stats", "matplotlib.pyplot.show", "merf.merf.MERF", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "numpy.std", "sklearn....
[((576, 592), 'sklearn.preprocessing.OrdinalEncoder', 'OrdinalEncoder', ([], {}), '()\n', (590, 592), False, 'from sklearn.preprocessing import OrdinalEncoder\n'), ((740, 761), 'pandas.read_csv', 'pd.read_csv', (['fip_data'], {}), '(fip_data)\n', (751, 761), True, 'import pandas as pd\n'), ((1690, 1786), 'sklearn.model...
from collections import namedtuple import numpy as np import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch import Tensor from .base import VariationalParameters class DiagonalGaussianVariationalParameters(VariationalParameters): """ diag Gaussian distribution. mean...
[ "torch.stack", "torch.randn_like", "numpy.log", "torch.exp", "torch.Tensor", "torch.empty_like", "collections.namedtuple", "torch.arange", "torch.pow", "torch.no_grad", "torch.sum", "torch.tensor" ]
[((402, 475), 'collections.namedtuple', 'namedtuple', (['"""DiagonalGaussianVariationalParameter"""', "['mean', 'diag_lstd']"], {}), "('DiagonalGaussianVariationalParameter', ['mean', 'diag_lstd'])\n", (412, 475), False, 'from collections import namedtuple\n'), ((2183, 2223), 'torch.tensor', 'torch.tensor', (['[1, -1]'...
import matplotlib.pyplot as plt import numpy as np import scipy.spatial.distance as distance class Point(object): def __init__(self, data=None, weights=None): self.pt = None if data is not None: self.fit(data, weights=weights) @property def min_sample_size(self): retur...
[ "scipy.spatial.distance.cdist", "matplotlib.pyplot.scatter", "numpy.count_nonzero", "numpy.average" ]
[((772, 813), 'numpy.average', 'np.average', (['data'], {'weights': 'weights', 'axis': '(0)'}), '(data, weights=weights, axis=0)\n', (782, 813), True, 'import numpy as np\n'), ((1036, 1081), 'matplotlib.pyplot.scatter', 'plt.scatter', (['self.pt[0]', 'self.pt[1]'], {}), '(self.pt[0], self.pt[1], **kwargs)\n', (1047, 10...
#!/usr/bin/python3.6 import sys import json import numpy as np import math problem_instance_file = sys.argv[1] D = np.genfromtxt (problem_instance_file, delimiter=",") # Now compute our solution import pyrankability search = pyrankability.exact.ExhaustiveSearch(D) search.find_P() print(pyrankability.common.as_json...
[ "pyrankability.exact.ExhaustiveSearch", "numpy.genfromtxt", "pyrankability.common.as_json" ]
[((117, 168), 'numpy.genfromtxt', 'np.genfromtxt', (['problem_instance_file'], {'delimiter': '""","""'}), "(problem_instance_file, delimiter=',')\n", (130, 168), True, 'import numpy as np\n'), ((229, 268), 'pyrankability.exact.ExhaustiveSearch', 'pyrankability.exact.ExhaustiveSearch', (['D'], {}), '(D)\n', (265, 268), ...
import contextlib import functools import hashlib import json import random import flowws from flowws import Argument as Arg import keras_gtar import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import backend as K try: import tensorflow_addons as tfa except ImportError: ...
[ "flowws.Argument", "functools.partial", "tensorflow.keras.backend.sum", "tensorflow.keras.backend.square", "tensorflow.keras.backend.softmax", "numpy.roll", "tensorflow.keras.callbacks.ReduceLROnPlateau", "keras_gtar.GTARLogger", "tensorflow.keras.models.clone_model", "contextlib.ExitStack", "te...
[((411, 471), 'flowws.Argument', 'Arg', (['"""optimizer"""', '"""-o"""', 'str', '"""adam"""'], {'help': '"""optimizer to use"""'}), "('optimizer', '-o', str, 'adam', help='optimizer to use')\n", (414, 471), True, 'from flowws import Argument as Arg\n'), ((492, 551), 'flowws.Argument', 'Arg', (['"""epochs"""', '"""-e"""...