code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 27 11:26:25 2019
@author: engelen
"""
import xarray as xr
import pandas as pd
from glob import glob
import os
import numpy as np
from collections import defaultdict
def get_first_true(df, condition):
time = df[condition].iloc[0:1].index.values
if time.size == 0:... | [
"numpy.abs",
"pandas.read_csv",
"os.path.join",
"xarray.Dataset",
"collections.defaultdict",
"os.path.basename",
"pandas.DataFrame",
"xarray.open_dataset",
"pandas.concat",
"glob.glob"
] | [((454, 467), 'glob.glob', 'glob', (['fw_path'], {}), '(fw_path)\n', (458, 467), False, 'from glob import glob\n'), ((528, 541), 'glob.glob', 'glob', (['or_path'], {}), '(or_path)\n', (532, 541), False, 'from glob import glob\n'), ((1383, 1396), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (1394, 1396), ... |
import numpy
from AnyQt.QtGui import QColor, QRadialGradient, QPainterPathStroker
def saturated(color, factor=150):
"""Return a saturated color.
"""
h = color.hsvHueF()
s = color.hsvSaturationF()
v = color.valueF()
a = color.alphaF()
s = factor * s / 100.0
s = max(min(1.0, s), 0.0)
... | [
"AnyQt.QtGui.QPainterPathStroker",
"AnyQt.QtGui.QColor.fromHsvF",
"numpy.argsort",
"numpy.linspace",
"AnyQt.QtGui.QRadialGradient"
] | [((507, 551), 'numpy.linspace', 'numpy.linspace', (['(0.0)', '(1.0)', 'num'], {'endpoint': '(True)'}), '(0.0, 1.0, num, endpoint=True)\n', (521, 551), False, 'import numpy\n'), ((1030, 1060), 'AnyQt.QtGui.QRadialGradient', 'QRadialGradient', (['(0.5)', '(0.5)', '(0.5)'], {}), '(0.5, 0.5, 0.5)\n', (1045, 1060), False, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Spectrassembler main program
@author: <NAME>
"""
from __future__ import print_function
from time import time
import sys
import argparse
from functools import partial
from multiprocessing import Pool
import numpy as np
from Bio import SeqIO
from scipy.sparse import coo... | [
"spectral.remove_bridge_reads",
"argparse.ArgumentParser",
"scipy.sparse.coo_matrix",
"ioandplots.make_dir",
"spectral.sym_max",
"overlaps.compute_positions",
"consensus.run_spoa_in_cc",
"ioandplots.oprint",
"spectral.reorder_mat",
"time.time",
"spectral.reorder_mat_par",
"ioandplots.fill_args... | [((715, 721), 'time.time', 'time', ([], {}), '()\n', (719, 721), False, 'from time import time\n'), ((732, 861), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""De novo experimental assemblerbased on a spectral algorithm to reorder the reads"""'}), "(description=\n 'De novo experimenta... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 18 16:59:08 2021
@author: Hatlab_3
"""
from data_processing.ddh5_Plotting.utility_modules.FS_utility_functions import fit_fluxsweep
from data_processing.Helper_Functions import find_all_ddh5
from plottr.apps.autoplot import autoplotDDH5, script, main
import numpy as np
im... | [
"numpy.abs",
"data_processing.ddh5_Plotting.utility_modules.FS_utility_functions.fit_fluxsweep",
"matplotlib.pyplot.plot",
"numpy.size",
"scipy.signal.savgol_filter",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.legend"
] | [((1611, 1654), 'data_processing.ddh5_Plotting.utility_modules.FS_utility_functions.fit_fluxsweep', 'fit_fluxsweep', (['datadir', 'savedir', '"""SA_2X_B1"""'], {}), "(datadir, savedir, 'SA_2X_B1')\n", (1624, 1654), False, 'from data_processing.ddh5_Plotting.utility_modules.FS_utility_functions import fit_fluxsweep\n'),... |
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, List, Optional
import numpy as np
import numpy.typing as npt
from nuplan.common.actor_state.agent import Agent
from nuplan.common.actor_state.ego_state import EgoState
from nuplan.common.actor_state.vehicle_parameters impor... | [
"numpy.abs",
"numpy.isclose",
"numpy.amin",
"nuplan.common.geometry.compute.signed_longitudinal_distance",
"numpy.sum",
"collections.defaultdict",
"nuplan.common.actor_state.vehicle_parameters.get_pacifica_parameters",
"nuplan.common.geometry.compute.signed_lateral_distance",
"numpy.amax"
] | [((9182, 9199), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (9193, 9199), False, 'from collections import defaultdict\n'), ((9608, 9625), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (9619, 9625), False, 'from collections import defaultdict\n'), ((2093, 2118), 'nuplan.... |
import unittest
import tempfile
import numpy as np
import coremltools
import os
import shutil
import tensorflow as tf
from tensorflow.keras import backend as _keras
from tensorflow.keras import layers
from coremltools._deps import HAS_TF_2
from test_utils import generate_data, tf_transpose
class TensorFlowKerasTests... | [
"numpy.random.rand",
"tensorflow.keras.layers.BatchNormalization",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.train.write_graph",
"tensorflow.keras.layers.GlobalMaxPooling2D",
"unittest.main",
"tensorflow.keras.layers.MaxPooling1D",
"tensorflow.gfile.GFile",
"tensorflow.keras.laye... | [((10165, 10224), 'unittest.skip', 'unittest.skip', (['"""non-equal block shape is not yet supported"""'], {}), "('non-equal block shape is not yet supported')\n", (10178, 10224), False, 'import unittest\n'), ((11845, 11885), 'unittest.skip', 'unittest.skip', (['"""list index out of range"""'], {}), "('list index out o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
大智慧数据的处理
"""
import urllib
import urllib.request
import numpy as np
from struct import *
from ..xio.h5 import write_dataframe_set_struct_keep_head
dzh_h5_type = np.dtype([
('time', np.uint64),
('pre_day', np.float64),
('pre_close', np.float64),
('split... | [
"numpy.fromiter",
"urllib.request.install_opener",
"urllib.request.ProxyHandler",
"urllib.request.build_opener",
"numpy.dtype",
"urllib.request.urlopen"
] | [((213, 545), 'numpy.dtype', 'np.dtype', (["[('time', np.uint64), ('pre_day', np.float64), ('pre_close', np.float64), (\n 'split', np.float64), ('purchase', np.float64), ('purchase_price', np.\n float64), ('dividend', np.float64), ('dr_pre_close', np.float64), (\n 'dr_factor', np.float64), ('backward_factor', ... |
"""
Res2Net for ImageNet-1K, implemented in Gluon.
Original paper: 'Res2Net: A New Multi-scale Backbone Architecture,' https://arxiv.org/abs/1904.01169.
"""
__all__ = ['Res2Net', 'res2net50_w14_s8', 'res2net50_w26_s8']
import os
from mxnet import cpu
from mxnet.gluon import nn, HybridBlock
from mxnet.gluon.co... | [
"numpy.prod",
"mxnet.nd.zeros",
"mxnet.gluon.nn.Dense",
"mxnet.cpu",
"mxnet.gluon.contrib.nn.Identity",
"os.path.join",
"mxnet.gluon.nn.Flatten",
"mxnet.gluon.nn.AvgPool2D",
"mxnet.gluon.nn.HybridSequential",
"mxnet.gluon.nn.Activation"
] | [((7313, 7318), 'mxnet.cpu', 'cpu', ([], {}), '()\n', (7316, 7318), False, 'from mxnet import cpu\n'), ((7341, 7378), 'os.path.join', 'os.path.join', (['"""~"""', '""".mxnet"""', '"""models"""'], {}), "('~', '.mxnet', 'models')\n", (7353, 7378), False, 'import os\n'), ((10602, 10610), 'mxnet.cpu', 'mx.cpu', ([], {}), '... |
from unittest import TestCase, skipUnless, mock
from pya import *
import numpy as np
import time
class TestAserver(TestCase):
def setUp(self) -> None:
self.backend = DummyBackend()
self.sig = np.sin(2 * np.pi * 440 * np.linspace(0, 1, 44100))
self.asine = Asig(self.sig, sr=44100, label="t... | [
"numpy.linspace",
"numpy.iinfo",
"time.sleep",
"numpy.max"
] | [((555, 570), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (565, 570), False, 'import time\n'), ((1049, 1064), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (1059, 1064), False, 'import time\n'), ((809, 823), 'numpy.max', 'np.max', (['sample'], {}), '(sample)\n', (815, 823), True, 'import numpy as ... |
# Importing modules
import pygame
import numpy as np
import random
# Initializing the Pygame module
pygame.init()
def console_screen():
"""This function is meant for the user to enter specifications for the game as the player plays. """
print('Note: Enter nicknames to name the players in the game'... | [
"pygame.mouse.get_pressed",
"pygame.init",
"pygame.quit",
"pygame.mixer.music.set_volume",
"pygame.mixer_music.load",
"pygame.font.Font",
"numpy.flip",
"pygame.display.set_mode",
"pygame.mixer_music.play",
"pygame.mouse.get_pos",
"pygame.draw.rect",
"pygame.image.load",
"pygame.display.updat... | [((107, 120), 'pygame.init', 'pygame.init', ([], {}), '()\n', (118, 120), False, 'import pygame\n'), ((2801, 2857), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(display_width, display_height)'], {}), '((display_width, display_height))\n', (2824, 2857), False, 'import pygame\n'), ((2859, 2901), 'pygame.disp... |
# coding: utf-8
from __future__ import with_statement, print_function, absolute_import
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_pl... | [
"torch.nn.ReLU",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"numpy.random.random_integers",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.functional.normalize",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.functional.softmax",
"torch.rand"
] | [((293, 424), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': 'dilation', 'groups': 'groups', 'bias': '(False)', 'dilation': 'dilation'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=\n dilation, groups=groups, bias=False, dilatio... |
"""Implementation of circuit for ML
"""
from numpy import pi, random, zeros_like, zeros, log2
class circuitML():
"""Abstract Quantum ML circuit interface.
Provides a unified interface to run multiple parametric circuits with
different input and model parameters, agnostic of the backend, implemented
in... | [
"numpy.zeros_like",
"numpy.zeros",
"numpy.random.seed",
"numpy.log2",
"numpy.random.randn"
] | [((2458, 2485), 'numpy.random.randn', 'random.randn', (['self.nbparams'], {}), '(self.nbparams)\n', (2470, 2485), False, 'from numpy import pi, random, zeros_like, zeros, log2\n'), ((4925, 4956), 'numpy.zeros', 'zeros', (['(self.nbparams, dim_out)'], {}), '((self.nbparams, dim_out))\n', (4930, 4956), False, 'from numpy... |
import numpy as np
def _GLMHMM_symb_lik(emit_w, X_trial, y_trial):
num_states = emit_w.shape[0]
num_emissions = emit_w.shape[1]
# Put the stimulus (X_trial) in a different format for easier multiplication
X_trial_mod = np.tile(np.reshape(X_trial, (1, 1, X_trial.shape[0], X_trial.shape[1]), ... | [
"numpy.sum",
"numpy.reshape",
"numpy.isnan"
] | [((256, 330), 'numpy.reshape', 'np.reshape', (['X_trial', '(1, 1, X_trial.shape[0], X_trial.shape[1])'], {'order': '"""F"""'}), "(X_trial, (1, 1, X_trial.shape[0], X_trial.shape[1]), order='F')\n", (266, 330), True, 'import numpy as np\n'), ((1175, 1199), 'numpy.isnan', 'np.isnan', (['symb_lik[:, t]'], {}), '(symb_lik[... |
import numpy as np
import time
import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
path_train = sys.argv[1];
path_test = sys.argv[2];
one_train = sys.argv[3];
one_test = sys.argv[4];
def one_hot(array):
n = array.shape[0];
X = np.zeros((n,85));
Y = np.zeros((n,10));
for i in rang... | [
"warnings.simplefilter",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.savetxt"
] | [((545, 585), 'numpy.genfromtxt', 'np.genfromtxt', (['path_train'], {'delimiter': '""","""'}), "(path_train, delimiter=',')\n", (558, 585), True, 'import numpy as np\n'), ((597, 636), 'numpy.genfromtxt', 'np.genfromtxt', (['path_test'], {'delimiter': '""","""'}), "(path_test, delimiter=',')\n", (610, 636), True, 'impor... |
import copy
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from adapt.parameter_based import TransferTreeClassifier, TransferForestClassifier
methods = [
'relab',
'ser',
'strut',
'ser_nr',
'ser_no_ext',
'ser_nr_lambda',
... | [
"numpy.random.multivariate_normal",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.ensemble.RandomForestClassifier",
"adapt.parameter_based.TransferTreeClassifier",
"numpy.diag",
"numpy.sum",
"numpy.zeros",
"numpy.random.seed",
"copy.deepcopy",
"adapt.parameter_based.TransferForestClassifier",
... | [((466, 483), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (480, 483), True, 'import numpy as np\n'), ((592, 607), 'numpy.diag', 'np.diag', (['[1, 1]'], {}), '([1, 1])\n', (599, 607), True, 'import numpy as np\n'), ((640, 655), 'numpy.diag', 'np.diag', (['[2, 2]'], {}), '([2, 2])\n', (647, 655), True,... |
import torch
import torch_quiver as torch_qv
import random
import numpy as np
import time
from typing import List
from quiver.shard_tensor import ShardTensor, ShardTensorConfig, Topo
from quiver.utils import reindex_feature
import torch.multiprocessing as mp
from torch.multiprocessing import Process
import os
import sy... | [
"quiver.shard_tensor.Topo",
"quiver.Feature",
"torch.cuda.device_count",
"torch.from_numpy",
"torch.cuda.synchronize",
"numpy.array",
"quiver.shard_tensor.ShardTensorConfig",
"quiver.shard_tensor.ShardTensor.new_from_share_ipc",
"torch.randint",
"os.getpid",
"torch.multiprocessing.set_start_meth... | [((11270, 11318), 'multiprocessing.reduction.ForkingPickler.register', 'ForkingPickler.register', (['Feature', 'reduce_feature'], {}), '(Feature, reduce_feature)\n', (11293, 11318), False, 'from multiprocessing.reduction import ForkingPickler\n'), ((11519, 11546), 'torch.cuda.set_device', 'torch.cuda.set_device', (['ra... |
# Copyright: (c) 2021, <NAME>
import sys
sys.path.append('../../py-cuda-sdr/')
sys.path.append('../')
import importlib
import softCombiner
import json,rjsmin
importlib.reload(softCombiner)
import numpy as np
import matplotlib.pyplot as plt
import logging
import zmq
import time
import unittest
import numpy as np
imp... | [
"copy.deepcopy",
"time.sleep",
"numpy.array",
"numpy.random.randint",
"softCombiner.Worker",
"importlib.reload",
"time.time",
"unittest.main",
"sys.path.append",
"numpy.all",
"loadConfig.getConfigAndLog",
"numpy.random.randn"
] | [((42, 79), 'sys.path.append', 'sys.path.append', (['"""../../py-cuda-sdr/"""'], {}), "('../../py-cuda-sdr/')\n", (57, 79), False, 'import sys\n'), ((80, 102), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (95, 102), False, 'import sys\n'), ((160, 190), 'importlib.reload', 'importlib.reload', ... |
import scanpy as sc
import muon as mu
import numpy as np
## VIASH START
par = {
'input': 'resources_test/pbmc_1k_protein_v3/pbmc_1k_protein_v3_filtered_feature_bc_matrix.h5mu',
'modality': ['rna'],
'output': 'output.h5mu',
'var_name_filter': 'filter_with_hvg',
'do_subset': False,
'flavor': 'seurat',
'n_t... | [
"numpy.ravel",
"muon.read_h5mu",
"scanpy.pp.highly_variable_genes"
] | [((472, 498), 'muon.read_h5mu', 'mu.read_h5mu', (["par['input']"], {}), "(par['input'])\n", (484, 498), True, 'import muon as mu\n'), ((1377, 1416), 'scanpy.pp.highly_variable_genes', 'sc.pp.highly_variable_genes', ([], {}), '(**hvg_args)\n', (1404, 1416), True, 'import scanpy as sc\n'), ((2116, 2158), 'numpy.ravel', '... |
import json
import torch
import torch.nn as nn
import numpy as np
import torchvision
from torchvision import models, transforms
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
from efficientnet_pytorch import EfficientNet
from PIL import Image
from trivialaugment import aug_lib
np.random.seed(42)
to... | [
"ConfigSpace.hyperparameters.UniformIntegerHyperparameter",
"trivialaugment.aug_lib.set_augmentation_space",
"ConfigSpace.hyperparameters.UniformFloatHyperparameter",
"efficientnet_pytorch.EfficientNet.from_name",
"torchvision.models.densenet161",
"torchvision.models.resnet18",
"numpy.array",
"torch.n... | [((299, 317), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (313, 317), True, 'import numpy as np\n'), ((318, 339), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (335, 339), False, 'import torch\n'), ((340, 370), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['(42... |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error as mae
import matplotlib.pyplot as plt
import pandas as pd
import csv
df = pd.read_csv('vgsales.csv')
print(df.head())
y = df['Global_Sales']
df =... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.xlabel",
"sklearn.metrics.mean_absolute_error",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"sklearn.linear_model.LinearRegression",
"numpy.nan_to_num",
"matplotlib.pyplot.show"... | [((247, 273), 'pandas.read_csv', 'pd.read_csv', (['"""vgsales.csv"""'], {}), "('vgsales.csv')\n", (258, 273), True, 'import pandas as pd\n'), ((429, 445), 'numpy.nan_to_num', 'np.nan_to_num', (['X'], {}), '(X)\n', (442, 445), True, 'import numpy as np\n'), ((482, 520), 'sklearn.model_selection.train_test_split', 'train... |
import gputransform
import numpy as np
import numpy.testing as npt
import time
import os
import numpy.testing as npt
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# load test point cloud util
def load_pc_file(filename):
# returns Nx3 matrix
pc = np.fromfile(os.path.join("./", filename... | [
"matplotlib.pyplot.imshow",
"numpy.reshape",
"os.path.join",
"gputransform.GPUTransformer",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.pause",
"time.time",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.show"
] | [((717, 729), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (727, 729), True, 'import matplotlib.pyplot as plt\n'), ((735, 746), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['fig'], {}), '(fig)\n', (741, 746), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((767, 777), 'matplotlib.pyplot.show', 'plt.s... |
import os
import datetime
import zipfile
import threading
import hashlib
import shutil
import subprocess
import pprint
from invoke import task
import boto3
S3_BUCKET = 'ai2-thor'
UNITY_VERSION = '2018.3.6f1'
def add_files(zipf, start_dir):
for root, dirs, files in os.walk(start_dir):
for f in files:
... | [
"boto3.client",
"zipfile.ZipFile",
"multiprocessing.Process",
"io.BytesIO",
"time.sleep",
"datetime.timedelta",
"multiprocessing.set_start_method",
"os.walk",
"os.path.exists",
"os.listdir",
"ai2thor.build.platform_map.keys",
"itertools.product",
"json.dumps",
"os.path.split",
"numpy.max... | [((271, 289), 'os.walk', 'os.walk', (['start_dir'], {}), '(start_dir)\n', (278, 289), False, 'import os\n'), ((685, 705), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (699, 705), False, 'import boto3\n'), ((725, 761), 'os.path.basename', 'os.path.basename', (['build_archive_name'], {}), '(build_a... |
import sys
import numpy as np
def l0gurobi(x, y, l0, l2, m, lb, ub, relaxed=True):
try:
from gurobipy import Model, GRB, QuadExpr, LinExpr
except ModuleNotFoundError:
raise Exception('Gurobi is not installed')
model = Model() # the optimization model
n = x.shape[0] # number of sampl... | [
"mosek.fusion.Domain.greaterThan",
"mosek.fusion.Expr.sum",
"mosek.fusion.Domain.inRotatedQCone",
"numpy.ones",
"mosek.fusion.Expr.add",
"mosek.fusion.Expr.mul",
"mosek.fusion.Domain.unbounded",
"mosek.fusion.Domain.inRange",
"gurobipy.QuadExpr",
"mosek.fusion.Expr.sub",
"gurobipy.Model",
"gur... | [((249, 256), 'gurobipy.Model', 'Model', ([], {}), '()\n', (254, 256), False, 'from gurobipy import Model, GRB, QuadExpr, LinExpr\n'), ((1353, 1363), 'gurobipy.QuadExpr', 'QuadExpr', ([], {}), '()\n', (1361, 1363), False, 'from gurobipy import Model, GRB, QuadExpr, LinExpr\n'), ((2684, 2695), 'mosek.fusion.Model', 'msk... |
import numpy as np
import torch
from pyquaternion import Quaternion
from utils.data_classes import Box
def anchor_to_standup_box2d(anchors):
# (N, 4) -> (N, 4); x,y,w,l -> x1,y1,x2,y2
anchor_standup = np.zeros_like(anchors)
# r == 0
anchor_standup[::2, 0] = anchors[::2, 0] - anchors[::2, 3] / 2
a... | [
"pyquaternion.Quaternion",
"torch.mul",
"torch.atan2",
"torch.sqrt",
"torch.sin",
"torch.exp",
"numpy.max",
"numpy.zeros",
"torch.cos",
"numpy.min",
"utils.data_classes.Box",
"torch.zeros_like",
"numpy.zeros_like",
"torch.FloatTensor"
] | [((212, 234), 'numpy.zeros_like', 'np.zeros_like', (['anchors'], {}), '(anchors)\n', (225, 234), True, 'import numpy as np\n'), ((978, 994), 'numpy.zeros', 'np.zeros', (['(N, 4)'], {}), '((N, 4))\n', (986, 994), True, 'import numpy as np\n'), ((1023, 1060), 'numpy.min', 'np.min', (['boxes_corner[:, :, 0]'], {'axis': '(... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import math
def get_min_node_pred(queue):
min_node = 0
for node in range(len(queue)):
if queue[node].cost_for_pred < queue[min_node].cost_for_pred:
min_node = node
return queue.pop(min_node)
def get_min_node_prey(queue):... | [
"numpy.clip",
"math.sqrt",
"numpy.sqrt",
"numpy.ones"
] | [((2585, 2625), 'numpy.sqrt', 'np.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (2592, 2625), True, 'import numpy as np\n'), ((2861, 2903), 'math.sqrt', 'math.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (2870, 2903), False, 'imp... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from astropy.tests.helper import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.modeling.models import Gaussian2D... | [
"astropy.tests.helper.pytest.raises",
"numpy.ones",
"astropy.tests.helper.pytest.mark.skipif",
"numpy.testing.assert_allclose",
"astropy.modeling.models.Gaussian2D"
] | [((512, 547), 'astropy.tests.helper.pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_SCIPY"""'], {}), "('not HAS_SCIPY')\n", (530, 547), False, 'from astropy.tests.helper import pytest\n'), ((582, 597), 'numpy.ones', 'np.ones', (['(5, 5)'], {}), '((5, 5))\n', (589, 597), True, 'import numpy as np\n'), ((796, 82... |
#!/usr/bin/env python3
# usage:
# fwhmSweep.py 56530 7 14
# fwhmSweep.py <mjd> <file number first> <file nimber last>
import glob
import pyfits
import sys, os
import numpy as np
from scipy import ndimage
from pylab import *
import scipy
directory="/data/ecam/%s/" % (sys.argv[1])
# if directory exist?
if os.pa... | [
"os.path.exists",
"numpy.sqrt",
"numpy.where",
"scipy.polyfit",
"scipy.array",
"scipy.interpolate.interp1d",
"numpy.array",
"scipy.polyval",
"sys.exit",
"scipy.ndimage.measurements.center_of_mass",
"pyfits.open"
] | [((1653, 1673), 'scipy.array', 'scipy.array', (['fwhmPix'], {}), '(fwhmPix)\n', (1664, 1673), False, 'import scipy\n'), ((1802, 1821), 'scipy.array', 'scipy.array', (['focArr'], {}), '(focArr)\n', (1813, 1821), False, 'import scipy\n'), ((1835, 1871), 'scipy.polyfit', 'scipy.polyfit', (['arrayFoc', 'arrayPix', '(2)'], ... |
import argparse
import os
import numpy as np
from torchdistill.datasets.transform import CustomCompose, CustomRandomResize
from torchdistill.datasets.util import load_coco_dataset, build_transform
from torchvision.datasets import ImageFolder, VOCSegmentation
from torchvision.transforms import transforms
from custom.t... | [
"torchvision.transforms.transforms.CenterCrop",
"argparse.ArgumentParser",
"torchdistill.datasets.transform.CustomRandomResize",
"numpy.array",
"custom.transform.BPG",
"torchvision.transforms.transforms.Resize",
"os.path.expanduser"
] | [((376, 477), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""BPG file size for ImageNet and COCO segmentation datasets"""'}), "(description=\n 'BPG file size for ImageNet and COCO segmentation datasets')\n", (399, 477), False, 'import argparse\n'), ((834, 982), 'custom.transform.BPG',... |
import numpy as np
import matplotlib.pyplot as pl
import os
from ipdb import set_trace as stop
os.environ["KERAS_BACKEND"] = "tensorflow"
from keras.optimizers import Adam
from keras.layers import Dense, LSTM, Input, TimeDistributed, Flatten
from keras.models import Model
import tensorflow as tf
import keras.backend.... | [
"keras.optimizers.Adam",
"keras.backend.tensorflow_backend.set_session",
"numpy.random.rand",
"keras.layers.Flatten",
"tensorflow.Session",
"keras.utils.plot_model",
"numpy.array",
"keras.layers.Input",
"numpy.zeros",
"numpy.random.randint",
"keras.models.Model",
"keras.layers.LSTM",
"keras.... | [((481, 497), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (495, 497), True, 'import tensorflow as tf\n'), ((561, 586), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (571, 586), True, 'import tensorflow as tf\n'), ((595, 619), 'keras.backend.tensorflow_backend.set... |
from __future__ import print_function
import numpy as np
from scipy import sparse
from scipy.interpolate import griddata
def fast_histogram2d(x, y, bins=10, weights=None, reduce_w=None, NULL=None,
reinterp=None):
"""
Compute the sparse bi-dimensional histogram of two data samples where *x... | [
"numpy.ones",
"numpy.sort",
"numpy.log",
"numpy.asarray",
"numpy.floor",
"numpy.argmax",
"numpy.diff",
"numpy.std",
"numpy.array",
"numpy.zeros",
"numpy.isfinite",
"numpy.vstack",
"numpy.concatenate",
"scipy.sparse.coo_matrix",
"numpy.cumsum",
"numpy.transpose",
"numpy.arange"
] | [((3555, 3600), 'scipy.sparse.coo_matrix', 'sparse.coo_matrix', (['(_w, _xyi)'], {'shape': '(nx, ny)'}), '((_w, _xyi), shape=(nx, ny))\n', (3572, 3600), False, 'from scipy import sparse\n'), ((5274, 5284), 'numpy.sort', 'np.sort', (['t'], {}), '(t)\n', (5281, 5284), True, 'import numpy as np\n'), ((5361, 5416), 'numpy.... |
from flask import Flask
from flask import render_template
from flask import Flask, flash, request, redirect, url_for
from werkzeug.utils import secure_filename
import os
import numpy as np
import tensorflow as tf
import PIL
from tensorflow import keras
#backend instantiation
app = Flask(__name__)
app.config['UPLOAD_F... | [
"flask.render_template",
"tensorflow.keras.preprocessing.image.load_img",
"flask.flash",
"flask.Flask",
"os.path.join",
"numpy.argmax",
"numpy.max",
"flask.redirect",
"tensorflow.keras.models.load_model",
"werkzeug.utils.secure_filename",
"tensorflow.nn.softmax",
"tensorflow.expand_dims",
"o... | [((284, 299), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (289, 299), False, 'from flask import Flask, flash, request, redirect, url_for\n'), ((381, 430), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""ai/fingernail_model"""'], {}), "('ai/fingernail_model')\n", (407, 430), Tru... |
import sys
import numpy as np
from PIL import Image
def spec_to_png(in_path, out_path):
specgram = np.load(in_path) # (channels, bins, frames)
specgram = specgram[0]
specgram = np.log2(specgram)
specgram = specgram.sum(1)[:, np.newaxis]
specgram = np.repeat(specgram, 128, axis=1)
smax, smin =... | [
"PIL.Image.fromarray",
"numpy.repeat",
"numpy.flipud",
"numpy.max",
"numpy.min",
"numpy.log2",
"numpy.load"
] | [((105, 121), 'numpy.load', 'np.load', (['in_path'], {}), '(in_path)\n', (112, 121), True, 'import numpy as np\n'), ((192, 209), 'numpy.log2', 'np.log2', (['specgram'], {}), '(specgram)\n', (199, 209), True, 'import numpy as np\n'), ((271, 303), 'numpy.repeat', 'np.repeat', (['specgram', '(128)'], {'axis': '(1)'}), '(s... |
#Cognitive NPL (Natural Language Processing)
#Copyright 2020 <NAME> MIT License. READ LICENSE.
#Personality Profiling with a Restricted Botzmannm Machine (RBM)
import numpy as np
from random import randint
class RBM:
def __init__(self, num_visible, num_hidden):
self.num_hidden = num_hidden
self.nu... | [
"numpy.insert",
"numpy.sqrt",
"numpy.random.rand",
"numpy.exp",
"numpy.array",
"numpy.dot",
"numpy.sum",
"numpy.random.RandomState"
] | [((3056, 3190), 'numpy.array', 'np.array', (['[[1, 1, 0, 0, 1, 1], [1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1, 0, 1, 1,\n 0], [1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 0]]'], {}), '([[1, 1, 0, 0, 1, 1], [1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1,\n 0, 1, 1, 0], [1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 0]])\n', (3064, ... |
import numpy as np
from mandlebrot import mandelbrot
def test_mandelbrot_incorrect_test():
x = np.linspace(-1.5, -2.0, 10)
y = np.linspace(-1.25, 1.25, 10)
output = mandelbrot(x, y, 100, False)
assert np.all(output == 0.0) | [
"numpy.all",
"numpy.linspace",
"mandlebrot.mandelbrot"
] | [((100, 127), 'numpy.linspace', 'np.linspace', (['(-1.5)', '(-2.0)', '(10)'], {}), '(-1.5, -2.0, 10)\n', (111, 127), True, 'import numpy as np\n'), ((136, 164), 'numpy.linspace', 'np.linspace', (['(-1.25)', '(1.25)', '(10)'], {}), '(-1.25, 1.25, 10)\n', (147, 164), True, 'import numpy as np\n'), ((178, 206), 'mandlebro... |
import math
import numpy as np
"""
This function calculates the roots of the quadratic inequality for the Rh reuse factor.
Parameters:
lx - list of input sizes of the lstms. The size of this list is equal to the number of layers.
lh - list of input sizes of the hidden layers. The size of this ... | [
"numpy.dot",
"math.sqrt"
] | [((815, 829), 'numpy.dot', 'np.dot', (['lh', 'lh'], {}), '(lh, lh)\n', (821, 829), True, 'import numpy as np\n'), ((889, 918), 'math.sqrt', 'math.sqrt', (['(b ** 2 - 4 * a * c)'], {}), '(b ** 2 - 4 * a * c)\n', (898, 918), False, 'import math\n'), ((938, 967), 'math.sqrt', 'math.sqrt', (['(b ** 2 - 4 * a * c)'], {}), '... |
from spikeextractors import RecordingExtractor
import numpy as np
import h5py
import ctypes
class BiocamRecordingExtractor(RecordingExtractor):
def __init__(self, recording_file):
RecordingExtractor.__init__(self)
self._recording_file = recording_file
self._rf, self._nFrames, self._sampli... | [
"numpy.abs",
"h5py.File",
"numpy.zeros",
"spikeextractors.RecordingExtractor.__init__",
"numpy.arange"
] | [((2663, 2687), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (2672, 2687), False, 'import h5py\n'), ((195, 228), 'spikeextractors.RecordingExtractor.__init__', 'RecordingExtractor.__init__', (['self'], {}), '(self)\n', (222, 228), False, 'from spikeextractors import RecordingExtractor\n... |
import collections
import pickle
import random
import h5py
import numpy as np
import tqdm
from nas_201_api import NASBench201API
def is_valid_arch(matrix):
n = matrix.shape[0]
visited = {0}
q = collections.deque([0])
while q:
u = q.popleft()
for v in range(u + 1, n):
if v ... | [
"random.choice",
"pickle.dump",
"collections.deque",
"nas_201_api.NASBench201API",
"random.seed",
"numpy.array"
] | [((488, 502), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (499, 502), False, 'import random\n'), ((509, 561), 'nas_201_api.NASBench201API', 'NASBench201API', (['"""/tmp/NAS-Bench-201-v1_1-096897.pth"""'], {}), "('/tmp/NAS-Bench-201-v1_1-096897.pth')\n", (523, 561), False, 'from nas_201_api import NASBench201A... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#############
## Imports ##
#############
import os
import sys ; sys.path.append("/home/developer/workspace/rklearn-lib")
import time
import pickle
import numpy as np
from rklearn.tfoo_v1 import BaseDataGenerator
from rktools.monitors import ProgressBar
##############... | [
"os.path.exists",
"numpy.eye",
"os.path.join",
"rktools.monitors.ProgressBar",
"pickle.load",
"os.path.split",
"numpy.array",
"sys.exc_info",
"numpy.concatenate",
"time.time",
"sys.path.append"
] | [((113, 169), 'sys.path.append', 'sys.path.append', (['"""/home/developer/workspace/rklearn-lib"""'], {}), "('/home/developer/workspace/rklearn-lib')\n", (128, 169), False, 'import sys\n'), ((4090, 4101), 'time.time', 'time.time', ([], {}), '()\n', (4099, 4101), False, 'import time\n'), ((5106, 5117), 'time.time', 'tim... |
import os
import numpy as np
from tqdm.notebook import tqdm
from deepnote import MusicRepr
from deepnote import DEFAULT_UNIT
from joblib import delayed, Parallel
import torch
from torch.utils.data import random_split, Dataset, DataLoader
def get_dataloaders(dataset,
n_jobs=2,
b... | [
"deepnote.MusicRepr.from_file",
"os.listdir",
"torch.utils.data.random_split",
"deepnote.MusicRepr.merge_tracks",
"joblib.Parallel",
"numpy.array",
"torch.tensor",
"torch.utils.data.DataLoader",
"joblib.delayed",
"numpy.pad",
"tqdm.notebook.tqdm"
] | [((453, 486), 'torch.utils.data.random_split', 'random_split', (['dataset', '[n - v, v]'], {}), '(dataset, [n - v, v])\n', (465, 486), False, 'from torch.utils.data import random_split, Dataset, DataLoader\n'), ((506, 623), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'train_dataset', 'batch_size': 'ba... |
import numpy as np
from sklearn.cluster import KMeans
from splearn.cluster import SparkKMeans
from splearn.utils.testing import SplearnTestCase, assert_array_almost_equal
class TestKMeans(SplearnTestCase):
def test_same_centroids(self):
X, y, X_rdd = self.make_blobs(centers=4, n_samples=200000)
... | [
"sklearn.cluster.KMeans",
"numpy.sort",
"splearn.cluster.SparkKMeans",
"splearn.utils.testing.assert_array_almost_equal"
] | [((328, 383), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(4)', 'init': '"""k-means++"""', 'random_state': '(42)'}), "(n_clusters=4, init='k-means++', random_state=42)\n", (334, 383), False, 'from sklearn.cluster import KMeans\n'), ((399, 459), 'splearn.cluster.SparkKMeans', 'SparkKMeans', ([], {'n_cluster... |
"""
Python 3.9 программа самостоятельной игры агентов текущего и предыдущего покаления
программа на Python по изучению обучения с подкреплением - Reinforcement Learning
Название файла actor.py
Version: 0.1
Author: <NAME>
Date: 2021-12-23
"""
import numpy as np
import parl
import os
from alphazero_agent import create_a... | [
"MCTS.MCTS",
"utils.win_loss_draw",
"parl.remote_class",
"alphazero_agent.create_agent",
"numpy.random.seed"
] | [((406, 435), 'parl.remote_class', 'parl.remote_class', ([], {'wait': '(False)'}), '(wait=False)\n', (423, 435), False, 'import parl\n'), ((531, 551), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (545, 551), True, 'import numpy as np\n'), ((1788, 1823), 'alphazero_agent.create_agent', 'create_agen... |
#!/usr/bin/python
import os, csv
import tensorflow as tf
import numpy as np
import pandas as pd
import helpers
# fix random seed for reproducibility
np.random.seed(7)
#-------------------------- Constants --------------------------#
FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_string(
"input_dir", os.path.abspath("../d... | [
"helpers.extract_hour",
"pandas.DataFrame",
"os.path.join",
"tensorflow.contrib.learn.preprocessing.VocabularyProcessor",
"helpers.create_iter_generator",
"numpy.random.seed",
"tensorflow.flags.DEFINE_integer",
"os.path.abspath",
"tensorflow.contrib.learn.preprocessing.VocabularyProcessor.restore"
] | [((151, 168), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (165, 168), True, 'import numpy as np\n'), ((549, 619), 'tensorflow.flags.DEFINE_integer', 'tf.flags.DEFINE_integer', (['"""max_vector_len"""', '(16)', '"""Maximum vector length"""'], {}), "('max_vector_len', 16, 'Maximum vector length')\n", (... |
import numpy as np
import tensorflow as tf
from tensorstream.finance.supertrend import Supertrend
from tensorstream.tests import TestCase
class SupertrendSpec(TestCase):
def setUp(self):
self.sheets = self.read_ods(
self.from_test_res('supertrend.ods', __file__))
def test_supertrend(self):
sheet =... | [
"numpy.testing.assert_almost_equal",
"tensorflow.placeholder",
"tensorstream.finance.supertrend.Supertrend",
"tensorflow.Session"
] | [((364, 381), 'tensorstream.finance.supertrend.Supertrend', 'Supertrend', (['(10)', '(3)'], {}), '(10, 3)\n', (374, 381), False, 'from tensorstream.finance.supertrend import Supertrend\n'), ((401, 427), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {}), '(tf.float32)\n', (415, 427), True, 'import tensorf... |
# Copyright 2020, Battelle Energy Alliance, LLC
# ALL RIGHTS RESERVED
import numpy as np
import math
import random
from scipy.integrate import quad
def timeDepLambda(t,a,b):
return a+t*b
def pdfFailure(t,a,b):
first = timeDepLambda(t,a,b)
second = math.exp(-quad(timeDepLambda, 0, t, args=(a,b))[0])
return fi... | [
"scipy.integrate.quad",
"numpy.zeros",
"numpy.ndenumerate"
] | [((452, 480), 'numpy.zeros', 'np.zeros', (["Input['time'].size"], {}), "(Input['time'].size)\n", (460, 480), True, 'import numpy as np\n'), ((503, 532), 'numpy.ndenumerate', 'np.ndenumerate', (["Input['time']"], {}), "(Input['time'])\n", (517, 532), True, 'import numpy as np\n'), ((267, 305), 'scipy.integrate.quad', 'q... |
# -*- coding: utf-8 -*-
import sys
import numpy as np
import time
from utils import print_bracketing, check_dir
import argparse
import torch
import os.path
import re
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
class Saver():
"""
Handles the saving of checkpoints a... | [
"time.localtime",
"re.search",
"numpy.convolve",
"numpy.ones",
"argparse.ArgumentParser",
"torch.load",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.zeros",
"torch.cuda.is_available",
"time.time",
"numpy.pad",
"utils.check_dir",
"utils.print_bracketin... | [((21619, 21792), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Continuous control environment for Udacity DeepRL course."""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'Continuous control environment for Udacity DeepRL co... |
import matplotlib.pyplot as plt
import numpy as np
def autolabel(rects):
for rect in rects:
height = rect.get_height()
plt.text(rect.get_x()+rect.get_width()/2., 1.03*height, "%s" % float(height))
text = ["10.65x", "57.62x", "54.44x"]
def autolabel_user(rects):
for i, rect in enumerate(rects... | [
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.yticks",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((478, 493), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (487, 493), True, 'import numpy as np\n'), ((760, 798), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Operation"""'], {'fontsize': '(18.5)'}), "('Operation', fontsize=18.5)\n", (770, 798), True, 'import matplotlib.pyplot as plt\n'), ((799, 850), '... |
from sklearn.metrics.pairwise import cosine_similarity
import pandas as pd
import numpy as np
cs = cosine_similarity
df=pd.read_csv("df_final.csv")
def get_recommender(user_input):
""" This function produces the 5 top recommendations depending on user_input.
The user_input is the age group and skills selecte... | [
"numpy.array",
"pandas.read_csv"
] | [((121, 148), 'pandas.read_csv', 'pd.read_csv', (['"""df_final.csv"""'], {}), "('df_final.csv')\n", (132, 148), True, 'import pandas as pd\n'), ((619, 639), 'numpy.array', 'np.array', (['all_scores'], {}), '(all_scores)\n', (627, 639), True, 'import numpy as np\n')] |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from music21 import midi
import pypianoroll
from pypianoroll import Multitrack
from texttable import Texttable
import os
from pprint import pprint
def play_midi(input_midi):
'''Takes path ... | [
"numpy.random.choice",
"os.path.join",
"music21.midi.MidiFile",
"music21.midi.translate.midiFileToStream",
"numpy.load",
"os.walk"
] | [((457, 472), 'music21.midi.MidiFile', 'midi.MidiFile', ([], {}), '()\n', (470, 472), False, 'from music21 import midi\n'), ((569, 613), 'music21.midi.translate.midiFileToStream', 'midi.translate.midiFileToStream', (['midi_object'], {}), '(midi_object)\n', (600, 613), False, 'from music21 import midi\n'), ((920, 933), ... |
import numpy as np
import pandas as pd
import time
mnist = pd.read_csv("../input/train.csv")
mnist.head()
y_train = mnist.label.values
x_train = mnist.drop('label',axis=1)
x_train = (x_train / 255.0).values
x_train = np.reshape(x_train,(42000,1,28,28))
x_train.shape
from keras.models import Sequential
from keras.l... | [
"keras.backend.set_image_data_format",
"keras.layers.core.Flatten",
"matplotlib.pyplot.grid",
"numpy.reshape",
"pandas.read_csv",
"matplotlib.pyplot.xticks",
"keras.layers.pooling.MaxPooling2D",
"time.strftime",
"numpy.argmax",
"keras.models.Sequential",
"matplotlib.pyplot.figure",
"keras.laye... | [((60, 93), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (71, 93), True, 'import pandas as pd\n'), ((221, 260), 'numpy.reshape', 'np.reshape', (['x_train', '(42000, 1, 28, 28)'], {}), '(x_train, (42000, 1, 28, 28))\n', (231, 260), True, 'import numpy as np\n'), ((531... |
# -*- coding: utf-8 -*-
"""
# 3D Image Data Synthesis.
# Copyright (C) 2021 <NAME>, <NAME>, <NAME>, <NAME>, <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 Liceense at
#
# http://www.apache.... | [
"numpy.clip",
"numpy.sqrt",
"numpy.array",
"scipy.ndimage.gaussian_filter",
"numpy.sin",
"numpy.gradient",
"numpy.arange",
"numpy.repeat",
"numpy.reshape",
"numpy.cross",
"os.path.split",
"numpy.dot",
"numpy.matmul",
"skimage.morphology.ball",
"numpy.maximum",
"pyshtools.SHCoeffs.from_... | [((2455, 2487), 'os.path.join', 'os.path.join', (['save_path', '"""masks"""'], {}), "(save_path, 'masks')\n", (2467, 2487), False, 'import os\n'), ((2580, 2621), 'numpy.random.randint', 'np.random.randint', (['min_radius', 'max_radius'], {}), '(min_radius, max_radius)\n', (2597, 2621), True, 'import numpy as np\n'), ((... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["GP"]
try:
from itertools import izip
except ImportError:
izip = zip
import numpy as np
import scipy.optimize as op
from scipy.linalg import cho_factor, cho_solve, LinAlgError
from .utils import multivariate_gaussian_samples... | [
"numpy.diag_indices_from",
"scipy.linalg.cho_solve",
"numpy.atleast_2d",
"numpy.ones_like",
"scipy.linalg.cho_factor",
"scipy.optimize.minimize",
"numpy.log",
"numpy.diag",
"numpy.argsort",
"numpy.dot",
"numpy.isfinite",
"itertools.izip",
"numpy.zeros_like",
"numpy.arange",
"numpy.atleas... | [((2842, 2858), 'numpy.atleast_1d', 'np.atleast_1d', (['t'], {}), '(t)\n', (2855, 2858), True, 'import numpy as np\n'), ((3612, 3628), 'numpy.atleast_1d', 'np.atleast_1d', (['y'], {}), '(y)\n', (3625, 3628), True, 'import numpy as np\n'), ((5344, 5375), 'scipy.linalg.cho_factor', 'cho_factor', (['K'], {'overwrite_a': '... |
import unittest
from collections import defaultdict
import numpy as np
import enstat.mean
class Test_mean(unittest.TestCase):
"""
tests
"""
def test_scalar(self):
"""
Basic test of "mean" and "std" using a random sample.
"""
average = enstat.scalar()
averag... | [
"numpy.mean",
"numpy.prod",
"numpy.random.random",
"numpy.logical_not",
"numpy.array",
"collections.defaultdict",
"numpy.std",
"unittest.main"
] | [((5207, 5222), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5220, 5222), False, 'import unittest\n'), ((4084, 4110), 'collections.defaultdict', 'defaultdict', (['enstat.scalar'], {}), '(enstat.scalar)\n', (4095, 4110), False, 'from collections import defaultdict\n'), ((4570, 4596), 'collections.defaultdict', '... |
"""Author: <NAME>, Copyright 2019"""
import numpy as np
import mineral as ml
from mineral.core.samplers.sampler import Sampler
class PathSampler(Sampler):
def __init__(
self,
env,
policies,
buffers,
time_skips=(1,),
**kwargs
):
Sampl... | [
"numpy.prod",
"mineral.core.samplers.sampler.Sampler.__init__",
"mineral.nested_apply"
] | [((315, 347), 'mineral.core.samplers.sampler.Sampler.__init__', 'Sampler.__init__', (['self'], {}), '(self, **kwargs)\n', (331, 347), False, 'from mineral.core.samplers.sampler import Sampler\n'), ((1194, 1230), 'numpy.prod', 'np.prod', (['self.time_skips[:level + 1]'], {}), '(self.time_skips[:level + 1])\n', (1201, 12... |
# coding:utf8
'''
利用synset的embedding,基于SPWE进行义原推荐
输入:所有synset(名词)的embedding,训练集synset及其义原,测试集synset
输出:测试集义原,正确率
'''
import sys
import os
import numpy as np
from numpy import linalg
import time
import random
outputMode = eval(sys.argv[1])
def ReadSysnetSememe(fileName):
'''
读取已经标注好义原的sysnet... | [
"numpy.mean",
"random.shuffle",
"time.clock",
"numpy.dot",
"numpy.linalg.norm"
] | [((4069, 4081), 'time.clock', 'time.clock', ([], {}), '()\n', (4079, 4081), False, 'import time\n'), ((4260, 4286), 'random.shuffle', 'random.shuffle', (['synsetList'], {}), '(synsetList)\n', (4274, 4286), False, 'import random\n'), ((345, 357), 'time.clock', 'time.clock', ([], {}), '()\n', (355, 357), False, 'import t... |
from dipsim import multiframe, util
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import matplotlib.patches as patches
import os; import time; start = time.time(); print('Running...')
import matplotlib.gridspec as gridspec
# Main input parameters
col_labels = ['Geometry\n (NA = 0.6, $\\beta=80{}... | [
"numpy.array",
"numpy.sin",
"dipsim.util.draw_scene",
"matplotlib.gridspec.GridSpecFromSubplotSpec",
"matplotlib.colors.LogNorm",
"matplotlib.ticker.FuncFormatter",
"matplotlib.gridspec.GridSpec",
"numpy.linspace",
"dipsim.util.plot_sphere",
"numpy.vstack",
"matplotlib.cm.get_cmap",
"numpy.abs... | [((174, 185), 'time.time', 'time.time', ([], {}), '()\n', (183, 185), False, 'import time\n'), ((710, 760), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(2.2 * inch_fig, 3 * inch_fig)'}), '(figsize=(2.2 * inch_fig, 3 * inch_fig))\n', (720, 760), True, 'import matplotlib.pyplot as plt\n'), ((763, 835), 'm... |
import numpy as np
import matplotlib.pyplot as plt
import pickle
from scipy.stats import multivariate_normal
def draw_heatmap(mux, muy, sx, sy, rho, plt = None, bound = 0.1):
x, y = np.meshgrid(np.linspace(mux - bound, mux + bound, 200),
np.linspace(muy - bound, muy + bound, 200))
m... | [
"numpy.dstack",
"numpy.abs",
"scipy.stats.multivariate_normal",
"matplotlib.pyplot.plot",
"pickle.load",
"matplotlib.pyplot.pcolormesh",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((453, 492), 'scipy.stats.multivariate_normal', 'multivariate_normal', ([], {'mean': 'mean', 'cov': 'cov'}), '(mean=mean, cov=cov)\n', (472, 492), False, 'from scipy.stats import multivariate_normal\n'), ((505, 522), 'numpy.dstack', 'np.dstack', (['[x, y]'], {}), '([x, y])\n', (514, 522), True, 'import numpy as np\n')... |
from GPy.kern import Kern
from GPy.core.parameterization import Param
import numpy as np
import sys
from paramz.transformations import Logexp
from ..kernels.tree.C_tree_kernel import wrapper_raw_SubsetTreeKernel
class SubsetTreeKernel(Kern):
"""
The SST kernel by Moschitti(2006), with two hyperparameters (la... | [
"numpy.ones",
"paramz.transformations.Logexp",
"numpy.hstack",
"numpy.array",
"numpy.sum"
] | [((3309, 3535), 'numpy.array', 'np.array', (["[['(S (NP ns) (VP v))'], ['(S (NP n) (VP v))'], [\n '(S (NP (N a)) (VP (V c)))'], ['(S (NP (Det a) (N b)) (VP (V c)))'], [\n '(S (NP (ADJ colorless) (N ideas)) (VP (V sleep) (ADV furiously)))']]"], {'dtype': 'object'}), "([['(S (NP ns) (VP v))'], ['(S (NP n) (VP v))']... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile
from common import balance, file_name, view, correction
# Read the audio file
rate, audio = wavfile.read(file_name)
audio = balance(audio)
count = audio.shape[0] # Number of data points
length = count / rate # Length of the recording (... | [
"matplotlib.pyplot.savefig",
"common.balance",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.fft.fft",
"common.view.__len__",
"numpy.linspace",
"scipy.io.wavfile.read",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"numpy.amax",
"matplotlib.p... | [((174, 197), 'scipy.io.wavfile.read', 'wavfile.read', (['file_name'], {}), '(file_name)\n', (186, 197), False, 'from scipy.io import wavfile\n'), ((206, 220), 'common.balance', 'balance', (['audio'], {}), '(audio)\n', (213, 220), False, 'from common import balance, file_name, view, correction\n'), ((483, 510), 'numpy.... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..','..'))
import numpy as np
import pickle
import random
import json
from collections import OrderedDict
import itertools as it
from src.neuralNetwork.policyValueResNet import GenerateModel, Train, saveVariables, sampleData, Approximat... | [
"src.constrainedChasingEscapingEnv.envNoPhysics.TransiteForNoPhysics",
"src.neuralNetwork.policyValueResNet.restoreVariables",
"numpy.array",
"os.path.exists",
"src.neuralNetwork.policyValueResNet.ApproximatePolicy",
"exec.trajectoriesSaveLoad.GetSavePath",
"pygame.display.set_mode",
"itertools.produc... | [((2400, 2423), 'json.loads', 'json.loads', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (2410, 2423), False, 'import json\n'), ((3245, 3270), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (3260, 3270), False, 'import os\n'), ((3303, 3478), 'os.path.join', 'os.path.join', (['dirName', '""".."""... |
import matplotlib.pyplot as plt
import numpy as np
def tunediagram(order=range(1,4),integer=[0,0],lines=[1,1,1,1],colors='ordered',linestyle='-',fig=plt.gcf()):
'''
plot resonance diagram up to specified order
mx + ny = p
x = (p-ny)/m
x = 1 where y = (p-m)/n
EXAMPLE:
tunediagram(order=... | [
"numpy.abs",
"matplotlib.pyplot.vlines",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.hlines",
"numpy.array",
"numpy.linspace",
"numpy.sign",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim"
] | [((151, 160), 'matplotlib.pyplot.gcf', 'plt.gcf', ([], {}), '()\n', (158, 160), True, 'import matplotlib.pyplot as plt\n'), ((1533, 1563), 'numpy.linspace', 'np.linspace', (['(0)', 'pval', '(pval + 1)'], {}), '(0, pval, pval + 1)\n', (1544, 1563), True, 'import numpy as np\n'), ((1957, 1995), 'matplotlib.pyplot.xlim', ... |
# Loads the data and an autoencoder model. The original data is passed
# through the AE and the latent space is fed to the qsvm network.
import sys
import os
import numpy as np
sys.path.append("..")
from .terminal_colors import tcols
from autoencoders import data as aedata
from autoencoders import util as aeutil
cla... | [
"numpy.ceil",
"autoencoders.data.AE_data",
"numpy.arange",
"os.path.join",
"autoencoders.util.choose_ae_model",
"numpy.array_split",
"os.path.dirname",
"autoencoders.util.import_hyperparams",
"numpy.concatenate",
"sys.path.append",
"numpy.random.RandomState"
] | [((178, 199), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (193, 199), False, 'import sys\n'), ((1928, 1955), 'os.path.dirname', 'os.path.dirname', (['model_path'], {}), '(model_path)\n', (1943, 1955), False, 'import os\n'), ((1974, 2024), 'os.path.join', 'os.path.join', (['model_folder', '"""h... |
import numpy as np
import torch
from torch import nn
def identity(x):
return x
def fanin_init(tensor):
size = tensor.size()
if len(size) == 2:
fan_in = size[0]
elif len(size) > 2:
fan_in = np.prod(size[1:])
else:
raise Exception("Tensor shape must have dimensions >= 2")
... | [
"numpy.prod",
"numpy.sqrt",
"torch.reciprocal",
"torch.sum",
"torch.normal",
"torch.zeros",
"torch.clamp",
"torch.ones"
] | [((530, 568), 'torch.clamp', 'torch.clamp', (['sigmas_squared'], {'min': '(1e-07)'}), '(sigmas_squared, min=1e-07)\n', (541, 568), False, 'import torch\n'), ((336, 351), 'numpy.sqrt', 'np.sqrt', (['fan_in'], {}), '(fan_in)\n', (343, 351), True, 'import numpy as np\n'), ((669, 707), 'torch.sum', 'torch.sum', (['(mus / s... |
from dataclasses import dataclass
import netCDF4
import numpy as np
from openamundsen import constants, errors, fileio, util
import pandas as pd
import pandas.tseries.frequencies
import pyproj
import xarray as xr
_ALLOWED_OFFSETS = [
pd.tseries.offsets.YearEnd,
pd.tseries.offsets.YearBegin,
pd.tseries.off... | [
"openamundsen.errors.ConfigurationError",
"pyproj.crs.CRS",
"numpy.repeat",
"numpy.arange",
"pandas.Timedelta",
"netCDF4.Dataset",
"pandas.to_datetime",
"numpy.flatnonzero",
"xarray.Dataset",
"numpy.array",
"openamundsen.util.offset_to_timedelta",
"pandas.period_range",
"openamundsen.fileio.... | [((17670, 17706), 'openamundsen.util.offset_to_timedelta', 'util.offset_to_timedelta', (['model_freq'], {}), '(model_freq)\n', (17694, 17706), False, 'from openamundsen import constants, errors, fileio, util\n'), ((14361, 14392), 'xarray.Dataset', 'xr.Dataset', (['data'], {'coords': 'coords'}), '(data, coords=coords)\n... |
import sys
import numpy as np
import mc3
def quad(p, x):
"""
Quadratic polynomial function.
Parameters
p: Polynomial constant, linear, and quadratic coefficients.
x: Array of dependent variables where to evaluate the polynomial.
Returns
y: Polinomial evaluated at x: y(x) = p0... | [
"numpy.random.normal",
"numpy.abs",
"numpy.array",
"numpy.linspace",
"mc3.sample",
"numpy.random.seed"
] | [((593, 612), 'numpy.random.seed', 'np.random.seed', (['(314)'], {}), '(314)\n', (607, 612), True, 'import numpy as np\n'), ((618, 642), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(1000)'], {}), '(0, 10, 1000)\n', (629, 642), True, 'import numpy as np\n'), ((718, 745), 'numpy.random.normal', 'np.random.normal',... |
#!/usr/bin/python3
# Copyright 2018 <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... | [
"tflmlib.LMBasic.get_model_fn",
"tflmlib.InputData",
"tflmlib.TokenizerSimple",
"tensorflow.variable_scope",
"tflmlib.LMBasic.restore_session",
"os.path.join",
"numpy.argmax",
"tflmlib.LMBasic",
"numpy.array",
"tflmlib.Vocab",
"tflmlib.SNLPConnection",
"tflmlib.TokenizerSmartA",
"tflmlib.LMB... | [((1119, 1151), 'tflmlib.SNLPConnection', 'SNLPConnection', (['snlp_server.port'], {}), '(snlp_server.port)\n', (1133, 1151), False, 'from tflmlib import SNLPConnection\n'), ((1407, 1508), 'tflmlib.InputData', 'InputData', (['self.config.batch_size', 'self.config.seq_length'], {'history_size': 'self.config.history_size... |
# !usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under a 3-clause BSD license.
#
# @Author: <NAME>
# @Date: 2018-10-11 17:51:43
# @Last modified by: <NAME>
# @Last Modified time: 2018-11-29 17:23:15
from __future__ import print_function, division, absolute_import
import numpy as np
import astropy
import... | [
"numpy.log10",
"numpy.argmax",
"marvin.utils.general.general.get_drpall_table",
"marvin.utils.plot.scatter.plot",
"marvin.tools.quantities.spectrum.Spectrum",
"numpy.argmin"
] | [((1530, 1567), 'numpy.argmax', 'np.argmax', (["[par1['snr'], par2['snr']]"], {}), "([par1['snr'], par2['snr']])\n", (1539, 1567), True, 'import numpy as np\n'), ((1585, 1622), 'numpy.argmin', 'np.argmin', (["[par1['rms'], par2['rms']]"], {}), "([par1['rms'], par2['rms']])\n", (1594, 1622), True, 'import numpy as np\n'... |
"""
File: bsd_patches.py
Author: Nrupatunga
Email: <EMAIL>
Github: https://github.com/nrupatunga
Description: BSDS500 patches
"""
import time
from pathlib import Path
import h5py
import numpy as np
from tqdm import tqdm
mode = 'train'
mat_root_dir = f'/media/nthere/datasets/DIV_superres/patches/train/'
out_root_dir =... | [
"numpy.mean",
"pathlib.Path",
"numpy.asarray",
"h5py.File",
"numpy.std"
] | [((1031, 1048), 'numpy.asarray', 'np.asarray', (['means'], {}), '(means)\n', (1041, 1048), True, 'import numpy as np\n'), ((1060, 1076), 'numpy.asarray', 'np.asarray', (['stds'], {}), '(stds)\n', (1070, 1076), True, 'import numpy as np\n'), ((1088, 1105), 'numpy.mean', 'np.mean', (['means', '(1)'], {}), '(means, 1)\n',... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import os
from pymatgen import Composition
class TransformReadingPeriodicTable():
def __init__(self, formula=None, rel_cif_file_path='write cif file path', data_dir='../data'):
self.formula = formula
self.allowed... | [
"pymatgen.Composition.from_dict",
"numpy.sum",
"numpy.zeros",
"pymatgen.Composition",
"numpy.round"
] | [((1828, 1871), 'numpy.zeros', 'np.zeros', (['[4, 7, 18 + 14]'], {'dtype': 'np.float32'}), '([4, 7, 18 + 14], dtype=np.float32)\n', (1836, 1871), True, 'import numpy as np\n'), ((3981, 4016), 'numpy.sum', 'np.sum', (['periodic_table_form'], {'axis': '(0)'}), '(periodic_table_form, axis=0)\n', (3987, 4016), True, 'impor... |
import openmc
from scipy import interpolate
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib import ticker
import matplotx
import numpy as np
import scipy.ndimage as ndimage
def reshape_values_to_mesh_shape(tally, values):
mesh_filter = tally.find_filter(filter_type=openmc.Mes... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.sca",
"matplotx.ylabel_top",
"numpy.array",
"openmc.StatePoint",
"matplotlib.pyplot.style.context",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.scatter",
"scipy.ndimage.g... | [((2780, 2823), 'openmc.StatePoint', 'openmc.StatePoint', ([], {'filepath': 'statepoint_file'}), '(filepath=statepoint_file)\n', (2797, 2823), False, 'import openmc\n'), ((1908, 1930), 'numpy.array', 'np.array', (["data['mean']"], {}), "(data['mean'])\n", (1916, 1930), True, 'import numpy as np\n'), ((2302, 2353), 'sci... |
"""This module tests Exceptions functionality in stereomideval module"""
import pytest
import numpy as np
from stereomideval.dataset import Dataset
from stereomideval.exceptions import ImageSizeNotEqual, PathNotFound, InvalidSceneName
def test_catch_invalid_image_sizes():
"""Test catching invalid image sizes"""
... | [
"stereomideval.dataset.Dataset.get_training_scene_list",
"stereomideval.dataset.Dataset.get_scene_list",
"stereomideval.exceptions.ImageSizeNotEqual.validate",
"numpy.zeros",
"pytest.raises",
"stereomideval.exceptions.PathNotFound.validate"
] | [((333, 349), 'numpy.zeros', 'np.zeros', (['(5, 5)'], {}), '((5, 5))\n', (341, 349), True, 'import numpy as np\n'), ((364, 380), 'numpy.zeros', 'np.zeros', (['(5, 6)'], {}), '((5, 6))\n', (372, 380), True, 'import numpy as np\n'), ((390, 422), 'pytest.raises', 'pytest.raises', (['ImageSizeNotEqual'], {}), '(ImageSizeNo... |
# -*- coding: utf-8 -*-
from random import Random
#from core.dataloader import DataLoader
from torch.utils.data import DataLoader
import numpy as np
from math import *
import logging
from scipy import stats
import numpy as np
from pyemd import emd
from collections import OrderedDict
import time
import pickle, random
fr... | [
"numpy.identity",
"pyemd.emd",
"collections.OrderedDict",
"scipy.stats.entropy",
"random.Random",
"pickle.load",
"logging.info",
"numpy.sum",
"numpy.zeros",
"numpy.random.seed",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"time.time"
] | [((20762, 20773), 'time.time', 'time.time', ([], {}), '()\n', (20771, 20773), False, 'import time\n'), ((941, 949), 'random.Random', 'Random', ([], {}), '()\n', (947, 949), False, 'from random import Random\n'), ((1168, 1188), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1182, 1188), True, 'impor... |
import numpy as np
import glob
import geo
import time
import pdb
start_time = time.time()
dataDir='./data/'
# get CrIS files
cris_sdr_files = sorted(glob.glob(dataDir+'SCRIS*'))
cris_geo_files = sorted(glob.glob(dataDir+'GCRSO*'))
# get VIIRS files
viirs_sdr_files = sorted(glob.glob(dataDir+'SVM15*'))
viirs_geo_f... | [
"geo.read_viirs_sdr",
"matplotlib.pyplot.savefig",
"geo.read_cris_sdr",
"geo.match_cris_viirs",
"numpy.zeros_like",
"numpy.ndindex",
"numpy.append",
"matplotlib.cm.ScalarMappable",
"glob.glob",
"matplotlib.colors.Normalize",
"geo.RAE2ENU",
"matplotlib.pyplot.get_cmap",
"geo.ENU2ECEF",
"tim... | [((79, 90), 'time.time', 'time.time', ([], {}), '()\n', (88, 90), False, 'import time\n'), ((457, 492), 'geo.read_viirs_geo', 'geo.read_viirs_geo', (['viirs_geo_files'], {}), '(viirs_geo_files)\n', (475, 492), False, 'import geo\n'), ((528, 563), 'geo.read_viirs_sdr', 'geo.read_viirs_sdr', (['viirs_sdr_files'], {}), '(... |
"""
Contains the code necessary to extract a list of optimal compression values from a csv file containing
columns corresponding to {compression_type}_{level}, {variable}, {time}, and {DSSIM}
It would be best to open the csv file once, and get a list of all variables, levels, and timesteps
so I don't read the csv file... | [
"csv.DictWriter",
"numpy.unique",
"argparse.ArgumentParser",
"re.compile",
"os.path.isfile",
"numpy.argsort",
"lcr_global_vars.varlist",
"csv.reader",
"re.search"
] | [((8948, 8964), 'numpy.unique', 'np.unique', (['times'], {}), '(times)\n', (8957, 8964), True, 'import numpy as np\n'), ((10290, 10306), 'numpy.unique', 'np.unique', (['times'], {}), '(times)\n', (10299, 10306), True, 'import numpy as np\n'), ((13106, 13131), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {... |
# -*- coding: utf-8 -*-
"""
===============================================================================
Horsager et al. (2009): Predicting temporal sensitivity
===============================================================================
This example shows how to use the
:py:class:`~pulse2percept.models.Horsager... | [
"pulse2percept.stimuli.BiphasicPulseTrain",
"pulse2percept.stimuli.MonophasicPulse",
"numpy.ceil",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.semilogx",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"pulse2percept.models.Horsager2009Temporal",
"pulse2percept.stimuli.B... | [((862, 881), 'pulse2percept.datasets.load_horsager2009', 'load_horsager2009', ([], {}), '()\n', (879, 881), False, 'from pulse2percept.datasets import load_horsager2009\n'), ((1248, 1325), 'pulse2percept.datasets.load_horsager2009', 'load_horsager2009', ([], {'subjects': '"""S05"""', 'electrodes': '"""C3"""', 'stim_ty... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 11 21:22:59 2018
@author: pami4
"""
#CUDA_VISIBLE_DEVICES=0 python
from pycocotools.coco import COCO
import coco
import numpy as np
from matplotlib import pyplot as plt
import visualize
import custom_utils
config = coco.CocoConfig()
config.GPU_CO... | [
"CustomDataGenerator.CustomDatasetIterator_MaskRCNN",
"CustomDataset.CocoDataset",
"numpy.sum",
"numpy.array",
"model.MaskRCNN",
"coco.CocoConfig",
"matplotlib.pyplot.show"
] | [((289, 306), 'coco.CocoConfig', 'coco.CocoConfig', ([], {}), '()\n', (304, 306), False, 'import coco\n'), ((361, 388), 'CustomDataset.CocoDataset', 'CustomDataset.CocoDataset', ([], {}), '()\n', (386, 388), False, 'import CustomDataset\n'), ((668, 778), 'CustomDataGenerator.CustomDatasetIterator_MaskRCNN', 'CustomData... |
#!/usr/bin/env python
"""Create benchmark for k nearest neighbor on unit sphere in R^k."""
# Scroll down to line 90 to "Adjust this" to add your experiment
import random
import numpy as np
import os.path
import logging
import sys
import Queue as queue
import h5py
import time
logging.basicConfig(format='%(asctime)s %... | [
"logging.basicConfig",
"random.uniform",
"Queue.PriorityQueue",
"time.time",
"h5py.File",
"numpy.array",
"numpy.zeros",
"numpy.linalg.norm",
"logging.info"
] | [((279, 391), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)s %(message)s"""', 'level': 'logging.DEBUG', 'stream': 'sys.stdout'}), "(format='%(asctime)s %(levelname)s %(message)s', level=\n logging.DEBUG, stream=sys.stdout)\n", (298, 391), False, 'import logging\n'), ((407... |
from hqca.core import *
import numpy as np
from hqca.tools import *
class SingleQubitHamiltonian(Hamiltonian):
def __init__(self,sq=True,
**kw
):
self._order = 1
self._model = 'sq'
self._qubOp = ''
self.No_tot = 1
self.Ne_tot = 1
self.real = T... | [
"numpy.array",
"numpy.zeros",
"numpy.linalg.eigvalsh"
] | [((953, 988), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {'dtype': 'np.complex_'}), '((2, 2), dtype=np.complex_)\n', (961, 988), True, 'import numpy as np\n'), ((1300, 1315), 'numpy.array', 'np.array', (['[mat]'], {}), '([mat])\n', (1308, 1315), True, 'import numpy as np\n'), ((1252, 1275), 'numpy.linalg.eigvalsh', 'np.li... |
"""
Likelihood maximization script. This program is designed to be entirely separable from ATESA in that it can be called
manually to perform likelihood maximization to user specifications and with arbitrary input files; however, it is
required by ATESA's aimless shooting information error convergence criterion.
"""
i... | [
"scipy.stats.linregress",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"math.floor",
"numpy.array",
"argparse.Namespace",
"os.path.exists",
"numpy.histogram",
"numpy.mean",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"numpy.asarray",
"numpy.max",
"numpy.min",
"sys.stdout.flush",
... | [((2677, 2699), 'sys.stdout.write', 'sys.stdout.write', (['text'], {}), '(text)\n', (2693, 2699), False, 'import sys\n'), ((2704, 2722), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (2720, 2722), False, 'import sys\n'), ((26829, 26904), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descripti... |
import os
import shutil
import re
from collections import OrderedDict
import subprocess
import numpy as np
import atexit
class Result:
checkpoint = None
log = None
tarball = None
board = None
if __name__ == '__main__':
results = OrderedDict()
def load_files():
files = os.listdir()
... | [
"collections.OrderedDict",
"os.listdir",
"os.path.getsize",
"numpy.unique",
"subprocess.Popen",
"re.match",
"os.path.join",
"os.path.isdir",
"re.finditer",
"shutil.rmtree",
"os.path.islink",
"os.walk",
"os.remove"
] | [((251, 264), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (262, 264), False, 'from collections import OrderedDict\n'), ((304, 316), 'os.listdir', 'os.listdir', ([], {}), '()\n', (314, 316), False, 'import os\n'), ((1110, 1131), 'os.path.islink', 'os.path.islink', (['start'], {}), '(start)\n', (1124, 113... |
from sklearn import svm
from ..data_wrappers import reject
import numpy as np
from scipy.stats import multivariate_normal
from sklearn.mixture import GMM
from sklearn.neighbors import KernelDensity
class DensityEstimators(object):
def __init__(self):
self.models = {}
self.unknown = {}
self... | [
"numpy.sqrt",
"numpy.linalg.pinv",
"scipy.stats.multivariate_normal",
"numpy.array",
"numpy.cov",
"numpy.arange",
"numpy.rank",
"sklearn.neighbors.KernelDensity",
"numpy.subtract",
"numpy.dot",
"numpy.vstack",
"numpy.eye",
"numpy.random.multivariate_normal",
"numpy.alen",
"sklearn.svm.SV... | [((604, 629), 'sklearn.svm.SVC', 'svm.SVC', ([], {'probability': '(True)'}), '(probability=True)\n', (611, 629), False, 'from sklearn import svm\n'), ((709, 734), 'numpy.vstack', 'np.vstack', (['(X_kno, X_unk)'], {}), '((X_kno, X_unk))\n', (718, 734), True, 'import numpy as np\n'), ((1689, 1701), 'numpy.unique', 'np.un... |
"""
fakedata.py
====================================
Generate artificial pupil-data.
"""
import numpy as np
import scipy.stats as stats
from .baseline import *
from .pupil import *
def generate_pupil_data(event_onsets, fs=1000, pad=5000, baseline_lowpass=0.2,
evoked_response_perc=0.02, respon... | [
"numpy.mean",
"numpy.ceil",
"numpy.ones",
"numpy.random.rand",
"numpy.any",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.random.randn",
"numpy.concatenate",
"numpy.zeros_like",
"numpy.arange",
"scipy.stats.truncnorm.rvs"
] | [((3093, 3111), 'numpy.any', 'np.any', (['(npars <= 0)'], {}), '(npars <= 0)\n', (3099, 3111), True, 'import numpy as np\n'), ((3162, 3180), 'numpy.any', 'np.any', (['(tmaxs <= 0)'], {}), '(tmaxs <= 0)\n', (3168, 3180), True, 'import numpy as np\n'), ((3481, 3492), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (3489... |
"""
Default audio settings.
"""
import numpy as np
from modules.socket.settings import PACKAGE_SIZE
# Number of sound channels.
CHANNELS = 2
# The size of the streaming buffer, that needs to fit into the socket buffer.
CHUNK_SIZE = PACKAGE_SIZE // CHANNELS // np.dtype(np.int16).itemsize
# Sound device frame rate. ... | [
"numpy.dtype"
] | [((264, 282), 'numpy.dtype', 'np.dtype', (['np.int16'], {}), '(np.int16)\n', (272, 282), True, 'import numpy as np\n')] |
"""
Unit and regression test for the neuralxc package.
"""
import copy
import os
import sys
from abc import ABC, abstractmethod
import dill as pickle
import matplotlib.pyplot as plt
import numpy as np
import pytest
# Import package, test suite, and other packages as needed
import neuralxc as xc
from neuralxc.constan... | [
"numpy.allclose",
"neuralxc.utils.SiestaDensityGetter",
"neuralxc.formatter.SpeciesGrouper",
"os.path.join",
"neuralxc.formatter.Formatter",
"numpy.sum",
"numpy.array",
"neuralxc.ml.transformer.GroupedVarianceThreshold",
"pytest.mark.skipif",
"os.path.abspath",
"neuralxc.ml.transformer.GroupedSt... | [((3614, 3670), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not ase_found)'], {'reason': '"""requires ase"""'}), "(not ase_found, reason='requires ase')\n", (3632, 3670), False, 'import pytest\n'), ((658, 683), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (673, 683), False, 'import os\n... |
import numpy as np
from PIL import Image
nets = ["caffenet", "googlenet", "vggf", "vgg16", "vgg19"]
def load(nets):
res = []
for net in nets:
data_path = "perturbations/perturbation_%s.npy" % net
imgs = np.load(data_path, allow_pickle=True, encoding="latin1")
# print(imgs.shape)
... | [
"numpy.uint8",
"PIL.Image.new",
"numpy.transpose",
"numpy.load"
] | [((717, 784), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(n * width + interval * (n - 1), height)', '"""white"""'], {}), "('RGB', (n * width + interval * (n - 1), height), 'white')\n", (726, 784), False, 'from PIL import Image\n'), ((230, 286), 'numpy.load', 'np.load', (['data_path'], {'allow_pickle': '(True)', 'enc... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"numpy.tile",
"jax.numpy.cos",
"jax.numpy.sqrt",
"jax.numpy.asarray",
"numpy.array",
"jax.numpy.maximum",
"jax.numpy.minimum"
] | [((3342, 3377), 'jax.numpy.asarray', 'jnp.asarray', (['ret'], {'dtype': 'jnp.float32'}), '(ret, dtype=jnp.float32)\n', (3353, 3377), True, 'import jax.numpy as jnp\n'), ((3575, 3605), 'numpy.tile', 'np.tile', (['x[-1]', '(batch_pad, 1)'], {}), '(x[-1], (batch_pad, 1))\n', (3582, 3605), True, 'import numpy as np\n'), ((... |
import numpy as np
def sigmoid(t):
return 1 / (1 + np.exp(-t))
def sigmoid_derivative(p):
return p * (1 - p)
class NeuralNetwork:
#Do not change this function header
def __init__(self,x=[[]],y=[],numLayers=2,numNodes=2,eta=0.001,maxIter=10000):
self.data = np.append(x,np.ones([len(x),1]),1)
... | [
"numpy.random.rand",
"numpy.exp",
"numpy.array",
"numpy.append",
"numpy.outer",
"numpy.dot"
] | [((342, 353), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (350, 353), True, 'import numpy as np\n'), ((56, 66), 'numpy.exp', 'np.exp', (['(-t)'], {}), '(-t)\n', (62, 66), True, 'import numpy as np\n'), ((746, 780), 'numpy.random.rand', 'np.random.rand', (['(self.nNodes + 1)', '(1)'], {}), '(self.nNodes + 1, 1)\n',... |
import argparse
import os
import cv2
import numpy as np
import torch
from torch import nn
from deepface.backbones.iresnet import iresnet18, iresnet34, iresnet50, iresnet100, iresnet200
from deepface.backbones.mobilefacenet import get_mbf
from deepface.commons import functions
import gdown
url={
'ms1mv3_r50':'https:... | [
"deepface.backbones.iresnet.iresnet34",
"deepface.backbones.iresnet2060.iresnet2060",
"deepface.backbones.mobilefacenet.get_mbf",
"deepface.backbones.iresnet.iresnet18",
"torch.from_numpy",
"os.path.exists",
"argparse.ArgumentParser",
"deepface.backbones.iresnet.iresnet50",
"os.mkdir",
"gdown.down... | [((3328, 3343), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3341, 3343), False, 'import torch\n'), ((3678, 3693), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3691, 3693), False, 'import torch\n'), ((4617, 4646), 'deepface.commons.functions.get_deepface_home', 'functions.get_deepface_home', ([], {}), '... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~----->>>
# _ _
# .__(.)< ?? >(.)__.
# \___) (___/
# @Time : 2022/3/20 下午10:06
# @Author : wds -->> <EMAIL>
# @File : util.py
# ~~~~~~~~~~~~~~~~~~~~~~... | [
"sklearn.cluster.KMeans",
"numpy.mean",
"numpy.unique",
"numpy.min",
"numpy.max",
"numpy.argsort",
"numpy.dot",
"numpy.std",
"torch.where"
] | [((1697, 1713), 'numpy.argsort', 'np.argsort', (['(-phi)'], {}), '(-phi)\n', (1707, 1713), True, 'import numpy as np\n'), ((2065, 2101), 'numpy.mean', 'np.mean', (['data'], {'axis': '(1)', 'keepdims': '(True)'}), '(data, axis=1, keepdims=True)\n', (2072, 2101), True, 'import numpy as np\n'), ((2114, 2149), 'numpy.std',... |
"""
https://www.kaggle.com/weicongkong/feedback-prize-huggingface-baseline-training/edit
Copyright (C) <NAME>, 23/02/2022
"""
# %% [markdown]
# # HuggingFace Training Baseline
#
# I wanted to create my own baseline for this competition, and I tried to do so "without peeking" at the kernels published by others. Ideall... | [
"wandb.login",
"datasets.Dataset.from_pandas",
"datasets.load_metric",
"transformers.TrainingArguments",
"pandas.DataFrame",
"pandas.merge",
"os.path.join",
"numpy.argmax",
"wandb.init",
"spacy.displacy.render",
"transformers.AutoModelForTokenClassification.from_pretrained",
"wandb.finish",
... | [((1613, 1637), 'wandb.login', 'wandb.login', ([], {'key': '"""<KEY>"""'}), "(key='<KEY>')\n", (1624, 1637), False, 'import wandb\n'), ((1638, 1695), 'wandb.init', 'wandb.init', ([], {'project': '"""feedback_prize"""', 'entity': '"""wilsonkong"""'}), "(project='feedback_prize', entity='wilsonkong')\n", (1648, 1695), Fa... |
import unittest
import numpy as np
from bert2tf import Executor, ElectraDiscriminator, BertTokenizer
from tests import Bert2TFTestCase
class MyTestCase(Bert2TFTestCase):
@unittest.skip('just run on local machine')
def test_create_electra_model(self):
model = Executor.load_config('ElectraDiscriminato... | [
"bert2tf.BertTokenizer",
"bert2tf.Executor.load_config",
"numpy.array",
"bert2tf.ElectraDiscriminator",
"unittest.skip"
] | [((179, 221), 'unittest.skip', 'unittest.skip', (['"""just run on local machine"""'], {}), "('just run on local machine')\n", (192, 221), False, 'import unittest\n'), ((1059, 1101), 'unittest.skip', 'unittest.skip', (['"""just run on local machine"""'], {}), "('just run on local machine')\n", (1072, 1101), False, 'impo... |
import numpy as np
import unittest
from deepblast.dataset.alphabet import UniprotTokenizer
import numpy.testing as npt
class TestAlphabet(unittest.TestCase):
def test_tokenizer(self):
tokenizer = UniprotTokenizer(pad_ends=True)
res = tokenizer(b'ARNDCQEGHILKMFPSTWYVXOUBZ')
# Need to accou... | [
"unittest.main",
"numpy.array",
"deepblast.dataset.alphabet.UniprotTokenizer",
"numpy.testing.assert_allclose"
] | [((1260, 1275), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1273, 1275), False, 'import unittest\n'), ((211, 242), 'deepblast.dataset.alphabet.UniprotTokenizer', 'UniprotTokenizer', ([], {'pad_ends': '(True)'}), '(pad_ends=True)\n', (227, 242), False, 'from deepblast.dataset.alphabet import UniprotTokenizer\n'... |
"""Tests for drg module"""
import sys
import os
import pkg_resources
import pytest
import numpy as np
import networkx as nx
import cantera as ct
from ..sampling import data_files, InputIgnition
from ..drg import graph_search, create_drg_matrix, run_drg, trim_drg, reduce_drg
# Taken from http://stackoverflow.com/a/2... | [
"tempfile.TemporaryDirectory",
"numpy.allclose",
"numpy.isclose",
"cantera.ConstantCp",
"networkx.DiGraph",
"os.path.join",
"pkg_resources.resource_filename",
"numpy.array",
"tempfile.mkdtemp",
"shutil.rmtree",
"cantera.Reaction.fromCti",
"cantera.Solution",
"cantera.Species"
] | [((971, 989), 'os.path.join', 'os.path.join', (['file'], {}), '(file)\n', (983, 989), False, 'import os\n'), ((1001, 1053), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['__name__', 'file_path'], {}), '(__name__, file_path)\n', (1032, 1053), False, 'import pkg_resources\n'), ((1798, 1856), 'ca... |
import os
from argparse import SUPPRESS
import numpy as np
from pysam import Samfile, Fastafile
from scipy.stats import scoreatpercentile
# Internal
from rgt.Util import GenomeData, HmmData, ErrorHandler
from rgt.GenomicRegionSet import GenomicRegionSet
from rgt.HINT.biasTable import BiasTable
from rgt.HINT.signalProc... | [
"rgt.Util.GenomeData",
"scipy.stats.scoreatpercentile",
"rgt.Util.ErrorHandler",
"rgt.HINT.signalProcessing.GenomicSignal",
"os.getcwd",
"rgt.HINT.biasTable.BiasTable",
"numpy.std",
"pysam.Samfile",
"rgt.Util.HmmData",
"rgt.GenomicRegionSet.GenomicRegionSet",
"numpy.nan_to_num",
"os.remove"
] | [((3332, 3346), 'rgt.Util.ErrorHandler', 'ErrorHandler', ([], {}), '()\n', (3344, 3346), False, 'from rgt.Util import GenomeData, HmmData, ErrorHandler\n'), ((3576, 3610), 'pysam.Samfile', 'Samfile', (['args.input_files[0]', '"""rb"""'], {}), "(args.input_files[0], 'rb')\n", (3583, 3610), False, 'from pysam import Samf... |
import numpy as np
from scipy import signal
from .. import MaskSeparationBase
from ...core import utils
from ...core import constants
class Duet(MaskSeparationBase):
"""
The DUET algorithm was originally proposed by S.Rickard and F.Dietrich for DOA
estimation and further developed for BSS and demixing b... | [
"numpy.abs",
"numpy.mat",
"scipy.signal.convolve2d",
"numpy.ones_like",
"numpy.ones",
"numpy.logical_and",
"numpy.sqrt",
"numpy.logical_not",
"numpy.floor",
"numpy.column_stack",
"numpy.logical_xor",
"numpy.log",
"numpy.exp",
"numpy.array",
"numpy.nonzero",
"numpy.histogram2d",
"nump... | [((9712, 9739), 'numpy.abs', 'np.abs', (['inter_channel_ratio'], {}), '(inter_channel_ratio)\n', (9718, 9739), True, 'import numpy as np\n'), ((11221, 11326), 'numpy.logical_and', 'np.logical_and', (['(self.attenuation_min < self.symmetric_atn)', '(self.symmetric_atn < self.attenuation_max)'], {}), '(self.attenuation_m... |
"""
Authors: <<NAME>, <NAME>>
Copyright: (C) 2019-2020 <http://www.dei.unipd.it/
Department of Information Engineering> (DEI), <http://www.unipd.it/ University of Padua>, Italy
License: <http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0>
"""
import os
import math
import s... | [
"numpy.mean",
"numpy.median",
"pickle.dump",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.random.choice",
"functools.reduce",
"numpy.std",
"pickle.load",
"numpy.max",
"os.path.isfile",
"numpy.array",
"numpy.random.randint",
"numpy.argsort",
"numpy.random.seed",
"numpy.min",
"xm... | [((834, 854), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (848, 854), True, 'import numpy as np\n'), ((11079, 11126), 'numpy.random.choice', 'np.random.choice', (['allowed_docs'], {'size': 'batch_size'}), '(allowed_docs, size=batch_size)\n', (11095, 11126), True, 'import numpy as np\n'), ((11860,... |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | [
"paddle.nn.Dropout",
"paddle.nn.functional.softmax_with_cross_entropy",
"paddle.nn.LSTM",
"paddle.mean",
"numpy.zeros",
"paddle.to_tensor",
"paddle.nn.Linear",
"paddle.reshape",
"paddle.nn.functional.softmax",
"paddle.nn.initializer.Uniform"
] | [((1628, 1704), 'paddle.nn.LSTM', 'LSTM', ([], {'input_size': 'hidden_size', 'hidden_size': 'hidden_size', 'num_layers': 'num_layers'}), '(input_size=hidden_size, hidden_size=hidden_size, num_layers=num_layers)\n', (1632, 1704), False, 'from paddle.nn import LSTM, Embedding, Dropout, Linear\n'), ((2294, 2397), 'paddle.... |
def corpus_file_transform(src_file,dst_file):
import os
assert os.path.isfile(src_file),'Src File Not Exists.'
with open(src_file,'r',encoding = 'utf-8') as text_corpus_src:
with open(dst_file,'w',encoding = 'utf-8') as text_corpus_dst:
from tqdm.notebook import tqdm
text_co... | [
"pickle.dump",
"pickle.load",
"os.path.isfile",
"numpy.array",
"numpy.isnan"
] | [((71, 95), 'os.path.isfile', 'os.path.isfile', (['src_file'], {}), '(src_file)\n', (85, 95), False, 'import os\n'), ((1002, 1016), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1013, 1016), False, 'import pickle\n'), ((1064, 1087), 'pickle.dump', 'pickle.dump', (['feature', 'f'], {}), '(feature, f)\n', (1075, 1... |
import board3d as go_board
import numpy as np
import global_vars_go as gvg
def games_to_states(game_data):
train_boards = []
train_next_moves = []
for game_index in range(len(game_data)):
board = go_board.setup_board(game_data[game_index])
for node in game_data[game_index].get_main... | [
"numpy.copy",
"board3d.make_move",
"numpy.zeros",
"board3d.setup_board",
"board3d.switch_player_perspec"
] | [((1261, 1323), 'numpy.zeros', 'np.zeros', (['(gvg.board_size, gvg.board_size, gvg.board_channels)'], {}), '((gvg.board_size, gvg.board_size, gvg.board_channels))\n', (1269, 1323), True, 'import numpy as np\n'), ((225, 268), 'board3d.setup_board', 'go_board.setup_board', (['game_data[game_index]'], {}), '(game_data[gam... |
import numpy as np
def white_noise(im, scale):
im = im + np.random.normal(0.0, scale, im.shape)
im = np.maximum(im, 0.0)
im = np.minimum(im, 1.0)
return im
def salt_and_pepper(im, prob):
if prob > 1 or prob < 0:
raise ValueError("Prob must be within 0 to 1")
if im.ndim == 2:
... | [
"numpy.random.normal",
"numpy.random.rand",
"numpy.minimum",
"numpy.squeeze",
"numpy.maximum"
] | [((111, 130), 'numpy.maximum', 'np.maximum', (['im', '(0.0)'], {}), '(im, 0.0)\n', (121, 130), True, 'import numpy as np\n'), ((140, 159), 'numpy.minimum', 'np.minimum', (['im', '(1.0)'], {}), '(im, 1.0)\n', (150, 159), True, 'import numpy as np\n'), ((381, 401), 'numpy.random.rand', 'np.random.rand', (['h', 'w'], {}),... |
"""
@Time : 203/21/19 17:11
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : crop_image.py
@Function:
"""
import os
import numpy as np
import skimage.io
input_path = '/media/iccd/TAYLORMEI/depth/image'
output_path = '/media/iccd/TAYLORMEI/depth/crop'
if not os.path.exists(output_path):
... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"numpy.sum",
"os.mkdir"
] | [((356, 378), 'os.listdir', 'os.listdir', (['input_path'], {}), '(input_path)\n', (366, 378), False, 'import os\n'), ((290, 317), 'os.path.exists', 'os.path.exists', (['output_path'], {}), '(output_path)\n', (304, 317), False, 'import os\n'), ((323, 344), 'os.mkdir', 'os.mkdir', (['output_path'], {}), '(output_path)\n'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.