code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- coding: utf-8 -*- ''' TopQuant-TQ极宽智能量化回溯分析系统2019版 Top极宽量化(原zw量化),Python量化第一品牌 by Top极宽·量化开源团队 2019.01.011 首发 网站: www.TopQuant.vip www.ziwang.com QQ群: Top极宽量化总群,124134140 文件名:toolkit.py 默认缩写:import topquant2019 as tk 简介:Top极宽量化·常用量化系统参数模块 ''' # import sys, os, re import arrow, bs4, rando...
[ "backtrader.feeds.PandasData", "arrow.get", "matplotlib.style.use", "pandas.read_csv", "pyfolio.create_full_tear_sheet", "backtrader.Cerebro", "pandas.set_option", "pandas.DataFrame", "numpy.set_printoptions", "arrow.now", "os.path.exists", "datetime.timedelta", "pyfolio.utils.to_utc", "io...
[((6630, 6664), 'matplotlib.style.use', 'mpl.style.use', (['"""seaborn-whitegrid"""'], {}), "('seaborn-whitegrid')\n", (6643, 6664), True, 'import matplotlib as mpl\n'), ((6670, 6705), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(450)'], {}), "('display.width', 450)\n", (6683, 6705), True, 'import p...
#codig:utf-8 import tensorflow as tf import numpy as np c = np.random.random([5,1]) ##随机生成一个5*1的数组 b = tf.nn.embedding_lookup(c, [1, 3]) ##查找数组中的序号为1和3的 with tf.Session() as sess: sess.run(tf.initialize_all_variables()) print(sess.run(b)) print(c)
[ "tensorflow.nn.embedding_lookup", "numpy.random.random", "tensorflow.Session", "tensorflow.initialize_all_variables" ]
[((61, 85), 'numpy.random.random', 'np.random.random', (['[5, 1]'], {}), '([5, 1])\n', (77, 85), True, 'import numpy as np\n'), ((105, 138), 'tensorflow.nn.embedding_lookup', 'tf.nn.embedding_lookup', (['c', '[1, 3]'], {}), '(c, [1, 3])\n', (127, 138), True, 'import tensorflow as tf\n'), ((162, 174), 'tensorflow.Sessio...
import numpy as np # give the corresponding posterior distribution of stimulus parameters, given the response def postsGivenResp(bins, posts, response, preferred=0): assert 0 <= preferred <= (2 * np.pi), "preferred should be in range 0, 2π" idx = np.argmin(np.abs(bins[2][:-1] - response)) slc = posts[:, :...
[ "numpy.sum", "numpy.log", "numpy.abs", "numpy.argmax", "numpy.roll", "numpy.amin", "numpy.nanstd", "numpy.zeros", "numpy.unravel_index", "numpy.shape", "numpy.cumsum", "numpy.amax", "numpy.array", "numpy.exp", "numpy.cos", "numpy.nanmean" ]
[((387, 407), 'numpy.roll', 'np.roll', (['slc', 'idx', '(1)'], {}), '(slc, idx, 1)\n', (394, 407), True, 'import numpy as np\n'), ((1398, 1419), 'numpy.cumsum', 'np.cumsum', (['postAll', '(0)'], {}), '(postAll, 0)\n', (1407, 1419), True, 'import numpy as np\n'), ((1761, 1785), 'numpy.shape', 'np.shape', (['posts[0, :, ...
__author__ = 'zhenyang' import numpy import logging import theano import theano.tensor as TT import cPickle from scipy import stats from sparnn.utils import * import sys sys.setrecursionlimit(15000) logger = logging.getLogger(__name__) ''' In VideoModel, middle_layers is a list cost_layer is a layer that stores t...
[ "numpy.sum", "numpy.argmax", "cPickle.load", "cPickle.dump", "theano.tensor.grad", "numpy.mean", "sys.setrecursionlimit", "logging.getLogger" ]
[((173, 201), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(15000)'], {}), '(15000)\n', (194, 201), False, 'import sys\n'), ((212, 239), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (229, 239), False, 'import logging\n'), ((1401, 1458), 'cPickle.dump', 'cPickle.dump', (['model',...
# Read the HDF5 stores and generate frames for a movie import matplotlib matplotlib.use('Qt5Agg') # avoids crashing MacOS Mojave import numpy as np import pandas as pd import healpy as hp import copy from matplotlib import cm from astropy.time import Time import matplotlib.pyplot as plt plt.interactive(False) # GALEX...
[ "matplotlib.cm.get_cmap", "healpy.graticule", "matplotlib.pyplot.style.use", "numpy.arange", "pandas.DataFrame", "pandas.read_hdf", "matplotlib.pyplot.interactive", "matplotlib.pyplot.close", "numpy.max", "matplotlib.pyplot.rcParams.update", "numpy.log10", "numpy.ma.masked_where", "astropy.t...
[((73, 97), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (87, 97), False, 'import matplotlib\n'), ((289, 311), 'matplotlib.pyplot.interactive', 'plt.interactive', (['(False)'], {}), '(False)\n', (304, 311), True, 'import matplotlib.pyplot as plt\n'), ((345, 381), 'pandas.read_hdf', 'pd.re...
import numpy as np import matplotlib.pyplot as plt from uncertainties import ufloat from scipy import optimize from scipy.stats import sem h, P1, P2, t, h_schieb = np.genfromtxt('python/daten/daempfung.txt', unpack=True) h *= 1e-3 # h in meter t *= 1e-6 # t in sekunden h_schieb *= 1e-3 # s in meter len = len(h) c...
[ "numpy.diag", "matplotlib.pyplot.xlim", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.genfromtxt", "scipy.optimize.curve_fit", "uncertainties.ufloat", "numpy.mean", "scipy.stats.sem", "numpy.linspace", "numpy.column_s...
[((165, 221), 'numpy.genfromtxt', 'np.genfromtxt', (['"""python/daten/daempfung.txt"""'], {'unpack': '(True)'}), "('python/daten/daempfung.txt', unpack=True)\n", (178, 221), True, 'import numpy as np\n'), ((323, 351), 'numpy.linspace', 'np.linspace', (['(0)', '(len - 1)', 'len'], {}), '(0, len - 1, len)\n', (334, 351),...
import csv import numpy as np from source import utils from source.preprocessing.activity_count.activity_count_collection import ActivityCountCollection class MesaActigraphyService(object): @staticmethod def load_raw(file_id): line_align = -1 # Find alignment line between PSG and actigraphy ...
[ "csv.reader", "source.utils.remove_nans", "source.preprocessing.activity_count.activity_count_collection.ActivityCountCollection", "source.utils.get_project_root", "numpy.array" ]
[((1467, 1485), 'numpy.array', 'np.array', (['activity'], {}), '(activity)\n', (1475, 1485), True, 'import numpy as np\n'), ((1501, 1524), 'source.utils.remove_nans', 'utils.remove_nans', (['data'], {}), '(data)\n', (1518, 1524), False, 'from source import utils\n'), ((1541, 1595), 'source.preprocessing.activity_count....
import json import geopandas as gpd import glob import numpy as np import os import pathlib import re import shapely.geometry from skimage import io import sys from config import DETECTION_THRESHOLD import lib_classification sys.path.insert(0, "../annotation/") from annotate import identifier_from_asset, asset_prefix...
[ "json.load", "geopandas.GeoSeries", "lib_classification.determine_target_bboxes", "annotate.asset_from_filename", "sys.path.insert", "annotate.identifier_from_asset", "pathlib.Path", "numpy.round", "os.path.join", "annotate.asset_prefix_from_asset", "re.compile" ]
[((227, 263), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../annotation/"""'], {}), "(0, '../annotation/')\n", (242, 263), False, 'import sys\n'), ((1501, 1545), 're.compile', 're.compile', (['""".*/ROIs-(swissimage.*).geojson"""'], {}), "('.*/ROIs-(swissimage.*).geojson')\n", (1511, 1545), False, 'import re\n')...
import numpy from pyscf.dft.numint import eval_ao from pyscf.tools.cubegen import Cube import pyscf.tools.molden from qstack.fields.decomposition import number_of_electrons_deco def coeffs_to_cube(mol, coeffs, cubename, nx = 80, ny = 80, nz = 80, resolution = 0.1, margin = 3.0): # Make grid grid = Cube(mol, n...
[ "pyscf.dft.numint.eval_ao", "qstack.fields.decomposition.number_of_electrons_deco", "numpy.array", "numpy.dot", "pyscf.tools.cubegen.Cube" ]
[((309, 350), 'pyscf.tools.cubegen.Cube', 'Cube', (['mol', 'nx', 'ny', 'nz', 'resolution', 'margin'], {}), '(mol, nx, ny, nz, resolution, margin)\n', (313, 350), False, 'from pyscf.tools.cubegen import Cube\n'), ((464, 484), 'pyscf.dft.numint.eval_ao', 'eval_ao', (['mol', 'coords'], {}), '(mol, coords)\n', (471, 484), ...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "numpy.random.seed", "ml_perf.mlp_log.init_stop", "rl_loop.fsdb.holdout_dir", "rl_loop.example_buffer.ExampleBuffer", "logging.getLogger", "logging.Formatter", "rl_loop.fsdb.eval_dir", "absl.flags.DEFINE_boolean", "glob.glob", "shutil.rmtree", "absl.flags.FlagValues", "os.path.join", "loggin...
[((658, 681), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (673, 681), False, 'import sys\n'), ((1148, 1345), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""checkpoint_dir"""', 'None', '"""The checkpoint directory specify a start model and a set of golden chunks used to start ...
#!/usr/bin/env python3 """ @Filename: inference.py @Author: dulanj @Time: 02/10/2021 19:18 """ import numpy as np import tensorflow as tf from deeplab.dataset import read_image def load_model(model_path): deeplab_model = tf.keras.models.load_model(model_path) return deeplab_model def inferenc...
[ "tensorflow.keras.models.load_model", "numpy.argmax", "numpy.expand_dims", "deeplab.dataset.read_image", "numpy.squeeze" ]
[((242, 280), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['model_path'], {}), '(model_path)\n', (268, 280), True, 'import tensorflow as tf\n'), ((529, 552), 'numpy.squeeze', 'np.squeeze', (['predictions'], {}), '(predictions)\n', (539, 552), True, 'import numpy as np\n'), ((571, 601), 'numpy.a...
import time from heapq import heappop, heappush import numpy as np import math class ShortestValidPathsComputerLORENZ(object): ''' This class is optimized used to check correctness of the optimized lorenz class; they should produce the same output ''' def __init__(self, substrate, valid_mapping_r...
[ "numpy.full", "heapq.heappush", "math.sqrt", "math.ceil", "heapq.heappop" ]
[((1217, 1266), 'numpy.full', 'np.full', (['self.number_of_nodes', '(-1)'], {'dtype': 'np.int32'}), '(self.number_of_nodes, -1, dtype=np.int32)\n', (1224, 1266), True, 'import numpy as np\n'), ((1297, 1352), 'numpy.full', 'np.full', (['self.number_of_nodes', 'np.inf'], {'dtype': 'np.float64'}), '(self.number_of_nodes, ...
""" Author: <NAME> email: <EMAIL> """ from __future__ import print_function from __future__ import division import argparse import os import sys sys.path.append("..") # Adds higher directory to python modules path. import shutil import time import yaml import torch from torchvision import datasets, transforms # f...
[ "sys.path.append", "numpy.random.choice", "numpy.meshgrid", "rospy.Time.now", "ros_numpy.numpify", "numpy.floor", "numpy.zeros", "numpy.transpose", "numpy.ones", "matplotlib.pyplot.draw", "ros_numpy.msgify", "numba.jit", "numpy.arange", "visualization_msgs.msg.Marker", "numpy.array", "...
[((150, 171), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (165, 171), False, 'import sys\n'), ((8886, 8904), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (8889, 8904), False, 'from numba import jit, types\n'), ((9452, 9470), 'numba.jit', 'jit', ([], {'nopython': '(Tru...
import torch import torch.nn as nn from torch.nn import BCEWithLogitsLoss from torch.nn import CrossEntropyLoss from torchvision import models import numpy as np from .transforms import create_part # class AttentionLoss(nn.Module): # def __init__(self): # super(AttentionLoss, self).__init__() # def fo...
[ "torchvision.models.vgg19", "torch.cat", "torch.nn.MSELoss", "torch.load", "torch.Tensor", "torch.mean", "torch.nn.BCEWithLogitsLoss", "torch.topk", "torch.max", "torch.pow", "torch.rand", "torch.nn.ConstantPad2d", "torch.sum", "torch.min", "torch.nn.Sequential", "torch.nn.L1Loss", "...
[((10857, 10887), 'numpy.random.rand', 'np.random.rand', (['(4)', '(3)', '(256)', '(192)'], {}), '(4, 3, 256, 192)\n', (10871, 10887), True, 'import numpy as np\n'), ((10897, 10916), 'torch.Tensor', 'torch.Tensor', (['input'], {}), '(input)\n', (10909, 10916), False, 'import torch\n'), ((538, 562), 'torch.abs', 'torch....
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
[ "bokeh.plotting.figure", "scipy.cluster.hierarchy.linkage", "bokeh.models.LinearColorMapper", "bokeh.plotting.output_file", "numpy.imag", "bokeh.plotting.show", "numpy.array", "numpy.real", "scipy.cluster.hierarchy.dendrogram" ]
[((1640, 1661), 'bokeh.plotting.output_file', 'output_file', (['filename'], {}), '(filename)\n', (1651, 1661), False, 'from bokeh.plotting import figure, output_file, show, ColumnDataSource\n'), ((2634, 2684), 'bokeh.models.LinearColorMapper', 'LinearColorMapper', ([], {'palette': 'colors', 'low': '(0)', 'high': '(1.0)...
#!/usr/bin/env python3 from .grid import Grid from .agent import Agent import numpy as np import time from .graphics import display_grid import random import json ELEMENT_INT_DICT = {'agent':1,'train':2,'switch':3} GRID_TYPE_DICT = {0:'push only',1:'switch or push',2:'do nothing',3:'others death'} def get_within(st...
[ "json.dump", "numpy.save", "numpy.concatenate", "random.sample", "numpy.empty", "random.shuffle", "time.time", "numpy.random.choice", "numpy.random.permutation", "numpy.vstack" ]
[((926, 945), 'numpy.random.choice', 'np.random.choice', (['(4)'], {}), '(4)\n', (942, 945), True, 'import numpy as np\n'), ((2183, 2224), 'random.sample', 'random.sample', (['unreachable_pos_choices', '(2)'], {}), '(unreachable_pos_choices, 2)\n', (2196, 2224), False, 'import random\n'), ((2327, 2361), 'random.sample'...
from common import ProblemType from solver import Solver from gui import Gui import images import connection_table as ct import numpy def multires(nelx, nely, params, bc): # Allocate design variables for the first level x = None x_comp = None # Dynamic parameters downsampling = 2**(params.numLeve...
[ "solver.Solver", "connection_table.construct_mapping_vector_wheel", "connection_table.construct_mapping_vector_shelf", "connection_table.construct_connection_table", "images.upsample", "connection_table.construct_mapping_vector", "numpy.dot", "numpy.array", "gui.Gui", "connection_table.construct_m...
[((643, 673), 'images.upsample', 'images.upsample', (['x', 'nelx', 'nely'], {}), '(x, nelx, nely)\n', (658, 673), False, 'import images\n'), ((950, 965), 'gui.Gui', 'Gui', (['nelx', 'nely'], {}), '(nelx, nely)\n', (953, 965), False, 'from gui import Gui\n'), ((1096, 1155), 'solver.Solver', 'Solver', (['nelx', 'nely', '...
import os import sys import numpy as np import matplotlib.pyplot as plt rng = np.random.default_rng(2021) #Setting the seed for reproducibility def coords_to_string(coords): """Function to convert a (RA, DEC) set of coordinates to a string. Args: coords: List or tuple with RA and DEC. Retur...
[ "casatools.msmetadata", "numpy.abs", "numpy.argmax", "casatools.quanta", "numpy.random.default_rng", "matplotlib.pyplot.figure", "numpy.sin", "numpy.zeros_like", "matplotlib.pyplot.close", "os.path.dirname", "os.path.exists", "numpy.genfromtxt", "numpy.append", "numpy.int", "os.path.base...
[((78, 105), 'numpy.random.default_rng', 'np.random.default_rng', (['(2021)'], {}), '(2021)\n', (99, 105), True, 'import numpy as np\n'), ((450, 461), 'numpy.int', 'np.int', (['pra'], {}), '(pra)\n', (456, 461), True, 'import numpy as np\n'), ((473, 500), 'numpy.int', 'np.int', (['((pra - Hpra) * 60.0)'], {}), '((pra -...
#!/usr/bin/env python # SPDX-License-Identifier: MIT # See LICENSE file for additional copyright and license details. import os, datetime, sys, argparse, random import numpy as np import matplotlib.pyplot as plt import modules import pointgen import utils import plotter import style DEMO_NAME = "demo_04_scalespace_...
[ "os.mkdir", "plotter.sample_segment", "numpy.random.seed", "argparse.ArgumentParser", "utils.gen_symbols", "os.path.exists", "matplotlib.pyplot.draw", "utils.intersect", "random.seed", "utils.Recorder", "matplotlib.pyplot.show", "plotter.transition_domain", "utils.Config", "modules.Transit...
[((1012, 1052), 'utils.intersect', 'utils.intersect', (['targets', 'active_symbols'], {}), '(targets, active_symbols)\n', (1027, 1052), False, 'import utils\n'), ((3509, 3532), 'utils.Recorder', 'utils.Recorder', (['nscales'], {}), '(nscales)\n', (3523, 3532), False, 'import utils\n'), ((4086, 4096), 'matplotlib.pyplot...
# coding = utf-8 import numpy as np from scipy.signal import lfilter, lfilter_zi, lfiltic import librosa # from scikits.talkbox import lpc def hz2mel(f): return 2595. * np.log10(1. + f / 700.) def mel2hz(z): return 700. * (np.power(10., z / 2595.) - 1.) def get_window(win_len, win_type): if win_type =...
[ "numpy.abs", "numpy.sum", "numpy.angle", "numpy.floor", "numpy.ones", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.sin", "numpy.linalg.norm", "numpy.zeros_like", "numpy.multiply", "scipy.signal.lfilter", "numpy.power", "numpy.fft.fft", "numpy.append", "numpy.finfo", "numpy.res...
[((965, 998), 'numpy.zeros', 'np.zeros', (['(nfilts, nfft // 2 + 1)'], {}), '((nfilts, nfft // 2 + 1))\n', (973, 998), True, 'import numpy as np\n'), ((1785, 1841), 'numpy.append', 'np.append', (['xx[0]', '(xx[1:] - pre_emphasis_weight * xx[:-1])'], {}), '(xx[0], xx[1:] - pre_emphasis_weight * xx[:-1])\n', (1794, 1841)...
""" The DenseDesignMatrix class and related code. Functionality for representing data that can be described as a dense matrix (rather than a sparse matrix) with each row containing an example and each column corresponding to a different feature. DenseDesignMatrix also supports other "views" of the data, for example a d...
[ "pylearn2.utils.rng.make_np_rng", "numpy.load", "numpy.abs", "pylearn2.utils.iteration.resolve_iterator_class", "tables.Int64Atom", "pylearn2.datasets.control.get_load_data", "tables.Int32Atom", "pylearn2.space.Conv2DSpace", "numpy.prod", "tables.Float32Atom", "tables.Float64Atom", "pylearn2.u...
[((1474, 1501), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1491, 1501), False, 'import logging\n'), ((10917, 10950), 'functools.wraps', 'functools.wraps', (['Dataset.iterator'], {}), '(Dataset.iterator)\n', (10932, 10950), False, 'import functools\n'), ((31728, 31769), 'functools.wra...
""" This function is intended to wrap the rewards returned by the CityLearn RL environment, and is meant to be modified at will. This reward_function takes all the electrical demands of all the buildings and turns them into one or multiple rewards for the agent(s) The current code of reward_functioin_ma computes a re...
[ "numpy.abs", "numpy.float32", "numpy.array", "numpy.sign" ]
[((1365, 1395), 'numpy.float32', 'np.float32', (['electricity_demand'], {}), '(electricity_demand)\n', (1375, 1395), True, 'import numpy as np\n'), ((1555, 1583), 'numpy.array', 'np.array', (['electricity_demand'], {}), '(electricity_demand)\n', (1563, 1583), True, 'import numpy as np\n'), ((2012, 2040), 'numpy.array',...
from skimage import filters, io import numpy as np import cv2 from scipy import signal import utils from matplotlib import pyplot as plt def get_obj_mask(image): """ Get the object in an image. :param raw_image: :return: mask of ROI of the object """ float_image = np.float32(image) otsu_th...
[ "numpy.zeros_like", "numpy.abs", "skimage.filters.threshold_otsu", "cv2.filter2D", "numpy.ones_like", "numpy.sum", "cv2.morphologyEx", "numpy.float32", "numpy.zeros", "numpy.ones", "numpy.min", "numpy.max", "numpy.mean" ]
[((291, 308), 'numpy.float32', 'np.float32', (['image'], {}), '(image)\n', (301, 308), True, 'import numpy as np\n'), ((330, 365), 'skimage.filters.threshold_otsu', 'filters.threshold_otsu', (['float_image'], {}), '(float_image)\n', (352, 365), False, 'from skimage import filters, io\n'), ((602, 623), 'numpy.float32', ...
from beautifultable import BeautifulTable from paintstorch.network import Generator, Illustration2Vec from torch.utils.data import DataLoader from torchvision.models import inception_v3 from tqdm import tqdm from evaluation.data import FullHintsDataset, NoHintDataset, SparseHintsDataset import cv2 import lpips import ...
[ "numpy.trace", "argparse.ArgumentParser", "numpy.mean", "evaluation.data.FullHintsDataset", "torch.no_grad", "torch.utils.data.DataLoader", "cv2.cvtColor", "torch.load", "torch.nn.functional.adaptive_avg_pool2d", "torch.zeros", "numpy.cov", "tqdm.tqdm", "torch.jit.load", "paintstorch.netwo...
[((789, 804), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (802, 804), False, 'import torch\n'), ((1780, 1805), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1803, 1805), False, 'import argparse\n'), ((2419, 2441), 'torch.load', 'torch.load', (['args.model'], {}), '(args.model)\n', (24...
#!/bin/env python import argparse import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter import numpy as np import os import sys # insert current directory into PYTHONPATH to allow imports sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) from cmdline import define_cmdline_args, ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.magnitude_spectrum", "csv_io.gen_input_files", "matplotlib.pyplot.plot", "matplotlib.pyplot.hist", "cmdline.define_cmdline_args", "matplotlib.pyplot.show", "os.path.dirname", "os.path.join", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.p...
[((909, 960), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': "FIGURE_CONFIGURATION['figsize']"}), "(figsize=FIGURE_CONFIGURATION['figsize'])\n", (919, 960), True, 'import matplotlib.pyplot as plt\n'), ((965, 997), 'matplotlib.pyplot.plot', 'plt.plot', (['jitter'], {'label': '"""jitter"""'}), "(jitter, label...
from setuptools import setup, Extension, dist import setuptools import sys dist.Distribution().fetch_build_eggs(['Cython>=0.15.1', 'numpy>=1.10']) try: from Cython.Build import cythonize USE_CYTHON = True except ImportError: sys.exit("""Could not import Cython, which is required to build benepar extension...
[ "setuptools.dist.Distribution", "Cython.Build.cythonize", "numpy.get_include", "sys.exit", "setuptools.find_packages" ]
[((680, 706), 'Cython.Build.cythonize', 'cythonize', (['"""benepar/*.pyx"""'], {}), "('benepar/*.pyx')\n", (689, 706), False, 'from Cython.Build import cythonize\n'), ((76, 95), 'setuptools.dist.Distribution', 'dist.Distribution', ([], {}), '()\n', (93, 95), False, 'from setuptools import setup, Extension, dist\n'), ((...
from torch import nn import torch import numpy as np data = torch.rand(16, 3, 150, 25, 2) print(data.shape) print(data[0, 0, 0, :, 0]) half = [1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 15, 16, 21, 22, 23] del_half = [8, 9, 10, 11, 16, 17, 18, 19, 23, 24] # data = data[:][:][:][1, 2, 3, 4, 5, 6, 7, 8, 13, 14, 15, 16, 21, 22, 23...
[ "numpy.random.random", "numpy.delete", "torch.rand" ]
[((61, 90), 'torch.rand', 'torch.rand', (['(16)', '(3)', '(150)', '(25)', '(2)'], {}), '(16, 3, 150, 25, 2)\n', (71, 90), False, 'import torch\n'), ((382, 419), 'numpy.random.random', 'np.random.random', (['(16, 3, 150, 25, 2)'], {}), '((16, 3, 150, 25, 2))\n', (398, 419), True, 'import numpy as np\n'), ((472, 505), 'n...
import random import numpy as np from collections import defaultdict from keras.datasets import cifar10 class_num = 10 image_size = 32 img_channels = 3 def prepare_data(n): (train_data, train_labels), (test_data, test_labels) = cifar10.load_data() train_data, test_data = color_preprocessing(train_data, test_...
[ "random.randint", "keras.datasets.cifar10.load_data", "numpy.asarray", "numpy.shape", "collections.defaultdict", "numpy.fliplr", "random.getrandbits", "numpy.lib.pad" ]
[((235, 254), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (252, 254), False, 'from keras.datasets import cifar10\n'), ((791, 813), 'numpy.asarray', 'np.asarray', (['labelled_x'], {}), '(labelled_x)\n', (801, 813), True, 'import numpy as np\n'), ((831, 853), 'numpy.asarray', 'np.asarray', ...
#!/usr/bin/env python import argparse import random import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx import prmf.plot as flp if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--outfile') args = parser.parse_args() fig_width = 12...
[ "matplotlib.pyplot.subplot", "argparse.ArgumentParser", "networkx.relabel_nodes", "networkx.random_powerlaw_tree", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.gridspec.GridSpec", "prmf.plot.plot_vec", "prmf.plot.plot_graph", "matplotlib.pyplot.savefig" ]
[((213, 238), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (236, 238), False, 'import argparse\n'), ((350, 426), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(fig_width / flp.DPI, fig_height / flp.DPI)', 'dpi': 'flp.DPI'}), '(figsize=(fig_width / flp.DPI, fig_height / flp.DPI),...
import numpy as np from scipy.stats import rv_discrete, nbinom, poisson from scipy.special import gammaln from scipy._lib._util import _lazywhere class genpoisson_p_gen(rv_discrete): '''Generalized Poisson distribution ''' def _argcheck(self, mu, alpha, p): return (mu >= 0) & (alpha==alpha) & (p >...
[ "scipy.stats.nbinom.cdf", "numpy.log", "scipy.stats.poisson", "scipy.stats.nbinom.moment", "scipy.stats.poisson.moment", "scipy.stats.nbinom.logpmf", "scipy.stats.nbinom.pmf", "numpy.exp", "scipy.special.gammaln", "scipy.stats.nbinom.ppf", "numpy.nextafter" ]
[((4269, 4292), 'scipy.stats.nbinom.ppf', 'nbinom.ppf', (['q_mod', 's', 'p'], {}), '(q_mod, s, p)\n', (4279, 4292), False, 'from scipy.stats import rv_discrete, nbinom, poisson\n'), ((419, 437), 'numpy.nextafter', 'np.nextafter', (['(0)', '(1)'], {}), '(0, 1)\n', (431, 437), True, 'import numpy as np\n'), ((481, 499), ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: <NAME> """ from backbone import Backbone import torch import argparse import os import numpy as np from torch.utils.data import DataLoader from tqdm import tqdm from torch.nn import DataParallel import nibabel as nib import pdb #######run command###########...
[ "argparse.ArgumentParser", "nibabel.load", "torch.manual_seed", "torch.load", "numpy.transpose", "torch.cat", "nibabel.save", "torch.squeeze", "numpy.shape", "os.path.isfile", "torch.max", "backbone.Backbone", "numpy.eye", "torch.nn.DataParallel", "torch.no_grad", "torch.from_numpy" ]
[((3383, 3408), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3406, 3408), False, 'import argparse\n'), ((4652, 4680), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (4669, 4680), False, 'import torch\n'), ((5108, 5132), 'nibabel.load', 'nib.load', (['args.dat...
''' Prerequisites: pip install opencv-python opencv-contrib-python pip install imutils This script can be used to detect and extract text from a given image (co-ordinates are extracted). As of right now the extracted ROI is put inside a rectangle. The algorithm used is OpenCV EAST (Efficiend and Accurate Scene Text De...
[ "cv2.waitKey", "cv2.dnn.blobFromImage", "cv2.dnn.readNet", "cv2.VideoCapture", "numpy.sin", "numpy.array", "numpy.cos", "cv2.rectangle", "cv2.imshow", "cv2.resize" ]
[((573, 592), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (589, 592), False, 'import cv2\n'), ((713, 761), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""frozen_east_text_detection.pb"""'], {}), "('frozen_east_text_detection.pb')\n", (728, 761), False, 'import cv2\n'), ((1993, 2021), 'cv2.resize', 'cv2...
import fortranfile import numpy as np import struct _NUM_SELECTIONS = 6 _NUM_PTYPES = 6 _ID_TYPE = np.dtype('int32') # Datatype of Particle IDs in the file _ID_SIZE = _ID_TYPE.itemsize # Size in bytes of one ID value _NAME_LENGTH = 500 # Size of the Selection name string class GVSelectFile(object): ...
[ "numpy.concatenate", "numpy.asarray", "numpy.dtype", "struct.pack", "numpy.array", "fortranfile.FortranFile" ]
[((101, 118), 'numpy.dtype', 'np.dtype', (['"""int32"""'], {}), "('int32')\n", (109, 118), True, 'import numpy as np\n'), ((987, 1022), 'fortranfile.FortranFile', 'fortranfile.FortranFile', (['input_file'], {}), '(input_file)\n', (1010, 1022), False, 'import fortranfile\n'), ((2406, 2498), 'struct.pack', 'struct.pack',...
import numpy as np from ipso_phen.ipapi.base.ip_abstract import BaseImageProcessor from ipso_phen.ipapi.tools.csv_writer import AbstractCsvWriter class ImageFluoCsvWriter(AbstractCsvWriter): def __init__(self): super().__init__() self.data_list = dict.fromkeys( [ # Hea...
[ "numpy.count_nonzero" ]
[((4931, 4958), 'numpy.count_nonzero', 'np.count_nonzero', (['self.mask'], {}), '(self.mask)\n', (4947, 4958), True, 'import numpy as np\n'), ((5961, 5988), 'numpy.count_nonzero', 'np.count_nonzero', (['self.mask'], {}), '(self.mask)\n', (5977, 5988), True, 'import numpy as np\n')]
import numpy as np import tensorflow as tf from neupy.utils import as_tuple from neupy.exceptions import LayerConnectionError from neupy.core.properties import TypedListProperty from .base import BaseLayer __all__ = ('Reshape', 'Transpose') class Reshape(BaseLayer): """ Layer reshapes input tensor. Pa...
[ "tensorflow.convert_to_tensor", "tensorflow.reshape", "tensorflow.TensorShape", "neupy.utils.as_tuple", "neupy.core.properties.TypedListProperty", "tensorflow.shape", "numpy.array", "numpy.prod" ]
[((1046, 1065), 'neupy.core.properties.TypedListProperty', 'TypedListProperty', ([], {}), '()\n', (1063, 1065), False, 'from neupy.core.properties import TypedListProperty\n'), ((3924, 3943), 'neupy.core.properties.TypedListProperty', 'TypedListProperty', ([], {}), '()\n', (3941, 3943), False, 'from neupy.core.properti...
import numpy as np from scipy import sparse as sps from scipy.sparse import linalg as sla from itertools import product as pd from numpy.linalg import norm from elem import Elem from aq import AQ class SAAF(object): def __init__(self, mat_cls, mesh_cls, prob_dict): # name of the Equation self._name...
[ "aq.AQ", "scipy.sparse.linalg.splu", "numpy.zeros", "numpy.ones", "scipy.sparse.csc_matrix", "numpy.array", "numpy.linalg.norm", "numpy.dot", "numpy.copyto", "elem.Elem" ]
[((581, 604), 'elem.Elem', 'Elem', (['self._cell_length'], {}), '(self._cell_length)\n', (585, 604), False, 'from elem import Elem\n'), ((12116, 12157), 'numpy.copyto', 'np.copyto', (['sflxes_old[g]', 'self._sflxes[g]'], {}), '(sflxes_old[g], self._sflxes[g])\n', (12125, 12157), True, 'import numpy as np\n'), ((1944, 1...
# -*- coding: utf-8 -*- """ Created on Thu Oct 8 17:57:06 2020 @author: tamiryuv """ ############################## #CNN : import os.path as pth import yaml with open('../config.yaml', 'r') as fp: config = yaml.load(fp, yaml.FullLoader) path = pth.dirname(pth.abspath(__file__))[:-3] + '/' import pand...
[ "yaml.load", "os.path.abspath", "torch.utils.data.DataLoader", "pandas.read_csv", "torch.argmax", "torch.nn.Conv2d", "torch.nn.CrossEntropyLoss", "torch.nn.BatchNorm1d", "sklearn.model_selection.KFold", "torch.save", "numpy.mean", "torch.cuda.is_available", "torch.nn.Linear", "torch.nn.Max...
[((223, 253), 'yaml.load', 'yaml.load', (['fp', 'yaml.FullLoader'], {}), '(fp, yaml.FullLoader)\n', (232, 253), False, 'import yaml\n'), ((539, 582), 'pandas.read_csv', 'pd.read_csv', (["(path + config['training_data'])"], {}), "(path + config['training_data'])\n", (550, 582), True, 'import pandas as pd\n'), ((2071, 20...
import numpy as np def default_if_none(value, default): return (value if (value is not None) else default) def to_float_if_int(value): return (float(value) if (isinstance(value, int)) else value) def validate_alpha(a): if (not is_membership_degree(a)): ...
[ "numpy.vectorize" ]
[((494, 528), 'numpy.vectorize', 'np.vectorize', (['is_membership_degree'], {}), '(is_membership_degree)\n', (506, 528), True, 'import numpy as np\n')]
import numpy # scipy.special for the sigmoid function expit() from scipy import special class mynn: # initialise the neural network def __init__(self, inputneurons, hiddenneurons, outputneurons, learningrate): # set number of neurons in each input, hidden, output layer self.ineurons = inp...
[ "numpy.argmax", "numpy.asarray", "numpy.asfarray", "numpy.zeros", "numpy.transpose", "scipy.special.expit", "numpy.array", "numpy.dot" ]
[((5466, 5490), 'numpy.asarray', 'numpy.asarray', (['scorecard'], {}), '(scorecard)\n', (5479, 5490), False, 'import numpy\n'), ((5049, 5070), 'numpy.argmax', 'numpy.argmax', (['outputs'], {}), '(outputs)\n', (5061, 5070), False, 'import numpy\n'), ((1322, 1349), 'numpy.dot', 'numpy.dot', (['self.wih', 'inputs'], {}), ...
from __future__ import division from builtins import range from past.utils import old_div import numpy as np def cartesian(arrays): return np.dstack( np.meshgrid(*arrays, indexing='ij') ).reshape(-1, len(arrays)) def cartesian_(arrays, out=None): """ Generate a cartesian product of input...
[ "numpy.meshgrid", "past.utils.old_div", "builtins.range", "numpy.prod", "numpy.repeat" ]
[((404, 437), 'numpy.prod', 'np.prod', (['[x.size for x in arrays]'], {}), '([x.size for x in arrays])\n', (411, 437), True, 'import numpy as np\n'), ((566, 592), 'past.utils.old_div', 'old_div', (['n', 'arrays[0].size'], {}), '(n, arrays[0].size)\n', (573, 592), False, 'from past.utils import old_div\n'), ((608, 631),...
"""Force plate calibration algorithm. """ __author__ = '<NAME>, https://github.com/demotu/BMC' __version__ = 'fpcalibra.py v.1.0.1 2016/08/19' __license__ = "MIT" import numpy as np from scipy.linalg import pinv, pinv2 from scipy.optimize import minimize import time def fpcalibra(Lfp, Flc, COP, threshold=1e-10, met...
[ "scipy.optimize.minimize", "numpy.sum", "numpy.abs", "numpy.empty", "numpy.zeros", "time.time", "numpy.sin", "numpy.array", "numpy.cos", "scipy.linalg.pinv2", "numpy.eye", "scipy.linalg.pinv", "numpy.all" ]
[((5287, 5307), 'numpy.empty', 'np.empty', (['(6, 3, nk)'], {}), '((6, 3, nk))\n', (5295, 5307), True, 'import numpy as np\n'), ((6071, 6083), 'numpy.zeros', 'np.zeros', (['nk'], {}), '(nk)\n', (6079, 6083), True, 'import numpy as np\n'), ((6092, 6114), 'numpy.empty', 'np.empty', (['(6, ns * nk)'], {}), '((6, ns * nk))...
#!/usr/bin/env python ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test NetCDF driver CF compliance. # Author: <NAME> <<EMAIL>> # ############################################################################### # No copyright in or...
[ "cdms2.open", "re.split", "getopt.getopt", "re.compile", "re.match", "numpy.isnan", "re.findall", "re.search", "re.sub", "ctypes.CFUNCTYPE", "sys.exc_info", "sys.stderr.write", "ctypes.CDLL", "sys.exit", "xml.sax.make_parser" ]
[((1985, 2014), 'ctypes.CDLL', 'ctypes.CDLL', (['"""libudunits2.so"""'], {}), "('libudunits2.so')\n", (1996, 2014), False, 'import ctypes\n'), ((8506, 8595), 're.search', 're.search', (['"""^(direction|magnitude|square|divergence)_of_[a-zA-Z][a-zA-Z0-9_]*$"""', 'name'], {}), "('^(direction|magnitude|square|divergence)_...
__author__ = 'mason' from domain_orderFulfillment import * from timer import DURATION from state import state import numpy as np ''' This is a randomly generated problem ''' def GetCostOfMove(id, r, loc1, loc2, dist): return 1 + dist def GetCostOfLookup(id, item): return max(1, np.random.beta(2, 2)) def Ge...
[ "numpy.random.beta", "numpy.random.normal" ]
[((291, 311), 'numpy.random.beta', 'np.random.beta', (['(2)', '(2)'], {}), '(2, 2)\n', (305, 311), True, 'import numpy as np\n'), ((375, 399), 'numpy.random.normal', 'np.random.normal', (['(5)', '(0.5)'], {}), '(5, 0.5)\n', (391, 399), True, 'import numpy as np\n'), ((453, 475), 'numpy.random.normal', 'np.random.normal...
import pytest from skimage._shared._geometry import polygon_clip, polygon_area import numpy as np from numpy.testing import assert_equal, assert_almost_equal pytest.importorskip("matplotlib") hand = np.array( [[ 1.64516129, 1.16145833 ], [ 1.64516129, 1.59375 ], [ 1.35080645, 1.921875 ], ...
[ "pytest.importorskip", "skimage._shared._geometry.polygon_clip", "numpy.array", "numpy.testing.assert_equal", "skimage._shared._geometry.polygon_area" ]
[((160, 193), 'pytest.importorskip', 'pytest.importorskip', (['"""matplotlib"""'], {}), "('matplotlib')\n", (179, 193), False, 'import pytest\n'), ((203, 792), 'numpy.array', 'np.array', (['[[1.64516129, 1.16145833], [1.64516129, 1.59375], [1.35080645, 1.921875], [\n 1.375, 2.18229167], [1.68548387, 1.9375], [1.6088...
""" Created: Sunday, 5th February, 2017 Author: <NAME> Email : <EMAIL> """ # TODO: reference all of the nearest neighbor libraries used import numpy as np from sklearn.utils import check_array from sklearn.neighbors import NearestNeighbors, LSHForest from sklearn.utils.validation import check_random_state from annoy i...
[ "sklearn.utils.check_array", "numpy.zeros", "sklearn.utils.validation.check_random_state", "sklearn.neighbors.NearestNeighbors", "annoy.AnnoyIndex" ]
[((4910, 4946), 'annoy.AnnoyIndex', 'AnnoyIndex', (['dimension'], {'metric': 'metric'}), '(dimension, metric=metric)\n', (4920, 4946), False, 'from annoy import AnnoyIndex\n'), ((5159, 5207), 'numpy.zeros', 'np.zeros', (['(datapoints, n_neighbors)'], {'dtype': '"""int"""'}), "((datapoints, n_neighbors), dtype='int')\n"...
import random import cv2 import numpy as np from torch.utils.data import Dataset from .pytorch_utils import from_numpy def fliplr(x): # Copy because needs to be contiguous with positive stride return np.fliplr(x).copy() class PairDataset(Dataset): def __init__(self, seqs, ...
[ "numpy.sum", "numpy.ones_like", "numpy.maximum", "numpy.logical_and.reduce", "numpy.fliplr", "cv2.imread", "numpy.where", "random.random", "numpy.random.choice", "numpy.all" ]
[((766, 786), 'numpy.sum', 'np.sum', (['self.indices'], {}), '(self.indices)\n', (772, 786), True, 'import numpy as np\n'), ((4024, 4057), 'numpy.all', 'np.all', (['(anno[:, 2:] >= 20)'], {'axis': '(1)'}), '(anno[:, 2:] >= 20, axis=1)\n', (4030, 4057), True, 'import numpy as np\n'), ((4071, 4105), 'numpy.all', 'np.all'...
# Copyright (C) 2021 <NAME>, <NAME> # # SPDX-License-Identifier: MIT import basix import dolfinx_cuas.cpp import numpy as np import pytest from dolfinx.fem import (Function, FunctionSpace, IntegralType, VectorFunctionSpace) from dolfinx.mesh import create_unit_square, locate_entities_boundar...
[ "numpy.full", "basix.make_quadrature", "dolfinx.fem.VectorFunctionSpace", "dolfinx.fem.FunctionSpace", "numpy.isclose", "numpy.where", "numpy.arange", "pytest.mark.parametrize", "dolfinx.fem.Function", "dolfinx.mesh.create_unit_square" ]
[((483, 539), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""space"""', "['CG', 'N1curl', 'DG']"], {}), "('space', ['CG', 'N1curl', 'DG'])\n", (506, 539), False, 'import pytest\n'), ((2063, 2119), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""space"""', "['CG', 'DG', 'N1curl']"], {}), "('spac...
#!/usr/bin/env python3 # 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. import time import os import numpy as np import faiss from faiss.contrib.datasets import SyntheticDataset os.system...
[ "faiss.omp_set_num_threads", "numpy.std", "os.system", "time.time", "numpy.mean", "numpy.array", "faiss.IndexFlatL2", "faiss.contrib.datasets.SyntheticDataset" ]
[((311, 361), 'os.system', 'os.system', (['"""grep -m1 \'model name\' < /proc/cpuinfo"""'], {}), '("grep -m1 \'model name\' < /proc/cpuinfo")\n', (320, 361), False, 'import os\n'), ((714, 748), 'faiss.omp_set_num_threads', 'faiss.omp_set_num_threads', (['nthread'], {}), '(nthread)\n', (739, 748), False, 'import faiss\n...
"""Fit an exponential curve to input data.""" import argparse import matplotlib.pyplot as plt import numpy as np import numpy import scipy.optimize def exp_decay(val, a, b): return 1-a*numpy.exp(-val**b) def exp_exp_decay(val, a, b, c): return 1-a*numpy.exp(-val**b)**c if __name__ == '__main__': pars...
[ "numpy.exp", "matplotlib.pyplot.subplots", "argparse.ArgumentParser", "matplotlib.pyplot.show" ]
[((325, 385), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fit Exponential Decay"""'}), "(description='Fit Exponential Decay')\n", (348, 385), False, 'import argparse\n'), ((782, 796), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (794, 796), True, 'import matplotlib....
import numpy as np import os import torch import xml.etree.ElementTree as ET from PIL import Image from torch.utils.data import Dataset class VOCDetection(Dataset): classes = [ 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', ...
[ "numpy.stack", "os.path.join", "torch.tensor" ]
[((821, 873), 'os.path.join', 'os.path.join', (['self.root', 'dataset_name', '"""Annotations"""'], {}), "(self.root, dataset_name, 'Annotations')\n", (833, 873), False, 'import os\n'), ((900, 951), 'os.path.join', 'os.path.join', (['self.root', 'dataset_name', '"""JPEGImages"""'], {}), "(self.root, dataset_name, 'JPEGI...
import numpy as np import netket as nk from shutil import move import sys import mpi4py.MPI as mpi import symmetries N = int(sys.argv[1]) J2 = float(sys.argv[2]) eps_read_in = sys.argv[3] eps = np.load(eps_read_in) if mpi.COMM_WORLD.Get_rank() == 0: with open("result.txt", "w") as fl: fl.write("N, energy...
[ "numpy.load", "netket.optimizer.SR", "netket.custom.get_symms_square_lattice", "numpy.imag", "mpi4py.MPI.COMM_WORLD.barrier", "netket.variational.estimate_expectations", "numpy.kron", "numpy.real", "numpy.save", "netket.sampler.MetropolisExchange", "numpy.asarray", "mpi4py.MPI.COMM_WORLD.Get_r...
[((196, 216), 'numpy.load', 'np.load', (['eps_read_in'], {}), '(eps_read_in)\n', (203, 216), True, 'import numpy as np\n'), ((373, 420), 'netket.graph.Hypercube', 'nk.graph.Hypercube', ([], {'length': 'L', 'n_dim': '(2)', 'pbc': '(True)'}), '(length=L, n_dim=2, pbc=True)\n', (391, 420), True, 'import netket as nk\n'), ...
from __future__ import division import subprocess as sp import re import numpy as np from moviepy.conf import FFMPEG_BINARY # ffmpeg, ffmpeg.exe, etc... from moviepy.tools import cvsecs class FFMPEG_VideoReader: def __init__(self, filename, print_infos=False, bufsize = None, pix_fmt="rgb24"):...
[ "moviepy.tools.cvsecs", "subprocess.Popen", "re.search", "numpy.fromstring" ]
[((1436, 1503), 'subprocess.Popen', 'sp.Popen', (['cmd'], {'bufsize': 'self.bufsize', 'stdout': 'sp.PIPE', 'stderr': 'sp.PIPE'}), '(cmd, bufsize=self.bufsize, stdout=sp.PIPE, stderr=sp.PIPE)\n', (1444, 1503), True, 'import subprocess as sp\n'), ((1923, 2028), 'subprocess.Popen', 'sp.Popen', (["[FFMPEG_BINARY, '-i', sel...
import numpy as np import logging from .comparisons import Comparison from .diagnostic import Diagnostic from .plotter import Plotter from .helpers import get_bins from .analysis import Analysis from .colors import Colors from .chain import Chain __all__ = ["ChainConsumer"] class ChainConsumer(object): """ A c...
[ "numpy.load", "numpy.meshgrid", "numpy.sum", "numpy.concatenate", "logging.basicConfig", "numpy.floor", "numpy.split", "numpy.sort", "numpy.array", "numpy.loadtxt", "logging.getLogger" ]
[((522, 561), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (541, 561), False, 'import logging\n'), ((585, 612), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (602, 612), False, 'import logging\n'), ((26977, 26992), 'numpy.sort',...
import sys import numpy from .radiotelescope import BaselineTable from .skymodel import apparent_fluxes_numba from matplotlib import pyplot sys.path.append("../../beam_perturbations/code/tile_beam_perturbations/") from analytic_covariance import sky_covariance def split_visibility(data): data_real = numpy.real(d...
[ "sys.path.append", "numpy.zeros", "numpy.setdiff1d", "analytic_covariance.sky_covariance", "numpy.hstack", "numpy.imag", "numpy.where", "numpy.arange", "numpy.array", "numpy.real", "numpy.mean", "numpy.sqrt" ]
[((140, 213), 'sys.path.append', 'sys.path.append', (['"""../../beam_perturbations/code/tile_beam_perturbations/"""'], {}), "('../../beam_perturbations/code/tile_beam_perturbations/')\n", (155, 213), False, 'import sys\n'), ((308, 324), 'numpy.real', 'numpy.real', (['data'], {}), '(data)\n', (318, 324), False, 'import ...
from app import app import pandas as pd import numpy as np from scipy import stats from keras.models import model_from_json COLUMNS = ['x-axis', 'y-axis', 'z-axis'] LABELS = ['Downstairs', 'Jogging', 'Sitting', 'Standing', 'Upstairs', 'Walking'] MODEL_PATH = "app/model/model.json" WEIGHTS_PATH = "app/model/model.h5" ...
[ "pandas.read_csv", "numpy.asarray", "keras.models.model_from_json" ]
[((358, 403), 'pandas.read_csv', 'pd.read_csv', (['data'], {'header': 'None', 'names': 'COLUMNS'}), '(data, header=None, names=COLUMNS)\n', (369, 403), True, 'import pandas as pd\n'), ((822, 869), 'numpy.asarray', 'np.asarray', (['segmented_dataset'], {'dtype': 'np.float32'}), '(segmented_dataset, dtype=np.float32)\n',...
import imutils import numpy as np import cv2 import pickle import tensorflow as tf import dlib from imutils import face_utils from watermarking import watermarking ############################################# frameWidth = 640 # CAMERA RESOLUTION frameHeight = 480 brightness = 180 threshold = 0.55 ...
[ "cv2.equalizeHist", "tensorflow.keras.models.load_model", "cv2.putText", "cv2.cvtColor", "cv2.waitKey", "numpy.asarray", "cv2.imwrite", "cv2.imshow", "cv2.VideoCapture", "cv2.imread", "numpy.amax", "imutils.face_utils.shape_to_np", "watermarking.watermarking", "dlib.get_frontal_face_detect...
[((445, 477), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (475, 477), False, 'import dlib\n'), ((491, 552), 'dlib.shape_predictor', 'dlib.shape_predictor', (['"""shape_predictor_68_face_landmarks.dat"""'], {}), "('shape_predictor_68_face_landmarks.dat')\n", (511, 552), False, '...
# Author: Pat # Email: <EMAIL> #loader for KITTI, in global frame--origin is defined as the imu position at the first frame in that scene import pandas as pd import numpy as np import glob from toolkit.core.trajdataset import TrajDataset import math from math import cos, sin, tan, pi from copy import deepcopy def lo...
[ "copy.deepcopy", "pandas.read_csv", "math.tan", "math.sin", "toolkit.core.trajdataset.TrajDataset", "numpy.array", "math.cos", "numpy.matmul", "glob.glob", "numpy.linalg.inv", "os.path.join", "pandas.concat", "numpy.unique" ]
[((365, 378), 'toolkit.core.trajdataset.TrajDataset', 'TrajDataset', ([], {}), '()\n', (376, 378), False, 'from toolkit.core.trajdataset import TrajDataset\n'), ((1035, 1059), 'pandas.concat', 'pd.concat', (['track_rawData'], {}), '(track_rawData)\n', (1044, 1059), True, 'import pandas as pd\n'), ((3629, 3665), 'math.c...
# SPDX-License-Identifier: Apache-2.0 import unittest import numpy as np from numpy.testing import assert_almost_equal import onnx import onnxruntime as ort from skl2onnx.algebra.onnx_ops import OnnxPad # noqa class TestOnnxOperatorsOpset(unittest.TestCase): @unittest.skipIf(onnx.defs.onnx_opset_version() < 10...
[ "unittest.main", "onnx.defs.onnx_opset_version", "numpy.array", "onnx.checker.check_model", "skl2onnx.algebra.onnx_ops.OnnxPad" ]
[((1310, 1325), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1323, 1325), False, 'import unittest\n'), ((384, 481), 'skl2onnx.algebra.onnx_ops.OnnxPad', 'OnnxPad', (['"""X"""'], {'output_names': "['Y']", 'mode': '"""constant"""', 'value': '(1.5)', 'pads': '[0, 1, 0, 1]', 'op_version': '(2)'}), "('X', output_nam...
"""Contains functions to build Lindbladian dephasing and thermalising (super)operators.""" from itertools import permutations, product import numpy as np from quantum_heom import bath from quantum_heom import utilities as util LINDBLAD_MODELS = ['local dephasing lindblad', 'global thermalising lin...
[ "quantum_heom.utilities.eigs", "numpy.outer", "quantum_heom.utilities.eigv", "numpy.zeros", "quantum_heom.bath.rate_constant_redfield", "numpy.matmul", "numpy.eye", "quantum_heom.utilities.basis_change" ]
[((1365, 1402), 'numpy.zeros', 'np.zeros', (['(dims, dims)'], {'dtype': 'complex'}), '((dims, dims), dtype=complex)\n', (1373, 1402), True, 'import numpy as np\n'), ((3220, 3249), 'numpy.zeros', 'np.zeros', (['dims'], {'dtype': 'complex'}), '(dims, dtype=complex)\n', (3228, 3249), True, 'import numpy as np\n'), ((3262,...
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "numpy.asarray", "absl.flags.mark_flag_as_required", "absl.flags.DEFINE_string", "extras.python.phonetics.hk_util.TrainedModel.load", "absl.app.run", "extras.python.phonetics.hk_util.params_as_list" ]
[((1393, 1465), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""model"""', 'None', '"""[REQUIRED] Model params .pkl file."""'], {}), "('model', None, '[REQUIRED] Model params .pkl file.')\n", (1412, 1465), False, 'from absl import flags\n'), ((1467, 1531), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['...
import pandas as pd import numpy as np from common.libs.neo2cos import find_songs INT_BITS = 32 MAX_INT = (1 << (INT_BITS - 1)) - 1 # Maximum Integer for INT_BITS def indi_count(df1, aaa): # 计算曲库中伪hash值的计数 cursor = 0 dataa = df1.loc[:, ['Indi']].values aaa = [0] * 256 for cursor in range(0, 256): ...
[ "pandas.DataFrame", "numpy.sum", "pandas.read_excel", "numpy.argsort", "numpy.array", "numpy.linalg.norm", "numpy.dot", "common.libs.neo2cos.find_songs" ]
[((899, 923), 'pandas.read_excel', 'pd.read_excel', (['Song_addr'], {}), '(Song_addr)\n', (912, 923), True, 'import pandas as pd\n'), ((951, 974), 'pandas.read_excel', 'pd.read_excel', (['Cus_addr'], {}), '(Cus_addr)\n', (964, 974), True, 'import pandas as pd\n'), ((1096, 1113), 'pandas.DataFrame', 'pd.DataFrame', (['d...
import pytest import numpy as np from sklearn.model_selection import train_test_split from sklearn.linear_model import Lasso, LassoCV, LinearRegression from sklearn.utils._testing import assert_array_almost_equal from sklearn.utils._testing import assert_almost_equal from sklearn.model_selection import KFold from skle...
[ "numpy.abs", "sklearn.model_selection.train_test_split", "numpy.arange", "numpy.random.normal", "pytest.mark.parametrize", "relaxed_lasso.RelaxedLassoCV", "numpy.power", "sklearn.datasets.make_regression", "relaxed_lasso.RelaxedLasso", "sklearn.linear_model.Lasso", "numpy.repeat", "sklearn.lin...
[((507, 524), 'numpy.repeat', 'np.repeat', (['(0)', '(100)'], {}), '(0, 100)\n', (516, 524), True, 'import numpy as np\n'), ((533, 547), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (542, 547), True, 'import numpy as np\n'), ((607, 628), 'numpy.power', 'np.power', (['(0.5)', 'powers'], {}), '(0.5, powers)\n...
""" ####################### # quket # ####################### init.py Initializing state. """ from typing import Any, List from dataclasses import dataclass, field, InitVar, make_dataclass import numpy as np from qulacs import Observable from qulacs.state import inner_product from qulacs.observable im...
[ "numpy.polynomial.legendre.leggauss", "openfermion.transforms.jordan_wigner", "dataclasses.field", "inspect.signature", "numpy.arccos", "dataclasses.make_dataclass" ]
[((1641, 1672), 'dataclasses.field', 'field', ([], {'init': '(False)', 'default': 'None'}), '(init=False, default=None)\n', (1646, 1672), False, 'from dataclasses import dataclass, field, InitVar, make_dataclass\n'), ((1700, 1731), 'dataclasses.field', 'field', ([], {'init': '(False)', 'default': 'None'}), '(init=False...
#importing libraries import os import numpy as np import flask import pickle #import pickle from flask import Flask, render_template, request #creating instance of the class app=Flask(__name__) #to tell flask what url shoud trigger the function index() @app.route('/') def home(): return render_template('home.html'...
[ "flask.Flask", "numpy.array", "flask.request.form.to_dict", "flask.render_template", "keras.backend.clear_session" ]
[((181, 196), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (186, 196), False, 'from flask import Flask, render_template, request\n'), ((293, 321), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (308, 321), False, 'from flask import Flask, render_template, reques...
from __future__ import print_function import random import sys from parallel_merge_sort import * import numpy def get_total_processes(): # Verifica se foi passado o numero de processos # Se nao passar o numero de processos, consideramos 1 processo total_processes = int(sys.argv[1]) if (len(sys.argv) > 1) e...
[ "numpy.std", "numpy.random.randint" ]
[((1529, 1545), 'numpy.std', 'numpy.std', (['times'], {}), '(times)\n', (1538, 1545), False, 'import numpy\n'), ((649, 692), 'numpy.random.randint', 'numpy.random.randint', (['(0)', '(3 * length)', 'length'], {}), '(0, 3 * length, length)\n', (669, 692), False, 'import numpy\n')]
# 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. """Tools for training and testing a model.""" import gc import os import sys import numpy as np import torch import random import xnas.core...
[ "torch.cuda.amp.autocast", "numpy.random.seed", "os.makedirs", "xnas.core.meters.topk_errors", "torch.manual_seed", "xnas.core.distributed.scaled_all_reduce", "xnas.core.logging.setup_logging", "torch.cuda.manual_seed_all", "random.seed", "xnas.core.logging.dump_log_data", "xnas.core.config.dump...
[((489, 517), 'xnas.core.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (507, 517), True, 'import xnas.core.logging as logging\n'), ((4874, 4889), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4887, 4889), False, 'import torch\n'), ((598, 619), 'xnas.core.distributed.is_master_pro...
################## # Plot chains from *.mcmc outputs. # Calculate average and standard deviations # for parameters from *.mcmc outputs. ################## import os import sys import math import pdb import numpy as np import matplotlib.pyplot as plt if not os.path.isdir('output/'): os.makedirs('output/') print...
[ "numpy.stack", "numpy.average", "os.makedirs", "os.path.isdir", "matplotlib.pyplot.close", "numpy.asarray", "numpy.savetxt", "numpy.genfromtxt", "numpy.shape", "matplotlib.pyplot.figure", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.p...
[((258, 282), 'os.path.isdir', 'os.path.isdir', (['"""output/"""'], {}), "('output/')\n", (271, 282), False, 'import os\n'), ((288, 310), 'os.makedirs', 'os.makedirs', (['"""output/"""'], {}), "('output/')\n", (299, 310), False, 'import os\n'), ((545, 594), 'numpy.genfromtxt', 'np.genfromtxt', (["(dir_mcmc + prefix + f...
from __future__ import division, print_function from os.path import join def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('lib', parent_package, top_path) config.add_include_dirs(join('..', 'core', 'include')) import sys ...
[ "numpy.distutils.core.setup", "numpy.distutils.misc_util.Configuration", "os.path.join" ]
[((197, 243), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""lib"""', 'parent_package', 'top_path'], {}), "('lib', parent_package, top_path)\n", (210, 243), False, 'from numpy.distutils.misc_util import Configuration\n'), ((678, 712), 'numpy.distutils.core.setup', 'setup', ([], {'configuration': 'con...
""" Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License ...
[ "unittest.main", "os.path.realpath", "math.sin", "ccblade.CCBlade", "numpy.array", "numpy.testing.assert_allclose", "os.path.join" ]
[((4848, 4863), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4861, 4863), False, 'import unittest\n'), ((774, 911), 'numpy.array', 'np.array', (['[2.8667, 5.6, 8.3333, 11.75, 15.85, 19.95, 24.05, 28.15, 32.25, 36.35, \n 40.45, 44.55, 48.65, 52.75, 56.1667, 58.9, 61.6333]'], {}), '([2.8667, 5.6, 8.3333, 11.75...
import os import torch import random import pickle import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as mcolors from argparse import ArgumentParser from utils.misc import * from model.platooning_energy import * from settings.platooning_energy import * from architectur...
[ "numpy.zeros_like", "argparse.ArgumentParser", "os.path.join", "numpy.logical_and", "numpy.zeros", "matplotlib.pyplot.figtext", "matplotlib.pyplot.style.use", "pickle.load", "numpy.linspace", "torch.tensor", "matplotlib.pyplot.subplots", "matplotlib.pyplot.cm.get_cmap", "matplotlib.colors.Tw...
[((359, 375), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (373, 375), False, 'from argparse import ArgumentParser\n'), ((1339, 1385), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""utils/qb-common_dark.mplstyle"""'], {}), "('utils/qb-common_dark.mplstyle')\n", (1352, 1385), True, 'import matpl...
# -*- coding: utf-8 -*- """ unit test for GAM Author: <NAME> """ import os import numpy as np from numpy.testing import assert_allclose, assert_equal, assert_ import pandas as pd import pytest import patsy from statsmodels.discrete.discrete_model import Poisson, Logit, Probit from statsmodels.genmod.generalized_...
[ "numpy.random.seed", "pandas.read_csv", "numpy.ones", "os.path.join", "pandas.DataFrame", "os.path.abspath", "statsmodels.tools.linalg.matrix_sqrt", "statsmodels.genmod.families.family.Poisson", "statsmodels.gam.smooth_basis.BSplines", "numpy.testing.assert_equal", "numpy.testing.assert_allclose...
[((1169, 1219), 'os.path.join', 'os.path.join', (['cur_dir', '"""results"""', '"""motorcycle.csv"""'], {}), "(cur_dir, 'results', 'motorcycle.csv')\n", (1181, 1219), False, 'import os\n'), ((1234, 1256), 'pandas.read_csv', 'pd.read_csv', (['file_path'], {}), '(file_path)\n', (1245, 1256), True, 'import pandas as pd\n')...
from pathlib import Path import numpy as np from PIL import Image def save_output_page_image(image_name, output_image, output_folder: Path, class_encoding): """ Helper function to save the output during testing in the DIVAHisDB format Parameters ---------- image_name: str name of the ima...
[ "numpy.where", "numpy.zeros", "numpy.argmax" ]
[((1542, 1567), 'numpy.argmax', 'np.argmax', (['output'], {'axis': '(0)'}), '(output, axis=0)\n', (1551, 1567), True, 'import numpy as np\n'), ((1788, 1810), 'numpy.where', 'np.where', (['mask', 'new', 'B'], {}), '(mask, new, B)\n', (1796, 1810), True, 'import numpy as np\n'), ((1833, 1891), 'numpy.zeros', 'np.zeros', ...
# coding=utf-8 import numpy as np import torch.nn.functional as F from datautil.util import random_pairs_of_minibatches from alg.algs.ERM import ERM class Mixup(ERM): def __init__(self, args): super(Mixup, self).__init__(args) self.args = args def update(self, minibatches, opt, sch): ...
[ "datautil.util.random_pairs_of_minibatches", "numpy.random.beta" ]
[((378, 429), 'datautil.util.random_pairs_of_minibatches', 'random_pairs_of_minibatches', (['self.args', 'minibatches'], {}), '(self.args, minibatches)\n', (405, 429), False, 'from datautil.util import random_pairs_of_minibatches\n'), ((449, 507), 'numpy.random.beta', 'np.random.beta', (['self.args.mixupalpha', 'self.a...
""" Functions to unpack Simrad EK60 .raw data file and save to netCDF or zarr. """ import os import re import shutil from collections import defaultdict import numpy as np import xarray as xr from datetime import datetime as dt import pytz import pynmea2 from .._version import get_versions from .utils.ek_raw_io impor...
[ "numpy.isin", "os.remove", "collections.defaultdict", "numpy.isclose", "numpy.arange", "shutil.rmtree", "os.path.join", "numpy.unique", "os.path.exists", "numpy.insert", "numpy.int32", "shutil.copyfile", "numpy.log10", "datetime.datetime.now", "os.path.basename", "os.rename", "pynmea...
[((981, 994), 'numpy.log10', 'np.log10', (['(2.0)'], {}), '(2.0)\n', (989, 994), True, 'import numpy as np\n'), ((2330, 2347), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (2340, 2347), False, 'import re\n'), ((8676, 8742), 'numpy.unique', 'np.unique', (['range_bin_lens'], {'return_inverse': '(True)', 'ret...
# This file is part of QuTiP: Quantum Toolbox in Python. # # Copyright (c) 2011 and later, The QuTiP Project. # 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. Redistribut...
[ "scipy.sparse.sputils.isdense", "numpy.empty", "numpy.ones", "numpy.isnan", "numpy.arange", "qutip.cy.spmath.zcsr_transpose", "scipy.sparse.sputils.get_index_dtype", "numpy.prod", "numpy.multiply", "numpy.result_type", "numpy.asarray", "scipy.sparse.csr_matrix", "scipy.sparse.sputils.upcast"...
[((17291, 17316), 'numpy.ones', 'np.ones', (['N'], {'dtype': 'complex'}), '(N, dtype=complex)\n', (17298, 17316), True, 'import numpy as np\n'), ((17327, 17355), 'numpy.arange', 'np.arange', (['N'], {'dtype': 'np.int32'}), '(N, dtype=np.int32)\n', (17336, 17355), True, 'import numpy as np\n'), ((17366, 17398), 'numpy.a...
import numpy as np from matplotlib import pyplot as plt import sys sys.path.append("..") import des_opt as mo import mach_eval as me import pygmo as pg from typing import List, Tuple, Any from copy import deepcopy class SleeveDesignProblemDefinition(me.ProblemDefinition): """Class converts input state into a pro...
[ "sys.path.append", "copy.deepcopy", "des_opt.MachineOptimizationMOEAD", "des_opt.MachineDesignProblem", "mach_eval.MachineEvaluator", "numpy.linspace", "pygmo.fast_non_dominated_sorting" ]
[((68, 89), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (83, 89), False, 'import sys\n'), ((5834, 5864), 'mach_eval.MachineEvaluator', 'me.MachineEvaluator', (['evalSteps'], {}), '(evalSteps)\n', (5853, 5864), True, 'import mach_eval as me\n'), ((6090, 6160), 'des_opt.MachineDesignProblem', 'm...
import cv2 import numpy as np import time webcam = cv2.VideoCapture(0) time.sleep(1) frame_count = 0 background = 0 for i in range(60): ret, background = webcam.read() background = np.flip(background, axis=1) while webcam.isOpened(): ret, img = webcam.read() if not ret: break frame_count +...
[ "numpy.flip", "cv2.bitwise_not", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "numpy.ones", "time.sleep", "cv2.VideoCapture", "cv2.addWeighted", "numpy.array", "cv2.destroyAllWindows", "cv2.inRange" ]
[((52, 71), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (68, 71), False, 'import cv2\n'), ((73, 86), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (83, 86), False, 'import time\n'), ((188, 215), 'numpy.flip', 'np.flip', (['background'], {'axis': '(1)'}), '(background, axis=1)\n', (195, 215), T...
#!/usr/bin/env python3 import numpy as np import scipy.stats as st import matplotlib.pyplot as plt # Format text used in plots to match LaTeX plt.rc('text', usetex=True) plt.rc('font', family='serif') def confidence_interval(data, confidence_level, loc=None): """ The frequentist confidence interval for a te...
[ "scipy.stats.norm", "numpy.random.seed", "numpy.logical_and", "numpy.mean", "numpy.array", "matplotlib.pyplot.rc", "numpy.linspace", "numpy.arange", "numpy.logical_or", "scipy.stats.sem", "numpy.linalg.norm", "matplotlib.pyplot.subplots" ]
[((144, 171), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (150, 171), True, 'import matplotlib.pyplot as plt\n'), ((172, 202), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (178, 202), True, 'import m...
""" Visualization tools for 2D projections of 3D functions on the sphere, such as ODFs. """ import numpy as np import scipy.interpolate as interp from ..utils.optpkg import optional_package matplotlib, has_mpl, setup_module = optional_package("matplotlib") plt, _, _ = optional_package("matplotlib.pyplot") tri, _, _...
[ "numpy.matrix", "dipy.core.geometry.sph2latlon", "dipy.core.geometry.cart2sphere", "numpy.nanmin", "numpy.where", "numpy.array", "mpl_toolkits.basemap.Basemap", "numpy.nanmax" ]
[((1891, 1914), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {}), '(**basemap_args)\n', (1898, 1914), False, 'from mpl_toolkits.basemap import Basemap\n'), ((2219, 2245), 'numpy.where', 'np.where', (['(verts_rot[0] > 0)'], {}), '(verts_rot[0] > 0)\n', (2227, 2245), True, 'import numpy as np\n'), ((2370, 2427), 'dipy...
# -*- coding: utf-8 -*- import numpy as np import pandas as pd def emg_intervalrelated(data): """Performs EMG analysis on longer periods of data (typically > 10 seconds), such as resting-state data. Parameters ---------- data : Union[dict, pd.DataFrame] A DataFrame containing the different pr...
[ "numpy.sum", "pandas.DataFrame.from_dict" ]
[((4142, 4156), 'numpy.sum', 'np.sum', (['bursts'], {}), '(bursts)\n', (4148, 4156), True, 'import numpy as np\n'), ((2903, 2952), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['intervals'], {'orient': '"""index"""'}), "(intervals, orient='index')\n", (2925, 2952), True, 'import pandas as pd\n'), ((2587, 26...
import os import glob import random from config import cfg import sys from tqdm import tqdm import numpy as np def main(ratio=0.9): train_data_path = '../dataset/train' labels = os.listdir(train_data_path) test_data_path = '../dataset/test' train_img_list = [] train_lab_list = [] val_img_list...
[ "random.shuffle", "numpy.vstack", "os.path.join", "os.listdir", "numpy.random.shuffle" ]
[((188, 215), 'os.listdir', 'os.listdir', (['train_data_path'], {}), '(train_data_path)\n', (198, 215), False, 'import os\n'), ((874, 917), 'numpy.vstack', 'np.vstack', (['(train_img_list, train_lab_list)'], {}), '((train_img_list, train_lab_list))\n', (883, 917), True, 'import numpy as np\n'), ((933, 972), 'numpy.vsta...
#!/usr/bin/env python # # ====================================================================== # # <NAME>, U.S. Geological Survey # # This code was developed as part of the Computational Infrastructure # for Geodynamics (http://geodynamics.org). # # Copyright (c) 2010-2017 University of California, Davis # # See COPY...
[ "numpy.zeros", "spatialdata.spatialdb.CompositeDB.CompositeDB", "spatialdata.geocoords.CSCart.CSCart", "numpy.array", "numpy.reshape", "spatialdata.spatialdb.UniformDB.UniformDB" ]
[((620, 631), 'spatialdata.spatialdb.UniformDB.UniformDB', 'UniformDB', ([], {}), '()\n', (629, 631), False, 'from spatialdata.spatialdb.UniformDB import UniformDB\n'), ((799, 810), 'spatialdata.spatialdb.UniformDB.UniformDB', 'UniformDB', ([], {}), '()\n', (808, 810), False, 'from spatialdata.spatialdb.UniformDB impor...
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
[ "unittest.main", "test_util.GenArgList", "oneflow.nn.GroupNorm", "numpy.zeros", "numpy.array", "oneflow.unittest.skip_unless_1n1d", "collections.OrderedDict", "oneflow.device" ]
[((12595, 12627), 'oneflow.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (12625, 12627), True, 'import oneflow as flow\n'), ((855, 1349), 'numpy.array', 'np.array', (['[[[[-0.8791, 0.2553, 0.7403, -0.2859], [0.8006, -1.7701, -0.9617, 0.1705],\n [0.2842, 1.7825, 0.3365, -0.8525]], [[...
import datetime from pathlib import Path import numpy as np import os import requests import yaml from django.db.models import Q from rest_framework import mixins, status, views, viewsets from rest_framework.response import Response from backend import celery_app, settings from backend_app import mixins as BAMixins, ...
[ "yaml.load", "numpy.load", "backend_app.serializers.StopProcessSerializer", "backend_app.models.Project.objects.filter", "yaml.dump", "backend_app.models.ModelWeights.objects.all", "backend_app.serializers.InferenceSerializer", "backend_app.models.Inference.objects.filter", "pathlib.Path", "backen...
[((1132, 1168), 'backend_app.models.AllowedProperty.objects.all', 'models.AllowedProperty.objects.all', ([], {}), '()\n', (1166, 1168), False, 'from backend_app import mixins as BAMixins, models, serializers\n'), ((2030, 2058), 'backend_app.models.Dataset.objects.all', 'models.Dataset.objects.all', ([], {}), '()\n', (2...
import os import pickle from time import time from multiprocessing import Process, Pipe import sys from signal import signal, SIGTERM import numpy as np from perfect_information_game.heuristics import Network from perfect_information_game.heuristics import ProxyNetwork from perfect_information_game.utils import get_tra...
[ "perfect_information_game.heuristics.Network", "numpy.concatenate", "signal.signal", "time.time", "perfect_information_game.heuristics.ProxyNetwork", "perfect_information_game.utils.get_training_path", "pickle.load", "multiprocessing.Pipe", "multiprocessing.Process", "sys.exit" ]
[((630, 648), 'multiprocessing.Pipe', 'Pipe', ([], {'duplex': '(False)'}), '(duplex=False)\n', (634, 648), False, 'from multiprocessing import Process, Pipe\n'), ((663, 775), 'multiprocessing.Process', 'Process', ([], {'target': 'training_process_loop', 'args': '(GameClass, model_path, worker_pipes, worker_training_dat...
import pandas as pd import pathlib import numpy as np from typing import Union, Tuple import matplotlib.pyplot as plt class QuestionnaireAnalysis: """ Reads and analyzes data generated by the questionnaire experiment. Should be able to accept strings and pathlib.Path objects. """ def __init__(...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.hist", "pandas.read_json", "pathlib.Path", "numpy.where", "numpy.linspace" ]
[((2986, 3011), 'pathlib.Path', 'pathlib.Path', (['"""data.json"""'], {}), "('data.json')\n", (2998, 3011), False, 'import pathlib\n'), ((385, 399), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (397, 399), True, 'import pandas as pd\n'), ((736, 765), 'pandas.read_json', 'pd.read_json', (['self.data_fname'], {}...
# coding: utf-8 # # Dataset boolean4: VP conjoined by and # # Generating sentences of the form # # - 1) **c VERB1 COMPLEMENT1 AND VERB2 COMPLEMENT2, c didn't VERB1 COMPLEMENT1** (contradiction) # - 1) **c VERB1 COMPLEMENT1 AND VERB2 COMPLEMENT2, c didn't VERB2 COMPLEMENT2** (contradiction) # # # - 2) **c VERB1 COMP...
[ "pandas.DataFrame", "os.makedirs", "os.path.exists", "numpy.random.choice", "numpy.random.shuffle" ]
[((7126, 7160), 'numpy.random.shuffle', 'np.random.shuffle', (['all_sentences_1'], {}), '(all_sentences_1)\n', (7143, 7160), True, 'import numpy as np\n'), ((7165, 7199), 'numpy.random.shuffle', 'np.random.shuffle', (['all_sentences_2'], {}), '(all_sentences_2)\n', (7182, 7199), True, 'import numpy as np\n'), ((7907, 7...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "numpy.dtype", "pandas.DataFrame.from_dict", "re.compile" ]
[((970, 994), 're.compile', 're.compile', (['"""^-[0-9.]+$"""'], {}), "('^-[0-9.]+$')\n", (980, 994), False, 'import re\n'), ((1259, 1316), 're.compile', 're.compile', (['"""^(?:"{2}|\\\\s{1,})(?=[\\\\-@+|=%])|^[\\\\-@+|=%]"""'], {}), '(\'^(?:"{2}|\\\\s{1,})(?=[\\\\-@+|=%])|^[\\\\-@+|=%]\')\n', (1269, 1316), False, 'im...
import os from pathlib import Path import sys import time from functools import partial import math import random import copy from collections import deque import logging sys.path.append(str(Path(__file__).resolve().parent.parent)) import scipy import scipy.optimize import numpy as np import matplotlib.pyplot as plt ...
[ "numpy.random.seed", "py_diff_pd.common.rl_sim.get_logger", "deep_rl.utils.set_one_thread", "deep_rl.utils.Config", "py_diff_pd.common.rl_sim.MeanStdNormalizer", "torch.manual_seed", "torch.load", "deep_rl.agent.FCBody", "deep_rl.utils.generate_tag", "time.time", "torch.save", "torch.set_defau...
[((1277, 1294), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1288, 1294), False, 'import random\n'), ((1299, 1319), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1313, 1319), True, 'import numpy as np\n'), ((1324, 1347), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see...
# Copyright 2022 <NAME> # 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...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "pandas.read_sql", "numpy.random.seed", "matplotlib.cm.get_cmap", "matplotlib.pyplot.clf", "os.getcwd", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "ordered_set.OrderedSet", "matplotlib.pyplot.figure", "numpy.array", "matplotl...
[((635, 646), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (644, 646), False, 'import os\n'), ((1937, 1970), 'matplotlib.cm.get_cmap', 'cm.get_cmap', (['"""rainbow"""', 'no_labels'], {}), "('rainbow', no_labels)\n", (1948, 1970), False, 'from matplotlib import cm\n'), ((1988, 2012), 'ordered_set.OrderedSet', 'OrderedSet...
""" Implement simple polynomial interpolation to help draw smooth curves on the merge trees """ import numpy as np import matplotlib.pyplot as plt def polyFit(X, xs, doPlot = False): """ Given a Nx2 array X of 2D coordinates, fit an N^th order polynomial and evaluate it at the coordinates in xs. This f...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.scatter", "matplotlib.pyplot.hold", "numpy.zeros", "matplotlib.pyplot.axis", "numpy.array", "numpy.linalg.inv", "numpy.linspace" ]
[((451, 467), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (459, 467), True, 'import numpy as np\n'), ((525, 541), 'numpy.linalg.inv', 'np.linalg.inv', (['A'], {}), '(A)\n', (538, 541), True, 'import numpy as np\n'), ((596, 612), 'numpy.zeros', 'np.zeros', (['(M, 2)'], {}), '((M, 2))\n', (604, 612), True,...
# Example of kNN implemented from Scratch in Python import csv import random import math import operator import numpy as np import sys def loadDataset(filename, split, trainingSet=[] , testSet=[]): with open(filename, 'rb') as csvfile: lines = csv.reader(csvfile) dataset = list(lines) for ...
[ "csv.reader", "math.sqrt", "numpy.empty", "random.random", "operator.itemgetter" ]
[((736, 770), 'numpy.empty', 'np.empty', (['(num_points, dim_points)'], {}), '((num_points, dim_points))\n', (744, 770), True, 'import numpy as np\n'), ((784, 804), 'numpy.empty', 'np.empty', (['num_points'], {}), '(num_points)\n', (792, 804), True, 'import numpy as np\n'), ((1151, 1170), 'math.sqrt', 'math.sqrt', (['d...
#!/usr/bin/env python # coding: utf-8 # ## Reinhold and Pierrehumbert 1982 model version # This model version is a simple 2-layer channel QG atmosphere truncated at wavenumber 2 on a beta-plane with # a simple orography (a montain and a valley). # # More detail can be found in the articles: # # * <NAME>., & <NAME>....
[ "integrators.integrator.RungeKuttaIntegrator", "numpy.random.seed", "numpy.deg2rad", "time.process_time", "numpy.savetxt", "numpy.insert", "functions.tendencies.create_tendencies", "sys.stdout.flush", "numpy.random.rand", "numpy.concatenate" ]
[((977, 998), 'numpy.random.seed', 'np.random.seed', (['(21217)'], {}), '(21217)\n', (991, 998), True, 'import numpy as np\n'), ((1952, 1971), 'time.process_time', 'time.process_time', ([], {}), '()\n', (1969, 1971), False, 'import time\n'), ((2609, 2644), 'functions.tendencies.create_tendencies', 'create_tendencies', ...
import copy import os import platform import numpy as np from cst_modeling.foil import cst_foil from scipy.interpolate import interp1d class TSfoil(): ''' Python interface of TSFOIL2. ''' def __init__(self): self.path = os.path.dirname(__file__) self.local = os.getcwd() ...
[ "copy.deepcopy", "os.getcwd", "os.path.dirname", "numpy.zeros", "os.path.exists", "os.system", "numpy.array", "platform.system", "scipy.interpolate.interp1d", "cst_modeling.foil.cst_foil" ]
[((248, 273), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (263, 273), False, 'import os\n'), ((295, 306), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (304, 306), False, 'import os\n'), ((1983, 2032), 'cst_modeling.foil.cst_foil', 'cst_foil', (['(81)', 'cst_u', 'cst_l'], {'x': 'None', 't': ...
import itertools import numpy as np import os import torch import matplotlib.pyplot as plt import metrics def plot_from_checkpoint_losses(checkpoint, last_plotted_epoch=None, ylim=(0, 0.3)): losses_train = checkpoint["losses_train"] codewords_in_dataset_train = checkpoint["codewords_in_dataset_train"] no...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.yscale", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.legend", "torch.load", "matplotlib.pyplot.figure", "numpy.where", "itertools.cycle", "numpy.array...
[((1008, 1038), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Number of epochs"""'], {}), "('Number of epochs')\n", (1018, 1038), True, 'import matplotlib.pyplot as plt\n'), ((1043, 1061), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Loss"""'], {}), "('Loss')\n", (1053, 1061), True, 'import matplotlib.pyplot as pl...
import random import string import tempfile import os import contextlib import json import urllib.request import hashlib import time import subprocess as sp import multiprocessing as mp import platform import av import pytest from tensorflow.io import gfile import imageio import numpy as np from . ...
[ "numpy.array_equal", "multiprocessing.Queue", "pytest.mark.parametrize", "os.path.join", "numpy.prod", "tempfile.TemporaryDirectory", "numpy.random.RandomState", "pytest.raises", "tempfile.mkdtemp", "imageio.get_reader", "tensorflow.io.gfile.mkdir", "json.dump", "hashlib.md5", "tensorflow....
[((5756, 5853), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ctx"""', '[_get_temp_local_path, _get_temp_gcs_path, _get_temp_as_path]'], {}), "('ctx', [_get_temp_local_path, _get_temp_gcs_path,\n _get_temp_as_path])\n", (5779, 5853), False, 'import pytest\n'), ((6154, 6251), 'pytest.mark.parametrize', ...
from abc import ABCMeta, abstractmethod, abstractproperty from sklearn.base import RegressorMixin import numpy as np class RegressorMixinND(RegressorMixin): def score(self, X, y, sample_weight=None): # TODO: multi-output. return super().score(X, y.reshape(-1), sample_weight) class BaseData(metac...
[ "numpy.ix_" ]
[((1251, 1275), 'numpy.ix_', 'np.ix_', (['indices', 'indices'], {}), '(indices, indices)\n', (1257, 1275), True, 'import numpy as np\n'), ((1570, 1610), 'numpy.ix_', 'np.ix_', (['*(np.r_[idx] for idx in indices)'], {}), '(*(np.r_[idx] for idx in indices))\n', (1576, 1610), True, 'import numpy as np\n')]
# Graciously adopted from https://github.com/ucscXena/xenaH5 # # Converts the sparse HDF5 files provided by 10xgenomics into a dense # representation as TSV. The script is design to be used with a runner # script and WARNING currently hardcodes values for the number of # available processes. # # Usage # # python makets...
[ "h5py.File", "numpy.zeros" ]
[((467, 522), 'h5py.File', 'h5py.File', (['"""1M_neurons_filtered_gene_bc_matrices_h5.h5"""'], {}), "('1M_neurons_filtered_gene_bc_matrices_h5.h5')\n", (476, 522), False, 'import h5py\n'), ((1143, 1183), 'numpy.zeros', 'np.zeros', (['counter_indptr_size'], {'dtype': 'int'}), '(counter_indptr_size, dtype=int)\n', (1151,...
import numpy as np import matplotlib.image as mpimg import matplotlib.pyplot as plt import torch from decimal import Decimal from helper_plot import * from elementary import * tensor_type = torch.DoubleTensor def shoot(cp, alpha, kernel_width, n_steps=10): """ This is the trajectory of a Hamiltonian d...
[ "torch.cat", "numpy.swapaxes", "torch.reshape", "torch.sum", "torch.from_numpy" ]
[((5447, 5539), 'torch.reshape', 'torch.reshape', (['deformed_points', '(deformed_points.shape[0], deformed_points.shape[1], 1)'], {}), '(deformed_points, (deformed_points.shape[0], deformed_points.\n shape[1], 1))\n', (5460, 5539), False, 'import torch\n'), ((5556, 5653), 'torch.reshape', 'torch.reshape', (['deform...
# Copyright 2017 <NAME>. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
[ "polyvore_model_vse.PolyvoreModel", "pickle.dump", "configuration.ModelConfig", "tensorflow.train.Saver", "tensorflow.Session", "os.path.isfile", "tensorflow.gfile.GFile", "tensorflow.Graph", "numpy.squeeze", "tensorflow.app.run", "tensorflow.flags.DEFINE_string" ]
[((1024, 1147), 'tensorflow.flags.DEFINE_string', 'tf.flags.DEFINE_string', (['"""checkpoint_path"""', '""""""', '"""Model checkpoint file or directory containing a model checkpoint file."""'], {}), "('checkpoint_path', '',\n 'Model checkpoint file or directory containing a model checkpoint file.')\n", (1046, 1147),...