code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# ****************************************************************************** # Copyright 2017-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
[ "os.path.exists", "ngraph.util.persist.fetch_file", "numpy.asarray", "ngraph.util.persist.valid_path_append", "numpy.concatenate" ]
[((2037, 2079), 'ngraph.util.persist.valid_path_append', 'valid_path_append', (['self.path', '""""""', 'filename'], {}), "(self.path, '', filename)\n", (2054, 2079), False, 'from ngraph.util.persist import valid_path_append, fetch_file\n'), ((2680, 2749), 'numpy.asarray', 'np.asarray', (['[self.token_to_index[t] for t ...
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions.normal import Normal import numpy as np __all__= ['actor_net'] class ActorNet(nn.Module): def __init__(self, args): super(ActorNet, self).__init__() state_dim = args.state_dim action_dim = args.z_d...
[ "torch.tanh", "torch.distributions.normal.Normal", "numpy.log", "torch.exp", "torch.nn.functional.softplus", "torch.nn.Linear" ]
[((402, 427), 'torch.nn.Linear', 'nn.Linear', (['state_dim', '(400)'], {}), '(state_dim, 400)\n', (411, 427), True, 'import torch.nn as nn\n'), ((453, 472), 'torch.nn.Linear', 'nn.Linear', (['(400)', '(400)'], {}), '(400, 400)\n', (462, 472), True, 'import torch.nn as nn\n'), ((502, 521), 'torch.nn.Linear', 'nn.Linear'...
import colorsys import numpy as np import cv2 from unidecode import unidecode # Inspired by https://github.com/hhk7734/tensorflow-yolov4 _MAX_CLASSES = 14 * 6 _HSV = [(x / _MAX_CLASSES, 1.0, 1.0) for x in range(int(_MAX_CLASSES * 1.2))] _COLORS = [colorsys.hsv_to_rgb(*x) for x in _HSV] _COLORS = [(int(x[0] ...
[ "cv2.rectangle", "numpy.copy", "numpy.unique", "colorsys.hsv_to_rgb", "numpy.array", "unidecode.unidecode", "cv2.getTextSize" ]
[((259, 282), 'colorsys.hsv_to_rgb', 'colorsys.hsv_to_rgb', (['*x'], {}), '(*x)\n', (278, 282), False, 'import colorsys\n'), ((882, 896), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (889, 896), True, 'import numpy as np\n'), ((1722, 1736), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (1729, 1736), ...
import random import math import copy import numpy as np import logging import collections import pyximport # pyximport.install() pyximport.install(setup_args={ # "script_args":["--compiler=mingw32"], "include_dirs":np.get_include()}, # relo...
[ "numpy.ravel", "numpy.array", "numpy.empty", "numpy.get_include" ]
[((623, 657), 'numpy.ravel', 'np.ravel', (['input_pattern'], {'order': '"""A"""'}), "(input_pattern, order='A')\n", (631, 657), True, 'import numpy as np\n'), ((1206, 1253), 'numpy.array', 'np.array', (['self.dendrite_mf_map'], {'dtype': 'np.uint16'}), '(self.dendrite_mf_map, dtype=np.uint16)\n', (1214, 1253), True, 'i...
import sys,os,pickle,argparse import numpy as np from models import * from sklearn.model_selection import KFold #deprecated #from sklearn.cross_validation import KFold from scrape import * import argparse from torch.multiprocessing import Pool from random import shuffle def fit(X,Y,model,criterion= nn.NLLLoss(),epochs...
[ "os.path.exists", "os.listdir", "argparse.ArgumentParser", "os.makedirs", "os.getcwd", "numpy.exp", "os.path.dirname", "torch.multiprocessing.Pool", "numpy.sum", "sklearn.model_selection.KFold", "numpy.set_printoptions" ]
[((2908, 2939), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'K', 'shuffle': '(True)'}), '(n_splits=K, shuffle=True)\n', (2913, 2939), False, 'from sklearn.model_selection import KFold\n'), ((4653, 4679), 'os.path.dirname', 'os.path.dirname', (['file_path'], {}), '(file_path)\n', (4668, 4679), False, 'im...
from setuptools import setup, Extension from setuptools import dist dist.Distribution().fetch_build_eggs(['numpy>=1.18.2', 'cython>=0.29.16']) import numpy as np # To compile and install locally run "python setup.py build_ext --inplace" # To install library to Python site-packages run "python setup.py build_ext inst...
[ "setuptools.dist.Distribution", "setuptools.setup", "numpy.get_include" ]
[((594, 821), 'setuptools.setup', 'setup', ([], {'name': '"""pycocotools"""', 'packages': "['pycocotools']", 'package_dir': "{'pycocotools': 'pycocotools'}", 'install_requires': "['setuptools>=18.0', 'cython>=0.27.3', 'matplotlib>=2.1.0']", 'version': '"""2.0"""', 'ext_modules': 'ext_modules'}), "(name='pycocotools', p...
# from ripe.atlas.sagan import Result from ripe.atlas.cousteau import Probe import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from collections import Counter from sklearn.mixture import GaussianMixture import urllib.request import json import pickle import decimal from Ollivie...
[ "numpy.sqrt", "numpy.column_stack", "numpy.argsort", "numpy.array", "numpy.arctan2", "pandas.read_pickle", "numpy.mean", "numpy.sort", "matplotlib.pyplot.plot", "OllivierRicci.ricciCurvature", "numpy.linalg.lstsq", "matplotlib.pyplot.scatter", "pandas.DataFrame", "ripe.atlas.cousteau.Probe...
[((368, 523), 'seaborn.set_context', 'sns.set_context', (['"""paper"""'], {'rc': "{'xtick.labelsize': 10, 'figure.figsize': (250, 250), 'ytick.labelsize': 10,\n 'axes.labelsize': 10, 'legend.labelsize': 15}"}), "('paper', rc={'xtick.labelsize': 10, 'figure.figsize': (250,\n 250), 'ytick.labelsize': 10, 'axes.labe...
import config as cfg import numpy as np import pandas as pd import warnings from sklearn.metrics import confusion_matrix, accuracy_score, classification_report, multilabel_confusion_matrix def print_conf_mat(true_labels, preds): cm = confusion_matrix(true_labels, preds) I = pd.Index(['True Negative', 'True ...
[ "pandas.Index", "numpy.sum", "pandas.DataFrame", "sklearn.metrics.multilabel_confusion_matrix", "warnings.filterwarnings", "sklearn.metrics.confusion_matrix" ]
[((242, 278), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['true_labels', 'preds'], {}), '(true_labels, preds)\n', (258, 278), False, 'from sklearn.metrics import confusion_matrix, accuracy_score, classification_report, multilabel_confusion_matrix\n'), ((287, 344), 'pandas.Index', 'pd.Index', (["['True Neg...
import itertools import numpy as np import torch from torchvision.utils import make_grid import plac from pathlib import Path from .data.loader import encode_batch_of_pairs, load_processed_train_batch from .utils.plot import plt, cm, sns from .utils.loading import load_model_skeleton CMAPS = { "velocity": cm.vi...
[ "numpy.abs", "numpy.savez", "torch.ones_like", "pathlib.Path", "torch.load", "plac.Annotation", "plac.call", "numpy.array", "torch.no_grad", "torchvision.utils.make_grid", "torch.cat", "torch.ones" ]
[((413, 428), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (426, 428), False, 'import torch\n'), ((2592, 2607), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2605, 2607), False, 'import torch\n'), ((4893, 4908), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4906, 4908), False, 'import torch\n'), ((...
# Copyright 2018 Google LLC. 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 applicable law or a...
[ "tensorflow.compat.v1.reshape", "tensorflow_compression.python.ops.padding_ops.same_padding_for_kernel", "numpy.zeros", "numpy.nonzero", "tensorflow.compat.v1.test.main" ]
[((2694, 2708), 'tensorflow.compat.v1.test.main', 'tf.test.main', ([], {}), '()\n', (2706, 2708), True, 'import tensorflow.compat.v1 as tf\n'), ((1054, 1088), 'numpy.zeros', 'np.zeros', (['ishape'], {'dtype': 'np.float32'}), '(ishape, dtype=np.float32)\n', (1062, 1088), True, 'import numpy as np\n'), ((1827, 1861), 'nu...
# -*- coding: utf-8 -*- """ Utility functions for welly. :copyright: 2016 Agile Geoscience :license: Apache 2.0 """ from __future__ import division import re import glob import numpy as np import matplotlib.pyplot as plt def deprecated(instructions): """ Flags a method as deprecated. This decorator can be ...
[ "numpy.abs", "numpy.convolve", "numpy.log10", "numpy.ones", "glob.iglob", "numpy.amin", "numpy.where", "numpy.floor", "numpy.append", "numpy.array", "numpy.zeros", "numpy.exp", "numpy.isnan", "numpy.sum", "numpy.cumsum" ]
[((7674, 7692), 'numpy.append', 'np.append', (['(0)', 'tops'], {}), '(0, tops)\n', (7683, 7692), True, 'import numpy as np\n'), ((9050, 9070), 'numpy.floor', 'np.floor', (['(length / 2)'], {}), '(length / 2)\n', (9058, 9070), True, 'import numpy as np\n'), ((9203, 9233), 'numpy.zeros', 'np.zeros', (['(a.shape[0] + 2 * ...
import matplotlib.pyplot as plt import numpy as np LOG_FILE = './log.txt' def get_log(log): f = open(log, 'r') lines = f.readlines() f.close() loss = [] for line in lines: loss.append(float(line.strip('\n').split(' ')[1])) return loss def plot_iteration(log): loss = get_log(log) plt.plot(range(len(loss))...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((329, 352), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Iteration"""'], {}), "('Iteration')\n", (339, 352), True, 'import matplotlib.pyplot as plt\n'), ((354, 372), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Loss"""'], {}), "('Loss')\n", (364, 372), True, 'import matplotlib.pyplot as plt\n'), ((374, 401), 'm...
# %% import library import pathlib import sys from glob import glob import numpy as np import pandas as pd # import residual_node2vec as rv import utils_link_pred from scipy import sparse from sklearn.metrics import roc_auc_score from tqdm import tqdm # Helper Functions def get_params(filename): params = pathli...
[ "pandas.read_csv", "pathlib.Path", "scipy.sparse.load_npz", "pandas.merge", "sklearn.metrics.roc_auc_score", "utils_link_pred.fit_glove_bias", "numpy.sum", "numpy.zeros", "numpy.isnan", "pandas.DataFrame", "numpy.maximum", "numpy.load", "pandas.concat", "glob.glob" ]
[((1643, 1693), 'pandas.merge', 'pd.merge', (['emb_file_table', 'edge_file_table'], {'on': 'cols'}), '(emb_file_table, edge_file_table, on=cols)\n', (1651, 1693), True, 'import pandas as pd\n'), ((1787, 1832), 'pandas.merge', 'pd.merge', (['file_table', 'net_file_table'], {'on': 'cols'}), '(file_table, net_file_table, ...
""" Base class for Filters, Factors and Classifiers """ from abc import ABCMeta, abstractproperty from bisect import insort from collections import Mapping from weakref import WeakValueDictionary from numpy import ( array, dtype as dtype_class, ndarray, searchsorted, ) from six import with_metaclass f...
[ "zipline.errors.UnsupportedDType", "weakref.WeakValueDictionary", "zipline.errors.NonSliceableTerm", "zipline.errors.NonWindowSafeInput", "numpy.searchsorted", "zipline.lib.adjusted_array.can_represent_dtype", "numpy.array", "zipline.utils.numpy_utils.default_missing_value_for_dtype", "zipline.utils...
[((1286, 1317), 'six.with_metaclass', 'with_metaclass', (['ABCMeta', 'object'], {}), '(ABCMeta, object)\n', (1300, 1317), False, 'from six import with_metaclass\n'), ((1883, 1904), 'weakref.WeakValueDictionary', 'WeakValueDictionary', ([], {}), '()\n', (1902, 1904), False, 'from weakref import WeakValueDictionary\n'), ...
# Copyright 2016 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...
[ "tensorflow.python.framework.ops.reset_default_graph", "tensorflow.python.debug.wrappers.framework.OnRunEndResponse", "tensorflow.python.debug.wrappers.framework.BaseDebugWrapperSession.__init__", "numpy.array", "tensorflow.python.platform.googletest.main", "tensorflow.python.ops.variables.Variable", "t...
[((4999, 5060), 'tensorflow.python.framework.test_util.run_v1_only', 'test_util.run_v1_only', (['"""Sessions are not available in TF 2.x"""'], {}), "('Sessions are not available in TF 2.x')\n", (5020, 5060), False, 'from tensorflow.python.framework import test_util\n'), ((16725, 16742), 'tensorflow.python.platform.goog...
import torch import torchvision import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import matplotlib.pyplot as plt import numpy as np class TorchModel(nn.Module): def __init__(self): super(TorchModel, self).__init__() self.conv1 = nn.Conv2d(3, 128, 3, stride=2) self.pool = nn...
[ "numpy.mean", "torch.nn.CrossEntropyLoss", "torch.load", "torch.nn.Conv2d", "torch.nn.MaxPool2d", "torch.nn.Linear" ]
[((271, 301), 'torch.nn.Conv2d', 'nn.Conv2d', (['(3)', '(128)', '(3)'], {'stride': '(2)'}), '(3, 128, 3, stride=2)\n', (280, 301), True, 'import torch.nn as nn\n'), ((318, 336), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2)', '(2)'], {}), '(2, 2)\n', (330, 336), True, 'import torch.nn as nn\n'), ((353, 385), 'torch.nn.C...
# coding=utf-8 # !/usr/bin/python3.6 ## Please use python 3.6 """ __synopsis__ : Calculates cosine similarity of support sets with target sample. __description__ : Calculates cosine similarity of support sets with target sample. __project__ : MNXC __author__ : <NAME> <<EMAIL>> __version__ : "0.1" __dat...
[ "torch.mul", "torch.stack", "torch.from_numpy", "logger.logger.logger.debug", "numpy.array", "torch.tensor", "torch.add", "logger.logger.logger.info" ]
[((4805, 4896), 'numpy.array', 'np.array', (['[[[1.0, 0.4], [1.0, 1.0], [0.0, 1.5]], [[1.0, 0.6], [1.0, 1.0], [0.0, 1.5]]]'], {}), '([[[1.0, 0.4], [1.0, 1.0], [0.0, 1.5]], [[1.0, 0.6], [1.0, 1.0], [\n 0.0, 1.5]]])\n', (4813, 4896), True, 'import numpy as np\n'), ((5004, 5027), 'torch.from_numpy', 'torch.from_numpy',...
import os import numpy as np import argparse import pandas as pd from openpyxl import load_workbook def init_args(): # Set argparse parser = argparse.ArgumentParser(description='Process data') parser.add_argument('--file_name', metavar='file', default='./output/lattice_ec/deit_bas...
[ "numpy.loadtxt", "pandas.ExcelWriter", "pandas.DataFrame", "argparse.ArgumentParser" ]
[((151, 202), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process data"""'}), "(description='Process data')\n", (174, 202), False, 'import argparse\n'), ((654, 685), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['args.excel_name'], {}), '(args.excel_name)\n', (668, 685), True, 'import pan...
import os import time import h5py import math import pickle import numpy as np import pandas as pd import cv2 import threading import queue import matplotlib.pyplot as plt import seaborn as sns from scipy import misc, ndimage from sklearn import model_selection, preprocessing, metrics from sklearn.utils import shuffle ...
[ "keras.losses.binary_crossentropy", "keras.backend.sum", "pandas.read_csv", "keras.backend.flatten", "numpy.array", "cv2.warpPerspective", "matplotlib.pyplot.imshow", "os.listdir", "numpy.random.random", "numpy.math.cos", "numpy.asarray", "numpy.dot", "keras.models.Model", "keras.callbacks...
[((823, 859), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""Train_RGB"""'], {}), "(DATA_PATH, 'Train_RGB')\n", (835, 859), False, 'import os\n'), ((872, 907), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""Test_RGB"""'], {}), "(DATA_PATH, 'Test_RGB')\n", (884, 907), False, 'import os\n'), ((927, 966), 'os.path...
# Copyright 2021 Sony Group Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
[ "nnabla_rl.model_trainers.model_trainer.rnn_support", "nnabla_rl.utils.misc.create_variables", "nnabla.functions.clip_by_value", "nnabla.Variable.from_numpy_array", "numpy.broadcast_to" ]
[((3511, 3558), 'numpy.broadcast_to', 'np.broadcast_to', ([], {'array': 'z', 'shape': '(batch_size, N)'}), '(array=z, shape=(batch_size, N))\n', (3526, 3558), True, 'import numpy as np\n'), ((3571, 3602), 'nnabla.Variable.from_numpy_array', 'nn.Variable.from_numpy_array', (['z'], {}), '(z)\n', (3599, 3602), True, 'impo...
""" radtraq.plotting.self_consistency --------------------- Module for plotting self-consistency histograms """ import numpy as np import matplotlib.pyplot as plt import scipy from radtraq.utils.dataset_utils import get_height_variable_name def plot_self_consistency(obj, variables=None, thresh=None): """ ...
[ "scipy.stats.linregress", "numpy.ceil", "radtraq.utils.dataset_utils.get_height_variable_name", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.subplots" ]
[((1190, 1240), 'radtraq.utils.dataset_utils.get_height_variable_name', 'get_height_variable_name', (['new_obj'], {'variable': 'var[0]'}), '(new_obj, variable=var[0])\n', (1214, 1240), False, 'from radtraq.utils.dataset_utils import get_height_variable_name\n'), ((1571, 1620), 'matplotlib.pyplot.subplots', 'plt.subplot...
# Copyright 2021 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.ops.operations.Squeeze", "mindspore.ops.ReLU", "math.sqrt", "numpy.array", "mindspore.ops.Pad", "mindspore.ops.Concat", "mindspore.ops.Ones", "numpy.arange", "mindspore.ops.operations.NMSWithMask", "mindspore.ops.GatherNd", "mindspore.ops.Sort", "mindspore.ops.OneHot", "mindspore....
[((2122, 2295), 'mindspore.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels'], {'kernel_size': 'kernel_size', 'stride': 'stride', 'padding': 'padding', 'pad_mode': 'pad_mode', 'weight_init': 'weights', 'has_bias': '(True)', 'bias_init': 'biass'}), '(in_channels, out_channels, kernel_size=kernel_size, stride=stri...
import cv2 import numpy as np import pickle import constants from PIL import Image, ImageTk from tkinter import messagebox import time import util cam = None imgCrop = hist = None pic = vstream = raw = None def build_squares(img): x, y, w, h = 450, 180, 13, 13 d = 10 imgCrop = None x1, y1 = x, y for i in range(1...
[ "cv2.rectangle", "cv2.normalize", "cv2.filter2D", "cv2.destroyAllWindows", "cv2.calcHist", "cv2.calcBackProject", "cv2.threshold", "cv2.medianBlur", "numpy.vstack", "constants.lblTypeCalibrateStream.after", "PIL.ImageTk.PhotoImage", "cv2.merge", "numpy.any", "cv2.cvtColor", "constants.lb...
[((517, 603), 'cv2.rectangle', 'cv2.rectangle', (['img', '(x1, y1)', '(x1 + (w + d) * 5, y1 + (h + d) * 5)', '(0, 255, 0)', '(2)'], {}), '(img, (x1, y1), (x1 + (w + d) * 5, y1 + (h + d) * 5), (0, 255,\n 0), 2)\n', (530, 603), False, 'import cv2\n'), ((657, 676), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(1)'], {}),...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ## ############################################### # # deconvolucion.py # Gestiona el proceso de deconvolucion # # Autor: <NAME> # License: MIT # # ## ############################################### from time import time from time import sleep import os import sys impor...
[ "numpy.uint8", "src.imageFunctions.normalizar", "src.imageFunctions.istiffRGB", "os.path.realpath", "numpy.zeros", "skimage.io.imread", "src.interfaceTools.printMessage", "numpy.uint16", "time.time" ]
[((626, 660), 'numpy.zeros', 'np.zeros', (['img.shape'], {'dtype': '"""int16"""'}), "(img.shape, dtype='int16')\n", (634, 660), True, 'import numpy as np\n'), ((1963, 1982), 'numpy.zeros', 'np.zeros', (['img.shape'], {}), '(img.shape)\n', (1971, 1982), True, 'import numpy as np\n'), ((2286, 2320), 'numpy.zeros', 'np.ze...
# Copyright 2020 MONAI Consortium # 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, s...
[ "monai.losses.DiceLoss", "monai.utils.misc.first", "monai.transforms.EnsureType", "torch.cuda.is_available", "monai.transforms.LoadImaged", "monai.data.create_test_image_3d", "monai.visualize.plot_2d_or_3d_image", "monai.config.print_config", "torch.utils.tensorboard.SummaryWriter", "monai.network...
[((1267, 1294), 'monai.config.print_config', 'monai.config.print_config', ([], {}), '()\n', (1292, 1294), False, 'import monai\n'), ((1299, 1357), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (1318, 1357), False, 'imp...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
[ "logging.getLogger", "numpy.sqrt", "numpy.array", "scipy.stats.chi2.ppf", "numpy.sin", "numpy.max", "numpy.real", "numpy.linspace", "numpy.min", "qiskit.QuantumCircuit", "qiskit.aqua.utils.validation.validate_min", "numpy.abs", "scipy.stats.norm.ppf", "numpy.cos", "qiskit.aqua.AquaError"...
[((1005, 1032), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1022, 1032), False, 'import logging\n'), ((2970, 3029), 'qiskit.aqua.utils.validation.validate_min', 'validate_min', (['"""num_oracle_circuits"""', 'num_oracle_circuits', '(1)'], {}), "('num_oracle_circuits', num_oracle_circu...
""" File: list_manipulation.py Project: analysis Last Modified: 2022-7-2 Created Date: 2022-7-2 Copyright (c) 2021 Author: AHMA project (Univ Rennes, CNRS, Inria, IRISA) """ ################################################################################ import argparse import numpy as np imp...
[ "logging.basicConfig", "tabulate.tabulate", "random.shuffle", "argparse.ArgumentParser", "numpy.unique", "sklearn.model_selection.train_test_split", "numpy.where", "tqdm.tqdm", "numpy.array", "glob.glob", "os.path.basename", "numpy.concatenate", "os.stat", "numpy.load", "numpy.save" ]
[((1868, 1906), 'numpy.load', 'np.load', (['path_lists'], {'allow_pickle': '(True)'}), '(path_lists, allow_pickle=True)\n', (1875, 1906), True, 'import numpy as np\n'), ((2805, 2924), 'numpy.save', 'np.save', (['path_lists', '[x_train_filelist, x_val_filelist, x_test_filelist, y_train, y_val, y_test]'], {'allow_pickle'...
#!/usr/bin/env python2 # # Example to compare the faces in two images. # <NAME> # 2015/09/29 # # Copyright 2015-2016 Carnegie Mellon University # # 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 ...
[ "openface.TorchNeuralNet", "cv2.imread", "argparse.ArgumentParser", "os.path.join", "itertools.combinations", "os.path.realpath", "numpy.dot", "openface.AlignDlib", "cv2.cvtColor", "time.time", "numpy.set_printoptions" ]
[((734, 745), 'time.time', 'time.time', ([], {}), '()\n', (743, 745), False, 'import time\n'), ((829, 861), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (848, 861), True, 'import numpy as np\n'), ((950, 987), 'os.path.join', 'os.path.join', (['fileDir', '""".."""', '""...
from collections import OrderedDict import cv2 import numpy as np import torch import torch.backends.cudnn as cudnn from torch.autograd import Variable from models.text_detect.craft import CRAFT from backend.text_detect.craft_utils import ( adjustResultCoordinates, getDetBoxes, ) from backend.text_detect.imgp...
[ "collections.OrderedDict", "models.text_detect.craft.CRAFT", "backend.text_detect.craft_utils.getDetBoxes", "torch.load", "torch.nn.DataParallel", "backend.text_detect.craft_utils.adjustResultCoordinates", "torch.from_numpy", "backend.text_detect.imgproc.resize_aspect_ratio", "numpy.array", "backe...
[((1720, 1733), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1731, 1733), False, 'from collections import OrderedDict\n'), ((2133, 2229), 'backend.text_detect.imgproc.resize_aspect_ratio', 'resize_aspect_ratio', (['image', 'canvas_size'], {'interpolation': 'cv2.INTER_LINEAR', 'mag_ratio': 'mag_ratio'}),...
import torch import glob, os from models.unet import UNet_clean from collections import OrderedDict from dess_utils.data_utils import imagesc import numpy as np import pandas as pd def get_dcm(dcm_path): l = glob.glob(dcm_path + '*') l.sort() dcm = [] for x in l: x = np.load(x) dcm.app...
[ "models.unet.UNet_clean", "pandas.read_csv", "torch.load", "numpy.argmax", "os.path.isdir", "os.mkdir", "numpy.concatenate", "numpy.save", "numpy.expand_dims", "numpy.load", "glob.glob" ]
[((214, 239), 'glob.glob', 'glob.glob', (["(dcm_path + '*')"], {}), "(dcm_path + '*')\n", (223, 239), False, 'import glob, os\n'), ((356, 378), 'numpy.concatenate', 'np.concatenate', (['dcm', '(0)'], {}), '(dcm, 0)\n', (370, 378), True, 'import numpy as np\n'), ((826, 918), 'models.unet.UNet_clean', 'UNet_clean', ([], ...
import unittest import numpy as np from chainer.backends import cuda from chainer import testing from chainer.testing import attr from chainercv.experimental.links.model.fcis import ProposalTargetCreator from chainercv.utils import generate_random_bbox from chainercv.utils import mask_to_bbox class TestProposalTa...
[ "chainercv.experimental.links.model.fcis.ProposalTargetCreator", "chainercv.utils.generate_random_bbox", "chainer.testing.run_module", "chainer.backends.cuda.get_array_module", "numpy.random.randint", "chainer.backends.cuda.to_cpu", "numpy.sum", "numpy.random.uniform", "chainercv.utils.mask_to_bbox"...
[((2788, 2826), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (2806, 2826), False, 'from chainer import testing\n'), ((542, 588), 'chainercv.utils.generate_random_bbox', 'generate_random_bbox', (['n_roi', 'img_size', '(16)', '(250)'], {}), '(n_roi, img_siz...
from aerosandbox.numpy import sin, cos, linalg from aerosandbox.numpy.array import array import numpy as _onp from typing import Union, List def rotation_matrix_2D( angle, as_array: bool = True, ): """ Gives the 2D rotation matrix associated with a counterclockwise rotation about an angle. ...
[ "numpy.eye", "aerosandbox.numpy.linalg.det", "aerosandbox.numpy.array.array", "aerosandbox.numpy.sin", "aerosandbox.numpy.cos" ]
[((533, 543), 'aerosandbox.numpy.sin', 'sin', (['angle'], {}), '(angle)\n', (536, 543), False, 'from aerosandbox.numpy import sin, cos, linalg\n'), ((552, 562), 'aerosandbox.numpy.cos', 'cos', (['angle'], {}), '(angle)\n', (555, 562), False, 'from aerosandbox.numpy import sin, cos, linalg\n'), ((1831, 1841), 'aerosandb...
from PIL import Image, ImageDraw, ImageFont import numpy as np def DrawRegion(text, font, fontcolor, shadowcolor, shadow_radius = 1, spread = 0) : # we first get size of region we need to draw text text_width, text_height = font.getsize(text) text_height += 2 * shadow_radius + 2 * spread text_width += 2 * shadow_...
[ "numpy.array", "PIL.Image.new", "PIL.ImageDraw.Draw" ]
[((386, 440), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(text_width, text_height)', '(0, 0, 0)'], {}), "('RGB', (text_width, text_height), (0, 0, 0))\n", (395, 440), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((453, 497), 'PIL.Image.new', 'Image.new', (['"""L"""', '(text_width, text_height)', '(0)'], ...
# Copyright 2021 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
[ "cirq.LineQubit.range", "cirq.resolve_parameters_once", "time.perf_counter", "cirq.experiments.xeb_simulation.simulate_2q_xeb_circuits", "pytest.mark.parametrize", "cirq.Simulator", "numpy.sum", "pytest.raises", "multiprocessing.Pool", "pandas.DataFrame", "pandas.testing.assert_frame_equal", "...
[((4296, 4350), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""multiprocess"""', '(True, False)'], {}), "('multiprocess', (True, False))\n", (4319, 4350), False, 'import pytest\n'), ((940, 963), 'cirq.LineQubit.range', 'cirq.LineQubit.range', (['(2)'], {}), '(2)\n', (960, 963), False, 'import cirq\n'), ((1...
import numpy from skimage.data import camera from dexp.processing.interpolation.warp import warp from dexp.utils.backends import Backend, CupyBackend, NumpyBackend from dexp.utils.timeit import timeit def demo_warp_2d_numpy(): try: with NumpyBackend(): _demo_warp_2d() except NotImplemente...
[ "napari.Viewer", "napari.gui_qt", "dexp.utils.backends.CupyBackend", "dexp.utils.backends.Backend.to_numpy", "dexp.utils.backends.NumpyBackend", "numpy.random.uniform", "skimage.data.camera", "dexp.utils.timeit.timeit", "dexp.processing.interpolation.warp.warp" ]
[((723, 810), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'low': '(-magnitude)', 'high': '(+magnitude)', 'size': '((grid_size,) * 2 + (2,))'}), '(low=-magnitude, high=+magnitude, size=(grid_size,) * 2 +\n (2,))\n', (743, 810), False, 'import numpy\n'), ((817, 831), 'dexp.utils.timeit.timeit', 'timeit', (['...
# Copyright 2020 The TensorFlow Recommenders Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
[ "tempfile.TemporaryDirectory", "numpy.arange", "os.path.join", "tensorflow_recommenders.layers.ann.BruteForce", "tensorflow.test.main", "tensorflow.keras.models.load_model", "tensorflow.constant", "numpy.random.RandomState" ]
[((1658, 1672), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (1670, 1672), True, 'import tensorflow as tf\n'), ((888, 913), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (909, 913), True, 'import numpy as np\n'), ((1128, 1167), 'tensorflow_recommenders.layers.ann.BruteForce...
# !/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import import os import numpy from dcase_util.datasets import AcousticSceneDataset from dcase_util.containers import MetaDataContainer, MetaDataItem from dcase_util.utils import Path class DCASE2013_Scenes_DevelopmentSe...
[ "sklearn.model_selection.StratifiedShuffleSplit", "dcase_util.utils.Path", "os.path.join", "dcase_util.containers.MetaDataContainer", "os.path.split", "os.path.isfile", "numpy.array" ]
[((2931, 2950), 'dcase_util.containers.MetaDataContainer', 'MetaDataContainer', ([], {}), '()\n', (2948, 2950), False, 'from dcase_util.containers import MetaDataContainer, MetaDataItem\n'), ((4434, 4452), 'numpy.array', 'numpy.array', (['files'], {}), '(files)\n', (4445, 4452), False, 'import numpy\n'), ((4543, 4637),...
from headers import * from colorama import Fore, Back, Style import numpy as np class paddle: def __init__(self): self.__pos_x=74 self.__pos_y=40 self.__vel_x=0 self.__vel_y=0 self.__body = np.zeros((3, 15), dtype='<U20') self.__empty = np.zeros((4, 15), dtype='<U20') self.__empty[:] = ' ' self.__x...
[ "numpy.array", "numpy.zeros", "numpy.tile" ]
[((204, 235), 'numpy.zeros', 'np.zeros', (['(3, 15)'], {'dtype': '"""<U20"""'}), "((3, 15), dtype='<U20')\n", (212, 235), True, 'import numpy as np\n'), ((254, 285), 'numpy.zeros', 'np.zeros', (['(4, 15)'], {'dtype': '"""<U20"""'}), "((4, 15), dtype='<U20')\n", (262, 285), True, 'import numpy as np\n'), ((321, 336), 'n...
# Copyright 2020 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...
[ "tensorflow.python.ipu.config.IPUConfig", "tensorflow.compiler.plugin.poplar.tests.test_utils.test_uses_ipus", "tensorflow.python.distribute.distribution_strategy_context.get_replica_context", "tensorflow.python.ipu.ops.replication_ops.replication_index", "tensorflow.python.ipu.ipu_infeed_queue.IPUInfeedQue...
[((1531, 1560), 'tensorflow.compiler.plugin.poplar.tests.test_utils.test_uses_ipus', 'tu.test_uses_ipus', ([], {'num_ipus': '(2)'}), '(num_ipus=2)\n', (1548, 1560), True, 'from tensorflow.compiler.plugin.poplar.tests import test_utils as tu\n'), ((2558, 2587), 'tensorflow.compiler.plugin.poplar.tests.test_utils.test_us...
import cv2 import numpy as np from torch.utils.data import Dataset from torch.utils.data import sampler class CSVDataset(Dataset): def __init__(self, df, transform): self.df = df self.transform = transform def __getitem__(self, index): row = self.df.iloc[index] img = cv2.imre...
[ "cv2.imread", "numpy.random.permutation" ]
[((312, 338), 'cv2.imread', 'cv2.imread', (["row['ImageID']"], {}), "(row['ImageID'])\n", (322, 338), False, 'import cv2\n'), ((1099, 1138), 'numpy.random.permutation', 'np.random.permutation', (['self.num_samples'], {}), '(self.num_samples)\n', (1120, 1138), True, 'import numpy as np\n')]
# Copyright 2017 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...
[ "keras.testing_infra.test_utils.should_run_eagerly", "tensorflow.compat.v2.nest.map_structure", "keras.engine.base_layer_utils.call_context", "tensorflow.compat.v2.einsum", "numpy.array", "keras.backend.dot", "tensorflow.compat.v2.ones_like", "tensorflow.compat.v2.executing_eagerly", "keras.Model", ...
[((1424, 1475), 'collections.namedtuple', 'collections.namedtuple', (['"""NestedInput"""', "['t1', 't2']"], {}), "('NestedInput', ['t1', 't2'])\n", (1446, 1475), False, 'import collections\n'), ((1490, 1541), 'collections.namedtuple', 'collections.namedtuple', (['"""NestedState"""', "['s1', 's2']"], {}), "('NestedState...
# import packages from matplotlib.colors import ListedColormap import numpy as np # generate my colors from matplotlib.colors import ListedColormap # red Red_colors = np.ones([256,4]) Red_colors[:,1] = np.linspace(1,0,256) Red_colors[:,2] = np.linspace(1,0,256) myReds = ListedColormap(Red_colors) myReds_r = ListedColo...
[ "numpy.ones", "numpy.flipud", "matplotlib.colors.ListedColormap", "numpy.array", "numpy.linspace", "numpy.zeros", "numpy.nanmax", "numpy.nanmin" ]
[((168, 185), 'numpy.ones', 'np.ones', (['[256, 4]'], {}), '([256, 4])\n', (175, 185), True, 'import numpy as np\n'), ((203, 225), 'numpy.linspace', 'np.linspace', (['(1)', '(0)', '(256)'], {}), '(1, 0, 256)\n', (214, 225), True, 'import numpy as np\n'), ((242, 264), 'numpy.linspace', 'np.linspace', (['(1)', '(0)', '(2...
from threading import Lock import numpy as np import sklearn import tensorflow as tf from tensorflow.keras.models import model_from_json import tensorflow.keras.backend as K class LocalModel(object): """ Local Model Each Client has its own model. The Weights will be sent to the Server. The Server upd...
[ "tensorflow.Graph", "numpy.mean", "tensorflow.keras.models.model_from_json", "threading.Lock", "sklearn.utils.shuffle", "tensorflow.Session", "numpy.array", "numpy.save" ]
[((1485, 1491), 'threading.Lock', 'Lock', ([], {}), '()\n', (1489, 1491), False, 'from threading import Lock\n'), ((1513, 1523), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1521, 1523), True, 'import tensorflow as tf\n'), ((2207, 2242), 'numpy.array', 'np.array', (["data_collected['x_train']"], {}), "(data_colle...
#!/usr/bin/env python3 import sys import numpy as np input_map = np.array([np.char.array(line.strip().encode('us-ascii'), unicode=False).view('u1', np.ndarray) - ord('0') for line in sys.stdin if line]) h, w = input_map.shape heightmap = np.zeros((h+2, w+2), dtype='u1') heightmap += 9 main_map = heightmap[1:-1,1:-1] ...
[ "numpy.sum", "numpy.zeros" ]
[((240, 276), 'numpy.zeros', 'np.zeros', (['(h + 2, w + 2)'], {'dtype': '"""u1"""'}), "((h + 2, w + 2), dtype='u1')\n", (248, 276), True, 'import numpy as np\n'), ((513, 541), 'numpy.sum', 'np.sum', (['(main_map[is_low] + 1)'], {}), '(main_map[is_low] + 1)\n', (519, 541), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ This is a process class whose evolve_state method is called at each timestep. An instance of MRNAExport is initialized once per Simulation with the State as input. Only the state 'mRNAs' is modified in this process. At each timestep, for an mRNA strand x, for all x, evolve_state reads the ...
[ "numpy.where", "numpy.size", "numpy.random.rand", "numpy.arange" ]
[((5093, 5167), 'numpy.arange', 'np.arange', (['self.NUM_OF_REV_REQ_FOR_EXPORT', '(self.MAX_REV_PER_TRANSCRIPT + 1)'], {}), '(self.NUM_OF_REV_REQ_FOR_EXPORT, self.MAX_REV_PER_TRANSCRIPT + 1)\n', (5102, 5167), True, 'import numpy as np\n'), ((5451, 5540), 'numpy.arange', 'np.arange', (['(self.NUM_OF_REV_REQ_FOR_EXPORT *...
def find_max_difference(datafile1, datafile2): '''A function to find absolute differences between mass fraction in two datafiles. Inputs: datafile1 = ts file to be compared datafile2 = second ts file to be compared Output: largest = list of n largest differences ...
[ "numpy.abs", "numpy.multiply", "numpy.linalg.norm", "numpy.subtract", "numpy.argsort", "heapq.nlargest", "read_ts_file.read_ts_file", "read_ts_file.build_element_symbol", "heapq.nsmallest", "read_ts_file.build_isotope_symbol", "numpy.cumsum", "numpy.shape", "numpy.arange" ]
[((750, 777), 'read_ts_file.read_ts_file', 'rtf.read_ts_file', (['datafile1'], {}), '(datafile1)\n', (766, 777), True, 'import read_ts_file as rtf\n'), ((1236, 1263), 'read_ts_file.read_ts_file', 'rtf.read_ts_file', (['datafile2'], {}), '(datafile2)\n', (1252, 1263), True, 'import read_ts_file as rtf\n'), ((1340, 1366)...
# Exercise 6.26 # Author: <NAME> import numpy as np import matplotlib.pyplot as plt def wave_packet(x, t): return np.exp(-(x - 3 * t) ** 2) * np.sin(3 * np.pi * (x - t)) xlist = np.linspace(-4, 4, 1001) tlist = (-0.85, 0, 0.85) for t in (-0.85, 0, 0.85): ylist = wave_packet(xlist, t) plt.plot(xlist, yli...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.exp", "numpy.linspace", "numpy.sin", "matplotlib.pyplot.title" ]
[((186, 210), 'numpy.linspace', 'np.linspace', (['(-4)', '(4)', '(1001)'], {}), '(-4, 4, 1001)\n', (197, 210), True, 'import numpy as np\n'), ((301, 323), 'matplotlib.pyplot.plot', 'plt.plot', (['xlist', 'ylist'], {}), '(xlist, ylist)\n', (309, 323), True, 'import matplotlib.pyplot as plt\n'), ((328, 343), 'matplotlib....
from __future__ import annotations import numpy as np import pytest from pytest_lazyfixture import lazy_fixture import stk from ...case_data import CaseData @pytest.fixture( params=( lazy_fixture('cage1'), lazy_fixture('cage2'), lazy_fixture('cage3'), ), ) def case_data(request): ...
[ "stk.cage.UnaligningVertex", "pytest_lazyfixture.lazy_fixture", "numpy.array", "pytest.fixture", "stk.Vertex" ]
[((1138, 1185), 'pytest.fixture', 'pytest.fixture', ([], {'params': '([0, 0, 0], [1, 2, -20])'}), '(params=([0, 0, 0], [1, 2, -20]))\n', (1152, 1185), False, 'import pytest\n'), ((1295, 1422), 'pytest.fixture', 'pytest.fixture', ([], {'params': '(stk.cage.LinearVertex, stk.cage.NonLinearVertex, stk.cage.UnaligningVerte...
import argparse import os import sys import random import numpy as np import scipy import torch import torch.optim as optim import torch.multiprocessing as mp import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data from params import Params import pickle impo...
[ "statistics.stdev", "matplotlib.pyplot.ylabel", "utils.Counter", "torch.from_numpy", "torch.min", "torch.cuda.is_available", "torch.sum", "sys.path.append", "gym.make", "model.ActorCriticNet", "os.path.exists", "torch.multiprocessing.Queue", "torch.mean", "params.Params", "matplotlib.pyp...
[((812, 879), 'sys.path.append', 'sys.path.append', (['"""/home/zhaoming/Documents/dev/gym/gym/envs/mujoco"""'], {}), "('/home/zhaoming/Documents/dev/gym/gym/envs/mujoco')\n", (827, 879), False, 'import sys\n'), ((2559, 2578), 'torch.sum', 'torch.sum', (['a'], {'dim': '(1)'}), '(a, dim=1)\n', (2568, 2578), False, 'impo...
import os import os.path as osp import torch from PIL import Image import numpy as np import json from maskrcnn_benchmark.config import cfg from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.boxlist_ops import boxlist_nms import pickle class Flickr(torch.utils.data.Datas...
[ "PIL.Image.open", "pickle.load", "os.path.join", "maskrcnn_benchmark.structures.bounding_box.BoxList", "numpy.array", "maskrcnn_benchmark.structures.boxlist_ops.boxlist_nms", "torch.FloatTensor" ]
[((1875, 1910), 'torch.FloatTensor', 'torch.FloatTensor', (['self.vocab_embed'], {}), '(self.vocab_embed)\n', (1892, 1910), False, 'import torch\n'), ((2765, 2783), 'numpy.array', 'np.array', (['gt_boxes'], {}), '(gt_boxes)\n', (2773, 2783), True, 'import numpy as np\n'), ((3197, 3241), 'os.path.join', 'os.path.join', ...
""" Encapsulates the functionality for representing and operating on the chess environment. """ import copy import enum from logging import getLogger import chess.pgn import numpy as np logger = getLogger(__name__) # noinspection PyArgumentList Winner = enum.Enum("Winner", "black white draw") # input planes # noins...
[ "logging.getLogger", "numpy.asarray", "numpy.tanh", "numpy.zeros", "numpy.vstack", "enum.Enum", "numpy.full", "copy.copy" ]
[((197, 216), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (206, 216), False, 'from logging import getLogger\n'), ((257, 296), 'enum.Enum', 'enum.Enum', (['"""Winner"""', '"""black white draw"""'], {}), "('Winner', 'black white draw')\n", (266, 296), False, 'import enum\n'), ((5127, 5141), 'num...
import matplotlib.pyplot as plt import numpy as np from beprof import profile import os data_sets = {} profiles = [] values = [] files = os.listdir('.') plot_data_files = [] positions, weights = np.loadtxt("result.dat", delimiter=";", usecols=(0, 1), unpack=True) print(positions, weights) weights = weights[::-1] fo...
[ "os.listdir", "matplotlib.pyplot.xlim", "beprof.profile.Profile", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.title", "numpy.loadtxt", "matplotlib.pyplot.show" ]
[((139, 154), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (149, 154), False, 'import os\n'), ((198, 266), 'numpy.loadtxt', 'np.loadtxt', (['"""result.dat"""'], {'delimiter': '""";"""', 'usecols': '(0, 1)', 'unpack': '(True)'}), "('result.dat', delimiter=';', usecols=(0, 1), unpack=True)\n", (208, 266), Tr...
import cv2 import numpy as np from .image import Image RADIUS = 1324 CENTER_X = 2184 CENTER_Y = 1456 class CloudCoverage: """Cloud cover index calculation related functions. """ @classmethod def get_mask(cls, image): """Return the transparency mask for the pixels outside of de image c...
[ "numpy.all", "numpy.sqrt", "numpy.ones" ]
[((988, 1038), 'numpy.sqrt', 'np.sqrt', (['((x - CENTER_X) ** 2 + (y - CENTER_Y) ** 2)'], {}), '((x - CENTER_X) ** 2 + (y - CENTER_Y) ** 2)\n', (995, 1038), True, 'import numpy as np\n'), ((3363, 3402), 'numpy.all', 'np.all', (['(image == [0, 0, 0, 255])'], {'axis': '(2)'}), '(image == [0, 0, 0, 255], axis=2)\n', (3369...
#!/usr/bin/env python import seaborn as sns import random import operator as op import numpy as np data = {} names = [('human', 174, 5), ('ape', 150, 10)] for name, mu, sigma in names: trial = [] trial_length = random.randint(200, 500) for _ in range(trial_length): trial.append(random.randint(0, ...
[ "numpy.random.normal", "operator.itemgetter", "seaborn.violinplot", "numpy.percentile", "seaborn.plt.yticks", "random.randint", "seaborn.plt.savefig" ]
[((813, 873), 'seaborn.violinplot', 'sns.violinplot', ([], {'data': 'sorted_vals', 'orient': '"""h"""', 'palette': '"""Set2"""'}), "(data=sorted_vals, orient='h', palette='Set2')\n", (827, 873), True, 'import seaborn as sns\n'), ((969, 1002), 'seaborn.plt.savefig', 'sns.plt.savefig', (['"""violinplot.png"""'], {}), "('...
import numpy as np def reorder_south2north(data, lat): # if latitude is not indexed from SP to NP, then reorder if lat[0]>lat[1]: lat = lat[::-1] data = data[::-1] return data, lat def get_itczposition_adam(pr, lat, latboundary, dlat): pr, lat = reorder_south2north(pr, lat) # inte...
[ "numpy.abs", "numpy.sum", "numpy.zeros", "numpy.cos", "numpy.interp", "numpy.nansum", "numpy.arange" ]
[((364, 406), 'numpy.arange', 'np.arange', (['(-latboundary)', 'latboundary', 'dlat'], {}), '(-latboundary, latboundary, dlat)\n', (373, 406), True, 'import numpy as np\n'), ((419, 443), 'numpy.interp', 'np.interp', (['lati', 'lat', 'pr'], {}), '(lati, lat, pr)\n', (428, 443), True, 'import numpy as np\n'), ((456, 482)...
#!/usr/bin/env python """ hycom.py Functions for dealing with the HYCOM model for importation into ROMS Written by <NAME> on 07/24/15 Copyright (c)2020 University of Hawaii under the MIT-License. """ import numpy as np from datetime import datetime import netCDF4 from seapy.lib import default_epoch, chunker...
[ "datetime.datetime", "seapy.roms.num2date", "numpy.logical_and", "seapy.model.grid.asgrid", "netCDF4.Dataset", "numpy.any", "numpy.max", "numpy.min", "seapy.lib.chunker" ]
[((600, 617), 'datetime.datetime', 'datetime', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (608, 617), False, 'from datetime import datetime\n'), ((645, 662), 'datetime.datetime', 'datetime', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (653, 662), False, 'from datetime import datetime\n'), ((1488, 1500), 'seapy.model.g...
# -*- coding: utf-8 -*- import sys, os sys.path.insert(0, os.path.abspath('../..')) import unittest, ga, cvrp, grid_search, re, math, numpy, itertools, matplotlib.pyplot as plt class ClassicalOperators(unittest.TestCase): """Test cases for CVRP problem.""" grid_search = False def test_1(self): "...
[ "matplotlib.pyplot.ylabel", "grid_search.GridSearch", "math.sqrt", "cvrp.CVRPIndividualFactory", "unittest.main", "numpy.arange", "re.search", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.yscale", "numpy.logspace", "ga.GeneticAlgorithm", "re.findall", "matplotli...
[((59, 83), 'os.path.abspath', 'os.path.abspath', (['"""../.."""'], {}), "('../..')\n", (74, 83), False, 'import sys, os\n'), ((12647, 12662), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12660, 12662), False, 'import unittest, ga, cvrp, grid_search, re, math, numpy, itertools, matplotlib.pyplot as plt\n'), ((9...
import os import numpy as np import networkx as nx from tqdm import tqdm from utils import load_networks # Get File Names data_path = os.path.join(os.path.dirname(__file__), '..', '..', 'Data') networks_dir = load_networks(os.path.join(data_path, 'Generated', 'Barabasi')) for net_dir in networks_dir: print('Ca...
[ "networkx.degree", "os.path.join", "os.path.dirname", "numpy.zeros", "os.path.basename", "networkx.read_gpickle", "numpy.pad", "numpy.save" ]
[((151, 176), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (166, 176), False, 'import os\n'), ((227, 275), 'os.path.join', 'os.path.join', (['data_path', '"""Generated"""', '"""Barabasi"""'], {}), "(data_path, 'Generated', 'Barabasi')\n", (239, 275), False, 'import os\n'), ((385, 409), 'net...
""" A module to handle metrics """ import copy import json import numbers from functools import partial from typing import Any, Dict import numpy as np from utils import pairwise def format_time(seconds): """ Format time in h:mm:ss.ss format """ hour = 60 * 60 hours = int(seconds // hour) minutes = ...
[ "numpy.sqrt", "numpy.average", "numpy.array", "functools.partial", "utils.pairwise", "copy.deepcopy", "json.load" ]
[((830, 870), 'functools.partial', 'partial', (['format_basic'], {'format_spec': '""".0f"""'}), "(format_basic, format_spec='.0f')\n", (837, 870), False, 'from functools import partial\n'), ((888, 928), 'functools.partial', 'partial', (['format_basic'], {'format_spec': '""".1%"""'}), "(format_basic, format_spec='.1%')\...
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "numpy.clip", "numpy.abs", "numpy.ceil", "numpy.power", "gym.spaces.Box", "numpy.concatenate", "numpy.rad2deg" ]
[((3790, 3857), 'numpy.concatenate', 'np.concatenate', (['[original_observation, target_observation]'], {'axis': '(-1)'}), '([original_observation, target_observation], axis=-1)\n', (3804, 3857), True, 'import numpy as np\n'), ((4335, 4376), 'numpy.concatenate', 'np.concatenate', (['[low0, task_low]'], {'axis': '(-1)'}...
import torch import random import numpy as np def set_seed(seed=0): np.random.seed(seed) random.seed(seed) torch.manual_seed(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False return True
[ "torch.manual_seed", "numpy.random.seed", "random.seed" ]
[((73, 93), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (87, 93), True, 'import numpy as np\n'), ((98, 115), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (109, 115), False, 'import random\n'), ((120, 143), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (137, 14...
import numpy as np from skipi.function import Function, Integral from ..helper import assert_equal, randspace def test_integration(): x_domain = np.linspace(0, 10, 100) f = Function(x_domain, lambda x: 6 * x) F = Integral.from_function(f) F2 = Function(x_domain, lambda x: 3 * x ** 2) assert_equa...
[ "numpy.linspace", "skipi.function.Function", "numpy.sqrt", "skipi.function.Integral.from_function" ]
[((152, 175), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (163, 175), True, 'import numpy as np\n'), ((184, 219), 'skipi.function.Function', 'Function', (['x_domain', '(lambda x: 6 * x)'], {}), '(x_domain, lambda x: 6 * x)\n', (192, 219), False, 'from skipi.function import Functio...
from nose.tools import assert_equal, assert_true, assert_raises, assert_almost_equal import shannon.discrete as discrete from numpy import array, mod, arange, histogram from numpy.random import randint, randn from numpy.testing import assert_array_almost_equal, assert_array_equal import pdb def test_entropy(): # t...
[ "shannon.discrete.bin", "numpy.histogram", "nose.tools.assert_almost_equal", "numpy.testing.assert_array_equal", "shannon.discrete.combine_symbols", "numpy.array", "numpy.random.randint", "nose.tools.assert_raises", "shannon.discrete.entropy", "shannon.discrete.mi", "nose.tools.assert_equal", ...
[((374, 384), 'numpy.array', 'array', (['[1]'], {}), '([1])\n', (379, 384), False, 'from numpy import array, mod, arange, histogram\n'), ((432, 459), 'shannon.discrete.entropy', 'discrete.entropy', ([], {'prob': 'prob'}), '(prob=prob)\n', (448, 459), True, 'import shannon.discrete as discrete\n'), ((464, 482), 'nose.to...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the Kramers-Kronig Calculator software package. # # Copyright (c) 2013 <NAME>, <NAME> # # The software is licensed under the terms of the zlib/libpng license. # For details see LICENSE.txt """This module implements a GUI using the wxPython toolkit."...
[ "logging.getLogger", "data.coeffs_to_linear", "logging.StreamHandler", "wx.lib.plot.PolyLine", "webbrowser.open", "numpy.array", "wx.lib.plot.PolyMarker", "wx.StaticBox", "wx.App", "kk.KK_PP", "kk.calc_relativistic_correction", "wx.lib.plot.PlotGraphics", "wx.CheckBox", "data.calculate_For...
[((347, 374), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (364, 374), False, 'import logging\n'), ((415, 455), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (434, 455), False, 'import logging\n'), ((457, 497), 'logging.Stream...
# This file is a derivative of repeat_copy.py created by SiliconSloth. # The license header of the original file is retained here. # # Copyright 2018 <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 t...
[ "collections.OrderedDict", "numpy.ones", "numpy.arange", "numpy.argmax", "numpy.max", "numpy.stack", "numpy.zeros", "numpy.ndarray", "numpy.concatenate", "scipy.sparse.csr_matrix", "numpy.transpose", "matplotlib.pyplot.subplots", "numpy.random.RandomState", "matplotlib.pyplot.show" ]
[((7213, 7272), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {'sharex': '(True)', 'sharey': '(False)', 'figsize': '(13, 8)'}), '(2, sharex=True, sharey=False, figsize=(13, 8))\n', (7225, 7272), True, 'import matplotlib.pyplot as plt\n'), ((7349, 7380), 'numpy.argmax', 'np.argmax', (["samples['x']"], {'axis':...
import torch from torchvision import transforms import os import cv2 import time import numpy as np from .pse import decode as pse_decode def Singleton(cls): _instance = {} def _singleton(*args, **kargs): if cls not in _instance: _instance[cls] = cls(*args, **kargs) return _i...
[ "torch.load", "numpy.array", "torch.cuda.is_available", "cv2.cvtColor", "time.time", "torch.no_grad", "cv2.resize", "torchvision.transforms.ToTensor", "torch.device" ]
[((2214, 2250), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (2226, 2250), False, 'import cv2\n'), ((2750, 2795), 'cv2.resize', 'cv2.resize', (['img', 'None'], {'fx': 'scale_w', 'fy': 'scale_h'}), '(img, None, fx=scale_w, fy=scale_h)\n', (2760, 2795), False, 'import ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Python libraries import pandas as pd import numpy as np import random import copy import logging import ipdb from ETL2.DBIndicadores import DBIndicadores # Local imports from rdigraphs.supergraph.snode import DataGraph class DataGraph_sql(DataGraph): """ Gen...
[ "random.sample", "pandas.DataFrame", "ipdb.set_trace", "logging.warning", "random.seed", "numpy.count_nonzero", "copy.deepcopy", "ETL2.DBIndicadores.DBIndicadores", "logging.info" ]
[((2004, 2116), 'ETL2.DBIndicadores.DBIndicadores', 'DBIndicadores', (["self.db_info['server']", "self.db_info['user']", "self.db_info['password']", "self.db_info['name']"], {}), "(self.db_info['server'], self.db_info['user'], self.db_info[\n 'password'], self.db_info['name'])\n", (2017, 2116), False, 'from ETL2.DBI...
import cv2 import numpy as np import os ########## KNN CODE ############ def distance(v1, v2): # Eucledian return np.sqrt(((v1-v2)**2).sum()) def knn(train, test, k=5): dist = [] for i in range(train.shape[0]): # Get the vector and label ix = train[i, :-1] iy = train[i, -1] # Compute the distance f...
[ "cv2.rectangle", "os.listdir", "numpy.unique", "numpy.ones", "numpy.argmax", "cv2.imshow", "cv2.putText", "numpy.array", "cv2.destroyAllWindows", "cv2.VideoCapture", "numpy.concatenate", "cv2.CascadeClassifier", "cv2.resize", "numpy.load", "cv2.waitKey" ]
[((762, 781), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (778, 781), False, 'import cv2\n'), ((815, 871), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_alt.xml"""'], {}), "('haarcascade_frontalface_alt.xml')\n", (836, 871), False, 'import cv2\n'), ((1043, 1067), 'o...
"""IMDB Dataset module for sentiment analysis.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from data.util import OOV_CHAR from data.util import START_CHAR from data.util import pad_sentence NUM_CLASS = 2 ...
[ "numpy.array", "numpy.eye", "tensorflow.keras.datasets.imdb.load_data", "data.util.pad_sentence" ]
[((849, 1036), 'tensorflow.keras.datasets.imdb.load_data', 'tf.keras.datasets.imdb.load_data', ([], {'path': '"""imdb.npz"""', 'num_words': 'vocabulary_size', 'skip_top': '(0)', 'maxlen': 'None', 'seed': '(113)', 'start_char': 'START_CHAR', 'oov_char': 'OOV_CHAR', 'index_from': '(OOV_CHAR + 1)'}), "(path='imdb.npz', nu...
import os import re import textwrap from pathlib import Path import moderngl import numpy as np from .. import config from ..utils import opengl from ..utils.simple_functions import get_parameters SHADER_FOLDER = Path(__file__).parent / "shaders" shader_program_cache: dict = {} file_path_to_code_map: dict = {} __al...
[ "numpy.eye", "pathlib.Path", "os.path.join", "numpy.array", "numpy.zeros", "re.finditer" ]
[((1650, 1766), 'numpy.zeros', 'np.zeros', (['unfiltered_attributes[unfiltered_attributes.dtype.names[0]].shape[0]'], {'dtype': 'filtered_attributes_dtype'}), '(unfiltered_attributes[unfiltered_attributes.dtype.names[0]].shape[\n 0], dtype=filtered_attributes_dtype)\n', (1658, 1766), True, 'import numpy as np\n'), (...
"""Density plot from a distribution of points in 3D""" import numpy as np from vedo import * n = 3000 p = np.random.normal(7, 0.3, (n,3)) p[:int(n*1/3) ] += [1,0,0] # shift 1/3 of the points along x by 1 p[ int(n*2/3):] += [1.7,0.4,0.2] pts = Points(p, alpha=0.5) vol = pts.density().c('Dark2').alpha([0.1,1]) #...
[ "numpy.random.normal" ]
[((107, 139), 'numpy.random.normal', 'np.random.normal', (['(7)', '(0.3)', '(n, 3)'], {}), '(7, 0.3, (n, 3))\n', (123, 139), True, 'import numpy as np\n')]
""" Running the threelink arm with the pygame display. The arm will move the end-effector to the target, which can be moved by clicking on the background. """ import numpy as np from abr_control.arms import threejoint as arm # from abr_control.arms import twojoint as arm from abr_control.interfaces import PyGame from ...
[ "numpy.copy", "numpy.sqrt", "abr_control.controllers.OSC", "abr_control.interfaces.PyGame", "numpy.zeros", "abr_control.arms.threejoint.Config", "abr_control.controllers.Damping", "abr_control.arms.threejoint.ArmSim" ]
[((426, 453), 'abr_control.arms.threejoint.Config', 'arm.Config', ([], {'use_cython': '(True)'}), '(use_cython=True)\n', (436, 453), True, 'from abr_control.arms import threejoint as arm\n'), ((492, 516), 'abr_control.arms.threejoint.ArmSim', 'arm.ArmSim', (['robot_config'], {}), '(robot_config)\n', (502, 516), True, '...
# Copyright 2018 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...
[ "tensorflow.python.framework.test_util.use_gpu", "tensorflow.python.eager.context.eager_mode", "numpy.sqrt", "tensorflow.python.platform.test.main", "tensorflow.python.ops.variables.global_variables_initializer", "itertools.product", "math.sqrt", "tensorflow.python.framework.constant_op.constant", "...
[((19603, 19614), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (19612, 19614), False, 'from tensorflow.python.platform import test\n'), ((1782, 1832), 'itertools.product', 'itertools.product', (['_DATA_TYPES', '_TEST_PARAM_VALUES'], {}), '(_DATA_TYPES, _TEST_PARAM_VALUES)\n', (1799, 1832), Fal...
""" A couple of mesh objects for GPU rendering. """ from OpenGL.GL import * from OpenGL.arrays import vbo import numpy as np class Cube: def __init__(self): O = -1.0 X = 1.0 positions = np.array([O, O, O, O, O, X, O, X, O, O, X, X, X, O, O, X, O, X, X, X, O, X, X, X,],dtype="f") i...
[ "numpy.array", "numpy.asarray", "OpenGL.arrays.vbo.VBO" ]
[((217, 314), 'numpy.array', 'np.array', (['[O, O, O, O, O, X, O, X, O, O, X, X, X, O, O, X, O, X, X, X, O, X, X, X]'], {'dtype': '"""f"""'}), "([O, O, O, O, O, X, O, X, O, O, X, X, X, O, O, X, O, X, X, X, O, X,\n X, X], dtype='f')\n", (225, 314), True, 'import numpy as np\n'), ((329, 467), 'numpy.array', 'np.array'...
import pandas as pd import numpy as np import matplotlib.pyplot as plt from empiricaldist import Pmf from scipy.stats import gaussian_kde from scipy.stats import binom from scipy.stats import gamma from scipy.stats import poisson def values(series): """Make a series of values and the number of times they appear...
[ "numpy.array", "numpy.arange", "scipy.stats.gaussian_kde", "statsmodels.nonparametric.smoothers_lowess.lowess", "matplotlib.pyplot.contour", "numpy.linspace", "pandas.DataFrame", "numpy.meshgrid", "matplotlib.pyplot.savefig", "seaborn.JointGrid", "matplotlib.pyplot.gca", "cycler.cycler", "nu...
[((10858, 10882), 'cycler.cycler', 'cycler', ([], {'color': 'color_list'}), '(color=color_list)\n', (10864, 10882), False, 'from cycler import cycler\n'), ((589, 609), 'pandas.DataFrame', 'pd.DataFrame', (['series'], {}), '(series)\n', (601, 609), True, 'import pandas as pd\n'), ((1029, 1043), 'pandas.DataFrame', 'pd.D...
from itertools import combinations import os from re import T import cv2 import numpy as np from numpy.lib.function_base import append, select from tensorflow import keras from sklearn.preprocessing import Normalizer from sklearn.preprocessing import LabelEncoder from sklearn.svm import SVC from scipy.spatial import di...
[ "numpy.mean", "random.sample", "os.listdir", "numpy.sqrt", "os.path.join", "numpy.square", "itertools.combinations", "scipy.spatial.distance.euclidean", "tensorflow.keras.models.load_model", "numpy.std", "cv2.resize", "cv2.imread" ]
[((622, 666), 'numpy.mean', 'np.mean', (['face'], {'axis': '(0, 1, 2)', 'keepdims': '(True)'}), '(face, axis=(0, 1, 2), keepdims=True)\n', (629, 666), True, 'import numpy as np\n'), ((675, 718), 'numpy.std', 'np.std', (['face'], {'axis': '(0, 1, 2)', 'keepdims': '(True)'}), '(face, axis=(0, 1, 2), keepdims=True)\n', (6...
import pytest import numpy.testing as npt @pytest.fixture def graphs_and_features(): import numpy as np import torch permutation_idx = np.random.permutation(5) permutation_matrix = np.zeros((5, 5), dtype=np.float32) permutation_matrix[ np.arange(5), permutation_idx, ] = 1 pe...
[ "dgl.reorder_graph", "hpno.HierarchicalPathNetworkLayer", "hpno.heterograph", "torch.randn", "torch.tensor", "numpy.zeros", "hpno.GraphReadout", "hpno.HierarchicalPathNetwork", "dgl.rand_graph", "numpy.arange", "numpy.random.permutation" ]
[((148, 172), 'numpy.random.permutation', 'np.random.permutation', (['(5)'], {}), '(5)\n', (169, 172), True, 'import numpy as np\n'), ((198, 232), 'numpy.zeros', 'np.zeros', (['(5, 5)'], {'dtype': 'np.float32'}), '((5, 5), dtype=np.float32)\n', (206, 232), True, 'import numpy as np\n'), ((339, 392), 'torch.tensor', 'to...
# Copyright 2019 TerraPower, 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 writi...
[ "armi.runLog.warning", "tabulate.tabulate", "armi.plugins.collectInterfaceDescriptions", "armi.physics.neutronics.fissionProductModel.fissionProductModelSettings.defineSettings", "os.path.expandvars", "armi.scripts.migration.crossSectionBlueprintsToSettings.migrateCrossSectionsFromBlueprints", "numpy.ar...
[((3088, 3132), 'armi.physics.neutronics.fissionProductModel.fissionProductModelSettings.defineSettings', 'fissionProductModelSettings.defineSettings', ([], {}), '()\n', (3130, 3132), False, 'from armi.physics.neutronics.fissionProductModel import fissionProductModelSettings\n'), ((9141, 9270), 'armi.runLog.warning', '...
import cv2 import pandas as pd from tqdm import tqdm train = pd.read_csv('Christof/assets/train_ext1.csv') #test = pd.read_csv('Christof/assets/sample_submission.csv') path_to_train = 'Christof/assets/ext_tomomi/' #path_to_test = 'Christof/assets/test_rgby_512/' fns = [path_to_train + f[:-4] + '.png' for f in train[...
[ "numpy.zeros", "numpy.reshape", "cv2.imread", "pandas.read_csv" ]
[((62, 107), 'pandas.read_csv', 'pd.read_csv', (['"""Christof/assets/train_ext1.csv"""'], {}), "('Christof/assets/train_ext1.csv')\n", (73, 107), True, 'import pandas as pd\n'), ((363, 374), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (371, 374), True, 'import numpy as np\n'), ((389, 400), 'numpy.zeros', 'np.zer...
import numpy as np def random_split_data(data, label, proportion): """ Split two numpy arrays into two parts of `proportion` and `1 - proportion` Args: - data: numpy array, to be split along the first axis - proportion: a float less than 1 """ assert data.shape[0] == label.shape[0...
[ "numpy.random.permutation" ]
[((355, 382), 'numpy.random.permutation', 'np.random.permutation', (['size'], {}), '(size)\n', (376, 382), True, 'import numpy as np\n')]
from collections import Counter from copy import copy import json import numpy as np import re import logging from stanza.models.common.utils import ud_scores, harmonic_mean from stanza.utils.conll import CoNLL from stanza.models.common.doc import * logger = logging.getLogger('stanza') def load_mwt_dict(filename): ...
[ "logging.getLogger", "re.escape", "numpy.where", "re.match", "numpy.argmax", "stanza.models.common.utils.harmonic_mean", "numpy.max", "numpy.concatenate", "json.load", "stanza.utils.conll.CoNLL.dict2conll" ]
[((261, 288), 'logging.getLogger', 'logging.getLogger', (['"""stanza"""'], {}), "('stanza')\n", (278, 288), False, 'import logging\n'), ((7603, 7631), 'numpy.concatenate', 'np.concatenate', (['all_preds', '(0)'], {}), '(all_preds, 0)\n', (7617, 7631), True, 'import numpy as np\n'), ((8823, 8874), 'stanza.models.common....
import base64 import json import numpy as np import pytest from zarr.codecs import Blosc, Delta, Zlib from zarr.errors import MetadataError from zarr.meta import (ZARR_FORMAT, decode_array_metadata, decode_dtype, decode_group_metadata, encode_array_metadata, encode_dtype)...
[ "zarr.meta.decode_group_metadata", "json.loads", "zarr.meta.decode_array_metadata", "zarr.meta.decode_dtype", "json.dumps", "zarr.codecs.Blosc", "base64.standard_b64encode", "numpy.array", "numpy.zeros", "pytest.raises", "zarr.meta.encode_array_metadata", "zarr.codecs.Delta", "numpy.dtype", ...
[((443, 461), 'json.loads', 'json.loads', (['expect'], {}), '(expect)\n', (453, 461), False, 'import json\n'), ((471, 489), 'json.loads', 'json.loads', (['actual'], {}), '(actual)\n', (481, 489), False, 'import json\n'), ((1055, 1082), 'zarr.meta.encode_array_metadata', 'encode_array_metadata', (['meta'], {}), '(meta)\...
import numpy as np import datacube from datetime import datetime dc = datacube.Datacube(app = 'my_app', config = '/home/localuser/.datacube.conf') import utils.data_cube_utilities.data_access_api as dc_api api = dc_api.DataAccessApi(config = '/home/localuser/.datacube.conf') # <hr> # # ## <a id="plat_prod">Sel...
[ "datetime.datetime.utcfromtimestamp", "utils.data_cube_utilities.dc_display_map.display_map", "datetime.datetime.utcnow", "datacube.Datacube", "utils.data_cube_utilities.data_access_api.DataAccessApi", "numpy.datetime64", "numpy.timedelta64" ]
[((71, 143), 'datacube.Datacube', 'datacube.Datacube', ([], {'app': '"""my_app"""', 'config': '"""/home/localuser/.datacube.conf"""'}), "(app='my_app', config='/home/localuser/.datacube.conf')\n", (88, 143), False, 'import datacube\n'), ((216, 277), 'utils.data_cube_utilities.data_access_api.DataAccessApi', 'dc_api.Dat...
""" Function to create the Rocket The rocket_builder.py file contains the build function to build the Rocket. Moreover, it contains the preprocess and postprocess functions that will be added to the model. """ from __future__ import division import json import types import os import cv2 import numpy as np import PIL ...
[ "torch.load", "torch.from_numpy", "numpy.array", "PIL.ImageDraw.Draw", "os.path.dirname", "cv2.cvtColor", "json.load", "cv2.resize", "types.MethodType" ]
[((1468, 1512), 'torch.load', 'torch.load', (['weights_path'], {'map_location': '"""cpu"""'}), "(weights_path, map_location='cpu')\n", (1478, 1512), False, 'import torch\n'), ((1578, 1614), 'types.MethodType', 'types.MethodType', (['postprocess', 'model'], {}), '(postprocess, model)\n', (1594, 1614), False, 'import typ...
import pytest import numpy as np from ctapipe.image.geometry_converter import ( convert_geometry_hex1d_to_rect2d, convert_geometry_rect2d_back_to_hexe1d, astri_to_2d_array, array_2d_to_astri, chec_to_2d_array, array_2d_to_chec, ) from ctapipe.image.hillas import hillas_parameters from ctapipe.in...
[ "numpy.abs", "ctapipe.instrument.CameraDescription.get_known_camera_names", "ctapipe.instrument.CameraGeometry.from_name", "numpy.sqrt", "pytest.mark.parametrize", "ctapipe.image.toymodel.Gaussian", "ctapipe.image.hillas.hillas_parameters" ]
[((457, 499), 'ctapipe.instrument.CameraDescription.get_known_camera_names', 'CameraDescription.get_known_camera_names', ([], {}), '()\n', (497, 499), False, 'from ctapipe.instrument import CameraDescription, CameraGeometry\n'), ((971, 1006), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""rot"""', '[3]'], ...
import argparse import pathlib import sys import gdcm import imageio import nibabel as nib import numpy as np import pydicom parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( "-i", "--input", type=pathlib.Path, metavar="folder", help="Dic...
[ "numpy.eye", "nibabel.save", "argparse.ArgumentParser", "imageio.imwrite", "gdcm.IPPSorter", "numpy.array", "gdcm.ImageReader", "numpy.empty_like" ]
[((136, 215), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (159, 215), False, 'import argparse\n'), ((1558, 1576), 'gdcm.ImageReader', 'gdcm.ImageReader', ([], {}), '()\n', (1574, ...
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
[ "gym.spaces.Box", "numpy.max", "tensorflow.concat", "numpy.array", "tensorflow.constant", "numpy.min", "numpy.shape", "tensorflow.cast" ]
[((3067, 3095), 'tensorflow.cast', 'tf.cast', (['tasks', 'states.dtype'], {}), '(tasks, states.dtype)\n', (3074, 3095), True, 'import tensorflow as tf\n'), ((3107, 3142), 'tensorflow.concat', 'tf.concat', (['[states, tasks]'], {'axis': '(-1)'}), '([states, tasks], axis=-1)\n', (3116, 3142), True, 'import tensorflow as ...
import sys, os sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import argparse, glob, json import matplotlib.pyplot as plt import numpy as np from matplotlib.offsetbox import * from matplotlib.patches import * from PIL import Image def load_results(path): res = [] skip_count = 0...
[ "numpy.mean", "numpy.ones", "argparse.ArgumentParser", "numpy.where", "numpy.std", "os.path.join", "numpy.max", "numpy.array", "numpy.zeros", "numpy.sum", "os.path.dirname", "numpy.min", "json.load", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((745, 758), 'numpy.array', 'np.array', (['res'], {}), '(res)\n', (753, 758), True, 'import numpy as np\n'), ((1210, 1241), 'numpy.zeros', 'np.zeros', (['(results.shape[1], 3)'], {}), '((results.shape[1], 3))\n', (1218, 1241), True, 'import numpy as np\n'), ((1645, 1682), 'numpy.sum', 'np.sum', (['(results == mat_trut...
''' Biblioteca para calculo de refrigeracao regenerativa em motores foguetes bi propelentes <NAME> https://github.com/jeffersonmsb/rocket-cooling-calculator ''' import csv import numpy as np import math import pyCEA from scipy import optimize import os import subprocess def geometry(data_in, data_out): with open(...
[ "pyCEA.readPropStagnationCEA", "scipy.optimize.bisect", "os.waitpid", "numpy.power", "subprocess.Popen", "csv.writer", "pyCEA.readPropCEA", "math.sqrt", "math.log", "pyCEA.calcPropStagnationCEA", "numpy.array", "numpy.gradient", "csv.reader", "math.tanh", "pyCEA.calcPropCEA" ]
[((6107, 6236), 'pyCEA.calcPropStagnationCEA', 'pyCEA.calcPropStagnationCEA', (["data_in['p0_pyCEA']", "data_in['fuel']", "data_in['oxidizer']", "data_in['of']", "data_in['motor_name']"], {}), "(data_in['p0_pyCEA'], data_in['fuel'], data_in[\n 'oxidizer'], data_in['of'], data_in['motor_name'])\n", (6134, 6236), Fals...
"""Main implementation class of PFE """ # MIT License # # Copyright (c) 2019 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the r...
[ "tensorflow.local_variables_initializer", "imp.load_source", "sys.stdout.write", "tensorflow.gradients", "tensorflow.group", "tensorflow.GPUOptions", "tensorflow.Graph", "os.path.exists", "os.listdir", "tensorflow.Session", "tensorflow.placeholder", "tensorflow.ConfigProto", "tensorflow.summ...
[((1348, 1358), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1356, 1358), True, 'import tensorflow as tf\n'), ((1381, 1413), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'allow_growth': '(True)'}), '(allow_growth=True)\n', (1394, 1413), True, 'import tensorflow as tf\n'), ((1434, 1532), 'tensorflow.ConfigProto...
''' @author : jhhalls ''' import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from .datasets import make_wave from .plot_helpers import cm2 def plot_linear_regression_wave(): X, y = make_wave(n_samples=60) ...
[ "sklearn.model_selection.train_test_split", "matplotlib.pyplot.gca", "matplotlib.pyplot.figure", "numpy.linspace", "sklearn.linear_model.LinearRegression" ]
[((355, 394), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'random_state': '(42)'}), '(X, y, random_state=42)\n', (371, 394), False, 'from sklearn.model_selection import train_test_split\n'), ((562, 588), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(...
"""Contains functions for geometrical calculations on a globe.""" import numpy as np from math import sin, cos, atan2, asin, pi # ============================================================================= # haversine # ============================================================================= def haversine(sta...
[ "numpy.radians", "numpy.sqrt", "math.cos", "numpy.degrees", "math.sin" ]
[((1034, 1058), 'numpy.radians', 'np.radians', (['start_coords'], {}), '(start_coords)\n', (1044, 1058), True, 'import numpy as np\n'), ((1076, 1098), 'numpy.radians', 'np.radians', (['end_coords'], {}), '(end_coords)\n', (1086, 1098), True, 'import numpy as np\n'), ((2605, 2629), 'numpy.radians', 'np.radians', (['star...
""" Module with utilities Author: <NAME> Email: <EMAIL> """ from ..tools import geometry import os import shutil import subprocess import contextlib import numpy as np from rdkit import Chem from rdkit.Chem import AllChem import re import logging logger = logging.getLogger(__name__) def translateToceroZcoord(mo...
[ "logging.getLogger", "rdkit.Chem.MolFromMol2File", "logging.StreamHandler", "numpy.array", "rdkit.Chem.MolFromPDBBlock", "rdkit.Chem.rdMolTransforms.TransformConformer", "re.search", "os.path.exists", "rdkit.Chem.MolFromPDBFile", "rdkit.Chem.rdMolTransforms.ComputeCentroid", "subprocess.run", ...
[((262, 289), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (279, 289), False, 'import logging\n'), ((1767, 1794), 'os.path.abspath', 'os.path.abspath', (['folderName'], {}), '(folderName)\n', (1782, 1794), False, 'import os\n'), ((2694, 2739), 'os.path.join', 'os.path.join', (['workdir'...
import argparse import os import time import matplotlib.pyplot as plt import numpy as np import PIL import torch import torch.optim as optim import torchvision from PIL import Image from torch import nn from torch.nn import functional as F from models.vanilla_vae_q import QuaternionVanillaVAE from models.vanilla_vae ...
[ "os.listdir", "argparse.ArgumentParser", "torchvision.transforms.ToTensor", "matplotlib.pyplot.imsave", "torch.load", "models.vanilla_vae.VanillaVAE", "os.path.join", "numpy.array", "models.vanilla_vae_q.QuaternionVanillaVAE", "numpy.pad", "torch.cuda.set_device" ]
[((371, 396), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (394, 396), False, 'import argparse\n'), ((2050, 2074), 'os.listdir', 'os.listdir', (['opt.root_dir'], {}), '(opt.root_dir)\n', (2060, 2074), False, 'import os\n'), ((2473, 2498), 'matplotlib.pyplot.imsave', 'plt.imsave', (['filename'...
# $Id$ # # Copyright (C) 2008-2011 <NAME> # # @@ All Rights Reserved @@ # This file is part of the RDKit. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the RDKit source tree. # from rdkit import Chem from rdkit import RDConfig impor...
[ "rdkit.Chem.GetPeriodicTable", "rdkit.Chem.WedgeMolBonds", "math.cos", "numpy.array", "rdkit.six.cmp", "math.atan2", "copy.deepcopy", "math.sin" ]
[((420, 443), 'rdkit.Chem.GetPeriodicTable', 'Chem.GetPeriodicTable', ([], {}), '()\n', (441, 443), False, 'from rdkit import Chem\n'), ((2912, 2930), 'math.atan2', 'math.atan2', (['dy', 'dx'], {}), '(dy, dx)\n', (2922, 2930), False, 'import math\n'), ((7678, 7696), 'copy.deepcopy', 'copy.deepcopy', (['pos'], {}), '(po...
##################################################################### # # # /labscript_devices/IMAQdxCamera/blacs_workers.py # # # # Copyright 2019, Monash University and ...
[ "numpy.uint8", "PIL.Image.new", "numpy.array", "PIL.ImageDraw.Draw", "labscript_utils.properties.set_attributes", "nivision.IMAQdxStartAcquisition", "nivision.IMAQdxSnap", "nivision.IMAQdxGrab", "labscript_utils.shared_drive.path_to_local", "numpy.random.poisson", "PIL.ImageFont.load_default", ...
[((3432, 3455), 'numpy.linspace', 'np.linspace', (['(-5)', '(5)', '(500)'], {}), '(-5, 5, 500)\n', (3443, 3455), True, 'import numpy as np\n'), ((3680, 3704), 'PIL.ImageFont.load_default', 'ImageFont.load_default', ([], {}), '()\n', (3702, 3704), False, 'from PIL import Image, ImageDraw, ImageFont\n'), ((3722, 3760), '...
import collections import json import os import warnings import copy import attr import numpy as np from functools import lru_cache import torch from transformers import AutoModel, AutoTokenizer, AutoConfig from text2qdmr.model.modules import abstract_preproc from text2qdmr.model.modules import encoder_modules from ...
[ "torch.as_tensor", "torch.randperm", "torch.LongTensor", "transformers.AutoTokenizer.from_pretrained", "copy.deepcopy", "torch.arange", "transformers.AutoModel.from_pretrained", "json.dumps", "attr.evolve", "torch.randint", "text2qdmr.utils.registry.register", "text2qdmr.utils.corenlp.annotate...
[((49496, 49537), 'text2qdmr.utils.registry.register', 'registry.register', (['"""encoder"""', '"""text2qdmr"""'], {}), "('encoder', 'text2qdmr')\n", (49513, 49537), False, 'from text2qdmr.utils import registry\n'), ((73648, 73673), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(100000)'}), '(maxsize=100000)\n'...
# This script produces custom wrappers for XGBoost and Lasagne modules (to generate sklearn-like interface) # The implementation of Lasagne (with some custom adjustments) is adapted from <NAME>'s solution # to Kaggle's Otto Product Classification Challenge which can be found here https://github.com/ahara/kaggle_otto #...
[ "theano.tensor.iscalar", "lasagne.updates.nesterov_momentum", "lasagne.utils.floatX", "numpy.array", "copy.deepcopy", "xgboost.DMatrix", "lasagne.layers.get_all_params", "numpy.mean", "theano.shared", "lasagne.objectives.Objective", "xgboost.train", "theano.function", "lasagne.layers.Dropout...
[((2244, 2261), 'xgboost.DMatrix', 'xgb.DMatrix', (['X', 'y'], {}), '(X, y)\n', (2255, 2261), True, 'import xgboost as xgb\n'), ((2803, 2843), 'xgboost.train', 'xgb.train', (['params', 'sf', 'self.n_estimators'], {}), '(params, sf, self.n_estimators)\n', (2812, 2843), True, 'import xgboost as xgb\n'), ((2907, 2921), 'x...
import tkinter as tk from pathlib import Path import random from numpy import array_equal, copy, zeros, any _GRID_SIZE = 4 class Application(tk.Tk): def __init__(self): tk.Tk.__init__(self) self.wm_iconbitmap('2048.ico') self.title("2048") self.minsize(272, 350) ...
[ "numpy.copy", "random.randrange", "pathlib.Path", "tkinter.Button", "numpy.any", "tkinter.StringVar", "numpy.zeros", "tkinter.Tk.__init__", "numpy.array_equal", "tkinter.Label", "tkinter.Frame" ]
[((194, 214), 'tkinter.Tk.__init__', 'tk.Tk.__init__', (['self'], {}), '(self)\n', (208, 214), True, 'import tkinter as tk\n'), ((394, 420), 'random.randrange', 'random.randrange', (['(16777215)'], {}), '(16777215)\n', (410, 420), False, 'import random\n'), ((474, 488), 'tkinter.Frame', 'tk.Frame', (['self'], {}), '(se...
import numpy as np from fast3tree import fast3tree, get_distance, find_friends_of_friends points = np.random.rand(1000, 3) def find_sphere(c, points, r, box_size=-1): return np.where(get_distance(c, points, box_size) < r)[0] def test_fast3tree(): c = np.array([0.5, 0.5, 0.5]) r = 0.1 with fast3tree(p...
[ "fast3tree.get_distance", "numpy.repeat", "numpy.random.rand", "numpy.unique", "fast3tree.fast3tree", "numpy.array", "fast3tree.find_friends_of_friends", "numpy.random.RandomState" ]
[((100, 123), 'numpy.random.rand', 'np.random.rand', (['(1000)', '(3)'], {}), '(1000, 3)\n', (114, 123), True, 'import numpy as np\n'), ((262, 287), 'numpy.array', 'np.array', (['[0.5, 0.5, 0.5]'], {}), '([0.5, 0.5, 0.5])\n', (270, 287), True, 'import numpy as np\n'), ((545, 564), 'numpy.array', 'np.array', (['[0, 0, 0...