code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from scope2screen.server.models import data_model
import numpy as np
import scipy.misc as sp
import time
import tifffile as tf
import re
import zarr
import sys
from skimage import data, transform
from skimage.util import img_as_ubyte
from skimage.morphology import disk
from skimage.filters import rank
from skimage.io ... | [
"numpy.pad",
"scope2screen.server.models.data_model.get_channel_names",
"numpy.sum",
"numpy.random.randn",
"skimage.util.img_as_ubyte",
"cv2.imwrite",
"skimage.filters.rank.windowed_histogram",
"time.perf_counter",
"time.sleep",
"skimage.measure.label",
"numpy.array",
"skimage.measure.find_con... | [((662, 681), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (679, 681), False, 'import time\n'), ((1188, 1207), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1205, 1207), False, 'import time\n'), ((3150, 3169), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (3167, 3169), False,... |
# ----------------------------------------------------------------------------
# Copyright (c) 2018--, empress development team.
#
# Distributed under the terms of the Modified BSD License.
#
# ----------------------------------------------------------------------------
import unittest
import numpy as np
import pandas ... | [
"unittest.main",
"skbio.TreeNode.read",
"pandas.DataFrame",
"numpy.random.seed",
"pandas.util.testing.assert_frame_equal",
"numpy.abs",
"empress.tree.Tree.from_tree",
"numpy.random.rand",
"skbio.TreeNode.from_linkage_matrix"
] | [((13016, 13031), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13029, 13031), False, 'import unittest\n'), ((619, 636), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (633, 636), True, 'import numpy as np\n'), ((649, 667), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (663, 66... |
from dataloader.paths import PathsDataset
from dataloader import indoor_scenes
from active_selection.vote_entropy import VoteEntropySelector
from utils.misc import turn_on_dropout, visualize_entropy, visualize_spx_dataset
import constants
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
import... | [
"tqdm.tqdm",
"dataloader.indoor_scenes.IndoorScenesWithAllInfo",
"numpy.zeros",
"active_selection.vote_entropy.VoteEntropySelector",
"torch.cuda.FloatTensor",
"dataloader.indoor_scenes.IndoorScenesWithAllInfo.get_scene_id_from_image_path",
"collections.defaultdict",
"collections.OrderedDict",
"datal... | [((824, 901), 'active_selection.vote_entropy.VoteEntropySelector', 'VoteEntropySelector', (['dataset', 'lmdb_handle', 'base_size', 'batch_size', 'num_classes'], {}), '(dataset, lmdb_handle, base_size, batch_size, num_classes)\n', (843, 901), False, 'from active_selection.vote_entropy import VoteEntropySelector\n'), ((1... |
"""This file contains methods for creating and updating cluster graphs (NOT a class) using networkx library
"""
import networkx as nx
import numpy as np
import copy
from statistics import mean, stdev
def create_cg(edge_dist_array):
"""
Given an edge distance array, returns a new cluster graph
:param edge... | [
"copy.deepcopy",
"numpy.asarray",
"statistics.stdev",
"networkx.Graph",
"statistics.mean",
"numpy.concatenate"
] | [((432, 442), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (440, 442), True, 'import networkx as nx\n'), ((1721, 1737), 'statistics.mean', 'mean', (['dist[:, 2]'], {}), '(dist[:, 2])\n', (1725, 1737), False, 'from statistics import mean, stdev\n'), ((2225, 2252), 'numpy.asarray', 'np.asarray', (['edge_dist_array'], ... |
# -*- coding: utf-8 -*-
"""
usage: change your own data dir and it works
"""
import numpy as np
import os
from collections import namedtuple
from PIL import Image
import cv2
import matplotlib.pylab as plt
import codecs
Img_dataset_dir = './intermediate_file/padding_images_to_detection/'
Label_dataset_dir = './interme... | [
"numpy.fromfile",
"cv2.transpose",
"collections.namedtuple",
"PIL.Image.fromarray",
"cv2.flip",
"os.path.join",
"os.listdir"
] | [((435, 464), 'os.listdir', 'os.listdir', (['Label_dataset_dir'], {}), '(Label_dataset_dir)\n', (445, 464), False, 'import os\n'), ((607, 653), 'os.path.join', 'os.path.join', (['Label_dataset_dir', 'Label_list[i]'], {}), '(Label_dataset_dir, Label_list[i])\n', (619, 653), False, 'import os\n'), ((910, 979), 'collectio... |
class Resampler:
def __init__(self, *args):
# Choose histogram size according to bin edges
# Take under/overflow into account for dependent variables only
edges = []
for arg in args[:-1]:
edges.append(np.append(np.append([-np.inf], arg), [np.inf]))
edges.append(a... | [
"numpy.sum",
"numpy.histogramdd",
"numpy.searchsorted",
"numpy.append",
"numpy.array",
"numpy.random.choice"
] | [((545, 563), 'numpy.array', 'np.array', (['features'], {}), '(features)\n', (553, 563), True, 'import numpy as np\n'), ((581, 641), 'numpy.histogramdd', 'np.histogramdd', (['features.T'], {'bins': 'self.edges', 'weights': 'weights'}), '(features.T, bins=self.edges, weights=weights)\n', (595, 641), True, 'import numpy ... |
import numpy as np
EPSILON = 1E-10
def calc_contrast(brighter, darker, method='weber', mode='elementwise'):
"""
Contrast metric calculation. Now supports Weber and Michelson metric.
:param brighter: ndarray of the brighter RoI
:param darker: ndarray of the darker RoI
:param method: contrast metri... | [
"numpy.random.choice"
] | [((858, 902), 'numpy.random.choice', 'np.random.choice', (['brighter'], {'size': 'length_diff'}), '(brighter, size=length_diff)\n', (874, 902), True, 'import numpy as np\n'), ((965, 1007), 'numpy.random.choice', 'np.random.choice', (['darker'], {'size': 'length_diff'}), '(darker, size=length_diff)\n', (981, 1007), True... |
# -*- coding: utf-8 -*-
"""
Created on Wed 01 Sept 2021
@author: <NAME>
CentraleSupelec
MICS laboratory
9 rue Juliot Curie, Gif-Sur-Yvette, 91190 France
Build the Multi-Layer Classifier netowrk.
"""
import torch
import torch.nn as nn
from collections import OrderedDict
from customics.tools import FullyCo... | [
"sklearn.metrics.confusion_matrix",
"matplotlib.pyplot.savefig",
"customics.loss.classification_loss",
"torch.nn.Sequential",
"matplotlib.pyplot.clf",
"sklearn.metrics.accuracy_score",
"numpy.unique",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_s... | [((3568, 3633), 'sklearn.metrics.roc_auc_score', 'roc_auc_score', (['y_true', 'y_pred'], {'average': 'average', 'multi_class': '"""ovo"""'}), "(y_true, y_pred, average=average, multi_class='ovo')\n", (3581, 3633), False, 'from sklearn.metrics import roc_auc_score\n'), ((3798, 3836), 'sklearn.metrics.accuracy_score', 'm... |
# a:截取72个算式
import sys,os
sys.path.append(os.path.dirname(__file__) + os.sep + '../')
import time
import numpy as np
import cv2
import config.config as config
from utils import get_perspective_transform
points = config.POS
# 600:900
# 4*18
# 150:50
def get_equation(img, num=0):
while num < 72: #18*4
pos... | [
"json.load",
"cv2.waitKey",
"os.path.dirname",
"utils.get_perspective_transform",
"time.time",
"cv2.VideoCapture",
"numpy.rot90",
"numpy.array",
"cv2.imshow",
"cv2.namedWindow",
"cv2.undistort"
] | [((511, 530), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (527, 530), False, 'import cv2\n'), ((743, 766), 'numpy.array', 'np.array', (["temp_d['mtx']"], {}), "(temp_d['mtx'])\n", (751, 766), True, 'import numpy as np\n'), ((781, 805), 'numpy.array', 'np.array', (["temp_d['dist']"], {}), "(temp_d['d... |
# An attempt to replicate http://www.nature.com/nature/journal/v518/n7540/full/nature14236.html
# (You can download it from Scihub)
from __future__ import print_function, division
import tensorflow as tf
import numpy as np
import gym
from collections import namedtuple
import random
import os
import h5py
from itertools... | [
"tensorflow.scalar_summary",
"os.remove",
"tensorflow.reduce_sum",
"tensorflow.image.rgb_to_grayscale",
"tensorflow.maximum",
"tensorflow.contrib.layers.flatten",
"numpy.empty",
"tensorflow.reduce_all",
"tensorflow.merge_all_summaries",
"tensorflow.reshape",
"tensorflow.train.RMSPropOptimizer",
... | [((1587, 1631), 'collections.namedtuple', 'namedtuple', (['"""QNetwork"""', '"""frames qvals vlist"""'], {}), "('QNetwork', 'frames qvals vlist')\n", (1597, 1631), False, 'from collections import namedtuple\n'), ((1645, 1705), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', '"""begin action reward termina... |
import tensorflow as tf
import numpy as np
from tensorflow.python.eager.backprop import GradientTape
d = np.array([0.00002, 0.00001])
L = np.array([1.326, 1.316])
x500: np.array = np.array(
[[-4.2, 4.3],
[-8.4, 8.5],
[-12.1, 12.3]]
)
x1000: np.array = np.array(
[[-8.5, 8.5],
[-17... | [
"numpy.full",
"tensorflow.abs",
"numpy.abs",
"tensorflow.convert_to_tensor",
"tensorflow.reduce_mean",
"numpy.array",
"tensorflow.sqrt",
"tensorflow.GradientTape",
"numpy.concatenate",
"numpy.sqrt"
] | [((110, 134), 'numpy.array', 'np.array', (['[2e-05, 1e-05]'], {}), '([2e-05, 1e-05])\n', (118, 134), True, 'import numpy as np\n'), ((144, 168), 'numpy.array', 'np.array', (['[1.326, 1.316]'], {}), '([1.326, 1.316])\n', (152, 168), True, 'import numpy as np\n'), ((189, 240), 'numpy.array', 'np.array', (['[[-4.2, 4.3], ... |
from matplotlib import pyplot as plt
from numpy import array, zeros, amax, amin
from matplotlib.ticker import MultipleLocator, AutoMinorLocator
def cm_to_inch(val:float):
return val * 0.393700787
def plot_SP_data(model, overlay=False):
t = []
SP = []
A = []
with open("C:\\Users\\luukv\\Documents\\... | [
"matplotlib.pyplot.margins",
"numpy.array",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.subplots"
] | [((2518, 2551), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {'figsize': '(8, 3.5)'}), '(2, figsize=(8, 3.5))\n', (2530, 2551), True, 'from matplotlib import pyplot as plt\n'), ((4334, 4409), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'top': '(1)', 'bottom': '(0)', 'right': '(1)', 'lef... |
# Importing Package(s)
import cv2
import numpy as np
print('Package(s) Imported')
# Basic Functions
img = cv2.imread('Resources/me.jpg')
kernel = np.ones((5,5), np.uint8)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Gray Scaled Image
imgBlur = cv2.GaussianBlur(imgGray, (7,7), 0) # Blurred Image, (7,7) - Kern... | [
"cv2.GaussianBlur",
"cv2.Canny",
"cv2.dilate",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.ones",
"cv2.imread",
"cv2.erode",
"cv2.imshow"
] | [((107, 137), 'cv2.imread', 'cv2.imread', (['"""Resources/me.jpg"""'], {}), "('Resources/me.jpg')\n", (117, 137), False, 'import cv2\n'), ((147, 172), 'numpy.ones', 'np.ones', (['(5, 5)', 'np.uint8'], {}), '((5, 5), np.uint8)\n', (154, 172), True, 'import numpy as np\n'), ((183, 220), 'cv2.cvtColor', 'cv2.cvtColor', ([... |
import numpy as np
import pytest
from bayesian_mmm.spend_transformation.spend_transformation import (
add_lagged_values_along_z,
compute_adstock,
compute_geo_decay,
compute_hill,
compute_reach
)
SPENDS = np.array([[10, 20], [0, 8], [1, 30], [5, 40]])
MAX_LAG = 4
LAGGED_SPENDS = np.array([
[[... | [
"bayesian_mmm.spend_transformation.spend_transformation.compute_hill",
"bayesian_mmm.spend_transformation.spend_transformation.compute_reach",
"bayesian_mmm.spend_transformation.spend_transformation.compute_adstock",
"bayesian_mmm.spend_transformation.spend_transformation.compute_geo_decay",
"numpy.array",
... | [((226, 272), 'numpy.array', 'np.array', (['[[10, 20], [0, 8], [1, 30], [5, 40]]'], {}), '([[10, 20], [0, 8], [1, 30], [5, 40]])\n', (234, 272), True, 'import numpy as np\n'), ((303, 449), 'numpy.array', 'np.array', (['[[[10, 0, 0, 0], [20, 0, 0, 0]], [[0, 10, 0, 0], [8, 20, 0, 0]], [[1, 0, 10,\n 0], [30, 8, 20, 0]]... |
# -*- coding: utf-8 -*-
from universal.algo import Algo
import universal.tools as tools
import numpy as np
from cvxopt import solvers, matrix
solvers.options['show_progress'] = False
class ONS(Algo):
"""
Online newton step algorithm.
Reference:
A.Agarwal, E.Hazan, S.Kale, R.E.Schapire.
... | [
"cvxopt.matrix",
"numpy.dot",
"numpy.zeros",
"numpy.ones",
"cvxopt.solvers.qp",
"numpy.eye",
"numpy.squeeze"
] | [((1586, 1599), 'cvxopt.matrix', 'matrix', (['(2 * M)'], {}), '(2 * M)\n', (1592, 1599), False, 'from cvxopt import solvers, matrix\n'), ((1610, 1628), 'cvxopt.matrix', 'matrix', (['(-2 * M * x)'], {}), '(-2 * M * x)\n', (1616, 1628), False, 'from cvxopt import solvers, matrix\n'), ((1743, 1754), 'cvxopt.matrix', 'matr... |
import scipy.sparse as sp
import numpy as np
from sklearn import preprocessing
import networkx as nx
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
def encode_onehot(labels):
classes = sorted(list(set(labels)))
classes_dict = {c: np.identity(len(classes))[i, :] for i, c in enumerate... | [
"numpy.count_nonzero",
"numpy.dtype",
"networkx.to_edgelist",
"scipy.sparse.csr_matrix",
"networkx.Graph",
"numpy.array",
"sklearn.preprocessing.normalize"
] | [((696, 756), 'scipy.sparse.csr_matrix', 'sp.csr_matrix', (['idx_feature_labels[:, 1:-1]'], {'dtype': 'np.float32'}), '(idx_feature_labels[:, 1:-1], dtype=np.float32)\n', (709, 756), True, 'import scipy.sparse as sp\n'), ((822, 872), 'numpy.array', 'np.array', (['idx_feature_labels[:, 0]'], {'dtype': 'np.int32'}), '(id... |
# -*- coding: utf-8 -*-
import pandas as pd
import torch
from sklearn.metrics import log_loss, roc_auc_score
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder, MinMaxScaler
from deepctr_torch.inputs import SparseFeat, DenseFeat, get_feature_names
from deepctr_torch.mod... | [
"numpy.load",
"yaml.load",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.MinMaxScaler",
"pandas.DataFrame",
"sklearn.preprocessing.LabelEncoder",
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.Linear",
"shutil.copyfile",
"p... | [((2372, 2397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2395, 2397), False, 'import argparse\n'), ((2903, 2918), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (2916, 2918), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((3042, 3082), 'shuti... |
import json
from datetime import timedelta
from glob import glob
from os.path import join, exists
import numpy as np
import pandas as pd
from grib2io import Grib2Message
from netCDF4 import Dataset, num2date
from scipy.interpolate import interp1d
from scipy.ndimage import gaussian_filter
from scipy.signal import fftco... | [
"numpy.isin",
"hagelslag.util.make_proj_grids.read_arps_map_file",
"scipy.stats.gamma.rvs",
"pandas.read_csv",
"numpy.isnan",
"numpy.product",
"numpy.mean",
"numpy.arange",
"scipy.spatial.cKDTree",
"scipy.signal.fftconvolve",
"scipy.interpolate.interp1d",
"netCDF4.Dataset",
"scipy.ndimage.ga... | [((2395, 2461), 'pandas.date_range', 'pd.date_range', ([], {'start': 'self.start_date', 'end': 'self.end_date', 'freq': '"""1H"""'}), "(start=self.start_date, end=self.end_date, freq='1H')\n", (2408, 2461), True, 'import pandas as pd\n'), ((9143, 9164), 'os.path.exists', 'exists', (['forecast_file'], {}), '(forecast_fi... |
import os, argparse
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import f1_score
def softmax_curvepoints(result_file, thresh, ood_ncls, num_rand):
assert os.path.exists(result_file), "File not found! Run baseline_i3d_softmax.py first!"
# load the testing results
results = np.loa... | [
"numpy.load",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.argmax",
"sklearn.metrics.f1_score",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.mean",
"matplotlib.pyplot.tight_layout",
"os.path.dirname",
"os.path.exists",
"numpy.max",
"numpy.random.choice",
"matplotlib.pyplot.... | [((187, 214), 'os.path.exists', 'os.path.exists', (['result_file'], {}), '(result_file)\n', (201, 214), False, 'import os, argparse\n'), ((314, 353), 'numpy.load', 'np.load', (['result_file'], {'allow_pickle': '(True)'}), '(result_file, allow_pickle=True)\n', (321, 353), True, 'import numpy as np\n'), ((607, 637), 'num... |
import numpy
def append_if_not_exists(arr, x):
if x not in arr:
arr.append(x)
def some_useless_slow_function():
arr = list()
for i in range(10000):
x = numpy.random.randint(0, 10000)
append_if_not_exists(arr, x)
| [
"numpy.random.randint"
] | [((190, 220), 'numpy.random.randint', 'numpy.random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (210, 220), False, 'import numpy\n')] |
####
#### last update Nov. 29, 2021
####
"""
This is not efficient. I am doing the following two scenarios in a
sequential fashion.
a. three filters: irrigated fields, NASS out, survey date correct
b. one filter: irrigated fields
The least could be done is do it in parallel fashion!
"""
import csv
import... | [
"sys.path.append",
"NASA_core.addToDF_SOS_EOS_White",
"os.makedirs",
"pandas.read_csv",
"pandas.merge",
"NASA_core.Null_SOS_EOS_by_DoYDiff",
"time.time",
"NASA_core.filter_out_nonIrrigated",
"numpy.append",
"pandas.to_datetime",
"NASA_core.initial_clean",
"NASA_core.filter_by_lastSurvey",
"N... | [((449, 460), 'time.time', 'time.time', ([], {}), '()\n', (458, 460), False, 'import time\n'), ((802, 842), 'sys.path.append', 'sys.path.append', (['"""/home/hnoorazar/NASA/"""'], {}), "('/home/hnoorazar/NASA/')\n", (817, 842), False, 'import sys\n'), ((2079, 2117), 'os.makedirs', 'os.makedirs', (['output_dir'], {'exis... |
#
# Copyright 2018 California Institute of Technology
#
# 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 applicabl... | [
"logging.error",
"numpy.sum",
"logging.debug",
"numpy.logical_and",
"numpy.log",
"numpy.logical_not",
"numpy.zeros",
"os.path.exists",
"numpy.isfinite",
"numpy.where",
"numpy.loadtxt",
"numpy.cos",
"scipy.interpolate.interp1d",
"os.path.join",
"os.getenv"
] | [((3425, 3464), 'os.path.join', 'os.path.join', (['self.lut_dir', 'infilename0'], {}), '(self.lut_dir, infilename0)\n', (3437, 3464), False, 'import os\n'), ((3488, 3528), 'os.path.join', 'os.path.join', (['self.lut_dir', 'infilename05'], {}), '(self.lut_dir, infilename05)\n', (3500, 3528), False, 'import os\n'), ((355... |
import numpy as np
import sys,os
from evaluation import nDCG5, save_result
import data
import json
if __name__ == '__main__':
score= []
num = len(sys.argv) -1
for i in range(num):
score_path = sys.argv[i+1]
score.append(np.load(score_path, allow_pickle=True).item())
score_enm = {}
... | [
"evaluation.nDCG5",
"numpy.load",
"evaluation.save_result"
] | [((1330, 1352), 'evaluation.save_result', 'save_result', (['score_enm'], {}), '(score_enm)\n', (1341, 1352), False, 'from evaluation import nDCG5, save_result\n'), ((1379, 1403), 'evaluation.nDCG5', 'nDCG5', (['score_enm', 'answer'], {}), '(score_enm, answer)\n', (1384, 1403), False, 'from evaluation import nDCG5, save... |
import unittest
import Mariana.layers as ML
import Mariana.layers as ML
import Mariana.decorators as dec
import Mariana.costs as MC
import Mariana.regularizations as MR
import Mariana.scenari as MS
import Mariana.activations as MA
import Mariana.training.datasetmaps as MD
import theano.tensor as tt
import numpy
clas... | [
"unittest.main",
"numpy.arange"
] | [((1245, 1260), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1258, 1260), False, 'import unittest\n'), ((582, 599), 'numpy.arange', 'numpy.arange', (['(100)'], {}), '(100)\n', (594, 599), False, 'import numpy\n'), ((607, 623), 'numpy.arange', 'numpy.arange', (['(10)'], {}), '(10)\n', (619, 623), False, 'import ... |
# -*- coding: utf-8 -*-
"""
Created on May 23 2014
@author: florian
"""
import sys
import threading
import atexit
import pyaudio
import numpy as np
import matplotlib.pyplot as plt
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.b... | [
"atexit.register",
"PyQt4.QtCore.QTimer",
"matplotlib.backends.backend_qt4agg.NavigationToolbar2QT",
"numpy.fft.rfft",
"PyQt4.QtGui.QLabel",
"PyQt4.QtGui.QCheckBox",
"numpy.abs",
"numpy.floor",
"PyQt4.QtGui.QVBoxLayout",
"matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg",
"matplotlib.pyplot.... | [((9295, 9334), 'numpy.array', 'np.array', (['x'], {'dtype': 'np.double', 'copy': '(True)'}), '(x, dtype=np.double, copy=True)\n', (9303, 9334), True, 'import numpy as np\n'), ((9344, 9362), 'numpy.hamming', 'np.hamming', (['x.size'], {}), '(x.size)\n', (9354, 9362), True, 'import numpy as np\n'), ((9449, 9465), 'numpy... |
# ======================================================================
#
# This routine interfaces with IPOPT
# It sets the optimization problem for every training point
# during the VFI.
#
# <NAME>, 11/16 ; 07/17; 01/19
# edited by <NAME>, with <NAME> and <NAME>, 11/2021
# Main difference is... | [
"ipopt_wrapper_A.ipopt_obj",
"numpy.empty",
"cyipopt.Problem",
"numpy.hstack"
] | [((938, 949), 'numpy.empty', 'np.empty', (['N'], {}), '(N)\n', (946, 949), True, 'import numpy as np\n'), ((961, 972), 'numpy.empty', 'np.empty', (['M'], {}), '(M)\n', (969, 972), True, 'import numpy as np\n'), ((996, 1007), 'numpy.empty', 'np.empty', (['M'], {}), '(M)\n', (1004, 1007), True, 'import numpy as np\n'), (... |
import numpy as np
from matplotlib import pyplot as plt
# args to create data from copy past logs:
# cat hb_timeout.txt | uniq -u | grep "timeout in" | cut -d " " -f 1,6 |
# cut -d ":" -f 3- >> hb_timeout.dat
data = np.loadtxt("hb_timeout.dat")
# print(
fig = plt.figure(figsize=(9, 4))
plt.scatter(data[:, 0], data[:... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.axhspan"
] | [((218, 246), 'numpy.loadtxt', 'np.loadtxt', (['"""hb_timeout.dat"""'], {}), "('hb_timeout.dat')\n", (228, 246), True, 'import numpy as np\n'), ((263, 289), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(9, 4)'}), '(figsize=(9, 4))\n', (273, 289), True, 'from matplotlib import pyplot as plt\n'), ((290, 32... |
import numpy as np
rand_num = np.random.normal(0,1,1)
print("Random number between 0 and 1:")
print(rand_num) | [
"numpy.random.normal"
] | [((30, 55), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(1)'], {}), '(0, 1, 1)\n', (46, 55), True, 'import numpy as np\n')] |
from rdkit import Chem
from .AtomProperty import GetRelativeAtomicProperty
import numpy
import numpy.linalg
def getBurdenMatrix(mol, propertylabel='m'):
"""
#################################################################
Calculate Burden matrix and their eigenvalues.
################################... | [
"numpy.linalg.eigvals",
"numpy.abs",
"numpy.concatenate",
"numpy.zeros",
"numpy.sort",
"numpy.array",
"numpy.argwhere",
"rdkit.Chem.AddHs",
"rdkit.Chem.GetAdjacencyMatrix",
"numpy.sqrt"
] | [((370, 385), 'rdkit.Chem.AddHs', 'Chem.AddHs', (['mol'], {}), '(mol)\n', (380, 385), False, 'from rdkit import Chem\n'), ((428, 456), 'rdkit.Chem.GetAdjacencyMatrix', 'Chem.GetAdjacencyMatrix', (['mol'], {}), '(mol)\n', (451, 456), False, 'from rdkit import Chem\n'), ((471, 495), 'numpy.argwhere', 'numpy.argwhere', ([... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import numpy as np
import pandas as pd
import sklearn as skl
import random
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
from sklearn.preprocessing import StandardScaler
import re
import sys
from math import floor
import ... | [
"numpy.save",
"Bio.SeqIO.parse",
"numpy.log",
"sklearn.preprocessing.LabelEncoder",
"numpy.array",
"re.sub",
"numpy.delete",
"numpy.random.shuffle"
] | [((444, 471), 're.sub', 're.sub', (['"""[^acgt]"""', '"""z"""', 'seq'], {}), "('[^acgt]', 'z', seq)\n", (450, 471), False, 'import re\n'), ((581, 595), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (593, 595), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((891, 919), 'numpy.dele... |
import numpy as np
import torch, sys, os, pdb
from .jindlib import JindLib
def main():
import pickle
with open('data/dendrites_annotated.pkl', 'rb') as f:
data = pickle.load(f)
cell_ids = np.arange(len(data))
np.random.seed(0)
# np.random.shuffle(cell_ids)
# l = int(0.5*len(cell_ids))
batches = list(set(dat... | [
"pickle.load",
"torch.set_num_threads",
"numpy.random.seed"
] | [((217, 234), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (231, 234), True, 'import numpy as np\n'), ((1527, 1552), 'torch.set_num_threads', 'torch.set_num_threads', (['(25)'], {}), '(25)\n', (1548, 1552), False, 'import torch, sys, os, pdb\n'), ((168, 182), 'pickle.load', 'pickle.load', (['f'], {}),... |
from sre_parse import fix_flags
from cv2 import FileStorage_UNDEFINED
import numpy as np
import pandas as pd
from pandas.io import sql
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
df= pd.read_csv('HINDALCO.csv', index_col=False, delimiter = ',')
df = df.set_index(pd.DatetimeIndex(df[... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"mysql.connector.connect",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"pandas.DatetimeIndex",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.where",
"matplotlib.pyplot.ylabel",
"matplotlib.py... | [((177, 209), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (190, 209), True, 'import matplotlib.pyplot as plt\n'), ((217, 276), 'pandas.read_csv', 'pd.read_csv', (['"""HINDALCO.csv"""'], {'index_col': '(False)', 'delimiter': '""","""'}), "('HINDALCO.csv', ind... |
import torch
from torch import nn
from torch import optim
from torch.nn import functional as F
from torch.utils.data import TensorDataset, DataLoader
from torch import optim
import numpy as np
from learner import Learner
from copy import deepcopy
import errors
def get_lr(optimizer):
for p... | [
"torch.eq",
"copy.deepcopy",
"learner.Learner",
"errors.find_psnr",
"torch.autograd.grad",
"torch.nn.functional.cross_entropy",
"numpy.array",
"torch.no_grad",
"torch.nn.functional.smooth_l1_loss",
"torch.optim.lr_scheduler.MultiStepLR"
] | [((1074, 1089), 'learner.Learner', 'Learner', (['config'], {}), '(config)\n', (1081, 1089), False, 'from learner import Learner\n'), ((1192, 1279), 'torch.optim.lr_scheduler.MultiStepLR', 'optim.lr_scheduler.MultiStepLR', (['self.meta_optim'], {'milestones': '[2000, 4000]', 'gamma': '(0.5)'}), '(self.meta_optim, milest... |
import os
import numpy as np
print("-------------------------------------------------")
print("|\t\tPyCylon Test Framework\t\t|")
print("-------------------------------------------------")
responses = []
def test_pycylon_installation_test():
print("1. PyCylon Installation Test")
responses.append(os.system("... | [
"numpy.array",
"os.system"
] | [((4346, 4365), 'numpy.array', 'np.array', (['responses'], {}), '(responses)\n', (4354, 4365), True, 'import numpy as np\n'), ((309, 359), 'os.system', 'os.system', (['"""pytest -q python/test/test_pycylon.py"""'], {}), "('pytest -q python/test/test_pycylon.py')\n", (318, 359), False, 'import os\n'), ((494, 548), 'os.s... |
import tensorflow as tf
from numpy.random import seed
from tensorflow.keras import activations
from tensorflow.keras.layers import Dense
import tensorflow.keras.backend as K
from tensorflow import set_random_seed
seed(2020)
set_random_seed(2020)
class SPARSE_MPNN(tf.keras.layers.Layer):
r"""Message p... | [
"tensorflow.reduce_sum",
"numpy.random.seed",
"tensorflow.keras.backend.softmax",
"tensorflow.keras.layers.Dense",
"tensorflow.nn.tanh",
"tensorflow.reshape",
"tensorflow.keras.backend.int_shape",
"tensorflow.multiply",
"tensorflow.matmul",
"tensorflow.math.unsorted_segment_sum",
"tensorflow.nn.... | [((221, 231), 'numpy.random.seed', 'seed', (['(2020)'], {}), '(2020)\n', (225, 231), False, 'from numpy.random import seed\n'), ((233, 254), 'tensorflow.set_random_seed', 'set_random_seed', (['(2020)'], {}), '(2020)\n', (248, 254), False, 'from tensorflow import set_random_seed\n'), ((1102, 1129), 'tensorflow.keras.act... |
"""Functions for control of LTI systems."""
# Author: <NAME>
import numpy as np
from .matrixmath import dlyap, mdot
def ctrb(A, B):
"""Controllabilty matrix
Parameters
----------
A, B: np.array
Dynamics and input matrix of the system
Returns
-------
C: matrix
... | [
"numpy.copy",
"numpy.zeros",
"numpy.shape",
"numpy.reshape",
"numpy.dot"
] | [((421, 432), 'numpy.shape', 'np.shape', (['B'], {}), '(B)\n', (429, 432), True, 'import numpy as np\n'), ((444, 463), 'numpy.zeros', 'np.zeros', (['[n, m, n]'], {}), '([n, m, n])\n', (452, 463), True, 'import numpy as np\n'), ((480, 490), 'numpy.copy', 'np.copy', (['B'], {}), '(B)\n', (487, 490), True, 'import numpy a... |
import numpy as np
class RandomEstimator:
def estimate(self, X_pool, *args):
return np.ones(X_pool.shape[0])
| [
"numpy.ones"
] | [((98, 122), 'numpy.ones', 'np.ones', (['X_pool.shape[0]'], {}), '(X_pool.shape[0])\n', (105, 122), True, 'import numpy as np\n')] |
# -------------------------------------------------
# IMPORTS
# -------------------------------------------------
import numpy as np
from math import ceil
from imblearn.under_sampling import NearMiss
from imblearn.over_sampling import SMOTE, ADASYN
from collections import Counter
from sklearn.ensemble import RandomF... | [
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"numpy.floor",
"numpy.clip",
"numpy.mean",
"numpy.exp",
"numpy.random.normal",
"numpy.round",
"numpy.unique",
"numpy.zeros_like",
"art.attacks.ZooAttack",
"numpy.transpose",
"sklearn.preprocessing.Label... | [((1021, 1053), 'numpy.unique', 'np.unique', (['y'], {'return_counts': '(True)'}), '(y, return_counts=True)\n', (1030, 1053), True, 'import numpy as np\n'), ((1355, 1381), 'numpy.vectorize', 'np.vectorize', (['rand_labeler'], {}), '(rand_labeler)\n', (1367, 1381), True, 'import numpy as np\n'), ((1602, 1634), 'numpy.un... |
'''external_drift.py
Classes
-------
ExternalDrift - base class for all external drift objects
ConstantDrift - generic class to apply a constant drift
'''
from abc import ABC, abstractmethod
import numpy as np
__all__ = ['ExternalDrift', 'ConstantDrift']
class ExternalDrift:
'''Base class for all external drift ... | [
"numpy.array"
] | [((1399, 1421), 'numpy.array', 'np.array', (['drift_vector'], {}), '(drift_vector)\n', (1407, 1421), True, 'import numpy as np\n')] |
from pathlib import Path
import pytest
from ai_ct_scans import data_loading
import pydicom
import mock
import numpy as np
@pytest.fixture()
def patient_1_dicom_dir():
return Path(__file__).parent / "fixtures" / "dicom_data" / "1"
@pytest.fixture()
def patched_root_directory(monkeypatch):
patch = mock.Magic... | [
"ai_ct_scans.data_loading.MultiPatientAxialStreamer",
"ai_ct_scans.data_loading.BodyPartLoader",
"pydicom.dcmread",
"ai_ct_scans.data_loading.ScanLoader",
"numpy.testing.assert_array_equal",
"ai_ct_scans.data_loading.dir_dicom_paths",
"ai_ct_scans.data_loading.data_root_directory",
"pytest.fixture",
... | [((126, 142), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (140, 142), False, 'import pytest\n'), ((240, 256), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (254, 256), False, 'import pytest\n'), ((473, 489), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (487, 489), False, 'import pytest\n'), (... |
import cv2
import numpy as np
def nothing(x):
pass
# for video capture
cap =cv2.VideoCapture(0)
cv2.namedWindow("Tracking")
cv2.createTrackbar("LH","Tracking",0,255,nothing)
cv2.createTrackbar("LS","Tracking",0,255,nothing)
cv2.createTrackbar("LV","Tracking",0,255,nothing)
cv2.createTrackbar("UH","Tracking",255... | [
"cv2.createTrackbar",
"cv2.bitwise_and",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"numpy.array",
"cv2.getTrackbarPos",
"cv2.destroyAllWindows",
"cv2.inRange",
"cv2.namedWindow"
] | [((83, 102), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (99, 102), False, 'import cv2\n'), ((104, 131), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Tracking"""'], {}), "('Tracking')\n", (119, 131), False, 'import cv2\n'), ((132, 185), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""LH"""', '"""Tr... |
from __future__ import print_function
import os
from skimage.transform import resize
from skimage.io import imsave
import numpy as np
import pdb
from skimage.io import imsave, imread
import cv2
#import pylab
import imageio
#import matplotlib.pyplot as plt
import params
from get_resUnet import *
#from get_model impor... | [
"gen_data.load_test_image",
"cv2.VideoWriter_fourcc",
"numpy.clip",
"numpy.shape",
"skimage.measure.label",
"cv2.VideoWriter",
"os.path.join",
"skimage.measure.regionprops",
"numpy.zeros_like",
"cv2.cvtColor",
"cv2.resize",
"numpy.dstack",
"params.init",
"cv2.addWeighted",
"numpy.squeeze... | [((825, 844), 'numpy.where', 'np.where', (['(img > 0.9)'], {}), '(img > 0.9)\n', (833, 844), True, 'import numpy as np\n'), ((1042, 1052), 'skimage.measure.label', 'label', (['img'], {}), '(img)\n', (1047, 1052), False, 'from skimage.measure import label, regionprops\n'), ((1067, 1089), 'skimage.measure.regionprops', '... |
#
# Copyright 2020 The FLEX 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... | [
"numpy.right_shift",
"math.ceil",
"numpy.frombuffer",
"numpy.zeros",
"math.floor",
"numpy.array",
"Crypto.Cipher.AES.new",
"numpy.bitwise_and",
"numpy.tile",
"numpy.matmul",
"math.log",
"numpy.all"
] | [((2096, 2127), 'Crypto.Cipher.AES.new', 'AES.new', (['self.key', 'AES.MODE_ECB'], {}), '(self.key, AES.MODE_ECB)\n', (2103, 2127), False, 'from Crypto.Cipher import AES\n'), ((2163, 2186), 'math.floor', 'math.floor', (['(self.n // 2)'], {}), '(self.n // 2)\n', (2173, 2186), False, 'import math\n'), ((2651, 2700), 'num... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 13 10:40:43 2020
@author: Código desarrollado en clase de EDP (USA - Maestría en Matemáticas Aplicadas)
"""
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-np.pi,np.pi,500)
plt.grid()
k2 = (2/np.pi)-(4/np.pi)*((1/3)*np.cos(2*x))
k3 = (2/np.pi)-(4/np.pi... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.cos",
"numpy.linspace",
"matplotlib.pyplot.grid"
] | [((211, 242), 'numpy.linspace', 'np.linspace', (['(-np.pi)', 'np.pi', '(500)'], {}), '(-np.pi, np.pi, 500)\n', (222, 242), True, 'import numpy as np\n'), ((241, 251), 'matplotlib.pyplot.grid', 'plt.grid', ([], {}), '()\n', (249, 251), True, 'import matplotlib.pyplot as plt\n'), ((676, 710), 'matplotlib.pyplot.plot', 'p... |
#!/usr/bin/env python3
import importlib
import math
from collections import defaultdict, deque
import numpy as np
import cereal.messaging as messaging
from cereal import car,log,tesla
from common.numpy_fast import interp
from common.params import Params
from common.realtime import Ratekeeper, set_realtime_priority
fro... | [
"selfdrive.car.tesla.readconfig.CarSettings",
"numpy.amin",
"selfdrive.controls.lib.radar_helpers.Track",
"cereal.messaging.drain_sock_raw",
"collections.defaultdict",
"numpy.arange",
"common.realtime.set_realtime_priority",
"numpy.interp",
"cereal.tesla.ICCarsLR.new_message",
"collections.deque",... | [((14931, 14955), 'common.realtime.set_realtime_priority', 'set_realtime_priority', (['(2)'], {}), '(2)\n', (14952, 14955), False, 'from common.realtime import Ratekeeper, set_realtime_priority\n'), ((15017, 15065), 'selfdrive.swaglog.cloudlog.info', 'cloudlog.info', (['"""radard is waiting for CarParams"""'], {}), "('... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"tensorflow_data_validation.statistics.generators.string_stats_generator.StringStatsGenerator",
"absl.testing.absltest.main",
"tensorflow_metadata.proto.v0.statistics_pb2.FeatureNameStatistics",
"numpy.array",
"tensorflow_metadata.proto.v0.schema_pb2.Schema"
] | [((7974, 7989), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (7987, 7989), False, 'from absl.testing import absltest\n'), ((1701, 1746), 'tensorflow_data_validation.statistics.generators.string_stats_generator.StringStatsGenerator', 'string_stats_generator.StringStatsGenerator', ([], {}), '()\n', (1... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by <NAME> (<EMAIL>)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import divis... | [
"numpy.minimum",
"numpy.maximum",
"cv2.imwrite",
"numpy.zeros",
"torchvision.utils.make_grid",
"numpy.linspace",
"cv2.applyColorMap"
] | [((1446, 1507), 'torchvision.utils.make_grid', 'torchvision.utils.make_grid', (['batch_image', 'nrow', 'padding', '(True)'], {}), '(batch_image, nrow, padding, True)\n', (1473, 1507), False, 'import torchvision\n'), ((2386, 2415), 'cv2.imwrite', 'cv2.imwrite', (['file_name', 'ndarr'], {}), '(file_name, ndarr)\n', (2397... |
# Copyright (c) 2018-2020 Simons Observatory.
# Full license can be found in the top level "LICENSE" file.
"""TOAST interface tools.
This module contains code for interfacing with TOAST data representations.
"""
import os
import sys
import re
import traceback
import numpy as np
# Import so3g first so that it can c... | [
"toast.qarray.mult",
"traceback.format_exception",
"toast.dist.Data",
"os.path.join",
"numpy.amin",
"os.walk",
"toast.qarray.to_position",
"toast.timing.Timer",
"toast.dist.distribute_discrete",
"numpy.amax",
"numpy.array",
"sys.exc_info",
"toast.tod.Noise",
"toast.tod.spt3g_utils.from_g3_... | [((13703, 13763), 'toast.tod.Noise', 'Noise', ([], {'detectors': 'detnames', 'freqs': 'noise_freq', 'psds': 'noise_psds'}), '(detectors=detnames, freqs=noise_freq, psds=noise_psds)\n', (13708, 13763), False, 'from toast.tod import TOD, Noise\n'), ((14759, 14771), 'toast.utils.Logger.get', 'Logger.get', ([], {}), '()\n'... |
import os
import time
import numpy as np
from ..population.fireworks import SSPFirework
from ..operator import operator as opt
from ..tools.distribution import MultiVariateNormalDistribution as MVND
EPS = 1e-6
class FWASSP(object):
def __init__(self):
# params
self.fw_size = None
self.sp... | [
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"numpy.empty",
"numpy.ones",
"numpy.clip",
"numpy.argsort",
"numpy.mean",
"numpy.arange",
"numpy.std",
"numpy.max",
"numpy.dot",
"numpy.random.uniform",
"os.getpid",
"numpy.zeros",
"time.time",
"numpy.any",
"numpy.array",
"numpy.matm... | [((2232, 2257), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (2246, 2257), True, 'import numpy as np\n'), ((2311, 2343), 'numpy.array', 'np.array', (['([False] * self.fw_size)'], {}), '([False] * self.fw_size)\n', (2319, 2343), True, 'import numpy as np\n'), ((2458, 2519), 'numpy.random.... |
import numpy as np
def to_binary(val, Nb):
return [int(i) for i in '{:0{w}b}'.format(val, w=Nb)][::-1][:Nb]
def operator_function(operator_name, Ni, No):
Nb = Ni // 2
d = 2**Nb
if operator_name == 'zero':
return lambda x: 0
elif operator_name == 'add':
return lambda x: to_binary... | [
"numpy.array_equal",
"numpy.random.randint",
"numpy.zeros"
] | [((3345, 3386), 'numpy.zeros', 'np.zeros', ([], {'shape': '(Ns, Ne)', 'dtype': 'np.uint64'}), '(shape=(Ns, Ne), dtype=np.uint64)\n', (3353, 3386), True, 'import numpy as np\n'), ((3647, 3688), 'numpy.zeros', 'np.zeros', ([], {'shape': '(Ns, Ne)', 'dtype': 'np.uint64'}), '(shape=(Ns, Ne), dtype=np.uint64)\n', (3655, 368... |
from model import Model
from preprocessing import VidToFrame
from preprocessing import FrameCount
import numpy as np
import sys
import os
class run_classification(object):
def __init__(self, file):
self.file = file
def FileToFrame(self):
return VidToFrame(self.file)
if __name__ == "__main__":... | [
"os.remove",
"model.Model",
"numpy.expand_dims",
"preprocessing.VidToFrame",
"os.listdir"
] | [((373, 389), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (383, 389), False, 'import os\n'), ((770, 777), 'model.Model', 'Model', ([], {}), '()\n', (775, 777), False, 'from model import Model\n'), ((884, 900), 'os.remove', 'os.remove', (['video'], {}), '(video)\n', (893, 900), False, 'import os\n'), ((271, ... |
from torch.utils.data import Dataset
import numpy as np
import os, cv2, time
from PIL import Image
from torchvision import transforms
from datasets.data_io import *
s_h, s_w = 0, 0
class MVSDataset(Dataset):
def __init__(self, datapath, split='intermediate', nviews=3, img_wh=(1920, 1056), ndepths=192):
s... | [
"numpy.stack",
"numpy.zeros",
"PIL.Image.open",
"numpy.array",
"numpy.arange",
"torchvision.transforms.Normalize",
"os.path.join",
"torchvision.transforms.ToTensor"
] | [((3387, 3407), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (3397, 3407), False, 'from PIL import Image\n'), ((3570, 3590), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (3580, 3590), False, 'from PIL import Image\n'), ((3684, 3704), 'PIL.Image.open', 'Image.open', (['filen... |
import os
import json
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
import argparse
import pandas as pd
import numpy as np
from blitz.modules import BayesianLSTM
from blitz.utils import variational_estimator
from load_data import DataLoader
from sklearn.metrics import ac... | [
"argparse.ArgumentParser",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.classification_report",
"sklearn.metrics.jaccard_score",
"matplotlib.pyplot.figure",
"load_data.DataLoader",
"matplotlib.pyplot.xlabel",
"pandas.DataFrame",
"torch.nn.BCELoss",
"os.path.dirname",
"random.seed",
"torc... | [((625, 650), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (648, 650), False, 'import argparse\n'), ((1389, 1404), 'random.seed', 'seed', (['args.seed'], {}), '(args.seed)\n', (1393, 1404), False, 'from random import seed, random\n'), ((584, 596), 'json.load', 'json.load', (['f'], {}), '(f)\n... |
import numpy as np
from ..metrics import mse, mse_grad
from .mv_splines import mv_b_spline_vector, mv_spline_grad
from tqdm import trange
from scipy.sparse import coo_matrix
def fit_spline(x_train, y_train,
x_val, y_val,
regressor,
optimizer,
knot_init=None,... | [
"tqdm.trange",
"numpy.ndim",
"scipy.sparse.coo_matrix",
"numpy.array",
"numpy.random.permutation"
] | [((1223, 1250), 'scipy.sparse.coo_matrix', 'coo_matrix', (['b_splines_train'], {}), '(b_splines_train)\n', (1233, 1250), False, 'from scipy.sparse import coo_matrix\n'), ((2075, 2092), 'tqdm.trange', 'trange', (['max_iters'], {}), '(max_iters)\n', (2081, 2092), False, 'from tqdm import trange\n'), ((528, 544), 'numpy.n... |
# MIT License
#
# Copyright (c) 2020-2021 CNRS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pu... | [
"torch.nn.functional.binary_cross_entropy",
"numpy.sum",
"numpy.argsort",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.tight_layout",
"pyannote.audio.utils.random.create_rng_for_worker",
"numpy.pad",
"pyannote.audio.core.io.Audio.power_normalize",
"pyannote.audio.utils.permutation.permutate",
... | [((9794, 9841), 'pyannote.audio.utils.random.create_rng_for_worker', 'create_rng_for_worker', (['self.model.current_epoch'], {}), '(self.model.current_epoch)\n', (9815, 9841), False, 'from pyannote.audio.utils.random import create_rng_for_worker\n'), ((13342, 13362), 'pyannote.audio.utils.permutation.permutate', 'permu... |
#*----------------------------------------------------------------------------*
#* Copyright (C) 2021 Politecnico di Torino, Italy *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... | [
"unittest.main",
"numpy.random.seed",
"utils.prepare_device",
"trainer.NinaProDB1Trainer.NinaProDB1Trainer",
"collections.namedtuple",
"model.TCCNet.TCCNet",
"torch.nn.DataParallel",
"parse_config.ConfigParser.from_args"
] | [((1810, 1830), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (1824, 1830), True, 'import numpy as np\n'), ((1902, 1956), 'collections.namedtuple', 'collections.namedtuple', (['"""args"""', '"""config resume device"""'], {}), "('args', 'config resume device')\n", (1924, 1956), False, 'import coll... |
import numpy as np
from rllab.envs.mujoco.hill.hill_env import HillEnv
from rllab.envs.mujoco.walker2d_env import Walker2DEnv
from rllab.misc.overrides import overrides
import rllab.envs.mujoco.hill.terrain as terrain
from rllab.spaces import Box
class Walker2DHillEnv(HillEnv):
MODEL_CLASS = Walker2DEnv
... | [
"numpy.array"
] | [((475, 497), 'numpy.array', 'np.array', (['[-2.0, -2.0]'], {}), '([-2.0, -2.0])\n', (483, 497), True, 'import numpy as np\n'), ((499, 521), 'numpy.array', 'np.array', (['[-0.5, -0.5]'], {}), '([-0.5, -0.5])\n', (507, 521), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 10:11:59 2018
@author: zhangxiang
"""
#import sys
#reload(sys)
#sys.setdefaultencoding("utf-8")
import importlib,sys
#importlib.reload(sys)
sys.path.append("/opt/spark/spark-2.2.0-bin-hadoop2.6/python")
sys.path.append("/opt/spark/spark-2.2.0-bin-hadoop2.6/python/l... | [
"sys.path.append",
"numpy.radians",
"pandas.DataFrame",
"pyspark.sql.session.SparkSession.builder.master",
"sklearn.cluster.DBSCAN"
] | [((195, 257), 'sys.path.append', 'sys.path.append', (['"""/opt/spark/spark-2.2.0-bin-hadoop2.6/python"""'], {}), "('/opt/spark/spark-2.2.0-bin-hadoop2.6/python')\n", (210, 257), False, 'import importlib, sys\n'), ((258, 349), 'sys.path.append', 'sys.path.append', (['"""/opt/spark/spark-2.2.0-bin-hadoop2.6/python/lib/py... |
"""
License
Copyright 2019 <NAME>, <NAME>, <NAME>, <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... | [
"pandas.read_csv",
"numpy.where",
"notebooks.scripts.disparity_measurement.DisparityTesting",
"pandas.set_option",
"pandas.concat"
] | [((750, 790), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(30)'], {}), "('display.max_columns', 30)\n", (763, 790), True, 'import pandas as pd\n'), ((791, 826), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(200)'], {}), "('display.width', 200)\n", (804, 826), True, 'import p... |
import os
import random
import numpy as np
from typing import List, Tuple, Dict, Union, Iterable
from geometry.TwoDimension import SE2Pose, Point2
from slam.Variables import SE2Variable, VariableType, R2Variable, Variable
import matplotlib.pyplot as plt
from utils.Statistics import mmd
from utils.Visualization import... | [
"numpy.sum",
"slam.Variables.SE2Variable",
"numpy.zeros",
"numpy.genfromtxt",
"os.path.exists",
"numpy.hstack",
"slam.Variables.R2Variable",
"geometry.TwoDimension.SE2Pose.by_exp_map",
"numpy.array",
"numpy.loadtxt",
"utils.Statistics.mmd"
] | [((423, 461), 'numpy.genfromtxt', 'np.genfromtxt', (['order_file'], {'dtype': '"""str"""'}), "(order_file, dtype='str')\n", (436, 461), True, 'import numpy as np\n'), ((1695, 1722), 'numpy.zeros', 'np.zeros', (['(sample_num, dim)'], {}), '((sample_num, dim))\n', (1703, 1722), True, 'import numpy as np\n'), ((3694, 3708... |
from shutil import rmtree
import pytest
import numpy as np
from snek5000_cbox.solver import Simul
from snek5000 import load
@pytest.mark.slow
def test_simple_simul():
params = Simul.create_default_params()
aspect_ratio = 1.0
params.prandtl = 0.71
# for aspect ratio 1, Ra_c = 1.825E08
params.... | [
"snek5000.load",
"numpy.linspace",
"snek5000_cbox.solver.Simul.create_default_params",
"shutil.rmtree",
"snek5000_cbox.solver.Simul"
] | [((186, 215), 'snek5000_cbox.solver.Simul.create_default_params', 'Simul.create_default_params', ([], {}), '()\n', (213, 215), False, 'from snek5000_cbox.solver import Simul\n'), ((836, 859), 'numpy.linspace', 'np.linspace', (['(0)', 'Lx', 'n1d'], {}), '(0, Lx, n1d)\n', (847, 859), True, 'import numpy as np\n'), ((912,... |
# Provides GUI to label duplicate images in dataset and saves labels to pickle files
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
import time
import pickle
import sys
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()
... | [
"pickle.dump",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.close",
"matplotlib.widgets.Button",
"matplotlib.pyplot.draw",
"numpy.sort",
"pickle.load",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.subplots",
"tensorflow.keras.datasets.fashion_mnist.load_data"
] | [((275, 318), 'tensorflow.keras.datasets.fashion_mnist.load_data', 'tf.keras.datasets.fashion_mnist.load_data', ([], {}), '()\n', (316, 318), True, 'import tensorflow as tf\n'), ((434, 450), 'numpy.sort', 'np.sort', (['y_train'], {}), '(y_train)\n', (441, 450), True, 'import numpy as np\n'), ((533, 548), 'numpy.sort', ... |
#!/usr/bin/env python
import numpy as np
import csv
from matplotlib import pyplot as plt
def calculate_odometry_velocity(currentPos, velL, velR, deltaT):
""" Calculate odometry based on velocity readings
Args:
currentPos (np.mat): current position
velL (float): velocity of left wheel
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"csv.DictReader",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.mat"
] | [((721, 745), 'numpy.mat', 'np.mat', (['[[velR], [velL]]'], {}), '([[velR], [velL]])\n', (727, 745), True, 'import numpy as np\n'), ((1466, 1551), 'numpy.mat', 'np.mat', (['[[deltaR / ticksPerRev * np.pi * d], [deltaL / ticksPerRev * np.pi * d]]'], {}), '([[deltaR / ticksPerRev * np.pi * d], [deltaL / ticksPerRev * np.... |
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the CC-by-NC license found in the
# LICENSE file in the root directory of this source tree.
#
import argparse
import datetime
import numpy as np
import time
import torch
import torch.backends.cudnn as cudnn
import... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"utils.unfreeze_model_weights",
"utils.freeze_policy_net",
"video_dataset_config.get_dataset_config",
"json.dumps",
"pathlib.Path",
"torch.nn.CosineSimilarity",
"torch.device",
"losses.DeepMutualLoss",
"losses.ONELoss",
"os.path.join",
"timm.lo... | [((1145, 1200), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (1168, 1200), False, 'import warnings\n'), ((1299, 1377), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""DeiT training and evaluation script"""'], {'a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2015-2018 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: <NAME> (<EMAIL>)
#
# Permission is hereby granted, free of charge, t... | [
"os.unlink",
"os.stat",
"os.removedirs",
"numpy.dtype",
"tempfile.gettempdir",
"time.time",
"pyFAI.io.HDF5Writer",
"tempfile.mkdtemp",
"pyFAI.third_party.argparse.ArgumentParser",
"numpy.random.random",
"os.path.join",
"numpy.random.random_integers",
"logging.getLogger"
] | [((1623, 1654), 'logging.getLogger', 'logging.getLogger', (['"""Bench_hdf5"""'], {}), "('Bench_hdf5')\n", (1640, 1654), False, 'import logging\n'), ((1761, 1796), 'pyFAI.third_party.argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (1775, 1796), False, 'from pyFAI.... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"pandas.DataFrame",
"absl.testing.absltest.main",
"pandas.testing.assert_frame_equal",
"gps_building_blocks.ml.statistical_inference.models.InferenceElasticNet",
"gps_building_blocks.ml.statistical_inference.data_preparation.InferenceData",
"gps_building_blocks.ml.statistical_inference.models.InferenceLin... | [((942, 2328), 'numpy.array', 'np.array', (['[[0.49671415, -0.1382643, 0.64768854, 1.52302986, -0.23415337], [-\n 0.23413696, 1.57921282, 0.76743473, -0.46947439, 0.54256004], [-\n 0.46341769, -0.46572975, 0.24196227, -1.91328024, -1.72491783], [-\n 0.56228753, -1.01283112, 0.31424733, -0.90802408, -1.4123037]... |
# Copyright 2020 <NAME>, <NAME>, <NAME>, <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... | [
"var_sep.data.taxibj.TaxiBJ.make_datasets",
"var_sep.train.train",
"numpy.random.randint",
"torch.device",
"os.path.join",
"var_sep.data.chairs.Chairs",
"var_sep.networks.utils.ConstantS",
"var_sep.networks.factory.get_resnet",
"torch.cuda.amp.autocast",
"torch.utils.data.DataLoader",
"var_sep.o... | [((1367, 1386), 'var_sep.options.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (1384, 1386), False, 'from var_sep.options import parser\n'), ((1693, 1720), 'numpy.random.randint', 'np.random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (1710, 1720), True, 'import numpy as np\n'), ((1725, 1748), 'tor... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 7 23:58:52 2019
@author: Sachin
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('data.csv')
df = dataset.iloc[:,:-1].values
X = pd.DataFrame(df)
x = X.loc[:,X.columns != 1]
y = X.loc[:,1]
fo... | [
"pandas.read_csv",
"numpy.random.random",
"numpy.array",
"pandas.DataFrame"
] | [((181, 204), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (192, 204), True, 'import pandas as pd\n'), ((244, 260), 'pandas.DataFrame', 'pd.DataFrame', (['df'], {}), '(df)\n', (256, 260), True, 'import pandas as pd\n'), ((559, 577), 'numpy.array', 'np.array', (['[10, 10]'], {}), '([10, ... |
# Copyright (c) 2021, <NAME>, FUNLab, Xiamen University
# All rights reserved.
# Generate terrain (site specific) data
import os
import argparse
import random
import numpy as np
import scipy.io as sio
from pprint import pprint
def gen_BMs(world_len: int, mesh_len: int, N: int, save_dir: str, seed=123):
'''
G... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"scipy.io.savemat",
"numpy.ones",
"random.seed",
"pprint.pprint",
"os.path.join"
] | [((370, 387), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (381, 387), False, 'import random\n'), ((392, 412), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (406, 412), True, 'import numpy as np\n'), ((919, 948), 'os.path.join', 'os.path.join', (['save_dir', 'fname'], {}), '(save_dir, ... |
import unittest
import mindspore
import numpy as np
from mindspore import Tensor
from elmo.modules.highway import HighWay
from mindspore import context
class TestHighWay(unittest.TestCase):
def test_highway(self):
context.set_context(mode=context.PYNATIVE_MODE, device_target='Ascend')
inputs = Tens... | [
"mindspore.context.set_context",
"elmo.modules.highway.HighWay",
"numpy.random.randn"
] | [((227, 298), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.PYNATIVE_MODE', 'device_target': '"""Ascend"""'}), "(mode=context.PYNATIVE_MODE, device_target='Ascend')\n", (246, 298), False, 'from mindspore import context\n'), ((384, 398), 'elmo.modules.highway.HighWay', 'HighWay', (['(10)... |
"""
PCA(SVD) analysis for glbase expression objects.
"""
from operator import itemgetter
import numpy
import numpy.linalg as LA
import matplotlib.pyplot as plot
import matplotlib.patches
from mpl_toolkits.mplot3d import Axes3D, art3d # not always available?
import scipy.cluster.vq
from . import config
from .draw ... | [
"mpl_toolkits.mplot3d.Axes3D",
"numpy.allclose",
"numpy.linalg.svd",
"numpy.array",
"numpy.mean",
"numpy.dot",
"operator.itemgetter",
"numpy.diag"
] | [((1774, 1817), 'numpy.array', 'numpy.array', (['parent.serialisedArrayDataList'], {}), '(parent.serialisedArrayDataList)\n', (1785, 1817), False, 'import numpy\n'), ((3093, 3114), 'numpy.array', 'numpy.array', (['self.__u'], {}), '(self.__u)\n', (3104, 3114), False, 'import numpy\n'), ((4495, 4543), 'numpy.array', 'nu... |
#!/usr/bin/env python
from distutils.util import strtobool
import numpy as np
import argparse
from generic.preprocess_data.extract_img_raw import extract_raw
from generic.data_provider.image_loader import RawImageBuilder
from clevr.data_provider.clevr_dataset import CLEVRDataset
from clevr.data_provider.clevr_batchif... | [
"generic.preprocess_data.extract_img_raw.extract_raw",
"argparse.ArgumentParser",
"distutils.util.strtobool",
"generic.data_provider.image_loader.RawImageBuilder",
"numpy.array"
] | [((359, 405), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Feature extractor! """'], {}), "('Feature extractor! ')\n", (382, 405), False, 'import argparse\n'), ((1405, 1503), 'generic.data_provider.image_loader.RawImageBuilder', 'RawImageBuilder', (['args.img_dir'], {'height': 'args.img_size', 'width': '... |
"""基本的な VAE を提供するモジュール.
Notes:
- reference:
`https://github.com/bhpfelix/Variational-Autoencoder-PyTorch/blob/master/src/vanila_vae.py`
"""
# default packages
import logging
import typing as t
# third party packages
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# l... | [
"torch.nn.UpsamplingNearest2d",
"torch.randn_like",
"torch.nn.Tanh",
"torch.nn.functional.mse_loss",
"torch.nn.Conv2d",
"torch.exp",
"torch.nn.BatchNorm2d",
"numpy.array",
"torch.nn.Linear",
"torch.nn.LeakyReLU",
"logging.getLogger"
] | [((335, 362), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (352, 362), False, 'import logging\n'), ((1624, 1657), 'numpy.array', 'np.array', (['[32, 64, 128, 256, 512]'], {}), '([32, 64, 128, 256, 512])\n', (1632, 1657), True, 'import numpy as np\n'), ((2502, 2546), 'torch.nn.Linear', '... |
import torch
import copy
import scipy.stats
import numpy as np
from collections import OrderedDict
from tqdm import trange
from torch import nn
from utils import initiate_model
class ProtoTrainer:
"""Trainer module for MAML
"""
def __init__(self, args, model, device):
"""Initiate MAML trainer
... | [
"torch.mean",
"copy.deepcopy",
"torch.stack",
"tqdm.trange",
"numpy.asarray",
"torch.nn.CrossEntropyLoss",
"utils.initiate_model"
] | [((847, 881), 'utils.initiate_model', 'initiate_model', (['model', 'self.device'], {}), '(model, self.device)\n', (861, 881), False, 'from utils import initiate_model\n'), ((907, 934), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (932, 934), False, 'import torch\n'), ((1761, 1779), 'torch... |
# ***************************************************************
# Copyright (c) 2020 Jittor. Authors: <NAME> <<EMAIL>>. All Rights Reserved.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ************************************************... | [
"unittest.main",
"numpy.sum",
"numpy.logical_and",
"jittor.random",
"numpy.where",
"jittor.where"
] | [((1910, 1925), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1923, 1925), False, 'import unittest\n'), ((523, 545), 'jittor.where', 'jt.where', (['[0, 1, 0, 1]'], {}), '([0, 1, 0, 1])\n', (531, 545), True, 'import jittor as jt\n'), ((649, 681), 'jittor.where', 'jt.where', (['[[0, 0, 1], [1, 0, 0]]'], {}), '([[0... |
# encoding=utf-8
import numpy as np
from sklearn import preprocessing
from src.config import feature_list
from src.feature.iku import spell_error, Mean_sentence_depth_level, essay_length
from src.feature.wangdq import word_vector_similarity_train, word_vector_similarity_test, \
mean_clause, pos_gram_train, pos_gra... | [
"util.util.pos_tagging",
"src.feature.xiaoyl.bag_of_words_train",
"src.feature.wangdq.vocab_size",
"sklearn.preprocessing.StandardScaler",
"src.feature.xiaoyl.word_bigram_test",
"src.feature.xiaoyl.get_sentence_length",
"src.feature.wangdq.mean_clause",
"src.feature.xiaoyl.word_length",
"src.feature... | [((1294, 1317), 'util.util.pos_tagging', 'pos_tagging', (['tokens_set'], {}), '(tokens_set)\n', (1305, 1317), False, 'from util.util import pos_tagging\n'), ((2696, 2742), 'numpy.concatenate', 'np.concatenate', (['(feature, new_feature)'], {'axis': '(1)'}), '((feature, new_feature), axis=1)\n', (2710, 2742), True, 'imp... |
import deepdiff
import numpy as np
from scipy import spatial as spat
from pyfar import Coordinates
from copy import deepcopy
class SphericalVoronoi(spat.SphericalVoronoi):
"""
Voronoi diagrams on the surface of a sphere. Note that
:py:func:`calculate_sph_voronoi_weights` can be used directly, if only the
... | [
"copy.deepcopy",
"numpy.sum",
"deepdiff.DeepDiff",
"pyfar.Coordinates",
"numpy.round"
] | [((1542, 1556), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (1550, 1556), False, 'from copy import deepcopy\n'), ((1974, 2083), 'pyfar.Coordinates', 'Coordinates', (["obj_dict['points'][:, 0]", "obj_dict['points'][:, 1]", "obj_dict['points'][:, 2]"], {'domain': '"""cart"""'}), "(obj_dict['points'][:, 0], o... |
# Fix paths for imports to work in unit tests ----------------
if __name__ == "__main__":
from _fix_paths import fix_paths
fix_paths()
# ------------------------------------------------------------
# Load libraries ---------------------------------------------
import numpy as np
# --------------------... | [
"numpy.asarray",
"_fix_paths.fix_paths",
"numpy.random.choice"
] | [((137, 148), '_fix_paths.fix_paths', 'fix_paths', ([], {}), '()\n', (146, 148), False, 'from _fix_paths import fix_paths\n'), ((991, 1013), 'numpy.random.choice', 'np.random.choice', (['temp'], {}), '(temp)\n', (1007, 1013), True, 'import numpy as np\n'), ((2146, 2161), 'numpy.asarray', 'np.asarray', (['arr'], {}), '(... |
from io import BytesIO
import matplotlib.pyplot as plt
import base64
import matplotlib
from astropy import utils, io
import numpy as np
from astropy.wcs import WCS
from astropy.visualization.wcsaxes import WCSAxes
import matplotlib.colors as mcolors
from astropy.visualization import (MinMaxInterval, SqrtStretch,ImageNo... | [
"io.BytesIO",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.imshow",
"astropy.io.fits.getdata",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"numpy.isnan",
"matplotlib.pyplot.colorbar",
"matplotlib.use",
... | [((331, 352), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (345, 352), False, 'import matplotlib\n'), ((457, 466), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (464, 466), False, 'from io import BytesIO\n'), ((475, 484), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (482, 484), True, 'imp... |
from copy import deepcopy
import numpy as np
import torch
import torchvision
from PIL import Image
from torch.utils.data import DataLoader
from src.dataset import factory as dataset_factory
from src.roar import roar_core
from src.utils.sysutils import get_cores_count
class CompoundImageFolderDataset(torch.utils.dat... | [
"copy.deepcopy",
"src.roar.roar_core.remove",
"torchvision.datasets.ImageFolder",
"numpy.array",
"src.dataset.factory.get_dataset_class",
"torchvision.transforms.Normalize",
"src.utils.sysutils.get_cores_count",
"torchvision.transforms.ToTensor"
] | [((1733, 1793), 'src.dataset.factory.get_dataset_class', 'dataset_factory.get_dataset_class', ([], {'dataset_name': 'dataset_name'}), '(dataset_name=dataset_name)\n', (1766, 1793), True, 'from src.dataset import factory as dataset_factory\n'), ((2288, 2345), 'torchvision.transforms.Normalize', 'torchvision.transforms.N... |
import subprocess
import time
import numpy as np
def get_instances():
"""returns array of instance names, array of corresponding n"""
instance_data = np.genfromtxt('m2s_nqubits.csv', delimiter=',', skip_header=1, dtype=str) # can add _noGT_nondg on end
return instance_data[:, 0], instance_data[:, 1... | [
"subprocess.run",
"time.process_time",
"numpy.savetxt",
"numpy.zeros",
"numpy.genfromtxt"
] | [((160, 233), 'numpy.genfromtxt', 'np.genfromtxt', (['"""m2s_nqubits.csv"""'], {'delimiter': '""","""', 'skip_header': '(1)', 'dtype': 'str'}), "('m2s_nqubits.csv', delimiter=',', skip_header=1, dtype=str)\n", (173, 233), True, 'import numpy as np\n'), ((462, 485), 'numpy.zeros', 'np.zeros', (['num_instances'], {}), '(... |
import numpy as np
import sys, os
import pprint
sys.path.append(os.path.dirname(sys.path[0]))
from lib.envs.gridworld import GridworldEnv
from ValueIteration import value_iteration
env = GridworldEnv()
pp = pprint.PrettyPrinter(indent=2)
random_policy = np.ones([env.nS, env.nA]) / env.nA
policy, v = value_iteration... | [
"lib.envs.gridworld.GridworldEnv",
"numpy.argmax",
"os.path.dirname",
"numpy.ones",
"pprint.PrettyPrinter",
"numpy.array",
"ValueIteration.value_iteration",
"numpy.testing.assert_array_almost_equal"
] | [((189, 203), 'lib.envs.gridworld.GridworldEnv', 'GridworldEnv', ([], {}), '()\n', (201, 203), False, 'from lib.envs.gridworld import GridworldEnv\n'), ((209, 239), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(2)'}), '(indent=2)\n', (229, 239), False, 'import pprint\n'), ((305, 325), 'ValueIteratio... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 16 13:12:53 2021
@author: emgordy
"""
# SST grids for the persistence model (basically making sure the time lines up, that's why we load in the OHC, it's a whole lotta checking)
import xarray as xr
import glob
import numpy as np
import matplotlib.... | [
"numpy.asarray",
"xarray.open_dataset",
"numpy.isnan",
"xarray.Dataset",
"numpy.shape",
"numpy.arange",
"numpy.reshape",
"glob.glob"
] | [((585, 611), 'xarray.open_dataset', 'xr.open_dataset', (['ohc700str'], {}), '(ohc700str)\n', (600, 611), True, 'import xarray as xr\n'), ((622, 652), 'numpy.asarray', 'np.asarray', (['ohc700_dataset.ohc'], {}), '(ohc700_dataset.ohc)\n', (632, 652), True, 'import numpy as np\n'), ((865, 888), 'xarray.open_dataset', 'xr... |
# -*- coding: utf-8 -*-
"""
对图片进行边缘检测;
添加滑动条,可自由调整阈值上下限。
"""
import cv2
import numpy as np
def nothing(x):
pass
cv2.namedWindow('Canny', 0)
# 创建滑动条
cv2.createTrackbar('min_val', 'Canny', 0, 255, nothing)
cv2.createTrackbar('max_val', 'Canny', 0, 255, nothing)
img = cv2.imread('Tree.jpg', 0)
# 高斯滤波去噪
img = cv2... | [
"cv2.createTrackbar",
"cv2.GaussianBlur",
"cv2.Canny",
"cv2.waitKey",
"cv2.imshow",
"numpy.hstack",
"cv2.imread",
"cv2.getTrackbarPos",
"cv2.destroyAllWindows",
"cv2.namedWindow"
] | [((120, 147), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Canny"""', '(0)'], {}), "('Canny', 0)\n", (135, 147), False, 'import cv2\n'), ((156, 211), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""min_val"""', '"""Canny"""', '(0)', '(255)', 'nothing'], {}), "('min_val', 'Canny', 0, 255, nothing)\n", (174, 211), False... |
import numpy as np
#import scipy.io as spio
# Utility functions to initialize the problem
from Grid.GridProcessing import Grid
from Shapes.ShapesFunctions import *
from hjComp6D import HJComp
# Specify the file that includes dynamic systems
from dynamics.DubinsCar6D_HRI import *
# Plot options
from plot_options import... | [
"numpy.shape",
"numpy.linspace",
"hjComp6D.HJComp"
] | [((866, 902), 'numpy.linspace', 'np.linspace', (['(5)', '(20)', '(8)'], {'endpoint': '(True)'}), '(5, 20, 8, endpoint=True)\n', (877, 902), True, 'import numpy as np\n'), ((917, 955), 'numpy.linspace', 'np.linspace', (['(-2)', '(30)', '(17)'], {'endpoint': '(True)'}), '(-2, 30, 17, endpoint=True)\n', (928, 955), True, ... |
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"utils.KEYPOINT_DICT.keys",
"cv2.copyMakeBorder",
"numpy.expand_dims",
"numpy.amax",
"tflite_runtime.interpreter.Interpreter",
"os.path.splitext",
"numpy.array",
"utils.KEYPOINT_DICT.values",
"numpy.squeeze",
"cv2.resize"
] | [((1666, 1694), 'os.path.splitext', 'os.path.splitext', (['model_name'], {}), '(model_name)\n', (1682, 1694), False, 'import os\n'), ((1783, 1832), 'tflite_runtime.interpreter.Interpreter', 'Interpreter', ([], {'model_path': 'model_name', 'num_threads': '(4)'}), '(model_path=model_name, num_threads=4)\n', (1794, 1832),... |
from turtle import st
import gym
import numpy as np
import matplotlib.pyplot as plt
import random
import pandas as pd
from tqdm import tqdm
import os
class BaiscStockEnv(gym.Env):
def __init__(self, dir:str, window_size:int, mode:str = 'csv', do_fast:bool = True):
self.files_name = os.listdir(dir)
... | [
"tqdm.tqdm",
"matplotlib.pyplot.show",
"random.randint",
"matplotlib.pyplot.plot",
"numpy.random.choice",
"os.path.join",
"os.listdir"
] | [((297, 312), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (307, 312), False, 'import os\n'), ((626, 647), 'tqdm.tqdm', 'tqdm', (['self.files_name'], {}), '(self.files_name)\n', (630, 647), False, 'from tqdm import tqdm\n'), ((2004, 2068), 'random.randint', 'random.randint', (['(0)', '(self.current_file.shape[... |
import unittest
import os
import numpy as np
from CGMFtk import histories as fh
class TestGammaProperties(unittest.TestCase):
# nubarg calculations
def test_nubarg_for_events(self):
"""
test the nubargtot function calculation (average gammas per event)
"""
nread = 10
#... | [
"unittest.main",
"numpy.max",
"numpy.mean",
"CGMFtk.histories.Histories"
] | [((2422, 2437), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2435, 2437), False, 'import unittest\n'), ((383, 502), 'CGMFtk.histories.Histories', 'fh.Histories', (['"""../../utils/cgmf/tests/u235nf-18MeV-events/histories.cgmf.parallel.0.reference"""'], {'nevents': 'nread'}), "(\n '../../utils/cgmf/tests/u235... |
import numpy as np
from ndindex import IntegerArray
class TimeIntegerArray:
def setup(self):
self.ia = IntegerArray([[1, 2], [2, -1]]*100)
def time_constructor_list(self):
IntegerArray([[1, 2], [2, -1]]*100)
def time_constructor_array(self):
IntegerArray(self.ia.array)
def ti... | [
"numpy.array",
"ndindex.IntegerArray"
] | [((116, 153), 'ndindex.IntegerArray', 'IntegerArray', (['([[1, 2], [2, -1]] * 100)'], {}), '([[1, 2], [2, -1]] * 100)\n', (128, 153), False, 'from ndindex import IntegerArray\n'), ((198, 235), 'ndindex.IntegerArray', 'IntegerArray', (['([[1, 2], [2, -1]] * 100)'], {}), '([[1, 2], [2, -1]] * 100)\n', (210, 235), False, ... |
import csv
from tempfile import NamedTemporaryFile
import shutil
import numpy as np
""" import csv
with open('/ws2122-lspm/upload_eventlog/data.csv', newline='') as f:
reader = csv.reader(f)
row1 = next(reader) # gets the first line
for row in reader:
print(row) # prints rows 2 and onward
... | [
"csv.reader",
"numpy.array"
] | [((898, 928), 'numpy.array', 'np.array', (['list_of_column_names'], {}), '(list_of_column_names)\n', (906, 928), True, 'import numpy as np\n'), ((476, 511), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (486, 511), False, 'import csv\n')] |
import numpy as np
from .coordinates import RegularCoords, SeparatedCoords, UnstructuredCoords
from .field import Field
from .cartesian_grid import CartesianGrid
def make_uniform_grid(dims, extent, center=0, has_center=False):
'''Create a uniformly-spaced :class:`Grid` of a certain shape and size.
Parameters
-----... | [
"numpy.zeros",
"numpy.ones",
"numpy.mod",
"numpy.max",
"numpy.array",
"numpy.arange",
"numpy.round",
"numpy.sqrt"
] | [((4234, 4248), 'numpy.array', 'np.array', (['dims'], {}), '(dims)\n', (4242, 4248), True, 'import numpy as np\n'), ((2457, 2468), 'numpy.max', 'np.max', (['fov'], {}), '(fov)\n', (2463, 2468), True, 'import numpy as np\n'), ((3324, 3335), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (3332, 3335), True, 'import n... |
'''
Class for all visualizations. Pass in Interact class, which contains all history variables
related to agent's actions, state and reward observations.
This file is currently designed to work with Binary_Maze.py
'''
import numpy as np
import matplotlib.pyplot as plt
import os, sys, glob
import math
import pickle
cl... | [
"matplotlib.pyplot.xlim",
"os.mkdir",
"matplotlib.pyplot.pcolor",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.close",
"matplotlib.pyplot.scatter",
"os.path.exists",
"numpy.zeros",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"... | [((7221, 7247), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(4, 3)'}), '(figsize=(4, 3))\n', (7231, 7247), True, 'import matplotlib.pyplot as plt\n'), ((7260, 7282), 'numpy.arange', 'np.arange', (['nb_episodes'], {}), '(nb_episodes)\n', (7269, 7282), True, 'import numpy as np\n'), ((7291, 7348), 'matplo... |
import numpy as np
from enum import Enum
from collections import defaultdict
import networking
# adapted from https://github.com/soong-construction/dirt-rally-time-recorder/blob/master/setup-dr2.sql
# max_rpm, idle_rpm, max_gears, car_name
car_data = [
# H1 FWD
[7330.3826904296875, 837.7580261230469, 4.0, 'M... | [
"numpy.abs",
"numpy.argmin",
"collections.defaultdict",
"numpy.array",
"numpy.all"
] | [((18171, 18188), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (18182, 18188), False, 'from collections import defaultdict\n'), ((19213, 19255), 'numpy.array', 'np.array', (['[t[0] for t in track_candidates]'], {}), '([t[0] for t in track_candidates])\n', (19221, 19255), True, 'import numpy as ... |
import numpy as np
__all__ = ['NFWParam']
class NFWParam(object):
"""
class which contains a halo model parameters dependent on cosmology for NFW profile
all distances are given in comoving coordinates
"""
rhoc = 2.77536627e11 # critical density [h^2 M_sun Mpc^-3]
def rhoc_z(self, z):
... | [
"numpy.log",
"scipy.interpolate.InterpolatedUnivariateSpline",
"numpy.linspace"
] | [((1992, 2017), 'numpy.linspace', 'np.linspace', (['(0.1)', '(10)', '(100)'], {}), '(0.1, 10, 100)\n', (2003, 2017), True, 'import numpy as np\n'), ((2140, 2238), 'scipy.interpolate.InterpolatedUnivariateSpline', 'interpolate.InterpolatedUnivariateSpline', (['rho0_array', 'c_array'], {'w': 'None', 'bbox': '[None, None]... |
import argparse
import os, h5py
import numpy as np
import context
#from context import EcalEnergyGan
from EcalEnergyGan import discriminator as build_discriminator
from EcalEnergyGan import generator as build_generator
def get_parser():
parser = argparse.ArgumentParser(
description='Generate 3D images',
... | [
"numpy.random.uniform",
"EcalEnergyGan.generator",
"h5py.File",
"numpy.random.seed",
"numpy.multiply",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.random.normal",
"numpy.linspace",
"numpy.squeeze"
] | [((1867, 1883), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (1881, 1883), True, 'import numpy as np\n'), ((1888, 1944), 'EcalEnergyGan.generator', 'build_generator', (['latent_space'], {'return_intermediate': '(False)'}), '(latent_space, return_intermediate=False)\n', (1903, 1944), True, 'from EcalEnergyGa... |
'''
AUTHORS:
NORSTRÖM, ARVID 19940206-3193,
HISELIUS, LEO 19940221-4192
'''
from collections import namedtuple
import numpy as np
import gym
import torch
import matplotlib.pyplot as plt
from tqdm import trange
from DQN_agent import RandomAgent, Agent
from DQN_agent import ExperienceReplayBuffer
import torch.opt... | [
"numpy.save",
"gym.make",
"torch.load",
"PPO_problem.LunarLander",
"numpy.arange",
"numpy.diag",
"torch.no_grad",
"torch.tensor"
] | [((401, 461), 'PPO_problem.LunarLander', 'LunarLander', (['(0.99)', '(3000)', '(300)', '[8, 64, 64, 4]', '[8, 64, 64, 4]'], {}), '(0.99, 3000, 300, [8, 64, 64, 4], [8, 64, 64, 4])\n', (412, 461), False, 'from PPO_problem import LunarLander\n'), ((472, 506), 'torch.load', 'torch.load', (['"""models/best_actor.pt"""'], {... |
import numpy as np
r1 = 4
r2 = 7
r3 = np.lcm(r1, r2) # finding lowest common multiple of 4 and 7
print(r3)
arr = np.array([3, 6, 12])
x = np.lcm.reduce(arr) # finding lcm for elements of array
print(x)
arr = np.arange(5, 16) # getting elements from 5 to 15 for finding lcm
x = ... | [
"numpy.arange",
"numpy.lcm.reduce",
"numpy.array",
"numpy.lcm"
] | [((39, 53), 'numpy.lcm', 'np.lcm', (['r1', 'r2'], {}), '(r1, r2)\n', (45, 53), True, 'import numpy as np\n'), ((131, 151), 'numpy.array', 'np.array', (['[3, 6, 12]'], {}), '([3, 6, 12])\n', (139, 151), True, 'import numpy as np\n'), ((156, 174), 'numpy.lcm.reduce', 'np.lcm.reduce', (['arr'], {}), '(arr)\n', (169, 174),... |
import numpy as np
def prune_data(dataset,npoints):
'''
for a given dataset, selects a subset of npoints samples through feature distance mapping
'''
l_param = 1.5
comparison_distance = 10.0
# Select first point randomly
sample_point = np.random.randint(low=0,high=np.shape(dataset)[0])
... | [
"numpy.abs",
"numpy.maximum",
"numpy.subtract",
"numpy.shape",
"numpy.concatenate"
] | [((372, 389), 'numpy.shape', 'np.shape', (['dataset'], {}), '(dataset)\n', (380, 389), True, 'import numpy as np\n'), ((497, 514), 'numpy.shape', 'np.shape', (['dataset'], {}), '(dataset)\n', (505, 514), True, 'import numpy as np\n'), ((804, 855), 'numpy.subtract', 'np.subtract', (['sample_dataset[:, :-1]', 'sample[:, ... |
import numpy as np
import numcalc_methods
def get_matrix(nmx):
init_augmx = np.zeros((nmx, nmx + 1))
init_solvec = np.zeros(nmx)
print("Enter augmented matrix coefficients: ")
for i in range(nmx):
for j in range(nmx + 1):
init_augmx[i][j] = float(input(f"a[{str(i)}][{str(j)}] = "... | [
"numpy.zeros",
"numcalc_methods.gauss_elimination"
] | [((83, 107), 'numpy.zeros', 'np.zeros', (['(nmx, nmx + 1)'], {}), '((nmx, nmx + 1))\n', (91, 107), True, 'import numpy as np\n'), ((126, 139), 'numpy.zeros', 'np.zeros', (['nmx'], {}), '(nmx)\n', (134, 139), True, 'import numpy as np\n'), ((586, 649), 'numcalc_methods.gauss_elimination', 'numcalc_methods.gauss_eliminat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 15:32:08 2021
@author: twguest
"""
import numpy as np
from matplotlib import pyplot as plt
from felpy.utils.vis_utils import plot_fill_between
DATA_DIR = "/media/twguest/shared/data/nkb_sensing/beam_center_r0046.npy"
def load_data(DATA_DIR):... | [
"numpy.load",
"numpy.delete",
"numpy.moveaxis"
] | [((342, 359), 'numpy.load', 'np.load', (['DATA_DIR'], {}), '(DATA_DIR)\n', (349, 359), True, 'import numpy as np\n'), ((1760, 1788), 'numpy.delete', 'np.delete', (['data', '(24)'], {'axis': '(-2)'}), '(data, 24, axis=-2)\n', (1769, 1788), True, 'import numpy as np\n'), ((1202, 1225), 'numpy.moveaxis', 'np.moveaxis', ([... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.