code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import copy import sys if sys.version_info < (3,): range = xrange import numpy as np import pandas as pd import scipy.stats as ss from patsy import dmatrices, dmatrix, demo_data from .. import families as fam from .. import tsm as tsm from .. import data_check as dc from .kalman import * class DAR(tsm.TSM): ...
[ "matplotlib.pyplot.title", "numpy.ones", "matplotlib.pyplot.figure", "numpy.mean", "matplotlib.pyplot.fill_between", "numpy.linalg.pinv", "pandas.DataFrame", "numpy.power", "numpy.identity", "numpy.append", "copy.deepcopy", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "scipy.stats...
[((2067, 2119), 'numpy.array', 'np.array', (['self.data[self.max_lag:self.data.shape[0]]'], {}), '(self.data[self.max_lag:self.data.shape[0]])\n', (2075, 2119), True, 'import numpy as np\n'), ((2132, 2151), 'numpy.ones', 'np.ones', (['Y.shape[0]'], {}), '(Y.shape[0])\n', (2139, 2151), True, 'import numpy as np\n'), ((4...
import pandas as pd import numpy as np import tensorflow as tf import sys sys.path.append("/data") csv = pd.read_csv("bmi.csv") csv["height"] = csv["height"] / 200 csv["weight"] = csv["weight"] / 100 bclass = {"thin": [1, 0, 0], "normal": [0, 1, 0], "fat": [0, 0, 1]} csv["label_pat"] = csv["label"].apply(lambda x: np....
[ "sys.path.append", "tensorflow.log", "pandas.read_csv", "tensorflow.argmax", "tensorflow.Session", "tensorflow.placeholder", "tensorflow.train.write_graph", "tensorflow.summary.FileWriter", "tensorflow.zeros", "tensorflow.cast", "tensorflow.initialize_all_variables", "numpy.array", "tensorfl...
[((75, 99), 'sys.path.append', 'sys.path.append', (['"""/data"""'], {}), "('/data')\n", (90, 99), False, 'import sys\n'), ((106, 128), 'pandas.read_csv', 'pd.read_csv', (['"""bmi.csv"""'], {}), "('bmi.csv')\n", (117, 128), True, 'import pandas as pd\n'), ((453, 490), 'tensorflow.placeholder', 'tf.placeholder', (['tf.fl...
import tensorflow as tf import skimage.transform import numpy as np def conv2d(x, W, b, strides=1): # Conv2D wrapper, with bias and relu activation x = tf.nn.conv2d(x, W, strides=[1, strides, strides, 1], padding='SAME') x = tf.nn.bias_add(x, b) return tf.nn.relu(x) def maxpool2d(x, k=2): # Wrap...
[ "numpy.stack", "tensorflow.image.resize_images", "tensorflow.nn.relu", "numpy.zeros", "tensorflow.nn.max_pool", "tensorflow.nn.conv2d", "numpy.random.choice", "tensorflow.nn.bias_add" ]
[((162, 230), 'tensorflow.nn.conv2d', 'tf.nn.conv2d', (['x', 'W'], {'strides': '[1, strides, strides, 1]', 'padding': '"""SAME"""'}), "(x, W, strides=[1, strides, strides, 1], padding='SAME')\n", (174, 230), True, 'import tensorflow as tf\n'), ((239, 259), 'tensorflow.nn.bias_add', 'tf.nn.bias_add', (['x', 'b'], {}), '...
"""Example code for the nodes in the example pipeline. This code is meant just for illustrating basic Kedro features. Delete this when you start working on your own Kedro project. """ # pylint: disable=invalid-name import logging from typing import Any, Dict import numpy as np import pandas as pd def train_model( ...
[ "numpy.sum", "numpy.concatenate", "numpy.argmax", "numpy.zeros", "numpy.ones", "numpy.vstack", "numpy.exp", "numpy.dot", "logging.getLogger" ]
[((910, 934), 'numpy.ones', 'np.ones', (['(X.shape[0], 1)'], {}), '((X.shape[0], 1))\n', (917, 934), True, 'import numpy as np\n'), ((943, 976), 'numpy.concatenate', 'np.concatenate', (['(bias, X)'], {'axis': '(1)'}), '((bias, X), axis=1)\n', (957, 976), True, 'import numpy as np\n'), ((1740, 1764), 'numpy.ones', 'np.o...
from __future__ import division, absolute_import, print_function import unittest import numpy.testing as testing import numpy as np import healpy as hp import healsparse class UpdateValuesTestCase(unittest.TestCase): def test_update_values_inorder(self): """ Test doing update_values, in coarse pi...
[ "unittest.main", "healpy.pix2ang", "numpy.testing.assert_array_almost_equal", "numpy.testing.assert_array_equal", "numpy.zeros", "numpy.sort", "numpy.array", "numpy.arange", "numpy.testing.assert_equal", "healsparse.HealSparseMap.make_empty", "numpy.concatenate" ]
[((7166, 7181), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7179, 7181), False, 'import unittest\n'), ((443, 512), 'healsparse.HealSparseMap.make_empty', 'healsparse.HealSparseMap.make_empty', (['nside_coverage', 'nside_map', 'dtype'], {}), '(nside_coverage, nside_map, dtype)\n', (478, 512), False, 'import hea...
from pathlib import Path import numpy as np import pytest from npe2 import DynamicPlugin from npe2.manifest.contributions import SampleDataURI import napari from napari.layers._source import Source from napari.viewer import ViewerModel def test_sample_hook(builtins, tmp_plugin: DynamicPlugin): viewer = ViewerM...
[ "napari.viewer.ViewerModel", "npe2.manifest.contributions.SampleDataURI", "pytest.raises", "pathlib.Path", "numpy.random.rand", "napari.layers._source.Source" ]
[((313, 326), 'napari.viewer.ViewerModel', 'ViewerModel', ([], {}), '()\n', (324, 326), False, 'from napari.viewer import ViewerModel\n'), ((387, 453), 'pytest.raises', 'pytest.raises', (['KeyError'], {'match': 'f"""Plugin {NAME!r} does not provide"""'}), "(KeyError, match=f'Plugin {NAME!r} does not provide')\n", (400,...
def example(Simulator): import numpy as np from csdl import Model import csdl class ExampleReorderMatrixSparse(Model): def define(self): shape2 = (5, 4) b = np.arange(20).reshape(shape2) mat = self.declare_variable('b', val=b) s...
[ "csdl.einsum", "numpy.arange" ]
[((406, 468), 'csdl.einsum', 'csdl.einsum', (['mat'], {'subscripts': '"""ij->ji"""', 'partial_format': '"""sparse"""'}), "(mat, subscripts='ij->ji', partial_format='sparse')\n", (417, 468), False, 'import csdl\n'), ((220, 233), 'numpy.arange', 'np.arange', (['(20)'], {}), '(20)\n', (229, 233), True, 'import numpy as np...
import argparse from dataloader import picked_train_test_data_loader from sklearn import preprocessing from classifier import train_best import numpy from bert_serving.client import BertClient bc = BertClient() def train_test(pickled_train_path, pickled_test_path): train, test = picked_train_test_data_loader(pic...
[ "argparse.ArgumentParser", "numpy.asarray", "dataloader.picked_train_test_data_loader", "sklearn.preprocessing.LabelEncoder", "classifier.train_best", "bert_serving.client.BertClient", "numpy.vstack" ]
[((200, 212), 'bert_serving.client.BertClient', 'BertClient', ([], {}), '()\n', (210, 212), False, 'from bert_serving.client import BertClient\n'), ((287, 355), 'dataloader.picked_train_test_data_loader', 'picked_train_test_data_loader', (['pickled_train_path', 'pickled_test_path'], {}), '(pickled_train_path, pickled_t...
from flask import Flask, request from flask_cors import CORS, cross_origin from flask_restful import Resource, Api from json import dumps from flask_jsonpify import jsonify import numpy as np import pandas as pd import matplotlib.pylab as plt import seaborn as sns from matplotlib.pylab import rcParams from datetime im...
[ "flask_restful.Api", "flask_jsonpify.jsonify", "flask_cors.CORS", "flask.Flask", "datetime.datetime.strptime", "numpy.array", "sklearn.externals.joblib.load", "numpy.round", "flask.request.get_json" ]
[((340, 355), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (345, 355), False, 'from flask import Flask, request\n'), ((362, 370), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (365, 370), False, 'from flask_restful import Resource, Api\n'), ((410, 419), 'flask_cors.CORS', 'CORS', (['app'], {}), '...
import subprocess import ujson as json import numpy as np import sys import os os.environ["MKL_SERVICE_FORCE_INTEL"] = "1" runs=10 #Top k HAN, variant2; adjust train_per in helper.py args = [ 'python3', 'train.py', '--problem-path', '../../../LineGraphGCN/data/yelp/', '--problem', 'yelp', '-...
[ "numpy.average", "numpy.asarray", "ujson.loads", "sys.stdout.flush" ]
[((1609, 1629), 'numpy.asarray', 'np.asarray', (['test_acc'], {}), '(test_acc)\n', (1619, 1629), True, 'import numpy as np\n'), ((1643, 1665), 'numpy.asarray', 'np.asarray', (['test_macro'], {}), '(test_macro)\n', (1653, 1665), True, 'import numpy as np\n'), ((1579, 1597), 'sys.stdout.flush', 'sys.stdout.flush', ([], {...
import math import random import torch import numpy as np from scipy.stats import beta from openmixup.models.utils import batch_shuffle_ddp def fftfreqnd(h, w=None, z=None): """ Get bin values for discrete fourier transform of size (h, w, z) :param h: Required, first dimension size :param w: Optional, se...
[ "scipy.stats.beta.rvs", "torch.from_numpy", "numpy.random.randn", "math.ceil", "numpy.fft.irfftn", "openmixup.models.utils.batch_shuffle_ddp", "math.floor", "numpy.expand_dims", "numpy.ones", "random.random", "numpy.fft.fftfreq", "numpy.linspace", "numpy.random.permutation", "torch.no_grad...
[((5484, 5499), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5497, 5499), False, 'import torch\n'), ((418, 435), 'numpy.fft.fftfreq', 'np.fft.fftfreq', (['h'], {}), '(h)\n', (432, 435), True, 'import numpy as np\n'), ((827, 863), 'numpy.sqrt', 'np.sqrt', (['(fx * fx + fy * fy + fz * fz)'], {}), '(fx * fx + fy *...
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import cv2 import mmcv import numpy as np try: import imageio except ImportError: imageio = None def parse_args(): parser = argparse.ArgumentParser( description='Merge images and visualized flow') parser.ad...
[ "os.path.join", "numpy.concatenate", "argparse.ArgumentParser", "mmcv.scandir" ]
[((226, 297), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Merge images and visualized flow"""'}), "(description='Merge images and visualized flow')\n", (249, 297), False, 'import argparse\n'), ((1182, 1203), 'mmcv.scandir', 'mmcv.scandir', (['img_dir'], {}), '(img_dir)\n', (1194, 1203...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: tshzzz """ import numpy as np import torch from src.utils import py_cpu_nms,bbox_iou def gen_yolo_box(featmaps,anchor_wh): #featmaps = [b,c,h,w] output = np.zeros((featmaps[0], featmaps[1], len(anchor_wh), 4)) for i in range(featmaps[0]): ...
[ "numpy.zeros", "torch.cat", "numpy.argsort", "torch.exp", "torch.Tensor", "numpy.array", "src.utils.py_cpu_nms", "src.utils.bbox_iou" ]
[((936, 1027), 'numpy.zeros', 'np.zeros', (['(self.featmap_size[0], self.featmap_size[1], self.boxes_num, self.class_num)'], {}), '((self.featmap_size[0], self.featmap_size[1], self.boxes_num, self.\n class_num))\n', (944, 1027), True, 'import numpy as np\n'), ((1039, 1112), 'numpy.zeros', 'np.zeros', (['(self.featm...
#plots.py import os import pandas import numpy as np import matplotlib.pyplot as plt #plots.py # . . . def plot_lines(df, linewidth = 1, figsize = (40,20),secondary_y = None, legend=True, pp = None, save_fig = False): fig, ax = plt.subplots(figsize = figsize) # If no secondary_y (axis), plot all vari...
[ "matplotlib.pyplot.title", "os.mkdir", "matplotlib.pyplot.show", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "matplotlib.pyplot.rcParams.update", "numpy.arange", "matplotlib.pyplot.cm.colors.Normalize", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savef...
[((239, 268), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (251, 268), True, 'import matplotlib.pyplot as plt\n'), ((2829, 2859), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n', (2841, 2859), True, 'import matplot...
import numpy as np import pytest import astropy import astropy.units as u from astropy.tests.helper import quantity_allclose, assert_quantity_allclose from astropy.coordinates import (SkyCoord, get_body_barycentric, Angle, ConvertError, Longitude, CartesianRepresentation, ...
[ "astropy.coordinates.Longitude", "numpy.arctan2", "astropy.coordinates.get_body_barycentric_posvel", "sunpy.coordinates.HeliocentricInertial", "sunpy.coordinates.Heliocentric", "pytest.mark.skipif", "astropy.coordinates.CartesianRepresentation", "sunpy.coordinates.transformations.transform_with_sun_ce...
[((22357, 22451), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(astropy.__version__ < '3.2.0')"], {'reason': '"""Not supported by Astropy <3.2"""'}), "(astropy.__version__ < '3.2.0', reason=\n 'Not supported by Astropy <3.2')\n", (22375, 22451), False, 'import pytest\n'), ((33417, 33480), 'pytest.mark.parametrize'...
""" tests for time conversions relevant to MSISE00 """ from __future__ import annotations import datetime import typing import numpy as np from pytest import approx import sciencedates as sd T: list[typing.Any] = [datetime.datetime(2013, 7, 2, 12, 0, 0)] T.append(T[0].date()) T.append(np.datetime64(T[0])) T.append(...
[ "numpy.datetime64", "sciencedates.datetime2gtd", "datetime.datetime", "numpy.arange", "pytest.approx" ]
[((218, 257), 'datetime.datetime', 'datetime.datetime', (['(2013)', '(7)', '(2)', '(12)', '(0)', '(0)'], {}), '(2013, 7, 2, 12, 0, 0)\n', (235, 257), False, 'import datetime\n'), ((290, 309), 'numpy.datetime64', 'np.datetime64', (['T[0]'], {}), '(T[0])\n', (303, 309), True, 'import numpy as np\n'), ((415, 442), 'scienc...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import ovito as ov import glob import numpy as np import matplotlib.pyplot as plt import os from scipy import optimize import pickle from itertools import product from multiprocessing import get_context def func(x, phi_l): a = (4/3)*np.pi*-2 b = 2*1.919 q = (...
[ "ovito.io.import_file", "numpy.count_nonzero", "os.getcwd", "ovito.modifiers.ConstructSurfaceModifier", "numpy.zeros", "scipy.optimize.fsolve", "multiprocessing.get_context", "numpy.append", "numpy.linspace", "glob.glob", "itertools.product", "numpy.round", "ovito.modifiers.SelectTypeModifie...
[((5286, 5297), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5295, 5297), False, 'import os\n'), ((5315, 5343), 'glob.glob', 'glob.glob', (["(folder + '/*.pdb')"], {}), "(folder + '/*.pdb')\n", (5324, 5343), False, 'import glob\n'), ((507, 530), 'ovito.io.import_file', 'ov.io.import_file', (['file'], {}), '(file)\n', (...
import cv2 import torch import numpy as np from torch import nn from collections import OrderedDict from torch.nn.functional import one_hot from utils.box.bbox import bbox_switch, angle_switch, bbox_iou, encode, decode from utils.box.ext.rotate_overlap_diff.oriented_iou_loss import cal_iou, cal_diou, cal_giou from uti...
[ "torch.nn.BCEWithLogitsLoss", "torch.zeros_like", "utils.box.bbox.encode", "utils.box.bbox.angle_switch", "torch.nn.functional.one_hot", "utils.utils.soft_weight", "utils.box.rbbox.rbbox_batched_nms", "utils.box.bbox.decode", "torch.max", "torch.zeros", "utils.box.bbox.bbox_switch", "torch.nn....
[((461, 478), 'utils.box.bbox.angle_switch', 'angle_switch', (['gts'], {}), '(gts)\n', (473, 478), False, 'from utils.box.bbox import bbox_switch, angle_switch, bbox_iou, encode, decode\n'), ((497, 516), 'utils.box.bbox.angle_switch', 'angle_switch', (['preds'], {}), '(preds)\n', (509, 516), False, 'from utils.box.bbox...
import os import numpy as np import string import re dataDir = '/u/cs401/A3/data/' # dataDir = './subdata/' def Levenshtein(r, h): """ Calculation of WER with Levenshtein distance. ...
[ "os.path.join", "numpy.std", "os.walk", "numpy.zeros", "numpy.mean", "numpy.arange", "re.sub", "re.compile" ]
[((2123, 2147), 'numpy.zeros', 'np.zeros', (['(n + 1, m + 1)'], {}), '((n + 1, m + 1))\n', (2131, 2147), True, 'import numpy as np\n'), ((2178, 2202), 'numpy.zeros', 'np.zeros', (['(n + 1, m + 1)'], {}), '((n + 1, m + 1))\n', (2186, 2202), True, 'import numpy as np\n'), ((2258, 2274), 'numpy.arange', 'np.arange', (['(n...
import os import sys import time from glob import glob import numpy as np import pandas as pd import pytest from PartSegCore.algorithm_describe_base import SegmentationProfile from PartSegCore.analysis.batch_processing import batch_backend from PartSegCore.analysis.batch_processing.batch_backend import CalculationMan...
[ "PartSegCore.analysis.calculation_plan.MaskSuffix", "PartSegCore.analysis.calculation_plan.CalculationPlan", "os.path.basename", "PartSegCore.analysis.calculation_plan.CalculationTree", "PartSegImage.TiffImageReader.read_image", "PartSegImage.Image", "numpy.zeros", "PartSegCore.analysis.measurement_ca...
[((12277, 12341), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:This method will be removed"""'], {}), "('ignore:This method will be removed')\n", (12303, 12341), False, 'import pytest\n'), ((13743, 13807), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:This method w...
''' total number of delimeters total number of hyphens the length of the hostname the length of the entire URL the number of dots a binary feature for each token in the hostname a binary feature for each token in the path ''' from urllib.parse import urlparse import whois import tldextract import pandas as pd import n...
[ "numpy.load", "numpy.save", "numpy.set_printoptions", "tldextract.extract", "pandas.read_csv", "numpy.array", "pandas.set_option", "urllib.parse.urlparse" ]
[((332, 375), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(10000)'], {}), "('display.max_columns', 10000)\n", (345, 375), True, 'import pandas as pd\n'), ((376, 416), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(10000)'], {}), "('display.max_rows', 10000)\n", (389, 416),...
import numpy as np from scipy import stats from pm4py.algo.filtering.log.start_activities import start_activities_filter def start_activities(log): log_start = start_activities_filter.get_start_activities(log) n_unique_start_activities = len(log_start) start_activities_occurrences = list(log_start.value...
[ "scipy.stats.iqr", "pm4py.algo.filtering.log.start_activities.start_activities_filter.get_start_activities", "numpy.median", "numpy.std", "numpy.percentile", "scipy.stats.skew", "numpy.min", "numpy.mean", "numpy.max", "scipy.stats.kurtosis", "numpy.var" ]
[((166, 215), 'pm4py.algo.filtering.log.start_activities.start_activities_filter.get_start_activities', 'start_activities_filter.get_start_activities', (['log'], {}), '(log)\n', (210, 215), False, 'from pm4py.algo.filtering.log.start_activities import start_activities_filter\n'), ((352, 388), 'numpy.min', 'np.min', (['...
import os import numpy as np from demo_utils import plot_image import svmbir """ This file demonstrates the generation of a 3D microscopy phantom followed by sinogram projection and reconstruction using MBIR. The phantom, sinogram, and reconstruction are then displayed. """ # Simulated image parameters num_rows = 2...
[ "os.makedirs", "svmbir.phantom.nrmse", "svmbir.recon", "numpy.linspace", "demo_utils.plot_image", "svmbir.phantom.gen_microscopy_sample_3d" ]
[((792, 863), 'svmbir.phantom.gen_microscopy_sample_3d', 'svmbir.phantom.gen_microscopy_sample_3d', (['num_rows', 'num_cols', 'num_slices'], {}), '(num_rows, num_cols, num_slices)\n', (831, 863), False, 'import svmbir\n'), ((908, 955), 'numpy.linspace', 'np.linspace', (['(-tilt_angle)', 'tilt_angle', 'num_views'], {}),...
""" Copyright 2013 <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 writing, software distrib...
[ "numpy.abs" ]
[((2147, 2170), 'numpy.abs', 'np.abs', (['self.expr.value'], {}), '(self.expr.value)\n', (2153, 2170), True, 'import numpy as np\n'), ((4407, 4430), 'numpy.abs', 'np.abs', (['self.expr.value'], {}), '(self.expr.value)\n', (4413, 4430), True, 'import numpy as np\n')]
"""Test the cross_validation module""" from __future__ import division import warnings import numpy as np from scipy.sparse import coo_matrix from scipy.sparse import csr_matrix from scipy import stats from sklearn.exceptions import ConvergenceWarning from sklearn.utils.testing import assert_true from sklearn.utils.t...
[ "sklearn.datasets.load_digits", "sklearn.datasets.load_iris", "numpy.sum", "numpy.abs", "sklearn.utils.testing.assert_raise_message", "sklearn.datasets.make_multilabel_classification", "sklearn.utils.testing.assert_equal", "sklearn.utils.mocking.CheckingClassifier", "numpy.ones", "sklearn.utils.te...
[((4572, 4588), 'numpy.ones', 'np.ones', (['(10, 2)'], {}), '((10, 2))\n', (4579, 4588), True, 'import numpy as np\n'), ((4600, 4613), 'scipy.sparse.coo_matrix', 'coo_matrix', (['X'], {}), '(X)\n', (4610, 4613), False, 'from scipy.sparse import coo_matrix\n'), ((1044, 1069), 'warnings.catch_warnings', 'warnings.catch_w...
import numpy as np from example import algs def test_pointless_sort(): # generate random vector of length 10 x = np.random.rand(10) # check that pointless_sort always returns [1,2,3] assert np.array_equal(algs.pointless_sort(x), np.array([1,2,3])) # generate a new random vector of length 10 x...
[ "numpy.random.rand", "example.algs.bubblesort", "numpy.array", "example.algs.pointless_sort" ]
[((122, 140), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (136, 140), True, 'import numpy as np\n'), ((323, 341), 'numpy.random.rand', 'np.random.rand', (['(10)'], {}), '(10)\n', (337, 341), True, 'import numpy as np\n'), ((223, 245), 'example.algs.pointless_sort', 'algs.pointless_sort', (['x'], {}...
# -*- coding: utf-8 -*- """ Generating image window by weighted sampling map from input image This can also be considered as a `weighted random cropping` layer of the input image """ from __future__ import absolute_import, division, print_function import numpy as np import tensorflow as tf from niftynet.engine.image_...
[ "tensorflow.logging.info", "tensorflow.logging.fatal", "numpy.argmax", "numpy.asarray", "numpy.floor", "numpy.zeros", "numpy.unravel_index", "numpy.ones", "numpy.argsort", "niftynet.engine.sampler_uniform.UniformSampler.__init__", "numpy.max", "numpy.append", "numpy.sort", "numpy.random.ra...
[((3368, 3413), 'numpy.asarray', 'np.asarray', (['spatial_win_sizes'], {'dtype': 'np.int32'}), '(spatial_win_sizes, dtype=np.int32)\n', (3378, 3413), True, 'import numpy as np\n'), ((3436, 3469), 'numpy.max', 'np.max', (['spatial_win_sizes'], {'axis': '(0)'}), '(spatial_win_sizes, axis=0)\n', (3442, 3469), True, 'impor...
import argparse import cv2 as cv import numpy as np from trainer.config import img_rows, img_cols if __name__ == '__main__': ap = argparse.ArgumentParser() ap.add_argument("-x0") ap.add_argument("-y0") ap.add_argument("-x1") ap.add_argument("-y1") args = vars(ap.parse_args()) x0 = int(args...
[ "cv2.imwrite", "cv2.imshow", "numpy.zeros", "argparse.ArgumentParser" ]
[((136, 161), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (159, 161), False, 'import argparse\n'), ((417, 466), 'numpy.zeros', 'np.zeros', (['(img_rows, img_cols, 1)'], {'dtype': 'np.uint8'}), '((img_rows, img_cols, 1), dtype=np.uint8)\n', (425, 466), True, 'import numpy as np\n'), ((507, 53...
import os import sys import numpy as np from math import floor def splitset(dataset, parts): """Partition data into "parts" partitions""" n = dataset.shape[0] local_n = floor(n/parts) result = [] for i in range(parts): result.append(dataset[i*local_n: (i+1)*local_n]) return np.array(res...
[ "os.mkdir", "numpy.load", "os.getcwd", "math.floor", "os.path.exists", "numpy.array" ]
[((182, 198), 'math.floor', 'floor', (['(n / parts)'], {}), '(n / parts)\n', (187, 198), False, 'from math import floor\n'), ((308, 324), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (316, 324), True, 'import numpy as np\n'), ((476, 501), 'numpy.load', 'np.load', (['"""data/mnist.npz"""'], {}), "('data/mn...
import numpy as np def approximate_error(motif): """Calculate approximate error""" pwm = motif.pwm bases = list(pwm.keys()) n = sum(motif.counts[bases[0]]) approx_error = (len(bases)-1)/(2 * np.log(2) * n) return approx_error def exact_error(motif): """Calculate exact error, using multin...
[ "numpy.log2", "numpy.log" ]
[((213, 222), 'numpy.log', 'np.log', (['(2)'], {}), '(2)\n', (219, 222), True, 'import numpy as np\n'), ((603, 613), 'numpy.log2', 'np.log2', (['p'], {}), '(p)\n', (610, 613), True, 'import numpy as np\n'), ((1828, 1846), 'numpy.log2', 'np.log2', (['pwm[b][l]'], {}), '(pwm[b][l])\n', (1835, 1846), True, 'import numpy a...
""" :py:class:`Utils` - a set of generic utilities ============================================== Usage:: # assuming that $PYTHONPATH=.../lcls2/psana # Run test: python lcls2/psana/psana/pyalgos/generic/Utils.py 1 # Import from psana.pyalgos.generic.Utils import input_single_char import psana.p...
[ "sys.stdout.write", "time.strptime", "pickle.dump", "getpass.getuser", "os.popen", "termios.tcsetattr", "time.mktime", "os.path.isfile", "sys.stdout.flush", "scipy.misc.imsave", "subprocess.getoutput", "os.path.join", "os.path.lexists", "os.path.dirname", "numpy.savetxt", "os.path.exis...
[((3460, 3489), 'logging.getLogger', 'logging.getLogger', (['"""__name__"""'], {}), "('__name__')\n", (3477, 3489), False, 'import logging\n'), ((4586, 4611), 'os.environ.get', 'os.environ.get', (['env', 'None'], {}), '(env, None)\n', (4600, 4611), False, 'import os\n'), ((4705, 4725), 'socket.gethostname', 'socket.get...
# -*- coding: utf-8 -*- """ TODO: Fix slowness Fix sorting so columns are initially sorted in ascending order """ import logging from wbia.guitool.__PYQT__ import QtCore, QtGui, QVariantHack from wbia.guitool.__PYQT__.QtCore import Qt from wbia.guitool import qtype from wbia.guitool.guitool_decorators import ...
[ "utool.is_funclike", "utool.replace_nones", "utool.grab_test_imgpath", "numpy.isnan", "utool.noinject", "six.moves.zip", "utool.get_argflag", "wbia.guitool.api_tree_node.TreeNode", "wbia.guitool.__PYQT__.QVariantHack", "utool.printex", "wbia.guitool.ensure_qapp", "wbia.guitool.qtype.cast_from_...
[((796, 821), 'logging.getLogger', 'logging.getLogger', (['"""wbia"""'], {}), "('wbia')\n", (813, 821), False, 'import logging\n'), ((822, 861), 'utool.noinject', 'ut.noinject', (['__name__', '"""[APIItemModel]"""'], {}), "(__name__, '[APIItemModel]')\n", (833, 861), True, 'import utool as ut\n'), ((1013, 1057), 'utool...
# -*- coding: utf-8 -*- from __future__ import division, absolute_import, unicode_literals import datetime as dt from io import StringIO import logging import numpy as np import pytest from sys import version_info import warnings import aacgmv2 class TestFutureDepWarning: def setup(self): # Initialize th...
[ "warnings.simplefilter", "numpy.testing.assert_almost_equal", "aacgmv2.deprecated.subsol", "aacgmv2.deprecated.gc2gd_lat", "datetime.datetime", "numpy.array", "warnings.catch_warnings", "numpy.testing.assert_allclose", "aacgmv2.deprecated.igrf_dipole_axis" ]
[((1307, 1339), 'datetime.datetime', 'dt.datetime', (['(2015)', '(1)', '(1)', '(0)', '(0)', '(0)'], {}), '(2015, 1, 1, 0, 0, 0)\n', (1318, 1339), True, 'import datetime as dt\n'), ((2151, 2183), 'datetime.datetime', 'dt.datetime', (['(2015)', '(1)', '(1)', '(0)', '(0)', '(0)'], {}), '(2015, 1, 1, 0, 0, 0)\n', (2162, 21...
""" Bilateral Filtering A bilateral filter is used for smoothening images and reducing noise, while preserving edges. """ import cv2 # read the image import numpy as np img = cv2.imread("../images/taj.jpg") # apply bilateral filter width s = 15 # sigmaColor = sigmaSpace = 75 bilateral = cv2.bilateralFi...
[ "cv2.GaussianBlur", "cv2.medianBlur", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.blur", "numpy.hstack", "cv2.bilateralFilter", "cv2.imread", "cv2.imshow" ]
[((191, 222), 'cv2.imread', 'cv2.imread', (['"""../images/taj.jpg"""'], {}), "('../images/taj.jpg')\n", (201, 222), False, 'import cv2\n'), ((305, 341), 'cv2.bilateralFilter', 'cv2.bilateralFilter', (['img', '(15)', '(75)', '(75)'], {}), '(img, 15, 75, 75)\n', (324, 341), False, 'import cv2\n'), ((377, 398), 'cv2.blur'...
""" This script creates an instance of a sacred experiment and defines default configurations. """ from src.neural_nets.models import get_model from src.neural_nets.load_data import get_loader from src.neural_nets.metrics import MaskedBCE, Accuracy, compute_acc, compute_loss import src.regression.logistic_regression ...
[ "numpy.random.seed", "src.neural_nets.load_data.get_loader", "src.neural_nets.metrics.compute_loss", "src.neural_nets.models.get_model", "torch.optim.lr_scheduler.LambdaLR", "torch.autograd.set_detect_anomaly", "torch.device", "src.neural_nets.metrics.MaskedBCE", "random.randint", "src.regression....
[((916, 941), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (939, 941), False, 'import torch\n'), ((969, 980), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (978, 980), False, 'import os\n'), ((2195, 2231), 'torch.distributions.Uniform', 'torch.distributions.Uniform', (['(0)', '(0.75)'], {}), '(...
#!/usr/bin/env python """polymer.py - prototype bond breaking reactions: Uses hydrogels to configure the following system 2 reactions: -A-A-A- + E -> -A-B-A- + E (spatial) r=2.0, k=1.0 { (structural) k=10000... -A-B-A- -> -A + A-A- A-B -> C + C } 2 particle_types: E (enzyme) ...
[ "pandas.DataFrame", "hydrogels.utils.topology.TopologyBond", "argparse.ArgumentParser", "hydrogels.utils.topology.Topology", "pandas.read_csv", "softnanotools.logger.Logger", "hydrogels.utils.system.System", "pathlib.Path", "readdy.StructuralReactionRecipe", "numpy.array", "yaml.safe_load", "n...
[((750, 767), 'softnanotools.logger.Logger', 'Logger', (['"""POLYMER"""'], {}), "('POLYMER')\n", (756, 767), False, 'from softnanotools.logger import Logger\n'), ((1117, 1210), 'hydrogels.utils.topology.TopologyBond', 'TopologyBond', (['"""harmonic"""', 'monomer', 'monomer'], {'length': 'length', 'force_constant': 'for...
import healpy as hp import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import scipy.special as spc import math import matplotlib as mpl from scipy.special import lpmn import scipy.integrate as integrate from scipy.integrate import quad from numpy import sin, cos from matplotlib.cm import Scal...
[ "random.randint", "healpy.mollview", "healpy.graticule", "numpy.zeros", "healpy.nside2npix", "matplotlib.pyplot.savefig" ]
[((365, 385), 'healpy.nside2npix', 'hp.nside2npix', (['nside'], {}), '(nside)\n', (378, 385), True, 'import healpy as hp\n'), ((419, 449), 'numpy.zeros', 'np.zeros', (['npix'], {'dtype': 'np.float'}), '(npix, dtype=np.float)\n', (427, 449), True, 'import numpy as np\n'), ((728, 826), 'healpy.mollview', 'hp.mollview', (...
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved. import dace from dace.memlet import Memlet import numpy as np sr = dace.SDFG('strided_range_test') s0 = sr.add_state('s0') A = s0.add_array('A', [2, 16, 4], dace.float32) B = s0.add_array('B', [16], dace.float32) tasklet = s0.add_tasklet( ...
[ "dace.memlet.Memlet.simple", "numpy.array", "numpy.linalg.norm", "numpy.random.rand", "dace.SDFG" ]
[((144, 175), 'dace.SDFG', 'dace.SDFG', (['"""strided_range_test"""'], {}), "('strided_range_test')\n", (153, 175), False, 'import dace\n'), ((644, 684), 'dace.memlet.Memlet.simple', 'Memlet.simple', (['A', '"""1, 2*i:2*i+10:8:2, 3"""'], {}), "(A, '1, 2*i:2*i+10:8:2, 3')\n", (657, 684), False, 'from dace.memlet import ...
from builtins import zip from builtins import range import numpy as np def save_data_regresssion(): # n = 20 # number of labeled/training data # D = 1 # dimension of input data x = np.array([[2.083970427750732, -0.821018066101379, -0.617870699182597, -1.183822608860694,\ 0.2740...
[ "numpy.zeros_like", "numpy.ones", "numpy.prod", "numpy.array", "numpy.linalg.inv", "numpy.arange", "numpy.dot", "numpy.eye", "numpy.savez", "builtins.range", "numpy.concatenate", "numpy.sqrt" ]
[((1348, 1409), 'numpy.savez', 'np.savez', (['"""Regression/regression_data"""'], {'x': 'x', 'y': 'y', 'xstar': 'xstar'}), "('Regression/regression_data', x=x, y=y, xstar=xstar)\n", (1356, 1409), True, 'import numpy as np\n'), ((1899, 5413), 'numpy.array', 'np.array', (['[[0.089450165731417, -0.000700765006939], [1.171...
import torch import torch.optim as optim import numpy as np from PIL import Image #import pano import pano_gen as pano import time def vecang(vec1, vec2): vec1 = vec1 / np.sqrt((vec1 ** 2).sum()) vec2 = vec2 / np.sqrt((vec2 ** 2).sum()) return np.arccos(np.dot(vec1, vec2)) def rotatevec(vec, theta): ...
[ "torch.cat", "torch.cos", "torch.ceil", "numpy.mean", "torch.arange", "torch.no_grad", "pano_gen.fit_avg_z", "torch.FloatTensor", "numpy.append", "torch.atan2", "numpy.stack", "torch.zeros_like", "pano_gen.constraint_cor_id_same_z", "torch.floor", "numpy.dot", "numpy.concatenate", "t...
[((451, 468), 'torch.cat', 'torch.cat', (['[x, y]'], {}), '([x, y])\n', (460, 468), False, 'import torch\n'), ((840, 864), 'torch.cat', 'torch.cat', (['[u, v]'], {'dim': '(1)'}), '([u, v], dim=1)\n', (849, 864), False, 'import torch\n'), ((3390, 3429), 'torch.stack', 'torch.stack', (['[corid[:, 1], corid[:, 0]]'], {}),...
""" Prior class for use in pisa.core.Param objects """ from __future__ import absolute_import, division from collections import Iterable, OrderedDict from numbers import Number from operator import setitem import numpy as np from scipy.interpolate import splev, splrep, interp1d from scipy.optimize import fminbound ...
[ "numpy.abs", "matplotlib.pyplot.figure", "numpy.sin", "pisa.utils.log.logging.info", "scipy.interpolate.interp1d", "matplotlib.pyplot.tight_layout", "pisa.utils.log.logging.debug", "pisa.utils.fileio.from_file", "numpy.max", "numpy.linspace", "scipy.interpolate.splrep", "pisa.utils.log.set_ver...
[((15175, 15189), 'matplotlib.use', 'mpl.use', (['"""pdf"""'], {}), "('pdf')\n", (15182, 15189), True, 'import matplotlib as mpl\n'), ((15439, 15480), 'pisa.utils.log.logging.info', 'logging.info', (['"""Plotting Prior: %s"""', 'prior'], {}), "('Plotting Prior: %s', prior)\n", (15451, 15480), False, 'from pisa.utils.lo...
import sys import unittest import numpy as np import crocoddyl import pinocchio from crocoddyl.utils import (CoMPositionCostDerived, ControlCostDerived, FramePlacementCostDerived, FrameTranslationCostDerived, FrameVelocityCostDerived, StateCostDerived) class CostModelAbstractTestCase(un...
[ "numpy.allclose", "pinocchio.forwardKinematics", "unittest.TestLoader", "pinocchio.jacobianCenterOfMass", "crocoddyl.CostModelCoMPosition", "crocoddyl.utils.FrameVelocityCostDerived", "pinocchio.SE3.Random", "crocoddyl.utils.FrameTranslationCostDerived", "crocoddyl.CostModelState", "pinocchio.comp...
[((6529, 6571), 'pinocchio.buildSampleModelHumanoidRandom', 'pinocchio.buildSampleModelHumanoidRandom', ([], {}), '()\n', (6569, 6571), False, 'import pinocchio\n'), ((6590, 6627), 'crocoddyl.StateMultibody', 'crocoddyl.StateMultibody', (['ROBOT_MODEL'], {}), '(ROBOT_MODEL)\n', (6614, 6627), False, 'import crocoddyl\n'...
# # Copyright (c) 2017, UT-BATTELLE, LLC # All rights reserved. # # This software is released under the BSD license detailed # in the LICENSE file in the top level a-prime directory # import numpy from get_season_months_index import get_season_months_index def get_days_in_season_months(begin_month, end_month): da...
[ "get_season_months_index.get_season_months_index", "numpy.array" ]
[((334, 395), 'numpy.array', 'numpy.array', (['[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]'], {}), '([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])\n', (345, 395), False, 'import numpy\n'), ((433, 480), 'get_season_months_index.get_season_months_index', 'get_season_months_index', (['begin_month', 'end_month'], ...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import division import time from datetime import datetime import warnings import numpy as np import pandas as pd from numpy import dot, exp from numpy.linalg import norm, inv from scipy.linalg import solve as spsolve from scipy.integrate im...
[ "lifelines.utils.significance_codes_as_text", "scipy.linalg.solve", "lifelines.statistics.chisq_test", "numpy.empty", "numpy.ones", "numpy.isnan", "numpy.argsort", "datetime.datetime.utcnow", "matplotlib.pyplot.figure", "numpy.linalg.norm", "numpy.exp", "lifelines.utils.normalize", "numpy.un...
[((5481, 5510), 'lifelines.utils.coalesce', 'coalesce', (['strata', 'self.strata'], {}), '(strata, self.strata)\n', (5489, 5510), False, 'from lifelines.utils import survival_table_from_events, inv_normal_cdf, normalize, significance_code, significance_codes_as_text, concordance_index, _get_index, qth_survival_times, p...
from torch.utils.data import Dataset from scipy import ndimage from .augmentation import augmentation import skimage import imageio import numpy as np import h5py import os import random class NeuroDataset(Dataset): def __init__(self, data_path, phase='train', transform=False, target_channels="3"): """Cus...
[ "h5py.File", "numpy.expand_dims" ]
[((1287, 1312), 'numpy.expand_dims', 'np.expand_dims', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (1301, 1312), True, 'import numpy as np\n'), ((951, 981), 'h5py.File', 'h5py.File', (['self.data_path', '"""r"""'], {}), "(self.data_path, 'r')\n", (960, 981), False, 'import h5py\n'), ((1172, 1202), 'h5py.File', 'h5py.Fil...
'''Code obtained from https://github.com/gitshanks/fer2013''' # load json and create model from __future__ import division from keras.models import Sequential from keras.layers import Dense from keras.models import model_from_json import numpy import os import numpy as np json_file = open('web_app/keras_model.json', '...
[ "numpy.load", "keras.models.model_from_json", "numpy.save" ]
[((394, 428), 'keras.models.model_from_json', 'model_from_json', (['loaded_model_json'], {}), '(loaded_model_json)\n', (409, 428), False, 'from keras.models import model_from_json\n'), ((574, 608), 'numpy.load', 'np.load', (['"""data/keras_modXtest.npy"""'], {}), "('data/keras_modXtest.npy')\n", (581, 608), True, 'impo...
#!/usr/bin/env python3 import sys sys.path.append("../") import plotlib import numpy import pylab import networkx import pickle import sys G,pos=pickle.load(open("graph.pickle","rb")) a_arr, m_hist, cor_hist=pickle.load(open("results.pickle","rb")) e=numpy.loadtxt("eigenval.csv", delimiter=",") v=numpy.loadtxt("eige...
[ "sys.path.append", "numpy.sum", "numpy.zeros", "numpy.argsort", "numpy.around", "numpy.linalg.norm", "numpy.loadtxt" ]
[((35, 57), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (50, 57), False, 'import sys\n'), ((254, 298), 'numpy.loadtxt', 'numpy.loadtxt', (['"""eigenval.csv"""'], {'delimiter': '""","""'}), "('eigenval.csv', delimiter=',')\n", (267, 298), False, 'import numpy\n'), ((301, 345), 'numpy.loadtxt'...
from .helpers import dualLP, optimalLP, optimalLPConstant import numpy as np def computeCostMinPoA(n, B, f, options=None): ''' Authors: <NAME>, <NAME> and <NAME> Copyright(c) 2020 <NAME>, <NAME>, <NAME>. All rights reserved. See LICENSE file in the project root for full license information. ...
[ "numpy.pad", "numpy.shape", "numpy.zeros", "numpy.arange" ]
[((4569, 4601), 'numpy.zeros', 'np.zeros', (['(m, n)'], {'dtype': 'np.float'}), '((m, n), dtype=np.float)\n', (4577, 4601), True, 'import numpy as np\n'), ((4628, 4640), 'numpy.arange', 'np.arange', (['m'], {}), '(m)\n', (4637, 4640), True, 'import numpy as np\n'), ((7957, 7989), 'numpy.zeros', 'np.zeros', (['(m, n)'],...
import folium import numpy as np from folium.plugins import HeatMap, MarkerCluster import pandas as pd from math import sin, cos, acos, asin, atan2, radians, degrees def plot_circle(lat, lon, radius, map=None, **kwargs): """ Plot a circle on a map (creating a new folium map instance if necessary). Parame...
[ "folium.map.Marker", "numpy.average", "math.asin", "math.atan2", "pandas.read_csv", "math.radians", "folium.plugins.HeatMap", "math.sin", "folium.Circle", "math.cos", "folium.Map", "folium.plugins.MarkerCluster", "folium.PolyLine", "math.degrees" ]
[((2603, 2610), 'math.asin', 'asin', (['z'], {}), '(z)\n', (2607, 2610), False, 'from math import sin, cos, acos, asin, atan2, radians, degrees\n'), ((2624, 2633), 'math.cos', 'cos', (['rlat'], {}), '(rlat)\n', (2627, 2633), False, 'from math import sin, cos, acos, asin, atan2, radians, degrees\n'), ((5734, 5790), 'pan...
import numpy as np from matplotlib import pyplot as plt from .interval import Interval class Pbox(object): def __init__(self, left=None, right=None, steps=200, shape=None, mean_left=None, mean_right=None, var_left=None, var_right=None, interpolation='linear'): if (left is not None) and (right is None): ...
[ "numpy.minimum", "numpy.maximum", "matplotlib.pyplot.show", "numpy.copy", "matplotlib.pyplot.plot", "numpy.flip", "numpy.empty", "numpy.isinf", "numpy.isnan", "numpy.any", "numpy.sort", "numpy.max", "numpy.mean", "numpy.array", "numpy.min", "numpy.linspace", "numpy.all", "numpy.rep...
[((18611, 18621), 'numpy.sort', 'np.sort', (['u'], {}), '(u)\n', (18618, 18621), True, 'import numpy as np\n'), ((18830, 18843), 'numpy.sort', 'np.sort', (['vals'], {}), '(vals)\n', (18837, 18843), True, 'import numpy as np\n'), ((20015, 20026), 'numpy.array', 'np.array', (['u'], {}), '(u)\n', (20023, 20026), True, 'im...
""" test automol.graph """ import numpy import automol from automol import graph C8H13O_CGR = ( {0: ('C', 3, None), 1: ('C', 2, None), 2: ('C', 3, None), 3: ('C', 1, None), 4: ('C', 1, None), 5: ('C', 1, None), 6: ('C', 1, None), 7: ('C', 1, None), 8: ('O', 0, None)}, {frozenset({1, 4}): (1, None),...
[ "automol.graph.transform_keys", "automol.graph.atom_symbols", "automol.graph.from_index_based_stereo", "automol.graph.stereogenic_bond_keys", "automol.graph.atom_stereo_parities", "automol.graph.string", "automol.graph.subgraph", "automol.graph.resonance_dominant_radical_atom_keys", "automol.graph.t...
[((14521, 14548), 'automol.graph.atom_keys', 'graph.atom_keys', (['C8H13O_CGR'], {}), '(C8H13O_CGR)\n', (14536, 14548), False, 'from automol import graph\n'), ((14559, 14656), 'automol.graph.set_atom_implicit_hydrogen_valences', 'graph.set_atom_implicit_hydrogen_valences', (['C8H13O_CGR', '{atm_key: (0) for atm_key in ...
import botbowl from botbowl.core import Action, Agent import numpy as np from copy import deepcopy import random import time from botbowl.core.model import Team PRINT = False IGNORE_IN_GAME = [botbowl.ActionType.PLACE_PLAYER, botbowl.ActionType.END_SETUP, botbowl.ActionType.SETUP_FORMATION_SPREAD, b...
[ "copy.deepcopy", "numpy.log", "numpy.argmax", "time.time", "botbowl.core.Action", "numpy.random.choice", "botbowl.register_bot" ]
[((7138, 7191), 'botbowl.register_bot', 'botbowl.register_bot', (['"""MCTS-bot-budget-10"""', 'SearchBot'], {}), "('MCTS-bot-budget-10', SearchBot)\n", (7158, 7191), False, 'import botbowl\n'), ((3561, 3575), 'copy.deepcopy', 'deepcopy', (['game'], {}), '(game)\n', (3569, 3575), False, 'from copy import deepcopy\n'), (...
import math import matplotlib import numpy as np from typing import Sequence from PIL import Image from io import BytesIO from contextlib import contextmanager from matplotlib.artist import Artist from matplotlib.axes import Axes from figpptx.slide_editor import SlideTransformer, Box def to_image(arg, **kwargs): ...
[ "io.BytesIO", "math.ceil", "figpptx.slide_editor.Box.from_vertices", "math.floor", "numpy.clip", "figpptx.artist_misc.to_figure", "PIL.Image.open", "numpy.min", "numpy.where", "numpy.array", "numpy.max", "figpptx.slide_editor.Box.union", "figpptx.slide_editor.SlideTransformer" ]
[((1432, 1441), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (1439, 1441), False, 'from io import BytesIO\n'), ((4024, 4039), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (4032, 4039), True, 'import numpy as np\n'), ((4081, 4101), 'numpy.where', 'np.where', (['(alpha != 0)'], {}), '(alpha != 0)\n', (4089, 410...
import pytest import numpy as np from numpy.testing import assert_, run_module_suite from qutip import (smesolve, mesolve, photocurrent_mesolve, liouvillian, QobjEvo, spre, spost, destroy, coherent, parallel_map, qeye, fock_dm, general_stochastic, ket2dm, num) def f(t, args): ...
[ "qutip.num", "qutip.coherent", "numpy.sin", "qutip.destroy", "qutip.fock_dm", "numpy.testing.run_module_suite", "numpy.linspace", "qutip.photocurrent_mesolve", "qutip.mesolve", "qutip.spre", "numpy.stack", "qutip.smesolve", "numpy.tanh", "qutip.qeye", "numpy.testing.assert_", "numpy.co...
[((583, 593), 'numpy.cos', 'np.cos', (['th'], {}), '(th)\n', (589, 593), True, 'import numpy as np\n'), ((605, 615), 'numpy.sin', 'np.sin', (['th'], {}), '(th)\n', (611, 615), True, 'import numpy as np\n'), ((692, 699), 'qutip.qeye', 'qeye', (['N'], {}), '(N)\n', (696, 699), False, 'from qutip import smesolve, mesolve,...
from typing import Dict, List, Union from typeguard import check_argument_types import tensorflow as tf import numpy as np from neuralmonkey.decoders.autoregressive import AutoregressiveDecoder from neuralmonkey.decoders.sequence_labeler import SequenceLabeler from neuralmonkey.decorators import tensor from neuralmon...
[ "numpy.mean", "typeguard.check_argument_types" ]
[((1083, 1105), 'typeguard.check_argument_types', 'check_argument_types', ([], {}), '()\n', (1103, 1105), False, 'from typeguard import check_argument_types\n'), ((739, 789), 'numpy.mean', 'np.mean', (["[res['xents'] for res in results]"], {'axis': '(0)'}), "([res['xents'] for res in results], axis=0)\n", (746, 789), T...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 1 15:45:38 2022 @author: erri """ import numpy as np import os run = 'q07_1' DoD_name = 'DoD_s1-s0_filt_nozero_rst.txt' home_dir = os.getcwd() DoDs_dir = os.path.join(home_dir, 'DoDs') DoD_path = os.path.join(DoDs_dir, 'DoD_' + run, DoD_name) DoD ...
[ "numpy.nansum", "numpy.sum", "numpy.abs", "os.getcwd", "numpy.nanstd", "numpy.isnan", "numpy.where", "numpy.loadtxt", "os.path.join", "numpy.nanmean" ]
[((204, 215), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (213, 215), False, 'import os\n'), ((227, 257), 'os.path.join', 'os.path.join', (['home_dir', '"""DoDs"""'], {}), "(home_dir, 'DoDs')\n", (239, 257), False, 'import os\n'), ((269, 315), 'os.path.join', 'os.path.join', (['DoDs_dir', "('DoD_' + run)", 'DoD_name'],...
# Copyright 2016 <NAME> and The Novo Nordisk Foundation Center for Biosustainability, DTU. # 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 # Unle...
[ "pickle.loads", "gzip.open", "pickle.dumps", "IProgress.Percentage", "os.path.getsize", "os.path.dirname", "numpy.dtype", "time.time", "cameo.fba", "cameo.flux_analysis.analysis.n_carbon", "shutil.copyfileobj", "os.path.join", "logging.getLogger", "re.compile" ]
[((1086, 1122), 'os.path.join', 'os.path.join', (['config.prj_dir', '"""data"""'], {}), "(config.prj_dir, 'data')\n", (1098, 1122), False, 'import os\n'), ((1136, 1174), 'os.path.join', 'os.path.join', (['config.prj_dir', '"""models"""'], {}), "(config.prj_dir, 'models')\n", (1148, 1174), False, 'import os\n'), ((1185,...
from __future__ import division import random import threading import numpy as np # Major -> Mixolydian (-) | Lydian (-) 0 # Dorian -> Minor (-) | Mixolydian (+) 1 # Phyrgian -> Locrian (-) | Minor (+) 2 # Lydian -> Mixolydian (-) | Major (+) 3 # Mixolydian -> Dorian (-) | Major (+) 4 # Min...
[ "threading.Timer", "random.choice", "numpy.clip", "random.random", "numpy.mean", "numpy.exp", "numpy.sign", "numpy.log10" ]
[((2880, 2926), 'numpy.clip', 'np.clip', (['tempo', '(old_tempo - 20)', '(old_tempo + 20)'], {}), '(tempo, old_tempo - 20, old_tempo + 20)\n', (2887, 2926), True, 'import numpy as np\n'), ((3557, 3591), 'numpy.sign', 'np.sign', (['(target_scale - scale_rank)'], {}), '(target_scale - scale_rank)\n', (3564, 3591), True, ...
import torch from torch.nn.functional import one_hot import h5py import shutil import numpy as np from pathlib import Path from tqdm import tqdm from time import time from utils.metrics import calc_ece, calc_nll_brier, BrierLoss from runners.base_runner import BaseRunner, reduce_tensor, gather_tensor class CnnRunne...
[ "tqdm.tqdm", "h5py.File", "runners.base_runner.gather_tensor", "runners.base_runner.reduce_tensor", "shutil.copy2", "torch.load", "time.time", "pathlib.Path", "numpy.mean", "torch.distributed.get_world_size", "utils.metrics.calc_nll_brier", "torch.no_grad", "utils.metrics.calc_ece", "numpy...
[((2154, 2169), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2167, 2169), False, 'import torch\n'), ((883, 917), 'torch.distributed.get_world_size', 'torch.distributed.get_world_size', ([], {}), '()\n', (915, 917), False, 'import torch\n'), ((4048, 4083), 'tqdm.tqdm', 'tqdm', (['loader'], {'total': 'self.loader...
import os import torch import pickle import pytest import tempfile import h5py import numpy as np from timeit import timeit from tianshou.data import Batch, SegmentTree, \ ReplayBuffer, ListReplayBuffer, PrioritizedReplayBuffer from tianshou.data.utils.converter import to_hdf5 if __name__ == '__main__': from ...
[ "os.remove", "numpy.abs", "numpy.allclose", "numpy.ones", "numpy.random.randint", "numpy.arange", "os.close", "timeit.timeit", "tianshou.data.ListReplayBuffer", "numpy.random.randn", "tianshou.data.PrioritizedReplayBuffer", "tianshou.data.SegmentTree", "pytest.raises", "numpy.random.choice...
[((453, 468), 'test.base.env.MyTestEnv', 'MyTestEnv', (['size'], {}), '(size)\n', (462, 468), False, 'from test.base.env import MyTestEnv\n'), ((479, 500), 'tianshou.data.ReplayBuffer', 'ReplayBuffer', (['bufsize'], {}), '(bufsize)\n', (491, 500), False, 'from tianshou.data import Batch, SegmentTree, ReplayBuffer, List...
import pickle import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from src.data_process_utils import create_folder, standardize_smi, get_encoded_smi from src.CONSTS import BATCH_SIZE_PRED def get_train_val_test_data(): create_folder('predictor_data/train_data/') create_...
[ "src.data_process_utils.get_encoded_smi", "pickle.dump", "numpy.quantile", "pandas.read_csv", "sklearn.model_selection.train_test_split", "src.data_process_utils.create_folder", "pickle.load", "pandas.concat", "numpy.vstack" ]
[((265, 308), 'src.data_process_utils.create_folder', 'create_folder', (['"""predictor_data/train_data/"""'], {}), "('predictor_data/train_data/')\n", (278, 308), False, 'from src.data_process_utils import create_folder, standardize_smi, get_encoded_smi\n'), ((313, 355), 'src.data_process_utils.create_folder', 'create_...
################ ## adaline.py ## ################ # original implementation # <NAME>, Python Machine Learning, 3rd Edition ############# ## imports ## ############# import numpy as np from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.utils.validation import check_X_y, check_is_fitted from sklear...
[ "rktools.monitors.ProgressBar", "sklearn.utils.validation.check_X_y", "numpy.random.RandomState", "sklearn.utils.validation.check_is_fitted", "sklearn.utils.multiclass.unique_labels", "numpy.dot" ]
[((1768, 1808), 'numpy.random.RandomState', 'np.random.RandomState', (['self.random_state'], {}), '(self.random_state)\n', (1789, 1808), True, 'import numpy as np\n'), ((2423, 2438), 'sklearn.utils.validation.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (2432, 2438), False, 'from sklearn.utils.validation impo...
import numpy as np from odeintw import odeintw from epidemioptim.environments.models.base_model import BaseModel from epidemioptim.utils import * PATH_TO_DATA = get_repo_path() + '/data/jane_model_data/ScenarioPlanFranceOne16.xlsx' PATH_TO_HOME_MATRIX = get_repo_path() + '/data/jane_model_data/contactHome.txt' PATH_...
[ "numpy.divide", "numpy.array", "numpy.arange", "numpy.linspace", "numpy.atleast_2d" ]
[((3881, 3897), 'numpy.divide', 'np.divide', (['Xm', 'T'], {}), '(Xm, T)\n', (3890, 3897), True, 'import numpy as np\n'), ((4130, 4143), 'numpy.array', 'np.array', (['pv2'], {}), '(pv2)\n', (4138, 4143), True, 'import numpy as np\n'), ((4154, 4167), 'numpy.array', 'np.array', (['pv3'], {}), '(pv3)\n', (4162, 4167), Tru...
# from matplotlib import rc import matplotlib.cm as mplcm import matplotlib.colors as colors import matplotlib.pyplot as plt import numpy as np import os import seaborn as sns from particle.statistics import ( calculate_avg_vel, calculate_l1_convergence, moving_average, ) from particle.processing import ( ...
[ "matplotlib.pyplot.tight_layout", "particle.processing.get_parameter_range", "matplotlib.pyplot.show", "matplotlib.pyplot.get_cmap", "matplotlib.cm.ScalarMappable", "particle.processing.load_traj_data", "particle.statistics.calculate_l1_convergence", "matplotlib.pyplot.subplots", "matplotlib.colors....
[((465, 503), 'seaborn.set', 'sns.set', ([], {'style': '"""white"""', 'context': '"""talk"""'}), "(style='white', context='talk')\n", (472, 503), True, 'import seaborn as sns\n'), ((878, 893), 'os.chdir', 'os.chdir', (['"""E:/"""'], {}), "('E:/')\n", (886, 893), False, 'import os\n'), ((1157, 1183), 'particle.processin...
from train_lstm import JigsawLSTMModel, CONFIG from pre_process import encode_sentence import numpy as np import torch import pandas as pd from tqdm import tqdm import gc import ast,emoji, string, re from torch.utils.data import Dataset, DataLoader # PyTorch Lightning import pytorch_lightning as pl MODEL_PATHS = [ ...
[ "train_lstm.JigsawLSTMModel.load_from_checkpoint", "torch.utils.data.DataLoader", "pandas.read_csv", "gc.collect", "numpy.mean", "numpy.array", "numpy.fromstring", "numpy.concatenate" ]
[((1535, 1547), 'gc.collect', 'gc.collect', ([], {}), '()\n', (1545, 1547), False, 'import gc\n'), ((2256, 2278), 'numpy.array', 'np.array', (['final_preds1'], {}), '(final_preds1)\n', (2264, 2278), True, 'import numpy as np\n'), ((2298, 2327), 'numpy.mean', 'np.mean', (['final_preds1'], {'axis': '(0)'}), '(final_preds...
# -*- coding: utf-8 -*- # @Time : 2020/11/4 16:04 # @Email : <EMAIL> # @Software: PyCharm # @License: BSD 3-Clause from itertools import combinations_with_replacement import torch.nn.functional as F import numpy as np import os import torch from numpy import random from torch import nn from torch.nn import Module...
[ "torch.nn.Dropout", "os.remove", "numpy.random.seed", "torch.cat", "numpy.random.randint", "cams.cam3d.GradCAM3dpp", "torch.device", "os.path.join", "torch.flatten", "torch.nn.Conv3d", "torch.load", "torch.utils.tensorboard.SummaryWriter", "torch.nn.Linear", "torch.zeros", "torch.random....
[((3557, 3571), 'numpy.random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (3568, 3571), False, 'from numpy import random\n'), ((3572, 3599), 'torch.random.manual_seed', 'torch.random.manual_seed', (['(0)'], {}), '(0)\n', (3596, 3599), False, 'import torch\n'), ((5152, 5227), 'torch.utils.tensorboard.SummaryWriter', '...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding 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-...
[ "inspect.getfullargspec", "copy.copy", "numpy.ravel_multi_index", "itertools.product", "functools.reduce", "math.log", "builtins.sum" ]
[((1376, 1405), 'functools.reduce', 'reduce', (['operator.mul', 'x.shape'], {}), '(operator.mul, x.shape)\n', (1382, 1405), False, 'from functools import reduce\n'), ((18610, 18630), 'copy.copy', 'copy.copy', (['in_tensor'], {}), '(in_tensor)\n', (18619, 18630), False, 'import copy\n'), ((6480, 6520), 'itertools.produc...
import torch import torch.nn.functional as F import numpy from babyai.rl.utils import DictList # dictionary that defines what head is required for each extra info used for auxiliary supervision required_heads = {'seen_state': 'binary', 'see_door': 'binary', 'see_obj': 'binary', ...
[ "torch.zeros", "numpy.mean", "babyai.rl.utils.DictList", "torch.tensor" ]
[((3547, 3571), 'babyai.rl.utils.DictList', 'DictList', (['collected_info'], {}), '(collected_info)\n', (3555, 3571), False, 'from babyai.rl.utils import DictList\n'), ((3605, 3632), 'babyai.rl.utils.DictList', 'DictList', (['extra_predictions'], {}), '(extra_predictions)\n', (3613, 3632), False, 'from babyai.rl.utils ...
import random as rd import numpy as np import networkx as nx from sklearn.metrics.cluster import normalized_mutual_info_score from sklearn.metrics.cluster import adjusted_rand_score from sklearn import metrics from numpy import linalg as LA import matplotlib.pyplot as plt from sklearn.cluster import SpectralClu...
[ "sklearn.metrics.cluster.contingency_matrix", "numpy.sum", "sklearn.cluster.SpectralClustering", "sklearn.metrics.cluster.adjusted_rand_score", "numpy.zeros", "numpy.ones", "numpy.amax", "networkx.Graph", "numpy.matmul", "networkx.is_isomorphic", "networkx.DiGraph", "sklearn.metrics.cluster.no...
[((337, 349), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (347, 349), True, 'import networkx as nx\n'), ((353, 363), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (361, 363), True, 'import networkx as nx\n'), ((655, 705), 'sklearn.metrics.cluster.contingency_matrix', 'metrics.cluster.contingency_matrix', (['y...
#!/opt/anaconda3/envs/py37/bin/python import numpy as np import twd97 import sys from cntr_kml import cntr_kml from pyproj import Proj import rasterio fname = sys.argv[1] img = rasterio.open(fname) data=np.flip(img.read()[0,:,:],[0]) l,b,r,t=img.bounds[:] LL=False if (l+r)/2==img.lnglat()[0]:LL=True x0,y0=img.xy(0,0) ...
[ "rasterio.open", "numpy.meshgrid", "cntr_kml.cntr_kml", "twd97.towgs84", "pyproj.Proj" ]
[((178, 198), 'rasterio.open', 'rasterio.open', (['fname'], {}), '(fname)\n', (191, 198), False, 'import rasterio\n'), ((855, 886), 'cntr_kml.cntr_kml', 'cntr_kml', (['data', 'lon', 'lat', 'fname'], {}), '(data, lon, lat, fname)\n', (863, 886), False, 'from cntr_kml import cntr_kml\n'), ((489, 506), 'numpy.meshgrid', '...
import numpy from sympy import Rational as frac from sympy import pi, sqrt from ..helpers import article, fsd, pm, untangle from ._helpers import Enr2Scheme citation = article( authors=["<NAME>", "<NAME>"], title="Approximate integration formulas for certain spherically symmetric regions", journal="Math. ...
[ "numpy.full", "sympy.sqrt", "sympy.Rational" ]
[((1252, 1266), 'sympy.Rational', 'frac', (['(2)', '(n + 2)'], {}), '(2, n + 2)\n', (1256, 1266), True, 'from sympy import Rational as frac\n'), ((1275, 1304), 'sympy.Rational', 'frac', (['(4 - n)', '(2 * (n + 2) ** 2)'], {}), '(4 - n, 2 * (n + 2) ** 2)\n', (1279, 1304), True, 'from sympy import Rational as frac\n'), (...
import os import time import copy import torch import matplotlib import torchvision import torch.nn as nn import numpy as np import torch.optim as optim import matplotlib.pyplot as plt from pathlib import Path from torch.optim import lr_scheduler from tor...
[ "matplotlib.pyplot.title", "torch.optim.lr_scheduler.StepLR", "torchvision.transforms.RandomHorizontalFlip", "models.trainer_class.TrainModel", "matplotlib.pyplot.imshow", "torchvision.transforms.Normalize", "torch.nn.CrossEntropyLoss", "numpy.clip", "pathlib.Path", "torchvision.transforms.CenterC...
[((657, 681), 'numpy.clip', 'np.clip', (['gridInput', '(0)', '(1)'], {}), '(gridInput, 0, 1)\n', (664, 681), True, 'import numpy as np\n'), ((692, 713), 'matplotlib.pyplot.imshow', 'plt.imshow', (['gridInput'], {}), '(gridInput)\n', (702, 713), True, 'import matplotlib.pyplot as plt\n'), ((718, 734), 'matplotlib.pyplot...
import colorsys import copy import os import time import numpy as np import torch from PIL import Image, ImageDraw, ImageFont from nets.frcnn import FasterRCNN from utils.utils import DecodeBox, get_new_img_size #--------------------------------------------# # 使用自己训练好的模型预测需要修改2个参数 # model_path和classes_path都需要修改...
[ "copy.deepcopy", "colorsys.hsv_to_rgb", "torch.load", "numpy.asarray", "numpy.floor", "utils.utils.get_new_img_size", "utils.utils.DecodeBox", "time.time", "numpy.shape", "torch.Tensor", "numpy.array", "nets.frcnn.FasterRCNN", "torch.cuda.is_available", "PIL.ImageDraw.Draw", "torch.no_gr...
[((1528, 1576), 'utils.utils.DecodeBox', 'DecodeBox', (['self.std', 'self.mean', 'self.num_classes'], {}), '(self.std, self.mean, self.num_classes)\n', (1537, 1576), False, 'from utils.utils import DecodeBox, get_new_img_size\n'), ((1759, 1796), 'os.path.expanduser', 'os.path.expanduser', (['self.classes_path'], {}), '...
from copy import copy from typing import Optional import numpy as np import pandas as pd from fedot.core.log import Log, default_log from fedot.core.repository.tasks import Task, TaskTypesEnum NAME_CLASS_STR = "<class 'str'>" NAME_CLASS_INT = "<class 'int'>" NAME_CLASS_FLOAT = "<class 'float'>" NAME_CLASS_NONE = "<c...
[ "copy.copy", "numpy.isnan", "numpy.array", "pandas.Series", "numpy.argwhere", "fedot.core.log.default_log", "numpy.delete", "pandas.to_numeric" ]
[((3397, 3451), 'copy.copy', 'copy', (["data.supplementary_data.column_types['features']"], {}), "(data.supplementary_data.column_types['features'])\n", (3401, 3451), False, 'from copy import copy\n'), ((3480, 3532), 'copy.copy', 'copy', (["data.supplementary_data.column_types['target']"], {}), "(data.supplementary_dat...
"""rv_bis_corr. Author: <NAME> Calculate and plot RV vs BIS correlation """ import numpy as np import statsmodels.api as sm from scipy.stats import pearsonr import scipy.stats as st import matplotlib.pyplot as plt def rv_bis_corr(data, confidence=0.05, name='last'): """Calculate RV vs BIS correlation and plot ...
[ "numpy.concatenate", "statsmodels.api.OLS", "numpy.power", "matplotlib.pyplot.legend", "scipy.stats.pearsonr", "numpy.array", "numpy.linspace", "statsmodels.api.add_constant", "scipy.stats.t.ppf", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((716, 728), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (724, 728), True, 'import numpy as np\n'), ((737, 749), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (745, 749), True, 'import numpy as np\n'), ((1048, 1062), 'scipy.stats.pearsonr', 'pearsonr', (['x', 'y'], {}), '(x, y)\n', (1056, 1062), False, 'fr...
import torch import functools from torch.optim import Adam from torch.utils.data import DataLoader import torchvision.transforms as transforms from torchvision.datasets import MNIST import tqdm import numpy as np from .model import ScoreNet # @title Set up the SDE device = None def marginal_prob_std(t, sigma): ...
[ "functools.partial", "torch.ones", "tqdm.tqdm", "numpy.log", "torch.randn_like", "tqdm.trange", "torch.sqrt", "torch.randn", "torch.rand", "torch.linspace", "torch.no_grad", "torch.sum", "torch.tensor" ]
[((981, 1030), 'functools.partial', 'functools.partial', (['marginal_prob_std'], {'sigma': 'sigma'}), '(marginal_prob_std, sigma=sigma)\n', (998, 1030), False, 'import functools\n'), ((1052, 1099), 'functools.partial', 'functools.partial', (['diffusion_coeff'], {'sigma': 'sigma'}), '(diffusion_coeff, sigma=sigma)\n', (...
"""Bayesian Optimization sampler : Defined only for continuous domains. For discrete inputs define another sampler""" from verifai.samplers.domain_sampler import DomainSampler import numpy as np class BayesOptSampler(DomainSampler): def __init__(self, domain, BO_params): try: import GPyOpt ...
[ "numpy.random.uniform", "sys.exit", "numpy.atleast_2d" ]
[((1261, 1300), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', 'self.dimension'], {}), '(0, 1, self.dimension)\n', (1278, 1300), True, 'import numpy as np\n'), ((390, 449), 'sys.exit', 'sys.exit', (['"""BayesOptSampler requires GPyOpt to be installed"""'], {}), "('BayesOptSampler requires GPyOpt to be ins...
#! /usr/bin/env python # -*- coding: utf8 -*- ''' Copyright 2018 University of Liège 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 requir...
[ "ccupydo.CFlexInterfaceData.dot", "ccupydo.CInterfaceMatrix.mult", "numpy.set_printoptions", "ccupydo.CFlexInterfaceData.__init__", "ccupydo.CInterfaceMatrix.__init__", "numpy.linalg.norm", "ccupydo.CFlexInterfaceData.norm", "ccupydo.CFlexInterfaceData.sum" ]
[((947, 989), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'sys.maxsize'}), '(threshold=sys.maxsize)\n', (966, 989), True, 'import numpy as np\n'), ((1397, 1469), 'ccupydo.CFlexInterfaceData.__init__', 'ccupydo.CFlexInterfaceData.__init__', (['self', 'val_nPoint', 'val_nDim', 'mpiComm'], {}), '(s...
from __future__ import division from future.utils import iteritems, itervalues from builtins import map, zip import numpy as np import itertools import collections import operator import copy import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec, GridSpecFromSubplotSpec from matplotlib import cm fro...
[ "matplotlib.pyplot.title", "matplotlib.cm.get_cmap", "numpy.ones", "matplotlib.pyplot.figure", "numpy.arange", "numpy.exp", "scipy.special.logsumexp", "matplotlib.pyplot.gca", "numpy.atleast_2d", "pybasicbayes.util.stats.atleast_2d", "joblib.Parallel", "matplotlib.pyplot.draw", "numpy.linspa...
[((2496, 2510), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2508, 2510), True, 'import matplotlib.pyplot as plt\n'), ((2577, 2678), 'pyhsmm.util.plot.heatmap', 'heatmap', (['tmat', 'states_list', 'states_list'], {'ax': 'ax', 'cmap': '"""Blues"""', 'cbarlabel': '"""Transition probability"""'}), "(tm...
import os import tensorflow as tf import numpy as np import quaternion import datetime import time def test_linspace(): # tf ops must take float variables # better use np.linspace instead x = tf.linspace(0., 3., 4) print("linspace", x) def test_gather(): coords = tf.tile(tf.expand_dims(tf.linspa...
[ "time.asctime", "tensorflow.ones", "numpy.set_printoptions", "tensorflow.linspace", "tensorflow.gather", "tensorflow.pad", "tensorflow.constant", "numpy.sin", "numpy.linalg.norm", "quaternion.as_rotation_vector", "numpy.cos", "datetime.datetime.now" ]
[((206, 230), 'tensorflow.linspace', 'tf.linspace', (['(0.0)', '(3.0)', '(4)'], {}), '(0.0, 3.0, 4)\n', (217, 230), True, 'import tensorflow as tf\n'), ((442, 468), 'tensorflow.gather', 'tf.gather', (['coords', 'indices'], {}), '(coords, indices)\n', (451, 468), True, 'import tensorflow as tf\n'), ((628, 664), 'tensorf...
import pandas as pd import numpy as np import multiprocessing from multiprocessing import Process, Manager, Queue import math from PyProM.src.data.importing import Import import sys import os from PyProM.src.utility.util_profile import Util_Profile from PyProM.src.utility.util_multiprocessing import Util_Multiprocess...
[ "pandas.read_csv", "numpy.std", "multiprocessing.Manager", "time.time", "PyProM.src.utility.util_multiprocessing.Util_Multiprocessing.join_dict", "numpy.mean", "pandas.to_datetime", "PyProM.src.data.importing.Import", "functools.wraps", "numpy.array_split", "multiprocessing.Queue", "multiproce...
[((383, 392), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (388, 392), False, 'from functools import wraps\n'), ((436, 447), 'time.time', 'time.time', ([], {}), '()\n', (445, 447), False, 'import time\n'), ((486, 497), 'time.time', 'time.time', ([], {}), '()\n', (495, 497), False, 'import time\n'), ((910, 936), ...
""" Functions for interacting with the BEAST model """ import numpy as np import h5py from tqdm import tqdm __all__ = ["read_lnp_data", "read_noise_data", "read_sed_data", "get_lnp_grid_vals"] def read_lnp_data(filename, nstars=None, shift_lnp=True): """ Read in the sparse lnp for all the stars in the hdf5...
[ "h5py.File", "tqdm.tqdm", "numpy.zeros", "numpy.isfinite", "numpy.max", "numpy.array" ]
[((833, 857), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (842, 857), False, 'import h5py\n'), ((2838, 2862), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (2847, 2862), False, 'import h5py\n'), ((2939, 2982), 'tqdm.tqdm', 'tqdm', (['param_list'], {'desc...
import math import numpy as np from collections import namedtuple import random from cyclopts import cyclopts_io as cycio from cyclopts.structured_species import data """default values and np.dtypes for points making up parameter space""" Param = namedtuple('Param', ['val', 'dtype']) class Point(object): """A co...
[ "numpy.abs", "random.uniform", "numpy.dtype", "numpy.zeros", "cyclopts.cyclopts_io.uuid_rows", "math.floor", "cyclopts.structured_species.data.append", "numpy.mean", "collections.namedtuple", "numpy.dot", "cyclopts.structured_species.data.loc" ]
[((249, 286), 'collections.namedtuple', 'namedtuple', (['"""Param"""', "['val', 'dtype']"], {}), "('Param', ['val', 'dtype'])\n", (259, 286), False, 'from collections import namedtuple\n'), ((6197, 6305), 'numpy.dtype', 'np.dtype', (["[('arcid', np.uint32), ('commod', np.uint32), ('pref_c', np.float32), (\n 'pref_l'...
import pygame import random import numpy as np from collections import deque import tensorflow as tf # http://blog.topspeedsnail.com/archives/10116 import cv2 # http://blog.topspeedsnail.com/archives/4755 BLACK = (0, 0, 0) WHITE = (255, 255, 255) SCREEN_SIZE = [320, 400] BAR_SIZE = [50, 5] BALL_SIZE = [...
[ "numpy.argmax", "random.sample", "tensorflow.reshape", "pygame.Rect", "tensorflow.matmul", "pygame.display.update", "tensorflow.multiply", "tensorflow.nn.conv2d", "collections.deque", "pygame.display.set_mode", "tensorflow.placeholder", "numpy.append", "numpy.max", "numpy.reshape", "tens...
[((3136, 3179), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, 80, 100, 4]'], {}), "('float', [None, 80, 100, 4])\n", (3150, 3179), True, 'import tensorflow as tf\n'), ((3198, 3237), 'tensorflow.placeholder', 'tf.placeholder', (['"""float"""', '[None, output]'], {}), "('float', [None, output])\n",...
import resources as res import numpy as np import nltk class Feature(object): dataset = None def __init__(self, dataset): self.dataset = dataset def run(self): array = [] for text in self.dataset: bigrams = 0 counter = 0 words = nltk.word_tok...
[ "numpy.matrix", "nltk.word_tokenize" ]
[((800, 816), 'numpy.matrix', 'np.matrix', (['array'], {}), '(array)\n', (809, 816), True, 'import numpy as np\n'), ((307, 331), 'nltk.word_tokenize', 'nltk.word_tokenize', (['text'], {}), '(text)\n', (325, 331), False, 'import nltk\n')]
from __future__ import absolute_import import numpy import orange, statc from . import stats def mean(l): return float(sum(l))/len(l) class MA_pearsonCorrelation: """ Calling an object of this class computes Pearson correlation of all attributes against class. """ def __call__(self, i, data...
[ "numpy.ma.sum", "numpy.abs", "numpy.sum", "orange.ExampleTable", "statc.mean", "numpy.ma.where", "random.shuffle", "numpy.ones", "numpy.clip", "numpy.ma.log", "numpy.ma.mean", "numpy.ma.transpose", "numpy.linalg.solve", "numpy.ma.asarray", "Orange.orng.orngMisc.progressBarMilestones", ...
[((12178, 12231), 'numpy.ma.concatenate', 'ma.concatenate', (['arrays', '(dim if dim is not None else 0)'], {}), '(arrays, dim if dim is not None else 0)\n', (12192, 12231), True, 'import numpy.ma as ma\n'), ((13455, 13480), 'numpy.ma.sum', 'ma.sum', (['observed', '(dim + 1)'], {}), '(observed, dim + 1)\n', (13461, 134...
from __future__ import print_function from PIL import Image import numpy as np import os import cv2 import torch import torch.nn.functional as F import torchvision import torchvision.transforms.functional as TF import math import pickle class ImageTransformer(object): """ Rescale the image in a sample to a gi...
[ "pickle.dump", "torchvision.transforms.functional.to_tensor", "numpy.ones", "pickle.load", "shutil.rmtree", "torch.nn.functional.pad", "torch.ones", "os.path.dirname", "numpy.transpose", "os.path.exists", "torch.FloatTensor", "numpy.max", "torch.Tensor", "cv2.resize", "numpy.repeat", "...
[((3155, 3188), 'numpy.zeros', 'np.zeros', (['(bs, 4)'], {'dtype': 'np.int32'}), '((bs, 4), dtype=np.int32)\n', (3163, 3188), True, 'import numpy as np\n'), ((3201, 3233), 'numpy.ones', 'np.ones', (['(bs,)'], {'dtype': 'np.float32'}), '((bs,), dtype=np.float32)\n', (3208, 3233), True, 'import numpy as np\n'), ((4872, 4...
import numpy as np import pyastar # The start and goal coordinates are in matrix coordinates (i, j). start = (0, 0) goal = (4, 4) # The minimum cost must be 1 for the heuristic to be valid. weights = np.array([[1, 3, 3, 3, 3], [2, 1, 3, 3, 3], [2, 2, 1, 3, 3], ...
[ "pyastar.astar_path", "numpy.array" ]
[((203, 321), 'numpy.array', 'np.array', (['[[1, 3, 3, 3, 3], [2, 1, 3, 3, 3], [2, 2, 1, 3, 3], [2, 2, 2, 1, 3], [2, 2,\n 2, 2, 1]]'], {'dtype': 'np.float32'}), '([[1, 3, 3, 3, 3], [2, 1, 3, 3, 3], [2, 2, 1, 3, 3], [2, 2, 2, 1, 3\n ], [2, 2, 2, 2, 1]], dtype=np.float32)\n', (211, 321), True, 'import numpy as np\n...
#simulate the movement of the rogue AP and recieved RSSI values at the stationary #APs based on the lognormal shadowing model #Results will be written in a file to be read by the server to calculate the distance to the rogue AP #Prx(d) = Prx(d0)-10*n*log(d/d0) + x(0, σ) #rogue AP moves at a constant speed = 1m/sec from...
[ "math.sqrt", "Crypto.Random.random.randrange", "Crypto.Random.random.choice", "math.log10", "numpy.random.normal" ]
[((1323, 1350), 'Crypto.Random.random.choice', 'random.choice', (['[0, 1, 2, 3]'], {}), '([0, 1, 2, 3])\n', (1336, 1350), False, 'from Crypto.Random import random\n'), ((628, 678), 'math.sqrt', 'math.sqrt', (['((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2)'], {}), '((b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2)\n', (637, 678), F...
#!/usr/bin/python # encoding: utf-8 import random import os import torch from PIL import Image import numpy as np from utils import * import cv2 def scale_image_channel(im, c, v): cs = list(im.split()) cs[c] = cs[c].point(lambda i: i * v) out = Image.merge(im.mode, tuple(cs)) return out def distort_...
[ "random.randint", "random.uniform", "os.path.getsize", "numpy.zeros", "PIL.Image.open", "numpy.reshape", "numpy.loadtxt", "torch.zeros", "os.path.join", "os.listdir", "torch.from_numpy" ]
[((807, 827), 'random.uniform', 'random.uniform', (['(1)', 's'], {}), '(1, s)\n', (821, 827), False, 'import random\n'), ((1240, 1263), 'random.randint', 'random.randint', (['(-dw)', 'dw'], {}), '(-dw, dw)\n', (1254, 1263), False, 'import random\n'), ((1277, 1300), 'random.randint', 'random.randint', (['(-dw)', 'dw'], ...
import logging import os import numpy as np import torch from tensorboardX import SummaryWriter from torch.optim.lr_scheduler import ReduceLROnPlateau from . import utils from tqdm import tqdm from unet3d.utils import unpad_eval class UNet3DTrainer: """3D UNet trainer. Args: model (Unet3D): UNet 3D ...
[ "tqdm.tqdm", "torch.no_grad", "unet3d.utils.unpad_eval", "numpy.ptp", "numpy.min", "torch.device", "torch.zeros", "os.path.split", "os.path.join", "torch.from_numpy" ]
[((4275, 4305), 'os.path.split', 'os.path.split', (['checkpoint_path'], {}), '(checkpoint_path)\n', (4288, 4305), False, 'import os\n'), ((4430, 4459), 'torch.device', 'torch.device', (["state['device']"], {}), "(state['device'])\n", (4442, 4459), False, 'import torch\n'), ((5759, 5785), 'os.path.split', 'os.path.split...
# -*- coding: utf-8 -*- import h5py import yaml from collections import UserDict from datetime import datetime from numpy import string_ from contextlib import contextmanager TYPEID = '_type_' @contextmanager def hdf_file(hdf, lazy=True, *args, **kwargs): """Context manager yields h5 file if hdf is str, oth...
[ "yaml.safe_dump", "h5py.File", "numpy.string_", "datetime.datetime.fromtimestamp" ]
[((419, 450), 'h5py.File', 'h5py.File', (['hdf', '*args'], {}), '(hdf, *args, **kwargs)\n', (428, 450), False, 'import h5py\n'), ((517, 548), 'h5py.File', 'h5py.File', (['hdf', '*args'], {}), '(hdf, *args, **kwargs)\n', (526, 548), False, 'import h5py\n'), ((1105, 1134), 'datetime.datetime.fromtimestamp', 'datetime.fro...
def pooled_cohen_kappa(samples_a, samples_b, weight_type=None, questions=None): """ Compute the pooled Cohen's Kappa for the given samples. From: <NAME>., <NAME>., <NAME>., & <NAME>. (2008). Using pooled kappa to summarize interrater agreement across many items. Field methods, 20(3)...
[ "numpy.sum", "numpy.zeros", "numpy.mean", "numpy.array", "numpy.concatenate" ]
[((2022, 2041), 'numpy.array', 'np.array', (['samples_a'], {}), '(samples_a)\n', (2030, 2041), True, 'import numpy as np\n'), ((2058, 2077), 'numpy.array', 'np.array', (['samples_b'], {}), '(samples_b)\n', (2066, 2077), True, 'import numpy as np\n'), ((4942, 4957), 'numpy.zeros', 'np.zeros', (['ncols'], {}), '(ncols)\n...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from .occ_targets_template import OccTargetsTemplate from ....utils import coords_utils, point_box_utils class OccTargets3D(OccTargetsTemplate): def __init__( self, model_cfg, voxel_size, point_cl...
[ "torch.ones_like", "torch.unique", "torch.zeros_like", "numpy.asarray", "torch.cat", "torch.zeros" ]
[((8412, 8490), 'torch.zeros', 'torch.zeros', (['[bs, self.nz, self.ny, self.nx]'], {'dtype': 'torch.uint8', 'device': '"""cuda"""'}), "([bs, self.nz, self.ny, self.nx], dtype=torch.uint8, device='cuda')\n", (8423, 8490), False, 'import torch\n'), ((11282, 11350), 'torch.zeros', 'torch.zeros', (['[bs, 3, nz, ny, nx]'],...
import csv from collections import defaultdict import numpy as np from PySAM.ResourceTools import SAM_CSV_to_solar_data from hybrid.keys import get_developer_nrel_gov_key from hybrid.log import hybrid_logger as logger from hybrid.resource.resource import * class SolarResource(Resource): """ Class to mana...
[ "numpy.pad", "hybrid.keys.get_developer_nrel_gov_key", "numpy.array", "PySAM.ResourceTools.SAM_CSV_to_solar_data", "numpy.delete" ]
[((3314, 3346), 'PySAM.ResourceTools.SAM_CSV_to_solar_data', 'SAM_CSV_to_solar_data', (['data_dict'], {}), '(data_dict)\n', (3335, 3346), False, 'from PySAM.ResourceTools import SAM_CSV_to_solar_data\n'), ((2219, 2247), 'hybrid.keys.get_developer_nrel_gov_key', 'get_developer_nrel_gov_key', ([], {}), '()\n', (2245, 224...
import os from os import path import numpy as np import pytest from astropy import cosmology as cosmo import autofit as af import autolens as al from autolens.fit.fit import InterferometerFit from test_autolens.mock import mock_pipeline pytestmark = pytest.mark.filterwarnings( "ignore:Using a non-tuple sequence ...
[ "autolens.masked.interferometer", "autolens.PhaseInterferometer", "os.path.realpath", "pytest.fixture", "numpy.ones", "autolens.visibilities.full", "autolens.GalaxyModel", "autolens.fit", "autolens.hyper_data.HyperBackgroundNoise", "autolens.fit.fit.InterferometerFit", "pytest.mark.filterwarning...
[((253, 558), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an arrays index, `arr[np.arrays(seq)]`, which will result either in an err...
# Copyright (c) Microsoft Corporation and Fairlearn contributors. # Licensed under the MIT License. import functools import numpy as np from sklearn.metrics import recall_score from fairlearn.metrics._annotated_metric_function import AnnotatedMetricFunction def test_constructor_unnamed(): fc = AnnotatedMetricF...
[ "numpy.array_equal", "functools.partial", "fairlearn.metrics._annotated_metric_function.AnnotatedMetricFunction" ]
[((304, 357), 'fairlearn.metrics._annotated_metric_function.AnnotatedMetricFunction', 'AnnotatedMetricFunction', ([], {'func': 'recall_score', 'name': 'None'}), '(func=recall_score, name=None)\n', (327, 357), False, 'from fairlearn.metrics._annotated_metric_function import AnnotatedMetricFunction\n'), ((413, 478), 'num...
# coding: utf-8 """ demo on forward 2D """ # Copyright (c) <NAME>. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. from __future__ import absolute_import, division, print_function import matplotlib.pyplot as plt import numpy as np import pyeit.eit.protocol as protocol imp...
[ "pyeit.mesh.wrapper.PyEITAnomaly_Circle", "matplotlib.pyplot.show", "pyeit.eit.protocol.create", "pyeit.mesh.set_perm", "pyeit.eit.fem.Forward", "matplotlib.pyplot.figure", "numpy.real", "pyeit.mesh.create" ]
[((938, 995), 'pyeit.mesh.wrapper.PyEITAnomaly_Circle', 'PyEITAnomaly_Circle', ([], {'center': '[0.4, 0.5]', 'r': '(0.2)', 'perm': '(100.0)'}), '(center=[0.4, 0.5], r=0.2, perm=100.0)\n', (957, 995), False, 'from pyeit.mesh.wrapper import PyEITAnomaly_Circle\n'), ((1007, 1063), 'pyeit.mesh.set_perm', 'mesh.set_perm', (...
import numpy as np from scipy.spatial.distance import cdist # reference vector generation def das_dennis(n_part, n_obj): if n_part == 0: return np.full((1, n_obj), 1 / n_obj) else: ref_dirs = [] ref_dir = np.full(n_obj, np.nan) das_dennis_recursion(ref_dirs, ref_dir, n_part, n_p...
[ "numpy.full", "numpy.sum", "numpy.copy", "numpy.clip", "numpy.sort", "numpy.dot", "numpy.concatenate" ]
[((869, 897), 'numpy.dot', 'np.dot', (['ref_dirs', 'ref_dirs.T'], {}), '(ref_dirs, ref_dirs.T)\n', (875, 897), True, 'import numpy as np\n'), ((157, 187), 'numpy.full', 'np.full', (['(1, n_obj)', '(1 / n_obj)'], {}), '((1, n_obj), 1 / n_obj)\n', (164, 187), True, 'import numpy as np\n'), ((238, 260), 'numpy.full', 'np....
""" Quinitc Polynomials Planner author: <NAME> (@Atsushi_twi) Ref: - [Local Path Planning And Motion Control For Agv In Positioning](http://ieeexplore.ieee.org/document/637936/) """ import numpy as np import matplotlib.pyplot as plt import math # parameter MAX_T = 100.0 # maximum time to the goal [s] MIN_T = 5....
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "math.atan2", "math.radians", "matplotlib.pyplot.axis", "math.sin", "numpy.hypot", "numpy.arange", "math.cos", "numpy.array", "matplotlib.pyplot.cla", "matplotlib.pyplot.pause", "numpy.linalg.solve", "matplotlib.pyplot.grid" ]
[((2750, 2780), 'numpy.arange', 'np.arange', (['MIN_T', 'MAX_T', 'MIN_T'], {}), '(MIN_T, MAX_T, MIN_T)\n', (2759, 2780), True, 'import numpy as np\n'), ((5052, 5070), 'math.radians', 'math.radians', (['(10.0)'], {}), '(10.0)\n', (5064, 5070), False, 'import math\n'), ((5251, 5269), 'math.radians', 'math.radians', (['(2...