code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import gym
import gym_envs
import pybullet as p
import numpy as np
env = gym.make('ReachingJaco-v1')
env.render()
observation = env.reset()
env.world_creation.print_joint_info(env.robot)
keys_actions = {
p.B3G_LEFT_ARROW: np.array([-0.01, 0, 0]),
p.B3G_RIGHT_ARROW: np.array([0.01, 0, 0]),
p.B3G_UP_ARROW:... | [
"pybullet.getLinkState",
"gym.make",
"pybullet.calculateInverseKinematics",
"numpy.array",
"pybullet.getKeyboardEvents"
] | [((74, 101), 'gym.make', 'gym.make', (['"""ReachingJaco-v1"""'], {}), "('ReachingJaco-v1')\n", (82, 101), False, 'import gym\n'), ((227, 250), 'numpy.array', 'np.array', (['[-0.01, 0, 0]'], {}), '([-0.01, 0, 0])\n', (235, 250), True, 'import numpy as np\n'), ((276, 298), 'numpy.array', 'np.array', (['[0.01, 0, 0]'], {}... |
import torch
import numpy as np
from sklearn.metrics import confusion_matrix
def calculate_acc(predict, labels):
pred_labels = torch.max(predict, dim=1)[1].int()
return torch.sum(pred_labels == labels.int()) * 100 / predict.shape[0]
def calculate_iou_single_shape(predict, labels, n_parts):
pred_labels =... | [
"numpy.sum",
"numpy.arange",
"torch.max",
"numpy.array",
"numpy.diagonal"
] | [((869, 887), 'numpy.array', 'np.array', (['iou_list'], {}), '(iou_list)\n', (877, 887), True, 'import numpy as np\n'), ((1581, 1624), 'numpy.diagonal', 'np.diagonal', (['confusions'], {'axis1': '(-2)', 'axis2': '(-1)'}), '(confusions, axis1=-2, axis2=-1)\n', (1592, 1624), True, 'import numpy as np\n'), ((1642, 1669), ... |
import pyaudio
import numpy as np
import matplotlib.pyplot as plt
SAMPLING_RATE = 44100
DURATION = 15
TOTAL_SAMPLES = SAMPLING_RATE*DURATION
def line(start_freq, end_freq, start_time, end_time):
epsilon = 0.05
xs = np.linspace(start_freq, end_freq, TOTAL_SAMPLES)
vs = np.concatenate([
np.linspace(0, 0, abs(int(S... | [
"numpy.linspace",
"numpy.sin",
"numpy.arange",
"pyaudio.PyAudio"
] | [((659, 676), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (674, 676), False, 'import pyaudio\n'), ((2767, 2790), 'numpy.arange', 'np.arange', (['min_duration'], {}), '(min_duration)\n', (2776, 2790), True, 'import numpy as np\n'), ((219, 267), 'numpy.linspace', 'np.linspace', (['start_freq', 'end_freq', 'TO... |
import cv2
import torch
import imutils
import numpy as np
import onnxruntime
from PIL import Image
from imutils import perspective
from torchvision import transforms
from models import cropper
from data_loader import crop_loader
def resize_image(img, short_size):
height, width, _ = img.shape
if height < widt... | [
"numpy.array_equal",
"cv2.approxPolyDP",
"cv2.arcLength",
"onnxruntime.InferenceSession",
"utils.util.save_image",
"imutils.resize",
"torch.device",
"data_loader.crop_loader.ToTensorLab",
"cv2.imshow",
"torch.no_grad",
"data_loader.crop_loader.RescaleT",
"torch.load",
"numpy.max",
"imutils... | [((608, 648), 'cv2.resize', 'cv2.resize', (['img', '(new_width, new_height)'], {}), '(img, (new_width, new_height))\n', (618, 648), False, 'import cv2\n'), ((1649, 1670), 'numpy.zeros', 'np.zeros', (['image.shape'], {}), '(image.shape)\n', (1657, 1670), True, 'import numpy as np\n'), ((1683, 1711), 'numpy.zeros', 'np.z... |
import tensorflow as tf
import numpy as np
from sklearn.preprocessing import StandardScaler
import joblib
from .compression_net import CompressionNet
from .estimation_net import EstimationNet
from .gmm import GMM
from pyod.utils.stat_models import pairwise_distances_no_broadcast
from os import makedirs
from os.path ... | [
"sklearn.preprocessing.StandardScaler",
"numpy.random.seed",
"tensorflow.compat.v1.reduce_mean",
"joblib.dump",
"tensorflow.compat.v1.add_to_collection",
"numpy.arange",
"os.path.join",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.placeholder",
"os.path.exists",
"te... | [((374, 398), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (396, 398), True, 'import tensorflow.compat.v1 as tf\n'), ((7543, 7574), 'os.path.join', 'join', (['fdir', 'self.MODEL_FILENAME'], {}), '(fdir, self.MODEL_FILENAME)\n', (7547, 7574), False, 'from os.path import exists,... |
#from netCDF4 import Dataset # http://code.google.com/p/netcdf4-python/
import os
import time
import datetime as dt
import xarray as xr
from datetime import datetime
import pandas
import matplotlib.pyplot as plt
import numpy as np
import math
####################you will need to change some paths here!################... | [
"numpy.empty",
"os.walk",
"numpy.argmin",
"numpy.arange",
"scipy.interpolate.interp1d",
"os.path.join",
"numpy.meshgrid",
"xarray.merge",
"numpy.append",
"datetime.timedelta",
"numpy.linspace",
"numpy.mod",
"xarray.Dataset",
"datetime.datetime",
"xarray.concat",
"xarray.open_dataset",
... | [((7165, 7199), 'datetime.datetime', 'dt.datetime', (['(1858)', '(11)', '(17)', '(0)', '(0)', '(0)'], {}), '(1858, 11, 17, 0, 0, 0)\n', (7176, 7199), True, 'import datetime as dt\n'), ((7432, 7462), 'os.walk', 'os.walk', (['dir_in'], {'topdown': '(False)'}), '(dir_in, topdown=False)\n', (7439, 7462), False, 'import os\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import numpy as np
from matplotlib.ticker import AutoMinorLocator
from ph_plotter.sf_plotter import SFPlotter
from ph_plotter.colormap_creator import ColormapCreator... | [
"numpy.meshgrid",
"numpy.zeros_like",
"numpy.sum",
"numpy.zeros",
"ph_plotter.colormap_creator.ColormapCreator",
"matplotlib.ticker.AutoMinorLocator",
"numpy.diff",
"numpy.where",
"numpy.linspace",
"numpy.repeat"
] | [((10040, 10075), 'numpy.meshgrid', 'np.meshgrid', (['xs_fine_1d', 'ys_fine_1d'], {}), '(xs_fine_1d, ys_fine_1d)\n', (10051, 10075), True, 'import numpy as np\n'), ((10545, 10565), 'numpy.repeat', 'np.repeat', (['points', 'n'], {}), '(points, n)\n', (10554, 10565), True, 'import numpy as np\n'), ((1315, 1357), 'numpy.l... |
import sys
import numpy as np
import pandas as pd
store = pd.HDFStore('/home/python/data/dur/store.h5')
test = store['test']
train = store['train']
varneedtranslist = ['RevolvingUtilizationOfUnsecuredLines',
'NumberOfTime30-59DaysPastDueNotWorse',
'DebtRatio','MonthlyIncome','N... | [
"pandas.to_numeric",
"pandas.HDFStore",
"numpy.errstate"
] | [((59, 104), 'pandas.HDFStore', 'pd.HDFStore', (['"""/home/python/data/dur/store.h5"""'], {}), "('/home/python/data/dur/store.h5')\n", (70, 104), True, 'import pandas as pd\n'), ((549, 578), 'numpy.errstate', 'np.errstate', ([], {'invalid': '"""ignore"""'}), "(invalid='ignore')\n", (560, 578), True, 'import numpy as np... |
import argparse
import os
import random
import numpy as np
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
from pytorch_lightning.loggers import WandbLogger
from transformers import AutoModel
from varclr.data.dataset import RenamesDataModule
from varc... | [
"argparse.Namespace",
"pytorch_lightning.Trainer",
"numpy.random.seed",
"argparse.ArgumentParser",
"varclr.models.tokenizers.PretrainedTokenizer.set_instance",
"os.path.basename",
"torch.manual_seed",
"varclr.models.Model",
"varclr.data.dataset.RenamesDataModule",
"varclr.utils.options.add_options... | [((487, 512), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (510, 512), False, 'import argparse\n'), ((517, 536), 'varclr.utils.options.add_options', 'add_options', (['parser'], {}), '(parser)\n', (528, 536), False, 'from varclr.utils.options import add_options\n'), ((572, 594), 'random.seed',... |
import glob
import os
import datetime
from collections import OrderedDict
import pandas as pd
import numpy as np
from sklearn.manifold import TSNE
import scipy.stats as stats
import scipy.sparse as sparse
from sparse_dataframe import SparseDataFrame
def combine_sdf_files(run_folder, folders, verbose=False, **kwa... | [
"os.mkdir",
"numpy.abs",
"numpy.nan_to_num",
"pandas.read_csv",
"pandas.to_pickle",
"sparse_dataframe.SparseDataFrame",
"os.path.join",
"pandas.DataFrame",
"numpy.zeros_like",
"numpy.power",
"os.path.dirname",
"os.path.exists",
"pandas.concat",
"numpy.asarray",
"datetime.datetime.strptim... | [((404, 421), 'sparse_dataframe.SparseDataFrame', 'SparseDataFrame', ([], {}), '()\n', (419, 421), False, 'from sparse_dataframe import SparseDataFrame\n'), ((1467, 1481), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs)\n', (1476, 1481), True, 'import pandas as pd\n'), ((2978, 3002), 'numpy.zeros_like', 'np.zeros_l... |
"""Hyperparameter grid search for smoothness penalty for nonparametric additive models"""
from copy import deepcopy
from IPython.display import Math
from ipywidgets import *
import numpy as np
import pandas as pd
from sklearn.metrics import mean_absolute_error, mean_squared_error
from scipy.special import comb
from tqd... | [
"pandas.DataFrame",
"copy.deepcopy",
"numpy.count_nonzero",
"numpy.logspace",
"numpy.zeros",
"numpy.savez_compressed"
] | [((593, 642), 'numpy.logspace', 'np.logspace', ([], {'start': '(-2)', 'stop': '(-6)', 'num': '(20)', 'base': '(10.0)'}), '(start=-2, stop=-6, num=20, base=10.0)\n', (604, 642), True, 'import numpy as np\n'), ((673, 721), 'numpy.logspace', 'np.logspace', ([], {'start': '(1)', 'stop': '(-5)', 'num': '(25)', 'base': '(10.... |
from keras import models
from keras import layers
import numpy as np
import math
import pickle
import os.path
from keras.models import load_model
import pandas as pd
class PredictorNNSensorsNotNormalized:
def __init__(self):
# define set of models
self.models = []
# load all the models fr... | [
"numpy.absolute",
"math.isnan",
"numpy.array"
] | [((1371, 1394), 'math.isnan', 'math.isnan', (['sensors[ix]'], {}), '(sensors[ix])\n', (1381, 1394), False, 'import math\n'), ((1817, 1842), 'numpy.array', 'np.array', (['[[x, y, theta]]'], {}), '([[x, y, theta]])\n', (1825, 1842), True, 'import numpy as np\n'), ((1844, 1870), 'numpy.array', 'np.array', (['[sensors[i - ... |
""" A collection of tree reconstruction methods.
Each one of these methods accepts a sequence alignment in the form of a dictionary,
and returns a collection of splits which have been chosen as `most likely' to be true.
Some methods will return additional information. Not all methods guarantee that the sp... | [
"splitp.NXTree",
"numpy.linalg.norm",
"splitp.tree_helper_functions.all_splits"
] | [((1248, 1296), 'splitp.NXTree', 'sp.NXTree', (['newick_string'], {'taxa_ordering': '"""sorted"""'}), "(newick_string, taxa_ordering='sorted')\n", (1257, 1296), True, 'import splitp as sp\n'), ((896, 919), 'splitp.tree_helper_functions.all_splits', 'hf.all_splits', (['num_taxa'], {}), '(num_taxa)\n', (909, 919), True, ... |
import numpy as np
from robosuite.mcts.tree_search_v5 import *
if __name__ == "__main__":
np.random.seed(1)
mesh_types, mesh_files, mesh_units, meshes, rotation_types, contact_faces, contact_points = get_meshes(_area_ths=0.003)
initial_object_list, goal_obj, contact_points, contact_faces, coll_mngr, _, _, ... | [
"numpy.random.seed",
"numpy.sum"
] | [((95, 112), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (109, 112), True, 'import numpy as np\n'), ((1575, 1603), 'numpy.sum', 'np.sum', (['n_obj_per_mesh_types'], {}), '(n_obj_per_mesh_types)\n', (1581, 1603), True, 'import numpy as np\n')] |
import numpy as np
import theano
import theano.tensor as T
from theano.tensor.shared_randomstreams import RandomStreams
from model import Model
class RNN(Model):
def __init__(self, nin, nout, nhid, numpy_rng, scale=1.0):
self.nin = nin
self.nout = nout
self.nhid = nhid
... | [
"theano.tensor.dot",
"numpy.float32",
"numpy.zeros",
"theano.tensor.imatrix",
"theano.tensor.gt",
"theano.tensor.grad",
"theano.tensor.fmatrix",
"theano.tensor.bmatrix",
"numpy.eye",
"theano.tensor.clip",
"theano.tensor.switch",
"theano.tensor.shared_randomstreams.RandomStreams"
] | [((376, 392), 'theano.tensor.shared_randomstreams.RandomStreams', 'RandomStreams', (['(1)'], {}), '(1)\n', (389, 392), False, 'from theano.tensor.shared_randomstreams import RandomStreams\n'), ((415, 432), 'numpy.float32', 'np.float32', (['scale'], {}), '(scale)\n', (425, 432), True, 'import numpy as np\n'), ((458, 477... |
# Copyright (C) 2020 Intel Corporation
# 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 w... | [
"torchvision.datasets.CIFAR10",
"numpy.eye",
"numpy.asarray"
] | [((1296, 1365), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', (['"""~/.CIFAR10"""'], {'train': '(True)', 'download': '(True)'}), "('~/.CIFAR10', train=True, download=True)\n", (1324, 1365), False, 'import torchvision\n'), ((1383, 1453), 'torchvision.datasets.CIFAR10', 'torchvision.datasets.CIFAR10', (... |
import os
import shutil
import time
import torch
import numpy as np
import numpy.random as rd
from FinRLPodracer.elegantrl.evaluator import Evaluator
from FinRLPodracer.elegantrl.replay import ReplayBufferMP
from FinRLPodracer.elegantrl.env import deepcopy_or_rebuild_env
class Arguments:
def __init__(self, agent... | [
"numpy.load",
"numpy.random.seed",
"numpy.argsort",
"torch.set_default_dtype",
"torch.set_num_threads",
"numpy.random.randint",
"torch.device",
"shutil.rmtree",
"torch.no_grad",
"os.path.exists",
"multiprocessing.Pipe",
"torch.manual_seed",
"numpy.log2",
"FinRLPodracer.elegantrl.env.deepco... | [((5037, 5057), 'numpy.argsort', 'np.argsort', (['e_r_list'], {}), '(e_r_list)\n', (5047, 5057), True, 'import numpy as np\n'), ((5762, 5799), 'os.makedirs', 'os.makedirs', (['wait_file'], {'exist_ok': '(True)'}), '(wait_file, exist_ok=True)\n', (5773, 5799), False, 'import os\n'), ((5829, 5854), 'os.path.exists', 'os.... |
"""Tests for Runge-Kutta initialization."""
import numpy as np
import pytest
from probnum import diffeq, randvars
from tests.test_diffeq.test_odefilter.test_initialization_routines import (
_interface_initialize_test,
)
class TestRungeKuttaInitialization(
_interface_initialize_test.InterfaceInitializationRou... | [
"numpy.testing.assert_allclose",
"pytest.fixture",
"probnum.diffeq.odefilter.initialization_routines.RungeKuttaInitialization",
"numpy.linalg.norm"
] | [((337, 365), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (351, 365), False, 'import pytest\n'), ((425, 517), 'probnum.diffeq.odefilter.initialization_routines.RungeKuttaInitialization', 'diffeq.odefilter.initialization_routines.RungeKuttaInitialization', ([], {'dt': '(0.1)', 'm... |
import numpy as np
import torch
from torch.autograd import Variable
from . import agent
from . import cnn_agent_second_input
from . import history_records
import image_preprocessing
import utils
import torch.optim as optim
import vizdoom as viz
class AgentTwoInput(agent.Agent):
def __init__(self, scenario_name,... | [
"torch.stack",
"torch.autograd.Variable",
"numpy.array",
"utils.load"
] | [((1527, 1612), 'numpy.array', 'np.array', (['[[self.current_health, self.previous_health, self.delta_health, step]]'], {}), '([[self.current_health, self.previous_health, self.delta_health, step]]\n )\n', (1535, 1612), True, 'import numpy as np\n'), ((3985, 4059), 'utils.load', 'utils.load', (['model_path'], {'mode... |
#!/usr/bin/env python
import os
import sys
import math
from subprocess import check_output
import numpy
import re
from aggregate import path_wrangle, writerow
from statistics import median
def stats2(array):
list_arr = array.tolist()
# drop two highest
list_arr.remove(max(list_arr))
list_arr.remove(ma... | [
"statistics.median",
"math.sqrt",
"aggregate.path_wrangle",
"numpy.zeros",
"aggregate.writerow",
"sys.exit"
] | [((453, 469), 'statistics.median', 'median', (['list_arr'], {}), '(list_arr)\n', (459, 469), False, 'from statistics import median\n'), ((1117, 1136), 'math.sqrt', 'math.sqrt', (['sqrs_avg'], {}), '(sqrs_avg)\n', (1126, 1136), False, 'import math\n'), ((1671, 1709), 'aggregate.path_wrangle', 'path_wrangle', (['crunched... |
from railrl.envs.remote import RemoteRolloutEnv
from railrl.samplers.util import rollout
from railrl.torch.core import PyTorchModule
from railrl.torch.pytorch_util import set_gpu_mode
import argparse
import joblib
import uuid
from railrl.core import logger
import cv2
import os.path as osp
import os
filename = str(uui... | [
"argparse.ArgumentParser",
"ipdb.set_trace",
"numpy.ones",
"railrl.core.logger.dump_tabular",
"railrl.torch.pytorch_util.set_gpu_mode",
"os.path.dirname",
"railrl.samplers.util.rollout",
"railrl.envs.wrappers.ImageMujocoEnv",
"numpy.uint8",
"os.path.basename",
"numpy.hstack",
"numpy.concatenat... | [((317, 329), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (327, 329), False, 'import uuid\n'), ((967, 994), 'numpy.concatenate', 'np.concatenate', (['(goal, obs)'], {}), '((goal, obs))\n', (981, 994), True, 'import numpy as np\n'), ((1005, 1024), 'numpy.uint8', 'np.uint8', (['(255 * img)'], {}), '(255 * img)\n', (101... |
'''
In this assignment you will implement one or more algorithms for the traveling salesman problem, such as the dynamic programming
algorithm covered in the video lectures. Here is a data file describing a TSP instance.
tsp.txt
The first line indicates the number of cities. Each city is a point in the plane, and eac... | [
"matplotlib.pyplot.show",
"os.getcwd",
"itertools.permutations",
"numpy.array",
"collections.namedtuple",
"matplotlib.pyplot.subplots"
] | [((1488, 1516), 'collections.namedtuple', 'namedtuple', (['"""City"""', '"""x y id"""'], {}), "('City', 'x y id')\n", (1498, 1516), False, 'from collections import defaultdict, namedtuple\n'), ((1529, 1540), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1538, 1540), False, 'import os, math\n'), ((4229, 4273), 'numpy.arr... |
import scipy as sp
import numpy as np
from scipy import stats
from scipy.misc import logsumexp
from numpy import seterr
class PHMM:
"""
This class defines a Hidden Markov Model with Poisson emissions,
in which all observed sequences are assumed to have the same initial
state probabilities, transition p... | [
"numpy.sum",
"numpy.log",
"scipy.stats.poisson",
"numpy.argmax",
"numpy.seterr",
"numpy.isneginf",
"scipy.misc.logsumexp",
"numpy.array",
"numpy.exp",
"numpy.add"
] | [((1573, 1596), 'numpy.seterr', 'seterr', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (1579, 1596), False, 'from numpy import seterr\n'), ((1657, 1675), 'numpy.log', 'np.log', (['init_delta'], {}), '(init_delta)\n', (1663, 1675), True, 'import numpy as np\n'), ((1697, 1715), 'numpy.log', 'np.log', (['init_... |
import numpy as np
import torch
import os
import sys
import random
import torch.nn as nn
import torch.utils.data as tdata
import h5py
import glob
import scipy.io as sio
import math
sys.path.append(".")
from preprocess_face import preprocess_face, non_linearity
class VideoLoader:
def __init__(self, root):
self.vid... | [
"sys.path.append",
"numpy.load",
"h5py.File",
"numpy.uint8",
"torch.utils.data.DataLoader",
"scipy.io.loadmat",
"math.ceil",
"numpy.zeros",
"numpy.flipud",
"numpy.fliplr",
"numpy.array",
"glob.glob",
"os.path.join",
"os.listdir"
] | [((182, 202), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (197, 202), False, 'import sys\n'), ((6573, 6662), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_dataset'], {'batch_size': '(1)', 'shuffle': '(True)', 'num_workers': '(2)'}), '(train_dataset, batch_size=1, shuffle... |
import numpy as np
import matplotlib.pyplot as mpl
import matplotlib.pyplot as mpl
def row2lat(height, row):
return 90 - 180 * (row + 0.5) / height
def lat2row(height, lat):
return int(np.floor((90 - lat) * height / 180.0))
def col2lon(height, col):
return 180 * (col + 0.5) / height - 180
def lon2co... | [
"numpy.maximum",
"numpy.arctan2",
"numpy.abs",
"numpy.sum",
"matplotlib.pyplot.get_cmap",
"numpy.logical_and",
"numpy.floor",
"numpy.zeros",
"numpy.cross",
"numpy.sin",
"numpy.array",
"numpy.where",
"numpy.cos",
"matplotlib.pyplot.imsave",
"numpy.arange",
"numpy.dot",
"numpy.sqrt"
] | [((433, 458), 'numpy.cos', 'np.cos', (['(lon * np.pi / 180)'], {}), '(lon * np.pi / 180)\n', (439, 458), True, 'import numpy as np\n'), ((473, 498), 'numpy.sin', 'np.sin', (['(lon * np.pi / 180)'], {}), '(lon * np.pi / 180)\n', (479, 498), True, 'import numpy as np\n'), ((513, 538), 'numpy.cos', 'np.cos', (['(lat * np.... |
import numpy as np
c16 = np.complex128()
f8 = np.float64()
i8 = np.int64()
u8 = np.uint64()
c8 = np.complex64()
f4 = np.float32()
i4 = np.int32()
u4 = np.uint32()
dt = np.datetime64(0, "D")
td = np.timedelta64(0, "D")
b_ = np.bool_()
b = bool()
c = complex()
f = float()
i = int()
AR = np.array([0], dtype=np.int64... | [
"numpy.uint32",
"numpy.bool_",
"numpy.uint64",
"numpy.complex128",
"numpy.datetime64",
"numpy.float32",
"numpy.timedelta64",
"numpy.array",
"numpy.complex64",
"numpy.int64",
"numpy.int32",
"numpy.float64"
] | [((26, 41), 'numpy.complex128', 'np.complex128', ([], {}), '()\n', (39, 41), True, 'import numpy as np\n'), ((47, 59), 'numpy.float64', 'np.float64', ([], {}), '()\n', (57, 59), True, 'import numpy as np\n'), ((65, 75), 'numpy.int64', 'np.int64', ([], {}), '()\n', (73, 75), True, 'import numpy as np\n'), ((81, 92), 'nu... |
## dengke.wu@author
from .predictor import MBModel
from maskrcnn_benchmark.config import cfg
import numpy as np
class modelTool:
# 通过config文件和模型文件对maskrcnn-benchmark的模型初始化
# initModel用于初始化模型
# cfg_path是model_config.yaml的路径
# wts_path是模型.pth存放的路径
def initModel(self, cfg_path, wts_path, labelmap=Non... | [
"numpy.array",
"maskrcnn_benchmark.config.cfg.merge_from_file",
"maskrcnn_benchmark.config.cfg.merge_from_list"
] | [((332, 361), 'maskrcnn_benchmark.config.cfg.merge_from_file', 'cfg.merge_from_file', (['cfg_path'], {}), '(cfg_path)\n', (351, 361), False, 'from maskrcnn_benchmark.config import cfg\n'), ((370, 417), 'maskrcnn_benchmark.config.cfg.merge_from_list', 'cfg.merge_from_list', (["['MODEL.WEIGHT', wts_path]"], {}), "(['MODE... |
# Copyright (c) 2019 Horizon Robotics. 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 applicab... | [
"tensorflow.test.main",
"alf.utils.common.set_per_process_memory_growth",
"tensorflow.keras.layers.Reshape",
"tf_agents.specs.tensor_spec.TensorSpec",
"tensorflow.keras.layers.Dense",
"absl.testing.parameterized.parameters",
"alf.networks.actor_network.ActorNetwork",
"tf_agents.specs.tensor_spec.sampl... | [((966, 1036), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (["{'outer_dims': (3,)}", "{'outer_dims': (3, 5)}"], {}), "({'outer_dims': (3,)}, {'outer_dims': (3, 5)})\n", (990, 1036), False, 'from absl.testing import parameterized\n'), ((1557, 1627), 'absl.testing.parameterized.parameters', 'para... |
"""
Sample: Load one scene
This module demonstrates loading data from one scene using the stereomideval module.
"""
import os
import numpy as np
from stereomideval.structures import MatchData
from stereomideval.dataset import Dataset
from stereomideval.eval import Eval, Timer, Metric
# Path to dowmload datasets
DATAS... | [
"stereomideval.dataset.Dataset.load_scene_data",
"numpy.random.uniform",
"stereomideval.eval.Timer",
"os.makedirs",
"os.getcwd",
"stereomideval.structures.MatchData.MatchResult",
"stereomideval.eval.Eval.eval_metric",
"os.path.exists",
"stereomideval.dataset.Dataset.download_scene_data"
] | [((817, 872), 'stereomideval.dataset.Dataset.download_scene_data', 'Dataset.download_scene_data', (['SCENE_NAME', 'DATASET_FOLDER'], {}), '(SCENE_NAME, DATASET_FOLDER)\n', (844, 872), False, 'from stereomideval.dataset import Dataset\n'), ((978, 1045), 'stereomideval.dataset.Dataset.load_scene_data', 'Dataset.load_scen... |
"""Data Assimilation Effectiveness Quantification
Module of functions to evaluate the effectiveness of Data Assimilation
methods. Mainly the evaluation of effectiveness is done by computing the
KL-divergence between the analysis ensemble and the background ensemble along
with the data likelihood under the analysis ens... | [
"math.exp",
"math.pow",
"numpy.linalg.det",
"math.log",
"numpy.linalg.solve"
] | [((1710, 1737), 'numpy.linalg.solve', 'np.linalg.solve', (['Ecov', 'Acov'], {}), '(Ecov, Acov)\n', (1725, 1737), True, 'import numpy as np\n'), ((1771, 1807), 'numpy.linalg.solve', 'np.linalg.solve', (['Ecov', '(Amean - Emean)'], {}), '(Ecov, Amean - Emean)\n', (1786, 1807), True, 'import numpy as np\n'), ((1820, 1839)... |
import numpy as np
from queue import Queue
class HeatMatrix:
def __init__(self, size, queue_size, origin=None):
if size <= 1:
raise ValueTooSmallError
if origin is not None:
if origin[0] - size >= 0 or origin[1] - size >= 0:
raise InvalidOriginError
... | [
"numpy.ones",
"numpy.array",
"queue.Queue",
"numpy.argmax"
] | [((520, 542), 'queue.Queue', 'Queue', (['self.queue_size'], {}), '(self.queue_size)\n', (525, 542), False, 'from queue import Queue\n'), ((570, 589), 'numpy.ones', 'np.ones', (['self.shape'], {}), '(self.shape)\n', (577, 589), True, 'import numpy as np\n'), ((851, 870), 'numpy.ones', 'np.ones', (['self.shape'], {}), '(... |
import torch
import numpy as np
from supermariopy.ptutils import compat as ptcompat
def to_numpy(x, permute=False):
"""automatically detach and move to cpu if necessary."""
if isinstance(x, torch.Tensor):
if x.is_cuda:
x = x.detach().cpu().numpy()
else:
x = x.detach().n... | [
"torch.split",
"numpy.transpose",
"torch.cuda.is_available",
"torch.device",
"supermariopy.ptutils.compat.torch_astype",
"torch.tensor",
"torch.from_numpy"
] | [((355, 384), 'numpy.transpose', 'np.transpose', (['x', '(0, 2, 3, 1)'], {}), '(x, (0, 2, 3, 1))\n', (367, 384), True, 'import numpy as np\n'), ((587, 606), 'torch.from_numpy', 'torch.from_numpy', (['x'], {}), '(x)\n', (603, 606), False, 'import torch\n'), ((618, 643), 'torch.cuda.is_available', 'torch.cuda.is_availabl... |
'''
Command line program for ingest to boss
Parses arguments and manages the ingest process
'''
import argparse
import platform
import sys
import time
from collections import defaultdict
from datetime import datetime
from functools import partial
from multiprocessing.dummy import Pool as ThreadPool
import numpy as np... | [
"functools.partial",
"src.ingest.ingest_job.IngestJob",
"numpy.sum",
"argparse.ArgumentParser",
"platform.architecture",
"multiprocessing.dummy.Pool",
"numpy.asarray",
"numpy.zeros",
"time.time",
"collections.defaultdict",
"time.sleep",
"numpy.random.randint",
"numpy.array_equal",
"src.ing... | [((2381, 2474), 'numpy.zeros', 'np.zeros', (['[1, ingest_job.img_size[1], ingest_job.img_size[0]]'], {'dtype': 'ingest_job.datatype'}), '([1, ingest_job.img_size[1], ingest_job.img_size[0]], dtype=\n ingest_job.datatype)\n', (2389, 2474), True, 'import numpy as np\n'), ((4139, 4176), 'numpy.random.randint', 'np.rand... |
from setuptools import setup, find_packages, Extension
from distutils import log
from distutils.sysconfig import customize_compiler
import glob
import os
import platform
import sys
from Cython.Distutils import build_ext
from Cython.Build import cythonize
if sys.platform == 'win32':
VC_INCLUDE_REDIST = False # ... | [
"sys.platform.startswith",
"setuptools.Extension",
"platform.architecture",
"os.path.basename",
"os.walk",
"os.path.exists",
"distutils.msvc9compiler.get_platform",
"platform.mac_ver",
"distutils.sysconfig.customize_compiler",
"numpy.get_include",
"Cython.Distutils.build_ext.build_extensions",
... | [((3820, 3920), 'setuptools.Extension', 'Extension', (['"""quantlib.settings"""', "['quantlib/settings.pyx', 'cpp_layer/ql_settings.cpp']"], {}), "('quantlib.settings', ['quantlib/settings.pyx',\n 'cpp_layer/ql_settings.cpp'], **kwargs)\n", (3829, 3920), False, 'from setuptools import setup, find_packages, Extension... |
"""
ourparams.py
- Intended to hold all standard arguments, either in
- default command line settings OR
- via hardcoded defaults
- Provides command line parsing
- Provides explicit settings for sampler parameters
"""
import argparse
import lalsimulation as lalsim
import RIFT.lalsimutils as lal... | [
"lal.LIGOTimeGPS",
"argparse.ArgumentParser",
"NRWaveformCatalogManager3.internal_ParametersAvailable.keys",
"glue.ligolw.table.get_table",
"numpy.exp",
"RIFT.lalsimutils.nextPow2",
"lalsimulation.GetApproximantFromString",
"numpy.power",
"lalinference.bayestar.fits.read_sky_map",
"numpy.cumsum",
... | [((20933, 20969), 'numpy.max', 'numpy.max', (['[0.05, tWindowExplore[1]]'], {}), '([0.05, tWindowExplore[1]])\n', (20942, 20969), False, 'import numpy\n'), ((20992, 21029), 'numpy.min', 'numpy.min', (['[-0.05, tWindowExplore[0]]'], {}), '([-0.05, tWindowExplore[0]])\n', (21001, 21029), False, 'import numpy\n'), ((1049,... |
"""
@author: <NAME>
@date: 20201101
@contact: <EMAIL>
"""
import os
import logging as logger
import cv2
import numpy as np
import torch
from torch.utils.data import Dataset
logger.basicConfig(level=logger.INFO,
format='%(levelname)s %(asctime)s %(filename)s: %(lineno)d] %(message)s',
... | [
"numpy.fromfile",
"os.path.join",
"logging.basicConfig"
] | [((175, 324), 'logging.basicConfig', 'logger.basicConfig', ([], {'level': 'logger.INFO', 'format': '"""%(levelname)s %(asctime)s %(filename)s: %(lineno)d] %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(level=logger.INFO, format=\n '%(levelname)s %(asctime)s %(filename)s: %(lineno)d] %(message)s',\n da... |
from imutils.face_utils.helpers import FACIAL_LANDMARKS_68_IDXS
from imutils.face_utils.helpers import shape_to_np
import numpy as np
from PIL import Image
from .filter import Filter
from utils import predictor_setup
class MouthClosedException(Exception):
pass
class MouthClosed(Filter):
def __init__(self, ... | [
"PIL.Image.fromarray",
"numpy.linalg.norm",
"utils.predictor_setup",
"imutils.face_utils.helpers.shape_to_np"
] | [((418, 435), 'utils.predictor_setup', 'predictor_setup', ([], {}), '()\n', (433, 435), False, 'from utils import predictor_setup\n'), ((782, 800), 'imutils.face_utils.helpers.shape_to_np', 'shape_to_np', (['shape'], {}), '(shape)\n', (793, 800), False, 'from imutils.face_utils.helpers import shape_to_np\n'), ((1390, 1... |
# -*- coding: utf-8 -*-
"""
Estimate CAT scores and t-scores
@author <NAME>, <NAME>
"""
from __future__ import print_function, division
import numpy as np
from sys import exit
from centroids import centroids
from corpcor.shrink_estimates import crossprod_powcor_shrink
def catscore(Xtrain, L, lambda_cor = None, lambd... | [
"numpy.sum",
"numpy.zeros",
"corpcor.shrink_estimates.crossprod_powcor_shrink",
"centroids.centroids",
"numpy.sqrt"
] | [((1468, 1573), 'centroids.centroids', 'centroids', (['Xtrain', 'L', 'lambda_var', 'lambda_freqs'], {'var_groups': '(False)', 'centered_data': '(True)', 'verbose': 'verbose'}), '(Xtrain, L, lambda_var, lambda_freqs, var_groups=False,\n centered_data=True, verbose=verbose)\n', (1477, 1573), False, 'from centroids imp... |
# coding: utf-8
# In[ ]:
import numpy as np
import pandas as pd
import os
from random import shuffle
from tqdm import tqdm
from skimage import io
from scipy.misc import imresize
import cv2
import tifffile as tiff
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers... | [
"pandas.DataFrame",
"tqdm.tqdm",
"sklearn.metrics.fbeta_score",
"pandas.read_csv",
"numpy.zeros",
"numpy.where",
"numpy.array",
"pandas.concat",
"cv2.resize"
] | [((866, 888), 'pandas.read_csv', 'pd.read_csv', (['TRAIN_CSV'], {}), '(TRAIN_CSV)\n', (877, 888), True, 'import pandas as pd\n'), ((914, 928), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (926, 928), True, 'import pandas as pd\n'), ((1057, 1093), 'pandas.concat', 'pd.concat', (['[train_csv, tags]'], {'axis': '... |
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from itertools import product as iter_prod
import tensorflow as tf
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.layers import Dense, Input
from tensorboard.plugins.hparams i... | [
"tensorflow.summary.scalar",
"tensorflow.keras.layers.Dense",
"os.path.realpath",
"tensorflow.summary.create_file_writer",
"tensorflow.keras.models.Model",
"tensorflow.test.is_gpu_available",
"tensorboard.plugins.hparams.api.Metric",
"tensorflow.keras.layers.Activation",
"tensorboard.plugins.hparams... | [((561, 591), 'tensorflow.keras.losses.KLDivergence', 'tf.keras.losses.KLDivergence', ([], {}), '()\n', (589, 591), True, 'import tensorflow as tf\n'), ((1422, 1442), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(n_in,)'}), '(shape=(n_in,))\n', (1427, 1442), False, 'from tensorflow.keras.layers import Dens... |
"""Collection of utility functions for eniric."""
import collections
import errno
import os
from os.path import join
from typing import Any, List, Optional, Sequence, Tuple, Union
import numpy as np
from astropy import constants as const
from numpy import ndarray
from eniric import config
# Band limits.
bands_ = {
... | [
"os.remove",
"numpy.sum",
"astropy.constants.c.to",
"numpy.abs",
"numpy.asarray",
"numpy.isfinite",
"os.cpu_count",
"Starfish.grid_tools.CIFISTGridInterface",
"Starfish.grid_tools.PHOENIXGridInterface",
"numpy.interp",
"numpy.convolve",
"os.path.join"
] | [((2796, 2824), 'numpy.asarray', 'np.asarray', (['wav'], {'dtype': 'float'}), '(wav, dtype=float)\n', (2806, 2824), True, 'import numpy as np\n'), ((2836, 2865), 'numpy.asarray', 'np.asarray', (['flux'], {'dtype': 'float'}), '(flux, dtype=float)\n', (2846, 2865), True, 'import numpy as np\n'), ((7213, 7234), 'numpy.asa... |
# Copyright 1996-2021 Cyberbotics Ltd.
#
# 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... | [
"geometry.polygon_circle_collision",
"numpy.empty",
"socket.socket",
"gamestate.GameState.sizeof",
"os.path.isfile",
"yaml.safe_load",
"geometry.aabb_circle_collision",
"numpy.linalg.norm",
"geometry.distance2",
"os.path.join",
"os.path.exists",
"socket.gethostname",
"traceback.format_exc",
... | [((1647, 1659), 'controller.Supervisor', 'Supervisor', ([], {}), '()\n', (1657, 1659), False, 'from controller import Supervisor, Node\n'), ((1749, 1758), 'sim_time.SimTime', 'SimTime', ([], {}), '()\n', (1756, 1758), False, 'from sim_time import SimTime\n'), ((1867, 1892), 'types.SimpleNamespace', 'SimpleNamespace', (... |
#!/usr/bin/env python
# This file is copied and adapted from https://github.com/onnx/onnx repository.
# There was no copyright statement on the file at the time of copying.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_litera... | [
"argparse.ArgumentParser",
"os.path.realpath",
"onnxruntime.capi.onnxruntime_pybind11_state.get_all_operator_schema",
"onnxruntime.capi.onnxruntime_pybind11_state.schemadef.OpSchema.is_infinite",
"collections.defaultdict",
"io.open",
"numpy.round",
"os.getenv",
"typing.Text"
] | [((994, 1017), 'onnxruntime.capi.onnxruntime_pybind11_state.schemadef.OpSchema.is_infinite', 'OpSchema.is_infinite', (['v'], {}), '(v)\n', (1014, 1017), False, 'from onnxruntime.capi.onnxruntime_pybind11_state.schemadef import OpSchema\n'), ((1055, 1062), 'typing.Text', 'Text', (['v'], {}), '(v)\n', (1059, 1062), False... |
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution3D, MaxPooling3D
from keras.optimizers import SGD, RMSprop
from keras.utils import np_utils, generic_utils
from... | [
"keras.layers.core.Dense",
"readDataset.readDataset",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"keras.layers.convolutional.Convolution3D",
"keras.layers.convolutional.MaxPooling3D",
"numpy.zeros",
"keras.layers.core.Activation",
"keras.backend.set_image_dim_ordering",
"keras.uti... | [((630, 660), 'keras.backend.set_image_dim_ordering', 'K.set_image_dim_ordering', (['"""th"""'], {}), "('th')\n", (654, 660), True, 'from keras import backend as K\n'), ((1036, 1099), 'readDataset.readDataset', 'readDataset', (['path', 'img_depth', 'color', 'resizeShape', 'interpolation'], {}), '(path, img_depth, color... |
from numpy.testing import assert_almost_equal, assert_raises
import numpy as np
from id3.data import load_data
import uuid
X = np.arange(20).reshape(10, 2)
y = np.arange(10).reshape(10, )
def test_load_data():
assert_raises(IOError, load_data.load_data, str(uuid.uuid4()))
X_, y_, _ = load_data.load_data("tes... | [
"numpy.testing.assert_almost_equal",
"uuid.uuid4",
"numpy.arange",
"id3.data.load_data.load_data"
] | [((296, 342), 'id3.data.load_data.load_data', 'load_data.load_data', (['"""test.csv"""'], {'nominal': '(False)'}), "('test.csv', nominal=False)\n", (315, 342), False, 'from id3.data import load_data\n'), ((347, 373), 'numpy.testing.assert_almost_equal', 'assert_almost_equal', (['X', 'X_'], {}), '(X, X_)\n', (366, 373),... |
import logging
import numpy as np
import pandas as pd
from sklearn.impute import SimpleImputer
from ConfigSpace.hyperparameters import CategoricalHyperparameter, \
UniformFloatHyperparameter, UniformIntegerHyperparameter
from ConfigSpace import Configuration
from ConfigSpace.configuration_space import Configurat... | [
"pandas.DataFrame",
"ConfigSpace.hyperparameters.CategoricalHyperparameter",
"numpy.array",
"logging.getLogger"
] | [((632, 748), 'ConfigSpace.hyperparameters.CategoricalHyperparameter', 'CategoricalHyperparameter', (['"""imputer_strategy"""'], {'choices': "['mean', 'median', 'most_frequent']", 'default_value': '"""mean"""'}), "('imputer_strategy', choices=['mean', 'median',\n 'most_frequent'], default_value='mean')\n", (657, 748... |
import pytest
import numpy as np
import xarray as xr
import xarray.testing as xrt
from xbout.utils import (
_set_attrs_on_all_vars,
_update_metadata_increased_resolution,
_1d_coord_from_spacing,
)
class TestUtils:
def test__set_attrs_on_all_vars(self):
ds = xr.Dataset()
ds["a"] = xr.... | [
"numpy.ones",
"xarray.Dataset",
"xbout.utils._update_metadata_increased_resolution",
"xbout.utils._1d_coord_from_spacing",
"xbout.utils._set_attrs_on_all_vars",
"numpy.arange",
"xarray.DataArray",
"pytest.raises",
"numpy.linspace",
"pytest.mark.parametrize"
] | [((1894, 1984), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""origin_at"""', "[None, 'lower', 'centre', 'upper', 'expectfail']"], {}), "('origin_at', [None, 'lower', 'centre', 'upper',\n 'expectfail'])\n", (1917, 1984), False, 'import pytest\n'), ((3310, 3400), 'pytest.mark.parametrize', 'pytest.mark.p... |
import nest
import numpy as np
import matplotlib.pylab as plt
import itertools
import sys
nest.set_verbosity(100)
def compute_rate(data,time,N,Dt):
"""
Compute the firing rate
:param data: the spike of all neurons between end and begin
:return: the mean and the standard deviation of firing rate, the ... | [
"nest.SetKernelStatus",
"numpy.shape",
"numpy.mean",
"numpy.arange",
"nest.GetKernelStatus",
"nest.ResetKernel",
"matplotlib.pylab.figure",
"nest.SetStatus",
"nest.Simulate",
"numpy.std",
"numpy.max",
"itertools.product",
"numpy.bincount",
"nest.GetStatus",
"numpy.ceil",
"nest.Create",... | [((91, 114), 'nest.set_verbosity', 'nest.set_verbosity', (['(100)'], {}), '(100)\n', (109, 114), False, 'import nest\n'), ((389, 416), 'numpy.searchsorted', 'np.searchsorted', (['time', 'data'], {}), '(time, data)\n', (404, 416), True, 'import numpy as np\n'), ((500, 518), 'numpy.bincount', 'np.bincount', (['n_fil'], {... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Define the IMU sensor used in robotics.
'An inertial measurement unit (IMU) is an electronic device that measures and reports a body's specific force,
angular rate, and sometimes the magnetic field surroundings the body, using a combination of accelerometers
and gyrosco... | [
"numpy.concatenate"
] | [((3823, 3871), 'numpy.concatenate', 'np.concatenate', (['(acceleration, angular_velocity)'], {}), '((acceleration, angular_velocity))\n', (3837, 3871), True, 'import numpy as np\n')] |
"""
Copyright 2018 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | [
"numpy.clip"
] | [((1932, 1997), 'numpy.clip', 'np.clip', (['self.x_offset', '(-self.MAX_X_DISTANCE)', 'self.MAX_X_DISTANCE'], {}), '(self.x_offset, -self.MAX_X_DISTANCE, self.MAX_X_DISTANCE)\n', (1939, 1997), True, 'import numpy as np\n'), ((2099, 2164), 'numpy.clip', 'np.clip', (['self.y_offset', '(-self.MAX_Y_DISTANCE)', 'self.MAX_Y... |
"""Minorization-maximization inference algorithms."""
import itertools
import numpy as np
from .convergence import NormOfDifferenceTest
from .utils import log_transform, exp_transform
def _mm(n_items, data, initial_params, alpha, max_iter, tol, mm_fun):
"""
Iteratively refine MM estimates until convergence.... | [
"networkx.to_scipy_sparse_matrix",
"numpy.asarray",
"numpy.zeros",
"numpy.errstate",
"numpy.arange",
"itertools.chain"
] | [((1035, 1065), 'numpy.zeros', 'np.zeros', (['n_items'], {'dtype': 'float'}), '(n_items, dtype=float)\n', (1043, 1065), True, 'import numpy as np\n'), ((1079, 1109), 'numpy.zeros', 'np.zeros', (['n_items'], {'dtype': 'float'}), '(n_items, dtype=float)\n', (1087, 1109), True, 'import numpy as np\n'), ((2735, 2765), 'num... |
import cv2
from numpy.core.fromnumeric import size
import trimesh
import torch
import h5py
import numpy as np
from os.path import join
from torch.utils.data import Dataset
from glob import glob
class ModelDataset(Dataset):
"""
Dataset for loading single model.
"""
def __init__(self, dataDir, dataList... | [
"numpy.sort",
"cv2.imread",
"numpy.loadtxt",
"numpy.random.choice",
"numpy.random.rand",
"os.path.join",
"numpy.random.shuffle",
"torch.from_numpy"
] | [((795, 818), 'numpy.sort', 'np.sort', (['self.modelList'], {}), '(self.modelList)\n', (802, 818), True, 'import numpy as np\n'), ((1882, 1915), 'numpy.random.shuffle', 'np.random.shuffle', (['self.modelList'], {}), '(self.modelList)\n', (1899, 1915), True, 'import numpy as np\n'), ((4412, 4431), 'numpy.loadtxt', 'np.l... |
import argparse
import scipy.io
import torch
import numpy as np
import os
from torchvision import datasets
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import json
#######################################################################
# Evaluate
parser = argparse.ArgumentParser(description=... | [
"matplotlib.pyplot.title",
"json.dump",
"argparse.ArgumentParser",
"os.path.join",
"matplotlib.pyplot.imshow",
"torch.FloatTensor",
"torch.mm",
"datetime.datetime.now",
"numpy.argsort",
"os.path.isfile",
"matplotlib.use",
"matplotlib.pyplot.imread",
"matplotlib.pyplot.pause"
] | [((126, 147), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (140, 147), False, 'import matplotlib\n'), ((284, 327), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Demo"""'}), "(description='Demo')\n", (307, 327), False, 'import argparse\n'), ((1093, 1129), 'torch.... |
# SPDX-FileCopyrightText: Copyright 2021, <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileType: SOURCE
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the license found in the LICENSE.txt file in the root directory
# of this source tree.
# =======
#... | [
"numpy.array",
"numpy.sqrt"
] | [((4740, 4762), 'numpy.array', 'numpy.array', (['[self.t1]'], {}), '([self.t1])\n', (4751, 4762), False, 'import numpy\n'), ((5935, 6066), 'numpy.sqrt', 'numpy.sqrt', (['(t ** 2 + ((1.0 / self.tau1) ** 2 - (1.0 / self.tau0) ** 2 - self.t1 ** 2) *\n (t / self.t1) + (1.0 / self.tau0) ** 2)'], {}), '(t ** 2 + ((1.0 / s... |
from functools import partial
import numpy as np
class PSO:
def _obj_wrapper(self, func, args, kwargs, x):
return func(x, *args, **kwargs)
def _is_feasible_wrapper(self, func, x):
return np.all(func(x)>=0)
def _cons_none_wrapper(self, x):
return np.array([0])
def _cons_ieqc... | [
"functools.partial",
"numpy.random.uniform",
"numpy.zeros_like",
"numpy.abs",
"numpy.sum",
"numpy.logical_and",
"numpy.zeros",
"numpy.ones",
"numpy.argmin",
"numpy.array",
"numpy.logical_or",
"multiprocessing.Pool",
"numpy.random.rand",
"numpy.all"
] | [((287, 300), 'numpy.array', 'np.array', (['[0]'], {}), '([0])\n', (295, 300), True, 'import numpy as np\n'), ((3633, 3645), 'numpy.array', 'np.array', (['lb'], {}), '(lb)\n', (3641, 3645), True, 'import numpy as np\n'), ((3664, 3676), 'numpy.array', 'np.array', (['ub'], {}), '(ub)\n', (3672, 3676), True, 'import numpy... |
#!/usr/bin/env python3
"""
Class to analyze a single JETSCAPE output file
Author: <NAME> (<EMAIL>)
"""
from __future__ import print_function
# General
import sys
import os
import argparse
import yaml
import numpy as np
# Fastjet via python (from external library heppy)
import fastjet as fj
import ROOT
sys.p... | [
"sys.path.append",
"argparse.ArgumentParser",
"os.path.exists",
"fastjet.ClusterSequence",
"fastjet.SelectorAbsRapMax",
"ROOT.TFile",
"ROOT.TH1F",
"numpy.array",
"yaml.safe_load",
"ROOT.TH2F",
"fastjet.SelectorPtMin",
"fastjet.JetDefinition",
"sys.exit"
] | [((315, 335), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (330, 335), False, 'import sys\n'), ((12676, 12739), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate JETSCAPE events"""'}), "(description='Generate JETSCAPE events')\n", (12699, 12739), False, 'impo... |
import numpy as np
from meta_mb.utils.serializable import Serializable
from gym.spaces import Box
from rand_param_envs.gym.spaces import Box as OldBox
"""
Normalizes the environment class.
Args:
EnvCls (gym.Env): class of the unnormalized gym environment
env_args (dict or None): arguments of the environment
... | [
"numpy.concatenate",
"numpy.zeros",
"meta_mb.utils.serializable.Serializable.__getstate__",
"meta_mb.utils.serializable.Serializable.__setstate__"
] | [((2508, 2539), 'meta_mb.utils.serializable.Serializable.__getstate__', 'Serializable.__getstate__', (['self'], {}), '(self)\n', (2533, 2539), False, 'from meta_mb.utils.serializable import Serializable\n'), ((2597, 2631), 'meta_mb.utils.serializable.Serializable.__setstate__', 'Serializable.__setstate__', (['self', 'd... |
# -*- coding: utf-8 -*-
"""\
Visualizing Parameters in a Modern Neural Network
=================================================
"""
from __future__ import (absolute_import, unicode_literals, print_function)
print(__doc__)
__author__ = '<NAME>'
import sys
import time
import logging
import argparse
import itertools
i... | [
"sys.stdout.write",
"sklearn.datasets.make_circles",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"logging.basicConfig",
"sklearn.preprocessing.StandardScaler",
"sknn.mlp.Layer",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.make_classification",
"numpy.random.RandomState",... | [((679, 767), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(message)s"""', 'level': 'logging.WARNING', 'stream': 'sys.stdout'}), "(format='%(message)s', level=logging.WARNING, stream=sys\n .stdout)\n", (698, 767), False, 'import logging\n'), ((1355, 1380), 'argparse.ArgumentParser', 'argparse.A... |
import signal
import sys # exit command
import numpy as np
######################## Setup Code ###################################
import hebi # for the Hebi motors
from time import sleep
import scipy.io as sio
signal.signal(signal.SIGINT, lambda number, frame: sys.exit())
# Module Names on SUPERball V2
numModule... | [
"hebi.GroupCommand",
"numpy.ones",
"time.sleep",
"sys.exit",
"hebi.Lookup"
] | [((496, 509), 'hebi.Lookup', 'hebi.Lookup', ([], {}), '()\n', (507, 509), False, 'import hebi\n'), ((541, 549), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (546, 549), False, 'from time import sleep\n'), ((1590, 1622), 'hebi.GroupCommand', 'hebi.GroupCommand', (['GroupAll.size'], {}), '(GroupAll.size)\n', (1607, 162... |
from torchvision import datasets, transforms, models
import torch
from PIL import Image
import numpy as np
# TODO: Define transforms for the training data and testing data
train_transforms = transforms.Compose([transforms.RandomRotation(30),
transforms.RandomResizedCrop(224),
... | [
"torch.topk",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomRotation",
"torchvision.transforms.Normalize",
"numpy.clip",
"PIL.Image.open",
"torch.exp",
"numpy.array",
"torch.cuda.is_available",
"torchvision.transforms.CenterCrop",
"torchvision.transforms.RandomResi... | [((1492, 1509), 'PIL.Image.open', 'Image.open', (['image'], {}), '(image)\n', (1502, 1509), False, 'from PIL import Image\n'), ((2322, 2353), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (2330, 2353), True, 'import numpy as np\n'), ((2364, 2395), 'numpy.array', 'np.array', ([... |
# ====================================================
# This code contains the weighted least
# squares method suitable for gamma spectrum
# analysis
#
# Author @ <NAME>
# Email: <EMAIL>
# date 05/25/2021
# ====================================================
import numpy as np
# -*-*-*-*-*-*-*-*-*-*-*-*-*... | [
"numpy.linalg.lstsq",
"numpy.zeros",
"numpy.shape",
"numpy.dot",
"numpy.sqrt"
] | [((448, 459), 'numpy.shape', 'np.shape', (['A'], {}), '(A)\n', (456, 459), True, 'import numpy as np\n'), ((482, 508), 'numpy.zeros', 'np.zeros', (['(self.m, self.m)'], {}), '((self.m, self.m))\n', (490, 508), True, 'import numpy as np\n'), ((552, 567), 'numpy.sqrt', 'np.sqrt', (['self.b'], {}), '(self.b)\n', (559, 567... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... | [
"matplotlib.pyplot.switch_backend",
"abex.plotting.core.plot_2d_slice_through_function",
"numpy.testing.assert_array_equal",
"abex.plotting.core.calc_1d_slice",
"psbutils.filecheck.figure_found",
"numpy.array",
"abex.plotting.core.plot_2d_slice_from_arrays",
"abex.plotting.core.plot_1d_slice_through_f... | [((465, 490), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""Agg"""'], {}), "('Agg')\n", (483, 490), True, 'import matplotlib.pyplot as plt\n'), ((967, 1074), 'abex.plotting.core.calc_1d_slice', 'core.calc_1d_slice', (['summer'], {'dim': '(1)', 'slice_loc': 'slice_loc', 'slice_bounds': '(low, high)', '... |
import basis
import numpy as np
class LinearRegressor():
def __init__(self, basis=basis.SimpleBasis):
self.basis = basis
"""
Args:
X (np.array(shape=(M, D))) : Training Data (M : number of training samples, D : data dimension)
T (np.array(shape=(M,))) : Target Function Values
R... | [
"numpy.linalg.pinv",
"numpy.ones",
"numpy.insert"
] | [((549, 591), 'numpy.ones', 'np.ones', (['designMatrixNonAugmented.shape[0]'], {}), '(designMatrixNonAugmented.shape[0])\n', (556, 591), True, 'import numpy as np\n'), ((631, 659), 'numpy.linalg.pinv', 'np.linalg.pinv', (['designMatrix'], {}), '(designMatrix)\n', (645, 659), True, 'import numpy as np\n'), ((807, 825), ... |
'''
Want to measure first and second moments of simulated stars relative to the simulated G5v stars.
'''
import pickle
import numpy
import pyfits
import _mypath
import chroma
def encode_obshistid(SED_type, filter_name, zenith, seed, redshift):
SED_types = {'G5v':'1', 'star':'2', 'gal':'3'}
SED_digit = SED_t... | [
"numpy.array",
"chroma.ProgressBar",
"numpy.arange",
"numpy.argmin"
] | [((3755, 3778), 'chroma.ProgressBar', 'chroma.ProgressBar', (['(100)'], {}), '(100)\n', (3773, 3778), False, 'import chroma\n'), ((3804, 3832), 'numpy.arange', 'numpy.arange', (['(0.0)', '(3.0)', '(0.03)'], {}), '(0.0, 3.0, 0.03)\n', (3816, 3832), False, 'import numpy\n'), ((2834, 2853), 'numpy.argmin', 'numpy.argmin',... |
from keras.callbacks import TensorBoard, ModelCheckpoint, EarlyStopping, ReduceLROnPlateau,History
from keras.layers import Input, Dense, Dropout
from keras.models import Model, Sequential
from keras.optimizers import SGD
from keras.utils.vis_utils import plot_model
import math
class SAE(object):
"""
Stacked... | [
"numpy.divide",
"keras.optimizers.SGD",
"math.ceil",
"sklearn.cluster.KMeans",
"keras.datasets.mnist.load_data",
"sklearn.metrics.normalized_mutual_info_score",
"keras.layers.Dropout",
"keras.models.Model",
"keras.layers.Dense",
"keras.layers.Input",
"keras.models.Sequential",
"numpy.concatena... | [((9107, 9136), 'sklearn.cluster.KMeans', 'KMeans', (['n_clusters'], {'n_init': '(20)'}), '(n_clusters, n_init=20)\n', (9113, 9136), False, 'from sklearn.cluster import KMeans\n'), ((2231, 2273), 'keras.layers.Input', 'Input', ([], {'shape': '(self.dims[0],)', 'name': '"""input"""'}), "(shape=(self.dims[0],), name='inp... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
import numpy as np
from ...testing import utils
from .. import nilearn as iface
from ...pipeline import engine as pe
import pytest
import numpy.testing as npt
no_nilearn = True
try:
__imp... | [
"os.path.abspath",
"numpy.testing.assert_almost_equal",
"pytest.fixture",
"pytest.raises",
"pytest.mark.skipif",
"numpy.array"
] | [((391, 468), 'pytest.mark.skipif', 'pytest.mark.skipif', (['no_nilearn'], {'reason': '"""the nilearn library is not available"""'}), "(no_nilearn, reason='the nilearn library is not available')\n", (409, 468), False, 'import pytest\n'), ((769, 812), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)', 'scope... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# <NAME>
#
import sys
import os
import pandas as pd
from glob import glob
import numpy as np
import random
# Sklearn
from sklearn import linear_model
from sklearn import ensemble
from sklearn import svm
from sklearn import model_selection
from sklearn import metrics
# ... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"matplotlib.pyplot.bar",
"sklearn.metrics.r2_score",
"matplotlib.pyplot.figure",
"numpy.mean",
"glob.glob",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.tight_layout",
"numpy.std",
"matplotlib.pyplot.close",
"numpy.linspace",
"matplotlib.... | [((1208, 1242), 'os.makedirs', 'os.makedirs', (['outdir'], {'exist_ok': '(True)'}), '(outdir, exist_ok=True)\n', (1219, 1242), False, 'import os\n'), ((4304, 4318), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (4316, 4318), True, 'import matplotlib.pyplot as plt\n'), ((4323, 4396), 'matplotlib.pyplot... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 09:25:46 2020
CryoSolver package
@author: <NAME>, <NAME>
TU Dresden 2020
"""
"""
.........................................................................
solver.py
The library of functions and classes to setup and simulate the cycle
"""
from sys impor... | [
"numpy.abs",
"numpy.amin",
"cryosolver.refpropfunc.vaporstring",
"cryosolver.refpropfunc.MassComposition",
"cryosolver.refpropfunc.liquidstring",
"matplotlib.pyplot.figure",
"numpy.interp",
"numpy.round",
"numpy.zeros_like",
"numpy.savetxt",
"numpy.append",
"cryosolver.refpropfunc.P_TS",
"nu... | [((69771, 69823), 'scipy.optimize.root', 'opt.root', (['mainfunction', 'mainvar.guess'], {'method': '"""hybr"""'}), "(mainfunction, mainvar.guess, method='hybr')\n", (69779, 69823), True, 'import scipy.optimize as opt\n'), ((1081, 1100), 'cryosolver.refpropfunc.fluid', 'RF.fluid', (['fluidlist'], {}), '(fluidlist)\n', ... |
"""Custom scorer for detecting and reducing bias in machine learning models."""
"""
Custom scorer for detecting and reducing bias in machine learning models.
Based upon https://arxiv.org/abs/1903.04561.
The scorer penalizes models/features which favour a particular subgroup (the "privileged group") over another grou... | [
"numpy.array",
"numpy.average"
] | [((3119, 3171), 'numpy.average', 'np.average', (['scores'], {'weights': '[0.25, 0.25, 0.25, 0.25]'}), '(scores, weights=[0.25, 0.25, 0.25, 0.25])\n', (3129, 3171), True, 'import numpy as np\n'), ((3297, 3313), 'numpy.array', 'np.array', (['y_true'], {}), '(y_true)\n', (3305, 3313), True, 'import numpy as np\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import pandas as pd
from typing import Text, Union
import urllib.request
import copy
from ...utils import get_or_create_path
from ...log import g... | [
"numpy.load",
"numpy.random.seed",
"torch.eye",
"numpy.isnan",
"numpy.mean",
"torch.nn.Softmax",
"torch.device",
"torch.no_grad",
"torch.isnan",
"torch.t",
"torch.ones",
"torch.get_device",
"torch.load",
"os.path.exists",
"numpy.cumsum",
"torch.nn.Linear",
"torch.nn.LSTM",
"numpy.r... | [((4286, 4302), 'torch.mean', 'torch.mean', (['loss'], {}), '(loss)\n', (4296, 4302), False, 'import torch\n'), ((4574, 4595), 'torch.isfinite', 'torch.isfinite', (['label'], {}), '(label)\n', (4588, 4595), False, 'import torch\n'), ((5609, 5636), 'numpy.load', 'np.load', (['self.stock2concept'], {}), '(self.stock2conc... |
import numpy as np
import torch
import logging
import os
import urllib
from os.path import join as join
import urllib.request
from cormorant.data.prepare.process import process_xyz_files, process_xyz_gdb9
from cormorant.data.prepare.utils import download_data, is_int, cleanup_file
def download_dataset_qm9(datadir,... | [
"cormorant.data.prepare.utils.is_int",
"cormorant.data.prepare.process.process_xyz_files",
"numpy.random.seed",
"os.makedirs",
"numpy.split",
"logging.info",
"urllib.request.urlretrieve",
"numpy.savez_compressed",
"numpy.random.permutation",
"os.path.join",
"cormorant.data.prepare.utils.cleanup_... | [((529, 555), 'os.path.join', 'join', (['*[datadir, dataname]'], {}), '(*[datadir, dataname])\n', (533, 555), True, 'from os.path import join as join\n'), ((603, 638), 'os.makedirs', 'os.makedirs', (['gdb9dir'], {'exist_ok': '(True)'}), '(gdb9dir, exist_ok=True)\n', (614, 638), False, 'import os\n'), ((764, 815), 'logg... |
# ******************************************************************************
# Copyright 2014-2018 Intel Corporation
#
# 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.apa... | [
"ngraph.dot",
"ngraph.frontends.neon.GradientDescentMomentum",
"ngraph.frontends.neon.Adam",
"pytest.config.flex_skip",
"pytest.config.flex_disabled",
"numpy.random.randint",
"pytest.mark.parametrize",
"ngraph.frontends.neon.LearningRateOptimizer",
"numpy.prod",
"numpy.zeros_like",
"ngraph.place... | [((7865, 7894), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[0, 1]'}), '(params=[0, 1])\n', (7879, 7894), False, 'import pytest\n'), ((7956, 7991), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[0, 1, 2, 3]'}), '(params=[0, 1, 2, 3])\n', (7970, 7991), False, 'import pytest\n'), ((8053, 8150), 'pytest.co... |
#Nessas linhas de codigo o objetivo é calcular a taxa media de retorno anual para um portfolio
import numpy as np
import pandas as pd
from pandas_datareader import data as wb
import matplotlib.pyplot as plt
tickers = ['AAPL', 'MSFT', 'PG', 'GE']
new_data = pd.DataFrame()
for t in tickers:
new_d... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"pandas_datareader.data.DataReader",
"numpy.array",
"numpy.dot"
] | [((273, 287), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (285, 287), True, 'import pandas as pd\n'), ((1073, 1083), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1081, 1083), True, 'import matplotlib.pyplot as plt\n'), ((1454, 1488), 'numpy.array', 'np.array', (['[0.25, 0.25, 0.25, 0.25]'], {}), '... |
import os
import cv2
import h5py
import numpy as np
import base64
import requests
# from extract_cnn_resnet50_rota import VGGNet
from extract_cnn_scda_rota import SCDANet
import lbp
import utils
'''
Returns a list of filenames for all jpg images in a directory.
'''
def get_imlist(database):
databasePath = os... | [
"numpy.argsort",
"requests.post",
"os.path.join",
"cv2.cvtColor",
"cv2.imwrite",
"lbp.get_hist",
"cv2.resize",
"h5py.File",
"cv2.Canny",
"cv2.bitwise_not",
"numpy.string_",
"numpy.dot",
"os.listdir",
"os.makedirs",
"numpy.zeros",
"cv2.imread",
"numpy.array",
"os.path.split",
"ext... | [((318, 357), 'os.path.join', 'os.path.join', (['utils.DATABASES', 'database'], {}), '(utils.DATABASES, database)\n', (330, 357), False, 'import os\n'), ((362, 402), 'os.makedirs', 'os.makedirs', (['databasePath'], {'exist_ok': '(True)'}), '(databasePath, exist_ok=True)\n', (373, 402), False, 'import os\n'), ((588, 615... |
from __future__ import print_function
import argparse
import io
import json
import os
import pickle
import re
#from collections import defaultdict as defdict
import operator
import string
import numpy as np
from keras.preprocessing.sequence import pad_sequences
from tqdm import tqdm
import time
from nltk.corpus impo... | [
"numpy.load",
"pickle.dump",
"argparse.ArgumentParser",
"keras.preprocessing.sequence.pad_sequences",
"util.get_snli_file_path",
"pickle.load",
"numpy.linalg.norm",
"os.path.join",
"numpy.pad",
"util.get_word2vec_file_path",
"util.get_multinli_file_path",
"json.loads",
"os.path.dirname",
"... | [((748, 773), 'numpy.array', 'np.array', (['res'], {'copy': '(False)'}), '(res, copy=False)\n', (756, 773), True, 'import numpy as np\n'), ((21684, 21769), 'keras.preprocessing.sequence.pad_sequences', 'pad_sequences', (['word_ids_p'], {'maxlen': 'p', 'padding': '"""post"""', 'truncating': '"""post"""', 'value': '(0.0)... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 11 20:02:37 2017
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
import interpolation
def f1(x):
"""Evaluates x^2-2x+3"""
return np.polyval([3, -2, 1], x)
def f2(x):
"""Evaluates cos(pi * x)"""
return np.cos(np.pi*x)
def f3(x)... | [
"interpolation.lSquaresMonomial",
"interpolation.lSquaresOrthogonal",
"numpy.polyval",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.zeros",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.exp",
"numpy.cos",
"numpy.polynomial.legendre.legval",
"matplotlib.pyp... | [((682, 703), 'numpy.arange', 'np.arange', (['a', 'b', '(0.01)'], {}), '(a, b, 0.01)\n', (691, 703), True, 'import numpy as np\n'), ((705, 721), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (714, 721), True, 'import matplotlib.pyplot as plt\n'), ((728, 775), 'interpolation.lSquaresMonomial'... |
from numpy import vstack
from pyNastran.converters.stl.stl import STL
# merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None, log=None):
def merge_stl_files(stl_filenames, stl_out_filename=None, remove_bad_elements=False,
is_binary=True, float_fmt='%6.12f'):
"""
Combines multip... | [
"pyNastran.converters.stl.stl.STL",
"numpy.vstack"
] | [((1779, 1792), 'numpy.vstack', 'vstack', (['nodes'], {}), '(nodes)\n', (1785, 1792), False, 'from numpy import vstack\n'), ((1814, 1830), 'numpy.vstack', 'vstack', (['elements'], {}), '(elements)\n', (1820, 1830), False, 'from numpy import vstack\n'), ((1175, 1180), 'pyNastran.converters.stl.stl.STL', 'STL', ([], {}),... |
from __future__ import absolute_import, division, print_function
"""
Author : Lyubimov, A.Y.
Created : 03/31/2020
Last Changed: 05/15/2020
Description : Streaming stills processor for live data analysis
"""
import copy
import time # noqa: F401; keep around for testing
import numpy as np
from cctbx import ... | [
"dxtbx.model.experiment_list.ExperimentListFactory.from_filenames",
"dials.command_line.refine_bravais_settings.phil_scope.fetch",
"interceptor.packagefinder",
"dials.algorithms.spot_finding.per_image_analysis.ice_rings_selection",
"cctbx.uctbx.d_as_d_star_sq",
"numpy.mean",
"dials.algorithms.spot_findi... | [((2056, 2085), 'iotbx.phil.parse', 'ip.parse', (['custom_param_string'], {}), '(custom_param_string)\n', (2064, 2085), True, 'from iotbx import phil as ip\n'), ((2227, 2238), 'time.time', 'time.time', ([], {}), '()\n', (2236, 2238), False, 'import time\n'), ((2243, 2282), 'interceptor.format.FormatEigerStreamSSRL.inje... |
import numpy as np
#=======================================================================
class Driver:
def __init__(self, od_pair, actions, initial_costs=None, extrapolate_costs=True, navigation_app=None, time_flexibility=0.5, flow=1.0):
#self.__name = 'Driver_%i' % identifier
self.__OD_pair = od_pair
... | [
"numpy.random.random"
] | [((4282, 4300), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (4298, 4300), True, 'import numpy as np\n'), ((4340, 4358), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (4356, 4358), True, 'import numpy as np\n')] |
# -*-coding:utf-8 -*-
# Keras情感分析(Sentiment Analysis)实战
import time
import numpy as np
from gensim.models.word2vec import Word2Vec
from gensim.corpora.dictionary import Dictionary
from gensim import models
import pandas as pd
import jieba
import logging
from keras import Sequential
from keras.preprocessing.sequence im... | [
"numpy.argmax",
"keras.preprocessing.sequence.pad_sequences",
"sklearn.model_selection.train_test_split",
"keras.Sequential",
"keras.layers.Dropout",
"numpy.zeros",
"keras.layers.Activation",
"keras.layers.LSTM",
"time.time",
"keras.utils.np_utils.to_categorical",
"keras.layers.Dense",
"numpy.... | [((1994, 2025), 'gensim.models.word2vec.Word2Vec.load', 'Word2Vec.load', (['"""word2vec.model"""'], {}), "('word2vec.model')\n", (2007, 2025), False, 'from gensim.models.word2vec import Word2Vec\n'), ((5180, 5191), 'time.time', 'time.time', ([], {}), '()\n', (5189, 5191), False, 'import time\n'), ((5250, 5261), 'time.t... |
import logging
from collections import (OrderedDict, namedtuple)
from threading import RLock
import numpy as np
from .engine import (Engine, Parameter)
from .sample import HklSample
from . import util
from .util import hkl_module
from .context import UsingEngine
logger = logging.getLogger(__name__)
NM_KEV = 1.23984... | [
"numpy.linspace",
"threading.RLock",
"numpy.array",
"logging.getLogger"
] | [((275, 302), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (292, 302), False, 'import logging\n'), ((905, 912), 'threading.RLock', 'RLock', ([], {}), '()\n', (910, 912), False, 'from threading import RLock\n'), ((10961, 10976), 'numpy.array', 'np.array', (['start'], {}), '(start)\n', (1... |
#
# TensorFlow training and running routines and classes.
#
# Copyright (C) 2017, IDEAConsult Ltd.
# Author: <NAME>) Georgiev
#
"""
The TensorFlow hooks which are defined here:
@@FeedDataHook
@@TrainLogHook
@@ProbabilisticOpsHook
@@ValidationHook
"""
from .tf_utils import *
from .dt_constants import DEF_DISPLAY_STEP... | [
"numpy.array",
"numpy.random.random",
"tensorflow.python.platform.tf_logging.info",
"numpy.argmax"
] | [((5061, 5079), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (5077, 5079), True, 'import numpy as np\n'), ((3893, 3967), 'tensorflow.python.platform.tf_logging.info', 'tf_logging.info', (["('Step: %04d, training loss: %.9f' % (self._counter, loss))"], {}), "('Step: %04d, training loss: %.9f' % (self._co... |
import random
import string
import string
import re
import numpy as np
import time
words = string.ascii_lowercase
class board:
def __init__(self, n_grid=None):
if n_grid == None:
n_grid = 9
self.n_grid = n_grid
self.cur = [[" " for _ in range(self.n_grid)] for _ in range(self.... | [
"numpy.random.choice"
] | [((1507, 1570), 'numpy.random.choice', 'np.random.choice', (['(self.n_grid ** 2)', 'self.n_mines'], {'replace': '(False)'}), '(self.n_grid ** 2, self.n_mines, replace=False)\n', (1523, 1570), True, 'import numpy as np\n')] |
import json
import sys
sys.dont_write_bytecode = True
import numpy as np
import datetime
import random
import math
import core
def run(debug):
# this strategy works best at 1hr intervals
# 1. the idea is based on calculating the slope of the current price (which is a random price at interval 't') against th... | [
"datetime.datetime.strftime",
"numpy.average",
"numpy.std",
"core.getPriceExchange_v1",
"core.addToScatterTrace",
"json.dumps",
"core.createNewScatterTrace",
"core.portfolioBuy",
"datetime.datetime.strptime",
"core.portfolioSell",
"datetime.timedelta",
"core.processPortfolio",
"core.portfoli... | [((595, 659), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['"""2018-05-01 12:00"""', '"""%Y-%m-%d %H:%M"""'], {}), "('2018-05-01 12:00', '%Y-%m-%d %H:%M')\n", (621, 659), False, 'import datetime\n'), ((672, 736), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['"""2018-05-26 12:00"""', '"... |
from pyqtgraph.parametertree import Parameter
# from . import something
from loguru import logger
from exsu import Report
import numpy as np
import os
# from pathlib import Path
import copy
# from matplotlib import pyplot as plt
# import cv2
# import skimage
import numpy as np
from pathlib import Path
# import skimage... | [
"pyqtgraph.parametertree.Parameter.create",
"skimage.feature.peak_local_max",
"numpy.amin",
"numpy.argmax",
"numpy.ones",
"numpy.argmin",
"exsu.Report",
"numpy.mean",
"skimage.measure.label",
"numpy.linalg.norm",
"skimage.measure.regionprops",
"numpy.prod",
"numpy.unique",
"os.path.abspath... | [((995, 1020), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1010, 1020), False, 'import os\n'), ((13436, 13467), 'scipy.optimize.linear_sum_assignment', 'linear_sum_assignment', (['comp_mat'], {}), '(comp_mat)\n', (13457, 13467), False, 'from scipy.optimize import linear_sum_assignment\n')... |
"""
Set stage
Ensures water height is non-negative
"""
__author__="steve"
__date__ ="$09/03/2012 4:46:39 PM$"
from anuga import Domain
from anuga import Quantity
import numpy as num
import anuga.utilities.log as log
from anuga.geometry.polygon import inside_polygon
from anuga.operators.set_quantity import Set_qua... | [
"anuga.operators.set_quantity.Set_quantity.__init__",
"numpy.maximum"
] | [((853, 1029), 'anuga.operators.set_quantity.Set_quantity.__init__', 'Set_quantity.__init__', (['self', 'domain', '"""stage"""'], {'value': 'stage', 'indices': 'indices', 'polygon': 'polygon', 'center': 'center', 'radius': 'radius', 'line': 'line', 'verbose': 'verbose', 'test_stage': '(False)'}), "(self, domain, 'stage... |
import copy
#import cupy as cp
from chainercv.links.model.ssd import random_crop_with_bbox_constraints
from chainercv.links.model.ssd import random_distort
from chainercv.links.model.ssd import resize_with_random_interpolation
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from chainercv im... | [
"numpy.load",
"numpy.ones",
"chainercv.links.model.ssd.resize_with_random_interpolation",
"numpy.random.randint",
"chainercv.transforms.resize_bbox",
"matplotlib.pyplot.imshow",
"numpy.transpose",
"cupy.asnumpy",
"cv2.resize",
"numpy.uint8",
"matplotlib.pyplot.show",
"chainercv.transforms.flip... | [((556, 584), 'numpy.array', 'np.array', (['[mask, mask, mask]'], {}), '([mask, mask, mask])\n', (564, 584), True, 'import numpy as np\n'), ((598, 628), 'numpy.transpose', 'np.transpose', (['mask_', '(1, 2, 0)'], {}), '(mask_, (1, 2, 0))\n', (610, 628), True, 'import numpy as np\n'), ((921, 949), 'numpy.transpose', 'np... |
import math
import numpy as np
import scipy.signal
import scipy.stats
import pandas as pd
import matplotlib.pyplot as plt
from typing import List, Union, Optional
from signalanalysis import tools
plt.style.use('seaborn')
class Signal:
"""Base class for general signal, either ECG or VCG
Attributes
-----... | [
"numpy.abs",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"signalanalysis.tools.maths.filter_savitzkygolay",
"numpy.std",
"numpy.max",
"pandas.isna",
"signalanalysis.tools.maths.normalise_signal",
"math.ceil",
"numpy.median",
"numpy.asarray",
"numpy.min",
... | [((198, 222), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn"""'], {}), "('seaborn')\n", (211, 222), True, 'import matplotlib.pyplot as plt\n'), ((2810, 2835), 'pandas.DataFrame', 'pd.DataFrame', ([], {'dtype': 'float'}), '(dtype=float)\n', (2822, 2835), True, 'import pandas as pd\n'), ((4122, 4147), 'pa... |
#!/usr/bin/env python
# Copyright (c) 2017-present, Facebook, Inc.
#
# 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 a... | [
"h5py.File",
"numpy.zeros",
"numpy.swapaxes",
"detectron.datasets.json_dataset.JsonDataset"
] | [((1227, 1252), 'detectron.datasets.json_dataset.JsonDataset', 'JsonDataset', (['dataset_name'], {}), '(dataset_name)\n', (1238, 1252), False, 'from detectron.datasets.json_dataset import JsonDataset\n'), ((1335, 1358), 'h5py.File', 'h5py.File', (['file_in', '"""r"""'], {}), "(file_in, 'r')\n", (1344, 1358), False, 'im... |
from unittest import TestCase
from pyanp.mcanp import *
from pyanp.pairwise import Pairwise
import numpy as np
import pandas as pd
import numpy.testing as npt
class TestMCAnp(TestCase):
def test_amscale(self):
"""
Testing our conversion functions between additive and
multiplicative scales.... | [
"numpy.testing.assert_allclose",
"numpy.array",
"pandas.Series"
] | [((1772, 1827), 'numpy.array', 'np.array', (['[[1, 2, 6], [1 / 2, 1, 3], [1 / 4, 1 / 3, 1]]'], {}), '([[1, 2, 6], [1 / 2, 1, 3], [1 / 4, 1 / 3, 1]])\n', (1780, 1827), True, 'import numpy as np\n'), ((1937, 1987), 'numpy.testing.assert_allclose', 'npt.assert_allclose', (['[0.6, 0.3, 0.1]', 's1'], {'rtol': 'err'}), '([0.... |
#!/usr/bin/env python
# coding: utf-8
# # Project 3 | Phase 2 | ENPM 661 | Planning for Autonomous Robots |
#SUBMISSION : March 20, 2020
#GITHUB: https://github.com/govindak-umd/ENPM661/tree/master/Project%203/Project%203%20Phase%202
#YOUTUBE: https://www.youtube.com/watch?v=VBzvzb2vaYg&feature=emb_logo
# A* Algori... | [
"matplotlib.pyplot.title",
"heapq.heappush",
"pygame.event.get",
"matplotlib.pyplot.quiver",
"cv2.imshow",
"cv2.imwrite",
"pygame.display.set_mode",
"pygame.display.set_caption",
"cv2.destroyAllWindows",
"matplotlib.pyplot.subplots",
"cv2.resize",
"pygame.quit",
"matplotlib.pyplot.show",
"... | [((611, 622), 'time.time', 'time.time', ([], {}), '()\n', (620, 622), False, 'import time\n'), ((11270, 11303), 'numpy.zeros', 'np.zeros', (['(rows, columns, layers)'], {}), '((rows, columns, layers))\n', (11278, 11303), True, 'import numpy as np\n'), ((18592, 18646), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""P... |
'''
Fully CNN approach
'''
import argparse
from math import floor, log2
from os import fsync, mkdir, path
from shutil import rmtree
from sys import stdout
import numpy as np
import tensorflow as tf
from scipy.stats import kendalltau, spearmanr
from tensorflow.contrib import learn
# from trend_clstr import DTWDistance... | [
"os.mkdir",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.argsort",
"tensorflow.ConfigProto",
"numpy.mean",
"sys.stdout.flush",
"numpy.arange",
"tensorflow.layers.max_pooling2d",
"scipy.stats.kendalltau",
"shutil.rmtree",
"tensorflow.GPUOptions",
"os.path.join",
"tensorflow.nn.relu",
"t... | [((871, 895), 'numpy.take', 'np.take', (['tg', 'ids'], {'axis': '(0)'}), '(tg, ids, axis=0)\n', (878, 895), True, 'import numpy as np\n'), ((1004, 1029), 'numpy.take', 'np.take', (['a2v', 'ids'], {'axis': '(0)'}), '(a2v, ids, axis=0)\n', (1011, 1029), True, 'import numpy as np\n'), ((1138, 1164), 'numpy.take', 'np.take... |
''' ---- SQream Native Python API ---- '''
import socket, json, ssl, logging, time, traceback, asyncio, sys, array, _thread as thread, threading
from struct import pack, pack_into, unpack, error as struct_error
from datetime import datetime, date, time as t
import multiprocessing as mp
fro... | [
"multiprocessing.Lock",
"pyarrow.csv.read_csv",
"socket.socket",
"pyarrow.int32",
"pyarrow.csv.ReadOptions",
"logging.getLogger",
"json.dumps",
"logging.Formatter",
"ssl.wrap_socket",
"mmap.mmap",
"logging.FileHandler",
"json.loads",
"pyarrow.csv.ConvertOptions",
"pyarrow.int16",
"struct... | [((2237, 2270), 'logging.getLogger', 'logging.getLogger', (['"""dbapi_logger"""'], {}), "('dbapi_logger')\n", (2254, 2270), False, 'import socket, json, ssl, logging, time, traceback, asyncio, sys, array, _thread as thread, threading\n'), ((6165, 6179), 'decimal.Decimal', 'Decimal', (['"""0.1"""'], {}), "('0.1')\n", (6... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by <NAME> <<EMAIL>>, March 2017
"""BCubed metrics (clustering validation).
This module aims at giving a simple and fas... | [
"numpy.array"
] | [((3515, 3531), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (3523, 3531), True, 'import numpy as np\n'), ((3608, 3629), 'numpy.array', 'np.array', (['true_labels'], {}), '(true_labels)\n', (3616, 3629), True, 'import numpy as np\n')] |
# Copyright (c) 2019, NVIDIA CORPORATION. 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 applic... | [
"numpy.full",
"numpy.sum",
"numpy.abs",
"kaolin.cuda.mesh_intersection.forward_cuda",
"numpy.cross",
"numpy.zeros",
"numpy.mod",
"torch.index_select",
"kaolin.triangle_hash.TriangleHash",
"torch.max",
"numpy.array",
"numpy.sign",
"torch.zeros",
"numpy.bincount",
"torch.abs",
"numpy.all... | [((2341, 2366), 'torch.zeros', 'torch.zeros', (['batchsize', 'n'], {}), '(batchsize, n)\n', (2352, 2366), False, 'import torch\n'), ((2403, 2461), 'kaolin.cuda.mesh_intersection.forward_cuda', 'mint.forward_cuda', (['points', 'verts_1', 'verts_2', 'verts_3', 'ints'], {}), '(points, verts_1, verts_2, verts_3, ints)\n', ... |
import os
import numpy as np
import matplotlib.pyplot as plt
a = os.system("g++ funcion.cpp -o f")
a = os.system("./f > data.txt")
datos=np.loadtxt("data.txt")
plt.hist(datos, bins=40)
plt.grid(True)
plt.tittle('')
plt.savefig("Ej22.png") | [
"matplotlib.pyplot.tittle",
"matplotlib.pyplot.hist",
"os.system",
"numpy.loadtxt",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig"
] | [((67, 100), 'os.system', 'os.system', (['"""g++ funcion.cpp -o f"""'], {}), "('g++ funcion.cpp -o f')\n", (76, 100), False, 'import os\n'), ((105, 132), 'os.system', 'os.system', (['"""./f > data.txt"""'], {}), "('./f > data.txt')\n", (114, 132), False, 'import os\n'), ((140, 162), 'numpy.loadtxt', 'np.loadtxt', (['""... |
# -*- coding: utf-8 -*-
"""
Core module defining elementary class and methods for SizingLab
"""
# -------[Import necessary packages]--------------------------------------------
import sys
import pint
import warnings
import logging
import sympy
import numpy
from collections import OrderedDict
from IPython.display impor... | [
"pint.UnitRegistry",
"sympy.sympify",
"numpy.shape",
"logging.captureWarnings",
"numpy.array",
"IPython.display.Math",
"collections.OrderedDict",
"warnings.warn"
] | [((2207, 2226), 'pint.UnitRegistry', 'pint.UnitRegistry', ([], {}), '()\n', (2224, 2226), False, 'import pint\n'), ((18831, 18860), 'logging.captureWarnings', 'logging.captureWarnings', (['(True)'], {}), '(True)\n', (18854, 18860), False, 'import logging\n'), ((22170, 22200), 'logging.captureWarnings', 'logging.capture... |
#!/usr/bin/env python3
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout, exit, stderr
import os, time, traceback
import parmed as pmd
import numpy as np
import mdtraj as mdt
###### convert time seconds to hours ######
def convert_time(seconds):
return second... | [
"traceback.print_exc",
"os.path.getsize",
"os.path.exists",
"os.system",
"time.time",
"mdtraj.load",
"numpy.histogram",
"numpy.max",
"numpy.arange",
"numpy.array",
"parmed.load_file",
"sys.exit",
"parmed.openmm.reporters.RestartReporter"
] | [((2616, 2648), 'os.path.exists', 'os.path.exists', (["(outname + '.out')"], {}), "(outname + '.out')\n", (2630, 2648), False, 'import os, time, traceback\n'), ((5247, 5269), 'parmed.load_file', 'pmd.load_file', (['psffile'], {}), '(psffile)\n', (5260, 5269), True, 'import parmed as pmd\n'), ((8374, 8385), 'time.time',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import pickle
from scipy.stats import kendalltau, spearmanr
from scipy.stats import rankdata
import pandas as pd
import time
#def getFileListWithGivenTag(dataBase,tag):
def getOneHotClasses(gt,numClasses):
oneHot=[]
for i in range(len(gt)):... | [
"pandas.read_csv",
"numpy.zeros",
"time.time",
"numpy.mean",
"numpy.array"
] | [((435, 451), 'numpy.array', 'np.array', (['oneHot'], {}), '(oneHot)\n', (443, 451), True, 'import numpy as np\n'), ((628, 649), 'numpy.mean', 'np.mean', (['fts1'], {'axis': '(2)'}), '(fts1, axis=2)\n', (635, 649), True, 'import numpy as np\n'), ((944, 955), 'time.time', 'time.time', ([], {}), '()\n', (953, 955), False... |
import numpy as np
import copy
import scipy.linalg
import mps.truncate
from mps import expectation
DEFAULT_TOLERANCE = np.finfo(np.float64).eps
def vector2mps(ψ, dimensions, tolerance=DEFAULT_TOLERANCE, normalize=True):
"""Construct a list of tensors for an MPS that approximates the state ψ
repres... | [
"numpy.abs",
"numpy.argmax",
"numpy.einsum",
"numpy.ones",
"numpy.product",
"numpy.arange",
"numpy.exp",
"numpy.linalg.norm",
"mps.expectation.all_expectation1",
"numpy.prod",
"mps.expectation.begin_environment",
"numpy.eye",
"numpy.finfo",
"numpy.cumsum",
"numpy.reshape",
"numpy.swapa... | [((126, 146), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (134, 146), True, 'import numpy as np\n'), ((1132, 1166), 'numpy.array', 'np.array', (['dimensions'], {'dtype': 'np.int'}), '(dimensions, dtype=np.int)\n', (1140, 1166), True, 'import numpy as np\n'), ((1177, 1196), 'numpy.prod', 'np.prod'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.