code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 1 18:56:24 2019
@author: cpdsg
"""
import svect as sv
import numpy as np
from math import pi
import qneural as qn
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
# ==================================... | [
"svect.unit",
"numpy.matrix",
"matplotlib.pyplot.show",
"qneural.initialize_network_eig",
"matplotlib.pyplot.figure",
"svect.transformDensity",
"numpy.array",
"qneural.get_seed",
"numpy.cos",
"numpy.sin",
"svect.tensorProd",
"numpy.dot",
"qneural.calculate_BoxCounting",
"svect.proj2x2"
] | [((913, 941), 'numpy.matrix', 'np.matrix', (['[[0, -1], [1, 0]]'], {}), '([[0, -1], [1, 0]])\n', (922, 941), True, 'import numpy as np\n'), ((947, 964), 'svect.proj2x2', 'sv.proj2x2', (['(False)'], {}), '(False)\n', (957, 964), True, 'import svect as sv\n'), ((971, 987), 'svect.proj2x2', 'sv.proj2x2', (['(True)'], {}),... |
import numpy as np
import matplotlib.pyplot as plt
from bci3wads.utils import data
from bci3wads.utils import constants
from bci3wads.features.epoch import Epoch
subject_match_signals = []
subject_mismatch_signals = []
for epoch_path in constants.REF_SUBJECT_PATH.glob('epoch_*.pickle'):
epoch = Epoch(data.load_p... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.mean",
"bci3wads.utils.constants.REF_SUBJECT_PATH.glob",
"bci3wads.utils.data.load_pickle",
"numpy.concatenate"
] | [((240, 289), 'bci3wads.utils.constants.REF_SUBJECT_PATH.glob', 'constants.REF_SUBJECT_PATH.glob', (['"""epoch_*.pickle"""'], {}), "('epoch_*.pickle')\n", (271, 289), False, 'from bci3wads.utils import constants\n'), ((566, 603), 'numpy.concatenate', 'np.concatenate', (['subject_match_signals'], {}), '(subject_match_si... |
"""
Relief Visualization Toolbox – Visualization Functions
RVT Convert to 8bit esri raster function
rvt_py, rvt.vis.byte_scale
Credits:
<NAME> (<EMAIL>)
<NAME> (<EMAIL>)
<NAME>
<NAME>
<NAME>
<NAME>
<NAME>
Copyright:
2010-2020 Research Centre of the Slovenian Academy of Sciences and Ar... | [
"gc.collect",
"numpy.array"
] | [((1832, 1894), 'numpy.array', 'np.array', (["pixelBlocks['raster_pixels']"], {'dtype': '"""f4"""', 'copy': '(False)'}), "(pixelBlocks['raster_pixels'], dtype='f4', copy=False)\n", (1840, 1894), True, 'import numpy as np\n'), ((2382, 2394), 'gc.collect', 'gc.collect', ([], {}), '()\n', (2392, 2394), False, 'import gc\n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
使用 LDA 算法重新实现一遍。
"""
import matplotlib.pyplot as plt
import numpy as np
import data_processing as dp
import model_selection as ms
from linear import LDA
if __name__ == '__main__':
data = np.loadtxt('ex2data2.txt', delimiter=',')
X = data[:, :2]
y = dat... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"data_processing.map_features",
"linear.LDA",
"model_selection.accuracy",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((247, 288), 'numpy.loadtxt', 'np.loadtxt', (['"""ex2data2.txt"""'], {'delimiter': '""","""'}), "('ex2data2.txt', delimiter=',')\n", (257, 288), True, 'import numpy as np\n'), ((397, 462), 'matplotlib.pyplot.plot', 'plt.plot', (['X[pos2, 0]', 'X[pos2, 1]', '"""k+"""'], {'linewidth': '(2)', 'markersize': '(7)'}), "(X[p... |
"""
Example of running PyTorch implementation of DDPG on HalfCheetah.
"""
import sys
sys.path.append('../')
import copy
from rlkit.torch.ddpg.dsfpg import DSFPGTrainer
from gym.envs.mujoco import HopperEnv
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.envs.wrappers import NormalizedBox... | [
"sys.path.append",
"rlkit.torch.networks.LinearMlp",
"copy.deepcopy",
"rlkit.torch.torch_rl_algorithm.TorchBatchRLAlgorithm",
"rlkit.torch.networks.TanhMlpPolicy",
"gym.make",
"rlkit.data_management.env_replay_buffer.EnvReplayBuffer",
"rlkit.torch.ddpg.dsfpg.DSFPGTrainer",
"rlkit.torch.networks.Conc... | [((85, 107), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (100, 107), False, 'import sys\n'), ((1477, 1506), 'gym.make', 'gym.make', (["variant['env_name']"], {}), "(variant['env_name'])\n", (1485, 1506), False, 'import d4rl, gym\n'), ((1640, 1732), 'rlkit.torch.networks.ConcatMlp', 'ConcatMl... |
import numpy as np
#program that displays 1000 entries of sin(x) vs x.
#also adds the same but for cos(x) as an extra and prep for propt 6.
def main():
x = np.linspace(0.0,2.0*np.pi,1000)
print(f"sin(x) cos(x)")
for i in range(1000):
print(f"{np.sin(x[i]):10.5e} {np.cos(x[i]):10.5e}")
if __name__ ... | [
"numpy.sin",
"numpy.cos",
"numpy.linspace"
] | [((159, 194), 'numpy.linspace', 'np.linspace', (['(0.0)', '(2.0 * np.pi)', '(1000)'], {}), '(0.0, 2.0 * np.pi, 1000)\n', (170, 194), True, 'import numpy as np\n'), ((260, 272), 'numpy.sin', 'np.sin', (['x[i]'], {}), '(x[i])\n', (266, 272), True, 'import numpy as np\n'), ((285, 297), 'numpy.cos', 'np.cos', (['x[i]'], {}... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import ceiltrack
import numpy as np
import struct
def rle(mask):
# assume run starts with zeros, output <skip length> <run length>
out = []
zero = True
run = 0
for i in range(len(mask)):
if zero:
if mask[i]:
... | [
"ceiltrack.ceillut",
"numpy.array",
"numpy.sum"
] | [((617, 630), 'numpy.array', 'np.array', (['out'], {}), '(out)\n', (625, 630), True, 'import numpy as np\n'), ((665, 684), 'ceiltrack.ceillut', 'ceiltrack.ceillut', ([], {}), '()\n', (682, 684), False, 'import ceiltrack\n'), ((1428, 1444), 'numpy.sum', 'np.sum', (['ceilmask'], {}), '(ceilmask)\n', (1434, 1444), True, '... |
# Copyright (c) 2020, <NAME>
# See LICENSE file for details: <https://github.com/moble/scri/blob/master/LICENSE>
### NOTE: The functions in this file are intended purely for inclusion in the AsymptoticBondData
### class. In particular, they assume that the first argument, `self` is an instance of
### AsymptoticBondDa... | [
"numpy.sum",
"math.sqrt",
"numpy.empty",
"numpy.einsum",
"numpy.cross",
"numpy.linalg.norm",
"numpy.sqrt"
] | [((2553, 2588), 'numpy.empty', 'np.empty', (['charge.shape'], {'dtype': 'float'}), '(charge.shape, dtype=float)\n', (2561, 2588), True, 'import numpy as np\n'), ((4338, 4363), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {'axis': '(1)'}), '(v, axis=1)\n', (4352, 4363), True, 'import numpy as np\n'), ((2702, 2709), 'm... |
import glob
import os
import cv2
import numpy as np
from random import shuffle
# data
def one_hot(label_array, num_classes):
return np.squeeze(np.eye(num_classes)[label_array.reshape(-1)])
def read_and_resize_image(dir_of_images, input_shape):
nrows, ncolumns, _ = input_shape
X = [] # list of images
... | [
"random.shuffle",
"cv2.imread",
"numpy.array",
"numpy.eye",
"os.path.join"
] | [((1354, 1373), 'random.shuffle', 'shuffle', (['data_files'], {}), '(data_files)\n', (1361, 1373), False, 'from random import shuffle\n'), ((1795, 1816), 'numpy.array', 'np.array', (['data_labels'], {}), '(data_labels)\n', (1803, 1816), True, 'import numpy as np\n'), ((149, 168), 'numpy.eye', 'np.eye', (['num_classes']... |
import numpy as np
import pandas as pd
import os
import anndata as ad
# remove runtime warning (divided by zero)
np.seterr(divide='ignore', invalid='ignore')
class GeneExp:
"""
A class used to creat gene expression anndata along data trait including both genes and samples information.
:param species: s... | [
"pandas.DataFrame",
"numpy.seterr",
"pandas.read_csv",
"os.path.isfile",
"anndata.AnnData",
"pandas.concat"
] | [((115, 159), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (124, 159), True, 'import numpy as np\n'), ((2167, 2264), 'pandas.DataFrame', 'pd.DataFrame', (['expressionList.columns[1:]'], {'columns': '[column]', 'index': 'expressionList... |
# scaling functions
import numpy as np
import copy
from VyPy.data.scaling import ScalingBunch
from VyPy.data.scaling import Linear as LinearFunction
class Linear(ScalingBunch):
def __init__(self,Train):
self.calc_scaling(Train)
return
def calc_scaling(self,Train):
... | [
"VyPy.data.scaling.Linear",
"numpy.zeros",
"numpy.min",
"numpy.max",
"numpy.array"
] | [((519, 560), 'numpy.array', 'np.array', (['[XB[:, 1] - XB[:, 0], XB[:, 0]]'], {}), '([XB[:, 1] - XB[:, 0], XB[:, 0]])\n', (527, 560), True, 'import numpy as np\n'), ((856, 906), 'VyPy.data.scaling.Linear', 'LinearFunction', (['Xref[0, :, None]', 'Xref[1, :, None]'], {}), '(Xref[0, :, None], Xref[1, :, None])\n', (870,... |
import numpy as np
import torch
from estimation_methods.abstract_estimation_method import \
AbstractEstimationMethod
from utils.torch_utils import torch_to_np, BatchIter, np_to_tensor
class DeepSieve(AbstractEstimationMethod):
# Implements SMD algorithm using LBFGS optimizer and identity omega
def __init... | [
"estimation_methods.abstract_estimation_method.AbstractEstimationMethod.__init__",
"utils.torch_utils.BatchIter",
"utils.torch_utils.np_to_tensor",
"numpy.eye",
"numpy.linalg.solve"
] | [((648, 711), 'estimation_methods.abstract_estimation_method.AbstractEstimationMethod.__init__', 'AbstractEstimationMethod.__init__', (['self', 'rho_generator', 'rho_dim'], {}), '(self, rho_generator, rho_dim)\n', (681, 711), False, 'from estimation_methods.abstract_estimation_method import AbstractEstimationMethod\n')... |
"""
Convert numpy data type to basic python data type.
"""
import numpy as np
def clean(d) -> dict:
new = dict()
def clean_item(item) -> object:
# Use this to detect something.
# if isinstance(x, tuple):
# raise Exception
if not isinstance(item, list):
try:
... | [
"numpy.asscalar"
] | [((339, 356), 'numpy.asscalar', 'np.asscalar', (['item'], {}), '(item)\n', (350, 356), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import simplejson as json
import six
import os
from pandas.api.types import is_integer_dtype
from scipy.sparse import coo_matrix
import numpy as np
import pandas as pd
import h5py
from .core import (
get,
region_to_offset... | [
"h5py.File",
"numpy.outer",
"os.path.basename",
"pandas.api.types.is_integer_dtype",
"pandas.Categorical.from_codes",
"numpy.isnan",
"pandas.Index",
"scipy.sparse.coo_matrix",
"pandas.Series",
"simplejson.loads",
"h5py.is_hdf5"
] | [((4737, 4777), 'h5py.File', 'h5py.File', (['self.filename', 'mode'], {}), '(self.filename, mode, **kwargs)\n', (4746, 4777), False, 'import h5py\n'), ((12838, 12866), 'os.path.basename', 'os.path.basename', (['self.store'], {}), '(self.store)\n', (12854, 12866), False, 'import os\n'), ((15534, 15567), 'pandas.api.type... |
import argparse
import os
import pathlib
import random
import timeit
import numpy as np
import pandas as pd
def stdin(n_repeat, n_number, i) -> list:
tmp = pathlib.Path('tmp')
for _ in range(n_repeat * n_number):
os.system('python stdin.py {} < data/N100000.txt >> {}'.format(i, tmp))
with tmp.ope... | [
"pandas.DataFrame",
"os.remove",
"argparse.ArgumentParser",
"random.random",
"pathlib.Path",
"numpy.array",
"operator.itemgetter"
] | [((163, 182), 'pathlib.Path', 'pathlib.Path', (['"""tmp"""'], {}), "('tmp')\n", (175, 182), False, 'import pathlib\n'), ((473, 489), 'os.remove', 'os.remove', (['"""tmp"""'], {}), "('tmp')\n", (482, 489), False, 'import os\n'), ((1493, 1518), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1516... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 22:14:14 2018
@author: <NAME>
"""
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from scipy import stats
from sklearn.cross_validation import train_test_split
from sklearn.linear_model import LogisticRegression
from ... | [
"pandas.DataFrame",
"sklearn.cross_validation.train_test_split",
"pandas.crosstab",
"pandas.read_csv",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.preprocessing.LabelEncoder",
"sklearn.metrics.f1_score",
"numpy.where",
"seaborn.FacetGrid"
] | [((746, 805), 'pandas.read_csv', 'pd.read_csv', (['"""D:\\\\Hackathons\\\\Promotion\\\\train_LZdllcl.csv"""'], {}), "('D:\\\\Hackathons\\\\Promotion\\\\train_LZdllcl.csv')\n", (757, 805), True, 'import pandas as pd\n'), ((860, 898), 'seaborn.FacetGrid', 'sns.FacetGrid', (['data'], {'col': '"""is_promoted"""'}), "(data,... |
import numpy as np
from annb.templates import *
class BatchSGD(Optimizer):
def __init__(self, learning_rate: float = None, decay: float = None, momentum: float = None) -> None:
super().__init__(learning_rate, decay, momentum)
self.manager = None
@staticmethod
def optimize(layer: Layer, l... | [
"numpy.zeros_like"
] | [((1195, 1230), 'numpy.zeros_like', 'np.zeros_like', (['layer.layer._weights'], {}), '(layer.layer._weights)\n', (1208, 1230), True, 'import numpy as np\n'), ((1320, 1352), 'numpy.zeros_like', 'np.zeros_like', (['layer.layer._bias'], {}), '(layer.layer._bias)\n', (1333, 1352), True, 'import numpy as np\n')] |
from itertools import product
import cv2
import numpy as np
import aoc_helper
from aoc_helper.utils import extract_ints
class Scanner:
def __init__(self, coords):
self.coords = coords
self.distances = np.array(
list(map(set, np.linalg.norm(coords[:, None] - coords[None], axis=-1)))
... | [
"aoc_helper.submit",
"aoc_helper.day",
"numpy.abs",
"aoc_helper.utils.extract_ints",
"numpy.zeros",
"numpy.where",
"numpy.array",
"numpy.linalg.norm",
"cv2.estimateAffine3D",
"numpy.concatenate"
] | [((2092, 2123), 'aoc_helper.submit', 'aoc_helper.submit', (['(19)', 'part_one'], {}), '(19, part_one)\n', (2109, 2123), False, 'import aoc_helper\n'), ((2124, 2155), 'aoc_helper.submit', 'aoc_helper.submit', (['(19)', 'part_two'], {}), '(19, part_two)\n', (2141, 2155), False, 'import aoc_helper\n'), ((1266, 1281), 'num... |
# -*- coding: utf-8 -*-
# Parser for PreCo dataset
#
# Author: <NAME> <<EMAIL>>
#
# For license information, see LICENSE
import gc
from collections import defaultdict, namedtuple
from enum import Enum
from itertools import chain
from multiprocessing import Pool
from typing import DefaultDict, List, Tuple
import numpy... | [
"spacy.tokens.doc.Doc",
"nltk.data.load",
"pandas.get_dummies",
"numpy.asarray",
"pandas.read_json",
"collections.defaultdict",
"spacy.load",
"gc.collect",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"collections.namedtuple",
"nltk.pos_tag"
] | [((719, 778), 'collections.namedtuple', 'namedtuple', (['"""ClusterIndicies"""', '"""sent_idx begin_idx end_idx"""'], {}), "('ClusterIndicies', 'sent_idx begin_idx end_idx')\n", (729, 778), False, 'from collections import defaultdict, namedtuple\n'), ((799, 851), 'collections.namedtuple', 'namedtuple', (['"""ClusteredS... |
# contains computational functions that are used for modelling
import torch as T
from torch.autograd import Variable
from torch import Tensor
from torch.nn.functional import softmax
import numpy as np
def masked_softmax(scores, mask=None, dim=-1):
"""
Normalizes scores using masked softmax operation.
:pa... | [
"torch.randn_like",
"torch.empty",
"numpy.float",
"torch.full",
"torch.nn.functional.softmax",
"torch.exp",
"torch.arange",
"torch.sum",
"torch.log"
] | [((529, 545), 'numpy.float', 'np.float', (['"""-inf"""'], {}), "('-inf')\n", (537, 545), True, 'import numpy as np\n'), ((558, 582), 'torch.nn.functional.softmax', 'softmax', (['scores'], {'dim': 'dim'}), '(scores, dim=dim)\n', (565, 582), False, 'from torch.nn.functional import softmax\n'), ((1210, 1258), 'torch.sum',... |
import sys
import os
import cv2
import numpy as np
import torch
import torch.nn.functional as F
import math
import copy
from light_cnn import LightCNN_Action_Net
from openpose import pyopenpose as op
from scipy.spatial.distance import euclidean
# ========= Action Classification params =============
nNumAction = 15... | [
"os.path.join",
"scipy.spatial.distance.euclidean",
"cv2.cvtColor",
"torch.load",
"numpy.transpose",
"light_cnn.LightCNN_Action_Net",
"numpy.ndarray.tolist",
"openpose.pyopenpose.Datum",
"cv2.resize",
"copy.deepcopy",
"cv2.circle",
"math.sqrt",
"torch.cuda.is_available",
"torch.unsqueeze",... | [((1000, 1018), 'openpose.pyopenpose.WrapperPython', 'op.WrapperPython', ([], {}), '()\n', (1016, 1018), True, 'from openpose import pyopenpose as op\n'), ((3346, 3356), 'openpose.pyopenpose.Datum', 'op.Datum', ([], {}), '()\n', (3354, 3356), True, 'from openpose import pyopenpose as op\n'), ((5969, 6030), 'numpy.zeros... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.9.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # E... | [
"numpy.maximum",
"numpy.sum",
"numpy.shape",
"numpy.mean",
"surmise.emulation.emulator",
"numpy.loadtxt",
"numpy.reshape",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"numpy.square",
"numpy.percentile",
"scipy.stats.uniform.logpdf",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplo... | [((760, 797), 'numpy.loadtxt', 'np.loadtxt', (['"""ball.csv"""'], {'delimiter': '""","""'}), "('ball.csv', delimiter=',')\n", (770, 797), True, 'import numpy as np\n'), ((828, 858), 'numpy.reshape', 'np.reshape', (['ball[:, 0]', '(m, 1)'], {}), '(ball[:, 0], (m, 1))\n', (838, 858), True, 'import numpy as np\n'), ((885,... |
# SPDX-License-Identifier: Apache-2.0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
class SequenceMap(Base):
@static... | [
"onnx.helper.make_tensor_type_proto",
"onnx.helper.make_node",
"numpy.random.uniform",
"onnx.helper.make_tensor_value_info",
"numpy.zeros",
"numpy.random.randint",
"numpy.array"
] | [((769, 845), 'onnx.helper.make_node', 'onnx.helper.make_node', (['"""SequenceMap"""'], {'inputs': "['x']", 'outputs': "['y']", 'body': 'body'}), "('SequenceMap', inputs=['x'], outputs=['y'], body=body)\n", (790, 845), False, 'import onnx\n'), ((2247, 2341), 'onnx.helper.make_node', 'onnx.helper.make_node', (['"""Seque... |
'''
Created on 30-08-2011
@author: Ankhazam
Based on find_obj.py OpenCV2 sample
'''
import numpy as np
import cv2
from common import anorm
class ORBFlannMatcher(object):
'''
Main recognition and training module.
'''
detector = cv2.FastFeatureDetector(16, True)
detector = cv2.GridAdaptedFeatureD... | [
"cv2.DescriptorExtractor_create",
"numpy.sum",
"numpy.float32",
"cv2.FlannBasedMatcher",
"cv2.GridAdaptedFeatureDetector",
"cv2.FastFeatureDetector",
"cv2.findHomography"
] | [((248, 281), 'cv2.FastFeatureDetector', 'cv2.FastFeatureDetector', (['(16)', '(True)'], {}), '(16, True)\n', (271, 281), False, 'import cv2\n'), ((297, 337), 'cv2.GridAdaptedFeatureDetector', 'cv2.GridAdaptedFeatureDetector', (['detector'], {}), '(detector)\n', (327, 337), False, 'import cv2\n'), ((354, 391), 'cv2.Des... |
# coding=utf-8
# Copyright 2018 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"sys.stdout.write",
"os.mkdir",
"tensorflow.gfile.Exists",
"dopamine.agents.abstract_agent.AbstractAgent.__init__",
"numpy.sum",
"numpy.abs",
"tensorflow.logging.info",
"dopamine.generators.wgan.wgan.WassersteinGAN",
"dopamine.generators.wgan_gp.wgan_gp.WassersteinGANGP",
"numpy.clip",
"collecti... | [((1764, 1787), 'numpy.sum', 'np.sum', (['(output * target)'], {}), '(output * target)\n', (1770, 1787), True, 'import numpy as np\n'), ((1678, 1699), 'numpy.clip', 'np.clip', (['output', '(0)', '(1)'], {}), '(output, 0, 1)\n', (1685, 1699), True, 'import numpy as np\n'), ((1721, 1742), 'numpy.clip', 'np.clip', (['targ... |
import numbers
import os
import queue as Queue
import threading
import mxnet as mx
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
import cv2
import albumentations as A
from albumentations.pytorch import ToTensorV2
from insightface.app import MaskAugm... | [
"mxnet.recordio.MXIndexedRecordIO",
"argparse.ArgumentParser",
"mxnet.image.imdecode",
"albumentations.Normalize",
"albumentations.HorizontalFlip",
"albumentations.ImageCompression",
"os.path.join",
"albumentations.MotionBlur",
"insightface.app.MaskAugmentation",
"cv2.imwrite",
"torch.cuda.set_d... | [((5808, 5859), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""dataset test"""'}), "(description='dataset test')\n", (5831, 5859), False, 'import argparse, cv2, copy\n'), ((6459, 6481), 'copy.deepcopy', 'copy.deepcopy', (['dataset'], {}), '(dataset)\n', (6472, 6481), False, 'import argpa... |
"""Hops flask middleware example"""
from flask import Flask
import ghhops_server as hs
#from numpy.lib.polynomial import poly1d
import rhino3dm
import numpy as np
# #-------------------------------------------------------
# import os
# import sys
# path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(... | [
"rhino3dm.Mesh",
"ghhops_server.HopsPoint",
"ghhops_server.HopsMesh",
"numpy.arange",
"ghhops_server.HopsInteger",
"hops_agnet.AGNet",
"ghhops_server.Hops",
"gridshell_agnet.Gridshell_AGNet",
"ghhops_server.HopsNumber",
"ghhops_server.HopsCurve",
"ghhops_server.HopsBoolean",
"ghhops_server.Hop... | [((698, 713), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (703, 713), False, 'from flask import Flask\n'), ((735, 747), 'ghhops_server.Hops', 'hs.Hops', (['app'], {}), '(app)\n', (742, 747), True, 'import ghhops_server as hs\n'), ((1350, 1365), 'numpy.array', 'np.array', (['vlist'], {}), '(vlist)\n', (1... |
import pandas as pd
import numpy as np
import os
def get_pairs(labels):
pairs = []
stack = []
stack_2 = []
stack_3 = []
stack_4 = []
stack_5 = []
stack_6 = []
stack_7 = []
for i, I in enumerate(labels):
if I == '(':
stack.append(i)
#print(I, i)
... | [
"pandas.read_csv",
"numpy.greater_equal",
"numpy.triu_indices"
] | [((7022, 7059), 'numpy.triu_indices', 'np.triu_indices', (['y_pred.shape[0]'], {'k': '(1)'}), '(y_pred.shape[0], k=1)\n', (7037, 7059), True, 'import numpy as np\n'), ((7282, 7314), 'numpy.greater_equal', 'np.greater_equal', (['outputs', '(0.198)'], {}), '(outputs, 0.198)\n', (7298, 7314), True, 'import numpy as np\n')... |
from os import path
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
# 資料網址
DATA_URL = 'https://archive.ics.uci.edu/ml/machine-learning-databases/abalone/abalone.data'
# 資料標籤
DATA_LABEL = ... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"sklearn.model_selection.train_test_split",
"os.path.exists",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.... | [((852, 881), 'numpy.array', 'np.array', (['df[DATA_LABEL[5:8]]'], {}), '(df[DATA_LABEL[5:8]])\n', (860, 881), True, 'import numpy as np\n'), ((942, 969), 'numpy.array', 'np.array', (['df[DATA_LABEL[4]]'], {}), '(df[DATA_LABEL[4]])\n', (950, 969), True, 'import numpy as np\n'), ((1094, 1126), 'matplotlib.pyplot.figure'... |
from copy import deepcopy
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from seqeval.metrics.sequence_labeling import classification_report
from torch.utils.data import DataLoader
from tqdm.autonotebook import tqdm
from pyramid_nested_ner.model import PyramidNer
class PyramidNerTrainer(o... | [
"torch.nn.BCEWithLogitsLoss",
"torch.nn.CrossEntropyLoss",
"seqeval.metrics.sequence_labeling.classification_report",
"numpy.mean",
"numpy.arange",
"torch.no_grad",
"torch.sum"
] | [((5764, 5783), 'numpy.mean', 'np.mean', (['train_loss'], {}), '(train_loss)\n', (5771, 5783), True, 'import numpy as np\n'), ((7537, 7574), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (7556, 7574), True, 'import torch.nn as nn\n'), ((9196, 9315), 'seqe... |
import numpy as np
import matplotlib.pyplot as plt
#Create data
x=np.array([0.,0.5,1.])
y_exact=np.array([0.,1.,1.])
#Intiliase W and b
W=0.5
b=0.5
#Set other constants
N=3
eta=0.75
MaxIter=64
#Initialise approximation
F=W * x + b
#Functions
def cost():
return (1/N) * np.sum( 0.5* (y_exact - F)**2 )
#Partial d... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.sum",
"matplotlib.pyplot.plot",
"numpy.empty",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((67, 92), 'numpy.array', 'np.array', (['[0.0, 0.5, 1.0]'], {}), '([0.0, 0.5, 1.0])\n', (75, 92), True, 'import numpy as np\n'), ((97, 122), 'numpy.array', 'np.array', (['[0.0, 1.0, 1.0]'], {}), '([0.0, 1.0, 1.0])\n', (105, 122), True, 'import numpy as np\n'), ((481, 498), 'numpy.empty', 'np.empty', (['MaxIter'], {}),... |
import warnings
warnings.filterwarnings('ignore')
import tensorflow as tf
tf.get_logger().setLevel('ERROR')
from stable_baselines.common.vec_env import DummyVecEnv
from stable_baselines.deepq.policies import FeedForwardPolicy
from stable_baselines import DQN, PPO2
import argparse
import gym
import numpy as np
impor... | [
"pandas.DataFrame",
"stable_baselines.common.vec_env.DummyVecEnv",
"stable_baselines.PPO2",
"stable_baselines.DQN",
"argparse.ArgumentParser",
"warnings.filterwarnings",
"gym.make",
"numpy.mean",
"stable_baselines.PPO2.load",
"stable_baselines.DQN.load",
"tensorflow.get_logger"
] | [((17, 50), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (40, 50), False, 'import warnings\n'), ((3103, 3117), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3115, 3117), True, 'import pandas as pd\n'), ((3441, 3564), 'stable_baselines.DQN', 'DQN', (['custom_poli... |
from scipy.io import loadmat
import numpy as np
import os
from torch.utils.data import Dataset
import matplotlib.pyplot as plt
plt.switch_backend('TKAgg')
from wfdb import rdann
"""Expands the sleep stage and apnea/hypopnea annotation files from Physionet into numpy memmaps with one annotation per sample"""
#######... | [
"matplotlib.pyplot.switch_backend",
"numpy.size",
"wfdb.rdann",
"os.path.isdir",
"scipy.io.loadmat",
"numpy.zeros",
"os.listdir"
] | [((128, 155), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""TKAgg"""'], {}), "('TKAgg')\n", (146, 155), True, 'import matplotlib.pyplot as plt\n'), ((1143, 1163), 'os.listdir', 'os.listdir', (['dataPath'], {}), '(dataPath)\n', (1153, 1163), False, 'import os\n'), ((1963, 2021), 'wfdb.rdann', 'rdann', ... |
import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
import glob
files = glob.glob("digits/*.jpg")
train = []
train_labels = []
for iii,f in enumerate(files):
img = cv.imread(f)
grayImage = cv.cvtColor(img,cv.COLOR_BGR2GRAY)
ret,thresImg = cv.threshold(grayImage,100,255,cv.THRESH_BINARY)... | [
"cv2.cvtColor",
"cv2.ml.KNearest_create",
"cv2.threshold",
"cv2.imread",
"numpy.array",
"glob.glob"
] | [((93, 118), 'glob.glob', 'glob.glob', (['"""digits/*.jpg"""'], {}), "('digits/*.jpg')\n", (102, 118), False, 'import glob\n'), ((585, 600), 'numpy.array', 'np.array', (['train'], {}), '(train)\n', (593, 600), True, 'import numpy as np\n'), ((605, 627), 'numpy.array', 'np.array', (['train_labels'], {}), '(train_labels)... |
import uclasm
import numpy as np
from functools import reduce
n_iterations = 0
def validate_alldiff_solns(tmplt, world, candidates):
""" Check that there exists a solution to the alldiff problem """
# Map from tmplt index to possible candidate indices
var_to_vals = {
tmplt_idx: [
cand... | [
"uclasm.values_map_to_same_key",
"numpy.ones",
"uclasm.invert",
"numpy.array",
"numpy.argwhere",
"uclasm.get_node_cover",
"uclasm.one_hot"
] | [((896, 922), 'uclasm.invert', 'uclasm.invert', (['var_to_vals'], {}), '(var_to_vals)\n', (909, 922), False, 'import uclasm\n'), ((1011, 1053), 'uclasm.values_map_to_same_key', 'uclasm.values_map_to_same_key', (['val_to_vars'], {}), '(val_to_vars)\n', (1040, 1053), False, 'import uclasm\n'), ((4383, 4421), 'uclasm.get_... |
import numpy as np
import scipy.stats as st
import random
from generate_infection_states import generate_correlated_infections, generate_correlated_infections_fixed_household_size
from PCR_test import false_negative_rate_binary, pooled_PCR_test
def one_stage_group_testing_fixed_household_size(infections, pool_size, s... | [
"generate_infection_states.generate_correlated_infections_fixed_household_size",
"PCR_test.false_negative_rate_binary",
"numpy.sum",
"numpy.vectorize",
"PCR_test.pooled_PCR_test",
"numpy.zeros",
"numpy.cumsum",
"numpy.random.shuffle"
] | [((1147, 1168), 'numpy.sum', 'np.sum', (['pools'], {'axis': '(1)'}), '(pools, axis=1)\n', (1153, 1168), True, 'import numpy as np\n'), ((1321, 1336), 'numpy.sum', 'np.sum', (['results'], {}), '(results)\n', (1327, 1336), True, 'import numpy as np\n'), ((1428, 1441), 'numpy.sum', 'np.sum', (['pools'], {}), '(pools)\n', ... |
import math
import astropy as ast
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
import warnings
from iminuit import Minuit
from probfit import UnbinnedLH, gaussian, doublegaussian
import numba as nb
import pandas as pd
from .models import *
class PeakFitting():
def __... | [
"pandas.DataFrame",
"numpy.vectorize",
"scipy.optimize.curve_fit",
"numpy.array",
"iminuit.Minuit",
"numpy.diag"
] | [((7748, 7768), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'd'}), '(data=d)\n', (7760, 7768), True, 'import pandas as pd\n'), ((3665, 3828), 'iminuit.Minuit', 'Minuit', (['unbinned_likelihood'], {'mu': 'self.init[0]', 'sigma': 'self.init[1]', 'mu_2': 'self.init[2]', 'sigma_2': 'self.init[3]', 'A': 'self.init[4]'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from os.path import join, dirname
sys.path.insert(0, join(dirname(__file__), '..'))
sys.path.insert(0, join(dirname(__file__), '../../'))
import os
import random
import argparse
import numpy as np
from PIL import Image, ImageDraw
from datetime import datetime
i... | [
"numpy.abs",
"argparse.ArgumentParser",
"torch.cat",
"matplotlib.pyplot.figure",
"torch.set_num_threads",
"torch.isnan",
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.close",
"os.path.dirname",
"utils.sample",
"matplotlib.pyplot.rcParams.update",
"torch.utils.tensorbo... | [((362, 413), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'figure.max_open_warning': 0}"], {}), "({'figure.max_open_warning': 0})\n", (381, 413), True, 'import matplotlib.pyplot as plt\n'), ((801, 823), 'torch.manual_seed', 'torch.manual_seed', (['(999)'], {}), '(999)\n', (818, 823), False, 'import ... |
"""Generic classes and functions which aid the asteroseismology features."""
import numpy as np
import copy
from astropy import units as u
from astropy.units import Quantity
__all__ = ["SeismologyQuantity"]
class SeismologyQuantity(Quantity):
"""Holds an asteroseismic value including its unit, error, and estimat... | [
"copy.deepcopy",
"astropy.units.Quantity",
"numpy.diff",
"astropy.units.Quantity.__new__",
"numpy.correlate",
"numpy.nanmean"
] | [((5464, 5527), 'copy.deepcopy', 'copy.deepcopy', (['periodogram.power[xt - spread:xt + spread].value'], {}), '(periodogram.power[xt - spread:xt + spread].value)\n', (5477, 5527), False, 'import copy\n'), ((5586, 5603), 'numpy.nanmean', 'np.nanmean', (['p_sel'], {}), '(p_sel)\n', (5596, 5603), True, 'import numpy as np... |
"""
NGHXRG - Teledyne HxRG Noise Generator
Modification History:
8-15 April 2015, <NAME>, NASA/GSFC
- Implement Pierre Ferruit's (ESA/ESTEC)recommendation to use
numpy.fft.rfft and numpy.fft.irfft for faster execution. This saves
about 30% in execution time.
- Clean up setting default values per several suggesti... | [
"numpy.sum",
"astropy.io.fits.PrimaryHDU",
"numpy.ones",
"os.path.isfile",
"numpy.mean",
"numpy.arange",
"numpy.random.normal",
"astropy.io.fits.HDUList",
"multiprocessing.cpu_count",
"numpy.zeros_like",
"numpy.fft.irfft",
"numpy.random.randn",
"scipy.ndimage.interpolation.zoom",
"numpy.ma... | [((4061, 4094), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (4084, 4094), False, 'import warnings\n'), ((4117, 4144), 'logging.getLogger', 'logging.getLogger', (['"""nghxrg"""'], {}), "('nghxrg')\n", (4134, 4144), False, 'import logging\n'), ((12090, 12138), 'numpy.zero... |
from train import Agent, utils as U
import gym
import numpy as np
import matplotlib.pyplot as plt
import nn
class PPO(Agent):
def __init__(self,
policy,
critic,
epsilon=.1,
T=16,
epochs=4,
batch_size=None,
... | [
"train.utils.unique",
"matplotlib.pyplot.show",
"gym.make",
"matplotlib.pyplot.plot",
"nn.Dense",
"train.utils.check_shape",
"nn.tensors",
"nn.Adam",
"nn.GradientTape",
"numpy.arange",
"nn.models.clone_model",
"nn.tensor",
"numpy.array_split",
"numpy.random.shuffle"
] | [((3956, 3979), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (3964, 3979), False, 'import gym\n'), ((4363, 4379), 'matplotlib.pyplot.plot', 'plt.plot', (['scores'], {}), '(scores)\n', (4371, 4379), True, 'import matplotlib.pyplot as plt\n'), ((4384, 4394), 'matplotlib.pyplot.show', 'plt.sho... |
import face_recognition
import cv2
import os
import numpy as np
import time
import datetime
video_capture = cv2.VideoCapture(0)
ummu_image = face_recognition.load_image_file("/Users/alisher/Desktop/known_face/Ummu.jpg")
ummu_face_encoding = face_recognition.face_encodings(ummu_image)[0]
merve_image = face_recognitio... | [
"face_recognition.face_distance",
"os.makedirs",
"face_recognition.compare_faces",
"cv2.putText",
"cv2.waitKey",
"cv2.imwrite",
"face_recognition.face_encodings",
"face_recognition.load_image_file",
"os.path.exists",
"cv2.imshow",
"numpy.argmin",
"os.system",
"cv2.VideoCapture",
"time.time... | [((109, 128), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (125, 128), False, 'import cv2\n'), ((143, 221), 'face_recognition.load_image_file', 'face_recognition.load_image_file', (['"""/Users/alisher/Desktop/known_face/Ummu.jpg"""'], {}), "('/Users/alisher/Desktop/known_face/Ummu.jpg')\n", (175, 221... |
import numpy as np
from copy import deepcopy
def default_zero(dtype):
"""
For a given dtype, return the zero value (which will indicate the absence of
an edge). Raises an error on unknown datatypes.
Inputs:
dtype (class): Datatype of property or array.
Outputs:
def_zero (dtype): D... | [
"copy.deepcopy",
"numpy.count_nonzero",
"numpy.zeros",
"numpy.insert",
"numpy.delete",
"numpy.issubdtype"
] | [((417, 448), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.number'], {}), '(dtype, np.number)\n', (430, 448), True, 'import numpy as np\n'), ((978, 1009), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.number'], {}), '(dtype, np.number)\n', (991, 1009), True, 'import numpy as np\n'), ((5716, 5758), 'numpy.z... |
from decimal import Decimal
from binance.client import Client
from binance.enums import *
from binance import ThreadedWebsocketManager
import config as Config
from datetime import datetime
import numpy
import talib
class Trade:
RSI_PERIOD = 14
RSI_OVERSOLD = 30
RSI_OVERBOUGHT = 70
def __init__(self, ... | [
"numpy.array",
"talib.RSI",
"binance.client.Client",
"datetime.datetime.now",
"binance.ThreadedWebsocketManager"
] | [((5069, 5147), 'binance.ThreadedWebsocketManager', 'ThreadedWebsocketManager', ([], {'api_key': 'Config.API_KEY', 'api_secret': 'Config.API_SECRET'}), '(api_key=Config.API_KEY, api_secret=Config.API_SECRET)\n', (5093, 5147), False, 'from binance import ThreadedWebsocketManager\n'), ((5163, 5204), 'binance.client.Clien... |
import numpy as np
import torch
class _NumpyTransducer(torch.autograd.Function):
@staticmethod
def forward(
ctx,
log_probs,
logit_lengths,
target_lengths,
targets,
blank=-1,
):
device = log_probs.device
log_probs = log_probs.cpu().data.numpy(... | [
"numpy.zeros_like",
"torch.autograd.Variable",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"torch.FloatTensor",
"numpy.logaddexp",
"numpy.exp",
"torch.nn.functional.log_softmax"
] | [((864, 898), 'torch.autograd.Variable', 'torch.autograd.Variable', (['gradients'], {}), '(gradients)\n', (887, 898), False, 'import torch\n'), ((1197, 1239), 'numpy.zeros', 'np.zeros', (['(max_T, max_U)'], {'dtype': 'np.float32'}), '((max_T, max_U), dtype=np.float32)\n', (1205, 1239), True, 'import numpy as np\n'), ((... |
from .grasp_sampling import GraspSampler
from .wholebody_planning import WholeBodyPlanner
from mp.const import VIRTUAL_CUBOID_HALF_SIZE
from mp.utils import keep_state
import mp.align_rotation as rot_util
from scipy.spatial.transform import Rotation as R
import copy
import numpy as np
def get_heuristic_grasp(env, pos... | [
"copy.deepcopy",
"mp.align_rotation.get_roll_pitch_axis_and_angle",
"mp.align_rotation.get_yaw_diff",
"scipy.spatial.transform.Rotation.from_euler",
"numpy.cross",
"numpy.clip",
"scipy.spatial.transform.Rotation.from_quat",
"numpy.sign",
"mp.utils.keep_state",
"mp.align_rotation.get_most_vertical_... | [((1073, 1098), 'copy.deepcopy', 'copy.deepcopy', (['path.grasp'], {}), '(path.grasp)\n', (1086, 1098), False, 'import copy\n'), ((1428, 1483), 'mp.align_rotation.get_roll_pitch_axis_and_angle', 'rot_util.get_roll_pitch_axis_and_angle', (['quat', 'goal_quat'], {}), '(quat, goal_quat)\n', (1466, 1483), True, 'import mp.... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
"""
Version 2.0
"""
import numpy as np
class CActivator(object):
# z = 本层的wx+b计算值矩阵
def forward(self, z):
pass
# z = 本层的wx+b计算值矩阵
# a = 本层的激活函数... | [
"numpy.zeros",
"numpy.exp",
"numpy.multiply",
"numpy.maximum"
] | [((715, 736), 'numpy.multiply', 'np.multiply', (['a', '(1 - a)'], {}), '(a, 1 - a)\n', (726, 736), True, 'import numpy as np\n'), ((748, 770), 'numpy.multiply', 'np.multiply', (['delta', 'da'], {}), '(delta, da)\n', (759, 770), True, 'import numpy as np\n'), ((992, 1014), 'numpy.multiply', 'np.multiply', (['delta', 'da... |
import time
import numpy as np
import math
from scipy import special
from scipy import optimize
EPS = 10e-15
class TruncatedMVN:
"""
Create a normal distribution :math:`X \sim N ({\mu}, {\Sigma})` subject to linear inequality constraints
:math:`lb < X < ub` and sample from it using minimax tilting. Bas... | [
"numpy.sum",
"numpy.ones",
"numpy.argmin",
"numpy.arange",
"numpy.exp",
"numpy.diag",
"numpy.linalg.solve",
"numpy.zeros_like",
"numpy.empty_like",
"numpy.append",
"numpy.expm1",
"numpy.log1p",
"numpy.ones_like",
"numpy.isinf",
"scipy.optimize.root",
"numpy.concatenate",
"numpy.log",... | [((20362, 20378), 'numpy.zeros_like', 'np.zeros_like', (['a'], {}), '(a)\n', (20375, 20378), True, 'import numpy as np\n'), ((20417, 20426), 'numpy.any', 'np.any', (['I'], {}), '(I)\n', (20423, 20426), True, 'import numpy as np\n'), ((20565, 20576), 'numpy.any', 'np.any', (['idx'], {}), '(idx)\n', (20571, 20576), True,... |
import numpy as np
import json
from ofdft_ml.statslib import Forward_PCA_transform, Backward_PCA_transform, ScalarGP, MultitaskGP, SeqModel
class Model_loader(object):
def __init__(self, train_data_dir, param_fname, train_size=None):
train_features = np.load(train_data_dir + 'features.npy')
train... | [
"numpy.load",
"ofdft_ml.statslib.Backward_PCA_transform",
"json.load",
"ofdft_ml.statslib.Forward_PCA_transform",
"ofdft_ml.statslib.SeqModel"
] | [((266, 306), 'numpy.load', 'np.load', (["(train_data_dir + 'features.npy')"], {}), "(train_data_dir + 'features.npy')\n", (273, 306), True, 'import numpy as np\n'), ((331, 370), 'numpy.load', 'np.load', (["(train_data_dir + 'targets.npy')"], {}), "(train_data_dir + 'targets.npy')\n", (338, 370), True, 'import numpy as... |
#!/usr/bin/env python3
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import itertools
import random
class PCFGVMap(nn.Module):
def __init__(self, nt_states, t_states):
super(PCFGVMap, self).__init__()
self.nt_states = nt_states # non-terminal states (NT)
self.t_... | [
"torch.remainder",
"torch.cat",
"torch.exp",
"torch.max",
"numpy.arange"
] | [((525, 540), 'torch.max', 'torch.max', (['x', 'y'], {}), '(x, y)\n', (534, 540), False, 'import torch\n'), ((6298, 6322), 'torch.max', 'torch.max', (['max_score', '(-1)'], {}), '(max_score, -1)\n', (6307, 6322), False, 'import torch\n'), ((646, 663), 'torch.max', 'torch.max', (['x', 'dim'], {}), '(x, dim)\n', (655, 66... |
import matplotlib.pyplot as plt
import numpy as np
from numpy import genfromtxt
import argparse
def percent_error(exp_value, theo_value):
error = (exp_value - theo_value) / theo_value
# theo_value * error + theo_value = exp_value
def margin_line(error, exp_val, theo_val):
exp_val = theo_val * error + theo... | [
"argparse.ArgumentParser",
"numpy.genfromtxt",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((354, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (377, 379), False, 'import argparse\n'), ((511, 572), 'numpy.genfromtxt', 'genfromtxt', (['args.input_fname'], {'delimiter': '""","""', 'skip_header': '(True)'}), "(args.input_fname, delimiter=',', skip_header=True)\n", (521, 572), Fa... |
#%%
import os
import sys
import random
import math
import re
import time
import numpy as np
import cv2
import matplotlib
import matplotlib.pyplot as plt
import pathlib
import skimage
from PIL import Image
import imgaug
from imgaug import augmenters as iaa
from skimage.filters import threshold_otsu
ROOT_DIR = os.path.a... | [
"sys.path.append",
"os.mkdir",
"os.path.abspath",
"numpy.moveaxis",
"skimage.color.gray2rgb",
"os.path.basename",
"os.path.exists",
"numpy.zeros",
"matplotlib.pyplot.subplots",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"mrcnn.model.MaskRCNN",
"os.path.join",
"os.listdir",
... | [((311, 333), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (326, 333), False, 'import os\n'), ((334, 359), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (349, 359), False, 'import sys\n'), ((555, 585), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs"""'], {}... |
import datetime
import itertools
import math
import os
import random
import glob
import json
from typing import *
import scipy
import imageio
import scipy.misc
import scipy.spatial
import scipy.ndimage
import numpy as np
import torch
import torch.nn as nn
import torchvision.transforms as transforms
import torchvision.... | [
"numpy.abs",
"random.sample",
"torch.mm",
"torch.cat",
"numpy.ones",
"matplotlib.pyplot.figure",
"models.PerceptualLoss",
"numpy.linalg.norm",
"numpy.random.randint",
"numpy.random.normal",
"torch.device",
"dcgan.Generator",
"torch.no_grad",
"os.path.join",
"matplotlib.offsetbox.OffsetIm... | [((3183, 3199), 'torch.mm', 'torch.mm', (['x', 'x.T'], {}), '(x, x.T)\n', (3191, 3199), False, 'import torch\n'), ((3741, 3761), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (3753, 3761), False, 'import torch\n'), ((4316, 4386), 'torch.tensor', 'torch.tensor', (['(2.7)'], {'requires_grad': '(True... |
import numpy as np
import scipy as sp
import scipy.sparse as sparse
import osqp
import warnings
def __is_vector__(vec):
if vec.ndim == 1:
return True
else:
if vec.ndim == 2:
if vec.shape[0] == 1 or vec.shape[1] == 0:
return True
else:
return Fals... | [
"scipy.sparse.kron",
"numpy.ones",
"numpy.shape",
"numpy.arange",
"scipy.sparse.eye",
"numpy.copy",
"osqp.OSQP",
"matplotlib.pyplot.subplots",
"scipy.sparse.diags",
"numpy.hstack",
"scipy.sparse.block_diag",
"scipy.sparse.vstack",
"numpy.zeros",
"time.time",
"scipy.sparse.csc_matrix",
... | [((23648, 23683), 'numpy.array', 'np.array', (['[[0.0, 1.0], [0, -b / M]]'], {}), '([[0.0, 1.0], [0, -b / M]])\n', (23656, 23683), True, 'import numpy as np\n'), ((23713, 23739), 'numpy.array', 'np.array', (['[[0.0], [1 / M]]'], {}), '([[0.0], [1 / M]])\n', (23721, 23739), True, 'import numpy as np\n'), ((23979, 24001)... |
import numpy as np
from tensorflow_serving_client import TensorflowServingClient
from keras_model_specs import ModelSpec
MODEL_SERVING_PORTS = {
'mobilenet_v1': 9001,
'inception_v3': 9002,
'xception': 9003
}
def query_model(model_spec_name):
model_spec = ModelSpec.get(model_spec_name)
client = ... | [
"tensorflow_serving_client.TensorflowServingClient",
"keras_model_specs.ModelSpec.get",
"numpy.array"
] | [((276, 306), 'keras_model_specs.ModelSpec.get', 'ModelSpec.get', (['model_spec_name'], {}), '(model_spec_name)\n', (289, 306), False, 'from keras_model_specs import ModelSpec\n'), ((320, 394), 'tensorflow_serving_client.TensorflowServingClient', 'TensorflowServingClient', (['"""localhost"""', 'MODEL_SERVING_PORTS[mode... |
"""
各ユーザの合計の生産性と品質
"""
from __future__ import annotations
import copy
import logging
from enum import Enum
from pathlib import Path
from typing import Any, Collection, Optional
import bokeh
import bokeh.layouts
import bokeh.palettes
import numpy
import pandas
from annofabapi.models import TaskPhase
from bokeh.plottin... | [
"pandas.DataFrame",
"copy.deepcopy",
"bokeh.plotting.figure",
"pandas.MultiIndex.from_tuples",
"bokeh.models.Div",
"annofabcli.statistics.scatter.create_hover_tool",
"numpy.isnan",
"annofabcli.statistics.scatter.get_color_from_palette",
"bokeh.plotting.ColumnDataSource",
"bokeh.models.Span",
"bo... | [((588, 615), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (605, 615), False, 'import logging\n'), ((5043, 5206), 'pandas.MultiIndex.from_tuples', 'pandas.MultiIndex.from_tuples', (["([('actual_worktime_hour', 'sum'), ('last_working_date', '')] + [(\n 'monitored_worktime_hour', phase... |
# -*- coding: utf-8 -*-
"""pix2pix_data.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1prb4RcGjgsweVTZF5G1URcqMxKSMX4Sk
"""
#!pip3 install scipy==1.1.0
#!pip install texttable
#from google.colab import drive
#drive.mount('/gdrive')
# %cd /gdri... | [
"os.mkdir",
"numpy.load",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig",
"keras.regularizers.l2",
"matplotlib.pyplot.close",
"numpy.round",
"keras.layers.Flatten",
"pandas.plotting.register_matplotlib_converters",
"numpy.where",
"numpy.arange",
"matplotlib.pyplot.rcParams.updat... | [((1990, 2022), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (2020, 2022), False, 'from pandas.plotting import register_matplotlib_converters, scatter_matrix\n'), ((2046, 2067), 'numpy.load', 'np.load', (['"""X_test.npy"""'], {}), "('X_test.npy')\n", (2053, 2067)... |
import tensorflow
import numpy as np
import os
from numpy import genfromtxt
import Utilities
import Model.Constants as Constants
import Model.blockFactory as factory
import Model.Layers.Start.firstBlock as startBlock
import Model.Layers.Inceptions.FirstInception.firstBlock as firstBlockOfFirstInception
import Model.Lay... | [
"Utilities.GetImageData",
"Model.Layers.Inceptions.ThirdInception.firstBlock.inceptionConstructor",
"tensorflow.subtract",
"Model.Layers.Inceptions.FirstInception.thirdBlock.inceptionConstructor",
"Model.Layers.Inceptions.SecondInception.secondBlock.inceptionConstructor",
"Model.blockFactory.finishing",
... | [((881, 910), 'Model.blockFactory.initialization', 'factory.initialization', (['shape'], {}), '(shape)\n', (903, 910), True, 'import Model.blockFactory as factory\n'), ((924, 961), 'Model.Layers.Start.firstBlock.constructor', 'startBlock.constructor', (['initialTensor'], {}), '(initialTensor)\n', (946, 961), True, 'imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Imports.
import argparse as Ap
import hashlib
import logging as L
import numpy as np
import os, pdb, sys
from pysnips.ml.argparseactions import OptimizerAction
import time
__versio... | [
"os.mkdir",
"argparse.ArgumentParser",
"logging.FileHandler",
"numpy.random.get_state",
"os.path.isdir",
"logging.StreamHandler",
"expmt.getExperiment",
"time.strftime",
"logging.getLogger",
"numpy.random.set_state",
"pdb.set_trace",
"sys.setrecursionlimit",
"os.path.join",
"time.localtime... | [((7411, 7507), 'argparse.ArgumentParser', 'Ap.ArgumentParser', ([], {'prog': 'prog', 'usage': 'None', 'description': 'None', 'epilog': 'None', 'version': '__version__'}), '(prog=prog, usage=None, description=None, epilog=None,\n version=__version__)\n', (7428, 7507), True, 'import argparse as Ap\n'), ((8339, 8367),... |
"""
main module used for running the inference on simple network sim
"""
from __future__ import annotations
import datetime as dt
import logging.config
import sys
import time
from abc import ABC, abstractmethod
from typing import Tuple, List, Dict, Type, ClassVar, Union
import numpy as np
import pandas as pd
import s... | [
"sys.path.append",
"numpy.minimum",
"numpy.maximum",
"numpy.log",
"numpy.sum",
"data_pipeline_api.standard_api.StandardAPI.from_config",
"time.time",
"numpy.percentile",
"numpy.argmin",
"pandas.to_datetime",
"numpy.exp",
"more_itertools.pairwise",
"scipy.stats.beta.pdf",
"numpy.all",
"nu... | [((531, 552), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (546, 552), False, 'import sys\n'), ((1854, 1891), 'numpy.maximum', 'np.maximum', (['(mean * stddev)', 'stddev_min'], {}), '(mean * stddev, stddev_min)\n', (1864, 1891), True, 'import numpy as np\n'), ((2182, 2205), 'pandas.to_datetime'... |
import pandas as pd
import numpy as np
import os
import sys
import pdb
import argparse
'''
Script to find the epoch that gives maximum validation set accuracy.
Used to choose best checkpoint
'''
def main(args):
exp = args.exp_id
log_dir = os.path.join(args.log_root,"exp_{}".format(exp))
df = pd.read_csv(... | [
"os.path.join",
"argparse.ArgumentParser",
"numpy.argmax"
] | [((466, 484), 'numpy.argmax', 'np.argmax', (['val_acc'], {}), '(val_acc)\n', (475, 484), True, 'import numpy as np\n'), ((888, 913), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (911, 913), False, 'import argparse\n'), ((320, 355), 'os.path.join', 'os.path.join', (['log_dir', '"""output.log""... |
import numpy as np
import torch
import torch.nn as nn
import os
import copy
import time
from PIL import Image
# images have shape 1280x1024
dims = (1920, 1080)
class Net(torch.nn.Module):
def __init__(self):
super(Net, self).__init__()
self.layer2 = nn.Sequential(
nn... | [
"torch.nn.MSELoss",
"numpy.random.seed",
"torch.nn.ReLU",
"numpy.asarray",
"torch.nn.Conv2d",
"PIL.Image.open",
"time.time",
"torch.nn.BatchNorm2d",
"numpy.array",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.tensor",
"os.listdir",
"numpy.random.shuffle"
] | [((5235, 5246), 'time.time', 'time.time', ([], {}), '()\n', (5244, 5246), False, 'import time\n'), ((5248, 5265), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (5262, 5265), True, 'import numpy as np\n'), ((5287, 5298), 'time.time', 'time.time', ([], {}), '()\n', (5296, 5298), False, 'import time\n'), ... |
"""Estimates base velocity for A1 robot from accelerometer readings."""
import numpy as np
from filterpy.kalman import KalmanFilter
class A1RobotStateEstimator:
"""Estimates base velocity of A1 robot.
The velocity estimator consists of a state estimator for CoM velocity.
Two sources of information are used:
... | [
"numpy.zeros",
"numpy.mean",
"numpy.array",
"filterpy.kalman.KalmanFilter",
"numpy.eye"
] | [((552, 610), 'numpy.array', 'np.array', (['[1.42072319e-05, 1.57958752e-05, 8.75317619e-05]'], {}), '([1.42072319e-05, 1.57958752e-05, 8.75317619e-05])\n', (560, 610), True, 'import numpy as np\n'), ((1274, 1313), 'filterpy.kalman.KalmanFilter', 'KalmanFilter', ([], {'dim_x': '(3)', 'dim_z': '(3)', 'dim_u': '(3)'}), '... |
#
# Copyright 2021-2022 konawasabi
#
# 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 o... | [
"tkinter.ttk.Label",
"tkinter.filedialog.asksaveasfilename",
"tkinter.ttk.Entry",
"numpy.deg2rad",
"configparser.ConfigParser",
"tkinter.filedialog.askopenfilename",
"tkinter.ttk.Frame",
"PIL.Image.open",
"tkinter.Toplevel",
"tkinter.BooleanVar",
"numpy.array",
"tkinter.ttk.Treeview",
"tkint... | [((2964, 2992), 'tkinter.Toplevel', 'tk.Toplevel', (['self.mainwindow'], {}), '(self.mainwindow)\n', (2975, 2992), True, 'import tkinter as tk\n'), ((3018, 3059), 'tkinter.ttk.Frame', 'ttk.Frame', (['self.master'], {'padding': '"""3 3 3 3"""'}), "(self.master, padding='3 3 3 3')\n", (3027, 3059), False, 'from tkinter i... |
import json
import numpy as np
from scipy.signal import correlate
"""
Base class that calculates Age of Information (AoI)
"""
class AoICalc():
def __init__(self, sim_id, data_file, num_sources, save_AoI_seq="None", save_Q_seq="None", **kwargs):
self.sim_id = sim_id
self.data_file = data_fil... | [
"json.load",
"scipy.signal.correlate",
"numpy.mean",
"numpy.arange",
"numpy.var"
] | [((5374, 5384), 'numpy.mean', 'np.mean', (['Q'], {}), '(Q)\n', (5381, 5384), True, 'import numpy as np\n'), ((5401, 5410), 'numpy.var', 'np.var', (['Q'], {}), '(Q)\n', (5407, 5410), True, 'import numpy as np\n'), ((5507, 5545), 'scipy.signal.correlate', 'correlate', (['norm_Q', 'norm_Q'], {'mode': '"""same"""'}), "(nor... |
import unittest
import numpy as np
from numpy.testing import assert_array_equal
from shape import (angle_absolute_error,
angle_absolute_error_direction_agnostic)
class AnglesTestCase(unittest.TestCase):
def test_angle_absolute_error(self):
self.assertEqual(angle_absolute_error(10, 20,... | [
"unittest.main",
"shape.angle_absolute_error_direction_agnostic",
"shape.angle_absolute_error",
"numpy.array"
] | [((2260, 2275), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2273, 2275), False, 'import unittest\n'), ((292, 324), 'shape.angle_absolute_error', 'angle_absolute_error', (['(10)', '(20)', 'np'], {}), '(10, 20, np)\n', (312, 324), False, 'from shape import angle_absolute_error, angle_absolute_error_direction_agn... |
# coding: utf-8
import os
import sys
# sys.path.append(os.pardir) # 为了导入父目录的文件而进行的设定
# from common.functions import *
# from common.gradient import numerical_gradient
# from common.functions import *
import numpy as np
def identity_function(x):
return x
def step_function(x):
return np.array(x > 0, dtype=... | [
"numpy.zeros_like",
"numpy.maximum",
"numpy.sum",
"numpy.random.randn",
"numpy.argmax",
"numpy.nditer",
"numpy.zeros",
"numpy.max",
"numpy.array",
"numpy.exp",
"numpy.arange",
"numpy.dot",
"numpy.sqrt"
] | [((298, 327), 'numpy.array', 'np.array', (['(x > 0)'], {'dtype': 'np.int'}), '(x > 0, dtype=np.int)\n', (306, 327), True, 'import numpy as np\n'), ((470, 486), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (480, 486), True, 'import numpy as np\n'), ((518, 529), 'numpy.zeros', 'np.zeros', (['x'], {}), '... |
import numpy as np
import numba
@numba.jit(nopython=True, parallel=True, nogil=True)
def div_vec_approx(collocation, # Точка коллокации x[3]
vec_collocation, # Значение вектора под дивергенцией в точке коллокации gx[3]
vec, # Весь вектор под дивергенц... | [
"numpy.zeros",
"numpy.cross",
"numba.jit",
"numpy.exp"
] | [((35, 86), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'parallel': '(True)', 'nogil': '(True)'}), '(nopython=True, parallel=True, nogil=True)\n', (44, 86), False, 'import numba\n'), ((1241, 1292), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'parallel': '(True)', 'nogil': '(True)'}), '(nopython=True... |
import numpy as np
from .config import conf
import os, sys
from .config import names as gs
import pandas as pd
truth = np.genfromtxt(conf.binned_personality_file, skip_header=1, usecols=range(1, conf.n_traits+1), delimiter=',')
# all comparisons to perform. Each has
# a name,
# two annotation values that dete... | [
"pandas.DataFrame",
"os.mkdir",
"numpy.load",
"numpy.sum",
"numpy.argmax",
"os.path.exists",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.array",
"numpy.logical_or",
"sys.exit",
"numpy.savez",
"numpy.unique"
] | [((1335, 1377), 'numpy.unique', 'np.unique', (['predictions'], {'return_counts': '(True)'}), '(predictions, return_counts=True)\n', (1344, 1377), True, 'import numpy as np\n'), ((1388, 1405), 'numpy.argmax', 'np.argmax', (['counts'], {}), '(counts)\n', (1397, 1405), True, 'import numpy as np\n'), ((4502, 4611), 'pandas... |
import numpy as np
class Loss:
def mean_squared_error(self, y, t):
return 0.5 * np.sum((y-t)**2)
def cross_entropy_error(self, y, t):
if y.ndim == 1:
t = t.reshape(1, t.size)
y = y.reshape(1, y.size)
# 훈련 데이터가 원-핫 벡터라면 정답 레이블의 인덱스로 반환
if t.... | [
"numpy.sum",
"numpy.arange"
] | [((94, 114), 'numpy.sum', 'np.sum', (['((y - t) ** 2)'], {}), '((y - t) ** 2)\n', (100, 114), True, 'import numpy as np\n'), ((450, 471), 'numpy.arange', 'np.arange', (['batch_size'], {}), '(batch_size)\n', (459, 471), True, 'import numpy as np\n')] |
from __future__ import print_function
from . import utils, optimize, base
import numpy as np
from .ODL import ODL
class UpdateXc(optimize.Fista):
"""
Update Xc in COPAR (page 189-190 COPAR)
see COPAR paper:
http://www.cs.zju.edu.cn/people/wangdh/papers/draft_ECCV12_particularity.pdf
cost = normF... | [
"numpy.zeros_like",
"numpy.zeros",
"numpy.argmin",
"numpy.dot",
"numpy.delete"
] | [((771, 795), 'numpy.dot', 'np.dot', (['self.D.T', 'self.D'], {}), '(self.D.T, self.D)\n', (777, 795), True, 'import numpy as np\n'), ((908, 922), 'numpy.dot', 'np.dot', (['D.T', 'Y'], {}), '(D.T, Y)\n', (914, 922), True, 'import numpy as np\n'), ((1017, 1047), 'numpy.dot', 'np.dot', (['self.DCp1.T', 'self.DCp1'], {}),... |
import numpy as np
import os
import tensorflow as tf
import urllib.request
import matplotlib.pyplot as plt
# TensorFlow-Slim aka TF-Slim
# https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/slim/python/slim
# https://github.com/tensorflow/models/tree/master/research/slim
# use slim from contrib
i... | [
"matplotlib.pyplot.suptitle",
"tensorflow.contrib.slim.nets.vgg.vgg_16",
"matplotlib.pyplot.figure",
"os.path.join",
"numpy.unique",
"datasets.imagenet.create_readable_names_for_imagenet_labels",
"numpy.max",
"tensorflow.to_float",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"tensorf... | [((3214, 3238), 'numpy.squeeze', 'np.squeeze', (['segmentation'], {}), '(segmentation)\n', (3224, 3238), True, 'import numpy as np\n'), ((3419, 3463), 'numpy.unique', 'np.unique', (['segmentation'], {'return_inverse': '(True)'}), '(segmentation, return_inverse=True)\n', (3428, 3463), True, 'import numpy as np\n'), ((35... |
import numpy as np
from NN1 import NN1
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
from nn_utils import mate, Type, sort_by_fittest
import os
class gdnn:
def __init__(self, nlayers):
self.nlayers = 1
@classmethod
def read_dataset(self, dbpath, size):
... | [
"os.path.abspath",
"nn_utils.sort_by_fittest",
"nn_utils.mate",
"sklearn.model_selection.train_test_split",
"NN1.NN1",
"numpy.random.randint",
"sklearn.utils.shuffle"
] | [((888, 917), 'sklearn.utils.shuffle', 'shuffle', (['X', 'Y'], {'random_state': '(1)'}), '(X, Y, random_state=1)\n', (895, 917), False, 'from sklearn.utils import shuffle\n'), ((1008, 1061), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y'], {'test_size': '(0.2)', 'random_state': '(1)'}), '(X,... |
import time
from numpy import cos, sqrt, sin, array, pi
from math import pi as π, exp
def Levy3(x):
time.sleep(0.01)
x = array(x)
n = len(x)
y = 1 + (x - 1) / 4
# calculate f(y(x))
term1 = sin(pi*y[0])**2
term3 = (y[n-1]-1)**2 *(1 + sin(2*pi*y[n-1]))**2
sum = 0
for x_i in y:
... | [
"math.exp",
"time.sleep",
"numpy.sin",
"numpy.array",
"numpy.cos"
] | [((106, 122), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (116, 122), False, 'import time\n'), ((131, 139), 'numpy.array', 'array', (['x'], {}), '(x)\n', (136, 139), False, 'from numpy import cos, sqrt, sin, array, pi\n'), ((448, 456), 'numpy.array', 'array', (['x'], {}), '(x)\n', (453, 456), False, 'from... |
import numpy as np
from clustering_system.evaluator.UnsupervisedEvaluation import UnsupervisedEvaluation
from clustering_system.evaluator.measures import purity, purity2, rand_index, entropy, homogeneity, completeness, \
v_measure, mutual_information, normalized_mutual_information, normalized_mutual_information2, ... | [
"clustering_system.evaluator.measures.f1_measure",
"clustering_system.evaluator.measures.entropy",
"clustering_system.evaluator.measures.normalized_mutual_information2",
"clustering_system.evaluator.measures.precision",
"clustering_system.evaluator.measures.v_measure",
"clustering_system.evaluator.measure... | [((1017, 1042), 'clustering_system.evaluator.measures.purity', 'purity', (['clusters', 'classes'], {}), '(clusters, classes)\n', (1023, 1042), False, 'from clustering_system.evaluator.measures import purity, purity2, rand_index, entropy, homogeneity, completeness, v_measure, mutual_information, normalized_mutual_inform... |
"""
"""
import numpy as np
from astropy.table import Table
from astropy.utils.misc import NumpyRNGContext
from astropy.tests.helper import pytest
from ...nfw_phase_space import NFWPhaseSpace
__all__ = ('test_mc_unit_sphere_stochasticity', )
fixed_seed = 43
def get_dummy_halo_table(npts):
x = np.linspace(-1, 1... | [
"numpy.zeros_like",
"astropy.table.Table",
"numpy.std",
"numpy.logspace",
"numpy.allclose",
"numpy.median",
"numpy.zeros",
"numpy.any",
"numpy.min",
"numpy.mean",
"numpy.linalg.norm",
"numpy.max",
"numpy.linspace",
"numpy.array",
"numpy.vstack",
"numpy.all"
] | [((303, 327), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', 'npts'], {}), '(-1, 1, npts)\n', (314, 327), True, 'import numpy as np\n'), ((398, 412), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (406, 412), True, 'import numpy as np\n'), ((425, 717), 'astropy.table.Table', 'Table', (["{'halo_x': x, 'halo_y... |
# slicer imports
from __main__ import vtk, slicer
# python includes
import logging
import sys
import time
import numpy as np
import os
import math
class Helper(object):
'''
classdocs
'''
@staticmethod
def Info(message):
'''
'''
# logging.debug("[PedicleScrewSimulatorPy " + time.strftime( "%Y-%m-%d ... | [
"__main__.slicer.mrmlScene.GetNodeByID",
"numpy.argmax",
"__main__.vtk.vtkMath.Norm",
"time.strftime",
"numpy.around",
"__main__.vtk.vtkMath.Subtract",
"sys.stdout.flush",
"numpy.linalg.norm",
"__main__.slicer.app.applicationLogic",
"__main__.vtk.vtkTransformPolyDataFilter",
"numpy.append",
"_... | [((746, 764), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (762, 764), False, 'import sys\n'), ((1593, 1622), '__main__.slicer.app.applicationLogic', 'slicer.app.applicationLogic', ([], {}), '()\n', (1620, 1622), False, 'from __main__ import vtk, slicer\n'), ((1808, 1837), '__main__.slicer.app.applicationL... |
import numpy as np
from galry import *
class DepthVisual(Visual):
def initialize(self, position, color):
self.size = position.shape[0]
self.add_attribute('position', ndim=3, data=position)
self.add_attribute('color', ndim=4, data=color)
self.add_varying('vcolor', ndim=4)
sel... | [
"numpy.zeros",
"numpy.linspace"
] | [((594, 611), 'numpy.zeros', 'np.zeros', (['(10, 3)'], {}), '((10, 3))\n', (602, 611), True, 'import numpy as np\n'), ((644, 670), 'numpy.linspace', 'np.linspace', (['(-0.5)', '(0.5)', '(10)'], {}), '(-0.5, 0.5, 10)\n', (655, 670), True, 'import numpy as np\n'), ((685, 710), 'numpy.linspace', 'np.linspace', (['(0.0)', ... |
__author__ = 'shyue'
import unittest
import numpy as np
from pyhull.convex_hull import ConvexHull
class ConvexHullTestCase(unittest.TestCase):
def setUp(self):
data = [[-0.5, -0.5], [-0.5, 0.5], [0.5, -0.5], [0.5, 0.5]]
self.hull = ConvexHull(data)
sphere_data = [[0.3927286959385721, 0.... | [
"unittest.main",
"pyhull.convex_hull.ConvexHull",
"numpy.random.randn"
] | [((3459, 3474), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3472, 3474), False, 'import unittest\n'), ((257, 273), 'pyhull.convex_hull.ConvexHull', 'ConvexHull', (['data'], {}), '(data)\n', (267, 273), False, 'from pyhull.convex_hull import ConvexHull\n'), ((1406, 1429), 'pyhull.convex_hull.ConvexHull', 'Conve... |
import os
import json
import albumentations
import numpy as np
from PIL import Image
from tqdm import tqdm
from torch.utils.data import Dataset
from forks.taming_transformers.taming.data.sflckr import SegmentationBase # for examples included in repo
class Examples(SegmentationBase):
def __init__(self, size=256, ... | [
"tqdm.tqdm",
"json.load",
"albumentations.Compose",
"albumentations.CenterCrop",
"albumentations.Resize",
"numpy.ravel",
"numpy.zeros",
"albumentations.SmallestMaxSize",
"PIL.Image.open",
"numpy.array",
"numpy.arange",
"albumentations.RandomCrop",
"os.path.join"
] | [((2615, 2648), 'tqdm.tqdm', 'tqdm', (['imagedirs'], {'desc': '"""ImgToPath"""'}), "(imagedirs, desc='ImgToPath')\n", (2619, 2648), False, 'from tqdm import tqdm\n'), ((3311, 3346), 'tqdm.tqdm', 'tqdm', (['capdirs'], {'desc': '"""ImgToCaptions"""'}), "(capdirs, desc='ImgToCaptions')\n", (3315, 3346), False, 'from tqdm ... |
import os
import cv2
import glob
import time
import argparse
import numpy as np
from tqdm import tqdm
from joblib import Parallel, delayed
from PIL import Image
from utils.utils import make_directory, read_csv
NUM_MASKSIZE = 512 # Size of the mask map
DIR_INFO = "trainset_info" # Pre-given information for test s... | [
"utils.utils.read_csv",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.dirname",
"numpy.zeros",
"time.time",
"utils.utils.make_directory",
"joblib.Parallel",
"joblib.delayed",
"os.path.join"
] | [((359, 398), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (382, 398), False, 'import argparse\n'), ((1740, 1751), 'time.time', 'time.time', ([], {}), '()\n', (1749, 1751), False, 'import time\n'), ((1285, 1339), 'numpy.zeros', 'np.zeros', (['(NUM_MASKSIZE... |
import numpy as np
from vispy import scene, app
from ..base.CLU import CLU
from .color_scheme import palette
from ..core.correlate import correlate
from phy.plot import View
class correlogram_view(View):
''' For grid purpose, phy.view is much faster than vispy.grid_view
Parameters
--------... | [
"numpy.ones",
"numpy.hstack"
] | [((883, 908), 'numpy.ones', 'np.ones', (['(4)'], {'dtype': '"""int32"""'}), "(4, dtype='int32')\n", (890, 908), True, 'import numpy as np\n'), ((3137, 3163), 'numpy.hstack', 'np.hstack', (['(palette[i], 1)'], {}), '((palette[i], 1))\n', (3146, 3163), True, 'import numpy as np\n')] |
import numpy as np
def get_2d_projection(activation_batch):
# TBD: use pytorch batch svd implementation
projections = []
for activations in activation_batch:
reshaped_activations = (
(activations).reshape(activations.shape[0], -1).transpose()
)
# Centering before the SV... | [
"numpy.float32",
"numpy.linalg.svd"
] | [((730, 753), 'numpy.float32', 'np.float32', (['projections'], {}), '(projections)\n', (740, 753), True, 'import numpy as np\n'), ((508, 563), 'numpy.linalg.svd', 'np.linalg.svd', (['reshaped_activations'], {'full_matrices': '(True)'}), '(reshaped_activations, full_matrices=True)\n', (521, 563), True, 'import numpy as ... |
# Import modules and libraries
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# ======================================================================================================================
# Overlap measure + KDE loss in 3D
# ==================================... | [
"torch.nn.MSELoss",
"numpy.finfo",
"numpy.exp",
"numpy.round",
"torch.sum",
"torch.from_numpy"
] | [((852, 876), 'torch.sum', 'torch.sum', (['(tflat * iflat)'], {}), '(tflat * iflat)\n', (861, 876), False, 'import torch\n'), ((890, 914), 'torch.sum', 'torch.sum', (['(tflat * tflat)'], {}), '(tflat * tflat)\n', (899, 914), False, 'import torch\n'), ((1330, 1381), 'numpy.exp', 'np.exp', (['(-(x * x + y * y + z * z) / ... |
import os
import torch.optim as optim
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.distributions import Normal
from torch.optim import Adam
import numpy as np
import random
import copy
import gym
import json
from sklearn.decomposition import PCA
# torch.autograd.set_detect_anomaly(True)... | [
"numpy.random.seed",
"torch.optim.lr_scheduler.StepLR",
"random.sample",
"torch.set_default_tensor_type",
"torch.cat",
"numpy.mean",
"torch.no_grad",
"numpy.prod",
"numpy.std",
"torch.load",
"torch.FloatTensor",
"os.path.exists",
"torch.cuda.FloatTensor",
"torch.nn.LayerNorm",
"torch.nn.... | [((404, 429), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (427, 429), False, 'import torch\n'), ((469, 494), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (492, 494), False, 'import torch\n'), ((435, 459), 'torch.cuda.set_device', 'torch.cuda.set_device', (['(1)'], ... |
'''
File: landsat_dataset.py
Author: <NAME>
Version: 0.1
Create: 2016-03-24 11:45:03
Description:
'''
import logging
class qa:
qa_land = 1
qa_shadow = 2
qa_cloud = 3
qa_water = 4
qa_snow = 5
qa_nodata = 255
cf0_land = 1
cf0_water = 5
cf0_shadow = 3
cf0_snow = 4
cf0_cloud ... | [
"os.path.isdir",
"numpy.empty",
"logging.info",
"re.search",
"gio.file_mag.get"
] | [((591, 640), 'numpy.empty', 'np.empty', (['(bnd.height, bnd.width)'], {'dtype': 'np.uint8'}), '((bnd.height, bnd.width), dtype=np.uint8)\n', (599, 640), True, 'import numpy as np\n'), ((1608, 1643), 'logging.info', 'logging.info', (["('loading band %s' % b)"], {}), "('loading band %s' % b)\n", (1620, 1643), False, 'im... |
#encoding=utf8
'''
Detection with SSD
In this example, we will load a SSD model and use it to detect objects.
'''
import os
import sys
import argparse
import numpy as np
import cv2
import random
import caffe
from google.protobuf import text_format
from caffe.proto import caffe_pb2
def get_labelname(labelmap, label... | [
"caffe.set_mode_gpu",
"argparse.ArgumentParser",
"caffe.io.load_image",
"os.getcwd",
"cv2.imwrite",
"caffe.io.Transformer",
"cv2.imread",
"caffe.set_device",
"caffe.proto.caffe_pb2.LabelMap",
"numpy.array",
"os.path.isfile",
"caffe.Net",
"os.listdir"
] | [((4950, 4969), 'os.listdir', 'os.listdir', (['img_dir'], {}), '(img_dir)\n', (4960, 4969), False, 'import os\n'), ((6880, 6905), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6903, 6905), False, 'import argparse\n'), ((861, 885), 'caffe.set_device', 'caffe.set_device', (['gpu_id'], {}), '(gp... |
# Copyright (C) 2012 <NAME> <<EMAIL>>
#
# 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 ... | [
"numpy.log",
"numpy.floor",
"numpy.zeros",
"numpy.array",
"numpy.arange"
] | [((919, 946), 'numpy.zeros', 'np.zeros', (['N_bins'], {'dtype': 'int'}), '(N_bins, dtype=int)\n', (927, 946), True, 'import numpy as np\n'), ((1067, 1089), 'numpy.array', 'np.array', (['x'], {'copy': '(True)'}), '(x, copy=True)\n', (1075, 1089), True, 'import numpy as np\n'), ((1680, 1691), 'numpy.log', 'np.log', (['lo... |
import cv2
import numpy as np
from scipy.stats import itemfreq
def get_dominant_color(image, n_colors):
pixels = np.float32(image).reshape((-1, 3))
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 200, .1)
flags = cv2.KMEANS_RANDOM_CENTERS
flags, labels, centroids = cv2.kmeans(
... | [
"numpy.uint8",
"cv2.HoughCircles",
"cv2.circle",
"scipy.stats.itemfreq",
"cv2.medianBlur",
"cv2.waitKey",
"cv2.cvtColor",
"numpy.float32",
"cv2.imshow",
"cv2.VideoCapture",
"numpy.around",
"cv2.setMouseCallback",
"cv2.kmeans",
"cv2.destroyAllWindows",
"cv2.namedWindow"
] | [((609, 628), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (625, 628), False, 'import cv2\n'), ((630, 655), 'cv2.namedWindow', 'cv2.namedWindow', (['"""camera"""'], {}), "('camera')\n", (645, 655), False, 'import cv2\n'), ((656, 695), 'cv2.setMouseCallback', 'cv2.setMouseCallback', (['"""camera"""', ... |
''' Purpose for this file is to verify functions associated with Groups._params dictionary.
'''
import unittest
import c3d
from c3d.group import Group
import numpy as np
import test.verify as verify
from test.zipload import Zipload
from test.base import Base
rnd = np.random.default_rng()
def add_dummy_param(group, n... | [
"numpy.random.default_rng",
"unittest.main",
"test.zipload.Zipload._get"
] | [((266, 289), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (287, 289), True, 'import numpy as np\n'), ((5880, 5895), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5893, 5895), False, 'import unittest\n'), ((3233, 3272), 'test.zipload.Zipload._get', 'Zipload._get', (['self.ZIP', 'self.IN... |
#!/usr/bin/env python
# stdlib imports
import os
import re
# third party imports
import numpy as np
from obspy.core.utcdatetime import UTCDateTime
# local
from gmprocess.utils.constants import UNIT_CONVERSIONS
from gmprocess.core.stationstream import StationStream
from gmprocess.core.stationtrace import StationTrace... | [
"gmprocess.core.stationtrace.StationTrace",
"numpy.ceil",
"os.path.basename",
"gmprocess.core.stationstream.StationStream",
"gmprocess.io.seedname.get_channel_name",
"numpy.genfromtxt",
"numpy.isnan",
"re.findall",
"obspy.core.utcdatetime.UTCDateTime",
"gmprocess.io.seedname.get_units_type",
"os... | [((1786, 1814), 'gmprocess.core.stationtrace.StationTrace', 'StationTrace', (['data1', 'header1'], {}), '(data1, header1)\n', (1798, 1814), False, 'from gmprocess.core.stationtrace import StationTrace, PROCESS_LEVELS\n'), ((1828, 1856), 'gmprocess.core.stationtrace.StationTrace', 'StationTrace', (['data2', 'header2'], ... |
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.patches as mpatches
from mpl_toolkits.mplot3d import axes3d
from matplotlib import style
import numpy as np
import math
import time
#plt.style.use('dark_background')
class ParticleInABox():
class OneDimensional(... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.ylim",
"math.sqrt",
"matplotlib.pyplot.legend",
"math.sin",
"time.sleep",
"matplotlib.pyplot.fi... | [((5214, 5248), 'numpy.linspace', 'np.linspace', (['(0)', 'self.length_x', '(100)'], {}), '(0, self.length_x, 100)\n', (5225, 5248), True, 'import numpy as np\n'), ((5313, 5347), 'numpy.linspace', 'np.linspace', (['(0)', 'self.length_y', '(100)'], {}), '(0, self.length_y, 100)\n', (5324, 5347), True, 'import numpy as n... |
import argparse
from multiprocessing import cpu_count
from multiprocessing.pool import Pool
from pathlib import Path
from typing import Dict, Union
import numpy as np
import tqdm
from dfa.audio import Audio
from dfa.paths import Paths
from dfa.text import Tokenizer
from dfa.utils import get_files, read_config, pickle... | [
"dfa.utils.read_metafile",
"numpy.load",
"numpy.save",
"argparse.ArgumentParser",
"dfa.utils.read_config",
"dfa.utils.pickle_binary",
"dfa.audio.Audio.from_config",
"dfa.utils.get_files",
"dfa.text.Tokenizer",
"multiprocessing.pool.Pool",
"dfa.paths.Paths.from_config",
"multiprocessing.cpu_cou... | [((1884, 1959), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Preprocessing for DeepForcedAligner."""'}), "(description='Preprocessing for DeepForcedAligner.')\n", (1907, 1959), False, 'import argparse\n'), ((2287, 2311), 'dfa.utils.read_config', 'read_config', (['args.config'], {}), '(... |
from sklearn import neighbors, datasets
import numpy as np
from sklearn import tree
from sklearn import linear_model
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
#Training Set
X = np.zeros((22,1))
X[:,0] = np.arange(0,11,.5)
noisesigma = .2
Y = np.ravel(2 + .1 * X + noisesigma * np.ran... | [
"matplotlib.pyplot.plot",
"numpy.ravel",
"numpy.random.randn",
"matplotlib.pyplot.legend",
"numpy.zeros",
"sklearn.linear_model.LinearRegression",
"sklearn.linear_model.RidgeCV",
"numpy.arange",
"sklearn.linear_model.Lasso"
] | [((214, 231), 'numpy.zeros', 'np.zeros', (['(22, 1)'], {}), '((22, 1))\n', (222, 231), True, 'import numpy as np\n'), ((240, 261), 'numpy.arange', 'np.arange', (['(0)', '(11)', '(0.5)'], {}), '(0, 11, 0.5)\n', (249, 261), True, 'import numpy as np\n'), ((357, 375), 'numpy.zeros', 'np.zeros', (['(110, 1)'], {}), '((110,... |
#!/usr/bin/env python
#
# -*- Mode: python -*-
#
# $Id: Simplex.py,v 1.2 2004/05/31 14:01:06 vivake Exp $
#
# Copyright (c) 2002-2004 <NAME> (vivakeATlab49.com). All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# pub... | [
"numpy.sum",
"math.sqrt",
"matplotlib.pylab.figure",
"copy.copy",
"matplotlib.pylab.plot",
"numpy.array",
"numpy.arange",
"numpy.exp",
"numpy.random.normal",
"matplotlib.pylab.show"
] | [((11157, 11171), 'numpy.array', 'numpy.array', (['x'], {}), '(x)\n', (11168, 11171), False, 'import numpy\n'), ((11472, 11497), 'numpy.arange', 'numpy.arange', (['(0)', '(50)', '(0.01)'], {}), '(0, 50, 0.01)\n', (11484, 11497), False, 'import numpy\n'), ((11827, 11838), 'matplotlib.pylab.figure', 'MP.figure', ([], {})... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test finding a new design point, thetaT
@author: <NAME> [University of Washington, Seattle], 2018
@email: dflemin3 (at) uw (dot) edu
"""
from approxposterior import approx, likelihood as lh, gpUtils
import numpy as np
import george
def testFindAmp():
"""
T... | [
"numpy.random.seed",
"approxposterior.gpUtils.defaultGP",
"numpy.allclose",
"approxposterior.likelihood.rosenbrockSample",
"approxposterior.likelihood.rosenbrockLnprior",
"approxposterior.likelihood.rosenbrockLnlike",
"approxposterior.approx.ApproxPosterior"
] | [((585, 605), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (599, 605), True, 'import numpy as np\n'), ((1046, 1086), 'approxposterior.gpUtils.defaultGP', 'gpUtils.defaultGP', (['theta', 'y'], {'fitAmp': '(True)'}), '(theta, y, fitAmp=True)\n', (1063, 1086), False, 'from approxposterior import appr... |
#!/usr/bin/env python3
from os import path
import numpy as np
import pandas as pd
import sys
parent_path = path.abspath('..')
sys.path.insert(0, parent_path)
import unittest
import dfFunctions
import tf_models
import recommender as re
from utils import rmse
def run_test(testClass, header):
"""
Function to ru... | [
"numpy.absolute",
"os.path.abspath",
"dfFunctions.load_dataframe",
"unittest.TextTestRunner",
"dfFunctions.count_intersection",
"dfFunctions.ItemFinder",
"sys.path.insert",
"numpy.array",
"dfFunctions.BatchGenerator",
"recommender.SVDmodel",
"unittest.TestLoader",
"utils.rmse"
] | [((108, 126), 'os.path.abspath', 'path.abspath', (['""".."""'], {}), "('..')\n", (120, 126), False, 'from os import path\n'), ((127, 158), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parent_path'], {}), '(0, parent_path)\n', (142, 158), False, 'import sys\n'), ((853, 875), 'numpy.array', 'np.array', (['[1, 1, 1, 1]... |
import numpy as np
from evobench import Benchmark, Solution
from evosolve.linkage import BaseEmpiricalLinkage, LinkageScrap
class EmpiricalLinkage(BaseEmpiricalLinkage):
def __init__(self, benchmark: Benchmark):
super(EmpiricalLinkage, self).__init__(benchmark)
def get_scrap(self, base: Solution, t... | [
"numpy.abs",
"evobench.Solution",
"evosolve.linkage.LinkageScrap"
] | [((572, 591), 'evobench.Solution', 'Solution', (['perturbed'], {}), '(perturbed)\n', (580, 591), False, 'from evobench import Benchmark, Solution\n'), ((1535, 1579), 'numpy.abs', 'np.abs', (['(base_converged - perturbed_converged)'], {}), '(base_converged - perturbed_converged)\n', (1541, 1579), True, 'import numpy as ... |
import Gymwrappers as wrappers
import dqn_model
from PER import SumTree, Memory
import argparse
import time
import numpy as np
import collections
import torch
import torch.nn as nn
import torch.optim as optim
from tensorboardX import SummaryWriter
import pdb
DEFAULT_ENV_NAME = 'PongNoFrameskip-v4'
MEAN_REWARD_BOUND ... | [
"argparse.ArgumentParser",
"numpy.mean",
"torch.arange",
"PER.Memory",
"torch.no_grad",
"collections.deque",
"torch.nn.MSELoss",
"torch.BoolTensor",
"torch.max",
"torch.cuda.is_available",
"Gymwrappers.make_env",
"dqn_model.DuelingDQN",
"tensorboardX.SummaryWriter",
"numpy.zeros",
"time.... | [((653, 757), 'collections.namedtuple', 'collections.namedtuple', (['"""Experience"""'], {'field_names': "['state', 'action', 'reward', 'done', 'new_state']"}), "('Experience', field_names=['state', 'action',\n 'reward', 'done', 'new_state'])\n", (675, 757), False, 'import collections\n'), ((3368, 3383), 'torch.no_g... |
import numpy as np
from unittest import TestCase
import VZcomp.utils as utils
import VZcomp
class Utils(TestCase):
@classmethod
def setUpClass(self):
pass
def test_list_from_file(self):
bell_file = VZcomp.__path__[0]+'/tests/files/bell_state.qasm'
lines = utils.list_from_file(bel... | [
"VZcomp.utils.mat2szxz",
"VZcomp.utils.op2matrix",
"numpy.round",
"VZcomp.utils.split_entangling"
] | [((769, 798), 'VZcomp.utils.split_entangling', 'utils.split_entangling', (['lines'], {}), '(lines)\n', (791, 798), True, 'import VZcomp.utils as utils\n'), ((1052, 1074), 'VZcomp.utils.op2matrix', 'utils.op2matrix', (['"""X90"""'], {}), "('X90')\n", (1067, 1074), True, 'import VZcomp.utils as utils\n'), ((1091, 1107), ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.