code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import os import argparse import numpy as np import tensorflow as tf from tensorflow.keras.layers import Input from tensorflow.keras.models import Model from tensorflow.keras.optimizers import Adam from softlearning.utils.keras import PicklableModel from softlearning.models.convnet import convnet_model from softlearn...
[ "argparse.ArgumentParser", "softlearning.models.feedforward.feedforward_model", "softlearning.utils.keras.PicklableModel", "tensorflow.keras.optimizers.Adam", "numpy.arange", "tensorflow.keras.layers.Input", "softlearning.models.convnet.convnet_model", "os.path.join", "numpy.random.shuffle" ]
[((823, 845), 'numpy.arange', 'np.arange', (['num_samples'], {}), '(num_samples)\n', (832, 845), True, 'import numpy as np\n'), ((850, 876), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (867, 876), True, 'import numpy as np\n'), ((1141, 1197), 'tensorflow.keras.layers.Input', 'Input', ...
# -*- coding: utf-8 -*- """PCA concordance.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1J13PIl7JVDX3jkkMC6ai-9FZippStPe8 """ import pandas as pd import numpy as np from scipy.stats import weightedtau, kendalltau, spearmanr, pearsonr def _ge...
[ "pandas.DataFrame", "numpy.linalg.eigh", "scipy.stats.weightedtau", "numpy.dot" ]
[((772, 798), 'numpy.linalg.eigh', 'np.linalg.eigh', (['dot_matrix'], {}), '(dot_matrix)\n', (786, 798), True, 'import numpy as np\n'), ((1058, 1130), 'pandas.DataFrame', 'pd.DataFrame', (['eigen_vec'], {'index': 'dot_matrix.index', 'columns': 'eigen_val.index'}), '(eigen_vec, index=dot_matrix.index, columns=eigen_val....
#!/usr/bin/env python # -*- coding:utf-8 -*- """ A package of compatibility functions helping to ease the transition between old MIRI data model and the new one. The module serves two purposes: 1) To provide replacements for methods which are not implemented in the new data model. If any of these methods are stil...
[ "miri.datamodels.dqflags.insert_value_column", "os.path.split", "numpy.array" ]
[((4621, 4682), 'numpy.array', 'np.array', (['[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]]'], {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]])\n', (4629, 4682), True, 'import numpy as np\n'), ((4739, 4800), 'numpy.array', 'np.array', (['[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [1.0, 1.0, 1.0]]'], {}), '([[1...
""" Exercise: Linear Regression using Adagrad @auth: <NAME> @date: 2018/09/18 """ # -------------------------------------------------------------------------------- # 1.Import packages # -------------------------------------------------------------------------------- import copy import matplotlib.pyplot as plt import ...
[ "matplotlib.pyplot.tight_layout", "numpy.meshgrid", "numpy.sum", "matplotlib.pyplot.get_cmap", "numpy.std", "matplotlib.pyplot.close", "numpy.power", "copy.copy", "numpy.mean", "numpy.loadtxt", "numpy.linspace", "numpy.random.rand", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig"...
[((1131, 1141), 'numpy.mean', 'np.mean', (['d'], {}), '(d)\n', (1138, 1141), True, 'import numpy as np\n'), ((1154, 1163), 'numpy.std', 'np.std', (['d'], {}), '(d)\n', (1160, 1163), True, 'import numpy as np\n'), ((2745, 2784), 'numpy.linspace', 'np.linspace', (['x_left', 'x_right', 'num_level'], {}), '(x_left, x_right...
from collections import defaultdict import h5py import numpy as np import pandas as pd from itertools import product systems = ['H2', 'LiH', 'Be', 'B', 'Li2', 'C'] ansatzes = ['SD-SJ', 'SD-SJBF', 'MD-SJ', 'MD-SJBF'] def get_mean_err(energies): return energies.mean(), energies.mean(axis=0).std() / np.sqrt(energie...
[ "h5py.File", "collections.defaultdict", "pandas.Series", "itertools.product", "pandas.concat", "numpy.sqrt" ]
[((344, 361), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (355, 361), False, 'from collections import defaultdict\n'), ((367, 423), 'h5py.File', 'h5py.File', (['f"""../data/raw/data_pub_small_systems.h5"""', '"""r"""'], {}), "(f'../data/raw/data_pub_small_systems.h5', 'r')\n", (376, 423), Fals...
import numpy import pandas from tec.ic.ia.p1 import g08_data from tec.ic.ia.pc1 import g08 from sklearn.svm import LinearSVC from sklearn.svm import SVC def non_shuffling_train_test_split(X, y, test_size=0.2): i = int((1 - test_size) * X.shape[0]) + 1 X_train, X_test = numpy.split(X, [i]) y_train, y_test =...
[ "tec.ic.ia.p1.g08_data.shaped_data2", "tec.ic.ia.pc1.g08.generar_muestra_pais", "sklearn.svm.LinearSVC", "numpy.split" ]
[((279, 298), 'numpy.split', 'numpy.split', (['X', '[i]'], {}), '(X, [i])\n', (290, 298), False, 'import numpy\n'), ((321, 340), 'numpy.split', 'numpy.split', (['y', '[i]'], {}), '(y, [i])\n', (332, 340), False, 'import numpy\n'), ((464, 494), 'tec.ic.ia.p1.g08_data.shaped_data2', 'g08_data.shaped_data2', (['dataset'],...
import os import sys import argparse from PIL import Image import numpy as np import cv2 import torch from torch.backends import cudnn import torchvision.transforms as transforms import network from optimizer import restore_snapshot from datasets import cityscapes from config import assert_and_infer_cfg parser = arg...
[ "network.get_net", "numpy.zeros_like", "argparse.ArgumentParser", "os.makedirs", "numpy.argmax", "config.assert_and_infer_cfg", "torchvision.transforms.Normalize", "os.path.exists", "PIL.Image.open", "numpy.where", "torch.cuda.empty_cache", "torch.nn.DataParallel", "torch.no_grad", "os.pat...
[((317, 360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""demo"""'}), "(description='demo')\n", (340, 360), False, 'import argparse\n'), ((851, 895), 'config.assert_and_infer_cfg', 'assert_and_infer_cfg', (['args'], {'train_mode': '(False)'}), '(args, train_mode=False)\n', (871, 895),...
import pandas as pd import numpy as np2 def build(args): # Get medians def get_medians(df_p, last): df_res = df_p.iloc[-last:].groupby(["param"]).median().reset_index()["median"][0] return df_res def medians_params(df_list, age_group, last): params_def = ["age", "beta", "IFR", "Re...
[ "pandas.read_csv", "pandas.DataFrame", "numpy.median" ]
[((709, 785), 'pandas.read_csv', 'pd.read_csv', (['args.params_data_path'], {'encoding': '"""unicode_escape"""', 'delimiter': '""","""'}), "(args.params_data_path, encoding='unicode_escape', delimiter=',')\n", (720, 785), True, 'import pandas as pd\n'), ((827, 896), 'pandas.DataFrame', 'pd.DataFrame', (["params_data_BO...
from __future__ import print_function import numpy as np import tensorflow as tf from agents.base_agent import BaseAgent from agents.network.base_network_manager import BaseNetwork_Manager # from agents.network import ac_network from agents.network import ac_actor_network from agents.network import ac_critic_network f...
[ "experiment.write_summary", "agents.network.ac_critic_network.AC_Critic_Network", "tensorflow.global_variables_initializer", "tensorflow.Session", "numpy.expand_dims", "numpy.random.RandomState", "tensorflow.set_random_seed", "agents.network.ac_actor_network.AC_Actor_Network", "numpy.mean", "numpy...
[((574, 615), 'numpy.random.RandomState', 'np.random.RandomState', (['config.random_seed'], {}), '(config.random_seed)\n', (595, 615), True, 'import numpy as np\n'), ((6207, 6253), 'numpy.reshape', 'np.reshape', (['reward_batch', '(self.batch_size, 1)'], {}), '(reward_batch, (self.batch_size, 1))\n', (6217, 6253), True...
# -*- coding: utf-8 -*- """ @author: <NAME> """ import numpy as np from scipy.stats import norm import chip_local_search as cls import matplotlib.pyplot as plt from scipy.stats import multinomial import generative_model_utils as utils import parameter_estimation as estimate_utils from spectral_clustering import spectr...
[ "generative_model_utils.event_dict_to_aggregated_adjacency", "matplotlib.pyplot.yscale", "numpy.argmax", "numpy.logspace", "parameter_estimation.compute_sample_mean_and_variance", "numpy.histogram", "numpy.mean", "numpy.unique", "numpy.copy", "generative_model_utils.calc_block_pair_size", "numpy...
[((1239, 1302), 'generative_model_utils.event_dict_to_aggregated_adjacency', 'utils.event_dict_to_aggregated_adjacency', (['num_nodes', 'event_dict'], {}), '(num_nodes, event_dict)\n', (1279, 1302), True, 'import generative_model_utils as utils\n'), ((1425, 1502), 'spectral_clustering.spectral_cluster', 'spectral_clust...
from fastText import load_model import joblib import numpy as np import sys def isEnglish(s): try: s.encode(encoding='utf-8').decode('ascii') except UnicodeDecodeError: return False else: return True def is_fence_word(w_embed, center1, center2): distance1 = np.linalg.norm(w_emb...
[ "joblib.load", "fastText.load_model", "numpy.linalg.norm" ]
[((300, 343), 'numpy.linalg.norm', 'np.linalg.norm', (['(w_embed - centers[cluster1])'], {}), '(w_embed - centers[cluster1])\n', (314, 343), True, 'import numpy as np\n'), ((360, 403), 'numpy.linalg.norm', 'np.linalg.norm', (['(w_embed - centers[cluster2])'], {}), '(w_embed - centers[cluster2])\n', (374, 403), True, 'i...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Reads a folder of .md files (with file name formatting of export_notes.pm) and rewrites the mendeley sqlite database notes table with the corresponding document_id notes """ from __future__ import print_function, division __author__ = "<NAME>" __license__ = "MIT" __v...
[ "pandas.DataFrame", "os.path.abspath", "argparse.ArgumentParser", "os.path.basename", "numpy.where", "sqlite3.connect", "os.path.join" ]
[((2389, 2418), 'sqlite3.connect', 'sqlite3.connect', (['DATABASE_LOC'], {}), '(DATABASE_LOC)\n', (2404, 2418), False, 'import sqlite3\n'), ((3546, 3585), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (3569, 3585), False, 'import argparse\n'), ((3761, 3795)...
#!python # -*- coding: utf-8 -*- __version__ = "$Revision: 1.8 $" # $Source: /home/mechanoid/projects/py/cv/bottle/template-matcher/RCS/main.py,v $ # # OS : GNU/Linux 4.10.3-1-ARCH # COMPILER : Python 3.6.0 # # AUTHOR : <NAME> # # http://www.mechanoid.kiev.ua # e-mail : <EMAIL> # - - - - - - - - - - - - -...
[ "os.path.basename", "cv2.cvtColor", "cv2.imwrite", "numpy.nonzero", "cv2.imread", "numpy.max", "numpy.where", "cv2.rectangle", "os.path.join", "os.listdir", "cv2.matchTemplate" ]
[((688, 741), 'cv2.matchTemplate', 'cv2.matchTemplate', (['img', 'img_tpl', 'cv2.TM_CCOEFF_NORMED'], {}), '(img, img_tpl, cv2.TM_CCOEFF_NORMED)\n', (705, 741), False, 'import cv2\n'), ((764, 781), 'numpy.max', 'np.max', (['match_map'], {}), '(match_map)\n', (770, 781), True, 'import numpy as np\n'), ((1282, 1332), 'num...
import os import pandas as pd import pickle import ast import numpy as np def open_dict_txt(dict_filename): file = open(dict_filename, "r") contents = file.read() dictionary = ast.literal_eval(contents) file.close() return dictionary DATASETS = ['sensorless_drive', 'segment', ...
[ "pandas.DataFrame", "pandas.DataFrame.from_dict", "os.path.exists", "numpy.array", "ast.literal_eval", "os.path.join", "os.listdir" ]
[((189, 215), 'ast.literal_eval', 'ast.literal_eval', (['contents'], {}), '(contents)\n', (205, 215), False, 'import ast\n'), ((2438, 2476), 'os.path.join', 'os.path.join', (['gdrive_rpath', 'MODEL_NAME'], {}), '(gdrive_rpath, MODEL_NAME)\n', (2450, 2476), False, 'import os\n'), ((6264, 6293), 'pandas.DataFrame', 'pd.D...
__license__ = "MIT" __author__ = "<NAME> (BGT) @ Johns Hopkins University" __startdate__ = "2016.01.11" __name__ = "cnn" __module__ = "Network" __lastdate__ = "2016.01.19" __version__ = "0.01" # To-do: # - Need to make stepsize adaptive # - Perturb the results every 100 mini_batches and choose the best solution a...
[ "numpy.sum", "numpy.random.randn", "numpy.argmax", "numpy.roll", "numpy.asarray", "numpy.einsum", "numpy.zeros", "numpy.equal", "numpy.prod", "numpy.mean", "numpy.arange", "numpy.matmul", "numpy.random.shuffle", "numpy.sqrt" ]
[((2125, 2157), 'numpy.random.randn', 'np.random.randn', (['self.n_features'], {}), '(self.n_features)\n', (2140, 2157), True, 'import numpy as np\n'), ((2409, 2441), 'numpy.random.randn', 'np.random.randn', (['self.n_features'], {}), '(self.n_features)\n', (2424, 2441), True, 'import numpy as np\n'), ((2868, 2895), 'n...
__description__ = \ """ Base class for simulating genotype phenotype maps from epistasis models. """ __author__ = "<NAME>" from .distribution import DistributionSimulation from epistasis.mapping import encoding_to_sites, assert_epistasis from epistasis.matrix import get_model_matrix import gpmap from gpmap import Gen...
[ "gpmap.utils.genotypes_to_mutations", "numpy.zeros", "gpmap.utils.mutations_to_genotypes", "epistasis.matrix.get_model_matrix", "epistasis.mapping.encoding_to_sites" ]
[((2126, 2176), 'epistasis.mapping.encoding_to_sites', 'encoding_to_sites', (['self.order', 'self.encoding_table'], {}), '(self.order, self.encoding_table)\n', (2143, 2176), False, 'from epistasis.mapping import encoding_to_sites, assert_epistasis\n'), ((4089, 4115), 'numpy.zeros', 'np.zeros', (['self.epistasis.n'], {}...
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import h5py m = 1 l_a = 1 l_r = 0.5 C_a = 1 C_r = 0.5 alpha = 1 beta = 0.5 N = 40 D = 2 num_steps = 4000 np.random.seed(3) # q_prime = f(q) z = np.zeros([3*N, D, num_steps]) #[x,v,a] = [x, f] = [q, a] x = z[:N, :, :] ...
[ "h5py.File", "numpy.random.seed", "numpy.sum", "numpy.zeros", "numpy.arange", "numpy.exp", "numpy.random.rand" ]
[((205, 222), 'numpy.random.seed', 'np.random.seed', (['(3)'], {}), '(3)\n', (219, 222), True, 'import numpy as np\n'), ((246, 277), 'numpy.zeros', 'np.zeros', (['[3 * N, D, num_steps]'], {}), '([3 * N, D, num_steps])\n', (254, 277), True, 'import numpy as np\n'), ((428, 440), 'numpy.arange', 'np.arange', (['N'], {}), ...
from numpy import inner from numpy.linalg import norm def cosine_similarity(a, b): na, nb = norm(a), norm(b) if na == .0 or nb == .0: return .0 return inner(a, b)/(norm(a)*norm(b))
[ "numpy.linalg.norm", "numpy.inner" ]
[((98, 105), 'numpy.linalg.norm', 'norm', (['a'], {}), '(a)\n', (102, 105), False, 'from numpy.linalg import norm\n'), ((107, 114), 'numpy.linalg.norm', 'norm', (['b'], {}), '(b)\n', (111, 114), False, 'from numpy.linalg import norm\n'), ((173, 184), 'numpy.inner', 'inner', (['a', 'b'], {}), '(a, b)\n', (178, 184), Fal...
import unittest import numpy as np from spectralcluster import laplacian from spectralcluster import utils LaplacianType = laplacian.LaplacianType class TestComputeLaplacian(unittest.TestCase): """Tests for the compute_laplacian function.""" def test_affinity(self): matrix = np.array([[3, 4], [-4, 3], [6, ...
[ "unittest.main", "spectralcluster.utils.compute_affinity_matrix", "numpy.allclose", "numpy.array", "numpy.array_equal", "spectralcluster.laplacian.compute_laplacian" ]
[((1980, 1995), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1993, 1995), False, 'import unittest\n'), ((289, 334), 'numpy.array', 'np.array', (['[[3, 4], [-4, 3], [6, 8], [-3, -4]]'], {}), '([[3, 4], [-4, 3], [6, 8], [-3, -4]])\n', (297, 334), True, 'import numpy as np\n'), ((350, 387), 'spectralcluster.utils....
# common import abbreviations import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns import pandas as pd import patsy import itertools as it import collections as co import functools as ft import os.path as osp import glob import textwrap # finally, a better idiom for warni...
[ "numpy.random.seed", "numpy.sum", "numpy.argmax", "numpy.empty", "numpy.mean", "numpy.arange", "matplotlib.pyplot.gca", "itertools.cycle", "pandas.set_option", "numpy.round", "numpy.unique", "numpy.set_printoptions", "numpy.meshgrid", "matplotlib.ticker.FixedLocator", "numpy.max", "num...
[((349, 424), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning', 'module': '"""sklearn"""'}), "('ignore', category=FutureWarning, module='sklearn')\n", (372, 424), False, 'import sklearn, warnings\n'), ((805, 852), 'numpy.set_printoptions', 'np.set_printoptions', ([],...
# Author: <NAME> import unittest import numpy as np from PySeismoSoil.class_site_factors import Site_Factors as SF from PySeismoSoil.class_frequency_spectrum import Frequency_Spectrum as FS class Test_Class_Site_Factors(unittest.TestCase): ''' Unit test for Site_Factors class ''' def test_range_check...
[ "numpy.meshgrid", "unittest.TextTestRunner", "PySeismoSoil.class_site_factors.Site_Factors", "numpy.allclose", "PySeismoSoil.class_site_factors.Site_Factors._range_check", "PySeismoSoil.class_site_factors.Site_Factors._search_sorted", "scipy.interpolate.RegularGridInterpolator", "unittest.TestLoader",...
[((2728, 2762), 'PySeismoSoil.class_site_factors.Site_Factors._search_sorted', 'SF._search_sorted', (['(24)', 'z1000_array'], {}), '(24, z1000_array)\n', (2745, 2762), True, 'from PySeismoSoil.class_site_factors import Site_Factors as SF\n'), ((2816, 2850), 'PySeismoSoil.class_site_factors.Site_Factors._search_sorted',...
#!/usr/bin/env python import numpy.ma as ma import os,sys, subprocess, math, datetime from os.path import basename import numpy as np import time as tt import gdal import h5py from datetime import timedelta,datetime from gdalconst import GDT_Float32, GA_Update from osgeo import ogr, osr #TODO: change for handling of ...
[ "numpy.amin", "numpy.ones", "gdal.GetDriverByName", "os.path.exists", "numpy.max", "numpy.reshape", "h5py.File", "numpy.average", "os.path.basename", "os.path.realpath", "os.system", "numpy.min", "datetime.datetime.fromtimestamp", "sys.exit", "numpy.ma.masked_equal", "gdal.Open", "nu...
[((462, 491), 'os.path.basename', 'os.path.basename', (['fileAbsPath'], {}), '(fileAbsPath)\n', (478, 491), False, 'import os, sys, subprocess, math, datetime\n'), ((716, 743), 'h5py.File', 'h5py.File', (['fileAbsPath', '"""r"""'], {}), "(fileAbsPath, 'r')\n", (725, 743), False, 'import h5py\n'), ((762, 791), 'gdal.Get...
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "absl.testing.absltest.main", "numpy.random.seed", "numpy.isnan", "numpy.sin", "numpy.testing.assert_array_almost_equal", "sofima.map_utils.compose_maps", "numpy.zeros_like", "sofima.map_utils.fill_missing", "connectomics.common.bounding_box.BoundingBox", "numpy.isfinite", "sofima.map_utils.to_r...
[((8599, 8614), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (8612, 8614), False, 'from absl.testing import absltest\n'), ((1300, 1397), 'scipy.interpolate.griddata', 'interpolate.griddata', (['data_points', 'coord_map[0, 0, ...][valid]', 'query_points'], {'method': '"""linear"""'}), "(data_points, ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import numpy as np # =============== function =============== # def split_n(line, length): """ n 文字毎に分割する関数 Args: line (str): 対象文字列 length (int): 分割後の個別の文字列の長さ Returns: list """ return [line[i:i+length] for i in range(0, len(line), length)] ...
[ "numpy.array", "numpy.dot", "sys.stderr.write", "numpy.delete", "sys.exit" ]
[((3304, 3320), 'numpy.array', 'np.array', (['coords'], {}), '(coords)\n', (3312, 3320), True, 'import numpy as np\n'), ((4284, 4304), 'numpy.array', 'np.array', (['new_coords'], {}), '(new_coords)\n', (4292, 4304), True, 'import numpy as np\n'), ((5429, 5467), 'numpy.delete', 'np.delete', (['self._coords', 'idx_remove...
# Authors: <NAME> """ This example shows the most simple way of using a solver. We solve free vibration of a simple oscillator:: m \ddot{u} + k u = 0, u(0) = u_0, \dot{u}(0) = \dot{u}_0 using the CVODE solver, which means we use a rhs function of \dot{u}. Solution:: u(t) = u_0*cos(sqrt(k/m)*t)+\dot{u}_0...
[ "scikits.odes.ode", "numpy.sqrt" ]
[((799, 834), 'scikits.odes.ode', 'ode', (['"""cvode"""', 'rhseqn'], {'old_api': '(False)'}), "('cvode', rhseqn, old_api=False)\n", (802, 834), False, 'from scikits.odes import ode\n'), ((1164, 1175), 'numpy.sqrt', 'sqrt', (['(k / m)'], {}), '(k / m)\n', (1168, 1175), False, 'from numpy import asarray, cos, sin, sqrt\n...
import unittest from imgaug.augmenters.meta import Augmenter, Sequential import numpy as np from autoPyTorch.pipeline.components.setup.augmentation.image.ImageAugmenter import ImageAugmenter class TestImageAugmenter(unittest.TestCase): def test_every_augmenter(self): image_augmenter = ImageAugmenter() ...
[ "unittest.main", "numpy.random.randint", "autoPyTorch.pipeline.components.setup.augmentation.image.ImageAugmenter.ImageAugmenter" ]
[((2253, 2268), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2266, 2268), False, 'import unittest\n'), ((303, 319), 'autoPyTorch.pipeline.components.setup.augmentation.image.ImageAugmenter.ImageAugmenter', 'ImageAugmenter', ([], {}), '()\n', (317, 319), False, 'from autoPyTorch.pipeline.components.setup.augment...
# Licensed under an MIT style license -- see LICENSE.md try: import pepredicates as pep PEP = True except ImportError: PEP = False import numpy as np import pandas as pd from pesummary.core.plots.figure import ExistingFigure from pesummary.utils.utils import logger __author__ = ["<NAME> <<EMAIL>>"] def...
[ "pandas.DataFrame", "pepredicates.plot_predicates", "pesummary.utils.utils.logger.debug", "pepredicates.is_BNS", "pepredicates.is_BBH", "pepredicates.rewt_approx_massdist_redshift", "pepredicates.is_NSBH", "pepredicates.is_MG", "pesummary.utils.utils.RedirectLogger", "numpy.round" ]
[((2503, 2517), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2515, 2517), True, 'import pandas as pd\n'), ((3486, 3528), 'pepredicates.rewt_approx_massdist_redshift', 'pep.rewt_approx_massdist_redshift', (['samples'], {}), '(samples)\n', (3519, 3528), True, 'import pepredicates as pep\n'), ((5572, 5620), 'pes...
#!/usr/bin/env python # Copyright 2016 NeuroData (http://neurodata.io) # # 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 ...
[ "vtk.vtkVolumeProperty", "dipy.viz.actor.line", "numpy.median", "vtk.vtkVolume", "dipy.viz.window.Renderer", "vtk.vtkPiecewiseFunction", "vtk.vtkNIFTIImageReader", "vtk.vtkSmartVolumeMapper", "os.path.split", "dipy.viz.window.record", "vtk.vtkColorTransferFunction" ]
[((1913, 1930), 'dipy.viz.window.Renderer', 'window.Renderer', ([], {}), '()\n', (1928, 1930), False, 'from dipy.viz import window, actor\n'), ((2036, 2052), 'dipy.viz.actor.line', 'actor.line', (['fibs'], {}), '(fibs)\n', (2046, 2052), False, 'from dipy.viz import window, actor\n'), ((2512, 2577), 'dipy.viz.window.rec...
#coding=utf-8 import numpy as np class Vector(object): def __init__(self): self._array = np.array([0., 0.],dtype=np.float64) @property def x(self): return self._array[0] @property def y(self): return self._array[1]
[ "numpy.array" ]
[((102, 140), 'numpy.array', 'np.array', (['[0.0, 0.0]'], {'dtype': 'np.float64'}), '([0.0, 0.0], dtype=np.float64)\n', (110, 140), True, 'import numpy as np\n')]
import numpy as np def compress_image(image, num_values): """Compress an image using SVD and keeping the top `num_values` singular values. Args: image: numpy array of shape (H, W) num_values: number of singular values to keep Returns: compressed_image: numpy array of shape (H, W)...
[ "numpy.linalg.svd", "numpy.zeros_like", "numpy.expand_dims" ]
[((438, 458), 'numpy.zeros_like', 'np.zeros_like', (['image'], {}), '(image)\n', (451, 458), True, 'import numpy as np\n'), ((714, 734), 'numpy.linalg.svd', 'np.linalg.svd', (['image'], {}), '(image)\n', (727, 734), True, 'import numpy as np\n'), ((1001, 1032), 'numpy.expand_dims', 'np.expand_dims', (['U[:, i]'], {'axi...
from numpy import zeros, trim_zeros, ones, linspace, concatenate, std,\ roll, diff, any, digitize, savetxt, append, array, savez_compressed, mean,\ sqrt from pickle import dump import matplotlib.pyplot as plt from ShapeGen import * from CrossSection import * from flow import * from sediment import * import sys from o...
[ "matplotlib.pyplot.show", "numpy.concatenate", "matplotlib.pyplot.plot", "numpy.roll", "numpy.zeros", "matplotlib.pyplot.axis", "os.path.exists", "numpy.ones", "numpy.mean", "numpy.linspace", "sys.exit" ]
[((2179, 2191), 'numpy.zeros', 'zeros', (['(t + 1)'], {}), '(t + 1)\n', (2184, 2191), False, 'from numpy import zeros, trim_zeros, ones, linspace, concatenate, std, roll, diff, any, digitize, savetxt, append, array, savez_compressed, mean, sqrt\n'), ((2195, 2207), 'numpy.zeros', 'zeros', (['(t + 1)'], {}), '(t + 1)\n',...
import matplotlib.animation as animation import matplotlib.cm as cm import matplotlib.pylab as plt from nilearn.image import load_img import numpy as np import os as os import pandas as pd # plot exemplar prediction set def draw_image_masks(brain_img, true_mask, predicted_mask): my_cmap_predict = cm.jet my_cm...
[ "matplotlib.pylab.show", "os.makedirs", "matplotlib.pylab.imshow", "nilearn.image.load_img", "matplotlib.pylab.title", "os.path.exists", "os.walk", "matplotlib.pylab.plot", "matplotlib.pylab.close", "numpy.random.rand", "matplotlib.pylab.tight_layout", "os.path.join", "matplotlib.pylab.figur...
[((455, 490), 'matplotlib.pylab.imshow', 'plt.imshow', (['brain_img'], {'cmap': '"""Greys"""'}), "(brain_img, cmap='Greys')\n", (465, 490), True, 'import matplotlib.pylab as plt\n'), ((513, 614), 'matplotlib.pylab.imshow', 'plt.imshow', (['predicted_mask'], {'cmap': 'my_cmap_predict', 'interpolation': '"""none"""', 'cl...
''' This file containts the run algorithm for the transit search ''' import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib import colors import itertools import numpy as np import multiprocessing as mp import os from tqdm import tqdm import pickle from transitleastsquares import transi...
[ "pickle.dump", "transitleastsquares.transitleastsquares", "numpy.abs", "numpy.sum", "matplotlib.colors.PowerNorm", "numpy.argmax", "numpy.shape", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "matplotlib.pyplot.tight_layout", "os.path.join", "multiprocessing.cp...
[((1974, 2060), 'numpy.arange', 'np.arange', (['self.TDurLower', '(self.TDurHigher + self.TDurStepSize)', 'self.TDurStepSize'], {}), '(self.TDurLower, self.TDurHigher + self.TDurStepSize, self.\n TDurStepSize)\n', (1983, 2060), True, 'import numpy as np\n'), ((10637, 10664), 'numpy.array', 'np.array', (['self.AllMod...
from __future__ import absolute_import from __future__ import division from builtins import zip from builtins import range import scipy.spatial as spa import scipy.linalg as lin import numpy as np def prepare_input(file_name): #pylint: disable=unused-argument """Read in from list of files and output them as...
[ "numpy.cross", "numpy.any", "numpy.linalg.det", "numpy.arange", "numpy.array", "builtins.zip", "scipy.linalg.norm", "numpy.dot", "scipy.spatial.ConvexHull", "builtins.range", "numpy.vstack" ]
[((997, 1022), 'scipy.spatial.ConvexHull', 'spa.ConvexHull', (['data_list'], {}), '(data_list)\n', (1011, 1022), True, 'import scipy.spatial as spa\n'), ((1457, 1489), 'numpy.arange', 'np.arange', (['three_points.shape[1]'], {}), '(three_points.shape[1])\n', (1466, 1489), True, 'import numpy as np\n'), ((2369, 2381), '...
# MIT License # # Copyright (c) 2021 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
[ "numpy.arctan2", "dsorlib.utils.wrapAngle", "numpy.linalg.norm", "numpy.array", "numpy.cos", "numpy.sin" ]
[((2735, 2765), 'numpy.array', 'np.array', (['[self._yc, self._xc]'], {}), '([self._yc, self._xc])\n', (2743, 2765), True, 'import numpy as np\n'), ((2779, 2809), 'numpy.array', 'np.array', (['[self._ys, self._xs]'], {}), '([self._ys, self._xs])\n', (2787, 2809), True, 'import numpy as np\n'), ((2828, 2851), 'numpy.lin...
""" You can use this script to evaluate prediction files (valpreds.npy). Essentially this is needed if you want to, say, combine answer and rationale predictions. """ import numpy as np import json import os # get gt labels labels = { 'val_rationale': [], 'test_rationale': [], 'val_answer': [], 'test_a...
[ "json.loads", "numpy.mean", "numpy.array", "numpy.exp", "os.path.join" ]
[((673, 692), 'numpy.array', 'np.array', (['labels[k]'], {}), '(labels[k])\n', (681, 692), True, 'import numpy as np\n'), ((1651, 1660), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (1657, 1660), True, 'import numpy as np\n'), ((483, 499), 'json.loads', 'json.loads', (['line'], {}), '(line)\n', (493, 499), False, 'impo...
import h5py import numpy import scipy.sparse import scipy.linalg import sys from afqmctools.utils.io import ( to_qmcpack_complex, from_qmcpack_complex ) from afqmctools.hamiltonian.io import ( write_sparse_basic, write_sparse_chol_chunk ) def get_dset_simple(fh5, name):...
[ "h5py.File", "numpy.abs", "numpy.tril", "afqmctools.hamiltonian.io.write_sparse_basic", "numpy.zeros", "afqmctools.utils.io.from_qmcpack_complex", "numpy.argsort", "afqmctools.utils.io.to_qmcpack_complex", "numpy.array", "numpy.real", "numpy.unique" ]
[((20756, 20791), 'numpy.zeros', 'numpy.zeros', (['nkp'], {'dtype': 'numpy.int32'}), '(nkp, dtype=numpy.int32)\n', (20767, 20791), False, 'import numpy\n'), ((25629, 25664), 'numpy.zeros', 'numpy.zeros', (['nkp'], {'dtype': 'numpy.int32'}), '(nkp, dtype=numpy.int32)\n', (25640, 25664), False, 'import numpy\n'), ((25683...
from pysb.tools.sensitivity_analysis import \ PairwiseSensitivity, InitialsSensitivity from pysb.examples.tyson_oscillator import model import numpy as np import numpy.testing as npt import os from pysb.simulator.scipyode import ScipyOdeSimulator import tempfile import shutil from nose.tools import raises class T...
[ "pysb.simulator.scipyode.ScipyOdeSimulator", "numpy.average", "shutil.rmtree", "numpy.testing.assert_almost_equal", "os.path.exists", "tempfile.mkdtemp", "numpy.array", "numpy.linspace", "nose.tools.raises", "os.path.join", "pysb.tools.sensitivity_analysis.PairwiseSensitivity", "pysb.tools.sen...
[((6569, 6587), 'nose.tools.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (6575, 6587), False, 'from nose.tools import raises\n'), ((7262, 7280), 'nose.tools.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (7268, 7280), False, 'from nose.tools import raises\n'), ((7613, 7630), 'nose.tools.raises...
import sys import numpy as np from scipy.misc import * def to_cylindrical(image, camera_params): F, k1, k2 = camera_params cyl_img_pts = np.mgrid[:image.shape[0], :image.shape[1]].transpose(1,2,0).astype(np.float32) x_cyl = cyl_img_pts[..., 1] y_cyl = cyl_img_pts[..., 0] # Convert from cylindric...
[ "numpy.dstack", "numpy.sin", "numpy.loadtxt", "numpy.cos" ]
[((589, 602), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (595, 602), True, 'import numpy as np\n'), ((629, 642), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (635, 642), True, 'import numpy as np\n'), ((1257, 1318), 'numpy.dstack', 'np.dstack', (['[yPrime[..., np.newaxis], xPrime[..., np.newaxis]]'], ...
from scipy import optimize import numpy as np def IR_constraint(Rtype,pH,pL,B,A,p): if Rtype=='sqroot': def f(x,a): return pH*(x**(0.5)-B*x/(pH-pL))-(x-a) def grad(x): return pH*0.5*x**(-0.5)-pH*B/(pH-pL)-1 sol = np.zeros((A.size)) for i in range(0,...
[ "numpy.log", "numpy.zeros", "scipy.optimize.newton" ]
[((276, 292), 'numpy.zeros', 'np.zeros', (['A.size'], {}), '(A.size)\n', (284, 292), True, 'import numpy as np\n'), ((641, 657), 'numpy.zeros', 'np.zeros', (['A.size'], {}), '(A.size)\n', (649, 657), True, 'import numpy as np\n'), ((1016, 1032), 'numpy.zeros', 'np.zeros', (['A.size'], {}), '(A.size)\n', (1024, 1032), T...
import pandas as pd import numpy as np import tensorflow as tf import functools from witwidget.notebook.visualization import WitConfigBuilder from witwidget.notebook.visualization import WitWidget # Creates a tf feature spec from the dataframe and columns specified. def create_feature_spec(df, columns=None): feat...
[ "functools.partial", "tensorflow.train.Example", "tensorflow.feature_column.numeric_column", "numpy.dtype", "tensorflow.TensorShape", "witwidget.notebook.visualization.WitConfigBuilder", "tensorflow.io.parse_example", "tensorflow.io.FixedLenFeature" ]
[((2426, 2494), 'tensorflow.io.parse_example', 'tf.io.parse_example', ([], {'serialized': 'example_proto', 'features': 'feature_spec'}), '(serialized=example_proto, features=feature_spec)\n', (2445, 2494), True, 'import tensorflow as tf\n'), ((4104, 4180), 'functools.partial', 'functools.partial', (['tfexamples_input_f...
import logging import os import numpy as np import pandas as pd import seaborn as sb from matplotlib import pyplot as plt from observers import dynamics_traj_observer from utils import RMS, log_multivariate_normal_likelihood, reshape_pt1, \ reshape_dim1, interpolate sb.set_style('whitegrid') # Some useful plot...
[ "matplotlib.pyplot.title", "numpy.arange", "utils.log_multivariate_normal_likelihood", "matplotlib.pyplot.fill_between", "os.path.join", "pandas.DataFrame", "logging.warning", "matplotlib.pyplot.close", "utils.RMS", "seaborn.set_style", "utils.reshape_dim1", "matplotlib.pyplot.show", "matplo...
[((274, 299), 'seaborn.set_style', 'sb.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (286, 299), True, 'import seaborn as sb\n'), ((3097, 3130), 'numpy.zeros', 'np.zeros', (['(rollout_length + 1, 1)'], {}), '((rollout_length + 1, 1))\n', (3105, 3130), True, 'import numpy as np\n'), ((6731, 6762), 'utils.RMS...
# coding:utf-8 import tensorflow as tf import numpy as np import time from ReinforcementLearning.Modules.Environments.IEnv import IEnv from ReinforcementLearning.Modules.Models.Models import DDPG_Model_v1, DDPG_Global_And_Local_Models_v1, \ DDPG_Model_v2_With_Reward_PreCorr from ReinforcementLearning.Modules.Agents...
[ "threading.Thread", "ReinforcementLearning.Modules.Models.Models.DDPG_Global_And_Local_Models_v1", "tensorflow.train.Coordinator", "ReinforcementLearning.Modules.Models.Models.DDPG_Model_v2_With_Reward_PreCorr", "ReinforcementLearning.Modules.DataAnalysisTools.DataMonitor.LineConfig", "copy.deepcopy", "...
[((3851, 3863), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (3861, 3863), True, 'import tensorflow as tf\n'), ((3994, 4193), 'ReinforcementLearning.Modules.Models.Models.DDPG_Global_And_Local_Models_v1', 'DDPG_Global_And_Local_Models_v1', ([], {'is_global_model': '(True)', 'a_dim': 'self.action_space', 's_dim...
from __future__ import annotations import numpy as np import pytest import xarray as xr from scipy.stats import genpareto, norm, uniform from xclim.core.options import set_options from xclim.core.units import convert_units_to from xclim.sdba.adjustment import ( LOCI, DetrendedQuantileMapping, EmpiricalQua...
[ "xclim.sdba.processing.uniform_noise_like", "xarray.testing.assert_equal", "scipy.stats.norm.rvs", "xclim.sdba.base.Grouper", "xclim.core.units.convert_units_to", "xclim.sdba.adjustment.LOCI.from_dataset", "numpy.arange", "pytest.mark.parametrize", "numpy.testing.assert_array_almost_equal", "xclim...
[((796, 866), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""group,dec"""', "(['time', 2], ['time.month', 1])"], {}), "('group,dec', (['time', 2], ['time.month', 1]))\n", (819, 866), False, 'import pytest\n'), ((2214, 2299), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""kind,name"""', "[(ADDI...
from abc import ABC, abstractmethod from typing import List, Optional from gym import Space, spaces import numpy as np from stable_baselines3.common import noise from yacht import Mode, utils from yacht.config import Config from yacht.config.proto.environment_pb2 import EnvironmentConfig from yacht.data.datasets impo...
[ "yacht.environments.action_noises.build_action_noise", "yacht.utils.build_from_kwargs", "stable_baselines3.common.noise.VectorizedActionNoise", "yacht.environments.action_noises.apply_action_noise", "numpy.clip", "numpy.min", "numpy.where", "numpy.array", "gym.spaces.Box", "numpy.max" ]
[((4742, 4829), 'yacht.utils.build_from_kwargs', 'utils.build_from_kwargs', (['action_schema_class', 'action_schema_kwargs'], {'to_numpy': '(False)'}), '(action_schema_class, action_schema_kwargs, to_numpy\n =False)\n', (4765, 4829), False, 'from yacht import Mode, utils\n'), ((1702, 1743), 'numpy.array', 'np.array'...
import os import numpy as np IMG_EXTENSIONS = ['.h5', ] def is_image_file(filename): """Check whether this file has specified extensions (".h5") or not. Args: filename (str): Image filename Returns: bool: Whether this file's extension is in IMG_EXTENSIONS or not. """ return any(...
[ "os.path.expanduser", "os.path.isdir", "os.walk", "numpy.random.random", "os.path.join", "os.listdir" ]
[((827, 850), 'os.path.expanduser', 'os.path.expanduser', (['dir'], {}), '(dir)\n', (845, 850), False, 'import os\n'), ((876, 891), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (886, 891), False, 'import os\n'), ((906, 931), 'os.path.join', 'os.path.join', (['dir', 'target'], {}), '(dir, target)\n', (918, 931)...
import numpy as np import bokeh.plotting as bpl class plotter: ''' This object is meant to emulate a matplotlib.pyplot.figure object, but with the bokeh html plotting library. ''' def __init__(self, rootpath=None): ''' ARGUMENTS: rootpath - String of a path to a directo...
[ "bokeh.plotting.figure", "bokeh.plotting.output_file", "bokeh.plotting.show", "numpy.array", "numpy.linspace", "bokeh.plotting.save" ]
[((4267, 4289), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(100)'], {}), '(0, 1, 100)\n', (4278, 4289), True, 'import numpy as np\n'), ((3620, 3638), 'bokeh.plotting.show', 'bpl.show', (['self.fig'], {}), '(self.fig)\n', (3628, 3638), True, 'import bokeh.plotting as bpl\n'), ((4138, 4156), 'bokeh.plotting.save',...
import numpy as np import tensorflow as tf from onnx_tf.common import sys_config class PadMixin(object): @classmethod def get_padding_as_op(cls, x, pads): num_dim = int(len(pads) / 2) tf_pads = np.transpose(np.array(pads).reshape([2, num_dim])) if sys_config.device == 'MCU': # make sure to ...
[ "tensorflow.pad", "numpy.array" ]
[((650, 668), 'tensorflow.pad', 'tf.pad', (['x', 'padding'], {}), '(x, padding)\n', (656, 668), True, 'import tensorflow as tf\n'), ((223, 237), 'numpy.array', 'np.array', (['pads'], {}), '(pads)\n', (231, 237), True, 'import numpy as np\n'), ((538, 555), 'numpy.array', 'np.array', (['tf_pads'], {}), '(tf_pads)\n', (54...
import time import numpy as np from ..misc import NumpyRNGContext def func(i): """An identity function that jitters its execution time by a pseudo-random amount. FIXME: This function should be defined in test_console.py, but Astropy's `python setup.py test` interacts strangely with Python's `multip...
[ "numpy.random.uniform" ]
[((543, 569), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(0.01)'], {}), '(0, 0.01)\n', (560, 569), True, 'import numpy as np\n')]
import unittest import numpy as np from pysster.One_Hot_Encoder import One_Hot_Encoder class Test_One_Hot_Encoder(unittest.TestCase): def setUp(self): self.one = One_Hot_Encoder("ACGT") self.reference_seq = "GATTACA" self.reference_one_hot = np.array([[0,0,1,0], ...
[ "numpy.array_equal", "pysster.One_Hot_Encoder.One_Hot_Encoder", "numpy.array" ]
[((191, 214), 'pysster.One_Hot_Encoder.One_Hot_Encoder', 'One_Hot_Encoder', (['"""ACGT"""'], {}), "('ACGT')\n", (206, 214), False, 'from pysster.One_Hot_Encoder import One_Hot_Encoder\n'), ((289, 417), 'numpy.array', 'np.array', (['[[0, 0, 1, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1], [1, 0, 0, 0], [0, \n 1, 0, 0...
""" Copyright 2021 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
[ "pandas.read_excel", "pandas.DataFrame", "pandas.ExcelWriter", "numpy.array" ]
[((677, 705), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['"""out_1.xlsx"""'], {}), "('out_1.xlsx')\n", (691, 705), True, 'import pandas as pd\n'), ((744, 817), 'pandas.read_excel', 'pd.read_excel', (['"""测点-测压阀-第1批.xlsx"""'], {'sheet_name': 'name', 'header': 'None', 'dtype': 'str'}), "('测点-测压阀-第1批.xlsx', sheet_name=name...
# -*- coding: utf-8 -*- """ Created on Thu Sep 28 09:28:15 2017 @author: tkoller """ import warnings import casadi as cas import numpy as np from casadi import MX, mtimes, vertcat from casadi import reshape as cas_reshape from .gp_reachability_casadi import lin_ellipsoid_safety_distance from .uncertainty_propagation...
[ "casadi.MX.eye", "casadi.nlpsol", "casadi.reshape", "numpy.copy", "numpy.random.randn", "numpy.zeros", "numpy.hstack", "numpy.shape", "casadi.vertcat", "casadi.mtimes", "casadi.MX.sym", "casadi.Function", "numpy.array", "numpy.dot", "numpy.eye", "warnings.warn", "numpy.vstack" ]
[((3535, 3560), 'numpy.shape', 'np.shape', (['self.h_mat_safe'], {}), '(self.h_mat_safe)\n', (3543, 3560), True, 'import numpy as np\n'), ((3816, 3832), 'numpy.eye', 'np.eye', (['self.n_s'], {}), '(self.n_s)\n', (3822, 3832), True, 'import numpy as np\n'), ((3850, 3880), 'numpy.zeros', 'np.zeros', (['(self.n_s, self.n_...
import scipy.io.wavfile as wav import noisereduce as nr import sounddevice as sd import numpy as np import pyaudio import matplotlib.pyplot as plt import soundfile as sf import time def denoiser(file): data, fs = sf.read(file, dtype='int16') noise, fs = sf.read('./tmp/static.wav', dtype='int16') data = lis...
[ "soundfile.read", "numpy.array", "noisereduce.reduce_noise", "scipy.io.wavfile.write" ]
[((218, 246), 'soundfile.read', 'sf.read', (['file'], {'dtype': '"""int16"""'}), "(file, dtype='int16')\n", (225, 246), True, 'import soundfile as sf\n'), ((263, 305), 'soundfile.read', 'sf.read', (['"""./tmp/static.wav"""'], {'dtype': '"""int16"""'}), "('./tmp/static.wav', dtype='int16')\n", (270, 305), True, 'import ...
''' =============================================================================== -- Author: <NAME>, <NAME> -- Create date: 04/11/2020 -- Description: This codes is for aligning templates bade on ORB. ORB (Oriented FAST and Rotated BRIEF) ORB is a FAST keypoint detector an...
[ "cv2.warpPerspective", "cv2.drawMatches", "cv2.waitKey", "cv2.cvtColor", "cv2.addWeighted", "numpy.hstack", "cv2.imread", "cv2.ORB_create", "cv2.DescriptorMatcher_create", "imutils.resize", "cv2.imshow", "cv2.findHomography" ]
[((1998, 2021), 'cv2.imread', 'cv2.imread', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (2008, 2021), False, 'import cv2\n'), ((2032, 2055), 'cv2.imread', 'cv2.imread', (['sys.argv[2]'], {}), '(sys.argv[2])\n', (2042, 2055), False, 'import cv2\n'), ((2226, 2260), 'imutils.resize', 'imutils.resize', (['aligned'], {'width'...
# %% """ Created on Sat Mar 20 09:43:09 2021 @author: j this program read GOES files (cloud mask or a specific channel) and produce an estimate of Cloud Fraction outside and inside an SST contour (the value set for is the 26.5 contour). A good part of this code have been readadapted from personal communication with t...
[ "GOES.create_gridmap", "matplotlib.pyplot.title", "numpy.isnan", "matplotlib.pyplot.contour", "numpy.arange", "pyresample.geometry.SwathDefinition", "numpy.meshgrid", "matplotlib.rcParams.update", "matplotlib.pyplot.colorbar", "matplotlib.dates.DateFormatter", "datetime.timedelta", "GOES.open_...
[((1584, 1671), 'GOES.locate_files', 'GOES.locate_files', (['path', '"""OR_ABI-L2-ACMF*.nc"""', '"""20200202-040000"""', '"""20200204-040400"""'], {}), "(path, 'OR_ABI-L2-ACMF*.nc', '20200202-040000',\n '20200204-040400')\n", (1601, 1671), False, 'import GOES\n'), ((1761, 1889), 'xarray.open_dataset', 'xr.open_datas...
#!/usr/bin/env python # coding: utf-8 # # Principal Component Analysis # # ## 1. Libraries # In[1]: import matplotlib.pyplot as plt import numpy as np from IPython.display import display from sklearn.decomposition import PCA # ## 2. Data # In[2]: # Generate initial points (Gaussian, centered around 0,0) np.r...
[ "numpy.radians", "numpy.random.seed", "numpy.sin", "sklearn.decomposition.PCA", "numpy.random.normal", "numpy.cos", "matplotlib.pyplot.subplots", "numpy.vstack" ]
[((316, 336), 'numpy.random.seed', 'np.random.seed', (['(3347)'], {}), '(3347)\n', (330, 336), True, 'import numpy as np\n'), ((493, 509), 'numpy.radians', 'np.radians', (['(60.0)'], {}), '(60.0)\n', (503, 509), True, 'import numpy as np\n'), ((667, 686), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': '(2)'}...
import numpy as np """ A "service" represents a third-party integration into the API server. In this example, the third-party is the NumPy library. When the GraphQL endpoint receives a request, it forwards it to a service which is responsible for producing the result. My current thoughts are that services should no...
[ "numpy.matmul" ]
[((866, 890), 'numpy.matmul', 'np.matmul', (['first', 'second'], {}), '(first, second)\n', (875, 890), True, 'import numpy as np\n')]
import os, sys import numpy as np import paddle # paddle.enable_static() import paddle.fluid as fluid from paddle import ParamAttr # import paddle.nn as nn # import paddle.nn.functional as F from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F SEED = 666 input_shape =...
[ "numpy.load", "numpy.random.seed", "numpy.sum", "paddle.concat", "paddle.unsqueeze", "paddle.nn.GRUCell", "torch.cat", "numpy.mean", "paddle.mm", "paddle.zeros", "numpy.random.rand", "paddle.nn.functional.softmax", "paddle.fluid.dygraph.guard", "numpy.max", "torch.Tensor", "torch.nn.Li...
[((7329, 7349), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (7343, 7349), True, 'import numpy as np\n'), ((8167, 8187), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (8181, 8187), True, 'import numpy as np\n'), ((8291, 8306), 'torch.Tensor', 'torch.Tensor', (['x'], {}), '(x)\...
""" Iterating through all sequences in a data directory, computing data stats for each sequence (#instances, #activities, ...), cleaning stats and saving them """ import os import copy from tqdm import tqdm import json import argparse import numpy as np import pandas as pd def get_args(): """ Reading command lin...
[ "pandas.DataFrame", "json.dump", "copy.deepcopy", "tqdm.tqdm", "json.load", "argparse.ArgumentParser", "pandas.DataFrame.from_dict", "os.path.basename", "os.getcwd", "os.path.isdir", "numpy.std", "numpy.min", "numpy.mean", "numpy.max", "os.path.join", "os.listdir", "numpy.unique" ]
[((350, 394), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (373, 394), False, 'import argparse\n'), ((8231, 8246), 'tqdm.tqdm', 'tqdm', (['seq_paths'], {}), '(seq_paths)\n', (8235, 8246), False, 'from tqdm import tqdm\n'), ((1841, 1879), 'numpy.uniqu...
import numpy as np def read_example_spectroscopy(sn): spectra_file = 'example_data/'+sn+'.spectra' JD_spectra = np.atleast_1d(np.genfromtxt(spectra_file, usecols=0)) spectra = np.atleast_1d(np.genfromtxt(spectra_file, usecols=1, dtype=str)) wl_spectra, f_spectra = [], [] for spectrum in spectra:...
[ "numpy.genfromtxt" ]
[((136, 174), 'numpy.genfromtxt', 'np.genfromtxt', (['spectra_file'], {'usecols': '(0)'}), '(spectra_file, usecols=0)\n', (149, 174), True, 'import numpy as np\n'), ((207, 256), 'numpy.genfromtxt', 'np.genfromtxt', (['spectra_file'], {'usecols': '(1)', 'dtype': 'str'}), '(spectra_file, usecols=1, dtype=str)\n', (220, 2...
import sys import json import torch import time import gym import numpy as np import pandas as pd import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.autograd import Variable import matplotlib.pyplot as plt import functools from env.BitcoinTradingEnv import BitcoinTradingEnv f...
[ "env.indicators.prepare_indicators", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "torch.load", "REINFORCE.update_policy", "time.time", "numpy.mean", "torch.cuda.is_available", "REINFORCE.PolicyNetwork", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "env.Bitcoin...
[((455, 533), 'env.indicators.prepare_indicators', 'prepare_indicators', (['"""data/bitstampUSD_1-min_data_2012-01-01_to_2019-08-12.csv"""'], {}), "('data/bitstampUSD_1-min_data_2012-01-01_to_2019-08-12.csv')\n", (473, 533), False, 'from env.indicators import prepare_indicators\n'), ((590, 701), 'env.BitcoinTradingEnv....
from zipfile import ZipFile, ZIP_DEFLATED from io import BytesIO import torch import time import numpy as np import math import yaml import shutil import sys import random import re import os import transformer import pickle from pathlib import Path import json import argparse from transformers import get_linear_schedu...
[ "os.mkdir", "pickle.dump", "transformer.Transformer", "numpy.random.seed", "argparse.ArgumentParser", "wandb.finish", "os.remove", "torch.cat", "pathlib.Path", "torchtext.vocab.Vocab", "shutil.rmtree", "torch.no_grad", "torch.utils.data.DataLoader", "random.Random", "os.path.exists", "...
[((1998, 2011), 'wandb.login', 'wandb.login', ([], {}), '()\n', (2009, 2011), False, 'import wandb\n'), ((2652, 2777), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train the model on dataset"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Train the mo...
"""Utilities for real-time data augmentation on image data. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np from keras_preprocessing.image.numpy_array_iterator import NumpyArrayIterator from keras_preprocessing.image.utils i...
[ "numpy.random.randint", "keras_preprocessing.image.utils.array_to_img", "numpy.array", "os.path.join" ]
[((512, 554), 'numpy.array', 'np.array', (['[self.x[j] for j in index_array]'], {}), '([self.x[j] for j in index_array])\n', (520, 554), True, 'import numpy as np\n'), ((750, 792), 'numpy.array', 'np.array', (['[self.y[j] for j in index_array]'], {}), '([self.y[j] for j in index_array])\n', (758, 792), True, 'import nu...
from xml.dom.minidom import parse import matplotlib.pyplot as plt from PIL import Image import pandas as pd import os import numpy as np import random import imageio def readxml(xml_path,image_dir): """ str:xml file path -> List:[filename,path,size,objectinfo] """ tree=parse(xml_...
[ "pandas.DataFrame", "matplotlib.pyplot.savefig", "matplotlib.pyplot.imshow", "imageio.imread", "matplotlib.pyplot.axis", "PIL.Image.open", "matplotlib.pyplot.Rectangle", "random.random", "xml.dom.minidom.parse", "matplotlib.pyplot.figure", "numpy.array", "os.listdir", "imageio.mimsave" ]
[((310, 325), 'xml.dom.minidom.parse', 'parse', (['xml_path'], {}), '(xml_path)\n', (315, 325), False, 'from xml.dom.minidom import parse\n'), ((2090, 2112), 'PIL.Image.open', 'Image.open', (['image_path'], {}), '(image_path)\n', (2100, 2112), False, 'from PIL import Image\n'), ((2122, 2154), 'matplotlib.pyplot.figure'...
import random import math import numpy as np class Node: """ Node of a graph """ def __init__(self, state, parent=None, action=None, path_cost=0): self.state = state self.parent = parent self.action = action self.path_cost = path_cost self.depth = parent.depth + 1 if p...
[ "numpy.sum", "math.radians", "random.shuffle", "random.choice", "math.sin", "numpy.fliplr", "math.cos", "numpy.argwhere" ]
[((4396, 4444), 'random.choice', 'random.choice', (['[x for x in state.A1 if x != old]'], {}), '([x for x in state.A1 if x != old])\n', (4409, 4444), False, 'import random\n'), ((5290, 5318), 'random.shuffle', 'random.shuffle', (['self.initial'], {}), '(self.initial)\n', (5304, 5318), False, 'import random\n'), ((5555,...
"""GLM-PCA, supporting missing values We seek to fit the model x_{ij} ~ Poisson(s_i μ_{ij}) where ln μ_{ij} = (LF)_{ij}. GLM-PCA fits this model using Fisher scoring updates (Newton-Raphson updates, using the Fisher information instead of the Hessian) to maximize the log likelihood (Townes 2019). To handle missing d...
[ "numpy.outer", "numpy.square", "numpy.isfinite", "numpy.array", "numpy.exp", "numpy.random.normal" ]
[((1092, 1107), 'numpy.exp', 'np.exp', (['(l @ f.T)'], {}), '(l @ f.T)\n', (1098, 1107), True, 'import numpy as np\n'), ((2186, 2201), 'numpy.exp', 'np.exp', (['(l @ f.T)'], {}), '(l @ f.T)\n', (2192, 2201), True, 'import numpy as np\n'), ((3229, 3261), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(n, rank...
import numpy as np from bactoml.df_pipeline import DFLambdaFunction, DFFeatureUnion, SampleWisePipeline, DFInPlaceLambda from bactoml.decision_tree_classifier import HistogramTransform, DTClassifier from bactoml.fcdataset import FCDataSet from bactoml.graph_model import GraphModel from FlowCytometryTools import Poly...
[ "numpy.divide", "sklearn.preprocessing.StandardScaler", "FlowCytometryTools.ThresholdGate", "bactoml.decision_tree_classifier.HistogramTransform", "bactoml.decision_tree_classifier.DTClassifier", "bactoml.df_pipeline.DFLambdaFunction", "bactoml.df_pipeline.SampleWisePipeline", "numpy.linspace", "skl...
[((2532, 2568), 'sklearn.pipeline.Pipeline', 'Pipeline', (['[tlog_step, tcc_gate_step]'], {}), '([tlog_step, tcc_gate_step])\n', (2540, 2568), False, 'from sklearn.pipeline import Pipeline\n'), ((2577, 2622), 'sklearn.pipeline.Pipeline', 'Pipeline', (['[hna_gate_step, event_counter_step]'], {}), '([hna_gate_step, event...
# Tests for utils.py in the cmbpix package def test_patches_works(): # Test that patches works for known cases, as well as for self-consistency from cmbpix import patches import numpy as np # Index 0 @ NSIDE=1 contains only these 4 indices @ NSIDE=2 patch0nside1to2 = np.array([0,4,5,13]) patch0nside1to4 = np.ar...
[ "healpy.nside2npix", "numpy.array", "cmbpix.patches" ]
[((275, 298), 'numpy.array', 'np.array', (['[0, 4, 5, 13]'], {}), '([0, 4, 5, 13])\n', (283, 298), True, 'import numpy as np\n'), ((315, 327), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (323, 327), True, 'import numpy as np\n'), ((345, 361), 'cmbpix.patches', 'patches', (['(0)', '(1)', '(2)'], {}), '(0, 1, 2)\n...
# encoding: utf-8 import os.path as op import numpy as np import pandas as pd import numpy.testing as npt import random import taj ## py.test taj -s # -s pour afficher le résultat de la console from taj import data_utils data_path = op.join(taj.__path__[0], 'data') ''' def test_balance_data(): print() insta...
[ "numpy.asarray", "taj.data_utils.load_data", "os.path.join", "numpy.testing.assert_equal" ]
[((236, 268), 'os.path.join', 'op.join', (['taj.__path__[0]', '"""data"""'], {}), "(taj.__path__[0], 'data')\n", (243, 268), True, 'import os.path as op\n'), ((1321, 1504), 'numpy.asarray', 'np.asarray', (['[[1.0, 2.0, 0.0, 7.0, 0.0], [1.0, 3.0, 1.0, 5.0, 0.0], [7.1, 4.5, 2.1, 0.8,\n 0.0], [1.0, 0.0, 4.0, 5.0, 0.0],...
# -*- coding: utf-8 -*- import pytest import tempfile import os import numpy as np @pytest.fixture(scope="function") def txt_values(): values = [23.0, 24.0, 25e-2, -26, -27.0, -28e3] b_string = b'' for v in values: b_string += '{}\n'.format(v).encode() fp = tempfile.NamedTemporaryFile() f...
[ "tempfile.NamedTemporaryFile", "numpy.asarray", "os.path.dirname", "pytest.fixture", "numpy.reshape" ]
[((86, 118), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (100, 118), False, 'import pytest\n'), ((392, 424), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (406, 424), False, 'import pytest\n'), ((547, 577), 'pytest.fixtu...
from xicam.plugins import OperationPlugin import numpy as np from astropy.modeling import fitting from astropy.modeling import Fittable1DModel from typing import Tuple from enum import Enum from xicam.plugins import manager as pluginmanager from pyqtgraph.parametertree import Parameter class AstropyQSpectraFit(Operat...
[ "xicam.plugins.manager.get_plugins_of_type", "numpy.logical_and" ]
[((1551, 1599), 'numpy.logical_and', 'np.logical_and', (['(domain_min <= q)', '(q <= domain_max)'], {}), '(domain_min <= q, q <= domain_max)\n', (1565, 1599), True, 'import numpy as np\n'), ((672, 730), 'xicam.plugins.manager.get_plugins_of_type', 'pluginmanager.get_plugins_of_type', (['"""Fittable1DModelPlugin"""'], {...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "numpy.minimum", "kws_streaming.layers.compat.tf.signal.linear_to_mel_weight_matrix", "kws_streaming.layers.mel_table.SpectrogramToMelMatrix", "kws_streaming.layers.compat.tf.constant", "kws_streaming.layers.compat.tf.matmul" ]
[((4545, 4582), 'kws_streaming.layers.compat.tf.matmul', 'tf.matmul', (['fft_mag', 'mel_weight_matrix'], {}), '(fft_mag, mel_weight_matrix)\n', (4554, 4582), False, 'from kws_streaming.layers.compat import tf\n'), ((5728, 5789), 'numpy.minimum', 'np.minimum', (['(non_zero_ind + 1)', 'self.mel_weight_matrix.shape[0]'], ...
# Lint as: python3 # Copyright 2021 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
[ "jax.numpy.transpose", "jax.numpy.sum", "jax.numpy.squeeze", "jax.nn.log_softmax", "lingvo.jax.base_layer.MaybeShard", "jax.numpy.arange", "jax.numpy.expand_dims", "jax.numpy.argmax", "jax.numpy.asarray", "lingvo.jax.layers.linears.FeedForwardLayer.Params", "numpy.mod", "jax.numpy.matmul", "...
[((6142, 6168), 'jax.nn.log_softmax', 'jax.nn.log_softmax', (['logits'], {}), '(logits)\n', (6160, 6168), False, 'import jax\n'), ((6696, 6718), 'jax.numpy.sum', 'jnp.sum', (['class_weights'], {}), '(class_weights)\n', (6703, 6718), True, 'from jax import numpy as jnp\n'), ((7892, 7932), 'jax.numpy.transpose', 'jnp.tra...
import torch import os import json import numpy as np from nemo.collections.asr.parts.features import WaveformFeaturizer from nemo.collections.asr.modules import AudioToMelSpectrogramPreprocessor from nemo.utils.nemo_logging import Logger logger = Logger() class MeanStdDevProcessor(object): def __init__(self) -...
[ "nemo.utils.nemo_logging.Logger", "nemo.collections.asr.parts.features.WaveformFeaturizer", "numpy.std", "torch.squeeze", "numpy.mean", "torch.unsqueeze", "torch.tensor", "os.path.join", "numpy.concatenate", "nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor" ]
[((249, 257), 'nemo.utils.nemo_logging.Logger', 'Logger', ([], {}), '()\n', (255, 257), False, 'from nemo.utils.nemo_logging import Logger\n'), ((1744, 1790), 'os.path.join', 'os.path.join', (['"""data/arabic/train"""', '"""cmvn/mean"""'], {}), "('data/arabic/train', 'cmvn/mean')\n", (1756, 1790), False, 'import os\n')...
import io import numpy as np import sys from gym.envs.toy_text import discrete from enum import Enum, unique @unique class Action(Enum): UP = 0 RIGHT = 1 DOWN = 2 LEFT = 3 UPRIGHT = 4 DOWNRIGHT = 5 DOWNLEFT = 6 UPLEFT = 7 UP = Action.UP.value RIGHT = Action.RIGHT.value DOWN = Action.DO...
[ "io.StringIO", "numpy.nditer", "numpy.zeros", "numpy.ones", "numpy.arange", "numpy.prod" ]
[((1591, 1605), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (1598, 1605), True, 'import numpy as np\n'), ((1774, 1812), 'numpy.nditer', 'np.nditer', (['grid'], {'flags': "['multi_index']"}), "(grid, flags=['multi_index'])\n", (1783, 1812), True, 'import numpy as np\n'), ((4830, 4868), 'numpy.nditer', 'np.ndi...
# Standard library # Third-party from astropy.constants import c as speed_of_light from astropy.nddata import StdDevUncertainty import astropy.units as u import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline from specutils import Spectrum1D # This project from .utils import WVLNU, wavelength_c...
[ "numpy.vander", "numpy.stack", "scipy.interpolate.InterpolatedUnivariateSpline", "numpy.linalg.lstsq", "numpy.zeros", "numpy.linalg.cond", "numpy.linalg.inv", "numpy.arange", "numpy.diag", "numpy.linalg.solve", "astropy.nddata.StdDevUncertainty", "numpy.unique", "numpy.sqrt" ]
[((409, 463), 'numpy.sqrt', 'np.sqrt', (['((speed_of_light + dv) / (speed_of_light - dv))'], {}), '((speed_of_light + dv) / (speed_of_light - dv))\n', (416, 463), True, 'import numpy as np\n'), ((982, 1034), 'scipy.interpolate.InterpolatedUnivariateSpline', 'InterpolatedUnivariateSpline', (['wvln', 'flux'], {'k': '(3)'...
import numpy as np import rdflib import six import bald def valid_array_reference(parray, carray, broadcast_shape=None): """ Returns boolean. Validates bald array broadcasting rules between one parent array and one child array. Args: * parray - a numpy array: the parent of a bald array r...
[ "bald.HttpCache", "numpy.broadcast", "numpy.zeros" ]
[((1217, 1245), 'numpy.broadcast', 'np.broadcast', (['parray', 'carray'], {}), '(parray, carray)\n', (1229, 1245), True, 'import numpy as np\n'), ((1994, 2010), 'bald.HttpCache', 'bald.HttpCache', ([], {}), '()\n', (2008, 2010), False, 'import bald\n'), ((6630, 6662), 'numpy.zeros', 'np.zeros', (['self.array.bald__shap...
from tqdm import tqdm import numpy as np from numba import njit from gensim.parsing.preprocessing import stem from pattern3.text.en.inflect import singularize, pluralize import pickle from copy import deepcopy class CleanGlove: def __init__(self, glove_path, codenames_path, stopwords_path, threshold=0.5, limit=in...
[ "pattern3.text.en.inflect.singularize", "copy.deepcopy", "pattern3.text.en.inflect.pluralize", "tqdm.tqdm", "pickle.dump", "numba.njit", "numpy.array", "gensim.parsing.preprocessing.stem", "numpy.sqrt" ]
[((1306, 1325), 'numba.njit', 'njit', ([], {'fastmath': '(True)'}), '(fastmath=True)\n', (1310, 1325), False, 'from numba import njit\n'), ((1663, 1678), 'numpy.sqrt', 'np.sqrt', (['u_norm'], {}), '(u_norm)\n', (1670, 1678), True, 'import numpy as np\n'), ((1696, 1711), 'numpy.sqrt', 'np.sqrt', (['v_norm'], {}), '(v_no...
import numpy as np import re from tqdm import tqdm import pandas as pd import random from SimilarFPAnalyzer import SimilarFPAnalyzer from LiPolymerDataBase import MAX_SMILES from DAWrapper import find_best_bit_DA,find_best_bit_BQ from Fingerprint import get_Tanimoto class Dummy: def __init__(self): pass ...
[ "numpy.isin", "pandas.DataFrame.from_dict", "numpy.random.randn", "random.choices", "re.match", "random.random", "Fingerprint.get_Tanimoto", "numpy.where", "numpy.array", "SimilarFPAnalyzer.SimilarFPAnalyzer", "DAWrapper.find_best_bit_BQ" ]
[((1472, 1508), 'SimilarFPAnalyzer.SimilarFPAnalyzer', 'SimilarFPAnalyzer', (['target_param', 'dum'], {}), '(target_param, dum)\n', (1489, 1508), False, 'from SimilarFPAnalyzer import SimilarFPAnalyzer\n'), ((1760, 1786), 'numpy.array', 'np.array', (['self.column_list'], {}), '(self.column_list)\n', (1768, 1786), True,...
"""This module sets up and runs iceberg drift simulations and optimizations. """ import numpy as np import xarray as xr from scipy.optimize import minimize from icedef import iceberg, metocean, drift, tools, timesteppers, plot from logging import getLogger, FileHandler, DEBUG, Formatter from time import gmtime, strf...
[ "scipy.optimize.minimize", "icedef.tools.dx_to_dlon", "icedef.metocean.Atmosphere", "time.gmtime", "icedef.metocean.Ocean", "numpy.zeros", "xarray.Dataset", "logging.Formatter", "icedef.tools.dy_to_dlat", "numpy.mean", "icedef.iceberg.quickstart", "numpy.timedelta64", "xarray.DataArray", "...
[((9300, 9336), 'numpy.zeros', 'np.zeros', (['nt'], {'dtype': '"""datetime64[ns]"""'}), "(nt, dtype='datetime64[ns]')\n", (9308, 9336), True, 'import numpy as np\n'), ((13851, 13863), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (13861, 13863), True, 'import xarray as xr\n'), ((558, 617), 'logging.FileHandler.__in...
import pickle import sklearn.metrics as skm import numpy as np from sklearn.linear_model import Ridge from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score, confusion_matrix, \ explained_variance_score, mean_squared_error, r2_score, mean_absolute_error, median_absolute_error, roc_auc...
[ "sklearn.linear_model.Ridge", "sklearn.metrics.accuracy_score", "sklearn.metrics.r2_score", "sklearn.metrics.recall_score", "sklearn.metrics.mean_absolute_error", "sklearn.metrics.roc_auc_score", "sklearn.metrics.median_absolute_error", "sklearn.metrics.f1_score", "pickle.load", "sklearn.model_sel...
[((754, 813), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': '(10)', 'shuffle': '(True)', 'random_state': '(42)'}), '(n_splits=10, shuffle=True, random_state=42)\n', (769, 813), False, 'from sklearn.model_selection import StratifiedKFold\n'), ((668, 682), 'pickle.load', 'pickle.load', (...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function """ Empirical XMM background model. Written by <NAME>, adapted by <NAME> and <NAME> (C) 2013-2016 For example usage, see examples/sherpa/background/xmm/fit.py """ import os import logging import numpy if "MAKESPHINXDOC" not in os.en...
[ "bxa.sherpa.background.xmm.get_embedded_file", "numpy.savetxt", "os.path.exists", "logging.info", "numpy.array", "numpy.loadtxt" ]
[((1265, 1299), 'numpy.array', 'numpy.array', (['([1.0] * urmf.detchans)'], {}), '([1.0] * urmf.detchans)\n', (1276, 1299), False, 'import numpy\n'), ((1390, 1442), 'numpy.array', 'numpy.array', (['([1] * urmf.detchans)'], {'dtype': 'numpy.uint32'}), '([1] * urmf.detchans, dtype=numpy.uint32)\n', (1401, 1442), False, '...
import vectorbt as vbt import numpy as np import pandas as pd from numba import njit from datetime import datetime import pytest from vectorbt.generic import nb as generic_nb from vectorbt.generic.enums import range_dt from tests.utils import record_arrays_close seed = 42 day_dt = np.timedelta64(86400000000000) ma...
[ "vectorbt.RAND.run", "pandas.Series.vbt.signals.generate_random", "vectorbt.STX.run", "pandas.DataFrame.vbt.signals.generate_random_both", "numpy.empty", "pandas.Series.vbt.signals.generate", "vectorbt.generic.nb.bshift_1d_nb", "pandas.Int64Index", "pandas.DataFrame.vbt.signals.generate_both", "nu...
[((286, 316), 'numpy.timedelta64', 'np.timedelta64', (['(86400000000000)'], {}), '(86400000000000)\n', (300, 316), True, 'import numpy as np\n'), ((653, 707), 'pandas.Series', 'pd.Series', (['[1.0, 2.0, 3.0, 2.0, 1.0]'], {'index': 'mask.index'}), '([1.0, 2.0, 3.0, 2.0, 1.0], index=mask.index)\n', (662, 707), True, 'imp...
""" This video filter tries to remove pixels that are made artificially brighter by stray X-rays. """ import numpy as np import scipy.ndimage from . Filter import Filter class HXRFilter(Filter): def __init__(self, threshold=0.9): """ Constructor. threshold: Relative amount by ...
[ "numpy.abs", "numpy.copy", "numpy.geterr", "numpy.seterr", "numpy.zeros", "numpy.interp" ]
[((662, 682), 'numpy.zeros', 'np.zeros', (['data.shape'], {}), '(data.shape)\n', (670, 682), True, 'import numpy as np\n'), ((901, 912), 'numpy.geterr', 'np.geterr', ([], {}), '()\n', (910, 912), True, 'import numpy as np\n'), ((921, 947), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""'}), "(divide='ignore'...
""" Beta hedging Author: <NAME> and <NAME> This algorithm computes beta to the S&P 500 and attempts to maintain a hedge for market neutrality. More information on beta hedging can be found in the beta hedging lecture as part of the Quantopian Lecture Series. https://www.quantopian.com/lectures This algorithm wa...
[ "pandas.DataFrame", "statsmodels.api.add_constant", "numpy.isnan", "statsmodels.api.OLS" ]
[((4169, 4215), 'pandas.DataFrame', 'pd.DataFrame', (['factors'], {'index': "['alpha', 'beta']"}), "(factors, index=['alpha', 'beta'])\n", (4181, 4215), True, 'import pandas as pd\n'), ((4382, 4400), 'statsmodels.api.add_constant', 'sm.add_constant', (['x'], {}), '(x)\n', (4397, 4400), True, 'import statsmodels.api as ...
''' This script has two modes: > Mode 1: 1. a text string which defines the prefix name of the output files (-n, required) 2. a text string which specifies the output directory (-d, optional) 3. a reference file with annotation in bed format (-r, required) 4. a STAR-aligned bam file (-b, required) 5. the un-trimmed fas...
[ "subprocess.Popen", "ghmm.GaussianMixtureDistribution", "gzip.open", "ghmm.SequenceSet", "argparse.ArgumentParser", "numpy.median", "subprocess.check_output", "time.time", "ghmm.GaussianDistribution", "os.path.isfile", "numpy.mean", "tarfile.open", "ghmm.Float", "math.log", "datetime.dat...
[((7314, 7320), 'time.time', 'time', ([], {}), '()\n', (7318, 7320), False, 'from time import time\n'), ((13681, 13706), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (13704, 13706), False, 'import sys, subprocess, math, numpy, gzip, ghmm, time, tarfile, concurrent.futures, random, os, argpars...
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "types.MethodType", "numpy.zeros", "numpy.random.RandomState", "gym.spaces.Box", "numpy.concatenate" ]
[((1509, 1607), 'gym.spaces.Box', 'gym.spaces.Box', ([], {'shape': '(obs_space.shape[0] + 1,)', 'low': 'obs_space.low[0]', 'high': 'obs_space.high[0]'}), '(shape=(obs_space.shape[0] + 1,), low=obs_space.low[0], high=\n obs_space.high[0])\n', (1523, 1607), False, 'import gym\n'), ((2047, 2077), 'numpy.concatenate', '...
import numpy as np """ data format conversions, esp for nonlattice """ def interval_counts_as_rates(obs_t, interval_counts): interval_counts = np.asarray(interval_counts) rates = interval_counts / obs_times_to_delta_times(obs_t) return obs_t, rates def rates_as_interval_counts(rates, obs_t, round=True)...
[ "numpy.asarray", "numpy.amax", "numpy.cumsum", "numpy.around", "numpy.diff", "numpy.linspace", "numpy.concatenate" ]
[((150, 177), 'numpy.asarray', 'np.asarray', (['interval_counts'], {}), '(interval_counts)\n', (160, 177), True, 'import numpy as np\n'), ((334, 351), 'numpy.asarray', 'np.asarray', (['obs_t'], {}), '(obs_t)\n', (344, 351), True, 'import numpy as np\n'), ((364, 381), 'numpy.asarray', 'np.asarray', (['rates'], {}), '(ra...
import tensorflow as tf import numpy as np import pandas as pd import matplotlib.pyplot as plt # Load the movies dataset and also pass header=None since files don't contain any headers movies_df = pd.read_csv('ml-1m/movies.dat', sep='::', header=None, engine='python') print(movies_df.head()) # Load the ratings datase...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "tensorflow.global_variables_initializer", "numpy.zeros", "tensorflow.Session", "tensorflow.reduce_mean", "tensorflow.transpose", "tensorflow.placeholder", "tensorflow.matmul", "tensorflow.shape", "matplotlib.pyplot.ylabel"...
[((198, 269), 'pandas.read_csv', 'pd.read_csv', (['"""ml-1m/movies.dat"""'], {'sep': '"""::"""', 'header': 'None', 'engine': '"""python"""'}), "('ml-1m/movies.dat', sep='::', header=None, engine='python')\n", (209, 269), True, 'import pandas as pd\n'), ((335, 407), 'pandas.read_csv', 'pd.read_csv', (['"""ml-1m/ratings....
from datetime import datetime import numpy as np import pandas as pd import sklearn.model_selection from sklearn.pipeline import Pipeline import sklearn.base import tqdm import traceback import warnings warnings.filterwarnings(action='ignore') from core import mp_utils from core.utils import get_component_constructor...
[ "tqdm.tqdm", "warnings.filterwarnings", "core.mp_utils.run", "numpy.random.RandomState", "numpy.isnan", "numpy.mean", "numpy.arange", "traceback.format_exc", "numpy.random.choice", "sklearn.pipeline.Pipeline", "core.utils.get_component_constructor", "core.mp_utils.init_mp", "datetime.datetim...
[((204, 244), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""'}), "(action='ignore')\n", (227, 244), False, 'import warnings\n'), ((3346, 3361), 'sklearn.pipeline.Pipeline', 'Pipeline', (['steps'], {}), '(steps)\n', (3354, 3361), False, 'from sklearn.pipeline import Pipeline\n'), ((1...
"""Time series of responses to creep.""" from math import sqrt from typing import List, Union, Optional import numpy as np from bridge_sim import sim from bridge_sim.model import Config, ResponseType, Point from bridge_sim.shrinkage import CementClass, RH, f_cm, notational_size from bridge_sim.sim.model import Respo...
[ "math.sqrt", "numpy.power", "numpy.isnan", "bridge_sim.shrinkage.notational_size", "bridge_sim.util.convert_times", "bridge_sim.util.print_d" ]
[((1183, 1218), 'bridge_sim.shrinkage.notational_size', 'notational_size', ([], {'config': 'config', 'x': 'x'}), '(config=config, x=x)\n', (1198, 1218), False, 'from bridge_sim.shrinkage import CementClass, RH, f_cm, notational_size\n'), ((1468, 1494), 'bridge_sim.util.print_d', 'print_d', (['D', 'f"""t_0 = {t_0}"""'],...
import warnings import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model from sklearn.metrics import mean_squared_error, r2_score from utils import load_data from utils import plot_data def normalize_by_self(): X_normalize, Y_normalize, Origin_X_normalize, Y_mean, Y_std, Origin_X_mean,...
[ "warnings.filterwarnings", "utils.load_data.load_and_normalize", "sklearn.linear_model.LinearRegression", "numpy.array", "utils.load_data.load_and_process" ]
[((336, 377), 'utils.load_data.load_and_normalize', 'load_data.load_and_normalize', (['"""data2.txt"""'], {}), "('data2.txt')\n", (364, 377), False, 'from utils import load_data\n'), ((402, 433), 'sklearn.linear_model.LinearRegression', 'linear_model.LinearRegression', ([], {}), '()\n', (431, 433), False, 'from sklearn...
# Enter your code here. Read input from STDIN. Print output to STDOUT N = int(input()) X = list(map(int, input().split())) X.sort() # Solution without import Package ## mean X_mean = round(sum(X)/N,1) ## median if N%2 != 0: X_median = X[int(N/2-0.5)] else: X_median = round((X[int(N/2-1)]+X[int(N/2)])/2, 1) ## ...
[ "numpy.median", "numpy.mean", "scipy.stats.mode" ]
[((492, 502), 'numpy.mean', 'np.mean', (['X'], {}), '(X)\n', (499, 502), True, 'import numpy as np\n'), ((514, 526), 'numpy.median', 'np.median', (['X'], {}), '(X)\n', (523, 526), True, 'import numpy as np\n'), ((536, 549), 'scipy.stats.mode', 'stats.mode', (['X'], {}), '(X)\n', (546, 549), False, 'from scipy import st...
import numpy as np from scipy import constants from layer import Layer ''' TransferMatrix for conductive sheets x ^ | eps1,mu1 | eps2, mu2 | _____________|__________________>z | | | sigma_e, sigma_m ''' ''' Convension (hin) = (M)(hout) ...
[ "numpy.matrix", "copy.deepcopy", "numpy.sum", "numpy.zeros", "numpy.ones", "numpy.sin", "numpy.array", "numpy.exp", "numpy.linspace", "numpy.matmul", "numpy.cos", "numpy.arange", "numpy.real", "numpy.sqrt" ]
[((3091, 3110), 'numpy.sqrt', 'np.sqrt', (['(mu0 / eps0)'], {}), '(mu0 / eps0)\n', (3098, 3110), True, 'import numpy as np\n'), ((3539, 3573), 'numpy.array', 'np.array', (['[[M11, M12], [M21, M22]]'], {}), '([[M11, M12], [M21, M22]])\n', (3547, 3573), True, 'import numpy as np\n'), ((3701, 3745), 'numpy.array', 'np.arr...
import unittest import numpy as np import signals import matplotlib.pyplot as plt import math class TestSignalFunctions(unittest.TestCase): def make_test_signal(self, sample_rate): """ Make a 10s signal with three frequency components f = [100, 10, 1]/(2pi) """ x = np.arange(0, 10, 1.0 / ...
[ "unittest.main", "matplotlib.pyplot.subplot", "signals.getpeaks", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "signals.interpolate_points", "matplotlib.pyplot.ylabel", "signals.find_periodicities", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.vstack", "numpy.arra...
[((2920, 2935), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2933, 2935), False, 'import unittest\n'), ((352, 368), 'numpy.sin', 'np.sin', (['(x * 10.0)'], {}), '(x * 10.0)\n', (358, 368), True, 'import numpy as np\n'), ((626, 657), 'numpy.arange', 'np.arange', (['(0)', '(math.pi * 8)', '(0.01)'], {}), '(0, mat...
"""Data file ============ Data channel methods, unless specified should not be called directly. """ import numpy as np from typing import List, Dict, Optional, Tuple, Callable, Set, Union, Any, Type import nixio as nix from nixio.exceptions.exceptions import InvalidFile from bisect import bisect_left from more_kivy_...
[ "nixio.File.open", "more_kivy_app.utils.yaml_dumps", "numpy.empty", "numpy.asarray", "numpy.array", "bisect.bisect_left", "more_kivy_app.utils.yaml_loads" ]
[((46055, 46084), 'numpy.array', 'np.array', (['[0]'], {'dtype': 'np.uint8'}), '([0], dtype=np.uint8)\n', (46063, 46084), True, 'import numpy as np\n'), ((48267, 48305), 'numpy.array', 'np.array', (['[[-1, -1]]'], {'dtype': 'np.float64'}), '([[-1, -1]], dtype=np.float64)\n', (48275, 48305), True, 'import numpy as np\n'...
# author: <NAME> # Python implementation of: # Fake News in Social Networks # @article{aymanns2017fake, # title={Fake News in Social Networks}, # author={Aymanns, Christoph and <NAME> and <NAME>}, # journal={arXiv preprint arXiv:1708.06233}, # year={2017} # } # Based on: # L...
[ "torch.nn.MSELoss", "matplotlib.pyplot.show", "argparse.ArgumentParser", "model.RDQN_multi", "env.env_multi", "torch.autograd.Variable", "agent.agent", "numpy.zeros", "random.choice", "numpy.max", "io.open", "matplotlib.pyplot.subplots" ]
[((1439, 1465), 'numpy.zeros', 'np.zeros', (['(args.T, n_test)'], {}), '((args.T, n_test))\n', (1447, 1465), True, 'import numpy as np\n'), ((1932, 1948), 'numpy.zeros', 'np.zeros', (['args.T'], {}), '(args.T)\n', (1940, 1948), True, 'import numpy as np\n'), ((4411, 4436), 'argparse.ArgumentParser', 'argparse.ArgumentP...
# -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by <NAME>, <NAME>, based on code from <NAME> # -------------------------------------------------------- from __future__ import absolute_import from __future__ import ...
[ "numpy.random.seed", "argparse.ArgumentParser", "model.utils.config.cfg_from_file", "model.rpn.bbox_transform.clip_boxes", "pickle.load", "pprint.pprint", "numpy.tile", "test_net.get_data2imdbval_dict", "os.path.join", "os.path.exists", "torch.FloatTensor", "roi_data_layer.roidb.combined_roidb...
[((2720, 2785), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train a Fast R-CNN network"""'}), "(description='Train a Fast R-CNN network')\n", (2743, 2785), False, 'import argparse\n'), ((5632, 5666), 'test_net.get_data2imdbval_dict', 'get_data2imdbval_dict', (['args.imgset'], {}), '(a...
import numpy as np from spira.core.parameters.variables import * from spira.core.parameters.processors import ProcessorTypeCast from spira.core.parameters.restrictions import RestrictType from spira.core.parameters.initializer import ParameterInitializer from spira.core.parameters.descriptor import RestrictedParameter ...
[ "spira.core.parameters.descriptor.RestrictedParameter", "spira.core.parameters.processors.ProcessorTypeCast.__init__", "spira.core.parameters.processors.ProcessorTypeCast.process", "numpy.array", "spira.core.parameters.restrictions.RestrictType", "numpy.array_equal", "numpy.ndarray" ]
[((1121, 1981), 'numpy.array', 'np.array', (['[[0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0,\n 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, \n 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1,\n 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 0, ...
import tensorflow as tf from tensorflow import keras import os import numpy as np layerNames = ['conv1', 'conv2', 'conv3', 'conv4', 'conv5', 'fc6', 'fc7', 'fc8'] alexnet_weights_path = os.path.join(os.path.dirname(__file__), 'data/bvlc_alexnet.npy') class AlexNet(keras.Model): def __init__(self, input_shape, pa...
[ "numpy.load", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.Dropout", "os.path.dirname", "tensorflow.pow", "tensorflow.keras.Sequential", "tensorflow.keras.layers.Fla...
[((199, 224), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (214, 224), False, 'import os\n'), ((446, 464), 'tensorflow.keras.Sequential', 'keras.Sequential', ([], {}), '()\n', (462, 464), False, 'from tensorflow import keras\n'), ((569, 732), 'tensorflow.keras.layers.Conv2D', 'keras.layers....