code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Author: <NAME>
# Email: <EMAIL>
# License: MIT License
import scipy
import random
import numpy as np
from .search_tracker import SearchTracker
from ..converter import Converter
from ..results_manager import ResultsManager
from ..init_positions import Initializer
from ..utils import set_random_seed, move_random
de... | [
"numpy.random.seed",
"random.uniform",
"numpy.clip",
"numpy.rint",
"numpy.random.randint",
"random.seed"
] | [((654, 693), 'random.seed', 'random.seed', (['(random_state + nth_process)'], {}), '(random_state + nth_process)\n', (665, 693), False, 'import random\n'), ((698, 740), 'numpy.random.seed', 'np.random.seed', (['(random_state + nth_process)'], {}), '(random_state + nth_process)\n', (712, 740), True, 'import numpy as np... |
import gzip
import importlib
import json
import pkgutil
import shutil
import tarfile
import zipfile
import requests
from pathlib import Path
from types import ModuleType
from typing import Dict, Tuple, Union, Any, NoReturn
from urllib.request import urlretrieve
import numpy as np
import pandas as pd
import wget
from _... | [
"numpy.stack",
"json.dump",
"tqdm.tqdm",
"importlib.invalidate_caches",
"pkgutil.walk_packages",
"importlib.import_module",
"zipfile.ZipFile",
"pandas.read_csv",
"gzip.open",
"requests.Session",
"urllib.request.urlretrieve",
"pathlib.Path",
"tarfile.open",
"shutil.rmtree",
"shutil.copyfi... | [((714, 729), 'pathlib.Path', 'Path', (['arch_path'], {}), '(arch_path)\n', (718, 729), False, 'from pathlib import Path\n'), ((1950, 2026), 'pandas.read_csv', 'pd.read_csv', (['freq_words_path'], {'sep': '"""\t"""', 'header': 'None', 'names': "['word', 'count']"}), "(freq_words_path, sep='\\t', header=None, names=['wo... |
# *****************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions... | [
"argparse.ArgumentParser",
"random.shuffle",
"torch.cat",
"scipy.io.wavfile.read",
"torch.nn.functional.pad",
"json.loads",
"random.randint",
"torch.squeeze",
"random.seed",
"torch.zeros",
"tacotron2.layers.TacotronSTFT",
"os.chmod",
"os.path.basename",
"torch.autograd.Variable",
"numpy.... | [((1985, 2016), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""tacotron2"""'], {}), "(0, 'tacotron2')\n", (2000, 2016), False, 'import sys\n'), ((2443, 2458), 'scipy.io.wavfile.read', 'read', (['full_path'], {}), '(full_path)\n', (2447, 2458), False, 'from scipy.io.wavfile import read\n'), ((12405, 12430), 'argpars... |
import numpy as np
from collections import defaultdict
from sympy import Matrix, MatrixSymbol, lambdify
from .icp import icp, tr_icp
POINT_DIM = 3
POINT_SHAPE = (3)
Xi = MatrixSymbol('Xi', 3, 1)
Xj = MatrixSymbol('Xj', 3, 1)
Z = MatrixSymbol('Z', 3, 1)
Z_ = Xj - Xi
# z_ = lambdify((Xi, Xj), Matrix(Z_), modules='n... | [
"numpy.arctan2",
"numpy.zeros",
"sympy.Matrix",
"sympy.lambdify",
"collections.defaultdict",
"numpy.fabs",
"numpy.array",
"numpy.sin",
"sympy.MatrixSymbol",
"numpy.cos"
] | [((176, 200), 'sympy.MatrixSymbol', 'MatrixSymbol', (['"""Xi"""', '(3)', '(1)'], {}), "('Xi', 3, 1)\n", (188, 200), False, 'from sympy import Matrix, MatrixSymbol, lambdify\n'), ((206, 230), 'sympy.MatrixSymbol', 'MatrixSymbol', (['"""Xj"""', '(3)', '(1)'], {}), "('Xj', 3, 1)\n", (218, 230), False, 'from sympy import M... |
"""Helpers for reducing the resolution of various operators.
Intended for use in calculating the uncertainties at a coarser
resolution than the fluxes.
"""
from __future__ import division
from math import ceil
import numpy as np
from numpy import zeros, newaxis
DTYPE = np.float32
def get_remappers(domain_size, blo... | [
"numpy.zeros",
"math.ceil"
] | [((1129, 1175), 'numpy.zeros', 'zeros', (['(reduced_size + domain_size)'], {'dtype': 'DTYPE'}), '(reduced_size + domain_size, dtype=DTYPE)\n', (1134, 1175), False, 'from numpy import zeros, newaxis\n'), ((1056, 1078), 'math.ceil', 'ceil', (['(dim / block_side)'], {}), '(dim / block_side)\n', (1060, 1078), False, 'from ... |
import numpy as np
import utils
def evaluate_by_metrics(model, params, data, metrics, tag_map_path):
X_valid = utils.process_data_for_keras(params.number_of_tags, data['data'])
length = np.array([len(sent) for sent in data['data']], dtype='int32')
y_pred = model.predict(X_valid)
y = np.argmax(y_pred,... | [
"utils.process_data_for_keras",
"numpy.argmax"
] | [((118, 183), 'utils.process_data_for_keras', 'utils.process_data_for_keras', (['params.number_of_tags', "data['data']"], {}), "(params.number_of_tags, data['data'])\n", (146, 183), False, 'import utils\n'), ((303, 324), 'numpy.argmax', 'np.argmax', (['y_pred', '(-1)'], {}), '(y_pred, -1)\n', (312, 324), True, 'import ... |
"""Database classes and support for measurements"""
from abc import ABC
import json
import logging
import os
import re
import sys
import time
import numpy as np
from typing import Tuple
from google.cloud import bigquery
logging.basicConfig(level=logging.INFO)
def get_database(style: str):
"""Retrieve database ... | [
"matplotlib.pyplot.title",
"google.cloud.bigquery.SchemaField",
"pymssql.connect",
"google.cloud.bigquery.Client",
"os.path.join",
"logging.error",
"logging.warning",
"os.path.exists",
"google.cloud.bigquery.LoadJobConfig",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"matplotlib.py... | [((223, 262), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (242, 262), False, 'import logging\n'), ((512, 557), 'logging.info', 'logging.info', (['"""Using Microsoft Azure backend"""'], {}), "('Using Microsoft Azure backend')\n", (524, 557), False, 'import log... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
d = 64 # dimension
nb = 100000 # database size
nq = 10000 ... | [
"faiss.IndexFlatL2",
"numpy.random.random",
"numpy.random.seed",
"numpy.arange"
] | [((341, 361), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (355, 361), True, 'import numpy as np\n'), ((623, 643), 'faiss.IndexFlatL2', 'faiss.IndexFlatL2', (['d'], {}), '(d)\n', (640, 643), False, 'import faiss\n'), ((455, 468), 'numpy.arange', 'np.arange', (['nb'], {}), '(nb)\n', (464, 468), T... |
import numpy as np
class Perceptron:
def __init__(self, num_features):
self.num_features = num_features
self.weights = np.zeros((num_features, 1), dtype=np.float)
self.bias = np.zeros(1, dtype=np.float)
def forward(self, x):
# (n, m) X (m, 1) = (n, 1) + (1) = (n, 1)
l... | [
"numpy.dot",
"numpy.where",
"numpy.zeros",
"numpy.sum"
] | [((142, 185), 'numpy.zeros', 'np.zeros', (['(num_features, 1)'], {'dtype': 'np.float'}), '((num_features, 1), dtype=np.float)\n', (150, 185), True, 'import numpy as np\n'), ((206, 233), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtype': 'np.float'}), '(1, dtype=np.float)\n', (214, 233), True, 'import numpy as np\n'), ((386... |
from itertools import product
import numpy as np
from skimage.color import rgb2hsv, rgb2lab, rgb2gray
from skimage.segmentation import felzenszwalb
def oversegmentation(img, k):
"""
Generating various starting regions using the method of
Felzenszwalb.
k effectively sets a scale of observa... | [
"skimage.color.rgb2gray",
"numpy.sum",
"skimage.color.rgb2hsv",
"itertools.product",
"skimage.segmentation.felzenszwalb",
"skimage.color.rgb2lab"
] | [((538, 589), 'skimage.segmentation.felzenszwalb', 'felzenszwalb', (['img'], {'scale': 'k', 'sigma': '(0.8)', 'min_size': '(100)'}), '(img, scale=k, sigma=0.8, min_size=100)\n', (550, 589), False, 'from skimage.segmentation import felzenszwalb\n'), ((2024, 2049), 'itertools.product', 'product', (['colors', 'ks', 'sims'... |
import os
import cv2
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
import numpy as np
from .eval import Evaluator
class FullImageEvaluator(Evaluator):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def process_batch(self, predicted, model, data, prefix=""):
... | [
"numpy.zeros",
"cv2.ocl.setUseOpenCL",
"cv2.setNumThreads",
"numpy.squeeze",
"os.path.join"
] | [((25, 45), 'cv2.setNumThreads', 'cv2.setNumThreads', (['(0)'], {}), '(0)\n', (42, 45), False, 'import cv2\n'), ((47, 74), 'cv2.ocl.setUseOpenCL', 'cv2.ocl.setUseOpenCL', (['(False)'], {}), '(False)\n', (67, 74), False, 'import cv2\n'), ((2599, 2655), 'numpy.zeros', 'np.zeros', (["(geometry['rows'], geometry['cols'])",... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import warnings
import pytest
import numpy as np
from numpy import testing as npt
import erfa
from astropy import units as u
from astropy.time import Time
from astropy.coordinates.builtin_frames import ICRS, AltAz
from astropy.co... | [
"erfa.apco13",
"astropy.coordinates.builtin_frames.ICRS",
"numpy.abs",
"erfa.atoiq",
"erfa.aticq",
"astropy.coordinates.builtin_frames.utils.__warningregistry__.clear",
"warnings.simplefilter",
"pytest.warns",
"erfa.atioq",
"erfa.atciq",
"numpy.max",
"warnings.catch_warnings",
"astropy.utils... | [((603, 635), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (617, 635), False, 'import pytest\n'), ((722, 754), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (736, 754), False, 'import pytest\n'), ((1118, 1179), 'pytest.fi... |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 20 18:23:01 2020
@author: lamington1010
"""
import cv2
import numpy as np
def imgimport():
s1 = input("image filename without numbers, e.g. cats")
s2 = input("file type, e.g. .jpg, .tif, etc ")
s3 = int(input("what is the range of images?"))
s3a = 'file ... | [
"numpy.size",
"numpy.transpose",
"numpy.shape",
"cv2.imread",
"numpy.array",
"numpy.reshape"
] | [((748, 764), 'numpy.shape', 'np.shape', (['Matrix'], {}), '(Matrix)\n', (756, 764), True, 'import numpy as np\n'), ((785, 817), 'numpy.reshape', 'np.reshape', (['Matrix', '(A[0], A[1])'], {}), '(Matrix, (A[0], A[1]))\n', (795, 817), True, 'import numpy as np\n'), ((447, 483), 'cv2.imread', 'cv2.imread', (['s5', 'cv2.I... |
import os.path
import PIL.Image as pimg
import nibabel as nib
import numpy as np
import torch
from ....in_out.image_functions import rescale_image_intensities, points_to_voxels_transform
from ....support import utilities
import logging
logger = logging.getLogger(__name__)
class Image:
"""
Landmarks (i.e. la... | [
"nibabel.Nifti1Image",
"numpy.meshgrid",
"numpy.subtract",
"numpy.zeros",
"numpy.min",
"torch.clamp",
"numpy.max",
"numpy.swapaxes",
"numpy.linspace",
"numpy.array",
"PIL.Image.fromarray",
"logging.getLogger"
] | [((247, 274), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (264, 274), False, 'import logging\n'), ((8735, 8764), 'numpy.zeros', 'np.zeros', (['(self.dimension, 2)'], {}), '((self.dimension, 2))\n', (8743, 8764), True, 'import numpy as np\n'), ((2725, 2842), 'numpy.linspace', 'np.linspa... |
# python frozen_raw.py --dump_path scratch/dump_word_embeddings_glove --dim_pca 17
import argparse
import numpy as np
import pickle
from pytorch_helper.util import cos_numpy
from scipy.stats import pearsonr, spearmanr
class RawFrozenEvaluator:
def __init__(self, hparams):
self.hparams = hparams
... | [
"argparse.Namespace",
"argparse.ArgumentParser",
"scipy.stats.spearmanr",
"numpy.expand_dims",
"scipy.stats.pearsonr",
"numpy.linalg.svd",
"numpy.mean",
"numpy.array",
"pytorch_helper.util.cos_numpy",
"numpy.column_stack"
] | [((3313, 3338), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3336, 3338), False, 'import argparse\n'), ((874, 895), 'numpy.column_stack', 'np.column_stack', (['embs'], {}), '(embs)\n', (889, 895), True, 'import numpy as np\n'), ((933, 951), 'numpy.mean', 'np.mean', (['X'], {'axis': '(1)'}), ... |
import numpy as np
import pandas as pd
from pandas import CategoricalIndex, Index, MultiIndex, Timestamp, date_range
import pandas._testing as tm
class TestGetLevelValues:
def test_get_level_values_box_datetime64(self):
dates = date_range("1/1/2000", periods=4)
levels = [dates, [0, 1]... | [
"pandas.date_range",
"pandas.MultiIndex.from_arrays",
"pandas.DatetimeIndex",
"pandas.Index",
"pandas._testing.assert_index_equal",
"numpy.array",
"pandas.Period",
"pandas.MultiIndex",
"pandas.CategoricalIndex"
] | [((611, 674), 'pandas.Index', 'Index', (["['foo', 'foo', 'bar', 'baz', 'qux', 'qux']"], {'name': '"""first"""'}), "(['foo', 'foo', 'bar', 'baz', 'qux', 'qux'], name='first')\n", (616, 674), False, 'from pandas import CategoricalIndex, Index, MultiIndex, Timestamp, date_range\n'), ((680, 719), 'pandas._testing.assert_in... |
import numpy as np
# 忽略除数为0的warning, 对于除数为0的情况已有相应处理
np.seterr(divide='ignore', invalid='ignore')
from utils.f_boundary import eval_mask_boundary
class Evaluator(object):
def __init__(self, num_class):
self.num_class = num_class
self.confusion_matrix = np.zeros((self.num_class,)*2)
def Pixe... | [
"numpy.sum",
"numpy.seterr",
"numpy.zeros",
"numpy.expand_dims",
"numpy.isnan",
"numpy.diag",
"numpy.bincount",
"utils.f_boundary.eval_mask_boundary",
"numpy.nanmean"
] | [((54, 98), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (63, 98), True, 'import numpy as np\n'), ((277, 308), 'numpy.zeros', 'np.zeros', (['((self.num_class,) * 2)'], {}), '((self.num_class,) * 2)\n', (285, 308), True, 'import numpy ... |
from shapely.geometry import Point, Polygon, LineString
import cv2
import numpy as np
from scipy import signal
from pathlib import Path
import pathlib
import math
import copy
from blender_scripts.util import _get_furniture_info
def place_multi_furniture_scoring(furniture_obj_dir="./data/basic_furniture/", wall_objs_... | [
"numpy.full",
"copy.deepcopy",
"shapely.geometry.Point",
"numpy.abs",
"numpy.arctan2",
"shapely.geometry.Polygon",
"numpy.argmax",
"cv2.cvtColor",
"scipy.signal.convolve2d",
"numpy.zeros",
"blender_scripts.util._get_furniture_info",
"numpy.argmin",
"math.copysign",
"shapely.geometry.LineSt... | [((571, 586), 'shapely.geometry.Polygon', 'Polygon', (['coords'], {}), '(coords)\n', (578, 586), False, 'from shapely.geometry import Point, Polygon, LineString\n'), ((613, 669), 'numpy.full', 'np.full', (['(max_y - min_y + 1, max_x - min_x + 1)', '(-np.inf)'], {}), '((max_y - min_y + 1, max_x - min_x + 1), -np.inf)\n'... |
import numpy as np
from six.moves import zip_longest
import unittest
import chainer
from chainer.iterators import SerialIterator
from chainer import testing
from chainercv.utils import apply_prediction_to_iterator
@testing.parameterize(*testing.product({
'multi_pred_values': [False, True],
'with_gt_values':... | [
"chainer.testing.product",
"numpy.random.uniform",
"chainer.datasets.TupleDataset",
"six.moves.zip_longest",
"numpy.random.randint",
"chainer.iterators.SerialIterator",
"numpy.testing.assert_equal",
"chainer.testing.run_module",
"chainercv.utils.apply_prediction_to_iterator"
] | [((3668, 3706), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (3686, 3706), False, 'from chainer import testing\n'), ((1686, 1741), 'chainer.iterators.SerialIterator', 'SerialIterator', (['dataset', '(2)'], {'repeat': '(False)', 'shuffle': '(False)'}), '(d... |
"""
.. _tut_inverse_mne_dspm:
Source localization with MNE/dSPM/sLORETA
=========================================
The aim of this tutorials is to teach you how to compute and apply a linear
inverse method such as MNE/dSPM/sLORETA on evoked/raw/epochs data.
"""
import numpy as np
import matplotlib.pyplot as plt
impo... | [
"mne.pick_types",
"mne.find_events",
"mne.compute_covariance",
"numpy.arange",
"mne.minimum_norm.make_inverse_operator",
"numpy.linspace",
"mne.compute_morph_matrix",
"matplotlib.pyplot.show",
"mne.pick_types_forward",
"mne.viz.plot_cov",
"mne.read_forward_solution",
"matplotlib.pyplot.ylabel"... | [((633, 651), 'mne.datasets.sample.data_path', 'sample.data_path', ([], {}), '()\n', (649, 651), False, 'from mne.datasets import sample\n'), ((729, 759), 'mne.io.read_raw_fif', 'mne.io.read_raw_fif', (['raw_fname'], {}), '(raw_fname)\n', (748, 759), False, 'import mne\n'), ((805, 849), 'mne.find_events', 'mne.find_eve... |
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,20,100)
plt.plot(x, np.sin(x))
plt.show() | [
"numpy.sin",
"matplotlib.pyplot.show",
"numpy.linspace"
] | [((58, 81), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', '(100)'], {}), '(0, 20, 100)\n', (69, 81), True, 'import numpy as np\n'), ((104, 114), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (112, 114), True, 'import matplotlib.pyplot as plt\n'), ((93, 102), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (9... |
import sys
import numpy as np
import cv2
import os
MIN_CONTOUR_AREA = 100
RESIZED_IMAGE_WIDTH = 20
RESIZED_IMAGE_HEIGHT = 30
def main():
imgTrainingNumbers = cv2.imread("Citra_Plate_Training/training_0.jpg")
# Resize Citra menjadi skala 80%
scale_percent = 80
width = int(imgTrainingNumbers.shape[1] *... | [
"cv2.GaussianBlur",
"cv2.findContours",
"cv2.contourArea",
"cv2.boundingRect",
"cv2.cvtColor",
"numpy.empty",
"cv2.destroyAllWindows",
"numpy.savetxt",
"cv2.waitKey",
"os.system",
"cv2.adaptiveThreshold",
"cv2.imread",
"numpy.append",
"numpy.array",
"cv2.rectangle",
"sys.exit",
"cv2.... | [((164, 213), 'cv2.imread', 'cv2.imread', (['"""Citra_Plate_Training/training_0.jpg"""'], {}), "('Citra_Plate_Training/training_0.jpg')\n", (174, 213), False, 'import cv2\n'), ((494, 563), 'cv2.resize', 'cv2.resize', (['imgTrainingNumbers', 'dimensi'], {'interpolation': 'cv2.INTER_AREA'}), '(imgTrainingNumbers, dimensi... |
# encoding: utf-8
__author__ = "<NAME>"
# Parts of the code have been taken from https://github.com/facebookresearch/fastMRI
import numpy as np
import pytest
import torch
from mridc.data import transforms
from mridc.data.subsample import RandomMaskFunc
from mridc.nn import CIRIM, Unet, VarNet
from tests.fastmri.conf... | [
"mridc.nn.CIRIM",
"tests.fastmri.conftest.create_input",
"mridc.nn.Unet",
"torch.cat",
"mridc.data.subsample.RandomMaskFunc",
"mridc.data.transforms.apply_mask",
"mridc.nn.VarNet",
"numpy.array",
"pytest.mark.parametrize",
"torch.no_grad"
] | [((348, 626), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shape, cascades, center_fractions, accelerations"""', '[([1, 3, 32, 16, 2], 1, [0.08], [4]), ([1, 5, 15, 12, 2], 32, [0.04], [8]),\n ([1, 8, 13, 18, 2], 16, [0.08], [4]), ([1, 2, 17, 19, 2], 8, [0.08], [4\n ]), ([1, 2, 17, 19, 2], 8, [0.08]... |
import argparse
import multiprocessing as mp
import os
import os.path as osp
from functools import partial
import numpy as np
import torch
import yaml
from munch import Munch
from softgroup.data import build_dataloader, build_dataset
from softgroup.evaluation import (ScanNetEval, evaluate_offset_mae, evaluate_semantic... | [
"argparse.ArgumentParser",
"softgroup.util.get_root_logger",
"yaml.safe_load",
"torch.cuda.current_device",
"torch.no_grad",
"os.path.join",
"softgroup.evaluation.ScanNetEval",
"numpy.savetxt",
"softgroup.model.SoftGroup",
"softgroup.util.init_dist",
"softgroup.util.get_dist_info",
"functools.... | [((695, 731), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""SoftGroup"""'], {}), "('SoftGroup')\n", (718, 731), False, 'import argparse\n'), ((1154, 1174), 'os.path.join', 'osp.join', (['root', 'name'], {}), '(root, name)\n', (1162, 1174), True, 'import os.path as osp\n'), ((1179, 1211), 'os.makedirs', 'o... |
import os
# hacky, but whatever
import sys
my_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(my_path, '..'))
import mdpsim # noqa: #402
import pytest # noqa: E402
import tensorflow as tf # noqa: E402
import numpy as np # noqa: E402
pytest.register_assert_rewrite('models')
from mode... | [
"os.path.abspath",
"models.get_problem_meta",
"numpy.sum",
"models.check_prob_dom_meta",
"mdpsim.parse_file",
"mdpsim.get_problems",
"tf_utils.masked_softmax",
"mdpsim.get_domains",
"models.get_domain_meta",
"numpy.exp",
"pytest.register_assert_rewrite",
"os.path.join"
] | [((270, 310), 'pytest.register_assert_rewrite', 'pytest.register_assert_rewrite', (['"""models"""'], {}), "('models')\n", (300, 310), False, 'import pytest\n'), ((69, 94), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (84, 94), False, 'import os\n'), ((112, 139), 'os.path.join', 'os.path.joi... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from extensions.ops.activation_ops import Elu, SoftPlus, Mish
from mo.graph.graph import Node
from mo.utils.unittest.graph import build_graph
class TestActivationOp(unittest.TestCase):
nodes_att... | [
"extensions.ops.activation_ops.SoftPlus.infer",
"mo.graph.graph.Node",
"extensions.ops.activation_ops.Mish.infer",
"numpy.array",
"extensions.ops.activation_ops.Elu.infer"
] | [((1492, 1522), 'mo.graph.graph.Node', 'Node', (['graph', '"""activation_node"""'], {}), "(graph, 'activation_node')\n", (1496, 1522), False, 'from mo.graph.graph import Node\n'), ((1531, 1557), 'extensions.ops.activation_ops.Elu.infer', 'Elu.infer', (['activation_node'], {}), '(activation_node)\n', (1540, 1557), False... |
import math
import numpy as np
import random
import neuron as nu
# f_FPC_unit: a one unit of f-PFC,2
W = np.array([[0, 1], [0.917, 0]])
class f_PFC_unit:
def __init__(self, V_d, V_c):
self.random_del = 1
self.dt = 0.01
self.Tau = 10
self.Wl = np.array([[0, 1], [0.9... | [
"neuron.neuron",
"numpy.zeros_like",
"numpy.array"
] | [((114, 144), 'numpy.array', 'np.array', (['[[0, 1], [0.917, 0]]'], {}), '([[0, 1], [0.917, 0]])\n', (122, 144), True, 'import numpy as np\n'), ((298, 327), 'numpy.array', 'np.array', (['[[0, 1], [0.93, 0]]'], {}), '([[0, 1], [0.93, 0]])\n', (306, 327), True, 'import numpy as np\n'), ((347, 380), 'numpy.array', 'np.arr... |
from datetime import datetime
import math
import numpy as np
import random
from utils \
import is_good, is_get_good, send_mail, test_bern_get, test_bern_post, query
FROM_GMAIL_ADDR = 'YOUR_GMAIL_ADDR'
FROM_GMAIL_ACCOUNT_PASSWORD = '<PASSWORD>'
TO_EMAIL_ADDR = 'TO_EMAIL_ADDR'
def check_bern(from_gmail, to_email, ... | [
"utils.is_good",
"utils.test_bern_post",
"numpy.std",
"utils.query",
"utils.is_get_good",
"utils.test_bern_get",
"datetime.datetime.now"
] | [((7218, 7267), 'utils.test_bern_get', 'test_bern_get', (['num_threads', 'wait_seconds', 'num_try'], {}), '(num_threads, wait_seconds, num_try)\n', (7231, 7267), False, 'from utils import is_good, is_get_good, send_mail, test_bern_get, test_bern_post, query\n'), ((7272, 8459), 'utils.test_bern_post', 'test_bern_post', ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 <NAME> <<EMAIL>>
#
# Distributed under terms of the BSD 3-Clause license.
"""Regression test 2."""
# pylint: disable=redefined-outer-name
import os
import sys
import csv
import pathlib
import numpy
import pytest
import rasterio
import... | [
"rasterio.open",
"numpy.zeros_like",
"numpy.ones_like",
"csv.reader",
"numpy.logical_and",
"pytest.fixture",
"pytest.raises",
"pytest.mark.skipif",
"matplotlib.use",
"numpy.tan",
"numpy.linspace",
"pathlib.Path",
"pytest.approx",
"numpy.sqrt"
] | [((414, 445), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (428, 445), False, 'import pytest\n'), ((8348, 8453), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(matplotlib.__version__ != '3.3.3')"], {'reason': '"""only check against matplotlib v3.3.3"""'}), "(matplotlib._... |
import numpy as np
import pytest
import gbmc_v0.pad_dump_file as pad
import gbmc_v0.util_funcs as uf
@pytest.mark.parametrize('filename0, lat_par, non_p',
[("data/dump_1", 4.05, 2),
("data/dump_2", 4.05, 1)])
def test_pad_gb_perp(filename0, lat_par, non_p):
data ... | [
"gbmc_v0.pad_dump_file.GB_finder",
"gbmc_v0.pad_dump_file.pad_gb_perp",
"numpy.allclose",
"numpy.linalg.norm",
"pytest.mark.parametrize",
"gbmc_v0.util_funcs.compute_ovito_data"
] | [((104, 214), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""filename0, lat_par, non_p"""', "[('data/dump_1', 4.05, 2), ('data/dump_2', 4.05, 1)]"], {}), "('filename0, lat_par, non_p', [('data/dump_1', 4.05,\n 2), ('data/dump_2', 4.05, 1)])\n", (127, 214), False, 'import pytest\n'), ((322, 354), 'gbmc_v... |
r"""
Visualization of normal modes from an elastic network model
===========================================================
The *elastic network model* (ENM) is a fast method to estimate movements
in a protein structure, without the need to run time-consuming MD
simulations.
A protein is modelled as *mass-and-spring*... | [
"tempfile.NamedTemporaryFile",
"biotite.structure.from_template",
"numpy.sum",
"biotite.structure.get_residue_starts",
"biotite.structure.io.save_structure",
"biotite.structure.io.mmtf.get_structure",
"numpy.max",
"numpy.sin",
"numpy.loadtxt",
"numpy.linspace",
"biotite.database.rcsb.fetch",
"... | [((2327, 2365), 'biotite.structure.io.mmtf.get_structure', 'mmtf.get_structure', (['mmtf_file'], {'model': '(1)'}), '(mmtf_file, model=1)\n', (2345, 2365), True, 'import biotite.structure.io.mmtf as mmtf\n'), ((3344, 3393), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', 'FRAMES'], {'endpoint': '(False)'}), '(... |
import numpy as np
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
import os
import scipy
import time
import cv2
# Remove previous weights and biases
tf.compat.v1.reset_default_graph()
# Dir of model check point
# save_file = "./model.ckpt"
# Get path where dog image place
data_pa... | [
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.compat.v1.train.exponential_decay",
"tensorflow.nn.conv2d",
"numpy.random.normal",
"tensorflow.nn.conv2d_transpose",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.math.log",
"tensorflow.compat.v1.placeholder",
"tensorflow.pl... | [((182, 216), 'tensorflow.compat.v1.reset_default_graph', 'tf.compat.v1.reset_default_graph', ([], {}), '()\n', (214, 216), True, 'import tensorflow as tf\n'), ((401, 422), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (411, 422), False, 'import os\n'), ((625, 703), 'tensorflow.compat.v1.placeholder... |
import numpy as np
import torch
import scipy.sparse as sp
idx_features_labels = np.genfromtxt("./cora.content", dtype=np.dtype(str))
features = sp.csr_matrix(idx_features_labels[:, 1:-1], dtype=np.float32)
features = torch.FloatTensor(np.array(features.todense()))
print(features.size())
list = features.numpy().tolist... | [
"scipy.sparse.csr_matrix",
"numpy.dtype"
] | [((145, 206), 'scipy.sparse.csr_matrix', 'sp.csr_matrix', (['idx_features_labels[:, 1:-1]'], {'dtype': 'np.float32'}), '(idx_features_labels[:, 1:-1], dtype=np.float32)\n', (158, 206), True, 'import scipy.sparse as sp\n'), ((119, 132), 'numpy.dtype', 'np.dtype', (['str'], {}), '(str)\n', (127, 132), True, 'import numpy... |
#!/usr/bin/python3
import requests
import pandas as pd
import numpy as np
PLAYERS_URL = (
"https://raw.githubusercontent.com/mesosbrodleto/"
"soccerDataChallenge/master/players.json"
)
EVENTS_URL = (
"https://raw.githubusercontent.com/mesosbrodleto/"
"soccerDataChallenge/master/worldCup-final.json"
)... | [
"pandas.DataFrame",
"numpy.matrix",
"requests.get"
] | [((1398, 1485), 'pandas.DataFrame', 'pd.DataFrame', (['match'], {'columns': "['teamId', 'playerId', 'tags', 'eventId', 'positions']"}), "(match, columns=['teamId', 'playerId', 'tags', 'eventId',\n 'positions'])\n", (1410, 1485), True, 'import pandas as pd\n'), ((2177, 2203), 'numpy.matrix', 'np.matrix', (['(5 * [5 *... |
"""
The AxesCache class alters how an Axes instance is rendered.
While enabled, the AxesCache quickly re-renders an original view,
properly scaled and translated to reflect changes in the viewport.
The downside is that the re-rendered image is fuzzy and/or truncated.
The best way to use an AxesCache is to enable it du... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.collections.QuadMesh",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"numpy.frombuffer",
"numpy.column_stack",
"numpy.flipud",
"matplotlib.axes.Axes.draw",
"numpy.random.randint",
"matplotlib.image.AxesImage",
"numpy.array",
... | [((5938, 5954), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(111)'], {}), '(111)\n', (5949, 5954), True, 'import matplotlib.pyplot as plt\n'), ((5959, 5999), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'bottom': '(0.5)', 'top': '(0.8)'}), '(bottom=0.5, top=0.8)\n', (5978, 5999), True, 'import m... |
"""
Interface for system identification data (Actuator and Drives).
"""
from __future__ import print_function
import os
import sys
import zipfile
import warnings
import numpy as np
import scipy.io as sio
from six.moves import urllib
from six.moves import cPickle as pkl
SOURCE_URLS = {
'actuator': 'https://www.c... | [
"sys.stdout.write",
"os.remove",
"zipfile.ZipFile",
"os.makedirs",
"scipy.io.loadmat",
"os.path.isdir",
"os.getcwd",
"os.path.exists",
"numpy.hstack",
"os.path.isfile",
"sys.stdout.flush",
"six.moves.urllib.request.urlretrieve",
"warnings.warn",
"os.path.join"
] | [((555, 587), 'os.path.join', 'os.path.join', (['data_path', '"""sysid"""'], {}), "(data_path, 'sysid')\n", (567, 587), False, 'import os\n'), ((607, 656), 'os.path.join', 'os.path.join', (['datadir_path', "(dataset_name + '.mat')"], {}), "(datadir_path, dataset_name + '.mat')\n", (619, 656), False, 'import os\n'), ((2... |
"""
@file orthogonal_3.py
@description solutions to linear algebra textbook 6.3
@author <NAME>
@version 1.0 May 28, 2021
"""
#!/bin/python
from sympy import Matrix
import numpy as np
import random
def problem25():
"""
Find neareast point in Col A to vector p in R^n
"""
print("broblem 25")
A = ... | [
"numpy.dot",
"numpy.linalg.norm",
"numpy.array"
] | [((320, 458), 'numpy.array', 'np.array', (['[[-6, -3, 6, 1], [-1, 2, 1, -6], [3, 6, 3, -2], [6, -3, 6, -1], [2, -1, 2, \n 3], [-3, 6, 3, 2], [-2, -1, 2, -3], [1, 2, 1, 6]]'], {}), '([[-6, -3, 6, 1], [-1, 2, 1, -6], [3, 6, 3, -2], [6, -3, 6, -1], [2,\n -1, 2, 3], [-3, 6, 3, 2], [-2, -1, 2, -3], [1, 2, 1, 6]])\n', ... |
import unittest
import numpy
from molml.molecule import Connectivity
from molml.crystal import GenerallizedCrystal
from molml.crystal import EwaldSumMatrix, SineMatrix
H_ELES = ['H']
H_NUMS = [1]
H_COORDS = numpy.array([[0.0, 0.0, 0.0]])
H_UNIT = numpy.array([
[2., .5, 0.],
[.25, 1., 0.],
[0., .3, 1.],
... | [
"unittest.main",
"molml.crystal.GenerallizedCrystal",
"molml.crystal.EwaldSumMatrix",
"molml.molecule.Connectivity",
"numpy.array",
"molml.crystal.SineMatrix",
"numpy.testing.assert_array_almost_equal"
] | [((211, 241), 'numpy.array', 'numpy.array', (['[[0.0, 0.0, 0.0]]'], {}), '([[0.0, 0.0, 0.0]])\n', (222, 241), False, 'import numpy\n'), ((251, 316), 'numpy.array', 'numpy.array', (['[[2.0, 0.5, 0.0], [0.25, 1.0, 0.0], [0.0, 0.3, 1.0]]'], {}), '([[2.0, 0.5, 0.0], [0.25, 1.0, 0.0], [0.0, 0.3, 1.0]])\n', (262, 316), False... |
import numpy as np
from multiphenotype_utils import (get_continuous_features_as_matrix, add_id, remove_id_and_get_mat,
partition_dataframe_into_binary_and_continuous, divide_idxs_into_batches)
import pandas as pd
import tensorflow as tf
from dimreducer import DimReducer
import time
from scipy.stats import pearsonr... | [
"multiphenotype_utils.partition_dataframe_into_binary_and_continuous",
"numpy.random.seed",
"numpy.abs",
"numpy.arange",
"numpy.diag",
"tensorflow.sqrt",
"tensorflow.gather",
"multiphenotype_utils.remove_id_and_get_mat",
"tensorflow.set_random_seed",
"tensorflow.placeholder",
"scipy.stats.linreg... | [((4661, 4700), 'copy.deepcopy', 'copy.deepcopy', (['self.binary_feature_idxs'], {}), '(self.binary_feature_idxs)\n', (4674, 4700), False, 'import copy\n'), ((4739, 4782), 'copy.deepcopy', 'copy.deepcopy', (['self.continuous_feature_idxs'], {}), '(self.continuous_feature_idxs)\n', (4752, 4782), False, 'import copy\n'),... |
import cv2
import imutils
import numpy as np
import os
import concurrent.futures
MAX_MATCHS = 5000
GOOD_RATE = 0.3
def align_imgs(template_img, origin_img):
'''
Args:
template_img: template image
origin_img: origin image
Function:
align the template image to origin image
'''
... | [
"os.mkdir",
"cv2.warpPerspective",
"cv2.xfeatures2d.BEBLID_create",
"os.path.join",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.exists",
"cv2.inRange",
"cv2.imread",
"numpy.where",
"cv2.ORB_create",
"numpy.array",
"cv2.DescriptorMatcher_create",
"cv2.findHomography",
"os.listdir",
"numpy.v... | [((340, 386), 'cv2.cvtColor', 'cv2.cvtColor', (['template_img', 'cv2.COLOR_BGR2GRAY'], {}), '(template_img, cv2.COLOR_BGR2GRAY)\n', (352, 386), False, 'import cv2\n'), ((405, 449), 'cv2.cvtColor', 'cv2.cvtColor', (['origin_img', 'cv2.COLOR_BGR2GRAY'], {}), '(origin_img, cv2.COLOR_BGR2GRAY)\n', (417, 449), False, 'impor... |
from ..errors import logger
from ..stats._rolling_stats import rolling_stats
import numpy as np
def _nan_reshape(Xd, no_data):
Xd[np.isnan(Xd) | np.isinf(Xd)] = no_data
return Xd[:, np.newaxis]
def _mean(X, axis=1, no_data=0):
"""
Computes the mean
"""
X_ = X.mean(axis=axis)
return... | [
"numpy.percentile",
"numpy.diff",
"numpy.isinf",
"numpy.isnan"
] | [((2669, 2699), 'numpy.percentile', 'np.percentile', (['X', '(5)'], {'axis': 'axis'}), '(X, 5, axis=axis)\n', (2682, 2699), True, 'import numpy as np\n'), ((2840, 2871), 'numpy.percentile', 'np.percentile', (['X', '(25)'], {'axis': 'axis'}), '(X, 25, axis=axis)\n', (2853, 2871), True, 'import numpy as np\n'), ((3015, 3... |
import os
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from model import Net
import json
from tqdm import tqdm
import numpy as np
import h5py
from data import get_extract_data
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
np.random.seed(1234)
import pickle
... | [
"pickle.dump",
"h5py.File",
"numpy.random.seed",
"tqdm.tqdm",
"torch.utils.data.DataLoader",
"model.Net",
"torch.cuda.device_count",
"pickle.load",
"pdb.set_trace",
"torch.nn.DataParallel",
"torch.no_grad",
"os.path.join"
] | [((285, 305), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (299, 305), True, 'import numpy as np\n'), ((547, 552), 'model.Net', 'Net', ([], {}), '()\n', (550, 552), False, 'from model import Net\n'), ((1826, 1922), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataset_', 'batch_... |
from abc import ABC
from dataclasses import dataclass
from enum import IntEnum
from functools import lru_cache
from typing import Any, Dict, List, Tuple, Type, Union
import numpy as np
import toolz
try:
from functools import cached_property
except:
from backports.cached_property import cached_property
from s... | [
"numpy.random.seed",
"numpy.zeros",
"colosseum.mdps.MDP.testing_parameters",
"numpy.where",
"colosseum.utils.random_vars.deterministic",
"numpy.random.rand",
"functools.lru_cache",
"numpy.delete",
"dataclasses.dataclass"
] | [((494, 516), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (503, 516), False, 'from dataclasses import dataclass\n'), ((6786, 6797), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (6795, 6797), False, 'from functools import lru_cache\n'), ((718, 742), 'colosseum.mdps.MDP.t... |
# -*- coding: utf-8 -*-
"""
Name : c10_16_straddle.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import matplotlib.pyplot as plt
import numpy as np
sT = np.arange(30,80,5)
x=50; c=2; p=1
st... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.annotate",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((284, 304), 'numpy.arange', 'np.arange', (['(30)', '(80)', '(5)'], {}), '(30, 80, 5)\n', (293, 304), True, 'import numpy as np\n'), ((393, 409), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(-6)', '(20)'], {}), '(-6, 20)\n', (401, 409), True, 'import matplotlib.pyplot as plt\n'), ((410, 426), 'matplotlib.pyplot.xlim', 'p... |
#!/usr/bin/env python
import numpy as np
def convert_to_x4_q7_weights(weights):
[r, h, w, c] = weights.shape
weights = np.reshape(weights, (r, h*w*c))
num_of_rows = r
num_of_cols = h*w*c
new_weights = np.copy(weights)
new_weights = np.reshape(new_weights, (r*h*w*c))
counter = 0
for i ... | [
"numpy.random.randint",
"numpy.zeros",
"numpy.reshape",
"numpy.copy"
] | [((130, 165), 'numpy.reshape', 'np.reshape', (['weights', '(r, h * w * c)'], {}), '(weights, (r, h * w * c))\n', (140, 165), True, 'import numpy as np\n'), ((224, 240), 'numpy.copy', 'np.copy', (['weights'], {}), '(weights)\n', (231, 240), True, 'import numpy as np\n'), ((259, 297), 'numpy.reshape', 'np.reshape', (['ne... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.axes import Axes
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.lines import Line2D
from matplotlib.artist import *
from matplotlib.patches import *
from retina.core.py2 import *
from retina.core.calc_context import tracker_manager
class Layer... | [
"matplotlib.pyplot.xlim",
"numpy.abs",
"numpy.amin",
"matplotlib.lines.Line2D",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.vlines",
"numpy.argsort",
"numpy.amax",
"numpy.array",
"numpy.linspace",
"itertools.product",
"matplotlib.pyplot.hlines",
"retina.core.calc_context.tracker_manager",
... | [((4116, 4126), 'matplotlib.pyplot.ylim', 'plt.ylim', ([], {}), '()\n', (4124, 4126), True, 'import matplotlib.pyplot as plt\n'), ((4486, 4496), 'matplotlib.pyplot.xlim', 'plt.xlim', ([], {}), '()\n', (4494, 4496), True, 'import matplotlib.pyplot as plt\n'), ((10887, 10902), 'numpy.array', 'np.array', (['point'], {}), ... |
"""
MIT License
Copyright (c) 2019 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"sklearn.preprocessing.StandardScaler",
"numpy.abs",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"stratx.plot.plot_ice",
"stratx.plot_stratpd_gridsearch",
"stratx.plot.plot_catice",
"tensorflow.ke... | [((3016, 3038), 'pandas.isnull', 'pd.isnull', (['df[colname]'], {}), '(df[colname])\n', (3025, 3038), True, 'import pandas as pd\n'), ((3134, 3177), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {'pad': 'pad', 'w_pad': '(0)', 'h_pad': '(0)'}), '(pad=pad, w_pad=0, h_pad=0)\n', (3150, 3177), True, 'import ma... |
"""
This is a template script - an example of how a CEA script should be set up.
NOTE: ADD YOUR SCRIPT'S DOCUMENTATION HERE (what, why, include literature references)
"""
import math
import os
from typing import Union
import numpy as np
import osmnx.footprints
from geopandas import GeoDataFrame as Gdf
import pandas a... | [
"numpy.nanmedian",
"os.path.exists",
"math.floor",
"pandas.isnull",
"numpy.isnan",
"cea.datamanagement.constants.OSM_BUILDING_CATEGORIES.keys",
"cea.utilities.dbf.dataframe_to_dbf",
"cea.utilities.standardize_coordinates.get_geographic_coordinate_system",
"re.search"
] | [((10086, 10162), 'cea.utilities.dbf.dataframe_to_dbf', 'dataframe_to_dbf', (["typology_df[fields + ['REFERENCE']]", 'occupancy_output_path'], {}), "(typology_df[fields + ['REFERENCE']], occupancy_output_path)\n", (10102, 10162), False, 'from cea.utilities.dbf import dataframe_to_dbf\n'), ((15059, 15090), 'os.path.exis... |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics.classification import accuracy_score
from dbn.tensorflow import SupervisedDBNClassification
from keras.preprocessing.image import ImageDataGenerator
train_dir = 'E:\\Datasets\\bangla\\train'
test_dir = 'E:\\Datasets\\bangla\\... | [
"sklearn.metrics.classification.accuracy_score",
"keras.preprocessing.image.ImageDataGenerator",
"dbn.tensorflow.SupervisedDBNClassification",
"numpy.argmax"
] | [((344, 381), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255)'}), '(rescale=1.0 / 255)\n', (362, 381), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((394, 431), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'resca... |
import boto3
import numpy as np
import time
import matplotlib.pyplot as plt
# docker run -p 8000:8000 -v $(pwd)/local/dynamodb:/data/ amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath /data
def main():
dynamodb=boto3.client(
'dynamodb',
endpoint_url='http://localhost:8000',
aws... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"numpy.random.uniform",
"matplotlib.pyplot.show",
"boto3.client",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.cumsum",
"matplotlib.pyplot.figure",
"boto3.resource",
"numpy.arange",
"numpy.mean",
"numpy.histogram",
"time.time_ns",
... | [((229, 363), 'boto3.client', 'boto3.client', (['"""dynamodb"""'], {'endpoint_url': '"""http://localhost:8000"""', 'aws_access_key_id': '"""foo"""', 'aws_secret_access_key': '"""bar"""', 'verify': '(False)'}), "('dynamodb', endpoint_url='http://localhost:8000',\n aws_access_key_id='foo', aws_secret_access_key='bar',... |
""" Class Scenario
Creation date: 2018 11 05
Author(s): <NAME>
To do:
Move falls_into method to ScenarioCategory and rename it to "comprises".
Modifications:
2018 11 22: Make is possible to instantiate a Scenario from JSON code.
2018 12 06: Add functionality to return the derived Tags.
2018 12 06: Make it possible t... | [
"numpy.any",
"numpy.array",
"numpy.logical_and"
] | [((11534, 11550), 'numpy.array', 'np.array', (['[time]'], {}), '([time])\n', (11542, 11550), True, 'import numpy as np\n'), ((10548, 10600), 'numpy.logical_and', 'np.logical_and', (['(vec_time >= tstart)', '(vec_time <= tend)'], {}), '(vec_time >= tstart, vec_time <= tend)\n', (10562, 10600), True, 'import numpy as np\... |
# library of small functions
import json
import logging
import traceback
from pathlib import Path
import numpy as np
from ibllib.misc import version
_logger = logging.getLogger('ibllib')
def pprint(my_dict):
print(json.dumps(my_dict, indent=4))
def _parametrized(dec):
def layer(*args, **kwargs):
d... | [
"logging.FileHandler",
"numpy.dtype",
"numpy.zeros",
"logging.StreamHandler",
"json.dumps",
"ibllib.misc.version.ibllib",
"logging.Formatter",
"pathlib.Path",
"traceback.format_exc",
"colorlog.ColoredFormatter",
"logging.getLogger"
] | [((161, 188), 'logging.getLogger', 'logging.getLogger', (['"""ibllib"""'], {}), "('ibllib')\n", (178, 188), False, 'import logging\n'), ((1876, 1905), 'logging.FileHandler', 'logging.FileHandler', (['log_file'], {}), '(log_file)\n', (1895, 1905), False, 'import logging\n'), ((2788, 2834), 'numpy.dtype', 'np.dtype', (["... |
import os.path as osp
import glob
from datetime import datetime
from os import mkdir
from os import path
from sys import exit
import cv2
import numpy as np
import torch
from model.unet.model import UNet
from utils.image import show_images_side2side
import matplotlib.image as mpimg
def save_predictions_as_imgs(model,... | [
"os.mkdir",
"matplotlib.image.imread",
"utils.image.show_images_side2side",
"os.path.basename",
"cv2.imwrite",
"torch.load",
"os.path.exists",
"numpy.transpose",
"cv2.imread",
"torch.cuda.is_available",
"glob.glob",
"model.unet.model.UNet",
"torch.no_grad"
] | [((581, 604), 'glob.glob', 'glob.glob', (['image_folder'], {}), '(image_folder)\n', (590, 604), False, 'import glob\n'), ((494, 515), 'os.path.exists', 'path.exists', (['save_dir'], {}), '(save_dir)\n', (505, 515), False, 'from os import path\n'), ((525, 540), 'os.mkdir', 'mkdir', (['save_dir'], {}), '(save_dir)\n', (5... |
#####################################################################
# Sampling from a Biased Population #
# In this tutorial we will go over some code that recreates the #
# visualizations in the Interactive Sampling Distribution Demo. #
# This demo looks at a hypothetical prob... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"seaborn.histplot",
"matplotlib.pyplot.show",
"numpy.random.seed",
"numpy.empty",
"numpy.append",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.random.choice",
"seaborn.set"
] | [((894, 903), 'seaborn.set', 'sns.set', ([], {}), '()\n', (901, 903), True, 'import seaborn as sns\n'), ((1325, 1366), 'numpy.append', 'np.append', (['uofm_students', 'students_at_gym'], {}), '(uofm_students, students_at_gym)\n', (1334, 1366), True, 'import numpy as np\n'), ((1401, 1429), 'matplotlib.pyplot.figure', 'p... |
"""
Common test functions for optimizers.
Also see: https://en.wikipedia.org/wiki/Test_functions_for_optimization
"""
def rosenbrock(x, y):
"""
Rosenbrock function. Minimum: f(1, 1) = 0.
https://en.wikipedia.org/wiki/Rosenbrock_function
"""
return (1 - x) ** 2 + 100 * (y - x ** 2) ** 2
rosenbr... | [
"numpy.sum",
"math.cos",
"math.sqrt"
] | [((1595, 1609), 'numpy.sum', 'np.sum', (['(x ** 2)'], {}), '(x ** 2)\n', (1601, 1609), True, 'import numpy as np\n'), ((689, 718), 'math.sqrt', 'sqrt', (['(0.5 * (x ** 2 + y ** 2))'], {}), '(0.5 * (x ** 2 + y ** 2))\n', (693, 718), False, 'from math import sqrt, exp, cos, pi, e\n'), ((744, 759), 'math.cos', 'cos', (['(... |
from collections import defaultdict
import numpy as np
from irec.offline_experiments.metrics.base import Metric
class TopItemsMembership(Metric):
def __init__(self, items_feature_values, top_size, *args, **kwargs):
super().__init__(*args, **kwargs)
self.users_num_items_recommended = defaultdict(in... | [
"collections.defaultdict",
"numpy.argsort"
] | [((306, 322), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (317, 322), False, 'from collections import defaultdict\n'), ((371, 389), 'collections.defaultdict', 'defaultdict', (['float'], {}), '(float)\n', (382, 389), False, 'from collections import defaultdict\n'), ((509, 541), 'numpy.argsort', '... |
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
import numpy as np
import cv2
import os
# Load the face detector model
print("[INFO] Loading faces detector model...")
prototxtPath = os.... | [
"tensorflow.keras.models.load_model",
"cv2.putText",
"cv2.waitKey",
"cv2.cvtColor",
"tensorflow.keras.preprocessing.image.img_to_array",
"cv2.dnn.blobFromImage",
"numpy.expand_dims",
"cv2.dnn.readNet",
"cv2.imread",
"tensorflow.keras.applications.mobilenet_v2.preprocess_input",
"numpy.array",
... | [((317, 373), 'os.path.sep.join', 'os.path.sep.join', (["['trainer-model/face/deploy.prototxt']"], {}), "(['trainer-model/face/deploy.prototxt'])\n", (333, 373), False, 'import os\n'), ((388, 474), 'os.path.sep.join', 'os.path.sep.join', (["['trainer-model/face/res10_300x300_ssd_iter_140000.caffemodel']"], {}), "([\n ... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from scipy.stats import binom
from scipy import linalg
from scipy.sparse.linalg import expm_multiply
from scipy.sparse import csc_matrix
import math
import timeit
def hypercube(n_dim):
n = n_dim - 1
sigma_x = np.array([[0, 1],
... | [
"matplotlib.pyplot.xlim",
"numpy.conj",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.rc",
"numpy.arange",
"timeit.timeit",
"numpy.kron",
"numpy.eye"... | [((297, 323), 'numpy.array', 'np.array', (['[[0, 1], [1, 0]]'], {}), '([[0, 1], [1, 0]])\n', (305, 323), True, 'import numpy as np\n'), ((970, 981), 'numpy.zeros', 'np.zeros', (['P'], {}), '(P)\n', (978, 981), True, 'import numpy as np\n'), ((1028, 1070), 'scipy.sparse.linalg.expm_multiply', 'expm_multiply', (['(-1.0j ... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"go.replay_position",
"go.is_eyeish",
"go.PlayerMove",
"go.LibertyTracker.from_board",
"tests.test_utils.load_board",
"sgf_wrapper.replay_sgf",
"go.Position",
"numpy.zeros",
"coords.from_flat",
"coords.from_gtp"
] | [((778, 844), 'tests.test_utils.load_board', 'test_utils.load_board', (['("""\n.X.....OO\nX........\n""" + EMPTY_ROW * 7)'], {}), '("""\n.X.....OO\nX........\n""" + EMPTY_ROW * 7)\n', (799, 844), False, 'from tests import test_utils\n'), ((1720, 1741), 'coords.from_gtp', 'coords.from_gtp', (['"""A1"""'], {}), "('A1')\n... |
import panel as pn
import numpy as np
import holoviews as hv
LOGO = "https://panel.holoviz.org/_static/logo_horizontal.png"
def test_vanilla_with_sidebar():
"""Returns an app that uses the vanilla template in various ways.
Inspect the app and verify that the issues of [Issue 1641]\
(https://github.com/holoviz/p... | [
"panel.pane.Markdown",
"holoviews.DynamicMap",
"panel.widgets.Button",
"panel.widgets.FloatSlider",
"panel.extension",
"panel.template.VanillaTemplate",
"numpy.sin",
"panel.layout.HSpacer",
"numpy.linspace",
"numpy.cos",
"panel.depends"
] | [((591, 655), 'panel.template.VanillaTemplate', 'pn.template.VanillaTemplate', ([], {'title': '"""Vanilla Template"""', 'logo': 'LOGO'}), "(title='Vanilla Template', logo=LOGO)\n", (618, 655), True, 'import panel as pn\n'), ((689, 710), 'numpy.linspace', 'np.linspace', (['(0)', 'np.pi'], {}), '(0, np.pi)\n', (700, 710)... |
# Copyright (C) 2013 <NAME> and <NAME>
#
# This file is part of WESTPA.
#
# WESTPA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... | [
"westpa.rc.get_data_manager",
"westtools.tool_classes.selected_segs.AllSegmentSelection",
"numpy.array",
"collections.namedtuple",
"numpy.argwhere",
"collections.deque"
] | [((751, 795), 'collections.namedtuple', 'namedtuple', (['"""trajnode"""', "('n_iter', 'seg_id')"], {}), "('trajnode', ('n_iter', 'seg_id'))\n", (761, 795), False, 'from collections import namedtuple\n'), ((3799, 4155), 'numpy.array', 'numpy.array', (['[(1, 1, -1, -1, 1.0), (1, 11, -1, -1, 1.0), (2, 2, 1, 0, 1.0), (2, 3... |
import matplotlib.pyplot as plt
import numpy as np
from maxtree.component_tree import MaxTree
from scipy import misc
img_rgb = misc.face()
img = np.uint16(img_rgb[:,:,0])
# Example 1
mt = MaxTree(img) # compute the max tree
mt.compute_shape_attributes() # compute shape attributes
cc_areas = mt.getAttributes('area') #... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.hist",
"numpy.logical_and",
"matplotlib.pyplot.imshow",
"numpy.float32",
"maxtree.component_tree.MaxTree",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.uint16",
"scipy.misc... | [((128, 139), 'scipy.misc.face', 'misc.face', ([], {}), '()\n', (137, 139), False, 'from scipy import misc\n'), ((146, 173), 'numpy.uint16', 'np.uint16', (['img_rgb[:, :, 0]'], {}), '(img_rgb[:, :, 0])\n', (155, 173), True, 'import numpy as np\n'), ((190, 202), 'maxtree.component_tree.MaxTree', 'MaxTree', (['img'], {})... |
from .common import *
from .callbacks import *
from typing import Any
import torch
from torch.nn import functional as F
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None # default='warn'
class Learner():
def __init__(self, model, opt, loss_func, data, target_name:str, target_class... | [
"pandas.DataFrame",
"torch.cat",
"torch.exp",
"torch.Size",
"numpy.random.normal",
"torch.no_grad",
"torch.tensor"
] | [((3563, 3584), 'torch.exp', 'torch.exp', (['(logvar / 2)'], {}), '(logvar / 2)\n', (3572, 3584), False, 'import torch\n'), ((3933, 3970), 'pandas.DataFrame', 'pd.DataFrame', (['pred'], {'columns': 'self.cols'}), '(pred, columns=self.cols)\n', (3945, 3970), True, 'import pandas as pd\n'), ((2336, 2353), 'torch.tensor',... |
import os
import math
import numpy as np
import tensorflow as tf
from copy import deepcopy
from sklearn.model_selection import train_test_split
from Function.InnerFunction.model_function import load_share, save_share, load_train_data
from Function.InnerFunction.get_valid_tag_function import get_valid_tag
from Function... | [
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"tensorflow.matmul",
"tensorflow.nn.conv2d",
"tensorflow.reduce_max",
"tensorflow.split",
"os.path.join",
"tensorflow.get_variable",
"tensorflow.nn.softmax",
"Function.InnerFunction.get_valid_tag_function.get_valid_tag",
"os.path.exists... | [((403, 429), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (419, 429), False, 'import os\n'), ((592, 602), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (600, 602), True, 'import tensorflow as tf\n'), ((1950, 1971), 'Function.InnerFunction.kor2eng_function.kor2eng', 'kor2eng', (['self... |
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
# 부모 클래스 - 자식 클래스가 가질 공통적인 속성, 메소드 선언
class Optimizer :
def __init__(self, point, iter_num, small_lr, proper_lr, large_lr):
'''
초기화
:param point: 현재 위치 : numpy array
:param iter_num: 최적화 횟수 : int... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.clabel",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.zeros_like",
"matplotlib.pyplot.legend",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"numpy.array... | [((4962, 4983), 'numpy.array', 'np.array', (['[-7.0, 2.0]'], {}), '([-7.0, 2.0])\n', (4970, 4983), True, 'import numpy as np\n'), ((5579, 5606), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16, 6)'}), '(figsize=(16, 6))\n', (5589, 5606), True, 'import matplotlib.pyplot as plt\n'), ((6346, 6356), 'matplo... |
"""
audio_recognize.py
This file contains the basic functions used for audio clustering and recognition
Maintainer: <NAME> {<EMAIL>}
"""
# -*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import KMeans, AgglomerativeClustering, Birch, MiniBatchKMeans, estimate_bandwidth
from sklearn.svm import SVR
from ... | [
"sklearn.cluster.MiniBatchKMeans",
"sklearn.preprocessing.StandardScaler",
"numpy.abs",
"numpy.argmax",
"sklearn.mixture.GaussianMixture",
"numpy.argmin",
"numpy.mean",
"torch.device",
"torch.no_grad",
"sklearn.metrics.davies_bouldin_score",
"numpy.unique",
"torch.utils.data.DataLoader",
"nu... | [((1043, 1065), 'sklearn.metrics.silhouette_score', 'silhouette_score', (['X', 'y'], {}), '(X, y)\n', (1059, 1065), False, 'from sklearn.metrics import silhouette_samples, silhouette_score, calinski_harabasz_score, davies_bouldin_score\n'), ((1081, 1110), 'sklearn.metrics.calinski_harabasz_score', 'calinski_harabasz_sc... |
import os
import numpy as np
import pickle
from hips.plotting.layout import create_figure
from hips.plotting.colormaps import gradient_cmap
import matplotlib.pyplot as plt
import brewer2mpl
from scipy.misc import logsumexp
from spclust import find_blockifying_perm
colors = brewer2mpl.get_map("Set1", "Qualitative", ... | [
"matplotlib.pyplot.title",
"numpy.argmax",
"numpy.ones",
"numpy.clip",
"numpy.argsort",
"hips.plotting.layout.create_legend_figure",
"pickle.load",
"brewer2mpl.get_map",
"numpy.diag",
"os.path.join",
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.colorbar",
... | [((347, 378), 'numpy.array', 'np.array', (['[0, 1, 2, 4, 6, 7, 8]'], {}), '([0, 1, 2, 4, 6, 7, 8])\n', (355, 378), True, 'import numpy as np\n'), ((277, 321), 'brewer2mpl.get_map', 'brewer2mpl.get_map', (['"""Set1"""', '"""Qualitative"""', '(9)'], {}), "('Set1', 'Qualitative', 9)\n", (295, 321), False, 'import brewer2m... |
# coding=utf-8
# Copyright (c) DIRECT Contributors
import logging
import numpy as np
import torch
import os
import sys
import pathlib
import functools
from direct.common.subsample import build_masking_function
from direct.data.mri_transforms import build_mri_transforms
from direct.data.datasets import build_dataset_f... | [
"direct.utils.set_all_seeds",
"direct.environment.Args",
"numpy.clip",
"collections.defaultdict",
"torch.set_num_threads",
"direct.launch.launch",
"direct.common.subsample.build_masking_function",
"direct.utils.io.read_json",
"direct.data.datasets.build_dataset_from_input",
"direct.data.lr_schedul... | [((694, 721), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (711, 721), False, 'import logging\n'), ((850, 867), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (861, 867), False, 'from collections import defaultdict\n'), ((3559, 3681), 'direct.environment.setup_tra... |
#!/usr/bin/python3
import argparse, hashlib, json, logging, os, sys
import numpy as np
import torch
# local imports
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib.data import *
from lib.utils import *
def parse_arguments():
arg_parser = argparse.ArgumentParser(description='Universal Depend... | [
"torch.mean",
"argparse.ArgumentParser",
"torch.sum",
"os.path.dirname",
"transformers.AutoModel.from_pretrained",
"logging.info",
"transformers.AutoTokenizer.from_pretrained",
"torch.cuda.is_available",
"sys.stdout.flush",
"numpy.array",
"torch.device",
"torch.no_grad",
"os.path.join"
] | [((267, 356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Universal Dependencies - Contextual Embedding"""'}), "(description=\n 'Universal Dependencies - Contextual Embedding')\n", (290, 356), False, 'import argparse, hashlib, json, logging, os, sys\n'), ((2817, 2947), 'logging.inf... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | [
"unittest.main",
"numpy.abs",
"numpy.exp",
"numpy.linspace",
"federatedml.optim.activation.sigmoid"
] | [((1139, 1154), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1152, 1154), False, 'import unittest\n'), ((854, 883), 'numpy.linspace', 'np.linspace', (['(-709)', '(709)', '(10000)'], {}), '(-709, 709, 10000)\n', (865, 883), True, 'import numpy as np\n'), ((1032, 1053), 'federatedml.optim.activation.sigmoid', 'ac... |
from numpy import *
from pyboltz.basis import get_basis
import numpy as np
import h5py
from matplotlib.pyplot import *
from eigenhdf import load_sparse_h5
spectral_basis = get_basis()
S = np.matrix(spectral_basis.make_mass_matrix())
Sinv = np.matrix(diag(1/diag(S)))
matrices = []
with h5py.File('p2h.hdf5', 'r') as fh5... | [
"h5py.File",
"pyboltz.basis.get_basis",
"numpy.zeros",
"numpy.dtype",
"numpy.cumsum",
"numpy.array",
"eigenhdf.load_sparse_h5"
] | [((173, 184), 'pyboltz.basis.get_basis', 'get_basis', ([], {}), '()\n', (182, 184), False, 'from pyboltz.basis import get_basis\n'), ((287, 313), 'h5py.File', 'h5py.File', (['"""p2h.hdf5"""', '"""r"""'], {}), "('p2h.hdf5', 'r')\n", (296, 313), False, 'import h5py\n'), ((775, 791), 'numpy.zeros', 'np.zeros', (['(n, n)']... |
"""
Additional functions and demos for Burgers' equation.
"""
import sys, os
from clawpack import pyclaw
from clawpack import riemann
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
from utils import riemann_tools
from . import burgers
def multivalued_solution(t,fi... | [
"matplotlib.pyplot.title",
"numpy.abs",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.exp",
"clawpack.pyclaw.Domain",
"matplotlib.pyplot.arrow",
"numpy.meshgrid",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"clawpack.pyclaw.ClawSolver1D",
"matplotlib.pyplot... | [((457, 484), 'numpy.arange', 'np.arange', (['(-11.0)', '(11.0)', '(0.1)'], {}), '(-11.0, 11.0, 0.1)\n', (466, 484), True, 'import numpy as np\n'), ((491, 510), 'numpy.exp', 'np.exp', (['(-x * x / 10)'], {}), '(-x * x / 10)\n', (497, 510), True, 'import numpy as np\n'), ((544, 592), 'matplotlib.pyplot.plot', 'plt.plot'... |
import json
import cv2
import numpy as np
import os
import sys
sys.path.append('../')
import Rect
#input original image and page bbox, output ROI (text region) bbox
def ExpandCol(rect,n):
#scale width by n
rect = [list(rect[0]), list(rect[1]), rect[2]]
if rect[1][0] > rect[1][1]:
rect[1][1] = rec... | [
"sys.path.append",
"json.dump",
"json.load",
"numpy.deg2rad",
"os.path.join"
] | [((63, 85), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (78, 85), False, 'import sys\n'), ((1135, 1150), 'json.load', 'json.load', (['file'], {}), '(file)\n', (1144, 1150), False, 'import json\n'), ((1272, 1296), 'json.dump', 'json.dump', (['rect', 'outfile'], {}), '(rect, outfile)\n', (1281... |
import quantities as pq
import numpy as np
def poisson_continuity_correction(n, observed):
"""
n : array
Likelihood to observe n or more events
observed : array
Rate of Poisson process
References
----------
<NAME>., & <NAME>. (2009). Unbiased estimation of precise temporal
c... | [
"numpy.sum",
"numpy.zeros",
"numpy.searchsorted",
"scipy.signal.gaussian",
"scipy.stats.poisson.pmf",
"numpy.nonzero",
"numpy.sort",
"numpy.max",
"numpy.where",
"numpy.arange",
"numpy.histogram",
"numpy.array",
"scipy.signal.fftconvolve",
"numpy.all",
"numpy.repeat"
] | [((531, 545), 'numpy.all', 'np.all', (['(n >= 0)'], {}), '(n >= 0)\n', (537, 545), True, 'import numpy as np\n'), ((559, 576), 'numpy.zeros', 'np.zeros', (['n.shape'], {}), '(n.shape)\n', (567, 576), True, 'import numpy as np\n'), ((2340, 2389), 'scipy.signal.fftconvolve', 'scs.fftconvolve', (['cch_padded', 'kernel'], ... |
# ==============================================================================
# This file is part of the SPNC project under the Apache License v2.0 by the
# Embedded Systems and Applications Group, TU Darmstadt.
# For the full copyright and license information, please view the LICENSE
# file that was distributed... | [
"spnc.gpu.CUDACompiler.isAvailable",
"spnc.gpu.CUDACompiler",
"numpy.isclose",
"numpy.random.randint",
"spn.algorithms.Inference.log_likelihood",
"numpy.exp",
"spn.structure.leaves.parametric.Parametric.Categorical",
"numpy.random.choice",
"spn.structure.Base.Product"
] | [((858, 899), 'spn.structure.leaves.parametric.Parametric.Categorical', 'Categorical', ([], {'p': '[0.35, 0.55, 0.1]', 'scope': '(0)'}), '(p=[0.35, 0.55, 0.1], scope=0)\n', (869, 899), False, 'from spn.structure.leaves.parametric.Parametric import Categorical\n'), ((909, 953), 'spn.structure.leaves.parametric.Parametri... |
'''
torch = 0.41
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import gym
import time
##################### hyper parameters ####################
MAX_EPISODES = 200
MAX_EP_STEPS = 200
LR_A = 0.001 # learning rate for actor
LR_C = 0.002 # learning rate for critic
GA... | [
"torch.mean",
"numpy.random.choice",
"torch.nn.MSELoss",
"gym.make",
"numpy.zeros",
"torch.FloatTensor",
"time.time",
"numpy.hstack",
"numpy.random.normal",
"torch.nn.Linear",
"torch.nn.functional.relu",
"torch.nn.functional.tanh"
] | [((4547, 4565), 'gym.make', 'gym.make', (['ENV_NAME'], {}), '(ENV_NAME)\n', (4555, 4565), False, 'import gym\n'), ((4776, 4787), 'time.time', 'time.time', ([], {}), '()\n', (4785, 4787), False, 'import time\n'), ((682, 702), 'torch.nn.Linear', 'nn.Linear', (['s_dim', '(30)'], {}), '(s_dim, 30)\n', (691, 702), True, 'im... |
################################################################################
# skforecast #
# #
# This work by <NAME> is licensed under a Creative Commons #
# Attribut... | [
"numpy.full",
"logging.basicConfig",
"sklearn.multioutput.MultiOutputRegressor",
"numpy.hstack",
"numpy.arange",
"numpy.array",
"numpy.column_stack",
"warnings.warn",
"numpy.vstack"
] | [((840, 953), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)-5s %(name)-10s %(levelname)-5s %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)-5s %(name)-10s %(levelname)-5s %(message)s', level=logging.INFO\n )\n", (859, 953), False, 'import logging\n'), ((3764, 3795... |
import unittest
from unittest.mock import Mock, patch
import numpy as np
import numpy.typing as npt
from nuplan.common.actor_state.state_representation import Point2D, StateSE2
from nuplan.common.geometry.transform import (
rotate,
rotate_2d,
rotate_angle,
transform,
translate,
translate_later... | [
"unittest.main",
"nuplan.common.actor_state.state_representation.StateSE2",
"nuplan.common.geometry.transform.rotate_2d",
"unittest.mock.patch",
"nuplan.common.actor_state.state_representation.Point2D",
"nuplan.common.geometry.transform.transform",
"numpy.array",
"nuplan.common.geometry.transform.tran... | [((2672, 2723), 'unittest.mock.patch', 'patch', (['"""nuplan.common.geometry.transform.translate"""'], {}), "('nuplan.common.geometry.transform.translate')\n", (2677, 2723), False, 'from unittest.mock import Mock, patch\n'), ((3177, 3228), 'unittest.mock.patch', 'patch', (['"""nuplan.common.geometry.transform.translate... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Predict with Mars in R/rpy2
MARS: Multivariate Adaptive Regression Splines
"""
import rpy2
import rpy2.robjects as ro
import rpy2.rinterface as ri
import numpy as np
import pandas as pd
from rpy2.robjects.packages import importr
from rpy2.robjects import pandas2ri
pan... | [
"rpy2.robjects.packages.importr",
"rpy2.robjects.pandas2ri.activate",
"rpy2.robjects.pandas2ri.py2rpy_pandasdataframe",
"numpy.array",
"rpy2.robjects.FloatVector"
] | [((317, 337), 'rpy2.robjects.pandas2ri.activate', 'pandas2ri.activate', ([], {}), '()\n', (335, 337), False, 'from rpy2.robjects import pandas2ri\n'), ((377, 391), 'rpy2.robjects.packages.importr', 'importr', (['"""mda"""'], {}), "('mda')\n", (384, 391), False, 'from rpy2.robjects.packages import importr\n'), ((1805, 1... |
"""
Created on Tue Jul 21 2020
@author: TheDrDOS
Interface with COVID, population, and location data from various sources
"""
# For updating git
import os
# For data processing
import pandas as pd
import numpy as np
import progress_bar as pbar
import hashlib
import json
import multiprocessing as mp
from time imp... | [
"progress_bar.progress_bar",
"numpy.nan_to_num",
"pandas.read_csv",
"time.perf_counter",
"os.system",
"time.time",
"json.dumps",
"pandas.to_datetime",
"gzip.GzipFile",
"multiprocessing.Pool",
"multiprocessing.cpu_count"
] | [((393, 398), 'time.time', 'now', ([], {}), '()\n', (396, 398), True, 'from time import time as now\n'), ((831, 837), 'time.perf_counter', 'pnow', ([], {}), '()\n', (835, 837), True, 'from time import perf_counter as pnow\n'), ((965, 981), 'pandas.read_csv', 'pd.read_csv', (['src'], {}), '(src)\n', (976, 981), True, 'i... |
__copyright__ = "Copyright (C) 2009-2013 <NAME>"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify... | [
"matplotlib.pyplot.show",
"modepy.tools.Monomial",
"modepy.quadrature.jacobi_gauss.LegendreGaussQuadrature",
"matplotlib.pyplot.plot",
"modepy.quadrature.clenshaw_curtis.FejerQuadrature",
"pytools.generate_nonnegative_integer_tuples_summing_to_at_most",
"modepy.quadrature.clenshaw_curtis.ClenshawCurtisQ... | [((1176, 1203), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1193, 1203), False, 'import logging\n'), ((1909, 1953), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""backend"""', 'BACKENDS'], {}), "('backend', BACKENDS)\n", (1932, 1953), False, 'import pytest\n'), ((2901, 29... |
# Copyright 2018 The Lucid 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 applicable l... | [
"lucid.misc.io.load",
"numpy.flip",
"tensorflow.reverse",
"tensorflow.get_default_graph",
"tensorflow.placeholder",
"lucid.modelzoo.util.load_graphdef",
"numpy.array",
"lucid.misc.io.showing.graph",
"lucid.modelzoo.util.load_text_labels",
"tensorflow.import_graph_def",
"lucid.modelzoo.util.forge... | [((978, 1014), 'numpy.array', 'np.array', (['[123.68, 116.779, 103.939]'], {}), '([123.68, 116.779, 103.939])\n', (986, 1014), True, 'import numpy as np\n'), ((1035, 1060), 'numpy.flip', 'np.flip', (['IMAGENET_MEAN', '(0)'], {}), '(IMAGENET_MEAN, 0)\n', (1042, 1060), True, 'import numpy as np\n'), ((1433, 1463), 'lucid... |
'''
created on Mar 13, 2018
@author: <NAME> (t-shsu)
'''
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn.utils import clip_grad_norm
import torch.optim as optim
import numpy as np
import random
from deep_dialog import dialog_config
use_cuda = torch.cuda.is_available()
class Discri... | [
"torch.ones",
"torch.nn.BCELoss",
"random.sample",
"torch.autograd.Variable",
"numpy.zeros",
"torch.FloatTensor",
"numpy.hstack",
"torch.nn.ELU",
"numpy.mean",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.LSTM",
"torch.optim.RMSprop",
"torch.nn.Sigmoid"
] | [((281, 306), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (304, 306), False, 'import torch\n'), ((2722, 2734), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (2732, 2734), True, 'import torch.nn as nn\n'), ((5394, 5446), 'random.sample', 'random.sample', (['self.user_experience_pool', '... |
# Copyright (c) 2020, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the follow... | [
"finn.transformation.infer_shapes.InferShapes",
"finn.util.pytorch.NormalizePreProc",
"finn.core.onnx_exec.execute_onnx",
"finn.transformation.merge_onnx_models.MergeONNXModels",
"finn.transformation.general.GiveUniqueNodeNames",
"numpy.argsort",
"finn.util.imagenet.get_val_images",
"torchvision.trans... | [((2935, 2979), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': 'mean', 'std': 'std_arr'}), '(mean=mean, std=std_arr)\n', (2955, 2979), True, 'import torchvision.transforms as transforms\n'), ((3529, 3560), 'finn.util.pytorch.NormalizePreProc', 'NormalizePreProc', (['mean', 'std', 'ch'], {}), ... |
class node():
def __init__(self, state, parent, action, g_cost, depth, h_cost, x, y, move, check):
self.state = state
self.parent = parent
self.action = action
self.g_cost = g_cost
self.depth = depth
self.h_cost = h_cost
self.x=x
self.y=y
self.... | [
"matplotlib.pyplot.title",
"copy.deepcopy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"math.sqrt",
"matplotlib.pyplot.legend",
"time.time",
"queue.PriorityQueue",
"numpy.array",
"collections.ChainMap",
"matplotlib.pyplot.ylabel",
"matplotlib.patches.Patch",
"matplotlib.pyplot.xlabe... | [((2161, 2193), 'matplotlib.pyplot.plot', 'plt.plot', (['BFS_depth'], {'color': '"""red"""'}), "(BFS_depth, color='red')\n", (2169, 2193), True, 'import matplotlib.pyplot as plt\n'), ((2195, 2229), 'matplotlib.pyplot.plot', 'plt.plot', (['UCS_depth'], {'color': '"""green"""'}), "(UCS_depth, color='green')\n", (2203, 22... |
# -*- encoding: utf-8 -*-
def run_readdata(filedir):
from glob import glob
import nibabel as ni
import numpy as np
import dtimp as DTII
file_DTI = filedir+"diffusion.nii.gz"
file_T1 = filedir+"t1.nii.gz"
file_mask = glob('{}/*.tag'.format(filedir))[0]
file_bet = filedir+"nodif_brain_ma... | [
"dtimp.createMaskSegmentationOriginal",
"nibabel.load",
"dtimp.getFissureSlice",
"dtimp.getFractionalAnisotropy",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.isnan",
"numpy.ones",
"numpy.linalg.inv",
"numpy.dot",
"numpy.diag",
"dtimp.loadNiftiDTI"
] | [((715, 736), 'numpy.diag', 'np.diag', (['[1, 1, 2, 1]'], {}), '([1, 1, 2, 1])\n', (722, 736), True, 'import numpy as np\n'), ((742, 758), 'numpy.dot', 'np.dot', (['T', 'scale'], {}), '(T, scale)\n', (748, 758), True, 'import numpy as np\n'), ((826, 867), 'dtimp.loadNiftiDTI', 'DTII.loadNiftiDTI', (['filedir'], {'reori... |
"""Tensorflow clustering"""
import tensorflow as tf
from tensorflow.contrib.factorization import KMEANS_PLUS_PLUS_INIT
__author__ = "<NAME> (http://www.vmusco.com)"
from numpy.core.tests.test_mem_overlap import xrange
from tensorflow.python.framework import constant_op
from mlperf.clustering import clusteringtoolkit... | [
"tensorflow.convert_to_tensor",
"tensorflow.contrib.factorization.KMeansClustering",
"tensorflow.set_random_seed",
"numpy.core.tests.test_mem_overlap.xrange",
"tensorflow.contrib.factorization.GMM"
] | [((666, 688), 'numpy.core.tests.test_mem_overlap.xrange', 'xrange', (['num_iterations'], {}), '(num_iterations)\n', (672, 688), False, 'from numpy.core.tests.test_mem_overlap import xrange\n'), ((1987, 2115), 'tensorflow.contrib.factorization.KMeansClustering', 'tf.contrib.factorization.KMeansClustering', ([], {'num_cl... |
__author__ = 'rvuine'
import math
from abc import ABCMeta, abstractmethod
class StepOperator(metaclass=ABCMeta):
"""
A step operator will be executed once per net step on all nodes.
"""
@property
@abstractmethod
def priority(self):
"""
Returns a numerical priority value used ... | [
"math.copysign",
"math.exp",
"numpy.sum"
] | [((9408, 9421), 'numpy.sum', 'np.sum', (['value'], {}), '(value)\n', (9414, 9421), True, 'import numpy as np\n'), ((6638, 6668), 'math.copysign', 'math.copysign', (['(1)', 'emo_pleasure'], {}), '(1, emo_pleasure)\n', (6651, 6668), False, 'import math\n'), ((6672, 6713), 'math.copysign', 'math.copysign', (['(1)', 'emo_s... |
import argparse
import copy
import json
import pickle
import pprint
import os
import sys
from tqdm import tqdm
from typing import *
from my_pybullet_envs import utils
import numpy as np
import torch
import math
import my_pybullet_envs
from system import policy, openrave
import pybullet as p
import time
import inspe... | [
"my_pybullet_envs.utils.create_table",
"my_pybullet_envs.inmoov_shadow_hand_v2.InmoovShadowNew",
"my_pybullet_envs.inmoov_shadow_demo_env_v4.InmoovShadowHandDemoEnvV4",
"numpy.random.seed",
"argparse.ArgumentParser",
"pybullet.resetSimulation",
"my_pybullet_envs.utils.perturb",
"numpy.clip",
"numpy.... | [((690, 713), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (708, 713), False, 'import os\n'), ((1017, 1049), 'sys.path.append', 'sys.path.append', (['"""a2c_ppo_acktr"""'], {}), "('a2c_ppo_acktr')\n", (1032, 1049), False, 'import sys\n'), ((1059, 1100), 'argparse.ArgumentParser', 'argparse.... |
"""
Plotting routines for visualizing chemical diversity of datasets
"""
import os
import sys
import pandas as pd
import numpy as np
import seaborn as sns
import umap
from scipy.stats.kde import gaussian_kde
from scipy.cluster.hierarchy import linkage
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.b... | [
"argparse.Namespace",
"matplotlib.backends.backend_pdf.PdfPages",
"matplotlib.rc",
"atomsci.ddm.utils.struct_utils.base_mol_from_smiles",
"pandas.read_csv",
"scipy.cluster.hierarchy.linkage",
"atomsci.ddm.utils.datastore_functions.config_client",
"rdkit.Chem.MolToSmiles",
"atomsci.ddm.pipeline.model... | [((859, 895), 'matplotlib.rc', 'matplotlib.rc', (['"""xtick"""'], {'labelsize': '(12)'}), "('xtick', labelsize=12)\n", (872, 895), False, 'import matplotlib\n'), ((896, 932), 'matplotlib.rc', 'matplotlib.rc', (['"""ytick"""'], {'labelsize': '(12)'}), "('ytick', labelsize=12)\n", (909, 932), False, 'import matplotlib\n'... |
# coding: utf-8
# Copyright 2018 <NAME>
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import importlib
import numpy
import torch
import pytest
def make_arg(**kwargs):
defaults = dict(
elayers_sd=1,
elayers=2,
subsample="1_2_2_1_1",
etype="vggblstmp"... | [
"argparse.Namespace",
"torch.ones",
"torch.mean",
"numpy.random.seed",
"importlib.import_module",
"numpy.random.randn",
"torch.equal",
"pytest.mark.parametrize",
"torch.tensor"
] | [((1225, 1479), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('etype', 'dtype', 'num_spkrs', 'spa', 'm_str', 'text_idx1')", "[('vggblstmp', 'lstm', 2, True, 'espnet.nets.pytorch_backend.e2e_asr_mix', \n 0), ('vggbgrup', 'gru', 2, True,\n 'espnet.nets.pytorch_backend.e2e_asr_mix', 1)]"], {}), "(('etype... |
import os
from pathlib import Path
from tempfile import tempdir
import numpy as np
import pytest
from numpy.testing import assert_allclose, assert_almost_equal
from ross.disk_element import DiskElement, DiskElement6DoF
from ross.materials import steel
@pytest.fixture
def disk():
return DiskElement(0, 0.07, 0.05... | [
"ross.disk_element.DiskElement6DoF.from_table",
"ross.disk_element.DiskElement.load",
"ross.disk_element.DiskElement.from_geometry",
"ross.disk_element.DiskElement6DoF.from_geometry",
"numpy.testing.assert_almost_equal",
"os.path.realpath",
"ross.disk_element.DiskElement",
"ross.disk_element.DiskEleme... | [((295, 330), 'ross.disk_element.DiskElement', 'DiskElement', (['(0)', '(0.07)', '(0.05)', '(0.32956)'], {}), '(0, 0.07, 0.05, 0.32956)\n', (306, 330), False, 'from ross.disk_element import DiskElement, DiskElement6DoF\n'), ((594, 701), 'numpy.array', 'np.array', (['[[0.07, 0.0, 0.0, 0.0], [0.0, 0.07, 0.0, 0.0], [0.0, ... |
import numpy as np
import cv2 as cv
import numba
from numba import jit
from skimage.measure import regionprops
def draw_boxes(image, labels):
props = regionprops(labels)
for prop in props:
cv_coords = np.flip(prop.coords, 1)
rect = cv.minAreaRect(cv_coords)
box = cv.boxPoints(rect)
... | [
"cv2.boxPoints",
"cv2.minAreaRect",
"cv2.imshow",
"skimage.measure.regionprops",
"cv2.cvtColor",
"numpy.max",
"cv2.split",
"cv2.drawContours",
"cv2.destroyAllWindows",
"numpy.dstack",
"numpy.int0",
"numpy.ones_like",
"cv2.waitKey",
"numpy.hstack",
"cv2.merge",
"cv2.add",
"numpy.vstac... | [((1530, 1548), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (1533, 1548), False, 'from numba import jit\n'), ((156, 175), 'skimage.measure.regionprops', 'regionprops', (['labels'], {}), '(labels)\n', (167, 175), False, 'from skimage.measure import regionprops\n'), ((456, 471), 'cv2.split', 'c... |
from pyaudio import PyAudio, paInt16
import wave
# set up loggers
import logging
logging.basicConfig()
logger = logging.getLogger(name=__name__)
# only show errors or warnings until userdefine log level is set up
logger.setLevel(logging.INFO)
try:
import numpy as np
except:
logger.warning(
"Could not l... | [
"wave.open",
"unittest.mock.MagicMock",
"logging.basicConfig",
"time.sleep",
"numpy.sin",
"numpy.linspace",
"pyaudio.PyAudio",
"logging.getLogger"
] | [((81, 102), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (100, 102), False, 'import logging\n'), ((112, 144), 'logging.getLogger', 'logging.getLogger', ([], {'name': '__name__'}), '(name=__name__)\n', (129, 144), False, 'import logging\n'), ((505, 514), 'pyaudio.PyAudio', 'PyAudio', ([], {}), '()\n'... |
import itertools
import json
import os
import numpy as np
import pybullet as p
from bddl.object_taxonomy import ObjectTaxonomy
from pynput import keyboard
import igibson
from igibson.objects.articulated_object import URDFObject
from igibson.objects.visual_marker import VisualMarker
from igibson.scenes.empty_scene imp... | [
"igibson.utils.assets_utils.download_assets",
"pybullet.getQuaternionFromEuler",
"json.dump",
"json.load",
"pynput.keyboard.Events",
"os.path.basename",
"numpy.deg2rad",
"bddl.object_taxonomy.ObjectTaxonomy",
"igibson.simulator.Simulator",
"numpy.array",
"itertools.product",
"pybullet.getEuler... | [((431, 448), 'igibson.utils.assets_utils.download_assets', 'download_assets', ([], {}), '()\n', (446, 448), False, 'from igibson.utils.assets_utils import download_assets\n'), ((838, 854), 'bddl.object_taxonomy.ObjectTaxonomy', 'ObjectTaxonomy', ([], {}), '()\n', (852, 854), False, 'from bddl.object_taxonomy import Ob... |
import cv2
import numpy as np
BLUE_RGB = (255, 0, 0)
WHITE_RGB = (255, 255, 255)
def create_mask(img):
lower_color = np.array([0, 0, 0], np.uint8)
upper_color = np.array([200, 255, 200], np.uint8)
# Get an Histogram based on the color saturation of the image
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV... | [
"cv2.contourArea",
"cv2.circle",
"cv2.bitwise_and",
"cv2.cvtColor",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.moments",
"cv2.imshow",
"numpy.ones",
"numpy.array",
"cv2.rectangle",
"cv2.erode",
"cv2.boundingRect",
"cv2.inRange",
"cv2.findContours"
] | [((124, 153), 'numpy.array', 'np.array', (['[0, 0, 0]', 'np.uint8'], {}), '([0, 0, 0], np.uint8)\n', (132, 153), True, 'import numpy as np\n'), ((172, 207), 'numpy.array', 'np.array', (['[200, 255, 200]', 'np.uint8'], {}), '([200, 255, 200], np.uint8)\n', (180, 207), True, 'import numpy as np\n'), ((285, 321), 'cv2.cvt... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 7 12:43:38 2022
@author: Paul
"""
import pandas as pd
import chemcoord as cc
import os
import numpy as np
from scipy.constants import Planck
from scipy.spatial.transform import Rotation as R
def anglebetweenvec (vec1, vec2):
vec1 = vec1/np.linalg.norm(vec1)
vec2... | [
"chemcoord.Cartesian.read_xyz",
"numpy.set_printoptions",
"numpy.sum",
"os.getcwd",
"numpy.cross",
"numpy.identity",
"pandas.read_excel",
"numpy.shape",
"numpy.where",
"numpy.array",
"numpy.linalg.norm",
"scipy.spatial.transform.Rotation.from_matrix",
"numpy.dot",
"numpy.round",
"os.chdi... | [((696, 732), 'pandas.read_excel', 'pd.read_excel', (['"""NMR_freq_table.xlsx"""'], {}), "('NMR_freq_table.xlsx')\n", (709, 732), True, 'import pandas as pd\n'), ((834, 845), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (843, 845), False, 'import os\n'), ((856, 883), 'os.chdir', 'os.chdir', (['"""amino_acids_xyz"""'], {... |
# Author: <NAME> <<EMAIL>>
"""
Calculate Segmentation metrics:
- GlobalAccuracy
- MeanAccuracy
- Mean MeanIoU
"""
import numpy as np
from data_io import imread
def cal_semantic_metrics(pred_list, gt_list, thresh_step=0.01, num_cls=2):
final_accuracy_all = []
for thresh in np.arange(0.0, 1.0, thresh_step)... | [
"numpy.arange",
"numpy.sum"
] | [((288, 320), 'numpy.arange', 'np.arange', (['(0.0)', '(1.0)', 'thresh_step'], {}), '(0.0, 1.0, thresh_step)\n', (297, 320), True, 'import numpy as np\n'), ((1662, 1680), 'numpy.sum', 'np.sum', (['(pred == gt)'], {}), '(pred == gt)\n', (1668, 1680), True, 'import numpy as np\n'), ((1853, 1884), 'numpy.sum', 'np.sum', (... |
import structured_map_ranking_loss
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from confidnet.utils import misc
class SelfConfidMSELoss(nn.modules.loss._Loss):
def __init__(self, config_args, device):
self.nb_classes = config_args["data"]["num_classes"]
s... | [
"torch.mean",
"torch.ones_like",
"structured_map_ranking_loss.backward",
"torch.nn.BCEWithLogitsLoss",
"torch.log",
"torch.nn.functional.softmax",
"torch.nn.NLLLoss",
"torch.exp",
"torch.sigmoid",
"torch.clamp",
"confidnet.utils.misc.one_hot_embedding",
"numpy.exp",
"torch.abs",
"structure... | [((544, 570), 'torch.nn.functional.softmax', 'F.softmax', (['input[0]'], {'dim': '(1)'}), '(input[0], dim=1)\n', (553, 570), True, 'import torch.nn.functional as F\n'), ((1119, 1135), 'torch.mean', 'torch.mean', (['loss'], {}), '(loss)\n', (1129, 1135), False, 'import torch\n'), ((1769, 1795), 'torch.nn.functional.soft... |
"""
dynophores.tests.fixures
Fixures to be used in unit testing.
"""
from pathlib import Path
import pytest
import numpy as np
from dynophores import Dynophore, SuperFeature, EnvPartner, ChemicalFeatureCloud3D
PATH_TEST_DATA = Path(__name__).parent / "dynophores" / "tests" / "data"
@pytest.fixture(scope="module"... | [
"dynophores.EnvPartner",
"dynophores.Dynophore.from_dir",
"pytest.fixture",
"pathlib.Path",
"numpy.array",
"dynophores.ChemicalFeatureCloud3D",
"dynophores.SuperFeature"
] | [((291, 321), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (305, 321), False, 'import pytest\n'), ((699, 729), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (713, 729), False, 'import pytest\n'), ((1010, 1040), 'pytest.fixture', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.