code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import unittest
import numpy as np
from rastervision.core.raster_transformer import RasterTransformer
from rastervision.core.raster_stats import RasterStats
class TestRasterTransformer(unittest.TestCase):
def test_no_channel_order_no_stats(self):
transformer = RasterTransformer()
chip = np.ones(... | [
"unittest.main",
"rastervision.core.raster_transformer.RasterTransformer",
"numpy.ones",
"numpy.array",
"numpy.testing.assert_equal",
"rastervision.core.raster_stats.RasterStats"
] | [((2581, 2596), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2594, 2596), False, 'import unittest\n'), ((277, 296), 'rastervision.core.raster_transformer.RasterTransformer', 'RasterTransformer', ([], {}), '()\n', (294, 296), False, 'from rastervision.core.raster_transformer import RasterTransformer\n'), ((403, ... |
# Regresion polinomial
import matplotlib.pyplot as plt
import numpy as np
def createMatrix(m,n, valor=0):
C = []
for i in range(m):
C.append([]) #could be c.append([valor]*n)
for j in range(n):
C[i].append(valor)
return C
def getDimensions(A):
ret... | [
"numpy.linspace",
"numpy.asarray",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot"
] | [((3884, 3904), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y', '"""rx"""'], {}), "(x, y, 'rx')\n", (3892, 3904), True, 'import matplotlib.pyplot as plt\n'), ((4017, 4040), 'numpy.linspace', 'np.linspace', (['(5)', '(35)', '(100)'], {}), '(5, 35, 100)\n', (4028, 4040), True, 'import numpy as np\n'), ((4067, 4083), 'm... |
"""
The environment for grasp exploration. Defines states, actions, rewards
and steps forward based on the reward and toppling transitions.
"""
import numpy as np
class StablePoseEnv(object):
def __init__(self,
arm_means,
pose_probs,
topple_matrix):
sel... | [
"numpy.random.random",
"numpy.arange"
] | [((606, 631), 'numpy.arange', 'np.arange', (['self.num_poses'], {}), '(self.num_poses)\n', (615, 631), True, 'import numpy as np\n'), ((811, 829), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (827, 829), True, 'import numpy as np\n'), ((1042, 1067), 'numpy.arange', 'np.arange', (['self.num_poses'], {}),... |
import collections
import copy
from logging import getLogger
import torch
from torch import nn
from torch.nn import functional as F
import numpy as np
from pfrl.agent import AttributeSavingMixin
from pfrl.agent import BatchAgent
from pfrl.utils.batch_states import batch_states
from pfrl.utils.contexts import evaluati... | [
"copy.deepcopy",
"pfrl.utils.copy_param.synchronize_parameters",
"torch.nn.ModuleList",
"collections.deque",
"torch.nn.functional.mse_loss",
"pfrl.replay_buffer.batch_experiences",
"pfrl.utils.contexts.evaluating",
"pfrl.replay_buffer.ReplayUpdater",
"numpy.mean",
"torch.cuda.is_available",
"tor... | [((584, 595), 'numpy.mean', 'np.mean', (['xs'], {}), '(xs)\n', (591, 595), True, 'import numpy as np\n'), ((3051, 3070), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (3060, 3070), False, 'from logging import getLogger\n'), ((3169, 3200), 'torch.nn.ModuleList', 'nn.ModuleList', (['[policy, q_fun... |
""" Module for calculations related to FRB experiments
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
from pkg_resources import resource_filename
from astropy import units as u
from frb import utils
class Experiment(object):
"""
"""
def __init... | [
"frb.utils.Tsky",
"numpy.sqrt",
"frb.utils.loadyaml"
] | [((743, 773), 'frb.utils.loadyaml', 'utils.loadyaml', (['self.data_file'], {}), '(self.data_file)\n', (757, 773), False, 'from frb import utils\n'), ((1633, 1696), 'numpy.sqrt', 'np.sqrt', (['(frb.Wi ** 2 + t_chan ** 2 + t_samp ** 2 + t_scatt ** 2)'], {}), '(frb.Wi ** 2 + t_chan ** 2 + t_samp ** 2 + t_scatt ** 2)\n', (... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
from scipy.optimize import curve_fit
from pylab import cm as plcm # colors for plotting
import pickle # for storing calculations and reading again while editing plot details
import math
import random... | [
"matplotlib.pyplot.show",
"random.randint",
"matplotlib.pyplot.plot",
"numpy.copy",
"numpy.abs",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.rcParams.update",
"scipy.stats.sem",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((349, 387), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (368, 387), True, 'import matplotlib.pyplot as plt\n'), ((954, 978), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1)'], {}), '((n + 1, n + 1))\n', (962, 978), True, 'import numpy as np\n'), ((127... |
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as interpolate
from scipy.optimize import curve_fit
import sys
class AsymmetricData:
def __init__(self, mu=10.0, sigma_n=1.0, sigma_p=1.0, N=10000, confidence=1.0, creation_type='by_constructor', data=[]):
"""
:param mu: M... | [
"matplotlib.pyplot.clf",
"numpy.exp",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.axvline",
"numpy.append",
"numpy.linspace",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"numpy.asarray",
"matplotlib.pyplot.legend",
"scipy.optimize.curve_fit",
"matplo... | [((5218, 5232), 'numpy.asarray', 'np.asarray', (['[]'], {}), '([])\n', (5228, 5232), True, 'import numpy as np\n'), ((5431, 5499), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['self.x_values', 'self.cdf_values'], {'kind': '"""nearest"""'}), "(self.x_values, self.cdf_values, kind='nearest')\n", (5451, 5499), ... |
from ..utils import *
from ..motion import blockMotion
import numpy as np
import scipy.ndimage
import scipy.fftpack
import scipy.stats
import scipy.io
import sys
from os.path import dirname
from os.path import join
def motion_feature_extraction(frames):
# setup
frames = frames.astype(np.float32)
mblock=10... | [
"numpy.zeros_like",
"numpy.abs",
"os.path.join",
"numpy.log",
"numpy.std",
"os.path.dirname",
"numpy.zeros",
"numpy.var",
"numpy.hstack",
"numpy.linalg.eig",
"numpy.mean",
"numpy.array",
"numpy.int",
"numpy.arange",
"numpy.dot",
"numpy.cov",
"numpy.linalg.pinv",
"numpy.sqrt"
] | [((588, 699), 'numpy.zeros', 'np.zeros', (['(motion_vectors.shape[0], motion_vectors.shape[1], motion_vectors.shape[2], 2)'], {'dtype': 'np.float32'}), '((motion_vectors.shape[0], motion_vectors.shape[1], motion_vectors.\n shape[2], 2), dtype=np.float32)\n', (596, 699), True, 'import numpy as np\n'), ((1905, 1923), ... |
import numpy as np
from numpy.random import binomial, multivariate_normal, uniform
from sklearn.model_selection import train_test_split
from ylearn.utils import to_df
TRAIN_SIZE = 1000
TEST_SIZE = 200
ADJUSTMENT_COUNT = 5
COVARIATE_COUNT = 3
def generate_variates(n, d):
return multivariate_normal(np.zeros(d), n... | [
"numpy.random.uniform",
"numpy.vectorize",
"numpy.random.binomial",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"numpy.searchsorted",
"ylearn.utils.to_df",
"numpy.ones",
"numpy.array",
"numpy.random.normal",
"numpy.dot"
] | [((1350, 1398), 'numpy.vectorize', 'np.vectorize', (['fn_treatment'], {'signature': '"""(n)->(m)"""'}), "(fn_treatment, signature='(n)->(m)')\n", (1362, 1398), True, 'import numpy as np\n'), ((1481, 1531), 'numpy.vectorize', 'np.vectorize', (['fn_outcome'], {'signature': '"""(n),(m)->(k)"""'}), "(fn_outcome, signature=... |
"""
Molecule class designed for RESP Optimization
"""
import os, sys, copy
import numpy as np
import re
from collections import OrderedDict
from warnings import warn
try:
import openeye.oechem as oechem
except ImportError:
warn(' The Openeye module cannot be imported. ( Please provide equivGoups and listofpol... | [
"copy.deepcopy",
"openeye.oechem.OEPerceiveSymmetry",
"os.getcwd",
"respyte.readinp_resp.Input",
"openeye.oechem.OEAssignHybridization",
"openeye.oechem.oemolistream",
"openeye.oechem.OEGraphMol",
"os.path.isfile",
"openeye.oechem.OEMol",
"numpy.array",
"pathlib.Path",
"openeye.oechem.OEReadMo... | [((37108, 37119), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (37117, 37119), False, 'import os, sys, copy\n'), ((37153, 37188), 'respyte.readinp_resp.Input', 'Input', (["('%s/input/respyte.yml' % cwd)"], {}), "('%s/input/respyte.yml' % cwd)\n", (37158, 37188), False, 'from respyte.readinp_resp import Input\n'), ((233,... |
import pandas as pd
import numpy as np
import re
from tensorflow import keras
from sklearn.feature_extraction.text import TfidfVectorizer
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
import codecs
def read_glove_vecs(glove_file):
with... | [
"pandas.DataFrame",
"tensorflow.keras.preprocessing.text.Tokenizer",
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.zeros",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"numpy.array",
"re.sub"
] | [((1220, 1265), 'pandas.DataFrame', 'pd.DataFrame', (['doc_list'], {'columns': "['documents']"}), "(doc_list, columns=['documents'])\n", (1232, 1265), True, 'import pandas as pd\n'), ((1527, 1538), 'tensorflow.keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (1536, 1538), False, 'from tensorflow.kera... |
import os
import json
import numpy as np
from numpy.testing import assert_array_almost_equal
from nose import with_setup
from nose.tools import assert_equal, assert_not_equal, assert_true
import nibabel
from nilearn.datasets import utils
from nilearn.datasets.tests import test_utils as tst
from nilearn._utils.niimg_con... | [
"os.mkdir",
"json.dump",
"sammba.data_fetchers.atlas.fetch_atlas_waxholm_rat_2014",
"nibabel.load",
"nilearn._utils.niimg_conversions.check_niimg",
"sammba.data_fetchers.atlas.fetch_masks_dorr_2008",
"os.path.dirname",
"numpy.dtype",
"numpy.zeros",
"nilearn.datasets.tests.test_utils.setup_mock",
... | [((548, 585), 'nose.with_setup', 'with_setup', (['setup_mock', 'teardown_mock'], {}), '(setup_mock, teardown_mock)\n', (558, 585), False, 'from nose import with_setup\n'), ((587, 638), 'nose.with_setup', 'with_setup', (['tst.setup_tmpdata', 'tst.teardown_tmpdata'], {}), '(tst.setup_tmpdata, tst.teardown_tmpdata)\n', (5... |
# encoding: utf-8
"""
Description: A python 2.7 implementation of gcForest proposed in [1]. A demo implementation of gcForest library as well as some demo client scripts to demostrate how to use the code. The implementation is flexible enough for modifying the model or
fit your own datasets.
Reference: [1] <NAME> and ... | [
"keras.preprocessing.sequence.pad_sequences",
"numpy.zeros",
"numpy.bincount",
"sklearn.feature_extraction.text.TfidfTransformer",
"keras.datasets.imdb.load_data"
] | [((1462, 1499), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'nb_words': 'max_features'}), '(nb_words=max_features)\n', (1476, 1499), False, 'from keras.datasets import imdb\n'), ((1565, 1674), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'nb_words': 'None', 'skip_top': '(0)', 'maxlen': 'None', ... |
import runway
import tensorflow as tf
import numpy as np
import sys
import json
import sys
import os
from glob import glob
from lm.modeling import GroverModel, GroverConfig, _top_p_sample, sample
from sample.encoder import get_encoder, format_context, _tokenize_article_pieces, extract_generated_target
import argparse... | [
"runway.run",
"argparse.ArgumentParser",
"numpy.ceil",
"tensorflow.train.Saver",
"os.path.join",
"numpy.ones",
"lm.modeling.sample",
"sample.encoder.extract_generated_target",
"tensorflow.ConfigProto",
"tensorflow.placeholder",
"numpy.array",
"tensorflow.InteractiveSession",
"sample.encoder.... | [((331, 447), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Contextual generation (aka given some metadata we will generate articles"""'}), "(description=\n 'Contextual generation (aka given some metadata we will generate articles')\n", (354, 447), False, 'import argparse\n'), ((2239... |
# Project hiatus
# script used to evaluate our models and analyse the results
# 16/11/2020
# <NAME>
# loading required packages
import os
import numpy as np
from sklearn.model_selection import train_test_split
from torch.utils.data import Subset
import torch
from sklearn.linear_model import LinearRegression
import skl... | [
"utils.visualize",
"evaluate.evaluate_model",
"frejus_dataset.get_datasets",
"utils.set_seed",
"evaluate.generate_prediction_baseline",
"sklearn.metrics.r2_score",
"utils.load_model_from_dict",
"metrics.svm_accuracy_estimation_2",
"utils.change_detection",
"utils.scatter_aleo",
"evaluate.generat... | [((436, 499), 'os.chdir', 'os.chdir', (['"""/home/adminlocal/Bureau/GIT/hiatus_change_detection"""'], {}), "('/home/adminlocal/Bureau/GIT/hiatus_change_detection')\n", (444, 499), False, 'import os\n'), ((648, 681), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (671, 681)... |
import numpy as np
class RosToRave(object):
"take in ROS joint_states messages and use it to update an openrave robot"
def __init__(self, robot, ros_names):
self.initialized = False
self.ros_names = ros_names
inds_ros2rave = np.array([robot.GetJointIndex(name) for na... | [
"numpy.flatnonzero"
] | [((372, 407), 'numpy.flatnonzero', 'np.flatnonzero', (['(inds_ros2rave != -1)'], {}), '(inds_ros2rave != -1)\n', (386, 407), True, 'import numpy as np\n')] |
from keras.models import Sequential
from keras.layers import Conv2D,MaxPool2D
from keras.layers import Activation,Dropout,Flatten,Dense
from keras.callbacks import EarlyStopping
from keras.models import model_from_json
from keras.models import load_model
import numpy as np
import csv
import cv2
import os
from keras.cal... | [
"csv.reader",
"keras.callbacks.ModelCheckpoint",
"cv2.cvtColor",
"keras.layers.Dropout",
"os.walk",
"keras.layers.MaxPool2D",
"keras.layers.Flatten",
"cv2.imread",
"keras.callbacks.EarlyStopping",
"numpy.array",
"keras.layers.Conv2D",
"keras.layers.Dense",
"keras.models.Sequential",
"os.pa... | [((1303, 1325), 'csv.reader', 'csv.reader', (['input_file'], {}), '(input_file)\n', (1313, 1325), False, 'import csv\n'), ((1957, 1990), 'os.walk', 'os.walk', (['"""./normalsVsAbnormalsV1"""'], {}), "('./normalsVsAbnormalsV1')\n", (1964, 1990), False, 'import os\n'), ((2625, 2641), 'numpy.array', 'np.array', (['x_data'... |
import numpy as np
import tensorflow as tf
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = '1'
""" This file is trying to simulate the Rayleigh channel without any channel information"""
tf.set_rando... | [
"numpy.random.seed",
"matplotlib.pyplot.clf",
"tensorflow.train.AdamOptimizer",
"tensorflow.matmul",
"matplotlib.pyplot.figure",
"numpy.imag",
"numpy.tile",
"numpy.random.normal",
"matplotlib.pyplot.gca",
"tensorflow.sqrt",
"matplotlib.pyplot.xlabel",
"os.path.exists",
"tensorflow.concat",
... | [((61, 82), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (75, 82), False, 'import matplotlib\n'), ((308, 331), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(100)'], {}), '(100)\n', (326, 331), True, 'import tensorflow as tf\n'), ((332, 351), 'numpy.random.seed', 'np.random.seed', (['(... |
# <markdowncell> Import scipy.io for matlab loading, numpy and teneto
# <codecell>
import scipy.io as sio
import scipy.stats as sps
import numpy as np
import teneto
import matplotlib.pyplot as plt
import plot_surf
import pandas as pd
import os
import markdown2
import tenetostats
coord = sio.matlab.loadmat('./data/coo... | [
"numpy.load",
"numpy.random.seed",
"scipy.io.matlab.loadmat",
"scipy.io.loadmat",
"pandas.read_csv",
"numpy.argsort",
"numpy.around",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.pyplot.tight_layout",
"tenetostats.shufflegroups",
"pandas.concat",
"teneto.misc.correct_pvalues_for_mul... | [((465, 512), 'numpy.array', 'np.array', (['[1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13]'], {}), '([1, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13])\n', (473, 512), True, 'import numpy as np\n'), ((512, 587), 'numpy.array', 'np.array', (["['SM', 'CO', 'AU', 'DM', 'V', 'FP', 'SA', 'Sub', 'VA', 'DA', 'U']"], {}), "(['SM', 'CO', 'AU', 'DM'... |
import libpclproc
import numpy
a = numpy.zeros((3,3,3),dtype='float32')
a[0,1,2] = 5
a[1,1,2] = 7
a[2,1,2] = 9
libpclproc.process(a)
| [
"numpy.zeros",
"libpclproc.process"
] | [((36, 75), 'numpy.zeros', 'numpy.zeros', (['(3, 3, 3)'], {'dtype': '"""float32"""'}), "((3, 3, 3), dtype='float32')\n", (47, 75), False, 'import numpy\n'), ((113, 134), 'libpclproc.process', 'libpclproc.process', (['a'], {}), '(a)\n', (131, 134), False, 'import libpclproc\n')] |
# -*- coding: utf-8 -*-
import copy
import os
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def generate(x, y):
return [[0 for _ in range(x)] for _ in range(y)]
def get_new_piece(matrix, piece_size):
piece = []
for x in range(x_length):
for y in range(y_l... | [
"copy.deepcopy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"random.shuffle",
"random.random",
"numpy.where",
"numpy.array",
"matplotlib.pyplot.tight_layout"
] | [((1170, 1236), 'matplotlib.pyplot.imshow', 'plt.imshow', (['matrix'], {'interpolation': '"""nearest"""', 'cmap': 'plt.cm.gist_ncar'}), "(matrix, interpolation='nearest', cmap=plt.cm.gist_ncar)\n", (1180, 1236), True, 'import matplotlib.pyplot as plt\n'), ((1378, 1396), 'matplotlib.pyplot.tight_layout', 'plt.tight_layo... |
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from light_bulb import Camera, Controls, Lighting
import math
import numpy as np
curve = np.array([
[2, 2, 0], [1, 1, 0], [1, -1, 0], [2, -2, 0]
])
black_down_tip = np.array([
[1, -1, 0], [1, -.9, 0], [2, -.1, 0]
])
... | [
"pygame.quit",
"math.sqrt",
"pygame.event.get",
"pygame.display.set_mode",
"numpy.zeros",
"pygame.init",
"light_bulb.Camera",
"pygame.display.flip",
"pygame.time.wait",
"math.sin",
"numpy.array",
"light_bulb.Controls",
"math.cos",
"light_bulb.Lighting"
] | [((184, 240), 'numpy.array', 'np.array', (['[[2, 2, 0], [1, 1, 0], [1, -1, 0], [2, -2, 0]]'], {}), '([[2, 2, 0], [1, 1, 0], [1, -1, 0], [2, -2, 0]])\n', (192, 240), True, 'import numpy as np\n'), ((265, 315), 'numpy.array', 'np.array', (['[[1, -1, 0], [1, -0.9, 0], [2, -0.1, 0]]'], {}), '([[1, -1, 0], [1, -0.9, 0], [2,... |
import numpy as np
from sklearn.neural_network import MLPClassifier
from vnpy.app.cta_strategy import (ArrayManager, BarData)
from vnpy.trader.constant import Direction
import joblib
from keras.models import load_model
from sklearn.preprocessing import MinMaxScaler
class LSTM_Analyze(ArrayManager):
def __init__(... | [
"keras.models.load_model",
"joblib.load",
"sklearn.preprocessing.MinMaxScaler",
"numpy.array"
] | [((389, 410), 'keras.models.load_model', 'load_model', (['"""LSTM.h5"""'], {}), "('LSTM.h5')\n", (399, 410), False, 'from keras.models import load_model\n'), ((620, 654), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (632, 654), False, 'from sklearn... |
#!/usr/bin/env python
##############################################
# Author: <NAME>
# Check all features permutations
##############################################
import itertools
import numpy as np
import pandas as pd
import os
from Models.NeuralNetwork import NeuralNetwork
path = os.path.dirname... | [
"os.path.abspath",
"pandas.DataFrame.from_dict",
"pandas.read_csv",
"Models.NeuralNetwork.NeuralNetwork",
"numpy.array",
"os.path.join"
] | [((459, 497), 'os.path.join', 'os.path.join', (['path', 'features_file_name'], {}), '(path, features_file_name)\n', (471, 497), False, 'import os\n'), ((513, 539), 'pandas.read_csv', 'pd.read_csv', (['features_file'], {}), '(features_file)\n', (524, 539), True, 'import pandas as pd\n'), ((2210, 2257), 'pandas.DataFrame... |
# Copyright <NAME> 2018.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.formula.api as sm
class RPSTr... | [
"pandas.DataFrame",
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.copy",
"numpy.eye",
"numpy.argmax",
"matplotlib.pyplot.legend",
"numpy.zeros",
"statsmodels.formula.api.ols",
"numpy.array",
"numpy.random.random",
"numpy.dot",
"matplotlib.pyplot.ylabel",
"matp... | [((2435, 2464), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'columns'}), '(columns=columns)\n', (2447, 2464), True, 'import pandas as pd\n'), ((2725, 2747), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['columns[0]'], {}), '(columns[0])\n', (2735, 2747), True, 'import matplotlib.pyplot as plt\n'), ((2752, 2779),... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
os.chdir('C:/Users/DELL/Desktop/Quant_macro/Pset2')
df = pd.read_excel('download_all.xls')
date = df.ix[4,'Unnamed: 1':]
dates = [np.float(da) for da in date[1:]]
dat = []
dat.append(dates[0])
for idx, dats in enumerate(dates):... | [
"numpy.float",
"pandas.read_excel",
"numpy.array",
"matplotlib.pyplot.subplots",
"os.chdir"
] | [((85, 136), 'os.chdir', 'os.chdir', (['"""C:/Users/DELL/Desktop/Quant_macro/Pset2"""'], {}), "('C:/Users/DELL/Desktop/Quant_macro/Pset2')\n", (93, 136), False, 'import os\n'), ((143, 176), 'pandas.read_excel', 'pd.read_excel', (['"""download_all.xls"""'], {}), "('download_all.xls')\n", (156, 176), True, 'import pandas... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: j-lazo
"""
import cv2
import os
import random
import numpy as np
from scipy.ndimage import zoom
def clipped_zoom(img, zoom_factor, **kwargs):
"""
:param img:
:param zoom_factor:
:param kwargs:
:return:
"""
h, w = img.shape[:2]
... | [
"os.listdir",
"numpy.zeros_like",
"random.choice",
"scipy.ndimage.zoom",
"cv2.warpAffine",
"cv2.LUT",
"numpy.arange",
"cv2.flip",
"numpy.round",
"cv2.getRotationMatrix2D"
] | [((1979, 2000), 'cv2.LUT', 'cv2.LUT', (['image', 'table'], {}), '(image, table)\n', (1986, 2000), False, 'import cv2\n'), ((2050, 2083), 'os.listdir', 'os.listdir', (["(files_path + 'image/')"], {}), "(files_path + 'image/')\n", (2060, 2083), False, 'import os\n'), ((2096, 2129), 'os.listdir', 'os.listdir', (["(files_p... |
import numpy as np
from utils import visualise
from read_mnist import load_data
import random
y_train,x_train,y_test,x_test=load_data()
print("Train data label dim: {}".format(y_train.shape))
print("Train data features dim: {}".format(x_train.shape))
print("Test data label dim: {}".format(y_test.shape))
print("Test da... | [
"numpy.sum",
"numpy.argmax",
"numpy.random.randn",
"numpy.zeros",
"numpy.max",
"read_mnist.load_data",
"numpy.exp",
"numpy.dot"
] | [((125, 136), 'read_mnist.load_data', 'load_data', ([], {}), '()\n', (134, 136), False, 'from read_mnist import load_data\n'), ((4163, 4183), 'numpy.argmax', 'np.argmax', (['z'], {'axis': '(1)'}), '(z, axis=1)\n', (4172, 4183), True, 'import numpy as np\n'), ((587, 596), 'numpy.max', 'np.max', (['f'], {}), '(f)\n', (59... |
import numpy as np
import pytest
from sed.binning import _hist_from_bin_range
from sed.binning import _hist_from_bins
sample1d = np.random.randn(int(1e2), 1)
sample2d = np.random.randn(int(1e2), 2)
sample3d = np.random.randn(int(1e2), 3)
bins1d = (95,)
bins2d = (95, 34)
bins3d = (95, 34, 27)
ranges1d = np.array([[1, ... | [
"numpy.testing.assert_allclose",
"numpy.histogramdd",
"pytest.skip",
"pytest.raises",
"numpy.array",
"numpy.linspace",
"pytest.mark.parametrize",
"sed.binning._hist_from_bin_range"
] | [((306, 324), 'numpy.array', 'np.array', (['[[1, 2]]'], {}), '([[1, 2]])\n', (314, 324), True, 'import numpy as np\n'), ((336, 362), 'numpy.array', 'np.array', (['[[1, 2], [1, 2]]'], {}), '([[1, 2], [1, 2]])\n', (344, 362), True, 'import numpy as np\n'), ((374, 408), 'numpy.array', 'np.array', (['[[1, 2], [1, 2], [1, 2... |
import numpy as np
import struct
from paddle import fluid
def get_data(data_path, place):
inputs = []
labels = []
with open(data_path, 'rb') as in_f:
while True:
plen = in_f.read(4)
if plen is None or len(plen) != 4:
break
alllen = struct.unpack(... | [
"numpy.frombuffer",
"struct.unpack",
"paddle.fluid.core.PaddleTensor",
"numpy.array",
"paddle.fluid.create_lod_tensor"
] | [((781, 829), 'paddle.fluid.create_lod_tensor', 'fluid.create_lod_tensor', (['feat', '[lod_feat]', 'place'], {}), '(feat, [lod_feat], place)\n', (804, 829), False, 'from paddle import fluid\n'), ((855, 880), 'paddle.fluid.core.PaddleTensor', 'fluid.core.PaddleTensor', ([], {}), '()\n', (878, 880), False, 'from paddle i... |
import unittest
import logging
from cnns.nnlib.utils.log_utils import get_logger
from cnns.nnlib.utils.log_utils import set_up_logging
import numpy as np
import torch
from cnns.nnlib.pytorch_layers.conv1D_cuda.conv import Conv1dfftCuda
import conv1D_cuda
class TestPyTorchConv1d(unittest.TestCase):
def setUp(sel... | [
"conv1D_cuda.plus_reduce",
"numpy.array",
"torch.cuda.is_available",
"numpy.correlate",
"torch.device",
"cnns.nnlib.utils.log_utils.get_logger",
"cnns.nnlib.utils.log_utils.set_up_logging",
"torch.tensor",
"torch.from_numpy"
] | [((415, 467), 'cnns.nnlib.utils.log_utils.set_up_logging', 'set_up_logging', ([], {'log_file': 'log_file', 'is_debug': 'is_debug'}), '(log_file=log_file, is_debug=is_debug)\n', (429, 467), False, 'from cnns.nnlib.utils.log_utils import set_up_logging\n'), ((490, 515), 'cnns.nnlib.utils.log_utils.get_logger', 'get_logge... |
import torch
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.utils.class_weight import compute_class_weight
import imgaug
# Local imports
from data.dataset import Dataset
# Correctly handle RNG to ensure different training distribution across epochs
# https://github... | [
"torch.from_numpy",
"torch.utils.data.DataLoader",
"pandas.read_csv",
"numpy.random.SeedSequence",
"numpy.ones",
"sklearn.preprocessing.LabelEncoder",
"torch.initial_seed",
"numpy.unique",
"data.dataset.Dataset"
] | [((471, 491), 'torch.initial_seed', 'torch.initial_seed', ([], {}), '()\n', (489, 491), False, 'import torch\n'), ((599, 645), 'numpy.random.SeedSequence', 'np.random.SeedSequence', (['[worker_id, base_seed]'], {}), '([worker_id, base_seed])\n', (621, 645), True, 'import numpy as np\n'), ((978, 1044), 'pandas.read_csv'... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
n_samples = 1500
random_state = 170
X, y = make_blobs(n_samples=n_samples, random_state=random_state)
# Incorrect number of clusters
y_pred = KMeans(n_clusters=3, random_state=random_state).... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.scatter",
"sklearn.cluster.KMeans",
"numpy.savetxt",
"sklearn.datasets.make_blobs",
"matplotlib.pyplot.figure",
"numpy.loadtxt",
"numpy.dot",
"matplotlib.pyplot.savefig"
] | [((172, 230), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n_samples', 'random_state': 'random_state'}), '(n_samples=n_samples, random_state=random_state)\n', (182, 230), False, 'from sklearn.datasets import make_blobs\n'), ((336, 386), 'numpy.savetxt', 'np.savetxt', (['"""X.txt"""', 'X'], {'fmt': '... |
import numpy as np
import os
import pytest
import doctest
from decitala import trees
from decitala.trees import FragmentTree
from decitala.search import get_by_ql_array
from decitala.fragment import GeneralFragment, GreekFoot
from music21 import converter
from music21 import note
here = os.path.abspath(os.path.dirna... | [
"decitala.fragment.GeneralFragment",
"decitala.trees.FragmentTree.from_frag_type",
"os.path.dirname",
"decitala.search.get_by_ql_array",
"numpy.array",
"decitala.fragment.GreekFoot",
"music21.chord.Chord",
"decitala.trees.FragmentTree",
"music21.converter.parse",
"os.listdir",
"doctest.testmod"
... | [((307, 332), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (322, 332), False, 'import os\n'), ((350, 371), 'os.path.dirname', 'os.path.dirname', (['here'], {}), '(here)\n', (365, 371), False, 'import os\n'), ((408, 429), 'os.path.dirname', 'os.path.dirname', (['here'], {}), '(here)\n', (423... |
import numpy as np
from perform.constants import REAL_TYPE
from perform.flux.invisc_flux.invisc_flux import InviscFlux
class RoeInviscFlux(InviscFlux):
"""Class implementing flux methods for Roe's flux difference scheme.
Inherits from InviscFlux. Provides member functions for computing the numerical flux at... | [
"numpy.absolute",
"numpy.power",
"numpy.zeros",
"numpy.expand_dims",
"numpy.sqrt"
] | [((1255, 1287), 'numpy.sqrt', 'np.sqrt', (['sol_left.sol_cons[0, :]'], {}), '(sol_left.sol_cons[0, :])\n', (1262, 1287), True, 'import numpy as np\n'), ((1305, 1338), 'numpy.sqrt', 'np.sqrt', (['sol_right.sol_cons[0, :]'], {}), '(sol_right.sol_cons[0, :])\n', (1312, 1338), True, 'import numpy as np\n'), ((3430, 3502), ... |
import numpy as np
data_path = "data/problem_13.txt"
# data_path = "data/problem_13_test.txt"
initial_state = []
folds = []
with open(data_path, "r") as f:
for line in f:
line = line.rstrip()
if line:
if line[0] == "f":
direction, value = line.rsplit(" ", 1)[-1].split(... | [
"numpy.array",
"numpy.unique"
] | [((536, 559), 'numpy.array', 'np.array', (['initial_state'], {}), '(initial_state)\n', (544, 559), True, 'import numpy as np\n'), ((1055, 1083), 'numpy.unique', 'np.unique', (['new_state'], {'axis': '(0)'}), '(new_state, axis=0)\n', (1064, 1083), True, 'import numpy as np\n')] |
# Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
# examples/Python/Basic/mesh_subdivision.py
import numpy as np
import open3d as o3d
import meshes
def mesh_generator():
yield meshes.triangle()
yield meshes.plane()
yield o3d.geometry.TriangleMesh.cr... | [
"open3d.geometry.TriangleMesh.create_sphere",
"numpy.random.uniform",
"open3d.geometry.TriangleMesh.create_box",
"numpy.random.seed",
"meshes.plane",
"numpy.asarray",
"open3d.geometry.TriangleMesh.create_octahedron",
"open3d.geometry.TriangleMesh.create_icosahedron",
"meshes.triangle",
"open3d.geo... | [((741, 759), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (755, 759), True, 'import numpy as np\n'), ((239, 256), 'meshes.triangle', 'meshes.triangle', ([], {}), '()\n', (254, 256), False, 'import meshes\n'), ((267, 281), 'meshes.plane', 'meshes.plane', ([], {}), '()\n', (279, 281), False, 'import ... |
# nuScenes dev-kit. Version 0.1
# Code written by <NAME>, 2018.
# Licensed under the Creative Commons [see licence.txt]
from __future__ import annotations
from typing import Tuple
import math
from enum import IntEnum
import numpy as np
from pyquaternion import Quaternion
class BoxVisibility(IntEnum):
""" Enumer... | [
"numpy.eye",
"numpy.logical_and",
"numpy.negative",
"math.sin",
"numpy.ones",
"math.acos",
"numpy.finfo",
"pyquaternion.Quaternion",
"numpy.array",
"numpy.dot"
] | [((1177, 1191), 'numpy.dot', 'np.dot', (['q0', 'q1'], {}), '(q0, q1)\n', (1183, 1191), True, 'import numpy as np\n'), ((1339, 1351), 'math.acos', 'math.acos', (['d'], {}), '(d)\n', (1348, 1351), False, 'import math\n'), ((2952, 2961), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (2958, 2961), True, 'import numpy as n... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 03 15:01:31 2017
@author: jdkern
"""
import pandas as pd
import numpy as np
import os
from shutil import copy
from pathlib import Path
#reading renewable timeseries
Offshore_ISO_2012 = pd.read_excel('ISONE_data_file/Scenarios/Renewable_timeseries/Off_Shore_wind_ISO.xlsx... | [
"pandas.DataFrame",
"numpy.sum",
"os.makedirs",
"pandas.read_csv",
"pandas.read_excel",
"pathlib.Path",
"pathlib.Path.cwd",
"shutil.copy",
"numpy.repeat"
] | [((235, 384), 'pandas.read_excel', 'pd.read_excel', (['"""ISONE_data_file/Scenarios/Renewable_timeseries/Off_Shore_wind_ISO.xlsx"""'], {'header': '(0)', 'sheet_name': '"""All Zones Time Series - 2018"""'}), "(\n 'ISONE_data_file/Scenarios/Renewable_timeseries/Off_Shore_wind_ISO.xlsx',\n header=0, sheet_name='All ... |
import numpy as np
import math as m
import copy
from array import array
import matplotlib.pyplot as plot
from sklearn.linear_model import Ridge
#################################################################################################################################
# Implementatio of DMP ... | [
"matplotlib.pyplot.title",
"numpy.arange",
"numpy.exp",
"numpy.linalg.norm",
"numpy.zeros_like",
"numpy.tan",
"sklearn.linear_model.Ridge",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.show",
"numpy.hstack",
"numpy.cos",
"numpy.squeeze",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gr... | [((6894, 6921), 'matplotlib.pyplot.title', 'plot.title', (['"""Demonstration"""'], {}), "('Demonstration')\n", (6904, 6921), True, 'import matplotlib.pyplot as plot\n'), ((6968, 7004), 'matplotlib.pyplot.xlabel', 'plot.xlabel', (['"""Time represented as t"""'], {}), "('Time represented as t')\n", (6979, 7004), True, 'i... |
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from config import Config
import gdown
np.random.seed(Config.random_seed)
Config.original_dataset_file_path.parent.mkdir(parents=True, exist_ok=True)
Config.dataset_path.mkdir(parents=True, exist_ok=True)
gdown.download(
... | [
"config.Config.original_dataset_file_path.parent.mkdir",
"sklearn.model_selection.train_test_split",
"numpy.random.seed",
"config.Config.dataset_path.mkdir"
] | [((133, 167), 'numpy.random.seed', 'np.random.seed', (['Config.random_seed'], {}), '(Config.random_seed)\n', (147, 167), True, 'import numpy as np\n'), ((169, 244), 'config.Config.original_dataset_file_path.parent.mkdir', 'Config.original_dataset_file_path.parent.mkdir', ([], {'parents': '(True)', 'exist_ok': '(True)'}... |
# - *- coding: utf- 8 - *-
import pandas as pd
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import xlwings as xw
import sys
import numpy as np
from listaColumnas import ObtenerColumnas
from obtenerMes import ObtenerMesesQuiebre, ObtenerMesesFuturos, ObtenerMesesQuiebreInt, ObtenerMeses... | [
"cantidadLotesDemandaAnual.CalcularCantidadLotesDemandaAnual",
"warnings.simplefilter",
"obtenerMes.ObtenerMesesQuiebre",
"listaColumnas.ObtenerColumnasCuanto",
"obtenerMes.ObtenerMesesQuiebreMenor",
"obtenerColumnasAjuste.ObtenerColumnasAjuste",
"obtenerColumnasAjuste.ObtenerAjuste",
"obtenerMes.Obte... | [((63, 125), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (84, 125), False, 'import warnings\n'), ((1323, 1355), 'numpy.repeat', 'np.repeat', (['df.index.values', 'lens'], {}), '(df.index.values, lens)\n',... |
from .OBJET import OBJET
import numpy as np
class Objet(object):
"""OBJET"""
def __init__(self, path_to_meta_json, width=500, height=500):
self._OBJET = OBJET(path_to_meta_json, width, height)
self.width = width
self.height = height
def draw(self, ):
self._OBJET.Draw()
... | [
"numpy.flip"
] | [((466, 486), 'numpy.flip', 'np.flip', (['img'], {'axis': '(0)'}), '(img, axis=0)\n', (473, 486), True, 'import numpy as np\n'), ((637, 657), 'numpy.flip', 'np.flip', (['img'], {'axis': '(0)'}), '(img, axis=0)\n', (644, 657), True, 'import numpy as np\n')] |
"""
Potentials
==========
Potential energy functions.
.. autosummary::
:nosignatures:
LennardJones
.. autoclass:: LennardJones
:members:
"""
import numpy as np
class LennardJones:
r"""Lennard-Jones pair potential.
The prototypical pair potential consisting of a steep repulsive core
and an... | [
"numpy.isscalar",
"numpy.zeros_like",
"numpy.array"
] | [((6726, 6740), 'numpy.isscalar', 'np.isscalar', (['x'], {}), '(x)\n', (6737, 6740), True, 'import numpy as np\n'), ((6753, 6791), 'numpy.array', 'np.array', (['x'], {'dtype': 'np.float64', 'ndmin': '(1)'}), '(x, dtype=np.float64, ndmin=1)\n', (6761, 6791), True, 'import numpy as np\n'), ((6909, 6925), 'numpy.zeros_lik... |
import logging
from bitstring import BitArray, ConstBitStream
from numpy import flip
from bitglitter.read.coloranalysis import colorSnap, returnDistance
from bitglitter.read.decoderassets import scanBlock
from bitglitter.palettes.paletteutilities import paletteGrabber, ColorsToValue
def frameLockOn(image, blockHeig... | [
"bitglitter.read.decoderassets.scanBlock",
"logging.debug",
"bitstring.ConstBitStream",
"numpy.flip",
"logging.warning",
"bitstring.BitArray",
"bitglitter.palettes.paletteutilities.paletteGrabber",
"bitglitter.palettes.paletteutilities.ColorsToValue",
"logging.info",
"bitglitter.read.coloranalysis... | [((604, 642), 'logging.debug', 'logging.debug', (['"""Locking onto frame..."""'], {}), "('Locking onto frame...')\n", (617, 642), False, 'import logging\n'), ((669, 688), 'bitglitter.palettes.paletteutilities.paletteGrabber', 'paletteGrabber', (['"""1"""'], {}), "('1')\n", (683, 688), False, 'from bitglitter.palettes.p... |
"""
Author: <NAME>
Copyright:
Secure Systems Group, Aalto University
https://ssg.aalto.fi/
This code is released under Apache 2.0 license
http://www.apache.org/licenses/LICENSE-2.0
"""
"""
This file takes a csv file (e.g. written by numpy) and puts the values
as an array into a TensorProto that is stored as a file... | [
"numpy.loadtxt"
] | [((690, 731), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {'delimiter': 'delimiter'}), '(filename, delimiter=delimiter)\n', (700, 731), True, 'import numpy as np\n')] |
#%%
from typing import *
import numpy as np
from numpy.fft import fft, fftfreq, rfft, rfftfreq
from scipy.stats import kurtosis, skew
class SpectrumValue:
frequency: Any
value: Any
def __init__(self, frequency, value):
self.frequency = frequency
self.value = value
def get_amplitude_spec... | [
"numpy.fft.rfft",
"numpy.median",
"scipy.stats.skew",
"numpy.min",
"numpy.mean",
"numpy.max",
"scipy.stats.kurtosis",
"numpy.var"
] | [((472, 482), 'numpy.fft.rfft', 'rfft', (['data'], {}), '(data)\n', (476, 482), False, 'from numpy.fft import fft, fftfreq, rfft, rfftfreq\n'), ((798, 824), 'numpy.mean', 'np.mean', (['feature2d'], {'axis': '(1)'}), '(feature2d, axis=1)\n', (805, 824), True, 'import numpy as np\n'), ((834, 859), 'numpy.min', 'np.min', ... |
"""
ALS methode for CP decomposition
"""
import numpy as np
import tensorly as tl
import time
import copy
from src._base import svd_init_fac,err
def err_fast(norm_tensor,A,V,W):
"""
fast data fitting error calculation of als
Parameters
----------
norm_tensor : float
norm of the tensor
A ... | [
"tensorly.transpose",
"src._base.svd_init_fac",
"copy.deepcopy",
"src._base.err",
"tensorly.cp_tensor.unfolding_dot_khatri_rao",
"tensorly.ndim",
"numpy.transpose",
"numpy.ones",
"tensorly.norm",
"time.time",
"numpy.sqrt"
] | [((594, 625), 'numpy.sqrt', 'np.sqrt', (['(norm_tensor ** 2 + res)'], {}), '(norm_tensor ** 2 + res)\n', (601, 625), True, 'import numpy as np\n'), ((1617, 1632), 'tensorly.ndim', 'tl.ndim', (['tensor'], {}), '(tensor)\n', (1624, 1632), True, 'import tensorly as tl\n'), ((1665, 1680), 'tensorly.norm', 'tl.norm', (['ten... |
# Copyright (c) 2019-2021 by University of Kassel, <NAME>, RWTH Aachen University and Fraunhofer
# Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual
# contributors (see AUTHORS file for details). All rights reserved.
import pytest
from numpy import array
import pandapower as pp
im... | [
"simbench.all_voltlvl_idx",
"pandapower.networks.example_multivoltage",
"simbench.voltlvl_idx",
"pandapower.pp_elements",
"pytest.main",
"simbench.convert_voltlvl_names",
"pandapower.networks.example_simple",
"numpy.array",
"simbench.get_voltlvl",
"pandapower.create_measurement"
] | [((456, 515), 'simbench.convert_voltlvl_names', 'sb.convert_voltlvl_names', (["[1, 2, 'hv', 4, 5, 'ehv', 7]", 'str'], {}), "([1, 2, 'hv', 4, 5, 'ehv', 7], str)\n", (480, 515), True, 'import simbench as sb\n'), ((616, 675), 'simbench.convert_voltlvl_names', 'sb.convert_voltlvl_names', (["[1, 2, 'hv', 4, 5, 'ehv', 7]", '... |
import os
import json
import torch
import cv2
import numpy as np
import time
from matplotlib import pyplot as plt
from build_utils import img_utils
from build_utils import torch_utils
from build_utils import utils
from models import Darknet
from draw_box_utils import draw_box
import models
import grad_CAM
from skimage ... | [
"models.save_image",
"grad_CAM.GradCAM",
"json.load",
"build_utils.img_utils.letterbox",
"models.get_last_conv_name",
"torch.load",
"os.path.exists",
"models.gen_cam",
"build_utils.torch_utils.time_synchronized",
"models.Darknet",
"cv2.imread",
"torch.cuda.is_available",
"numpy.ascontiguousa... | [((676, 695), 'os.path.exists', 'os.path.exists', (['cfg'], {}), '(cfg)\n', (690, 695), False, 'import os\n'), ((750, 773), 'os.path.exists', 'os.path.exists', (['weights'], {}), '(weights)\n', (764, 773), False, 'import os\n'), ((836, 861), 'os.path.exists', 'os.path.exists', (['json_path'], {}), '(json_path)\n', (850... |
from __future__ import print_function
import os
try:
import cPickle # python 2
except:
import pickle as cPickle # python 3 (cPickle not existing any more)
import numpy as np
from scipy.spatial import cKDTree
from geoval.core import GeoData
from geoval.core.mapping import SingleMap
"""
Minimum trend analysi... | [
"numpy.meshgrid",
"numpy.asarray",
"os.path.exists",
"numpy.ones",
"numpy.isnan",
"geoval.core.GeoData",
"numpy.ma.array",
"scipy.spatial.cKDTree",
"geoval.core.mapping.SingleMap",
"numpy.vstack",
"numpy.sqrt"
] | [((1086, 1115), 'os.path.exists', 'os.path.exists', (['self._lutname'], {}), '(self._lutname)\n', (1100, 1115), False, 'import os\n'), ((1276, 1320), 'numpy.meshgrid', 'np.meshgrid', (["d['means']", "d['phis']", "d['cvs']"], {}), "(d['means'], d['phis'], d['cvs'])\n", (1287, 1320), True, 'import numpy as np\n'), ((1724... |
"""Clone optimizer definion and utilities."""
import numpy as np
from abc import ABCMeta, abstractmethod
def get_objective(number_of_mutations, B):
"""Get the objective function."""
return lambda x: np.linalg.norm(
np.outer(
x[:number_of_mutations],
x[number_of_mutations:]
... | [
"numpy.outer"
] | [((233, 291), 'numpy.outer', 'np.outer', (['x[:number_of_mutations]', 'x[number_of_mutations:]'], {}), '(x[:number_of_mutations], x[number_of_mutations:])\n', (241, 291), True, 'import numpy as np\n')] |
import numpy as np
from tqdm import tqdm_notebook as tqdm
import torch
from utils.pytorch.utils.common import get_batch_info
def validate_model(model, criterion, loss_fn, metric_fn, val_dataloader):
n_val_obs, val_batch_size, val_batch_per_epoch = get_batch_info(val_dataloader)
total_loss = np.zeros(val_batc... | [
"torch.no_grad",
"numpy.zeros",
"utils.pytorch.utils.common.get_batch_info"
] | [((255, 285), 'utils.pytorch.utils.common.get_batch_info', 'get_batch_info', (['val_dataloader'], {}), '(val_dataloader)\n', (269, 285), False, 'from utils.pytorch.utils.common import get_batch_info\n'), ((303, 332), 'numpy.zeros', 'np.zeros', (['val_batch_per_epoch'], {}), '(val_batch_per_epoch)\n', (311, 332), True, ... |
import argparse
import logging
import cv2 as cv
import librosa
import numpy as np
import torch
from config import sample_rate
def clip_gradient(optimizer, grad_clip):
"""
Clips gradients computed during backpropagation to avoid explosion of gradients.
:param optimizer: optimizer with the gradients to be... | [
"os.mkdir",
"argparse.ArgumentParser",
"logging.Formatter",
"librosa.feature.melspectrogram",
"librosa.feature.mfcc",
"cv2.cvtColor",
"librosa.feature.rmse",
"numpy.max",
"numpy.swapaxes",
"librosa.effects.trim",
"numpy.save",
"numpy.ceil",
"librosa.feature.delta",
"logging.StreamHandler",... | [((910, 937), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (920, 937), False, 'import torch\n'), ((2354, 2411), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Speaker Embeddings"""'}), "(description='Speaker Embeddings')\n", (2377, 2411), False, 'import... |
import numpy as np
sleep = 12
study = 4
stress = 10
xs = np.array([[sleep],
[study],
[stress]])
#sleep, study, stress
ws = np.array([0.5, 0.3, -0.2]).reshape(3, 1)
p = xs.T.dot(ws)
s = 1/(1+np.exp(-p))
prediction = s*100
print(prediction)
| [
"numpy.array",
"numpy.exp"
] | [((59, 97), 'numpy.array', 'np.array', (['[[sleep], [study], [stress]]'], {}), '([[sleep], [study], [stress]])\n', (67, 97), True, 'import numpy as np\n'), ((156, 182), 'numpy.array', 'np.array', (['[0.5, 0.3, -0.2]'], {}), '([0.5, 0.3, -0.2])\n', (164, 182), True, 'import numpy as np\n'), ((224, 234), 'numpy.exp', 'np... |
import os
from numpy.distutils.core import setup
DESCRIPTION = "Python implementation of Friedman's Supersmoother"
LONG_DESCRIPTION = """
SuperSmoother in Python
=======================
This is an efficient implementation of Friedman's SuperSmoother based in
Python. It makes use of numpy for fast numerical computation... | [
"numpy.distutils.core.setup",
"numpy.distutils.misc_util.Configuration",
"os.path.exists",
"os.remove"
] | [((1304, 2029), 'numpy.distutils.core.setup', 'setup', ([], {'configuration': 'configuration', 'name': 'NAME', 'version': 'VERSION', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESCRIPTION', 'author': 'AUTHOR', 'author_email': 'AUTHOR_EMAIL', 'maintainer': 'MAINTAINER', 'maintainer_email': 'MAINTAINER_EMAIL... |
import matplotlib.pyplot as plt
import numpy as np
def findSymbolOutOfPara(symbol, content):
num = -1
ignore = False
while num < len(content)-1:
num += 1
if content[num]==')':
ignore = False
continue
if ignore:
continue
if content[num]=='... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.log2",
"matplotlib.pyplot.figure",
"numpy.tan",
"numpy.sin",
"numpy.linspace",
"numpy.cos"
] | [((2295, 2337), 'numpy.linspace', 'np.linspace', (['(-12 * np.pi)', '(12 * np.pi)', '(1000)'], {}), '(-12 * np.pi, 12 * np.pi, 1000)\n', (2306, 2337), True, 'import numpy as np\n'), ((2754, 2767), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (2764, 2767), True, 'import matplotlib.pyplot as plt\n'),... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .anchor_head_template import AnchorHeadTemplate
from ...ops.iou3d_nms import iou3d_nms_utils
from ..model_utils import meter_utils
class Diversity_Head(AnchorHeadTemplate):
'''
This class will implement the distil... | [
"torch.nn.MSELoss",
"numpy.log",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.functional.softmax",
"torch.sigmoid",
"torch.clamp",
"torch.max",
"torch.nn.init.normal_",
"torch.nn.functional.sigmoid",
"torch.nn.SmoothL1Loss",
"torch.abs",
"torch.tensor"
] | [((1446, 1523), 'torch.nn.Conv2d', 'nn.Conv2d', (['(256)', '(self.num_anchors_per_location * self.num_class)'], {'kernel_size': '(1)'}), '(256, self.num_anchors_per_location * self.num_class, kernel_size=1)\n', (1455, 1523), True, 'import torch.nn as nn\n'), ((1582, 1673), 'torch.nn.Conv2d', 'nn.Conv2d', (['(256)', '(s... |
""" Tests of the command-line interface
:Author: <NAME> <<EMAIL>>
:Date: 2021-08-12
:Copyright: 2021, Center for Reproducible Biomedical Modeling
:License: MIT
"""
from biosimulators_masspy import __main__
from biosimulators_masspy import core
from biosimulators_masspy.data_model import KISAO_ALGORITHM_MAP
from biosi... | [
"os.mkdir",
"yaml.load",
"biosimulators_utils.simulator.specs.gen_algorithms_from_specs",
"biosimulators_utils.sedml.data_model.ModelAttributeChange",
"biosimulators_utils.combine.io.CombineArchiveWriter",
"biosimulators_utils.sedml.data_model.Model",
"json.dumps",
"numpy.isnan",
"mass.io.sbml.read_... | [((1500, 1525), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1515, 1525), False, 'import os\n'), ((1687, 1712), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1702, 1712), False, 'import os\n'), ((1865, 1883), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '(... |
## @ingroup Methods-Geometry-Two_Dimensional-Cross_Section-Airfoil
# import_airfoil_polars.py
#
# Created: Mar 2019, <NAME>
# Mar 2020, <NAME>
# Sep 2020, <NAME>
# May 2021, <NAME>
# Nov 2021, <NAME>
# ----------------------------------------------------------------------
# ... | [
"numpy.interp",
"numpy.zeros",
"numpy.linspace",
"SUAVE.Core.Data"
] | [((1371, 1377), 'SUAVE.Core.Data', 'Data', ([], {}), '()\n', (1375, 1377), False, 'from SUAVE.Core import Data\n'), ((1471, 1516), 'numpy.zeros', 'np.zeros', (['(num_airfoils, num_polars, dim_aoa)'], {}), '((num_airfoils, num_polars, dim_aoa))\n', (1479, 1516), True, 'import numpy as np\n'), ((1534, 1579), 'numpy.zeros... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
parmap (or parmapper): Tool for easy parallel function mapping
without requiring a pickleable function (e.g. lambdas).
"""
from __future__ import print_function, unicode_literals, division
__version__ = '20190531'
import multiprocessing as mp
import multiprocessing.du... | [
"sys.stdout.flush",
"multiprocessing.Queue",
"itertools.imap",
"multiprocessing.cpu_count",
"multiprocessing.dummy.Pool",
"IPython.display.display",
"numpy.cumsum",
"multiprocessing.JoinableQueue",
"threading.Thread",
"functools.partial",
"ipywidgets.IntText",
"numpy.ceil",
"math.ceil",
"n... | [((754, 768), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (766, 768), True, 'import multiprocessing as mp\n'), ((11026, 11044), 'multiprocessing.JoinableQueue', 'mp.JoinableQueue', ([], {}), '()\n', (11042, 11044), True, 'import multiprocessing as mp\n'), ((11107, 11117), 'multiprocessing.Queue', 'mp... |
'''
Author: <NAME>
Email: <EMAIL>
Date created: 2020/6/16
Python Version: 3.6
'''
import numpy as np
from numpy.linalg import inv as inv
# functions for train_model,py
def kr_prod(a, b):
return np.einsum('ir, jr -> ijr', a, b).reshape(a.shape[0] * b.shape[0], -1)
def cp_combine(U, V, X):
ret... | [
"numpy.moveaxis",
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"numpy.zeros",
"numpy.einsum",
"numpy.where",
"numpy.array",
"numpy.linalg.norm",
"numpy.matmul",
"numpy.random.rand",
"numpy.eye",
"numpy.concatenate"
] | [((324, 363), 'numpy.einsum', 'np.einsum', (['"""is, js, ts -> ijt"""', 'U', 'V', 'X'], {}), "('is, js, ts -> ijt', U, V, X)\n", (333, 363), True, 'import numpy as np\n'), ((684, 712), 'numpy.array', 'np.array', (['[dim1, dim2, dim3]'], {}), '([dim1, dim2, dim3])\n', (692, 712), True, 'import numpy as np\n'), ((847, 87... |
#!/usr/bin/env python
"""
Tree Tracing
Here we trace a tree generated by Bayesian teaching
of a matrix of size (10*10) or (20*20)
"""
import os
import pickle
from datetime import datetime as dt
import numpy as np
import torch
# import torch.multiprocessing as mp
import multiprocessing as mp
CURDIR = os.path.abspa... | [
"torch.ones",
"os.path.abspath",
"pickle.dump",
"datetime.datetime.today",
"multiprocessing.Pool",
"pickle.load",
"sinkhorn_torch.sinkhorn_torch",
"numpy.random.choice",
"torch.sum"
] | [((307, 333), 'os.path.abspath', 'os.path.abspath', (['os.curdir'], {}), '(os.curdir)\n', (322, 333), False, 'import os\n'), ((1415, 1437), 'torch.sum', 'torch.sum', (['prior_learn'], {}), '(prior_learn)\n', (1424, 1437), False, 'import torch\n'), ((6158, 6204), 'pickle.dump', 'pickle.dump', (['data', 'LOG_FILES[branch... |
# import os
from observations import observation as obs
from observations import obs_collection as oc
import numpy as np
import pytest
# import sys
# sys.path.insert(1, "..")
# TEST_DIR = os.path.dirname(os.path.abspath(__file__))
# PROJECT_DIR = os.path.abspath(os.path.join(TEST_DIR, os.pardir))
# sys.path.insert(0,... | [
"observations.observation.GroundwaterQualityObs.from_dino",
"pystore.set_path",
"observations.observation.KnmiObs.from_nearest_xy",
"observations.observation.GroundwaterObs.from_wiski",
"pytest.mark.skip",
"observations.obs_collection.ObsCollection.from_fews",
"observations.obs_collection.ObsCollection.... | [((7670, 7726), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""needs installation pastastore"""'}), "(reason='needs installation pastastore')\n", (7686, 7726), False, 'import pytest\n'), ((7870, 7926), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""needs installation pastastore"""'}), "(reason... |
# Copyright (c) 2016, The Bifrost Authors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | [
"hickle.load",
"bifrost.ndarray",
"copy.deepcopy",
"numpy.int32"
] | [((3476, 3516), 'bifrost.ndarray', 'bf.ndarray', (['w'], {'dtype': '"""ci8"""', 'space': '"""cuda"""'}), "(w, dtype='ci8', space='cuda')\n", (3486, 3516), True, 'import bifrost as bf\n'), ((4205, 4219), 'copy.deepcopy', 'deepcopy', (['ihdr'], {}), '(ihdr)\n', (4213, 4219), False, 'from copy import deepcopy\n'), ((2743,... |
import os
from datetime import datetime
import time
import numpy as np
import random
import argparse
from shutil import copyfile
import torch
import spacy
from data.loader import DataLoader
from model.rnn import SubjectObjectRelationModel
from utils import scorer, constant, helper
from utils.vocab import Vo... | [
"numpy.load",
"os.remove",
"numpy.random.seed",
"argparse.ArgumentParser",
"utils.constant.LABEL_TO_ID.items",
"spacy.load",
"random.seed",
"utils.helper.ensure_dir",
"utils.constant.ID_TO_CLASS.items",
"utils.helper.save_config",
"shutil.copyfile",
"datetime.datetime.now",
"utils.helper.Fil... | [((362, 387), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (385, 387), False, 'import argparse\n'), ((3033, 3061), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (3050, 3061), False, 'import torch\n'), ((3063, 3088), 'numpy.random.seed', 'np.random.seed', (['a... |
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
from skimage.transform import AffineTransform
import cv2
import numpy as np
import torch
class SingleDataset(BaseDataset):
"""This dataset class can load a set of images specified by the path --... | [
"data.base_dataset.BaseDataset.__init__",
"numpy.asarray",
"torch.cat",
"PIL.Image.open",
"PIL.Image.fromarray",
"cv2.warpAffine",
"numpy.linalg.inv",
"numpy.linspace",
"numpy.random.choice",
"skimage.transform.AffineTransform",
"data.image_folder.make_dataset",
"data.base_dataset.get_transfor... | [((677, 708), 'data.base_dataset.BaseDataset.__init__', 'BaseDataset.__init__', (['self', 'opt'], {}), '(self, opt)\n', (697, 708), False, 'from data.base_dataset import BaseDataset, get_transform\n'), ((907, 950), 'data.base_dataset.get_transform', 'get_transform', (['opt'], {'grayscale': '(input_nc == 1)'}), '(opt, g... |
from datetime import datetime
from typing import Any, Dict, Generic, List, Optional, Set, Type, TypeVar, Union
import numpy as np
from paralleldomain.model.image import DecoderImage, Image, ImageDecoderProtocol
from paralleldomain.model.point_cloud import DecoderPointCloud, PointCloud, PointCloudDecoderProtocol
from ... | [
"paralleldomain.model.point_cloud.DecoderPointCloud",
"numpy.array",
"paralleldomain.utilities.projection.project_points_3d_to_2d",
"typing.TypeVar",
"paralleldomain.model.image.DecoderImage"
] | [((866, 878), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (873, 878), False, 'from typing import Any, Dict, Generic, List, Optional, Set, Type, TypeVar, Union\n'), ((891, 940), 'typing.TypeVar', 'TypeVar', (['"""TDateTime"""'], {'bound': 'Union[None, datetime]'}), "('TDateTime', bound=Union[None, datetim... |
# scalings.py shows how the prediction for the thermals height, density, and radius align with the simulation results
import xarray as xr
import numpy as np
import matplotlib
from faceted import faceted
from matplotlib import ticker
matplotlib.rcParams['mathtext.fontset'] = 'cm'
import matplotlib.pyplot as plt
from m... | [
"matplotlib.pyplot.show",
"faceted.faceted",
"matplotlib.lines.Line2D",
"matplotlib.ticker.MaxNLocator",
"xarray.open_dataset",
"matplotlib.pyplot.legend",
"numpy.loadtxt",
"xarray.open_mfdataset",
"xarray.open_dataarray",
"lighten_color.lighten_color"
] | [((400, 499), 'xarray.open_mfdataset', 'xr.open_mfdataset', (['"""/work/bnm/buoyant_entrainment/data/lam/rho_u_v_w/slice*.nc"""'], {'concat_dim': '"""t"""'}), "('/work/bnm/buoyant_entrainment/data/lam/rho_u_v_w/slice*.nc',\n concat_dim='t')\n", (417, 499), True, 'import xarray as xr\n'), ((507, 596), 'xarray.open_da... |
import numpy as np
import pytest
from kickscore.kernel import *
from kickscore.kernel.kernel import Kernel
TS = np.array([1.26, 1.46, 2.67])
KERNEL = {
"constant": Constant(2.5),
"exponential": Exponential(1.1, 2.2),
"matern32": Matern32(1.5, 0.7),
"matern52": Matern52(0.2, 5.0),
# In this case i... | [
"kickscore.kernel.kernel.Kernel.noise_cov",
"numpy.allclose",
"kickscore.kernel.kernel.Kernel.transition",
"numpy.random.random",
"numpy.array",
"numpy.linspace"
] | [((115, 143), 'numpy.array', 'np.array', (['[1.26, 1.46, 2.67]'], {}), '([1.26, 1.46, 2.67])\n', (123, 143), True, 'import numpy as np\n'), ((1393, 1454), 'numpy.array', 'np.array', (['[[2.5, 2.5, 2.5], [2.5, 2.5, 2.5], [2.5, 2.5, 2.5]]'], {}), '([[2.5, 2.5, 2.5], [2.5, 2.5, 2.5], [2.5, 2.5, 2.5]])\n', (1401, 1454), Tr... |
import torch
import numpy as np
from collections import OrderedDict
from core.memories.base import BaseBuffer
from core.memories.greedy import GreedyBuffer
from core.memories.reservoir import ReservoirBuffer
class StratifiedBuffer(BaseBuffer):
"""Unbounded user replay buffer"""
def __init__(
self,
... | [
"collections.OrderedDict",
"numpy.random.randint",
"torch.device",
"time.time"
] | [((516, 529), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (527, 529), False, 'from collections import OrderedDict\n'), ((1284, 1319), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.user_num'], {}), '(0, self.user_num)\n', (1301, 1319), True, 'import numpy as np\n'), ((1953, 1964), 'time.tim... |
import tensorflow as tf
import random
import numpy as np
from LOADDATA import build_vocab,get_corpus_indices,data_format,get_data
from LSTM.LSTM import lstm
from DENSE.DENSE import dense
from EMBEDDING.EMBEDDING import embedding
random.seed(1)
class stentimentAnalysis:
def __init__(self,batch_size,lr,num_input,nu... | [
"tensorflow.reduce_sum",
"numpy.argmax",
"tensorflow.keras.optimizers.SGD",
"tensorflow.reshape",
"numpy.ones",
"tensorflow.clip_by_global_norm",
"tensorflow.nn.softmax",
"tensorflow.math.log",
"tensorflow.one_hot",
"tensorflow.concat",
"EMBEDDING.EMBEDDING.embedding",
"random.seed",
"LOADDA... | [((230, 244), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (241, 244), False, 'import random\n'), ((3428, 3455), 'numpy.ones', 'np.ones', (['[nonO.shape[1], 1]'], {}), '([nonO.shape[1], 1])\n', (3435, 3455), True, 'import numpy as np\n'), ((3465, 3486), 'numpy.dot', 'np.dot', (['exist', 'factor'], {}), '(exist... |
"""
"""
import numpy as np
from dyconnmap import sliding_window_indx
if __name__ == '__main__':
ts = np.zeros((4, 100))
wlen = 10
indices1 = sliding_window_indx(ts, window_length=wlen, overlap=0.5)
indices3 = sliding_window_indx(ts, window_length=wlen, overlap=0.75)
indices6 = sliding_window... | [
"dyconnmap.sliding_window_indx",
"numpy.zeros"
] | [((111, 129), 'numpy.zeros', 'np.zeros', (['(4, 100)'], {}), '((4, 100))\n', (119, 129), True, 'import numpy as np\n'), ((160, 216), 'dyconnmap.sliding_window_indx', 'sliding_window_indx', (['ts'], {'window_length': 'wlen', 'overlap': '(0.5)'}), '(ts, window_length=wlen, overlap=0.5)\n', (179, 216), False, 'from dyconn... |
# This file is part of the P3IV Simulator (https://github.com/fzi-forschungszentrum-informatik/P3IV),
# copyright by FZI Forschungszentrum Informatik, licensed under the BSD-3 license (see LICENSE file in main directory)
import uuid
import numpy as np
from enum import Enum
from copy import deepcopy
from p3iv_types.mot... | [
"copy.deepcopy",
"uuid.uuid4",
"numpy.abs",
"numpy.zeros",
"numpy.ones",
"numpy.arange",
"p3iv_types.motion.MotionStateArray"
] | [((3420, 3432), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (3430, 3432), False, 'import uuid\n'), ((3558, 3576), 'p3iv_types.motion.MotionStateArray', 'MotionStateArray', ([], {}), '()\n', (3574, 3576), False, 'from p3iv_types.motion import MotionStateArray\n'), ((3774, 3794), 'numpy.zeros', 'np.zeros', (['(self.N +... |
import numpy as np
from optfolio.nsga2 import non_dominated_fronts
def test_non_dominated_fronts():
points = np.asarray([
[r * np.cos(phi), r * np.sin(phi)]
for r in (np.arange(5) + 1)
for phi in np.linspace(np.pi/2, np.pi, 10)
])
fronts, _ = non_dominated_fronts(points[:,1], poi... | [
"numpy.sin",
"numpy.arange",
"numpy.linspace",
"numpy.cos",
"numpy.argwhere",
"numpy.all"
] | [((450, 481), 'numpy.arange', 'np.arange', (['(i * 10)', '((i + 1) * 10)'], {}), '(i * 10, (i + 1) * 10)\n', (459, 481), True, 'import numpy as np\n'), ((563, 596), 'numpy.all', 'np.all', (['(front_ids == expected_ids)'], {}), '(front_ids == expected_ids)\n', (569, 596), True, 'import numpy as np\n'), ((227, 260), 'num... |
# coding: utf-8
import sys
import numpy
import matplotlib.pyplot
def analyse (filename, outfile=None):
data = numpy.loadtxt(fname=filename, delimiter=',')
# Create a wide figure to hold subplots
fig = matplotlib.pyplot.figure (figsize = (10.0, 3.0))
# create placeholders for plots
subplo... | [
"numpy.max",
"numpy.mean",
"numpy.min",
"numpy.loadtxt"
] | [((119, 163), 'numpy.loadtxt', 'numpy.loadtxt', ([], {'fname': 'filename', 'delimiter': '""","""'}), "(fname=filename, delimiter=',')\n", (132, 163), False, 'import numpy\n'), ((1171, 1215), 'numpy.loadtxt', 'numpy.loadtxt', ([], {'fname': 'filename', 'delimiter': '""","""'}), "(fname=filename, delimiter=',')\n", (1184... |
import numpy as np
import pandas as pd
"""
Parse groups size DataFrame into the initial values required for the model
Params
------
groupsize_df: DataFrame
Includes columns for 'Population_Size', 'Recovery_Rate',
'Initial_Infection_Rate' for each of the groups.
return
-------
gn: array with the group names ... | [
"pandas.DataFrame",
"numpy.log",
"numpy.zeros",
"numpy.where",
"numpy.exp",
"numpy.dot"
] | [((3216, 3255), 'numpy.where', 'np.where', (["(Group_Names == 'White_Prison')"], {}), "(Group_Names == 'White_Prison')\n", (3224, 3255), True, 'import numpy as np\n'), ((3277, 3316), 'numpy.where', 'np.where', (["(Group_Names == 'Black_Prison')"], {}), "(Group_Names == 'Black_Prison')\n", (3285, 3316), True, 'import nu... |
import cv2
import glob
import os
import numpy as np
import argparse
from collections import defaultdict
import pickle
from utils_for_mtmct import DataPacker
tracklets_info = []
tracklet_global_id = 1
root = '/data3/shensj/datasets/my_files/gps/GPSReID/MOT/GPSReID/crop_images/yolo_nms03_all_dataset_2_ft1/'
... | [
"numpy.zeros",
"numpy.array",
"os.listdir",
"os.path.join"
] | [((969, 993), 'numpy.array', 'np.array', (['tracklets_info'], {}), '(tracklets_info)\n', (977, 993), True, 'import numpy as np\n'), ((1016, 1090), 'numpy.zeros', 'np.zeros', (['(tracklet_global_id - 1, tracklet_global_id - 1)'], {'dtype': 'np.int64'}), '((tracklet_global_id - 1, tracklet_global_id - 1), dtype=np.int64)... |
# coding:utf-8
import torch
import numpy as np
class Vocab:
def __init__(self, embed, word2id):
self.embed = embed
self.word2id = word2id
self.id2word = {v: k for k, v in word2id.items()}
assert len(self.word2id) == len(self.id2word)
self.PAD_IDX = 0
self.UNK_IDX = ... | [
"numpy.array",
"torch.FloatTensor",
"torch.LongTensor"
] | [((1699, 1722), 'torch.LongTensor', 'torch.LongTensor', (['sents'], {}), '(sents)\n', (1715, 1722), False, 'import torch\n'), ((1746, 1777), 'torch.FloatTensor', 'torch.FloatTensor', (['sents_target'], {}), '(sents_target)\n', (1763, 1777), False, 'import torch\n'), ((1800, 1830), 'torch.FloatTensor', 'torch.FloatTenso... |
# Copyright 2017 Regents of the University of Colorado. All Rights Reserved.
# Released under the MIT license.
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
# Verify current version before use at: https://github.com/MAVENSDC/Pydivide
import re
import os
fro... | [
"numpy.abs",
"os.path.join",
"os.path.dirname",
"os.path.exists",
"numpy.max",
"re.findall",
"datetime.timedelta",
"re.search",
"re.split",
"re.match",
"numpy.min",
"datetime.datetime.strptime",
"os.listdir",
"numpy.nanmax",
"numpy.all",
"re.compile",
"numpy.nanmin",
"numpy.array",... | [((13424, 13451), 'numpy.all', 'np.all', (['filter_list'], {'axis': '(0)'}), '(filter_list, axis=0)\n', (13430, 13451), True, 'import numpy as np\n'), ((17126, 17197), 'os.path.join', 'os.path.join', (['mvn_root_data_dir', '"""maven"""', '"""data"""', '"""sci"""', '"""kp"""', '"""insitu"""'], {}), "(mvn_root_data_dir, ... |
import numpy as np
class StoneAgeGame(object):
def __init__(self, policy, player_types):
# TODO: Keep food limit in mind for the GUI
# TODO: Clean this in initialization
self.placements_max = {'Farm': 1, 'Mating': 2, 'Wood': 7, 'Food': 20}
self.spots_to_index = {'Farm': 0... | [
"numpy.argmax",
"numpy.random.choice"
] | [((718, 748), 'numpy.random.choice', 'np.random.choice', (['self.players'], {}), '(self.players)\n', (734, 748), True, 'import numpy as np\n'), ((2428, 2450), 'numpy.argmax', 'np.argmax', (['self.points'], {}), '(self.points)\n', (2437, 2450), True, 'import numpy as np\n')] |
import os
import numpy as np
import torch
class ORACCDataset(torch.utils.data.Dataset):
def __init__(self, file_path, tokenizer, block_size, missing_sign_encoding: int,
encode_only_first_token_in_word: bool = False,
ignore_missing=True):
assert os.path.isfile(file_path),... | [
"os.path.isfile",
"numpy.array",
"torch.tensor"
] | [((294, 319), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (308, 319), False, 'import os\n'), ((1068, 1098), 'torch.tensor', 'torch.tensor', (['self.labels[idx]'], {}), '(self.labels[idx])\n', (1080, 1098), False, 'import torch\n'), ((974, 996), 'torch.tensor', 'torch.tensor', (['val[idx]']... |
import argparse
from datetime import datetime
import pandas as pd
import re
import os
from tabulate import tabulate
from ast import literal_eval
import numpy as np
def init_data(
) -> pd.DataFrame:
"""
Return
-------
Plan: pd.DataFrame. Item of the planner
Notes
-------
Reads the plan fro... | [
"pandas.DataFrame",
"os.mkdir",
"datetime.datetime.today",
"os.getcwd",
"pandas.read_csv",
"os.path.exists",
"pandas.to_datetime",
"ast.literal_eval",
"numpy.intersect1d",
"os.path.join",
"re.sub"
] | [((648, 678), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'features'}), '(columns=features)\n', (660, 678), True, 'import pandas as pd\n'), ((2111, 2175), 'pandas.to_datetime', 'pd.to_datetime', (["plan['date']"], {'format': '"""%Y-%m-%d"""', 'errors': '"""coerce"""'}), "(plan['date'], format='%Y-%m-%d', error... |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from time import time
from tensorflow.contrib.distributions import Normal
from stein.samplers import SteinSampler
from stein.optimizers import AdamGradientDescent
# Import data.
data_X = np.loadtxt("./data/data_X.csv", delimiter=",")
if len(da... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"stein.samplers.SteinSampler",
"tensorflow.variable_scope",
"stein.optimizers.AdamGradientDescent",
"time.time",
"tensorflow.placeholder",
"matplotlib.pyplot.figure",
"tensorflow.zeros",
"tensorflow.matmul",
"numpy.loadtxt",
"numpy.linspace",... | [((264, 310), 'numpy.loadtxt', 'np.loadtxt', (['"""./data/data_X.csv"""'], {'delimiter': '""","""'}), "('./data/data_X.csv', delimiter=',')\n", (274, 310), True, 'import numpy as np\n'), ((1248, 1254), 'time.time', 'time', ([], {}), '()\n', (1252, 1254), False, 'from time import time\n'), ((1394, 1432), 'stein.optimize... |
#!/usr/bin/env python3
# Imports
# Standard lib
import unittest
import pathlib
# 3rd party
import numpy as np
from PIL import Image
# Our own imports
from deep_hipsc_tracking.model import preproc
from deep_hipsc_tracking.model._preproc import composite_mask
from .. import helpers
# Helper Classes
class FakeDet... | [
"numpy.ones",
"deep_hipsc_tracking.model._preproc.composite_mask",
"pathlib.Path",
"numpy.mean",
"numpy.arange",
"deep_hipsc_tracking.model.preproc.resample_in_box",
"deep_hipsc_tracking.model.preproc.CompleteSampler",
"numpy.round",
"numpy.full",
"numpy.meshgrid",
"numpy.testing.assert_almost_e... | [((611, 653), 'numpy.ones', 'np.ones', (['(batch_size, 1)'], {'dtype': 'np.float32'}), '((batch_size, 1), dtype=np.float32)\n', (618, 653), True, 'import numpy as np\n'), ((1391, 1417), 'numpy.random.ranf', 'np.random.ranf', (['(256, 256)'], {}), '((256, 256))\n', (1405, 1417), True, 'import numpy as np\n'), ((1492, 15... |
from abc import ABCMeta, abstractmethod
from abcpy.graphtools import GraphTools
from abcpy.acceptedparametersmanager import *
import numpy as np
from sklearn import linear_model
class Summaryselections(metaclass=ABCMeta):
"""This abstract base class defines a way to choose the summary statistics.
"""
@... | [
"numpy.zeros",
"numpy.transpose",
"numpy.random.RandomState",
"sklearn.linear_model.LinearRegression",
"numpy.array",
"numpy.concatenate"
] | [((2513, 2540), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (2534, 2540), True, 'import numpy as np\n'), ((3380, 3407), 'numpy.array', 'np.array', (['sample_parameters'], {}), '(sample_parameters)\n', (3388, 3407), True, 'import numpy as np\n'), ((3436, 3469), 'numpy.concatenate', '... |
import unittest
import numpy as np
from scipy.linalg import null_space
import util.geometry_util as geo_util
from solvers.rigidity_solver import algo_core
from solvers.rigidity_solver.constraints_3d import direction_for_relative_disallowed_motions
from solvers.rigidity_solver.models import Model, Joint, Beam
class Te... | [
"unittest.main",
"numpy.zeros_like",
"solvers.rigidity_solver.models.Model",
"solvers.rigidity_solver.models.Beam.tetra",
"solvers.rigidity_solver.constraints_3d.direction_for_relative_disallowed_motions",
"numpy.ones",
"numpy.isclose",
"numpy.linalg.matrix_rank",
"numpy.array",
"numpy.eye"
] | [((3275, 3290), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3288, 3290), False, 'import unittest\n'), ((608, 617), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (614, 617), True, 'import numpy as np\n'), ((690, 709), 'numpy.array', 'np.array', (['[0, 1, 0]'], {}), '([0, 1, 0])\n', (698, 709), True, 'import nu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ******************************************************************************
# $Id$
#
# Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/)
# Support: BRGM (http://www.brgm.fr)
# Purpose: Convert a raster into TMS (Tile Map Service) tiles in a di... | [
"os.remove",
"numpy.count_nonzero",
"os.path.join",
"os.walk",
"os.path.splitext",
"osgeo.gdal.Open",
"osgeo.gdal.GetDriverByName"
] | [((3316, 3333), 'os.walk', 'os.walk', (['walk_dir'], {}), '(walk_dir)\n', (3323, 3333), False, 'import os\n'), ((3382, 3410), 'os.path.join', 'os.path.join', (['root', 'filename'], {}), '(root, filename)\n', (3394, 3410), False, 'import os\n'), ((3509, 3547), 'osgeo.gdal.Open', 'gdal.Open', (['file_path', 'gdal.GA_Read... |
import numpy as np
from nearpy.distances.distance import Distance
def squared_euclidean_distance(x: np.ndarray, y: np.ndarray) -> np.ndarray:
d = x - y
return np.sum(d ** 2)
class SquaredEuclideanDistance(Distance):
""" Squared Euclidean distance for nearpy data structures """
def distance(self, x... | [
"numpy.sum"
] | [((170, 184), 'numpy.sum', 'np.sum', (['(d ** 2)'], {}), '(d ** 2)\n', (176, 184), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# Copyright (c) 2011-2019, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
import unittest
import numpy as np
from wradlib import adjust
# Arguments to be used throughout all test classes
raw_x, raw_y = np.meshgrid(np.arange(4).astype("f4"),
... | [
"unittest.main",
"wradlib.adjust._get_statfunc",
"wradlib.adjust.AdjustNone",
"numpy.allclose",
"wradlib.adjust.AdjustAdd",
"wradlib.adjust.GageOnly",
"numpy.array",
"numpy.arange",
"wradlib.adjust.AdjustMFB",
"wradlib.adjust.AdjustMultiply",
"wradlib.adjust.best",
"wradlib.adjust.AdjustMixed"... | [((432, 490), 'numpy.array', 'np.array', (['[[1.0, 1.0], [2.0, 1.0], [1.0, 3.5], [3.5, 3.0]]'], {}), '([[1.0, 1.0], [2.0, 1.0], [1.0, 3.5], [3.5, 3.0]])\n', (440, 490), True, 'import numpy as np\n'), ((491, 673), 'numpy.array', 'np.array', (['[[1.0, 2.0, 1.0, 0.0, 1.0, 2.0, 1.0, 2.0, 1.0, 0.0, 0.0, 3.0, 4.0, 0.0, 4.0,\... |
# coding=utf-8
# Copyright 2018 The DisentanglementLib Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | [
"numpy.load",
"numpy.minimum",
"numpy.cumprod",
"PIL.Image.open",
"numpy.array",
"numpy.dot",
"numpy.prod",
"numpy.repeat"
] | [((2057, 2116), 'numpy.load', 'np.load', (['dataset_path'], {'encoding': '"""latin1"""', 'allow_pickle': '(True)'}), "(dataset_path, encoding='latin1', allow_pickle=True)\n", (2064, 2116), True, 'import numpy as np\n'), ((2139, 2161), 'numpy.array', 'np.array', (["data['imgs']"], {}), "(data['imgs'])\n", (2147, 2161), ... |
# vim: fdm=indent
'''
author: <NAME>
date: 02/03/18
content: Initial quality control of samples.
'''
# Modules
import os
import sys
import argparse
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
os.environ['SINGLET_CONFIG_FILENAME'] = 'singlet.yml'
sys.path.ap... | [
"seaborn.kdeplot",
"argparse.ArgumentParser",
"numpy.maximum",
"mCMV.filenames.get_count_filenames",
"pandas.read_csv",
"numpy.logspace",
"numpy.arange",
"matplotlib.pyplot.tight_layout",
"sys.path.append",
"numpy.linspace",
"collections.Counter",
"numpy.log10",
"matplotlib.pyplot.subplots",... | [((309, 366), 'sys.path.append', 'sys.path.append', (['"""/home/fabio/university/postdoc/singlet"""'], {}), "('/home/fabio/university/postdoc/singlet')\n", (324, 366), False, 'import sys\n'), ((556, 617), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some integers."""'}), "(desc... |
'''
Descripttion:
version:
Author: zpliu
Date: 2021-07-02 21:57:39
LastEditors: zpliu
LastEditTime: 2021-07-02 23:27:38
@param:
'''
import logging
import pandas as pd
import numpy as np
import pybedtools
import re
import pysam
import sys
logger=logging.getLogger()
logger.setLevel(logging.INFO)
logger.info("loadin... | [
"pandas.read_csv",
"re.match",
"pybedtools.BedTool",
"numpy.array",
"re.sub",
"logging.getLogger"
] | [((251, 270), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (268, 270), False, 'import logging\n'), ((838, 941), 'pandas.read_csv', 'pd.read_csv', (['"""./gene_region/homoeolog_promoter_geneBody.bed"""'], {'header': 'None', 'index_col': 'None', 'sep': '"""\t"""'}), "('./gene_region/homoeolog_promoter_gene... |
import gin
import h5py
import numpy as np
import pandas as pd
import time
import models
import utils
from dqn import DQN
from circle import CircleEnv
# Load configuration for DQN and model
gin.parse_config_file('configs/influence/influence.gin')
def influence(state, training_data, test_data, oracle_init_model, orac... | [
"pandas.DataFrame",
"h5py.File",
"numpy.argmax",
"dqn.DQN",
"time.time",
"numpy.array",
"gin.parse_config_file"
] | [((192, 248), 'gin.parse_config_file', 'gin.parse_config_file', (['"""configs/influence/influence.gin"""'], {}), "('configs/influence/influence.gin')\n", (213, 248), False, 'import gin\n'), ((3590, 3723), 'pandas.DataFrame', 'pd.DataFrame', (['state_influences'], {'columns': "['state_x', 'state_y', 'episode', 'step', '... |
import base64
import json
import os
import random
import re
import sys
import threading
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
import zmq
import dataHandler as dh
import symbolDNNClassifier as DNNC
# Model attributes for prediction
classes = 15
tags = ['button', 'input'... | [
"dataHandler._replaceMultiple",
"tensorflow.train.Int64List",
"json.dumps",
"sys.stdout.flush",
"tensorflow.train.FloatList",
"threading.currentThread",
"zmq.Context",
"random.randint",
"os.path.exists",
"datetime.datetime.now",
"tensorflow.train.BytesList",
"threading.Thread",
"tensorflow.k... | [((1473, 1499), 'random.randint', 'random.randint', (['(8000)', '(9000)'], {}), '(8000, 9000)\n', (1487, 1499), False, 'import random\n'), ((2381, 2406), 'dataHandler.handleInferences', 'dh.handleInferences', (['objs'], {}), '(objs)\n', (2400, 2406), True, 'import dataHandler as dh\n'), ((2421, 2465), 'dataHandler._rep... |
# Copyright (C)
# Honda Research Institute Europe GmbH
# Carl-Legien-Str. 30
# 63073 Offenbach/Main
# Germany
#
# UNPUBLISHED PROPRIETARY MATERIAL.
# ALL RIGHTS RESERVED.
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import itertools
import numpy as np
from PyQt5.QtWidgets import QWidget, QVBo... | [
"PyQt5.QtWidgets.QVBoxLayout",
"numpy.array",
"itertools.product"
] | [((2730, 2743), 'PyQt5.QtWidgets.QVBoxLayout', 'QVBoxLayout', ([], {}), '()\n', (2741, 2743), False, 'from PyQt5.QtWidgets import QWidget, QVBoxLayout\n'), ((4095, 4333), 'numpy.array', 'np.array', (["[(self.skeleton_data['RightFoot']['position'][0] + self.skeleton_data[\n 'LeftFoot']['position'][0]) * 0.5, (self.sk... |
# This is a modified version of IRLS implementation in 'sattsmodels'
# Copyright (C) 2006, <NAME>
# All rights reserved.
#
# Copyright (c) 2006-2008 Scipy Developers.
# All rights reserved.
#
# Copyright (c) 2009-2018 statsmodels Developers.
# All rights reserved.
#
#
# Redistribution and use in source and binary form... | [
"scipy.stats.norm.ppf",
"numpy.abs",
"numpy.linalg.lstsq",
"numpy.asarray",
"numpy.sign",
"numpy.sqrt"
] | [((1847, 1868), 'scipy.stats.norm.ppf', 'Gaussian.ppf', (['(3 / 4.0)'], {}), '(3 / 4.0)\n', (1859, 1868), True, 'from scipy.stats import norm as Gaussian\n'), ((5091, 5122), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['X', 'y'], {'rcond': '(-1)'}), '(X, y, rcond=-1)\n', (5106, 5122), True, 'import numpy as np\n'), ((520... |
# -*- coding: utf-8 -*-
"""
Author: <NAME>
================================
"""
from typing import List
import numpy as np
def absorption_coefficient(zc: List[complex], kc: List[complex],
thickness: float, z_air: float):
"""
Returns the Sound Absorption Coefficient.
NOTE 1: The... | [
"numpy.tan",
"numpy.abs"
] | [((797, 819), 'numpy.tan', 'np.tan', (['(kc * thickness)'], {}), '(kc * thickness)\n', (803, 819), True, 'import numpy as np\n'), ((930, 940), 'numpy.abs', 'np.abs', (['vp'], {}), '(vp)\n', (936, 940), True, 'import numpy as np\n')] |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from common.layer_test_class import check_ir_version
from common.onnx_layer_test_class import OnnxRuntimeLayerTest
from unit_tests.utils.graph import build_graph
class TestArgMax(OnnxRuntimeLayerTest):... | [
"onnx.helper.make_node",
"onnx.helper.make_model",
"unit_tests.utils.graph.build_graph",
"onnx.helper.make_tensor_value_info",
"common.layer_test_class.check_ir_version",
"numpy.random.randint",
"pytest.mark.parametrize",
"onnx.helper.make_graph",
"numpy.prod"
] | [((5982, 6026), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params"""', 'test_data'], {}), "('params', test_data)\n", (6005, 6026), False, 'import pytest\n'), ((6032, 6078), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""keepdims"""', '[None, 0]'], {}), "('keepdims', [None, 0])\n", (6055, 6... |
#import libraries
import re
import string
import tensorflow as tf
from numpy import array
from pickle import dump
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Embedd... | [
"tensorflow.keras.preprocessing.text.Tokenizer",
"tensorflow.keras.utils.to_categorical",
"tensorflow.keras.layers.Dense",
"re.escape",
"numpy.array",
"tensorflow.keras.models.Sequential",
"tensorflow.keras.layers.LSTM",
"tensorflow.keras.layers.Embedding",
"tensorflow.keras.callbacks.EarlyStopping"... | [((2241, 2252), 'tensorflow.keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (2250, 2252), False, 'from tensorflow.keras.preprocessing.text import Tokenizer\n'), ((2392, 2408), 'numpy.array', 'array', (['sequences'], {}), '(sequences)\n', (2397, 2408), False, 'from numpy import array\n'), ((2456, 249... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.