code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from numpy import dot, linalg, average, array import heapq from math import trunc class NLargest(list): def __init__(self, size): self.__size = size def add(self, element): if self.__size == len(self) and self[0] < element: heapq.heapreplace(self, element) return heapq.heappush(self, el...
[ "heapq.heappush", "heapq.heapify", "heapq.nlargest", "heapq.heapreplace", "numpy.array", "numpy.linalg.norm", "numpy.dot", "math.trunc" ]
[((297, 326), 'heapq.heappush', 'heapq.heappush', (['self', 'element'], {}), '(self, element)\n', (311, 326), False, 'import heapq\n'), ((546, 560), 'numpy.array', 'array', (['vector1'], {}), '(vector1)\n', (551, 560), False, 'from numpy import dot, linalg, average, array\n'), ((580, 594), 'numpy.array', 'array', (['ve...
import argparse import logging import random import numpy as np import torch from networks.meta_learner import MetaLearner random.seed(1) np.random.seed(1) torch.manual_seed(1) class InitiateTraining(object): def __init__(self, args): self.dataset = args.dataset self.data_path = args.data_path ...
[ "numpy.random.seed", "argparse.ArgumentParser", "logging.basicConfig", "torch.manual_seed", "logging.info", "random.seed", "networks.meta_learner.MetaLearner" ]
[((126, 140), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (137, 140), False, 'import random\n'), ((141, 158), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (155, 158), True, 'import numpy as np\n'), ((159, 179), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (176, 179), Fal...
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
[ "unittest.main", "numpy.random.uniform", "paddle.fluid.core.CUDAPlace", "test_softmax_op.stable_softmax", "numpy.zeros", "paddle.fluid.core.is_compiled_with_cuda" ]
[((2330, 2345), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2343, 2345), False, 'import unittest\n'), ((2101, 2129), 'paddle.fluid.core.is_compiled_with_cuda', 'core.is_compiled_with_cuda', ([], {}), '()\n', (2127, 2129), True, 'import paddle.fluid.core as core\n'), ((1236, 1257), 'test_softmax_op.stable_softm...
""" Straight-ray 2D travel-time tomography (i.e., does not consider reflection or refraction) **Solver** * :class:`~fatiando.seismic.srtomo.SRTomo`: Data misfit class that runs the tomography. **Functions** * :func:`~fatiando.seismic.srtomo.slowness2vel`: Safely convert slowness to velocity (avoids zero divisio...
[ "numpy.flatnonzero", "numpy.array", "numpy.ones_like" ]
[((4827, 4848), 'numpy.array', 'numpy.array', (['slowness'], {}), '(slowness)\n', (4838, 4848), False, 'import numpy\n'), ((3348, 3373), 'numpy.flatnonzero', 'numpy.flatnonzero', (['column'], {}), '(column)\n', (3365, 3373), False, 'import numpy\n'), ((3429, 3453), 'numpy.ones_like', 'numpy.ones_like', (['nonzero'], {}...
import copy import textwrap import astropy.constants as const import astropy.units as u import numpy as np import xarray as xr from scipy import interpolate import psipy.visualization as viz from psipy.util.decorators import add_common_docstring __all__ = ['Variable'] # Some docstrings that are used more than once...
[ "psipy.visualization.animate_time", "copy.deepcopy", "scipy.interpolate.interpn", "psipy.visualization.setup_polar_ax", "psipy.visualization.setup_radial_ax", "textwrap.indent", "psipy.visualization.format_equatorial_ax", "xarray.Dataset", "numpy.rad2deg", "numpy.append", "numpy.diff", "psipy....
[((493, 702), 'textwrap.indent', 'textwrap.indent', (['f"""\n{quad_mesh_link} or {animation_link}\n If a timestep is specified, the {quad_mesh_link} of the plot is returned.\n Otherwise an {animation_link} is returned.\n"""', '""" """'], {}), '(\n f"""\n{quad_mesh_link} or {animation_link}\n If a tim...
from __future__ import (absolute_import, division, print_function, unicode_literals) import six import os from copy import deepcopy import numpy as np import pandas as pd from pandas import DataFrame, Series import unittest import nose from numpy.testing import assert_almost_equal, assert_allcl...
[ "numpy.random.seed", "numpy.sum", "numpy.allclose", "numpy.ones", "trackpy.strip_diagnostics", "trackpy.linking.PointND", "numpy.arange", "os.path.join", "pandas.DataFrame", "os.path.abspath", "numpy.random.randn", "pandas.concat", "copy.deepcopy", "pandas.util.testing.assert_frame_equal",...
[((691, 720), 'trackpy.utils.make_pandas_strict', 'tp.utils.make_pandas_strict', ([], {}), '()\n', (718, 720), True, 'import trackpy as tp\n'), ((780, 806), 'os.path.join', 'os.path.join', (['path', '"""data"""'], {}), "(path, 'data')\n", (792, 806), False, 'import os\n'), ((937, 954), 'numpy.random.seed', 'np.random.s...
import pandas as pd import sys from typing import List import numpy as np def csv_to_arff(csv_file_name: str, arff_file_name: str, title: str) -> None: """Writes the arff file from the csv entered""" data_frame = pd.read_csv(csv_file_name) arff_list = df_to_arff(data_frame, title) with open(arff_file_...
[ "pandas.read_csv", "numpy.issubdtype" ]
[((223, 249), 'pandas.read_csv', 'pd.read_csv', (['csv_file_name'], {}), '(csv_file_name)\n', (234, 249), True, 'import pandas as pd\n'), ((1446, 1476), 'numpy.issubdtype', 'np.issubdtype', (['type', 'np.number'], {}), '(type, np.number)\n', (1459, 1476), True, 'import numpy as np\n')]
import numpy as np import torch from torch import nn from torch.nn import functional as F from torch import autograd from torch import jit import math import pdb class NBeatsNet(nn.Module): SEASONALITY_BLOCK = 'seasonality' TREND_BLOCK = 'trend' GENERIC_BLOCK = 'generic' def __init__(self, ...
[ "torch.nn.init.uniform_", "torch.cat", "torch.mm", "torch.device", "torch.flatten", "torch.hstack", "torch.squeeze", "torch.Tensor", "torch.nn.ParameterList", "numpy.linspace", "torch.nn.Linear", "torch.zeros", "torch.nn.functional.relu", "torch.nn.LSTM", "torch.nn.GRU", "math.sqrt", ...
[((3130, 3215), 'numpy.linspace', 'np.linspace', (['(-backcast_length)', 'forecast_length', '(backcast_length + forecast_length)'], {}), '(-backcast_length, forecast_length, backcast_length +\n forecast_length)\n', (3141, 3215), True, 'import numpy as np\n'), ((1720, 1753), 'torch.nn.ParameterList', 'nn.ParameterLis...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import gin import numpy as np from slac.agents.slac.model_distribution_network import Bernoulli from slac.agents.slac.model_distribution_network import Compressor from slac.agents.slac.model_d...
[ "slac.agents.slac.model_distribution_network.Compressor", "tensorflow.reduce_sum", "slac.agents.slac.model_distribution_network.Decoder", "slac.agents.slac.model_distribution_network.Bernoulli", "tensorflow.not_equal", "tensorflow.concat", "slac.agents.slac.model_distribution_network.Normal", "tensorf...
[((1922, 1952), 'numpy.sqrt', 'np.sqrt', (['(0.1)'], {'dtype': 'np.float32'}), '(0.1, dtype=np.float32)\n', (1929, 1952), True, 'import numpy as np\n'), ((4663, 4701), 'slac.agents.slac.model_distribution_network.Compressor', 'Compressor', (['base_depth', '(8 * base_depth)'], {}), '(base_depth, 8 * base_depth)\n', (467...
import pandas as pd import numpy as np from sklearn.cluster import KMeans import pickle # Get the train features dataframe playlist_features = pd.read_csv('../data/playlist_features_with_artists_train.csv', index_col=0, header=0) playlist_list = playlist_features.index.values # Set desired number of clusters n_cluste...
[ "pandas.read_csv", "sklearn.cluster.KMeans", "numpy.savetxt", "numpy.column_stack" ]
[((144, 234), 'pandas.read_csv', 'pd.read_csv', (['"""../data/playlist_features_with_artists_train.csv"""'], {'index_col': '(0)', 'header': '(0)'}), "('../data/playlist_features_with_artists_train.csv', index_col=0,\n header=0)\n", (155, 234), True, 'import pandas as pd\n'), ((413, 471), 'sklearn.cluster.KMeans', 'K...
import unittest import numpy as np from keras_nmf import NMFModel class TestFitRandom(unittest.TestCase): def test_decrease_loss(self): nmf_model = NMFModel(99, 7, 4) nmf_model.compile_model(learning_rate=0.5) ii = np.random.randint(0, 99, 128) jj = np.random.randint(0, 99, (128...
[ "numpy.random.uniform", "numpy.random.seed", "keras_nmf.NMFModel", "numpy.random.randint", "numpy.arange", "numpy.random.choice" ]
[((164, 182), 'keras_nmf.NMFModel', 'NMFModel', (['(99)', '(7)', '(4)'], {}), '(99, 7, 4)\n', (172, 182), False, 'from keras_nmf import NMFModel\n'), ((248, 277), 'numpy.random.randint', 'np.random.randint', (['(0)', '(99)', '(128)'], {}), '(0, 99, 128)\n', (265, 277), True, 'import numpy as np\n'), ((291, 325), 'numpy...
#!/usr/bin/python # encoding: utf-8 """ @author: Ian @file: train.py @time: 2019-04-19 11:52 """ import pandas as pd import numpy as np from mayiutils.file_io.pickle_wrapper import PickleWrapper as picklew from mayiutils.algorithm.algorithmset.calcPearson import calcPearson from sklearn.tree import DecisionTreeClassif...
[ "pandas.DataFrame", "sklearn.ensemble.RandomForestClassifier", "lightgbm.train", "mayiutils.algorithm.algorithmset.calcPearson.calcPearson", "pandas.read_csv", "mayiutils.file_io.pickle_wrapper.PickleWrapper.loadFromFile", "lightgbm.Dataset", "sklearn.tree.DecisionTreeClassifier", "sklearn.metrics.c...
[((640, 679), 'mayiutils.file_io.pickle_wrapper.PickleWrapper.loadFromFile', 'picklew.loadFromFile', (['"""train_data2.pkl"""'], {}), "('train_data2.pkl')\n", (660, 679), True, 'from mayiutils.file_io.pickle_wrapper import PickleWrapper as picklew\n'), ((769, 802), 'mayiutils.file_io.pickle_wrapper.PickleWrapper.loadFr...
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "unittest.main", "federatedml.feature.instance.Instance", "federatedml.optim.gradient.hetero_lr_gradient_and_loss.Guest", "arch.api.session.init", "arch.api.session.stop", "numpy.square", "federatedml.optim.gradient.hetero_linear_model_gradient.compute_gradient", "federatedml.secureprotol.PaillierEncr...
[((3850, 3870), 'arch.api.session.init', 'session.init', (['"""1111"""'], {}), "('1111')\n", (3862, 3870), False, 'from arch.api import session\n'), ((3875, 3890), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3888, 3890), False, 'import unittest\n'), ((3895, 3909), 'arch.api.session.stop', 'session.stop', ([], ...
""" <NAME> """ import numpy as np import pandas as pd from gym import spaces import matplotlib.pyplot as plt from scipy import stats from recsim import document from recsim import user from recsim.choice_model import MultinomialLogitChoiceModel,AbstractChoiceModel from recsim.simulator import environment from recsim...
[ "data_preprocess.get_user_positive", "random.randint", "numpy.random.shuffle", "data_preprocess.load_data", "numpy.zeros", "gym.spaces.Discrete", "numpy.argwhere", "numpy.array", "recsim.choice_model.MultinomialLogitChoiceModel", "gym.spaces.Box", "numpy.random.choice", "data_preprocess.create...
[((22816, 22847), 'data_preprocess.load_data', 'data_preprocess.load_data', (['path'], {}), '(path)\n', (22841, 22847), False, 'import data_preprocess\n'), ((22991, 23037), 'data_preprocess.get_user_positive', 'data_preprocess.get_user_positive', (['format_data'], {}), '(format_data)\n', (23024, 23037), False, 'import ...
import argparse import os from os.path import join from pathflowai.utils import run_preprocessing_pipeline, generate_patch_pipeline, img2npy_, create_zero_mask import click import dask import time CONTEXT_SETTINGS = dict(help_option_names=['-h','--help'], max_content_width=90) @click.group(context_settings= CONTEXT_S...
[ "pathflowai.utils.npy2da", "click.version_option", "click.option", "numpy.arange", "click.Path", "os.path.join", "pathflowai.utils.adjust_mask", "dask.distributed.Client", "os.path.exists", "dask.config.set", "click.group", "os.path.basename", "pathflowai.utils.create_zero_mask", "sqlite3....
[((281, 327), 'click.group', 'click.group', ([], {'context_settings': 'CONTEXT_SETTINGS'}), '(context_settings=CONTEXT_SETTINGS)\n', (292, 327), False, 'import click\n'), ((330, 365), 'click.version_option', 'click.version_option', ([], {'version': '"""0.1"""'}), "(version='0.1')\n", (350, 365), False, 'import click\n'...
import sys sys.path.insert(0, '/home/liyongjing/Egolee_2021/programs/RepVGG-main') import torch import cv2 import os import numpy as np from repvgg import get_RepVGG_func_by_name import torchvision.transforms as transforms from PIL import Image, ImageOps import random class RepVGGTorchInfer(object): def __init__...
[ "numpy.sum", "numpy.argmax", "numpy.ones", "numpy.exp", "local_files.local_transformer.ResizeCenterCropPaddingShort", "repvgg.get_RepVGG_func_by_name", "torchvision.transforms.Normalize", "cv2.imshow", "os.path.join", "torch.no_grad", "torch.ones", "cv2.subtract", "random.randint", "onnx.s...
[((11, 82), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/liyongjing/Egolee_2021/programs/RepVGG-main"""'], {}), "(0, '/home/liyongjing/Egolee_2021/programs/RepVGG-main')\n", (26, 82), False, 'import sys\n'), ((371, 400), 'repvgg.get_RepVGG_func_by_name', 'get_RepVGG_func_by_name', (['arch'], {}), '(arch)\n'...
# Author <NAME> # July 2019 # Disclaimer: I am not responsible for the consequences of using this script or getting you banned from Riot Games. # This is only for educational purpose. Be warned the risk for its use. import sys from enum import Enum import time import cv2 import numpy from PIL import ImageGra...
[ "cv2.matchTemplate", "sys.stdout.write", "random.randint", "pyautogui.typewrite", "PIL.ImageGrab.grab", "pyautogui.press", "pyautogui.mouseUp", "time.gmtime", "time.strftime", "time.sleep", "time.time", "cv2.imread", "sys.stdout.flush", "numpy.array", "cv2.minMaxLoc", "pyautogui.mouseD...
[((1316, 1352), 'cv2.imread', 'cv2.imread', (['"""images/matchsearch.jpg"""'], {}), "('images/matchsearch.jpg')\n", (1326, 1352), False, 'import cv2\n'), ((1368, 1400), 'cv2.imread', 'cv2.imread', (['"""images/inqueue.jpg"""'], {}), "('images/inqueue.jpg')\n", (1378, 1400), False, 'import cv2\n'), ((1422, 1460), 'cv2.i...
#!venv/bin/python3 #main.py import numpy as np import cv2 import time # from muralia.utils import ( imread, imshow, imwrite, resize_image, resize_format, crop_image ) from muralia.pdi import ( compare_dist, correlation_matrix, create_small_images, generate_mosaic, correla...
[ "muralia.pdi.generate_mosaic_resize", "muralia.files.save_list", "numpy.load", "muralia.pdi.create_photos", "numpy.savez_compressed", "muralia.files.load_list", "muralia.files.join_path", "muralia.files.mk_all_dirs", "muralia.pdi.correlation_matrix_resize", "muralia.files.files_from_dir", "mural...
[((1149, 1188), 'muralia.files.mk_all_dirs', 'mk_all_dirs', (['"""output_images"""'], {'root': '(True)'}), "('output_images', root=True)\n", (1160, 1188), False, 'from muralia.files import files_from_dir, is_file_exist, join_path, mkdir, load_list, save_list, mk_all_dirs\n'), ((1295, 1337), 'muralia.files.join_path', '...
import copy import os.path as osp import numpy as np import tensorflow as tf from spektral.data import Graph from spektral.data.utils import get_spec from spektral.datasets.utils import DATASET_FOLDER class Dataset: """ A container for Graph objects. This class can be extended to represent a graph datas...
[ "tensorflow.as_dtype", "os.path.exists", "copy.copy", "numpy.array", "os.path.join", "spektral.data.utils.get_spec" ]
[((7285, 7334), 'os.path.join', 'osp.join', (['DATASET_FOLDER', 'self.__class__.__name__'], {}), '(DATASET_FOLDER, self.__class__.__name__)\n', (7293, 7334), True, 'import os.path as osp\n'), ((3844, 3865), 'os.path.exists', 'osp.exists', (['self.path'], {}), '(self.path)\n', (3854, 3865), True, 'import os.path as osp\...
import unittest import logging import numpy as np from sklearn.preprocessing import MinMaxScaler, StandardScaler from darts.dataprocessing.transformers import Scaler from darts.utils import timeseries_generation as tg from darts import TimeSeries class DataTransformerTestCase(unittest.TestCase): __test__ = True...
[ "sklearn.preprocessing.StandardScaler", "darts.TimeSeries.from_values", "sklearn.preprocessing.MinMaxScaler", "logging.disable", "darts.utils.timeseries_generation.random_walk_timeseries", "numpy.array", "numpy.arange", "numpy.random.rand" ]
[((372, 405), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (387, 405), False, 'import logging\n'), ((3346, 3371), 'numpy.random.rand', 'np.random.rand', (['(10)', '(5)', '(50)'], {}), '(10, 5, 50)\n', (3360, 3371), True, 'import numpy as np\n'), ((3382, 3410), 'darts.TimeSer...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 4 20:39:07 2020 @author: JianyuanZhai """ import pyomo.environ as pe import numpy as np import time DOUBLE = np.float64 class DDCU_Nonuniform(): def __init__(self, intercept = True): self.intercept = intercept self.ddcu = DDCU_...
[ "pyomo.environ.SolverFactory", "pyomo.environ.Constraint", "pyomo.environ.Var", "pyomo.environ.value", "time.time", "pyomo.environ.Objective", "pyomo.environ.exp", "numpy.array", "pyomo.environ.Param", "pyomo.environ.AbstractModel", "pyomo.environ.Set" ]
[((387, 411), 'pyomo.environ.SolverFactory', 'pe.SolverFactory', (['"""glpk"""'], {}), "('glpk')\n", (403, 411), True, 'import pyomo.environ as pe\n'), ((1001, 1025), 'pyomo.environ.SolverFactory', 'pe.SolverFactory', (['solver'], {}), '(solver)\n', (1017, 1025), True, 'import pyomo.environ as pe\n'), ((1091, 1102), 't...
import os import sys sys.path.append("/src") import glob import cv2 as cv import json import numpy as np import tensorflow as tf import pyquaternion from utils import tf_utils, helpers, kitti_utils from utils import box3dImageTransform as box_utils def create_example(img, scan, label): feature = { 'ima...
[ "utils.kitti_utils.remove_dontcare", "numpy.ones", "numpy.clip", "numpy.sin", "cv2.imencode", "os.path.join", "sys.path.append", "pyquaternion.Quaternion", "utils.tf_utils.bytes_feature", "cv2.resize", "utils.box3dImageTransform.Camera", "os.path.basename", "tensorflow.train.Features", "ut...
[((22, 45), 'sys.path.append', 'sys.path.append', (['"""/src"""'], {}), "('/src')\n", (37, 45), False, 'import sys\n'), ((329, 356), 'utils.tf_utils.bytes_feature', 'tf_utils.bytes_feature', (['img'], {}), '(img)\n', (351, 356), False, 'from utils import tf_utils, helpers, kitti_utils\n'), ((1732, 1783), 'os.path.join'...
""" Kinetic Reaction Scheme Functions for Fast Pyrolysis of Biomass. Each function is for a particular kinetic scheme. Reference for each scheme is provided as main author and publication year. """ # modules # ----------------------------------------------------------------------------- import numpy as np # Sadhukha...
[ "numpy.exp" ]
[((881, 905), 'numpy.exp', 'np.exp', (['(-E1 / (R * T[i]))'], {}), '(-E1 / (R * T[i]))\n', (887, 905), True, 'import numpy as np\n'), ((952, 976), 'numpy.exp', 'np.exp', (['(-E2 / (R * T[i]))'], {}), '(-E2 / (R * T[i]))\n', (958, 976), True, 'import numpy as np\n'), ((1010, 1034), 'numpy.exp', 'np.exp', (['(-E3 / (R * ...
# # Copyright (c) 2018-2019 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
[ "numpy.ones", "utils.grpc.model_metadata_response", "utils.rest.get_model_metadata_response_rest", "utils.rest.infer_rest", "pytest.mark.parametrize", "utils.grpc.infer", "utils.grpc.get_model_metadata" ]
[((3616, 3721), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""request_format"""', "['row_name', 'row_noname', 'column_name', 'column_noname']"], {}), "('request_format', ['row_name', 'row_noname',\n 'column_name', 'column_noname'])\n", (3639, 3721), False, 'import pytest\n'), ((1806, 1829), 'numpy.ones...
import pandas as pd from mne.event import define_target_events import mne import numpy as np def listen_italian_epoch(raw, mat,Tmin, Tmax): # extract trials of tmax second and remove the wrong answer trials and seperate the in three conditions # start and end of an epoch in sec. # ignore stimuli shorter than tmax ...
[ "pandas.DataFrame", "mne.pick_types", "numpy.hstack", "mne.find_events", "numpy.sort", "mne.Epochs", "mne.event.define_target_events", "numpy.where", "numpy.intersect1d", "numpy.vstack" ]
[((333, 377), 'mne.find_events', 'mne.find_events', (['raw'], {'stim_channel': '"""Trigger"""'}), "(raw, stim_channel='Trigger')\n", (348, 377), False, 'import mne\n'), ((639, 732), 'mne.event.define_target_events', 'define_target_events', (['events', 'reference_id', 'target_id', 'sfreq', 'tmin', 'Tmax', 'new_id', 'fil...
## @ingroup Methods-Weights-Buildups-Common # prop.py # # Created: Jun 2017, <NAME> # Modified: Apr 2018, J. Smart # Mar 2020, <NAME> #------------------------------------------------------------------------------- # Imports #------------------------------------------------------------------------------- ...
[ "numpy.sum", "numpy.abs", "numpy.amin", "SUAVE.Attributes.Solids.Aluminum", "numpy.ones", "numpy.mean", "numpy.multiply", "SUAVE.Attributes.Solids.Epoxy", "SUAVE.Attributes.Solids.Bidirectional_Carbon_Fiber", "numpy.linspace", "SUAVE.Attributes.Solids.Carbon_Fiber_Honeycomb", "copy.deepcopy", ...
[((4319, 4353), 'copy.deepcopy', 'cp.deepcopy', (['forward_web_locations'], {}), '(forward_web_locations)\n', (4330, 4353), True, 'import copy as cp\n'), ((6958, 7022), 'numpy.multiply', 'np.multiply', (['(5 * toc)', '[0.2969, -0.126, -0.3516, 0.2843, -0.1015]'], {}), '(5 * toc, [0.2969, -0.126, -0.3516, 0.2843, -0.101...
import torch import torch.nn as nn import numpy as np import pandas as pd import copy import time import argparse import os import rbo from library_models import * from library_data import * from scipy import stats from collections import defaultdict, Counter def filter_and_split(data=[]): (users,counts) = np.un...
[ "copy.deepcopy", "numpy.average", "argparse.ArgumentParser", "pandas.read_csv", "numpy.median", "numpy.std", "numpy.zeros", "numpy.insert", "collections.defaultdict", "numpy.argsort", "torch.mul", "numpy.array", "torch.cuda.is_available", "numpy.random.choice", "torch.zeros", "collecti...
[((315, 356), 'numpy.unique', 'np.unique', (['data[:, 0]'], {'return_counts': '(True)'}), '(data[:, 0], return_counts=True)\n', (324, 356), True, 'import numpy as np\n'), ((759, 777), 'numpy.array', 'np.array', (['new_data'], {}), '(new_data)\n', (767, 777), True, 'import numpy as np\n'), ((1320, 1345), 'argparse.Argum...
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 <NAME> and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Common high-level operations test Tests features...
[ "h5py.File", "os.unlink", "numpy.dtype", "six.unichr", "tempfile.mktemp" ]
[((1048, 1063), 'six.unichr', 'six.unichr', (['(252)'], {}), '(252)\n', (1058, 1063), False, 'import six\n'), ((1067, 1082), 'six.unichr', 'six.unichr', (['(223)'], {}), '(223)\n', (1077, 1082), False, 'import six\n'), ((1674, 1687), 'numpy.dtype', 'np.dtype', (['"""f"""'], {}), "('f')\n", (1682, 1687), True, 'import n...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' polynomial regression It is a form of regression analysis in which the relationship between the independent variable x and the dependent variable y is modelled as an nth degree polynomial in x. y = c0 * x^0 + c1 * x^1 + c2 * x^2 + c3 * x^3 + ..... + cn * x ^n ...
[ "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.subtract", "random.uniform", "numpy.split", "sklearn.linear_model.LinearRegression", "sklearn.preprocessing.PolynomialFeatures", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((1827, 1867), 'numpy.split', 'np.split', (['y1_samples', '[train_sample_cnt]'], {}), '(y1_samples, [train_sample_cnt])\n', (1835, 1867), True, 'import numpy as np\n'), ((1943, 1983), 'numpy.split', 'np.split', (['y2_samples', '[train_sample_cnt]'], {}), '(y2_samples, [train_sample_cnt])\n', (1951, 1983), True, 'impor...
import numpy as np #----------------------------------------------------------------------- # node_0 # [2] ---------(1)------> |[]|xx # xx (1)zz-----> | | xx # xx zz | | (2)---> # xz | | [] # zz xx | | (-1)--...
[ "numpy.array" ]
[((911, 927), 'numpy.array', 'np.array', (['[2, 3]'], {}), '([2, 3])\n', (919, 927), True, 'import numpy as np\n'), ((1880, 1920), 'numpy.array', 'np.array', (['[node_0_output, node_1_output]'], {}), '([node_0_output, node_1_output])\n', (1888, 1920), True, 'import numpy as np\n'), ((987, 1003), 'numpy.array', 'np.arra...
from model import Model import torch torch.backends.cudnn.benchmark=True import torch.nn as nn import torchvision.datasets as dsets import torchvision.models as models import torchvision.transforms as transforms from torch.autograd import Variable import torch.optim as optim import torch.nn.functional as F import argpa...
[ "numpy.load", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "torch.autograd.Variable", "subprocess.check_output", "model.Model", "data_loader.cifar100", "numpy.arange", "numpy.random.permutation", "numpy.savez" ]
[((555, 612), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Continuum learning"""'}), "(description='Continuum learning')\n", (578, 612), False, 'import argparse\n'), ((1490, 1521), 'numpy.load', 'np.load', (['"""cifar_mean_image.npy"""'], {}), "('cifar_mean_image.npy')\n", (1497, 1521)...
from __future__ import print_function, division import numpy as np from openmdao.api import ExplicitComponent class CreateRHS(ExplicitComponent): """ Compute the right-hand-side of the K * u = f linear system to solve for the displacements. The RHS is based on the loads. For the aerostructural case, thes...
[ "numpy.zeros", "numpy.abs", "numpy.arange", "numpy.ones" ]
[((1146, 1158), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (1155, 1158), True, 'import numpy as np\n'), ((994, 1016), 'numpy.zeros', 'np.zeros', (['(self.ny, 6)'], {}), '((self.ny, 6))\n', (1002, 1016), True, 'import numpy as np\n'), ((1067, 1093), 'numpy.ones', 'np.ones', (['((self.ny + 1) * 6)'], {}), '((self...
import os import sys import json import unittest import numpy as np import luigi import z5py from sklearn.metrics import adjusted_rand_score try: from elf.segmentation.mutex_watershed import mutex_watershed except ImportError: mutex_watershed = None try: from ..base import BaseTest except ValueError: ...
[ "unittest.main", "sys.path.append", "z5py.File", "json.dump", "cluster_tools.mutex_watershed.MwsWorkflow.get_config", "numpy.logical_not", "unittest.skipUnless", "elf.segmentation.mutex_watershed.mutex_watershed", "cluster_tools.mutex_watershed.MwsWorkflow", "os.path.join", "luigi.build" ]
[((2166, 2220), 'unittest.skipUnless', 'unittest.skipUnless', (['mutex_watershed', '"""Needs affogato"""'], {}), "(mutex_watershed, 'Needs affogato')\n", (2185, 2220), False, 'import unittest\n'), ((3030, 3084), 'unittest.skipUnless', 'unittest.skipUnless', (['mutex_watershed', '"""Needs affogato"""'], {}), "(mutex_wat...
import pytest import os import numpy as np import spiceypy as spice import json from unittest.mock import patch, PropertyMock import unittest from conftest import get_image_label, get_image_kernels, convert_kernels, get_isd, compare_dicts import ale from ale.drivers.mex_drivers import MexHrscPds3NaifSpiceDriver, MexHrs...
[ "os.remove", "ale.load", "json.loads", "conftest.compare_dicts", "ale.drivers.mex_drivers.MexHrscIsisLabelNaifSpiceDriver", "ale.drivers.mex_drivers.MexSrcPds3NaifSpiceDriver", "numpy.testing.assert_almost_equal", "conftest.get_image_kernels", "pytest.fixture", "json.dumps", "conftest.get_image_...
[((376, 392), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (390, 392), False, 'import pytest\n'), ((13061, 13077), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (13075, 13077), False, 'import pytest\n'), ((13361, 13377), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (13375, 13377), False, 'impo...
#! /usr/bin/env python # by weil # Sep 24, 2020 # save as anndata import pandas as pd import numpy as np import scipy import os import scanpy as sc from anndata import AnnData # expr matrix expr_mat=pd.read_csv("../download/MacParland/GSE115469_Data.csv.gz", index_col=0) # reshape to cell * gene expr_mat=expr_mat.T...
[ "pandas.DataFrame", "numpy.sum", "scanpy.pp.highly_variable_genes", "os.makedirs", "os.path.join", "pandas.read_csv", "os.path.exists", "scanpy.pl.highly_variable_genes", "scanpy.pp.log1p", "anndata.AnnData", "scanpy.pp.normalize_total" ]
[((202, 274), 'pandas.read_csv', 'pd.read_csv', (['"""../download/MacParland/GSE115469_Data.csv.gz"""'], {'index_col': '(0)'}), "('../download/MacParland/GSE115469_Data.csv.gz', index_col=0)\n", (213, 274), True, 'import pandas as pd\n'), ((342, 431), 'pandas.read_csv', 'pd.read_csv', (['"""../download/MacParland/Cell_...
from numpy.random import RandomState from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams from random import Random import time seed = int(time.time()) py_rng = Random(seed) np_rng = RandomState(seed) t_rng = RandomStreams(seed) def set_seed(n): global seed, py_rng, np_rng, t_rng seed =...
[ "random.Random", "theano.sandbox.rng_mrg.MRG_RandomStreams", "numpy.random.RandomState", "time.time" ]
[((180, 192), 'random.Random', 'Random', (['seed'], {}), '(seed)\n', (186, 192), False, 'from random import Random\n'), ((202, 219), 'numpy.random.RandomState', 'RandomState', (['seed'], {}), '(seed)\n', (213, 219), False, 'from numpy.random import RandomState\n'), ((228, 247), 'theano.sandbox.rng_mrg.MRG_RandomStreams...
import tvm import numpy as np import torch N = 2 nC = 16 H = 14 W = 14 K = 16 R = 3 S = 3 padding = 1 P = H + 2 * padding Q = W + 2 * padding dtype = "float32" A = tvm.te.placeholder([N, nC, H, W], dtype=dtype, name="A") C = tvm.te.compute([N, K, P, Q], lambda n, k, h, w : tvm.tir.if_then_else( tvm.t...
[ "numpy.random.uniform", "tvm.te.placeholder", "tvm.nd.array", "tvm.context", "numpy.zeros", "tvm.build", "tvm.te.grad_op", "tvm.te.create_schedule", "tvm.lower", "tvm.tir.all" ]
[((171, 227), 'tvm.te.placeholder', 'tvm.te.placeholder', (['[N, nC, H, W]'], {'dtype': 'dtype', 'name': '"""A"""'}), "([N, nC, H, W], dtype=dtype, name='A')\n", (189, 227), False, 'import tvm\n'), ((447, 503), 'tvm.te.placeholder', 'tvm.te.placeholder', (['[N, K, P, Q]'], {'dtype': 'dtype', 'name': '"""dC"""'}), "([N,...
#!/usr/bin/env python # coding: utf-8 # # Approximating Runge's function # # **<NAME>, PhD** # # This demo is based on the original Matlab demo accompanying the <a href="https://mitpress.mit.edu/books/applied-computational-economics-and-finance">Computational Economics and Finance</a> 2001 textbook by <NAME> and <N...
[ "warnings.simplefilter", "numpy.polyval", "numpy.zeros", "numpy.linalg.cond", "compecon.BasisChebyshev", "numpy.arange", "numpy.linalg.norm", "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((910, 941), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (931, 941), False, 'import warnings\n'), ((1140, 1164), 'numpy.linspace', 'np.linspace', (['a', 'b', 'nplot'], {}), '(a, b, nplot)\n', (1151, 1164), True, 'import numpy as np\n'), ((1251, 1270), 'numpy.arange', 'np.a...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 31 14:50:41 2018 @author: mimbres """ import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.optim.lr_scheduler import StepLR from torch.backends import cudnn import numpy as np import glob...
[ "numpy.set_printoptions", "torch.nn.ReLU", "argparse.ArgumentParser", "os.path.dirname", "torch.nn.Conv1d", "blocks.highway_dil_conv.HighwayDCBlock" ]
[((539, 602), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Sequence Skip Prediction"""'}), "(description='Sequence Skip Prediction')\n", (562, 602), False, 'import argparse\n'), ((1901, 1933), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)'}), '(precision=3)\n...
import json import argparse import torch import os import random import numpy as np import requests import logging import math import copy import string from tqdm import tqdm from time import time from flask import Flask, request, jsonify, render_template, redirect from flask_cors import CORS from tornado.wsgi import ...
[ "numpy.random.seed", "argparse.ArgumentParser", "tornado.ioloop.IOLoop.instance", "flask_cors.CORS", "json.dumps", "flask.jsonify", "os.path.join", "tornado.wsgi.WSGIContainer", "json.loads", "requests_futures.sessions.FuturesSession", "random.seed", "densephrases.utils.open_utils.load_phrase_...
[((780, 923), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=l...
#!/usr/bin/env python import contextlib import multiprocessing import numpy as np import scipy.spatial.distance as ssd import aqml.cheminfo.core as cc import aqml.cheminfo.molecule.nbody as MB import aqml.cheminfo.molecule.core as cmc import matplotlib.pylab as plt T, F = True, False class RawM(object): """ ...
[ "numpy.abs", "argparse.ArgumentParser", "numpy.argsort", "numpy.linalg.norm", "scipy.spatial.distance.pdist", "numpy.arange", "numpy.exp", "multiprocessing.cpu_count", "numpy.set_printoptions", "numpy.meshgrid", "matplotlib.pylab.legend", "numpy.max", "numpy.linspace", "aqml.cheminfo.core....
[((7386, 7407), 'numpy.get_printoptions', 'np.get_printoptions', ([], {}), '()\n', (7405, 7407), True, 'import numpy as np\n'), ((7412, 7448), 'numpy.set_printoptions', 'np.set_printoptions', (['*args'], {}), '(*args, **kwargs)\n', (7431, 7448), True, 'import numpy as np\n'), ((7761, 7780), 'argparse.ArgumentParser', '...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "crossbeam.model.encoder.ValueWeightEncoder", "torch.nn.ReLU", "torch.nn.Embedding", "crossbeam.model.great.Great", "torch.cat", "crossbeam.model.op_arg.LSTMArgSelector", "torch.arange", "numpy.reshape", "torch.nn.Linear", "crossbeam.model.encoder.DummyWeightEncoder", "torch.tensor" ]
[((1029, 1179), 'crossbeam.model.op_arg.LSTMArgSelector', 'LSTMArgSelector', ([], {'hidden_size': 'args.embed_dim', 'mlp_sizes': '[256, 1]', 'step_score_func': 'args.step_score_func', 'step_score_normalize': 'args.score_normed'}), '(hidden_size=args.embed_dim, mlp_sizes=[256, 1],\n step_score_func=args.step_score_fu...
import glob import os import numpy as np import skimage.io import skimage.transform import multiprocessing as mp import utils directories = glob.glob("data/train/*") class_names = [os.path.basename(d) for d in directories] class_names.sort() num_classes = len(class_names) paths_train = glob.glob("d...
[ "utils.load_gz", "numpy.log", "os.path.basename", "numpy.deg2rad", "numpy.float32", "numpy.zeros", "numpy.array", "glob.glob" ]
[((155, 180), 'glob.glob', 'glob.glob', (['"""data/train/*"""'], {}), "('data/train/*')\n", (164, 180), False, 'import glob\n'), ((308, 335), 'glob.glob', 'glob.glob', (['"""data/train/*/*"""'], {}), "('data/train/*/*')\n", (317, 335), False, 'import glob\n'), ((372, 396), 'glob.glob', 'glob.glob', (['"""data/test/*"""...
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' \file Test.py \brief Code to train a denoiser network. \copyright Copyright (c) 2019 Visual Computing group of Ulm University, Germany. See the LICENSE file at the top-level directory of this d...
[ "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "numpy.amin", "tf_ops_module.point_to_mesh_distance", "numpy.isnan", "tensorflow.ConfigProto", "numpy.mean", "numpy.linalg.norm", "tensorflow.get_default_graph", "tensorflow.GPUOptions", "tf_ops_module.find_knn", "os.path.join", "...
[((805, 836), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""MCCNN"""'], {}), "(BASE_DIR, 'MCCNN')\n", (817, 836), False, 'import os\n'), ((716, 741), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (731, 741), False, 'import os\n'), ((759, 791), 'os.path.join', 'os.path.join', (['BASE_DIR'...
# Injector parameter calculation script (like-on-like doublet impingment injector) # Authors: <NAME>, <NAME>, <NAME>, <NAME>, # Project Caelus, 04 March 2021 """ INPUTS: - mdot = Mass flow rate, kg/sec - of_ratio = Oxidizer to fuel ratio, dimensionless - rho_f = Fuel density, kg/m^3 - rho_o = Oxidizer...
[ "numpy.sum", "numpy.deg2rad", "numpy.floor", "helpers.misc.print_header", "sys.exit", "numpy.sqrt" ]
[((3363, 3376), 'numpy.floor', 'np.floor', (['n_o'], {}), '(n_o)\n', (3371, 3376), True, 'import numpy as np\n'), ((3436, 3449), 'numpy.floor', 'np.floor', (['n_f'], {}), '(n_f)\n', (3444, 3449), True, 'import numpy as np\n'), ((3524, 3628), 'helpers.misc.print_header', 'print_header', (['"""The given fuel injector are...
import numpy as np # # Performs interpolation along a Bezier curve # # p0, p1, p2, and p3 are 2D coordinates # # t is a time value from 0 to 1 # def bezier_interp(p0, p1, p2, p3, t): # l01 = p1 - p0 # l12 = p2 - p1 # l23 = p3 - p2 # p01 = l01 * t + p0 # p12 = l12 * t + p1 # p23 = l23 * t + p2 ...
[ "numpy.zeros", "numpy.repeat" ]
[((1086, 1110), 'numpy.zeros', 'np.zeros', (['(numFrames, 4)'], {}), '((numFrames, 4))\n', (1094, 1110), True, 'import numpy as np\n'), ((1294, 1318), 'numpy.zeros', 'np.zeros', (['(numFrames, 4)'], {}), '((numFrames, 4))\n', (1302, 1318), True, 'import numpy as np\n'), ((1636, 1664), 'numpy.repeat', 'np.repeat', (['cu...
"""Tests ellipse_fit with satellites. Compatible with pytest.""" import pytest import numpy as np import sys import os.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) from util.new_tle_kep_state import tle_to_state from util.rkf5 import rkf5 from kep_determination.ellips...
[ "util.rkf5.rkf5", "kep_determination.ellipse_fit.determine_kep", "numpy.insert", "util.new_tle_kep_state.tle_to_state", "numpy.array", "numpy.reshape", "pytest.approx" ]
[((923, 999), 'numpy.array', 'np.array', (['[101.754, 195.737, 0.0031531, 352.864, 117.261, 12.53984625169364]'], {}), '([101.754, 195.737, 0.0031531, 352.864, 117.261, 12.53984625169364])\n', (931, 999), True, 'import numpy as np\n'), ((1012, 1029), 'util.new_tle_kep_state.tle_to_state', 'tle_to_state', (['tle'], {}),...
import csv import numpy as np def getDataSource(data_path): marks_in_percentage=[] days_present=[] with open(data_path) as csv_file: csv_reader=csv.DictReader(csv_file) for row in csv_reader: marks_in_percentage.append(float(row["marksinpercentage"])) days_present.app...
[ "csv.DictReader", "numpy.corrcoef" ]
[((455, 500), 'numpy.corrcoef', 'np.corrcoef', (["datasource['x']", "datasource['y']"], {}), "(datasource['x'], datasource['y'])\n", (466, 500), True, 'import numpy as np\n'), ((164, 188), 'csv.DictReader', 'csv.DictReader', (['csv_file'], {}), '(csv_file)\n', (178, 188), False, 'import csv\n')]
import numpy as np from scipy.special import digamma from scipy.special import gamma import warnings warnings.filterwarnings("error") from utility import compute_normalized_volumes class NNSingleFunctionalEstimator: def __init__(self, ks=None, alphas=None, beta=0.): """ Parameters ------...
[ "numpy.maximum", "numpy.log", "numpy.ceil", "warnings.filterwarnings", "scipy.special.digamma", "numpy.array", "utility.compute_normalized_volumes", "scipy.special.gamma" ]
[((101, 133), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (124, 133), False, 'import warnings\n'), ((485, 497), 'numpy.array', 'np.array', (['ks'], {}), '(ks)\n', (493, 497), True, 'import numpy as np\n'), ((1952, 1993), 'utility.compute_normalized_volumes', 'compute_norm...
# Triples class for (T) corrections, CC3, etc. import numpy as np from opt_einsum import contract class cctriples(object): def __init__(self, ccwfn): self.ccwfn = ccwfn # Vikings' formulation def t_vikings(self): o = self.ccwfn.o v = self.ccwfn.v no = self.ccwfn.no ...
[ "opt_einsum.contract", "numpy.zeros_like", "numpy.diag" ]
[((467, 495), 'numpy.zeros_like', 'np.zeros_like', (['self.ccwfn.t1'], {}), '(self.ccwfn.t1)\n', (480, 495), True, 'import numpy as np\n'), ((509, 537), 'numpy.zeros_like', 'np.zeros_like', (['self.ccwfn.t2'], {}), '(self.ccwfn.t2)\n', (522, 537), True, 'import numpy as np\n'), ((1585, 1604), 'numpy.zeros_like', 'np.ze...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import glob import logging import os import time import numpy from keras.layers import Conv2D, BatchNormalization, Input, Activation, Flatten, Dense, Add from keras.models import Model from keras.optimizers import Adam from keras.regularizers import l2 from alphazero.nnet ...
[ "keras.regularizers.l2", "numpy.random.seed", "keras.layers.Activation", "numpy.zeros", "keras.layers.Flatten", "keras.models.Model", "numpy.ones", "keras.layers.Add", "logging.info", "keras.optimizers.Adam", "keras.layers.Dense", "numpy.array", "time.time", "glob.glob", "keras.layers.In...
[((366, 389), 'numpy.random.seed', 'numpy.random.seed', (['(1337)'], {}), '(1337)\n', (383, 389), False, 'import numpy\n'), ((1287, 1366), 'keras.layers.Input', 'Input', ([], {'shape': '(self.args.history_num * 2 + 1, self.args.rows, self.args.columns)'}), '(shape=(self.args.history_num * 2 + 1, self.args.rows, self.ar...
from types import SimpleNamespace as NS from copy import deepcopy, copy import numpy as np class coord: """ Base class for all coordinate systems """ # If the coordinate system is linear is_linear = False def __radd__(self, gg, inplace=False): gg = gg if inplace else deepcopy(gg) ...
[ "copy.deepcopy", "numpy.asarray", "numpy.floor", "copy.copy", "numpy.isnan", "numpy.hstack", "numpy.repeat", "numpy.linspace", "types.SimpleNamespace", "numpy.sqrt" ]
[((4238, 4251), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (4248, 4251), True, 'import numpy as np\n'), ((4260, 4273), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (4270, 4273), True, 'import numpy as np\n'), ((4285, 4339), 'numpy.sqrt', 'np.sqrt', (['((x[:-1] - x[1:]) ** 2 + (y[:-1] - y[1:]) ** 2)'],...
import numpy as np from collections import namedtuple def cosine_similarity(u, v): return np.dot(np.squeeze(u),np.squeeze(v)) / (np.linalg.norm(u) * np.linalg.norm(v)) Batch = namedtuple("Batch", ["obs", "a", "returns", "s_diff", "ri", "gsum", "features"]) class FeudalBatch(object): def __init__(self): ...
[ "numpy.zeros_like", "numpy.asarray", "numpy.linalg.norm", "collections.namedtuple", "numpy.squeeze" ]
[((183, 268), 'collections.namedtuple', 'namedtuple', (['"""Batch"""', "['obs', 'a', 'returns', 's_diff', 'ri', 'gsum', 'features']"], {}), "('Batch', ['obs', 'a', 'returns', 's_diff', 'ri', 'gsum', 'features']\n )\n", (193, 268), False, 'from collections import namedtuple\n'), ((826, 846), 'numpy.asarray', 'np.asar...
#!/usr/bin/env python # coding: utf-8 from PIL import Image import cv2 import numpy as np from paddle.fluid.io import DataLoader import os from paddlex.cls import transforms #import Albumentation as A from glob import glob import paddle.fluid as fluid def loader(path): x = Image.open(path).convert("RGB") x ...
[ "cv2.cvtColor", "numpy.asarray", "paddlex.cls.transforms.RandomCrop", "paddlex.cls.transforms.RandomDistort", "PIL.Image.open", "paddle.fluid.io.batch", "paddlex.cls.transforms.RandomHorizontalFlip", "glob.glob", "paddlex.cls.transforms.RandomRotate", "os.path.join", "cv2.resize", "paddle.flui...
[((2905, 2932), 'os.path.join', 'os.path.join', (['path', '"""*.png"""'], {}), "(path, '*.png')\n", (2917, 2932), False, 'import os\n'), ((2953, 2973), 'glob.glob', 'glob', (['search_pattern'], {}), '(search_pattern)\n', (2957, 2973), False, 'from glob import glob\n'), ((3222, 3251), 'paddle.fluid.io.shuffle', 'fluid.i...
############################################################################## # # Unit tests for probabilities of Fock autocomes in the Gaussian backend # This DOES NOT test for sampling of the said probabilities # ############################################################################## import unittest import o...
[ "numpy.conj", "numpy.abs", "unittest.TextTestRunner", "unittest.TestSuite", "numpy.tanh", "os.getcwd", "numpy.empty", "numpy.arange", "numpy.tile", "math.factorial", "unittest.TestLoader", "numpy.array", "numpy.diag", "numpy.exp", "numpy.cosh", "numpy.sqrt" ]
[((343, 354), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (352, 354), False, 'import os, sys\n'), ((5452, 5472), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (5470, 5472), False, 'import unittest\n'), ((1513, 1543), 'numpy.empty', 'np.empty', (['(self.bsize, self.D)'], {}), '((self.bsize, self.D))\n', ...
import numpy as np import os from keras.models import model_from_json, model_from_yaml import tensorflow as tf from tensorflow.python.ops import array_ops def dataset_import(data_dir, data_type): sets = [] print("Load from %s" % data_dir) for dir_name, subdir_list, file_list in os.walk(data_dir): f...
[ "os.mkdir", "tensorflow.reduce_sum", "tensorflow.clip_by_value", "os.walk", "tensorflow.zeros_like", "tensorflow.greater", "tensorflow.abs", "tensorflow.less_equal", "tensorflow.cast", "tensorflow.equal", "tensorflow.reduce_mean", "tensorflow.ones_like", "tensorflow.round", "os.listdir", ...
[((292, 309), 'os.walk', 'os.walk', (['data_dir'], {}), '(data_dir)\n', (299, 309), False, 'import os\n'), ((983, 1011), 'os.mkdir', 'os.mkdir', (["(new_dir + '/model')"], {}), "(new_dir + '/model')\n", (991, 1011), False, 'import os\n'), ((1016, 1046), 'os.mkdir', 'os.mkdir', (["(new_dir + '/logging')"], {}), "(new_di...
import os import numpy as np def build_datasets(base, val_ratio=0.2): ban_list = ["10020533.jpg"] with open(base+'labels.txt', 'w') as f: for i in range(20): f.write(str(i)+'\n') imgs = os.listdir(os.path.join(base, 'train/')) np.random.seed(5) np.random.shuffle(imgs) val...
[ "os.listdir", "numpy.random.seed", "os.path.join", "numpy.random.shuffle" ]
[((267, 284), 'numpy.random.seed', 'np.random.seed', (['(5)'], {}), '(5)\n', (281, 284), True, 'import numpy as np\n'), ((289, 312), 'numpy.random.shuffle', 'np.random.shuffle', (['imgs'], {}), '(imgs)\n', (306, 312), True, 'import numpy as np\n'), ((233, 261), 'os.path.join', 'os.path.join', (['base', '"""train/"""'],...
#!/usr/bin/env python3 """ @author:Harold @file: utils.py @time: 27/09/2019 """ import numpy as np import pandas as pd def load_3d_pt_cloud_data_with_delimiter(path_name: str, delimiter: str) -> np.array: return pd.read_csv( path_name, dtype=np.float32, delimiter=delimiter, header=None ).to_numpy() ...
[ "pandas.read_csv", "numpy.mean", "numpy.abs" ]
[((990, 1013), 'numpy.mean', 'np.mean', (['limits'], {'axis': '(1)'}), '(limits, axis=1)\n', (997, 1013), True, 'import numpy as np\n'), ((219, 293), 'pandas.read_csv', 'pd.read_csv', (['path_name'], {'dtype': 'np.float32', 'delimiter': 'delimiter', 'header': 'None'}), '(path_name, dtype=np.float32, delimiter=delimiter...
import numpy as np import torch import pytest from pytorch_widedeep.models import BasicRNN, AttentiveRNN, StackedAttentiveRNN padded_sequences = np.random.choice(np.arange(1, 100), (100, 48)) padded_sequences = np.hstack( (np.repeat(np.array([[0, 0]]), 100, axis=0), padded_sequences) ) pretrained_embeddings = np....
[ "pytest.warns", "pytorch_widedeep.models.BasicRNN", "pytorch_widedeep.models.StackedAttentiveRNN", "numpy.arange", "numpy.array", "torch.Size", "numpy.random.rand", "pytest.mark.parametrize", "pytorch_widedeep.models.AttentiveRNN", "torch.from_numpy" ]
[((591, 642), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""attention"""', '[True, False]'], {}), "('attention', [True, False])\n", (614, 642), False, 'import pytest\n'), ((1389, 1444), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bidirectional"""', '[True, False]'], {}), "('bidirectional',...
"""Unit Tests for inferences module""" import pytest import numpy as np import pandas as pd from pandas.testing import assert_series_equal from statsmodels.tsa.statespace.structural import UnobservedComponents from statsmodels.tsa.arima_process import ArmaProcess import causalimpact compile_posterior = causalimpact...
[ "pandas.DataFrame", "statsmodels.tsa.statespace.structural.UnobservedComponents", "numpy.random.seed", "numpy.cumsum", "numpy.array", "pandas.Series", "numpy.random.normal", "statsmodels.tsa.arima_process.ArmaProcess", "pandas.testing.assert_series_equal", "pandas.concat", "numpy.concatenate" ]
[((361, 378), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (375, 378), True, 'import numpy as np\n'), ((441, 454), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (449, 454), True, 'import numpy as np\n'), ((474, 493), 'statsmodels.tsa.arima_process.ArmaProcess', 'ArmaProcess', (['ar', 'ma'], {})...
import os os.environ['CUDA_VISIBLE_DEVICES'] = '4' import cv2 import numpy as np from maskrcnn_benchmark.config import cfg from demo.predictor import ICDARDemo, RRPNDemo from maskrcnn_benchmark.utils.visualize import vis_image, write_result_ICDAR_RRPN2polys, zip_dir, write_result_ICDAR_MASKRRPN2polys from PIL ...
[ "os.remove", "numpy.sum", "cv2.bitwise_and", "os.popen", "maskrcnn_benchmark.config.cfg.MODEL.WEIGHT.split", "cv2.fillPoly", "os.path.isfile", "Pascal_VOC.eval_func", "maskrcnn_benchmark.config.cfg.merge_from_list", "skimage.measure.find_contours", "os.path.join", "cv2.cvtColor", "maskrcnn_b...
[((5213, 5245), 'maskrcnn_benchmark.config.cfg.merge_from_file', 'cfg.merge_from_file', (['config_file'], {}), '(config_file)\n', (5232, 5245), False, 'from maskrcnn_benchmark.config import cfg\n'), ((5279, 5324), 'maskrcnn_benchmark.config.cfg.merge_from_list', 'cfg.merge_from_list', (["['MODEL.DEVICE', 'cuda']"], {})...
import unittest import numpy as np from ocgis.util.helpers import iter_array class Test(unittest.TestCase): def test_iter_array(self): values = np.random.rand(2,2,4,4) mask = np.random.random_integers(0,1,values.shape) values = np.ma.array(values,mask=mask) for idx in iter_array(v...
[ "unittest.main", "ocgis.util.helpers.iter_array", "numpy.ma.array", "numpy.random.rand", "numpy.random.random_integers" ]
[((650, 665), 'unittest.main', 'unittest.main', ([], {}), '()\n', (663, 665), False, 'import unittest\n'), ((159, 185), 'numpy.random.rand', 'np.random.rand', (['(2)', '(2)', '(4)', '(4)'], {}), '(2, 2, 4, 4)\n', (173, 185), True, 'import numpy as np\n'), ((198, 243), 'numpy.random.random_integers', 'np.random.random_i...
from __future__ import print_function import photutils import matplotlib.pyplot as plt import numpy as np import pandas as pd import gklib as gk from astropy.stats import SigmaClip class CircularBackgroundSubractor(object): """ A class to calculate and subtract the background in a FITS image after masking out...
[ "numpy.sum", "photutils.aperture_photometry", "photutils.MedianBackground", "photutils.CircularAperture", "photutils.Background2D", "gklib.num2str", "numpy.arange", "numpy.interp", "astropy.stats.SigmaClip", "matplotlib.pyplot.subplots" ]
[((3081, 3114), 'numpy.arange', 'np.arange', (['postage_stamp.shape[1]'], {}), '(postage_stamp.shape[1])\n', (3090, 3114), True, 'import numpy as np\n'), ((3129, 3162), 'numpy.arange', 'np.arange', (['postage_stamp.shape[0]'], {}), '(postage_stamp.shape[0])\n', (3138, 3162), True, 'import numpy as np\n'), ((3171, 3200)...
############################################# # Copy and modify based on DiGCN # https://github.com/flyingtango/DiGCN ############################################# import os.path as osp import numpy as np import scipy.sparse as sp import networkx as nx import pandas as pd import os import torch import sys import torch...
[ "numpy.load", "numpy.sum", "numpy.unique", "numpy.zeros", "torch.cat", "numpy.random.RandomState", "numpy.setdiff1d", "scipy.sparse.csr_matrix", "torch_geometric.data.Data", "numpy.squeeze", "numpy.vstack", "numpy.concatenate", "torch.from_numpy" ]
[((857, 886), 'numpy.vstack', 'np.vstack', (['(coo.row, coo.col)'], {}), '((coo.row, coo.col))\n', (866, 886), True, 'import numpy as np\n'), ((950, 1010), 'torch_geometric.data.Data', 'Data', ([], {'x': 'values', 'edge_index': 'indices', 'edge_weight': 'None', 'y': 'None'}), '(x=values, edge_index=indices, edge_weight...
import torch, time import numpy as np import joblib import logging as log from training_pipeline.topic_finder import TopicFinder cuda = torch.device("cuda" if torch.cuda.is_available() else "cpu") torch.cuda.empty_cache() class modelClass: def __init__(self, config, statistical_similarity_matrix, vocabulary, hie...
[ "torch.unique", "torch.where", "numpy.asanyarray", "torch.argsort", "torch.cat", "time.time", "torch.mul", "torch.max", "torch.cuda.is_available", "torch.cuda.empty_cache", "torch.rand", "torch.tensor", "torch.sum", "torch.div", "training_pipeline.topic_finder.TopicFinder", "torch.tran...
[((198, 222), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (220, 222), False, 'import torch, time\n'), ((160, 185), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (183, 185), False, 'import torch, time\n'), ((423, 477), 'training_pipeline.topic_finder.TopicFinder', 'Top...
# -*- coding: utf-8 -*- """SHERIFS Seismic Hazard and Earthquake Rates In Fault Systems Version 1.0 This code open the interface to select the options explored in the logic tree @author: <NAME> """ import numpy as np #import tkinter as tk #from tkinter import ttk, Label, Text, INSERT,END, StringVar,Li...
[ "numpy.array", "numpy.genfromtxt" ]
[((17321, 17413), 'numpy.genfromtxt', 'np.genfromtxt', (['NomFichier_InfosZonage'], {'dtype': "['U100', 'U100', 'f8', 'f8']", 'skip_header': '(1)'}), "(NomFichier_InfosZonage, dtype=['U100', 'U100', 'f8', 'f8'],\n skip_header=1)\n", (17334, 17413), True, 'import numpy as np\n'), ((17556, 17583), 'numpy.array', 'np.a...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. py:currentmodule:: vpsem .. moduleauthor:: <NAME> <<EMAIL>> Script to compute absorption of x-ray by the gas in a VP-SEM. """ ############################################################################### # Copyright 2021 <NAME> # # Licensed under the Apache Lice...
[ "numpy.exp", "xray.mac.models.chantler2005.Chantler2005" ]
[((1276, 1290), 'xray.mac.models.chantler2005.Chantler2005', 'Chantler2005', ([], {}), '()\n', (1288, 1290), False, 'from xray.mac.models.chantler2005 import Chantler2005\n'), ((1633, 1685), 'numpy.exp', 'np.exp', (['(-total_mac_cm2_g * density_g_cm3 * length_cm)'], {}), '(-total_mac_cm2_g * density_g_cm3 * length_cm)\...
import pytest import numpy as np from scipy.spatial import ConvexHull from hysynth.utils.hybrid_system import HybridSystemConvexHull from hysynth.utils.hybrid_system.library import construct_variable_name as get_var def test_instantiation_check(): with pytest.raises(ValueError): _ = HybridSystemConvexHul...
[ "hysynth.utils.hybrid_system.library.construct_variable_name", "pytest.fixture", "pytest.raises", "numpy.random.rand", "scipy.spatial.ConvexHull" ]
[((347, 363), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (361, 363), False, 'import pytest\n'), ((663, 679), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (677, 679), False, 'import pytest\n'), ((777, 808), 'numpy.random.rand', 'np.random.rand', (['n_points', 'n_dim'], {}), '(n_points, n_dim)\n', (79...
import numpy as np import bct import sys import mne from nitime import TimeSeries from nitime.analysis import CorrelationAnalyzer from my_settings import (bands, source_folder, window_size, step_size) subject = sys.argv[1] cls = np.load(source_folder + "hilbert_data/%s_classic_ht-epo.npy" % subject).it...
[ "numpy.load", "numpy.save", "my_settings.bands.keys", "numpy.abs", "nitime.TimeSeries", "numpy.asarray", "bct.transitivity_bu", "bct.distance.charpath", "numpy.nonzero", "bct.degrees_und", "numpy.arange", "nitime.analysis.CorrelationAnalyzer" ]
[((430, 455), 'numpy.arange', 'np.arange', (['(-4000)', '(1001)', '(1)'], {}), '(-4000, 1001, 1)\n', (439, 455), True, 'import numpy as np\n'), ((3481, 3576), 'numpy.save', 'np.save', (["(source_folder + 'graph_data/%s_pln_pow_sliding_bin-epo.npy' % subject)", 'results_pln'], {}), "(source_folder + 'graph_data/%s_pln_p...
from optparse import Values import matplotlib.pyplot as plt from floodsystem.analysis import polyfit import matplotlib import numpy as np from datetime import datetime, timedelta from floodsystem.datafetcher import fetch_measure_levels def plot_water_levels(station, dates, levels): "plots time series of level data"...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "floodsystem.analysis.polyfit", "matplotlib.pyplot.xticks", "numpy.linspace", "matplotlib.dates.date2num", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.tight_layout" ]
[((379, 402), 'matplotlib.pyplot.plot', 'plt.plot', (['dates', 'levels'], {}), '(dates, levels)\n', (387, 402), True, 'import matplotlib.pyplot as plt\n'), ((799, 817), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""date"""'], {}), "('date')\n", (809, 817), True, 'import matplotlib.pyplot as plt\n'), ((822, 851), 'mat...
"""The point of Container.py is to provide a function Container which converts any old thing A to thing B which looks and acts just like A, but it has a 'value' attribute. B.value looks and acts just like A but every variable 'inside' B has been replaced by its value. Examples: class MyObject(object): def ...
[ "numpy.dtype", "numpy.array", "copy.copy" ]
[((8334, 8363), 'numpy.array', 'array', (['val_ind'], {'dtype': '"""int32"""'}), "(val_ind, dtype='int32')\n", (8339, 8363), False, 'from numpy import ndarray, array, zeros, shape, arange, where, dtype, Inf\n'), ((8423, 8455), 'numpy.array', 'array', (['nonval_ind'], {'dtype': '"""int32"""'}), "(nonval_ind, dtype='int3...
import math import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from config import Config # # DEVICE = torch.device('cpu') # NOISY_LAYER_STD = 0.1 # From shandong def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) n...
[ "numpy.asarray", "torch.nn.functional.linear", "torch.nn.init.constant_", "torch.nn.Linear", "torch.zeros", "torch.nn.functional.softplus", "torch.nn.init.orthogonal_", "torch.from_numpy" ]
[((240, 278), 'torch.nn.init.orthogonal_', 'nn.init.orthogonal_', (['layer.weight.data'], {}), '(layer.weight.data)\n', (259, 278), True, 'import torch.nn as nn\n'), ((319, 356), 'torch.nn.init.constant_', 'nn.init.constant_', (['layer.bias.data', '(0)'], {}), '(layer.bias.data, 0)\n', (336, 356), True, 'import torch.n...
from typing import ClassVar, Sequence, Tuple, Union import numpy as np from ..utils.events.dataclass import Property, evented_dataclass def only_2D_3D(ndisplay): if ndisplay not in (2, 3): raise ValueError( f"Invalid number of dimensions to be displayed {ndisplay}" f" must be eit...
[ "numpy.argsort", "numpy.array", "numpy.clip", "numpy.roll" ]
[((707, 722), 'numpy.array', 'np.array', (['order'], {}), '(order)\n', (715, 722), True, 'import numpy as np\n'), ((731, 746), 'numpy.argsort', 'np.argsort', (['arr'], {}), '(arr)\n', (741, 746), True, 'import numpy as np\n'), ((7727, 7751), 'numpy.array', 'np.array', (['self.displayed'], {}), '(self.displayed)\n', (77...
""" Definition of power supply interfacing commands. """ import time import numpy as np from mqlab.connections import Instrument class PowerSupply(Instrument): def __init__(self, max_current_A, **kwargs): """ Init for power supply including a safety routine to limit accidental setting of erroneo...
[ "time.sleep", "numpy.linspace", "time.time" ]
[((702, 750), 'numpy.linspace', 'np.linspace', (['self._set_current_before_ramp', '(0)', '(6)'], {}), '(self._set_current_before_ramp, 0, 6)\n', (713, 750), True, 'import numpy as np\n'), ((1100, 1148), 'numpy.linspace', 'np.linspace', (['(0)', 'self._set_current_before_ramp', '(6)'], {}), '(0, self._set_current_before...
from helper_tool import ConfigSemanticKITTI as cfg from RandLANet import Network, compute_loss, compute_acc, IoUCalculator from semantic_kitti_dataset import SemanticKITTI import numpy as np import os, argparse import torch from torch.utils.data import DataLoader import torch.nn as nn import torch.optim as optim from ...
[ "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "torch.cuda.device_count", "os.path.isfile", "torch.no_grad", "os.path.join", "torch.utils.data.DataLoader", "torch.load", "os.path.exists", "RandLANet.IoUCalculator", "datetime.datetime.now", "RandLANet.compute_acc", "torch.cuda....
[((356, 381), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (379, 381), False, 'import os, argparse\n'), ((1475, 1500), 'semantic_kitti_dataset.SemanticKITTI', 'SemanticKITTI', (['"""training"""'], {}), "('training')\n", (1488, 1500), False, 'from semantic_kitti_dataset import SemanticKITTI\n'...
import functools import os import random from typing import List import numpy i = 7 j = 7 k = 5 ij = i + j ijk = i + j + k # A - 0, B - 1, C - 2 P = numpy.array( [[0, i / ij, j / ij], [i / ijk, k / ijk, j / ijk], [j / ij, i / ij, 0]] ) print("P") print(P) w, v = numpy.linalg.eig(P.transpose()) print(v...
[ "os.remove", "numpy.empty", "numpy.identity", "random.random", "numpy.array", "functools.reduce", "numpy.diag" ]
[((152, 240), 'numpy.array', 'numpy.array', (['[[0, i / ij, j / ij], [i / ijk, k / ijk, j / ijk], [j / ij, i / ij, 0]]'], {}), '([[0, i / ij, j / ij], [i / ijk, k / ijk, j / ijk], [j / ij, i /\n ij, 0]])\n', (163, 240), False, 'import numpy\n'), ((364, 403), 'functools.reduce', 'functools.reduce', (['(lambda x, y: x...
import numpy as np from badgr.utils.np_utils import imresize from badgr.utils.python_utils import AttrDict class EnvSpec(object): def __init__(self, names_shapes_limits_dtypes): names_shapes_limits_dtypes = list(names_shapes_limits_dtypes) names_shapes_limits_dtypes += [('done', (1,), (0, 1), np...
[ "badgr.utils.python_utils.AttrDict", "numpy.array" ]
[((361, 371), 'badgr.utils.python_utils.AttrDict', 'AttrDict', ([], {}), '()\n', (369, 371), False, 'from badgr.utils.python_utils import AttrDict\n'), ((404, 414), 'badgr.utils.python_utils.AttrDict', 'AttrDict', ([], {}), '()\n', (412, 414), False, 'from badgr.utils.python_utils import AttrDict\n'), ((447, 457), 'bad...
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2020 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) import itertools from pprint import pprint import numpy as np from IPython.core.display import dis...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.close", "pymor.discretizers.builtin.gui.matplotlib.MatplotlibPatchAxes", "matplotlib.pyplot.figure", "numpy.min", "ipywidgets.widgets.Output", "numpy.max", "pymor.discretizers.builtin.gui.matplotlib.Matplotlib1DAxes" ]
[((3378, 3405), 'matplotlib.pyplot.figure', 'plt.figure', (['self.fig_ids[0]'], {}), '(self.fig_ids[0])\n', (3388, 3405), True, 'import matplotlib.pyplot as plt\n'), ((4640, 4656), 'ipywidgets.widgets.Output', 'widgets.Output', ([], {}), '()\n', (4654, 4656), False, 'from ipywidgets import HTML, HBox, widgets, Layout\n...
from __future__ import division #brings in Python 3.0 mixed type calculation rules import datetime import inspect import numpy as np import numpy.testing as npt import os.path import pandas as pd import sys from tabulate import tabulate import unittest ##find parent directory and import model #parentddir = os.path.ab...
[ "unittest.main", "pandas.DataFrame", "numpy.testing.assert_array_equal", "tabulate.tabulate", "pandas.Series", "numpy.testing.assert_equal", "inspect.currentframe", "numpy.testing.assert_allclose" ]
[((167075, 167090), 'unittest.main', 'unittest.main', ([], {}), '()\n', (167088, 167090), False, 'import unittest\n'), ((1077, 1091), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1089, 1091), True, 'import pandas as pd\n'), ((2222, 2251), 'pandas.Series', 'pd.Series', (['[]'], {'dtype': '"""object"""'}), "([]...
#!/usr/bin/env python3 ''' Functions used for common spatial patterns''' import numpy as np from scipy.special import binom import pyriemann.utils.mean as rie_mean from filters import butter_fir_filter from eig import gevd __author__ = "<NAME> and <NAME>" __email__ = "<EMAIL>,<EMAIL>" def csp_one_one(cov_matrix,NO...
[ "scipy.special.binom", "pyriemann.utils.mean.mean_covariance", "eig.gevd", "numpy.zeros", "numpy.transpose", "numpy.reshape", "numpy.eye", "numpy.log10", "numpy.var", "filters.butter_fir_filter" ]
[((629, 649), 'scipy.special.binom', 'binom', (['NO_classes', '(2)'], {}), '(NO_classes, 2)\n', (634, 649), False, 'from scipy.special import binom\n'), ((696, 717), 'numpy.zeros', 'np.zeros', (['(N, NO_csp)'], {}), '((N, NO_csp))\n', (704, 717), True, 'import numpy as np\n'), ((1789, 1847), 'numpy.zeros', 'np.zeros', ...
import plotly.graph_objs as go import pandas as pd import numpy as np from sklearn.metrics import accuracy_score from simulation import load_sample import sys colors = {"ncv": ("rgb(31,120,180)", "rgb(166, 206, 227)", "rgba(166, 206, 227,0.1)"), "bncv": ("rgb(51,160,44)", "rgb(178,223,138)", "rgba(178,223,13...
[ "pandas.read_csv", "plotly.graph_objs.Figure", "numpy.array", "simulation.load_sample" ]
[((3167, 3186), 'plotly.graph_objs.Figure', 'go.Figure', (['children'], {}), '(children)\n', (3176, 3186), True, 'import plotly.graph_objs as go\n'), ((3512, 3536), 'pandas.read_csv', 'pd.read_csv', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (3523, 3536), True, 'import pandas as pd\n'), ((815, 843), 'simulation.load_sam...
#!/usr/bin/env python import numpy as np import spatialmath.base.argcheck as argcheck import cv2 as cv import machinevisiontoolbox.base.color as color from scipy import interpolate # import scipy as sp # from scipy import signal # from scipy import interpolate # from collecitons import namedtuple # from pathlib i...
[ "numpy.dstack", "machinevisiontoolbox.base.color.gamma_encode", "machinevisiontoolbox.Image.Image", "numpy.minimum", "cv2.cvtColor", "numpy.zeros", "machinevisiontoolbox.Image.Image.showcolorspace", "numpy.reshape", "spatialmath.base.argcheck.getvector" ]
[((14381, 14402), 'machinevisiontoolbox.Image.Image', 'Image', (['"""monalisa.png"""'], {}), "('monalisa.png')\n", (14386, 14402), False, 'from machinevisiontoolbox.Image import Image\n'), ((14429, 14451), 'machinevisiontoolbox.Image.Image.showcolorspace', 'Image.showcolorspace', ([], {}), '()\n', (14449, 14451), False...
#!/usr/bin/env python3.7 """ The copyrights of this software are owned by Duke University. Please refer to the LICENSE.txt and README.txt files for licensing instructions. The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent """ # builtins import os import time impor...
[ "sys.platform.startswith", "matplotlib.pyplot.savefig", "src.core.Trace", "src.core.Nerve.morphology_data", "numpy.arctan2", "src.utils.TemplateOutput.read", "matplotlib.pyplot.figure", "numpy.sin", "cv2.floodFill", "os.path.join", "os.chdir", "cv2.imwrite", "matplotlib.pyplot.close", "os....
[((1501, 1562), 'src.utils.Exceptionable.__init__', 'Exceptionable.__init__', (['self', 'SetupMode.OLD', 'exception_config'], {}), '(self, SetupMode.OLD, exception_config)\n', (1523, 1562), False, 'from src.utils import Exceptionable, Configurable, Saveable, SetupMode, Config, MaskFileNames, NerveMode, MaskInputMode, R...
import numpy as np def rotationMatrix3D(roll, pitch, yaw): # RPY <--> XYZ, roll first, picth then, yaw final si, sj, sk = np.sin(roll), np.sin(pitch), np.sin(yaw) ci, cj, ck = np.cos(roll), np.cos(pitch), np.cos(yaw) cc, cs = ci * ck, ci * sk sc, ss = si * ck, si * sk R = np.identity(3) R...
[ "numpy.concatenate", "numpy.transpose", "numpy.identity", "numpy.expand_dims", "numpy.hstack", "numpy.ones", "numpy.sin", "numpy.array", "numpy.linalg.inv", "numpy.cos", "numpy.dot", "numpy.vstack" ]
[((300, 314), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (311, 314), True, 'import numpy as np\n'), ((582, 596), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (593, 596), True, 'import numpy as np\n'), ((611, 623), 'numpy.cos', 'np.cos', (['roll'], {}), '(roll)\n', (617, 623), True, 'import num...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch.utils.data as data import numpy as np import torch import json import cv2 import os from utils.image import flip, color_aug from utils.image import get_affine_transform, affine_transform from utils...
[ "random.sample", "numpy.clip", "cv2.warpAffine", "numpy.random.randint", "numpy.arange", "os.path.join", "numpy.random.randn", "numpy.random.choice", "numpy.stack", "math.ceil", "utils.image.affine_transform", "numpy.zeros", "random.choice", "utils.image.color_aug", "math.floor", "cv2....
[((544, 622), 'numpy.array', 'np.array', (['[box[0], box[1], box[0] + box[2], box[1] + box[3]]'], {'dtype': 'np.float32'}), '([box[0], box[1], box[0] + box[2], box[1] + box[3]], dtype=np.float32)\n', (552, 622), True, 'import numpy as np\n'), ((2633, 2701), 'numpy.array', 'np.array', (['[img.shape[1] / 2.0, img.shape[0...
#!/usr/bin/env python """Chainer example: train a VAE on MNIST """ import argparse import os import numpy as np import chainer from chainer import training from chainer.training import extensions import chainerx import net def main(): parser = argparse.ArgumentParser(description='Chainer example: VAE') par...
[ "argparse.ArgumentParser", "net.make_encoder", "net.AvgELBOLoss", "net.make_decoder", "chainer.no_backprop_mode", "chainer.iterators.SerialIterator", "os.path.join", "chainer.training.extensions.LogReport", "chainer.serializers.load_npz", "chainer.training.extensions.Evaluator", "net.make_prior"...
[((253, 312), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chainer example: VAE"""'}), "(description='Chainer example: VAE')\n", (276, 312), False, 'import argparse\n'), ((2397, 2428), 'chainer.get_device', 'chainer.get_device', (['args.device'], {}), '(args.device)\n', (2415, 2428), F...
from probeinterface import Probe import numpy as np import pytest def _dummy_position(): n = 24 positions = np.zeros((n, 2)) for i in range(n): x = i // 8 y = i % 8 positions[i] = x, y positions *= 20 positions[8:16, 1] -= 10 return positions def test_probe(): ...
[ "probeinterface.Probe.from_dict", "numpy.random.randn", "probeinterface.Probe", "numpy.allclose", "numpy.zeros", "numpy.ones", "probeinterface.Probe.from_numpy", "numpy.arange", "numpy.random.rand", "probeinterface.Probe.from_dataframe", "numpy.random.shuffle" ]
[((119, 135), 'numpy.zeros', 'np.zeros', (['(n, 2)'], {}), '((n, 2))\n', (127, 135), True, 'import numpy as np\n'), ((369, 397), 'probeinterface.Probe', 'Probe', ([], {'ndim': '(2)', 'si_units': '"""um"""'}), "(ndim=2, si_units='um')\n", (374, 397), False, 'from probeinterface import Probe\n'), ((1173, 1202), 'numpy.ar...
#!/usr/bin/env python u""" load_nodal_corrections.py (12/2020) Calculates the nodal corrections for tidal constituents Modification of ARGUMENTS fortran subroutine by <NAME> 03/1999 CALLING SEQUENCE: pu,pf,G = load_nodal_corrections(MJD,constituents) INPUTS: MJD: Modified Julian Day of input date constitu...
[ "numpy.arctan2", "numpy.zeros", "numpy.sin", "numpy.tan", "numpy.cos", "numpy.arctan", "numpy.atleast_1d", "pyTMD.calc_astrol_longitudes.calc_astrol_longitudes", "numpy.sqrt" ]
[((3157, 3208), 'pyTMD.calc_astrol_longitudes.calc_astrol_longitudes', 'calc_astrol_longitudes', (['(MJD + DELTAT)'], {'ASTRO5': 'ASTRO5'}), '(MJD + DELTAT, ASTRO5=ASTRO5)\n', (3179, 3208), False, 'from pyTMD.calc_astrol_longitudes import calc_astrol_longitudes\n'), ((3355, 3373), 'numpy.zeros', 'np.zeros', (['(nt, 60)...
import numpy as np import pytest from scripts.utils import check_if_board_is_full, get_winner, negamax, negamax_alpha_beta_pruned board0 = np.zeros(shape=(3, 3)) board1 = np.array([[-1, 0, 1], [1, 0, 0], [1, -1, -1]]) board2 = np.array([[1, 0, 1], [0, 0, 0], [0, -1, -1]]) board3 = np.array([[1, -1, -1], [-1, 1, 1], [...
[ "scripts.utils.negamax_alpha_beta_pruned", "numpy.zeros", "scripts.utils.check_if_board_is_full", "numpy.array", "scripts.utils.negamax", "pytest.mark.parametrize", "scripts.utils.get_winner" ]
[((141, 163), 'numpy.zeros', 'np.zeros', ([], {'shape': '(3, 3)'}), '(shape=(3, 3))\n', (149, 163), True, 'import numpy as np\n'), ((173, 219), 'numpy.array', 'np.array', (['[[-1, 0, 1], [1, 0, 0], [1, -1, -1]]'], {}), '([[-1, 0, 1], [1, 0, 0], [1, -1, -1]])\n', (181, 219), True, 'import numpy as np\n'), ((229, 274), '...
################################################################################################################# # ewstools # Description: Python package for computing, analysing and visualising # early warning signals (EWS) in time-series data # Author: <NAME> # Web: http://www.math.uwaterloo.ca/~tbury/ # Code repo:...
[ "pandas.DataFrame", "scipy.signal.welch", "numpy.linalg.eig", "numpy.isnan", "numpy.array", "pandas.Series", "numpy.exp", "numpy.linalg.inv", "numpy.cos", "numpy.sqrt", "pandas.concat", "lmfit.Model" ]
[((4133, 4248), 'scipy.signal.welch', 'signal.welch', (['yVals', 'fs'], {'nperseg': 'ham_length', 'noverlap': 'ham_offset_points', 'return_onesided': '(False)', 'scaling': 'scaling'}), '(yVals, fs, nperseg=ham_length, noverlap=ham_offset_points,\n return_onesided=False, scaling=scaling)\n', (4145, 4248), False, 'fro...
import numpy as np import matplotlib.pyplot as plt def amplify(x): n = len(x) A = np.matrix(np.zeros((2*n,n))) b = np.matrix(np.zeros((2*n,1))) for i in range(n): A[i, i] = 1. # amplify the curvature A[i, (i+1)%n] = -1. b[i, 0] = (x[i] - x[(i+1)%n])*1.9 A[n+i, i] = 1...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.zeros", "matplotlib.pyplot.axis", "numpy.linalg.inv", "matplotlib.pyplot.gca" ]
[((865, 904), 'matplotlib.pyplot.plot', 'plt.plot', (['(x + [x[0]])', '(y + [y[0]])', '"""g--"""'], {}), "(x + [x[0]], y + [y[0]], 'g--')\n", (873, 904), True, 'import matplotlib.pyplot as plt\n'), ((933, 984), 'matplotlib.pyplot.plot', 'plt.plot', (['(x + [x[0]])', '(y + [y[0]])', '"""k-"""'], {'linewidth': '(3)'}), "...
import numpy as np from numpy.lib.index_tricks import index_exp def create_burrow(lines): longest = max(len(l) for l in lines) normalised_lines = [] for line in lines: if len(line) == longest: normalised_lines.append(line) continue missing = longest - len(line) ...
[ "numpy.ndenumerate" ]
[((539, 561), 'numpy.ndenumerate', 'np.ndenumerate', (['burrow'], {}), '(burrow)\n', (553, 561), True, 'import numpy as np\n'), ((751, 773), 'numpy.ndenumerate', 'np.ndenumerate', (['burrow'], {}), '(burrow)\n', (765, 773), True, 'import numpy as np\n')]
import numpy as np import matplotlib.pyplot as plt N = 4 samplerate1 = (16.474, 13.585, 5.42, 16.138, 7.455) minstrel1 = (12.653, 10.208, 7.587, 10.867, 8.430) minproved1 = (17.037, 14.879, 11.107, 15.846, 12.162) samplerate2 = (13.107, 9.688, 7.982, 13.894) minstrel2 = (11.575, 10.837, 8.320, 11.729) minproved2 =(16...
[ "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.show" ]
[((359, 371), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (368, 371), True, 'import numpy as np\n'), ((456, 468), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (466, 468), True, 'import matplotlib.pyplot as plt\n'), ((1224, 1234), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1232, 1234)...
# coding: utf-8 # In[1]: """ Todo: combine read_lines, load_pickle, etc... to one single function load_file(), and use if statement to see which suffix the file has. Also keep an optional param suffix=None just in case we want to force it to load with a certain format """ from random import shuffle import ...
[ "numpy.percentile", "random.shuffle" ]
[((1876, 1911), 'numpy.percentile', 'np.percentile', (['turn_lengths_lst', '(90)'], {}), '(turn_lengths_lst, 90)\n', (1889, 1911), True, 'import numpy as np\n'), ((3090, 3113), 'random.shuffle', 'shuffle', (['norm_dialogues'], {}), '(norm_dialogues)\n', (3097, 3113), False, 'from random import shuffle\n'), ((3214, 3229...
#!/usr/bin/env python # coding: utf-8 # **Chapter 14 – Deep Computer Vision Using Convolutional Neural Networks** # _This notebook contains all the sample code in chapter 14._ # <table align="left"> # <td> # <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/14_dee...
[ "tensorflow.random.set_seed", "matplotlib.pyplot.title", "matplotlib.rc", "tensorflow.image.resize_with_crop_or_pad", "numpy.random.seed", "tensorflow_datasets.load", "tensorflow.keras.applications.resnet50.ResNet50", "tensorflow.keras.layers.Dense", "tensorflow.keras.layers.MaxPooling2D", "tensor...
[((1579, 1597), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1593, 1597), True, 'import numpy as np\n'), ((1598, 1620), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(42)'], {}), '(42)\n', (1616, 1620), True, 'import tensorflow as tf\n'), ((1757, 1785), 'matplotlib.rc', 'mpl.rc', (['"""axe...
import os from typing import Dict, List, Tuple import sys sys.path.append(os.path.abspath(os.path.dirname(__file__)+'/'+'..')) import gym import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from common.PER import PrioritizedReplayBuffer from common.experie...
[ "common.arguments.get_args", "torch.mean", "common.network.NoisyLinearNetwork", "os.path.dirname", "torch.FloatTensor", "common.network.LinearNetwork", "common.network.NoisyLinearDuelingNetwork", "common.PER.PrioritizedReplayBuffer", "numpy.random.random", "torch.cuda.is_available", "common.expe...
[((609, 619), 'common.arguments.get_args', 'get_args', ([], {}), '()\n', (617, 619), False, 'from common.arguments import get_args\n'), ((1701, 1766), 'common.experience_replay.ReplayBuffer', 'ReplayBuffer', (['self.obs_dim', 'config.memory_size', 'config.batch_size'], {}), '(self.obs_dim, config.memory_size, config.ba...
import eigenpy eigenpy.switchToNumpyArray() import numpy as np import numpy.linalg as la dim = 100 A = np.random.rand(dim,dim) A = (A + A.T)*0.5 + np.diag(10. + np.random.rand(dim)) ldlt = eigenpy.LDLT(A) L = ldlt.matrixL() D = ldlt.vectorD() P = ldlt.transpositionsP() assert eigenpy.is_approx(np.transpose(P)....
[ "eigenpy.LDLT", "numpy.transpose", "eigenpy.switchToNumpyArray", "numpy.random.rand", "numpy.diag" ]
[((15, 43), 'eigenpy.switchToNumpyArray', 'eigenpy.switchToNumpyArray', ([], {}), '()\n', (41, 43), False, 'import eigenpy\n'), ((105, 129), 'numpy.random.rand', 'np.random.rand', (['dim', 'dim'], {}), '(dim, dim)\n', (119, 129), True, 'import numpy as np\n'), ((193, 208), 'eigenpy.LDLT', 'eigenpy.LDLT', (['A'], {}), '...
import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.utils import shuffle import tensorflow as tf from tensorflow import keras from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Embedding, Dot, Add, Flatten from tensorflow.keras.regularize...
[ "pandas.read_csv", "tensorflow.keras.models.load_model", "numpy.array" ]
[((1699, 1740), 'pandas.read_csv', 'pd.read_csv', (['"""./data/archive/ratings.csv"""'], {}), "('./data/archive/ratings.csv')\n", (1710, 1740), True, 'import pandas as pd\n'), ((3126, 3172), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""regression_model.h5"""'], {}), "('regression_model.h5')\n"...
import numpy as np import random import torch import torch.nn as nn from torch import optim class Encoder(nn.Module): def __init__(self, input_size, hidden_size, num_layers = 1): super(Encoder, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_l...
[ "numpy.full", "torch.nn.MSELoss", "random.random", "torch.nn.Linear", "torch.zeros", "torch.nn.LSTM" ]
[((360, 438), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': 'input_size', 'hidden_size': 'hidden_size', 'num_layers': 'num_layers'}), '(input_size=input_size, hidden_size=hidden_size, num_layers=num_layers)\n', (367, 438), True, 'import torch.nn as nn\n'), ((914, 992), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': ...
import json import os import numpy as np import torch from zerogercrnn.lib.constants import EMPTY_TOKEN_ID, UNKNOWN_TOKEN_ID from zerogercrnn.experiments.ast_level.utils import read_non_terminals from zerogercrnn.lib.constants import EMPTY_TOKEN_ID, UNKNOWN_TOKEN_ID, EOF_TOKEN from zerogercrnn.lib.metrics import Metr...
[ "numpy.save", "torch.sum", "zerogercrnn.lib.metrics.MaxPredictionAccuracyMetrics", "torch.argmax", "zerogercrnn.experiments.ast_level.utils.read_non_terminals", "numpy.zeros", "torch.nonzero", "json.dumps", "torch.index_select", "torch.max", "zerogercrnn.lib.metrics.BaseAccuracyMetrics", "zero...
[((1701, 1739), 'zerogercrnn.experiments.ast_level.utils.read_non_terminals', 'read_non_terminals', (['non_terminals_file'], {}), '(non_terminals_file)\n', (1719, 1739), False, 'from zerogercrnn.experiments.ast_level.utils import read_non_terminals\n'), ((4580, 4601), 'zerogercrnn.lib.metrics.BaseAccuracyMetrics', 'Bas...