code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" A group of spiking neurons with noise `~U(0, potential_noise_scale)` is added to `n_neurons * prob_rand_fire` neurons at each step. Each spiking neuron has an internal membrane potential that increases with each incoming spike. The potential persists but slowly decreases over time. Each neuron fires when its poten...
[ "numpy.int_", "numpy.random.uniform", "spikey.module.Key" ]
[((3757, 3828), 'numpy.random.uniform', 'np.random.uniform', (['(0)', 'self._potential_noise_scale'], {'size': 'self._n_neurons'}), '(0, self._potential_noise_scale, size=self._n_neurons)\n', (3774, 3828), True, 'import numpy as np\n'), ((2339, 2417), 'spikey.module.Key', 'Key', (['"""potential_noise_scale"""', '"""Mul...
from skimage import color import numpy as np from matplotlib import pyplot as plt def plot_cielab(l): min_range = -110 max_range = 110 ab_range = np.linspace(min_range, max_range, 500) b, a = np.meshgrid(ab_range, ab_range) color_cielab = np.array([np.ones(a.shape) * l, a, b]).T color_rgb = co...
[ "numpy.meshgrid", "numpy.ones", "numpy.any", "skimage.color.lab2rgb", "numpy.sin", "numpy.arange", "numpy.array", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.subplots" ]
[((159, 197), 'numpy.linspace', 'np.linspace', (['min_range', 'max_range', '(500)'], {}), '(min_range, max_range, 500)\n', (170, 197), True, 'import numpy as np\n'), ((210, 241), 'numpy.meshgrid', 'np.meshgrid', (['ab_range', 'ab_range'], {}), '(ab_range, ab_range)\n', (221, 241), True, 'import numpy as np\n'), ((318, ...
from Statistics.Mean import mean from numpy import absolute, asarray def var(data): x = (absolute(asarray(data) - mean(data))) y = x **2 z = mean(y) return round(z, 13) # variance is the square of mean deviation
[ "Statistics.Mean.mean", "numpy.asarray" ]
[((155, 162), 'Statistics.Mean.mean', 'mean', (['y'], {}), '(y)\n', (159, 162), False, 'from Statistics.Mean import mean\n'), ((104, 117), 'numpy.asarray', 'asarray', (['data'], {}), '(data)\n', (111, 117), False, 'from numpy import absolute, asarray\n'), ((120, 130), 'Statistics.Mean.mean', 'mean', (['data'], {}), '(d...
""" Matrix related utility functions """ #*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains cert...
[ "numpy.linalg.eigvals", "numpy.sum", "numpy.diag_indices_from", "numpy.abs", "scipy.sparse.issparse", "numpy.empty", "numpy.allclose", "pygsti.tools.basistools.change_basis", "numpy.imag", "numpy.linalg.svd", "numpy.linalg.norm", "numpy.isclose", "scipy.sparse.linalg._expm_multiply.LazyOpera...
[((2965, 2987), 'numpy.linalg.eigvals', '_np.linalg.eigvals', (['mx'], {}), '(mx)\n', (2983, 2987), True, 'import numpy as _np\n'), ((4368, 4384), 'numpy.sum', '_np.sum', (['(ar ** 2)'], {}), '(ar ** 2)\n', (4375, 4384), True, 'import numpy as _np\n'), ((4800, 4817), 'numpy.linalg.svd', '_np.linalg.svd', (['m'], {}), '...
''' Created on Jun 27, 2016 @author: rajajosh ''' import numpy from scipy.spatial.distance import euclidean class KNNClassifier(object): "K-Nearest Neighbors classifier class" len=0 x_train=[] y_train=[] kVal=1 clusters = set() def __init__(self): ''' Const...
[ "numpy.asarray", "scipy.spatial.distance.euclidean" ]
[((1417, 1438), 'numpy.asarray', 'numpy.asarray', (['retArr'], {}), '(retArr)\n', (1430, 1438), False, 'import numpy\n'), ((883, 919), 'scipy.spatial.distance.euclidean', 'euclidean', (['testData', 'self.x_train[i]'], {}), '(testData, self.x_train[i])\n', (892, 919), False, 'from scipy.spatial.distance import euclidean...
import os import argparse import base64 import warnings from multiprocessing import Pool import shutil import zlib import numpy as np import cv2 import h5py from tqdm import tqdm def encode_single(info): source_path, target_path, video, video_index, num_videos, delete = info print('Encoding {} / {} file.'.fo...
[ "os.mkdir", "tqdm.tqdm", "numpy.void", "argparse.ArgumentParser", "os.path.exists", "multiprocessing.Pool", "os.path.split", "os.path.join", "os.listdir" ]
[((942, 973), 'os.path.exists', 'os.path.exists', (['opt.source_path'], {}), '(opt.source_path)\n', (956, 973), False, 'import os\n'), ((1066, 1093), 'os.listdir', 'os.listdir', (['opt.source_path'], {}), '(opt.source_path)\n', (1076, 1093), False, 'import os\n'), ((2466, 2497), 'os.path.exists', 'os.path.exists', (['o...
import math import operator import numpy as np def _convert_to_float(fl): """ This method converts ONLY the numeric values of a string into floats """ try: return float(fl) except (ValueError, TypeError): return fl def _wrap_to_pi(angle): """ This method wrap the input angle to 360 [...
[ "operator.itemgetter", "numpy.array", "numpy.sign", "numpy.deg2rad" ]
[((835, 1029), 'numpy.array', 'np.array', (['[-x1 * x0 - y1 * y0 - z1 * z0 + w1 * w0, x1 * w0 + y1 * z0 - z1 * y0 + w1 *\n x0, -x1 * z0 + y1 * w0 + z1 * x0 + w1 * y0, x1 * y0 - y1 * x0 + z1 * w0 +\n w1 * z0]'], {'dtype': 'np.float64'}), '([-x1 * x0 - y1 * y0 - z1 * z0 + w1 * w0, x1 * w0 + y1 * z0 - z1 *\n y0 +...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Provide some reward processors. It processes the rewards before returning them; this can be useful to standardize, normalize, center them for instance. """ import numpy as np from pyrobolearn.rewards.reward import Reward __author__ = "<NAME>" __copyright__ = "Copyrig...
[ "numpy.random.uniform", "numpy.minimum", "numpy.maximum", "numpy.clip", "numpy.sqrt" ]
[((1534, 1590), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': 'self.range[0]', 'high': 'self.range[1]'}), '(low=self.range[0], high=self.range[1])\n', (1551, 1590), True, 'import numpy as np\n'), ((3361, 3397), 'numpy.clip', 'np.clip', (['reward', 'self.low', 'self.high'], {}), '(reward, self.low, self.high...
from __future__ import print_function import threading import math from numpy import sign, clip import rospy from geometry_msgs.msg import Twist from nav_msgs.msg import Odometry from b2_logic.odometry_helpers import heading_from_odometry, normalize_theta, calc_steering_angle # Mode enum MODE_FORWARD = 0 MODE_OBSTAC...
[ "rospy.logwarn", "b2_logic.odometry_helpers.heading_from_odometry", "rospy.logerr", "nav_msgs.msg.Odometry", "b2_logic.odometry_helpers.calc_steering_angle", "b2_logic.odometry_helpers.normalize_theta", "threading.RLock", "geometry_msgs.msg.Twist", "rospy.Rate", "numpy.clip", "rospy.is_shutdown"...
[((994, 1004), 'nav_msgs.msg.Odometry', 'Odometry', ([], {}), '()\n', (1002, 1004), False, 'from nav_msgs.msg import Odometry\n'), ((1032, 1049), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (1047, 1049), False, 'import threading\n'), ((1480, 1504), 'rospy.Rate', 'rospy.Rate', (['self._loophz'], {}), '(self....
import matplotlib.pyplot as plt import matplotlib.patches as patches import matplotlib.gridspec as gridspec import numpy as np def isSampleFree(sample, obs, dimW): for o in range(0, obs.shape[0] // (2 * dimW)): isFree = 0 for d in range(0, sample.shape[0]): if (sample[d] < obs[2 * dimW...
[ "matplotlib.pyplot.show", "matplotlib.patches.Rectangle", "matplotlib.pyplot.scatter", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.linspace", "numpy.concatenate" ]
[((1127, 1192), 'numpy.concatenate', 'np.concatenate', (['(obs1, obs2, obs3, obs4, obs5, obsBounds)'], {'axis': '(0)'}), '((obs1, obs2, obs3, obs4, obs5, obsBounds), axis=0)\n', (1141, 1192), True, 'import numpy as np\n'), ((1264, 1295), 'numpy.linspace', 'np.linspace', (['(0)', '(1)'], {'num': 'gridSize'}), '(0, 1, nu...
import numpy as np import pandas as pd import os from psrqpy import QueryATNF from utmost_psr import utils, plot def UTMOST_NS_module_params(): """ System parameters for a single UTMOST-2D North-South module. output: ------- UTMOST_NS_module: dict Dictionary containing module parameters (...
[ "numpy.cos", "numpy.sqrt" ]
[((1611, 1644), 'numpy.sqrt', 'np.sqrt', (['((period - width) / width)'], {}), '((period - width) / width)\n', (1618, 1644), True, 'import numpy as np\n'), ((2264, 2309), 'numpy.cos', 'np.cos', (['((psr_DECJ - Latitude) * np.pi / 180.0)'], {}), '((psr_DECJ - Latitude) * np.pi / 180.0)\n', (2270, 2309), True, 'import nu...
#/usr/bin/python3 #-*- encoding=utf-8 -*- from pathlib import Path import random import numpy as np import cv2 from cv2 import cv2 as cv from keras.utils import Sequence import os def readTxt(txtpath): filelist = [] with open(txtpath, 'r') as f: for line in f.readlines(): filelist.append(...
[ "os.path.basename", "os.popen", "numpy.zeros", "random.choice", "os.path.exists", "numpy.expand_dims", "cv2.imread", "numpy.random.randint", "cv2.resize" ]
[((1788, 1853), 'numpy.zeros', 'np.zeros', (['(batch_size, image_size, image_size, 3)'], {'dtype': 'np.uint8'}), '((batch_size, image_size, image_size, 3), dtype=np.uint8)\n', (1796, 1853), True, 'import numpy as np\n'), ((1866, 1931), 'numpy.zeros', 'np.zeros', (['(batch_size, image_size, image_size, 3)'], {'dtype': '...
import sys import os import math import cv2 import numpy as np import pandas as pd from skimage import io from PIL import Image from sklearn.model_selection import train_test_split from skimage.color import gray2rgb import torch from torch.utils.data.sampler import SubsetRandomSampler from torch.utils.data import Data...
[ "sys.path.append", "pandas.read_csv", "sklearn.model_selection.train_test_split", "numpy.array", "numpy.loadtxt", "skimage.color.gray2rgb", "os.path.join", "os.listdir", "skimage.io.imread" ]
[((379, 401), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (394, 401), False, 'import sys\n'), ((630, 698), 'os.path.join', 'os.path.join', (["cfg['root']", '"""RAF-Face"""', "('%s/Annotation/manual' % type)"], {}), "(cfg['root'], 'RAF-Face', '%s/Annotation/manual' % type)\n", (642, 698), Fal...
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " import time import numpy as np from mpi4py import MPI from nest_elephant_tvb.translation.s...
[ "numpy.sum", "nest_elephant_tvb.translation.science_tvb_to_nest.generate_data", "mpi4py.MPI.Win.Allocate_shared", "mpi4py.MPI.Status", "numpy.empty", "time.sleep", "mpi4py.MPI.DOUBLE.Get_size", "mpi4py.MPI.Request.Waitall", "numpy.ndarray", "numpy.concatenate" ]
[((1502, 1571), 'nest_elephant_tvb.translation.science_tvb_to_nest.generate_data', 'generate_data', (["(path_config + '/../../log/')", 'nb_spike_generator', 'param'], {}), "(path_config + '/../../log/', nb_spike_generator, param)\n", (1515, 1571), False, 'from nest_elephant_tvb.translation.science_tvb_to_nest import ge...
# Copyright (c) 2018-2019, NVIDIA CORPORATION. import numpy as np import pytest from utils import assert_eq import nvcategory import nvstrings def test_size(): strs = nvstrings.to_device( ["eee", "aaa", "eee", "ddd", "ccc", "ccc", "ccc", "eee", "aaa"] ) cat = nvcategory.from_strings(strs) as...
[ "utils.assert_eq", "nvcategory.to_device", "pytest.raises", "numpy.array", "nvcategory.from_strings", "nvcategory.from_strings_list", "nvstrings.to_device", "nvcategory.from_offsets" ]
[((175, 263), 'nvstrings.to_device', 'nvstrings.to_device', (["['eee', 'aaa', 'eee', 'ddd', 'ccc', 'ccc', 'ccc', 'eee', 'aaa']"], {}), "(['eee', 'aaa', 'eee', 'ddd', 'ccc', 'ccc', 'ccc', 'eee',\n 'aaa'])\n", (194, 263), False, 'import nvstrings\n'), ((284, 313), 'nvcategory.from_strings', 'nvcategory.from_strings', ...
""" Object to perform analysis and plotting on a given dataset Methods for the measurement control software to anaylse and plot data @author: krolljg """ import matplotlib.pyplot as plt import numpy as np import colorsys import qcodes #from qcodes import Instrument # consider making a qcodes instrument in the future...
[ "numpy.abs", "numpy.argmax", "numpy.polyfit", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.round", "matplotlib.pyplot.tight_layout", "numpy.transpose", "numpy.linspace", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.asarray", "numpy.isinf", "scipy.optimize.curve_fit", ...
[((2870, 2882), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2880, 2882), True, 'import matplotlib.pyplot as plt\n'), ((7099, 7134), 'numpy.polyfit', 'np.polyfit', (['self.xvar', 'self.yvar', '(1)'], {}), '(self.xvar, self.yvar, 1)\n', (7109, 7134), True, 'import numpy as np\n'), ((7151, 7196), 'numpy.l...
import numpy as np import matplotlib.pyplot as pl import h5py import platform import os import pickle import scipy.io as io import seaborn as sns from keras.models import model_from_json import json from ipdb import set_trace as stop class plot_map(object): def __init__(self, root): self.root = root ...
[ "matplotlib.pyplot.tight_layout", "h5py.File", "numpy.atleast_3d", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.close", "numpy.zeros", "numpy.max", "keras.models.model_from_json", "numpy.min", "numpy.mean", "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((504, 533), 'h5py.File', 'h5py.File', (['self.dataFile', '"""r"""'], {}), "(self.dataFile, 'r')\n", (513, 533), False, 'import h5py\n'), ((611, 636), 'numpy.min', 'np.min', (['self.pars'], {'axis': '(0)'}), '(self.pars, axis=0)\n', (617, 636), True, 'import numpy as np\n'), ((658, 683), 'numpy.max', 'np.max', (['self...
# Copyright 2018 <NAME> <<EMAIL>> # # 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 l...
[ "serial.Serial", "numpy.array" ]
[((4568, 4586), 'numpy.array', 'np.array', (['measures'], {}), '(measures)\n', (4576, 4586), True, 'import numpy as np\n'), ((1144, 1284), 'serial.Serial', 'serial.Serial', (['self._port'], {'baudrate': '(9600)', 'bytesize': 'serial.EIGHTBITS', 'parity': 'serial.PARITY_NONE', 'stopbits': 'serial.STOPBITS_ONE', 'timeout...
import os import unittest import logging import shutil import numpy as np from smac.configspace import Configuration from smac.scenario.scenario import Scenario from smac.stats.stats import Stats from smac.tae.execute_ta_run import StatusType from smac.tae.execute_ta_run_old import ExecuteTARunOld from smac.runhistor...
[ "os.remove", "smac.utils.validate._Run", "smac.runhistory.runhistory.RunHistory", "smac.utils.io.traj_logging.TrajLogger.read_traj_aclib_format", "shutil.rmtree", "smac.tae.execute_ta_run_old.ExecuteTARunOld", "os.path.join", "os.chdir", "unittest.mock.MagicMock", "smac.utils.validate.Validator", ...
[((716, 727), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (725, 727), False, 'import os\n'), ((736, 760), 'os.chdir', 'os.chdir', (['base_directory'], {}), '(base_directory)\n', (744, 760), False, 'import os\n'), ((770, 791), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (789, 791), False, 'import log...
''' This script, functions of which are in foo_vb_lib.py, is based on https://github.com/chenzeno/FOO-VB/blob/ebc14a930ba9d1c1dadc8e835f746c567c253946/main.py For more information, please see the original paper https://arxiv.org/abs/2010.00373 . Author: <NAME>(@karalleyna) ''' import numpy as np from time import ...
[ "jax.random.PRNGKey", "foo_vb_lib.aggregate_e_b", "foo_vb_lib.update_m", "foo_vb_lib.weight_grad", "jax.numpy.argmax", "foo_vb_lib.aggregate_e_a", "foo_vb_lib.init_param", "functools.partial", "foo_vb_lib.aggregate_grads", "jax.numpy.sum", "foo_vb_lib.gen_phi", "foo_vb_lib.zero_matrix", "jax...
[((752, 769), 'jax.random.split', 'random.split', (['key'], {}), '(key)\n', (764, 769), False, 'from jax import random, value_and_grad, tree_map, vmap, lax\n'), ((865, 899), 'jax.tree_map', 'tree_map', (['jnp.transpose', 'variables'], {}), '(jnp.transpose, variables)\n', (873, 899), False, 'from jax import random, valu...
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "os.makedirs", "src.dataset.create_ocr_val_dataset", "numpy.zeros", "numpy.ones", "os.path.join" ]
[((1133, 1196), 'src.dataset.create_ocr_val_dataset', 'create_ocr_val_dataset', (['mindrecord_file', 'config.eval_batch_size'], {}), '(mindrecord_file, config.eval_batch_size)\n', (1155, 1196), False, 'from src.dataset import create_ocr_val_dataset\n'), ((1381, 1430), 'os.path.join', 'os.path.join', (['config.pre_resul...
import numpy as np from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense from tcn import TCN # if you increase the sequence length make sure the receptive field of the TCN is big enough. MAX_TIME_STEP = 30 """ Input: sequence of length 7 Input: sequence of length 25 Input: sequence of len...
[ "tensorflow.keras.layers.Dense", "numpy.zeros", "numpy.expand_dims", "tcn.TCN" ]
[((1154, 1180), 'tcn.TCN', 'TCN', ([], {'input_shape': '(None, 1)'}), '(input_shape=(None, 1))\n', (1157, 1180), False, 'from tcn import TCN\n'), ((1186, 1216), 'tensorflow.keras.layers.Dense', 'Dense', (['(1)'], {'activation': '"""sigmoid"""'}), "(1, activation='sigmoid')\n", (1191, 1216), False, 'from tensorflow.kera...
# -*- coding: utf-8 -*- """ Created on Mon Jun 19 11:25:16 2017 @author: flwe6397 """ import scipy import statsmodels.api as sm import matplotlib matplotlib.rcParams.update({'font.size': 12}) from matplotlib import pyplot import numpy as np from pylab import rcParams rcParams['figure.figsize'] = 16/2,12/2 ...
[ "matplotlib.pyplot.show", "statistics.median", "scipy.stats.shapiro", "numpy.argmax", "scipy.stats.mannwhitneyu", "statistics.stdev", "matplotlib.rcParams.update", "matplotlib.pyplot.bar", "scipy.stats.levene", "scipy.stats.ttest_ind", "numpy.argmin", "matplotlib.pyplot.figure", "numpy.array...
[((153, 198), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 12}"], {}), "({'font.size': 12})\n", (179, 198), False, 'import matplotlib\n'), ((1008, 1031), 'statistics.stdev', 'statistics.stdev', (['list1'], {}), '(list1)\n', (1024, 1031), False, 'import statistics\n'), ((1046, 1069), 'sta...
import os import numpy as np import logging from pystella.model.sn_eve import PreSN from pystella.util.phys_var import phys logger = logging.getLogger(__name__) try: import matplotlib.pyplot as plt from matplotlib import gridspec is_matplotlib = True except ImportError: logging.debug('matplotlib fa...
[ "os.path.expanduser", "logging.debug", "numpy.zeros", "os.path.isfile", "matplotlib.pyplot.figure", "numpy.min", "numpy.loadtxt", "numpy.max", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.matplotlib.rcParams.update", "pystella.model.sn_eve.PreSN", "logging.getLogger" ]
[((136, 163), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (153, 163), False, 'import logging\n'), ((513, 540), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (530, 540), False, 'import logging\n'), ((11263, 11284), 'pystella.model.sn_eve.PreSN', 'PreSN', ...
import os from typing import List from enum import IntEnum import cv2 as cv import numpy as np from pydicom import dcmread from pydicom.dataset import Dataset from pydicom.sequence import Sequence from rt_utils.utils import ROIData, SOPClassUID def load_sorted_image_series(dicom_series_path: str): """ File ...
[ "cv2.line", "numpy.invert", "numpy.ravel", "os.walk", "numpy.zeros", "numpy.ones", "cv2.fillPoly", "numpy.around", "numpy.array", "os.path.join", "numpy.concatenate" ]
[((823, 849), 'os.walk', 'os.walk', (['dicom_series_path'], {}), '(dicom_series_path)\n', (830, 849), False, 'import os\n'), ((4837, 4882), 'numpy.concatenate', 'np.concatenate', (['(contour, z_indicies)'], {'axis': '(1)'}), '((contour, z_indicies), axis=1)\n', (4851, 4882), True, 'import numpy as np\n'), ((4899, 4916)...
import os import json import pickle from datetime import datetime import torch import numpy as np from pathlib import Path from mushroom_rl.core import Serializable from mushroom_rl.core.logger import ConsoleLogger class BenchmarkLogger(ConsoleLogger): """ Class to handle all interactions with the log direc...
[ "json.dump", "pickle.dump", "numpy.save", "numpy.load", "json.load", "os.path.isdir", "torch.load", "os.path.exists", "datetime.datetime.now", "torch.save", "pathlib.Path", "pickle.load", "os.path.join", "os.getenv" ]
[((2434, 2473), 'os.path.join', 'os.path.join', (['self._log_dir', 'log_id', '""""""'], {}), "(self._log_dir, log_id, '')\n", (2446, 2473), False, 'import os\n'), ((2818, 2869), 'os.path.join', 'os.path.join', (['self._log_dir', 'self._log_id', 'filename'], {}), '(self._log_dir, self._log_id, filename)\n', (2830, 2869)...
import math import numpy as np def _is_in_china(func): def wrapper(cls, lnglat): if 72.004 < lnglat[0] < 137.8347 and .8293 < lnglat[1] < 55.8271: return func(cls, lnglat) return lnglat return wrapper class Convert: _XPI = math.pi * 3000 / 180 _PI = math.pi _A = 63782...
[ "math.exp", "numpy.flip", "math.sqrt", "math.atan2", "math.radians", "math.tan", "math.fabs", "math.sin", "numpy.array", "math.cos", "math.sinh", "math.degrees" ]
[((1975, 1991), 'math.sin', 'math.sin', (['radlat'], {}), '(radlat)\n', (1983, 1991), False, 'import math\n'), ((2056, 2072), 'math.sqrt', 'math.sqrt', (['magic'], {}), '(magic)\n', (2065, 2072), False, 'import math\n'), ((3034, 3050), 'math.sin', 'math.sin', (['radlat'], {}), '(radlat)\n', (3042, 3050), False, 'import...
""" Some codes from https://github.com/Newmu/dcgan_code """ from __future__ import division import math import json import random import pprint import scipy.misc import numpy as np import os from time import gmtime, strftime #pp = pprint.PrettyPrinter() #get_stddev = lambda x, k_h, k_w: 1/math.sqrt(k_w*k_h*x.get_shap...
[ "os.makedirs", "os.path.dirname", "os.path.exists", "numpy.expand_dims", "numpy.zeros", "numpy.fliplr", "numpy.random.random", "numpy.array", "numpy.concatenate" ]
[((1157, 1184), 'os.path.dirname', 'os.path.dirname', (['image_path'], {}), '(image_path)\n', (1172, 1184), False, 'import os\n'), ((584, 611), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(2)'}), '(img, axis=2)\n', (598, 611), True, 'import numpy as np\n'), ((898, 912), 'numpy.fliplr', 'np.fliplr', (['im...
import numpy as np import yaml, pickle, os, librosa, argparse from concurrent.futures import ThreadPoolExecutor as PE from collections import deque from threading import Thread from tqdm import tqdm from Audio import Audio_Prep, Mel_Generate from yin import pitch_calc with open('Hyper_Parameters.yaml') as f: hp_D...
[ "yaml.load", "pickle.dump", "argparse.ArgumentParser", "os.makedirs", "os.path.join", "os.path.basename", "os.walk", "Audio.Audio_Prep", "Audio.Mel_Generate", "numpy.min", "numpy.max", "pickle.load", "os.path.splitext", "yin.pitch_calc" ]
[((326, 358), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.Loader'}), '(f, Loader=yaml.Loader)\n', (335, 358), False, 'import yaml, pickle, os, librosa, argparse\n'), ((465, 749), 'yin.pitch_calc', 'pitch_calc', ([], {'sig': 'audio', 'sr': "hp_Dict['Sound']['Sample_Rate']", 'w_len': "hp_Dict['Sound']['Frame_Lengt...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ assemble.py This module finds and forms essential structure components, which are the smallest building blocks that form every repeat in the song. These functions ensure that each time step of a song is contained in at most one of the song's essential structure ...
[ "matplotlib.pyplot.title", "numpy.triu", "numpy.sum", "numpy.amin", "numpy.empty", "numpy.allclose", "numpy.ones", "numpy.argsort", "numpy.shape", "numpy.arange", "numpy.tile", "numpy.unique", "numpy.full", "numpy.ndim", "numpy.transpose", "numpy.insert", "numpy.max", "inspect.sign...
[((3662, 3702), 'inspect.signature', 'signature', (['breakup_overlaps_by_intersect'], {}), '(breakup_overlaps_by_intersect)\n', (3671, 3702), False, 'from inspect import signature\n'), ((4414, 4437), 'numpy.nonzero', 'np.nonzero', (['(bw_vec == T)'], {}), '(bw_vec == T)\n', (4424, 4437), True, 'import numpy as np\n'), ...
from __future__ import print_function, division import numpy as np import healpy as hp from matplotlib import pyplot as plt import geometry # given nside | number of pixels | resolution (pixel size in degree) | Maximum angular distance (degree) | pixel area (in square degrees) # 1 | 12 | ...
[ "geometry.genEA", "healpy.max_pixrad", "healpy.visufunc.projscatter", "matplotlib.pyplot.show", "healpy.mollview", "numpy.random.randn", "healpy.graticule", "healpy.nside2pixarea", "healpy.nside2npix", "numpy.linalg.norm", "healpy.nside2resol" ]
[((2358, 2381), 'numpy.random.randn', 'np.random.randn', (['(100)', '(3)'], {}), '(100, 3)\n', (2373, 2381), True, 'import numpy as np\n'), ((2453, 2470), 'geometry.genEA', 'geometry.genEA', (['v'], {}), '(v)\n', (2467, 2470), False, 'import geometry\n'), ((2557, 2570), 'healpy.mollview', 'hp.mollview', ([], {}), '()\n...
# Helpful classes import numpy as np # Helper function for calculating dists def dists(array): lens = [] for i in range(len(array)): lens.append(np.linalg.norm(np.array(array[i][0])- np.array(array[i][1]))) return lens # This is for the original shape you want to cut class Shape: def __init__(self...
[ "numpy.array" ]
[((344, 356), 'numpy.array', 'np.array', (['ls'], {}), '(ls)\n', (352, 356), True, 'import numpy as np\n'), ((170, 191), 'numpy.array', 'np.array', (['array[i][0]'], {}), '(array[i][0])\n', (178, 191), True, 'import numpy as np\n'), ((199, 220), 'numpy.array', 'np.array', (['array[i][1]'], {}), '(array[i][1])\n', (207,...
import io import cv2 import numpy as np def predict(image): nparr = np.fromstring(image, np.uint8) img = cv2.imdecode(nparr, cv2.IMREAD_COLOR) gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) res, im_png = cv2.imencode(".png", gray_image) return im_png def details(): details = { "...
[ "cv2.cvtColor", "cv2.imdecode", "numpy.fromstring", "cv2.imencode" ]
[((74, 104), 'numpy.fromstring', 'np.fromstring', (['image', 'np.uint8'], {}), '(image, np.uint8)\n', (87, 104), True, 'import numpy as np\n'), ((115, 152), 'cv2.imdecode', 'cv2.imdecode', (['nparr', 'cv2.IMREAD_COLOR'], {}), '(nparr, cv2.IMREAD_COLOR)\n', (127, 152), False, 'import cv2\n'), ((170, 207), 'cv2.cvtColor'...
import numpy as np from numpy.random import randn from numpy.linalg import norm from numpy.random import permutation from numpy.testing import assert_array_almost_equal, assert_array_equal import tensor.utils as tu from tensor.tensor_train import ttsvd, tt_product # np.random.seed(20) shape_A = (3, 4, 5, 6, 7) A = ra...
[ "tensor.tensor_train.ttsvd", "numpy.linalg.norm", "tensor.tensor_train.tt_product", "numpy.random.randn" ]
[((318, 333), 'numpy.random.randn', 'randn', (['*shape_A'], {}), '(*shape_A)\n', (323, 333), False, 'from numpy.random import randn\n'), ((487, 533), 'tensor.tensor_train.ttsvd', 'ttsvd', (['A', 'tol'], {'dim_order': 'dim_order', 'ranks': 'None'}), '(A, tol, dim_order=dim_order, ranks=None)\n', (492, 533), False, 'from...
''' Visualization code for point clouds and 3D bounding boxes with mayavi. Modified by <NAME> Date: September 2017 Ref: https://github.com/hengck23/didi-udacity-2017/blob/master/baseline-04/kitti_data/draw.py ''' import warnings import numpy as np try: import mayavi.mlab as mlab except ImportError: warnings...
[ "lyft_dataset_sdk.utils.data_classes.LidarPointCloud.from_file", "dataset.prepare_lyft_data_v2.transform_pc_to_camera_coord", "mayavi.mlab.text3d", "mayavi.mlab.figure", "numpy.eye", "pandas.read_csv", "dataset.prepare_lyft_data.transform_box_from_world_to_sensor_coordinates", "mayavi.mlab.view", "n...
[((5711, 5805), 'mayavi.mlab.figure', 'mlab.figure', ([], {'figure': 'None', 'bgcolor': '(0, 0, 0)', 'fgcolor': 'None', 'engine': 'None', 'size': '(1600, 1000)'}), '(figure=None, bgcolor=(0, 0, 0), fgcolor=None, engine=None, size\n =(1600, 1000))\n', (5722, 5805), True, 'import mayavi.mlab as mlab\n'), ((5862, 5987)...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ manipulated bfgs method from scipy.optimize (V 1.5.2) """ #__docformat__ = "restructuredtext en" # ******NOTICE*************** # optimize.py module by <NAME> # # You may copy and use this module as you see fit with no # guarantee implied provided you keep this notice ...
[ "numpy.abs", "numpy.isnan", "numpy.linalg.norm", "numpy.inner", "warnings.simplefilter", "numpy.isfinite", "numpy.finfo", "warnings.catch_warnings", "numpy.size", "numpy.asarray", "numpy.isinf", "scipy.optimize._differentiable_functions.ScalarFunction", "numpy.dot", "numpy.all", "numpy.i...
[((9140, 9232), 'scipy.optimize._differentiable_functions.ScalarFunction', 'ScalarFunction', (['fun', 'x0', 'args', 'grad', 'hess', 'finite_diff_rel_step', 'bounds'], {'epsilon': 'epsilon'}), '(fun, x0, args, grad, hess, finite_diff_rel_step, bounds,\n epsilon=epsilon)\n', (9154, 9232), False, 'from scipy.optimize._...
from numpy.random import seed seed(42) from tensorflow import set_random_seed set_random_seed(42) import nltk from nltk.corpus import stopwords from xml.dom.minidom import parse import warnings warnings.simplefilter(action='ignore', category=FutureWarning) warnings.filterwarnings("ignore", category=DeprecationWarning)...
[ "matplotlib.pyplot.title", "pickle.dump", "numpy.random.seed", "numpy.argmax", "evaluator.evaluate", "keras.models.Model", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "keras_contrib.layers.CRF", "pickle.load", "nltk.download", "keras.layers.concatenate", "sys.path.append", "...
[((30, 38), 'numpy.random.seed', 'seed', (['(42)'], {}), '(42)\n', (34, 38), False, 'from numpy.random import seed\n'), ((78, 97), 'tensorflow.set_random_seed', 'set_random_seed', (['(42)'], {}), '(42)\n', (93, 97), False, 'from tensorflow import set_random_seed\n'), ((195, 257), 'warnings.simplefilter', 'warnings.simp...
import numpy as np from icecream import ic if __name__ == '__main__': length = 12 size = 6 a = np.ones(size) * -1 counter = 0 for i in range(size): if i < size-1: a[i] = i else: remain = length - (i+1) counter += remain a_mask = np.where(a==-1...
[ "icecream.ic", "numpy.sum", "numpy.empty_like", "numpy.ones", "numpy.where", "numpy.random.choice" ]
[((349, 354), 'icecream.ic', 'ic', (['a'], {}), '(a)\n', (351, 354), False, 'from icecream import ic\n'), ((359, 369), 'icecream.ic', 'ic', (['a_mask'], {}), '(a_mask)\n', (361, 369), False, 'from icecream import ic\n'), ((374, 381), 'icecream.ic', 'ic', (['idx'], {}), '(idx)\n', (376, 381), False, 'from icecream impor...
import time import os import argparse import numpy as np import torch import torch.nn as nn import torch.optim as optim from scipy.io import savemat parser = argparse.ArgumentParser() parser.add_argument('--tol', type=float, default=1e-3) parser.add_argument('--adjoint', type=eval, default=False) parser.add_argument(...
[ "torch.nn.MSELoss", "numpy.save", "numpy.load", "argparse.ArgumentParser", "torch.random.manual_seed", "os.makedirs", "torch.nn.Tanh", "numpy.empty", "torch.nn.Sequential", "scipy.io.savemat", "torch.cat", "time.time", "torch.save", "torchdiffeq.odeint", "torch.cuda.is_available", "tor...
[((160, 185), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (183, 185), False, 'import argparse\n'), ((2234, 2264), 'torch.random.manual_seed', 'torch.random.manual_seed', (['(2021)'], {}), '(2021)\n', (2258, 2264), False, 'import torch\n'), ((3069, 3081), 'torch.nn.MSELoss', 'nn.MSELoss', ([]...
""" Permits calling arbitrary functions and passing some forms of data from C++ to Python (only one direction) as a server-client pair. The server in this case is the C++ program, and the client is this binary. For an example of C++ usage, see `call_python_server_test.cc`. Here's an example of running with the C++ te...
[ "argparse.ArgumentParser", "numpy.sin", "os.path.join", "numpy.meshgrid", "traceback.print_exc", "numpy.linspace", "matplotlib.pyplot.pause", "threading.Thread", "matplotlib.pyplot.show", "numpy.ones_like", "os.stat", "matplotlib.interactive", "numpy.frombuffer", "signal.getsignal", "num...
[((5645, 5673), 'matplotlib.interactive', 'matplotlib.interactive', (['(True)'], {}), '(True)\n', (5667, 5673), False, 'import matplotlib\n'), ((20361, 20464), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description...
""" Plot SV3 Results """ # LRGs import sys sys.path.append('/home/mehdi/github/LSSutils') import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import healpy as hp import numpy as np from time import time import fitsio as ft from lssutils.lab import (make_overdensity, AnaFast, ...
[ "sys.path.append", "pandas.read_hdf", "lssutils.lab.make_overdensity", "lssutils.stats.pcc.pcc", "lssutils.lab.hpixsum", "lssutils.lab.AnaFast", "lssutils.lab.get_meandensity", "numpy.isfinite", "time.time", "numpy.percentile", "fitsio.read", "numpy.log10", "lssutils.dataviz.setup_color", ...
[((44, 90), 'sys.path.append', 'sys.path.append', (['"""/home/mehdi/github/LSSutils"""'], {}), "('/home/mehdi/github/LSSutils')\n", (59, 90), False, 'import sys\n'), ((4698, 4711), 'lssutils.dataviz.setup_color', 'setup_color', ([], {}), '()\n', (4709, 4711), False, 'from lssutils.dataviz import setup_color\n'), ((5059...
"""This module implements a time series class with related methods.""" from collections import deque from datetime import datetime, timedelta from IPython.display import display from matplotlib.axes import Axes from matplotlib.figure import Figure import matplotlib.pyplot as plt import numpy as np import pandas as pd...
[ "datetime.datetime.fromisoformat", "numpy.flatnonzero", "IPython.display.display", "numpy.array", "pandas.Series", "datetime.timedelta", "matplotlib.pyplot.subplots" ]
[((1209, 1231), 'pandas.Series', 'pd.Series', (['self.series'], {}), '(self.series)\n', (1218, 1231), True, 'import pandas as pd\n'), ((1834, 1856), 'pandas.Series', 'pd.Series', (['self.series'], {}), '(self.series)\n', (1843, 1856), True, 'import pandas as pd\n'), ((3106, 3128), 'pandas.Series', 'pd.Series', (['self....
import argparse import collections import numpy as np parser = argparse.ArgumentParser( description='Convert T5 predictions into a TREC-formatted run.') parser.add_argument('--predictions', type=str, required=True, help='T5 predictions file.') parser.add_argument('--query_run_ids', type=str, required=True, ...
[ "collections.defaultdict", "numpy.exp", "argparse.ArgumentParser" ]
[((65, 158), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert T5 predictions into a TREC-formatted run."""'}), "(description=\n 'Convert T5 predictions into a TREC-formatted run.')\n", (88, 158), False, 'import argparse\n'), ((551, 580), 'collections.defaultdict', 'collections.d...
import numpy as np import gym from gym import Wrapper from gym.spaces import Discrete, Box from gym_pomdp.envs.rock import RockEnv, Obs class RockSampleHistoryEnv(Wrapper): """ takes observations from an RockSample environment and stacks to history given hist_len of history length """ def __init__(...
[ "gym.make", "numpy.zeros", "numpy.hstack", "numpy.array", "gym.spaces.Box", "numpy.concatenate" ]
[((2699, 2715), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (2707, 2715), False, 'import gym\n'), ((9135, 9203), 'numpy.zeros', 'np.zeros', (['(self.observation_space.shape[0] - self.historyIgnoreIdx,)'], {}), '((self.observation_space.shape[0] - self.historyIgnoreIdx,))\n', (9143, 9203), True, 'import nump...
import numpy as np # The last dimensions of box_1 and box_2 are both 4. (x, y, w, h) class IOU(object): def __init__(self, box_1, box_2): self.box_1_min, self.box_1_max = self.__get_box_min_and_max(box_1) self.box_2_min, self.box_2_max = self.__get_box_min_and_max(box_2) self.box_1_area = ...
[ "numpy.minimum", "numpy.maximum" ]
[((768, 810), 'numpy.maximum', 'np.maximum', (['self.box_1_min', 'self.box_2_min'], {}), '(self.box_1_min, self.box_2_min)\n', (778, 810), True, 'import numpy as np\n'), ((835, 877), 'numpy.minimum', 'np.minimum', (['self.box_1_max', 'self.box_2_max'], {}), '(self.box_1_max, self.box_2_max)\n', (845, 877), True, 'impor...
''' Function: Algorithm implementation. Author: Charles 微信公众号: Charles的皮卡丘 ''' import cv2 import math import numpy as np from PIL import Image from scipy import signal from utils.utils import * from scipy.ndimage import interpolation from scipy.sparse.linalg import spsolve from scipy.sparse import csr_matrix, spdiag...
[ "numpy.abs", "numpy.rot90", "numpy.zeros_like", "numpy.true_divide", "scipy.signal.convolve2d", "cv2.cvtColor", "cv2.imwrite", "numpy.power", "scipy.ndimage.interpolation.zoom", "numpy.cumsum", "numpy.reshape", "scipy.sparse.linalg.spsolve", "math.ceil", "cv2.calcHist", "scipy.sparse.csr...
[((338, 371), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (361, 371), False, 'import warnings\n'), ((850, 872), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (860, 872), False, 'import cv2\n'), ((2535, 2574), 'numpy.zeros', 'np.zeros', (['(kernel_s...
""" Tests for the blaze interface to the pipeline api. """ from __future__ import division from collections import OrderedDict from datetime import timedelta from unittest import TestCase import warnings import blaze as bz from datashape import dshape, var, Record from nose_parameterized import parameterized import n...
[ "zipline.pipeline.engine.SimplePipelineEngine", "toolz.curried.operator.itemgetter", "blaze.transform", "pandas.DataFrame", "toolz.curried.operator.attrgetter", "nose_parameterized.parameterized.expand", "datashape.dshape", "warnings.simplefilter", "zipline.pipeline.loaders.blaze.BlazeLoader", "wa...
[((994, 1015), 'toolz.curried.operator.attrgetter', 'op.attrgetter', (['"""name"""'], {}), "('name')\n", (1007, 1015), True, 'from toolz.curried import operator as op\n'), ((1026, 1048), 'toolz.curried.operator.attrgetter', 'op.attrgetter', (['"""dtype"""'], {}), "('dtype')\n", (1039, 1048), True, 'from toolz.curried i...
import cv2 import numpy as np from pyzbar.pyzbar import decode def decoder(image): gray_img = cv2.cvtColor(image, 0) barcode = decode(gray_img) for obj in barcode: points = obj.polygon (x, y, w, h) = obj.rect pts = np.array(points, np.int32) pts = pts.reshape((-1, 1, 2)) ...
[ "cv2.putText", "cv2.polylines", "cv2.cvtColor", "pyzbar.pyzbar.decode", "cv2.waitKey", "cv2.VideoCapture", "numpy.array", "cv2.imshow" ]
[((700, 719), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (716, 719), False, 'import cv2\n'), ((100, 122), 'cv2.cvtColor', 'cv2.cvtColor', (['image', '(0)'], {}), '(image, 0)\n', (112, 122), False, 'import cv2\n'), ((137, 153), 'pyzbar.pyzbar.decode', 'decode', (['gray_img'], {}), '(gray_img)\n', (1...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ "tensorflow.python.platform.test.main", "tensorflow.python.ops.sparse_ops.sparse_to_dense", "numpy.sum", "tensorflow.python.data.experimental.ops.interleave_ops.parallel_interleave", "tensorflow.python.framework.sparse_tensor.SparseTensorValue", "tensorflow.python.data.ops.dataset_ops.Dataset.range", "n...
[((3690, 3701), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (3699, 3701), False, 'from tensorflow.python.platform import test\n'), ((1411, 1446), 'numpy.array', 'np.array', (['[4, 5, 6]'], {'dtype': 'np.int64'}), '([4, 5, 6], dtype=np.int64)\n', (1419, 1446), True, 'import numpy as np\n'), ((...
import tensorflow_quantum as tfq import tensorflow as tf import cirq import sympy import matplotlib.pyplot as plt import numpy as np def make_data(qubits): train, train_label = [], [] # 0 XOR 0 cir = cirq.Circuit() cir.append([cirq.I(qubits[0])]) cir.append([cirq.I(qubits[1])]) train.append(cir...
[ "matplotlib.pyplot.title", "cirq.rx", "cirq.ry", "numpy.mean", "cirq.CNOT", "cirq.rz", "cirq.I", "tensorflow.keras.Input", "tensorflow.cast", "tensorflow.keras.optimizers.Adam", "tensorflow.squeeze", "cirq.Z", "matplotlib.pyplot.show", "tensorflow_quantum.differentiators.ParameterShift", ...
[((2587, 2635), 'tensorflow.keras.Input', 'tf.keras.Input', ([], {'shape': '()', 'dtype': 'tf.dtypes.string'}), '(shape=(), dtype=tf.dtypes.string)\n', (2601, 2635), True, 'import tensorflow as tf\n'), ((2852, 2904), 'tensorflow.keras.models.Model', 'tf.keras.models.Model', ([], {'inputs': 'inputs', 'outputs': 'layer1'...
from unittest import TestCase import numpy as np from hamcrest import assert_that, is_ from core.batch_generator import BatchGenerator class DummyBatchGenerator(BatchGenerator): def __init__(self, batch_items, batch_size): super().__init__(batch_items, batch_size, 'en') def shuffle_entries(self): ...
[ "numpy.random.rand", "hamcrest.is_" ]
[((394, 415), 'numpy.random.rand', 'np.random.rand', (['i', '(26)'], {}), '(i, 26)\n', (408, 415), True, 'import numpy as np\n'), ((780, 786), 'hamcrest.is_', 'is_', (['(3)'], {}), '(3)\n', (783, 786), False, 'from hamcrest import assert_that, is_\n'), ((890, 905), 'hamcrest.is_', 'is_', (['batch_size'], {}), '(batch_s...
# -*- coding: utf-8 -*- """ Seismic wavelets. :copyright: 2015 Agile Geoscience :license: Apache 2.0 """ from collections import namedtuple import numpy as np from scipy.signal import hilbert from scipy.signal import chirp def sinc(duration, dt, f, return_t=False, taper='blackman'): """ sinc function center...
[ "numpy.asanyarray", "numpy.sinc", "numpy.amax", "numpy.imag", "scipy.signal.chirp", "numpy.arange", "collections.namedtuple", "scipy.signal.hilbert", "numpy.sin", "numpy.squeeze", "numpy.exp", "numpy.correlate", "numpy.real", "numpy.cos" ]
[((1481, 1527), 'numpy.arange', 'np.arange', (['(-duration / 2.0)', '(duration / 2.0)', 'dt'], {}), '(-duration / 2.0, duration / 2.0, dt)\n', (1490, 1527), True, 'import numpy as np\n'), ((3024, 3066), 'numpy.arange', 'np.arange', (['(-duration / 2)', '(duration / 2)', 'dt'], {}), '(-duration / 2, duration / 2, dt)\n'...
import ee import numpy as np import pandas as pd import geopandas as gpd from shapely.geometry import box import rabpro from rabpro.basin_stats import Dataset # coords_file = gpd.read_file(r"tests/data/Big Blue River.geojson") # total_bounds = coords_file.total_bounds total_bounds = np.array([-85.91331249, 39.426098...
[ "pandas.DataFrame", "rabpro.basin_stats.Dataset", "rabpro.basin_stats.fetch_gee", "numpy.array", "shapely.geometry.box" ]
[((287, 351), 'numpy.array', 'np.array', (['[-85.91331249, 39.42609864, -85.88453019, 39.46429816]'], {}), '([-85.91331249, 39.42609864, -85.88453019, 39.46429816])\n', (295, 351), True, 'import numpy as np\n'), ((476, 522), 'pandas.DataFrame', 'pd.DataFrame', (["feature['properties']"], {'index': '[0]'}), "(feature['p...
import logging import numpy as np import pytest import xskillscore as xs from climpred.exceptions import CoordinateError from climpred.prediction import compute_hindcast def test_same_inits_initializations( hind_ds_initialized_1d_cftime, reconstruction_ds_1d_cftime, caplog ): """Tests that inits are identic...
[ "climpred.prediction.compute_hindcast", "pytest.raises", "numpy.arange", "xskillscore.mse", "pytest.mark.parametrize", "numpy.concatenate" ]
[((1597, 1664), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""alignment"""', "['same_inits', 'same_verifs']"], {}), "('alignment', ['same_inits', 'same_verifs'])\n", (1620, 1664), False, 'import pytest\n'), ((2371, 2438), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""alignment"""', "['same_i...
#!/usr/bin/env python """ Plot signal heatmaps from TFBS across different bigwigs @author: <NAME> @contact: mette.bentsen (at) mpi-bn.mpg.de @license: MIT """ import os import sys import argparse import logging import numpy as np import matplotlib as mpl mpl.use("Agg") #non-interactive backend import matplotlib.pyp...
[ "numpy.abs", "argparse.ArgumentParser", "matplotlib.pyplot.suptitle", "numpy.floor", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "tobias.parsers.add_heatmap_arguments", "matplotlib.pyplot.Subplot", "matplotlib.colors.Normalize", "matplotlib.pyplot.close", "numpy.ceil", "os.path...
[((259, 273), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (266, 273), True, 'import matplotlib as mpl\n'), ((8567, 8601), 'numpy.arange', 'np.arange', (['(-args.flank)', 'args.flank'], {}), '(-args.flank, args.flank)\n', (8576, 8601), True, 'import numpy as np\n'), ((8610, 8653), 'matplotlib.pyplot.f...
import torch import numpy as np class Network(torch.nn.Module): def __init__(self, structure): super(Network, self).__init__() self.structure = structure self.layers_pool_inited = self.init_layers(self.structure) def init_layers(self, structure): # pool of layers, whic...
[ "numpy.where", "torch.cat" ]
[((9206, 9253), 'numpy.where', 'np.where', (['(structure.matrix[:, layer_index] == 1)'], {}), '(structure.matrix[:, layer_index] == 1)\n', (9214, 9253), True, 'import numpy as np\n'), ((768, 820), 'numpy.where', 'np.where', (['(self.structure.matrix[:, layer_index] == 1)'], {}), '(self.structure.matrix[:, layer_index] ...
# coding: utf-8 import numpy as np import torch def convert_to_np(weights): for k, v in weights.items(): if isinstance(v, torch.Tensor): weights[k] = v.cpu().numpy() elif isinstance(v, np.ndarray): pass elif isinstance(v, list): weights[k] = np.array(v) ...
[ "torch.mean", "numpy.array", "torch.no_grad", "torch.cosine_similarity", "torch.from_numpy" ]
[((1234, 1249), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1247, 1249), False, 'import torch\n'), ((1413, 1454), 'torch.cosine_similarity', 'torch.cosine_similarity', (['old_out', 'new_out'], {}), '(old_out, new_out)\n', (1436, 1454), False, 'import torch\n'), ((610, 629), 'torch.from_numpy', 'torch.from_nump...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch import optim from torch.autograd import Variable from torch.nn.parameter import Parameter from torchvision import datasets, transforms from torch.utils.data import DataLoader, Dataset from xbbo.utils.constants import MAXIN...
[ "torch.FloatTensor", "torch.empty", "numpy.isnan", "torch.no_grad", "torch.optim.SGD" ]
[((1051, 1083), 'torch.optim.SGD', 'optim.SGD', (['[self.theta]'], {'lr': '(0.01)'}), '([self.theta], lr=0.01)\n', (1060, 1083), False, 'from torch import optim\n'), ((1326, 1360), 'torch.empty', 'torch.empty', (['(2)'], {'device': 'self.device'}), '(2, device=self.device)\n', (1337, 1360), False, 'import torch\n'), ((...
import torch as ch import utils import numpy as np from tqdm import tqdm if __name__ == "__main__": import sys model_arch = sys.argv[1] model_type = sys.argv[2] prefix = sys.argv[3] dataset = sys.argv[4] if dataset == 'cifar10': dx = utils.CIFAR10() elif dataset == 'imagenet': dx = utils.I...
[ "torch.mean", "tqdm.tqdm", "numpy.save", "utils.ImageNet1000", "utils.CIFAR10", "torch.cat", "torch.std", "torch.no_grad" ]
[((952, 968), 'torch.cat', 'ch.cat', (['all_reps'], {}), '(all_reps)\n', (958, 968), True, 'import torch as ch\n'), ((981, 1005), 'torch.mean', 'ch.mean', (['all_reps'], {'dim': '(0)'}), '(all_reps, dim=0)\n', (988, 1005), True, 'import torch as ch\n'), ((1018, 1041), 'torch.std', 'ch.std', (['all_reps'], {'dim': '(0)'...
# This is my main script import json import multiprocessing as mp import os import time import matplotlib.cm import matplotlib.pyplot import matplotlib.pyplot as plt import numpy as np from sklearn import metrics from sklearn.cluster import AgglomerativeClustering from sklearn.cluster import OPTICS import FeatureProc...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.clf", "matplotlib.pyplot.suptitle", "json.dumps", "matplotlib.pyplot.figure", "os.path.isfile", "numpy.arange", "matplotlib.pyplot.gca", "numpy.full_like", "json.loads", "matplotlib.pyplot.close", "process_cuckoo_reports.mp_get_all_files_api_sequen...
[((1607, 1616), 'multiprocessing.Pool', 'mp.Pool', ([], {}), '()\n', (1614, 1616), True, 'import multiprocessing as mp\n'), ((2641, 2650), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (2648, 2650), True, 'import matplotlib.pyplot as plt\n'), ((2665, 2708), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'f...
""" SAMS umbrella sampling for DDR1 kinase DFG loop flip. """ __author__ = '<NAME>' ################################################################################ # IMPORTS ################################################################################ import os, os.path import sys, math import numpy as np impor...
[ "sams.analysis.analyze", "simtk.openmm.CustomTorsionForce", "simtk.openmm.MonteCarloBarostat", "sams.ThermodynamicState", "collections.namedtuple", "numpy.linspace", "simtk.openmm.app.PDBFile", "sams.analysis.write_trajectory" ]
[((2874, 2905), 'simtk.openmm.app.PDBFile', 'app.PDBFile', (['state_pdb_filename'], {}), '(state_pdb_filename)\n', (2885, 2905), False, 'from simtk.openmm import app\n'), ((3863, 3905), 'simtk.openmm.CustomTorsionForce', 'openmm.CustomTorsionForce', (['energy_function'], {}), '(energy_function)\n', (3888, 3905), False,...
import numpy as np from numpy.random import beta import sys #sys.path.append('../h5hep') #from write import * import hepfile ################################################################################ def calc_energy(mass,px,py,pz): energy = np.sqrt(mass*mass + px*px + py*py + pz*pz) return energy ####...
[ "hepfile.initialize", "hepfile.pack", "numpy.random.beta", "hepfile.create_single_bucket", "hepfile.write_to_file", "numpy.random.randint", "numpy.random.random", "hepfile.create_group", "numpy.sqrt", "hepfile.create_dataset" ]
[((405, 425), 'hepfile.initialize', 'hepfile.initialize', ([], {}), '()\n', (423, 425), False, 'import hepfile\n'), ((427, 476), 'hepfile.create_group', 'hepfile.create_group', (['data', '"""jet"""'], {'counter': '"""njet"""'}), "(data, 'jet', counter='njet')\n", (447, 476), False, 'import hepfile\n'), ((475, 566), 'he...
import numpy as np import cv2 import Person import time #Contadores de entrada y salida cnt_up = 0 cnt_down = 0 #Fuente de video #cap = cv2.VideoCapture(0) cap = cv2.VideoCapture('peopleCounter.avi') #Propiedades del video ##cap.set(3, 160) #Width ##cap.set(4, 120) #Height # Imprime las propiedades de captura a con...
[ "numpy.ones", "time.strftime", "cv2.rectangle", "cv2.imshow", "cv2.contourArea", "cv2.boundingRect", "cv2.destroyAllWindows", "cv2.circle", "cv2.waitKey", "cv2.morphologyEx", "Person.MyPerson", "cv2.createBackgroundSubtractorMOG2", "cv2.putText", "cv2.polylines", "cv2.threshold", "cv2....
[((164, 201), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""peopleCounter.avi"""'], {}), "('peopleCounter.avi')\n", (180, 201), False, 'import cv2\n'), ((852, 882), 'numpy.array', 'np.array', (['[pt1, pt2]', 'np.int32'], {}), '([pt1, pt2], np.int32)\n', (860, 882), True, 'import numpy as np\n'), ((998, 1028), 'numpy.ar...
#*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights # in this software. # Licensed...
[ "numpy.array_equal", "numpy.eye", "numpy.bitwise_xor", "numpy.zeros", "numpy.identity", "numpy.shape", "numpy.append", "numpy.random.randint", "numpy.array", "numpy.round_", "numpy.linalg.det", "numpy.dot", "numpy.diag", "numpy.linalg.multi_dot" ]
[((1528, 1571), 'numpy.zeros', '_np.zeros', (['(n1 + n2, n1 + n2)'], {'dtype': '"""int8"""'}), "((n1 + n2, n1 + n2), dtype='int8')\n", (1537, 1571), True, 'import numpy as _np\n'), ((1952, 1971), 'numpy.append', '_np.append', (['A', 'b', '(1)'], {}), '(A, b, 1)\n', (1962, 1971), True, 'import numpy as _np\n'), ((2132, ...
# Copyright (C) 2020 GreenWaves Technologies, SAS # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This progr...
[ "stats.ranges.Ranges.range_output", "numpy.sum", "math.sqrt", "stats.scales.Scales.scale_output", "numpy.array", "stats.scales.Scales.scale_input", "stats.ranges.Ranges.range_input", "logging.getLogger" ]
[((1034, 1073), 'logging.getLogger', 'logging.getLogger', (["('nntool.' + __name__)"], {}), "('nntool.' + __name__)\n", (1051, 1073), False, 'import logging\n'), ((3704, 3762), 'stats.ranges.Ranges.range_output', 'Ranges.range_output', (["nn_0['node']"], {'weights': "nn_0['weights']"}), "(nn_0['node'], weights=nn_0['we...
# -*- coding: utf-8 -*- """ An extension of the pystruct OneSlackSSVM module to have a fit_with_valid method on it Copyright Xerox(C) 2016 <NAME> Developed for the EU project READ. The READ project has received funding from the European Union�s Horizon 2020 research and innovation pr...
[ "numpy.sum", "numpy.zeros", "time.time", "pystruct.learners.OneSlackSSVM.__init__", "numpy.dot" ]
[((1079, 1515), 'pystruct.learners.OneSlackSSVM.__init__', 'Pystruct_OneSlackSSVM.__init__', (['self', 'model'], {'max_iter': 'max_iter', 'C': 'C', 'check_constraints': 'check_constraints', 'verbose': 'verbose', 'negativity_constraint': 'negativity_constraint', 'n_jobs': 'n_jobs', 'break_on_bad': 'break_on_bad', 'show_...
__copyright__ = "Copyright (C) 2020 <NAME>" __license__ = """ 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 list of conditions and the follow...
[ "mlir.run.call_function", "numpy.empty_like", "mlir.run.mlir_opt", "pytest.main", "mlir.run.get_mlir_opt_version", "numpy.random.rand", "numpy.testing.assert_allclose" ]
[((2362, 2439), 'mlir.run.mlir_opt', 'mlirrun.mlir_opt', (['source', "['-convert-linalg-to-loops', '-convert-scf-to-std']"], {}), "(source, ['-convert-linalg-to-loops', '-convert-scf-to-std'])\n", (2378, 2439), True, 'import mlir.run as mlirrun\n'), ((2487, 2509), 'numpy.random.rand', 'np.random.rand', (['(10)', '(10)'...
import random import numpy as np import scipy.stats as sps import torch import torch.utils.data as tud import torch.nn.utils as tnnu import models.dataset as md import utils.tensorboard as utb import utils.scaffold as usc class Action: def __init__(self, logger=None): """ (Abstract) Initializes...
[ "numpy.sum", "torch.utils.data.DataLoader", "models.dataset.Dataset", "random.sample", "utils.scaffold.join_joined_attachments", "scipy.stats.entropy", "numpy.histogram", "models.dataset.DecoratorDataset", "numpy.array", "utils.scaffold.join_first_attachment", "torch.no_grad" ]
[((5789, 5804), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5802, 5804), False, 'import torch\n'), ((3927, 3994), 'models.dataset.DecoratorDataset', 'md.DecoratorDataset', (['training_set'], {'vocabulary': 'self.model.vocabulary'}), '(training_set, vocabulary=self.model.vocabulary)\n', (3946, 3994), True, 'imp...
import onnx from onnx import numpy_helper import numpy as np # Filter sobel = { 3: np.array([[1, 0, -1], [2, 0, -2], [1, 0, -1]], dtype='float32'), 5: np.array([[2, 1, 0, -1, -2], [3, 2, 0, -2, -3], [4, 3, 0, -3, -4], [3, 2, 0, -2, -3], [2, 1, 0, -1, -2]], dtype='float32'), 7: np.array([[...
[ "onnx.helper.make_node", "onnx.numpy_helper.from_array", "onnx.save", "onnx.helper.make_model", "onnx.helper.make_tensor_value_info", "numpy.array", "numpy.random.rand", "onnx.checker.check_model", "onnx.helper.make_graph" ]
[((86, 149), 'numpy.array', 'np.array', (['[[1, 0, -1], [2, 0, -2], [1, 0, -1]]'], {'dtype': '"""float32"""'}), "([[1, 0, -1], [2, 0, -2], [1, 0, -1]], dtype='float32')\n", (94, 149), True, 'import numpy as np\n'), ((164, 290), 'numpy.array', 'np.array', (['[[2, 1, 0, -1, -2], [3, 2, 0, -2, -3], [4, 3, 0, -3, -4], [3, ...
import sys sys.path.append("../ern/") sys.path.append("../dies/") import copy import torch import numpy as np import pandas as pd from dies.utils import listify from sklearn.metrics import mean_squared_error as mse from torch.utils.data.dataloader import DataLoader from fastai.basic_data import DataBunch from fastai.b...
[ "sys.path.append", "pandas.DataFrame", "sklearn.metrics.mean_squared_error", "pandas.read_csv", "numpy.clip", "glob.glob", "torch.utils.data.dataloader.DataLoader", "pandas.concat", "numpy.unique", "fastai.basic_data.DataBunch" ]
[((12, 38), 'sys.path.append', 'sys.path.append', (['"""../ern/"""'], {}), "('../ern/')\n", (27, 38), False, 'import sys\n'), ((39, 66), 'sys.path.append', 'sys.path.append', (['"""../dies/"""'], {}), "('../dies/')\n", (54, 66), False, 'import sys\n'), ((701, 786), 'torch.utils.data.dataloader.DataLoader', 'DataLoader'...
import pytest import numpy as np from quantum_systems import BasisSet def test_add_spin_spf(): spf = (np.arange(15) + 1).reshape(3, 5).T n = 3 n_a = 2 n_b = n - n_a l = 2 * spf.shape[0] assert l == 10 m_a = l // 2 - n_a assert m_a == 3 m_b = l // 2 - n_b assert m_b == 4 ...
[ "numpy.testing.assert_allclose", "numpy.arange", "quantum_systems.BasisSet.add_spin_spf" ]
[((333, 363), 'quantum_systems.BasisSet.add_spin_spf', 'BasisSet.add_spin_spf', (['spf', 'np'], {}), '(spf, np)\n', (354, 363), False, 'from quantum_systems import BasisSet\n'), ((392, 438), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['spf[0]', 'new_spf[0]'], {}), '(spf[0], new_spf[0])\n', (418, 43...
""" Train a spiking Bayesian WTA network and plot weight changes, spike trains and log-likelihood live. MIT License Copyright (c) 2019 <NAME>, <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softw...
[ "utility.sigmoid", "tqdm.tqdm", "copy.deepcopy", "numpy.log", "utility.load_mnist", "plot.SpiketrainPlotter", "plot.WeightPCAPlotter", "data_generator.DataGenerator", "numpy.std", "numpy.prod", "numpy.mean", "plot.CurvePlotter", "network.EventBasedBinaryWTANetwork", "collections.deque" ]
[((1636, 1714), 'utility.load_mnist', 'ut.load_mnist', ([], {'h': 'H', 'w': 'W', 'labels': 'labels', 'train': '(False)', 'frequencies': 'spiking_input'}), '(h=H, w=W, labels=labels, train=False, frequencies=spiking_input)\n', (1649, 1714), True, 'import utility as ut\n'), ((1723, 1865), 'network.EventBasedBinaryWTANetw...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Feb 26 15:15:37 2018 @author: <NAME>, <NAME> """ import numpy as np from PIL import Image import matplotlib.pyplot as plt from fnmatch import fnmatch import sys import os import matplotlib.image as mpimg import scipy # Make sure that caffe is on the python pat...
[ "caffe.set_mode_gpu", "os.makedirs", "os.path.isdir", "os.walk", "os.path.exists", "sys.path.insert", "PIL.Image.open", "caffe.set_device", "numpy.array", "scipy.misc.imsave", "caffe.Net", "os.path.join", "fnmatch.fnmatch" ]
[((386, 427), 'sys.path.insert', 'sys.path.insert', (['(0)', "(CAFFE_ROOT + 'python')"], {}), "(0, CAFFE_ROOT + 'python')\n", (401, 427), False, 'import sys\n'), ((443, 463), 'caffe.set_mode_gpu', 'caffe.set_mode_gpu', ([], {}), '()\n', (461, 463), False, 'import caffe\n'), ((464, 483), 'caffe.set_device', 'caffe.set_d...
import numpy as np from py_vbc.constants import * from py_vbc.interpolations import interpolate_tf def sigma(k, tf_spline, R=8.0/hconst): """Integrand to calculate the mass fluctuations in a sphere of radius R, up to some constant of proportionality C, using transfer functions. Uses the fact that si...
[ "py_vbc.interpolations.interpolate_tf", "numpy.max", "numpy.sin", "numpy.min", "numpy.cos" ]
[((1468, 1497), 'py_vbc.interpolations.interpolate_tf', 'interpolate_tf', ([], {'flag': '"""t"""', 'z': '(0)'}), "(flag='t', z=0)\n", (1482, 1497), False, 'from py_vbc.interpolations import interpolate_tf\n'), ((1551, 1571), 'numpy.min', 'np.min', (['tf0_spline.x'], {}), '(tf0_spline.x)\n', (1557, 1571), True, 'import ...
import os import torch import torch.nn.functional as F import numpy as np from collections import namedtuple import time import matplotlib.pyplot as plt # 定义是否使用GPU device = torch.device("cuda" if torch.cuda.is_available() else "cpu") def LpNormalize_cnn(input, p=2, cp=1, eps=1e-6): r'''Calculate the unit vect...
[ "torch.cuda.is_available", "numpy.average", "numpy.sqrt" ]
[((2774, 2784), 'numpy.sqrt', 'np.sqrt', (['d'], {}), '(d)\n', (2781, 2784), True, 'import numpy as np\n'), ((3545, 3555), 'numpy.sqrt', 'np.sqrt', (['d'], {}), '(d)\n', (3552, 3555), True, 'import numpy as np\n'), ((4278, 4315), 'numpy.average', 'np.average', (['w_sparsity'], {'weights': 'num_w'}), '(w_sparsity, weigh...
"""Plot 1d ovservables""" from gna.ui import basecmd, append_typed, qualified import matplotlib from matplotlib import pyplot as plt from matplotlib.ticker import AutoMinorLocator from mpl_tools.helpers import savefig import numpy as np from gna.bindings import common from gna.env import PartNotFoundError, env class ...
[ "gna.ui.basecmd.__init__", "numpy.savetxt", "gna.env.PartNotFoundError", "numpy.array", "gna.env.env.ns" ]
[((383, 422), 'gna.ui.basecmd.__init__', 'basecmd.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (399, 422), False, 'from gna.ui import basecmd, append_typed, qualified\n'), ((1174, 1192), 'numpy.array', 'np.array', (['dt.edges'], {}), '(dt.edges)\n', (1182, 1192), True, 'import numpy as np\n'), ((157...
import numpy as np import pandas as pd from tensorflow.keras import Input from keras.layers.core import Dropout, Dense from keras.layers import LSTM, Bidirectional, Concatenate from keras.layers.embeddings import Embedding from keras.models import Model from tensorflow.keras.preprocessing.text import Tokenizer fro...
[ "pandas.DataFrame", "model.convert_cities", "tensorflow.keras.preprocessing.text.Tokenizer", "keras.layers.embeddings.Embedding", "keras.layers.core.Dense", "model.convert_countries", "pandas.read_csv", "pandas.get_dummies", "tensorflow.keras.Input", "keras.layers.LSTM", "keras.models.Model", ...
[((440, 469), 'pandas.read_csv', 'pd.read_csv', (['"""data/train.csv"""'], {}), "('data/train.csv')\n", (451, 469), True, 'import pandas as pd\n'), ((477, 505), 'pandas.read_csv', 'pd.read_csv', (['"""data/test.csv"""'], {}), "('data/test.csv')\n", (488, 505), True, 'import pandas as pd\n'), ((546, 631), 'pandas.read_c...
import numpy as np from PIL import Image def save_image_array(img_array, fname, batch_size=100, class_num=10): channels = img_array.shape[1] resolution = img_array.shape[-1] img_rows = 10 img_cols = batch_size//class_num img = np.full([channels, resolution * img_rows, resolution * img_cols], 0.0) ...
[ "numpy.full", "PIL.Image.fromarray", "numpy.rollaxis" ]
[((249, 319), 'numpy.full', 'np.full', (['[channels, resolution * img_rows, resolution * img_cols]', '(0.0)'], {}), '([channels, resolution * img_rows, resolution * img_cols], 0.0)\n', (256, 319), True, 'import numpy as np\n'), ((710, 732), 'numpy.rollaxis', 'np.rollaxis', (['img', '(0)', '(3)'], {}), '(img, 0, 3)\n', ...
#!/usr/bin/env python3 import logging import torch import numpy as np import torch.nn as nn from torch.nn.utils.rnn import pack_padded_sequence from pytorch_translate import rnn # noqa logger = logging.getLogger(__name__) def add_args(parser): parser.add_argument( "--char-rnn", action="store_t...
[ "pytorch_translate.rnn.Embedding", "torch.LongTensor", "torch.cat", "pytorch_translate.rnn.LSTMSequenceEncoder.LSTM", "numpy.array", "torch.nn.utils.rnn.pack_padded_sequence", "torch.sort", "logging.getLogger" ]
[((198, 225), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (215, 225), False, 'import logging\n'), ((4715, 4838), 'pytorch_translate.rnn.Embedding', 'rnn.Embedding', ([], {'num_embeddings': 'num_embeddings', 'embedding_dim': 'embed_dim', 'padding_idx': 'self.padding_idx', 'freeze_embed'...
"""Multiview Random Gaussian Projection""" # Authors: <NAME> # # License: MIT import numpy as np from sklearn.base import TransformerMixin from sklearn.utils.validation import check_is_fitted from sklearn.random_projection import GaussianRandomProjection from .utils import check_n_views class RandomGaussianProject...
[ "numpy.random.seed", "sklearn.random_projection.GaussianRandomProjection", "sklearn.utils.validation.check_is_fitted" ]
[((2611, 2644), 'numpy.random.seed', 'np.random.seed', (['self.random_state'], {}), '(self.random_state)\n', (2625, 2644), True, 'import numpy as np\n'), ((3287, 3308), 'sklearn.utils.validation.check_is_fitted', 'check_is_fitted', (['self'], {}), '(self)\n', (3302, 3308), False, 'from sklearn.utils.validation import c...
import argparse import numpy as np import torch from torch import optim from torchvision import utils from tqdm import tqdm from model import Glow from samplers import memory_mnist, memory_fashion from utils import ( net_args, calc_z_shapes, calc_loss, string_args, create_deltas_sequence, ) parse...
[ "argparse.ArgumentParser", "torch.randn_like", "utils.create_deltas_sequence", "utils.calc_z_shapes", "model.Glow", "torch.randn", "torch.rand_like", "numpy.mean", "utils.calc_loss", "utils.string_args", "torch.no_grad" ]
[((333, 384), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Glow trainer"""'}), "(description='Glow trainer')\n", (356, 384), False, 'import argparse\n'), ((582, 599), 'utils.string_args', 'string_args', (['args'], {}), '(args)\n', (593, 599), False, 'from utils import net_args, calc_z_...
#!/usr/bin/env python3 import numpy as np #################### # generate_stimuli # #################### def generate_stimuli(arg, env): """ Function to generate the stimuli Arguments --------- arg: Argument for which to generate stimuli (either Argument or ArrayArgument) env: Dict mapping...
[ "numpy.sin" ]
[((1759, 1773), 'numpy.sin', 'np.sin', (['in_rad'], {}), '(in_rad)\n', (1765, 1773), True, 'import numpy as np\n'), ((1827, 1856), 'numpy.sin', 'np.sin', (["inputs['value'].value"], {}), "(inputs['value'].value)\n", (1833, 1856), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ Created on Fri Aug 31 22:33:41 2018 @author: Yulab """ import tensorflow as tf import numpy as np import math #%% def conv(layer_name, x, out_channels, kernel_size=[3,3], stride=[1,1,1,1], is_pretrain=True, seed=1): '''Convolution op wrapper, use RELU activation after convolution ...
[ "tensorflow.contrib.layers.xavier_initializer", "tensorflow.reduce_sum", "numpy.random.seed", "tensorflow.constant_initializer", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.nn.conv2d", "tensorflow.nn.relu", "tensorflow.variable_scope", "tensorflow.nn.softmax_cross_entropy_with_logits_v2...
[((4569, 4595), 'tensorflow.cast', 'tf.cast', (['correct', 'tf.int32'], {}), '(correct, tf.int32)\n', (4576, 4595), True, 'import tensorflow as tf\n'), ((4610, 4632), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['correct'], {}), '(correct)\n', (4623, 4632), True, 'import tensorflow as tf\n'), ((5753, 5773), 'numpy.rando...
from hoomd_periodic import simulate from md_nnps_periodic import MDNNPSSolverPeriodic import numpy as np import matplotlib.pyplot as plt def run_simulations(num_particles, tf, dt): # run hoomd simulation simulate(num_particles, dt, tf, log=True) # run compyle simulation solver = MDNNPSSolverPeriodic(n...
[ "hoomd_periodic.simulate", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.pyplot.legend", "numpy.genfromtxt", "matplotlib.pyplot.ylabel", "md_nnps_periodic.MDNNPSSolverPeriodic", "matplotlib.pyplot.savefig", "matplotlib.pyplot.xlabel" ]
[((213, 254), 'hoomd_periodic.simulate', 'simulate', (['num_particles', 'dt', 'tf'], {'log': '(True)'}), '(num_particles, dt, tf, log=True)\n', (221, 254), False, 'from hoomd_periodic import simulate\n'), ((298, 333), 'md_nnps_periodic.MDNNPSSolverPeriodic', 'MDNNPSSolverPeriodic', (['num_particles'], {}), '(num_partic...
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
[ "numpy.abs", "numpy.allclose", "numpy.einsum", "numpy.linalg.svd", "numpy.diag", "numpy.conjugate", "numpy.round", "openfermion.hermitian_conjugated", "numpy.transpose", "numpy.isrealobj", "openfermion.FermionOperator", "numpy.conj", "numpy.complex128", "scipy.linalg.block_diag", "numpy....
[((1906, 1936), 'numpy.zeros', 'np.zeros', (['(nso ** 2, nso ** 2)'], {}), '((nso ** 2, nso ** 2))\n', (1914, 1936), True, 'import numpy as np\n'), ((2302, 2348), 'numpy.allclose', 'np.allclose', (['test_generator_mat', 'generator_mat'], {}), '(test_generator_mat, generator_mat)\n', (2313, 2348), True, 'import numpy as...
import numpy as np def to_categorical(y, num_classes=None): """Converts a class vector (integers) to binary class matrix. E.g. for use with categorical_crossentropy. # Arguments y: class vector to be converted into a matrix (integers from 0 to num_classes). num_classes: total...
[ "numpy.zeros", "numpy.max", "numpy.arange", "numpy.array", "numpy.reshape" ]
[((465, 489), 'numpy.array', 'np.array', (['y'], {'dtype': '"""int"""'}), "(y, dtype='int')\n", (473, 489), True, 'import numpy as np\n'), ((747, 791), 'numpy.zeros', 'np.zeros', (['(n, num_classes)'], {'dtype': 'np.float32'}), '((n, num_classes), dtype=np.float32)\n', (755, 791), True, 'import numpy as np\n'), ((895, ...
# -*- coding: utf-8 -*- """ Functions relating velocity trend extrapolation """ from __future__ import (absolute_import, division, print_function, unicode_literals) __author__ = "yuhao" import numpy as np from pygeopressure.basic.well_log import Log # from ..well_log import Log v0 = 1600 # t...
[ "numpy.array", "numpy.exp", "pygeopressure.basic.well_log.Log" ]
[((1209, 1226), 'numpy.exp', 'np.exp', (['(x * b - a)'], {}), '(x * b - a)\n', (1215, 1226), True, 'import numpy as np\n'), ((1474, 1479), 'pygeopressure.basic.well_log.Log', 'Log', ([], {}), '()\n', (1477, 1479), False, 'from pygeopressure.basic.well_log import Log\n'), ((1496, 1519), 'numpy.array', 'np.array', (['vel...
import time import numpy as np import matplotlib.pyplot as plt from test_farfield import make_meshes from tectosaur.ops.sparse_integral_op import RegularizedSparseIntegralOp from tectosaur.ops.dense_integral_op import RegularizedDenseIntegralOp from tectosaur.ops.sparse_farfield_op import TriToTriDirectFarfieldOp from ...
[ "numpy.ones", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.exp", "tectosaur.ops.sparse_integral_op.RegularizedSparseIntegralOp", "tectosaur.logger.setLevel", "numpy.full", "tectosaur.ops.dense_integral_op.RegularizedDenseIntegralOp", "numpy.testing.assert_almost_equal", "matplotlib.pyplot.col...
[((1550, 1585), 'numpy.zeros', 'np.zeros', (['(dof_pts.shape[0] * 3, 3)'], {}), '((dof_pts.shape[0] * 3, 3))\n', (1558, 1585), True, 'import numpy as np\n'), ((1863, 1884), 'tectosaur.constraint_builders.find_free_edges', 'find_free_edges', (['m[1]'], {}), '(m[1])\n', (1878, 1884), False, 'from tectosaur.constraint_bui...
from rh_logger.api import logger import logging import numpy as np from scipy.optimize import least_squares import pickle import os import time import scipy.sparse as spp from scipy.sparse.linalg import lsqr import scipy.optimize from rh_renderer.models import RigidModel #import common EPS = 0.000001 class Rigid2DOpt...
[ "scipy.sparse.linalg.lsqr", "numpy.zeros_like", "numpy.ones_like", "numpy.sum", "numpy.abs", "numpy.median", "numpy.empty", "numpy.empty_like", "time.time", "numpy.min", "numpy.sin", "pickle.load", "numpy.array", "numpy.cos", "rh_renderer.models.RigidModel", "numpy.mean", "numpy.dot"...
[((939, 952), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (945, 952), True, 'import numpy as np\n'), ((973, 986), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (979, 986), True, 'import numpy as np\n'), ((1289, 1331), 'numpy.empty', 'np.empty', (['(matches_num,)'], {'dtype': 'np.float32'}), '((matches_n...
from abc import ABC, abstractmethod, abstractclassmethod from typing import Dict, Optional import pandas as pd import numpy as np from wiseml.models.types.task_type import TaskType from wiseml.models.types.model_type import ModelType class TrainSet: def __init__(self, X: pd.DataFrame, y: pd.Series): if...
[ "numpy.arange" ]
[((434, 455), 'numpy.arange', 'np.arange', (['X.shape[0]'], {}), '(X.shape[0])\n', (443, 455), True, 'import numpy as np\n')]
"""Code for AMS 2019 short course.""" import copy import glob import errno import random import os.path import json import pickle import time import calendar import numpy import netCDF4 import keras from keras import backend as K from sklearn.metrics import auc as scikit_learn_auc import matplotlib.colors import matpl...
[ "numpy.sum", "keras.backend.epsilon", "numpy.ones", "keras.models.Model", "numpy.argsort", "numpy.linalg.svd", "numpy.exp", "keras.layers.Input", "netCDF4.Dataset", "keras.layers.Flatten", "numpy.max", "matplotlib.pyplot.rc", "matplotlib.pyplot.subplots", "keras.backend.gradients", "matp...
[((974, 992), 'numpy.full', 'numpy.full', (['(3)', '(0.0)'], {}), '(3, 0.0)\n', (984, 992), False, 'import numpy\n'), ((1080, 1113), 'matplotlib.pyplot.rc', 'pyplot.rc', (['"""font"""'], {'size': 'FONT_SIZE'}), "('font', size=FONT_SIZE)\n", (1089, 1113), True, 'import matplotlib.pyplot as pyplot\n'), ((1114, 1152), 'ma...
# libraries import numpy as np from bio_embeddings.embed import ProtTransT5BFDEmbedder import pandas as pd embedder = ProtTransT5BFDEmbedder() ds = pd.read_csv('Sequences_Predict.csv') sequences_Example = list(ds["Sequence"]) num_seq = len(sequences_Example) i = 0 length = 1000 while i < num_seq: print("Doing", i...
[ "pandas.read_csv", "numpy.asarray", "numpy.savez_compressed", "bio_embeddings.embed.ProtTransT5BFDEmbedder" ]
[((120, 144), 'bio_embeddings.embed.ProtTransT5BFDEmbedder', 'ProtTransT5BFDEmbedder', ([], {}), '()\n', (142, 144), False, 'from bio_embeddings.embed import ProtTransT5BFDEmbedder\n'), ((151, 187), 'pandas.read_csv', 'pd.read_csv', (['"""Sequences_Predict.csv"""'], {}), "('Sequences_Predict.csv')\n", (162, 187), True,...
from math import isclose import numpy as np from scipy.spatial.transform.rotation import Rotation from scipy.spatial.distance import cityblock MIN_OVERLAPPING_BEACONS = 12 scanner_positions = [] class Beacon: def __init__(self, x: int, y: int, z: int): self.pos = np.array([x, y, z]) class Scanner: ...
[ "numpy.radians", "scipy.spatial.distance.cityblock", "numpy.array", "math.isclose", "numpy.linalg.norm", "scipy.spatial.transform.rotation.Rotation.from_rotvec" ]
[((2299, 2320), 'numpy.radians', 'np.radians', (['x_degrees'], {}), '(x_degrees)\n', (2309, 2320), True, 'import numpy as np\n'), ((2341, 2360), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (2349, 2360), True, 'import numpy as np\n'), ((2424, 2461), 'scipy.spatial.transform.rotation.Rotation.from_ro...
# -*- coding: utf-8 -*- __author__ = 'Jinkey' import time import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage from dnn_app_utils import * from keras.models import Sequential, load_model from keras.layers import Dense, Dropout, Activation np.rando...
[ "keras.models.load_model", "h5py.File", "numpy.random.seed", "matplotlib.pyplot.show", "keras.models.Sequential", "matplotlib.pyplot.imshow", "keras.layers.Dense", "scipy.misc.imresize", "numpy.squeeze", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "scipy.ndimage.imread" ]
[((312, 329), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (326, 329), True, 'import numpy as np\n'), ((587, 599), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (597, 599), False, 'from keras.models import Sequential, load_model\n'), ((1764, 1781), 'numpy.random.seed', 'np.random.seed', (...
""" ******************************************************************************** make figures ******************************************************************************** """ import numpy as np from scipy.interpolate import griddata import matplotlib.pyplot as plt def plt_sol0(XY, u, width, height, cmap): ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.pcolor", "matplotlib.pyplot.subplot", "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "numpy.arange", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((376, 405), 'numpy.linspace', 'np.linspace', (['lb[0]', 'ub[0]', 'nx'], {}), '(lb[0], ub[0], nx)\n', (387, 405), True, 'import numpy as np\n'), ((414, 443), 'numpy.linspace', 'np.linspace', (['lb[1]', 'ub[1]', 'nx'], {}), '(lb[1], ub[1], nx)\n', (425, 443), True, 'import numpy as np\n'), ((455, 472), 'numpy.meshgrid'...
#### feed in the obs seq line by line #### quantity becomes all one #### feed with all obs seq import numpy as np import pandas as pd import random from sklearn.model_selection import KFold from hmm_class import hmm from sklearn.preprocessing import normalize import time import matplotlib.pyplot as plt #...
[ "matplotlib.pyplot.title", "numpy.argmax", "hmm_class.hmm", "numpy.ones", "numpy.shape", "matplotlib.pyplot.figure", "numpy.arange", "numpy.unique", "random.randint", "numpy.loadtxt", "matplotlib.pyplot.show", "time.perf_counter", "sklearn.preprocessing.normalize", "matplotlib.pyplot.ylabe...
[((411, 442), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'dtype': 'int'}), '(filename, dtype=int)\n', (421, 442), True, 'import numpy as np\n'), ((452, 491), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'k_splits', 'shuffle': '(False)'}), '(n_splits=k_splits, shuffle=False)\n', (457, 491), False, 'fr...
from functools import partial import numpy as np import matplotlib.pyplot as plt from mne.utils import _TempDir from pactools.dar_model import AR, DAR, HAR, StableDAR from pactools.utils.testing import assert_equal, assert_greater from pactools.utils.testing import assert_raises, assert_array_equal from pactools.uti...
[ "functools.partial", "pactools.simulate_pac.simulate_pac", "pactools.utils.testing.assert_raises", "mne.utils._TempDir", "matplotlib.pyplot.close", "pactools.utils.testing.assert_array_equal", "pactools.comodulogram.read_comodulogram", "numpy.zeros", "pactools.utils.testing.assert_equal", "pactool...
[((827, 952), 'pactools.simulate_pac.simulate_pac', 'simulate_pac', ([], {'n_points': 'n_points', 'fs': 'fs', 'high_fq': 'high_fq', 'low_fq': 'low_fq', 'low_fq_width': '(1.0)', 'noise_level': '(0.1)', 'random_state': '(0)'}), '(n_points=n_points, fs=fs, high_fq=high_fq, low_fq=low_fq,\n low_fq_width=1.0, noise_level...
import numpy as np from ..base import NCMBase from sklearn.neighbors import NearestNeighbors class KNeighborsMean(NCMBase): def __init__(self, **sklearn): if "n_neighbors" in sklearn: sklearn["n_neighbors"] += 1 else: sklearn["n_neighbors"] = 6 self.clf = NearestN...
[ "numpy.array", "sklearn.neighbors.NearestNeighbors", "numpy.unique" ]
[((312, 339), 'sklearn.neighbors.NearestNeighbors', 'NearestNeighbors', ([], {}), '(**sklearn)\n', (328, 339), False, 'from sklearn.neighbors import NearestNeighbors\n'), ((1084, 1097), 'numpy.array', 'np.array', (['res'], {}), '(res)\n', (1092, 1097), True, 'import numpy as np\n'), ((768, 802), 'numpy.unique', 'np.uni...
""" .. _pyvista_demo_ref: 3D Visualization with PyVista ============================= The example demonstrates the how to use the VTK interface via the `pyvista library <http://docs.pyvista.org>`__ . To run this example, you will need to `install pyvista <http://docs.pyvista.org/getting-started/installation.html>`__ ...
[ "pyvista.set_plot_theme", "discretize.utils.download", "shelve.open", "pyvista.Plotter", "numpy.loadtxt", "tarfile.open", "discretize.TensorMesh.copy", "pyvista.PolyData" ]
[((794, 823), 'pyvista.set_plot_theme', 'pv.set_plot_theme', (['"""document"""'], {}), "('document')\n", (811, 823), True, 'import pyvista as pv\n'), ((1387, 1433), 'discretize.utils.download', 'discretize.utils.download', (['url'], {'overwrite': '(True)'}), '(url, overwrite=True)\n', (1412, 1433), False, 'import discr...
import numpy as np # time occ1 occ2 mctdh_data = np.array( [[5.0000000e-01, 1.2083970e-02, 9.8791603e-01], [1.0000000e+00, 4.3008830e-02, 9.5699117e-01], [1.5000000e+00, 7.9675930e-02, 9.2032407e-01], [2.0000000e+00, 1.0804013e-01, 8.9195987e-01], [2.5000000e...
[ "numpy.array" ]
[((76, 8320), 'numpy.array', 'np.array', (['[[0.5, 0.01208397, 0.98791603], [1.0, 0.04300883, 0.95699117], [1.5, \n 0.07967593, 0.92032407], [2.0, 0.10804013, 0.89195987], [2.5, \n 0.11972252, 0.88027748], [3.0, 0.11480491, 0.88519509], [3.5, \n 0.09996381, 0.90003619], [4.0, 0.08391523, 0.91608477], [4.5, \n ...