code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, <NAME>"
__license__ = "GPL"
__version__ = "1.0.1"
__email__ = "<EMAIL>"
import numpy as np
from scipy.interpolate import interp1d
from scipy.optimize import fsolve
from scipy.optimize import root
import matplotlib.py... | [
"scipy.optimize.fsolve",
"numpy.sqrt",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.deg2rad",
"numpy.empty_like",
"numpy.cos",
"src.UtilsMod.build_interp_func",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((999, 1027), 'src.UtilsMod.build_interp_func', 'build_interp_func', (['"""fcdmult"""'], {}), "('fcdmult')\n", (1016, 1027), False, 'from src.UtilsMod import build_interp_func\n'), ((1049, 1075), 'src.UtilsMod.build_interp_func', 'build_interp_func', (['"""kheff"""'], {}), "('kheff')\n", (1066, 1075), False, 'from src... |
"""P2S10 TD3 v5 with 60x60 front and orientation from ac3.ipynb
Automatically generated by Colaboratory.
# Twin-Delayed DDPG
On a custom car env
state:
1. 40x40 cutout: 25 embeddings || car is at mid ( grid embeddings)
2. 25 cnn embeddings `+` [distance, orientation, -orientation, self.angle, -self.angle]
NOTE: Emb... | [
"numpy.random.normal",
"os.path.exists",
"os.makedirs",
"ai.ReplayBuffer",
"ai.TD3",
"torch.cuda.is_available",
"time.time",
"gym.make",
"numpy.save"
] | [((3245, 3263), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (3253, 3263), False, 'import gym\n'), ((3598, 3639), 'ai.TD3', 'ai.TD3', (['state_dim', 'action_dim', 'max_action'], {}), '(state_dim, action_dim, max_action)\n', (3604, 3639), False, 'import ai\n'), ((3713, 3730), 'ai.ReplayBuffer', 'ai.Replay... |
from random import random
import numpy as np
import math
class MCM:
'''
输入函数函数,积分上下限,实验次数,即可计算蒙特卡洛积分
用__init__初始化
solve有两种方法,投点法和平均值法
'''
def __init__(self, f, xlim, ylim=(0,1), times=10000):
'''
f是函数,按照正常python函数写,返回函数表达式
xlim和ylim是元组或者列表
times是实验次... | [
"random.random",
"math.sin",
"numpy.random.rand"
] | [((1214, 1225), 'math.sin', 'math.sin', (['x'], {}), '(x)\n', (1222, 1225), False, 'import math\n'), ((506, 514), 'random.random', 'random', ([], {}), '()\n', (512, 514), False, 'from random import random\n'), ((560, 568), 'random.random', 'random', ([], {}), '()\n', (566, 568), False, 'from random import random\n'), (... |
import sys
sys.path.append('/home/xuchengjun/ZXin/smap')
import torch
from torch.utils.data import DataLoader
import os
import argparse
import numpy as np
import copy
import time
from IPython import embed
from dataset.p2p_dataset import P2PDataset
from model.refine_model.refinenet import RefineNet
# from lib.utils.mode... | [
"numpy.mean",
"numpy.abs",
"argparse.ArgumentParser",
"model.refine_model.refinenet.RefineNet",
"torch.load",
"time.time",
"os.path.join",
"dataset.p2p_dataset.P2PDataset",
"torch.utils.data.DataLoader",
"torch.no_grad",
"sys.path.append"
] | [((11, 56), 'sys.path.append', 'sys.path.append', (['"""/home/xuchengjun/ZXin/smap"""'], {}), "('/home/xuchengjun/ZXin/smap')\n", (26, 56), False, 'import sys\n'), ((493, 561), 'dataset.p2p_dataset.P2PDataset', 'P2PDataset', ([], {'dataset_path': 'cfg.DATA_DIR', 'root_idx': 'cfg.DATASET.ROOT_IDX'}), '(dataset_path=cfg.... |
import numpy as np
# The worker class is a member of the trainer class, the trainer can have multiple workers
class Worker():
def __init__(self, settings, sess, number, trainerNumber, network, queues, coord):
self.localAC = network
self.name = 'worker{}'.format(number)
self.number = number
... | [
"numpy.random.choice",
"numpy.argmax"
] | [((1256, 1304), 'numpy.random.choice', 'np.random.choice', (['actionDist[0]'], {'p': 'actionDist[0]'}), '(actionDist[0], p=actionDist[0])\n', (1272, 1304), True, 'import numpy as np\n'), ((1326, 1357), 'numpy.argmax', 'np.argmax', (['(actionDist == action)'], {}), '(actionDist == action)\n', (1335, 1357), True, 'import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 10:12:52 2019
@author: gregz
"""
import argparse as ap
import numpy as np
import os.path as op
import matplotlib.pyplot as plt
import sys
import warnings
from scipy.interpolate import interp1d, griddata
from math_utils import biweight
from inpu... | [
"numpy.nanargmax",
"numpy.sqrt",
"numpy.nanpercentile",
"numpy.random.rand",
"numpy.hstack",
"numpy.polyfit",
"input_utils.setup_logging",
"math_utils.biweight",
"scipy.interpolate.interp1d",
"numpy.argsort",
"astropy.convolution.Gaussian1DKernel",
"numpy.array_split",
"numpy.array",
"nump... | [((15661, 15694), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (15684, 15694), False, 'import warnings\n'), ((15734, 15766), 'argparse.ArgumentParser', 'ap.ArgumentParser', ([], {'add_help': '(True)'}), '(add_help=True)\n', (15751, 15766), True, 'import argparse as ap\n'... |
from unittest import TestCase
from niaaml import ParameterDefinition, MinMax, OptimizationStats, get_bin_index
import numpy as np
import tempfile
class UtilitiesTestCase(TestCase):
def test_get_bin_index_works_fine(self):
self.assertEqual(get_bin_index(0.0, 4), 0)
self.assertEqual(get_bin_index(0.... | [
"niaaml.get_bin_index",
"numpy.array",
"niaaml.MinMax",
"niaaml.OptimizationStats"
] | [((1005, 1247), 'numpy.array', 'np.array', (["['Class 1', 'Class 1', 'Class 1', 'Class 2', 'Class 1', 'Class 2',\n 'Class 2', 'Class 2', 'Class 2', 'Class 1', 'Class 1', 'Class 2',\n 'Class 1', 'Class 2', 'Class 1', 'Class 1', 'Class 1', 'Class 1',\n 'Class 2', 'Class 1']"], {}), "(['Class 1', 'Class 1', 'Clas... |
import numpy as np
from .initialization import *
from .conviction_helper_functions import *
import networkx as nx
# Phase 2
# Behaviors
def check_progress(params, step, sL, s):
'''
Driving processes: completion of previously funded proposals
'''
network = s['network']
proposals = get_nodes_... | [
"numpy.sum",
"numpy.log",
"numpy.random.rand",
"numpy.max"
] | [((4687, 4747), 'numpy.sum', 'np.sum', (["[network.edges[i, j]['affinity'] for j in supported]"], {}), "([network.edges[i, j]['affinity'] for j in supported])\n", (4693, 4747), True, 'import numpy as np\n'), ((5366, 5431), 'numpy.sum', 'np.sum', (["[network.edges[i, j]['conviction'] for i in participants]"], {}), "([ne... |
import subprocess
import numpy as np
import matplotlib.pyplot as plt
runs = 50
def outlier_filter(datas, threshold = 2):
datas = np.array(datas)
z = np.abs((datas - datas.mean()) / datas.std())
return datas[z < threshold]
def data_processing(data_set, n):
catgories = data_set[0].shape[0]
samples ... | [
"matplotlib.pyplot.savefig",
"numpy.delete",
"subprocess.run",
"numpy.array",
"numpy.zeros",
"numpy.loadtxt",
"matplotlib.pyplot.subplots"
] | [((135, 150), 'numpy.array', 'np.array', (['datas'], {}), '(datas)\n', (143, 150), True, 'import numpy as np\n'), ((355, 385), 'numpy.zeros', 'np.zeros', (['(catgories, samples)'], {}), '((catgories, samples))\n', (363, 385), True, 'import numpy as np\n'), ((985, 1016), 'matplotlib.pyplot.subplots', 'plt.subplots', (['... |
"""Collect training data from MIDI files."""
import argparse
from pathlib import Path
import numpy as np
from pypianoroll import Multitrack, Track
FAMILY_NAMES = [
"drum",
"bass",
"guitar",
"string",
"piano",
]
FAMILY_THRESHOLDS = [
(2, 24), # drum
(1, 96), # bass
(2, 156), # guita... | [
"argparse.ArgumentParser",
"numpy.where",
"pypianoroll.Multitrack",
"numpy.sum",
"numpy.random.randint",
"numpy.zeros",
"numpy.concatenate",
"numpy.save",
"numpy.random.permutation"
] | [((450, 526), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Collect training data from MIDI files"""'}), "(description='Collect training data from MIDI files')\n", (473, 526), False, 'import argparse\n'), ((5588, 5625), 'numpy.concatenate', 'np.concatenate', (['compiled_list'], {'axis':... |
import unittest
from generativepy.nparray import make_nparray, make_nparray_frame
from generativepy.movie import save_frame
from image_test_helper import run_image_test
import numpy as np
"""
Test each function of the nparray module, with 1, 3 and 4 channel output
"""
def draw4(array, pixel_width, pixel_height, frame... | [
"generativepy.movie.save_frame",
"image_test_helper.run_image_test",
"generativepy.nparray.make_nparray_frame",
"generativepy.nparray.make_nparray",
"numpy.full"
] | [((1712, 1759), 'generativepy.nparray.make_nparray', 'make_nparray', (['file', 'draw4', '(600)', '(400)'], {'channels': '(4)'}), '(file, draw4, 600, 400, channels=4)\n', (1724, 1759), False, 'from generativepy.nparray import make_nparray, make_nparray_frame\n'), ((1785, 1838), 'image_test_helper.run_image_test', 'run_i... |
import torch
from torch import nn
import copy
import numpy as np
import os
import sys
import wandb
from chemprop.models import MoleculeModelDUN
from chemprop.bayes import BayesLinear, neg_log_likeDUN
from chemprop.bayes_utils import scheduler_const
from chemprop.utils import save_checkpoint, load_checkpoint
from chem... | [
"wandb.log",
"chemprop.bayes_utils.scheduler_const",
"os.path.join",
"torch.exp",
"chemprop.models.MoleculeModelDUN",
"numpy.nanmean",
"chemprop.nn_utils.NoamLR",
"copy.deepcopy",
"chemprop.data.MoleculeDataLoader"
] | [((686, 866), 'chemprop.data.MoleculeDataLoader', 'MoleculeDataLoader', ([], {'dataset': 'train_data', 'batch_size': 'args.batch_size_dun', 'num_workers': 'num_workers', 'cache': 'cache', 'class_balance': 'args.class_balance', 'shuffle': '(True)', 'seed': 'args.seed'}), '(dataset=train_data, batch_size=args.batch_size_... |
import json
import os
import os.path
from abc import ABCMeta
from collections import OrderedDict
from typing import Any, Optional, Union
import numpy as np
import torch
from mmhuman3d.core.conventions.keypoints_mapping import (
convert_kps,
get_keypoint_num,
)
from mmhuman3d.core.evaluation.mpjpe import keypo... | [
"collections.OrderedDict",
"mmhuman3d.models.builder.build_body_model",
"mmhuman3d.data.data_structures.human_data.HumanData.fromfile",
"mmhuman3d.core.conventions.keypoints_mapping.get_keypoint_num",
"os.path.join",
"torch.Tensor",
"json.load",
"numpy.array",
"numpy.zeros",
"mmhuman3d.core.evalua... | [((2087, 2115), 'mmhuman3d.core.conventions.keypoints_mapping.get_keypoint_num', 'get_keypoint_num', (['convention'], {}), '(convention)\n', (2103, 2115), False, 'from mmhuman3d.core.conventions.keypoints_mapping import convert_kps, get_keypoint_num\n'), ((2512, 2567), 'os.path.join', 'os.path.join', (['self.data_prefi... |
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
class graph_ntu():
def __init__(self,
max_hop=1,
dilation=1):
self.max_hop = max_hop
self.dilation = dilation
self.lvls = 4 # 25 -> 11 -> 5 -> 1
self.As = []
... | [
"networkx.relabel_nodes",
"networkx.cycle_basis",
"networkx.Graph",
"numpy.array",
"networkx.convert_node_labels_to_integers"
] | [((1345, 1355), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1353, 1355), True, 'import networkx as nx\n'), ((1487, 1539), 'networkx.convert_node_labels_to_integers', 'nx.convert_node_labels_to_integers', (['G'], {'first_label': '(0)'}), '(G, first_label=0)\n', (1521, 1539), True, 'import networkx as nx\n'), ((3245... |
import os
import warnings
import sklearn.decomposition
import numpy as np
from .openl3_exceptions import OpenL3Error
with warnings.catch_warnings():
# Suppress TF and Keras warnings when importing
warnings.simplefilter("ignore")
import tensorflow as tf
import tensorflow.keras.backend as K
from tens... | [
"tensorflow.math.log",
"tensorflow.keras.backend.ndim",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.cast",
"tensorflow.keras.layers.Input",
"tensorflow.keras.backend.maximum",
"tensorflow.keras.layers.Permute",
"tensorflow.keras.backend.max",
"warnings.simplefilter",
"numpy.ceil",
... | [((123, 148), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {}), '()\n', (146, 148), False, 'import warnings\n'), ((206, 237), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (227, 237), False, 'import warnings\n'), ((1028, 1065), 'tensorflow.cast', 'tf.cast', (['(... |
# -*- coding: utf-8 -*-
import numpy as np
import scipy.interpolate
def signal_interpolate(x_values, y_values, x_new=None, method="quadratic"):
"""**Interpolate a signal**
Interpolate a signal using different methods.
Parameters
----------
x_values : Union[list, np.array, pd.Series]
The ... | [
"numpy.linspace"
] | [((3929, 3974), 'numpy.linspace', 'np.linspace', (['x_values[0]', 'x_values[-1]', 'x_new'], {}), '(x_values[0], x_values[-1], x_new)\n', (3940, 3974), True, 'import numpy as np\n')] |
import os
import numpy as np
import cv2
import copy
class ImageProcessing:
def __init__(self, shape):
self.images = []
self.labels = []
self.filenames = []
self.images_norm = []
self.labels_norm = []
self.shape = tuple([shape[0], shape[1]])
def loa... | [
"os.path.join",
"numpy.array",
"os.path.basename",
"cv2.cvtColor",
"copy.deepcopy",
"cv2.resize",
"os.walk"
] | [((383, 400), 'os.walk', 'os.walk', (['dir_name'], {}), '(dir_name)\n', (390, 400), False, 'import os\n'), ((931, 970), 'numpy.array', 'np.array', (['self.images'], {'dtype': 'np.float32'}), '(self.images, dtype=np.float32)\n', (939, 970), True, 'import numpy as np\n'), ((989, 1010), 'numpy.array', 'np.array', (['self.... |
#!/usr/bin/python
import os
import json
import numpy as np
import torch
import torch.nn as nn
from torch import optim
from torch.utils.data import DataLoader, Subset
from torch.utils.data.sampler import SubsetRandomSampler
import dysts
from dysts.utils import find_significant_frequencies
from dysts.flows import *
f... | [
"numpy.argsort",
"torch.nn.MSELoss",
"dysts.utils.find_significant_frequencies",
"numpy.array",
"sktime.utils.data_processing.from_nested_to_3d_numpy",
"numpy.genfromtxt",
"numpy.mean",
"resources.classification_models.Autoencoder",
"numpy.random.seed",
"numpy.logspace",
"resources.classificatio... | [((682, 699), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (696, 699), True, 'import numpy as np\n'), ((1103, 1166), 'numpy.genfromtxt', 'np.genfromtxt', (["(cwd + '/resources/ucr_ea_names.txt')"], {'dtype': '"""str"""'}), "(cwd + '/resources/ucr_ea_names.txt', dtype='str')\n", (1116, 1166), True, 'im... |
import pytest
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LinearRegression, Ridge, LogisticRegression
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklego.common import flatten
from sklego.meta import DecayEstimator
from tests.co... | [
"numpy.random.normal",
"pytest.approx",
"sklearn.tree.DecisionTreeRegressor",
"sklego.common.flatten",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.linear_model.Ridge",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.linear_model.LogisticRegression",
"sklego.meta.DecayEstimator",
"pytest.rai... | [((440, 499), 'sklego.common.flatten', 'flatten', (['[general_checks, nonmeta_checks, regressor_checks]'], {}), '([general_checks, nonmeta_checks, regressor_checks])\n', (447, 499), False, 'from sklego.common import flatten\n'), ((687, 747), 'sklego.common.flatten', 'flatten', (['[general_checks, nonmeta_checks, classi... |
#!/usr/bin/env python
"""
Created on Sun Dec 7 15:09:45 2014
Author: <NAME>
Email: <EMAIL>
"""
import numpy as np
from pycuda.compiler import SourceModule
from pycuda.driver import Context
from pycuda import gpuarray
from of.utils import ipshell
_kernel="""
__global__ void resampler(
double* pts,
double* img,
dou... | [
"pycuda.driver.Context.get_device",
"pycuda.compiler.SourceModule",
"numpy.int32"
] | [((2991, 3012), 'pycuda.compiler.SourceModule', 'SourceModule', (['_kernel'], {}), '(_kernel)\n', (3003, 3012), False, 'from pycuda.compiler import SourceModule\n'), ((2928, 2948), 'pycuda.driver.Context.get_device', 'Context.get_device', ([], {}), '()\n', (2946, 2948), False, 'from pycuda.driver import Context\n'), ((... |
from bluesky_live.run_builder import RunBuilder
import pytest
import numpy
from ..plot_builders import RasteredImages
from ..plot_specs import Axes, Figure
@pytest.fixture
def non_snaking_run():
# Test data
md = {"motors": ["y", "x"], "shape": [2, 2], "snaking": (False, False)}
with RunBuilder(md) as bui... | [
"bluesky_live.run_builder.RunBuilder",
"numpy.array_equal"
] | [((2763, 2808), 'numpy.array_equal', 'numpy.array_equal', (['actual_data', 'expected_data'], {}), '(actual_data, expected_data)\n', (2780, 2808), False, 'import numpy\n'), ((3127, 3172), 'numpy.array_equal', 'numpy.array_equal', (['actual_data', 'expected_data'], {}), '(actual_data, expected_data)\n', (3144, 3172), Fal... |
# -*- coding: utf-8 -*-
"""
The module contains functions to evaluate the optical depth,
to convert this to observed transmission and to convolve the
observed spectrum with the instrumental profile.
"""
__author__ = '<NAME>'
import numpy as np
from scipy.signal import fftconvolve, gaussian
from numba import jit
# =... | [
"numpy.sqrt",
"numpy.ones",
"numpy.float64",
"scipy.signal.fftconvolve",
"numpy.diff",
"numpy.exp",
"numpy.sum",
"numpy.concatenate",
"numpy.interp",
"numpy.logspace",
"numpy.zeros_like"
] | [((461, 476), 'numpy.exp', 'np.exp', (['(-x ** 2)'], {}), '(-x ** 2)\n', (467, 476), True, 'import numpy as np\n'), ((2497, 2507), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (2504, 2507), True, 'import numpy as np\n'), ((2520, 2549), 'numpy.concatenate', 'np.concatenate', (['[pad, P, pad]'], {}), '([pad, P, pad])\n... |
from collections import defaultdict
from tempfile import NamedTemporaryFile
import numpy as np
from celery import group
from celery.decorators import task
from network.tasks.analysis.utils import \
call_bigwig_average_over_bed, generate_intersection_df
from network import models
def get_locus_values(loci, locus... | [
"numpy.median",
"network.models.Annotation.objects.filter",
"network.models.Transcript.objects.get",
"network.tasks.analysis.utils.generate_intersection_df",
"network.tasks.analysis.utils.call_bigwig_average_over_bed",
"network.models.LocusGroup.objects.filter",
"network.models.Annotation.objects.get",
... | [((1827, 1845), 'collections.defaultdict', 'defaultdict', (['float'], {}), '(float)\n', (1838, 1845), False, 'from collections import defaultdict\n'), ((3586, 3632), 'network.models.Locus.objects.filter', 'models.Locus.objects.filter', ([], {'group': 'locus_group'}), '(group=locus_group)\n', (3613, 3632), False, 'from ... |
import os
import jieba
import numpy as np
import pandas as pd
import torch
from elmoformanylangs import Embedder
from gensim.models import Word2Vec
from sentence_transformers import SentenceTransformer
from transformers import AutoModel, AutoTokenizer
from bert_text_classification.predict import bert_classification_pr... | [
"bert_text_classification.predict.bert_classification_predict",
"pandas.read_csv",
"numpy.argsort",
"numpy.array",
"torch.sum",
"transformers.AutoTokenizer.from_pretrained",
"numpy.linalg.norm",
"numpy.mean",
"transformers.AutoModel.from_pretrained",
"gensim.models.Word2Vec.load",
"pandas.set_op... | [((573, 598), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (588, 598), False, 'import os\n'), ((605, 649), 'pandas.read_csv', 'pd.read_csv', (["(root_path + '/data/qa_data.csv')"], {}), "(root_path + '/data/qa_data.csv')\n", (616, 649), True, 'import pandas as pd\n'), ((820, 833), 'numpy.ze... |
import logging
logging.basicConfig(level=logging.DEBUG)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm
fgp = __import__('FaST-GP')
ds = __import__('data_simulation')
def get_coords(index):
coords = pd.DataFrame(index=index)
coords['x'] = index.str.split('x').st... | [
"numpy.log10",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"logging.info",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"numpy.logspace",
"matplotlib.pyplot.yscale",
"numpy.ceil",
"matplotli... | [((16, 56), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (35, 56), False, 'import logging\n'), ((253, 278), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'index'}), '(index=index)\n', (265, 278), True, 'import pandas as pd\n'), ((441, 489), 'pandas.read... |
import numpy as np
import torch
from affogato.affinities import compute_affinities
from torchvision.utils import make_grid
from inferno.extensions.criteria import SorensenDiceLoss
class ConcatDataset(torch.utils.data.Dataset):
def __init__(self, *datasets):
self.datasets = datasets
self.lens = [l... | [
"torch.utils.tensorboard.SummaryWriter",
"inferno.extensions.criteria.SorensenDiceLoss",
"numpy.prod",
"numpy.roll",
"numpy.where",
"numpy.isin",
"affogato.affinities.compute_affinities",
"numpy.random.randint",
"torch.utils.data.DataLoader",
"numpy.cumsum",
"torchvision.utils.make_grid"
] | [((3514, 3574), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['ds'], {'batch_size': '(1)', 'num_workers': '(2)'}), '(ds, batch_size=1, num_workers=2)\n', (3541, 3574), False, 'import torch\n'), ((3725, 3777), 'torch.utils.tensorboard.SummaryWriter', 'torch.utils.tensorboard.SummaryWriter', (['"""./run... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""The DpuCar is a module which contains the DpuCar class and the related common function
By xiaobo
Contact <EMAIL>
Created on June 7 22:10 2020
"""
# Copyright (C)
#
#
# GWpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Genera... | [
"PIL.Image.fromarray",
"dnndk.n2cube.dpuGetOutputTensorScale",
"cv2.imencode",
"dnndk.n2cube.dpuGetOutputTensorAddress",
"dnndk.n2cube.dpuGetOutputTensorChannel",
"numpy.argmax",
"io.BytesIO",
"IPython.display.clear_output",
"numpy.max",
"numpy.array",
"dnndk.n2cube.dpuRunTask",
"cv2.VideoCapt... | [((1261, 1280), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (1277, 1280), False, 'import cv2\n'), ((2147, 2240), 'cv2.resize', 'cv2.resize', (['img_input', '(self.dpuImgSize, self.dpuImgSize)'], {'interpolation': 'cv2.INTER_CUBIC'}), '(img_input, (self.dpuImgSize, self.dpuImgSize), interpolation=cv2... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pandas_datareader as data
# noinspection PyUnresolvedReferences
import silence_tensorflow.auto # for ignoring tensorflow info and warnings
from keras.models import load_model
from sklearn.preprocessing import MinMaxScaler
import streamli... | [
"streamlit.pyplot",
"keras.models.load_model",
"matplotlib.pyplot.ylabel",
"pandas_datareader.DataReader",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"matplotlib.pyplot.figure",
"streamlit.subheader",
"datetime.date.today",
"streamlit.text_input",
"sklearn.preprocessi... | [((466, 500), 'streamlit.title', 'st.title', (['"""Stock Trend Prediction"""'], {}), "('Stock Trend Prediction')\n", (474, 500), True, 'import streamlit as st\n'), ((528, 570), 'streamlit.text_input', 'st.text_input', (['"""Enter Stock Ticker"""', '"""SBI"""'], {}), "('Enter Stock Ticker', 'SBI')\n", (541, 570), True, ... |
#! /usr/bin/env python
"""compare float array files."""
import argparse
import os
import numpy as np
import glob
parser = argparse.ArgumentParser(description='compare .float binary files')
parser.add_argument('dir1', help='path to directory containing .float files')
parser.add_argument('dir2', help='path to another di... | [
"numpy.abs",
"numpy.fromfile",
"argparse.ArgumentParser",
"os.path.join",
"numpy.max",
"os.path.isfile",
"numpy.sum",
"os.path.basename",
"numpy.min",
"os.path.expanduser"
] | [((123, 189), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""compare .float binary files"""'}), "(description='compare .float binary files')\n", (146, 189), False, 'import argparse\n'), ((1699, 1728), 'numpy.abs', 'np.abs', (['(features1 - features2)'], {}), '(features1 - features2)\n', ... |
import pandas as pd
import numpy as np
import sys
import warnings
from slicer.interpretapi.explanation import AttributionExplanation
from slicer import Slicer
# slicer confuses pylint...
# pylint: disable=no-member
class Explanation(AttributionExplanation):
""" This is currently an experimental feature don't de... | [
"numpy.array",
"numpy.abs",
"slicer.Slicer"
] | [((1402, 1422), 'slicer.Slicer', 'Slicer', (['lower_bounds'], {}), '(lower_bounds)\n', (1408, 1422), False, 'from slicer import Slicer\n'), ((1517, 1537), 'slicer.Slicer', 'Slicer', (['upper_bounds'], {}), '(upper_bounds)\n', (1523, 1537), False, 'from slicer import Slicer\n'), ((1632, 1652), 'slicer.Slicer', 'Slicer',... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... | [
"unittest.skipIf",
"acme.wrappers.open_spiel_wrapper.OpenSpielWrapper",
"absl.testing.absltest.main",
"open_spiel.python.rl_environment.Environment",
"numpy.dtype"
] | [((1109, 1172), 'unittest.skipIf', 'unittest.skipIf', (['SKIP_OPEN_SPIEL_TESTS', 'SKIP_OPEN_SPIEL_MESSAGE'], {}), '(SKIP_OPEN_SPIEL_TESTS, SKIP_OPEN_SPIEL_MESSAGE)\n', (1124, 1172), False, 'import unittest\n'), ((2272, 2287), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (2285, 2287), False, 'from ab... |
import taichi as ti
from utils.tools import Pair
from pcg_method import PCG_Solver
import numpy as np
@ti.data_oriented
class Thin_Flame:
def __init__(self , resolution = 512 ) :
shape = (resolution , resolution)
self._sd_cur = ti.var(dt = ti.f32 , shape= shape)
self._sd_nxt = ti.var(dt = ... | [
"taichi.ndrange",
"numpy.random.rand",
"taichi.static_print",
"taichi.init",
"taichi.template",
"utils.tools.Pair",
"taichi.exp",
"taichi.abs",
"taichi.static",
"taichi.GUI",
"taichi.Vector",
"taichi.grouped",
"taichi.var"
] | [((9279, 9321), 'taichi.init', 'ti.init', ([], {'arch': 'ti.gpu', 'kernel_profiler': '(True)'}), '(arch=ti.gpu, kernel_profiler=True)\n', (9286, 9321), True, 'import taichi as ti\n'), ((9335, 9371), 'taichi.GUI', 'ti.GUI', (['"""Thin Flame"""'], {'res': 'resolution'}), "('Thin Flame', res=resolution)\n", (9341, 9371), ... |
from mal import Anime
from bs4 import BeautifulSoup
import numpy
import requests
def animerec():
p = numpy.random.randint(16000,size=1)
id = int(p[0])
# for i in range(id,16000):
try:
anime = Anime(id)
title = str(anime.title)
titlef = title.replace(' ','_')
titlef = ti... | [
"bs4.BeautifulSoup",
"requests.get",
"numpy.random.randint",
"mal.Anime"
] | [((107, 142), 'numpy.random.randint', 'numpy.random.randint', (['(16000)'], {'size': '(1)'}), '(16000, size=1)\n', (127, 142), False, 'import numpy\n'), ((218, 227), 'mal.Anime', 'Anime', (['id'], {}), '(id)\n', (223, 227), False, 'from mal import Anime\n'), ((442, 459), 'requests.get', 'requests.get', (['url'], {}), '... |
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this open-source project.
import os
import sys
import json
import random
import argparse
import essentia
import essentia.streaming
from essentia.standard import *
import librosa
import numpy as np
from extractor ... | [
"os.path.exists",
"os.listdir",
"aistplusplus_api.aist_plusplus.loader.AISTDataset.load_motion",
"argparse.ArgumentParser",
"essentia.standard.MonoLoader",
"os.path.join",
"torch.from_numpy",
"numpy.array",
"smplx.SMPL",
"aistplusplus_api.aist_plusplus.loader.AISTDataset",
"os.mkdir",
"numpy.c... | [((452, 477), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (475, 477), False, 'import argparse\n'), ((1313, 1331), 'extractor.FeatureExtractor', 'FeatureExtractor', ([], {}), '()\n', (1329, 1331), False, 'from extractor import FeatureExtractor\n'), ((1340, 1370), 'os.path.exists', 'os.path.ex... |
"""
This is a simple script showing how to connect and control a Wasatch Photonics
Raman spectrometer using Wasatch.PY.
In particular, it walks the user through a short process to optimize the working
distance by checking the height of a specific expected Raman peak (the 801.3cm⁻¹
peak of cyclohexane, in this case)... | [
"wasatch.WasatchDevice.WasatchDevice",
"numpy.asarray",
"time.sleep",
"sys.exit",
"wasatch.WasatchBus.WasatchBus",
"wasatch.RealUSBDevice.RealUSBDevice"
] | [((5483, 5494), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (5491, 5494), False, 'import sys\n'), ((1037, 1062), 'wasatch.WasatchBus.WasatchBus', 'WasatchBus', ([], {'use_sim': '(False)'}), '(use_sim=False)\n', (1047, 1062), False, 'from wasatch.WasatchBus import WasatchBus\n'), ((1291, 1315), 'wasatch.RealUSBDevic... |
"""
Core implementation of :mod:`facet.simulation.partition`
"""
import logging
import math
import operator as op
from abc import ABCMeta, abstractmethod
from typing import Any, Generic, Iterable, Optional, Sequence, Tuple, TypeVar
import numpy as np
import pandas as pd
from pytools.api import AllTracker, inheritdoc... | [
"logging.getLogger",
"pandas.Series",
"numpy.log10",
"math.ceil",
"math.floor",
"numpy.digitize",
"operator.sub",
"numpy.array",
"numpy.nanquantile",
"pytools.api.inheritdoc",
"math.log10",
"numpy.bincount",
"numpy.arange",
"typing.TypeVar"
] | [((366, 393), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (383, 393), False, 'import logging\n'), ((578, 595), 'typing.TypeVar', 'TypeVar', (['"""T_Self"""'], {}), "('T_Self')\n", (585, 595), False, 'from typing import Any, Generic, Iterable, Optional, Sequence, Tuple, TypeVar\n'), ((6... |
from numpy import sign
def comp_rot_dir(self):
"""Compute the rotation direction of the fundamental magnetic field induced by the winding
WARNING: rot_dir = -1 to have positive rotor rotating direction, i.e. rotor position moves towards positive angle
Parameters
----------
self : LamSlotMultiWind... | [
"numpy.sign"
] | [((1210, 1221), 'numpy.sign', 'sign', (['(f / r)'], {}), '(f / r)\n', (1214, 1221), False, 'from numpy import sign\n')] |
import numpy as np
import pytest
import random
import torch
import densetorch as dt
NUMBER_OF_PARAMETERS_WITH_21_CLASSES = {
"152": 61993301,
"101": 46349653,
"50": 27357525,
"mbv2": 3284565,
}
NUMBER_OF_ENCODER_DECODER_LAYERS = {
"152": (465, 28),
"101": (312, 28),
"50": (159, 28),
... | [
"numpy.ceil",
"torch.FloatTensor",
"pytest.mark.parametrize",
"torch.cuda.is_available",
"pytest.fixture",
"torch.no_grad",
"random.randint"
] | [((632, 648), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (646, 648), False, 'import pytest\n'), ((704, 720), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (718, 720), False, 'import pytest\n'), ((777, 793), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (791, 793), False, 'import pytest\n'), (... |
from __future__ import print_function
import numpy as np
import tensorflow as tf
try:
import pystan
from collections import OrderedDict
except ImportError:
pass
class PythonModel:
"""
Model wrapper for models written in NumPy/SciPy.
"""
def __init__(self):
self.num_vars = None
... | [
"collections.OrderedDict",
"numpy.sum",
"numpy.zeros",
"pystan.stan",
"tensorflow.py_func"
] | [((2680, 2719), 'numpy.zeros', 'np.zeros', (['zs.shape[0]'], {'dtype': 'np.float32'}), '(zs.shape[0], dtype=np.float32)\n', (2688, 2719), True, 'import numpy as np\n'), ((364, 417), 'tensorflow.py_func', 'tf.py_func', (['self._py_log_prob', '[xs, zs]', '[tf.float32]'], {}), '(self._py_log_prob, [xs, zs], [tf.float32])\... |
"""surface.py: Surface element and geometry"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import properties
from .base import ProjectElement
from .data import Int3Array, ScalarArray, Vector3Arr... | [
"properties.Instance",
"properties.Vector3",
"properties.StringChoice",
"numpy.max",
"numpy.min",
"properties.Array",
"properties.ValidationError"
] | [((479, 570), 'properties.StringChoice', 'properties.StringChoice', (['"""Category of Surface"""'], {'choices': "('surface',)", 'default': '"""surface"""'}), "('Category of Surface', choices=('surface',),\n default='surface')\n", (502, 570), False, 'import properties\n'), ((1268, 1368), 'properties.Instance', 'prope... |
import numpy as np
from pyecsca.sca import (
align_correlation,
align_peaks,
align_sad,
align_dtw_scale,
align_dtw,
Trace,
InspectorTraceSet,
)
from .utils import Plottable, slow
class AlignTests(Plottable):
def test_align(self):
first_arr = np.array(
[10, 64, 120, ... | [
"pyecsca.sca.Trace",
"numpy.dtype",
"numpy.testing.assert_equal",
"pyecsca.sca.align_dtw",
"pyecsca.sca.InspectorTraceSet.read",
"numpy.argmax",
"pyecsca.sca.align_sad",
"pyecsca.sca.align_correlation",
"pyecsca.sca.align_dtw_scale",
"pyecsca.sca.align_peaks"
] | [((562, 578), 'pyecsca.sca.Trace', 'Trace', (['first_arr'], {}), '(first_arr)\n', (567, 578), False, 'from pyecsca.sca import align_correlation, align_peaks, align_sad, align_dtw_scale, align_dtw, Trace, InspectorTraceSet\n'), ((591, 608), 'pyecsca.sca.Trace', 'Trace', (['second_arr'], {}), '(second_arr)\n', (596, 608)... |
from matplotlib.testing import setup
import numpy as np
import numpy.testing as npt
import matplotlib.pyplot as plt
import matplotlib as mpl
import packaging.version
import pytest
import animatplot as amp
from tests.tools import animation_compare
from animatplot.blocks import Block, Title
setup()
class TestTitleB... | [
"numpy.testing.assert_equal",
"animatplot.blocks.Line",
"numpy.array",
"tests.tools.animation_compare",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.close",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.pyplot.gca",
"pytest.raises",
"animatplot.blocks.Pcolormesh",
"animatplot.blocks.Qui... | [((294, 301), 'matplotlib.testing.setup', 'setup', ([], {}), '()\n', (299, 301), False, 'from matplotlib.testing import setup\n'), ((6974, 7033), 'tests.tools.animation_compare', 'animation_compare', ([], {'baseline_images': '"""Blocks/Line"""', 'nframes': '(5)'}), "(baseline_images='Blocks/Line', nframes=5)\n", (6991,... |
# This file is part of the Open Data Cube, see https://opendatacube.org for more information
#
# Copyright (c) 2015-2020 ODC Contributors
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from affine import Affine
from odc.geo import CRS, geom
from odc.geo.geobox import (
GeoBox,
bounding... | [
"odc.geo.geobox.geobox_intersection_conservative",
"odc.geo.CRS",
"odc.geo.geobox.GeoBox.from_geopolygon",
"affine.Affine",
"numpy.testing.assert_array_almost_equal",
"numpy.asarray",
"numpy.testing.assert_almost_equal",
"odc.geo.testutils.xy_norm",
"affine.Affine.translation",
"odc.geo.geobox.gbo... | [((774, 911), 'numpy.asarray', 'np.asarray', (['[151.000125, 151.000375, 151.000625, 151.000875, 151.001125, 151.001375, \n 151.001625, 151.001875, 151.002125, 151.002375]'], {}), '([151.000125, 151.000375, 151.000625, 151.000875, 151.001125, \n 151.001375, 151.001625, 151.001875, 151.002125, 151.002375])\n', (78... |
import cv2
import os
import os.path as osp
import sys
from multiprocessing import Pool
import numpy as np
import glob
try:
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from utils.util import ProgressBar
except ImportError:
pass
def main():
train_or_test = 'train'
qp = 37
... | [
"os.path.exists",
"os.makedirs",
"numpy.arange",
"os.walk",
"os.path.join",
"numpy.ascontiguousarray",
"numpy.append",
"multiprocessing.Pool",
"os.path.basename",
"os.path.abspath",
"cv2.imread",
"glob.glob"
] | [((3688, 3710), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (3704, 3710), False, 'import os\n'), ((3721, 3737), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (3731, 3737), False, 'import cv2\n'), ((3969, 4004), 'numpy.arange', 'np.arange', (['(0)', '(h - crop_sz + 1)', 'step'], {}), '(... |
import numpy
n=int(input())
a=numpy.array([input().split() for i in range(n)],int)
b=numpy.array([input().split() for i in range(n)],int)
x=numpy.array([],int)
for i in range(n):
for j in range(n):
x=numpy.append(x,numpy.dot(a[i,:],b[:,j]))
x=numpy.reshape(x,(n,n))
print(x) | [
"numpy.array",
"numpy.dot",
"numpy.reshape"
] | [((144, 164), 'numpy.array', 'numpy.array', (['[]', 'int'], {}), '([], int)\n', (155, 164), False, 'import numpy\n'), ((263, 287), 'numpy.reshape', 'numpy.reshape', (['x', '(n, n)'], {}), '(x, (n, n))\n', (276, 287), False, 'import numpy\n'), ((234, 261), 'numpy.dot', 'numpy.dot', (['a[i, :]', 'b[:, j]'], {}), '(a[i, :... |
'''
<NAME> - ERL VIBOT CNRS 6000 - 2019
This code is the python conversion of Ning Li's release matlab code
Please refer below for references
% The code can only be used for research purpose.
% Please cite the following paper when you use it:
% <NAME>, <NAME>, <NAME>, and <NAME>,
% "Demosaicking DoFP images... | [
"numpy.zeros",
"numpy.double"
] | [((1161, 1173), 'numpy.double', 'np.double', (['I'], {}), '(I)\n', (1170, 1173), True, 'import numpy as np\n'), ((1204, 1223), 'numpy.zeros', 'np.zeros', (['(m, n, 4)'], {}), '((m, n, 4))\n', (1212, 1223), True, 'import numpy as np\n'), ((1280, 1307), 'numpy.zeros', 'np.zeros', (['(m, n)'], {'dtype': 'int'}), '((m, n),... |
# -*- coding: utf-8 -*-
"""
se2cnn/layers.py
Implementation of tensorflow layers for operations in SE2N.
Details in MICCAI 2018 paper: "Roto-Translation Covariant Convolutional Networks for Medical Image Analysis".
Released in June 2018
@author: <NAME>, Eindhoven University of Technology, The Netherlands
@author: <NA... | [
"tensorflow.nn.conv2d",
"numpy.identity",
"tensorflow.nn.max_pool",
"tensorflow.shape",
"tensorflow.transpose",
"tensorflow.SparseTensor",
"tensorflow.sparse_tensor_dense_matmul",
"tensorflow.matmul",
"tensorflow.reshape",
"tensorflow.expand_dims",
"tensorflow.stack"
] | [((2953, 2996), 'tensorflow.transpose', 'tf.transpose', (['kernel_stack', '[1, 2, 3, 0, 4]'], {}), '(kernel_stack, [1, 2, 3, 0, 4])\n', (2965, 2996), True, 'import tensorflow as tf\n'), ((3099, 3203), 'tensorflow.reshape', 'tf.reshape', (['kernels_as_if_2D', '[kernelSizeH, kernelSizeW, channelsIN, orientations_nb * cha... |
#!python3
"""
An implementation of a PROPm allocation algorithm. Reference:
<NAME>, <NAME>, <NAME>, and <NAME> (2021).
["PROPm Allocations of Indivisible Goods to Multiple Agents"](https://arxiv.org/abs/2105.11348).
Programmer: <NAME>
Since: 2021-05
"""
import networkx as nx
import numpy as np
from fairpy ... | [
"logging.getLogger",
"numpy.allclose",
"logging.StreamHandler",
"fairpy.convert_input_to_valuation_matrix",
"networkx.get_edge_attributes",
"networkx.DiGraph",
"doctest.testmod",
"networkx.get_node_attributes",
"fairpy.ValuationMatrix",
"networkx.set_node_attributes",
"networkx.dfs_edges"
] | [((465, 492), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (482, 492), False, 'import logging\n'), ((9817, 9840), 'fairpy.ValuationMatrix', 'ValuationMatrix', (['agents'], {}), '(agents)\n', (9832, 9840), False, 'from fairpy import ValuationMatrix, Allocation, convert_input_to_valuation... |
"""
This script follows closely the Mathematica script from Sandri, 1996 (see
Sandri_1996_script/ for more details) and tries to reproduce the results
therein.
"""
import matplotlib.pyplot as plt
import mpl_extras as me
import tpsim as tp
import numpy as np
sigma = 16
beta = 4
rho = 45.92
def F(t, state):
"""... | [
"numpy.identity",
"numpy.isclose",
"mpl_extras.setup_mpl",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.linalg.norm",
"tpsim.gram_schmidt",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((1440, 1462), 'numpy.array', 'np.array', (['[19, 20, 50]'], {}), '([19, 20, 50])\n', (1448, 1462), True, 'import numpy as np\n'), ((1470, 1484), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (1481, 1484), True, 'import numpy as np\n'), ((2362, 2396), 'numpy.isclose', 'np.isclose', (['LCE', '(1.45026)'], {'... |
import numpy as np
import os, datetime, time
import plot_settings
from joblib import Parallel, delayed
import matplotlib.pyplot as plt
from test_utilities import process_fig2p6
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "..",))
from frius import total_freq_response, distance2time
"""
Increas... | [
"numpy.argsort",
"frius.distance2time",
"numpy.array",
"numpy.arange",
"numpy.mean",
"matplotlib.pyplot.savefig",
"os.path.dirname",
"numpy.std",
"time.time",
"matplotlib.pyplot.show",
"numpy.insert",
"os.makedirs",
"numpy.fft.fftfreq",
"os.path.join",
"joblib.Parallel",
"datetime.date... | [((827, 881), 'numpy.arange', 'np.arange', ([], {'start': 'max_n_diracs', 'stop': '(1)', 'step': '(-step_size)'}), '(start=max_n_diracs, stop=1, step=-step_size)\n', (836, 881), True, 'import numpy as np\n'), ((902, 951), 'numpy.insert', 'np.insert', (['n_diracs_vals', '(0)', '[500, 400, 300, 200]'], {}), '(n_diracs_va... |
r"""
.. _sec-normal:
Gaussian process change
====================================================================================================
Description
----------------------------------------------------------------------------------------------------
This cost function detects changes in the mean and scale o... | [
"numpy.linalg.slogdet",
"numpy.cov"
] | [((3339, 3351), 'numpy.linalg.slogdet', 'slogdet', (['cov'], {}), '(cov)\n', (3346, 3351), False, 'from numpy.linalg import slogdet\n'), ((3252, 3265), 'numpy.cov', 'np.cov', (['sub.T'], {}), '(sub.T)\n', (3258, 3265), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# coding=UTF-8
# BSD 2-Clause License
# Copyright (c) 2021, <NAME> (Beigesoft™)
# All rights reserved.
# See the LICENSE in the root source folder
#transfer NIST data to LIBSVM formatted train (900 samples) and test (the rest 100) files
#NIST data from http://www.cis.jhu.edu/~sachin/digit/digit.... | [
"os.path.abspath",
"sys.exc_info",
"numpy.fromfile"
] | [((1175, 1208), 'numpy.fromfile', 'np.fromfile', (['fnme'], {'dtype': 'np.uint8'}), '(fnme, dtype=np.uint8)\n', (1186, 1208), True, 'import numpy as np\n'), ((478, 503), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (493, 503), False, 'import sys, os\n'), ((2367, 2381), 'sys.exc_info', 'sys.... |
# Created by <NAME>, 30/08/2018
import os
from os import path
import numpy as np
import gym
from gym import GoalEnv
from gym import error, spaces
from gym.utils import seeding
import mujoco_py
from mujoco_py import load_model_from_path,... | [
"numpy.clip",
"numpy.prod",
"numpy.equal",
"numpy.array",
"copy.deepcopy",
"numpy.linalg.norm",
"mujoco_py.MjViewer",
"gym.utils.seeding.np_random",
"mujoco_py.MjSim",
"os.path.exists",
"mujoco_py.MjSimState",
"mujoco_py.load_model_from_path",
"numpy.where",
"numpy.asarray",
"cv2.warpAff... | [((1139, 1169), 'mujoco_py.load_model_from_path', 'load_model_from_path', (['fullpath'], {}), '(fullpath)\n', (1159, 1169), False, 'from mujoco_py import load_model_from_path, MjSim, MjViewer\n'), ((1189, 1228), 'mujoco_py.MjSim', 'MjSim', (['self.model'], {'nsubsteps': 'n_substeps'}), '(self.model, nsubsteps=n_substep... |
'''A wrapper class for optimizer '''
import numpy as np
class ScheduledOptim(object):
'''A simple wrapper class for learning rate scheduling'''
def __init__(self, optimizer, d_model, n_warmup_steps):
self.optimizer = optimizer
self.d_model = d_model
self.n_warmup_steps = n_war... | [
"numpy.power"
] | [((723, 751), 'numpy.power', 'np.power', (['self.d_model', '(-0.5)'], {}), '(self.d_model, -0.5)\n', (731, 751), True, 'import numpy as np\n'), ((776, 812), 'numpy.power', 'np.power', (['self.n_current_steps', '(-0.5)'], {}), '(self.n_current_steps, -0.5)\n', (784, 812), True, 'import numpy as np\n'), ((827, 862), 'num... |
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import os
import sys
import pickle
from typing import List
import numpy as np
from jina.executors.devices import TorchDevice
from jina.excepts import PretrainedModelFileDoesNotExist
from jina.executors.decorators im... | [
"os.path.exists",
"pickle.load",
"numpy.stack",
"numpy.moveaxis",
"jina.excepts.PretrainedModelFileDoesNotExist",
"img_text_composition_models.TIRG",
"sys.path.append",
"torch.device"
] | [((428, 448), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (443, 448), False, 'import sys\n'), ((1288, 1319), 'os.path.exists', 'os.path.exists', (['self.model_path'], {}), '(self.model_path)\n', (1302, 1319), False, 'import os\n'), ((1438, 1454), 'img_text_composition_models.TIRG', 'TIRG', (['te... |
import sys
sys.path.append('./')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import multiprocessing as multi
import optuna
import changefinder
import bocpd
import dmdl.sdmdl as sdmdl
import dmdl.hsdmdl2 as hsdmdl2
import tsmdl.aw2s_mdl as aw2s_mdl
import utils.sdmdl_nml as sdmdl_nml
import ut... | [
"bocpd.Retrospective",
"dmdl.hsdmdl2.Retrospective",
"numpy.mean",
"utils.utils.create_dataset",
"changefinder.Retrospective",
"tsmdl.aw2s_mdl.Retrospective",
"numpy.std",
"multiprocessing.cpu_count",
"utils.utils.calc_F1_score",
"functools.partial",
"bocpd.StudentT",
"numpy.random.seed",
"c... | [((11, 32), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (26, 32), False, 'import sys\n'), ((671, 694), 'copy.deepcopy', 'deepcopy', (['retrospective'], {}), '(retrospective)\n', (679, 694), False, 'from copy import deepcopy\n'), ((788, 851), 'utils.utils.calc_F1_score', 'calc_F1_score', (['sco... |
import math
import numpy as np
from rclpy.qos import QoSDurabilityPolicy
from rclpy.qos import QoSHistoryPolicy
from rclpy.qos import QoSProfile
from rclpy.qos import QoSReliabilityPolicy
import rclpy
from rclpy.node import Node
from geometry_msgs.msg import Twist, Vector3
from turtlesim.msg import Pose
from rclpy.para... | [
"geometry_msgs.msg.Vector3",
"math.cos",
"numpy.array",
"numpy.sin",
"math.hypot",
"rclpy.init",
"numpy.arange",
"numpy.vstack",
"numpy.min",
"numpy.hypot",
"rclpy.shutdown",
"geometry_msgs.msg.Twist",
"math.atan2",
"numpy.cos",
"numpy.transpose",
"rclpy.qos.QoSProfile",
"rclpy.spin"... | [((9300, 9321), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (9310, 9321), False, 'import rclpy\n'), ((1238, 1263), 'numpy.array', 'np.array', (['[0, 0, 0, 0, 0]'], {}), '([0, 0, 0, 0, 0])\n', (1246, 1263), True, 'import numpy as np\n'), ((1351, 1367), 'numpy.array', 'np.array', (['[0, 0]'], {})... |
# digitizer class for zurich instrument's hf2li lockin
from small_lab_gui.digitizers.digitizer import digitizer
import numpy as np
import time
from threading import Event
class hf2li_dummy(digitizer):
def __init__(self, dev='dev1251'):
self.num_sensors = 6
self.dev = dev
def setup(self, inte... | [
"threading.Event",
"numpy.random.rand",
"time.sleep"
] | [((539, 567), 'time.sleep', 'time.sleep', (['self.integration'], {}), '(self.integration)\n', (549, 567), False, 'import time\n'), ((942, 949), 'threading.Event', 'Event', ([], {}), '()\n', (947, 949), False, 'from threading import Event\n'), ((1015, 1043), 'time.sleep', 'time.sleep', (['self.integration'], {}), '(self... |
import numpy as np
# Constants
a = 0.4
b = 2.0
c = 2.0
class Particle:
def __init__(self, lower_bound, upper_bound):
# Assign local variables
self.lower_bound = lower_bound
self.upper_bound = upper_bound
# Initialize the particle's position with a uniformly distributed random vec... | [
"numpy.fabs",
"numpy.array",
"numpy.cos",
"numpy.random.uniform"
] | [((348, 394), 'numpy.random.uniform', 'np.random.uniform', (['lower_bound', 'upper_bound', '(2)'], {}), '(lower_bound, upper_bound, 2)\n', (365, 394), True, 'import numpy as np\n'), ((570, 586), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (578, 586), True, 'import numpy as np\n'), ((1726, 1770), 'numpy.f... |
#! /usr/bin/env python3
import numpy as np
import sys
import math
sys.stdout.write('.')
def loadDataFromFile(filename):
global prefix
try:
data = np.loadtxt(filename, skiprows=0)
except:
prefix = filename if len(sys.argv) <= 3 else sys.argv[3]
print(prefix+": UNABLE TO OPEN '"+filename+"'")
sys.exit(1)
... | [
"numpy.loadtxt",
"math.sqrt",
"sys.exit",
"sys.stdout.write"
] | [((68, 89), 'sys.stdout.write', 'sys.stdout.write', (['"""."""'], {}), "('.')\n", (84, 89), False, 'import sys\n'), ((1632, 1684), 'math.sqrt', 'math.sqrt', (['(norm_l2_value / (size_cmp_i * size_cmp_j))'], {}), '(norm_l2_value / (size_cmp_i * size_cmp_j))\n', (1641, 1684), False, 'import math\n'), ((1105, 1116), 'sys.... |
import numpy as np
class ReplayBuffer:
"""Experience Replay Buffer para DQNs."""
def __init__(self, max_length, observation_space):
"""Cria um Replay Buffer.
Parâmetros
----------
max_length: int
Tamanho máximo do Replay Buffer.
observation_space: int
... | [
"numpy.zeros",
"numpy.random.randint"
] | [((460, 519), 'numpy.zeros', 'np.zeros', (['(max_length, observation_space)'], {'dtype': 'np.float32'}), '((max_length, observation_space), dtype=np.float32)\n', (468, 519), True, 'import numpy as np\n'), ((543, 579), 'numpy.zeros', 'np.zeros', (['max_length'], {'dtype': 'np.int32'}), '(max_length, dtype=np.int32)\n', ... |
import gym
from gym.spaces import Box, Discrete
from gym.utils import seeding
import numpy as np
from .world import World
from .agents import Car, Building, Pedestrian, Painting
from .geometry import Point
import time
class Scenario5(gym.Env):
def __init__(self):
self.seed(0) # just in case we forget seeding
... | [
"numpy.clip",
"numpy.abs",
"numpy.tan",
"gym.spaces.Box",
"numpy.array",
"numpy.mod",
"gym.utils.seeding.np_random"
] | [((1651, 1845), 'numpy.array', 'np.array', (['[0, self.ego.min_speed, self.init_adv.x - self.noise_adv_pos / 2.0, 0 - \n self.ego.max_speed * self.dt - self.noise_adv_pos / 2.0, self.adv.\n min_speed - self.noise_adv_vel / 2.0]'], {}), '([0, self.ego.min_speed, self.init_adv.x - self.noise_adv_pos / 2.0,\n 0 -... |
'''
beeBrain - An Artificial Intelligence & Machine Learning library
by Dev. <NAME> (www.devhima.tk)
'''
''''
MIT License
Copyright (c) 2019 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwar... | [
"numpy.empty_like"
] | [((1456, 1472), 'numpy.empty_like', 'np.empty_like', (['v'], {}), '(v)\n', (1469, 1472), True, 'import numpy as np\n')] |
import argparse
import numpy as np
import pandas as pd
import os
import sys
import time
from lightgbm import LGBMClassifier
from sklearn.preprocessing import LabelEncoder
import cleanlab
from cleanlab.pruning import get_noise_indices
model = 'clean_embed_all-mpnet-base-v2.csv'
df = pd.read_csv('/global/project/hpcg16... | [
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"lightgbm.LGBMClassifier",
"numpy.argmax",
"sklearn.model_selection.StratifiedKFold",
"numpy.around",
"pandas.DataFrame",
"cleanlab.pruning.get_noise_indices"
] | [((377, 401), 'pandas.read_csv', 'pd.read_csv', (['"""clean.csv"""'], {}), "('clean.csv')\n", (388, 401), True, 'import pandas as pd\n'), ((654, 668), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (666, 668), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((722, 764), 'sklearn.mod... |
"""
Original code from <NAME> for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by <NAME> and <NAME>
Adapted for CS294-112 Fall 2018 by <NAME>, <NAME>, and <NAME>
"""
import inspect
import os
import time
from itertools import count
import gym
import numpy as np
import torch
from torch ... | [
"logz.save_params",
"torch.distributions.Categorical",
"inspect.getfullargspec",
"time.sleep",
"torch.from_numpy",
"torch.nn.MSELoss",
"numpy.array",
"torch.cuda.is_available",
"logz.configure_output_dir",
"logz.save_agent",
"gym.make",
"logz.dump_tabular",
"os.path.exists",
"numpy.mean",
... | [((1910, 1943), 'logz.configure_output_dir', 'logz.configure_output_dir', (['logdir'], {}), '(logdir)\n', (1935, 1943), False, 'import logz\n'), ((2098, 2122), 'logz.save_params', 'logz.save_params', (['params'], {}), '(params)\n', (2114, 2122), False, 'import logz\n'), ((2829, 2848), 'logz.dump_tabular', 'logz.dump_ta... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define the rhythmic dynamic movement primitive.
"""
import numpy as np
from pyrobolearn.models.dmp.canonical_systems import RhythmicCS
from pyrobolearn.models.dmp.forcing_terms import RhythmicForcingTerm
from pyrobolearn.models.dmp.dmp import DMP
__author__ = "<NAME>"... | [
"numpy.ones",
"pyrobolearn.models.dmp.canonical_systems.RhythmicCS",
"pyrobolearn.models.dmp.forcing_terms.RhythmicForcingTerm",
"numpy.zeros",
"numpy.isnan"
] | [((2848, 2865), 'pyrobolearn.models.dmp.canonical_systems.RhythmicCS', 'RhythmicCS', ([], {'dt': 'dt'}), '(dt=dt)\n', (2858, 2865), False, 'from pyrobolearn.models.dmp.canonical_systems import RhythmicCS\n'), ((4036, 4058), 'numpy.ones', 'np.ones', (['self.num_dmps'], {}), '(self.num_dmps)\n', (4043, 4058), True, 'impo... |
from __future__ import print_function
import torch
import torch.utils.data
import numpy as np
import torchvision.utils as vutils
def gen_error_colormap():
cols = np.array(
[[0 / 3.0, 0.1875 / 3.0, 49, 54, 149],
[0.1875 / 3.0, 0.375 / 3.0, 69, 117, 180],
[0.375 / 3.0, 0.75 / ... | [
"numpy.abs",
"numpy.minimum",
"numpy.logical_and",
"numpy.logical_not",
"torch.from_numpy",
"numpy.array",
"numpy.zeros",
"torchvision.utils.make_grid"
] | [((178, 603), 'numpy.array', 'np.array', (['[[0 / 3.0, 0.1875 / 3.0, 49, 54, 149], [0.1875 / 3.0, 0.375 / 3.0, 69, 117,\n 180], [0.375 / 3.0, 0.75 / 3.0, 116, 173, 209], [0.75 / 3.0, 1.5 / 3.0,\n 171, 217, 233], [1.5 / 3.0, 3 / 3.0, 224, 243, 248], [3 / 3.0, 6 / 3.0,\n 254, 224, 144], [6 / 3.0, 12 / 3.0, 253, ... |
# coding=utf-8
# Copyright (c) DIRECT Contributors
import numpy as np
import pytest
import torch
from direct.data.transforms import fft2, ifft2
from direct.nn.unet.unet_2d import NormUnetModel2d, Unet2d
def create_input(shape):
data = np.random.randn(*shape).copy()
data = torch.from_numpy(data).float()
... | [
"pytest.mark.parametrize",
"direct.nn.unet.unet_2d.Unet2d",
"numpy.random.randn",
"torch.from_numpy"
] | [((337, 439), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shape"""', '[[2, 3, 16, 16], [4, 5, 16, 32], [3, 4, 32, 32], [3, 4, 40, 20]]'], {}), "('shape', [[2, 3, 16, 16], [4, 5, 16, 32], [3, 4, 32,\n 32], [3, 4, 40, 20]])\n", (360, 439), False, 'import pytest\n'), ((487, 536), 'pytest.mark.parametriz... |
import matplotlib.pyplot as plt
import numpy as np
import math
from matplotlib import rc
from matplotlib import rcParams
__author__ = 'ernesto'
# if use latex or mathtext
rc('text', usetex=True)
rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}"]
# Parámetros
# número de muestras
N = 100
# número de paráme... | [
"numpy.eye",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.plot",
"math.cos",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.rc",
"numpy.cos",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"math.sin",
"matplotlib.pyplot.subplot2grid",
"numpy.aran... | [((174, 197), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (176, 197), False, 'from matplotlib import rc\n'), ((396, 410), 'numpy.zeros', 'np.zeros', (['(p,)'], {}), '((p,))\n', (404, 410), True, 'import numpy as np\n'), ((612, 624), 'numpy.arange', 'np.arange', (['N'], {}),... |
import src.sfamanopt.mssfa as mssfa
import src.sfamanopt.ssfa as ssfa
import src.sfamanopt.fault_diagnosis as fd
import numpy as np
import matplotlib.pyplot as plt
import tepimport
if __name__ == "__main__":
alpha = 0.01
Md = 55
lagged_samples = 2
# Algorithm names for labels
"""Import Data"""
... | [
"src.sfamanopt.mssfa.MSSFA",
"numpy.mean",
"tepimport.add_lagged_samples",
"numpy.linalg.pinv",
"matplotlib.pyplot.savefig",
"numpy.delete",
"tepimport.import_sets",
"matplotlib.pyplot.close",
"numpy.zeros",
"numpy.std",
"src.sfamanopt.fault_diagnosis.calculate_crit_values",
"src.sfamanopt.ssf... | [((477, 513), 'numpy.delete', 'np.delete', (['X[1]', 'ignored_var'], {'axis': '(0)'}), '(X[1], ignored_var, axis=0)\n', (486, 513), True, 'import numpy as np\n'), ((522, 558), 'numpy.delete', 'np.delete', (['T[1]', 'ignored_var'], {'axis': '(0)'}), '(T[1], ignored_var, axis=0)\n', (531, 558), True, 'import numpy as np\... |
import logging
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import style
from mpl_finance import candlestick_ohlc
from stock_analyzer.analyzer_base import AnalyzerBase
logging.basicConfig(format='%(level_name)s: %(message)s', level=logging.DEBUG)
style.use('gg... | [
"logging.basicConfig",
"matplotlib.pyplot.subplots_adjust",
"stock_analyzer.analyzer_base.AnalyzerBase.ordinary_least_square_model",
"matplotlib.pyplot.grid",
"mpl_finance.candlestick_ohlc",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
... | [((227, 305), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(level_name)s: %(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(level_name)s: %(message)s', level=logging.DEBUG)\n", (246, 305), False, 'import logging\n'), ((307, 326), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), ... |
import numpy as np
from numpy import sqrt
from numpy.random import rand, randn
import matplotlib.pyplot as plt
import channel
import Coding
import BPSK, QPSK, BFSK, QFSK, MPSK
if __name__ == "__main__":
N = 1e3
EbNodB_range = range(0,50)
ber = []
for n in range(len(EbNodB_range)):
EbNodB... | [
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"Coding.encodebits",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"BPSK.modulate",
"channel.generate_noise",
"BPSK.demodulate",
"BPSK.error_probabilities",
"Coding.decodebits",
"matplo... | [((847, 908), 'matplotlib.pyplot.plot', 'plt.plot', (['EbNodB_range', 'ber', '"""o-"""'], {'label': '"""BPSK Practical BER"""'}), "(EbNodB_range, ber, 'o-', label='BPSK Practical BER')\n", (855, 908), True, 'import matplotlib.pyplot as plt\n'), ((913, 933), 'matplotlib.pyplot.xscale', 'plt.xscale', (['"""linear"""'], {... |
from heapq import heappop, heappush
import time
from scipy import ndimage as ndi
import numpy as np
import napari
from skimage import filters, morphology, feature
from skimage.morphology._util import _offsets_to_raveled_neighbors, _validate_connectivity
SLEEP_PER_PIX = 0
# ---------
# Watershed
# ---------
def wate... | [
"numpy.sqrt",
"time.sleep",
"numpy.array",
"heapq.heappush",
"napari.view_labels",
"scipy.ndimage.label",
"numpy.max",
"numpy.stack",
"heapq.heappop",
"scipy.ndimage.distance_transform_edt",
"numpy.ones",
"skimage.morphology._util._validate_connectivity",
"numpy.indices",
"skimage.morpholo... | [((1747, 1787), 'skimage.morphology._util._validate_connectivity', '_validate_connectivity', (['im_ndim', '(1)', 'None'], {}), '(im_ndim, 1, None)\n', (1769, 1787), False, 'from skimage.morphology._util import _offsets_to_raveled_neighbors, _validate_connectivity\n'), ((2074, 2162), 'numpy.apply_along_axis', 'np.apply_... |
#!/usr/bin/env python
from __future__ import absolute_import
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('sharpclaw', parent_package, top_path)
config.add_extension('sharpclaw1',
['ClawParams.f90','... | [
"numpy.distutils.misc_util.Configuration"
] | [((183, 235), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""sharpclaw"""', 'parent_package', 'top_path'], {}), "('sharpclaw', parent_package, top_path)\n", (196, 235), False, 'from numpy.distutils.misc_util import Configuration\n')] |
"""
Random Correlation matrix (LKJ 2009) output checking
Created on Wed Aug 2 09:09:02 2017
@author: junpenglao
"""
import numpy as np
from scipy import stats
def is_pos_def(A):
if np.array_equal(A, A.T):
try:
np.linalg.cholesky(A)
return 1
except np.linalg.linalg.LinAlgE... | [
"matplotlib.pylab.subplots",
"scipy.stats.beta.rvs",
"numpy.triu_indices",
"matplotlib.pylab.legend",
"numpy.array_equal",
"numpy.linalg.cholesky"
] | [((682, 696), 'matplotlib.pylab.subplots', 'plt.subplots', ([], {}), '()\n', (694, 696), True, 'import matplotlib.pylab as plt\n'), ((907, 951), 'matplotlib.pylab.legend', 'plt.legend', ([], {'loc': '"""upper right"""', 'frameon': '(False)'}), "(loc='upper right', frameon=False)\n", (917, 951), True, 'import matplotlib... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import collections
import copy
import datetime
import gc
import time
# import torch
import numpy as np
IrcTuple = collections.namedtuple('IrcTuple', ['index', 'row', 'col'])
XyzTuple = collections.namedtuple('XyzTuple', ['x', 'y', 'z'])
def irc2xyz(coord_irc, origin_xy... | [
"numpy.histogram",
"collections.namedtuple",
"numpy.array",
"numpy.linalg.inv",
"time.time",
"numpy.round"
] | [((164, 223), 'collections.namedtuple', 'collections.namedtuple', (['"""IrcTuple"""', "['index', 'row', 'col']"], {}), "('IrcTuple', ['index', 'row', 'col'])\n", (186, 223), False, 'import collections\n'), ((235, 286), 'collections.namedtuple', 'collections.namedtuple', (['"""XyzTuple"""', "['x', 'y', 'z']"], {}), "('X... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
range_start = np.linspace(0,40, 8, endpoint=False)
dr = range_start[1] - range_start[0]
# pertubation_types = ["all"]
pertubation_types = ["lattice", "lattice_nodens", "atom_types", "atom_sites", "density", "all"]
for t in pertubation_types:
... | [
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"numpy.load"
] | [((88, 125), 'numpy.linspace', 'np.linspace', (['(0)', '(40)', '(8)'], {'endpoint': '(False)'}), '(0, 40, 8, endpoint=False)\n', (99, 125), True, 'import numpy as np\n'), ((329, 350), 'numpy.load', 'np.load', (["('%s.npy' % t)"], {}), "('%s.npy' % t)\n", (336, 350), True, 'import numpy as np\n'), ((360, 401), 'pandas.D... |
import numpy as np
import scipy.signal
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal
from torch.distributions.utils import _standard_normal, broadcast_all
from torch.distributions.exp_family import ExponentialFamily
from numbers import Number
from torc... | [
"numpy.prod",
"torch.nn.Sequential",
"torch.distributions.normal.Normal",
"numpy.log",
"math.sqrt",
"torch.exp",
"torch.erfinv",
"torch.squeeze",
"torch.tanh",
"numpy.isscalar",
"torch.zeros_like",
"torch.ones_like",
"torch.distributions.utils.broadcast_all",
"torch.nn.functional.softplus"... | [((776, 798), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (789, 798), True, 'import torch.nn as nn\n'), ((6644, 6689), 'torch.clamp', 'torch.clamp', (['x'], {'min': '(-1 + 1e-05)', 'max': '(1 - 1e-05)'}), '(x, min=-1 + 1e-05, max=1 - 1e-05)\n', (6655, 6689), False, 'import torch\n'), ((731... |
import argparse
import time
import os
import glob
import sys
import json
import shutil
import itertools
import numpy as np
import pandas as pd
import csv
import torch
from torch.autograd import Variable
from sklearn.metrics import confusion_matrix
from torch.nn import functional as F
from opts import parse_opts_onli... | [
"utils.Queue",
"mean.get_std",
"mean.get_mean",
"numpy.array",
"torch.nn.functional.softmax",
"target_transforms.ClassLabel",
"numpy.exp",
"model._modify_first_conv_layer",
"sys.stdout.flush",
"torch.autograd.Variable",
"csv.reader",
"dataset.get_online_data",
"model.generate_model",
"nump... | [((893, 912), 'opts.parse_opts_online', 'parse_opts_online', ([], {}), '()\n', (910, 912), False, 'from opts import parse_opts_online\n'), ((5185, 5203), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (5201, 5203), False, 'import sys\n'), ((5389, 5401), 'target_transforms.ClassLabel', 'ClassLabel', ([], {}),... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# Capriqorn --- CAlculation of P(R) and I(Q) Of macRomolcules in solutioN
#
# Copyright (c) <NAME>, <NAME>, and contributors.
# See the file AUTHORS.rst for the full list ... | [
"re.split",
"numpy.where",
"scipy.spatial.distance.cdist",
"numpy.asarray",
"numpy.linalg.norm",
"numpy.logical_xor",
"numpy.asanyarray",
"past.utils.old_div",
"numpy.zeros",
"builtins.range",
"copy.deepcopy",
"capriqorn.kernel.c_refstruct.queryDistance"
] | [((2169, 2205), 'numpy.asanyarray', 'np.asanyarray', (['xyz'], {'dtype': 'np.float64'}), '(xyz, dtype=np.float64)\n', (2182, 2205), True, 'import numpy as np\n'), ((2216, 2252), 'numpy.asanyarray', 'np.asanyarray', (['ref'], {'dtype': 'np.float64'}), '(ref, dtype=np.float64)\n', (2229, 2252), True, 'import numpy as np\... |
# Based on https://stackoverflow.com/questions/30376581/save-numpy-array-in-append-mode
import tables
import numpy as np
import h5py
class BigH5Array():
def __init__(self, filename, shape=None, atom=tables.Float32Atom()):
self.filename = filename
self.shape = shape
self.atom = atom
def... | [
"numpy.prod",
"tables.open_file",
"h5py.File",
"h5py.string_dtype",
"h5py.vlen_dtype",
"tables.Float32Atom"
] | [((205, 225), 'tables.Float32Atom', 'tables.Float32Atom', ([], {}), '()\n', (223, 225), False, 'import tables\n'), ((360, 401), 'tables.open_file', 'tables.open_file', (['self.filename'], {'mode': '"""w"""'}), "(self.filename, mode='w')\n", (376, 401), False, 'import tables\n'), ((550, 591), 'tables.open_file', 'tables... |
# -*-coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Nov 20, 2014
Configuration file for AlexNet topology ... | [
"os.path.join",
"numpy.iinfo"
] | [((1357, 1412), 'os.path.join', 'os.path.join', (['root.common.dirs.datasets', '"""AlexNet/LMDB"""'], {}), "(root.common.dirs.datasets, 'AlexNet/LMDB')\n", (1369, 1412), False, 'import os\n'), ((9258, 9328), 'os.path.join', 'os.path.join', (['root.common.dirs.datasets', '"""AlexNet/mean_image_227.JPEG"""'], {}), "(root... |
from common.caching import cached
from . import dataio
import numpy as np
import tkinter as tk
import skimage.io
import os
import glob
import random
import time
class BodyPartLabelerGUI(object):
def __init__(self, master, files, labels):
self.master = master
self.files = files
self.image... | [
"common.caching.cached",
"tkinter.Canvas",
"numpy.array",
"tkinter.Label",
"numpy.rot90",
"numpy.save",
"os.path.exists",
"numpy.max",
"tkinter.StringVar",
"numpy.stack",
"glob.glob",
"numpy.abs",
"random.shuffle",
"numpy.fliplr",
"tkinter.PhotoImage",
"time.time",
"random.seed",
"... | [((4116, 4164), 'common.caching.cached', 'cached', (['dataio.get_all_data_generator'], {'version': '(5)'}), '(dataio.get_all_data_generator, version=5)\n', (4122, 4164), False, 'from common.caching import cached\n'), ((553, 612), 'tkinter.Canvas', 'tk.Canvas', ([], {'width': 'self.image_width', 'height': 'self.image_he... |
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def resolve_de(Pd,beta,gamma):
n = len(beta)
b = [-beta[i] for i in range(n)]
b.append(Pd)
c = np.zeros((n+1,n+1))
for i in range(n): c[i][i] = gamma[i]*2
c[ :, -1] = -1
c[-1, :] = 1
c[-1, -1] = 0
d... | [
"numpy.linalg.solve",
"numpy.float",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"random.randint",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.sho... | [((194, 218), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1)'], {}), '((n + 1, n + 1))\n', (202, 218), True, 'import numpy as np\n'), ((324, 345), 'numpy.linalg.solve', 'np.linalg.solve', (['c', 'b'], {}), '(c, b)\n', (339, 345), True, 'import numpy as np\n'), ((1554, 1567), 'numpy.array', 'np.array', (['bet'], {}), '(be... |
# Copyright (c) ASU GitHub Project.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
################################################################################
import numpy as np
import SimpleITK as sitk
def resam... | [
"SimpleITK.ResampleImageFilter",
"numpy.round",
"SimpleITK.Transform"
] | [((802, 828), 'SimpleITK.ResampleImageFilter', 'sitk.ResampleImageFilter', ([], {}), '()\n', (826, 828), True, 'import SimpleITK as sitk\n'), ((1039, 1055), 'SimpleITK.Transform', 'sitk.Transform', ([], {}), '()\n', (1053, 1055), True, 'import SimpleITK as sitk\n'), ((552, 619), 'numpy.round', 'np.round', (['(original_... |
from __future__ import division
import argparse
import matplotlib.pyplot as plt
import pickle
import gzip
import numpy as np
import tensorflow as tf
import matplotlib.gridspec as gridspec
import os
# from tensorflow.examples.tutorials.mnist import input_data
# np.set_printoptions(threshold=np.inf)
f =gzip.open('./scre... | [
"tensorflow.contrib.layers.conv2d",
"tensorflow.contrib.layers.flatten",
"tensorflow.layers.flatten",
"tensorflow.shape",
"gzip.open",
"tensorflow.contrib.layers.conv2d_transpose",
"numpy.array",
"tensorflow.math.exp",
"tensorflow.reduce_mean",
"matplotlib.pyplot.imshow",
"os.path.exists",
"te... | [((303, 351), 'gzip.open', 'gzip.open', (['"""./screenshot_data2002003.gzip"""', '"""rb"""'], {}), "('./screenshot_data2002003.gzip', 'rb')\n", (312, 351), False, 'import gzip\n'), ((862, 927), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, X_dim, X_dim, X_channel]'}), '(tf.float32, shap... |
import numpy as np
DEBUG = False
def overlap(samll_box, big_box):
if samll_box[1] > big_box[1] and samll_box[2] > big_box[2] and \
samll_box[3] < big_box[3] and samll_box[4] < big_box[4]:
lap = 1
else:
lap = 0
return lap
def local_box_layer(rois, im_info):
"""
Assign... | [
"numpy.array"
] | [((1284, 1305), 'numpy.array', 'np.array', (['local_boxes'], {}), '(local_boxes)\n', (1292, 1305), True, 'import numpy as np\n')] |
# A simple Psi 4 input script to compute a SCF reference using Psi4's libJK
# Requires numpy 1.7.2+
#
# Created by: <NAME>
# Date: 4/1/15
# License: GPL v3.0
#
import time
import numpy as np
import helper_HF as scf_helper
np.set_printoptions(precision=5, linewidth=200, suppress=True)
import psi4
# Memory for Psi4 in ... | [
"numpy.einsum",
"numpy.linalg.norm",
"numpy.mean",
"numpy.diag_indices_from",
"psi4.geometry",
"numpy.linalg.qr",
"numpy.asarray",
"numpy.dot",
"psi4.compare_values",
"numpy.linalg.eigh",
"numpy.abs",
"psi4.set_memory",
"numpy.ones",
"psi4.energy",
"time.time",
"numpy.set_printoptions"... | [((223, 285), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(5)', 'linewidth': '(200)', 'suppress': '(True)'}), '(precision=5, linewidth=200, suppress=True)\n', (242, 285), True, 'import numpy as np\n'), ((323, 346), 'psi4.set_memory', 'psi4.set_memory', (['"""2 GB"""'], {}), "('2 GB')\n", (338, ... |
import platform
import numpy as np
import pytest
import qtpy
from napari.layers import Labels, Points
from qtpy.QtCore import QCoreApplication
from PartSeg._roi_analysis.image_view import ResultImageView
from PartSeg.common_backend.base_settings import BaseSettings
from PartSeg.common_gui.channel_control import Chann... | [
"PartSeg.common_gui.napari_viewer_wrap.Viewer",
"PartSeg.common_backend.base_settings.BaseSettings",
"qtpy.QtCore.QCoreApplication.processEvents",
"numpy.array",
"platform.system",
"PartSeg.common_gui.channel_control.ChannelProperty",
"PartSeg._roi_analysis.image_view.ResultImageView"
] | [((874, 912), 'PartSeg.common_gui.channel_control.ChannelProperty', 'ChannelProperty', (['part_settings', '"""test"""'], {}), "(part_settings, 'test')\n", (889, 912), False, 'from PartSeg.common_gui.channel_control import ChannelProperty\n'), ((930, 974), 'PartSeg._roi_analysis.image_view.ResultImageView', 'ResultImage... |
# The kNN code implemented using NumPy
import numpy as np
import db_func
from os import path
def display_data(v):
"""Display a given vector using print"""
try:
assert(type(v) is np.ndarray)
assert(len(v.shape) == 1)
assert(v.size % db_func.config["data-width"] == 0)
except:
... | [
"db_func.read_db_list",
"numpy.arange"
] | [((900, 922), 'db_func.read_db_list', 'db_func.read_db_list', ([], {}), '()\n', (920, 922), False, 'import db_func\n'), ((3107, 3123), 'numpy.arange', 'np.arange', (['(0)', '(10)'], {}), '(0, 10)\n', (3116, 3123), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 11:43:28 2021
@author: <NAME>
"""
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
class Panels:
def __init__(self, n_panels):
self.n_panels = self.get_n_panels(n_panels)
self.x_coords, s... | [
"numpy.sqrt",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"numpy.log",
"numpy.array",
"numpy.arctan2",
"numpy.sin",
"numpy.arange",
"numpy.mean",
"numpy.flip",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.diff",
"numpy.max",
"matplotlib.pyplot.close",
"matplotlib.p... | [((2410, 2426), 'numpy.arange', 'np.arange', (['(n + 1)'], {}), '(n + 1)\n', (2419, 2426), True, 'import numpy as np\n'), ((2542, 2586), 'numpy.concatenate', 'np.concatenate', (['(bot_coords, top_coords[1:])'], {}), '((bot_coords, top_coords[1:]))\n', (2556, 2586), True, 'import numpy as np\n'), ((5820, 5855), 'numpy.a... |
# -*- coding: utf-8 -*-
import io
import logging
import os
import pickle
import subprocess
import sys
import pandas as pd
import numpy as np
from tqdm.notebook import tqdm
import matplotlib.pyplot as plt
#import h5py
from ..trajectory.oracle_core import Oracle
from .scatter_to_grid import scatter_value_to_grid_val... | [
"numpy.sqrt",
"numpy.array",
"numpy.linalg.norm",
"numpy.gradient",
"numpy.arange",
"numpy.mean",
"numpy.where",
"numpy.max",
"scipy.stats.wilcoxon",
"numpy.linspace",
"numpy.dot",
"numpy.vstack",
"sklearn.neighbors.NearestNeighbors",
"numpy.min",
"pandas.DataFrame",
"numpy.meshgrid",
... | [((1398, 1560), 'pandas.DataFrame', 'pd.DataFrame', (["{'score': oracle_object.inner_product[~oracle_object.mass_filter],\n 'pseudotime': oracle_object.new_pseudotime[~oracle_object.mass_filter]}"], {}), "({'score': oracle_object.inner_product[~oracle_object.\n mass_filter], 'pseudotime': oracle_object.new_pseudo... |
# Copyright (C) 2020 THL A29 Limited, a Tencent company.
# All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# https://opensource.org/licenses/BSD-3-Clause
# Unless required by appl... | [
"torch.cuda.Event",
"torch.onnx.export",
"onnx.load_model",
"json.dumps",
"transformers.BertModel",
"transformers.AlbertConfig",
"transformers.RobertaModel",
"torch.cuda.synchronize",
"torch.randint",
"numpy.random.randint",
"multiprocessing.Pool",
"transformers.AlbertModel",
"torch.set_grad... | [((2009, 2038), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (2031, 2038), False, 'import torch\n'), ((2584, 2699), 'torch.randint', 'torch.randint', ([], {'low': '(0)', 'high': '(cfg.vocab_size - 1)', 'size': '(batch_size, seq_len)', 'dtype': 'torch.long', 'device': 'test_device'... |
import gzip
import os
import unittest
import cPickle
import numpy as np
from convnet.layers import *
from convnet.net import ConvNet
from convnet.utils import arr_2d_to_3d, input_2d_to_3d, input_1d_to_3d, to_3d, y_to_3d, y_1d_to_3d
# noinspection PyPep8Naming
class ConvNetTest(unittest.TestCase):
def setUp(self... | [
"numpy.unique",
"convnet.net.ConvNet",
"numpy.where",
"numpy.asarray",
"os.path.join",
"convnet.utils.y_1d_to_3d",
"numpy.zeros",
"numpy.concatenate",
"os.path.abspath",
"convnet.utils.y_to_3d",
"cPickle.load",
"numpy.arange",
"numpy.set_printoptions"
] | [((331, 378), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)', 'linewidth': '(120)'}), '(precision=2, linewidth=120)\n', (350, 378), True, 'import numpy as np\n'), ((641, 650), 'convnet.net.ConvNet', 'ConvNet', ([], {}), '()\n', (648, 650), False, 'from convnet.net import ConvNet\n'), ((1884, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 3 16:27:12 2017
@author: xinruyue
"""
import pandas as pd
import numpy as np
import xlrd
import pickle
import os
def get_country():
f = open('country.txt','r')
country = []
for line in f:
line = line.strip('\n')
countr... | [
"os.listdir",
"pickle.dump",
"xlrd.open_workbook",
"os.path.join",
"numpy.zeros",
"pandas.read_excel",
"pandas.DataFrame",
"pandas.concat"
] | [((431, 453), 'numpy.zeros', 'np.zeros', (['(size, size)'], {}), '((size, size))\n', (439, 453), True, 'import numpy as np\n'), ((721, 735), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (733, 735), True, 'import pandas as pd\n'), ((747, 772), 'xlrd.open_workbook', 'xlrd.open_workbook', (['file1'], {}), '(file1... |
import sys
if sys.version_info[0] < 3:
import Tkinter as Tk
else:
import tkinter as Tk
import numpy as np
import matplotlib.colors as colors
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
# implement the default mpl key bindings
from matplotlib.backend_bases import ke... | [
"numpy.copy",
"matplotlib.backends.backend_tkagg.NavigationToolbar2Tk",
"matplotlib.figure.Figure",
"tkinter.Button",
"tkinter.Tk",
"matplotlib.backend_bases.key_press_handler",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg"
] | [((445, 452), 'tkinter.Tk', 'Tk.Tk', ([], {}), '()\n', (450, 452), True, 'import tkinter as Tk\n'), ((624, 644), 'numpy.copy', 'np.copy', (['x_ray_image'], {}), '(x_ray_image)\n', (631, 644), True, 'import numpy as np\n'), ((2549, 2600), 'matplotlib.backend_bases.key_press_handler', 'key_press_handler', (['event', 'sel... |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.compat.v2_compat.enable_v2_behavior",
"numpy.reshape",
"tensorflow.python.distribute.distribute_lib.InputOptions",
"absl.testing.parameterized.parameters",
"tensorflow.python.platform.test.main"
] | [((1194, 1233), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['[True, False]'], {}), '([True, False])\n', (1218, 1233), False, 'from absl.testing import parameterized\n'), ((3744, 3774), 'tensorflow.python.compat.v2_compat.enable_v2_behavior', 'v2_compat.enable_v2_behavior', ([], {}), '()\n', (... |
import numpy as np
import nutszebra_data_augmentation_picture
from functools import wraps
da = nutszebra_data_augmentation_picture.DataAugmentationPicture()
def reset(func):
@wraps(func)
def wrapper(self, *args, **kwargs):
da()
return func(self, *args, **kwargs)
return wrapper
class Data... | [
"functools.wraps",
"numpy.array",
"numpy.reshape",
"nutszebra_data_augmentation_picture.DataAugmentationPicture"
] | [((95, 156), 'nutszebra_data_augmentation_picture.DataAugmentationPicture', 'nutszebra_data_augmentation_picture.DataAugmentationPicture', ([], {}), '()\n', (154, 156), False, 'import nutszebra_data_augmentation_picture\n'), ((181, 192), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (186, 192), False, 'from f... |
from DeepJetCore.TrainData import TrainData, fileTimeOut
from DeepJetCore import SimpleArray
import numpy as np
import uproot3 as uproot
import ROOT
import os
import pickle
import gzip
import pandas as pd
class TrainData_ild(TrainData):
def __init__(self):
TrainData.__init__(self)
#d... | [
"pickle.dump",
"gzip.open",
"uproot3.open",
"DeepJetCore.TrainData.TrainData.__init__",
"numpy.log",
"pickle.load",
"os.path.splitext",
"numpy.count_nonzero",
"numpy.array",
"DeepJetCore.SimpleArray",
"DeepJetCore.TrainData.fileTimeOut",
"numpy.concatenate",
"numpy.expand_dims",
"pandas.Da... | [((276, 300), 'DeepJetCore.TrainData.TrainData.__init__', 'TrainData.__init__', (['self'], {}), '(self)\n', (294, 300), False, 'from DeepJetCore.TrainData import TrainData, fileTimeOut\n'), ((2215, 2249), 'numpy.array', 'np.array', (['rowsplits'], {'dtype': '"""int64"""'}), "(rowsplits, dtype='int64')\n", (2223, 2249),... |
from typing import Dict, Union
import gym
import numpy as np
from stable_baselines3.common.type_aliases import GymObs, GymStepReturn
class TimeFeatureWrapper(gym.Wrapper):
"""
Add remaining, normalized time to observation space for fixed length episodes.
See https://arxiv.org/abs/1712.00378 and https://g... | [
"numpy.append",
"numpy.array",
"numpy.concatenate",
"gym.spaces.Box"
] | [((3458, 3498), 'numpy.array', 'np.array', (['time_feature'], {'dtype': 'self.dtype'}), '(time_feature, dtype=self.dtype)\n', (3466, 3498), True, 'import numpy as np\n'), ((3649, 3677), 'numpy.append', 'np.append', (['obs', 'time_feature'], {}), '(obs, time_feature)\n', (3658, 3677), True, 'import numpy as np\n'), ((19... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.