code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
# Simple Vector
a = np.array([1, 2, 3])
print("a", a)
print("type", type(a))
print("a[0]", a[0])
# Simple Matrix and indexing
a=np.array([[1, 2, 3], [4, 5, 6]])
print("a", a)
print("a[0,1]", a[0,1])
print("a[0][1]", a[0][1])
# Matrix properties
a = np.arange(15).reshape(3, 5)
print("a.shape", a.sh... | [
"numpy.random.randn",
"numpy.std",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.mean",
"numpy.arange",
"numpy.eye"
] | [((40, 59), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (48, 59), True, 'import numpy as np\n'), ((149, 181), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (157, 181), True, 'import numpy as np\n'), ((503, 519), 'numpy.empty', 'np.empty', (['(3, 4)'], {}... |
import pandas as pd
import datetime
from mimesis import Generic
import random
import numpy as np
products_head = ['ID', 'Name', 'Price', 'Unit Cost', 'Manufacturer']
customers_head = ['id', 'Name', 'Address', 'City', 'Country', 'Website', 'Email', 'Phone', 'Registration Date']
staff_head = ['id', 'Name', 'Title', 'Add... | [
"pandas.DataFrame",
"random.randint",
"pandas.read_csv",
"random.choice",
"numpy.random.randint",
"mimesis.Generic",
"numpy.random.normal",
"numpy.random.choice",
"datetime.datetime.now"
] | [((812, 835), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (833, 835), False, 'import datetime\n'), ((846, 859), 'mimesis.Generic', 'Generic', (['"""en"""'], {}), "('en')\n", (853, 859), False, 'from mimesis import Generic\n'), ((869, 905), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'cu... |
"""
==========
SPLIT MESH
==========
Split mesh.
by <NAME> <<EMAIL>>
Feb 13, 2021
"""
import numpy as np
import openmesh as om
__all__ = ['split_mesh']
def split_mesh(V, F, edges, ratios):
"""
Split mesh.
Parameters
----------
V : numpy.array
F : numpy.array
edges : numpy.array
ra... | [
"openmesh.TriMesh",
"numpy.multiply"
] | [((462, 478), 'openmesh.TriMesh', 'om.TriMesh', (['V', 'F'], {}), '(V, F)\n', (472, 478), True, 'import openmesh as om\n'), ((656, 702), 'numpy.multiply', 'np.multiply', (['pts0', '(1.0 - ratios[:, np.newaxis])'], {}), '(pts0, 1.0 - ratios[:, np.newaxis])\n', (667, 702), True, 'import numpy as np\n'), ((712, 752), 'num... |
""" *** DEPRECIATED ***
Contains functions to view and interrogate chi-squared minimisation
Attributes:
MAIN_FONT (dict): style properties for the main font to use in plot labels
"""
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib.colorbar import make_axes_gridspec
from matp... | [
"echidna.limit.limit_config.LimitConfig",
"argparse.ArgumentParser",
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"numpy.power",
"numpy.transpose",
"matplotlib.ticker.FixedLocator",
"numpy.append",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"mpl_toolkits.mplot3d.Axes3D",
"matplot... | [((2450, 2487), 'matplotlib.pyplot.figure', 'plt.figure', (['fig_num'], {'figsize': '(10, 10)'}), '(fig_num, figsize=(10, 10))\n', (2460, 2487), True, 'import matplotlib.pyplot as plt\n'), ((3324, 3362), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""$\\\\chi^{2}$"""'], {}), "('$\\\\chi^{2}$', **BOLD_FONT)\n", (3334, ... |
# -*- coding: utf-8 -*-
import argparse, os, sys, json
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from math import ceil
from datetime import datetime
from keras.preprocessing.image import ImageDataGenerator
import keras.backend as K
from keras.utils import to_categorica... | [
"keras.preprocessing.image.ImageDataGenerator",
"numpy.isin",
"argparse.ArgumentParser",
"utils.utils.save_res_csv",
"utils.preprocessing.split_classes",
"model.classification_model.Classification",
"evaluation.evaluate_accuracy.evaluate_1_vs_all",
"os.path.join",
"utils.utils.print_nested",
"util... | [((74, 95), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (88, 95), False, 'import matplotlib\n'), ((823, 908), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train and validate a model on any dataset"""'}), "(description='Train and validate a model on any dataset... |
# Copyright (c) 2021 Massachusetts Institute of Technology
# SPDX-License-Identifier: MIT
import inspect
import hypothesis.strategies as st
import numpy as np
import pytest
from hypothesis import assume, given
from omegaconf import OmegaConf
from hydra_zen import builds, instantiate, just, to_yaml
from hydra_zen.str... | [
"hydra_zen.structured_configs._utils.safe_name",
"hydra_zen.builds",
"hydra_zen.to_yaml",
"hypothesis.strategies.booleans",
"hydra_zen.just",
"numpy.array",
"inspect.signature",
"pytest.mark.parametrize",
"hydra_zen.instantiate",
"hypothesis.assume"
] | [((795, 840), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""obj"""', 'numpy_objects'], {}), "('obj', numpy_objects)\n", (818, 840), False, 'import pytest\n'), ((915, 1051), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""obj, expected_name"""', "[(np.add, 'add'), (np.shape, 'shape'), (np.array... |
#!/usr/bin/python
"""
Compute log power feature from an audio file
"""
import pickle, numpy
from btk20.common import *
from btk20.stream import *
from btk20.feature import *
D = 160 # 10 msec for 16 kHz audio
fft_len = 256
pow_num = fft_len//2 + 1
input_filename = "../tools/filterbank/Headset1.wav"
output_filename = "... | [
"pickle.dump",
"numpy.array2string"
] | [((1118, 1152), 'pickle.dump', 'pickle.dump', (['log_vector', 'ofp', '(True)'], {}), '(log_vector, ofp, True)\n', (1129, 1152), False, 'import pickle, numpy\n'), ((1024, 1113), 'numpy.array2string', 'numpy.array2string', (['log_vector[0:10]'], {'formatter': "{'float_kind': lambda x: '%.2f' % x}"}), "(log_vector[0:10], ... |
# Copyright (c) 2020 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
#
# Un... | [
"json.dump",
"ppdet.utils.logger.setup_logger",
"numpy.ones",
"os.path.isfile",
"numpy.array",
"sys.stdout.flush"
] | [((1065, 1087), 'ppdet.utils.logger.setup_logger', 'setup_logger', (['__name__'], {}), '(__name__)\n', (1077, 1087), False, 'from ppdet.utils.logger import setup_logger\n'), ((1753, 1778), 'os.path.isfile', 'os.path.isfile', (['anno_file'], {}), '(anno_file)\n', (1767, 1778), False, 'import os\n'), ((4594, 4619), 'os.p... |
import numpy as np
import math
class FuzzyMembership():
def __init__(self):
self.name = "Fuzzy Membership Function"
self.description = ("Reclassifies or transforms the input data to a 0 to 1 "
"scale based on the possibility of being a member of a "
... | [
"numpy.putmask",
"numpy.array",
"numpy.clip"
] | [((5439, 5501), 'numpy.array', 'np.array', (["pixelBlocks['raster_pixels']"], {'dtype': '"""f8"""', 'copy': '(False)'}), "(pixelBlocks['raster_pixels'], dtype='f8', copy=False)\n", (5447, 5501), True, 'import numpy as np\n'), ((7097, 7117), 'numpy.clip', 'np.clip', (['r', '(0.0)', '(1.0)'], {}), '(r, 0.0, 1.0)\n', (710... |
"""
Understanding Image Retrieval Re-Ranking: A Graph Neural Network Perspective
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
Project Page : https://github.com/Xuanmeng-Zhang/gnn-re-ranking
Paper: https://arxiv.org/abs/2012.07620v2
==============================================================... | [
"pickle.dump",
"numpy.setdiff1d",
"torch.mm",
"numpy.append",
"pickle.load",
"torch.pow",
"numpy.argwhere",
"numpy.intersect1d",
"numpy.in1d"
] | [((1698, 1712), 'torch.mm', 'torch.mm', (['x', 'y'], {}), '(x, y)\n', (1706, 1712), False, 'import torch\n'), ((2362, 2383), 'numpy.argwhere', 'np.argwhere', (['(gl == ql)'], {}), '(gl == ql)\n', (2373, 2383), True, 'import numpy as np\n'), ((2401, 2422), 'numpy.argwhere', 'np.argwhere', (['(gc == qc)'], {}), '(gc == q... |
"""
Creative Applications of Deep Learning w/ Tensorflow.
Kadenze, Inc.
Copyright <NAME>, June 2016.
"""
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import gfile
from .utils import download
from skimage.transform import resize as imresize
def celeb_vaegan_download():
"""Download a p... | [
"tensorflow.python.platform.gfile.GFile",
"numpy.zeros",
"numpy.min",
"skimage.transform.resize",
"tensorflow.GraphDef"
] | [((1340, 1379), 'numpy.zeros', 'np.zeros', (['(n_els, n_labels)'], {'dtype': 'bool'}), '((n_els, n_labels), dtype=bool)\n', (1348, 1379), True, 'import numpy as np\n'), ((2346, 2367), 'numpy.min', 'np.min', (['img.shape[:2]'], {}), '(img.shape[:2])\n', (2352, 2367), True, 'import numpy as np\n'), ((2663, 2714), 'skimag... |
import tensorflow as tf
import numpy as np
# create data
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data*0.1+0.3
##create tensorflow structure start ###
Weights = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
biases = tf.Variable(tf.zeros([1]))
y = Weights*x_data + biases
loss = tf.reduce_mean(tf.... | [
"tensorflow.random_uniform",
"tensorflow.Session",
"tensorflow.zeros",
"tensorflow.initialize_all_variables",
"tensorflow.square",
"numpy.random.rand",
"tensorflow.train.GradientDescentOptimizer"
] | [((350, 388), 'tensorflow.train.GradientDescentOptimizer', 'tf.train.GradientDescentOptimizer', (['(0.5)'], {}), '(0.5)\n', (383, 388), True, 'import tensorflow as tf\n'), ((430, 459), 'tensorflow.initialize_all_variables', 'tf.initialize_all_variables', ([], {}), '()\n', (457, 459), True, 'import tensorflow as tf\n'),... |
"""!
@brief A dataset creation which is compatible with pytorch framework
and much faster in loading time depending on the new version of
loading only the appropriate files that might be needed. Moreover
this dataset has minimal input argument requirements in order to be
more user friendly.
@author <NAME> {<EMAIL>}
@c... | [
"os.path.lexists",
"sklearn.externals.joblib.dump",
"numpy.abs",
"torch.utils.data.DataLoader",
"os.path.basename",
"os.path.isdir",
"numpy.std",
"numpy.mean",
"numpy.array",
"sklearn.externals.joblib.load",
"os.path.join"
] | [((8536, 8590), 'torch.utils.data.DataLoader', 'DataLoader', (['data'], {'pin_memory': '(False)'}), '(data, **generator_params, pin_memory=False)\n', (8546, 8590), False, 'from torch.utils.data import Dataset, DataLoader\n'), ((1427, 1463), 'os.path.join', 'os.path.join', (['dataset_dir', 'partition'], {}), '(dataset_d... |
# 2019-11-25 16:19:29(JST)
import sys
import numpy as np
def main():
H, W, K = map(int, sys.stdin.readline().split())
N = int(sys.stdin.readline().rstrip())
hw = map(int, sys.stdin.read().split())
hw = list(zip(hw, hw))
vert, hori = [0] * (H + 1), [0] * (W + 1)
candy = [[0] * (W... | [
"sys.stdin.readline",
"sys.stdin.read",
"numpy.array",
"numpy.searchsorted"
] | [((450, 475), 'numpy.array', 'np.array', (['[1, 3, 4, 5, 6]'], {}), '([1, 3, 4, 5, 6])\n', (458, 475), True, 'import numpy as np\n'), ((485, 510), 'numpy.array', 'np.array', (['[1, 3, 4, 5, 7]'], {}), '([1, 3, 4, 5, 7])\n', (493, 510), True, 'import numpy as np\n'), ((713, 750), 'numpy.searchsorted', 'np.searchsorted',... |
# -- coding: utf-8 --
# -- coding: utf-8 --
import tensorflow as tf
import numpy as np
from gcn_model.data_read import *
import argparse
from gcn_model.hyparameter import parameter
class HA():
def __init__(self,
site_id=0,
is_training=True,
time_size=3,
... | [
"numpy.sum",
"argparse.ArgumentParser",
"numpy.std",
"numpy.square",
"numpy.mean",
"numpy.array",
"numpy.reshape"
] | [((2396, 2426), 'numpy.sum', 'np.sum', (['((label - predict) ** 2)'], {}), '((label - predict) ** 2)\n', (2402, 2426), True, 'import numpy as np\n'), ((3580, 3605), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3603, 3605), False, 'import argparse\n'), ((3767, 3796), 'numpy.array', 'np.array'... |
import numpy as np
import matplotlib.pyplot as plt
N = 17
men_means = (2.82, 2.8, 2.82, 2.94, 2.66, 2.6, 2.74, 2.8, 2.9, 2.7, 2.92, 2.92, 10.66, 4.12, 3.72, 3.26, 3.44)
men_std = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
ind = np.arange(N) # the x locations for the groups
width = 0.1 # the wid... | [
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((246, 258), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (255, 258), True, 'import numpy as np\n'), ((346, 360), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (358, 360), True, 'import matplotlib.pyplot as plt\n'), ((1760, 1770), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1768, 1... |
"""
pipeline_example.py
------------
Example pipeline for netrd
author: <NAME>
email: <EMAIL>othylarock at gmail dot com
Submitted as part of the 2019 NetSI Collabathon
"""
# NOTE: !IMPORTANT! If you want to play and make changes,
# please make your own copy of this file (with a different name!)
# first and edit tha... | [
"netrd.reconstruction.PartialCorrelationMatrixReconstructor",
"collections.defaultdict",
"netrd.utilities.read_time_series",
"netrd.reconstruction.MaximumLikelihoodEstimationReconstructor",
"netrd.distance.HammingIpsenMikhailov",
"numpy.arange",
"netrd.reconstruction.FreeEnergyMinimizationReconstructor"... | [((3063, 3080), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3074, 3080), False, 'from collections import defaultdict\n'), ((4988, 5005), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (4999, 5005), False, 'from collections import defaultdict\n'), ((5534, 5596), 'numpy.z... |
"""
Neural Network Diagram
----------------------
"""
# Author: <NAME> <<EMAIL>>
# License: BSD
# The figure produced by this code is published in the textbook
# "Statistics, Data Mining, and Machine Learning in Astronomy" (2013)
# For more information, see http://astroML.github.com
import numpy as np
from matpl... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.arctan2",
"sparse_investigation.run",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.box",
"matplotlib.pyplot.text",
"matplotlib.pyplot.figure",
"numpy.sin",
"matplotlib.pyplot.Circle",
"numpy.linspace",
"numpy.cos"
] | [((396, 404), 'sparse_investigation.run', 'si.run', ([], {}), '()\n', (402, 404), True, 'import sparse_investigation as si\n'), ((412, 437), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'facecolor': '"""w"""'}), "(facecolor='w')\n", (422, 437), True, 'from matplotlib import pyplot as plt\n'), ((510, 524), 'matplotli... |
"""
Class to read mManager format images saved separately and their metadata (JSON) .
"""
import json, os
import numpy as np
import pandas as pd
import cv2
import warnings
from ..utils.imgIO import get_sub_dirs, get_sorted_names
class mManagerReader(object):
"""General mManager metadata and image reader for d... | [
"numpy.stack",
"json.dump",
"json.load",
"os.makedirs",
"cv2.cvtColor",
"os.path.exists",
"cv2.imread",
"os.path.join"
] | [((3038, 3076), 'os.path.join', 'os.path.join', (['pos_path', '"""metadata.txt"""'], {}), "(pos_path, 'metadata.txt')\n", (3050, 3076), False, 'import json, os\n'), ((8722, 8766), 'os.path.join', 'os.path.join', (['self.img_in_pos_path', 'img_name'], {}), '(self.img_in_pos_path, img_name)\n', (8734, 8766), False, 'impo... |
import numpy as np
from graphical_model_learning.utils.core_utils import random_max
from tqdm import trange
def resit(
samples: np.ndarray,
regression_function, # todo: hyperparameters should be CV'd
dependence_function,
progress: bool = False
):
nsamples, nnodes = samples.shape
... | [
"causaldag.rand.graphs.directed_erdos",
"causaldag.rand.graphs.rand_additive_basis",
"causaldag.utils.ci_tests.hsic_test_vector",
"scipy.special.expit",
"graphical_model_learning.utils.core_utils.random_max",
"numpy.linalg.inv",
"pygam.GAM"
] | [((2375, 2425), 'causaldag.rand.graphs.directed_erdos', 'directed_erdos', (['(10)'], {'exp_nbrs': '(9)', 'random_order': '(False)'}), '(10, exp_nbrs=9, random_order=False)\n', (2389, 2425), False, 'from causaldag.rand.graphs import rand_additive_basis, directed_erdos\n'), ((2480, 2523), 'causaldag.rand.graphs.rand_addi... |
# coding=utf-8
""""
Matrix factorization model for item prediction (ranking) optimized using BPR (BPRMF)
[Item Recommendation (Ranking)]
Literature:
<NAME>, <NAME>, <NAME>, <NAME>:
BPR: Bayesian Personalized Ranking from Implicit Feedback.
UAI 2009.
http://www.ismll.uni-hild... | [
"numpy.random.seed",
"caserec.utils.extra_functions.timed",
"random.choices",
"random.choice",
"random.seed",
"numpy.exp",
"numpy.dot"
] | [((7113, 7147), 'numpy.dot', 'np.dot', (['self.p[user]', 'self.q[item]'], {}), '(self.p[user], self.q[item])\n', (7119, 7147), True, 'import numpy as np\n'), ((4377, 4404), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (4391, 4404), True, 'import numpy as np\n'), ((4417, 4441), 'rando... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 2 11:35:07 2021
@authors: Dr. <NAME> and Dr. <NAME>
"""
import numpy as np
import math
import cmath
from QuantumInformation import RecurNum
from QuantumInformation import QuantumMechanics as QM
from QuantumInformation import LinearAlgebra as LA
im... | [
"numpy.trace",
"QuantumInformation.RecurNum.RecurChainRL4",
"QuantumInformation.LinearAlgebra",
"numpy.identity",
"re.findall",
"numpy.kron",
"QuantumInformation.RecurNum.RecurChainRL3",
"QuantumInformation.RecurNum.RecurChainRL2",
"math.sqrt",
"numpy.matrix.transpose",
"cmath.exp",
"math.log2... | [((754, 780), 'numpy.zeros', 'np.zeros', (['[2 ** N, 2 ** N]'], {}), '([2 ** N, 2 ** N])\n', (762, 780), True, 'import numpy as np\n'), ((1698, 1725), 'numpy.array', 'np.array', (['[[1, 0], [0, -1]]'], {}), '([[1, 0], [0, -1]])\n', (1706, 1725), True, 'import numpy as np\n'), ((3947, 4013), 'numpy.array', 'np.array', (... |
import logging
from ROAR.agent_module.agent import Agent
from ROAR.utilities_module.data_structures_models import SensorsData, Transform, Location
from ROAR.utilities_module.vehicle_models import Vehicle, VehicleControl
from ROAR.configurations.configuration import Configuration as AgentConfig
import cv2
import numpy ... | [
"open3d.geometry.PointCloud",
"numpy.ones",
"pathlib.Path",
"numpy.mean",
"cv2.erode",
"cv2.imshow",
"cv2.inRange",
"collections.deque",
"numpy.copy",
"cv2.dilate",
"ROAR.perception_module.depth_to_pointcloud_detector.DepthToPointCloudDetector",
"datetime.datetime.now",
"cv2.resize",
"ROAR... | [((1026, 1042), 'collections.deque', 'deque', ([], {'maxlen': '(10)'}), '(maxlen=10)\n', (1031, 1042), False, 'from collections import deque\n'), ((1263, 1298), 'ROAR.control_module.real_world_image_based_pid_controller.RealWorldImageBasedPIDController', 'ImageBasedPIDController', ([], {'agent': 'self'}), '(agent=self)... |
import os
import os.path
import tensorflow as tf
import numpy as np
from glob import glob as get_all_paths
from src.utils.utils import get_logger
from src.video_preprocessor import preprocess_videos
from src.utils.utils import contains_videos
dataset_names = ['trainA', 'trainB']
preferred_image_format_file_ending = '... | [
"src.video_preprocessor.preprocess_videos",
"tensorflow.image.resize_images",
"src.utils.utils.get_logger",
"tensorflow.convert_to_tensor",
"tensorflow.device",
"os.path.exists",
"tensorflow.map_fn",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.minimum",
"tensorflow.shape",
"tensorf... | [((443, 468), 'src.utils.utils.get_logger', 'get_logger', (['"""data_loader"""'], {}), "('data_loader')\n", (453, 468), False, 'from src.utils.utils import get_logger\n'), ((1262, 1308), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['image_path'], {}), '(image_path)\n', (1296, 13... |
from functools import partial
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
class QtPlotter(object):
def __init__(self):
self._app = QtGui.QApplication([])
self._win = pg.GraphicsWindow(title="JackPlay Plotter")
self._win.setWindowTitle("JackPlay Plotter... | [
"functools.partial",
"pyqtgraph.ViewBox",
"pyqtgraph.GraphicsWindow",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"pyqtgraph.Qt.QtCore.QTimer",
"numpy.random.normal",
"pyqtgraph.Qt.QtGui.QApplication",
"numpy.random.rand",
"pyqtgraph.setConfigOptions"
] | [((2530, 2557), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(1000)'}), '(size=1000)\n', (2546, 2557), True, 'import numpy as np\n'), ((183, 205), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (201, 205), False, 'from pyqtgraph.Qt import QtGui, QtCore\n'), ((226, 269), 'p... |
# nbapr/nbapr/nbapr.py
# -*- coding: utf-8 -*-
# Copyright (C) 2021 <NAME>
# Licensed under the MIT License
import logging
import time
from typing import Iterable, Union
import warnings
import numpy as np
import pandas as pd
logging.getLogger(__name__).addHandler(logging.NullHandler())
def _timeit(method):
de... | [
"numpy.sum",
"numpy.empty",
"numpy.argsort",
"numpy.argpartition",
"numpy.arange",
"numpy.tile",
"logging.NullHandler",
"numpy.nanmean",
"pandas.DataFrame",
"numpy.apply_along_axis",
"numpy.asarray",
"numpy.broadcast_to",
"numpy.core.multiarray.normalize_axis_index",
"time.time",
"numpy.... | [((268, 289), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (287, 289), False, 'import logging\n'), ((1463, 1495), 'numpy.tile', 'np.tile', (['probs', '(num_samples, 1)'], {}), '(probs, (num_samples, 1))\n', (1470, 1495), True, 'import numpy as np\n'), ((1516, 1564), 'numpy.random.random', 'np.random.... |
"""Dask_cudf reader."""
import logging
from typing import Any
from typing import Dict
from typing import Optional
from typing import Sequence
from typing import TypeVar
from typing import Union
import numpy as np
import cupy as cp
import pandas as pd
import cudf
import dask_cudf
import dask.dataframe as dd
from das... | [
"lightautoml.dataset.gpu.gpu_dataset.DaskCudfDataset",
"cudf.DataFrame",
"dask_cudf.from_cudf",
"cupy.sort",
"cudf.from_pandas",
"lightautoml.dataset.roles.DropRole",
"time.perf_counter",
"lightautoml.dataset.gpu.gpu_dataset.CudfDataset",
"numpy.issubdtype",
"cupy.asnumpy",
"cupy.arange",
"lig... | [((771, 798), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (788, 798), False, 'import logging\n'), ((846, 883), 'typing.TypeVar', 'TypeVar', (['"""RoleType"""'], {'bound': 'ColumnRole'}), "('RoleType', bound=ColumnRole)\n", (853, 883), False, 'from typing import TypeVar\n'), ((4099, 411... |
import copy
import glob
import math
import pickle
import random
from typing import Any, Optional, Dict, List, Union, Tuple, Collection, Sequence
import ai2thor.server
import numpy as np
from ai2thor.controller import Controller
from ai2thor.util import metrics
from utils.cache_utils import _str_to_pos, _pos_to_str
fr... | [
"utils.cache_utils._str_to_pos",
"copy.deepcopy",
"utils.cache_utils._pos_to_str",
"math.sqrt",
"ai2thor.controller.Controller",
"math.floor",
"random.choice",
"numpy.ones",
"utils.system.get_logger",
"pickle.load",
"random.seed",
"numpy.arange",
"glob.glob",
"utils.experiment_utils.recurs... | [((1126, 1187), 'utils.experiment_utils.recursive_update', 'recursive_update', (['self.config', "{**kwargs, 'agentMode': 'bot'}"], {}), "(self.config, {**kwargs, 'agentMode': 'bot'})\n", (1142, 1187), False, 'from utils.experiment_utils import recursive_update\n'), ((1214, 1239), 'ai2thor.controller.Controller', 'Contr... |
import numpy as np
from random import choice
from composer.instruments import Instruments, DrumInstruments
INDEX_TO_NOTENUMBER = 20 #1から88にこれを足すとmidiのノートナンバーになる
# 例:よくある左手のF=20+21
#ダイアトニックコードリスト
F_DIATONIC = \
[
["F2","A2","C3"], #Ⅰ 0
["G2","A#2","D3"], #Ⅱm 1
["A... | [
"numpy.sum",
"random.choice",
"numpy.min",
"numpy.random.randint",
"numpy.array",
"numpy.random.choice",
"numpy.random.rand"
] | [((10577, 10589), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (10585, 10589), True, 'import numpy as np\n'), ((10333, 10362), 'random.choice', 'choice', (['duration_candidate[1]'], {}), '(duration_candidate[1])\n', (10339, 10362), False, 'from random import choice\n'), ((11861, 11889), 'numpy.random.choice', 'np... |
import numpy as np
import pandas as pd
from datetime import datetime
import pytest
import empyrical
import vectorbt as vbt
from vectorbt import settings
from tests.utils import isclose
day_dt = np.timedelta64(86400000000000)
ts = pd.DataFrame({
'a': [1, 2, 3, 4, 5],
'b': [5, 4, 3, 2, 1],
'c': [1, 2, 3, ... | [
"empyrical.tail_ratio",
"empyrical.excess_sharpe",
"numpy.random.seed",
"empyrical.conditional_value_at_risk",
"numpy.isnan",
"pandas.DatetimeIndex",
"pytest.mark.parametrize",
"empyrical.value_at_risk",
"empyrical.beta",
"empyrical.downside_risk",
"empyrical.omega_ratio",
"empyrical.max_drawd... | [((197, 227), 'numpy.timedelta64', 'np.timedelta64', (['(86400000000000)'], {}), '(86400000000000)\n', (211, 227), True, 'import numpy as np\n'), ((586, 606), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (600, 606), True, 'import numpy as np\n'), ((5995, 6049), 'pytest.mark.parametrize', 'pytest.m... |
import numpy as np
import pytest
from steppy.base import Step, IdentityOperation, StepsError, make_transformer
from steppy.adapter import Adapter, E
from .steppy_test_utils import EXP_DIR
@pytest.fixture
def data():
return {
'input_1': {
'features': np.array([
[1, 6],
... | [
"steppy.base.make_transformer",
"steppy.base.IdentityOperation",
"pytest.raises",
"numpy.array",
"steppy.adapter.E",
"pytest.mark.parametrize"
] | [((845, 884), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', '[0, 1]'], {}), "('mode', [0, 1])\n", (868, 884), False, 'import pytest\n'), ((999, 1020), 'steppy.base.make_transformer', 'make_transformer', (['fun'], {}), '(fun)\n', (1015, 1020), False, 'from steppy.base import Step, IdentityOperati... |
"""
Copyright (c) 2019, National Institute of Informatics
All rights reserved.
Author: <NAME>
-----------------------------------------------------
Script for fine-tuning ClassNSeg (the proposed method)
"""
import os
import random
import torch
import torch.backends.cudnn as cudnn
import numpy as np
from t... | [
"torch.eye",
"argparse.ArgumentParser",
"sklearn.metrics.accuracy_score",
"torch.cat",
"model.ae.Encoder",
"scipy.interpolate.interp1d",
"os.path.join",
"random.randint",
"torch.FloatTensor",
"torchvision.transforms.ToPILImage",
"model.ae.ActivationLoss",
"random.seed",
"tqdm.tqdm",
"torch... | [((884, 909), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (907, 909), False, 'import argparse\n'), ((2494, 2521), 'random.seed', 'random.seed', (['opt.manualSeed'], {}), '(opt.manualSeed)\n', (2505, 2521), False, 'import random\n'), ((2527, 2560), 'torch.manual_seed', 'torch.manual_seed', ([... |
import numpy as np
from Bio import SeqIO
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1'
import tensorflow as tf
from tensorflow.keras import models, layers
from tensorflow.keras.utils import plot_model
import keras
from matplotlib import pyplot as plt
from keras.models import load_model
from matplotlib import pyplo... | [
"matplotlib.pyplot.title",
"tensorflow.keras.layers.Dense",
"tensorflow.matmul",
"tensorflow.nn.softmax",
"tensorflow.keras.layers.Concatenate",
"numpy.math.sqrt",
"tensorflow.keras.preprocessing.sequence.pad_sequences",
"tensorflow.keras.optimizers.Adam",
"tensorflow.keras.layers.Input",
"tensorf... | [((1520, 1596), 'tensorflow.keras.preprocessing.sequence.pad_sequences', 'tf.keras.preprocessing.sequence.pad_sequences', (['train_samples'], {'padding': '"""post"""'}), "(train_samples, padding='post')\n", (1565, 1596), True, 'import tensorflow as tf\n'), ((2532, 2564), 'tensorflow.keras.layers.Input', 'layers.Input',... |
import random
from collections import defaultdict
import os
import glob
import cv2
import numpy as np
from keras.datasets import mnist
from keras import backend as K
from keras.models import Model
import scikitplot as skplt
import matplotlib.pyplot as plt
from PIL import Image
import keras
from sklearn.metrics import p... | [
"os.remove",
"numpy.sum",
"numpy.clip",
"collections.defaultdict",
"numpy.mean",
"keras.backend.shape",
"numpy.exp",
"glob.glob",
"numpy.float64",
"numpy.zeros_like",
"random.randint",
"numpy.reshape",
"math.isnan",
"numpy.ones_like",
"keras.backend.exp",
"numpy.square",
"keras.backe... | [((801, 825), 'numpy.zeros_like', 'np.zeros_like', (['gradients'], {}), '(gradients)\n', (814, 825), True, 'import numpy as np\n'), ((1175, 1198), 'numpy.ones_like', 'np.ones_like', (['gradients'], {}), '(gradients)\n', (1187, 1198), True, 'import numpy as np\n'), ((1215, 1233), 'numpy.mean', 'np.mean', (['gradients'],... |
# Copyright 2021 <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, software... | [
"pennylearn.utils.scores.accuracy",
"numpy.asarray",
"numpy.random.default_rng",
"pennylane.device",
"pennylane.qnode",
"pennylane.PauliZ"
] | [((2143, 2184), 'pennylane.device', 'qml.device', (['device'], {'wires': 'self._num_wires'}), '(device, wires=self._num_wires)\n', (2153, 2184), True, 'import pennylane as qml\n'), ((3331, 3372), 'pennylane.device', 'qml.device', (['device'], {'wires': 'self._num_wires'}), '(device, wires=self._num_wires)\n', (3341, 33... |
import pandas as pd
from numpy.random import default_rng
from sklearn import metrics
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.feature_selection import SelectKBest
from sklearn import linear_model
from a_utils import *
from sklearn import featu... | [
"pandas.DataFrame",
"seaborn.heatmap",
"matplotlib.pyplot.show",
"pandas.read_csv",
"numpy.random.default_rng",
"sklearn.ensemble.ExtraTreesClassifier",
"pandas.Series",
"pandas.concat",
"matplotlib.pyplot.subplots",
"sklearn.feature_selection.SelectKBest"
] | [((1176, 1206), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(16, 14)'}), '(figsize=(16, 14))\n', (1188, 1206), True, 'import matplotlib.pyplot as plt\n'), ((1211, 1269), 'seaborn.heatmap', 'sns.heatmap', (['corData'], {'annot': '(False)', 'cmap': 'plt.cm.Reds', 'ax': 'ax'}), '(corData, annot=False, ... |
#%%
import os
import itertools
import cloudpickle
import re
import glob
import git
# Our numerical workhorses
import numpy as np
import pandas as pd
import scipy as sp
# Import library to perform maximum entropy fits
from maxentropy.skmaxent import FeatureTransformer, MinDivergenceModel
# Import libraries to paralle... | [
"pandas.DataFrame",
"pandas.read_csv",
"ccutils.maxent.MaxEnt_bretthorst",
"git.Repo",
"joblib.Parallel",
"ccutils.maxent.feature_fn",
"re.findall",
"numpy.arange",
"numpy.array",
"pandas.Series",
"itertools.product",
"joblib.delayed"
] | [((454, 500), 'git.Repo', 'git.Repo', (['"""./"""'], {'search_parent_directories': '(True)'}), "('./', search_parent_directories=True)\n", (462, 500), False, 'import git\n'), ((663, 729), 'pandas.read_csv', 'pd.read_csv', (['f"""{datadir}MaxEnt_constraints_mult_protein_ext_R.csv"""'], {}), "(f'{datadir}MaxEnt_constrain... |
import torch
import numpy as np
import torch.utils.data
from lib.add_window import Add_Window_Horizon
from lib.load_dataset import load_st_dataset
from lib.normalization import NScaler, MinMax01Scaler, MinMax11Scaler, StandardScaler, ColumnMinMaxScaler
import controldiffeq
def normalize_dataset(data, normalize... | [
"lib.normalization.MinMax11Scaler",
"lib.load_dataset.load_st_dataset",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"numpy.concatenate",
"lib.normalization.StandardScaler",
"torch.cat",
"lib.add_window.Add_Window_Horizon",
"torch.cuda.is_available",
"torch.utils.data.TensorDataset",
... | [((3105, 3141), 'torch.utils.data.TensorDataset', 'torch.utils.data.TensorDataset', (['X', 'Y'], {}), '(X, Y)\n', (3135, 3141), False, 'import torch\n'), ((3160, 3258), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['data'], {'batch_size': 'batch_size', 'shuffle': 'shuffle', 'drop_last': 'drop_last'}),... |
import os
import sys
main_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, main_path)
import numpy as np
import time
from src.preprocesing import gen_dataset_from_h5, rearrange_splits, get_mmbopf_plasticc_path
from src.cross_validation import cv_mmm_bopf, load_bopf_from_quantit... | [
"os.mkdir",
"argparse.ArgumentParser",
"pandas.read_csv",
"src.preprocesing.gen_dataset_from_h5",
"numpy.unique",
"os.path.dirname",
"sys.path.insert",
"src.preprocesing.rearrange_splits",
"time.time",
"os.path.exists",
"time.strftime",
"src.mmmbopf.method.MMMBOPF",
"src.cross_validation.cv_... | [((96, 125), 'sys.path.insert', 'sys.path.insert', (['(0)', 'main_path'], {}), '(0, main_path)\n', (111, 125), False, 'import sys\n'), ((1402, 1496), 'src.preprocesing.gen_dataset_from_h5', 'gen_dataset_from_h5', (['dataset_name'], {'bands': '_BANDS', 'num_folds': '(5)', 'select_survey': 'select_survey'}), '(dataset_na... |
import numpy as np
# for dummy executor
from concurrent.futures import Future, Executor
from threading import Lock
from datetime import date
from hashlib import blake2b
import yaml
import json
from copy import deepcopy
import importlib
import inspect
import datetime
import os
import logging
xopt_logo = """ _
... | [
"yaml.dump",
"json.dumps",
"datetime.datetime.utcnow",
"yaml.safe_load",
"hashlib.blake2b",
"os.path.join",
"numpy.full",
"concurrent.futures.Future",
"os.path.abspath",
"os.path.exists",
"threading.Lock",
"inspect.signature",
"json.dump",
"importlib.import_module",
"datetime.date.today"... | [((720, 747), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (737, 747), False, 'import logging\n'), ((5269, 5293), 'os.path.expandvars', 'os.path.expandvars', (['path'], {}), '(path)\n', (5287, 5293), False, 'import os\n'), ((5302, 5320), 'os.path.abspath', 'os.path.abspath', (['p'], {})... |
'''
Pack64 is a vector encoding using a kind-of-floating-point, kind-of-base64
representation requiring only 3 bytes per vector entry. This Python module
provides functions for encoding and decoding pack64 vectors.
'''
__all__ = ['pack64', 'unpack64']
import math
import numpy as np
# CHARS is a bytestring of the 6... | [
"numpy.full",
"numpy.abs",
"numpy.frombuffer",
"numpy.asarray",
"numpy.isfinite",
"numpy.arange",
"numpy.round"
] | [((555, 591), 'numpy.frombuffer', 'np.frombuffer', (['CHARS'], {'dtype': 'np.uint8'}), '(CHARS, dtype=np.uint8)\n', (568, 591), True, 'import numpy as np\n'), ((755, 788), 'numpy.full', 'np.full', (['(128,)', '(-1)'], {'dtype': 'np.int'}), '((128,), -1, dtype=np.int)\n', (762, 788), True, 'import numpy as np\n'), ((820... |
import sys
sys.path.append('../')
from model import StyledGenerator, Discriminator
import torch
import numpy as np
generator = StyledGenerator(flame_dim=159,
all_stage_discrim=False,
embedding_vocab_size=70_000,
rendered_flame_ascondit... | [
"sys.path.append",
"torch.manual_seed",
"torch.randn",
"torch.zeros",
"model.StyledGenerator",
"numpy.prod"
] | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((128, 360), 'model.StyledGenerator', 'StyledGenerator', ([], {'flame_dim': '(159)', 'all_stage_discrim': '(False)', 'embedding_vocab_size': '(70000)', 'rendered_flame_ascondition': '(False)', 'inst_nor... |
import numpy as np
import torch
import time
import tqdm
import datetime
# from torchvision.utils import make_grid
from pkg_resources import parse_version
from base import BasePCTrainer
from torch.nn.modules.batchnorm import _BatchNorm
from pointcloud_utils.pointcloud_vis import *
from pointcloud_utils.iou_metric import... | [
"os.mkdir",
"numpy.sum",
"numpy.sin",
"torch.autograd.set_detect_anomaly",
"torch.arange",
"torch.no_grad",
"os.path.join",
"os.path.exists",
"datetime.timedelta",
"numpy.linspace",
"pointcloud_utils.iou_metric.PointCloudIOU",
"torch.manual_seed",
"numpy.cos",
"numpy.concatenate",
"torch... | [((525, 536), 'time.time', 'time.time', ([], {}), '()\n', (534, 536), False, 'import time\n'), ((492, 503), 'time.time', 'time.time', ([], {}), '()\n', (501, 503), False, 'import time\n'), ((4117, 4128), 'time.time', 'time.time', ([], {}), '()\n', (4126, 4128), False, 'import time\n'), ((4377, 4388), 'time.time', 'time... |
"""
Bar plots
==========
An example of bar plots with matplotlib.
"""
import numpy as np
import matplotlib.pyplot as plt
n = 12
X = np.arange(n)
Y1 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n)
Y2 = (1 - X / float(n)) * np.random.uniform(0.5, 1.0, n)
plt.axes([0.025, 0.025, 0.95, 0.95])
plt.bar(X, +Y1, face... | [
"matplotlib.pyplot.xlim",
"numpy.random.uniform",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.text",
"numpy.arange",
"matplotlib.pyplot.xticks"
] | [((135, 147), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (144, 147), True, 'import numpy as np\n'), ((263, 299), 'matplotlib.pyplot.axes', 'plt.axes', (['[0.025, 0.025, 0.95, 0.95]'], {}), '([0.025, 0.025, 0.95, 0.95])\n', (271, 299), True, 'import matplotlib.pyplot as plt\n'), ((300, 355), 'matplotlib.pyplot.b... |
import numpy as np
import scipy as sp
import scipy.io
import scipy.signal
np.random.seed(4)
abs_val, phase_val = [sp.rand(13, 20) for _ in range(2)]
phase_val *= 2 * np.pi
shift = (2, 3)
for img in (abs_val, phase_val):
for ax in range(2):
img[:] = sp.signal.resample(img, int(img.shape[ax] * 1.5), axis=... | [
"scipy.rand",
"numpy.random.seed",
"numpy.exp"
] | [((77, 94), 'numpy.random.seed', 'np.random.seed', (['(4)'], {}), '(4)\n', (91, 94), True, 'import numpy as np\n'), ((117, 132), 'scipy.rand', 'sp.rand', (['(13)', '(20)'], {}), '(13, 20)\n', (124, 132), True, 'import scipy as sp\n'), ((339, 371), 'numpy.exp', 'np.exp', (['(1.0j * np.pi * 2 * dest2)'], {}), '(1.0j * np... |
from tkinter import *
import numpy as np
import json
from sklearn.cluster import KMeans
from itertools import count
from tqdm import tqdm
from PIL import Image, ImageDraw, ImageFilter, ImageEnhance
import os
from multiprocessing import Pool
import traceback
import math
import json
import csv
from config import *
import... | [
"PIL.Image.new",
"numpy.load",
"csv.reader",
"PIL.ImageEnhance.Brightness",
"random.shuffle",
"json.dumps",
"numpy.argmin",
"numpy.mean",
"traceback.print_exc",
"sklearn.cluster.KMeans",
"os.path.exists",
"webp.imread",
"PIL.ImageFilter.GaussianBlur",
"image_loader.ImageDataset",
"math.c... | [((662, 719), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(TILE_SIZE, TILE_SIZE)', '(255, 255, 255)'], {}), "('RGB', (TILE_SIZE, TILE_SIZE), (255, 255, 255))\n", (671, 719), False, 'from PIL import Image, ImageDraw, ImageFilter, ImageEnhance\n'), ((734, 799), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(TILE_SIZE *... |
import time
import numpy as np
import tensorflow as tf
from models import GAT
from inits import test_positive_sample, test_negative_sample
from inits import load_data
from inits import generate_mask
from inits import sparse_to_tuple
from metrics import masked_accuracy
from metrics import ROC
def train(train_arr, test... | [
"tensorflow.compat.v1.placeholder",
"metrics.masked_accuracy",
"metrics.ROC",
"inits.load_data",
"tensorflow.compat.v1.local_variables_initializer",
"tensorflow.compat.v1.Session",
"inits.test_positive_sample",
"time.time",
"tensorflow.Graph",
"inits.sparse_to_tuple",
"tensorflow.name_scope",
... | [((1222, 1270), 'inits.load_data', 'load_data', (['train_arr', 'test_arr', 'cv', 'args', 'labels'], {}), '(train_arr, test_arr, cv, args, labels)\n', (1231, 1270), False, 'from inits import load_data\n'), ((1459, 1487), 'inits.sparse_to_tuple', 'sparse_to_tuple', (['interaction'], {}), '(interaction)\n', (1474, 1487), ... |
#!/usr/bin/env python
"""
Fit for shapelet coefficients across beta, xc, phi, and n_max
"""
import sys
import numpy as np
from scipy import optimize
import shapelets
if __name__ == '__main__':
from optparse import OptionParser
o = OptionParser()
o.set_usage('%prog [options] FITS_IMAGE')
o.set_descript... | [
"matplotlib.pyplot.title",
"shapelets.img.makeNoiseMap",
"numpy.abs",
"optparse.OptionParser",
"shapelets.img.centroid",
"shapelets.decomp.genBasisMatrix",
"shapelets.img.estimateNoise",
"matplotlib.pyplot.figure",
"scipy.optimize.minimize",
"matplotlib.pyplot.imshow",
"shapelets.decomp.genPolar... | [((241, 255), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (253, 255), False, 'from optparse import OptionParser\n'), ((3847, 3887), 'shapelets.fileio.readFITS', 'shapelets.fileio.readFITS', (['ifn'], {'hdr': '(True)'}), '(ifn, hdr=True)\n', (3872, 3887), False, 'import shapelets\n'), ((4023, 4098), 'shap... |
"""This module handles indels and frameshift mutations.
Indels and frameshifts are detected from the allele columns of the mutation
input.
"""
import prob2020.python.utils as utils
import numpy as np
import pandas as pd
def simulate_indel_counts(indel_df, bed_dict,
num_permutations=1,
... | [
"numpy.nonzero",
"numpy.sum",
"pandas.Series",
"numpy.random.RandomState"
] | [((614, 699), 'pandas.Series', 'pd.Series', (['[b.cds_len for b in bed_genes]'], {'index': '[b.gene_name for b in bed_genes]'}), '([b.cds_len for b in bed_genes], index=[b.gene_name for b in\n bed_genes])\n', (623, 699), True, 'import pandas as pd\n'), ((971, 1003), 'numpy.random.RandomState', 'np.random.RandomState... |
import numpy as np
import csv
import os
engel = 45
def generate_poses(file_path):
with open(file_path, 'a') as csvfile:
csvwriter = csv.writer(csvfile)
for idx in range(10000):
orientation_x = np.round(np.random.uniform()*2*engel *(np.pi/180) - engel *(np.pi/180),4)
orientation_y = np.round(np.random.uni... | [
"numpy.random.uniform",
"csv.writer"
] | [((139, 158), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (149, 158), False, 'import csv\n'), ((483, 502), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (500, 502), True, 'import numpy as np\n'), ((526, 545), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (543, 545), T... |
import numpy as np
DEFAULT_MAZE = '''
+-----+
| |
| |
| |
| |
| |
+-----+
'''
HARD_MAZE = '''
+--------+-----+
| |
| |
+-----+ +-----+
| | |
| | |
| +--+- --+--+
| |
| |
| + + +-----+
| | | | |
| | | | ... | [
"numpy.argwhere",
"numpy.zeros",
"numpy.arange"
] | [((842, 878), 'numpy.zeros', 'np.zeros', (['[height, width]'], {'dtype': 'str'}), '([height, width], dtype=str)\n', (850, 878), True, 'import numpy as np\n'), ((1255, 1296), 'numpy.zeros', 'np.zeros', (['[size + 2, size + 2]'], {'dtype': 'str'}), '([size + 2, size + 2], dtype=str)\n', (1263, 1296), True, 'import numpy ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import numpy as np
from six.moves import xrange
import tensorflow as tf
import warnings
from . import utils_tf
from . import utils
from tensorflow.python.pl... | [
"tensorflow.reduce_sum",
"numpy.sum",
"numpy.maximum",
"tensorflow.clip_by_value",
"numpy.argmax",
"numpy.abs",
"numpy.floor",
"numpy.shape",
"numpy.product",
"tensorflow.reduce_max",
"tensorflow.abs",
"tensorflow.sign",
"numpy.max",
"numpy.reshape",
"tensorflow.gradients",
"tensorflow... | [((1944, 1965), 'tensorflow.gradients', 'tf.gradients', (['loss', 'x'], {}), '(loss, x)\n', (1956, 1965), True, 'import tensorflow as tf\n'), ((2915, 2955), 'tensorflow.stop_gradient', 'tf.stop_gradient', (['(x + scaled_signed_grad)'], {}), '(x + scaled_signed_grad)\n', (2931, 2955), True, 'import tensorflow as tf\n'),... |
import numpy as np
from scipy import signal
import math
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
from functions.pareq import pareq
def plotPredictions(filtergainsPrediction,G_db,fs,fc2,fc1,bw,G2opt_db,numsopt,densopt):
G_db2 = np.zeros([61,1])
G_db2[::2] = G_db
G_db2[1::2] = ... | [
"matplotlib.pyplot.title",
"functions.pareq.pareq",
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.lines.Line2D",
"scipy.signal.freqz",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylab... | [((263, 280), 'numpy.zeros', 'np.zeros', (['[61, 1]'], {}), '([61, 1])\n', (271, 280), True, 'import numpy as np\n'), ((418, 435), 'numpy.zeros', 'np.zeros', (['(3, 31)'], {}), '((3, 31))\n', (426, 435), True, 'import numpy as np\n'), ((453, 470), 'numpy.zeros', 'np.zeros', (['(3, 31)'], {}), '((3, 31))\n', (461, 470),... |
"""Parametrizing a single pv-panel.
Fit PV-Parameters from Datasheet
single_ifromv (singlediode)
substri_v (substring/module)
module_v (module/panel)
"""
#
# def single2ifromv(arg0 = np.array(
# [6.48000237e+00, 6.03959251e-10, 5.55129794e-03,
# 1.52143849e+04, 3.13453068e-02])):
import numpy as np
from scipy.inter... | [
"numpy.meshgrid",
"numpy.sum",
"numpy.asarray",
"numpy.isnan",
"numpy.hstack",
"numpy.array",
"numpy.linspace",
"functools.lru_cache",
"pvlib.pvsystem.singlediode"
] | [((5885, 5899), 'numpy.asarray', 'np.asarray', (['x0'], {}), '(x0)\n', (5895, 5899), True, 'import numpy as np\n'), ((5913, 5967), 'numpy.asarray', 'np.asarray', (['[x_0 - x_0 * delta_x, x_0 + x_0 * delta_x]'], {}), '([x_0 - x_0 * delta_x, x_0 + x_0 * delta_x])\n', (5923, 5967), True, 'import numpy as np\n'), ((6859, 6... |
# -*- coding: UTF-8 -*-
__author__ = '<NAME>'
import numpy as np
import VoigtFit
def print_T_model_pars(dataset, filename=None):
"""Print the turbulence and T parameters for physical model."""
N_comp = len(dataset.components.values()[0])
print("")
print(u" No: Temperature [K] Turbulence [k... | [
"VoigtFit.DataSet",
"numpy.loadtxt",
"numpy.sqrt"
] | [((1261, 1291), 'numpy.loadtxt', 'np.loadtxt', (['fname'], {'unpack': '(True)'}), '(fname, unpack=True)\n', (1271, 1291), True, 'import numpy as np\n'), ((1554, 1577), 'VoigtFit.DataSet', 'VoigtFit.DataSet', (['z_DLA'], {}), '(z_DLA)\n', (1570, 1577), False, 'import VoigtFit\n'), ((5693, 5730), 'numpy.sqrt', 'np.sqrt',... |
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats
import numpy as np
import pandas as pd
import os
from biothings_client import get_client
from bioservices import KEGG
import porch
import porch.qvalue as qv
import porch.cache as cache
import porch.sunburst.sunburst as sb
# Directories and file e... | [
"pandas.DataFrame",
"porch.porch_multi_reactome",
"porch.sunburst.sunburst.generate_reactome_sunburst",
"matplotlib.pyplot.show",
"porch.porch_reactome",
"porch.linear_model",
"porch.qvalue.qvalues",
"bioservices.KEGG",
"porch.sunburst.sunburst.get_conf_human",
"matplotlib.pyplot.figure",
"seabo... | [((1352, 1373), 'pandas.DataFrame', 'pd.DataFrame', (['content'], {}), '(content)\n', (1364, 1373), True, 'import pandas as pd\n'), ((2020, 2041), 'pandas.DataFrame', 'pd.DataFrame', (['content'], {}), '(content)\n', (2032, 2041), True, 'import pandas as pd\n'), ((3249, 3268), 'bioservices.KEGG', 'KEGG', ([], {'verbose... |
# 用于编程测试一些函数
import numpy as np
from keras.models import load_model
model = load_model('model_200_10.h5')
x_input = np.zeros((1,361),dtype=int)
x_input[0,180] = 1
x_input[0,181] = 2
print(x_input)
print(x_input.shape)
score = model.predict(x_input) * 20000 - 10000
print(score)
score = score[0,0]
print(score)
print("---... | [
"keras.models.load_model",
"numpy.zeros"
] | [((76, 105), 'keras.models.load_model', 'load_model', (['"""model_200_10.h5"""'], {}), "('model_200_10.h5')\n", (86, 105), False, 'from keras.models import load_model\n'), ((116, 145), 'numpy.zeros', 'np.zeros', (['(1, 361)'], {'dtype': 'int'}), '((1, 361), dtype=int)\n', (124, 145), True, 'import numpy as np\n')] |
"""Chunker functions"""
from itertools import islice, chain
from functools import partial
from typing import Iterable
inf = float('inf')
DFLT_CHK_SIZE = 2048
def mk_chunker(chk_size=DFLT_CHK_SIZE, chk_step=None, *, use_numpy_reshape=None):
"""
Generator of (fixed size and fixed step) chunks of an iterable.... | [
"itertools.chain.from_iterable",
"numpy.reshape",
"itertools.islice"
] | [((4643, 4668), 'itertools.chain.from_iterable', 'chain.from_iterable', (['chks'], {}), '(chks)\n', (4662, 4668), False, 'from itertools import islice, chain\n'), ((14606, 14635), 'itertools.islice', 'islice', (['it', 'start_at', 'stop_at'], {}), '(it, start_at, stop_at)\n', (14612, 14635), False, 'from itertools impor... |
import os
import time
import torch
import numpy as np
p = os.path.abspath('../..')
print(p)
import networks.networks as networks
def simple_resnet():
netname = "ResNet18"
net = networks.build(netname, 10)
print(net)
def all_thirdparty():
for netname in networks.KUANGLIU_NETS:
print(netname... | [
"networks.iotnets.random_net_densenet.get_instance",
"networks.iotnets.random_net_resnet.get_config",
"networks.iotnets.random_net_googlenet.sample",
"numpy.mean",
"networks.networks.build",
"torch.no_grad",
"networks.networks.sample_from_law",
"os.path.abspath",
"numpy.random.randn",
"numpy.std",... | [((59, 83), 'os.path.abspath', 'os.path.abspath', (['"""../.."""'], {}), "('../..')\n", (74, 83), False, 'import os\n'), ((189, 216), 'networks.networks.build', 'networks.build', (['netname', '(10)'], {}), '(netname, 10)\n', (203, 216), True, 'import networks.networks as networks\n'), ((710, 746), 'networks.iotnets.ran... |
# -*- coding: utf-8 -*-
''' Develop the vehicle simulation model, including the decision making module and motion planning module. '''
import torch
import numpy as np
import xlrd
from utils.Veh_dyn import vehicle_dyn
from utils.Det_crash import det_crash
from utils.Con_est import Collision_cond
__author__ = "<NAME... | [
"xlrd.open_workbook",
"utils.Con_est.Collision_cond",
"torch.nn.functional.softmax",
"numpy.rad2deg",
"numpy.append",
"numpy.max",
"numpy.sin",
"utils.Veh_dyn.vehicle_dyn",
"numpy.min",
"numpy.cos",
"utils.Det_crash.det_crash",
"numpy.array",
"numpy.arctan"
] | [((13651, 13671), 'numpy.max', 'np.max', (['[t_t - 1, 0]'], {}), '([t_t - 1, 0])\n', (13657, 13671), True, 'import numpy as np\n'), ((3505, 3527), 'numpy.max', 'np.max', (['[ego_t - 1, 0]'], {}), '([ego_t - 1, 0])\n', (3511, 3527), True, 'import numpy as np\n'), ((9802, 9828), 'numpy.arctan', 'np.arctan', (['(y_rela / ... |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
# matplotlib.use('Agg')
font = {'size': 14}
matplotlib.rc('font', **font)
root = os.getcwd()
root = '../absorb_spec/'
t, fit_wl, err_wl = np.genfromtxt(root+'peak_wls.txt', skip_header=1,
unpack=True)
fig... | [
"matplotlib.rc",
"matplotlib.pyplot.show",
"os.getcwd",
"numpy.genfromtxt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.tight_layout"
] | [((124, 153), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (137, 153), False, 'import matplotlib\n'), ((162, 173), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (171, 173), False, 'import os\n'), ((219, 283), 'numpy.genfromtxt', 'np.genfromtxt', (["(root + 'peak_wls.txt')"], {'skip_header... |
import torch
from torchvision import datasets, transforms
import argparse
import numpy as np
from PIL import Image
import json
def argparse_train():
parser = argparse.ArgumentParser()
parser.add_argument("data_directory", help="set directory to get the data from")
parser.add_argument("--save_dir", help="s... | [
"torchvision.transforms.ColorJitter",
"json.load",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomRotation",
"PIL.Image.open",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.ToTensor",
"numpy.array",
"torchvision.transforms.Normalize",
"torch... | [((163, 188), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (186, 188), False, 'import argparse\n'), ((1552, 1577), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1575, 1577), False, 'import argparse\n'), ((4738, 4760), 'PIL.Image.open', 'Image.open', (['image_path'],... |
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import numpy as np
import argparse
import cv2
import cvlib as cv
import os
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="path to input image")
args = ap.parse_args()
image = cv2.imread(args.im... | [
"cvlib.detect_face",
"argparse.ArgumentParser",
"numpy.copy",
"cv2.imwrite",
"numpy.expand_dims",
"cv2.imread",
"keras.preprocessing.image.img_to_array",
"cv2.rectangle",
"cv2.destroyAllWindows",
"cv2.resize"
] | [((168, 193), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (191, 193), False, 'import argparse\n'), ((302, 324), 'cv2.imread', 'cv2.imread', (['args.image'], {}), '(args.image)\n', (312, 324), False, 'import cv2\n'), ((463, 484), 'cvlib.detect_face', 'cv.detect_face', (['image'], {}), '(image... |
import logging
import time
import numpy as np
import quaternion
logging.basicConfig(level=logging.INFO)
def lookRotation(forward, up):
"""
Quaternion that rotates world to face Forward, while keeping orientation dictated by Up
See https://answers.unity.com/questions/467614/what-is-the-source-code-of-qua... | [
"logging.basicConfig",
"numpy.square",
"numpy.cross",
"numpy.arcsin",
"time.perf_counter",
"numpy.clip",
"numpy.isclose",
"numpy.sin",
"numpy.linalg.norm",
"numpy.array",
"numpy.cos",
"quaternion.quaternion",
"logging.getLogger",
"numpy.sqrt"
] | [((66, 105), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (85, 105), False, 'import logging\n'), ((416, 434), 'numpy.linalg.norm', 'np.linalg.norm', (['up'], {}), '(up)\n', (430, 434), True, 'import numpy as np\n'), ((498, 518), 'numpy.cross', 'np.cross', (['u... |
import tempfile
import argparse
import logging
import os
import pickle
import pprint
import time
import numpy as np
import yaml
import utils
import settings
import dataset_for_data_analysisv2 as dataset
import models
from collections import Counter
def get_inverse_dict(mydict):
inverse_dict = {}
for k in mydi... | [
"os.makedirs",
"argparse.ArgumentParser",
"dataset_for_data_analysisv2.get_data_loaders",
"utils.Map",
"logging.warn",
"torch.load",
"utils.get_template_id_maps",
"sys.path.insert",
"torch.FloatTensor",
"numpy.array",
"settings.set_settings",
"models.select_model",
"models.TypedDM",
"torch... | [((1173, 1198), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1196, 1198), False, 'import argparse\n'), ((4495, 4512), 'utils.Map', 'utils.Map', (['config'], {}), '(config)\n', (4504, 4512), False, 'import utils\n'), ((4525, 4591), 'utils.get_template_id_maps', 'utils.get_template_id_maps', (... |
import warnings
import scipy.ndimage
import numba
import numpy as np
def add_noise(image, model, mask=None):
"""
Adds noise to a simulated ccd image according to the noise model
Parameters
----------
image : ndarray
image data. Noise is only added to image values > 0
model : function... | [
"numpy.divide",
"warnings.filterwarnings",
"numpy.floor",
"numba.njit",
"numpy.zeros",
"numpy.isfinite",
"numpy.array",
"warnings.catch_warnings",
"numpy.fft.fft2"
] | [((1628, 1650), 'numba.njit', 'numba.njit', ([], {'cache': '(True)'}), '(cache=True)\n', (1638, 1650), False, 'import numba\n'), ((500, 527), 'numpy.array', 'np.array', (['image'], {'copy': '(False)'}), '(image, copy=False)\n', (508, 527), True, 'import numpy as np\n'), ((2099, 2136), 'numpy.zeros', 'np.zeros', (['(sx,... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 23 15:32:07 2019
A really simple implementation of Keras functional model
@author: kerem.ataman
"""
from numpy import genfromtxt
from numpy import array
from numpy import reshape
from tensorflow.keras.preprocessing.sequence import TimeseriesGenerator
from t... | [
"tensorflow.keras.layers.Dense",
"os.getcwd",
"numpy.genfromtxt",
"tensorflow.keras.models.Model",
"tensorflow.keras.layers.LSTM",
"tensorflow.keras.layers.Input",
"numpy.reshape",
"numpy.array",
"tensorflow.keras.callbacks.EarlyStopping"
] | [((985, 1040), 'numpy.genfromtxt', 'genfromtxt', (['inputLocation'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(inputLocation, delimiter=',', skip_header=1)\n", (995, 1040), False, 'from numpy import genfromtxt\n'), ((1464, 1518), 'numpy.reshape', 'reshape', (['trainX', '(trainX.shape[0], 1, trainX.shape[1])'],... |
import numpy as np
# ------------------ CONSTANTS --------------------
F_M = 50.1 * 10**6
V_TUBE = 2.248 * 10**8
V_SOLID = 1.87 * 10**8
V_AIR = 2.99 * 10**8
L_SOLID = 0.3
L_TUBE = 1 # +-0.001
V_C = 2.998 * 10**8
E_0 = 8.854 * 10** -12
MU_0 = 1.1257 * 10** -6
# -----------------------------... | [
"numpy.mean",
"numpy.array",
"to_latex.to_latex"
] | [((695, 720), 'numpy.array', 'np.array', (['[0, 0, 0, 0, 0]'], {}), '([0, 0, 0, 0, 0])\n', (703, 720), True, 'import numpy as np\n'), ((727, 768), 'numpy.array', 'np.array', (['[1.42, 1.42, 1.41, 1.41, 1.405]'], {}), '([1.42, 1.42, 1.41, 1.41, 1.405])\n', (735, 768), True, 'import numpy as np\n'), ((793, 817), 'numpy.m... |
import ROOT as rt
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score, roc_curve
import numpy as np
import argparse
import os
import random
fs=25
parser=argparse.ArgumentParser()
parser.add_argument("--var",type=str,default="eta",help='')
parser.add_argument("--savename",type=str,default="savemae"... | [
"numpy.load",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"sklearn.metrics.roc_curve",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"sklearn.metrics.roc_auc_score",
"ROOT.TFile",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tick_params",
"matplotli... | [((175, 200), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (198, 200), False, 'import argparse\n'), ((3409, 3419), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (3417, 3419), True, 'import matplotlib.pyplot as plt\n'), ((1463, 1490), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'... |
"""
<NAME> 02/2022
"""
# - python dependencies
from __future__ import print_function
import os
import numpy as np
import geopandas as gpd
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.ticker as mticker
from matplotlib.gridspec import GridSpec
from mpl_toolkits.axes_grid1 import... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"numpy.floor",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"cartopy.io.shapereader.Reader",
"cartopy.crs.PlateCarree",
"os.path.join",
"cartopy.crs.NorthPolarSte... | [((694, 713), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""jet"""'], {}), "('jet')\n", (706, 713), True, 'import matplotlib.pyplot as plt\n'), ((921, 992), 'os.path.join', 'os.path.join', (['"""."""', '"""esri_shp"""', '"""Petermann_Domain_glaciers_epsg3413.shp"""'], {}), "('.', 'esri_shp', 'Petermann_Domain_gla... |
#!/usr/bin/python3
import numpy as np
import os
import yaml
import argparse
parser = argparse.ArgumentParser(description =
"""
This script functions by reading in energy and entropy data given
the number 'N' forming the N*N Ising model. The heat capacity is computed
and compared to a bench... | [
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.xlim",
"yaml.load",
"numpy.zeros_like",
"matplotlib.pyplot.show",
"os.makedirs",
"argparse.ArgumentParser",
"numpy.reciprocal",
"os.path.isfile",
"matplotlib.pyplot.figure",
"numpy.arange"
] | [((87, 447), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n This script functions by reading in energy and entropy data given\n the number \'N\' forming the N*N Ising model. The heat capacity is computed\n and compared to a benchmark (which is also read in). A he... |
import gym
import time
import ctypes
import numpy as np
from collections import OrderedDict
from multiprocessing.context import Process
from multiprocessing import Array, Pipe, connection, Queue
from typing import Any, List, Tuple, Union, Callable, Optional
from tianshou.env.worker import EnvWorker
from tianshou.env.u... | [
"numpy.stack",
"numpy.isscalar",
"numpy.frombuffer",
"time.time",
"numpy.prod",
"multiprocessing.Pipe",
"tianshou.env.utils.CloudpickleWrapper",
"numpy.copyto",
"multiprocessing.context.Process",
"multiprocessing.connection.wait"
] | [((1387, 1413), 'numpy.copyto', 'np.copyto', (['dst_np', 'ndarray'], {}), '(dst_np, ndarray)\n', (1396, 1413), True, 'import numpy as np\n'), ((5443, 5449), 'multiprocessing.Pipe', 'Pipe', ([], {}), '()\n', (5447, 5449), False, 'from multiprocessing import Array, Pipe, connection, Queue\n'), ((5938, 5985), 'multiproces... |
import numpy as np
def approximate_steady_state_iob_from_sbr(scheduled_basal_rate: np.float64) -> np.float64:
"""
Approximate the amount of insulin-on-board from user's scheduled basal rate (sbr). This value
comes from running the Tidepool Simple Diabetes Metabolism Model with the user's sbr for 8 hours.
... | [
"numpy.sum"
] | [((2019, 2062), 'numpy.sum', 'np.sum', (['indices_with_less_50percent_sbr_iob'], {}), '(indices_with_less_50percent_sbr_iob)\n', (2025, 2062), True, 'import numpy as np\n')] |
import numpy as np
import json
import unittest
from opponent_move import opponent_move
"""
This is based on a paper titled 'Using Evolutionary Programming to Create
Neural Networks that are Capable of Playing Tic-Tac-Toe'.
The values and algorithms used in this project are taken from the paper,
except for the propaga... | [
"json.dump",
"numpy.random.uniform",
"json.load",
"numpy.sum",
"numpy.amin",
"numpy.power",
"opponent_move.opponent_move",
"numpy.zeros",
"numpy.nonzero",
"numpy.around",
"numpy.cumsum",
"numpy.histogram",
"numpy.array",
"numpy.random.randint",
"numpy.random.normal",
"numpy.exp",
"nu... | [((599, 621), 'numpy.zeros', 'np.zeros', (['(arr_len, 1)'], {}), '((arr_len, 1))\n', (607, 621), True, 'import numpy as np\n'), ((6969, 6985), 'numpy.array', 'np.array', (['scores'], {}), '(scores)\n', (6977, 6985), True, 'import numpy as np\n'), ((7101, 7123), 'numpy.power', 'np.power', (['score_arr', '(3)'], {}), '(s... |
# Copyright 2021 Quantapix Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
"os.path.isdir",
"transformers.EvalPrediction",
"logging.getLogger",
"json.dumps",
"collections.defaultdict",
"tqdm.auto.tqdm",
"numpy.max",
"collections.OrderedDict",
"torch.no_grad",
"os.path.join",
"numpy.concatenate"
] | [((1085, 1112), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1102, 1112), False, 'import logging\n'), ((12945, 12974), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (12968, 12974), False, 'import collections\n'), ((13123, 13148), 'collections.Ordered... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import scipy as sp
from scipy import sparse
from scipy.sparse import linalg
def error_A_norm(**kwargs):
'''
callback function to compute A-norm of error at each step
Parameters
----------
kwargs['k'] : inetger
... | [
"scipy.sparse.issparse",
"numpy.zeros",
"numpy.sqrt"
] | [((1491, 1521), 'numpy.sqrt', 'np.sqrt', (['(error.T @ (A @ error))'], {}), '(error.T @ (A @ error))\n', (1498, 1521), True, 'import numpy as np\n'), ((1323, 1356), 'numpy.zeros', 'np.zeros', (['max_iter'], {'dtype': 'A.dtype'}), '(max_iter, dtype=A.dtype)\n', (1331, 1356), True, 'import numpy as np\n'), ((1093, 1114),... |
import matplotlib.pyplot as pyplot
import numpy
# inspired by http://people.duke.edu/~ccc14/pcfb/numpympl/MatplotlibBarPlots.html
xTickMarks = ["azure A1", "azure A4", "amazon T2", "amazon C4", "amazon M4", "amazon R4"]
N = 6
CPU_total_time = [66.8626, 66.6122, 29.8535, 25.0010, 29.3211, 27.8841]
CPU_avg_request = [6... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.setp",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.tight_layout"
] | [((363, 378), 'numpy.arange', 'numpy.arange', (['N'], {}), '(N)\n', (375, 378), False, 'import numpy\n'), ((399, 414), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (412, 414), True, 'import matplotlib.pyplot as pyplot\n'), ((741, 790), 'matplotlib.pyplot.setp', 'pyplot.setp', (['xtickNames'], {'rotati... |
# Author: SiliconSloth 18/1/2018
import numpy as np
import cPickle
import cv2
# PyCharm seems to need this to work properly.
# try:
# from cv2 import cv2
# except:
# pass
# In a raw training video there is often very little difference between consecutive frames, so using every single frame of the... | [
"cv2.VideoWriter_fourcc",
"numpy.median",
"cPickle.load",
"cv2.VideoCapture",
"cPickle.dump",
"cv2.KeyPoint",
"numpy.array",
"cv2.BFMatcher_create"
] | [((3093, 3148), 'cv2.BFMatcher_create', 'cv2.BFMatcher_create', (['cv2.NORM_HAMMING'], {'crossCheck': '(True)'}), '(cv2.NORM_HAMMING, crossCheck=True)\n', (3113, 3148), False, 'import cv2\n'), ((3198, 3237), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(videoPath + videoFile)'], {}), '(videoPath + videoFile)\n', (3214, 3... |
import argparse
import logging
import os
import random
import socket
import sys
from sklearn.utils import shuffle
import numpy as np
import psutil
import setproctitle
import torch
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from fedml_api.model.finance.vfl_classifier import VFLClassif... | [
"fedml_api.distributed.classical_vertical_fl.vfl_api.FedML_VFL_distributed",
"numpy.random.seed",
"argparse.ArgumentParser",
"os.getpid",
"os.getcwd",
"torch.manual_seed",
"fedml_api.data_preprocessing.lending_club_loan.lending_club_dataset.loan_load_three_party_data",
"setproctitle.setproctitle",
"... | [((2268, 2298), 'logging.info', 'logging.info', (['process_gpu_dict'], {}), '(process_gpu_dict)\n', (2280, 2298), False, 'import logging\n'), ((2418, 2438), 'logging.info', 'logging.info', (['device'], {}), '(device)\n', (2430, 2438), False, 'import logging\n'), ((2569, 2581), 'fedml_api.distributed.fedavg.FedAvgAPI.Fe... |
##Python script to convert back from sphire to relion##
import sys
import os
import numpy as np
def is_number(s): ##### definition to check for int
try:
int(s)
return True
except ValueError:
return False
print('\nTaking sphire substack id list to convert back to relion!')
i = 1
wh... | [
"os.path.isfile",
"numpy.loadtxt",
"os.remove"
] | [((1307, 1332), 'os.path.isfile', 'os.path.isfile', (['star_path'], {}), '(star_path)\n', (1321, 1332), False, 'import os\n'), ((1430, 1453), 'os.path.isfile', 'os.path.isfile', (['id_list'], {}), '(id_list)\n', (1444, 1453), False, 'import os\n'), ((1606, 1636), 'numpy.loadtxt', 'np.loadtxt', (['id_list'], {'dtype': '... |
# -*- coding: UTF-8 -*-
# !/usr/bin/python
# @time :2019/8/14 17:40
# @author :Mo
# @function :
# 适配linux
import pathlib
import sys
import os
project_path = str(pathlib.Path(os.path.abspath(__file__)).parent.parent.parent)
sys.path.append(project_path)
# 地址
from keras_textclassification.conf.path_config import ... | [
"sys.path.append",
"os.path.abspath",
"keras_textclassification.m02_TextCNN.graph.TextCNNGraph",
"keras_textclassification.data_preprocess.text_preprocess.PreprocessTextMulti",
"numpy.array",
"keras_textclassification.data_preprocess.text_preprocess.load_json"
] | [((231, 260), 'sys.path.append', 'sys.path.append', (['project_path'], {}), '(project_path)\n', (246, 260), False, 'import sys\n'), ((929, 960), 'keras_textclassification.data_preprocess.text_preprocess.load_json', 'load_json', (['path_hyper_parameter'], {}), '(path_hyper_parameter)\n', (938, 960), False, 'from keras_t... |
import crocoddyl
from crocoddyl.utils import DifferentialFreeFwdDynamicsDerived
import pinocchio
import example_robot_data
import numpy as np
import os
import sys
import time
import subprocess
# First, let's load the Pinocchio model for the Talos arm.
ROBOT = example_robot_data.loadTalosArm()
N = 100 # number of node... | [
"crocoddyl.CostModelFramePlacement",
"crocoddyl.StateMultibody",
"crocoddyl.SolverDDP",
"numpy.matrix",
"os.path.abspath",
"crocoddyl.ShootingProblem",
"crocoddyl.CallbackVerbose",
"numpy.zeros",
"time.time",
"crocoddyl.CostModelControl",
"crocoddyl.CostModelState",
"crocoddyl.ActuationModelFu... | [((261, 294), 'example_robot_data.loadTalosArm', 'example_robot_data.loadTalosArm', ([], {}), '()\n', (292, 294), False, 'import example_robot_data\n'), ((1008, 1045), 'crocoddyl.StateMultibody', 'crocoddyl.StateMultibody', (['robot_model'], {}), '(robot_model)\n', (1032, 1045), False, 'import crocoddyl\n'), ((1244, 12... |
from __future__ import absolute_import, division, print_function
import pytest
pytest.importorskip('flask')
pytest.importorskip('flask.ext.cors')
from base64 import b64encode
from copy import copy
import datashape
from datashape.util.testing import assert_dshape_equal
import numpy as np
from odo import odo, convert
... | [
"numpy.arange",
"pytest.mark.parametrize",
"numpy.testing.assert_array_almost_equal",
"blaze.dispatch.dispatch",
"pandas.DataFrame",
"blaze.utils.example",
"blaze.compute",
"datashape.dshape",
"pytest.yield_fixture",
"blaze.symbol",
"blaze.server.serialization.fastmsgpack.loads",
"blaze.server... | [((80, 108), 'pytest.importorskip', 'pytest.importorskip', (['"""flask"""'], {}), "('flask')\n", (99, 108), False, 'import pytest\n'), ((109, 146), 'pytest.importorskip', 'pytest.importorskip', (['"""flask.ext.cors"""'], {}), "('flask.ext.cors')\n", (128, 146), False, 'import pytest\n'), ((839, 908), 'pandas.DataFrame'... |
#!/usr/bin/env python
"""Demonstrate non-binary plot calibration curve failure
Reproduction for WB-6749.
---
id: 0.sklearn.01-plot-calibration-curve-nonbinary
tag:
shard: sklearn
plugin:
- wandb
depend:
requirements:
- numpy
- pandas
- scikit-learn
files:
- file: wine.csv
source: https:/... | [
"sklearn.ensemble.RandomForestClassifier",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.argsort",
"wandb.init",
"wandb.sklearn.plot_calibration_curve"
] | [((1168, 1191), 'pandas.read_csv', 'pd.read_csv', (['"""wine.csv"""'], {}), "('wine.csv')\n", (1179, 1191), True, 'import pandas as pd\n'), ((1362, 1399), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)'}), '(X, y, test_size=0.2)\n', (1378, 1399), False, 'from sklearn.m... |
import numpy as np
import copy
n=6;
G=np.mat("0 0 0 1.0 0 1.0;1 0 0 0 0 0;0 1 0 0 0 0;0 1 1 0 0 0;0 0 1 0 0 0;0 0 0 1 1 0");
#0 0 0 1 0 1
#1 0 0 0 0 0
#0 1 0 0 0 0
#0 1 1 0 0 0
#0 0 1 0 0 0
#0 0 0 1 1 0
P=np.mat("0 0.0 0 0 0");
A=np.mat("0 0 0 1.0 0 1.0;1 0 0 0 0 0;0 1 0 0 0 0;0 1 1 0 0 0;0 0 1 0 0 0;0 0 0 1 1 0");
#f... | [
"copy.deepcopy",
"numpy.zeros",
"numpy.transpose",
"numpy.ones",
"numpy.mat"
] | [((38, 133), 'numpy.mat', 'np.mat', (['"""0 0 0 1.0 0 1.0;1 0 0 0 0 0;0 1 0 0 0 0;0 1 1 0 0 0;0 0 1 0 0 0;0 0 0 1 1 0"""'], {}), "(\n '0 0 0 1.0 0 1.0;1 0 0 0 0 0;0 1 0 0 0 0;0 1 1 0 0 0;0 0 1 0 0 0;0 0 0 1 1 0'\n )\n", (44, 133), True, 'import numpy as np\n'), ((205, 226), 'numpy.mat', 'np.mat', (['"""0 0.0 0 0 ... |
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import pickle
from warnings import simplefilter
from all_functions import *
from feedback_functions import *
simplefilter(action='ignore', category=FutureWarning)
# np.random.seed(0)
# [babbling_kinematics, babbling_activations] = babbling_fc... | [
"numpy.random.seed",
"warnings.simplefilter",
"numpy.power",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.arange",
"numpy.tile",
"numpy.random.rand",
"numpy.dot"
] | [((186, 239), 'warnings.simplefilter', 'simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (198, 239), False, 'from warnings import simplefilter\n'), ((731, 749), 'numpy.array', 'np.array', (['[10, 15]'], {}), '([10, 15])\n', (739, 749), True, 'i... |
# https://zhuanlan.zhihu.com/p/335753926
import os, sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from collections import OrderedDict
import numpy as np
import cv2
import torch
from pytorchocr.base_ocr_v20 import BaseOCRV20
class PPOCRv2RecConverter(BaseOCRV20):
def __init__(s... | [
"os.path.abspath",
"numpy.sum",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.random.randn",
"numpy.max",
"numpy.mean",
"numpy.min",
"torch.Tensor",
"torch.from_numpy"
] | [((2631, 2656), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2654, 2656), False, 'import argparse, json, textwrap, sys, os\n'), ((3300, 3319), 'numpy.random.seed', 'np.random.seed', (['(666)'], {}), '(666)\n', (3314, 3319), True, 'import numpy as np\n'), ((3390, 3414), 'torch.from_numpy', 't... |
import torch
import torch.nn as nn
from torch.utils.data import Dataset
import pickle
import numpy as np
from typing import List, Union
from random import randint
import re
from perf_gan.data.preprocess import Identity, PitchTransform, LoudnessTransform
class SynthDataset(Dataset):
def __init__(self, path: str, ... | [
"re.split",
"torch.split",
"torch.cat",
"pickle.load",
"torch.Tensor",
"numpy.concatenate"
] | [((1230, 1258), 'numpy.concatenate', 'np.concatenate', (['(u_f0, e_f0)'], {}), '((u_f0, e_f0))\n', (1244, 1258), True, 'import numpy as np\n'), ((1438, 1466), 'numpy.concatenate', 'np.concatenate', (['(u_lo, e_lo)'], {}), '((u_lo, e_lo))\n', (1452, 1466), True, 'import numpy as np\n'), ((1915, 1936), 'torch.split', 'to... |
# SPDX-License-Identifier: BSD-3-Clause AND Apache-2.0
# Copyright 2018 Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code... | [
"numpy.minimum",
"numpy.maximum",
"scipy.interpolate.InterpolatedUnivariateSpline",
"scipy.optimize.brentq",
"scipy.cluster.vq.kmeans",
"numpy.std",
"numpy.isscalar",
"numpy.searchsorted",
"numpy.insert",
"numpy.append",
"numpy.around",
"numpy.diff",
"numpy.arange",
"numpy.array",
"numpy... | [((3142, 3207), 'scipy.interpolate.InterpolatedUnivariateSpline', 'interp.InterpolatedUnivariateSpline', (['xvec', 'yvec'], {'k': 'order', 'ext': 'ext'}), '(xvec, yvec, k=order, ext=ext)\n', (3177, 3207), True, 'import scipy.interpolate as interp\n'), ((5838, 5851), 'numpy.diff', 'np.diff', (['qvec'], {}), '(qvec)\n', ... |
import os
from flask import Flask, request, render_template
os.environ['PATH'] = r'D:\home\python354x64;' + os.environ['PATH']
import cntk
import numpy as np
app = Flask(__name__)
wsgi_app = app.wsgi_app
model = cntk.load_model('D:\\home\\site\\wwwroot\\models\\hangman_model.dnn')
''' Helper functions for neural netw... | [
"flask.request.form.getlist",
"cntk.load_model",
"flask.Flask",
"numpy.zeros",
"os.environ.get",
"flask.render_template",
"numpy.squeeze"
] | [((165, 180), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'from flask import Flask, request, render_template\n'), ((213, 282), 'cntk.load_model', 'cntk.load_model', (['"""D:\\\\home\\\\site\\\\wwwroot\\\\models\\\\hangman_model.dnn"""'], {}), "('D:\\\\home\\\\site\\\\wwwroot\\\\models... |
"""
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import pathlib
import random
import numpy as np
import h5py
from torch.utils.data import Dataset
from data import transforms
import torch
class SliceData(Dataset):
"""
A PyTorch Da... | [
"data.transforms.complex_abs",
"data.transforms.to_tensor",
"h5py.File",
"random.shuffle",
"numpy.asarray",
"pathlib.Path",
"data.transforms.normalize",
"random.seed",
"data.transforms.apply_mask",
"torch.tensor",
"data.transforms.ifft2"
] | [((1527, 1544), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1538, 1544), False, 'import random\n'), ((4908, 4936), 'data.transforms.to_tensor', 'transforms.to_tensor', (['kspace'], {}), '(kspace)\n', (4928, 4936), False, 'from data import transforms\n'), ((5292, 5323), 'data.transforms.ifft2', 'transform... |
import pytest, os
import numpy as np
import bowienator
global faces
def test_generator_face_list():
global faces
faces = bowienator.face_list(os.path.join(os.path.dirname(os.path.realpath(__file__)),'data','james.png'))
assert np.all(faces) == np.all([[482, 201, 330, 330]])
def test_generator_bowie_draw():
gl... | [
"os.path.realpath",
"numpy.all"
] | [((234, 247), 'numpy.all', 'np.all', (['faces'], {}), '(faces)\n', (240, 247), True, 'import numpy as np\n'), ((251, 281), 'numpy.all', 'np.all', (['[[482, 201, 330, 330]]'], {}), '([[482, 201, 330, 330]])\n', (257, 281), True, 'import numpy as np\n'), ((177, 203), 'os.path.realpath', 'os.path.realpath', (['__file__'],... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import os.path as op
import mne
import numpy as np
from mnefun._paths import (get_raw_fnames, get_event_fnames)
import expyfun
# words = 1
# faces = 2
# cars = 3 (channels 1 and 2)
# alien = 4
def prek_score(p, subjects):
for si, subject in enumerate(su... | [
"mne.io.read_raw_fif",
"mnefun._paths.get_raw_fnames",
"mnefun._paths.get_event_fnames",
"expyfun.analyze.dprime",
"mne.find_events",
"numpy.array",
"os.path.join",
"numpy.concatenate",
"numpy.in1d"
] | [((346, 436), 'mnefun._paths.get_raw_fnames', 'get_raw_fnames', (['p', 'subject'], {'which': '"""raw"""', 'erm': '(False)', 'add_splits': '(False)', 'run_indices': 'None'}), "(p, subject, which='raw', erm=False, add_splits=False,\n run_indices=None)\n", (360, 436), False, 'from mnefun._paths import get_raw_fnames, g... |
import os
import numpy as np
import matplotlib.pyplot as plt
import struct
import h5py
import numpy as np
import matplotlib.pyplot as plt
import pickle
from extractModel_mappings import allparams_from_mapping
import subprocess
import csv
import bluepyopt as bpop
import shutil, errno
import pandas as pd
#os.chdir("Ne... | [
"os.mkdir",
"h5py.File",
"os.remove",
"os.path.isdir",
"numpy.fromfile",
"pandas.read_csv",
"os.path.exists",
"numpy.genfromtxt",
"numpy.max",
"numpy.array",
"numpy.reshape",
"shutil.copytree",
"shutil.copy"
] | [((642, 668), 'os.path.isdir', 'os.path.isdir', (['"""/tmp/Data"""'], {}), "('/tmp/Data')\n", (655, 668), False, 'import os\n'), ((674, 695), 'os.mkdir', 'os.mkdir', (['"""/tmp/Data"""'], {}), "('/tmp/Data')\n", (682, 695), False, 'import os\n'), ((1067, 1092), 'numpy.fromfile', 'np.fromfile', (['f', 'np.double'], {}),... |
import numpy as np
import os
import pandas as pd
import pytest
import torch
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.linear_model import LogisticRegression
from tx2.wrapper import Wrapper
@pytest.fixture
def replacement_debounce():
"""This is so that we can replace utils.debounce... | [
"pandas.DataFrame",
"sklearn.feature_extraction.text.CountVectorizer",
"tx2.wrapper.Wrapper",
"pytest.fixture",
"os.system",
"torch.squeeze",
"sklearn.linear_model.LogisticRegression",
"numpy.array"
] | [((2234, 2266), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (2248, 2266), False, 'import pytest\n'), ((2922, 2953), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (2936, 2953), False, 'import pytest\n'), ((897, 915), 'panda... |
from utils_tf_record.read_dataset_utils import read_and_parse_sharded_dataset
import os
import itertools
import random
import tensorflow as tf
import numpy as np
import pandas as pd
import math
from tqdm import tqdm
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
import seaborn as sns
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"sklearn.preprocessing.MinMaxScaler",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"numpy.mean",
"pyeasyga.pyeasyga.GeneticAlgorithm",
"numpy.arange",
"numpy.random.randint",
"utils_tf_record.read_dataset_utils.read... | [((675, 712), 'tensorflow.compat.v1.enable_eager_execution', 'tf.compat.v1.enable_eager_execution', ([], {}), '()\n', (710, 712), True, 'import tensorflow as tf\n'), ((3727, 3751), 'pandas.read_csv', 'pd.read_csv', (['OUTPUT_FILE'], {}), '(OUTPUT_FILE)\n', (3738, 3751), True, 'import pandas as pd\n'), ((42468, 42527), ... |
"""Tests for the ``bokeh_templating`` module.
Authors
-------
- <NAME>
Use
---
These tests can be run via the command line (omit the -s to
suppress verbose output to stdout):
::
pytest -s test_bokeh_templating.py
"""
import os
import numpy as np
from jwql.bokeh_templating import BokehTemplate
f... | [
"os.path.realpath",
"os.path.join",
"numpy.linspace"
] | [((346, 372), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (362, 372), False, 'import os\n'), ((913, 974), 'os.path.join', 'os.path.join', (['file_dir', '"""test_bokeh_tempating_interface.yaml"""'], {}), "(file_dir, 'test_bokeh_tempating_interface.yaml')\n", (925, 974), False, 'import os\... |
from typing import Dict
import numpy as np
from scipy.signal import lfilter
def np_softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum(axis=-1)
def geometric_cumsum(alpha, x):
"""
Adapted from https://github.com/zuoxingdong/lagom
"""
x = np.asarray(x)
if x.ndim == 1:
x ... | [
"scipy.signal.lfilter",
"numpy.empty",
"numpy.asarray",
"numpy.dtype",
"numpy.expand_dims",
"numpy.max"
] | [((276, 289), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (286, 289), True, 'import numpy as np\n'), ((322, 342), 'numpy.expand_dims', 'np.expand_dims', (['x', '(0)'], {}), '(x, 0)\n', (336, 342), True, 'import numpy as np\n'), ((377, 422), 'scipy.signal.lfilter', 'lfilter', (['[1]', '[1, -alpha]', 'x[:, ::-1]... |
import os
from math import isclose
import numpy as np
import pytest
import xarray as xr
from roocs_utils.xarray_utils.xarray_utils import get_coord_by_type
from clisops.ops.subset import subset
from ._common import CMIP6_RLDS_ONE_TIME_STEP
def open_dataset():
# use real dataset to get full longitude data
r... | [
"roocs_utils.xarray_utils.xarray_utils.get_coord_by_type",
"numpy.testing.assert_raises",
"numpy.testing.assert_array_equal",
"os.path.isdir",
"xarray.open_dataset",
"pytest.raises",
"clisops.ops.subset.subset",
"numpy.testing.assert_allclose",
"xarray.open_mfdataset",
"pytest.mark.skip"
] | [((3799, 3856), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""rolling now done within subset"""'}), "(reason='rolling now done within subset')\n", (3815, 3856), False, 'import pytest\n'), ((4372, 4429), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""rolling now done within subset"""'}), "(rea... |
import copy
import numpy as np
import pytest
import torch
from mmdet.core import GeneralData, InstanceData
def _equal(a, b):
if isinstance(a, (torch.Tensor, np.ndarray)):
return (a == b).all()
else:
return a == b
def test_general_data():
# test init
meta_info = dict(
img_s... | [
"torch.ones",
"copy.deepcopy",
"torch.randint",
"mmdet.core.InstanceData.cat",
"torch.LongTensor",
"numpy.random.rand",
"mmdet.core.GeneralData",
"mmdet.digit_version",
"pytest.raises",
"numpy.random.random",
"torch.cuda.is_available",
"torch.arange",
"torch.Tensor",
"torch.rand",
"numpy... | [((577, 609), 'mmdet.core.GeneralData', 'GeneralData', ([], {'meta_info': 'meta_info'}), '(meta_info=meta_info)\n', (588, 609), False, 'from mmdet.core import GeneralData, InstanceData\n'), ((1646, 1659), 'mmdet.core.GeneralData', 'GeneralData', ([], {}), '()\n', (1657, 1659), False, 'from mmdet.core import GeneralData... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.