code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import onnx import numpy as np from onnx.helper import make_graph, make_model, make_tensor_value_info import pytest from openvino.frontend import FrontEndManager from tests.runtime import get_runtime def create_onnx_model():...
[ "onnx.helper.make_node", "os.remove", "onnx.helper.make_tensor_value_info", "numpy.float64", "tests.runtime.get_runtime", "openvino.runtime.opset8.add", "numpy.int32", "numpy.int64", "numpy.bool", "numpy.testing.assert_allclose", "onnx.helper.make_graph", "openvino.frontend.onnx.ConversionExte...
[((5073, 5090), 'openvino.frontend.FrontEndManager', 'FrontEndManager', ([], {}), '()\n', (5088, 5090), False, 'from openvino.frontend import FrontEndManager\n'), ((331, 393), 'onnx.helper.make_node', 'onnx.helper.make_node', (['"""Add"""'], {'inputs': "['x', 'y']", 'outputs': "['z']"}), "('Add', inputs=['x', 'y'], out...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: <NAME> <<EMAIL>> # # 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 r...
[ "numpy.float32", "numpy.sin", "numpy.linalg.norm", "numpy.cos", "numpy.dot" ]
[((3620, 3721), 'numpy.float32', 'np.float32', (['((1, 0, -(img_shape[1] / 2.0)), (0, 1, -(img_shape[0] / 2.0)), (0, 0, 1), (\n 0, 0, 1))'], {}), '(((1, 0, -(img_shape[1] / 2.0)), (0, 1, -(img_shape[0] / 2.0)), (\n 0, 0, 1), (0, 0, 1)))\n', (3630, 3721), True, 'import numpy as np\n'), ((3921, 4022), 'numpy.float3...
import argparse import lzma import pickle import os import urllib.request import sys import zipfile import numpy as np import sklearn.metrics class Dataset: def __init__( self, name="isnt_it_ironic.train.zip", url="https://ufal.mff.cuni.cz/~straka/courses/npfl129/1920/datasets/", ): ...
[ "lzma.open", "numpy.random.seed", "argparse.ArgumentParser", "zipfile.ZipFile", "os.path.exists", "pickle.load", "numpy.array" ]
[((1037, 1062), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1060, 1062), False, 'import argparse\n'), ((1324, 1349), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (1338, 1349), True, 'import numpy as np\n'), ((994, 1025), 'numpy.array', 'np.array', (['self.tar...
import argparse import logging import os import pprint import random import numpy as np import torch import torch.optim as optim from common.dataset import DatasetFactory from common.evaluation import EvaluatorFactory from common.train import TrainerFactory from utils.serialization import load_checkpoint from .model ...
[ "numpy.random.seed", "argparse.ArgumentParser", "torch.manual_seed", "logging.StreamHandler", "torch.cuda.manual_seed", "common.train.TrainerFactory.get_trainer", "utils.serialization.load_checkpoint", "logging.Formatter", "common.evaluation.EvaluatorFactory.get_evaluator", "numpy.prod", "random...
[((461, 554), 'common.evaluation.EvaluatorFactory.get_evaluator', 'EvaluatorFactory.get_evaluator', (['dataset_cls', 'model', 'embedding', 'loader', 'batch_size', 'device'], {}), '(dataset_cls, model, embedding, loader,\n batch_size, device)\n', (491, 554), False, 'from common.evaluation import EvaluatorFactory\n'),...
import matplotlib.pyplot as plt import numpy as np import time, os, sys from scipy.fftpack import fft, ifft, fftshift import math sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../software/models/')) import utilFunctions as UF import dftModel as DF (fs, x) = UF.wavread('../../../soun...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "os.path.realpath", "matplotlib.pyplot.axis", "numpy.ones", "scipy.fftpack.fft", "matplotlib.pyplot.figure", "numpy.convolve", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefi...
[((295, 334), 'utilFunctions.wavread', 'UF.wavread', (['"""../../../sounds/ocean.wav"""'], {}), "('../../../sounds/ocean.wav')\n", (305, 334), True, 'import utilFunctions as UF\n'), ((346, 396), 'utilFunctions.wavread', 'UF.wavread', (['"""../../../sounds/impulse-response.wav"""'], {}), "('../../../sounds/impulse-respo...
__copyright__ = "Copyright (C) 2019 <NAME>" __license__ = """ 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, modif...
[ "common.parser.set_defaults", "pystella.derivs.centered_diff", "pystella.DomainDecomposition", "pymbolic.var", "pyopencl.CommandQueue", "common.parser.parse_args", "pystella.Field", "numpy.product", "pytest.mark.parametrize", "pytest.mark.filterwarnings", "pyopencl.clrandom.rand" ]
[((1466, 1556), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore::pyopencl.characterize.CLCharacterizationWarning"""'], {}), "(\n 'ignore::pyopencl.characterize.CLCharacterizationWarning')\n", (1492, 1556), False, 'import pytest\n'), ((1560, 1628), 'pytest.mark.filterwarnings', 'pytest.mark.f...
#!/usr/bin/env python # coding: Latin-1 # Load library functions we want import time import sys import gpiozero import numpy as np import cv2 as cv from PIL import Image from camera import Camera from argparse import ArgumentParser import logging import os from rectangle import Rectangle from time import sleep from ...
[ "cv2.putText", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.cvtColor", "cv2.getStructuringElement", "camera.Camera", "cv2.setWindowProperty", "os.system", "time.sleep", "cv2.setMouseCallback", "numpy.array", "picamera.array.PiRGBArray", "cv2.rectangle", "rectangle.Rectangle", "cv2.imshow...
[((513, 539), 'rectangle.Rectangle', 'Rectangle', (['(290)', '(0)', '(320)', '(20)'], {}), '(290, 0, 320, 20)\n', (522, 539), False, 'from rectangle import Rectangle\n'), ((549, 572), 'rectangle.Rectangle', 'Rectangle', (['(0)', '(0)', '(20)', '(20)'], {}), '(0, 0, 20, 20)\n', (558, 572), False, 'from rectangle import ...
import pickle import numpy as np import statsmodels.api as sm # find the games which are 2v2, 3v3, 4v4 def scan_game_table(table_path): team_game_set = set() target_file = open(table_path, "r") line = target_file.readline().strip().split(",") while len(line) > 1: game_id = int(line[0]) ...
[ "statsmodels.api.OLS", "numpy.column_stack" ]
[((2886, 2915), 'numpy.column_stack', 'np.column_stack', (['(x[0], ones)'], {}), '((x[0], ones))\n', (2901, 2915), True, 'import numpy as np\n'), ((2967, 2992), 'numpy.column_stack', 'np.column_stack', (['(ele, X)'], {}), '((ele, X))\n', (2982, 2992), True, 'import numpy as np\n'), ((3008, 3020), 'statsmodels.api.OLS',...
# Copyright 2018-2019 CNRS-UM LIRMM # # \author <NAME> # # # # pyQpController is free software: you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of the License, # or (at your option) any later version. ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.load", "matplotlib.pyplot.show", "matplotlib.font_manager.FontProperties", "matplotlib.pyplot.plot", "matplotlib.pyplot.subplots", "matplotlib.pyplot.figure", "matplotlib.ticker.FormatStrFormatter", "matplotlib.pyplot.ylabel", "matpl...
[((985, 1002), 'numpy.load', 'np.load', (['fileName'], {}), '(fileName)\n', (992, 1002), True, 'import numpy as np\n'), ((1057, 1080), 'numpy.load', 'np.load', (['impactFileName'], {}), '(impactFileName)\n', (1064, 1080), True, 'import numpy as np\n'), ((1382, 1398), 'matplotlib.font_manager.FontProperties', 'FontPrope...
# -*- coding: utf-8 -*- """ lantz.drivers.tektronix.tds2024b ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Implements the drivers to control an oscilloscope. :copyright: 2015 by Lantz Authors, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import struct import numpy as np fro...
[ "matplotlib.pyplot.show", "csv.writer", "argparse.ArgumentParser", "matplotlib.pyplot.plot", "lantz.feat.Feat", "numpy.array", "lantz.action.Action", "argparse.FileType" ]
[((570, 578), 'lantz.action.Action', 'Action', ([], {}), '()\n', (576, 578), False, 'from lantz.action import Action\n'), ((807, 813), 'lantz.feat.Feat', 'Feat', ([], {}), '()\n', (811, 813), False, 'from lantz.feat import Feat\n'), ((900, 906), 'lantz.feat.Feat', 'Feat', ([], {}), '()\n', (904, 906), False, 'from lant...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class Accuracy(nn.Module): def __init__(self, topk=(1,)): super(Accuracy, self).__init__() self.topk = topk def forward(self, output, target): """Computes the precision@k for the specified values...
[ "numpy.ndarray", "numpy.ndim", "numpy.argmax" ]
[((1420, 1454), 'numpy.ndarray', 'np.ndarray', (['(k, k)'], {'dtype': 'np.int32'}), '((k, k), dtype=np.int32)\n', (1430, 1454), True, 'import numpy as np\n'), ((2379, 2397), 'numpy.ndim', 'np.ndim', (['predicted'], {}), '(predicted)\n', (2386, 2397), True, 'import numpy as np\n'), ((2559, 2582), 'numpy.argmax', 'np.arg...
import numpy as np # Constants BIAS = 1 ITERATIONS = 1000 class MulticlassPreceptron: '''''' ''' Initializer function to takes the possible classes for the data set. ''' def __init__(self, possible_classes): self.learning_rate = 0.1 self.X_train = None self.y_train ...
[ "numpy.append", "numpy.array" ]
[((3810, 3822), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3818, 3822), True, 'import numpy as np\n'), ((810, 857), 'numpy.array', 'np.array', (['([0.0] * (self.number_of_features + 1))'], {}), '([0.0] * (self.number_of_features + 1))\n', (818, 857), True, 'import numpy as np\n'), ((3977, 4016), 'numpy.append'...
import numpy as np from numpy import sin, cos, tan, pi, sqrt from numpy.core.defchararray import index import yaml import os from collections import OrderedDict # import imp # import welleng.error from ..utils import NEV_to_HLA # since this is running on different OS flavors PATH = os.path.dirname(__file__) TOOL_INDE...
[ "numpy.stack", "numpy.radians", "numpy.absolute", "numpy.zeros_like", "numpy.put", "os.path.dirname", "numpy.zeros", "numpy.errstate", "numpy.amax", "numpy.where", "numpy.array", "numpy.sin", "numpy.cos", "yaml.safe_load", "collections.OrderedDict", "numpy.tan", "os.path.join", "nu...
[((285, 310), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (300, 310), False, 'import os\n'), ((324, 368), 'os.path.join', 'os.path.join', (['""""""', "*[PATH, 'tool_index.yaml']"], {}), "('', *[PATH, 'tool_index.yaml'])\n", (336, 368), False, 'import os\n'), ((8435, 8478), 'numpy.where', '...
# -*- coding: utf-8 -*- # # Project: silx (originally pyFAI) # https://github.com/silx-kit/silx # # Copyright (C) 2012-2017 European Synchrotron Radiation Facility, Grenoble, France # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated docume...
[ "numpy.outer", "numpy.zeros_like", "unittest.TestSuite", "numpy.zeros", "numpy.random.randint", "numpy.arange", "numpy.exp", "logging.getLogger", "numpy.sqrt" ]
[((1380, 1407), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1397, 1407), False, 'import logging\n'), ((7507, 7527), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (7525, 7527), False, 'import unittest\n'), ((1744, 1768), 'numpy.exp', 'numpy.exp', (['(-a * a / 4000)'], {...
""" scatter plots of magnitudes vs various parameters... to see whether the EPD linear fitting approach works. """ import numpy as np, matplotlib.pyplot as plt, pandas as pd from glob import glob import os from astropy.io import fits from plot_mag_vs_EPD_parameters import get_data import seaborn as sns from scipy.i...
[ "numpy.random.seed", "numpy.argmax", "numpy.logspace", "sklearn.metrics.r2_score", "numpy.argsort", "numpy.mean", "seaborn.PairGrid", "os.path.join", "numpy.atleast_2d", "pandas.DataFrame", "matplotlib.pyplot.close", "os.path.exists", "IPython.embed", "numpy.linspace", "matplotlib.pyplot...
[((11965, 11983), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (11979, 11983), True, 'import numpy as np, matplotlib.pyplot as plt, pandas as pd\n'), ((12027, 12048), 'plot_mag_vs_EPD_parameters.get_data', 'get_data', ([], {'n_lcs': 'n_lcs'}), '(n_lcs=n_lcs)\n', (12035, 12048), False, 'from plot_mag...
import cv2 import numpy as np from scipy import misc i = misc.ascent() import matplotlib.pyplot as plt plt.grid(False) i_transformed = np.copy(i) print(i_transformed.shape) size_x = i_transformed.shape[0] size_y = i_transformed.shape[1] print(i_transformed.shape) filter = [ [-1, -2, -1], [0, 0, 0], [1, 2, 1]] weight ...
[ "matplotlib.pyplot.gray", "matplotlib.pyplot.show", "numpy.copy", "matplotlib.pyplot.imshow", "matplotlib.pyplot.axis", "scipy.misc.ascent", "matplotlib.pyplot.grid" ]
[((57, 70), 'scipy.misc.ascent', 'misc.ascent', ([], {}), '()\n', (68, 70), False, 'from scipy import misc\n'), ((104, 119), 'matplotlib.pyplot.grid', 'plt.grid', (['(False)'], {}), '(False)\n', (112, 119), True, 'import matplotlib.pyplot as plt\n'), ((137, 147), 'numpy.copy', 'np.copy', (['i'], {}), '(i)\n', (144, 147...
""" :author: <NAME> (<EMAIL>) 2021 :License: This package is published under Simplified BSD License. """ from array import array import numpy as np FORMAT = {1: "b", 2: "h", 4: "i"} def pad(data, max_len, type): if type == "Silence": return pad_with_silence(data, max_len) elif type == "Data": return pad_...
[ "numpy.pad", "numpy.zeros", "array.array" ]
[((480, 541), 'numpy.pad', 'np.pad', (['data', '(0, to_add)'], {'mode': '"""constant"""', 'constant_values': '(0)'}), "(data, (0, to_add), mode='constant', constant_values=0)\n", (486, 541), True, 'import numpy as np\n'), ((641, 682), 'numpy.zeros', 'np.zeros', ([], {'shape': '(max_len,)', 'dtype': '"""int16"""'}), "(s...
''' cmbmap.py Plot intensity skymap from Planck, and get power spectrum. NOTE that I have not been able to install healpy in Canopy on Windows :( ''' import numpy as np import matplotlib.pyplot as plt # from pylab import * import healpy as hp # here are a bunch of different maps; the last one seems to work best # ht...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "healpy.mollview", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.logical_not", "matplotlib.pyplot.ylabel", "numpy.genfromtxt", "healpy.ma", "matplotlib.pyplot.figure", "...
[((942, 957), 'healpy.read_map', 'hp.read_map', (['fn'], {}), '(fn)\n', (953, 957), True, 'import healpy as hp\n'), ((993, 1100), 'healpy.mollview', 'hp.mollview', (['map_I'], {'coord': '"""G"""', 'title': '"""Planck R1, Histogram equalized Galactic"""', 'unit': '"""mK"""', 'norm': '"""hist"""'}), "(map_I, coord='G', t...
""" Function:Feedforward Neural Network (base class) Author:lzb Date:2021.01.07 """ import numpy as np import time from gl import errorcode from gl.array_string import array_2_string from activation.normal_activation import Sigmoid from activation.last_hop_activation import DichotomyLHA from loss.loss import MSELos...
[ "loss.loss.MSELoss", "activation.normal_activation.Sigmoid", "numpy.zeros", "time.time", "numpy.random.random", "activation.last_hop_activation.DichotomyLHA", "numpy.matmul", "gl.array_string.array_2_string" ]
[((1065, 1074), 'activation.normal_activation.Sigmoid', 'Sigmoid', ([], {}), '()\n', (1072, 1074), False, 'from activation.normal_activation import Sigmoid\n'), ((1149, 1163), 'activation.last_hop_activation.DichotomyLHA', 'DichotomyLHA', ([], {}), '()\n', (1161, 1163), False, 'from activation.last_hop_activation impor...
#Pandas is used to open csv files and convert to lists import pandas as pd #Used for making plots import matplotlib.pyplot as plt #Library used to do maths import numpy as np #Load data to pandas data = pd.read_csv('data.csv') #Give time from data time = data['Time'] light_values = data['Light'] #Use...
[ "matplotlib.pyplot.title", "numpy.full", "numpy.sum", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((213, 236), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (224, 236), True, 'import pandas as pd\n'), ((529, 549), 'numpy.sum', 'np.sum', (['light_values'], {}), '(light_values)\n', (535, 549), True, 'import numpy as np\n'), ((883, 952), 'numpy.full', 'np.full', ([], {'shape': 'number_...
from keras.models import load_model from sklearn.externals import joblib import numpy as np from keras import backend as K # Set learning phase (disable dropout) K.set_learning_phase(0) # Load model, char mapping, encoder, and raw text from disk model = load_model('shakespeare/model_1-2.h5') char_mapping = joblib.loa...
[ "keras.models.load_model", "random.uniform", "numpy.expand_dims", "keras.backend.set_learning_phase", "sklearn.externals.joblib.load" ]
[((163, 186), 'keras.backend.set_learning_phase', 'K.set_learning_phase', (['(0)'], {}), '(0)\n', (183, 186), True, 'from keras import backend as K\n'), ((256, 294), 'keras.models.load_model', 'load_model', (['"""shakespeare/model_1-2.h5"""'], {}), "('shakespeare/model_1-2.h5')\n", (266, 294), False, 'from keras.models...
""" Implements the Gradient aligned adversarial "subspace" (GAAS) of [tra17]. REFERENCES: [tra17] Tramer et al. "The Space of Transferable Adversarial Examples," arXiv 2017. [gvl96] Golub and <NAME> "Matrix Computations" 1996. """ __author__ = "mjp" __date__ = 'november, 2017' import numpy as...
[ "numpy.eye", "numpy.zeros", "numpy.ones", "numpy.linalg.norm", "numpy.random.rand", "numpy.dot", "numpy.sqrt" ]
[((805, 821), 'numpy.zeros', 'np.zeros', (['(d, k)'], {}), '((d, k))\n', (813, 821), True, 'import numpy as np\n'), ((883, 897), 'numpy.zeros', 'np.zeros', (['(d,)'], {}), '((d,))\n', (891, 897), True, 'import numpy as np\n'), ((2755, 2768), 'numpy.ones', 'np.ones', (['(n,)'], {}), '((n,))\n', (2762, 2768), True, 'impo...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 21 21:55:54 2020 @author: mostafamousavi last update: 05/27/2021 """ from __future__ import print_function from __future__ import division import os os.environ['KERAS_BACKEND']='tensorflow' from tensorflow.keras import backend as K from tensorflo...
[ "pickle.dump", "os.remove", "numpy.abs", "matplotlib.pyplot.clf", "numpy.isnan", "numpy.argsort", "tensorflow.ConfigProto", "matplotlib.pyplot.figure", "numpy.mean", "obspy.core.Stream", "numpy.arange", "matplotlib.pyplot.gca", "shutil.rmtree", "os.path.join", "matplotlib.pyplot.tight_la...
[((440, 461), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (454, 461), False, 'import matplotlib\n'), ((926, 947), 'faulthandler.enable', 'faulthandler.enable', ([], {}), '()\n', (945, 947), False, 'import faulthandler\n'), ((1100, 1133), 'warnings.filterwarnings', 'warnings.filterwarnings', ([...
from __future__ import print_function, division import os import torch from torch.autograd import Variable from skimage import io import pandas as pd import numpy as np from torch.utils.data import Dataset from geotnf.transformation import GeometricTnf from geotnf.flow import read_flo_file class TSSDataset(Dataset): ...
[ "numpy.flip", "pandas.read_csv", "torch.autograd.Variable", "numpy.asarray", "os.path.dirname", "numpy.expand_dims", "geotnf.flow.read_flo_file", "geotnf.transformation.GeometricTnf", "os.path.join", "skimage.io.imread" ]
[((906, 927), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {}), '(csv_file)\n', (917, 927), True, 'import pandas as pd\n'), ((1440, 1504), 'geotnf.transformation.GeometricTnf', 'GeometricTnf', ([], {'out_h': 'self.out_h', 'out_w': 'self.out_w', 'use_cuda': '(False)'}), '(out_h=self.out_h, out_w=self.out_w, use_cuda...
# ~~~ # This file is part of the PhD-thesis: # # "Adaptive Reduced Basis Methods for Multiscale Problems # and Large-scale PDE-constrained Optimization" # # by: <NAME> # # https://github.com/TiKeil/Supplementary-Material-for-PhD-thesis # # Copyright 2019-2022 all developers. All rights reserve...
[ "numpy.sum", "pymor.discretizers.builtin.discretize_stationary_cg", "pymor.vectorarrays.numpy.NumpyVectorSpace", "numpy.prod", "pymor.parameters.functionals.ConstantParameterFunctional", "pdeopt.gridlod_model.GridlodModel", "pdeopt.model.QuadraticPdeoptStationaryModel", "numpy.log10", "pdeopt.gridlo...
[((2150, 2166), 'numpy.array', 'np.array', (['[n, n]'], {}), '([n, n])\n', (2158, 2166), True, 'import numpy as np\n'), ((2186, 2202), 'numpy.array', 'np.array', (['[N, N]'], {}), '([N, N])\n', (2194, 2202), True, 'import numpy as np\n'), ((2493, 2519), 'numpy.array', 'np.array', (['[[a, b], [c, d]]'], {}), '([[a, b], ...
# Code by <NAME> # TODO # [X] - Generate a random sample with mean = 5, std. dev. = 2. # [X] - Plot the distribution. # [X] - Give the summary statistics import numpy as np import matplotlib.pyplot as plt import random # Input number of samples numberSamples = int(input("Enter number of samples in the sample list: ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.hist", "random.normalvariate", "numpy.std", "numpy.mean" ]
[((800, 820), 'matplotlib.pyplot.hist', 'plt.hist', (['sampleList'], {}), '(sampleList)\n', (808, 820), True, 'import matplotlib.pyplot as plt\n'), ((821, 831), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (829, 831), True, 'import matplotlib.pyplot as plt\n'), ((362, 388), 'random.normalvariate', 'random.no...
import cv2 import glob import numpy as np np.set_printoptions(threshold=np.nan) images = [] images_name = images_name = glob.glob('sample/*') for index, image in enumerate(images_name): print('Reading ' + str(index) + ' of ' + str(len(images_name))) img = cv2.imread(image) img = cv2.resize(img, (1024, 768...
[ "numpy.set_printoptions", "cv2.waitKey", "cv2.imshow", "cv2.imread", "cv2.split", "glob.glob", "cv2.destroyAllWindows", "cv2.resize" ]
[((43, 80), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (62, 80), True, 'import numpy as np\n'), ((121, 142), 'glob.glob', 'glob.glob', (['"""sample/*"""'], {}), "('sample/*')\n", (130, 142), False, 'import glob\n'), ((625, 639), 'cv2.waitKey', 'cv2.waitKey', ...
# -*- coding: utf-8 -*- from datetime import datetime import os import re import h5py from lib.pb_io import attrs2dict from lib.pb_sat import planck_r2t from lib.read_base import ReadL1 import numpy as np import pandas as pd __description__ = 'MERSI传感器读取类' __author__ = 'wangpeng' __date__ = '2018-08-28' __version__...
[ "numpy.nanmedian", "os.path.isfile", "pandas.read_table", "os.path.join", "numpy.nanmean", "numpy.full", "numpy.insert", "numpy.loadtxt", "numpy.linspace", "numpy.repeat", "h5py.File", "os.path.basename", "os.path.realpath", "re.match", "datetime.datetime", "datetime.datetime.strptime"...
[((378, 404), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (394, 404), False, 'import os\n'), ((1211, 1241), 'os.path.basename', 'os.path.basename', (['self.in_file'], {}), '(self.in_file)\n', (1227, 1241), False, 'import os\n'), ((1578, 1608), 'os.path.basename', 'os.path.basename', (['s...
# -*- coding: utf-8 -*- """ Created on Thu Jan 24 15:59:00 2019 @author: hsteffens """ import json, os, time, warnings import numpy as np import pandas as pd import datetime as dt import matplotlib.pyplot as plt from copy import deepcopy from enum import Enum from scipy import special from scipy.optimize import curve...
[ "time.strftime", "matplotlib.pyplot.figure", "matplotlib.pyplot.fill_between", "os.path.join", "pandas.DataFrame", "warnings.simplefilter", "datetime.timedelta", "warnings.catch_warnings", "numpy.linspace", "matplotlib.pyplot.semilogy", "json.JSONEncoder.default", "json.dump", "copy.deepcopy...
[((15408, 15435), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (15418, 15435), True, 'import matplotlib.pyplot as plt\n'), ((2360, 2395), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (2384, 2395), False, 'import json, o...
#!/usr/bin/env python # # fnirt.py - Functions for working with FNIRT non-linear transformations. # # Author: <NAME> <<EMAIL>> # """This module contains functions for working with FNIRT non-linear transformations. The following functions are available: .. autosummary:: :nosignatures: readFnirt toFnirt fro...
[ "nibabel.nifti1.Nifti1Image", "numpy.eye", "fsl.data.image.Image", "numpy.isclose", "numpy.array", "numpy.diag", "logging.getLogger" ]
[((4495, 4522), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (4512, 4522), False, 'import logging\n'), ((7771, 7861), 'numpy.array', 'np.array', (["[img.header['intent_p1'], img.header['intent_p2'], img.header['intent_p3']]"], {}), "([img.header['intent_p1'], img.header['intent_p2'], im...
#!/usr/bin/env python3 import clusterking as ck import clusterking_physics.models.bdlnu.distribution as bdlnu import numpy as np from numpy import sqrt from wilson.run.smeft.smpar import p from wilson import Wilson v = sqrt(1 / (sqrt(2) * p["GF"])) Yb = 4.2 / v Ytau = 1.776 / v def dGEl(bm, el): w = Wilson( ...
[ "clusterking_physics.models.bdlnu.distribution.dGEl", "clusterking.scan.Scanner", "clusterking.Data", "numpy.linspace", "numpy.sqrt" ]
[((497, 514), 'clusterking.scan.Scanner', 'ck.scan.Scanner', ([], {}), '()\n', (512, 514), True, 'import clusterking as ck\n'), ((703, 712), 'clusterking.Data', 'ck.Data', ([], {}), '()\n', (710, 712), True, 'import clusterking as ck\n'), ((473, 490), 'clusterking_physics.models.bdlnu.distribution.dGEl', 'bdlnu.dGEl', ...
import click import os import numpy as np import tensorflow as tf from math import ceil from BNN_functions import (normalizeData, build_input_pipeline, createNeuralNet, percentError, setupOptimization) @click.command() @click.option('--hidden', default=3, help='Number of hidden...
[ "BNN_functions.build_input_pipeline", "tensorflow.train.Saver", "BNN_functions.setupOptimization", "tensorflow.global_variables_initializer", "math.ceil", "os.getcwd", "click.option", "tensorflow.Session", "BNN_functions.createNeuralNet", "click.command", "tensorflow.local_variables_initializer"...
[((244, 259), 'click.command', 'click.command', ([], {}), '()\n', (257, 259), False, 'import click\n'), ((262, 329), 'click.option', 'click.option', (['"""--hidden"""'], {'default': '(3)', 'help': '"""Number of hidden layers"""'}), "('--hidden', default=3, help='Number of hidden layers')\n", (274, 329), False, 'import ...
import numpy as np from mahjong.shanten import Shanten from itertools import combinations from utils import * np.random.seed(0) def is_tinroto(hand): return all([x in [0, 8, 9, 17, 18, 26] for x in key]) shanten = Shanten() cases = [] for key in combinations(range(34), 5): hand = [0] * 34 for tile in...
[ "mahjong.shanten.Shanten", "numpy.random.seed", "numpy.random.choice" ]
[((112, 129), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (126, 129), True, 'import numpy as np\n'), ((224, 233), 'mahjong.shanten.Shanten', 'Shanten', ([], {}), '()\n', (231, 233), False, 'from mahjong.shanten import Shanten\n'), ((425, 450), 'numpy.random.choice', 'np.random.choice', (['flatten'], ...
import os import matplotlib.pyplot as plt import numpy as np import torch from torch import nn from sanitize_data import read_from_tar, TORCH_FILENAME from weather_format import WeatherDataset, WeatherRow from model import WeatherLSTM from config import WINDOW_SIZE, DEVICE, DTYPE, TRAIN_END, VALIDATE_END, BATCH_SIZE,...
[ "matplotlib.pyplot.title", "numpy.random.seed", "matplotlib.pyplot.clf", "matplotlib.pyplot.bar", "os.path.isfile", "torch.no_grad", "matplotlib.pyplot.tight_layout", "torch.nn.MSELoss", "torch.utils.data.DataLoader", "torch.load", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "n...
[((1259, 1288), 'sanitize_data.read_from_tar', 'read_from_tar', (['TORCH_FILENAME'], {}), '(TORCH_FILENAME)\n', (1272, 1288), False, 'from sanitize_data import read_from_tar, TORCH_FILENAME\n'), ((1300, 1324), 'torch.load', 'torch.load', (['torch_binary'], {}), '(torch_binary)\n', (1310, 1324), False, 'import torch\n')...
import logging import os import pickle import numpy as np from termcolor import colored import torch from torch import nn from torch.nn import functional as F from detectron2.utils.logger import setup_logger logger = setup_logger(name=__name__) def load_semantic_embeddings(semantic_corpus, classes, precomputed_sema...
[ "numpy.stack", "pickle.dump", "torch.norm", "torch.nonzero", "torch.cat", "detectron2.utils.logger.setup_logger", "termcolor.colored", "os.path.isfile", "torch.sigmoid", "torch.clamp", "pickle.load", "torch.max", "torch.zeros", "torch.as_tensor", "torch.sum", "torch.sort" ]
[((219, 246), 'detectron2.utils.logger.setup_logger', 'setup_logger', ([], {'name': '__name__'}), '(name=__name__)\n', (231, 246), False, 'from detectron2.utils.logger import setup_logger\n'), ((691, 732), 'os.path.isfile', 'os.path.isfile', (['precomputed_semantic_embs'], {}), '(precomputed_semantic_embs)\n', (705, 73...
# Copyright 2019 <NAME> and <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
[ "src.gym.worker.worker_runner.WorkerRunner", "src.gym.worker.aurora_worker.AuroraWorker", "random.uniform", "os.path.dirname", "src.gym.worker.two_point_ogd_worker.TwoPointOGDWorker", "sys.path.insert", "matplotlib.pyplot.draw", "src.gym.simulate_network.link.Link.generate_random_link", "numpy.array...
[((763, 790), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (778, 790), False, 'import os\n'), ((804, 830), 'os.path.dirname', 'os.path.dirname', (['parentdir'], {}), '(parentdir)\n', (819, 830), False, 'import os\n'), ((831, 861), 'sys.path.insert', 'sys.path.insert', (['(0)', 'pparentd...
#!/usr/bin/env python # coding: utf-8 # # Dark matter spatial and spectral models # # ## Introduction # # Gammapy has some convenience methods for dark matter analyses in `~gammapy.astro.darkmatter`. These include J-Factor computation and calculation the expected gamma flux for a number of annihilation channels. Th...
[ "matplotlib.pyplot.loglog", "matplotlib.pyplot.title", "numpy.logspace", "gammapy.astro.darkmatter.DarkMatterAnnihilationSpectralModel", "gammapy.astro.darkmatter.PrimaryFlux", "gammapy.astro.darkmatter.profiles.NFWProfile", "matplotlib.colors.LogNorm", "matplotlib.pyplot.axvline", "gammapy.maps.Wcs...
[((1185, 1218), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1208, 1218), False, 'import warnings\n'), ((1492, 1527), 'gammapy.astro.darkmatter.profiles.DMProfile.__subclasses__', 'profiles.DMProfile.__subclasses__', ([], {}), '()\n', (1525, 1527), False, 'from gammapy....
# coding=utf-8 import itertools import numpy as np import matplotlib.pyplot as plt from ..helper_functions.helpers import is_this_saved_iteration, convert_global_to_particle_iter, colors, directions class Plot: """ A plot for visualization. Mainly an abstract class for overloading with interesting kinds of ...
[ "numpy.ones_like", "numpy.abs", "numpy.histogram", "numpy.max", "numpy.min", "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((9547, 9575), 'numpy.histogram', 'np.histogram', (['arr'], {'bins': 'bins'}), '(arr, bins=bins)\n', (9559, 9575), True, 'import numpy as np\n'), ((839, 859), 'numpy.linspace', 'np.linspace', (['(0)', 'L', '(7)'], {}), '(0, L, 7)\n', (850, 859), True, 'import numpy as np\n'), ((2385, 2424), 'numpy.ones_like', 'np.ones...
from PIL import Image import numpy as np import math def floating_point(number): temp=int(number) if number>temp: return temp+1 else : return number def mat_Multi(angle,x,y,k): tangent=math.tan(angle/2) if k==0 or k==2: X=x-y*tangent Y=y else: X=x ...
[ "numpy.zeros_like", "math.radians", "math.tan", "math.sin", "PIL.Image.open", "math.cos" ]
[((219, 238), 'math.tan', 'math.tan', (['(angle / 2)'], {}), '(angle / 2)\n', (227, 238), False, 'import math\n'), ((448, 467), 'math.radians', 'math.radians', (['angle'], {}), '(angle)\n', (460, 467), False, 'import math\n'), ((479, 494), 'math.cos', 'math.cos', (['angle'], {}), '(angle)\n', (487, 494), False, 'import...
# Copyright 2019 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "mindspore.context.set_context", "numpy.array", "mindspore.nn.MaxPool2d" ]
[((793, 858), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': '"""CPU"""'}), "(mode=context.GRAPH_MODE, device_target='CPU')\n", (812, 858), True, 'import mindspore.context as context\n'), ((1820, 1874), 'numpy.array', 'np.array', (['[[[[7, 9, -4], [19, 21, 2...
#!/usr/bin/env python # coding: utf-8 # In[1]: import tensorflow as tf import tensorflow.contrib.eager as tfe import numpy as np import pandas as pd import pickle from timeit import default_timer as timer import matplotlib.pyplot as plt import sklearn from sklearn.model_selection import train_test_split import nltk...
[ "nltk.Tree", "os.getpid", "numpy.argmax", "os.getcwd", "pandas.read_csv", "tensorflow.nn.embedding_lookup", "timeit.default_timer", "numpy.zeros", "tensorflow.contrib.eager.Variable", "tensorflow.reshape", "tensorflow.concat", "gc.collect", "tensorflow.matmul", "pickle.load", "tensorflow...
[((462, 489), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (487, 489), True, 'import tensorflow as tf\n'), ((656, 667), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (665, 667), False, 'import os\n'), ((682, 716), 'os.path.join', 'os.path.join', (['dirname', '"""datasets/"""'], {}),...
#!/usr/bin/env python3 import time import numpy as np import collections import torch import torch.nn as nn import torch.optim as optim COLAB = False CUDA = True if not COLAB: from lib import wrappers from lib import dqn_model import argparse from tensorboardX import SummaryWriter ENV_NAME = "Pong...
[ "torch.nn.MSELoss", "lib.wrappers.make_env", "tensorboardX.SummaryWriter", "argparse.ArgumentParser", "torch.ByteTensor", "torch.load", "time.time", "numpy.random.random", "numpy.array", "collections.namedtuple", "torch.max", "torch.device", "numpy.mean", "torch.tensor", "collections.deq...
[((639, 743), 'collections.namedtuple', 'collections.namedtuple', (['"""Experience"""'], {'field_names': "['state', 'action', 'reward', 'done', 'new_state']"}), "('Experience', field_names=['state', 'action',\n 'reward', 'done', 'new_state'])\n", (661, 743), False, 'import collections\n'), ((4582, 4626), 'torch.devi...
# python3 # pylint: disable=g-bad-file-header # Copyright 2019 DeepMind Technologies Limited. 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...
[ "plotnine.ylab", "bsuite.utils.plotting.plot_regret_group_nosmooth", "bsuite.utils.plotting.plot_regret_ave_scaling", "numpy.array", "bsuite.utils.plotting.plot_individual_returns" ]
[((2233, 2390), 'bsuite.utils.plotting.plot_regret_group_nosmooth', 'plotting.plot_regret_group_nosmooth', ([], {'df_in': 'df', 'group_col': 'group_col', 'sweep_vars': 'sweep_vars', 'regret_col': '"""regret_ratio"""', 'max_episode': 'sweep.NUM_EPISODES'}), "(df_in=df, group_col=group_col,\n sweep_vars=sweep_vars, re...
#%% from graph_data import graph_data import numpy as np from scipy.linalg import block_diag from typing import Final from networkx.generators.random_graphs import watts_strogatz_graph, barabasi_albert_graph from networkx.linalg.graphmatrix import adjacency_matrix class Gnp: def __init__(self, n0, p0, n1, p1): ...
[ "numpy.random.uniform", "numpy.random.binomial", "graph_data.graph_data", "numpy.multiply", "networkx.generators.random_graphs.barabasi_albert_graph", "numpy.sum", "scipy.linalg.block_diag", "numpy.ones", "numpy.any", "networkx.generators.random_graphs.watts_strogatz_graph", "numpy.argpartition"...
[((488, 518), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '[n, n]'}), '(size=[n, n])\n', (505, 518), True, 'import numpy as np\n'), ((598, 613), 'numpy.ones', 'np.ones', (['[n, 1]'], {}), '([n, 1])\n', (605, 613), True, 'import numpy as np\n'), ((625, 657), 'graph_data.graph_data', 'graph_data', (['adj',...
#!/usr/bin/python3 # -*- coding: utf-8 -*- ## Autor: <NAME> import numpy as np from vispy.scene.visuals import Line CV = np.arange(0, 2.05, 0.05, dtype=np.float32) * 3.14159 ZCV = np.zeros(CV.size, dtype=np.float32) C_xy = np.array([np.cos(CV), np.sin(CV), ZCV]).T C_xz = np.array([np.cos(CV), ZCV, np.sin(CV)]).T C_yz...
[ "numpy.abs", "numpy.zeros", "numpy.sin", "numpy.arange", "vispy.scene.visuals.Line", "numpy.cos", "numpy.random.rand", "numpy.concatenate" ]
[((182, 217), 'numpy.zeros', 'np.zeros', (['CV.size'], {'dtype': 'np.float32'}), '(CV.size, dtype=np.float32)\n', (190, 217), True, 'import numpy as np\n'), ((377, 411), 'numpy.concatenate', 'np.concatenate', (['[C_xy, C_xz, C_yz]'], {}), '([C_xy, C_xz, C_yz])\n', (391, 411), True, 'import numpy as np\n'), ((123, 165),...
''' The detection code is partially derived and modified from the object_detection_tutorial.ipynb. The original author should be honoured: "Speed/accuracy trade-offs for modern convolutional object detectors." <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, CVPR 2017 ''' from ...
[ "os.walk", "os.path.join", "sys.path.append", "os.path.abspath", "flask.redirect", "utils.label_map_util.convert_label_map_to_categories", "datetime.timedelta", "flask.render_template", "tensorflow.GraphDef", "cv2.waitKey", "utils.label_map_util.load_labelmap", "tensorflow.Session", "tensorf...
[((520, 555), 'flask.Flask', 'Flask', (['__name__'], {'template_folder': '""""""'}), "(__name__, template_folder='')\n", (525, 555), False, 'from flask import Flask, request, render_template, redirect\n'), ((629, 649), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(1)'}), '(seconds=1)\n', (638, 649), False, 'fro...
import numpy as np import cv2 import timeit import datetime import os import time import math from line import get_points #for SERVER SIDE import json import requests #convert img to JSON object import base64 import pickle #API endpoint #api = 'https://tdispeeddetection.free.beeceptor.com/success...
[ "cv2.GaussianBlur", "cv2.medianBlur", "numpy.argmax", "numpy.ones", "json.dumps", "cv2.bgsegm.createBackgroundSubtractorGMG", "pickle.load", "numpy.linalg.norm", "cv2.imencode", "cv2.rectangle", "requests.post", "cv2.minMaxLoc", "cv2.imshow", "cv2.erode", "cv2.line", "cv2.contourArea",...
[((1650, 1680), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""night1.mp4"""'], {}), "('night1.mp4')\n", (1666, 1680), False, 'import cv2\n'), ((1964, 1985), 'cv2.imread', 'cv2.imread', (['"""m1.jpeg"""'], {}), "('m1.jpeg')\n", (1974, 1985), False, 'import cv2\n'), ((1994, 2033), 'cv2.cvtColor', 'cv2.cvtColor', (['mask1...
from __future__ import division import numpy as np from .chemistry import * #==============================================================================# class Species(): """An abstract class representing a molecular species, composed of some monomer types, atoms, and bonded functionality. All concre...
[ "numpy.sum", "numpy.random.randn", "numpy.cumsum", "numpy.append", "numpy.array", "numpy.linalg.norm", "numpy.unique" ]
[((2738, 2756), 'numpy.sum', 'np.sum', (['block_lens'], {}), '(block_lens)\n', (2744, 2756), True, 'import numpy as np\n'), ((2874, 2894), 'numpy.array', 'np.array', (['block_lens'], {}), '(block_lens)\n', (2882, 2894), True, 'import numpy as np\n'), ((2920, 2960), 'numpy.array', 'np.array', (['[mon.id for mon in block...
#!/usr/bin/python # -*- coding: utf-8 -*- """ Compute an optimal storage control policy for a PV plant supposing a perfect knowledge of the future inputs. <NAME> — November 2013 """ from __future__ import division, print_function, unicode_literals import sys from datetime import datetime import numpy as np import mat...
[ "sys.path.append", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "stodynprog.SysDescription", "matplotlib.pyplot.subplots", "matplotlib.pyplot.colorbar", "numpy.ma.array", "matplotlib.pyplot.figure", "numpy.max", "numpy.arange", "numpy.load...
[((2285, 2371), 'stodynprog.SysDescription', 'SysDescription', (['(1, 1, 0)'], {'name': '"""Deterministic Storage for PV"""', 'stationnary': '(False)'}), "((1, 1, 0), name='Deterministic Storage for PV', stationnary=\n False)\n", (2299, 2371), False, 'from stodynprog import SysDescription, DPSolver\n'), ((2516, 2533...
import dgl import mxnet as mx import numpy as np import logging, time from operator import attrgetter, itemgetter from mxnet import nd, gluon from mxnet.gluon import nn from dgl.utils import toindex from dgl.nn.mxnet import GraphConv from gluoncv.model_zoo import get_model from gluoncv.data.batchify import Pad def iou...
[ "numpy.count_nonzero", "mxnet.metric.check_label_shapes", "mxnet.metric.alias", "numpy.ones", "operator.itemgetter" ]
[((1375, 1397), 'mxnet.metric.alias', 'mx.metric.alias', (['"""auc"""'], {}), "('auc')\n", (1390, 1397), True, 'import mxnet as mx\n'), ((2485, 2511), 'mxnet.metric.alias', 'mx.metric.alias', (['"""predcls"""'], {}), "('predcls')\n", (2500, 2511), True, 'import mxnet as mx\n'), ((3632, 3657), 'mxnet.metric.alias', 'mx....
import numpy as np pts = np.load('point_cloud.npy') np.savetxt('point_cloud_manual_map.txt', pts)
[ "numpy.load", "numpy.savetxt" ]
[((27, 53), 'numpy.load', 'np.load', (['"""point_cloud.npy"""'], {}), "('point_cloud.npy')\n", (34, 53), True, 'import numpy as np\n'), ((54, 99), 'numpy.savetxt', 'np.savetxt', (['"""point_cloud_manual_map.txt"""', 'pts'], {}), "('point_cloud_manual_map.txt', pts)\n", (64, 99), True, 'import numpy as np\n')]
# Question 1 import pandas as pd def read_url_and_create_csv(url_to_read): data = pd.read_csv(url_to_read) return data # Question 2 import numpy as np def same_type(data_list): is_same_type = True first_item = data_list[0] for item in data_list[1:]: if type(first_item) == type(item) or np...
[ "pandas.read_csv", "numpy.isnan" ]
[((87, 111), 'pandas.read_csv', 'pd.read_csv', (['url_to_read'], {}), '(url_to_read)\n', (98, 111), True, 'import pandas as pd\n'), ((318, 332), 'numpy.isnan', 'np.isnan', (['item'], {}), '(item)\n', (326, 332), True, 'import numpy as np\n')]
""" Library to produce specific plots using the nerscsplot library. """ from commonLib.nerscPlot import (paintHistogramMulti, paintBoxPlotGeneral, paintBarsHistogram) import getopt import matplotlib.pyplot as plt import matplotlib.patches as mpatches import sys from array import array f...
[ "matplotlib.pyplot.tight_layout", "stats.trace.ResultTrace.get_result_type_edge", "getopt.getopt", "stats.trace.ResultTrace", "stats.NumericStats", "matplotlib.pyplot.axes", "numpy.floor", "matplotlib.patches.Patch", "matplotlib.pyplot.subplots", "commonLib.nerscPlot.paintHistogramMulti", "orche...
[((1609, 1752), 'commonLib.nerscPlot.paintHistogramMulti', 'paintHistogramMulti', (['name', 'data_dic'], {'bins': '(100)', 'graphFileName': 'file_name', 'labelX': 'x_axis_label', 'xLogScale': 'x_log_scale', 'labelY': '"""Number Of Jobs"""'}), "(name, data_dic, bins=100, graphFileName=file_name,\n labelX=x_axis_label...
import collections import json import os import matplotlib.pyplot as plt import numpy as np import pandas as pd import tensorflow as tf from tqdm import tqdm import constants import helpers from models.recognition.recognizer import Recognizer from visualization.visualize import plot_3x3_images_RW def analyze(checkp...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.tight_layout", "tqdm.tqdm", "json.load", "constants.DATASET_PATH.format", "matplotlib.pyplot.show", "numpy.argmax", "helpers.transform_images", "collections.defaultdict", "visualization.visualize.plot_3x3_images_RW", "models.recognition.recognizer.Re...
[((1775, 1821), 'models.recognition.recognizer.Recognizer', 'Recognizer', (['dataset_name', 'model_img_res', '(False)'], {}), '(dataset_name, model_img_res, False)\n', (1785, 1821), False, 'from models.recognition.recognizer import Recognizer\n'), ((2362, 2385), 'os.listdir', 'os.listdir', (['images_path'], {}), '(imag...
import numpy as np import pandas as pd from sklearn.metrics import mean_squared_error from sklearn.model_selection import train_test_split from processor import data_filling, data_processing from sklearn.ensemble import RandomForestRegressor from xgboost import XGBRegressor pd.set_option('display.max_columns', None) ...
[ "sklearn.model_selection.train_test_split", "numpy.savetxt", "processor.data_processing", "xgboost.XGBRegressor", "pandas.set_option", "sklearn.metrics.mean_squared_error" ]
[((276, 318), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (289, 318), True, 'import pandas as pd\n'), ((940, 983), 'xgboost.XGBRegressor', 'XGBRegressor', ([], {'n_estimators': '(600)', 'max_depth': '(5)'}), '(n_estimators=600, max_depth=5)\n', (...
import time import numpy as np import torch from torch import nn from rl.learners.ppo import PPO class PPOTestTime(PPO): def learn_test_time(self, ne, bs, mbs): os, acts, rs, op, logpbs, _, dones = self.buf.get(self.pol.dist_stack) os, acts, rs, op, logpbs, dones = os[:bs], acts[:bs], rs[:bs], op...
[ "torch.cat", "time.time", "torch.clamp", "numpy.arange", "torch.max", "torch.no_grad", "numpy.random.shuffle" ]
[((471, 482), 'time.time', 'time.time', ([], {}), '()\n', (480, 482), False, 'import time\n'), ((627, 649), 'numpy.arange', 'np.arange', (['os.shape[0]'], {}), '(os.shape[0])\n', (636, 649), True, 'import numpy as np\n'), ((678, 689), 'time.time', 'time.time', ([], {}), '()\n', (687, 689), False, 'import time\n'), ((36...
import numpy from ._helpers import HexahedronScheme def product(scheme1d): schemes = scheme1d if isinstance(scheme1d, list) else 3 * [scheme1d] wy, wz, wx = numpy.meshgrid( schemes[0].weights, schemes[1].weights, schemes[2].weights ) weights = numpy.vstack([wx.flatten(), wy.flatten(), wz.fla...
[ "numpy.meshgrid", "numpy.prod" ]
[((169, 243), 'numpy.meshgrid', 'numpy.meshgrid', (['schemes[0].weights', 'schemes[1].weights', 'schemes[2].weights'], {}), '(schemes[0].weights, schemes[1].weights, schemes[2].weights)\n', (183, 243), False, 'import numpy\n'), ((345, 372), 'numpy.prod', 'numpy.prod', (['weights'], {'axis': '(1)'}), '(weights, axis=1)\...
#!/bin/python """This is a simple text editor""" # Import the libraries we are using. It is good practice to import all necessary # libraries in the first lines of a file. import os import sys import numpy as np import matplotlib.pyplot as plt import pandas as pd # Create a function to read the data file def read_d...
[ "matplotlib.pyplot.show", "pandas.read_csv", "matplotlib.pyplot.bar", "os.path.dirname", "numpy.genfromtxt", "numpy.append", "matplotlib.pyplot.figure", "numpy.array", "os.path.join" ]
[((582, 641), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': 'delimiter', 'skip_header': '(5)'}), '(filename, delimiter=delimiter, skip_header=5)\n', (595, 641), True, 'import numpy as np\n'), ((760, 809), 'numpy.array', 'np.array', (['all_data[starting_row:, :]'], {'dtype': 'float'}), '(all_data[sta...
import numpy as np import logbook import pandas as pd from zipline.lib.adjusted_array import AdjustedArray from zipline.pipeline.loaders.base import PipelineLoader from zipline.utils.calendars import get_calendar from zipline.errors import NoFurtherDataError from pipeline_live.data.sources import alpaca log = logbo...
[ "numpy.stack", "pandas.DataFrame", "logbook.Logger", "pandas.Timestamp.utcnow", "zipline.utils.calendars.get_calendar", "pipeline_live.data.sources.alpaca.get_stockprices" ]
[((315, 339), 'logbook.Logger', 'logbook.Logger', (['__name__'], {}), '(__name__)\n', (329, 339), False, 'import logbook\n'), ((488, 508), 'zipline.utils.calendars.get_calendar', 'get_calendar', (['"""NYSE"""'], {}), "('NYSE')\n", (500, 508), False, 'from zipline.utils.calendars import get_calendar\n'), ((1369, 1404), ...
from nose.tools import * import scipy.stats import torch import numpy as np from stable_nalu.dataset import SimpleFunctionStaticDataset def test_solveable_by_linear_algebra(): dataset = SimpleFunctionStaticDataset( operation='add', seed=0 ) dataset_test = iter(dataset.fork(input_range=1).dataloa...
[ "numpy.stack", "numpy.round", "numpy.zeros", "stable_nalu.dataset.SimpleFunctionStaticDataset" ]
[((194, 246), 'stable_nalu.dataset.SimpleFunctionStaticDataset', 'SimpleFunctionStaticDataset', ([], {'operation': '"""add"""', 'seed': '(0)'}), "(operation='add', seed=0)\n", (221, 246), False, 'from stable_nalu.dataset import SimpleFunctionStaticDataset\n'), ((400, 417), 'numpy.stack', 'np.stack', (['x_batch'], {}), ...
import re import json import os import requests import numpy as np import copy from sklearn.metrics.pairwise import cosine_similarity import spacy from collections import defaultdict from networkx import algorithms from fourlang.stanford_wrapper import StanfordParser from fourlang.fourlang import FourLang from .parse_d...
[ "copy.deepcopy", "sklearn.metrics.pairwise.cosine_similarity", "os.path.abspath", "numpy.asarray", "numpy.transpose", "json.dumps", "collections.defaultdict", "spacy.load", "networkx.algorithms.has_path", "fourlang.stanford_wrapper.StanfordParser", "networkx.algorithms.shortest_path", "re.sub"...
[((666, 709), 'spacy.load', 'spacy.load', (['self.language_models[self.lang]'], {}), '(self.language_models[self.lang])\n', (676, 709), False, 'import spacy\n'), ((741, 757), 'fourlang.stanford_wrapper.StanfordParser', 'StanfordParser', ([], {}), '()\n', (755, 757), False, 'from fourlang.stanford_wrapper import Stanfor...
""" This module contains classes that can learn the weights. """ import numpy as np class STDP: """ Spike Timing Dependent Plasticity """ def __init__(self, eta, w_in, w_out, tau, window_size, verbose=False, tau2=None): """ :param eta: learning rate :param w_in: :par...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.zeros", "numpy.array", "numpy.exp", "numpy.linspace" ]
[((5713, 5786), 'numpy.array', 'np.array', (['[[0, 0, 1, 1, 1], [0, 0, 1, 0, 0], [0, 0, 1, 0, 1]]'], {'dtype': 'bool'}), '([[0, 0, 1, 1, 1], [0, 0, 1, 0, 0], [0, 0, 1, 0, 1]], dtype=bool)\n', (5721, 5786), True, 'import numpy as np\n'), ((5832, 5888), 'numpy.array', 'np.array', (['[[0, 1, 1], [0, 0, 1], [0, 0, 0]]'], {...
###################################################### # 多个分支、远端近端、多个频率下某个分支从近端到远端的突触权值分布数据 ###################################################### from __future__ import division from brian2 import * import numpy as np import matplotlib.pyplot as plt import json import copy as cp import os, sys mod_path = os.path.ab...
[ "sys.path.append", "json.load", "oo_initScripts.set_init_nrn", "numpy.mean", "numpy.array", "oo_initScripts.set_init_syn", "os.path.join", "sys.exit" ]
[((354, 379), 'sys.path.append', 'sys.path.append', (['mod_path'], {}), '(mod_path)\n', (369, 379), False, 'import os, sys\n'), ((1191, 1207), 'json.load', 'json.load', (['data1'], {}), '(data1)\n', (1200, 1207), False, 'import json\n'), ((1218, 1234), 'json.load', 'json.load', (['data2'], {}), '(data2)\n', (1227, 1234...
#!/usr/bin/env python import rospy from std_msgs.msg import String, Header from tf2_msgs.msg import TFMessage from nav_msgs.msg import Odometry from sensor_msgs.msg import PointCloud2, Image, PointField from nav_msgs.msg import OccupancyGrid from geometry_msgs.msg import PoseStamped from actionlib_msgs.msg import Goal...
[ "rospy.Subscriber", "numpy.nan_to_num", "numpy.sum", "rospy.Time", "actionlib_msgs.msg.GoalID", "sensor_msgs.point_cloud2.read_points", "rospy.Duration", "geometry_msgs.msg.PoseStamped", "tf2_ros.TransformListener", "struct.pack", "numpy.append", "rospy.init_node", "struct.unpack", "geomet...
[((989, 1045), 'rospy.Publisher', 'rospy.Publisher', (['"""map_seen"""', 'OccupancyGrid'], {'queue_size': '(1)'}), "('map_seen', OccupancyGrid, queue_size=1)\n", (1004, 1045), False, 'import rospy\n'), ((1258, 1276), 'numpy.array', 'np.array', (['msg.data'], {}), '(msg.data)\n', (1266, 1276), True, 'import numpy as np\...
#!/usr/bin/env python """ Library module that contains functions common to all our FARM-based programs for evaluation, training, application. """ import sys import os.path import datetime from sklearn.metrics import confusion_matrix import torch import statistics import numbers import logging import time from collect...
[ "sklearn.metrics.confusion_matrix", "argparse.ArgumentParser", "torch.cuda.max_memory_allocated", "numpy.argmax", "time.strftime", "farm.infer.Inferencer.load", "collections.defaultdict", "pathlib.Path", "statistics.variance", "orderedattrdict.AttrDict", "mlflow.end_run", "torch.cuda.max_memor...
[((1369, 1382), 'farm_tools.utils.init_logger', 'init_logger', ([], {}), '()\n', (1380, 1382), False, 'from farm_tools.utils import init_logger\n'), ((1855, 1899), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal_handler'], {}), '(signal.SIGINT, signal_handler)\n', (1868, 1899), False, 'import signal\n'), (...
#!/usr/bin/python import pygame, sys, pygame.mixer, os sys.path.append('/home/pi/GitHub/T-BOTS/Python') from pygame.locals import * from time import sleep, time import bluetooth as bt from TBotTools import tbt from collections import deque import numpy as np starttime = time() # setup for plotting xdatarange = [200,32...
[ "pygame.joystick.get_count", "pygame.event.get", "pygame.draw.lines", "pygame.font.Font", "pygame.display.quit", "collections.deque", "sys.path.append", "TBotTools.tbt.bt_connect", "numpy.copy", "pygame.display.set_mode", "pygame.display.set_caption", "pygame.joystick.Joystick", "pygame.quit...
[((55, 103), 'sys.path.append', 'sys.path.append', (['"""/home/pi/GitHub/T-BOTS/Python"""'], {}), "('/home/pi/GitHub/T-BOTS/Python')\n", (70, 103), False, 'import pygame, sys, pygame.mixer, os\n'), ((271, 277), 'time.time', 'time', ([], {}), '()\n', (275, 277), False, 'from time import sleep, time\n'), ((356, 399), 'co...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- import numpy as np import argparse import cv2 ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required = True, help = "Path to the image") args = vars(ap.parse_args()) image = cv2.imread(args["image"]) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) blu...
[ "cv2.GaussianBlur", "cv2.Canny", "cv2.boundingRect", "cv2.minEnclosingCircle", "argparse.ArgumentParser", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "numpy.zeros", "cv2.imread", "cv2.drawContours", "cv2.imshow" ]
[((98, 123), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (121, 123), False, 'import argparse\n'), ((244, 269), 'cv2.imread', 'cv2.imread', (["args['image']"], {}), "(args['image'])\n", (254, 269), False, 'import cv2\n'), ((277, 316), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2...
import numpy as _np from numpy import ndarray as _ndarray def accu_len_from_origin(tile_ind:int, tile_mu:float, div_RZ:_ndarray) -> float: div_tile_len = _np.linalg.norm(div_RZ[1:]-div_RZ[:-1], axis=-1) assert(tile_ind>=0 and tile_ind<=len(div_tile_len)-1) return _np.sum(div_tile_len[:tile_ind]) + tile_mu*...
[ "numpy.zeros_like", "numpy.sum", "numpy.asarray", "numpy.argmin", "numpy.linalg.norm" ]
[((159, 209), 'numpy.linalg.norm', '_np.linalg.norm', (['(div_RZ[1:] - div_RZ[:-1])'], {'axis': '(-1)'}), '(div_RZ[1:] - div_RZ[:-1], axis=-1)\n', (174, 209), True, 'import numpy as _np\n'), ((2241, 2259), 'numpy.asarray', '_np.asarray', (['point'], {}), '(point)\n', (2252, 2259), True, 'import numpy as _np\n'), ((2692...
# This program is to create visualization of the Iris dataset # Export images of plots to png files # Author:<NAME> from statistics import stdev from isort import file from nbformat import write import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd # Read in the original iris...
[ "matplotlib.pyplot.title", "pandas.read_csv", "numpy.arange", "seaborn.relplot", "seaborn.move_legend", "seaborn.PairGrid", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "matplotlib.pyplot.xticks", "seaborn.set_context", "seaborn.set_style", "seabor...
[((360, 409), 'pandas.read_csv', 'pd.read_csv', (['"""iris_ds.data"""'], {'sep': '""","""', 'header': 'None'}), "('iris_ds.data', sep=',', header=None)\n", (371, 409), True, 'import pandas as pd\n'), ((784, 832), 'pandas.read_csv', 'pd.read_csv', (['"""iris_ds.data"""'], {'sep': '""","""', 'names': 'cols'}), "('iris_ds...
from typing import Tuple import numpy as np def camera_from_world_transform(d: float = 1.0) -> np.ndarray: """Define a transformation matrix in homogeneous coordinates that transforms coordinates from world space to camera space, according to the coordinate systems in Question 1. Args: d (f...
[ "numpy.cross", "numpy.zeros", "numpy.ones", "numpy.append", "numpy.array", "numpy.eye", "numpy.sqrt" ]
[((721, 730), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (727, 730), True, 'import numpy as np\n'), ((3143, 3154), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (3151, 3154), True, 'import numpy as np\n'), ((3327, 3355), 'numpy.cross', 'np.cross', (['line_one', 'line_two'], {}), '(line_one, line_two)\n', (3335...
import numpy as np import torch import torch.nn as nn from common.nets import LinearNet from common.modules.NoisyLinear import NoisyLinear def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1. / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class Actor(nn.Module): def __init_...
[ "common.modules.NoisyLinear.NoisyLinear", "torch.cat", "common.nets.LinearNet", "torch.Tensor", "torch.nn.Linear", "numpy.sqrt" ]
[((218, 232), 'numpy.sqrt', 'np.sqrt', (['fanin'], {}), '(fanin)\n', (225, 232), True, 'import numpy as np\n'), ((854, 973), 'common.nets.LinearNet', 'LinearNet', ([], {'layers': '([n_observation] + layers)', 'activation': 'activation', 'layer_norm': 'layer_norm', 'linear_layer': 'linear_layer'}), '(layers=[n_observati...
from pyannote.audio.pipeline.speech_turn_assignment import SpeechTurnClosestAssignment import torch import itertools import torch.nn.functional as F from pyannote.pipeline.parameter import Uniform from pyannote.core.utils.distance import cdist from pyannote.core.utils.distance import dist_range from pyannote.core.utils...
[ "pyannote.pipeline.parameter.Uniform", "pyannote.core.utils.distance.l2_normalize", "pyannote.core.utils.distance.dist_range", "pyannote.core.utils.distance.cdist", "numpy.isfinite", "torch.cat", "numpy.argsort", "pyannote.audio.pipeline.utils.assert_string_labels", "numpy.mean", "pyannote.audio.p...
[((1279, 1335), 'pyannote.core.utils.distance.dist_range', 'dist_range', ([], {'metric': 'self.metric', 'normalize': 'self.normalize'}), '(metric=self.metric, normalize=self.normalize)\n', (1289, 1335), False, 'from pyannote.core.utils.distance import dist_range\n'), ((1695, 1722), 'pyannote.pipeline.parameter.Uniform'...
import numpy as np def calculate_perplexity(log_probs): # https://web.stanford.edu/class/cs124/lec/languagemodeling.pdf perp = 0 for p in log_probs: perp += -p return np.exp(perp / len(log_probs)) def sample(a, temperature=1.0): # helper function to sample an index from a probability array...
[ "numpy.log", "numpy.random.multinomial", "os.walk", "numpy.zeros", "numpy.array", "numpy.exp", "os.path.join" ]
[((715, 749), 'numpy.array', 'np.array', (['raw_data'], {'dtype': 'np.int32'}), '(raw_data, dtype=np.int32)\n', (723, 749), True, 'import numpy as np\n'), ((829, 878), 'numpy.zeros', 'np.zeros', (['[batch_size, batch_len]'], {'dtype': 'np.int32'}), '([batch_size, batch_len], dtype=np.int32)\n', (837, 878), True, 'impor...
import numpy as np from SoftThreshold import soft_threshold def shrunken_centroids_fit(model, X_train, y_train, _lambda): """对收缩质心模型进行训练 关于该模型训练的详细原理可参考书籍 《The Elements of Statistical Learning》(ESL)2nd editor,section 18.2 Input: model: DiscrimModel实例 Xtrain: 设计矩阵, shape=(n_samples, dim) ...
[ "numpy.sum", "numpy.true_divide", "numpy.median", "numpy.empty", "numpy.power", "numpy.zeros", "SoftThreshold.soft_threshold", "numpy.mean", "numpy.array", "numpy.unique" ]
[((432, 449), 'numpy.array', 'np.array', (['X_train'], {}), '(X_train)\n', (440, 449), True, 'import numpy as np\n'), ((494, 511), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (502, 511), True, 'import numpy as np\n'), ((649, 671), 'numpy.empty', 'np.empty', (['(n_classes,)'], {}), '((n_classes,))\n', (...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ PyAMG: Algebraic Multigrid Solvers in Python PyAMG is a library of Algebraic Multigrid (AMG) solvers with a convenient Python interface. PyAMG features implementations of: - Ruge-Stuben (RS) or Classical AMG - AMG based on Smoothed Aggregation (SA) - Adaptive Smoothe...
[ "tempfile.NamedTemporaryFile", "subprocess.Popen", "pybind11.get_include", "os.path.dirname", "os.path.exists", "setuptools.command.build_ext.build_ext.finalize_options", "pytest.main", "os.environ.get", "imp.load_source", "setuptools.command.test.test.finalize_options", "numpy.get_include", "...
[((1906, 1928), 'os.path.exists', 'os.path.exists', (['""".git"""'], {}), "('.git')\n", (1920, 1928), False, 'import os\n'), ((1976, 2010), 'os.path.exists', 'os.path.exists', (['"""pyamg/version.py"""'], {}), "('pyamg/version.py')\n", (1990, 2010), False, 'import os\n'), ((3476, 3510), 'setuptools.command.test.test.fi...
import os import argparse import torch import torchvision.transforms as transforms import torch.nn.functional as F import torch.utils.data as data from PIL import Image import cv2 import numpy as np from glob import glob import random import sys sys.path.append(".") from utils import default_loader_img, de...
[ "sys.path.append", "random.randint", "torchvision.transforms.RandomHorizontalFlip", "torch.utils.data.DataLoader", "utils.default_loader_img", "utils.default_loader_wf", "os.path.exists", "random.random", "numpy.random.randint", "random.seed", "torchvision.transforms.Normalize", "torchvision.t...
[((258, 278), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (273, 278), False, 'import sys\n'), ((2018, 2043), 'numpy.random.randint', 'np.random.randint', (['(123321)'], {}), '(123321)\n', (2035, 2043), True, 'import numpy as np\n'), ((2049, 2066), 'random.seed', 'random.seed', (['seed'], {}), '(...
import numpy as np import matplotlib.pyplot as plt Ts = np.arange(1.0,4.1,0.1) entropies20 = np.loadtxt('entropies20.txt') free20 = np.loadtxt('freeenergies20.txt') energies20 = np.loadtxt('energies20.txt') varenergies20 = np.loadtxt('varenergies20.txt') n = len(Ts) entropy = np.zeros(n) free = np.zeros(n) energy ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.arange", "numpy.loadtxt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((57, 81), 'numpy.arange', 'np.arange', (['(1.0)', '(4.1)', '(0.1)'], {}), '(1.0, 4.1, 0.1)\n', (66, 81), True, 'import numpy as np\n'), ((96, 125), 'numpy.loadtxt', 'np.loadtxt', (['"""entropies20.txt"""'], {}), "('entropies20.txt')\n", (106, 125), True, 'import numpy as np\n'), ((135, 167), 'numpy.loadtxt', 'np.load...
import os import json import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm def compute_iou(box_1, box_2): ''' This function takes a pair of bounding boxes and returns intersection-over- union (IoU) of two bounding boxes. ''' # Get coordinates of intersecting box tli_row = m...
[ "tqdm.tqdm", "json.load", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.sort", "matplotlib.pyplot.figure", "numpy.random.choice", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join", "matplotlib.pyplot.savefig" ]
[((3893, 3931), 'numpy.random.choice', 'np.random.choice', (['confidence_thrs', '(100)'], {}), '(confidence_thrs, 100)\n', (3909, 3931), True, 'import numpy as np\n'), ((3950, 3974), 'numpy.sort', 'np.sort', (['confidence_thrs'], {}), '(confidence_thrs)\n', (3957, 3974), True, 'import numpy as np\n'), ((3994, 4011), 't...
# # Copyright 2019 Xilinx Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
[ "torch.nn.Parameter", "torch.nn.init._calculate_fan_in_and_fan_out", "torch.from_numpy", "math.sqrt", "torch.sqrt", "torch.nn.init.uniform_", "torch.nn.functional.conv2d", "torch.nn.init.zeros_", "torch.nn.BatchNorm2d", "torch.Tensor", "torch.rsqrt", "torch.no_grad", "numpy.sqrt", "torch.n...
[((2010, 2180), 'torch.nn.modules.conv._ConvNd.__init__', 'nn.modules.conv._ConvNd.__init__', (['self', 'in_channels', 'out_channels', 'kernel_size', 'stride', 'padding', 'dilation', 'transposed', 'output_padding', 'groups', '(False)', 'padding_mode'], {}), '(self, in_channels, out_channels,\n kernel_size, stride, p...
#!/bin/sh """ Pipeline to prepare data from new patients : 1) smoothed data 2) combat normalise ( ! make sure your combat parameters & info dict are updated) 3) inter & intra normalisation """ # Import packages import os import argparse import pandas as pd import numpy as np from meld_classifier.meld_cohort import...
[ "pandas.DataFrame", "argparse.ArgumentParser", "meld_classifier.meld_cohort.MeldCohort", "numpy.loadtxt", "meld_classifier.data_preprocessing.Preprocess", "meld_classifier.data_preprocessing.Feature", "os.path.join" ]
[((580, 594), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (592, 594), True, 'import pandas as pd\n'), ((831, 901), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""data-processing on new subject """'}), "(description='data-processing on new subject ')\n", (854, 901), False, 'impo...
""" Main lib for project_watson Project """ import multiprocessing import time import warnings from tempfile import mkdtemp import joblib import mlflow import pandas as pd import numpy as np import sys from project_watson.data import get_data, get_snli from project_watson.params import MLFLOW_URI from project_watso...
[ "sklearn.model_selection.train_test_split", "project_watson.data.get_data", "sys.exc_info", "numpy.argmax" ]
[((4590, 4600), 'project_watson.data.get_data', 'get_data', ([], {}), '()\n', (4598, 4600), False, 'from project_watson.data import get_data, get_snli\n'), ((4716, 4770), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.3)', 'random_state': '(42)'}), '(X, y, test_size=0.3, ...
# # Copyright (C) 2019-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # This file is based in part on deepspeech_openvino_0.5.py by <NAME> at # https://github.com/openvinotoolkit/open_model_zoo/pull/419, commit 529805d011d9b405f142b2b40f4d202bd403a4f1 on Sep 19, 2019. # from copy import deepcopy import...
[ "copy.deepcopy", "numpy.lib.stride_tricks.as_strided", "numpy.zeros" ]
[((898, 915), 'copy.deepcopy', 'deepcopy', (['profile'], {}), '(profile)\n', (906, 915), False, 'from copy import deepcopy\n'), ((2896, 3121), 'numpy.lib.stride_tricks.as_strided', 'np.lib.stride_tricks.as_strided', (['mfcc_features', "(self._block_len, self._context_len + 1, self.p['num_mfcc_dct_coefs'])", '(mfcc_feat...
from Arch1 import Arch1CNN from Arch2 import Arch2CNN import torch import numpy as np import torchvision from torchvision import models, transforms import torch.nn as nn from torch.utils.data.sampler import SubsetRandomSampler from torch.utils.data import Dataset,DataLoader from xray_dataloader_zscored import ChestXray...
[ "torch.utils.data.sampler.SubsetRandomSampler", "torch.utils.data.DataLoader", "torch.load", "numpy.savetxt", "numpy.zeros", "numpy.setdiff1d", "torchvision.transforms.ToTensor", "xray_dataloader_zscored.ChestXrayDataset", "numpy.where", "torch.cuda.is_available", "numpy.loadtxt", "torch.devic...
[((583, 593), 'Arch1.Arch1CNN', 'Arch1CNN', ([], {}), '()\n', (591, 593), False, 'from Arch1 import Arch1CNN\n'), ((607, 617), 'Arch2.Arch2CNN', 'Arch2CNN', ([], {}), '()\n', (615, 617), False, 'from Arch2 import Arch2CNN\n'), ((782, 807), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (805, 80...
import numpy import collections import torch Transition = collections.namedtuple("Transition", ("observation", "q_values", "action", "reward", "done")) class Buffer(): def __init__(self, size, gamma, steps, observation_shape, actions_count): self.size = size self.gamma = gamma self.s...
[ "numpy.zeros", "numpy.max", "collections.namedtuple", "torch.zeros", "torch.from_numpy" ]
[((60, 157), 'collections.namedtuple', 'collections.namedtuple', (['"""Transition"""', "('observation', 'q_values', 'action', 'reward', 'done')"], {}), "('Transition', ('observation', 'q_values', 'action',\n 'reward', 'done'))\n", (82, 157), False, 'import collections\n'), ((575, 610), 'numpy.zeros', 'numpy.zeros', ...
# -*- coding: utf-8 -*- """NNratio_1D.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/13zC6nTSvjEFa_-FFy6-Rpy5zH8bUUlMJ """ from __future__ import print_function from __future__ import division import keras import os from keras.models import Sequ...
[ "keras.regularizers.l2", "numpy.load", "numpy.sum", "numpy.vectorize", "keras.backend.reshape", "keras.backend.exp", "numpy.asarray", "numpy.zeros", "numpy.ones", "keras.backend.sum", "numpy.append", "numpy.histogram", "numpy.cumsum", "numpy.random.poisson", "numpy.column_stack", "kera...
[((3180, 3211), 'numpy.load', 'np.load', (['"""Sample200k_2k_R1.npz"""'], {}), "('Sample200k_2k_R1.npz')\n", (3187, 3211), True, 'import numpy as np\n'), ((3588, 3638), 'numpy.histogram', 'np.histogram', (['Ref_sample'], {'bins': 'Nbins', 'range': '(0, 1)'}), '(Ref_sample, bins=Nbins, range=(0, 1))\n', (3600, 3638), Tr...
import pytest import numpy as np @pytest.fixture def color_values(): N = 16384 a = np.zeros((N,3), dtype=float) for i in range(3): a[:,i] = np.roll(np.linspace(0., 1., N), i) return a
[ "numpy.zeros", "numpy.linspace" ]
[((92, 121), 'numpy.zeros', 'np.zeros', (['(N, 3)'], {'dtype': 'float'}), '((N, 3), dtype=float)\n', (100, 121), True, 'import numpy as np\n'), ((169, 193), 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.0)', 'N'], {}), '(0.0, 1.0, N)\n', (180, 193), True, 'import numpy as np\n')]
import numpy as np from copy import deepcopy class Position(object): """ Position Simple type for 4D space-time vector manipulation. The dimension order in the vector is (t,x,y,z). Access to dimensions should be only through the __getattr__ and __setattr__ methods. For example to set the x d...
[ "numpy.array_equal", "numpy.dot", "copy.deepcopy", "numpy.array" ]
[((4230, 4267), 'numpy.array_equal', 'np.array_equal', (['self.data', 'other.data'], {}), '(self.data, other.data)\n', (4244, 4267), True, 'import numpy as np\n'), ((5660, 5674), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (5668, 5674), False, 'from copy import deepcopy\n'), ((4023, 4052), 'numpy.dot', 'np...
import sys import numpy as np import cv2 REMAP_INTERPOLATION = cv2.INTER_LINEAR DEPTH_VISUALIZATION_SCALE = 2048 if len(sys.argv) != 2: print("Syntax: {0} CALIBRATION_FILE".format(sys.argv[0])) sys.exit(1) calibration = np.load(sys.argv[1], allow_pickle=False) imageSize = tuple(calibration["ima...
[ "cv2.StereoBM_create", "numpy.load", "cv2.VideoWriter_fourcc", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.remap", "cv2.VideoCapture", "cv2.destroyAllWindows", "sys.exit" ]
[((244, 284), 'numpy.load', 'np.load', (['sys.argv[1]'], {'allow_pickle': '(False)'}), '(sys.argv[1], allow_pickle=False)\n', (251, 284), True, 'import numpy as np\n'), ((653, 672), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (669, 672), False, 'import cv2\n'), ((682, 701), 'cv2.VideoCapture', 'cv2....
import re import torch import itertools import numpy as np import pandas as pd import pytorch_lightning as pl from torch.utils.data import DataLoader, Dataset from typing import Callable, Tuple, List, Iterable, Dict, Union, Optional, Iterable from collections import OrderedDict from pathlib import Path from tqdm import...
[ "tqdm.tqdm", "numpy.ceil", "torch.utils.data.DataLoader", "torch.stack", "src.dl.utils.tensor_to_ndarray", "src.utils.label_sem_map", "torch.load", "src.patching.TilerStitcherTorch", "pathlib.Path", "re.findall", "src.metrics.Benchmarker", "torch.cuda.is_available", "itertools.islice", "to...
[((2724, 2741), 'pathlib.Path', 'Path', (['folder_path'], {}), '(folder_path)\n', (2728, 2741), False, 'from pathlib import Path\n'), ((4264, 4300), 're.findall', 're.findall', (['"""(x-\\\\d+_y-\\\\d+)"""', 'fname'], {}), "('(x-\\\\d+_y-\\\\d+)', fname)\n", (4274, 4300), False, 'import re\n'), ((4481, 4517), 're.finda...
""" Unit tests for Fourier transform processors """ import logging import unittest from functools import partial import numpy from astropy import units as u from astropy.coordinates import SkyCoord from astropy.wcs.utils import pixel_to_skycoord from arl.data.polarisation import PolarisationFrame from arl.image.ope...
[ "arl.image.operations.export_image_to_fits", "numpy.abs", "arl.visibility.base.create_visibility", "arl.skycomponent.operations.insert_skycomponent", "arl.imaging.invert_2d", "arl.data.polarisation.PolarisationFrame", "astropy.wcs.utils.pixel_to_skycoord", "unittest.main", "arl.imaging.weighting.wei...
[((1186, 1213), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1203, 1213), False, 'import logging\n'), ((17796, 17811), 'unittest.main', 'unittest.main', ([], {}), '()\n', (17809, 17811), False, 'import unittest\n'), ((1422, 1457), 'arl.image.operations.create_empty_image_like', 'create...
from abc import ABC, abstractmethod import numpy as np from enum import Enum from learning.normalizer import Normalizer class Env(ABC): class Terminate(Enum): Null = 0 Fail = 1 Succ = 2 def __init__(self, args, enable_draw): self.enable_draw = enable_draw return @a...
[ "numpy.zeros", "numpy.ones" ]
[((2222, 2242), 'numpy.zeros', 'np.zeros', (['state_size'], {}), '(state_size)\n', (2230, 2242), True, 'import numpy as np\n'), ((2353, 2372), 'numpy.ones', 'np.ones', (['state_size'], {}), '(state_size)\n', (2360, 2372), True, 'import numpy as np\n'), ((2481, 2500), 'numpy.zeros', 'np.zeros', (['goal_size'], {}), '(go...
import numpy as np from pettingzoo.mappo_ssd import escalation_gw_v1 def main(): env = escalation_gw_v1.parallel_env(max_frames=20, share_reward=False, shape_reward=False, shape_beta=0.8) obs = env.reset()[0] obs = np.array([obs]) print(obs) print(env.env.obs_to_all_symmetries_agent(obs, 0)) ...
[ "pettingzoo.mappo_ssd.escalation_gw_v1.parallel_env", "numpy.array" ]
[((94, 198), 'pettingzoo.mappo_ssd.escalation_gw_v1.parallel_env', 'escalation_gw_v1.parallel_env', ([], {'max_frames': '(20)', 'share_reward': '(False)', 'shape_reward': '(False)', 'shape_beta': '(0.8)'}), '(max_frames=20, share_reward=False,\n shape_reward=False, shape_beta=0.8)\n', (123, 198), False, 'from pettin...
import os import glob import pandas as pd import numpy as np from chainercv.transforms import resize from chainercv.utils import read_image,write_image import pydicom as dicom import argparse def img2var(self,img): # cut off mask [-1,1] or [0,1] output return(2*(np.clip(img,-1024,1024)+1024)/2048-1.0) parse...
[ "argparse.ArgumentParser", "pydicom.read_file", "os.path.basename", "chainercv.utils.read_image", "os.path.dirname", "numpy.clip", "os.path.splitext", "numpy.random.poisson", "os.path.join" ]
[((324, 396), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""chainer implementation of pix2pix"""'}), "(description='chainer implementation of pix2pix')\n", (347, 396), False, 'import argparse\n'), ((755, 787), 'os.path.join', 'os.path.join', (['args.out', '"""trainA"""'], {}), "(args.ou...
import numpy as np from pycocotools.coco import COCO import json from .custom import CustomDataset #DATASET = 'DB_4LESIONS' #DATASET = 'ROP_9LESIONS' DATASET = 'DB_7LESIONS' pseudo_threds = 0.0 def xyxy2xywh(bbox): _bbox = bbox.tolist() return [ _bbox[0], _bbox[1], _bbox[2] - _bbox[0]...
[ "numpy.minimum", "numpy.maximum", "numpy.zeros", "pycocotools.coco.COCO", "numpy.where", "numpy.array" ]
[((859, 891), 'numpy.maximum', 'np.maximum', (['x1[i]', 'x1[order[1:]]'], {}), '(x1[i], x1[order[1:]])\n', (869, 891), True, 'import numpy as np\n'), ((908, 940), 'numpy.maximum', 'np.maximum', (['y1[i]', 'y1[order[1:]]'], {}), '(y1[i], y1[order[1:]])\n', (918, 940), True, 'import numpy as np\n'), ((957, 989), 'numpy.m...
import numpy as np import random from ConceptSet import getConceptSet from sklearn import metrics def kMedoids(D, k=6, maxItr=100): DM=np.array(D) n = DM.shape[0] if k > n: raise Exception('K>N') random.seed(123) M = np.array(list(range(n))) np.random.shuffle(M) M = np.sort(M[:k]) Mnew = np.copy(M) C = {}...
[ "numpy.copy", "ConceptSet.getConceptSet", "numpy.ix_", "numpy.argmin", "numpy.sort", "numpy.where", "random.seed", "numpy.array", "numpy.array_equal", "numpy.random.shuffle" ]
[((138, 149), 'numpy.array', 'np.array', (['D'], {}), '(D)\n', (146, 149), True, 'import numpy as np\n'), ((204, 220), 'random.seed', 'random.seed', (['(123)'], {}), '(123)\n', (215, 220), False, 'import random\n'), ((252, 272), 'numpy.random.shuffle', 'np.random.shuffle', (['M'], {}), '(M)\n', (269, 272), True, 'impor...
import numpy as np from scipy.optimize import _lbfgsb def objfun(x): """simplified objective func to test lbfgsb bound violation""" x0 = [0.8750000000000278, 0.7500000000000153, 0.9499999999999722, 0.8214285714285992, 0.6363636363636085] x1 = [1.0, 0.0, 1.0, 0.0, 0....
[ "numpy.full", "scipy.optimize._lbfgsb.setulb", "numpy.copy", "numpy.allclose", "numpy.zeros", "numpy.ones", "numpy.array" ]
[((657, 771), 'numpy.array', 'np.array', (['[-0.5934820547965749, 1.6251549718258351, -71.99168459202559, \n 5.346636965797545, 37.10732723092604]'], {}), '([-0.5934820547965749, 1.6251549718258351, -71.99168459202559, \n 5.346636965797545, 37.10732723092604])\n', (665, 771), True, 'import numpy as np\n'), ((852,...
""" Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University. All rights reserved. Description : A package wihch provides tools for generating pixel-level thermal maps that can be used as states in reinforcement learning for autonomous vehicle. Author:<NAME> """ import numpy as np from msgs...
[ "obj_state.road_obj.road_obj", "situation_assessment._assess_one_obj_safety", "math.sqrt", "numpy.zeros", "math.sin", "math.acos", "numpy.array", "math.cos", "msgs.log.logger.error", "obj_state.ego_vehicle.ego_vehicle", "kp2hm_utils.heat_map" ]
[((1026, 1096), 'numpy.zeros', 'np.zeros', ([], {'shape': '(heat_map_size[0], heat_map_size[1])', 'dtype': 'np.float32'}), '(shape=(heat_map_size[0], heat_map_size[1]), dtype=np.float32)\n', (1034, 1096), True, 'import numpy as np\n'), ((2332, 2402), 'numpy.zeros', 'np.zeros', ([], {'shape': '(heat_map_size[0], heat_ma...
# Copyright 2016-2019 <NAME> <<EMAIL>> # Copyright 2013 <NAME> <<EMAIL>> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THIS SOFTWARE IS PROVIDED...
[ "os.path.abspath", "urllib.request.pathname2url", "lilv.Instance", "numpy.zeros", "lilv.World", "sys.stderr.write" ]
[((852, 905), 'os.path.abspath', 'os.path.abspath', (['"""bindings/bindings_test_plugin.lv2/"""'], {}), "('bindings/bindings_test_plugin.lv2/')\n", (867, 905), False, 'import os\n'), ((1327, 1339), 'lilv.World', 'lilv.World', ([], {}), '()\n', (1337, 1339), False, 'import lilv\n'), ((2718, 2730), 'lilv.World', 'lilv.Wo...
# fitsviewer.py # Server side of fits viewer client in browser # Copyright 2014 by <NAME> # License: GPLv3 from __future__ import division,print_function from random import * import os import math import astropy.io.fits as pyfits import numpy as np import copy import astropy.wcs as pywcs import hashlib # astropyp mod...
[ "os.remove", "numpy.amin", "os.walk", "numpy.ones", "os.path.isfile", "astropyp.utils.core.progress_log", "os.path.join", "numpy.linspace", "copy.deepcopy", "math.ceil", "astropyp.utils.core.AstropypError", "astropyp.utils.core.check4key", "os.makedirs", "os.path.isdir", "astropyp.utils....
[((828, 928), 'os.path.join', 'os.path.join', (["core.active_users[id['userId']].stored_dirs['session'][id['sessionId']]", 'hash_dir'], {}), "(core.active_users[id['userId']].stored_dirs['session'][id[\n 'sessionId']], hash_dir)\n", (840, 928), False, 'import os\n'), ((934, 974), 'os.path.relpath', 'os.path.relpath'...
import numpy as np from scipy.constants import gravitational_constant as G from scipy.integrate import odeint import matplotlib.pyplot as plt M = 5.975e24 # [kg] R = 6.378e6 # [m] v0 = np.sqrt(2*G*M/R) # [m/s] T = 10000.0 # [s] steps = 1000 t = np.linspace(0.0, T, steps) def rhs(y, t): x, v = y[:2], y[2:] a ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "scipy.integrate.odeint", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.sin", "numpy.linalg.norm", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.sqrt" ]
[((186, 208), 'numpy.sqrt', 'np.sqrt', (['(2 * G * M / R)'], {}), '(2 * G * M / R)\n', (193, 208), True, 'import numpy as np\n'), ((247, 273), 'numpy.linspace', 'np.linspace', (['(0.0)', 'T', 'steps'], {}), '(0.0, T, steps)\n', (258, 273), True, 'import numpy as np\n'), ((420, 451), 'numpy.linspace', 'np.linspace', (['...