code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
import numpy as np
import sklearn.metrics as skm
import fairlearn.metrics as metrics
# ======================================================
a = "a"
b = "b"
c = "c"
Y_true = [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0... | [
"numpy.random.rand",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.r2_score",
"sklearn.metrics.zero_one_loss",
"fairlearn.metrics.group_accuracy_score",
"numpy.asarray",
"fairlearn.metrics.group_roc_auc_score",
"fairlearn.metri... | [((2279, 2346), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_tuple"""', 'supported_metrics_unweighted'], {}), "('func_tuple', supported_metrics_unweighted)\n", (2302, 2346), False, 'import pytest\n'), ((2896, 2968), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_tuple"""', 'support... |
"""
Adapted from OpenAI Baselines.
"""
import numpy as np
import tensorflow as tf # pylint: ignore-module
import random
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scala... | [
"numpy.prod",
"tensorflow.tanh",
"tensorflow.split",
"tensorflow.get_default_session",
"multiprocessing.cpu_count",
"tensorflow.gradients",
"tensorflow.group",
"tensorflow.cast",
"tensorflow.variables_initializer",
"tensorflow.set_random_seed",
"tensorflow.clip_by_global_norm",
"cloudpickle.lo... | [((1837, 1931), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'inter_op_parallelism_threads': 'num_cpu', 'intra_op_parallelism_threads': 'num_cpu'}), '(inter_op_parallelism_threads=num_cpu,\n intra_op_parallelism_threads=num_cpu)\n', (1851, 1931), True, 'import tensorflow as tf\n'), ((2277, 2295), 'functools.wra... |
import numpy as np
import math
import matplotlib.pyplot as plt
U = 5 # equival a l'E
R = 2 # equival a R1
R2 = 3
P = 1.2
Vt = 0.026
Is = 0.000005
n = 200 # profunditat
Vd = np.zeros(n) # sèries
Vl = np.zeros(n)
I1 = np.zeros(n)
I1[0] = U / R # inicialització de les sèries
Vd[0] = Vt * math.log(1 + I1[0] / Is)... | [
"numpy.sum",
"numpy.zeros",
"math.log"
] | [((179, 190), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (187, 190), True, 'import numpy as np\n'), ((206, 217), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (214, 217), True, 'import numpy as np\n'), ((223, 234), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (231, 234), True, 'import numpy as np\n'), ((10... |
"""
Autonomous dataset collection of data for jetson nano
<NAME> - <EMAIL>
"""
import datasets
import json
from datasets import Board, ChessPiece, PieceColor, PieceType
#from realsense_utils import RealSenseCamera
import preprocessing as pr
import cv2
import pandas as pd
import os
from os.path import isfile, join
im... | [
"cv2.imwrite",
"cv2.warpAffine",
"PIL.Image.open",
"PIL.ExifTags.TAGS.get",
"numpy.array",
"preprocessing.board_to_64_files",
"pandas.DataFrame",
"cv2.getRotationMatrix2D",
"pandas.concat",
"json.dump",
"os.remove"
] | [((1065, 1114), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['image_center', 'angle', '(1.0)'], {}), '(image_center, angle, 1.0)\n', (1088, 1114), False, 'import cv2\n'), ((1126, 1200), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'rot_mat', 'image.shape[1::-1]'], {'flags': 'cv2.INTER_LINEAR'}), '(image, r... |
import numpy as np
import sys
sys.path.append('/homes/rlreed/workspace/unotran/src')
from coarseBounds import computeBounds, Grouping
import pickle
from makeDLPbasis import makeBasis as makeDLP
from makeKLTbasis import makeBasis as makeKLT
import sph
import sph_dgm
import pydgm
def buildGEO(ass_map):
fine_map = [... | [
"sph_dgm.DGMSOLVER",
"coarseBounds.computeBounds",
"makeDLPbasis.makeBasis",
"pydgm.dgmsolver.initialize_dgmsolver",
"pydgm.control.finalize_control",
"numpy.cumsum",
"sph_dgm.XS",
"sys.path.append",
"makeKLTbasis.makeBasis",
"pydgm.dgmsolver.finalize_dgmsolver",
"numpy.set_printoptions"
] | [((30, 84), 'sys.path.append', 'sys.path.append', (['"""/homes/rlreed/workspace/unotran/src"""'], {}), "('/homes/rlreed/workspace/unotran/src')\n", (45, 84), False, 'import sys\n'), ((612, 625), 'numpy.cumsum', 'np.cumsum', (['cm'], {}), '(cm)\n', (621, 625), True, 'import numpy as np\n'), ((1025, 1101), 'sph_dgm.DGMSO... |
import numpy as np
from PIL import Image
from keras.models import load_model
img_gray = Image.open('1002.png')
number = np.array(img_gray)
print(number.shape)
print('准备的图片的shape:',number.flatten().shape)
print('原number:',number)
number = number.astype('float32')
number = number/255 #归一化
number = number.flatten()
pri... | [
"numpy.array",
"PIL.Image.open",
"keras.models.load_model"
] | [((89, 111), 'PIL.Image.open', 'Image.open', (['"""1002.png"""'], {}), "('1002.png')\n", (99, 111), False, 'from PIL import Image\n'), ((121, 139), 'numpy.array', 'np.array', (['img_gray'], {}), '(img_gray)\n', (129, 139), True, 'import numpy as np\n'), ((367, 393), 'keras.models.load_model', 'load_model', (['"""mnist-... |
from dataclasses import dataclass, field
from typing import Mapping, List, Any
from datetime import datetime
import logging
import pandas as pd
import glob
import numpy as np
import logging
import os
from collections import OrderedDict
import nrrd
import vtk
import vedo
from vtk.util.numpy_support import numpy_to_vtk
... | [
"vedo.colors.getColor",
"numpy.random.rand",
"iblviewer.utils.get_transformation_matrix",
"nrrd.read",
"vtk.vtkPlane",
"iblviewer.objects.Points",
"vtk.vtkImageAppend",
"numpy.array",
"vedo.io.loadImageData",
"vtk.vtkImageReslice",
"vedo.colorMap",
"numpy.linalg.norm",
"vedo.loadImageData",
... | [((753, 787), 'dataclasses.field', 'field', ([], {'default_factory': 'unique_name'}), '(default_factory=unique_name)\n', (758, 787), False, 'from dataclasses import dataclass, field\n'), ((841, 874), 'dataclasses.field', 'field', ([], {'default_factory': 'Collection'}), '(default_factory=Collection)\n', (846, 874), Fal... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 11:11:56 2020
This program is use to plot polarization map from vlbi fits image.
You should specify the input fits images by -i or --infile,
output file by -o or --output,
contour levs by -l or --levs
contour base by -c or --cmul
polarization... | [
"getopt.getopt",
"matplotlib.pyplot.savefig",
"sys.exit",
"matplotlib.colors.LogNorm",
"numpy.min",
"matplotlib.colors.ListedColormap",
"numpy.max",
"numpy.array",
"matplotlib.colors.PowerNorm",
"matplotlib.colors.SymLogNorm",
"astropy.table.Table.read",
"astropy.io.fits.open",
"matplotlib.c... | [((1726, 1788), 'matplotlib.patches.Ellipse', 'Ellipse', (['bpos', 'bmaj', 'bmin'], {'angle': 'bpa', 'ec': '"""k"""', 'facecolor': '"""gray"""'}), "(bpos, bmaj, bmin, angle=bpa, ec='k', facecolor='gray')\n", (1733, 1788), False, 'from matplotlib.patches import Ellipse\n'), ((2198, 2216), 'matplotlib.pyplot.get_cmap', '... |
"""Tests for quantization"""
import numpy as np
import unittest
import os
import shutil
import yaml
import tensorflow as tf
def build_fake_yaml():
fake_yaml = '''
model:
name: fake_yaml
framework: tensorflow
inputs: x
outputs: op_to_store
dev... | [
"yaml.load",
"unittest.main",
"tensorflow.compat.v1.Session",
"tensorflow.compat.v1.global_variables_initializer",
"os.remove",
"tensorflow.graph_util.convert_variables_to_constants",
"tensorflow.Graph",
"tensorflow.compat.v1.placeholder",
"numpy.random.random",
"tensorflow.Session",
"tensorflow... | [((619, 663), 'yaml.load', 'yaml.load', (['fake_yaml'], {'Loader': 'yaml.SafeLoader'}), '(fake_yaml, Loader=yaml.SafeLoader)\n', (628, 663), False, 'import yaml\n'), ((1296, 1340), 'yaml.load', 'yaml.load', (['fake_yaml'], {'Loader': 'yaml.SafeLoader'}), '(fake_yaml, Loader=yaml.SafeLoader)\n', (1305, 1340), False, 'im... |
#!/usr/bin/env python
"""
@package ion_functions.qc_functions
@file ion_functions/qc_functions.py
@author <NAME>
@brief Module containing QC functions ported from matlab samples in DPS documents
"""
from ion_functions.qc.qc_extensions import stuckvalues, spikevalues, gradientvalues, ntp_to_month
import time
import n... | [
"logging.getLogger",
"numpy.sqrt",
"numpy.polyfit",
"ion_functions.utils.islogical",
"numpy.column_stack",
"numpy.asanyarray",
"ion_functions.utils.isnumeric",
"numpy.array",
"numpy.sin",
"ion_functions.qc.qc_extensions.gradientvalues",
"numpy.fix",
"ion_functions.qc.qc_extensions.ntp_to_month... | [((2766, 2784), 'numpy.atleast_1d', 'np.atleast_1d', (['dat'], {}), '(dat)\n', (2779, 2784), True, 'import numpy as np\n'), ((2798, 2819), 'numpy.atleast_1d', 'np.atleast_1d', (['datlim'], {}), '(datlim)\n', (2811, 2819), True, 'import numpy as np\n'), ((9354, 9374), 'numpy.max', 'np.max', (['datlim[:, 1]'], {}), '(dat... |
from mlagents.trainers.brain import BrainInfo, BrainParameters, CameraResolution
from mlagents.envs.base_env import BatchedStepResult, AgentGroupSpec
from mlagents.envs.exception import UnityEnvironmentException
import numpy as np
from typing import List
def step_result_to_brain_info(
step_result: BatchedStepResu... | [
"mlagents.trainers.brain.CameraResolution",
"numpy.sum",
"numpy.zeros",
"mlagents.envs.exception.UnityEnvironmentException",
"numpy.concatenate"
] | [((990, 1031), 'numpy.zeros', 'np.zeros', (['(n_agents, 0)'], {'dtype': 'np.float32'}), '((n_agents, 0), dtype=np.float32)\n', (998, 1031), True, 'import numpy as np\n'), ((1060, 1129), 'numpy.concatenate', 'np.concatenate', (['[step_result.obs[i] for i in vec_obs_indices]'], {'axis': '(1)'}), '([step_result.obs[i] for... |
#!/usr/bin/env python
from skimage.color import rgb2gray
from skimage.io import imread, imsave
from scipy.misc import toimage
import numpy as np
import wrapper as wr
###########################################################
# IMAGE IO
###########################################################
def imload_rgb(pa... | [
"skimage.color.rgb2gray",
"numpy.logical_and",
"numpy.where",
"scipy.misc.toimage",
"skimage.io.imread",
"skimage.io.imsave",
"numpy.random.uniform",
"wrapper.data_to_pic",
"numpy.random.RandomState"
] | [((2702, 2731), 'numpy.where', 'np.where', (['(image < 0)', '(0)', 'image'], {}), '(image < 0, 0, image)\n', (2710, 2731), True, 'import numpy as np\n'), ((2744, 2773), 'numpy.where', 'np.where', (['(image > 1)', '(1)', 'image'], {}), '(image > 1, 1, image)\n', (2752, 2773), True, 'import numpy as np\n'), ((5095, 5108)... |
import strawberryfields as sf
from strawberryfields import ops
from strawberryfields.utils import random_interferometer
from strawberryfields.apps import data, sample, subgraph, plot
import plotly
import networkx as nx
import numpy as np
class GBS:
def __init__(self, samples =[], min_pho = 16, max_pho = 30, subgra... | [
"strawberryfields.Program",
"strawberryfields.ops.BSgate",
"strawberryfields.ops.MZgate",
"strawberryfields.ops.MeasureFock",
"strawberryfields.utils.random_interferometer",
"strawberryfields.apps.subgraph.search",
"numpy.sum",
"strawberryfields.ops.Interferometer",
"numpy.min",
"strawberryfields.... | [((621, 700), 'strawberryfields.apps.subgraph.search', 'subgraph.search', (['samples', 'pl_graph', 'subgraph_size', 'min_pho'], {'max_count': 'max_count'}), '(samples, pl_graph, subgraph_size, min_pho, max_count=max_count)\n', (636, 700), False, 'from strawberryfields.apps import data, sample, subgraph, plot\n'), ((121... |
# -*- coding: utf-8 -*-
"""
Modules to support data reduction in Python.
The main purpose of the base module ``Data_Reduction`` is to provide a
suplerclass with a good set of attributes and methods to cover all common needs.
The base module is also able to read data from a text file as a ``numpy``
structured array. ... | [
"logging.getLogger",
"Astronomy.apparent_to_J2000",
"datetime.datetime.utcfromtimestamp",
"numpy.log10",
"math.log",
"math.cos",
"numpy.array",
"Math.clusters.find_clusters",
"Astronomy.J2000_to_apparent",
"numpy.genfromtxt",
"numpy.arange",
"re.search",
"os.path.exists",
"readline.parse_a... | [((2597, 2637), 'readline.parse_and_bind', 'readline.parse_and_bind', (['"""tab: complete"""'], {}), "('tab: complete')\n", (2620, 2637), False, 'import readline\n'), ((2648, 2675), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2665, 2675), False, 'import logging\n'), ((43188, 43265), '... |
import numpy as np
from wordreps import WordReps
from algebra import cosine, normalize
import tensorflow as tf
import random
from dataset import DataSet
import CGRE_Model
from Eval import eval_SemEval
import sklearn.preprocessing
# ============ End Imports ============
class Training():
def __init__(self):
# Compo... | [
"numpy.random.normal",
"random.shuffle",
"CGRE_Model.CGRE",
"dataset.DataSet",
"wordreps.WordReps",
"numpy.hstack",
"tensorflow.Session",
"Eval.eval_SemEval",
"tensorflow.global_variables_initializer",
"numpy.zeros",
"numpy.save"
] | [((7593, 7603), 'wordreps.WordReps', 'WordReps', ([], {}), '()\n', (7601, 7603), False, 'from wordreps import WordReps\n'), ((7714, 7730), 'numpy.zeros', 'np.zeros', (['WR.dim'], {}), '(WR.dim)\n', (7722, 7730), True, 'import numpy as np\n'), ((8127, 8199), 'dataset.DataSet', 'DataSet', (['corpus', 'Train_dataset', 'Te... |
"""
Nonnegative CP decomposition by Hierarchical alternating least squares (HALS).
With support for missing data.
"""
import numpy as np
import scipy as sci
from scipy import linalg
from tensortools.operations import unfold, khatri_rao
from tensortools.tensors import KTensor
from tensortools.optimize import FitResult... | [
"tensortools.optimize.optim_utils._check_cpd_inputs",
"numpy.copy",
"tensortools.operations.khatri_rao",
"tensortools.operations.unfold",
"tensortools.optimize.FitResult",
"tensortools.optimize.optim_utils._get_initial_ktensor",
"numpy.linalg.norm"
] | [((3073, 3083), 'numpy.copy', 'np.copy', (['X'], {}), '(X)\n', (3080, 3083), True, 'import numpy as np\n'), ((3099, 3122), 'numpy.linalg.norm', 'np.linalg.norm', (['X[mask]'], {}), '(X[mask])\n', (3113, 3122), True, 'import numpy as np\n'), ((3148, 3186), 'tensortools.optimize.optim_utils._check_cpd_inputs', 'optim_uti... |
"""
@author: <NAME> "Mayou36"
DEPRECEATED! USE OTHER MODULES LIKE rd.data, rd.ml, rd.reweight, rd.score and rd.stat
DEPRECEATED!DEPRECEATED!DEPRECEATED!DEPRECEATED!DEPRECEATED!
Contains several tools to convert, load, save and plot data
"""
import warnings
import os
import copy
import pandas as pd
import numpy... | [
"root_numpy.array2root",
"copy.deepcopy",
"pickle.dump",
"pickle.load",
"numpy.logical_or",
"os.path.isfile",
"numpy.stack",
"numpy.array",
"numpy.asfarray",
"root_numpy.root2array",
"numpy.core.records.fromarrays",
"uproot.open",
"rootpy.io.root_open",
"pandas.DataFrame",
"numpy.percent... | [((1340, 1378), 'numpy.percentile', 'np.percentile', (['signal_data', 'percentile'], {}), '(signal_data, percentile)\n', (1353, 1378), True, 'import numpy as np\n'), ((3382, 3406), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (3396, 3406), False, 'import os\n'), ((1419, 1476), 'numpy.logical_... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.mxnet.mx_reshape_to_reshape import MXReshapeToReshape
from openvino.tools.mo.ops.Reverse import Reverse
from openvino.tools.mo.ops.mxreshape import MXReshape
from openvino.tools.mo.front.c... | [
"numpy.in1d",
"numpy.flip",
"openvino.tools.mo.front.common.partial_infer.utils.int64_array"
] | [((1606, 1622), 'openvino.tools.mo.front.common.partial_infer.utils.int64_array', 'int64_array', (['[0]'], {}), '([0])\n', (1617, 1622), False, 'from openvino.tools.mo.front.common.partial_infer.utils import int64_array\n'), ((1952, 1968), 'openvino.tools.mo.front.common.partial_infer.utils.int64_array', 'int64_array',... |
# <NAME> (<EMAIL>)
from __future__ import division, print_function
from builtins import range
import numpy as np
import scipy.stats as ss
import mlpaper.constants as cc
import mlpaper.mlpaper as bt
import mlpaper.perf_curves as pc
from mlpaper.classification import DEFAULT_NGRID, curve_boot
from mlpaper.test_constan... | [
"numpy.random.rand",
"mlpaper.util.area",
"numpy.array",
"builtins.range",
"numpy.mean",
"mlpaper.classification.curve_boot",
"scipy.stats.binom_test",
"mlpaper.util.interp1d",
"numpy.dot",
"numpy.linspace",
"numpy.random.seed",
"numpy.min",
"mlpaper.mlpaper.boot_EB",
"numpy.abs",
"numpy... | [((3095, 3129), 'numpy.zeros', 'np.zeros', (['DEFAULT_NGRID'], {'dtype': 'int'}), '(DEFAULT_NGRID, dtype=int)\n', (3103, 3129), True, 'import numpy as np\n'), ((3150, 3184), 'numpy.zeros', 'np.zeros', (['DEFAULT_NGRID'], {'dtype': 'int'}), '(DEFAULT_NGRID, dtype=int)\n', (3158, 3184), True, 'import numpy as np\n'), ((3... |
from typing import Any, Dict
import numpy as np
import pandas as pd
import core.artificial_signal_generators as sig_gen
import core.statistics as stats
import core.timeseries_study as tss
import helpers.unit_test as hut
class TestTimeSeriesDailyStudy(hut.TestCase):
def test_usual_case(self) -> None:
idx... | [
"pandas.Series",
"core.timeseries_study.TimeSeriesDailyStudy",
"core.timeseries_study.map_dict_to_dataframe",
"core.artificial_signal_generators.ArmaProcess",
"numpy.array",
"helpers.unit_test.convert_df_to_string",
"pandas.date_range",
"core.timeseries_study.TimeSeriesMinutelyStudy"
] | [((323, 364), 'pandas.date_range', 'pd.date_range', (['"""2018-12-31"""', '"""2019-01-31"""'], {}), "('2018-12-31', '2019-01-31')\n", (336, 364), True, 'import pandas as pd\n'), ((419, 445), 'pandas.Series', 'pd.Series', (['vals'], {'index': 'idx'}), '(vals, index=idx)\n', (428, 445), True, 'import pandas as pd\n'), ((... |
import GeneralStats as gs
import numpy as np
from scipy.stats import skew
from scipy.stats import kurtosistest
import pandas as pd
if __name__ == "__main__":
gen=gs.GeneralStats()
data=np.array([[1, 1, 2, 2, 3],[2, 2, 3, 3, 5],[1, 4, 3, 3, 3],[2, 4, 5, 5, 3]])
data1=np.array([1,2,3,4,5])
... | [
"GeneralStats.GeneralStats",
"numpy.array",
"pandas.Series",
"scipy.stats.skew"
] | [((178, 195), 'GeneralStats.GeneralStats', 'gs.GeneralStats', ([], {}), '()\n', (193, 195), True, 'import GeneralStats as gs\n'), ((208, 286), 'numpy.array', 'np.array', (['[[1, 1, 2, 2, 3], [2, 2, 3, 3, 5], [1, 4, 3, 3, 3], [2, 4, 5, 5, 3]]'], {}), '([[1, 1, 2, 2, 3], [2, 2, 3, 3, 5], [1, 4, 3, 3, 3], [2, 4, 5, 5, 3]]... |
"""
A simple, good-looking plot
===========================
Demoing some simple features of matplotlib
"""
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(5, 4), dpi=72)
axes = fig.add_axes([0.01, 0.01, .98, 0.98])
X = np.linspace(0, 2, 200)
Y = np... | [
"matplotlib.pyplot.grid",
"matplotlib.use",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.sin",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.show"
] | [((146, 167), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (160, 167), False, 'import matplotlib\n'), ((207, 241), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 4)', 'dpi': '(72)'}), '(figsize=(5, 4), dpi=72)\n', (217, 241), True, 'import matplotlib.pyplot as plt\n'), ((291, 3... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2018 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-... | [
"mars.tensor.expressions.base.ptp",
"numpy.testing.assert_equal",
"numpy.random.rand",
"mars.tensor.expressions.base.argwhere",
"mars.tensor.expressions.base.moveaxis",
"mars.tensor.expressions.base.copyto",
"mars.tensor.expressions.base.vsplit",
"mars.tensor.expressions.base.average",
"numpy.array"... | [((1394, 1411), 'mars.tensor.execution.core.Executor', 'Executor', (['"""numpy"""'], {}), "('numpy')\n", (1402, 1411), False, 'from mars.tensor.execution.core import Executor\n'), ((1463, 1488), 'numpy.random.random', 'np.random.random', (['(11, 8)'], {}), '((11, 8))\n', (1479, 1488), True, 'import numpy as np\n'), ((1... |
import matplotlib
matplotlib.use('Agg')
import numpy as np
import matplotlib.pyplot as plt
from glob import glob
from astropy.table import Table, join
from os import chdir, system
from scipy.stats import norm as gauss_norm
from sys import argv
from getopt import getopt
# turn off polyfit ranking warnings
import warnin... | [
"numpy.polyfit",
"numpy.array",
"numpy.isfinite",
"numpy.poly1d",
"numpy.histogram",
"numpy.polynomial.chebyshev.chebval",
"numpy.polynomial.legendre.legfit",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.nanmax",
"glob.glob",
"numpy.abs",
"getopt.getopt",
"numpy.nanstd",
"matplotl... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((323, 356), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (346, 356), False, 'import warnings\n'), ((4237, 4302), 'astropy.table.Table.read', 'Table... |
import argparse
import multiprocessing
import os
import random
import numpy as np
from data_utils import DATAFILE_LIST, DATASET_LIST, prepare_data, RESULTS_DIR
from models import SumOfBetaEce
random.seed(2020)
num_cores = multiprocessing.cpu_count()
NUM_BINS = 10
NUM_RUNS = 100
N_list = [100, 200, 500, 1000, 2000, 5... | [
"data_utils.prepare_data",
"numpy.mean",
"random.shuffle",
"argparse.ArgumentParser",
"multiprocessing.cpu_count",
"random.seed",
"os.mkdir",
"numpy.savetxt",
"numpy.std",
"os.stat",
"models.SumOfBetaEce"
] | [((195, 212), 'random.seed', 'random.seed', (['(2020)'], {}), '(2020)\n', (206, 212), False, 'import random\n'), ((225, 252), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (250, 252), False, 'import multiprocessing\n'), ((517, 565), 'data_utils.prepare_data', 'prepare_data', (['DATAFILE_LI... |
from sigvisa.learn.train_coda_models import get_shape_training_data
import numpy as np
X, y, evids = get_shape_training_data(runid=4, site="AS12", chan="SHZ", band="freq_2.0_3.0", phases=["P",], target="amp_transfer", max_acost=np.float("inf"), min_amp=-2)
np.savetxt("X.txt", X)
np.savetxt("y.txt", y)
np.savetxt("evid... | [
"numpy.float",
"numpy.savetxt"
] | [((258, 280), 'numpy.savetxt', 'np.savetxt', (['"""X.txt"""', 'X'], {}), "('X.txt', X)\n", (268, 280), True, 'import numpy as np\n'), ((281, 303), 'numpy.savetxt', 'np.savetxt', (['"""y.txt"""', 'y'], {}), "('y.txt', y)\n", (291, 303), True, 'import numpy as np\n'), ((304, 334), 'numpy.savetxt', 'np.savetxt', (['"""evi... |
import functools
import numpy as np
import math
import argparse
import ags_solver
import go_problems
import nlopt
import sys
from Simple import SimpleTuner
import itertools
from scipy.spatial import Delaunay
from scipy.optimize import differential_evolution
from scipy.optimize import basinhopping
from sdaopt import sda... | [
"benchmark_tools.core.solve_class",
"argparse.ArgumentParser",
"benchmark_tools.core.GrishClass",
"math.pow",
"benchmark_tools.stats.save_stats",
"benchmark_tools.stats.compute_stats",
"itertools.product",
"benchmark_tools.core.GKLSClass",
"numpy.array",
"functools.partial",
"shgo.shgo",
"pyOp... | [((13158, 13203), 'functools.partial', 'functools.partial', (['AGSWrapper'], {'mixedFast': '(True)'}), '(AGSWrapper, mixedFast=True)\n', (13175, 13203), False, 'import functools\n'), ((13224, 13284), 'functools.partial', 'functools.partial', (['NLOptWrapper'], {'method': 'nlopt.GN_ORIG_DIRECT'}), '(NLOptWrapper, method... |
from argparse import ArgumentParser
import os
import numpy as np
from joblib import dump
from mldftdat.workflow_utils import SAVE_ROOT
from mldftdat.models.gp import *
from mldftdat.data import load_descriptors, filter_descriptors
import yaml
def parse_settings(args):
fname = args.datasets_list[0]
if args.suff... | [
"numpy.mean",
"argparse.ArgumentParser",
"os.path.join",
"yaml.load",
"numpy.append",
"mldftdat.data.load_descriptors",
"mldftdat.data.filter_descriptors",
"numpy.random.seed",
"joblib.dump",
"numpy.arange",
"numpy.random.shuffle"
] | [((390, 480), 'os.path.join', 'os.path.join', (['SAVE_ROOT', '"""DATASETS"""', 'args.functional', 'args.basis', 'args.version', 'fname'], {}), "(SAVE_ROOT, 'DATASETS', args.functional, args.basis, args.\n version, fname)\n", (402, 480), False, 'import os\n'), ((1042, 1132), 'os.path.join', 'os.path.join', (['SAVE_RO... |
"""
********************************
* Created by mohammed-alaa *
********************************
Spatial Dataloader implementing sequence api from keras (defines how to load a single item)
this loads batches of images for each iteration it returns [batch_size, height, width ,3] ndarrays
"""
import copy
import ran... | [
"random.randint",
"random.shuffle",
"numpy.array",
"copy.deepcopy",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.subplots_adjust"
] | [((760, 787), 'copy.deepcopy', 'copy.deepcopy', (['data_to_load'], {}), '(data_to_load)\n', (773, 787), False, 'import copy\n'), ((890, 914), 'copy.deepcopy', 'copy.deepcopy', (['augmenter'], {}), '(augmenter)\n', (903, 914), False, 'import copy\n'), ((1705, 1798), 'numpy.array', 'np.array', (['self.labels[batch_start ... |
# ******************************************************
## Copyright 2019, PBL Netherlands Environmental Assessment Agency and Utrecht University.
## Reuse permitted under Gnu Public License, GPL v3.
# ******************************************************
from netCDF4 import Dataset
import numpy as np
import genera... | [
"ascraster.create_mask",
"numpy.zeros"
] | [((503, 576), 'ascraster.create_mask', 'ascraster.create_mask', (['mask_asc_fn', 'mask_id'], {'logical': 'logical', 'numtype': 'int'}), '(mask_asc_fn, mask_id, logical=logical, numtype=int)\n', (524, 576), False, 'import ascraster\n'), ((930, 982), 'numpy.zeros', 'np.zeros', (['(dum_asc.nrows, dum_asc.ncols)'], {'dtype... |
from parameters import *
from library_time import *
from paths import *
import numpy as np
import pylab as plt
import matplotlib.pyplot as mplt
mplt.rc('text', usetex=True)
mplt.rcParams.update({'font.size': 16})
import logging, getopt, sys
import time
import os
#####################################################... | [
"os.path.exists",
"matplotlib.pyplot.savefig",
"os.makedirs",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.rcParams.update",
"numpy.linspace",
"numpy.zeros",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot... | [((145, 173), 'matplotlib.pyplot.rc', 'mplt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (152, 173), True, 'import matplotlib.pyplot as mplt\n'), ((174, 213), 'matplotlib.pyplot.rcParams.update', 'mplt.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (194, 213), True, '... |
"""
echopype data model that keeps tracks of echo data and
its connection to data files.
"""
import os
import warnings
import datetime as dt
from echopype.utils import uwa
import numpy as np
import xarray as xr
class ModelBase(object):
"""Class for manipulating echo data that is already converted to netCDF."""
... | [
"numpy.array",
"xarray.align",
"numpy.mod",
"numpy.arange",
"os.path.exists",
"xarray.merge",
"os.path.split",
"os.mkdir",
"numpy.round",
"numpy.ceil",
"os.path.splitext",
"os.path.dirname",
"xarray.open_dataset",
"numpy.unique",
"os.path.join",
"os.getcwd",
"datetime.datetime.now",
... | [((2910, 2929), 'os.path.basename', 'os.path.basename', (['p'], {}), '(p)\n', (2926, 2929), False, 'import os\n'), ((2947, 2967), 'os.path.splitext', 'os.path.splitext', (['pp'], {}), '(pp)\n', (2963, 2967), False, 'import os\n'), ((8945, 8977), 'os.path.join', 'os.path.join', (['save_dir', 'file_out'], {}), '(save_dir... |
import cv2
import numpy as np
import time
class CaptureManager(object):
def __init__(self, capture, preview_window_manager=None, should_mirror_preview = False):
self.preview_window_manager = preview_window_manager
self.should_mirror_preview = should_mirror_preview
self._capture = capture... | [
"cv2.destroyWindow",
"numpy.fliplr",
"cv2.imshow",
"cv2.waitKey",
"time.time",
"cv2.namedWindow"
] | [((2291, 2325), 'cv2.namedWindow', 'cv2.namedWindow', (['self._window_name'], {}), '(self._window_name)\n', (2306, 2325), False, 'import cv2\n'), ((2401, 2437), 'cv2.imshow', 'cv2.imshow', (['self._window_name', 'frame'], {}), '(self._window_name, frame)\n', (2411, 2437), False, 'import cv2\n'), ((2477, 2513), 'cv2.des... |
"""
Unit tests for SNIa truth catalog code.
"""
import os
import unittest
import sqlite3
import numpy as np
import pandas as pd
from desc.sims_truthcatalog import SNeTruthWriter, SNSynthPhotFactory
class SNSynthPhotFactoryTestCase(unittest.TestCase):
"""
Test case class for SNIa synthetic photometry factory c... | [
"numpy.testing.assert_equal",
"sqlite3.connect",
"desc.sims_truthcatalog.SNSynthPhotFactory",
"os.path.join",
"os.path.isfile",
"unittest.main",
"pandas.read_sql",
"desc.sims_truthcatalog.SNeTruthWriter",
"os.remove"
] | [((4369, 4384), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4382, 4384), False, 'import unittest\n'), ((524, 720), 'desc.sims_truthcatalog.SNSynthPhotFactory', 'SNSynthPhotFactory', ([], {'z': '(0.6322702169418335)', 't0': '(61719.9950436545)', 'x0': '(4.2832710977804034e-06)', 'x1': '(-1.207738485943195)', 'c... |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import os
import argparse
import logging
import numpy as np
from PIL import Image
import matplotlib
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from torchvision import transforms
import cv2
import tqdm
from net.pspnet import PSPNet
models = {
... | [
"numpy.array",
"torch.cuda.is_available",
"os.path.exists",
"os.listdir",
"numpy.repeat",
"argparse.ArgumentParser",
"matplotlib.colors.ListedColormap",
"os.mkdir",
"torchvision.transforms.ToTensor",
"matplotlib.pyplot.savefig",
"numpy.argmax",
"torchvision.transforms.Normalize",
"torchvisio... | [((1113, 1181), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Pyramid Scene Parsing Network"""'}), "(description='Pyramid Scene Parsing Network')\n", (1136, 1181), False, 'import argparse\n'), ((1679, 1699), 'torch.nn.DataParallel', 'nn.DataParallel', (['net'], {}), '(net)\n', (1694, 16... |
import cv2
import os
import numpy as np
# This module contains all common functions that are called in tester.py file
# Given an image below function returns rectangle for face detected alongwith gray scale image
def faceDetection(test_img):
gray_img = cv2.cvtColor(test_img, cv2.COLOR_BGR2GRAY) # convert color... | [
"cv2.rectangle",
"os.path.join",
"cv2.face.LBPHFaceRecognizer_create",
"cv2.putText",
"numpy.array",
"os.path.basename",
"cv2.cvtColor",
"cv2.CascadeClassifier",
"cv2.imread",
"os.walk"
] | [((261, 303), 'cv2.cvtColor', 'cv2.cvtColor', (['test_img', 'cv2.COLOR_BGR2GRAY'], {}), '(test_img, cv2.COLOR_BGR2GRAY)\n', (273, 303), False, 'import cv2\n'), ((364, 436), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""HaarCascade/haarcascade_frontalface_default.xml"""'], {}), "('HaarCascade/haarcascade_front... |
import dask
import numpy as np
import pandas as pd
from epimargin.models import Age_SIRVD
from epimargin.utils import annually, normalize, percent, years
from studies.vaccine_allocation.commons import *
from tqdm import tqdm
import warnings
warnings.filterwarnings("error")
num_sims = 1000
simulation_range = 1... | [
"dask.config.set",
"dask.distributed.progress",
"numpy.tile",
"numpy.ones",
"pandas.read_csv",
"dask.distributed.get_task_stream",
"epimargin.utils.normalize",
"dask.distributed.Client",
"numpy.zeros",
"numpy.savez_compressed",
"warnings.filterwarnings"
] | [((242, 274), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (265, 274), False, 'import warnings\n'), ((937, 1076), 'numpy.savez_compressed', 'np.savez_compressed', (["(dst / f'{tag}.npz')"], {'dT': 'policy.dT_total', 'dD': 'policy.dD_total', 'pi': 'policy.pi', 'q0': 'policy... |
'''Every agent has an agent state, which is its local view of the world'''
import numpy as np
import itertools
class AgentState:
def __init__(self, name, agt, seed=1234):
self.name = name
self.prng = np.random.RandomState(seed)
# contains the variable assignment (exploreD) for this agent a... | [
"itertools.product",
"numpy.random.RandomState"
] | [((221, 248), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (242, 248), True, 'import numpy as np\n'), ((837, 864), 'itertools.product', 'itertools.product', (['*domains'], {}), '(*domains)\n', (854, 864), False, 'import itertools\n')] |
from typing import List, Union
import numpy as np
import pandas_datareader as pdr
import pandas as pd
import matplotlib.pyplot as plt
def rsi(symbol :str ,name :str, date :str) -> None :
"""
Calculates and visualises the Relative Stock Index on a Stock of the company.
Parameters:
symbol(str) : Sy... | [
"pandas_datareader.get_data_yahoo",
"numpy.max",
"pandas.concat",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((620, 652), 'pandas_datareader.get_data_yahoo', 'pdr.get_data_yahoo', (['symbol', 'date'], {}), '(symbol, date)\n', (638, 652), True, 'import pandas_datareader as pdr\n'), ((1072, 1087), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (1084, 1087), True, 'import matplotlib.pyplot as plt\n'), ((1... |
"""
These classes are a collection of the needed tools to read external data.
The External type objects created by these classes are initialized before
the Stateful objects by functions.Model.initialize.
"""
import re
import os
import warnings
import pandas as pd # TODO move to openpyxl
import numpy as np
import xarr... | [
"numpy.all",
"re.compile",
"openpyxl.load_workbook",
"xarray.broadcast",
"os.path.join",
"os.path.splitext",
"numpy.diff",
"os.path.isfile",
"numpy.array",
"numpy.empty_like",
"numpy.isnan",
"pandas.to_numeric",
"pandas.read_excel",
"warnings.warn",
"numpy.interp",
"re.findall",
"num... | [((16001, 16015), 'numpy.isnan', 'np.isnan', (['data'], {}), '(data)\n', (16009, 16015), True, 'import numpy as np\n'), ((16902, 16931), 'numpy.empty_like', 'np.empty_like', (['x'], {'dtype': 'float'}), '(x, dtype=float)\n', (16915, 16931), True, 'import numpy as np\n'), ((19042, 19071), 're.findall', 're.findall', (['... |
import random
from typing import Optional, Tuple, Union
import numpy as np
import torch
from torch import Tensor
from torch_geometric.utils import coalesce, degree, remove_self_loops
from .num_nodes import maybe_num_nodes
def negative_sampling(edge_index: Tensor,
num_nodes: Optional[Union[int... | [
"torch.split",
"torch_geometric.utils.degree",
"torch.all",
"torch.stack",
"numpy.isin",
"torch.from_numpy",
"torch_geometric.utils.remove_self_loops",
"torch.arange",
"torch_geometric.utils.coalesce",
"torch.cat"
] | [((5711, 5748), 'torch.split', 'torch.split', (['edge_index', 'split'], {'dim': '(1)'}), '(edge_index, split, dim=1)\n', (5722, 5748), False, 'import torch\n'), ((5764, 5799), 'torch_geometric.utils.degree', 'degree', (['src_batch'], {'dtype': 'torch.long'}), '(src_batch, dtype=torch.long)\n', (5770, 5799), False, 'fro... |
from tkinter import *
from PIL import ImageGrab
import numpy as np
import cv2
import time
import pyautogui as pg
import DirectInputRoutines as DIR
from LogKey import key_check
last_time = time.time()
one_hot = [0, 0, 0, 0, 0, 0]
hash_dict = {'w':0, 's':1, 'a':2, 'd':3, 'c':4, 'v':5}
X = []
y = []
def a... | [
"cv2.fillPoly",
"pyautogui.hotkey",
"numpy.median",
"cv2.GaussianBlur",
"PIL.ImageGrab.grab",
"cv2.line",
"numpy.zeros_like",
"cv2.bitwise_and",
"numpy.array",
"cv2.cvtColor",
"cv2.Canny",
"time.time",
"numpy.save"
] | [((196, 207), 'time.time', 'time.time', ([], {}), '()\n', (205, 207), False, 'import time\n'), ((3513, 3532), 'numpy.save', 'np.save', (['"""X.npy"""', 'X'], {}), "('X.npy', X)\n", (3520, 3532), True, 'import numpy as np\n'), ((3534, 3553), 'numpy.save', 'np.save', (['"""y.npy"""', 'y'], {}), "('y.npy', y)\n", (3541, 3... |
import quandl
import math
import numpy as np
from sklearn import preprocessing, cross_validation, svm
from sklearn.linear_model import LinearRegression
import pickle
import datetime
from matplotlib import style
import matplotlib.pyplot as plot
# Config
isLoadFromLocal = True
quandl.ApiConfig.api_key = '<KEY>'
style.us... | [
"datetime.datetime.fromtimestamp",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"numpy.array",
"matplotlib.style.use",
"quandl.get",
"sklearn.cross_validation.train_test_split",
"sklearn.linear_model.LinearRegression",
"sklearn.preprocessing.scale",
"matplo... | [((312, 331), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (321, 331), False, 'from matplotlib import style\n'), ((1072, 1094), 'sklearn.preprocessing.scale', 'preprocessing.scale', (['x'], {}), '(x)\n', (1091, 1094), False, 'from sklearn import preprocessing, cross_validation, svm\n'), ... |
import tkinter.messagebox
from tkinter import *
import tkinter as tk
from tkinter import filedialog
import numpy
import pytesseract #Python wrapper for Google-owned OCR engine known by the name of Tesseract.
import cv2
from PIL import Image, ImageTk
import os
root = tk.Tk()
root.title("Object Character Recognizer")
ro... | [
"tkinter.LabelFrame",
"PIL.Image.open",
"cv2.threshold",
"cv2.medianBlur",
"tkinter.Button",
"os.getcwd",
"numpy.array",
"tkinter.Tk",
"tkinter.Label",
"pytesseract.image_to_string",
"cv2.cvtColor"
] | [((268, 275), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (273, 275), True, 'import tkinter as tk\n'), ((3726, 3783), 'tkinter.LabelFrame', 'tk.LabelFrame', (['root'], {'text': '"""Image:"""', 'width': '(768)', 'height': '(600)'}), "(root, text='Image:', width=768, height=600)\n", (3739, 3783), True, 'import tkinter as tk... |
# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
# reserved. See files LICENSE and NOTICE for details.
#
# This file is part of CEED, a collection of benchmarks, miniapps, software
# libraries and APIs for efficient h... | [
"numpy.eye",
"libceed.Ceed",
"numpy.allclose",
"numpy.sqrt",
"check.output",
"numpy.float32"
] | [((1674, 1701), 'libceed.Ceed', 'libceed.Ceed', (['ceed_resource'], {}), '(ceed_resource)\n', (1686, 1701), False, 'import libceed\n'), ((2155, 2182), 'libceed.Ceed', 'libceed.Ceed', (['ceed_resource'], {}), '(ceed_resource)\n', (2167, 2182), False, 'import libceed\n'), ((2857, 2884), 'libceed.Ceed', 'libceed.Ceed', ([... |
import cv2
import ezdxf
import numpy as np
def draw_hatch(img, entity, color, mask):
for poly_path in entity.paths.paths:
# print(poly_path.path_type_flags)
polygon = np.array([vertex[:-1] for vertex in poly_path.vertices]).astype(int)
if poly_path.path_type_flags & 1 == 1:
cv2... | [
"cv2.fillPoly",
"numpy.ceil",
"cv2.drawContours",
"cv2.flip",
"numpy.ones",
"numpy.floor",
"numpy.column_stack",
"cv2.findContours",
"ezdxf.readfile",
"numpy.array",
"numpy.zeros",
"numpy.cos",
"numpy.sin",
"numpy.zeros_like",
"numpy.arange"
] | [((1455, 1481), 'numpy.arange', 'np.arange', (['s', '(e + d / 2)', 'd'], {}), '(s, e + d / 2, d)\n', (1464, 1481), True, 'import numpy as np\n'), ((3039, 3062), 'ezdxf.readfile', 'ezdxf.readfile', (['in_path'], {}), '(in_path)\n', (3053, 3062), False, 'import ezdxf\n'), ((3306, 3324), 'numpy.zeros_like', 'np.zeros_like... |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import numpy as np
from os import path as op
from ..util import load_data_file
# This is the package data dir, not the dir for config, etc.
DATA_DIR = op.join... | [
"os.path.dirname",
"numpy.zeros",
"os.path.join",
"numpy.modf"
] | [((321, 341), 'os.path.dirname', 'op.dirname', (['__file__'], {}), '(__file__)\n', (331, 341), True, 'from os import path as op\n'), ((1080, 1124), 'numpy.zeros', 'np.zeros', (['(value.shape + (4,))'], {'dtype': 'np.ubyte'}), '(value.shape + (4,), dtype=np.ubyte)\n', (1088, 1124), True, 'import numpy as np\n'), ((1178,... |
import warnings
import numpy as np
import torch
import torch.nn.functional as F
from sklearn import metrics
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
from tqdm import tqdm
from datasets.bert_processors.abstract_processor import convert_examples_to_features_with_emotion, \
... | [
"datasets.bert_processors.abstract_processor.convert_examples_to_hierarchical_features",
"torch.nn.functional.sigmoid",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"numpy.array",
"sklearn.metrics.jaccard_score",
"utils.emotion.Emotion",
"sklearn.metrics.hamming_loss",
"dataset... | [((539, 572), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (562, 572), False, 'import warnings\n'), ((785, 858), 'utils.tokenization.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['args.model'], {'is_lowercase': 'args.is_lowercase'}), '(args.model, is... |
#!/usr/bin/env python
# coding: utf-8
""" Learning Koopman Invariant Subspace
(c) <NAME>, 2017.
<EMAIL>
"""
import numpy as np
np.random.seed(1234567890)
from argparse import ArgumentParser
from os import path
import time
from lkis import TimeSeriesBatchMaker, KoopmanInvariantSubspaceLearner
from losses import co... | [
"torch.manual_seed",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"lkis.TimeSeriesBatchMaker",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"lkis.KoopmanInvariantSubspaceLearner",
"losses.combined_loss",
"numpy.random.seed",
"torch.save",
"matplotlib.pyplot.title",
"numpy... | [((131, 157), 'numpy.random.seed', 'np.random.seed', (['(1234567890)'], {}), '(1234567890)\n', (145, 157), True, 'import numpy as np\n'), ((485, 496), 'time.time', 'time.time', ([], {}), '()\n', (494, 496), False, 'import time\n'), ((506, 596), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Learn... |
import numpy as np
from math import pi,exp
def static_stability(height,area,theta,s_et=None,n_et=None):
"""
The function "static_stability" computes the vertical gradient (z-derivative)
of hemispheric-averaged potential temperature, i.e. d\tilde{theta}/dz in the def-
inition of QGPV in eq.(3) of Huang ... | [
"numpy.abs",
"numpy.mean",
"numpy.ones",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"numpy.empty_like",
"numpy.cos",
"numpy.sin",
"math.exp"
] | [((2300, 2324), 'numpy.zeros', 'np.zeros', (['theta.shape[0]'], {}), '(theta.shape[0])\n', (2308, 2324), True, 'import numpy as np\n'), ((2338, 2362), 'numpy.zeros', 'np.zeros', (['theta.shape[0]'], {}), '(theta.shape[0])\n', (2346, 2362), True, 'import numpy as np\n'), ((2621, 2652), 'numpy.sum', 'np.sum', (['area_zon... |
import numpy as np
import scipy.interpolate
import scipy.ndimage
from sklearn.feature_extraction.image import extract_patches_2d, reconstruct_from_patches_2d
def _calc_patch_grid_dims(shape, patch_size, patch_stride):
x_w, x_h, x_c = shape
num_rows = 1 + (x_h - patch_size) // patch_stride
num_cols = 1 + (... | [
"numpy.clip",
"sklearn.feature_extraction.image.extract_patches_2d",
"numpy.array",
"image_analogy.img_utils.preprocess_image",
"numpy.arange",
"numpy.rank",
"numpy.reshape",
"numpy.where",
"scipy.misc.imsave",
"numpy.asarray",
"image_analogy.img_utils.load_image",
"image_analogy.img_utils.dep... | [((527, 574), 'sklearn.feature_extraction.image.extract_patches_2d', 'extract_patches_2d', (['x', '(patch_size, patch_size)'], {}), '(x, (patch_size, patch_size))\n', (545, 574), False, 'from sklearn.feature_extraction.image import extract_patches_2d, reconstruct_from_patches_2d\n'), ((1228, 1303), 'numpy.reshape', 'np... |
import gym
from gym import spaces, error, utils
from gym.utils import seeding
import numpy as np
from scipy.spatial.distance import pdist, squareform
import configparser
from os import path
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
font = {'family' : 'sans-serif',
'weight' : 'bold',
... | [
"numpy.clip",
"configparser.ConfigParser",
"numpy.sin",
"numpy.divide",
"gym.utils.seeding.np_random",
"numpy.mean",
"numpy.multiply",
"numpy.min",
"matplotlib.pyplot.ylim",
"numpy.random.normal",
"numpy.eye",
"matplotlib.pyplot.gca",
"numpy.fill_diagonal",
"os.path.dirname",
"numpy.cos"... | [((488, 515), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (513, 515), False, 'import configparser\n'), ((1655, 1720), 'numpy.zeros', 'np.zeros', (['(self.n_nodes, self.nx * self.filter_len, self.n_pools)'], {}), '((self.n_nodes, self.nx * self.filter_len, self.n_pools))\n', (1663, 1720),... |
import pandas as pd
import numpy as np
import os
import logging
# suppress warnings
import warnings;
warnings.filterwarnings('ignore');
from tqdm.autonotebook import tqdm
# register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm`
tqdm.pandas()
# https://pandas.pydata.org/pandas-docs/stable/user_g... | [
"tqdm.autonotebook.tqdm.pandas",
"matplotlib.rcParams.update",
"seaborn.set_style",
"warnings.filterwarnings",
"numpy.set_printoptions"
] | [((103, 136), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (126, 136), False, 'import warnings\n'), ((252, 265), 'tqdm.autonotebook.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (263, 265), False, 'from tqdm.autonotebook import tqdm\n'), ((746, 780), 'numpy.set_printopt... |
import sys
import soundcard
import numpy
import pytest
ones = numpy.ones(1024)
signal = numpy.concatenate([[ones], [-ones]]).T
def test_speakers():
for speaker in soundcard.all_speakers():
assert isinstance(speaker.name, str)
assert hasattr(speaker, 'id')
assert isinstance(speaker.channels... | [
"soundcard.get_microphone",
"soundcard.all_speakers",
"soundcard.all_microphones",
"numpy.ones",
"soundcard.default_microphone",
"soundcard.default_speaker",
"soundcard.get_speaker",
"numpy.concatenate"
] | [((63, 79), 'numpy.ones', 'numpy.ones', (['(1024)'], {}), '(1024)\n', (73, 79), False, 'import numpy\n'), ((89, 125), 'numpy.concatenate', 'numpy.concatenate', (['[[ones], [-ones]]'], {}), '([[ones], [-ones]])\n', (106, 125), False, 'import numpy\n'), ((169, 193), 'soundcard.all_speakers', 'soundcard.all_speakers', ([]... |
import numpy as np
import h5py
import os
from devito.logger import info
from devito import TimeFunction, clear_cache
from examples.seismic.acoustic import AcousticWaveSolver
from examples.seismic import Model, RickerSource, Receiver, TimeAxis
from math import floor
from scipy.interpolate import griddata
import argparse... | [
"examples.seismic.TimeAxis",
"numpy.reshape",
"argparse.ArgumentParser",
"scipy.interpolate.griddata",
"devito.TimeFunction",
"os.path.join",
"h5py.File",
"examples.seismic.RickerSource",
"numpy.zeros",
"examples.seismic.Model",
"numpy.linspace",
"examples.seismic.Receiver",
"devito.clear_ca... | [((331, 370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (354, 370), False, 'import argparse\n'), ((877, 904), 'numpy.reshape', 'np.reshape', (['vp', '(1601, 401)'], {}), '(vp, (1601, 401))\n', (887, 904), True, 'import numpy as np\n'), ((959, 996), 'num... |
"""
Functions for reading Magritek Spinsolve binary (dx/1d) files and
parameter (acqu.par/proc.par) files.
"""
import os
from warnings import warn
import numpy as np
from . import fileiobase
from . import jcampdx
__developer_info__ = """
Spinsolve is the software used on the Magritek benchtop NMR devices.
A spect... | [
"os.path.join",
"os.path.isfile",
"os.path.isdir",
"warnings.warn",
"numpy.frombuffer"
] | [((3216, 3242), 'os.path.join', 'os.path.join', (['dir', 'acqupar'], {}), '(dir, acqupar)\n', (3228, 3242), False, 'import os\n'), ((3250, 3273), 'os.path.isfile', 'os.path.isfile', (['acqupar'], {}), '(acqupar)\n', (3264, 3273), False, 'import os\n'), ((3551, 3577), 'os.path.join', 'os.path.join', (['dir', 'procpar'],... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | [
"numpy.cumsum",
"modin.error_message.ErrorMessage.catch_bugs_and_request_email",
"numpy.all"
] | [((2458, 2544), 'modin.error_message.ErrorMessage.catch_bugs_and_request_email', 'ErrorMessage.catch_bugs_and_request_email', (['(axis is not None and axis not in [0, 1])'], {}), '(axis is not None and axis not in\n [0, 1])\n', (2499, 2544), False, 'from modin.error_message import ErrorMessage\n'), ((2590, 2624), 'n... |
# Copyright (C) 2019 Cancer Care Associates
# 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 ... | [
"pymedphys._dicom.header.adjust_RED_by_structure_name",
"pymedphys._dicom.header.adjust_machine_name",
"pymedphys._dicom.header.RED_adjustment_map_from_structure_names",
"subprocess.check_call",
"pymedphys._dicom.utilities.remove_file",
"uuid.uuid4",
"os.path.dirname",
"pymedphys._dicom.create.dicom_d... | [((958, 983), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (973, 983), False, 'import os\n'), ((1256, 1309), 'pydicom.write_file', 'pydicom.write_file', (['ORIGINAL_DICOM_FILENAME', 'original'], {}), '(ORIGINAL_DICOM_FILENAME, original)\n', (1274, 1309), False, 'import pydicom\n'), ((1676, ... |
""" Simple Example using coreali to access a register model. Needs no h^ardware"""
# Import dependencies and compile register model with systemrdl-compiler
from systemrdl import RDLCompiler
import coreali
import numpy as np
import os
from coreali import RegisterModel
rdlc = RDLCompiler()
rdlc.compile_file(os.path.di... | [
"os.path.dirname",
"systemrdl.RDLCompiler",
"coreali.RegisterModel",
"numpy.uint8"
] | [((278, 291), 'systemrdl.RDLCompiler', 'RDLCompiler', ([], {}), '()\n', (289, 291), False, 'from systemrdl import RDLCompiler\n'), ((502, 526), 'coreali.RegisterModel', 'RegisterModel', (['root', 'rio'], {}), '(root, rio)\n', (515, 526), False, 'from coreali import RegisterModel\n'), ((310, 335), 'os.path.dirname', 'os... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file contains the generators and their inverses for common archimedean copulas.
"""
import numpy as np
def boundsConditions(x):
if x < 0 or x > 1:
raise ValueError("Unable to compute generator for x equals to {}".format(x))
def claytonGenerator(... | [
"numpy.exp",
"numpy.log",
"numpy.divide"
] | [((2585, 2622), 'numpy.log', 'np.log', (['((1.0 - theta * (1.0 - x)) / x)'], {}), '((1.0 - theta * (1.0 - x)) / x)\n', (2591, 2622), True, 'import numpy as np\n'), ((2141, 2173), 'numpy.log', 'np.log', (['(1.0 - (1.0 - x) ** theta)'], {}), '(1.0 - (1.0 - x) ** theta)\n', (2147, 2173), True, 'import numpy as np\n'), ((1... |
"""Implementations of algorithms for continuous control."""
import functools
from typing import Optional, Sequence, Tuple
import jax
import jax.numpy as jnp
import numpy as np
import optax
from jaxrl.agents.sac import temperature
from jaxrl.agents.sac.actor import update as update_actor
from jaxrl.agents.sac.critic ... | [
"jaxrl.networks.critic_net.ValueCritic",
"numpy.clip",
"optax.adam",
"jax.random.PRNGKey",
"jaxrl.agents.sac.temperature.update",
"jaxrl.networks.policies.sample_actions",
"jaxrl.networks.common.Model.create",
"jaxrl.agents.sac_v1.critic.update_q",
"numpy.asarray",
"jaxrl.agents.sac.actor.update",... | [((542, 601), 'functools.partial', 'functools.partial', (['jax.jit'], {'static_argnames': '"""update_target"""'}), "(jax.jit, static_argnames='update_target')\n", (559, 601), False, 'import functools\n'), ((907, 954), 'jaxrl.agents.sac_v1.critic.update_q', 'update_q', (['critic', 'target_value', 'batch', 'discount'], {... |
#! /usr/bin/env python
import cv2
import matplotlib.pyplot as plt
import skimage
import skimage.io
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.pyplot import cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
from numpy import ... | [
"numpy.sqrt",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.dot",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.dtype",
"numpy.tile",
"numpy.ceil",
"cv2.putText",
"skimage.io.imread",
"cv2.cvtColor",
"matplotlib.pyplot.title",
"cv2.getTextSize... | [((1017, 1036), 'numpy.array', 'array', (['arr', '"""uint8"""'], {}), "(arr, 'uint8')\n", (1022, 1036), False, 'from numpy import arange, array, newaxis, tile, linspace, pad, expand_dims, fromstring, ceil, dtype, float32, sqrt, dot, zeros\n'), ((1633, 1655), 'matplotlib.figure.Figure', 'Figure', ([], {'figsize': '(5, 5... |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistribut... | [
"scipy.sparse.isspmatrix_csc",
"scipy.sparse.isspmatrix_csr",
"numpy.abs",
"qutip.cy.graph_utils._maximum_bipartite_matching",
"qutip.cy.graph_utils._breadth_first_search",
"qutip.cy.graph_utils._node_degrees",
"numpy.diff",
"qutip.cy.graph_utils._reverse_cuthill_mckee",
"numpy.any",
"numpy.argsor... | [((2836, 2882), 'qutip.cy.graph_utils._node_degrees', '_node_degrees', (['A.indices', 'A.indptr', 'A.shape[0]'], {}), '(A.indices, A.indptr, A.shape[0])\n', (2849, 2882), False, 'from qutip.cy.graph_utils import _breadth_first_search, _node_degrees, _reverse_cuthill_mckee, _maximum_bipartite_matching, _weighted_biparti... |
import click
import pickle
import numpy as np
from collections import defaultdict
from utils import reset_seeds, get_dataset, load_embeddings
from mlp_multilabel_wrapper import PowersetKerasWrapper, MultiOutputKerasWrapper
from mlp_utils import CrossLabelDependencyLoss
def get_random_sample(dataset_name='bbc', train_... | [
"mlp_multilabel_wrapper.MultiOutputKerasWrapper",
"click.option",
"utils.get_dataset",
"mlp_utils.CrossLabelDependencyLoss",
"collections.defaultdict",
"mlp_multilabel_wrapper.PowersetKerasWrapper",
"utils.load_embeddings",
"utils.reset_seeds",
"click.command",
"numpy.arange"
] | [((912, 927), 'click.command', 'click.command', ([], {}), '()\n', (925, 927), False, 'import click\n'), ((929, 968), 'click.option', 'click.option', (['"""--n-samples"""'], {'default': '(10)'}), "('--n-samples', default=10)\n", (941, 968), False, 'import click\n'), ((970, 1031), 'click.option', 'click.option', (['"""--... |
from __future__ import division
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import sys
import os
import time
#
# TORCH INSTALLATION: refer to https://pytorch.org/get-started/locally/
#
def update_progress(job_t... | [
"numpy.sqrt",
"torch.det",
"torch.t",
"torch.mm",
"torch.tensor",
"numpy.zeros",
"numpy.savetxt",
"torch.dot",
"os.system",
"sys.stdout.flush",
"torch.empty",
"torch.inverse",
"sys.stdout.write"
] | [((1336, 1402), 'torch.tensor', 'torch.tensor', (['coords_data'], {'requires_grad': '(True)', 'dtype': 'torch.float64'}), '(coords_data, requires_grad=True, dtype=torch.float64)\n', (1348, 1402), False, 'import torch\n'), ((2061, 2127), 'torch.tensor', 'torch.tensor', (['val_r_data'], {'requires_grad': '(False)', 'dtyp... |
import logging
import os
import random
import string
import time
import unittest
import neurolib.utils.paths as paths
import neurolib.utils.pypetUtils as pu
import numpy as np
import pytest
import xarray as xr
from neurolib.models.aln import ALNModel
from neurolib.models.fhn import FHNModel
from neurolib.models.multim... | [
"neurolib.optimize.exploration.BoxSearch",
"random.choice",
"numpy.random.rand",
"numpy.ones",
"neurolib.models.multimodel.MultiModel",
"os.path.join",
"neurolib.utils.parameterSpace.ParameterSpace",
"neurolib.utils.loadData.Dataset",
"neurolib.models.aln.ALNModel",
"numpy.array",
"numpy.linspac... | [((10456, 10471), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10469, 10471), False, 'import unittest\n'), ((1635, 1679), 'neurolib.utils.parameterSpace.ParameterSpace', 'ParameterSpace', (["{'mue_ext_mean': [1.0, 2.0]}"], {}), "({'mue_ext_mean': [1.0, 2.0]})\n", (1649, 1679), False, 'from neurolib.utils.parame... |
# newly added libraries
import copy
import wandb
import time
import math
import csv
import shutil
from tqdm import tqdm
import torch
import numpy as np
import pandas as pd
from client import Client
from config import *
import scheduler as sch
class FedAvgTrainer(object):
def __init__(self, dataset, model, device... | [
"wandb.log",
"numpy.random.rand",
"torch.nn.CrossEntropyLoss",
"numpy.array",
"client.Client",
"copy.deepcopy",
"numpy.arange",
"numpy.asarray",
"numpy.max",
"numpy.isinf",
"scheduler.Scheduler_PN_method_1",
"csv.writer",
"torch.norm",
"numpy.isnan",
"scheduler.Scheduler_PN_method_3",
... | [((4042, 4076), 'numpy.zeros', 'np.zeros', (['(1, client_num_in_total)'], {}), '((1, client_num_in_total))\n', (4050, 4076), True, 'import numpy as np\n'), ((23990, 24031), 'math.ceil', 'math.ceil', (['(TIME_COMPRESSION_RATIO * tmp_t)'], {}), '(TIME_COMPRESSION_RATIO * tmp_t)\n', (23999, 24031), False, 'import math\n')... |
# -*- coding: utf-8 -*-
from sklearn import preprocessing
from torch.autograd import Variable
from models_gat import GAT
import os
import torch
import numpy as np
import argparse
import pickle
import sklearn.metrics as metrics
import cross_val
import time
import random
torch.manual_seed(0)
np.random.seed(0)
random.s... | [
"numpy.hstack",
"torch.max",
"cross_val.stratify_splits",
"torch.from_numpy",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"torch.cuda.is_available",
"torch.squeeze",
"cross_val.model_selection_split",
"os.remove",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParse... | [((273, 293), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (290, 293), False, 'import torch\n'), ((294, 311), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (308, 311), True, 'import numpy as np\n'), ((312, 326), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (323, 326), Fals... |
"""
Copyright (c) 2016 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import sys
import numpy as np
import logging
import time
import types
from datetime import datetime
from netCDF4 import Dataset
from nexustiles.nexustiles import NexusTileService
from webservice.webmodel impor... | [
"logging.getLogger",
"numpy.ma.max",
"inspect.getmembers",
"numpy.flipud",
"numpy.where",
"webservice.webmodel.NexusProcessingException",
"netCDF4.Dataset",
"time.time",
"functools.wraps",
"numpy.max",
"numpy.linspace",
"numpy.min",
"numpy.all",
"numpy.ma.min",
"nexustiles.nexustiles.Nex... | [((442, 469), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (459, 469), False, 'import logging\n'), ((822, 849), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (839, 849), False, 'import logging\n'), ((2833, 2860), 'logging.getLogger', 'logging.getLogger', ... |
import numpy as np
from collections import defaultdict, Counter
from .rbbox_np import rbbox_iou
def get_ap(recall, precision):
recall = [0] + list(recall) + [1]
precision = [0] + list(precision) + [0]
for i in range(len(precision) - 1, 0, -1):
precision[i - 1] = max(precision[i - 1], precision[i... | [
"numpy.any",
"numpy.max",
"collections.Counter",
"numpy.stack",
"numpy.linspace",
"numpy.zeros",
"collections.defaultdict",
"numpy.cumsum"
] | [((522, 558), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(11)'], {'endpoint': '(True)'}), '(0, 1, 11, endpoint=True)\n', (533, 558), True, 'import numpy as np\n'), ((598, 610), 'numpy.any', 'np.any', (['mask'], {}), '(mask)\n', (604, 610), True, 'import numpy as np\n'), ((1134, 1167), 'collections.Counter', 'Cou... |
import json
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import simulation
from eval_functions import oks_score_multi
import utils
def alter_location(points, x_offset, y_offset):
x, y = points.T
return np.array([x + x_offset, y + y_offset]).T
def alter_rotation(points, radians):... | [
"numpy.random.normal",
"numpy.mean",
"eval_functions.oks_score_multi",
"numpy.random.beta",
"utils.bounded_cauchy",
"numpy.reshape",
"numpy.random.choice",
"utils.make_categorical",
"numpy.exp",
"numpy.array",
"json.load",
"simulation.create_sim_df",
"numpy.linspace",
"numpy.sign",
"nump... | [((336, 359), 'numpy.mean', 'np.mean', (['points'], {'axis': '(0)'}), '(points, axis=0)\n', (343, 359), True, 'import numpy as np\n'), ((496, 519), 'numpy.mean', 'np.mean', (['points'], {'axis': '(0)'}), '(points, axis=0)\n', (503, 519), True, 'import numpy as np\n'), ((2047, 2067), 'pandas.DataFrame', 'pd.DataFrame', ... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from .shared import Conv_Block
from ..utils.utils import zeros, mean_cube, last_frame, ENS
class Residual(nn.Module):
def __init__(self, fn):
super().__init__()
self.fn = fn
def f... | [
"torch.mul",
"torch.split",
"numpy.power",
"torch.nn.ModuleList",
"torch.nn.LayerNorm",
"torch.sin",
"torch.stack",
"einops.rearrange",
"torch.nn.Conv2d",
"torch.cos",
"torch.cuda.is_available",
"torch.concat",
"torch.moveaxis",
"torch.nn.functional.softmax"
] | [((494, 511), 'torch.nn.LayerNorm', 'nn.LayerNorm', (['dim'], {}), '(dim)\n', (506, 511), True, 'import torch.nn as nn\n'), ((2972, 3000), 'torch.stack', 'torch.stack', (['([K] * s)'], {'dim': '(-2)'}), '([K] * s, dim=-2)\n', (2983, 3000), False, 'import torch\n'), ((3017, 3045), 'torch.stack', 'torch.stack', (['([V] *... |
import numpy as np
import photon_stream as ps
import photon_stream_production as psp
import pkg_resources
import os
runinfo_path = pkg_resources.resource_filename(
'photon_stream_production',
os.path.join('tests', 'resources', 'runinfo_20161115_to_20170103.csv')
)
drs_fRunID_for_obs_run = psp.drs_run._drs_fRu... | [
"photon_stream_production.drs_run.assign_drs_runs",
"photon_stream_production.runinfo.read",
"os.path.join",
"numpy.isnan"
] | [((201, 271), 'os.path.join', 'os.path.join', (['"""tests"""', '"""resources"""', '"""runinfo_20161115_to_20170103.csv"""'], {}), "('tests', 'resources', 'runinfo_20161115_to_20170103.csv')\n", (213, 271), False, 'import os\n'), ((379, 409), 'photon_stream_production.runinfo.read', 'psp.runinfo.read', (['runinfo_path']... |
import datetime as dt
from os.path import dirname, join
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
from bokeh.io import curdoc
from bokeh.layouts import column, gridplot, row
from bokeh.models import ColumnDataSource, DataRange1d, Select, HoverTool, Panel, Tabs, LinearC... | [
"datetime.datetime",
"bokeh.layouts.column",
"bokeh.models.Div",
"pyarrow.parquet.read_table",
"bokeh.plotting.figure",
"bokeh.io.curdoc",
"bokeh.models.Select",
"numpy.array",
"bokeh.models.NumeralTickFormatter",
"pandas.DataFrame",
"pandas.date_range",
"bokeh.models.HoverTool"
] | [((902, 925), 'datetime.datetime', 'dt.datetime', (['(2017)', '(7)', '(1)'], {}), '(2017, 7, 1)\n', (913, 925), True, 'import datetime as dt\n'), ((935, 958), 'datetime.datetime', 'dt.datetime', (['(2022)', '(1)', '(1)'], {}), '(2022, 1, 1)\n', (946, 958), True, 'import datetime as dt\n'), ((7986, 8121), 'bokeh.models.... |
import pandas_datareader.data as pdr
import yfinance as fix
import numpy as np
fix.pdr_override()
def back_test(strategy, seq_len, ticker, start_date, end_date, dim):
"""
A simple back test for a given date period
:param strategy: the chosen strategy. Note to have already formed the model, and fitted with... | [
"yfinance.pdr_override",
"numpy.array",
"pandas_datareader.data.get_data_yahoo"
] | [((79, 97), 'yfinance.pdr_override', 'fix.pdr_override', ([], {}), '()\n', (95, 97), True, 'import yfinance as fix\n'), ((785, 833), 'pandas_datareader.data.get_data_yahoo', 'pdr.get_data_yahoo', (['ticker', 'start_date', 'end_date'], {}), '(ticker, start_date, end_date)\n', (803, 833), True, 'import pandas_datareader.... |
import os
import cv2
import random
import numpy as np
from tensorflow.keras.utils import to_categorical
from scripts.consts import class_dict
def get_data(path, split=0.2):
X, y = [], []
for directory in os.listdir(path):
dirpath = os.path.join(path, directory)
print(directory, len(os.listd... | [
"tensorflow.keras.utils.to_categorical",
"os.listdir",
"random.shuffle",
"os.path.join",
"numpy.array",
"cv2.resize",
"cv2.imread"
] | [((216, 232), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (226, 232), False, 'import os\n'), ((716, 736), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (730, 736), False, 'import random\n'), ((253, 282), 'os.path.join', 'os.path.join', (['path', 'directory'], {}), '(path, directory)\n', (2... |
# -*- coding: utf-8 -*-
# GFOLD_static_p3p4
min_=min
from cvxpy import *
import cvxpy_codegen as cpg
from time import time
import numpy as np
import sys
import GFOLD_params
''' As defined in the paper...
PROBLEM 3: Minimum Landing Error (tf roughly solved)
MINIMIZE : norm of landing error vector
SUBJ TO :
... | [
"numpy.array",
"GFOLD_params.SuperParams",
"cvxpy_codegen.codegen"
] | [((1050, 1076), 'GFOLD_params.SuperParams', 'GFOLD_params.SuperParams', ([], {}), '()\n', (1074, 1076), False, 'import GFOLD_params\n'), ((4489, 4523), 'cvxpy_codegen.codegen', 'cpg.codegen', (['problem', 'codegen_path'], {}), '(problem, codegen_path)\n', (4500, 4523), True, 'import cvxpy_codegen as cpg\n'), ((2230, 23... |
#!/usr/bin/env python3
# vim:fileencoding=UTF-8
# -*- coding: UTF-8 -*-
"""
Created on 15 juny 2019 y.
@author: <NAME> <EMAIL>
"""
import sys
import struct
import numpy as np
from progress.bar import Bar
import logging
logging.basicConfig(format = u'%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s... | [
"logging.basicConfig",
"numpy.zeros",
"struct.unpack",
"progress.bar.Bar",
"logging.info"
] | [((223, 369), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'u"""%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s"""', 'level': 'logging.DEBUG', 'stream': 'sys.stdout'}), "(format=\n u'%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s',\n level=logging.DEBUG, str... |
import os
import pickle
import time
import timeit
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import torch
import tempfile
import horovod.torch as hvd
from horovod.ray import RayExecutor
from ray_shuffling_data_loader.torch_dataset import (TorchShufflingDatase... | [
"horovod.torch.broadcast_optimizer_state",
"horovod.torch.local_rank",
"ray_shuffling_data_loader.data_generation.DATA_SPEC.values",
"time.sleep",
"horovod.torch.local_size",
"torch.cuda.is_available",
"horovod.torch.size",
"ray.init",
"numpy.mean",
"os.path.exists",
"horovod.torch.rank",
"arg... | [((922, 982), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (945, 982), False, 'import argparse\n'), ((4215, 4225), 'horovod.torch.init', 'hvd.init', ([], {}), '()\n', (4223, 4225), True, 'import horovod.torch as hv... |
import pytest
import numpy as np
import eqtk
def test_promiscuous_binding_failure():
A = np.array(
[
[
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
... | [
"eqtk.solve",
"eqtk.eqcheck",
"numpy.exp",
"numpy.array",
"numpy.dot",
"pytest.raises"
] | [((96, 687), 'numpy.array', 'np.array', (['[[1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0,\n 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0,\n 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,\n 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0... |
import database as d
import numpy as np
import random
from transitions import Machine
#Conversations are markov chains. Works as follows: a column vector for each CURRENT state j, a row vector for each TARGET state i.
#Each entry i,j = the probability of moving to state i from state j.
#target state D = end of convers... | [
"random.random",
"numpy.dot",
"transitions.Machine"
] | [((2827, 2933), 'transitions.Machine', 'Machine', ([], {'model': 'self', 'states': 'Conversation.states', 'transitions': 'Conversation.transitions', 'initial': '"""exit"""'}), "(model=self, states=Conversation.states, transitions=Conversation.\n transitions, initial='exit')\n", (2834, 2933), False, 'from transitions... |
import tensorflow as tf
import os
import pickle
import numpy as np
from constant_params import input_feature_dim, window_size
def build_dataset(input_tfrecord_files, batch_size):
drop_remainder = False
feature_description = {
'label': tf.io.FixedLenFeature([], tf.int64),
'ref_aa': tf.io.Fixe... | [
"tensorflow.data.TFRecordDataset",
"os.path.exists",
"numpy.ones",
"tensorflow.io.parse_single_example",
"tensorflow.data.Options",
"pickle.load",
"numpy.int32",
"numpy.zeros",
"tensorflow.io.FixedLenFeature",
"tensorflow.io.decode_raw",
"tensorflow.reshape",
"tensorflow.cast",
"numpy.float3... | [((1795, 1840), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['input_tfrecord_files'], {}), '(input_tfrecord_files)\n', (1818, 1840), True, 'import tensorflow as tf\n'), ((1856, 1873), 'tensorflow.data.Options', 'tf.data.Options', ([], {}), '()\n', (1871, 1873), True, 'import tensorflow as tf\n'), ((3... |
import pandas as pd
import numpy as np
import pickle
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from math import sqrt
from sklearn.svm import SVR
from sklearn.svm import LinearSVR
from sklearn.preprocessing imp... | [
"pandas.read_pickle",
"pandas.read_csv",
"pickle.load",
"numpy.array",
"pandas.DataFrame"
] | [((697, 754), 'pandas.read_pickle', 'pd.read_pickle', (['"""../../dataset/score_df_final_tst.pickle"""'], {}), "('../../dataset/score_df_final_tst.pickle')\n", (711, 754), True, 'import pandas as pd\n'), ((848, 870), 'numpy.array', 'np.array', (['score_df_tst'], {}), '(score_df_tst)\n', (856, 870), True, 'import numpy ... |
import gym
from gym import spaces, error, utils
from gym.utils import seeding
import numpy as np
import configparser
from os import path
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
font = {'family': 'sans-serif',
'weight': 'bold',
'size': 14}
class MappingEnv(gym.Env):
def ... | [
"numpy.clip",
"numpy.hstack",
"numpy.logical_not",
"numpy.argsort",
"numpy.linalg.norm",
"gym.utils.seeding.np_random",
"numpy.mean",
"numpy.multiply",
"numpy.stack",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.pyplot.ylim",
"numpy.ones",
"matplotlib.pyplot.gca",
"numpy.fill_diagonal... | [((2106, 2165), 'numpy.linspace', 'np.linspace', (['(-1.0 * self.px_max)', 'self.px_max', 'self.n_agents'], {}), '(-1.0 * self.px_max, self.px_max, self.n_agents)\n', (2117, 2165), True, 'import numpy as np\n'), ((2178, 2237), 'numpy.linspace', 'np.linspace', (['(-1.0 * self.py_max)', 'self.py_max', 'self.n_agents'], {... |
# 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.ops.map_fn.map_fn",
"numpy.random.rand",
"tensorflow.python.ops.variables.global_variables_initializer",
"numpy.array",
"tensorflow.python.ops.array_ops.matrix_set_diag",
"tensorflow.python.ops.math_ops.range",
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.ops.array_... | [((8201, 8237), 'tensorflow.python.framework.test_util.run_v1_only', 'test_util.run_v1_only', (['"""b/120545219"""'], {}), "('b/120545219')\n", (8222, 8237), False, 'from tensorflow.python.framework import test_util\n'), ((10466, 10477), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10475, 104... |
# Library for the dynamics of a lumen network
# The lumen are 2 dimensional and symmetric and connected with 1 dimensional tubes
#
# Created by <NAME>, 2018
# Modified by <NAME>--Serandour on 8/04/2019
"""
network.py conf.init
Defines the class network and associated functions
Imports
-------... | [
"numpy.abs",
"os.path.getsize",
"numpy.linalg.solve",
"numpy.sqrt",
"numpy.arccos",
"os.path.join",
"numpy.column_stack",
"numpy.sum",
"numpy.zeros",
"numpy.sin",
"numpy.loadtxt"
] | [((8944, 8983), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (8952, 8983), True, 'import numpy as np\n'), ((9052, 9091), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (9060, 9091), True, 'import ... |
# Illustrate upsampling in 2d
# Code from <NAME>
# https://machinelearningmastery.com/generative_adversarial_networks/
import tensorflow as tf
from tensorflow import keras
from numpy import asarray
#from keras.models import Sequential
from tensorflow.keras.models import Sequential
#from keras.layers import UpSampl... | [
"tensorflow.keras.layers.UpSampling2D",
"numpy.asarray",
"tensorflow.keras.models.Sequential"
] | [((380, 405), 'numpy.asarray', 'asarray', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (387, 405), False, 'from numpy import asarray\n'), ((415, 457), 'numpy.asarray', 'asarray', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n', (422, 457), False, 'from numpy import asarray\n'... |
# ======================================================================
# copyright 2020. Triad National Security, LLC. All rights
# reserved. This program was produced under U.S. Government contract
# 89233218CNA000001 for Los Alamos National Laboratory (LANL), which
# is operated by Triad National Security, LLC for ... | [
"numpy.array",
"numpy.zeros"
] | [((3787, 3803), 'numpy.zeros', 'np.zeros', (['[4, 4]'], {}), '([4, 4])\n', (3795, 3803), True, 'import numpy as np\n'), ((4682, 4796), 'numpy.array', 'np.array', (['[[g_tt, g_tr, 0.0, g_tf], [g_tr, g_rr, 0.0, g_rf], [0.0, 0.0, g_thth, 0.0],\n [g_tf, g_rf, 0.0, g_ff]]'], {}), '([[g_tt, g_tr, 0.0, g_tf], [g_tr, g_rr, ... |
# -*- coding: utf-8 -*-
"""A module for plotting penguins data for modelling with scikit-learn."""
# Imports ---------------------------------------------------------------------
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Constants -----------------------------... | [
"numpy.random.normal",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.pyplot.style.reload_library",
"matplotlib.ticker.FormatStrFormatter",
"pandas.DataFrame",
"numpy.meshgrid",
"matplotlib.pyplot.subplots"
] | [((608, 645), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""./style/eda.mplstyle"""'], {}), "('./style/eda.mplstyle')\n", (621, 645), True, 'import matplotlib.pyplot as plt\n'), ((977, 1020), 'numpy.linspace', 'np.linspace', (['X_AXIS[0]', 'X_AXIS[1]', 'n_points'], {}), '(X_AXIS[0], X_AXIS[1], n_points)\n', (98... |
from ipso_phen.ipapi.base.ipt_abstract import IptBase
from ipso_phen.ipapi.tools import regions
import numpy as np
import cv2
import logging
logger = logging.getLogger(__name__)
from ipso_phen.ipapi.base import ip_common as ipc
class IptFilterContourBySize(IptBase):
def build_params(self):
... | [
"logging.getLogger",
"numpy.dstack",
"ipso_phen.ipapi.tools.regions.keep_rois",
"cv2.drawContours",
"cv2.bitwise_and",
"cv2.contourArea",
"cv2.putText",
"ipso_phen.ipapi.base.ip_common.get_contours",
"numpy.zeros_like",
"cv2.boundingRect"
] | [((159, 186), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (176, 186), False, 'import logging\n'), ((4349, 4368), 'numpy.zeros_like', 'np.zeros_like', (['mask'], {}), '(mask)\n', (4362, 4368), True, 'import numpy as np\n'), ((8412, 8443), 'cv2.bitwise_and', 'cv2.bitwise_and', (['out_mas... |
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, <NAME> and <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistribut... | [
"numpy.prod",
"scipy.sparse.lil_matrix",
"numpy.sqrt",
"numpy.ones",
"qutip.states.enr_state_dictionaries",
"qutip.dimensions.flatten",
"qutip.qobj.Qobj",
"scipy.sparse.eye",
"numpy.fix",
"numpy.conj",
"qutip.fastsparse.fast_csr_matrix",
"qutip.states.qutrit_basis",
"qutip.fastsparse.fast_id... | [((4281, 4288), 'qutip.qobj.Qobj', 'Qobj', (['A'], {}), '(A)\n', (4285, 4288), False, 'from qutip.qobj import Qobj\n'), ((4415, 4454), 'numpy.arange', 'np.arange', (['j', '(-j - 1)', '(-1)'], {'dtype': 'complex'}), '(j, -j - 1, -1, dtype=complex)\n', (4424, 4454), True, 'import numpy as np\n'), ((4540, 4571), 'numpy.ar... |
from abc import ABCMeta, abstractmethod
import random
import json
import pickle
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import nltk
from nltk.stem import WordNetLemmatizer
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout
from tensorflow.... | [
"random.choice",
"pickle.dump",
"random.shuffle",
"nltk.download",
"nltk.word_tokenize",
"tensorflow.keras.layers.Dropout",
"nltk.stem.WordNetLemmatizer",
"pickle.load",
"tensorflow.keras.optimizers.SGD",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"... | [((396, 430), 'nltk.download', 'nltk.download', (['"""punkt"""'], {'quiet': '(True)'}), "('punkt', quiet=True)\n", (409, 430), False, 'import nltk\n'), ((431, 467), 'nltk.download', 'nltk.download', (['"""wordnet"""'], {'quiet': '(True)'}), "('wordnet', quiet=True)\n", (444, 467), False, 'import nltk\n'), ((1406, 1425)... |
"""
@brief Generate Fe55 images and associated darks and bias images
according to section 5.4 of the E/O document (Dec 19, 2012 version).
@author <NAME> <<EMAIL>>
"""
import os
import numpy as np
from sim_inputs import *
from sim_tools import *
def generate_Fe55_images(exptimes, nxrays, outdir, sensorid, gain=gain,
... | [
"numpy.linspace",
"os.path.join"
] | [((3210, 3233), 'numpy.linspace', 'np.linspace', (['(1)', '(5)', 'nexp'], {}), '(1, 5, nexp)\n', (3221, 3233), True, 'import numpy as np\n'), ((659, 688), 'os.path.join', 'os.path.join', (['outdir', 'outfile'], {}), '(outdir, outfile)\n', (671, 688), False, 'import os\n'), ((1406, 1435), 'os.path.join', 'os.path.join',... |
import scipy.stats
import numpy as np
def f_test(sample_x, sample_y, larger_varx_alt):
"""
Computes the F-value and corresponding p-value for a pair of samples and alternative hypothesis.
Parameters
----------
sample_x : list
A random sample x1,...,xnx. Let its (underlying) variance be ox... | [
"numpy.mean",
"numpy.median",
"numpy.max",
"numpy.array",
"numpy.sum",
"numpy.var"
] | [((1099, 1123), 'numpy.var', 'np.var', (['sample_x'], {'ddof': '(1)'}), '(sample_x, ddof=1)\n', (1105, 1123), True, 'import numpy as np\n'), ((1143, 1167), 'numpy.var', 'np.var', (['sample_y'], {'ddof': '(1)'}), '(sample_y, ddof=1)\n', (1149, 1167), True, 'import numpy as np\n'), ((2649, 2673), 'numpy.var', 'np.var', (... |
import numpy as np
from kivygames.games import Game
import kivygames.games.noughtsandcrosses.c as c
class CellOccupiedError(Exception):
pass
class NoughtsAndCrosses(Game):
minPlayers = 2
maxPlayers = 2
hasAI = True
gridShape = (3, 3)
def __init__(self):
Game.__init__(self)
... | [
"numpy.count_nonzero",
"numpy.zeros",
"kivygames.games.noughtsandcrosses.c.hasPlayerWon",
"kivygames.games.noughtsandcrosses.c.minimax",
"kivygames.games.Game.__init__"
] | [((294, 313), 'kivygames.games.Game.__init__', 'Game.__init__', (['self'], {}), '(self)\n', (307, 313), False, 'from kivygames.games import Game\n'), ((335, 371), 'numpy.zeros', 'np.zeros', (['self.gridShape'], {'dtype': '"""u1"""'}), "(self.gridShape, dtype='u1')\n", (343, 371), True, 'import numpy as np\n'), ((926, 9... |
"""
:mod:`meshes` -- Discretization
===============================
Everything related to meshes appropriate for the multigrid solver.
"""
# Copyright 2018-2020 The emg3d Developers.
#
# This file is part of emg3d.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except... | [
"numpy.clip",
"numpy.sqrt",
"numpy.array",
"copy.deepcopy",
"numpy.nanmin",
"numpy.arange",
"numpy.diff",
"numpy.max",
"numpy.nanmax",
"numpy.argmin",
"numpy.ceil",
"numpy.ones",
"numpy.floor",
"numpy.squeeze",
"scipy.optimize.fsolve",
"numpy.isclose",
"numpy.unique",
"numpy.sum",
... | [((10528, 10550), 'numpy.array', 'np.array', (['res'], {'ndmin': '(1)'}), '(res, ndmin=1)\n', (10536, 10550), True, 'import numpy as np\n'), ((10807, 10831), 'numpy.array', 'np.array', (['fixed'], {'ndmin': '(1)'}), '(fixed, ndmin=1)\n', (10815, 10831), True, 'import numpy as np\n'), ((12111, 12140), 'numpy.array', 'np... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.utils import data
from torch import optim
import torchvision.models as models
from torch.autograd import Variable
import torchvision as tv
import random
import math
import time
from datetime i... | [
"torch.randperm",
"torch.nn.init.constant_",
"torch.nn.L1Loss",
"math.sqrt",
"torch.cuda.device_count",
"torch.cuda.synchronize",
"torch.cuda.is_available",
"torch.nn.functional.interpolate",
"torchvision.utils.make_grid",
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.init.kaiming_normal_",... | [((3063, 3088), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (3086, 3088), False, 'import torch\n'), ((4383, 4397), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (4395, 4397), False, 'from datetime import datetime\n'), ((5320, 5354), 'torch.utils.tensorboard.SummaryWriter', 'Summ... |
import pygame
import time
import numpy as np
import sys
gray = (150, 150, 150)
white = (255, 255, 255)
black = (0, 0, 0, )
red_block = (255, 0, 0)
red_border = (76, 0, 19)
block_color = (255, 128, 0)
border_color = (165,42,42)
screen = None
SIDE = 50
BORDER = 5
MARGIN = 5
LINE = 1
h_switch = True
def __draw_hor... | [
"pygame.init",
"pygame.quit",
"pygame.event.get",
"numpy.where",
"pygame.display.set_mode",
"time.sleep",
"pygame.display.quit",
"sys.exit",
"pygame.display.update",
"pygame.Rect"
] | [((1755, 1773), 'pygame.event.get', 'pygame.event.get', ([], {}), '()\n', (1771, 1773), False, 'import pygame\n'), ((3536, 3559), 'pygame.display.update', 'pygame.display.update', ([], {}), '()\n', (3557, 3559), False, 'import pygame\n'), ((3564, 3579), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (3574, 357... |
# -*- coding: utf-8 -*-
"""Test GUI component."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
#from contextlib import contextmanager
from pytest import yield_fixture, fixture, raises
import ... | [
"phylib.utils.emit",
"phy.gui.tests.test_widgets._assert",
"phylib.utils.Bunch",
"phy.gui.qt.qInstallMessageHandler",
"numpy.repeat",
"phy.utils.context.Context",
"phy.gui.tests.test_widgets._wait_until_table_ready",
"phy.gui.GUI",
"numpy.array",
"pytest.raises",
"phylib.utils.connect",
"phy.g... | [((978, 1009), 'phy.gui.qt.qInstallMessageHandler', 'qInstallMessageHandler', (['handler'], {}), '(handler)\n', (1000, 1009), False, 'from phy.gui.qt import qInstallMessageHandler\n'), ((1313, 1374), 'phy.gui.GUI', 'GUI', ([], {'position': '(200, 100)', 'size': '(500, 500)', 'config_dir': 'tempdir'}), '(position=(200, ... |
# The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# 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... | [
"numpy.product"
] | [((1433, 1452), 'numpy.product', 'np.product', (['v.shape'], {}), '(v.shape)\n', (1443, 1452), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.