code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# -------------------------------------------------------------------... | [
"InnerEye.Common.common_util.MetricsDataframeLoggers",
"torch.nn.ConvTranspose3d",
"InnerEye.ML.config.SegmentationModelBase",
"numpy.isnan",
"torch.cuda.device_count",
"pytest.mark.skipif",
"pytest.mark.parametrize",
"InnerEye.ML.utils.model_util.ModelAndInfo",
"torch.nn.Conv3d",
"InnerEye.ML.dee... | [((2985, 3050), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value_to_insert"""', '[1.0, np.NaN, np.Inf]'], {}), "('value_to_insert', [1.0, np.NaN, np.Inf])\n", (3008, 3050), False, 'import pytest\n'), ((3052, 3110), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""in_training_mode"""', '[True... |
# generate overexposure samples from clear images
# author: @LucasX
import argparse
import os
import random
from multiprocessing import Queue, Process
import cv2
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('-orig_dir', type=str,
default='C:/Users/LucasX/Desktop/ShelfE... | [
"argparse.ArgumentParser",
"random.randint",
"os.makedirs",
"cv2.waitKey",
"cv2.destroyAllWindows",
"os.path.basename",
"numpy.zeros",
"os.path.exists",
"numpy.clip",
"cv2.imread",
"multiprocessing.Queue",
"multiprocessing.Process",
"cv2.imshow",
"os.path.join",
"os.listdir"
] | [((192, 217), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (215, 217), False, 'import argparse\n'), ((3309, 3316), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (3314, 3316), False, 'from multiprocessing import Queue, Process\n'), ((3334, 3362), 'os.listdir', 'os.listdir', (["args['orig... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 28 16:40:41 2020
<NAME>
<EMAIL>
BME Bogazici University
Istanbul / Uskudar
@author: abas
"""
import numpy as np
import pytorch_lightning as pl
import torch
import torchvision
from torch.utils.data import Dataset, DataLoader
from preprocess import ... | [
"preprocess.normalizer",
"numpy.load",
"preprocess.scaler",
"pandas.read_excel",
"preprocess.transformation",
"numpy.array",
"torch.tensor",
"preprocess.smoother"
] | [((1431, 1450), 'pandas.read_excel', 'pd.read_excel', (['path'], {}), '(path)\n', (1444, 1450), True, 'import pandas as pd\n'), ((1661, 1676), 'numpy.load', 'np.load', (['gtpath'], {}), '(gtpath)\n', (1668, 1676), True, 'import numpy as np\n'), ((1717, 1756), 'numpy.array', 'np.array', (['self.exc.iloc[:, responseCol]'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: lry
"""
import scipy.io as sio
import numpy as np
sep = [20,40,61,103] # please pay attention to this seperation , setted according to the spectral response function of different sensors.
# setting global parameters
patch_size = 16
patch_size1 = ... | [
"numpy.reshape",
"scipy.io.loadmat"
] | [((935, 956), 'scipy.io.loadmat', 'sio.loadmat', (['filename'], {}), '(filename)\n', (946, 956), True, 'import scipy.io as sio\n'), ((1262, 1291), 'numpy.reshape', 'np.reshape', (['Xl_3d', '[-1, dimX]'], {}), '(Xl_3d, [-1, dimX])\n', (1272, 1291), True, 'import numpy as np\n')] |
# %%
import pandas as pd
import numpy as np
from datetime import datetime
import os
import pickle
import matplotlib.pyplot as plt
import scipy.special as sc
from scipy.stats import norm
from scipy.stats import lognorm
import copy
exec(open('../env_vars.py').read())
dir_data = os.environ['dir_data']
dir_picklejar = os.... | [
"copy.deepcopy",
"numpy.sum",
"os.path.realpath",
"numpy.cumsum",
"numpy.array"
] | [((2457, 2483), 'copy.deepcopy', 'copy.deepcopy', (['latent_data'], {}), '(latent_data)\n', (2470, 2483), False, 'import copy\n'), ((2978, 3004), 'copy.deepcopy', 'copy.deepcopy', (['latent_data'], {}), '(latent_data)\n', (2991, 3004), False, 'import copy\n'), ((3608, 3660), 'copy.deepcopy', 'copy.deepcopy', (['clean_d... |
from .alphabet import protein_alphabet, dna_alphabet, rna_alphabet
from .alignment import Alignment, ReferenceMapping
import numpy as np
from Bio import pairwise2
from Bio.SubsMat import MatrixInfo
def _get_substitution_matrix(alphabet):
""" Return a tuple with default parameters `(substitution_matrix, gap_open... | [
"numpy.asarray",
"Bio.pairwise2.align.globalds",
"numpy.mean",
"numpy.argmax"
] | [((3260, 3277), 'numpy.argmax', 'np.argmax', (['scores'], {}), '(scores)\n', (3269, 3277), True, 'import numpy as np\n'), ((3655, 3685), 'numpy.mean', 'np.mean', (['gap_structure'], {'axis': '(1)'}), '(gap_structure, axis=1)\n', (3662, 3685), True, 'import numpy as np\n'), ((5770, 5897), 'Bio.pairwise2.align.globalds',... |
import numpy as np
from ._Epsilon import Epsilon
class UCB1(Epsilon):
"""
Agente que soluciona el problema del el Bandido Multibrazo
(Multi-Armed Bandit) mediante el uso de una estrategia UCB1
Parámetros
----------
bandits : array of Bandit
Vector con los bandidos con los que se ... | [
"numpy.log",
"numpy.ceil",
"numpy.isnan",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.random.choice",
"numpy.sqrt"
] | [((1368, 1397), 'numpy.random.choice', 'np.random.choice', (['max_bandits'], {}), '(max_bandits)\n', (1384, 1397), True, 'import numpy as np\n'), ((2717, 2752), 'numpy.random.choice', 'np.random.choice', (['self._num_bandits'], {}), '(self._num_bandits)\n', (2733, 2752), True, 'import numpy as np\n'), ((3484, 3513), 'n... |
import Globals
import tkinter as tk
from tkinter import filedialog, INSERT, DISABLED, messagebox, NORMAL,simpledialog,\
PhotoImage, BOTH, Canvas, N, S, W, E, ALL, Frame, SUNKEN, Radiobutton, GROOVE, ACTIVE, \
FLAT, END, Scrollbar, HORIZONTAL, VERTICAL, ttk, TOP, RIGHT, LEFT, ttk
import os
from os.path import no... | [
"Globals.profiles_doseplan_text_image.width",
"Globals.DVH_doseplans_filenames.append",
"Globals.DVH_input_lateral_displacement.config",
"Globals.profiles_showPlanes_image.width",
"Globals.DVH_distance_reference_point_ROI.append",
"Globals.DCH_film_orientation.get",
"os.path.dirname",
"tkinter.filedia... | [((2165, 2176), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (2173, 2176), True, 'import numpy as np\n'), ((6927, 6938), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (6935, 6938), True, 'import numpy as np\n'), ((9940, 9951), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (9948, 9951), True, 'import num... |
import numpy as np
import sys
import pandas as pd
import matplotlib.pyplot as plt
# read in csv as data frame
data_val = pd.read_csv('val_event.csv',delimiter=' ')
data_mu = pd.read_csv('ylength_mu_michel.csv',delimiter=' ')
data_pi = pd.read_csv('ylength_pi.csv',delimiter=' ')
mergedmu = data_val.merge(data_mu, o... | [
"numpy.abs",
"pandas.read_csv",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((123, 166), 'pandas.read_csv', 'pd.read_csv', (['"""val_event.csv"""'], {'delimiter': '""" """'}), "('val_event.csv', delimiter=' ')\n", (134, 166), True, 'import pandas as pd\n'), ((177, 228), 'pandas.read_csv', 'pd.read_csv', (['"""ylength_mu_michel.csv"""'], {'delimiter': '""" """'}), "('ylength_mu_michel.csv', de... |
#!/usr/bin/python
"""The primary script to execute the tensorflow models."""
from __future__ import print_function
from munch import munchify
from six.moves import cPickle
from config.arguments import parser
""" Default model """
from model.model import Model
from utils.processor import BatchLoader, DataLoader, eval... | [
"yaml.load",
"numpy.sum",
"tensorflow.reset_default_graph",
"tensorflow.local_variables_initializer",
"tensorflow.ConfigProto",
"numpy.random.randint",
"config.arguments.parser.parse_args",
"numpy.exp",
"tensorflow.get_default_graph",
"os.path.join",
"tensorflow.random_uniform_initializer",
"u... | [((513, 537), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (535, 537), True, 'import tensorflow as tf\n'), ((593, 612), 'config.arguments.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (610, 612), False, 'from config.arguments import parser\n'), ((719, 759), 'os.path.join', ... |
#######################################################
#This script is for evaluating for the task of SLR #
#######################################################
import argparse
import time
import collections
import os
import sys
import torch
import torch.nn
from torch.autograd import Variable
import torch.nn a... | [
"argparse.ArgumentParser",
"progressbar.Percentage",
"torch.device",
"os.path.join",
"_pickle.load",
"torch.load",
"os.path.exists",
"progressbar.Bar",
"dataloader_slr.loader",
"tensorflow.compat.v1.sparse.to_dense",
"utils.Batch",
"datetime.datetime.now",
"cv2.resize",
"torch.mean",
"tr... | [((997, 1024), 'tensorflow.compat.v1.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (1022, 1024), True, 'import tensorflow.compat.v1 as tf\n'), ((1070, 1119), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluation"""'}), "(description='Evaluation')\n", (1093, ... |
# Copyright (c) 2021 PaddlePaddle 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 appli... | [
"argparse.ArgumentParser",
"paddle.load",
"paddle.reshape",
"paddle.argmax",
"sklearn.metrics.classification_report",
"numpy.array",
"yaml.safe_load",
"paddle.set_device",
"paddle.io.DataLoader",
"sklearn.metrics.precision_recall_fscore_support"
] | [((1357, 1436), 'sklearn.metrics.precision_recall_fscore_support', 'precision_recall_fscore_support', (['y_test', 'y_pred'], {'average': 'None', 'labels': '[1, 2, 3]'}), '(y_test, y_pred, average=None, labels=[1, 2, 3])\n', (1388, 1436), False, 'from sklearn.metrics import precision_recall_fscore_support\n'), ((1460, 1... |
import os
import glob
from segmentation import *
from utils.image_io import prepare_image
import numpy as np
from cv2.ximgproc import guidedFilter
from matplotlib import pyplot as plt
from _utils import *
image_dir = '../double_dip/images'
prior_hint_dir_fg = '../double_dip/saliency/output_fg'
prior_hint_dir_bg = '... | [
"matplotlib.pyplot.title",
"numpy.zeros_like",
"os.path.join",
"matplotlib.pyplot.plot",
"os.path.basename",
"matplotlib.pyplot.legend",
"os.system",
"matplotlib.pyplot.figure",
"numpy.array",
"glob.glob",
"matplotlib.pyplot.subplots"
] | [((1711, 1738), 'glob.glob', 'glob.glob', (["(image_dir + '/*')"], {}), "(image_dir + '/*')\n", (1720, 1738), False, 'import glob\n'), ((486, 514), 'os.system', 'os.system', (['"""rm -rf output/*"""'], {}), "('rm -rf output/*')\n", (495, 514), False, 'import os\n'), ((787, 801), 'matplotlib.pyplot.subplots', 'plt.subpl... |
import json
import pickle
import sys
from datetime import datetime
from json import JSONEncoder
import numpy as np
import pandas as pd
import watchdog.events
import watchdog.observers
import time
import tensorflow as tf
import configparser
import os
from kafka import KafkaProducer
tf.compat.v1.logging.set_verbosity(t... | [
"sys.path.append",
"tensorflow.python.keras.models.load_model",
"warnings.filterwarnings",
"pandas.merge",
"numpy.asarray",
"kafka.KafkaProducer",
"json.dumps",
"time.time",
"time.sleep",
"numpy.append",
"datetime.datetime.now",
"tensorflow.compat.v1.logging.set_verbosity",
"numpy.array",
... | [((284, 346), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logging.ERROR)\n', (318, 346), True, 'import tensorflow as tf\n'), ((402, 438), 'sys.path.append', 'sys.path.append', (["(sys.path[0] + '/..')"], {}), "(sys.path[0] + '/... |
import os
import sys
import numpy as np
import pandas as pd
import logging
import gc
import tqdm
import pickle
import time
gc.enable()
cwd = os.getcwd()
train_path = os.path.join(cwd, 'train_artifact')
test_path = os.path.join(cwd, 'test_artifact')
input_path = os.path.join(cwd, 'input_artifact')
embed_path = os.path... | [
"os.mkdir",
"numpy.load",
"numpy.save",
"pickle.dump",
"os.path.join",
"logging.FileHandler",
"os.getcwd",
"os.path.isdir",
"logging.StreamHandler",
"time.ctime",
"logging.Formatter",
"pickle.load",
"gc.enable",
"logging.getLogger"
] | [((125, 136), 'gc.enable', 'gc.enable', ([], {}), '()\n', (134, 136), False, 'import gc\n'), ((143, 154), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (152, 154), False, 'import os\n'), ((168, 203), 'os.path.join', 'os.path.join', (['cwd', '"""train_artifact"""'], {}), "(cwd, 'train_artifact')\n", (180, 203), False, 'im... |
from typing import Union, List, Dict, Optional, Callable, Set
from skdecide.builders.solver.policy import DeterministicPolicies, UncertainPolicies
from skdecide import Domain, Solver
from skdecide.builders.scheduling.modes import SingleMode
from skdecide.builders.scheduling.scheduling_domains_modelling import State, Sc... | [
"numpy.sum",
"numpy.mean",
"scipy.stats.kendalltau",
"deap.tools.HallOfFame",
"deap.base.Toolbox",
"numpy.max",
"skdecide.builders.discrete_optimization.rcpsp.solver.cpm.CPM",
"skdecide.hub.solver.do_solver.sk_to_do_binding.build_do_domain",
"deap.algorithms.eaSimple",
"numpy.median",
"operator.... | [((3338, 3353), 'numpy.mean', 'np.mean', (['values'], {}), '(values)\n', (3345, 3353), True, 'import numpy as np\n'), ((3576, 3590), 'numpy.min', 'np.min', (['values'], {}), '(values)\n', (3582, 3590), True, 'import numpy as np\n'), ((4153, 4167), 'numpy.max', 'np.max', (['values'], {}), '(values)\n', (4159, 4167), Tru... |
from machin.utils.media import (
show_image, create_video, create_video_subproc,
create_image, create_image_subproc
)
from os.path import join
import os
import pytest
import numpy as np
@pytest.fixture(scope="function")
def images():
images = [
np.random.randint(0, 255, size=[128, 128], dtype=np.u... | [
"machin.utils.media.create_video_subproc",
"machin.utils.media.create_image",
"machin.utils.media.create_image_subproc",
"pytest.fixture",
"numpy.random.randint",
"numpy.random.rand",
"machin.utils.media.create_video",
"os.path.join",
"machin.utils.media.show_image"
] | [((197, 229), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (211, 229), False, 'import pytest\n'), ((381, 413), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (395, 413), False, 'import pytest\n'), ((565, 608), 'machin.util... |
# ###########################################################################
#
# CLOUDERA APPLIED MACHINE LEARNING PROTOTYPE (AMP)
# (C) Cloudera, Inc. 2020
# All rights reserved.
#
# Applicable Open Source License: Apache 2.0
#
# NOTE: Cloudera open source products are modular software products
# made up of hun... | [
"pandas.DataFrame",
"sts.data.loader.load_california_electricity_demand",
"numpy.exp",
"sts.models.prophet.seasonal_daily_prophet_model"
] | [((2318, 2354), 'sts.data.loader.load_california_electricity_demand', 'load_california_electricity_demand', ([], {}), '()\n', (2352, 2354), False, 'from sts.data.loader import load_california_electricity_demand\n'), ((2473, 2505), 'sts.models.prophet.seasonal_daily_prophet_model', 'seasonal_daily_prophet_model', (['df'... |
from __future__ import print_function
import argparse
import gzip
import json
import logging
import os
import traceback
import numpy as np
import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Conv2D, Dense, Flatten
logging.basicConfig(level=logging.DEBUG)
# Define the model... | [
"argparse.ArgumentParser",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.metrics.Mean",
"numpy.mean",
"os.path.join",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"json.loads",
"numpy.std",
"os.path.exists",
"numpy.finfo",
"tensorflow.keras.o... | [((260, 300), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (279, 300), False, 'import logging\n'), ((1832, 1868), 'numpy.mean', 'np.mean', (['x'], {'axis': 'axis', 'keepdims': '(True)'}), '(x, axis=axis, keepdims=True)\n', (1839, 1868), True, 'import numpy a... |
import pathlib
import numpy
import pytest
import helpers
import meshio
@pytest.mark.parametrize(
"mesh", [helpers.tri_mesh, helpers.quad_mesh, helpers.tri_quad_mesh]
)
def test_obj(mesh):
def writer(*args, **kwargs):
return meshio.obj.write(*args, **kwargs)
for k, c in enumerate(mesh.cells):
... | [
"numpy.sum",
"meshio.read",
"pathlib.Path",
"meshio.obj.write",
"pytest.mark.parametrize",
"helpers.write_read"
] | [((76, 173), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mesh"""', '[helpers.tri_mesh, helpers.quad_mesh, helpers.tri_quad_mesh]'], {}), "('mesh', [helpers.tri_mesh, helpers.quad_mesh,\n helpers.tri_quad_mesh])\n", (99, 173), False, 'import pytest\n'), ((462, 565), 'pytest.mark.parametrize', 'pytest.... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"retworkx.generators.directed_grid_graph",
"scipy.sparse.csgraph.connected_components",
"retworkx.is_weakly_connected",
"qiskit.transpiler.exceptions.CouplingError",
"retworkx.digraph_distance_matrix",
"qiskit.exceptions.MissingOptionalLibraryError",
"retworkx.PyDiGraph",
"scipy.sparse.coo_matrix",
... | [((2012, 2026), 'retworkx.PyDiGraph', 'rx.PyDiGraph', ([], {}), '()\n', (2024, 2026), True, 'import retworkx as rx\n'), ((4287, 4533), 'warnings.warn', 'warnings.warn', (['"""The .subgraph() method is deprecated and will be removed in a future release. Instead the .reduce() method should be used instead which does the ... |
import numpy as np
import pandas as pd
import pytest
from rayml.data_checks import (
DataCheckActionCode,
DataCheckActionOption,
DataCheckMessageCode,
DataCheckWarning,
IDColumnsDataCheck,
)
id_data_check_name = IDColumnsDataCheck.name
def test_id_cols_data_check_init():
id_cols_check = IDCo... | [
"pandas.DataFrame",
"rayml.data_checks.DataCheckActionOption",
"pandas.DataFrame.from_dict",
"pytest.raises",
"numpy.array",
"rayml.data_checks.IDColumnsDataCheck"
] | [((316, 336), 'rayml.data_checks.IDColumnsDataCheck', 'IDColumnsDataCheck', ([], {}), '()\n', (334, 336), False, 'from rayml.data_checks import DataCheckActionCode, DataCheckActionOption, DataCheckMessageCode, DataCheckWarning, IDColumnsDataCheck\n'), ((403, 439), 'rayml.data_checks.IDColumnsDataCheck', 'IDColumnsDataC... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"non_semantic_speech_benchmark.eval_embedding.sklearn.sklearn_utils.tfexamples_to_nps",
"numpy.random.seed",
"tensorflow.compat.v1.train.Example",
"absl.testing.absltest.get_default_test_tmpdir",
"tensorflow.compat.v1.python_io.TFRecordWriter",
"absl.testing.parameterized.parameters",
"tensorflow.compat... | [((999, 1085), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (["{'l2_normalization': True}", "{'l2_normalization': False}"], {}), "({'l2_normalization': True}, {'l2_normalization': \n False})\n", (1023, 1085), False, 'from absl.testing import parameterized\n'), ((3382, 3396), 'tensorflow.compa... |
import numpy as np
import matplotlib.pyplot as plt
import cv2
import sys
# read the image
image = cv2.imread(sys.argv[1])
# convert to grayscale
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# perform edge detection
edges = cv2.Canny(grayscale, 30, 100)
# detect lines in the image using hough li... | [
"cv2.line",
"cv2.Canny",
"matplotlib.pyplot.show",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"cv2.imread",
"numpy.array"
] | [((105, 128), 'cv2.imread', 'cv2.imread', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (115, 128), False, 'import cv2\n'), ((168, 207), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (180, 207), False, 'import cv2\n'), ((245, 274), 'cv2.Canny', 'cv2.Canny', (['grays... |
import tensorflow
from tensorflow.keras.datasets import cifar10
from tensorflow import keras
import numpy as np
num_classes = 10
class EvalDataset(object):
def __init__(self, batch_size=100):
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
x_train = x_train.astype('float32') / 255
... | [
"tensorflow.keras.utils.to_categorical",
"neural_compressor.experimental.Benchmark",
"tensorflow.keras.datasets.cifar10.load_data",
"neural_compressor.experimental.common.Model",
"numpy.mean"
] | [((1031, 1058), 'neural_compressor.experimental.Benchmark', 'Benchmark', (['"""benchmark.yaml"""'], {}), "('benchmark.yaml')\n", (1040, 1058), False, 'from neural_compressor.experimental import Benchmark, common\n'), ((1077, 1109), 'neural_compressor.experimental.common.Model', 'common.Model', (['"""./baseline_model"""... |
import ast, gast
import inspect
import numpy as np
import sys
import typing
from chainer_compiler.elichika.typing import types
from chainer_compiler.elichika.typing.type_inference import InferenceEngine
from chainer_compiler.elichika.typing.utils import node_description, is_expr
from chainer_compiler.elichika.parser i... | [
"chainer_compiler.elichika.typing.type_inference.InferenceEngine",
"numpy.random.seed",
"argparse.ArgumentParser",
"chainer_compiler.elichika.typing.utils.is_expr",
"typing.get_type_hints",
"numpy.zeros",
"inspect.getsource",
"chainer.functions.pad_sequence",
"ast.parse",
"chainer_compiler.elichik... | [((1137, 1186), 'chainer_compiler.elichika.typing.type_inference.InferenceEngine', 'InferenceEngine', ([], {'is_debug': 'is_debug', 'module': 'module'}), '(is_debug=is_debug, module=module)\n', (1152, 1186), False, 'from chainer_compiler.elichika.typing.type_inference import InferenceEngine\n'), ((3532, 3550), 'numpy.r... |
#!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
import cPickle
from collections import defaultdict
from itertools import izip
import json
import numpy as np
import cellranger.constants as cr_constants
import cellranger.library_constants as lib_constants
from cellranger.molecule_co... | [
"numpy.absolute",
"numpy.random.seed",
"numpy.sum",
"cPickle.load",
"collections.defaultdict",
"cellranger.molecule_counter.MoleculeCounter.estimate_mem_gb",
"numpy.arange",
"numpy.fromiter",
"cellranger.molecule_counter.MoleculeCounter.open",
"cellranger.rna.library.get_library_type_metric_prefix... | [((1651, 1696), 'cellranger.molecule_counter.MoleculeCounter.open', 'MoleculeCounter.open', (['args.molecule_info', '"""r"""'], {}), "(args.molecule_info, 'r')\n", (1671, 1696), False, 'from cellranger.molecule_counter import MoleculeCounter\n'), ((1938, 1954), 'collections.defaultdict', 'defaultdict', (['int'], {}), '... |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2018-09-18 13:25:04
# @Last Modified by: <NAME>
# @Last Modified time: 2018-09-18 13:35:04
"""
CUSTOM ESTIMATOR AS DECORATORS for Scikit-Learn Pipelines
"""
from sklearn.base import BaseEstimator, TransformerMixin, ClassifierMixin
import pandas as pd
class SKTr... | [
"sklearn.pipeline.Pipeline",
"numpy.array"
] | [((1813, 1843), 'sklearn.pipeline.Pipeline', 'Pipeline', (['[power2, lessThan50]'], {}), '([power2, lessThan50])\n', (1821, 1843), False, 'from sklearn.pipeline import Pipeline\n'), ((1906, 1929), 'numpy.array', 'np.array', (['[3, 6, 8, 10]'], {}), '([3, 6, 8, 10])\n', (1914, 1929), True, 'import numpy as np\n')] |
# vim: expandtab:ts=4:sw=4
from __future__ import absolute_import
import numpy as np
import pdb
from . import kf_2d, kf_3d, double_measurement_kf, imm
from . import linear_assignment
from . import iou_matching
from .track import Track
from . import JPDA_matching
from . import tracking_utils
import math
from nn_matching... | [
"numpy.dstack",
"nn_matching.NearestNeighborDistanceMetric",
"numpy.asarray",
"numpy.array",
"numpy.linalg.norm",
"cv2.calcOpticalFlowFarneback",
"numpy.dot"
] | [((2036, 2089), 'nn_matching.NearestNeighborDistanceMetric', 'NearestNeighborDistanceMetric', (['"""euclidean"""', 'nn_budget'], {}), "('euclidean', nn_budget)\n", (2065, 2089), False, 'from nn_matching import NearestNeighborDistanceMetric\n'), ((3126, 3179), 'numpy.array', 'np.array', (['[tracks[i].track_id for i in t... |
"""PhoSim Instance Catalog"""
from __future__ import absolute_import, division, print_function
import numpy as np
from lsst.sims.catUtils.exampleCatalogDefinitions import (PhoSimCatalogZPoint,
PhoSimCatalogPoint,
... | [
"lsst.sims.catalogs.db.CompoundCatalogDBObject",
"numpy.array"
] | [((2155, 2176), 'numpy.array', 'np.array', (['split_names'], {}), '(split_names)\n', (2163, 2176), True, 'import numpy as np\n'), ((6160, 6199), 'lsst.sims.catalogs.db.CompoundCatalogDBObject', 'CompoundCatalogDBObject', (['dbObjClassList'], {}), '(dbObjClassList)\n', (6183, 6199), False, 'from lsst.sims.catalogs.db im... |
# more or less the same simulation, but split up in to chunks that fit into memory
# for large states (CA, IA, KS, OK, TX)
# chunks of size 2000 (2000 locations in one part calculated and create temporary file)
location_chunk = 2000
import argparse
import datetime
import glob
import math
import numpy as np
import os
i... | [
"sys.path.append",
"os.mkdir",
"os.remove",
"argparse.ArgumentParser",
"pandas.read_csv",
"xarray.open_rasterio",
"os.path.exists",
"time.time",
"dask.diagnostics.ProgressBar",
"numpy.arange",
"pandas.to_datetime",
"glob.glob",
"xarray.open_mfdataset"
] | [((457, 479), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (472, 479), False, 'import sys\n'), ((766, 836), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Insert state and optionally GWA"""'}), "(description='Insert state and optionally GWA')\n", (789, 836), Fa... |
"""OVK learning, unit tests.
The :mod:`sklearn.tests.test_semisuo` tests semisup module.
"""
import operalib as ovk
import numpy as np
def test_semisup_linop():
"""Test ovk.semisup.SemisupLinop."""
np.random.seed()
n = 100
p = 5
lbda2 = .1
# supervised indices
B = np.random.randint(2, ... | [
"numpy.random.seed",
"numpy.sum",
"numpy.random.randn",
"numpy.empty",
"numpy.random.randint",
"numpy.dot",
"operalib.ridge._SemisupLinop"
] | [((210, 226), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (224, 226), True, 'import numpy as np\n'), ((383, 393), 'numpy.sum', 'np.sum', (['(~B)'], {}), '(~B)\n', (389, 393), True, 'import numpy as np\n'), ((402, 435), 'numpy.random.randn', 'np.random.randn', (['n_unsup', 'n_unsup'], {}), '(n_unsup, n_unsu... |
# /usr/bin/env python3
import numpy as np
def operadores():
a=np.random.randint(3,10,size=10)
b=np.random.randint(4,78,size=10)
print(np.add(a,b))
print(np.subtract(b,a))
print(np.negative(a,b))
print(np.multiply(a,b))
print(np.divide(a,b))
print(np.floor_divide(b,a))
prin... | [
"numpy.divide",
"numpy.multiply",
"numpy.subtract",
"numpy.floor_divide",
"numpy.power",
"numpy.negative",
"numpy.mod",
"numpy.random.randint",
"numpy.add"
] | [((69, 102), 'numpy.random.randint', 'np.random.randint', (['(3)', '(10)'], {'size': '(10)'}), '(3, 10, size=10)\n', (86, 102), True, 'import numpy as np\n'), ((108, 141), 'numpy.random.randint', 'np.random.randint', (['(4)', '(78)'], {'size': '(10)'}), '(4, 78, size=10)\n', (125, 141), True, 'import numpy as np\n'), (... |
"""This module creates a new dataframe with a movie id and its corresponding
mean sentiment score. Mean sentiment score is computed by taking the average of
the sentiment scores for all the movie's comments
"""
from os import listdir
import os.path as op
import pandas as pd
import numpy as np
from .analyze_comments_tb... | [
"pandas.DataFrame",
"pandas.read_csv",
"numpy.asarray",
"os.path.join",
"os.listdir"
] | [((389, 435), 'os.path.join', 'op.join', (['mv.__path__[0]', '"""data/movie_comments"""'], {}), "(mv.__path__[0], 'data/movie_comments')\n", (396, 435), True, 'import os.path as op\n'), ((577, 630), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['movie_id', 'sentiment_score']"}), "(columns=['movie_id', 'sentime... |
from datetime import datetime
import numpy as np
import warnings
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__created__ = datetime(2008, 8, 15)
__modified__ = datetime(2015, 7, 25)
__version__ = "1.5"
__status__ = "Development"
'''
Various vertical coordinates
Presently, only ocean s-coordinates are suppo... | [
"numpy.tanh",
"numpy.empty",
"numpy.asarray",
"numpy.zeros",
"datetime.datetime",
"numpy.arange",
"numpy.exp",
"numpy.squeeze",
"warnings.warn",
"numpy.cosh",
"numpy.sinh"
] | [((131, 152), 'datetime.datetime', 'datetime', (['(2008)', '(8)', '(15)'], {}), '(2008, 8, 15)\n', (139, 152), False, 'from datetime import datetime\n'), ((168, 189), 'datetime.datetime', 'datetime', (['(2015)', '(7)', '(25)'], {}), '(2015, 7, 25)\n', (176, 189), False, 'from datetime import datetime\n'), ((1891, 1904)... |
import sys
import pytest
import numpy as np
from numpy.testing import assert_array_equal, IS_PYPY
class TestDLPack:
@pytest.mark.skipif(IS_PYPY, reason="PyPy can't get refcounts.")
def test_dunder_dlpack_refcount(self):
x = np.arange(5)
y = x.__dlpack__()
assert sys.getrefcount(x) == ... | [
"numpy.datetime64",
"numpy.testing.assert_array_equal",
"numpy.dtype",
"numpy.zeros",
"numpy.ones",
"sys.getrefcount",
"pytest.raises",
"pytest.mark.skipif",
"numpy.arange",
"numpy._from_dlpack",
"numpy.array",
"pytest.mark.parametrize",
"numpy.diagonal"
] | [((124, 187), 'pytest.mark.skipif', 'pytest.mark.skipif', (['IS_PYPY'], {'reason': '"""PyPy can\'t get refcounts."""'}), '(IS_PYPY, reason="PyPy can\'t get refcounts.")\n', (142, 187), False, 'import pytest\n'), ((808, 871), 'pytest.mark.skipif', 'pytest.mark.skipif', (['IS_PYPY'], {'reason': '"""PyPy can\'t get refcou... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 4 07:10:55 2020
@author: sj
"""
import numpy as np
# left corner as (0,0), US in West and Asia in East
# only validated in Asia, North and East
#x as latitude (180), y as longitude (360),
# x = 114288 # latitude, filepath
# y = 214078 # longitude, filena... | [
"numpy.power",
"numpy.floor",
"numpy.sinh"
] | [((444, 458), 'numpy.power', 'np.power', (['(2)', 'z'], {}), '(2, z)\n', (452, 458), True, 'import numpy as np\n'), ((686, 699), 'numpy.floor', 'np.floor', (['lat'], {}), '(lat)\n', (694, 699), True, 'import numpy as np\n'), ((741, 754), 'numpy.floor', 'np.floor', (['tmp'], {}), '(tmp)\n', (749, 754), True, 'import num... |
from PIL import Image
import numpy as np
import sys, os
from progress_bar import ProgressBar
def get_bit(pos, img):
# avoids modifying thumbnail
size = img.shape[0]*img.shape[1] - 4096
rgb = pos//size
if rgb > 2:
raise IndexError("Position is too large")
pos = pos % size + 4096
x,y = po... | [
"progress_bar.ProgressBar",
"numpy.array",
"PIL.Image.open"
] | [((395, 418), 'PIL.Image.open', 'Image.open', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (405, 418), False, 'from PIL import Image\n'), ((485, 498), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (493, 498), True, 'import numpy as np\n'), ((874, 891), 'progress_bar.ProgressBar', 'ProgressBar', (['size'], {}), '(si... |
# Iterative Conway's game of life in Python / CUDA C
# this version is meant to illustrate the use of shared kernel memory in CUDA.
# written by <NAME> for "Hands on GPU Programming with Python and CUDA"
import pycuda.autoinit
import pycuda.driver as drv
from pycuda import gpuarray
from pycuda.compiler import SourceMo... | [
"numpy.random.choice",
"pycuda.compiler.SourceModule",
"matplotlib.pyplot.show",
"time.time",
"matplotlib.pyplot.figure",
"numpy.int32",
"pycuda.gpuarray.to_gpu"
] | [((417, 2837), 'pycuda.compiler.SourceModule', 'SourceModule', (['""" \n#define _iters 1000000 \n\n#define _X ( threadIdx.x + blockIdx.x * blockDim.x )\n#define _Y ( threadIdx.y + blockIdx.y * blockDim.y )\n\n#define _WIDTH ( blockDim.x * gridDim.x )\n#define _HEIGHT ( blockDim.y * gridDim.y... |
#!/usr/bin/env python
'''======================================================
Created by: <NAME> and <NAME>
Last updated: March 2015
File name: DF_Plots.py
Organization: RISC Lab, Utah State University
======================================================'''
import roslib; roslib.load_manifes... | [
"matplotlib.pyplot.title",
"rospy.Subscriber",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.figure",
"roslib.load_manifest",
"matplotlib.pyplot.close",
"rospy.Rate",
"rospy.signal_shutdown",
"numpy.append",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.get_time",
"matplotlib.pyplot.show",
... | [((301, 334), 'roslib.load_manifest', 'roslib.load_manifest', (['"""risc_msgs"""'], {}), "('risc_msgs')\n", (321, 334), False, 'import roslib\n'), ((1180, 1213), 'numpy.zeros', 'np.zeros', (['(1, states_of_interest)'], {}), '((1, states_of_interest))\n', (1188, 1213), True, 'import numpy as np\n'), ((3923, 3944), 'matp... |
import numpy as np
import anndata as ad
# -------------------------------------------------------------------------------
# Some test data
# -------------------------------------------------------------------------------
X_list = [ # data matrix of shape n_obs x n_vars
[1, 2, 3], [4, 5, 6], [7, 8, 9]]
obs_di... | [
"anndata.AnnData",
"numpy.empty",
"numpy.array",
"numpy.ones"
] | [((1049, 1065), 'numpy.array', 'np.array', (['X_list'], {}), '(X_list)\n', (1057, 1065), True, 'import numpy as np\n'), ((1078, 1148), 'anndata.AnnData', 'ad.AnnData', (['X'], {'obs': 'obs_dict', 'var': 'var_dict', 'uns': 'uns_dict', 'dtype': '"""int32"""'}), "(X, obs=obs_dict, var=var_dict, uns=uns_dict, dtype='int32'... |
import cv2
import glob
import numpy as np
from keras.models import Sequential
from keras.layers import Conv2D, Flatten, Dense, MaxPooling2D, Dropout
from keras.utils.np_utils import to_categorical
from keras import losses, optimizers, regularizers
X_train = []
x_label = []
for img_class, directory in enumerate(['Red... | [
"keras.regularizers.l2",
"cv2.cvtColor",
"keras.layers.Dropout",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"cv2.imread",
"keras.utils.np_utils.to_categorical",
"keras.layers.Dense",
"numpy.array",
"keras.models.Sequential",
"keras.layers.MaxPooling2D",
"cv2.resize"
] | [((832, 849), 'numpy.array', 'np.array', (['X_train'], {}), '(X_train)\n', (840, 849), True, 'import numpy as np\n'), ((860, 877), 'numpy.array', 'np.array', (['x_label'], {}), '(x_label)\n', (868, 877), True, 'import numpy as np\n'), ((902, 925), 'keras.utils.np_utils.to_categorical', 'to_categorical', (['x_label'], {... |
import torch
from sklearn.model_selection import train_test_split
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
import random
import numpy as np
import Read_Data
import Confusion_Matrix
def getdata():
features, target = Read_Data.read_data3('mushrooms_data.csv')
... | [
"torch.nn.Dropout",
"numpy.random.seed",
"Read_Data.read_data3",
"numpy.argmax",
"torch.manual_seed",
"sklearn.model_selection.train_test_split",
"torch.cuda.manual_seed",
"torch.nn.functional.cross_entropy",
"torch.cuda.manual_seed_all",
"Confusion_Matrix.main",
"random.seed",
"torch.nn.Linea... | [((274, 316), 'Read_Data.read_data3', 'Read_Data.read_data3', (['"""mushrooms_data.csv"""'], {}), "('mushrooms_data.csv')\n", (294, 316), False, 'import Read_Data\n'), ((357, 406), 'sklearn.model_selection.train_test_split', 'train_test_split', (['features', 'target'], {'test_size': '(0.2)'}), '(features, target, test_... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy import stats
from scipy import interpolate as spin
import pandas as pd
import os
import warnings
from datetime import datetime, timedelta
import calendar
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as pltick
import matplotlib.d... | [
"matplotlib.pyplot.title",
"matplotlib.dates.MonthLocator",
"numpy.abs",
"time_tools.convert_tuple_to_8_int",
"matplotlib.pyplot.quiver",
"load_product.sea_ice_concentration_along_track",
"numpy.isnan",
"matplotlib.patches.Polygon",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.... | [((515, 565), 'os.path.isdir', 'os.path.isdir', (['"""/Applications/anaconda/share/proj"""'], {}), "('/Applications/anaconda/share/proj')\n", (528, 565), False, 'import os\n'), ((775, 839), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '""".*is_string_like function.*"""'], {}), "('ignore', '.*... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 14:24:54 2017
@author: IACJ
"""
import os
from os import path
from os.path import expanduser
from numpy import genfromtxt
import numpy as np
from numpy import array, zeros, argmin, inf
from numpy import *
from US_DTW import US_DTW
# classify using kNN
def kNNCl... | [
"os.path.join",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.tile",
"US_DTW.US_DTW",
"os.path.expanduser",
"os.listdir"
] | [((1638, 1658), 'numpy.zeros', 'np.zeros', (['numSamples'], {}), '(numSamples)\n', (1646, 1658), True, 'import numpy as np\n'), ((2650, 2670), 'numpy.zeros', 'np.zeros', (['numSamples'], {}), '(numSamples)\n', (2658, 2670), True, 'import numpy as np\n'), ((3916, 3937), 'numpy.zeros', 'zeros', (['(r + 1, c + 1)'], {}), ... |
import html
from unittest.mock import Mock
import numpy as np
import pytest
from napari.utils import nbscreenshot
def test_nbscreenshot(make_napari_viewer):
"""Test taking a screenshot."""
viewer = make_napari_viewer()
np.random.seed(0)
data = np.random.random((10, 15))
viewer.add_image(data)
... | [
"numpy.random.seed",
"napari.utils.nbscreenshot",
"unittest.mock.Mock",
"numpy.random.random",
"pytest.mark.parametrize",
"html.escape"
] | [((585, 1229), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""alt_text_input, expected_alt_text"""', '[(None, None), (\'Good alt text\', \'Good alt text\'), (",./;\'[]\\\\-=",\n \',./;'[]\\\\-=\'), (\'>?:"{}|_+\', \'>?:"{}|_+\'), (\n \'!@#$%^&*()`~\', \'!@#$%^&*()`~\'), (\'😍\', \'😍... |
import numpy as np
def random_sum(*dimensions):
return np.random.rand(*dimensions).sum()
| [
"numpy.random.rand"
] | [((61, 88), 'numpy.random.rand', 'np.random.rand', (['*dimensions'], {}), '(*dimensions)\n', (75, 88), True, 'import numpy as np\n')] |
import numpy as np
import time
import sys
from ServoMotor import *
from fns import *
# Initialize motor control library & USB Port
filename = "/dev/ttyUSB0"
motor = ServoMotor(filename)
IO = motor.IO_Init()
if IO < 0:
print('IO exit')
sys.exit()
# Call corresponding function to convert sim2real/real2sim
def convFns... | [
"numpy.load",
"numpy.zeros",
"time.sleep",
"numpy.sin",
"sys.exit"
] | [((3246, 3259), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (3256, 3259), False, 'import time\n'), ((3514, 3527), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (3524, 3527), False, 'import time\n'), ((238, 248), 'sys.exit', 'sys.exit', ([], {}), '()\n', (246, 248), False, 'import sys\n'), ((524, 536), 'nu... |
import json
import jsonschema
from jsonschema import validate
import abc
import error as error
from Estimator import Estimator
import sys
import numpy as np # vectors and matrices
import pandas as pd # tables and data manipulations
from dateutil.relativedel... | [
"jsonschema.validate",
"scipy.optimize.minimize",
"numpy.abs",
"warnings.filterwarnings",
"sys.path.insert",
"sklearn.model_selection.TimeSeriesSplit",
"numpy.array",
"TripleES_OM.TripleES_OM"
] | [((802, 835), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (825, 835), False, 'import warnings\n'), ((8825, 8853), 'sklearn.model_selection.TimeSeriesSplit', 'TimeSeriesSplit', ([], {'n_splits': 'cv'}), '(n_splits=cv)\n', (8840, 8853), False, 'from sklearn.model_selectio... |
'''
Future Update Notes:
1) Non-supervisor mode is not coded.
2) Controller functions should be updated.
3) robot_creator function takes too much arguments and more argument
necessary for options like robot tags, data transfer between real
robot and player, etc. New structure might be necessary.
4) Codes m... | [
"numpy.ndindex",
"numpy.random.randint",
"ctypes.windll.shell32.IsUserAnAdmin",
"pathlib.Path"
] | [((13388, 13426), 'numpy.random.randint', 'np.random.randint', (['(0)', '(5)'], {'size': '(10, 10)'}), '(0, 5, size=(10, 10))\n', (13405, 13426), True, 'import numpy as np\n'), ((2466, 2496), 'numpy.ndindex', 'np.ndindex', (['floor_matrix.shape'], {}), '(floor_matrix.shape)\n', (2476, 2496), True, 'import numpy as np\n... |
"""
This package includes my constraints/utilities/etc for cpmpy.
This cpmpy model was written by <NAME> (<EMAIL>)
See also my cpmpy page: http://hakank.org/cpmpy/
"""
import sys, math, re
import itertools
import numpy as np
from functools import reduce
from cpmpy import *
from cpmpy.expressions.globalconstraint... | [
"math.sqrt",
"itertools.combinations",
"numpy.array",
"functools.reduce",
"cpmpy.transformations.flatten_model.flatten_model",
"cpmpy.transformations.get_variables.print_variables"
] | [((29382, 29411), 'functools.reduce', 'reduce', (['(lambda a, b: a * b)', 'x'], {}), '(lambda a, b: a * b, x)\n', (29388, 29411), False, 'from functools import reduce\n'), ((38373, 38393), 'cpmpy.transformations.flatten_model.flatten_model', 'flatten_model', (['model'], {}), '(model)\n', (38386, 38393), False, 'from cp... |
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
print(data)
#Code starts here
census = np.concatenate((new_recor... | [
"numpy.sum",
"warnings.filterwarnings",
"numpy.std",
"numpy.genfromtxt",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.mean",
"numpy.concatenate"
] | [((82, 115), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (105, 115), False, 'import warnings\n'), ((203, 252), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (216, 252), True, 'i... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sys
try:
from Cython.Distutils import build_ext
except ImportError:
def build_ext(*args, **kwargs):
from Cython.Distutils import build_ext
return build_ext(*args, **kwargs)
class lazy_extlist(list):
def __init__(s... | [
"Cython.Distutils.build_ext",
"numpy.get_include",
"setuptools.find_packages"
] | [((1559, 1574), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1572, 1574), False, 'from setuptools import setup, find_packages\n'), ((247, 273), 'Cython.Distutils.build_ext', 'build_ext', (['*args'], {}), '(*args, **kwargs)\n', (256, 273), False, 'from Cython.Distutils import build_ext\n'), ((1338, 13... |
import openpnm as op
import numpy as np
import matplotlib.pyplot as plt
pn = op.network.Cubic(shape=[10, 10, 10], spacing=1e-4)
geo = op.geometry.SpheresAndCylinders(network=pn, pores=pn.Ps, throats=pn.Ts)
air = op.phases.Air(network=pn, name='air')
water = op.phases.Water(network=pn, name='h2o')
phys_air = op.physics... | [
"openpnm.algorithms.InvasionPercolation",
"openpnm.phases.Air",
"openpnm.network.Cubic",
"openpnm.algorithms.StokesFlow",
"openpnm.geometry.SpheresAndCylinders",
"openpnm.physics.Standard",
"openpnm.phases.Water",
"numpy.linspace",
"openpnm.io.Statoil.export_data"
] | [((78, 130), 'openpnm.network.Cubic', 'op.network.Cubic', ([], {'shape': '[10, 10, 10]', 'spacing': '(0.0001)'}), '(shape=[10, 10, 10], spacing=0.0001)\n', (94, 130), True, 'import openpnm as op\n'), ((135, 206), 'openpnm.geometry.SpheresAndCylinders', 'op.geometry.SpheresAndCylinders', ([], {'network': 'pn', 'pores': ... |
import torch
import numpy as np
from torchvision import models
from utils.misc import *
from utils.process_fp import process_inputs_fp
def compute_features(tg_model, free_model, tg_feature_model, is_start_iteration, evalloader, num_samples, num_features, device=None):
if device is None:
device = torch.devi... | [
"utils.process_fp.process_inputs_fp",
"torch.no_grad",
"numpy.zeros",
"torch.cuda.is_available"
] | [((493, 530), 'numpy.zeros', 'np.zeros', (['[num_samples, num_features]'], {}), '([num_samples, num_features])\n', (501, 530), True, 'import numpy as np\n'), ((558, 573), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (571, 573), False, 'import torch\n'), ((335, 360), 'torch.cuda.is_available', 'torch.cuda.is_avai... |
"Unit tests for Constraint, MonomialEquality and SignomialInequality"
import unittest
import numpy as np
from gpkit import Variable, SignomialsEnabled, Posynomial, VectorVariable
from gpkit.nomials import SignomialInequality, PosynomialInequality
from gpkit.nomials import MonomialEquality
from gpkit import Model, Const... | [
"gpkit.VectorVariable",
"gpkit.constraints.loose.Loose",
"gpkit.ConstraintSet",
"gpkit.constraints.relax.ConstraintsRelaxedEqually",
"gpkit.globals.NamedVariables.reset_modelnumbers",
"gpkit.nomials.PosynomialInequality",
"gpkit.tests.helpers.run_tests",
"gpkit.constraints.relax.ConstantsRelaxed",
"... | [((15753, 15769), 'gpkit.tests.helpers.run_tests', 'run_tests', (['TESTS'], {}), '(TESTS)\n', (15762, 15769), False, 'from gpkit.tests.helpers import run_tests\n'), ((997, 1010), 'gpkit.Variable', 'Variable', (['"""x"""'], {}), "('x')\n", (1005, 1010), False, 'from gpkit import Variable, SignomialsEnabled, Posynomial, ... |
from bokeh.models import ColumnDataSource, HoverTool, Range1d, Plot, LinearAxis, Grid, Paragraph,TapTool,Div
from bokeh.plotting import figure, show, output_file
from bokeh.io import curdoc
from bokeh.layouts import widgetbox , layout
from bokeh.models.widgets import Select, Slider, Button
import dim_reduction
import n... | [
"bokeh.models.Plot",
"bokeh.layouts.widgetbox",
"sklearn.preprocessing.MinMaxScaler",
"dim_reduction.project",
"pickle.load",
"data_format.get_data",
"bokeh.models.widgets.Slider",
"bokeh.models.widgets.Select",
"os.path.abspath",
"numpy.transpose",
"bokeh.io.curdoc",
"bokeh.models.Div",
"cl... | [((552, 577), 'os.path.abspath', 'os.path.abspath', (['"""./src/"""'], {}), "('./src/')\n", (567, 577), False, 'import os\n'), ((9359, 9404), 'data_format.get_data', 'data_format.get_data', (["(load_dir + 'model.json')"], {}), "(load_dir + 'model.json')\n", (9379, 9404), False, 'import data_format\n'), ((9438, 9494), '... |
#!/usr/bin/env -S conda run -n tf python
import numpy as np
import cv2
import onnxruntime
import json
import requests
from PIL import Image
from tqdm import tqdm
from pathlib import Path
from fire import Fire
from typing import List, Union, Tuple
def preprocess_image(
image_path,
min_side = 800,
max_side... | [
"json.dump",
"tqdm.tqdm",
"fire.Fire",
"pathlib.Path.home",
"cv2.cvtColor",
"PIL.Image.open",
"onnxruntime.InferenceSession",
"pathlib.Path",
"numpy.array",
"requests.get",
"PIL.Image.fromarray",
"cv2.resize"
] | [((1586, 1627), 'cv2.resize', 'cv2.resize', (['img', 'None'], {'fx': 'scale', 'fy': 'scale'}), '(img, None, fx=scale, fy=scale)\n', (1596, 1627), False, 'import cv2\n'), ((2423, 2431), 'pathlib.Path', 'Path', (['to'], {}), '(to)\n', (2427, 2431), False, 'from pathlib import Path\n'), ((2551, 2581), 'requests.get', 'req... |
"""Visualize the Fibonacci sequence in binary.
This script plots the Fibonacci sequence in binary form; the idea comes from
https://mathworld.wolfram.com/FibonacciNumber.html
and
https://www.maa.org/editorial/mathgames
This script depends on the dataset `fibonacci.dat`, which is hosted on Zenodo:
https://zenodo.o... | [
"pathlib.Path",
"numpy.zeros",
"matplotlib.colors.ListedColormap",
"matplotlib.pyplot.subplots"
] | [((916, 943), 'numpy.zeros', 'np.zeros', (['(N, B)'], {'dtype': 'int'}), '((N, B), dtype=int)\n', (924, 943), True, 'import numpy as np\n'), ((951, 962), 'numpy.zeros', 'np.zeros', (['B'], {}), '(B)\n', (959, 962), True, 'import numpy as np\n'), ((970, 981), 'numpy.zeros', 'np.zeros', (['B'], {}), '(B)\n', (978, 981), ... |
""" obtain the static field from a set of charges and
dipoles at polarizable points.
"""
import numpy
from .tensor import T
from .mulmom import MulMom as M
def get_static_field_from_file(potential, filename):
f = open(filename, 'r')
field = []
for i, line in enumerate(f):
d = line.split()
... | [
"numpy.array",
"numpy.zeros",
"numpy.ravel"
] | [((441, 459), 'numpy.ravel', 'numpy.ravel', (['field'], {}), '(field)\n', (452, 459), False, 'import numpy\n'), ((625, 657), 'numpy.zeros', 'numpy.zeros', (['(3 * potential.npols)'], {}), '(3 * potential.npols)\n', (636, 657), False, 'import numpy\n'), ((1041, 1070), 'numpy.zeros', 'numpy.zeros', (['potential.nsites'],... |
import sys
import os
import json
import numpy as np
import glob
import argparse
import pdb
import f0dl_bernox
def compute_f0_shift_curve(expt_dict, filter_key, filter_value, f0_min=80.0, f0_max=1e3):
'''
'''
# Identify trials where filter_key = filter_value and stimulus is in f0 range
indexes = expt_... | [
"json.dump",
"numpy.zeros_like",
"f0dl_bernox.add_f0_estimates_to_expt_dict",
"argparse.ArgumentParser",
"numpy.logical_and",
"numpy.median",
"numpy.std",
"numpy.min",
"numpy.mean",
"f0dl_bernox.load_f0_expt_dict_from_json",
"numpy.max",
"glob.glob",
"json.JSONEncoder.default",
"numpy.uniq... | [((744, 763), 'numpy.unique', 'np.unique', (['f0_shift'], {}), '(f0_shift)\n', (753, 763), True, 'import numpy as np\n'), ((789, 819), 'numpy.zeros_like', 'np.zeros_like', (['f0_shift_unique'], {}), '(f0_shift_unique)\n', (802, 819), True, 'import numpy as np\n'), ((847, 877), 'numpy.zeros_like', 'np.zeros_like', (['f0... |
"""
Base Class for Optimization Algorithms
Implements problem instance loading, heuristic initialization function, and data plotting functions.
"""
# ----------------------------------------------------------
import tsplib95 as tsp
from numpy.random import default_rng
# plotting
import matplotlib
import matplotlib... | [
"matplotlib.lines.Line2D",
"matplotlib.pyplot.close",
"matplotlib.rcParams.update",
"tsplib95.load",
"matplotlib.pyplot.subplots",
"numpy.random.default_rng",
"candidate_solution.CandidateSolution.set_problem",
"matplotlib.pyplot.style.use",
"matplotlib.use",
"pathlib.Path",
"matplotlib.pyplot.t... | [((396, 417), 'matplotlib.use', 'matplotlib.use', (['"""pgf"""'], {}), "('pgf')\n", (410, 417), False, 'import matplotlib\n'), ((418, 546), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'pgf.texsystem': 'pdflatex', 'font.family': 'serif', 'text.usetex': True,\n 'pgf.rcfonts': False}"], {}), "({'pgf... |
from emto_input_generator import *
import numpy as np
folder = os.getcwd() # Get current working directory.
emtopath = folder+"/L11_CuPt" # Folder where the calculations will be performed.
latpath = emtopath
# L11 CuPt
prims = np.array([[1.0,0.5,0.5],
[0.5,1.0,0.5],
[0... | [
"numpy.array",
"numpy.linspace"
] | [((240, 301), 'numpy.array', 'np.array', (['[[1.0, 0.5, 0.5], [0.5, 1.0, 0.5], [0.5, 0.5, 1.0]]'], {}), '([[1.0, 0.5, 0.5], [0.5, 1.0, 0.5], [0.5, 0.5, 1.0]])\n', (248, 301), True, 'import numpy as np\n'), ((343, 387), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0], [0.5, 0.5, 0.5]]'], {}), '([[0.0, 0.0, 0.0], [0.5, 0.... |
import numpy as np
import cv2
import math
from PIL import Image, ImageStat
import sys
from os import listdir
import pymeanshift as pms
import os.path
# path1 = "/Users/caijieyang/Desktop/allgoodthinghere/"
# files= listdir(path1)
avg_recall=[]
avg_pre=[]
hsl_acc_list=[]
manual_acc_list=[]
file = sys.argv[1]
file = str... | [
"numpy.asarray",
"PIL.Image.open",
"pymeanshift.segment",
"cv2.imread",
"PIL.Image.fromarray",
"PIL.Image.merge"
] | [((351, 367), 'PIL.Image.open', 'Image.open', (['file'], {}), '(file)\n', (361, 367), False, 'from PIL import Image, ImageStat\n'), ((534, 567), 'cv2.imread', 'cv2.imread', (["(file + '_cropped.png')"], {}), "(file + '_cropped.png')\n", (544, 567), False, 'import cv2\n'), ((616, 694), 'pymeanshift.segment', 'pms.segmen... |
#!/usr/bin/env python
#
# fix_settling_shifts.py
#
# Author: <NAME>, STScI, February 2022
#
# Script to fix shifts between groups introduced by settling issue.
#
# Input arguments:
# required: image filename (single "uncal.fits" file)
# optional: boxpeaksize (box size for searching central peak; default=20 pixels... | [
"argparse.ArgumentParser",
"numpy.argmax",
"astropy.stats.sigma_clipped_stats",
"jwst.ramp_fitting.RampFitStep.call",
"scipy.signal.fftconvolve",
"scipy.ndimage.median_filter",
"numpy.full",
"jwst.pipeline.calwebb_detector1.Detector1Pipeline.call",
"jwst.pipeline.Image2Pipeline.call",
"astropy.io.... | [((1422, 1510), 'scipy.signal.fftconvolve', 'scipy.signal.fftconvolve', (['data_template', 'data_to_be_shifted[::-1, ::-1]'], {'mode': '"""same"""'}), "(data_template, data_to_be_shifted[::-1, ::-1],\n mode='same')\n", (1446, 1510), False, 'import scipy\n'), ((2132, 2249), 'astropy.modeling.models.Gaussian2D', 'mode... |
"""
Unit tests for the atom ID filter
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import unittest
import numpy as np
from ....system import lattice
from .. import atomIdFilter
from .. import base
###############################################################################... | [
"numpy.empty",
"numpy.arange"
] | [((1719, 1765), 'numpy.arange', 'np.arange', (['self.lattice.NAtoms'], {'dtype': 'np.int32'}), '(self.lattice.NAtoms, dtype=np.int32)\n', (1728, 1765), True, 'import numpy as np\n'), ((1881, 1904), 'numpy.empty', 'np.empty', (['(0)', 'np.float64'], {}), '(0, np.float64)\n', (1889, 1904), True, 'import numpy as np\n'), ... |
"""
Filename: cartesian.py
Authors: <NAME>
Implements cartesian products and regular cartesian grids.
"""
import numpy
from numba import njit
def cartesian(nodes, order="C"):
"""Cartesian product of a list of arrays
Parameters:
-----------
nodes: (list of 1d-arrays)
order: ('C' or 'F') order i... | [
"numpy.cumprod",
"numba.njit",
"numpy.zeros",
"numpy.array",
"numpy.linspace",
"numpy.prod"
] | [((1674, 1690), 'numba.njit', 'njit', ([], {'cache': '(True)'}), '(cache=True)\n', (1678, 1690), False, 'from numba import njit\n'), ((579, 597), 'numpy.prod', 'numpy.prod', (['shapes'], {}), '(shapes)\n', (589, 597), False, 'import numpy\n'), ((608, 627), 'numpy.zeros', 'numpy.zeros', (['(l, n)'], {}), '((l, n))\n', (... |
"""
-------------------------------------------
Author: <NAME>
Date: 7/3/19
-------------------------------------------
"""
# common packages, most likely already installed
import scipy
import math
import pandas as pd
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
import sy... | [
"pandas.DataFrame",
"seaborn.set_style",
"matplotlib.pyplot.title",
"seaborn.kdeplot",
"networkx.degree",
"numpy.std",
"matplotlib.pyplot.legend",
"scipy.special.ndtr",
"numpy.mean",
"seaborn.distplot",
"networkx.subgraph",
"matplotlib.pyplot.ylabel",
"networkx.connected_component_subgraphs"... | [((2872, 2972), 'pandas.DataFrame', 'pd.DataFrame', (["{'min_degree': min_degree, 'max_degree': max_degree, 'genes_binned':\n genes_binned}"], {}), "({'min_degree': min_degree, 'max_degree': max_degree,\n 'genes_binned': genes_binned})\n", (2884, 2972), True, 'import pandas as pd\n'), ((10006, 10035), 'matplotlib... |
import os
import numpy as np
import scipy.io as sio
import skimage as sk
#from osgeo import gdal
from sklearn.metrics import f1_score, precision_score, recall_score, accuracy_score, confusion_matrix
import sklearn
import warnings
def save_as_mat(data, name):
sio.savemat(name, {name: data})
def Read_TIFF_Image(Pa... | [
"numpy.sum",
"sklearn.metrics.accuracy_score",
"numpy.ones",
"sklearn.metrics.f1_score",
"numpy.rot90",
"numpy.pad",
"numpy.max",
"warnings.catch_warnings",
"numpy.divide",
"numpy.size",
"sklearn.metrics.recall_score",
"numpy.min",
"numpy.flip",
"warnings.filterwarnings",
"numpy.zeros",
... | [((265, 296), 'scipy.io.savemat', 'sio.savemat', (['name', '{name: data}'], {}), '(name, {name: data})\n', (276, 296), True, 'import scipy.io as sio\n'), ((563, 608), 'numpy.zeros', 'np.zeros', (['(Image.shape[1], Image.shape[2], 1)'], {}), '((Image.shape[1], Image.shape[2], 1))\n', (571, 608), True, 'import numpy as n... |
import warnings
warnings.filterwarnings("ignore")
import yfinance as yf
import numpy as np
import pandas as pd
import matplotlib
import matplotlib as mpl
matplotlib.use("Agg")
from matplotlib import style
from matplotlib import pyplot as plt
plt.style.use("ggplot")
import seaborn as sns
plt.style.use("seaborn")
sn... | [
"numpy.random.seed",
"numpy.sum",
"numpy.argmax",
"numpy.argmin",
"matplotlib.pyplot.style.use",
"streamlit.sidebar.selectbox",
"numpy.round",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"streamlit.subheader",
"yfinance.download",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.subplots... | [((17, 50), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (40, 50), False, 'import warnings\n'), ((157, 178), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (171, 178), False, 'import matplotlib\n'), ((246, 269), 'matplotlib.pyplot.style.use', 'plt.... |
from stl import mesh
import math
import numpy
# Create 3 faces of a cube
data = numpy.zeros(6, dtype=mesh.Mesh.dtype)
# Top of the cube
data['vectors'][0] = numpy.array([[0, 1, 1],
[1, 0, 1],
[0, 0, 1]])
data['vectors'][1] = numpy.array([[1, 0, 1],
... | [
"matplotlib.pyplot.show",
"mpl_toolkits.mplot3d.Axes3D",
"math.radians",
"numpy.zeros",
"mpl_toolkits.mplot3d.art3d.Poly3DCollection",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.concatenate"
] | [((81, 118), 'numpy.zeros', 'numpy.zeros', (['(6)'], {'dtype': 'mesh.Mesh.dtype'}), '(6, dtype=mesh.Mesh.dtype)\n', (92, 118), False, 'import numpy\n'), ((159, 205), 'numpy.array', 'numpy.array', (['[[0, 1, 1], [1, 0, 1], [0, 0, 1]]'], {}), '([[0, 1, 1], [1, 0, 1], [0, 0, 1]])\n', (170, 205), False, 'import numpy\n'), ... |
#
# 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/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"arch.api.utils.log_utils.getLogger",
"numpy.square",
"federatedml.statistic.data_overview.rubbish_clear",
"federatedml.optim.gradient.HeteroLogisticGradient",
"federatedml.secureprotol.EncryptModeCalculator"
] | [((1082, 1103), 'arch.api.utils.log_utils.getLogger', 'log_utils.getLogger', ([], {}), '()\n', (1101, 1103), False, 'from arch.api.utils import log_utils\n'), ((2325, 2352), 'federatedml.statistic.data_overview.rubbish_clear', 'rubbish_clear', (['rubbish_list'], {}), '(rubbish_list)\n', (2338, 2352), False, 'from feder... |
import numpy as np
import cv2
# Identify pixels above the threshold
# Threshold of RGB > 160 does a nice job of identifying ground pixels only
def color_thresh(img, rgb_thresh=(160, 160, 160),above = True):
# Create an array of zeros same xy size as img, but single channel
color_select = np.zeros_like(img[:,:,... | [
"cv2.warpPerspective",
"numpy.zeros_like",
"numpy.arctan2",
"numpy.int_",
"numpy.abs",
"numpy.sum",
"cv2.getPerspectiveTransform",
"numpy.multiply",
"numpy.float32",
"numpy.clip",
"numpy.mean",
"numpy.arange",
"numpy.sin",
"numpy.cos",
"numpy.sqrt"
] | [((298, 325), 'numpy.zeros_like', 'np.zeros_like', (['img[:, :, 0]'], {}), '(img[:, :, 0])\n', (311, 325), True, 'import numpy as np\n'), ((1314, 1341), 'numpy.zeros_like', 'np.zeros_like', (['img[:, :, 0]'], {}), '(img[:, :, 0])\n', (1327, 1341), True, 'import numpy as np\n'), ((2660, 2696), 'numpy.sqrt', 'np.sqrt', (... |
import tensorflow as tf
from utils.util_class import WrongInputException
def augmentation_factory(augment_probs=None):
augment_probs = augment_probs if augment_probs else dict()
augmenters = []
for key, prob in augment_probs.items():
if key is "CropAndResize":
augm = CropAndResize(prob... | [
"tensorflow.image.flip_left_right",
"tensorflow.clip_by_value",
"tensorflow.reshape",
"tensorflow.image.crop_and_resize",
"numpy.isclose",
"tensorflow.linalg.inv",
"numpy.linalg.norm",
"utils.convert_pose.pose_rvec2matr_batch_tf",
"cv2.imshow",
"os.path.join",
"tensorflow.abs",
"tensorflow.ran... | [((9665, 9711), 'tensorflow.constant', 'tf.constant', (['[height, width]'], {'dtype': 'tf.float32'}), '([height, width], dtype=tf.float32)\n', (9676, 9711), True, 'import tensorflow as tf\n'), ((9728, 9832), 'tensorflow.constant', 'tf.constant', (['[[[width / 2, 0, width / 2], [0, height / 2, height / 2], [0, 0, 1]]]']... |
# contrast activity contrast back lr
import os
import mne
from mne.io import read_raw_fif
import numpy
import numpy as np
import matplotlib.pyplot as plt
import os.path as op
from operator import itemgetter
from mne.io import Raw
from mne.io import read_raw_ctf
from mne.preprocessing import ICA
from mne.viz import pl... | [
"numpy.load",
"mne.io.read_raw_fif",
"mne.pick_types",
"matplotlib.pyplot.close",
"numpy.shape",
"matplotlib.pyplot.figure",
"mne.channels.layout._find_topomap_coords",
"numpy.array",
"mne.Epochs",
"numpy.arange",
"matplotlib.gridspec.GridSpec",
"operator.itemgetter",
"mne.viz.topomap._plot_... | [((3639, 3663), 'numpy.array', 'np.array', (['list_data_back'], {}), '(list_data_back)\n', (3647, 3663), True, 'import numpy as np\n'), ((3677, 3701), 'numpy.array', 'np.array', (['list_data_left'], {}), '(list_data_left)\n', (3685, 3701), True, 'import numpy as np\n'), ((3716, 3741), 'numpy.array', 'np.array', (['list... |
import cv2
import numpy as np
import pyautogui
hand_hist = None
traverse_point = []
total_rectangle = 9
hand_rect_one_x = None
hand_rect_one_y = None
hand_rect_two_x = None
hand_rect_two_y = None
def rescale_frame(frame, wpercent=130, hpercent=130):
width = int(frame.shape[1] * wpercent / 100)
height = int(... | [
"cv2.bitwise_and",
"numpy.argmax",
"cv2.rectangle",
"cv2.normalize",
"cv2.erode",
"cv2.convexityDefects",
"cv2.subtract",
"cv2.filter2D",
"cv2.dilate",
"cv2.cvtColor",
"cv2.calcBackProject",
"cv2.destroyAllWindows",
"cv2.resize",
"cv2.circle",
"cv2.waitKey",
"cv2.calcHist",
"cv2.conv... | [((364, 428), 'cv2.resize', 'cv2.resize', (['frame', '(width, height)'], {'interpolation': 'cv2.INTER_AREA'}), '(frame, (width, height), interpolation=cv2.INTER_AREA)\n', (374, 428), False, 'import cv2\n'), ((489, 538), 'cv2.cvtColor', 'cv2.cvtColor', (['hist_mask_image', 'cv2.COLOR_BGR2GRAY'], {}), '(hist_mask_image, ... |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.ops.gradient_checker.compute_gradient_error",
"numpy.abs",
"numpy.asarray",
"tensorflow.python.framework.constant_op.constant",
"tensorflow.python.ops.nn_ops.softsign",
"numpy.array"
] | [((2751, 2762), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (2760, 2762), False, 'from tensorflow.python.platform import test\n'), ((1416, 1444), 'tensorflow.python.ops.nn_ops.softsign', 'nn_ops.softsign', (['np_features'], {}), '(np_features)\n', (1431, 1444), False, 'from tensorflow.python.... |
#import cv2
import numpy as np
#import os
#import tensorflow as tf
#from tensorflow import keras
def calib_input(iter):
X = np.load("features.npy") / 255.0
images = X[:100]
return {"conv2d_input": images}
| [
"numpy.load"
] | [((127, 150), 'numpy.load', 'np.load', (['"""features.npy"""'], {}), "('features.npy')\n", (134, 150), True, 'import numpy as np\n')] |
import os
import time
import torch
import numpy as np
import utils
import logging
from options import *
from model.hidden import Hidden
from average_meter import AverageMeter
def train(model: Hidden,
device: torch.device,
hidden_config: HiDDenConfiguration,
train_options: TrainingOption... | [
"utils.get_data_loaders",
"average_meter.AverageMeter",
"time.time",
"logging.info",
"numpy.random.choice",
"os.path.join",
"utils.log_progress"
] | [((952, 1004), 'utils.get_data_loaders', 'utils.get_data_loaders', (['hidden_config', 'train_options'], {}), '(hidden_config, train_options)\n', (974, 1004), False, 'import utils\n'), ((1656, 1667), 'time.time', 'time.time', ([], {}), '()\n', (1665, 1667), False, 'import time\n'), ((2704, 2726), 'logging.info', 'loggin... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 14 14:28:11 2018
@author: <NAME>
"""
import numpy as np
import numpy.random as rd
import argparse
from collections import deque
import pickle
import os
from ddpg import Actor, Critic
from make_env import make_env
import torch
dtype = torch.float
device = torch.device(... | [
"numpy.size",
"numpy.zeros_like",
"make_env.make_env",
"argparse.ArgumentParser",
"os.getcwd",
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"numpy.array",
"numpy.random.normal",
"torch.device",
"ddpg.Critic",
"ddpg.Actor",
"collections.deque",
"numpy.sqrt"
] | [((307, 327), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (319, 327), False, 'import torch\n'), ((443, 464), 'numpy.zeros_like', 'np.zeros_like', (['x_prev'], {}), '(x_prev)\n', (456, 464), True, 'import numpy as np\n'), ((477, 492), 'numpy.size', 'np.size', (['x_prev'], {}), '(x_prev)\n', (484,... |
import numpy as np
from yaml import safe_load
import pandas as pd
import glob
from cricscraper.cricinfo import CricInfo
from cricscraper.matchinfo import MatchInfo
class CricSheet:
innings_name = ["1st innings", "2nd innings", "3rd innings", "4th innings"]
def __init__(self, files=None, folder=None):
if fold... | [
"pandas.DataFrame",
"cricscraper.matchinfo.MatchInfo",
"numpy.ceil",
"cricscraper.cricinfo.CricInfo",
"yaml.safe_load",
"pandas.concat"
] | [((429, 443), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (441, 443), True, 'import pandas as pd\n'), ((4120, 4138), 'cricscraper.cricinfo.CricInfo', 'CricInfo', (['match_id'], {}), '(match_id)\n', (4128, 4138), False, 'from cricscraper.cricinfo import CricInfo\n'), ((1086, 1104), 'yaml.safe_load', 'safe_load... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import math
import numpy as np
from openvino.tools.mo.ops.ONNXResize10 import ONNXResize10
from openvino.tools.mo.ops.upsample import UpsampleOp
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.fron... | [
"openvino.tools.mo.front.onnx.extractors.utils.onnx_attr",
"openvino.tools.mo.front.onnx.extractors.utils.get_onnx_opset_version",
"math.fabs",
"openvino.tools.mo.ops.upsample.UpsampleOp.update_node_stat",
"openvino.tools.mo.utils.error.Error",
"numpy.array",
"openvino.tools.mo.ops.ONNXResize10.ONNXResi... | [((597, 625), 'openvino.tools.mo.front.onnx.extractors.utils.get_onnx_opset_version', 'get_onnx_opset_version', (['node'], {}), '(node)\n', (619, 625), False, 'from openvino.tools.mo.front.onnx.extractors.utils import onnx_attr, get_onnx_opset_version\n'), ((807, 858), 'openvino.tools.mo.ops.ONNXResize10.ONNXResize10.u... |
# encoding: utf-8
from nose.tools import *
import numpy as np
from cmpy.inference import standardize_data
from cmpy import machines
from ..canonical import tmatrix
from ..counts import path_counts, out_arrays
def test_path_counts1():
# Test without state_path
m = machines.Even()
delta, nodes, symbols =... | [
"cmpy.inference.standardize_data",
"numpy.random.RandomState",
"cmpy.machines.Even"
] | [((277, 292), 'cmpy.machines.Even', 'machines.Even', ([], {}), '()\n', (290, 292), False, 'from cmpy import machines\n'), ((344, 367), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (365, 367), True, 'import numpy as np\n'), ((426, 445), 'cmpy.inference.standardize_data', 'standardize_data', (['... |
import sys
import gurobipy
import math
import numpy as np
import time
# Lies die Lösungsdatei ein und gib eine Liste der Mittelpunkte zurück
# solutionFilePath = Pfad zur Lösungsdatei (string)
# n = Dimension der Kugel (int, >= 1)
def readSolution(solutionFilePath, n=3):
solution = []
try:
# Öffne die ... | [
"gurobipy.Model",
"time.time",
"numpy.array",
"math.cos",
"sys.exit"
] | [((1451, 1467), 'gurobipy.Model', 'gurobipy.Model', ([], {}), '()\n', (1465, 1467), False, 'import gurobipy\n'), ((4200, 4216), 'gurobipy.Model', 'gurobipy.Model', ([], {}), '()\n', (4214, 4216), False, 'import gurobipy\n'), ((5245, 5256), 'time.time', 'time.time', ([], {}), '()\n', (5254, 5256), False, 'import time\n'... |
# -*- coding: utf-8 -*-
import cv2, glob
import numpy as np
import pandas as pd
from os import path
from math import isnan
from sklearn.metrics.pairwise import euclidean_distances
from JPP_precision import load_JPP_ply
from Modules.utils import get_parameter, get_args, figure_disappears, enum_test_files
from Modules.f... | [
"pandas.DataFrame",
"math.isnan",
"Modules.coordinate_conversion.project_point_cloud",
"pandas.read_csv",
"JPP_precision.load_JPP_ply",
"numpy.zeros",
"numpy.ones",
"os.path.exists",
"Modules.features_labels.make_labels",
"Modules.utils.get_args",
"cv2.imread",
"numpy.where",
"numpy.array",
... | [((494, 516), 'numpy.ones', 'np.ones', (['(n_joints, 2)'], {}), '((n_joints, 2))\n', (501, 516), True, 'import numpy as np\n'), ((687, 815), 'numpy.array', 'np.array', (['(0, 0, 0, 0, 1, 2, 2, 3, 3, 4, 5, 18, 18, 18, 18, 6, 7, 8, 9, 10, 11, 18, \n 18, 18, 18, 12, 13, 14, 15, 16, 17, 18)'], {}), '((0, 0, 0, 0, 1, 2, ... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
x=np.arange(0,2*np.pi,0.1)
y=np.exp(x)
plt.plot(x,y)
plt.show()
| [
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((71, 99), 'numpy.arange', 'np.arange', (['(0)', '(2 * np.pi)', '(0.1)'], {}), '(0, 2 * np.pi, 0.1)\n', (80, 99), True, 'import numpy as np\n'), ((98, 107), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (104, 107), True, 'import numpy as np\n'), ((108, 122), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, ... |
"""
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
# -*- coding: utf-8 -*-
import sys
import os
import time
import argparse
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
from PIL import Image
import cv2
from skimage import io... | [
"argparse.ArgumentParser",
"torch.cat",
"tools.craft_utils.adjustResultCoordinates",
"models.moran.MORAN.cuda",
"torch.no_grad",
"cv2.imshow",
"models.moran.MORAN.eval",
"torch.load",
"models.craft.CRAFT",
"tools.utils.strLabelConverterForAttention",
"tools.utils.saveResult",
"tools.utils.load... | [((2591, 2650), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""CRAFT Text Detection"""'}), "(description='CRAFT Text Detection')\n", (2614, 2650), False, 'import argparse\n'), ((812, 825), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (823, 825), False, 'from collections im... |
# Author: <NAME> <<EMAIL>>
# License: Simplified BSD
from sklearn.metrics.pairwise import polynomial_kernel
from sklearn.utils.extmath import safe_sparse_dot
from scipy.sparse import issparse
import numpy as np
def safe_power(X, degree=2):
"""Element-wise power supporting both sparse and dense data.
Parame... | [
"numpy.dot",
"scipy.sparse.issparse",
"sklearn.metrics.pairwise.polynomial_kernel"
] | [((630, 641), 'scipy.sparse.issparse', 'issparse', (['X'], {}), '(X)\n', (638, 641), False, 'from scipy.sparse import issparse\n'), ((1498, 1554), 'sklearn.metrics.pairwise.polynomial_kernel', 'polynomial_kernel', (['X', 'P'], {'degree': 'degree', 'gamma': '(1)', 'coef0': '(0)'}), '(X, P, degree=degree, gamma=1, coef0=... |
import numpy
from noise import snoise2
from worldengine.model.world import Step
from worldengine.simulations.basic import find_threshold_f
from worldengine.simulations.hydrology import WatermapSimulation
from worldengine.simulations.irrigation import IrrigationSimulation
from worldengine.simulations.humidity import H... | [
"worldengine.simulations.basic.find_threshold_f",
"worldengine.simulations.temperature.TemperatureSimulation",
"numpy.iinfo",
"worldengine.simulations.permeability.PermeabilitySimulation",
"worldengine.simulations.biome.BiomeSimulation",
"worldengine.simulations.hydrology.WatermapSimulation",
"worldengi... | [((1152, 1165), 'worldengine.common.get_verbose', 'get_verbose', ([], {}), '()\n', (1163, 1165), False, 'from worldengine.common import anti_alias, get_verbose\n'), ((1338, 1351), 'worldengine.common.get_verbose', 'get_verbose', ([], {}), '()\n', (1349, 1351), False, 'from worldengine.common import anti_alias, get_verb... |
#!/usr/bin/env python
import copy
import numpy as np
from scipy import signal
from edrixs.photon_transition import dipole_polvec_rixs
from edrixs.utils import boltz_dist
from edrixs.rixs_utils import scattering_mat
if __name__ == "__main__":
'''
Purpose: This exampl... | [
"edrixs.photon_transition.dipole_polvec_rixs",
"numpy.abs",
"scipy.signal.fftconvolve",
"edrixs.utils.boltz_dist",
"numpy.zeros",
"numpy.transpose",
"numpy.loadtxt",
"numpy.linspace",
"numpy.exp",
"edrixs.rixs_utils.scattering_mat"
] | [((1002, 1028), 'numpy.linspace', 'np.linspace', (['om1', 'om2', 'nom'], {}), '(om1, om2, nom)\n', (1013, 1028), True, 'import numpy as np\n'), ((1087, 1117), 'numpy.linspace', 'np.linspace', (['(-0.5)', '(5.0)', 'neloss'], {}), '(-0.5, 5.0, neloss)\n', (1098, 1117), True, 'import numpy as np\n'), ((1372, 1396), 'numpy... |
# -*- coding: utf-8 -*-
import io
import os
import shutil
import itertools
import gzip
import warnings
import tempfile
import atexit
import zarr
import h5py
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
import pytest
from pytest import approx
from allel.io.vcf_read import ... | [
"atexit.register",
"numpy.load",
"os.remove",
"pandas.read_csv",
"numpy.isnan",
"allel.io.vcf_read.read_vcf",
"allel.io.vcf_read.vcf_to_dataframe",
"shutil.rmtree",
"numpy.testing.assert_array_almost_equal",
"os.path.join",
"zarr.open_group",
"allel.io.vcf_read.vcf_to_csv",
"allel.io.vcf_rea... | [((617, 641), 'warnings.resetwarnings', 'warnings.resetwarnings', ([], {}), '()\n', (639, 641), False, 'import warnings\n'), ((642, 673), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""'], {}), "('always')\n", (663, 673), False, 'import warnings\n'), ((715, 733), 'tempfile.mkdtemp', 'tempfile.mkdtemp'... |
"""
Tests module image_io
# Author: <NAME>
# $Id:$
"""
from __future__ import unicode_literals
from __future__ import print_function
__version__ = "$Revision:$"
from copy import copy, deepcopy
import pickle
import os.path
import unittest
import numpy
import numpy.testing as np_test
import scipy
from pyto.io.ima... | [
"unittest.TextTestRunner",
"numpy.testing.assert_almost_equal",
"numpy.dtype",
"pyto.io.image_io.ImageIO",
"numpy.array",
"unittest.TestLoader",
"numpy.testing.assert_equal",
"numpy.arange"
] | [((928, 937), 'pyto.io.image_io.ImageIO', 'ImageIO', ([], {}), '()\n', (935, 937), False, 'from pyto.io.image_io import ImageIO\n'), ((1170, 1179), 'pyto.io.image_io.ImageIO', 'ImageIO', ([], {}), '()\n', (1177, 1179), False, 'from pyto.io.image_io import ImageIO\n'), ((1256, 1354), 'numpy.array', 'numpy.array', (['[[-... |
import networkx as nx
import numpy as np
import pickle
G = nx.Graph()
node1, node2 = np.loadtxt(graph_input, usecols=(0,1), unpack=True)
for i in range(len(node1)):
G.add_edge(node1[i], node2[i])
graph_num_node = G.number_of_nodes()
print(f"This graph contains {graph_num_node} nodes. ")
graph_num_edge = G.numbe... | [
"networkx.set_node_attributes",
"networkx.betweenness_centrality",
"numpy.column_stack",
"networkx.Graph",
"numpy.loadtxt",
"numpy.array",
"networkx.get_node_attributes"
] | [((60, 70), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (68, 70), True, 'import networkx as nx\n'), ((86, 138), 'numpy.loadtxt', 'np.loadtxt', (['graph_input'], {'usecols': '(0, 1)', 'unpack': '(True)'}), '(graph_input, usecols=(0, 1), unpack=True)\n', (96, 138), True, 'import numpy as np\n'), ((408, 436), 'network... |
"""Collection of tests for sorting functions."""
# global
from hypothesis import given, strategies as st
import numpy as np
# local
import ivy_tests.test_ivy.helpers as helpers
import ivy.functional.backends.numpy as ivy_np
# argsort
@given(
array_shape=helpers.lists(
st.integers(1, 5), min_size="num_di... | [
"hypothesis.strategies.data",
"ivy_tests.test_ivy.helpers.num_positional_args",
"ivy_tests.test_ivy.helpers.test_array_function",
"hypothesis.strategies.sampled_from",
"numpy.isnan",
"hypothesis.strategies.booleans",
"hypothesis.strategies.integers",
"ivy_tests.test_ivy.helpers.nph.arrays"
] | [((1313, 1516), 'ivy_tests.test_ivy.helpers.test_array_function', 'helpers.test_array_function', (['input_dtype', 'as_variable', 'with_out', 'num_positional_args', 'native_array', 'container', 'instance_method', 'fw', '"""argsort"""'], {'x': 'x', 'axis': 'axis', 'descending': 'descending', 'stable': 'stable'}), "(input... |
import numpy as np
from random import random
from noneq_settings import BETA
def hamming(s1, s2):
"""Calculate the Hamming distance between two bit lists"""
assert len(s1) == len(s2)
return sum(c1 != c2 for c1, c2 in zip(s1, s2))
def hamiltonian(state_vec, intxn_matrix):
return -0.5 * reduce(np.dot... | [
"numpy.zeros",
"random.random",
"numpy.array",
"numpy.exp",
"numpy.dot"
] | [((514, 560), 'numpy.dot', 'np.dot', (['intxn_matrix[spin_idx, :]', 'state[:, t]'], {}), '(intxn_matrix[spin_idx, :], state[:, t])\n', (520, 560), True, 'import numpy as np\n'), ((686, 694), 'random.random', 'random', ([], {}), '()\n', (692, 694), False, 'from random import random\n'), ((2226, 2248), 'numpy.zeros', 'np... |
# Copyright 2020 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"numpy.random.seed",
"magenta.models.arbitrary_image_stylization.arbitrary_image_stylization_build_model.build_model",
"magenta.models.image_stylization.image_utils.load_np_image_uint8",
"tensorflow.compat.v1.gfile.Exists",
"magenta.models.image_stylization.image_utils.resize_image",
"tensorflow.compat.v1... | [((2656, 2697), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (2680, 2697), True, 'import tensorflow.compat.v1 as tf\n'), ((7755, 7779), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (7777, 7779), Tru... |
#!/usr/bin/env python
"""
@package ion_functions.data.adcp_functions
@file ion_functions/data/adcp_functions.py
@author <NAME>, <NAME>, <NAME>
@brief Module containing ADCP related data-calculations.
"""
import numpy as np
from ion_functions.data.generic_functions import magnetic_declination
from ion_functions... | [
"numpy.radians",
"ion_functions.data.generic_functions.magnetic_declination",
"ion_functions.data.generic_functions.replace_fill_with_nan",
"numpy.isscalar",
"numpy.deg2rad",
"numpy.zeros",
"numpy.ones",
"numpy.einsum",
"numpy.sin",
"numpy.array",
"numpy.fabs",
"numpy.cos",
"numpy.rollaxis",... | [((5640, 5658), 'numpy.atleast_1d', 'np.atleast_1d', (['lat'], {}), '(lat)\n', (5653, 5658), True, 'import numpy as np\n'), ((5670, 5688), 'numpy.atleast_1d', 'np.atleast_1d', (['lon'], {}), '(lon)\n', (5683, 5688), True, 'import numpy as np\n'), ((5699, 5716), 'numpy.atleast_1d', 'np.atleast_1d', (['dt'], {}), '(dt)\n... |
import numpy as np
import os
from scipy.io.wavfile import write as audio_write
### Generate data
data = np.random.uniform(size=(10000)) # single example
DATA = np.random.uniform(size=(10,10000)) # multi example
wavfiles, numpyfiles = [], []
datafolder = 'data_intro/data'
os.makedirs(datafolder,exist_ok=True)
os.makedi... | [
"numpy.random.uniform",
"numpy.save",
"os.makedirs",
"scipy.io.wavfile.write",
"dabstract.abstract.abstract.DataAbstract",
"numpy.mean",
"dabstract.abstract.abstract.MapAbstract",
"os.path.join",
"dabstract.dataprocessor.ProcessingChain"
] | [((105, 134), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(10000)'}), '(size=10000)\n', (122, 134), True, 'import numpy as np\n'), ((161, 196), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(10, 10000)'}), '(size=(10, 10000))\n', (178, 196), True, 'import numpy as np\n'), ((273, 311), 'os.... |
from operator import mul
try:
reduce
except NameError:
from functools import reduce
import numpy as np
def logit(x):
return np.log(x) - np.log(1 - x)
def logitsum(xs):
total = 0
for x in xs:
total += logit(x)
return total
def prod(*x):
return reduce(mul, x, 1)
| [
"functools.reduce",
"numpy.log"
] | [((286, 303), 'functools.reduce', 'reduce', (['mul', 'x', '(1)'], {}), '(mul, x, 1)\n', (292, 303), False, 'from functools import reduce\n'), ((139, 148), 'numpy.log', 'np.log', (['x'], {}), '(x)\n', (145, 148), True, 'import numpy as np\n'), ((151, 164), 'numpy.log', 'np.log', (['(1 - x)'], {}), '(1 - x)\n', (157, 164... |
import pytest
import json
from ..embedding.model import EmbeddingModel
from ..feature_extraction import FeatureExtraction
import numpy as np
class TestFeatureExtraction():
@classmethod
def setup_class(self):
self.embedder_DE = EmbeddingModel(lang="de")
self.embedder_EN = EmbeddingModel(lang="en... | [
"numpy.array"
] | [((518, 578), 'numpy.array', 'np.array', (['[[-1, 1, 1], [-11, 3, 9], [22, 0, 8]]'], {'dtype': 'float'}), '([[-1, 1, 1], [-11, 3, 9], [22, 0, 8]], dtype=float)\n', (526, 578), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.