code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import Agent
import aux_functions
from collections import deque
import pickle
import numpy as np
import torch
import torch.optim as optim
def init_algo(data_path, history_power_td=60000, weather_dim=6):
agents = deque(maxlen=4)
policy = Agent.Policy(state_size=weather_dim)
optimizer = o... | [
"numpy.mean",
"collections.deque",
"pickle.dump",
"aux_functions.preprocess_weather_data",
"aux_functions.preprocess_power_data",
"torch.Tensor",
"torch.no_grad",
"Agent.Policy",
"Agent.Agent"
] | [((226, 241), 'collections.deque', 'deque', ([], {'maxlen': '(4)'}), '(maxlen=4)\n', (231, 241), False, 'from collections import deque\n'), ((257, 293), 'Agent.Policy', 'Agent.Policy', ([], {'state_size': 'weather_dim'}), '(state_size=weather_dim)\n', (269, 293), False, 'import Agent\n'), ((383, 413), 'collections.dequ... |
"""
Used to generate a sample from an MFGP sample.
-- <EMAIL>
"""
# pylint: disable=import-error
# pylint: disable=no-member
# pylint: disable=invalid-name
# pylint: disable=relative-import
# pylint: disable=too-many-locals
# pylint: disable=no-name-in-module
# pylint: disable=superfluous-parens
import numpy as n... | [
"numpy.random.get_state",
"numpy.random.set_state",
"scipy.interpolate.RectBivariateSpline",
"mf_func.get_noisy_mfof_from_mfof",
"numpy.random.random",
"gp.kernel.SEKernel",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"mf_func.MFOptFunction",
"numpy.random.seed",
"mf_gp.get_mfgp_from_fidel... | [((821, 842), 'numpy.random.get_state', 'np.random.get_state', ([], {}), '()\n', (840, 842), True, 'import numpy as np\n'), ((845, 872), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (859, 872), True, 'import numpy as np\n'), ((1003, 1016), 'numpy.array', 'np.array', (['[1]'], {}), '(... |
#! /usr/bin/env python3
from mvnc import mvncapi as mvnc
import numpy, cv2
import sys, os
import cPickle as pickle
import fd
def getPaddingSize(img):
h, w, _ = img.shape
top, bottom, left, right = (0,0,0,0)
if w < int(h / 3 * 4):
tmp = int(h / 3 * 4) - w
left = tmp // 2
right = tm... | [
"numpy.mean",
"os.listdir",
"cPickle.dump",
"numpy.sqrt",
"fd.detect_face",
"cv2.copyMakeBorder",
"numpy.subtract",
"mvnc.mvncapi.Device",
"numpy.square",
"numpy.any",
"cv2.cvtColor",
"numpy.std",
"cv2.resize",
"cv2.imread",
"mvnc.mvncapi.EnumerateDevices"
] | [((565, 606), 'cv2.resize', 'cv2.resize', (['image_to_classify', '(640, 480)'], {}), '(image_to_classify, (640, 480))\n', (575, 606), False, 'import numpy, cv2\n'), ((699, 792), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (['image', 'top', 'bottom', 'left', 'right', 'cv2.BORDER_CONSTANT'], {'value': '[0, 0, 0]'}), '(im... |
'''
Created on Sep 24, 2016
@author: Wajih-PC
'''
import numpy as np
from scipy.special import erfinv
def sigmrnd(input):
# Declaring variables as np float type to avoid Overflow warnings
minusone = np.float(-1.0)
plusone = np.float(1.0)
sigmVals = np.true_divide(plusone,np.add(plusone,n... | [
"numpy.where",
"numpy.multiply",
"numpy.float",
"numpy.random.uniform"
] | [((220, 234), 'numpy.float', 'np.float', (['(-1.0)'], {}), '(-1.0)\n', (228, 234), True, 'import numpy as np\n'), ((251, 264), 'numpy.float', 'np.float', (['(1.0)'], {}), '(1.0)\n', (259, 264), True, 'import numpy as np\n'), ((372, 408), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', 'input.shape'], {}), ... |
#!/usr/bin/env python
#----------------------------------------------------------------------------
# Copyright (c) 2013, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#----------------------------------... | [
"numpy.distutils.misc_util.Configuration"
] | [((488, 537), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""extern"""', 'parent_package', 'top_path'], {}), "('extern', parent_package, top_path)\n", (501, 537), False, 'from numpy.distutils.misc_util import Configuration\n')] |
# Copyright (c) 2021 <NAME>. All rights reserved.
# This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details)
"""Base class for working with records.
vectorbt works with two different representations of data: matrices and records.
A matrix, in this context, is just an array of o... | [
"vectorbt.generic.stats_builder.StatsBuilderMixin.stats_defaults.__get__",
"numpy.argsort",
"vectorbt.utils.attr_.get_dict_attr",
"vectorbt.base.reshape_fns.to_1d_array",
"numpy.flatnonzero",
"numpy.asarray",
"numpy.take",
"vectorbt.records.col_mapper.ColumnMapper",
"vectorbt.records.nb.is_col_sorte... | [((12280, 12319), 'vectorbt._typing.TypeVar', 'tp.TypeVar', (['"""RecordsT"""'], {'bound': '"""Records"""'}), "('RecordsT', bound='Records')\n", (12290, 12319), True, 'from vectorbt import _typing as tp\n'), ((15048, 15143), 'vectorbt.base.array_wrapper.Wrapping.__init__', 'Wrapping.__init__', (['self', 'wrapper'], {'r... |
import numpy as np
import json
# with open("pattern.json", "r") as fh:
# patterns = json.load(fh)
class Pat_Match(object):
def __init__(self, config, label_to_id, filt=None):
self.config = config
self.label_to_id = label_to_id
self.patterns = config.patterns
if filt is not No... | [
"numpy.zeros",
"numpy.amax",
"numpy.argmax"
] | [((603, 632), 'numpy.zeros', 'np.zeros', (['[num_text, num_pat]'], {}), '([num_text, num_pat])\n', (611, 632), True, 'import numpy as np\n'), ((648, 686), 'numpy.zeros', 'np.zeros', (['[num_text, config.num_class]'], {}), '([num_text, config.num_class])\n', (656, 686), True, 'import numpy as np\n'), ((1159, 1182), 'num... |
import numpy as np
from PIL import Image
from loader_base import LoaderBase
import os
class LoaderNumpy(LoaderBase):
def __init__(self, root, data_transform=[], target_transform=[]):
super(LoaderNumpy, self).__init__(root, data_transform, target_transform)
def index_dataset(self, dir):
# get... | [
"os.path.join",
"os.listdir",
"numpy.left_shift",
"numpy.ndarray"
] | [((1027, 1061), 'numpy.ndarray', 'np.ndarray', (['(x, y)'], {'dtype': 'np.int16'}), '((x, y), dtype=np.int16)\n', (1037, 1061), True, 'import numpy as np\n'), ((1112, 1133), 'numpy.left_shift', 'np.left_shift', (['out', '(8)'], {}), '(out, 8)\n', (1125, 1133), True, 'import numpy as np\n'), ((548, 577), 'os.path.join',... |
from .quantizer import quantize
from .io_helper import write_quantized_output
from numpy import floor
import os
from jinja2 import Environment, FileSystemLoader
from shutil import copy
from .caf_verilog_base import CafVerilogBase
class CpxMultiply(CafVerilogBase):
def __init__(self, x, y, x_i_bits=12, x_q_bits=0... | [
"os.path.join",
"numpy.floor",
"jinja2.Environment"
] | [((2683, 2718), 'jinja2.Environment', 'Environment', ([], {'loader': 'template_loader'}), '(loader=template_loader)\n', (2694, 2718), False, 'from jinja2 import Environment, FileSystemLoader\n'), ((2003, 2027), 'numpy.floor', 'floor', (['self.x_quant.real'], {}), '(self.x_quant.real)\n', (2008, 2027), False, 'from nump... |
import numpy as np
import teaserpp_python
from Config import Config
import gtsam as gt
from gtsam import (Cal3_S2, GenericProjectionFactorCal3_S2,
NonlinearFactorGraph, NonlinearISAM, Pose3,
PriorFactorPoint3, PriorFactorPose3, Rot3,
PinholeCameraCal3_S2, Values,... | [
"numpy.sqrt",
"gtsam.Pose3",
"gtsam.Point3",
"gtsam.Marginals",
"numpy.array",
"gtsam.Values",
"numpy.arange",
"gtsam.symbol_shorthand.X",
"teaserpp_python.RobustRegistrationSolver.Params",
"gtsam.noiseModel_Diagonal.Information",
"teaserpp_python.RobustRegistrationSolver",
"numpy.dot",
"num... | [((3547, 3596), 'teaserpp_python.RobustRegistrationSolver.Params', 'teaserpp_python.RobustRegistrationSolver.Params', ([], {}), '()\n', (3594, 3596), False, 'import teaserpp_python\n'), ((4094, 4154), 'teaserpp_python.RobustRegistrationSolver', 'teaserpp_python.RobustRegistrationSolver', (['self.solver_params'], {}), '... |
try:
import torch
import torchmetrics
from latte.metrics.torch import interpolatability as T
has_torch_and_tm = True
except:
has_torch_and_tm = False
import pytest
import numpy as np
from latte.metrics.core import interpolatability as C
@pytest.mark.skipif(not has_torch_and_tm, reason="requires... | [
"torch.testing.assert_allclose",
"numpy.arange",
"numpy.testing.assert_allclose",
"torch.from_numpy",
"pytest.mark.skipif",
"latte.metrics.core.interpolatability.Smoothness",
"numpy.random.randn",
"latte.metrics.torch.interpolatability.Smoothness"
] | [((263, 350), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not has_torch_and_tm)'], {'reason': '"""requires torch and torchmetrics"""'}), "(not has_torch_and_tm, reason=\n 'requires torch and torchmetrics')\n", (281, 350), False, 'import pytest\n'), ((419, 433), 'latte.metrics.core.interpolatability.Smoothness', ... |
import itertools
import time
import numpy as np
import scipy.ndimage as ndi
import pytest
from mrrt.utils import ImageGeometry, ellipse_im
from mrrt.mri import mri_exp_approx
__all__ = ["test_mri_exp_approx"]
def _test_mri_exp_approx1(
segments=4,
nx=64,
tmax=25e-3,
dt=5e-6,
autocorr=False,
... | [
"pytest.mark.filterwarnings",
"numpy.array",
"scipy.ndimage.zoom",
"numpy.arange",
"matplotlib.pyplot.imshow",
"itertools.product",
"numpy.asarray",
"numpy.dot",
"mrrt.mri.mri_exp_approx",
"numpy.round",
"numpy.abs",
"numpy.ones",
"numpy.floor",
"scipy.ndimage.convolve",
"numpy.any",
"... | [((4468, 4531), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:the matrix subclass is not"""'], {}), "('ignore:the matrix subclass is not')\n", (4494, 4531), False, 'import pytest\n'), ((547, 569), 'numpy.arange', 'np.arange', (['(0)', 'tmax', 'dt'], {}), '(0, tmax, dt)\n', (556, 569), True, '... |
from __future__ import print_function
import torch
import torch.utils.data as data
import torchvision
from torchvision import transforms
import random
import os
import numpy as np
from PIL import Image
class Base_Dataset(data.Dataset):
def __init__(self, root, partition, target_ratio=0.0):
super(Base_Datas... | [
"torchvision.transforms.CenterCrop",
"random.choice",
"PIL.Image.open",
"random.shuffle",
"torch.LongTensor",
"torch.stack",
"os.path.join",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomCrop",
"torch.tensor",
"numpy.array",
"torchvision.transforms.Normalize",
... | [((609, 657), 'torchvision.transforms.Normalize', 'transforms.Normalize', ([], {'mean': 'mean_pix', 'std': 'std_pix'}), '(mean=mean_pix, std=std_pix)\n', (629, 657), False, 'from torchvision import transforms\n'), ((2421, 2455), 'random.shuffle', 'random.shuffle', (['class_index_source'], {}), '(class_index_source)\n',... |
import numpy as np
import torch
from experience_replay import ExperienceReplay
from network import Q
from config import hyperparameters as h
#----------------------------------------------------------------------------
# Reinforcement learning agent.
class Agent:
def __init__(self, state_shape, nof_actions):
... | [
"torch.from_numpy",
"experience_replay.ExperienceReplay",
"torch.tensor",
"numpy.random.randint",
"numpy.random.sample",
"network.Q"
] | [((466, 495), 'experience_replay.ExperienceReplay', 'ExperienceReplay', (['state_shape'], {}), '(state_shape)\n', (482, 495), False, 'from experience_replay import ExperienceReplay\n'), ((513, 550), 'network.Q', 'Q', (['state_shape', 'nof_actions', '"""online"""'], {}), "(state_shape, nof_actions, 'online')\n", (514, 5... |
# Copyright 2022 The Brax 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 wri... | [
"logging.getLogger",
"logging.StreamHandler",
"brax.io.file.Exists",
"brax.io.file.MakeDirs",
"numpy.array",
"pyqtgraph.Qt.QtGui.QApplication",
"copy.deepcopy",
"pyqtgraph.GraphicsWindow",
"numpy.genfromtxt",
"numpy.mean",
"collections.deque",
"brax.io.file.File",
"numpy.max",
"multiproces... | [((962, 994), 'pprint.pformat', 'pprint.pformat', (['config'], {'indent': '(2)'}), '(config, indent=2)\n', (976, 994), False, 'import pprint\n'), ((6220, 6245), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (6243, 6245), False, 'import collections\n'), ((7076, 7087), 'time.time', 'time.time', ... |
'''
PointGroup train.py
Written by <NAME>
'''
import torch
import torch.nn.functional as F
import torch.optim as optim
import time, sys, os, random
from tensorboardX import SummaryWriter
import numpy as np
from util.config import cfg
from util.log import logger
import util.utils as utils
device = torch.device("cuda:... | [
"util.utils.is_power2",
"torch.cuda.is_available",
"util.utils.is_multiple",
"model.pointgroup.pointgroup.PointGroup",
"tensorboardX.SummaryWriter",
"util.log.logger.info",
"torch.set_num_threads",
"numpy.random.seed",
"util.config.cfg.config.split",
"time.time",
"torch.cuda.empty_cache",
"tor... | [((431, 473), 'os.path.join', 'os.path.join', (['cfg.exp_path', '"""backup_files"""'], {}), "(cfg.exp_path, 'backup_files')\n", (443, 473), False, 'import time, sys, os, random\n'), ((478, 516), 'os.makedirs', 'os.makedirs', (['backup_dir'], {'exist_ok': '(True)'}), '(backup_dir, exist_ok=True)\n', (489, 516), False, '... |
import ast
import operator
import pickle
from copy import deepcopy
from typing import List
import cv2
import numpy as np
import albumentations as A
from torch.utils.data import Dataset
from mlcomp.db.providers import ModelProvider
from mlcomp.utils.config import parse_albu_short, Config
from mlcomp.utils.torch impor... | [
"mlcomp.utils.torch.infer",
"numpy.array",
"mlcomp.db.providers.ModelProvider",
"cv2.imdecode",
"mlcomp.contrib.transform.tta.TtaWrap",
"copy.deepcopy",
"ast.parse",
"mlcomp.utils.config.parse_albu_short"
] | [((1599, 1610), 'copy.deepcopy', 'deepcopy', (['x'], {}), '(x)\n', (1607, 1610), False, 'from copy import deepcopy\n'), ((2221, 2242), 'mlcomp.contrib.transform.tta.TtaWrap', 'TtaWrap', (['x', 'tfms_albu'], {}), '(x, tfms_albu)\n', (2228, 2242), False, 'from mlcomp.contrib.transform.tta import TtaWrap\n'), ((3376, 3472... |
import bpy
import sys
import pickle
import struct
import numpy
PEANO_PREFIX = "_Peano"
WATER_MATERIAL_NAME = "Meta-water"
WIREFRAME_MATERIAL = "WireframeMaterial"
WIREFRAME_OFFSET = 0.001
class ReferenceArray:
def __init__(self, cellsPerDimension):
numpy.zeros([cellsPerDimension, cellsPerDimension], int)
def d... | [
"bpy.ops.object.editmode_toggle",
"bpy.context.scene.objects.link",
"bpy.data.meshes.remove",
"bpy.ops.mesh.select_all",
"time.clock",
"bpy.ops.object.mode_set",
"bpy.ops.object.material_slot_assign",
"bpy.context.scene.objects.unlink",
"bpy.data.objects.new",
"pickle.load",
"bpy.ops.mesh.faces_... | [((1587, 1625), 'bpy.data.objects.new', 'bpy.data.objects.new', (['objectName', 'mesh'], {}), '(objectName, mesh)\n', (1607, 1625), False, 'import bpy\n'), ((1663, 1706), 'bpy.context.scene.objects.link', 'bpy.context.scene.objects.link', (['peanoObject'], {}), '(peanoObject)\n', (1693, 1706), False, 'import bpy\n'), (... |
# Copyright (c) 2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Meteogram
=========
Plots time series data as a meteogram.
"""
import datetime as dt
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from metpy.ca... | [
"datetime.datetime",
"matplotlib.dates.date2num",
"metpy.plots.add_metpy_logo",
"datetime.datetime.utcnow",
"matplotlib.dates.DateFormatter",
"metpy.cbook.get_test_data",
"numpy.array",
"matplotlib.pyplot.figure",
"metpy.units.units",
"datetime.timedelta",
"numpy.arange",
"matplotlib.pyplot.sh... | [((6981, 7018), 'datetime.datetime', 'dt.datetime', (['(2016)', '(3)', '(31)', '(22)', '(0)', '(0)', '(0)'], {}), '(2016, 3, 31, 22, 0, 0, 0)\n', (6992, 7018), True, 'import datetime as dt\n'), ((8372, 8400), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 16)'}), '(figsize=(20, 16))\n', (8382, 8400), ... |
"""
Base Container Object
"""
# global
import re
import termcolor
import numpy as _np
import json as _json
import h5py as _h5py
import pickle as _pickle
import random as _random
from operator import lt as _lt
from operator import le as _le
from operator import eq as _eq
from operator import ne as _ne
from operator imp... | [
"numpy.prod",
"ivy.einops_rearrange",
"ivy.indices_where",
"ivy.einops_repeat",
"ivy.cast",
"ivy.Container.identical_structure",
"operator.not_",
"re.split",
"numpy.where",
"json.dumps",
"numpy.asarray",
"ivy.copy_array",
"ivy.wrapped_mode",
"random.randint",
"random.shuffle",
"numpy.o... | [((698, 712), 'json.dumps', '_json.dumps', (['x'], {}), '(x)\n', (709, 712), True, 'import json as _json\n'), ((4259, 4284), 'ivy.exists', '_ivy.exists', (['self._queues'], {}), '(self._queues)\n', (4270, 4284), True, 'import ivy as _ivy\n'), ((4827, 4863), 'ivy.default', '_ivy.default', (['keyword_color_dict', '{}'], ... |
from __future__ import print_function
import numpy as np
from . import utils
from numpy import linalg as LA
import math
def ODL_updateD(D, E, F, iterations=100, tol=1e-8):
"""
The main algorithm in ODL.
Solving the optimization problem:
D = arg min_D -2trace(E'*D) + trace(D*F*D') subject to: ||d_i||_... | [
"numpy.eye",
"numpy.linalg.eig",
"math.sqrt",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.zeros_like"
] | [((2437, 2453), 'numpy.zeros_like', 'np.zeros_like', (['D'], {}), '(D)\n', (2450, 2453), True, 'import numpy as np\n'), ((2464, 2482), 'numpy.eye', 'np.eye', (['D.shape[1]'], {}), '(D.shape[1])\n', (2470, 2482), True, 'import numpy as np\n'), ((3251, 3267), 'numpy.zeros_like', 'np.zeros_like', (['X'], {}), '(X)\n', (32... |
# Given a face image and a model, creates a new image plotting the nose coordinates (or what the model thinks is the nose!)
from __future__ import print_function
import keras
from PIL import Image
import numpy as np
from data_utils import *
import argparse
def main():
parser = argparse.ArgumentParser()
pars... | [
"keras.models.load_model",
"PIL.Image.open",
"numpy.asarray",
"argparse.ArgumentParser"
] | [((286, 311), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (309, 311), False, 'import argparse\n'), ((845, 867), 'PIL.Image.open', 'Image.open', (['args.image'], {}), '(args.image)\n', (855, 867), False, 'from PIL import Image\n'), ((999, 1015), 'numpy.asarray', 'np.asarray', (['data'], {}), ... |
import tensorflow as tf
import numpy as np
from TensorflowLearning.common import deal_label
(train_images, train_labels), (test_images, test_labels) = tf.keras.datasets.mnist.load_data()
train_images, test_images = train_images / 255.0, test_images / 255.0
train_images = np.reshape(train_images, [-1, 784])
test_images... | [
"TensorflowLearning.common.deal_label",
"numpy.reshape",
"tensorflow.keras.datasets.mnist.load_data"
] | [((152, 187), 'tensorflow.keras.datasets.mnist.load_data', 'tf.keras.datasets.mnist.load_data', ([], {}), '()\n', (185, 187), True, 'import tensorflow as tf\n'), ((273, 308), 'numpy.reshape', 'np.reshape', (['train_images', '[-1, 784]'], {}), '(train_images, [-1, 784])\n', (283, 308), True, 'import numpy as np\n'), ((3... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import cv2
import numpy as np
import constants as const
import transformations.shadow_mask as mask
def add_n_ellipses_light(image, intensity = 0.5, blur_width = 6, n = 1):
inverted_colors = const.WHITE - image
inverted_shadow = add_n_ellipses_shadow(inverted_colors, i... | [
"cv2.ellipse",
"numpy.zeros",
"transformations.shadow_mask.apply_shadow_mask",
"numpy.random.uniform"
] | [((908, 949), 'numpy.zeros', 'np.zeros', (['image.shape[:2]'], {'dtype': 'np.uint8'}), '(image.shape[:2], dtype=np.uint8)\n', (916, 949), True, 'import numpy as np\n'), ((1039, 1100), 'transformations.shadow_mask.apply_shadow_mask', 'mask.apply_shadow_mask', (['image', 'blur_width', 'intensity', 'ellipse'], {}), '(imag... |
"""Description
"""
import sys, os, tempfile, argparse
import tensorflow as tf
import numpy as np
from definitions import *
from feeder import SampleReader
from model import SptAudioGen, SptAudioGenParams
from pyutils.iolib.audio import save_wav
import myutils
def parse_arguments():
parser = argparse.ArgumentPars... | [
"pyutils.iolib.audio.save_wav",
"myutils.gen_360video",
"tensorflow.compat.v1.Session",
"os.remove",
"myutils.load_params",
"model.SptAudioGenParams",
"model.SptAudioGen",
"tensorflow.compat.v1.placeholder",
"argparse.ArgumentParser",
"numpy.stack",
"numpy.concatenate",
"tensorflow.train.lates... | [((299, 402), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (322, 402), False, 'import sys, os, tempfile, argparse\n'), ((8303, 8420... |
import sys
from set_up import Setup
from estimator import CommonEstimator
import json
import h5py
#from utils import get_memory_usage
import numpy as np
SEED = 12939 #from random.org
np.random.seed(SEED)
print('python main.py fpType fpSize estimators.json dataset')
fpType = sys.argv[1]
fpSize = int(sys.argv[2])
tr... | [
"set_up.Setup",
"numpy.random.seed",
"estimator.CommonEstimator"
] | [((184, 204), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (198, 204), True, 'import numpy as np\n'), ((604, 640), 'set_up.Setup', 'Setup', (['fpType', 'dataset'], {'verbose': '(True)'}), '(fpType, dataset, verbose=True)\n', (609, 640), False, 'from set_up import Setup\n'), ((1051, 1112), 'estimat... |
#======================================================================
#
# This module contains routines to postprocess the VFI
# solutions.
#
# <NAME>, 01/19
# edited by <NAME>, with <NAME> and <NAME>, 11/2021
#======================================================================
import numpy as np... | [
"numpy.fabs",
"numpy.random.default_rng",
"pickle.load",
"datetime.datetime.now",
"numpy.empty",
"numpy.savetxt",
"numpy.set_printoptions"
] | [((917, 931), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (929, 931), False, 'from datetime import datetime\n'), ((1011, 1036), 'numpy.random.default_rng', 'np.random.default_rng', (['dt'], {}), '(dt)\n', (1032, 1036), True, 'import numpy as np\n'), ((1164, 1180), 'numpy.empty', 'np.empty', (['(1, 3)'], ... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
# http://www.apache.org/licenses/LICENSE-2.0
# or in the "license" file... | [
"numpy.prod",
"numpy.sqrt",
"numpy.log",
"unittest.main",
"numpy.divide",
"numpy.mean",
"numpy.multiply",
"numpy.tanh",
"numpy.subtract",
"numpy.max",
"numpy.exp",
"numpy.testing.assert_almost_equal",
"numpy.min",
"numpy.maximum",
"numpy.abs",
"numpy.ceil",
"onnx.helper.make_node",
... | [((11776, 11791), 'unittest.main', 'unittest.main', ([], {}), '()\n', (11789, 11791), False, 'import unittest\n'), ((1161, 1202), 'onnx.helper.make_node', 'helper.make_node', (['"""Abs"""', "['ip1']", "['ip2']"], {}), "('Abs', ['ip1'], ['ip2'])\n", (1177, 1202), False, 'from onnx import helper\n'), ((1466, 1527), 'onnx... |
"""
This code implements the Growing Neural Gas algorithm that creates a graph
that learns the topologies in the given input data.
See e.g. followning documents references:
https://papers.nips.cc/paper/893-a-growing-neural-gas-network-learns-topologies.pdf
http://www.booru.net/download/MasterThesisProj.pdf
"""
fro... | [
"numpy.random.rand",
"numpy.random.randint",
"FeatureGraph.graph.Graph",
"numpy.linalg.norm"
] | [((1105, 1112), 'FeatureGraph.graph.Graph', 'Graph', ([], {}), '()\n', (1110, 1112), False, 'from FeatureGraph.graph import Graph\n'), ((3182, 3220), 'numpy.linalg.norm', 'np.linalg.norm', (['(vertex_vect - ref_vect)'], {}), '(vertex_vect - ref_vect)\n', (3196, 3220), True, 'import numpy as np\n'), ((6748, 6772), 'nump... |
import os
import json
import numpy as np
import glob
from datetime import datetime
import shutil
from sklearn.model_selection import train_test_split
np.random.seed(41)
#0为背景
classname_to_id = {"__background__": 0,"short": 1,"solder":2,"solderball":3}
class Lableme2CoCo:
def __init__(self):
self.images =... | [
"labelme.utils.img_b64_to_arr",
"os.path.exists",
"os.makedirs",
"sklearn.model_selection.train_test_split",
"datetime.datetime.now",
"numpy.random.seed",
"os.path.basename",
"json.load",
"glob.glob"
] | [((150, 168), 'numpy.random.seed', 'np.random.seed', (['(41)'], {}), '(41)\n', (164, 168), True, 'import numpy as np\n'), ((4431, 4466), 'glob.glob', 'glob.glob', (["(labelme_path + '/*.json')"], {}), "(labelme_path + '/*.json')\n", (4440, 4466), False, 'import glob\n'), ((4547, 4594), 'sklearn.model_selection.train_te... |
#!/usr/bin/env python3
# std
import unittest
# 3rd
import numpy as np
# ours
from clusterking.util.testing import MyTestCase
from clusterking.scan.wilsonscanner import WilsonScanner
from clusterking.data.data import Data
# noinspection PyUnusedLocal
def simple_func(w, q):
return q + 1
class TestWilsonScanner... | [
"unittest.main",
"numpy.array",
"clusterking.scan.wilsonscanner.WilsonScanner",
"clusterking.data.data.Data"
] | [((1945, 1960), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1958, 1960), False, 'import unittest\n'), ((375, 424), 'clusterking.scan.wilsonscanner.WilsonScanner', 'WilsonScanner', ([], {'scale': '(5)', 'eft': '"""WET"""', 'basis': '"""flavio"""'}), "(scale=5, eft='WET', basis='flavio')\n", (388, 424), False, '... |
"""Portfolio."""
import itertools
from contextlib import contextmanager
from enum import Enum, auto
import numpy as np
from .base import Quotes
from .performance import BriefPerformance, Performance, Stats
from .utils import fromtimestamp, timeit
__all__ = (
'Portfolio',
'Position',
'Order',
)
class ... | [
"enum.auto",
"numpy.where",
"itertools.product",
"numpy.sum",
"numpy.maximum.accumulate",
"numpy.cumsum",
"numpy.zeros_like"
] | [((6096, 6102), 'enum.auto', 'auto', ([], {}), '()\n', (6100, 6102), False, 'from enum import Enum, auto\n'), ((6116, 6122), 'enum.auto', 'auto', ([], {}), '()\n', (6120, 6122), False, 'from enum import Enum, auto\n'), ((6138, 6144), 'enum.auto', 'auto', ([], {}), '()\n', (6142, 6144), False, 'from enum import Enum, au... |
import json
import numpy as np
import os
from photogrammetry_importer.types.camera import Camera
from photogrammetry_importer.types.point import Point
from photogrammetry_importer.file_handlers.utility import (
check_radial_distortion,
)
from photogrammetry_importer.blender_utility.logging_utility import log_repor... | [
"photogrammetry_importer.file_handlers.utility.check_radial_distortion",
"photogrammetry_importer.types.camera.Camera",
"os.path.join",
"os.path.splitext",
"photogrammetry_importer.blender_utility.logging_utility.log_report",
"os.path.isfile",
"numpy.array",
"os.path.dirname",
"os.path.isdir",
"js... | [((5921, 5975), 'photogrammetry_importer.blender_utility.logging_utility.log_report', 'log_report', (['"""INFO"""', '"""parse_meshroom_sfm_file: ..."""', 'op'], {}), "('INFO', 'parse_meshroom_sfm_file: ...', op)\n", (5931, 5975), False, 'from photogrammetry_importer.blender_utility.logging_utility import log_report\n')... |
"""Convert Senate speech data from 114th Congress to bag of words format.
The data is provided by [1]. Specifically, we use the `hein-daily` data. To
run this script, make sure the relevant files are in
`data/senate-speeches-114/raw/`. The files needed for this script are
`speeches_114.txt`, `descr_114.txt`, and `1... | [
"os.path.exists",
"numpy.unique",
"os.makedirs",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.delete",
"numpy.where",
"os.path.join",
"scipy.sparse.csr_matrix",
"numpy.array",
"numpy.sum",
"os.path.dirname",
"setup_utils.remove_cooccurring_ngrams"
] | [((875, 932), 'os.path.join', 'os.path.join', (['project_dir', '"""data/senate-speeches-114/raw"""'], {}), "(project_dir, 'data/senate-speeches-114/raw')\n", (887, 932), False, 'import os\n'), ((944, 1003), 'os.path.join', 'os.path.join', (['project_dir', '"""data/senate-speeches-114/clean"""'], {}), "(project_dir, 'da... |
import unittest
from os import path
from os.path import join
from pyrep import PyRep
from pyrep.robots.arms.panda import Panda
from pyrep.robots.end_effectors.panda_gripper import PandaGripper
from rlbench import environment
from rlbench.backend.const import TTT_FILE
from rlbench.backend.scene import Scene
from rlbench... | [
"rlbench.backend.scene.Scene",
"rlbench.observation_config.ObservationConfig",
"pyrep.robots.arms.panda.Panda",
"pyrep.robots.end_effectors.panda_gripper.PandaGripper",
"os.path.join",
"rlbench.tasks.reach_target.ReachTarget",
"numpy.array_equal",
"pyrep.PyRep",
"os.path.abspath",
"rlbench.noise_m... | [((571, 593), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (583, 593), False, 'from os import path\n'), ((843, 850), 'pyrep.PyRep', 'PyRep', ([], {}), '()\n', (848, 850), False, 'from pyrep import PyRep\n'), ((1224, 1324), 'rlbench.observation_config.ObservationConfig', 'ObservationConfig', ([... |
"""
Running operational space control with a PyGame display, and using the pydmps
library to specify a trajectory for the end-effector to follow, in
this case, a bell shaped velocity profile.
To install the pydmps library, clone https://github.com/studywolf/pydmps
and run 'python setup.py develop'
***NOTE*** there are... | [
"pydmps.DMPs_discrete",
"matplotlib.pyplot.plot",
"numpy.exp",
"numpy.sum",
"numpy.linspace",
"numpy.array",
"numpy.vstack",
"numpy.cumsum",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((1667, 1697), 'numpy.linspace', 'np.linspace', (['(0)', '(np.pi * 2)', '(100)'], {}), '(0, np.pi * 2, 100)\n', (1678, 1697), True, 'import numpy as np\n'), ((1838, 1847), 'numpy.sum', 'np.sum', (['g'], {}), '(g)\n', (1844, 1847), True, 'import numpy as np\n'), ((1951, 1963), 'numpy.cumsum', 'np.cumsum', (['g'], {}), ... |
from torch.utils.data import DataLoader
import torch
from tqdm import tqdm
import os
from shutil import copyfile
import numpy as np
import matplotlib.pyplot as plt
from src.generic_model import Criterian
from .dataloader import DataLoaderSYNTH
from src.utils.data_manipulation import denormalize_mean_variance
import tr... | [
"numpy.array",
"train_synth.config.pretrained_path.split",
"numpy.save",
"matplotlib.pyplot.plot",
"src.utils.utils.calculate_batch_fscore",
"src.utils.parallel.DataParallelModel",
"matplotlib.pyplot.savefig",
"src.UNET_ResNet.UNetWithResnet50Encoder",
"src.generic_model.Criterian",
"shutil.copyfi... | [((1249, 1281), 'os.makedirs', 'os.makedirs', (['base'], {'exist_ok': '(True)'}), '(base, exist_ok=True)\n', (1260, 1281), False, 'import os\n'), ((2940, 2956), 'tqdm.tqdm', 'tqdm', (['dataloader'], {}), '(dataloader)\n', (2944, 2956), False, 'from tqdm import tqdm\n'), ((6590, 6656), 'shutil.copyfile', 'copyfile', (['... |
# ==============================================================================
# MIT License
#
# Copyright 2020 Institute for Automotive Engineering of RWTH Aachen University.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "S... | [
"numpy.array"
] | [((1367, 1553), 'numpy.array', 'np.array', (['[[4.651574574230558e-14, 10.192351107009959, -5.36318723862984e-07], [-\n 5.588661045867985e-07, 0.0, 2.3708767903941617], [35.30731833118676, \n 0.0, -1.7000018578614013]]'], {}), '([[4.651574574230558e-14, 10.192351107009959, -5.36318723862984e-07\n ], [-5.588661... |
import os, sys
import argparse
from collections import defaultdict
import numpy as np
from netCDF4 import Dataset
import adios2
try:
from mpi4py import MPI
if MPI.COMM_WORLD.Get_size() > 1:
parallel = True
else:
parallel = False
except ImportError:
parallel = False
def progress(cou... | [
"argparse.ArgumentParser",
"netCDF4.Dataset",
"mpi4py.MPI.COMM_WORLD.Get_size",
"numpy.array",
"collections.defaultdict",
"adios2.open",
"sys.stdout.flush",
"numpy.zeros_like",
"sys.stdout.write"
] | [((536, 562), 'sys.stdout.write', 'sys.stdout.write', (['"""\x1b[K"""'], {}), "('\\x1b[K')\n", (552, 562), False, 'import os, sys\n'), ((638, 656), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (654, 656), False, 'import os, sys\n'), ((1095, 1181), 'netCDF4.Dataset', 'Dataset', (['output_file', '"""w"""'], ... |
# Copyright 2018 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | [
"numpy.array",
"tensorflow.constant",
"numpy.sum"
] | [((886, 899), 'numpy.array', 'np.array', (['mat'], {}), '(mat)\n', (894, 899), True, 'import numpy as np\n'), ((911, 940), 'tensorflow.constant', 'tf.constant', (['mat'], {'dtype': 'dtype'}), '(mat, dtype=dtype)\n', (922, 940), True, 'import tensorflow as tf\n'), ((853, 866), 'numpy.sum', 'np.sum', (['shape'], {}), '(s... |
from collections import Counter
import random
import numpy as np
def matches(vector, a):
"""
Returns indices where the elements of a vector match some value.
Args:
vector (ndarray(int)): A 1D numpy array describing a vector.
a (int): The value to match.
Returns:
list(int): A l... | [
"collections.Counter",
"random.choice",
"numpy.array_equal"
] | [((6665, 6706), 'numpy.array_equal', 'np.array_equal', (['self.vector', 'other.vector'], {}), '(self.vector, other.vector)\n', (6679, 6706), True, 'import numpy as np\n'), ((5918, 5941), 'random.choice', 'random.choice', (['too_many'], {}), '(too_many)\n', (5931, 5941), False, 'import random\n'), ((5960, 5982), 'random... |
from torch.utils.data import Dataset
import torch
import json, os, random, time
import cv2
import torchvision.transforms as transforms
from data_transform.transform_wrapper import TRANSFORMS
import numpy as np
from utils.utils import get_category_list
import math
from PIL import Image
class BaseSet(Dataset)... | [
"torchvision.transforms.ToPILImage",
"os.path.join",
"math.sqrt",
"time.sleep",
"os.path.isfile",
"numpy.array",
"random.random",
"cv2.cvtColor",
"json.load",
"torchvision.transforms.ToTensor",
"cv2.imread",
"torchvision.transforms.Compose"
] | [((4008, 4042), 'torchvision.transforms.Compose', 'transforms.Compose', (['transform_list'], {}), '(transform_list)\n', (4026, 4042), True, 'import torchvision.transforms as transforms\n'), ((4821, 4852), 'os.path.join', 'os.path.join', (["now_info['fpath']"], {}), "(now_info['fpath'])\n", (4833, 4852), False, 'import ... |
"""
Database schema.
"""
import datetime
import enum
import os
import copy
import gwemopt.utils
import gwemopt.ztf_tiling
from astropy import table
from astropy import coordinates
from astropy import units as u
from flask_login.mixins import UserMixin
from flask_sqlalchemy import SQLAlchemy
import gcn
import healpy a... | [
"astropy.table.Table",
"ligo.skymap.bayestar.rasterize",
"copy.deepcopy",
"numpy.moveaxis",
"datetime.timedelta",
"astropy.table.unique",
"healpy.reorder",
"healpy.query_polygon",
"numpy.vstack",
"healpy.nside2order",
"os.path.isfile",
"flask_sqlalchemy.SQLAlchemy",
"numpy.transpose",
"pkg... | [((646, 661), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (656, 661), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((1178, 1210), 'numpy.transpose', 'np.transpose', (['offsets', '(2, 0, 1)'], {}), '(offsets, (2, 0, 1))\n', (1190, 1210), True, 'import numpy as np\n'), ((4913, 4929), 't... |
""" P2] Se presenta una escena con objetos dibujados con diferentes materiales a la escena base """
""" Se usa imgui para generar un menu y controlar variables de reflexion para el material de los objetos """
import glfw
from OpenGL.GL import *
import OpenGL.GL.shaders
import numpy as np
import grafica.transfor... | [
"glfw.make_context_current",
"glfw.swap_interval",
"glfw.poll_events",
"numpy.array",
"grafica.transformations.lookAt",
"numpy.sin",
"imgui.slider_float",
"imgui.end_frame",
"imgui.color_edit3",
"imgui.render",
"grafica.lighting_shaders.SimplePhongShaderProgram",
"glfw.get_time",
"imgui.get_... | [((5320, 5337), 'imgui.new_frame', 'imgui.new_frame', ([], {}), '()\n', (5335, 5337), False, 'import imgui\n'), ((5376, 5447), 'imgui.begin', 'imgui.begin', (['"""Material control"""', '(False)', 'imgui.WINDOW_ALWAYS_AUTO_RESIZE'], {}), "('Material control', False, imgui.WINDOW_ALWAYS_AUTO_RESIZE)\n", (5387, 5447), Fal... |
""" Module providing testing of `halotools.mock_observables.velocity_marked_npairs_3d`
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from astropy.tests.helper import pytest
from astropy.utils.misc import NumpyRNGContext
from ..velocity_marked_npairs_3d impor... | [
"numpy.random.random",
"astropy.tests.helper.pytest.raises",
"astropy.utils.misc.NumpyRNGContext"
] | [((594, 621), 'astropy.utils.misc.NumpyRNGContext', 'NumpyRNGContext', (['fixed_seed'], {}), '(fixed_seed)\n', (609, 621), False, 'from astropy.utils.misc import NumpyRNGContext\n'), ((641, 668), 'numpy.random.random', 'np.random.random', (['(npts, 3)'], {}), '((npts, 3))\n', (657, 668), True, 'import numpy as np\n'), ... |
'''
Train and operate with PMI-SVD embeddings
'''
from collections import Counter
import numpy as np
import pandas as pd
from scipy.sparse import linalg
import umap
import src.utility.general as util
class PmiSvdEmbeddings:
def __init__(self, texts):
'''
Args:
- texts (str|list): text d... | [
"pandas.Series",
"numpy.argpartition",
"src.utility.general.validate_input",
"collections.Counter",
"numpy.zeros",
"numpy.dot",
"umap.UMAP",
"numpy.linalg.norm",
"scipy.sparse.linalg.svds",
"numpy.log2"
] | [((415, 441), 'src.utility.general.validate_input', 'util.validate_input', (['texts'], {}), '(texts)\n', (434, 441), True, 'import src.utility.general as util\n'), ((2013, 2022), 'collections.Counter', 'Counter', ([], {}), '()\n', (2020, 2022), False, 'from collections import Counter\n'), ((3276, 3296), 'numpy.zeros', ... |
#!/usr/bin/env python
"""
Some common lineshapes and distribution functions
"""
from __future__ import division
from numpy import exp, pi, sqrt, where
from scipy import special
from lmfit.lineshapes import (gaussian, lorentzian, voigt, pvoigt, moffat,
pearson7, breit_wigner, damped_osci... | [
"numpy.sqrt",
"numpy.where",
"numpy.exp",
"scipy.special.erf",
"scipy.special.gamma",
"scipy.special.erfc",
"scipy.special.wofz",
"scipy.special.gammaln"
] | [((606, 618), 'numpy.sqrt', 'sqrt', (['(2 * pi)'], {}), '(2 * pi)\n', (610, 618), False, 'from numpy import exp, pi, sqrt, where\n'), ((622, 631), 'numpy.sqrt', 'sqrt', (['(2.0)'], {}), '(2.0)\n', (626, 631), False, 'from numpy import exp, pi, sqrt, where\n'), ((2630, 2644), 'scipy.special.erf', 'special.erf', (['x'], ... |
import numpy as np
import time
import cv2
import os
class YoloObjectsDetector:
def __init__(self, image, yolo_path=None, min_confidence=0.5, threshold=0.3):
self.image = image
# get image height and width
self.height = self.image.shape[0]
self.width = self.image.shape[1]
... | [
"cv2.dnn.blobFromImage",
"cv2.rectangle",
"cv2.setMouseCallback",
"numpy.argmax",
"cv2.putText",
"cv2.imshow",
"os.path.dirname",
"cv2.waitKey",
"numpy.array",
"cv2.dnn.NMSBoxes",
"time.time",
"cv2.dnn.readNetFromDarknet"
] | [((1360, 1423), 'cv2.dnn.readNetFromDarknet', 'cv2.dnn.readNetFromDarknet', (['self.config_path', 'self.weights_path'], {}), '(self.config_path, self.weights_path)\n', (1386, 1423), False, 'import cv2\n'), ((1597, 1683), 'cv2.dnn.blobFromImage', 'cv2.dnn.blobFromImage', (['self.image', '(1 / 255.0)', '(416, 416)'], {'s... |
import numpy as np
import os
from . import plot
from . import util
def label_statistics(labels):
labels = (np.array(labels)).astype(np.int64)
label_num = np.max(labels)+1
label_cnt = np.zeros(label_num,dtype=np.int64)
for i in range(len(labels)):
label_cnt[labels[i]] += 1
label_cnt_per = la... | [
"numpy.clip",
"numpy.mean",
"numpy.max",
"numpy.array",
"numpy.sum",
"numpy.zeros"
] | [((196, 231), 'numpy.zeros', 'np.zeros', (['label_num'], {'dtype': 'np.int64'}), '(label_num, dtype=np.int64)\n', (204, 231), True, 'import numpy as np\n'), ((727, 775), 'numpy.zeros', 'np.zeros', (['(label_num, label_num)'], {'dtype': 'np.int64'}), '((label_num, label_num), dtype=np.int64)\n', (735, 775), True, 'impor... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from itertools import product
from pathlib import Path
import numpy as np
import tensorflow as tf
from dotenv import load_dotenv
from annotation.direction import PinDirection
from annotation.piece import Piece
from ..count import WhiteEffectCountLayer
from ..lo... | [
"pathlib.Path",
"tensorflow.placeholder",
"os.environ.get",
"numpy.sum",
"numpy.zeros",
"numpy.empty",
"numpy.all",
"tensorflow.squeeze"
] | [((695, 724), 'os.environ.get', 'os.environ.get', (['"""DATA_FORMAT"""'], {}), "('DATA_FORMAT')\n", (709, 724), False, 'import os\n'), ((907, 938), 'numpy.empty', 'np.empty', (['shape'], {'dtype': 'np.int32'}), '(shape, dtype=np.int32)\n', (915, 938), True, 'import numpy as np\n'), ((993, 1023), 'numpy.zeros', 'np.zero... |
import unittest
from yauber_algo.errors import *
class CategorizeTestCase(unittest.TestCase):
def test_categorize(self):
import yauber_algo.sanitychecks as sc
from numpy import array, nan, inf
import os
import sys
import pandas as pd
import numpy as np
from... | [
"pandas.Series",
"numpy.array",
"numpy.random.random",
"yauber_algo.sanitychecks.SanityChecker"
] | [((473, 495), 'yauber_algo.sanitychecks.SanityChecker', 'sc.SanityChecker', (['algo'], {}), '(algo)\n', (489, 495), True, 'import yauber_algo.sanitychecks as sc\n'), ((619, 679), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0]'], {}), '([0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0]... |
# -*- coding: UTF-8 -*-
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import mne
import os.path
import pytest
import copy
import itertools
import numpy as np
from mne.datasets import testing
from mne.io.fieldtrip.utils import NOINFO_WARNING, _create_events
from mne.utils import _c... | [
"pytest.mark.filterwarnings",
"mne.utils._check_pandas_installed",
"mne.io.fieldtrip.tests.helpers.get_data_paths",
"numpy.array",
"copy.deepcopy",
"mne.io.fieldtrip.tests.helpers.assert_warning_in_record",
"mne.io.read_evoked_fieldtrip",
"numpy.arange",
"mne.datasets.testing.data_path",
"numpy.re... | [((1722, 1793), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:.*parse meas date.*:RuntimeWarning"""'], {}), "('ignore:.*parse meas date.*:RuntimeWarning')\n", (1748, 1793), False, 'import pytest\n'), ((1795, 1866), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:.*num... |
# Copyright 2014 <NAME>, <EMAIL>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | [
"numpy.array",
"math.degrees",
"math.radians"
] | [((985, 1002), 'numpy.array', 'array', (['[10, 0, 0]'], {}), '([10, 0, 0])\n', (990, 1002), False, 'from numpy import array\n'), ((3334, 3350), 'numpy.array', 'array', (['[0, 1, 0]'], {}), '([0, 1, 0])\n', (3339, 3350), False, 'from numpy import array\n'), ((1977, 1995), 'math.degrees', 'degrees', (['euler.yaw'], {}), ... |
"""Basic Package
"""
import numpy as np
from .base import MFPackageDIS
from .reader import MFFileReader
__all__ = ['BAS6']
class BAS6(MFPackageDIS):
"""Basic Package"""
valid_options = ['XSECTION', 'CHTOCH', 'FREE', 'PRINTTIME',
'SHOWPROGRESS', 'STOPERROR']
_Options = []
@pr... | [
"numpy.empty"
] | [((4623, 4667), 'numpy.empty', 'np.empty', (['self.dis.shape3d', 'self._float_type'], {}), '(self.dis.shape3d, self._float_type)\n', (4631, 4667), True, 'import numpy as np\n'), ((3873, 3904), 'numpy.empty', 'np.empty', (['self.dis.shape3d', '"""i"""'], {}), "(self.dis.shape3d, 'i')\n", (3881, 3904), True, 'import nump... |
"Bag Of Discriptors"
import cv2
import numpy as np
class Detector(object):
def __init__(self, verbose=True):
'''
Detector (class) constructor.
Args:
verbose(bool): Indicator for log and progress bar
'''
self.orb = cv2.ORB_create()
self.bf = cv... | [
"cv2.BFMatcher",
"numpy.argmax",
"numpy.max",
"cv2.ORB_create",
"cv2.imread"
] | [((283, 299), 'cv2.ORB_create', 'cv2.ORB_create', ([], {}), '()\n', (297, 299), False, 'import cv2\n'), ((318, 366), 'cv2.BFMatcher', 'cv2.BFMatcher', (['cv2.NORM_HAMMING'], {'crossCheck': '(True)'}), '(cv2.NORM_HAMMING, crossCheck=True)\n', (331, 366), False, 'import cv2\n'), ((713, 755), 'cv2.imread', 'cv2.imread', (... |
import numpy as np
from girard import sampling
def all_coordinates_are_positive(vec):
return all(map(lambda pos: pos >= 0, vec))
def estimate_solid_angle(spanning_matrix, sample_size):
dim = len(spanning_matrix)
inverse = np.linalg.inv(spanning_matrix)
points_inside_cone = 0
for i in range(sample_... | [
"numpy.linalg.inv",
"girard.sampling.sample_hypersphere_point"
] | [((236, 266), 'numpy.linalg.inv', 'np.linalg.inv', (['spanning_matrix'], {}), '(spanning_matrix)\n', (249, 266), True, 'import numpy as np\n'), ((360, 398), 'girard.sampling.sample_hypersphere_point', 'sampling.sample_hypersphere_point', (['dim'], {}), '(dim)\n', (393, 398), False, 'from girard import sampling\n')] |
import os
import cv2
import numpy as np
def convert(size, box):
'''
convert (xmin, ymin, xmax, ymax) to (cx/w, cy/h, bw/w, bw/h)
param:
size: tuple (im_width, im_height)
box: list [xmin, ymin, xmax, ymax]
return:
tuple (cx/w, cy/h, bw/w, bw/h)
'''
dw = 1. / size[0]
d... | [
"numpy.array"
] | [((957, 975), 'numpy.array', 'np.array', (['box_list'], {}), '(box_list)\n', (965, 975), True, 'import numpy as np\n')] |
"""This submodule defines the "vanilla" `MODNetModel`, i.e. a single
model with deterministic weights and outputs.
"""
from typing import List, Tuple, Dict, Optional, Callable, Any
from pathlib import Path
import multiprocessing
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler,... | [
"zipfile.ZipFile",
"pandas.to_pickle",
"multiprocessing.cpu_count",
"tensorflow.keras.layers.BatchNormalization",
"sklearn.metrics.roc_auc_score",
"tensorflow.keras.callbacks.EarlyStopping",
"numpy.array",
"tensorflow.keras.layers.Dense",
"numpy.nanmean",
"pandas.read_pickle",
"tensorflow.keras.... | [((5852, 5890), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(n_feat,)'}), '(shape=(n_feat,))\n', (5873, 5890), True, 'import tensorflow as tf\n'), ((8390, 8446), 'tensorflow.keras.models.Model', 'tf.keras.models.Model', ([], {'inputs': 'f_input', 'outputs': 'final_out'}), '(inputs=f_input,... |
#coding:utf-8
#
# Copyright (c) 2018-present, the Authors of the OpenKE-PyTorch (old).
# All rights reserved.
#
# Link to the project: https://github.com/thunlp/OpenKE/tree/OpenKE-PyTorch(old)
#
# Note: This code was partially adapted by <NAME>
# to adapt to the case of HyperKG, described in:
# https... | [
"torch.manual_seed",
"ctypes.cdll.LoadLibrary",
"torch.load",
"numpy.array",
"numpy.zeros",
"torch.cuda.is_available",
"os.path.dirname",
"numpy.random.seed",
"torch.utils.data.DataLoader"
] | [((876, 910), 'ctypes.cdll.LoadLibrary', 'ctypes.cdll.LoadLibrary', (['base_file'], {}), '(base_file)\n', (899, 910), False, 'import ctypes\n'), ((13304, 13324), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (13321, 13324), False, 'import torch\n'), ((13412, 13429), 'numpy.random.seed', 'np.random.s... |
""" Module containing all segmentation related functions. """
from typing import List, Tuple, NamedTuple, Generator
import cv2 as cv
import numpy as np
from skimage import measure, morphology, segmentation as segment
from scipy import ndimage
# ==========================================================
# SETTINGS
# ... | [
"skimage.morphology.watershed",
"scipy.ndimage.distance_transform_edt",
"numpy.amax",
"numpy.ones",
"numpy.average",
"numpy.where",
"scipy.ndimage.label",
"numpy.zeros_like",
"skimage.segmentation.morphological_geodesic_active_contour",
"cv2.morphologyEx",
"numpy.array",
"skimage.morphology.co... | [((425, 475), 'cv2.getStructuringElement', 'cv.getStructuringElement', (['cv.MORPH_ELLIPSE', '(9, 9)'], {}), '(cv.MORPH_ELLIPSE, (9, 9))\n', (449, 475), True, 'import cv2 as cv\n'), ((716, 766), 'cv2.getStructuringElement', 'cv.getStructuringElement', (['cv.MORPH_ELLIPSE', '(9, 9)'], {}), '(cv.MORPH_ELLIPSE, (9, 9))\n'... |
"""
Levenberg Marquart fitting class and helper tools
https://github.com/jaimedelacruz/LevMar
Coded by <NAME> (ISP-SU 2021)
References:
This implementation follows the notation presented in:
<NAME>, Leenaarts, Danilovic & Uitenbroek (2019):
https://ui.adsabs.harvard.edu/abs/2019A%26A...623A..74D/abstract
but without... | [
"numpy.copy",
"numpy.abs",
"numpy.sqrt",
"numpy.minimum",
"numpy.diag",
"numpy.ascontiguousarray",
"numpy.zeros",
"numpy.linalg.svd",
"numpy.maximum",
"numpy.transpose"
] | [((4195, 4205), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (4202, 4205), True, 'import numpy as np\n'), ((6606, 6622), 'numpy.linalg.svd', 'np.linalg.svd', (['A'], {}), '(A)\n', (6619, 6622), True, 'import numpy as np\n'), ((7442, 7481), 'numpy.zeros', 'np.zeros', (['(nPar, nPar)'], {'dtype': '"""float64"""'}), "((... |
# Copyright 2020 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,... | [
"qkeras.qtools.quantized_operators.quantizer_impl.Bernoulli",
"qkeras.qtools.quantized_operators.quantizer_impl.StochasticTernary",
"numpy.testing.assert_equal",
"qkeras.qtools.quantized_operators.quantizer_impl.Ternary",
"qkeras.quantizers.quantized_ulaw",
"qkeras.quantizers.stochastic_binary",
"qkeras... | [((1154, 1181), 'qkeras.quantizers.quantized_bits', 'quantizers.quantized_bits', ([], {}), '()\n', (1179, 1181), False, 'from qkeras import quantizers\n'), ((1203, 1233), 'qkeras.qtools.quantized_operators.quantizer_impl.QuantizedBits', 'quantizer_impl.QuantizedBits', ([], {}), '()\n', (1231, 1233), False, 'from qkeras... |
import numpy as np
########################## method used - "1env_1jet", or "1env_njet" ##################################################
method='1env_1jet'
########################## nature of neural network - "mlp", "mlp_shared" or "cnn" ##################################################
policy_name='mlp'
####... | [
"numpy.array"
] | [((2754, 2795), 'numpy.array', 'np.array', (['(jets_position / dx)'], {'dtype': '"""int"""'}), "(jets_position / dx, dtype='int')\n", (2762, 2795), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Survey_Estimate3dCoord.py
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Gen... | [
"numpy.identity",
"PyQt5.QtCore.QCoreApplication.translate",
"numpy.sqrt",
"numpy.linalg.pinv",
"lftools.geocapt.topogeo.dms2dd",
"numpy.diag",
"numpy.array",
"lftools.geocapt.topogeo.String2CoordList",
"lftools.geocapt.imgs.Imgs",
"lftools.geocapt.topogeo.String2StringList",
"numpy.cos",
"num... | [((1447, 1495), 'PyQt5.QtCore.QCoreApplication.translate', 'QCoreApplication.translate', (['"""Processing"""', 'string'], {}), "('Processing', string)\n", (1473, 1495), False, 'from PyQt5.QtCore import QCoreApplication, QVariant\n'), ((7050, 7056), 'numpy.cos', 'cos', (['Z'], {}), '(Z)\n', (7053, 7056), False, 'from nu... |
import numpy as np
from sklearn.preprocessing import Imputer
# Represent the unknown value by np.nan in numpy
data_origin = [[30, 100],
[20, 50],
[35, np.nan],
[25, 80],
[30, 70],
[40, 60]]
# Imputation with the mean value
imp_mean = Imputer(m... | [
"sklearn.ensemble.RandomForestRegressor",
"numpy.where",
"sklearn.preprocessing.Imputer",
"sklearn.model_selection.cross_val_score",
"numpy.array",
"numpy.random.randint",
"sklearn.datasets.load_diabetes",
"numpy.random.seed",
"numpy.random.shuffle"
] | [((311, 357), 'sklearn.preprocessing.Imputer', 'Imputer', ([], {'missing_values': '"""NaN"""', 'strategy': '"""mean"""'}), "(missing_values='NaN', strategy='mean')\n", (318, 357), False, 'from sklearn.preprocessing import Imputer\n'), ((502, 550), 'sklearn.preprocessing.Imputer', 'Imputer', ([], {'missing_values': '"""... |
import cv2
import numpy as np
import os
import pickle
import torch
from torch.utils.data import Dataset
from torchvision.transforms import Normalize
import config
class PW3DEvalDataset(Dataset):
def __init__(self, pw3d_dir_path, img_wh):
super(PW3DEvalDataset, self).__init__()
# Paths
cr... | [
"os.path.join",
"torch.from_numpy",
"torch.is_tensor",
"torchvision.transforms.Normalize",
"cv2.resize",
"numpy.transpose",
"cv2.imread"
] | [((339, 384), 'os.path.join', 'os.path.join', (['pw3d_dir_path', '"""cropped_frames"""'], {}), "(pw3d_dir_path, 'cropped_frames')\n", (351, 384), False, 'import os\n'), ((731, 792), 'torchvision.transforms.Normalize', 'Normalize', ([], {'mean': 'config.IMG_NORM_MEAN', 'std': 'config.IMG_NORM_STD'}), '(mean=config.IMG_N... |
#### !/usr/bin/env python
# coding: utf-8
from molmap.model import RegressionEstimator, MultiClassEstimator, MultiLabelEstimator
from molmap import loadmap, dataset
from molmap.show import imshow_wrap
import molmap
from sklearn.utils import shuffle
from joblib import load, dump
import numpy as np
import pandas as pd
... | [
"molmap.model.MultiLabelEstimator",
"pandas.read_csv",
"os.path.join",
"chembench.dataset.load_BACE",
"numpy.nanmean",
"joblib.load",
"pandas.DataFrame",
"chembench.dataset.load_HIV",
"chembench.dataset.load_BBBP"
] | [((635, 654), 'chembench.dataset.load_BACE', 'dataset.load_BACE', ([], {}), '()\n', (652, 654), False, 'from chembench import dataset\n'), ((662, 681), 'chembench.dataset.load_BBBP', 'dataset.load_BBBP', ([], {}), '()\n', (679, 681), False, 'from chembench import dataset\n'), ((688, 706), 'chembench.dataset.load_HIV', ... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from facial.util import getData, y2indicator, error_rate, init_weight_and_bias
from sklearn.utils import shuffle
class HiddenLayer(object):
def __init__(self, M1, M2, an_id):
self.id = an_id
self.M1 = M1
self.M2 = M... | [
"tensorflow.train.RMSPropOptimizer",
"facial.util.init_weight_and_bias",
"tensorflow.placeholder",
"sklearn.utils.shuffle",
"tensorflow.Session",
"numpy.argmax",
"matplotlib.pyplot.plot",
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tensorflow.global_variables_initializer",
"tensorflow.n... | [((3672, 3681), 'facial.util.getData', 'getData', ([], {}), '()\n', (3679, 3681), False, 'from facial.util import getData, y2indicator, error_rate, init_weight_and_bias\n'), ((337, 365), 'facial.util.init_weight_and_bias', 'init_weight_and_bias', (['M1', 'M2'], {}), '(M1, M2)\n', (357, 365), False, 'from facial.util im... |
import numpy as np
import tensorflow as tf
import scipy
import lib_gcnn.graph as graph
class GraphCNN(object):
"""
A graph CNN for text classification. Composed of graph convolutional + max-pooling layer(s) and a
softmax layer.
filter_name = Filter name (i.e. "chebyshev", "spline", "fourier")
L... | [
"tensorflow.equal",
"tensorflow.transpose",
"numpy.column_stack",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"numpy.array",
"tensorflow.nn.dropout",
"lib_gcnn.graph.rescale_L",
"tensorflow.reduce_mean",
"tensorflow.cast",
"numpy.mod",
"tensorflow.sparse_reorder",
"numpy.isscalar... | [((1631, 1701), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[batch_size, num_vertices]'], {'name': '"""input_x"""'}), "(tf.float32, [batch_size, num_vertices], name='input_x')\n", (1645, 1701), True, 'import tensorflow as tf\n'), ((1725, 1779), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', ... |
from __future__ import print_function
import numpy as np
import bayesiancoresets as bc
from scipy.optimize import minimize
from inference import nuts, rhat, hmc
import time
## FOR LOGISTIC REGRESSION
from model_lr import *
dnames = ['synth', 'ds1', 'phishing']
fldr = 'lr'
## FOR POISSON REGRESSION
#from model_poiss ... | [
"numpy.ones",
"numpy.random.multivariate_normal",
"numpy.zeros",
"bayesiancoresets.RandomSubsampling",
"bayesiancoresets.GIGA",
"numpy.savez_compressed",
"numpy.logspace",
"time.time",
"bayesiancoresets.FrankWolfe"
] | [((536, 568), 'numpy.logspace', 'np.logspace', (['(0)', '(3)', '(10)'], {'dtype': 'int'}), '(0, 3, 10, dtype=int)\n', (547, 568), True, 'import numpy as np\n'), ((855, 866), 'time.time', 'time.time', ([], {}), '()\n', (864, 866), False, 'import time\n'), ((1120, 1141), 'numpy.ones', 'np.ones', (['cov.shape[0]'], {}), '... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
from astropy.io import ascii
from uncertainties import ufloat
import uncertainties.unumpy as unp
g = ufloat(9.811899, 0.000041)
x, d0, d = np.genfromtxt("Messdaten/c.txt", unpack=True)
D = d - d0
x1 = x[0:26]
x2 = x[28:52]
D1 = D[0... | [
"scipy.optimize.curve_fit",
"matplotlib.pyplot.savefig",
"astropy.io.ascii.write",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"numpy.diag",
"matplotlib.pyplot.tight_layout",
"uncertainties.ufloat",
"matplotlib.pyplot.xlim",
"matpl... | [((189, 214), 'uncertainties.ufloat', 'ufloat', (['(9.811899)', '(4.1e-05)'], {}), '(9.811899, 4.1e-05)\n', (195, 214), False, 'from uncertainties import ufloat\n'), ((228, 273), 'numpy.genfromtxt', 'np.genfromtxt', (['"""Messdaten/c.txt"""'], {'unpack': '(True)'}), "('Messdaten/c.txt', unpack=True)\n", (241, 273), Tru... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from sklearn.decomposition import FastICA
from ..utils.parallel import ParallelBackend, get_backend
from ..utils.kde import kde
from ..utils.cubic import cubic_spline
from ..utils.sobol import multivariate_normal
from ..utils.random import ... | [
"numpy.random.default_rng",
"numpy.log",
"numpy.array",
"getdist.plots.getSubplotPlotter",
"numpy.isfinite",
"scipy.stats.norm.logpdf",
"sklearn.decomposition.FastICA",
"numpy.mean",
"numpy.asarray",
"numpy.concatenate",
"warnings.warn",
"numpy.eye",
"numpy.ones",
"numpy.std",
"matplotli... | [((7215, 7228), 'sklearn.decomposition.FastICA', 'FastICA', ([], {}), '(**io)\n', (7222, 7228), False, 'from sklearn.decomposition import FastICA\n'), ((7466, 7484), 'numpy.mean', 'np.mean', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (7473, 7484), True, 'import numpy as np\n'), ((7497, 7514), 'numpy.std', 'np.std', (['... |
import common
import numpy as np
from utils import iter_proofs
from lark.exceptions import UnexpectedCharacters, ParseError
from tac_grammar import CFG, TreeBuilder, NonterminalNode, TerminalNode
import pdb
grammar = CFG(common.tac_grammar, 'tactic_expr')
tree_builder = TreeBuilder(grammar)
ast_height = []
num_token... | [
"tac_grammar.CFG",
"numpy.mean",
"tac_grammar.TreeBuilder",
"utils.iter_proofs"
] | [((219, 257), 'tac_grammar.CFG', 'CFG', (['common.tac_grammar', '"""tactic_expr"""'], {}), "(common.tac_grammar, 'tactic_expr')\n", (222, 257), False, 'from tac_grammar import CFG, TreeBuilder, NonterminalNode, TerminalNode\n'), ((273, 293), 'tac_grammar.TreeBuilder', 'TreeBuilder', (['grammar'], {}), '(grammar)\n', (2... |
# pylint: disable-msg=W0611, W0612, W0511,R0201
"""Tests suite for MaskedArray.
Adapted from the original test_ma by <NAME>
:author: <NAME> & <NAME>
:contact: pierregm_at_uga_dot_edu & mattknox_ca_at_hotmail_dot_com
:version: $Id: test_timeseries.py 3836 2008-01-15 13:09:03Z <EMAIL> $
"""
__author__ = "<NAME> & <NAME>... | [
"numpy.sqrt",
"numpy.random.rand",
"scikits.timeseries.date_array",
"scikits.timeseries.TimeSeriesError",
"numpy.ma.column_stack",
"numpy.column_stack",
"numpy.ma.sqrt",
"numpy.array",
"scikits.timeseries.last_unmasked_val",
"scikits.timeseries.align_series",
"copy.deepcopy",
"numpy.arange",
... | [((1408, 1435), 'scikits.timeseries.date_array', 'date_array', (['dlist'], {'freq': '"""D"""'}), "(dlist, freq='D')\n", (1418, 1435), False, 'from scikits.timeseries import TimeSeries, TimeSeriesError, TimeSeriesCompatibilityError, tseries, Date, date_array, now, time_series, adjust_endpoints, align_series, align_with,... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown copyright. The Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | [
"numpy.sqrt",
"iris.cube.CubeList",
"numpy.ones",
"iris.coords.DimCoord",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"improver.wind_calculations.wind_components.ResolveWindComponents",
"unittest.main",
"iris.coord_systems.OSGB"
] | [((2334, 2379), 'numpy.linspace', 'np.linspace', (['(150000)', '(250000)', 'data_2d.shape[1]'], {}), '(150000, 250000, data_2d.shape[1])\n', (2345, 2379), True, 'import numpy as np\n'), ((2445, 2485), 'numpy.linspace', 'np.linspace', (['(0)', '(600000)', 'data_2d.shape[0]'], {}), '(0, 600000, data_2d.shape[0])\n', (245... |
import argparse
from utils.distributions import RandInt, Uniform
from functions.mnist import MLPWithMNIST
import numpy as np
import os
import datetime
from hyperband import Hyperband
from utils import plot_util
import time
import pandas as pd
def get_path_with_time(alg_name):
time_name = str(datetime.datetime.now... | [
"utils.plot_util.plot_separately",
"argparse.ArgumentParser",
"os.makedirs",
"utils.distributions.Uniform",
"datetime.datetime.now",
"numpy.random.randint",
"os.path.isdir",
"pandas.DataFrame",
"time.time",
"hyperband.Hyperband",
"utils.distributions.RandInt"
] | [((799, 832), 'numpy.random.randint', 'np.random.randint', (['(0)', '(2 ** 32 - 1)'], {}), '(0, 2 ** 32 - 1)\n', (816, 832), True, 'import numpy as np\n'), ((1070, 1130), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Hyperband main script"""'}), "(description='Hyperband main script')\n"... |
import numpy as np
import numpy.matlib
from ..core import Agent
class FPSP(Agent):
""" Fast Periodic Switching between high and low beta policy.
Implementation of https://robertshorten.files.wordpress.com/2020/03/fpsr_title.pdf
Agent returns
[0, ... suppression start]: beta_high
... | [
"numpy.array",
"numpy.zeros",
"numpy.vstack",
"numpy.maximum",
"numpy.mod"
] | [((3017, 3028), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (3025, 3028), True, 'import numpy as np\n'), ((4315, 4347), 'numpy.mod', 'np.mod', (['cycle_step', 'cycle_length'], {}), '(cycle_step, cycle_length)\n', (4321, 4347), True, 'import numpy as np\n'), ((5523, 5534), 'numpy.array', 'np.array', (['x'], {}), '(... |
# Copyright 2019 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distribu... | [
"numpy.abs",
"numpy.sqrt",
"numpy.polyfit",
"numpy.min",
"numpy.diff",
"scipy.interpolate.interp1d",
"numpy.max",
"datetime.datetime.now",
"numpy.deg2rad",
"numpy.array",
"numpy.cos",
"numpy.concatenate",
"sys.exit",
"numpy.sin",
"numpy.maximum",
"numpy.rad2deg",
"numpy.zeros_like",
... | [((731, 754), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (752, 754), False, 'import datetime\n'), ((776, 789), 'numpy.rad2deg', 'np.rad2deg', (['(1)'], {}), '(1)\n', (786, 789), True, 'import numpy as np\n'), ((800, 813), 'numpy.deg2rad', 'np.deg2rad', (['(1)'], {}), '(1)\n', (810, 813), True, ... |
import numpy as np
import pyaudio
import time, sys, math
from collections import deque
from src.utils import *
class Stream_Reader:
"""
The Stream_Reader continuously reads data from a selected sound source using PyAudio
Arguments:
device: int or None: Select which audio stream to read .
... | [
"collections.deque",
"sys.exit",
"numpy.frombuffer",
"pyaudio.PyAudio",
"time.time"
] | [((712, 729), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (727, 729), False, 'import pyaudio\n'), ((1348, 1364), 'collections.deque', 'deque', ([], {'maxlen': '(20)'}), '(maxlen=20)\n', (1353, 1364), False, 'from collections import deque\n'), ((3414, 3425), 'time.time', 'time.time', ([], {}), '()\n', (3423,... |
import numpy as np
from sklearn.exceptions import NotFittedError
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neighbors._base import _get_weights
from .base import BaseDetector
# TODO: Support other distance metrics
class KDN(BaseDetector):
"... | [
"numpy.ones_like",
"numpy.average",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.neighbors._base._get_weights",
"numpy.zeros",
"numpy.zeros_like",
"numpy.arange"
] | [((1321, 1352), 'sklearn.neighbors._base._get_weights', '_get_weights', (['dist', 'self.weight'], {}), '(dist, self.weight)\n', (1333, 1352), False, 'from sklearn.neighbors._base import _get_weights\n'), ((1483, 1529), 'numpy.average', 'np.average', (['agreement'], {'axis': '(1)', 'weights': 'weights'}), '(agreement, a... |
"""Test numpy array to matrix conversion function."""
import numpy as np
import libs.test_carma as carma
test_flags = {
1: 'Number of elements between array and matrix are not the same',
2: 'Number of rows between array and matrix are not the same',
3: 'Number of columns between array and matrix are not t... | [
"numpy.random.normal",
"libs.test_carma.to_arma_mat",
"libs.test_carma.arr_to_col",
"libs.test_carma.arr_to_cube",
"libs.test_carma.to_arma_row",
"libs.test_carma.arr_to_mat_long",
"libs.test_carma.to_arma_cube",
"libs.test_carma.arr_to_mat_double_copy",
"libs.test_carma.to_arma_col",
"libs.test_c... | [((625, 670), 'libs.test_carma.arr_to_mat_double', 'carma.arr_to_mat_double', (['sample', '(False)', '(False)'], {}), '(sample, False, False)\n', (648, 670), True, 'import libs.test_carma as carma\n'), ((875, 918), 'libs.test_carma.arr_to_mat_long', 'carma.arr_to_mat_long', (['sample', '(False)', '(False)'], {}), '(sam... |
from __future__ import print_function
"""
Markov based methods for spatial dynamics.
"""
__author__ = "<NAME> <<EMAIL>"
__all__ = ["Markov", "LISA_Markov", "Spatial_Markov", "kullback",
"prais", "shorrock", "homogeneity"]
import numpy as np
from pysal.spatial_dynamics.ergodic import fmpt
from pysal.spati... | [
"numpy.trace",
"numpy.asmatrix",
"numpy.log",
"pysal.Quantiles",
"numpy.array",
"numpy.arange",
"numpy.multiply",
"scipy.stats.chi2.cdf",
"numpy.asarray",
"pysal.region.components.Graph",
"pysal.spatial_dynamics.ergodic.steady_state",
"pysal.spatial_dynamics.markov.chi2",
"numpy.kron",
"nu... | [((631, 652), 'numpy.zeros', 'np.zeros', (['(5, 5)', 'int'], {}), '((5, 5), int)\n', (639, 652), True, 'import numpy as np\n'), ((25202, 25223), 'numpy.multiply', 'np.multiply', (['num', 'num'], {}), '(num, num)\n', (25213, 25223), True, 'import numpy as np\n'), ((48485, 48499), 'numpy.trace', 'np.trace', (['pmat'], {}... |
import numpy as np
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(x)
| [
"numpy.sin",
"numpy.linspace"
] | [((24, 54), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(100)'], {}), '(0, 2 * np.pi, 100)\n', (35, 54), True, 'import numpy as np\n'), ((57, 66), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (63, 66), True, 'import numpy as np\n')] |
import math
import os
import re
import numpy as np
from BluPrintTriboSys import TriboSys
from Constants import PltOpts, SubDir, TexTempl, UnitTex, Unit, PrintOpts, \
PreSol
from cartesian_plot_functions import plt_profile, plt_contact, plt_3d, \
plt_2d_scatt_line, \
plt_energy_ring_on_ring, plt... | [
"math.floor",
"generate_latex_output.get_calc_specific_latex_template",
"cartesian_plot_functions.plt_energy_ring_on_ring",
"system_functions.exit_program",
"system_functions.print_it",
"system_functions.to_preci",
"influ_matrix_management.load_influ_mat",
"hertz_equations.hertz_displ",
"numpy.divid... | [((1803, 1844), 'system_functions.print_it', 'print_it', (['"""calculating load distribution"""'], {}), "('calculating load distribution')\n", (1811, 1844), False, 'from system_functions import print_it, to_preci, exit_program, save_to_matlab\n'), ((2202, 2257), 'system_functions.print_it', 'print_it', (['"""determinin... |
from lumicks.pylake.detail.utilities import *
import pytest
import matplotlib as mpl
import numpy as np
def test_first():
assert(first((1, 2, 3), condition=lambda x: x % 2 == 0) == 2)
assert(first(range(3, 100)) == 3)
with pytest.raises(StopIteration):
first((1, 2, 3), condition=lambda x: x % 5 =... | [
"numpy.array",
"numpy.equal",
"pytest.raises",
"numpy.arange"
] | [((823, 866), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]'], {}), '([0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0])\n', (831, 866), True, 'import numpy as np\n'), ((1673, 1686), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (1682, 1686), True, 'import numpy as np\n'), ((238, 266), 'pytest.raises', 'pyte... |
from granger_causality import granger_causality
import pandas as pd
import numpy as np
our_data = pd.read_csv("natural_data2.csv")
our_data = our_data[np.where(our_data['Year'] == 1880)[0][0]:]
print(granger_causality(our_data, ['Ozone', 'WMGHG'], 'Temperature', lags=3, our_type='trend'))
| [
"numpy.where",
"granger_causality.granger_causality",
"pandas.read_csv"
] | [((99, 131), 'pandas.read_csv', 'pd.read_csv', (['"""natural_data2.csv"""'], {}), "('natural_data2.csv')\n", (110, 131), True, 'import pandas as pd\n'), ((202, 294), 'granger_causality.granger_causality', 'granger_causality', (['our_data', "['Ozone', 'WMGHG']", '"""Temperature"""'], {'lags': '(3)', 'our_type': '"""tren... |
from collections import defaultdict
import numpy as np
from pyNastran.bdf.bdf_interface.assign_type import (
integer, integer_or_blank, double_or_blank)
from pyNastran.bdf.field_writer_8 import print_card_8, set_blank_if_default
from pyNastran.bdf.cards.base_card import _format_comment
class Rods:
"""intiali... | [
"numpy.unique",
"pyNastran.bdf.cards.base_card._format_comment",
"numpy.hstack",
"pyNastran.bdf.field_writer_8.set_blank_if_default",
"numpy.array",
"pyNastran.bdf.bdf_interface.assign_type.integer_or_blank",
"collections.defaultdict",
"numpy.vstack",
"pyNastran.bdf.bdf_interface.assign_type.integer... | [((4213, 4240), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""int32"""'}), "([], dtype='int32')\n", (4221, 4240), True, 'import numpy as np\n'), ((4261, 4288), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""int32"""'}), "([], dtype='int32')\n", (4269, 4288), True, 'import numpy as np\n'), ((4308, 4335), 'numpy.a... |
import pandas as pd
import numpy as np
import os
import tensorflow as tf
####### STUDENTS FILL THIS OUT ######
#Question 3
def reduce_dimension_ndc(df, ndc_df):
'''
df: pandas dataframe, input dataset
ndc_df: pandas dataframe, drug code dataset used for mapping in generic names
return:
df: pand... | [
"numpy.where",
"tensorflow.feature_column.categorical_column_with_vocabulary_file",
"os.path.join",
"tensorflow.feature_column.indicator_column",
"numpy.random.seed",
"tensorflow.cast",
"numpy.random.permutation"
] | [((1268, 1291), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(13)'}), '(seed=13)\n', (1282, 1291), True, 'import numpy as np\n'), ((1324, 1351), 'numpy.random.permutation', 'np.random.permutation', (['keys'], {}), '(keys)\n', (1345, 1351), True, 'import numpy as np\n'), ((3004, 3028), 'tensorflow.cast', 'tf.ca... |
#!/usr/bin/env python
import os
import shutil
import copy
import csv
import json
import math as m
import traceback
import cv2
import numpy as np
from .util_video import FrameStamps
from .util_video import FrameCache
class FrameStamps:
def __init__(self, Nfrm, runTime_s):
self.Nfrm = Nfrm
self.runTim... | [
"cv2.rectangle",
"os.path.exists",
"traceback.format_exc",
"numpy.where",
"os.path.join",
"os.path.splitext",
"os.path.split",
"json.load",
"numpy.sum",
"numpy.zeros",
"shutil.copyfile",
"numpy.empty",
"cv2.VideoCapture",
"numpy.nonzero",
"copy.deepcopy",
"numpy.isnan",
"json.dump",
... | [((1950, 1978), 'os.path.split', 'os.path.split', (['videoFilePath'], {}), '(videoFilePath)\n', (1963, 1978), False, 'import os\n'), ((2013, 2040), 'os.path.splitext', 'os.path.splitext', (['videoFile'], {}), '(videoFile)\n', (2029, 2040), False, 'import os\n'), ((2159, 2221), 'os.path.join', 'os.path.join', (['self.ou... |
from typing import Dict
import numpy as np
from gym import spaces
from stable_baselines3.common.vec_env import VecEnv, VecEnvWrapper
class ObsDictWrapper(VecEnvWrapper):
"""
Wrapper for a VecEnv which overrides the observation space for Hindsight Experience Replay to support dict observations.
:param e... | [
"gym.spaces.MultiDiscrete",
"gym.spaces.MultiBinary",
"numpy.concatenate",
"gym.spaces.Box"
] | [((2733, 2826), 'numpy.concatenate', 'np.concatenate', (['[observation_dict[observation_key], observation_dict[goal_key]]'], {'axis': '(-1)'}), '([observation_dict[observation_key], observation_dict[\n goal_key]], axis=-1)\n', (2747, 2826), True, 'import numpy as np\n'), ((1141, 1263), 'numpy.concatenate', 'np.conca... |
from __future__ import absolute_import
import sys, os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
sys.path.append(BASE_DIR)
import numpy as np
import PMML43Ext as pml
from skl import pre_process as pp
from datetime import datetime
import math
import metadata
import inspect
from nyoka.keras.keras_model_to_pmm... | [
"PMML43Ext.KNNInputs",
"PMML43Ext.TargetValueCounts",
"PMML43Ext.InstanceFields",
"PMML43Ext.OutputField",
"numpy.hstack",
"PMML43Ext.NeuralOutputs",
"PMML43Ext.minkowski",
"numpy.asanyarray",
"PMML43Ext.LinearKernelType",
"numpy.array",
"PMML43Ext.MiningModel",
"PMML43Ext.ComparisonMeasure",
... | [((109, 134), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (124, 134), False, 'import sys, os\n'), ((82, 107), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (97, 107), False, 'import sys, os\n'), ((11628, 11668), 'PMML43Ext.MiningBuildTask', 'pml.MiningBuildTask'... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# 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... | [
"logging.getLogger",
"qiskit.circuit.tools.pi_check.pi_check",
"re.compile",
"matplotlib.patches.Arc",
"pylatexenc.latex2text.LatexNodes2Text",
"numpy.sin",
"matplotlib.get_backend",
"qiskit.visualization.qcstyle.DefaultStyle",
"matplotlib.pyplot.close",
"matplotlib.patches.Circle",
"os.path.exp... | [((1274, 1301), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1291, 1301), False, 'import logging\n'), ((4154, 4179), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (4177, 4179), False, 'import collections\n'), ((4206, 4231), 'collections.OrderedDict', 'collecti... |
import numpy as np
import pytest
import tensorflow as tf
from autokeras.adapters import output_adapter
from tests import utils
def test_y_is_pd_series():
(x, y), (val_x, val_y) = utils.dataframe_series()
head = output_adapter.ClassificationHeadAdapter(name='a')
head.fit_transform(y)
assert isinstance... | [
"tests.utils.generate_one_hot_labels",
"numpy.array",
"tests.utils.dataframe_series",
"pytest.raises",
"autokeras.adapters.output_adapter.ClassificationHeadAdapter"
] | [((186, 210), 'tests.utils.dataframe_series', 'utils.dataframe_series', ([], {}), '()\n', (208, 210), False, 'from tests import utils\n'), ((222, 272), 'autokeras.adapters.output_adapter.ClassificationHeadAdapter', 'output_adapter.ClassificationHeadAdapter', ([], {'name': '"""a"""'}), "(name='a')\n", (262, 272), False,... |
# --- built in ---
import os
# --- 3rd party ---
import numpy as np
import torch
from torch import nn
# --- my module ---
__all__ = [
'langevin_dynamics',
'anneal_langevin_dynamics',
'sample_score_field',
'sample_energy_field'
]
# --- dynamics ---
def langevin_dynamics(
score_fn,
x,
eps... | [
"numpy.sqrt",
"numpy.log",
"numpy.asarray",
"torch.from_numpy",
"numpy.stack",
"numpy.linspace",
"torch.randn_like"
] | [((2245, 2290), 'numpy.linspace', 'np.linspace', (['(-range_lim)', 'range_lim', 'grid_size'], {}), '(-range_lim, range_lim, grid_size)\n', (2256, 2290), True, 'import numpy as np\n'), ((2299, 2344), 'numpy.linspace', 'np.linspace', (['(-range_lim)', 'range_lim', 'grid_size'], {}), '(-range_lim, range_lim, grid_size)\n'... |
import cv2
import numpy as np
import pytesseract
import requests
from PIL import Image
def ocr(img) -> str:
"""
识别验证码,由于可以绕过验证码,该方法不再需要
"""
img = np.array(img)
img = img[:, :, ::-1].copy()
img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(img, (45, 100, 40), (90, 255, 255))
... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"cv2.inRange",
"requests.get",
"numpy.array",
"cv2.cvtColor",
"pytesseract.image_to_string",
"numpy.zeros_like"
] | [((164, 177), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (172, 177), True, 'import numpy as np\n'), ((221, 257), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (233, 257), False, 'import cv2\n'), ((270, 317), 'cv2.inRange', 'cv2.inRange', (['img', '(45, 100, ... |
# coding=UTF-8
# ex:ts=4:sw=4:et=on
# Copyright (c) 2013, <NAME>
# All rights reserved.
# Complete license can be found in the LICENSE file.
import numpy as np
from scipy.special import erf
from math import sqrt
from .math_tools import sqrt2pi, sqrt8
def get_S(soller1, soller2):
_S = sqrt((soller1 * 0.5) ** 2 ... | [
"numpy.radians",
"math.sqrt",
"numpy.exp",
"scipy.special.erf",
"numpy.cos",
"numpy.sin"
] | [((294, 343), 'math.sqrt', 'sqrt', (['((soller1 * 0.5) ** 2 + (soller2 * 0.5) ** 2)'], {}), '((soller1 * 0.5) ** 2 + (soller2 * 0.5) ** 2)\n', (298, 343), False, 'from math import sqrt\n'), ((547, 566), 'numpy.sin', 'np.sin', (['range_theta'], {}), '(range_theta)\n', (553, 566), True, 'import numpy as np\n'), ((1247, 1... |
from PINN_Base.base_v1 import PINN_Base
import tensorflow as tf
import numpy as np
class Soft_Mesh(PINN_Base):
def __init__(self,
lower_bound,
upper_bound,
layers_approx,
layers_mesh,
**kwargs
):
assert... | [
"tensorflow.reduce_sum",
"numpy.abs",
"tensorflow.nn.softmax"
] | [((898, 919), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['scores'], {}), '(scores)\n', (911, 919), True, 'import tensorflow as tf\n'), ((1610, 1656), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(basis_functions * probs)'], {'axis': '(1)'}), '(basis_functions * probs, axis=1)\n', (1623, 1656), True, 'import tensorflow... |
# Copyright (c) 2020-2022 by Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel, and University of Kassel. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
import os
import numpy as np
import pandapipes as pp
i... | [
"numpy.abs",
"numpy.all",
"pandapipes.create_fluid_from_lib",
"os.path.join",
"pandapipes.create_junction",
"pandapipes.create_ext_grid",
"numpy.concatenate",
"pandapipes.create_pipe_from_parameters",
"pandapipes.pipeflow",
"pandapipes.create_empty_network",
"pandapipes.create_sink"
] | [((637, 690), 'os.path.join', 'os.path.join', (['test_path', '"""pipeflow_internals"""', '"""data"""'], {}), "(test_path, 'pipeflow_internals', 'data')\n", (649, 690), False, 'import os\n'), ((772, 802), 'pandapipes.create_empty_network', 'pp.create_empty_network', (['"""net"""'], {}), "('net')\n", (795, 802), True, 'i... |
"""
Definition of views.
"""
from datetime import datetime
from django.shortcuts import render
from django.http import HttpRequest
from . import models
import numpy as np
from . import predict_model as pm
import time
import random
def home(request):
"""Renders the home page."""
assert isinstance(request, Http... | [
"django.shortcuts.render",
"datetime.datetime.now",
"numpy.hstack"
] | [((27989, 28019), 'django.shortcuts.render', 'render', (['request', 'template_name'], {}), '(request, template_name)\n', (27995, 28019), False, 'from django.shortcuts import render\n'), ((28096, 28126), 'django.shortcuts.render', 'render', (['request', 'template_name'], {}), '(request, template_name)\n', (28102, 28126)... |
import fileinput
import math
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
import re
from scipy import interpolate # strait up linear interpolation, nothing fancy
import scipy.signal as signal
yaw_interp = None
pitch_interp = None
roll_interp = None
north_interp = None
east_interp = None
... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"scipy.signal.filtfilt",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"scipy.signal.butter",
"scipy.interpolate.interp1d",
"numpy.array",
"matplotlib.pyplot.figure",
"fileinput.input",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
... | [((429, 450), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (440, 450), True, 'import pandas as pd\n'), ((839, 873), 'scipy.signal.butter', 'signal.butter', (['(2)', 'cutoff_hz'], {'fs': 'hz'}), '(2, cutoff_hz, fs=hz)\n', (852, 873), True, 'import scipy.signal as signal\n'), ((919, 970), 'scipy.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.