code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
import gzip
from Bio import SeqIO
from pathlib import Path
import os
import subprocess
import tarfile
from io import BytesIO
#for parallel computing
from joblib import Parallel, delayed
import multiprocessing
num_cores_energy = multiprocessing.cpu_count()
from tqdm import tqdm
import pandas as pd
imp... | [
"tarfile.open",
"subprocess.run",
"os.path.join",
"io.BytesIO",
"multiprocessing.cpu_count",
"numpy.log",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"joblib.Parallel",
"Bio.SeqIO.parse",
"pandas.DataFrame",
"joblib.delayed",
"numpy.load",
"numpy.round"
] | [((247, 274), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (272, 274), False, 'import multiprocessing\n'), ((748, 780), 'tarfile.open', 'tarfile.open', (['path_h_DCA', '"""r:gz"""'], {}), "(path_h_DCA, 'r:gz')\n", (760, 780), False, 'import tarfile\n'), ((998, 1030), 'tarfile.open', 'tarf... |
import os
import random
import argparse
import time
from datetime import datetime
from tqdm import tqdm
import paddle
paddle.disable_static()
import paddle.nn.functional as F
import paddle.optimizer as optim
from pgl.utils.data import Dataloader
import numpy as np
from models import DeepFRI
from data_preprocessing i... | [
"custom_metrics.do_compute_metrics",
"paddle.no_grad",
"argparse.ArgumentParser",
"paddle.nn.functional.sigmoid",
"tqdm.tqdm",
"utils.add_saved_args_and_params",
"datetime.datetime.now",
"paddle.disable_static",
"data_preprocessing.MyDataset",
"numpy.concatenate",
"paddle.load",
"models.DeepFR... | [((120, 143), 'paddle.disable_static', 'paddle.disable_static', ([], {}), '()\n', (141, 143), False, 'import paddle\n'), ((623, 656), 'tqdm.tqdm', 'tqdm', (['data_loader'], {'desc': 'f"""{desc}"""'}), "(data_loader, desc=f'{desc}')\n", (627, 656), False, 'from tqdm import tqdm\n'), ((827, 854), 'numpy.concatenate', 'np... |
"""
Kravatte Achouffe Cipher Suite: Encryption, Decryption, and Authentication Tools based on the Farfalle modes
Copyright 2018 <NAME>
see LICENSE file
"""
from multiprocessing import Pool
from math import floor, ceil, log2
from typing import Tuple
from os import cpu_count
from ctypes import memset
import numpy as np
... | [
"numpy.copy",
"math.ceil",
"hashlib.md5",
"numpy.bitwise_xor.reduce",
"math.floor",
"math.log2",
"time.perf_counter",
"numpy.array",
"numpy.zeros",
"numpy.uint64",
"multiprocessing.Pool",
"os.cpu_count",
"numpy.frombuffer",
"ctypes.memset"
] | [((870, 1005), 'numpy.array', 'np.array', (['[32778, 9223372039002259466, 9223372039002292353, 9223372036854808704, \n 2147483649, 9223372039002292232]'], {'dtype': 'np.uint64'}), '([32778, 9223372039002259466, 9223372039002292353, \n 9223372036854808704, 2147483649, 9223372039002292232], dtype=np.uint64)\n', (87... |
import numpy as np
import gym
poleThetaSpace = np.linspace(-0.209, 0.209, 10)
poleThetaVelSpace = np.linspace(-4, 4, 10)
cartPosSpace = np.linspace(-2.4, 2.4, 10)
cartVelSpace = np.linspace(-4, 4, 10)
def get_state(observation):
cartX, cartXdot, cartTheta, cartThetaDot = observation
cartX = int(np.digitize(ca... | [
"numpy.mean",
"numpy.digitize",
"numpy.random.random",
"numpy.argmax",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"gym.make"
] | [((48, 78), 'numpy.linspace', 'np.linspace', (['(-0.209)', '(0.209)', '(10)'], {}), '(-0.209, 0.209, 10)\n', (59, 78), True, 'import numpy as np\n'), ((99, 121), 'numpy.linspace', 'np.linspace', (['(-4)', '(4)', '(10)'], {}), '(-4, 4, 10)\n', (110, 121), True, 'import numpy as np\n'), ((137, 163), 'numpy.linspace', 'np... |
from __future__ import division
import copy
from functools import reduce
import numpy
import six
from mpilot import params
from mpilot.commands import Command
from mpilot.libraries.eems.exceptions import (
MismatchedWeights,
MixedArrayLengths,
DuplicateRawValues,
)
from mpilot.libraries.eems.mixins impor... | [
"numpy.copy",
"mpilot.params.ResultParameter",
"numpy.ma.std",
"numpy.ma.mean",
"mpilot.utils.insure_fuzzy",
"numpy.full",
"mpilot.params.PathParameter",
"mpilot.params.NumberParameter",
"numpy.ma.minimum",
"numpy.ma.maximum",
"numpy.logical_and",
"mpilot.params.DataParameter",
"numpy.ma.emp... | [((565, 587), 'mpilot.params.DataParameter', 'params.DataParameter', ([], {}), '()\n', (585, 587), False, 'from mpilot import params\n'), ((970, 992), 'mpilot.params.DataParameter', 'params.DataParameter', ([], {}), '()\n', (990, 992), False, 'from mpilot import params\n'), ((1439, 1461), 'mpilot.params.DataParameter',... |
from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
from magenta.models.nsynth.wavenet import fastgen
import sys
# Change path back to /src to load other modules
sys.path.insert(0, '/home/ubuntu/DeepBass/src')
from ingestion.IO_utils import Load, Save
from preproce... | [
"magenta.models.nsynth.wavenet.fastgen.encode",
"sys.path.insert",
"streamlit.pyplot",
"os.listdir",
"os.path.join",
"preprocess.SilenceRemoval.SR",
"numpy.linspace",
"ingestion.IO_utils.Load",
"magenta.models.nsynth.wavenet.fastgen.synthesize",
"ingestion.IO_utils.Save",
"time.time",
"matplot... | [((217, 264), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/ubuntu/DeepBass/src"""'], {}), "(0, '/home/ubuntu/DeepBass/src')\n", (232, 264), False, 'import sys\n'), ((2443, 2482), 'ingestion.IO_utils.Load', 'Load', (['AUDIO_DIR', 'FirstSong_fname'], {'sr': 'sr'}), '(AUDIO_DIR, FirstSong_fname, sr=sr)\n', (24... |
"""
Adapted from https://github.com/hovinh/DeCNN
"""
import numpy as np
from keras import backend as K
class Backpropagation():
def __init__(self, model, layer_name, input_data, layer_idx=None, masking=None):
"""
@params:
- model: a Keras Model.
- layer_name: name of layer... | [
"numpy.abs",
"numpy.mean",
"keras.backend.cast",
"numpy.ones",
"numpy.random.random",
"keras.backend.mean",
"keras.backend.gradients",
"numpy.zeros",
"keras.backend.function",
"numpy.amax"
] | [((1485, 1525), 'keras.backend.mean', 'K.mean', (['(self.layer.output * self.masking)'], {}), '(self.layer.output * self.masking)\n', (1491, 1525), True, 'from keras import backend as K\n'), ((1600, 1643), 'keras.backend.function', 'K.function', (['[self.model.input]', '[gradients]'], {}), '([self.model.input], [gradie... |
import torch
import numpy as np
from rlbot.agents.base_agent import SimpleControllerState, BaseAgent
class OutputFormatter():
"""
A class to format model output
"""
def transform_action(self, action):
"""
Transforms the action into a controller state.
"""
action = acti... | [
"rlbot.agents.base_agent.BaseAgent.convert_output_to_v4",
"numpy.concatenate"
] | [((428, 481), 'numpy.concatenate', 'np.concatenate', (['(action[:5], action[5:] >= 0)'], {'axis': '(0)'}), '((action[:5], action[5:] >= 0), axis=0)\n', (442, 481), True, 'import numpy as np\n'), ((512, 556), 'rlbot.agents.base_agent.BaseAgent.convert_output_to_v4', 'BaseAgent.convert_output_to_v4', (['self', 'action'],... |
import numpy as np
from sklearn import svm
from data_loader import data_loader
N = 100
NUM_CLASS = 4
data_dir = "C:\\Users\\wsy\\Documents\\Audio\\*.m4a"
data_X, data_Y = data_loader(data_dir)
print(len(data_X))
clf_list = []
for idx in range(NUM_CLASS):
for i, X in enumerate(data_X):
if ... | [
"data_loader.data_loader",
"numpy.zeros",
"sklearn.svm.LinearSVC"
] | [((181, 202), 'data_loader.data_loader', 'data_loader', (['data_dir'], {}), '(data_dir)\n', (192, 202), False, 'from data_loader import data_loader\n'), ((681, 700), 'numpy.zeros', 'np.zeros', (['NUM_CLASS'], {}), '(NUM_CLASS)\n', (689, 700), True, 'import numpy as np\n'), ((397, 412), 'sklearn.svm.LinearSVC', 'svm.Lin... |
import numpy as np
#create array of weekly vaccination numbers from https://opendata-geohive.hub.arcgis.com/datasets/0101ed10351e42968535bb002f94c8c6_0.csv?outSR=%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D
a= np.array([3946,
43856,
52659,
49703,
51381,
56267,
32176,
86434,
88578,
88294,
91298,
64535,
133195,
... | [
"numpy.array",
"numpy.min"
] | [((219, 633), 'numpy.array', 'np.array', (['[3946, 43856, 52659, 49703, 51381, 56267, 32176, 86434, 88578, 88294, 91298,\n 64535, 133195, 139946, 131038, 155716, 188626, 211497, 245947, 323166, \n 331292, 305479, 277195, 290362, 357077, 370059, 370544, 390891, 373319,\n 336086, 300378, 232066, 232234, 229694, ... |
import numpy as np
import pandas as pd
data = pd.DataFrame(data=pd.read_csv('enjoysport.csv'))
concepts = np.array(data.iloc[:,0:-1])
print('Concepts:', concepts)
target = np.array(data.iloc[:,-1])
print('Target:', target)
def learn(concepts, target):
print("Initialization of specific_h and general_... | [
"numpy.array",
"pandas.read_csv"
] | [((111, 139), 'numpy.array', 'np.array', (['data.iloc[:, 0:-1]'], {}), '(data.iloc[:, 0:-1])\n', (119, 139), True, 'import numpy as np\n'), ((180, 206), 'numpy.array', 'np.array', (['data.iloc[:, -1]'], {}), '(data.iloc[:, -1])\n', (188, 206), True, 'import numpy as np\n'), ((67, 96), 'pandas.read_csv', 'pd.read_csv', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#######################################
#-------------------------------------#
# Module: Frontera Eficiente #
#-------------------------------------#
# Creado: #
# 20. 04. 2019 #
# Ult. modificacion: ... | [
"matplotlib.pylab.xticks",
"matplotlib.pylab.subplots",
"numpy.sqrt",
"pandas.read_csv",
"numpy.array",
"matplotlib.pylab.show",
"pandas.ewma",
"numpy.mean",
"seaborn.set",
"numpy.random.random",
"matplotlib.pylab.legend",
"matplotlib.pylab.title",
"pandas.DataFrame.from_dict",
"numpy.lins... | [((695, 718), 'seaborn.set', 'sns.set', ([], {'font_scale': '(1.5)'}), '(font_scale=1.5)\n', (702, 718), True, 'import seaborn as sns\n'), ((968, 1030), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (989, 1... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import norm as lpnorm
if __name__ == "__main__":
N = 1000 # Precision
p = 0.5 # p-norm
# Discretize unit-circle
angles = np.linspace(0, 2*np.pi, N)
# Create unit-circle points
points = np.stack((np.cos(angles), np.sin(... | [
"matplotlib.pyplot.gca",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.cos",
"scipy.linalg.norm",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((215, 243), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', 'N'], {}), '(0, 2 * np.pi, N)\n', (226, 243), True, 'import numpy as np\n'), ((460, 511), 'matplotlib.pyplot.plot', 'plt.plot', (['points[:, 0]', 'points[:, 1]'], {'linestyle': '"""-"""'}), "(points[:, 0], points[:, 1], linestyle='-')\n", (468, 511)... |
import numpy as np
from .. import T
from ..layer import ShapedLayer
from ..initialization import initialize_weights
from .full import Linear
from .. import stats
__all__ = ['Gaussian', 'Bernoulli', 'IdentityVariance']
class Gaussian(Linear):
def __init__(self, *args, **kwargs):
self.cov_type = kwargs.p... | [
"numpy.zeros",
"numpy.sqrt"
] | [((1005, 1024), 'numpy.zeros', 'np.zeros', (['[dim_out]'], {}), '([dim_out])\n', (1013, 1024), True, 'import numpy as np\n'), ((2690, 2712), 'numpy.sqrt', 'np.sqrt', (['self.variance'], {}), '(self.variance)\n', (2697, 2712), True, 'import numpy as np\n')] |
import numpy as np
#DEFINE INNER FUNCTIONS
def inv_log_func(x, a, b):
return ((a * starting_score) / (2 + np.log(b * x)))
def bump_func(x,e):
return (e * np.sin(x - np.pi / 2)) + e
def sin_vals(ampl,steps):
if (steps < 1): steps = 1
sin_step = (np.pi * 2.0) / steps
x_range = np.arange(0,np.pi * 2... | [
"numpy.log",
"numpy.asarray",
"numpy.random.seed",
"numpy.savetxt",
"numpy.random.uniform",
"numpy.sin",
"numpy.arange"
] | [((2457, 2496), 'numpy.arange', 'np.arange', (['range_start', 'range_end', 'step'], {}), '(range_start, range_end, step)\n', (2466, 2496), True, 'import numpy as np\n'), ((2511, 2536), 'numpy.random.seed', 'np.random.seed', (['rand_seed'], {}), '(rand_seed)\n', (2525, 2536), True, 'import numpy as np\n'), ((2709, 2730)... |
#################################################################################################
# #
# MULTI-ARMED BANDITS ---- 10-ARM TESTBED SOFTMAX METHOD #
# #
# Author: <NAME> #
# #
# References: ... | [
"numpy.random.normal",
"numpy.mean",
"numpy.ones",
"numpy.argmax",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"matplotlib.pyplot.figure",
"time.time",
"matplotlib.pyplot.show"
] | [((843, 854), 'time.time', 'time.time', ([], {}), '()\n', (852, 854), False, 'import time\n'), ((1058, 1088), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(n, k)'], {}), '(0, 1, (n, k))\n', (1074, 1088), True, 'import numpy as np\n'), ((1135, 1152), 'numpy.argmax', 'np.argmax', (['q_t', '(1)'], {}), '(q_... |
import os
import sys
import tempfile
import subprocess
import cv2
import pymesh
import numpy as np
import torch
import triangle as tr
from tridepth import BaseMesh
from tridepth.extractor import calculate_canny_edges
from tridepth.extractor import SVGReader
from tridepth.extractor import resolve_self_intersection, cle... | [
"pymesh.wires.WireNetwork.create_empty",
"pymesh.wires.WireNetwork.create_from_data",
"triangle.triangulate",
"tridepth.BaseMesh",
"sys.exit",
"subprocess.Popen",
"tridepth.extractor.calculate_canny_edges",
"matplotlib.pyplot.plot",
"os.unlink",
"numpy.concatenate",
"tempfile.NamedTemporaryFile"... | [((1252, 1325), 'subprocess.Popen', 'subprocess.Popen', (['(self.autotrace_cmd + [filename])'], {'stdout': 'subprocess.PIPE'}), '(self.autotrace_cmd + [filename], stdout=subprocess.PIPE)\n', (1268, 1325), False, 'import subprocess\n'), ((2094, 2115), 'tridepth.extractor.SVGReader', 'SVGReader', (['svg_string'], {}), '(... |
"""
## Minería de textos
Universidad de Alicante, curso 2021-2022
Esta documentación forma parte de la práctica "[Lectura y documentación de un sistema de
extracción de entidades](https://jaspock.github.io/mtextos2122/bloque2_practica.html)" y se
basa en el código del curso [CS230](https://github.com/cs230-stanford/c... | [
"torch.nn.LSTM",
"numpy.argmax",
"numpy.sum",
"torch.sum",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.nn.Embedding"
] | [((6365, 6391), 'numpy.argmax', 'np.argmax', (['outputs'], {'axis': '(1)'}), '(outputs, axis=1)\n', (6374, 6391), True, 'import numpy as np\n'), ((1609, 1662), 'torch.nn.Embedding', 'nn.Embedding', (['params.vocab_size', 'params.embedding_dim'], {}), '(params.vocab_size, params.embedding_dim)\n', (1621, 1662), True, 'i... |
import olll
import numpy as np
test1 = [[1,0,0,1,1,0,1],[0,1,0,5,0,0,0],[0,0,1,0,5,0,5]]
test2 = [[1,0,0,2,-1,1],[0,1,0,3,-4,-2],[0,0,1,5,-10,-8]]
test3 = [[1,0,0,1,1,0,1], [0,1,0,4,-1,0,-1], [0,0,1,1,1,0,1]]
test4 = [[1,0,0,2,5,3],[0,1,0,1,1,1,],[0,0,1,4,-2,0]]
test5 = [[1,0,0,0,0,0,2,1,1,2],[0,1,0,0,0,0,1,1,-1,-1],[... | [
"numpy.identity",
"olll.reduction"
] | [((787, 801), 'numpy.identity', 'np.identity', (['k'], {}), '(k)\n', (798, 801), True, 'import numpy as np\n'), ((1169, 1196), 'olll.reduction', 'olll.reduction', (['test7', '(0.75)'], {}), '(test7, 0.75)\n', (1183, 1196), False, 'import olll\n')] |
import numpy as np
import matplotlib.pyplot as plt
import ipywidgets
from mesostat.utils.opencv_helper import cvWriter
from mesostat.utils.arrays import numpy_merge_dimensions
from sklearn.decomposition import PCA
def distance_matrix(data):
nDim, nTime = data.shape
dataExtr = np.repeat(data[..., None], nTime... | [
"numpy.repeat",
"sklearn.decomposition.PCA",
"numpy.linalg.norm",
"numpy.zeros",
"mesostat.utils.opencv_helper.cvWriter",
"ipywidgets.interact",
"numpy.std",
"numpy.percentile",
"mesostat.utils.arrays.numpy_merge_dimensions",
"matplotlib.pyplot.subplots"
] | [((288, 329), 'numpy.repeat', 'np.repeat', (['data[..., None]', 'nTime'], {'axis': '(2)'}), '(data[..., None], nTime, axis=2)\n', (297, 329), True, 'import numpy as np\n'), ((392, 421), 'numpy.linalg.norm', 'np.linalg.norm', (['delta'], {'axis': '(0)'}), '(delta, axis=0)\n', (406, 421), True, 'import numpy as np\n'), (... |
import sys
import os
import numpy as np
import scipy.io as sio
import random
from decimal import Decimal
import argparse
import csv
from keras.models import load_model
import f_model
from f_preprocess import fill_length
# Usage: python rematch_challenge.py test_file_path
def arg_parse():
"""
Parse arguements... | [
"f_preprocess.fill_length",
"os.listdir",
"argparse.ArgumentParser",
"csv.writer",
"numpy.asarray",
"scipy.io.loadmat",
"numpy.empty",
"f_model.build_model_01"
] | [((343, 409), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Rematch test of ECG Contest"""'}), "(description='Rematch test of ECG Contest')\n", (366, 409), False, 'import argparse\n'), ((1293, 1354), 'f_model.build_model_01', 'f_model.build_model_01', ([], {'num_classes': '(10)', 'len_t... |
import csv
import numpy as np
import time
from pathlib import Path
from Panalyzer.utils.wr_extractor import wr_extractor
from Panalyzer.TraceParser.logic_masking import *
def arm32buffered_csv2np(fcsv, buffersize, num_reg):
detailded_info = {'wr': None, 'regval': None, 'tick': None, 'masking': None, ... | [
"pathlib.Path",
"Panalyzer.utils.wr_extractor.wr_extractor",
"time.perf_counter",
"numpy.zeros",
"numpy.full",
"csv.reader"
] | [((402, 440), 'numpy.zeros', 'np.zeros', (['[buffersize]'], {'dtype': 'np.int64'}), '([buffersize], dtype=np.int64)\n', (410, 440), True, 'import numpy as np\n'), ((456, 508), 'numpy.full', 'np.full', (['[num_reg, 2, buffersize]', '(False)'], {'dtype': 'bool'}), '([num_reg, 2, buffersize], False, dtype=bool)\n', (463, ... |
import os
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
from loguru import logger
import config
from Train import train
from Model import EEGNet
class OptunaTrainer:
def __init__(self, checkpointPath, epochs, batchsize, logPath=None):
self.checkpointPath = checkpointPath
self.logpa... | [
"numpy.mean",
"numpy.median",
"loguru.logger.info",
"Train.train",
"os.path.dirname",
"numpy.array",
"Model.EEGNet"
] | [((1200, 1217), 'numpy.array', 'np.array', (['metrics'], {}), '(metrics)\n', (1208, 1217), True, 'import numpy as np\n'), ((1449, 1466), 'loguru.logger.info', 'logger.info', (['info'], {}), '(info)\n', (1460, 1466), False, 'from loguru import logger\n'), ((1469, 1494), 'loguru.logger.info', 'logger.info', (['trial.para... |
import numpy
import sympy
from matplotlib import pyplot
from sympy.utilities.lambdify import lambdify
# Set the font family and size to use for Matplotlib figures.
pyplot.rcParams['font.family'] = 'serif'
pyplot.rcParams['font.size'] = 16
sympy.init_printing()
x, nu, t = sympy.symbols('x nu t')
phi = (sympy.exp(-(x ... | [
"sympy.utilities.lambdify.lambdify",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"sympy.init_printing",
"sympy.symbols",
"numpy.linspace",
"matplotlib.pyplot.figure",
"sympy.exp",
"matplotlib.pyplot.ylim",... | [((241, 262), 'sympy.init_printing', 'sympy.init_printing', ([], {}), '()\n', (260, 262), False, 'import sympy\n'), ((275, 298), 'sympy.symbols', 'sympy.symbols', (['"""x nu t"""'], {}), "('x nu t')\n", (288, 298), False, 'import sympy\n'), ((496, 519), 'sympy.utilities.lambdify.lambdify', 'lambdify', (['(t, x, nu)', '... |
# Copyright 2021 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.einsum",
"reservoir_nn.keras.rewiring.AdaptiveSparseReservoir",
"numpy.arange",
"numpy.random.RandomState",
"numpy.testing.assert_allclose",
"tensorflow.keras.optimizers.SGD",
"reservoir_nn.keras.rewiring.GlobalPolicy",
"reservoir_nn.keras.rewiring.MutationPolicy",
"numpy.testing.assert_array... | [((8276, 8291), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (8289, 8291), False, 'from absl.testing import absltest\n'), ((899, 917), 'tensorflow.constant', 'tf.constant', (['[1.0]'], {}), '([1.0])\n', (910, 917), True, 'import tensorflow as tf\n'), ((929, 997), 'reservoir_nn.keras.rewiring.Adaptiv... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import torch
import math
import copy
from .base_debugger import BaseDebugger
from models.utils import _tranpose_and_gather_feat, _gather_feat
from mo... | [
"numpy.sqrt",
"models.decode._topk",
"models.utils._tranpose_and_gather_feat",
"numpy.ascontiguousarray",
"numpy.argsort",
"numpy.array",
"copy.copy",
"math.atan",
"numpy.partition",
"numpy.max",
"math.fabs",
"numpy.concatenate",
"numpy.arctan",
"torch.abs",
"torch.topk",
"numpy.argmax... | [((626, 641), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (639, 641), False, 'import torch\n'), ((5076, 5096), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (5088, 5096), False, 'import torch\n'), ((5178, 5198), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (5190, 519... |
import logbook
import pandas as pd
import zipline as zl
from datetime import datetime, timedelta
import pathlib
import azul
import numpy as np
from typing import List, Tuple
log = logbook.Logger('BasePriceManager')
class BasePriceManager(object):
def __init__(self, calendar_name='NYSE'):
self._calendar ... | [
"logbook.Logger",
"pandas.DataFrame",
"pathlib.Path",
"numpy.array",
"zipline.get_calendar",
"datetime.datetime.today",
"datetime.timedelta",
"pandas.concat"
] | [((181, 215), 'logbook.Logger', 'logbook.Logger', (['"""BasePriceManager"""'], {}), "('BasePriceManager')\n", (195, 215), False, 'import logbook\n'), ((322, 357), 'zipline.get_calendar', 'zl.get_calendar', ([], {'name': 'calendar_name'}), '(name=calendar_name)\n', (337, 357), True, 'import zipline as zl\n'), ((746, 780... |
import random
import numpy as np
from gym_multigrid.multigrid import World
from gym_multigrid.multigrid import DIR_TO_VEC
from gym_multigrid.multigrid import Actions
class Agent:
def __init__(self, agent_id, agent_type=0):
self.id = agent_id
self.total_reward = 0
self.action_probabilities ... | [
"random.choice",
"numpy.arange"
] | [((2837, 2873), 'random.choice', 'random.choice', (['target_ball_positions'], {}), '(target_ball_positions)\n', (2850, 2873), False, 'import random\n'), ((693, 705), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (702, 705), True, 'import numpy as np\n')] |
# -*- coding: UTF-8 -*-
import glob
import numpy as np
import pandas as pd
from PIL import Image
import random
# h,w = 60,50
h, w = (60, 50)
size = h * w
# Receding_Hairline Wearing_Necktie Rosy_Cheeks Eyeglasses Goatee Chubby
# Sideburns Blurry Wearing_Hat Double_Chin Pale_Skin Gray_Hair Mustache Bald
... | [
"random.sample",
"PIL.Image.open",
"numpy.array",
"numpy.zeros",
"pandas.read_table",
"glob.glob"
] | [((411, 505), 'pandas.read_table', 'pd.read_table', (['"""./data/list_attr_celeba.txt"""'], {'delim_whitespace': '(True)', 'error_bad_lines': '(False)'}), "('./data/list_attr_celeba.txt', delim_whitespace=True,\n error_bad_lines=False)\n", (424, 505), True, 'import pandas as pd\n'), ((537, 562), 'numpy.array', 'np.a... |
"""
Created on Sat Mar 23 00:23:27 2019
@author: nahid
"""
#https://docs.scipy.org/doc/numpy/reference/generated/numpy.absolute.html
import numpy as np
import matplotlib.pyplot as plt
x = np.array([-1.2, 1.2])
x = np.absolute(x)
print(x)
print(np.absolute(1 + 2j))
#Plot the function over [-10, 10]:
x = np.linspace(-1... | [
"numpy.abs",
"numpy.absolute",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((189, 210), 'numpy.array', 'np.array', (['[-1.2, 1.2]'], {}), '([-1.2, 1.2])\n', (197, 210), True, 'import numpy as np\n'), ((215, 229), 'numpy.absolute', 'np.absolute', (['x'], {}), '(x)\n', (226, 229), True, 'import numpy as np\n'), ((306, 331), 'numpy.linspace', 'np.linspace', (['(-10)', '(10)', '(101)'], {}), '(-... |
#!/usr/bin/env python3
import sys
import os
import argparse
import time
import serial
import csv
import math
import pickle
from collections import defaultdict
import numpy as np
from sklearn.decomposition import PCA, FastICA
from sklearn.svm import SVC
# Graph
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 800
PLOT_SCROLL = 3 ... | [
"pygame.init",
"math.sqrt",
"time.sleep",
"numpy.array",
"sklearn.decomposition.FastICA",
"pygame.font.Font",
"argparse.ArgumentParser",
"sklearn.decomposition.PCA",
"pygame.display.set_mode",
"pygame.display.flip",
"csv.reader",
"csv.writer",
"pickle.load",
"os.path.dirname",
"time.time... | [((19921, 19986), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Electromyography Processor"""'}), "(description='Electromyography Processor')\n", (19944, 19986), False, 'import argparse\n'), ((24584, 24626), 'os.environ.get', 'os.environ.get', (['"""EMGPROC_LOAD_GAME"""', '(False)'], {}... |
import numpy as np
from preprocess import Vectorizer
from flask import render_template, make_response
from google.oauth2.id_token import verify_oauth2_token
from google.auth.transport.requests import Request
from google.cloud import firestore
from os.path import join, abspath, dirname
from random import randint
from pi... | [
"flask.render_template",
"google.cloud.firestore.Client",
"google.auth.transport.requests.Request",
"pickle.load",
"os.path.join",
"numpy.any",
"numpy.count_nonzero",
"numpy.argsort",
"numpy.random.seed",
"os.path.abspath",
"random.randint"
] | [((383, 401), 'google.cloud.firestore.Client', 'firestore.Client', ([], {}), '()\n', (399, 401), False, 'from google.cloud import firestore\n'), ((424, 441), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (431, 441), False, 'from os.path import join, abspath, dirname\n'), ((583, 599), 'pickle.load', ... |
'''
Filename: predict.py
Python Version: 3.6.5
Project: Neutrophil Identifier
Author: <NAME>
Created date: Sep 5, 2018 4:13 PM
-----
Last Modified: Oct 9, 2018 3:48 PM
Modified By: <NAME>
-----
License: MIT
http://www.opensource.org/licenses/MIT
'''
import os
import sys
import logging
from math import ceil
from keras.... | [
"logging.basicConfig",
"keras.models.load_model",
"logging.debug",
"math.ceil",
"os.path.join",
"tables.open_file",
"os.path.basename",
"numpy.savetxt",
"logging.info"
] | [((1965, 2005), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (1984, 2005), False, 'import logging\n'), ((996, 1018), 'keras.models.load_model', 'load_model', (['model_path'], {}), '(model_path)\n', (1006, 1018), False, 'from keras.models import load_model\n'... |
import numpy as np
import os
import tensorflow as tf
EPS = 1e-8
def placeholder(dim=None):
return tf.placeholder(dtype=tf.float32, shape=(None,dim) if dim else (None,))
def placeholders(*args):
return [placeholder(dim) for dim in args]
def mlp(x, hidden_sizes=(32,), activation=tf.tanh, output_activation=Non... | [
"tensorflow.shape",
"tensorflow.reduce_sum",
"numpy.log",
"tensorflow.multiply",
"tensorflow.nn.softmax",
"tensorflow.keras.initializers.Orthogonal",
"tensorflow.cast",
"tensorflow.log",
"tensorflow.placeholder",
"tensorflow.concat",
"tensorflow.convert_to_tensor",
"tensorflow.variable_scope",... | [((104, 175), 'tensorflow.placeholder', 'tf.placeholder', ([], {'dtype': 'tf.float32', 'shape': '((None, dim) if dim else (None,))'}), '(dtype=tf.float32, shape=(None, dim) if dim else (None,))\n', (118, 175), True, 'import tensorflow as tf\n'), ((338, 375), 'tensorflow.keras.initializers.Orthogonal', 'tf.keras.initial... |
# -*- coding: utf-8 -*-
"""Polynomial techniques for fitting baselines to experimental data.
Created on Feb. 27, 2021
@author: <NAME>
The function penalized_poly was adapted from MATLAB code from
https://www.mathworks.com/matlabcentral/fileexchange/27429-background-correction
(accessed March 18, 2021), which was lic... | [
"numpy.ones_like",
"numpy.abs",
"numpy.sqrt",
"numpy.minimum",
"math.ceil",
"numpy.argsort",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.empty",
"numpy.sign",
"numpy.linalg.lstsq",
"numpy.std",
"warnings.warn",
"numpy.maximum",
"numpy.arange"
] | [((9204, 9225), 'numpy.sqrt', 'np.sqrt', (['weight_array'], {}), '(weight_array)\n', (9211, 9225), True, 'import numpy as np\n'), ((9274, 9308), 'numpy.dot', 'np.dot', (['pseudo_inverse', '(sqrt_w * y)'], {}), '(pseudo_inverse, sqrt_w * y)\n', (9280, 9308), True, 'import numpy as np\n'), ((9324, 9344), 'numpy.dot', 'np... |
"""
Running operational space control with the PyGame display, using an exponential
additive signal when to push away from joints.
The target location can be moved by clicking on the background.
"""
import numpy as np
from abr_control.arms import threejoint as arm
# from abr_control.arms import twojoint as arm
from ab... | [
"numpy.hstack",
"abr_control.controllers.OSC",
"abr_control.interfaces.PyGame",
"abr_control.controllers.AvoidJointLimits",
"abr_control.arms.threejoint.Config",
"abr_control.controllers.Damping",
"abr_control.arms.threejoint.ArmSim"
] | [((509, 536), 'abr_control.arms.threejoint.Config', 'arm.Config', ([], {'use_cython': '(True)'}), '(use_cython=True)\n', (519, 536), True, 'from abr_control.arms import threejoint as arm\n'), ((575, 599), 'abr_control.arms.threejoint.ArmSim', 'arm.ArmSim', (['robot_config'], {}), '(robot_config)\n', (585, 599), True, '... |
import itertools
from unittest import TestCase
import numpy as np
from utils.data import ArrayInfo, image_array_to_rgb
from utils.data.mappers import *
class ImageUtilsTestCase(TestCase):
def test_image_array_to_rgb(self):
np.random.seed(1234)
def f(batch_size, n_channels, channel_last, the_ch... | [
"numpy.reshape",
"numpy.testing.assert_equal",
"itertools.product",
"utils.data.ArrayInfo",
"utils.data.image_array_to_rgb",
"numpy.random.randint",
"numpy.random.seed"
] | [((240, 260), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (254, 260), True, 'import numpy as np\n'), ((2216, 2375), 'itertools.product', 'itertools.product', (['([], [7], [3, 4])', '(None, 1, 3)', '(None, True, False)', '(True, False)', '(True, False)', '(8, 5)', '(True, False)', '(None, (0, 1)... |
## @ingroup Methods-Aerodynamics-Airfoil_Panel_Method
# panel_geometry.py
# Created: Mar 2021, <NAME>
# ---------------------------------------
#-------------------------------
# Imports
# ----------------------------------------------------------------------
import SUAVE
from SUAVE.Core import Units
import numpy ... | [
"numpy.zeros",
"numpy.sqrt"
] | [((1778, 1832), 'numpy.sqrt', 'np.sqrt', (['((x[1:] - x[:-1]) ** 2 + (y[1:] - y[:-1]) ** 2)'], {}), '((x[1:] - x[:-1]) ** 2 + (y[1:] - y[:-1]) ** 2)\n', (1785, 1832), True, 'import numpy as np\n'), ((1962, 1996), 'numpy.zeros', 'np.zeros', (['(npanel, 2, nalpha, nRe)'], {}), '((npanel, 2, nalpha, nRe))\n', (1970, 1996)... |
# -*- coding: utf-8 -*-
import csv
import logging as logmodule
import math
import os
import sys
import tempfile
from collections import OrderedDict
# On OS X, the default backend will fail if you are not using a Framework build of Python,
# e.g. in a virtualenv. To avoid having to set MPLBACKEND each time we use Studi... | [
"logging.getLogger",
"contentcuration.utils.format.format_size",
"pdfkit.from_string",
"sys.platform.startswith",
"pptx.Presentation",
"math.log",
"matplotlib.pyplot.annotate",
"os.path.sep.join",
"matplotlib.pyplot.switch_backend",
"pressurecooker.encodings.encode_file_to_base64",
"pptx.dml.col... | [((359, 392), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (382, 392), False, 'import sys\n'), ((1653, 1678), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (1671, 1678), True, 'import matplotlib.pyplot as plt\n'), ((1927, 195... |
import os
import numpy
from pydub import AudioSegment
from scipy.fftpack import fft
class AudioSignal(object):
def __init__(self, sample_rate, signal=None, filename=None):
# Set sample rate
self._sample_rate = sample_rate
if signal is None:
# Get file name and file extensio... | [
"numpy.ones",
"os.path.splitext",
"numpy.hamming",
"numpy.append",
"numpy.array",
"pydub.AudioSegment.from_file",
"scipy.fftpack.fft",
"numpy.fromstring"
] | [((1474, 1500), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (1490, 1500), False, 'import os\n'), ((1995, 2027), 'pydub.AudioSegment.from_file', 'AudioSegment.from_file', (['filename'], {}), '(filename)\n', (2017, 2027), False, 'from pydub import AudioSegment\n'), ((4962, 5037), 'numpy.ap... |
from tensorflow import keras
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
model = keras.models.load_model("Saved models/2layerNet.h5")
x = np.load("data/preprocessedInputs.npy")
y = np.load("data/outputs.npy")
oosx = np.load("data/testx.npy")
oosy = np.load("data/testy.npy")
... | [
"numpy.load",
"tensorflow.keras.models.load_model"
] | [((115, 167), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""Saved models/2layerNet.h5"""'], {}), "('Saved models/2layerNet.h5')\n", (138, 167), False, 'from tensorflow import keras\n'), ((173, 211), 'numpy.load', 'np.load', (['"""data/preprocessedInputs.npy"""'], {}), "('data/preprocessedInputs... |
import numpy as np
import scipy as sp
from scipy.sparse.linalg import LinearOperator, lgmres, gmres
import tensornetwork as tn
import jax_vumps.numpy_backend.contractions as ct
# import jax_vumps.numpy_backend.mps_linalg as mps_linalg
def LH_linear_operator(A_L, lR):
"""
Return, as a LinearOperator, the LH... | [
"scipy.sparse.linalg.LinearOperator",
"numpy.eye",
"jax_vumps.numpy_backend.contractions.proj",
"jax_vumps.numpy_backend.contractions.tmdense",
"tensornetwork.ncon",
"jax_vumps.numpy_backend.contractions.compute_hR",
"jax_vumps.numpy_backend.contractions.XopR",
"jax_vumps.numpy_backend.contractions.co... | [((462, 490), 'numpy.eye', 'np.eye', (['chi'], {'dtype': 'A_L.dtype'}), '(chi, dtype=A_L.dtype)\n', (468, 490), True, 'import numpy as np\n'), ((686, 754), 'scipy.sparse.linalg.LinearOperator', 'LinearOperator', (['(chi ** 2, chi ** 2)'], {'matvec': 'matvec', 'dtype': 'A_L.dtype'}), '((chi ** 2, chi ** 2), matvec=matve... |
# -*- coding: utf-8 -*-
"""
File Name: utils
Description :
Author : mick.yi
date: 2019/1/4
"""
import numpy as np
def enqueue(np_array, elem):
"""
入队列,新增元素放到队首,队尾元素丢弃
:param np_array: 原始队列
:param elem: 增加元素
:return:
"""
np_array[1:] = np_arra... | [
"numpy.argsort",
"numpy.asarray",
"numpy.argmax"
] | [((1123, 1141), 'numpy.argsort', 'np.argsort', (['labels'], {}), '(labels)\n', (1133, 1141), True, 'import numpy as np\n'), ((1322, 1341), 'numpy.asarray', 'np.asarray', (['weights'], {}), '(weights)\n', (1332, 1341), True, 'import numpy as np\n'), ((1658, 1685), 'numpy.argmax', 'np.argmax', (['predict'], {'axis': '(-1... |
"""
Module with reading functionalities of color and magnitude data from photometric and
spectral libraries.
"""
import os
import configparser
from typing import Optional, Tuple
import h5py
import numpy as np
from typeguard import typechecked
from species.core import box
from species.read import read_spectrum
from... | [
"configparser.ConfigParser",
"species.util.phot_util.apparent_to_absolute",
"numpy.where",
"numpy.size",
"numpy.asarray",
"species.core.box.create_box",
"h5py.File",
"os.getcwd",
"numpy.array",
"numpy.isnan",
"species.read.read_spectrum.ReadSpectrum"
] | [((1538, 1565), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1563, 1565), False, 'import configparser\n'), ((8001, 8028), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (8026, 8028), False, 'import configparser\n'), ((1485, 1496), 'os.getcwd', 'os.getcwd', ([... |
# ===========================================================================
# imgcv.py ----------------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# -----... | [
"rsvis.utils.imgtools.expand_image_dim",
"PIL.Image.fromarray",
"numpy.logical_and",
"rsvis.utils.imgtools.project_and_stack",
"numpy.asarray",
"rsvis.utils.imgtools.invert_bool_img",
"rsvis.utils.imgtools.bool_to_img",
"PIL.ImageTk.PhotoImage"
] | [((6408, 6438), 'rsvis.utils.imgtools.expand_image_dim', 'imgtools.expand_image_dim', (['img'], {}), '(img)\n', (6433, 6438), True, 'import rsvis.utils.imgtools as imgtools\n'), ((6594, 6614), 'PIL.Image.fromarray', 'Image.fromarray', (['img'], {}), '(img)\n', (6609, 6614), False, 'from PIL import Image, ImageTk\n'), (... |
#! /usr/bin/env python3
#
"""
Plot time series data in an interactive plot viewer.
Usage
=====
$ python3 plot_time_series.py --loglevel=20 --stderr
Plots add new data every second, and update on screen every 5 sec.
24 hours of data is kept. Each plot starts out in "autoaxis X PAN"
and "autoaxis Y VIS".
Things you c... | [
"ginga.plot.data_source.XYDataSource",
"ginga.gw.Widgets.Button",
"ginga.toolkit.use",
"ginga.plot.data_source.update_plot_from_source",
"ginga.plot.time_series.TimePlotTitle",
"ginga.gw.Widgets.HBox",
"ginga.gw.Viewers.CanvasView",
"sys.exit",
"numpy.arange",
"ginga.plot.time_series.TimePlotBG",
... | [((3175, 3186), 'time.time', 'time.time', ([], {}), '()\n', (3184, 3186), False, 'import time\n'), ((3906, 3949), 'ginga.gw.Viewers.CanvasView', 'Viewers.CanvasView', (['logger'], {'render': '"""widget"""'}), "(logger, render='widget')\n", (3924, 3949), False, 'from ginga.gw import Viewers\n'), ((4227, 4243), 'ginga.pl... |
#-*- coding:utf-8 -*-
from __future__ import print_function
import os,sys,sip,time
from datetime import datetime,timedelta
from qtpy.QtWidgets import QTreeWidgetItem,QMenu,QApplication,QAction,QMainWindow
from qtpy import QtGui,QtWidgets
from qtpy.QtCore import Qt,QUrl,QDate
from Graph import graphpage
from layout impo... | [
"qtpy.QtCore.QUrl.fromLocalFile",
"qtpy.QtCore.QDate.fromString",
"Graph.graphpage",
"numpy.array",
"qtpy.QtWidgets.QAction",
"tushare.get_industry_classified",
"datetime.timedelta",
"qtpy.QtWidgets.QTreeWidgetItem",
"pandas.DataFrame",
"layout.Ui_MainWindow",
"qtpy.QtWidgets.QMenu",
"pickle.l... | [((16921, 16943), 'qtpy.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (16933, 16943), False, 'from qtpy.QtWidgets import QTreeWidgetItem, QMenu, QApplication, QAction, QMainWindow\n'), ((564, 579), 'layout.Ui_MainWindow', 'Ui_MainWindow', ([], {}), '()\n', (577, 579), False, 'from layout ... |
#Función que calcula la matriz resultante "C" después de aplicar la operación convolución de A*B=
# EJERCICIO 28 DE OCTUBRE
# <NAME> A01377098
import numpy as np
def convolucion (A, B):
contaFil = 0
contaCol = 0
limiteFil = len(A)
limiteCol = len(A)
longitudB = len(B)
for x in range (len(C))... | [
"numpy.array",
"numpy.zeros"
] | [((1153, 1169), 'numpy.array', 'np.array', (['Matriz'], {}), '(Matriz)\n', (1161, 1169), True, 'import numpy as np\n'), ((1174, 1190), 'numpy.array', 'np.array', (['Filtro'], {}), '(Filtro)\n', (1182, 1190), True, 'import numpy as np\n'), ((1196, 1212), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (1204, ... |
"""
This module is used to generate correlation (R) and regression (b)
coefficients for relationships between the 2015 Census,
2018 Yale Climate Opinion Maps (YCOM) and land area datasets,
as well as p values for these relationships.
"""
import numpy as np
import pandas as pd
from scipy.stats import linregress
def ca... | [
"pandas.DataFrame",
"scipy.stats.linregress",
"numpy.mean",
"numpy.std"
] | [((2469, 2546), 'pandas.DataFrame', 'pd.DataFrame', (['stats_outputs_standard[:, :, 0]'], {'columns': 'n_census', 'index': 'n_ycom'}), '(stats_outputs_standard[:, :, 0], columns=n_census, index=n_ycom)\n', (2481, 2546), True, 'import pandas as pd\n'), ((2691, 2759), 'pandas.DataFrame', 'pd.DataFrame', (['stats_outputs[... |
import numpy as np
from mindspore import context
import mindspore as ms
import mindspore.nn as nn
from mindspore.ops import operations as P
from mindspore import Tensor
from mindspore.common.api import _executor
from tests.ut.python.ops.test_math_ops import VirtualLoss
from mindspore.parallel import set_algo_parameters... | [
"mindspore.common.api._executor._get_strategy",
"numpy.ones",
"mindspore.ops.operations.ReLU",
"mindspore.context.set_context",
"mindspore.nn.BatchNorm2d",
"mindspore.parallel.set_algo_parameters",
"tests.ut.python.ops.test_math_ops.VirtualLoss",
"mindspore.parallel._utils._reset_op_id",
"mindspore.... | [((1523, 1560), 'mindspore.context.set_context', 'context.set_context', ([], {'save_graphs': '(True)'}), '(save_graphs=True)\n', (1542, 1560), False, 'from mindspore import context\n'), ((1565, 1627), 'mindspore.context.set_auto_parallel_context', 'context.set_auto_parallel_context', ([], {'device_num': '(8)', 'global_... |
import tensorflow as tf
import numpy as np
tf.set_random_seed(777)
data = np.loadtxt('data-04-zoo.csv', delimiter=',', dtype=np.float32)
x_data = data[:, 0:-1]
y_data = data[:, [-1]]
x = tf.placeholder(dtype=tf.float32, shape=[None, 16])
y = tf.placeholder(dtype=tf.int32, shape=[None, 1])
y_ont_hot = tf.one_hot(y, 7)... | [
"tensorflow.one_hot",
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow.matmul",
"tensorflow.nn.s... | [((43, 66), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(777)'], {}), '(777)\n', (61, 66), True, 'import tensorflow as tf\n'), ((75, 137), 'numpy.loadtxt', 'np.loadtxt', (['"""data-04-zoo.csv"""'], {'delimiter': '""","""', 'dtype': 'np.float32'}), "('data-04-zoo.csv', delimiter=',', dtype=np.float32)\n", (85... |
from cmx import doc
import gym
import numpy as np
from env_wrappers.flat_env import FlatGoalEnv
from sawyer.misc import space2dict, obs2dict
def test_start():
doc @ """
# Sawyer Blocks Environment
## To-do
- [ ] automatically generate the environment table
We include the following domain... | [
"env_wrappers.flat_env.FlatGoalEnv",
"cmx.doc",
"numpy.array",
"cmx.doc.video",
"sawyer.misc.space2dict",
"numpy.min",
"sawyer.misc.obs2dict",
"cmx.doc.flush",
"gym.make"
] | [((1064, 1102), 'cmx.doc.video', 'doc.video', (['frames', 'f"""videos/reach.gif"""'], {}), "(frames, f'videos/reach.gif')\n", (1073, 1102), False, 'from cmx import doc\n'), ((1107, 1118), 'cmx.doc.flush', 'doc.flush', ([], {}), '()\n', (1116, 1118), False, 'from cmx import doc\n'), ((3801, 3844), 'cmx.doc.video', 'doc.... |
import numpy as np
import pandas as pa
import time
from sklearn.metrics import pairwise_distances
from scipy.sparse import csr_matrix
class Kmeans:
def __init__(self,data,k,geneNames,cellNames,cluster_label=None,seed=None):
self.data=data
self.k=k
self.geneNames=geneNames
self.cellN... | [
"numpy.mean",
"sklearn.metrics.pairwise_distances",
"numpy.max",
"numpy.array",
"numpy.random.randint",
"numpy.apply_along_axis",
"numpy.zeros",
"numpy.sum",
"numpy.random.seed",
"numpy.min",
"numpy.argwhere",
"time.time"
] | [((1207, 1238), 'numpy.random.randint', 'np.random.randint', (['(0)', 'n', 'self.k'], {}), '(0, n, self.k)\n', (1224, 1238), True, 'import numpy as np\n'), ((1839, 1877), 'numpy.zeros', 'np.zeros', (['(self.k, self.data.shape[1])'], {}), '((self.k, self.data.shape[1]))\n', (1847, 1877), True, 'import numpy as np\n'), (... |
from flask import Flask, render_template, request
from keras.preprocessing.image import img_to_array, load_img
from keras.models import load_model
import cv2
import os
import numpy as np
from flask_cors import CORS, cross_origin
import tensorflow.keras
from PIL import Image, ImageOps
import base64
import json
import dl... | [
"flask.render_template",
"flask_cors.CORS",
"flask.Flask",
"PIL.ImageOps.fit",
"numpy.array",
"cv2.imdecode",
"json.dumps",
"numpy.asarray",
"dlib.shape_predictor",
"dlib.get_frontal_face_detector",
"numpy.squeeze",
"cv2.cvtColor",
"imutils.face_utils.shape_to_np",
"cv2.imread",
"numpy.s... | [((4465, 4480), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (4470, 4480), False, 'from flask import Flask, render_template, request\n'), ((4488, 4497), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (4492, 4497), False, 'from flask_cors import CORS, cross_origin\n'), ((807, 839), 'dlib.get_frontal... |
import pandas as pd
import nltk
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import os
nltk.download('stopwords')
nltk.download('punkt')
nltk.download('wordnet_ic')
nltk.download('genesis')
nltk.download('averaged_perceptron_tagger')
nltk.download('wordnet')
from src.Preprocess import Uti... | [
"os.path.exists",
"os.makedirs",
"nltk.download",
"src.Preprocess.Utils.readDataset",
"os.path.join",
"pandas.set_option",
"numpy.random.seed"
] | [((116, 142), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (129, 142), False, 'import nltk\n'), ((143, 165), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (156, 165), False, 'import nltk\n'), ((166, 193), 'nltk.download', 'nltk.download', (['"""wordnet_ic"""'... |
import numpy as np
from prml.nn.function import Function
class Product(Function):
def __init__(self, axis=None, keepdims=False):
if isinstance(axis, int):
axis = (axis,)
elif isinstance(axis, tuple):
axis = tuple(sorted(axis))
self.axis = axis
self.keepdims... | [
"numpy.prod",
"numpy.expand_dims",
"numpy.squeeze"
] | [((382, 423), 'numpy.prod', 'np.prod', (['x'], {'axis': 'self.axis', 'keepdims': '(True)'}), '(x, axis=self.axis, keepdims=True)\n', (389, 423), True, 'import numpy as np\n'), ((473, 496), 'numpy.squeeze', 'np.squeeze', (['self.output'], {}), '(self.output)\n', (483, 496), True, 'import numpy as np\n'), ((690, 715), 'n... |
import numpy as np
from scipy import sparse
from sklearn.model_selection import train_test_split
rows = [0,1,2,8]
cols = [1,0,4,8]
vals = [1,2,1,4]
A = sparse.coo_matrix((vals, (rows, cols)))
print(A.todense())
B = A.tocsr()
C = sparse.csr_matrix(np.array([0,1,0,0,2,0,0,0,1]).reshape(1,9))
print(B.shape,C.shape)... | [
"sklearn.model_selection.train_test_split",
"scipy.sparse.load_npz",
"numpy.array",
"numpy.random.randint",
"scipy.sparse.coo_matrix",
"scipy.sparse.save_npz",
"scipy.sparse.vstack"
] | [((156, 195), 'scipy.sparse.coo_matrix', 'sparse.coo_matrix', (['(vals, (rows, cols))'], {}), '((vals, (rows, cols)))\n', (173, 195), False, 'from scipy import sparse\n'), ((325, 346), 'scipy.sparse.vstack', 'sparse.vstack', (['[B, C]'], {}), '([B, C])\n', (338, 346), False, 'from scipy import sparse\n'), ((417, 446), ... |
import numpy as np
import matplotlib.pyplot as plt
# mass, spring constant, initial position and velocity
m = 1
k = 1
x = 0
v = 1
# Creating first two data using Euler's method
t_max = 0.2
dt = 0.1
t_array = np.arange(0, t_max, dt)
x_list = []
v_list = []
for t in t_array:
x_list.append(x)
v_list.append(v)
... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((210, 233), 'numpy.arange', 'np.arange', (['(0)', 't_max', 'dt'], {}), '(0, t_max, dt)\n', (219, 233), True, 'import numpy as np\n'), ((426, 451), 'numpy.arange', 'np.arange', (['(0.2)', 't_max', 'dt'], {}), '(0.2, t_max, dt)\n', (435, 451), True, 'import numpy as np\n'), ((905, 921), 'numpy.array', 'np.array', (['x_... |
#!/usr/bin/env python3
import sys
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime as dt
import numpy as np
import argparse
global pred_map,sat_map,inst_map
pred_map = { 1 : '1 (constant) ',
2 : '1000-300hPa thickness',
3 : '200-50hPa thickness... | [
"matplotlib.pyplot.savefig",
"numpy.add",
"argparse.ArgumentParser",
"matplotlib.dates.WeekdayLocator",
"datetime.datetime.strptime",
"matplotlib.dates.DateFormatter",
"matplotlib.pyplot.tight_layout",
"sys.exit",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
... | [((3935, 3968), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8.27, 3.6)'}), '(figsize=(8.27, 3.6))\n', (3947, 3968), True, 'import matplotlib.pyplot as plt\n'), ((4067, 4090), 'matplotlib.pyplot.title', 'plt.title', (['title_string'], {}), '(title_string)\n', (4076, 4090), True, 'import matplotlib.p... |
'''
This code is used for testing MoDL on JPEG-compressed data, for the results shown in figures 6, 7 and 8c in the paper.
Before running this script you should update the following:
basic_data_folder - it should be the same as the output folder defined in the script /crime_2_jpeg/data_prep/jpeg_data_prep.py
(c... | [
"logging.getLogger",
"utils.datasets.create_data_loaders",
"MoDL_single.UnrolledModel",
"numpy.array",
"torch.cuda.is_available",
"matplotlib.pyplot.imshow",
"os.path.exists",
"numpy.savez",
"numpy.asarray",
"matplotlib.pyplot.axis",
"numpy.abs",
"matplotlib.pyplot.show",
"logging.basicConfi... | [((652, 691), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (671, 691), False, 'import logging\n'), ((702, 729), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (719, 729), False, 'import logging\n'), ((1324, 1352), 'numpy.array', ... |
import numpy as np
from scipy.spatial import cKDTree as KDTree
import math
import argparse
# ref: https://github.com/facebookresearch/DeepSDF/blob/master/deep_sdf/metrics/chamfer.py
# takes one pair of reconstructed and gt point cloud and return the cd
def compute_cd(gt_points, gen_points):
# one direction
... | [
"argparse.ArgumentParser",
"scipy.spatial.cKDTree",
"numpy.square",
"math.isnan",
"numpy.load",
"numpy.random.shuffle"
] | [((341, 359), 'scipy.spatial.cKDTree', 'KDTree', (['gen_points'], {}), '(gen_points)\n', (347, 359), True, 'from scipy.spatial import cKDTree as KDTree\n'), ((537, 554), 'scipy.spatial.cKDTree', 'KDTree', (['gt_points'], {}), '(gt_points)\n', (543, 554), True, 'from scipy.spatial import cKDTree as KDTree\n'), ((810, 83... |
#!/usr/bin/env python3
# This is the master ImageAnalysis processing script. For DJI and
# Sentera cameras it should typically be able to run through with
# default settings and produce a good result with no further input.
#
# If something goes wrong, there are usually specific sub-scripts that
# can be run to fix th... | [
"lib.smart.update_srtm_elevations",
"lib.pose.set_aircraft_poses",
"lib.optimizer.Optimizer",
"lib.match_cleanup.triangulate_smart",
"props_json.load",
"lib.match_cleanup.merge_duplicates",
"os.path.exists",
"lib.state.check",
"argparse.ArgumentParser",
"lib.pose.make_pix4d",
"lib.matcher.find_m... | [((1275, 1338), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create an empty project."""'}), "(description='Create an empty project.')\n", (1298, 1338), False, 'import argparse\n'), ((4865, 4911), 'lib.logger.log', 'log', (['"""Project processed with arguments:"""', 'args'], {}), "('Pr... |
import pytorch_lightning as pl
import torch
from torch.utils.data import Dataset, DataLoader, random_split
from sklearn.preprocessing import LabelEncoder
from PIL import Image
import numpy as np
import pandas as pd
def encode_labels(labels):
le = LabelEncoder()
encoded = le.fit_transform(labels)
... | [
"sklearn.preprocessing.LabelEncoder",
"PIL.Image.open",
"pandas.read_csv",
"numpy.array",
"torch.utils.data.DataLoader",
"numpy.transpose",
"torch.Generator"
] | [((256, 270), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (268, 270), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((384, 400), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (394, 400), False, 'from PIL import Image\n'), ((470, 483), 'numpy.array', 'np.array', ([... |
import argparse
import shutil
import numpy as np
from project.data_preprocessing.preprocessing import Preprocessor
from project.data_preprocessing.data_loader import Loader
from project.models.model import Model
from prostagma.techniques.grid_search import GridSearch
from prostagma.performances.cross_validation impor... | [
"project.data_preprocessing.data_loader.Loader",
"argparse.ArgumentParser",
"project.data_preprocessing.preprocessing.Preprocessor",
"numpy.random.seed",
"shutil.rmtree",
"prostagma.performances.cross_validation.CrossValidation",
"project.models.model.Model"
] | [((348, 373), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (371, 373), False, 'import argparse\n'), ((1718, 1735), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1732, 1735), True, 'import numpy as np\n'), ((1770, 1818), 'project.data_preprocessing.data_loader.Loader', 'Loade... |
import numpy as np
import requests
import talib
class stock_ins:
BASE_URL = "https://paper-api.alpaca.markets"
DATA_URL = "https://data.alpaca.markets"
def __init__(self, stock_name, save_len, api_key, secret_key):
self.stock_name = stock_name
self.save_len = save_len
self.ask_data... | [
"numpy.array",
"market.is_open",
"time.sleep",
"time.time"
] | [((2142, 2158), 'market.is_open', 'market.is_open', ([], {}), '()\n', (2156, 2158), False, 'import market\n'), ((1350, 1380), 'numpy.array', 'np.array', (['data'], {'dtype': '"""double"""'}), "(data, dtype='double')\n", (1358, 1380), True, 'import numpy as np\n'), ((2186, 2197), 'time.time', 'time.time', ([], {}), '()\... |
import numpy as np
from rotations import rot2, rot3
import mavsim_python_parameters_aerosonde_parameters as P
class Gravity:
def __init__(self, state):
self.mass = P.mass
self.gravity = P.gravity
self.state = state
# Aero quantities
@property
def force(self):
... | [
"numpy.array"
] | [((385, 421), 'numpy.array', 'np.array', (['[0, 0, P.mass * P.gravity]'], {}), '([0, 0, P.mass * P.gravity])\n', (393, 421), True, 'import numpy as np\n')] |
from tensorflow.python.framework import ops
import tensorflow as tf
from utilities import model as md
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
import os
import time
import cv2
def model(photos_train, Y_train, photos_test, Y_test, learning_rate=0.0005,
... | [
"tensorflow.python.framework.ops.reset_default_graph",
"matplotlib.pyplot.ylabel",
"utilities.model.forward_propagation",
"utilities.model.get_data_chunk",
"tensorflow.set_random_seed",
"tensorflow.cast",
"numpy.save",
"utilities.model.compute_cost",
"utilities.model.initialize_parameters",
"tenso... | [((969, 994), 'tensorflow.python.framework.ops.reset_default_graph', 'ops.reset_default_graph', ([], {}), '()\n', (992, 994), False, 'from tensorflow.python.framework import ops\n'), ((1065, 1086), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1)'], {}), '(1)\n', (1083, 1086), True, 'import tensorflow as tf\n... |
import os
import scipy
import numpy as np
from ImageStatistics import UsefulImDirectory
import scipy as sp
import ast
from bokeh.charts import Histogram, show
import pandas as pd
class Game(object):
def __init__(self, gamefolder):
self.gamefolder = os.path.abspath(gamefolder)
file = open(os.path.jo... | [
"numpy.mean",
"numpy.median",
"scipy.stats.iqr",
"os.path.join",
"ast.literal_eval",
"numpy.std",
"os.path.abspath",
"numpy.var"
] | [((262, 289), 'os.path.abspath', 'os.path.abspath', (['gamefolder'], {}), '(gamefolder)\n', (277, 289), False, 'import os\n'), ((310, 343), 'os.path.join', 'os.path.join', (['gamefolder', '"""sales"""'], {}), "(gamefolder, 'sales')\n", (322, 343), False, 'import os\n'), ((465, 503), 'os.path.join', 'os.path.join', (['g... |
from .ranking import CreditRanking
from .interleaving_method import InterleavingMethod
import numpy as np
from scipy.optimize import linprog
class Optimized(InterleavingMethod):
'''
Optimized Interleaving
Args:
lists: lists of document IDs
max_length: the maximum length of resultant inter... | [
"numpy.sum",
"numpy.array",
"numpy.vstack"
] | [((2386, 2413), 'numpy.sum', 'np.sum', (['self._probabilities'], {}), '(self._probabilities)\n', (2392, 2413), True, 'import numpy as np\n'), ((4982, 5011), 'numpy.vstack', 'np.vstack', (['(A_p_sum, ub_cons)'], {}), '((A_p_sum, ub_cons))\n', (4991, 5011), True, 'import numpy as np\n'), ((5027, 5069), 'numpy.array', 'np... |
# import key libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from wordcloud import WordCloud, STOPWORDS
import nltk
import re
from nltk.stem import PorterStemmer, WordNetLemmatizer
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize,... | [
"pandas.read_csv",
"nltk.download",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"tensorflow.keras.layers.Dense",
"gensim.utils.simple_preprocess",
"matplotlib.pyplot.imshow",
"nltk.corpus.stopwords.words",
"tensorflow.keras.models.Sequential",
"sklearn.metrics.confusion_matrix",
"tens... | [((925, 959), 'pandas.read_csv', 'pd.read_csv', (['"""stock_sentiment.csv"""'], {}), "('stock_sentiment.csv')\n", (936, 959), True, 'import pandas as pd\n'), ((2040, 2066), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (2053, 2066), False, 'import nltk\n'), ((2068, 2094), 'nltk.corpus.... |
from ...isa.inst import *
import numpy as np
class Vwmacc_vv(Inst):
name = 'vwmacc.vv'
# vwmacc.vv vd, vs1, vs2, vm
def golden(self):
if self['vl']==0:
return self['ori']
result = self['ori'].copy()
maskflag = 1 if 'mask' in self else 0
vstart = self['v... | [
"numpy.unpackbits"
] | [((455, 501), 'numpy.unpackbits', 'np.unpackbits', (["self['mask']"], {'bitorder': '"""little"""'}), "(self['mask'], bitorder='little')\n", (468, 501), True, 'import numpy as np\n')] |
import collections
import re
import numpy
import pytest
import random
import time
import nidaqmx
from nidaqmx.constants import (
AcquisitionType, BusType, RegenerationMode)
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.utils import flatten_channel_string
from nidaqmx.tests.fixtures import x_series_devi... | [
"nidaqmx.Task",
"nidaqmx.stream_writers.AnalogUnscaledWriter",
"numpy.zeros",
"pytest.raises",
"pytest.skip"
] | [((859, 899), 'pytest.skip', 'pytest.skip', (['"""Requires a plugin device."""'], {}), "('Requires a plugin device.')\n", (870, 899), False, 'import pytest\n'), ((1031, 1045), 'nidaqmx.Task', 'nidaqmx.Task', ([], {}), '()\n', (1043, 1045), False, 'import nidaqmx\n'), ((1842, 1930), 'nidaqmx.stream_writers.AnalogUnscale... |
import io
import os
import time
import urllib.request
import zipfile
import numpy as np
from scipy.io.wavfile import read as wav_read
from tqdm import tqdm
class dclde:
"""
The high-frequency dataset consists of marked encounters with echolocation
clicks of species commonly found along the US Atlantic Co... | [
"os.path.exists",
"zipfile.ZipFile",
"tqdm.tqdm",
"numpy.asarray",
"io.BytesIO",
"os.path.isdir",
"scipy.io.wavfile.read",
"os.mkdir",
"time.time"
] | [((1646, 1657), 'time.time', 'time.time', ([], {}), '()\n', (1655, 1657), False, 'import time\n'), ((2348, 2396), 'zipfile.ZipFile', 'zipfile.ZipFile', (["(path + 'DCLDE/DCLDE_LF_Dev.zip')"], {}), "(path + 'DCLDE/DCLDE_LF_Dev.zip')\n", (2363, 2396), False, 'import zipfile\n'), ((2469, 2497), 'tqdm.tqdm', 'tqdm', (['f.f... |
#This file will generate functions in polynomials
import numpy as np
import random
import matplotlib.pyplot as plt
class generateFunctions():
#the initial function taking 4 inputs
def __init__(self, x_vector, high_degree_vector, rangeLow, rangeHigh):
#the input processing
self.x_vector = x_vector
self.hi... | [
"numpy.random.randint",
"random.choice"
] | [((710, 788), 'numpy.random.randint', 'np.random.randint', ([], {'low': 'self.rangeLow', 'high': 'self.rangeHigh', 'size': '(highestVar + 1)'}), '(low=self.rangeLow, high=self.rangeHigh, size=highestVar + 1)\n', (727, 788), True, 'import numpy as np\n'), ((872, 901), 'random.choice', 'random.choice', (['allowed_values'... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 15 17:22:01 2020
@author: Kamil
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import morse_decoder
import iir_filter
class RealtimeWindow:
def __init__(self, channel: str):
# create a plot window
se... | [
"matplotlib.animation.FuncAnimation",
"iir_filter.GenerateHighPassCoeff",
"numpy.append",
"numpy.zeros",
"iir_filter.IIRFilter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"morse_decoder.MorseCodeDecoder"
] | [((349, 364), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (361, 364), True, 'import matplotlib.pyplot as plt\n'), ((373, 405), 'matplotlib.pyplot.title', 'plt.title', (['f"""Channel: {channel}"""'], {}), "(f'Channel: {channel}')\n", (382, 405), True, 'import matplotlib.pyplot as plt\n'), ((517... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import numpy as np
MAXLINE = 10000
MAXFRAME = 10000
def read_xyz(xyz,natoms):
#
fopen = open(xyz,'r')
frames = []
for i in range(MAXLINE):
line = fopen.readline()
if line.strip():
assert int(line.strip().split()[0... | [
"os.listdir",
"os.path.join",
"numpy.array",
"numpy.sum",
"os.path.abspath"
] | [((2693, 2726), 'numpy.array', 'np.array', (['lines[2:5]'], {'dtype': 'float'}), '(lines[2:5], dtype=float)\n', (2701, 2726), True, 'import numpy as np\n'), ((2804, 2819), 'numpy.sum', 'np.sum', (['numbers'], {}), '(numbers)\n', (2810, 2819), True, 'import numpy as np\n'), ((3051, 3079), 'numpy.array', 'np.array', (['p... |
# -*- coding: utf-8 -*-
# Copyright (c) 2012, <NAME>
# All rights reserved.
# This file is part of PyDSM.
# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | [
"numpy.testing.assert_equal",
"numpy.arange",
"numpy.array",
"pydsm.delsig.simulateDSM",
"numpy.testing.run_module_suite",
"numpy.load",
"pkg_resources.resource_stream"
] | [((1841, 1859), 'numpy.testing.run_module_suite', 'run_module_suite', ([], {}), '()\n', (1857, 1859), False, 'from numpy.testing import TestCase, run_module_suite\n'), ((1063, 1131), 'pkg_resources.resource_stream', 'resource_stream', (['"""pydsm.delsig"""', '"""tests/Data/test_simulateDSM_0.npz"""'], {}), "('pydsm.del... |
##Clustering script for CaM_Trials##
#clusters using HDBSCAN the last 1 microsecond of simulation
#uses rmsd to native of backbone (excluding flexible tails but including peptide) as distance metric
import mdtraj as md
import numpy as np
import matplotlib.pyplot as plt
import hdbscan
MIN_SAMPLES = 200 #determined fr... | [
"numpy.mean",
"numpy.median",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"numpy.where",
"numpy.sort",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",
"numpy.std",
"numpy.max",
"mdtraj.load_dcd",
"numpy.empty",
"numpy.min",
"mdtraj.rmsd",
"mdtraj.load",
"hdbscan.HDBS... | [((2359, 2382), 'mdtraj.load', 'md.load', (['"""cam_fill.pdb"""'], {}), "('cam_fill.pdb')\n", (2366, 2382), True, 'import mdtraj as md\n'), ((418, 458), 'numpy.empty', 'np.empty', (['(traj.n_frames, traj.n_frames)'], {}), '((traj.n_frames, traj.n_frames))\n', (426, 458), True, 'import numpy as np\n'), ((729, 755), 'num... |
import typing as t
import numpy as np
import pandas as pd
from house_prices_regression_model import __version__ as VERSION
from house_prices_regression_model.processing.data_manager import load_pipeline
from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH
from house_prices_regression_m... | [
"house_prices_regression_model.config.core.load_config_file",
"house_prices_regression_model.processing.data_manager.load_pipeline",
"numpy.exp",
"house_prices_regression_model.processing.data_validation.validate_inputs",
"pandas.DataFrame"
] | [((400, 431), 'house_prices_regression_model.config.core.load_config_file', 'load_config_file', (['SETTINGS_PATH'], {}), '(SETTINGS_PATH)\n', (416, 431), False, 'from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH\n'), ((564, 607), 'house_prices_regression_model.processing.data_manager... |
import numpy as np
from amlearn.utils.basetest import AmLearnTest
from amlearn.utils.data import get_isometric_lists
class test_data(AmLearnTest):
def setUp(self):
pass
def test_get_isometric_lists(self):
test_lists= [[1, 2, 3], [4], [5, 6], [1, 2, 3]]
isometric_lists = \
... | [
"numpy.array",
"amlearn.utils.data.get_isometric_lists"
] | [((320, 381), 'amlearn.utils.data.get_isometric_lists', 'get_isometric_lists', (['test_lists'], {'limit_width': '(80)', 'fill_value': '(0)'}), '(test_lists, limit_width=80, fill_value=0)\n', (339, 381), False, 'from amlearn.utils.data import get_isometric_lists\n'), ((630, 692), 'amlearn.utils.data.get_isometric_lists'... |
import json
import torch
import numpy as np
import os
#from pytorch_pretrained_bert import BertTokenizer
from transformers import BertTokenizer
class BertWordFormatter:
def __init__(self, config, mode):
self.max_question_len = config.getint("data", "max_question_len")
self.max_option_len = config.g... | [
"torch.tensor",
"numpy.array"
] | [((2646, 2691), 'torch.tensor', 'torch.tensor', (['all_input_ids'], {'dtype': 'torch.long'}), '(all_input_ids, dtype=torch.long)\n', (2658, 2691), False, 'import torch\n'), ((2717, 2763), 'torch.tensor', 'torch.tensor', (['all_input_mask'], {'dtype': 'torch.long'}), '(all_input_mask, dtype=torch.long)\n', (2729, 2763),... |
"""A filter block.
"""
import control
import numpy as np
import scipy
from .base import Block
class Filter(Block):
"""A Filter block class
This is simply a single-input-single-output LTI system defined by a
single TransferFunction object.
Parameters
----------
tf : control.TransferFunction
... | [
"numpy.dot",
"numpy.zeros_like",
"scipy.signal.cont2discrete"
] | [((2083, 2112), 'numpy.dot', 'np.dot', (['num_d', 'input_register'], {}), '(num_d, input_register)\n', (2089, 2112), True, 'import numpy as np\n'), ((2130, 2168), 'numpy.dot', 'np.dot', (['den_d[1:]', 'output_register[1:]'], {}), '(den_d[1:], output_register[1:])\n', (2136, 2168), True, 'import numpy as np\n'), ((5163,... |
import pandas as pd
import numpy as np
import xml.etree.ElementTree as ElementTree
from traffic_analysis.d00_utils.bbox_helpers import bboxcv2_to_bboxcvlib
from traffic_analysis.d05_evaluation.parse_annotation import parse_annotation
from traffic_analysis.d05_evaluation.compute_mean_average_precision import get_avg_p... | [
"traffic_analysis.d00_utils.bbox_helpers.bboxcv2_to_bboxcvlib",
"numpy.mean",
"traffic_analysis.d05_evaluation.parse_annotation.parse_annotation",
"xml.etree.ElementTree.parse",
"pandas.merge",
"pandas.DataFrame.from_dict",
"traffic_analysis.d05_evaluation.compute_mean_average_precision.get_avg_precisio... | [((781, 797), 'pandas.DataFrame', 'pd.DataFrame', (['{}'], {}), '({})\n', (793, 797), True, 'import pandas as pd\n'), ((831, 847), 'pandas.DataFrame', 'pd.DataFrame', (['{}'], {}), '({})\n', (843, 847), True, 'import pandas as pd\n'), ((2556, 2594), 'pandas.concat', 'pd.concat', (['frame_level_map_dfs'], {'axis': '(0)'... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2021, Trustworthy AI, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list ... | [
"geometry_msgs.msg.Vector3",
"geometry_msgs.msg.Twist",
"math.radians",
"geometry_msgs.msg.Transform",
"numpy.array",
"geometry_msgs.msg.Point",
"geometry_msgs.msg.Quaternion",
"tf.transformations.quaternion_from_euler",
"tf.transformations.euler_matrix",
"geometry_msgs.msg.Accel",
"geometry_msg... | [((2477, 2545), 'numpy.array', 'numpy.array', (['[carla_location.x, -carla_location.y, carla_location.z]'], {}), '([carla_location.x, -carla_location.y, carla_location.z])\n', (2488, 2545), False, 'import numpy\n'), ((2962, 2971), 'geometry_msgs.msg.Vector3', 'Vector3', ([], {}), '()\n', (2969, 2971), False, 'from geom... |
import numpy as np
class KNearestNeighbors:
def __init__(self, distances, labels, k=10):
self.distances = distances
self.labels = labels
self.k = k
def _kNN(self, instance, train, k):
nearest = np.argpartition(self.distances[instance][train], k)
nearest_labels = self.... | [
"numpy.argmax",
"numpy.zeros",
"numpy.unique",
"numpy.argpartition"
] | [((238, 289), 'numpy.argpartition', 'np.argpartition', (['self.distances[instance][train]', 'k'], {}), '(self.distances[instance][train], k)\n', (253, 289), True, 'import numpy as np\n'), ((372, 417), 'numpy.unique', 'np.unique', (['nearest_labels'], {'return_counts': '(True)'}), '(nearest_labels, return_counts=True)\n... |
# coding: utf-8
# In[1]:
from path import Path
from matplotlib import pyplot as plt
import numpy as np
import skimage.io as io
import os
from PIL import Image
import cv2
import random
import shutil
def crop_by_sequence(image_path,img_class_path,crop_size_w,crop_size_h,prefix,save_dir ,same_scale = False):
... | [
"cv2.imwrite",
"shutil.move",
"path.Path",
"skimage.io.imread",
"numpy.random.randint",
"numpy.zeros",
"os.mkdir"
] | [((703, 728), 'skimage.io.imread', 'io.imread', (['img_class_path'], {}), '(img_class_path)\n', (712, 728), True, 'import skimage.io as io\n'), ((3340, 3365), 'skimage.io.imread', 'io.imread', (['img_class_path'], {}), '(img_class_path)\n', (3349, 3365), True, 'import skimage.io as io\n'), ((3576, 3624), 'numpy.random.... |
import copy
import logging
import torch
import numpy as np
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
log = logging.getLogger(__name__)
def balanced_batches(dataset, batch_size):
unlabled_idx = dataset.unlabeled_idx
labeled_idx = list(filter(lambda _: _ not in unlab... | [
"logging.getLogger",
"copy.deepcopy",
"numpy.random.choice",
"torch.LongTensor",
"torch.stack",
"numpy.array_split",
"numpy.array",
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor"
] | [((152, 179), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (169, 179), False, 'import logging\n'), ((411, 432), 'numpy.array', 'np.array', (['labeled_idx'], {}), '(labeled_idx)\n', (419, 432), True, 'import numpy as np\n'), ((590, 629), 'numpy.array_split', 'np.array_split', (['unlabled... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... | [
"numpy.abs",
"mvpa2.clfs.gnb.GNB",
"numpy.exp",
"numpy.sum",
"mvpa2.generators.splitters.Splitter"
] | [((712, 717), 'mvpa2.clfs.gnb.GNB', 'GNB', ([], {}), '()\n', (715, 717), False, 'from mvpa2.clfs.gnb import GNB\n'), ((735, 761), 'mvpa2.clfs.gnb.GNB', 'GNB', ([], {'common_variance': '(False)'}), '(common_variance=False)\n', (738, 761), False, 'from mvpa2.clfs.gnb import GNB\n'), ((778, 797), 'mvpa2.clfs.gnb.GNB', 'GN... |
"""
amplitude.py
measure the maximum peak-to-peak amplitude
"""
import obspy
import types
import numpy as np
import pandas as pd
import madpy.noise as n
from typing import Tuple
import madpy.checks as ch
import madpy.config as config
import matplotlib.pyplot as plt
import madpy.plotting.amp as plot
def measure_ampl... | [
"numpy.abs",
"madpy.noise.arrival_time_utc",
"madpy.checks.check_amplitude",
"madpy.noise.rms_noise",
"numpy.divide",
"numpy.where",
"madpy.checks.check_window",
"numpy.diff",
"numpy.subtract",
"madpy.plotting.amp.amplitude_plot",
"numpy.array",
"numpy.isnan",
"pandas.DataFrame",
"numpy.na... | [((1808, 1829), 'madpy.checks.check_waveform', 'ch.check_waveform', (['tr'], {}), '(tr)\n', (1825, 1829), True, 'import madpy.checks as ch\n'), ((2460, 2474), 'numpy.diff', 'np.diff', (['peaks'], {}), '(peaks)\n', (2467, 2474), True, 'import numpy as np\n'), ((2538, 2561), 'madpy.checks.check_amplitude', 'ch.check_ampl... |
####################################################
####################################################
# functions and classes used in conjunction with
# pipeline_metaomics.py
####################################################
####################################################
# import libraries
import sys
impo... | [
"numpy.mean",
"CGATPipelines.Pipeline.run",
"sqlite3.connect",
"CGATPipelines.Pipeline.snip",
"itertools.product",
"CGATPipelines.Pipeline.getTempFilename",
"os.unlink",
"os.path.basename",
"pandas.DataFrame",
"CGAT.IOTools.openFile",
"rpy2.robjects.r"
] | [((2859, 2881), 'sqlite3.connect', 'sqlite3.connect', (['rnadb'], {}), '(rnadb)\n', (2874, 2881), False, 'import sqlite3\n'), ((2926, 2948), 'sqlite3.connect', 'sqlite3.connect', (['dnadb'], {}), '(dnadb)\n', (2941, 2948), False, 'import sqlite3\n'), ((4401, 4420), 'sqlite3.connect', 'sqlite3.connect', (['db'], {}), '(... |
# Third-party
import astropy.units as u
import numpy as np
import pymc3 as pm
from pymc3.distributions import generate_samples
import aesara_theano_fallback.tensor as tt
import exoplanet.units as xu
__all__ = ['UniformLog', 'FixedCompanionMass']
class UniformLog(pm.Continuous):
def __init__(self, a, b, **kwargs... | [
"numpy.sqrt",
"numpy.log",
"aesara_theano_fallback.tensor.as_tensor_variable",
"numpy.zeros",
"numpy.random.uniform",
"pymc3.distributions.generate_samples",
"astropy.units.quantity_input"
] | [((1908, 1973), 'astropy.units.quantity_input', 'u.quantity_input', ([], {'sigma_K0': '(u.km / u.s)', 'P0': 'u.day', 'max_K': '(u.km / u.s)'}), '(sigma_K0=u.km / u.s, P0=u.day, max_K=u.km / u.s)\n', (1924, 1973), True, 'import astropy.units as u\n'), ((945, 973), 'numpy.random.uniform', 'np.random.uniform', ([], {'size... |
import cv2
import numpy as np
from PyQt5.QtGui import QIntValidator
from PyQt5.QtWidgets import QDialog
from PyQt5.uic import loadUi
from utils import processing_utils as utils
IMAGE_DESCRIPT_DIALOG_UI = 'coreUI/image_description_dialog.ui'
class ImageDescriptionDialog(QDialog):
"""Image Description Dialog Windo... | [
"PyQt5.QtGui.QIntValidator",
"PyQt5.uic.loadUi",
"utils.processing_utils.display_img",
"cv2.filter2D",
"numpy.sum"
] | [((420, 458), 'PyQt5.uic.loadUi', 'loadUi', (['IMAGE_DESCRIPT_DIALOG_UI', 'self'], {}), '(IMAGE_DESCRIPT_DIALOG_UI, self)\n', (426, 458), False, 'from PyQt5.uic import loadUi\n'), ((1016, 1061), 'utils.processing_utils.display_img', 'utils.display_img', (['image', 'self.imageViewLabel'], {}), '(image, self.imageViewLab... |
# -*- coding: utf-8 -*-
import os
os.environ['DJANGO_SETTINGS_MODULE']='settings'
from logistic import logisticdb
import webapp2 as webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
import numpy as np
import cgi
import cgitb
cgitb.enable()
def lesl... | [
"cgi.FieldStorage",
"os.path.dirname",
"numpy.dot",
"numpy.zeros",
"google.appengine.ext.webapp.util.run_wsgi_app",
"webapp2.WSGIApplication",
"cgitb.enable",
"google.appengine.ext.webapp.template.render"
] | [((291, 305), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (303, 305), False, 'import cgitb\n'), ((4709, 4772), 'webapp2.WSGIApplication', 'webapp.WSGIApplication', (["[('/.*', leslieOutputPage)]"], {'debug': '(True)'}), "([('/.*', leslieOutputPage)], debug=True)\n", (4731, 4772), True, 'import webapp2 as webapp\n... |
import time
import os
import arcade
import argparse
import gym
from gym import spaces
import swarm_env
import numpy as np
import random
import sys
sys.path.insert(0, '..')
from objects import SwarmSimulator
# Running experiment 22 in standalone file.
def experiment_runner(SWARM_SIZE = 15, ARENA_WIDTH = 600, ARENA_HEI... | [
"random.uniform",
"sys.path.insert",
"random.randint",
"numpy.argmax",
"numpy.max",
"numpy.exp",
"numpy.zeros",
"os.path.isdir",
"os.mkdir",
"arcade.run",
"objects.SwarmSimulator",
"time.time",
"gym.make"
] | [((147, 171), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (162, 171), False, 'import sys\n'), ((352, 363), 'time.time', 'time.time', ([], {}), '()\n', (361, 363), False, 'import time\n'), ((1595, 1638), 'gym.make', 'gym.make', (['"""humanswarm-v0"""'], {'maze_size': 'GRID_X'}), "('hu... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import numpy as np
class DMatrix:
def __init__(self, data_arr, missing={np.nan, 0}):
"""
:param data_arr: 样本特征 (不含标签)
:param missing: 缺失值的集合, 若特征值在此集合中, 则认为其为缺失值
"""
# N 样本总个数( 包含缺出现缺失值的样本 )
# m 特征的总数
self.N, sel... | [
"numpy.shape"
] | [((326, 344), 'numpy.shape', 'np.shape', (['data_arr'], {}), '(data_arr)\n', (334, 344), True, 'import numpy as np\n')] |
import os
from glob import glob
import tensorflow as tf
from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array, load_img
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.layers import Conv2D,... | [
"tensorflow.keras.applications.mobilenet_v2.MobileNetV2",
"os.path.dirname",
"glob.glob",
"tensorflow.keras.applications.mobilenet_v2.preprocess_input",
"numpy.expand_dims",
"tensorflow.keras.models.Model",
"cv2.resize",
"cv2.imread",
"numpy.save"
] | [((816, 865), 'tensorflow.keras.applications.mobilenet_v2.MobileNetV2', 'MobileNetV2', ([], {'weights': '"""imagenet"""', 'include_top': '(True)'}), "(weights='imagenet', include_top=True)\n", (827, 865), False, 'from tensorflow.keras.applications.mobilenet_v2 import MobileNetV2, preprocess_input\n'), ((906, 974), 'ten... |
import argparse
import matplotlib.pyplot as plt
import meshcut
import numpy as np
import pandas
import seaborn as sns
import pandas as pd
import sys, os
import math
#from scipy.stats import norm
SAVE_PATH = os.path.join(os.path.expanduser("~"),'PycharmProjects/Gibson_Exercise/examples/plot_result/')
WAY_PATH = os.path... | [
"matplotlib.pyplot.grid",
"argparse.ArgumentParser",
"matplotlib.pyplot.ylabel",
"meshcut.cross_section",
"matplotlib.pyplot.xlabel",
"numpy.absolute",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"os.path.join",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.mi... | [((221, 244), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (239, 244), False, 'import sys, os\n'), ((326, 349), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (344, 349), False, 'import sys, os\n'), ((705, 720), 'numpy.array', 'np.array', (['verts'], {}), '(verts)... |
"""A module for the uFJC single-chain model in the isometric ensemble.
This module consist of the class ``uFJCIsometric`` which contains
methods for computing single-chain quantities
in the isometric (constant end-to-end vector) thermodynamic ensemble.
Example:
Import and instantiate the class:
... | [
"numpy.log",
"numpy.linalg.norm"
] | [((11454, 11494), 'numpy.linalg.norm', 'la.norm', (['(config[j, :] - config[j - 1, :])'], {}), '(config[j, :] - config[j - 1, :])\n', (11461, 11494), True, 'import numpy.linalg as la\n'), ((10199, 10234), 'numpy.log', 'np.log', (['(1 + eta * coth / self.kappa)'], {}), '(1 + eta * coth / self.kappa)\n', (10205, 10234), ... |
"""
Plot various visualizations
"""
import sys
import json
from collections import Counter
import numpy as np
import scipy.stats as scstats
import matplotlib
matplotlib.use("agg")
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.patches as mp
from zipteedo.util import GzipFileType, load... | [
"zipteedo.stats.make_bias_table",
"matplotlib.pyplot.ylabel",
"numpy.polyfit",
"zipteedo.util.first",
"numpy.array",
"zipteedo.stats.get_correlations",
"matplotlib.pyplot.errorbar",
"sys.exit",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"zipteedo.viz.violi... | [((160, 181), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (174, 181), False, 'import matplotlib\n'), ((1343, 1365), 'zipteedo.stats.get_correlations', 'get_correlations', (['data'], {}), '(data)\n', (1359, 1365), False, 'from zipteedo.stats import get_correlations, get_data_efficiencies, make_... |
#!/usr/bin/env python3
import statistics
import os
import glob
from tkinter import filedialog
from tkinter import * # noqa
import pandas as pd
from eventcodes import eventcodes_dictionary
from natsort import natsorted, ns
import matplotlib.pyplot as plt
import numpy as np
import datetime
__all__ = ["loop_over_days",... | [
"statistics.mean",
"tkinter.filedialog.askdirectory",
"pandas.read_csv",
"datetime.datetime.strptime",
"numpy.delete",
"matplotlib.pyplot.xlabel",
"os.path.join",
"pandas.DataFrame.from_dict",
"matplotlib.pyplot.figure",
"glob.glob",
"natsort.natsorted",
"pandas.to_numeric",
"pandas.DataFram... | [((4274, 4307), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'column_list'}), '(columns=column_list)\n', (4286, 4307), True, 'import pandas as pd\n'), ((5395, 5428), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'column_list'}), '(columns=column_list)\n', (5407, 5428), True, 'import pandas as pd\n'), ((7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.