code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from hypothesis import assume, given
import hypothesis.strategies as st
import numpy as np
from caffe2.proto import caffe2_pb2
from caffe2.python import ... | [
"unittest.main",
"unittest.skipIf",
"caffe2.python.hypothesis_test_util.tensor",
"numpy.ones",
"hypothesis.strategies.booleans",
"caffe2.python.core.CreateOperator",
"hypothesis.strategies.floats"
] | [((430, 495), 'unittest.skipIf', 'unittest.skipIf', (['(not workspace.C.use_mkldnn)', '"""No MKLDNN support."""'], {}), "(not workspace.C.use_mkldnn, 'No MKLDNN support.')\n", (445, 495), False, 'import unittest\n'), ((1467, 1524), 'unittest.skipIf', 'unittest.skipIf', (['(True)', '"""Skip duo to different rand seed.""... |
# Python imports
import unittest
import numpy as np
import os
import shutil
import xarray as xr
import pytest
import oggm
from scipy import optimize as optimization
salem = pytest.importorskip('salem')
gpd = pytest.importorskip('geopandas')
# Locals
import oggm.cfg as cfg
from oggm import tasks, utils, workflow
from ... | [
"oggm.tasks.init_present_time_glacier",
"oggm.core.centerlines.compute_centerlines",
"oggm.core.centerlines.catchment_width_correction",
"numpy.sum",
"oggm.cfg.initialize",
"numpy.polyfit",
"numpy.abs",
"oggm.core.centerlines.compute_downstream_bedshape",
"xarray.zeros_like",
"oggm.core.centerline... | [((174, 202), 'pytest.importorskip', 'pytest.importorskip', (['"""salem"""'], {}), "('salem')\n", (193, 202), False, 'import pytest\n'), ((209, 241), 'pytest.importorskip', 'pytest.importorskip', (['"""geopandas"""'], {}), "('geopandas')\n", (228, 241), False, 'import pytest\n'), ((547, 580), 'pytest.mark.test_env', 'p... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"autoregressive_diffusion.utils.util_fns.sum_except_batch",
"absl.logging.info",
"jax.lax.axis_index",
"autoregressive_diffusion.model.autoregressive_diffusion.ardm_utils.get_batch_permutations",
"autoregressive_diffusion.model.autoregressive_diffusion.ardm_utils.get_selections_for_sigma_and_range",
"jax.... | [((1649, 1689), 'flax.training.common_utils.onehot', 'common_utils.onehot', (['targets', 'vocab_size'], {}), '(targets, vocab_size)\n', (1668, 1689), False, 'from flax.training import common_utils\n'), ((1766, 1792), 'numpy.prod', 'np.prod', (['targets.shape[1:]'], {}), '(targets.shape[1:])\n', (1773, 1792), True, 'imp... |
"""
Copyright (c) 2021, Electric Power Research Institute
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this li... | [
"pandas.DataFrame",
"numpy.multiply",
"cvxpy.Parameter",
"cvxpy.multiply",
"cvxpy.Zero",
"storagevet.Library.drop_extra_data",
"storagevet.ValueStreams.ValueStream.ValueStream.__init__",
"cvxpy.promote",
"cvxpy.NonPos",
"cvxpy.sum",
"storagevet.Library.fill_extra_data",
"pandas.Period",
"cvx... | [((2376, 2416), 'storagevet.ValueStreams.ValueStream.ValueStream.__init__', 'ValueStream.__init__', (['self', 'name', 'params'], {}), '(self, name, params)\n', (2396, 2416), False, 'from storagevet.ValueStreams.ValueStream import ValueStream\n'), ((2974, 3015), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'self... |
import numpy as np
import tensorflow as tf
# the activation function
def g_1(x):
assert len(x.shape) == 1
rand = tf.random_uniform([x.shape.as_list()[0]], dtype=tf.float32)
t = tf.nn.sigmoid(x) - rand
return 0.5*(1 + t / (tf.abs(t) + 1e-8))
def g_2(x):
return tf.nn.sigmoid(x)
def g(x):
ret... | [
"numpy.uint8",
"tensorflow.abs",
"tensorflow.global_variables_initializer",
"numpy.zeros",
"tensorflow.Session",
"tensorflow.matmul",
"tensorflow.placeholder",
"numpy.random.randint",
"numpy.array",
"tensorflow.global_variables",
"numpy.random.rand",
"tensorflow.train.GradientDescentOptimizer"... | [((284, 300), 'tensorflow.nn.sigmoid', 'tf.nn.sigmoid', (['x'], {}), '(x)\n', (297, 300), True, 'import tensorflow as tf\n'), ((324, 343), 'tensorflow.nn.leaky_relu', 'tf.nn.leaky_relu', (['x'], {}), '(x)\n', (340, 343), True, 'import tensorflow as tf\n'), ((3318, 3329), 'numpy.uint8', 'np.uint8', (['x'], {}), '(x)\n',... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"absl.testing.absltest.main",
"jax.disable_jit",
"jax.numpy.log2",
"aqt.jax.primitives.round_and_clip_to_signed_int",
"jax.random.PRNGKey",
"aqt.jax.quantization.quantized_dot_general",
"aqt.jax.test_utils.configure_jax",
"aqt.jax.quantization.quantized_dot",
"unittest.mock.patch.object",
"aqt.jax... | [((1250, 1276), 'aqt.jax.test_utils.configure_jax', 'test_utils.configure_jax', ([], {}), '()\n', (1274, 1276), False, 'from aqt.jax import test_utils\n'), ((28850, 28891), 'unittest.mock.patch.object', 'mock.patch.object', (['jax.lax', '"""dot_general"""'], {}), "(jax.lax, 'dot_general')\n", (28867, 28891), False, 'fr... |
import rNet as rNet
import numpy as np
def generate(net,seed_,num_to_gen):
net.reset()
x=np.zeros((1,1,vocab_size))
x[0,0,seed_]=1
out=index_to_char[seed_]
for t in range(0,num_to_gen):
p=net(x)[0,0,:]
ix = np.random.choice(range(vocab_size), p=p.ravel())
x=np.zeros(x.shape)... | [
"rNet.rNet",
"numpy.zeros_like",
"numpy.log",
"rNet.LSTM",
"numpy.zeros",
"numpy.clip",
"numpy.random.randint",
"numpy.array",
"rNet.softmax",
"rNet.softmax_loss",
"numpy.sqrt"
] | [((859, 870), 'rNet.rNet', 'rNet.rNet', ([], {}), '()\n', (868, 870), True, 'import rNet as rNet\n'), ((1052, 1071), 'rNet.softmax_loss', 'rNet.softmax_loss', ([], {}), '()\n', (1069, 1071), True, 'import rNet as rNet\n'), ((1426, 1488), 'numpy.random.randint', 'np.random.randint', (['(data_size - time_steps - 1)'], {'... |
# -*- coding: utf-8 -*-
"""
Convert ECoG to NWB.
:Author: <NAME>, <NAME>
Modified by <NAME> on May 30, 2020
"""
from __future__ import print_function
import os
from datetime import datetime
from os import path
from pathlib import Path
import numpy as np
import pandas as pd
from hdmf.backends.hdf5 import H5DataIO
from... | [
"scipy.io.loadmat",
"pandas.read_csv",
"hdmf.backends.hdf5.H5DataIO",
"scipy.io.wavfile.read",
"numpy.argsort",
"os.path.isfile",
"pathlib.Path",
"numpy.arange",
"pynwb.NWBFile",
"os.path.join",
"numpy.unique",
"numpy.zeros_like",
"os.path.exists",
"numpy.isfinite",
"ndx_bipolar_scheme.E... | [((765, 778), 'pynwb.get_manager', 'get_manager', ([], {}), '()\n', (776, 778), False, 'from pynwb import NWBFile, TimeSeries, get_manager, NWBHDF5IO\n'), ((1076, 1100), 'os.path.isfile', 'os.path.isfile', (['wav_path'], {}), '(wav_path)\n', (1090, 1100), False, 'import os\n'), ((1268, 1292), 'os.path.isfile', 'os.path... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os,time,cv2,scipy.io
import tensorflow as tf
# import tensorflow.contrib.slim as slim
import scipy.misc as sic
# import network as network
import subprocess
import numpy as np
from matplotlib.co... | [
"cv2.GaussianBlur",
"numpy.load",
"numpy.maximum",
"numpy.ones",
"numpy.random.randint",
"numpy.tile",
"glob.glob",
"tensorflow.abs",
"numpy.power",
"numpy.max",
"numpy.int",
"numpy.reshape",
"numpy.linspace",
"tensorflow.atan",
"tensorflow.equal",
"numpy.uint8",
"numpy.minimum",
"... | [((554, 576), 'glob.glob', 'glob', (["(data_path + '/*')"], {}), "(data_path + '/*')\n", (558, 576), False, 'from glob import glob\n'), ((1701, 1754), 'glob.glob', 'glob', (['"""../data_new/Data_Polar_Clean/MMR_1/train/*npy"""'], {}), "('../data_new/Data_Polar_Clean/MMR_1/train/*npy')\n", (1705, 1754), False, 'from glo... |
import pyclesperanto_prototype as cle
import numpy as np
def test_maximum_y_projection():
test1 = cle.push(np.asarray([
[
[1, 0, 0, 0, 9],
[0, 2, 0, 8, 0],
[3, 0, 1, 0, 10],
[0, 4, 0, 7, 0],
[5, 0, 6, 0, 10]
], [
[0, 2, 0, 8, 0... | [
"numpy.array_equal",
"pyclesperanto_prototype.maximum_y_projection",
"numpy.asarray",
"pyclesperanto_prototype.pull",
"pyclesperanto_prototype.create"
] | [((1129, 1150), 'pyclesperanto_prototype.create', 'cle.create', (['reference'], {}), '(reference)\n', (1139, 1150), True, 'import pyclesperanto_prototype as cle\n'), ((1155, 1194), 'pyclesperanto_prototype.maximum_y_projection', 'cle.maximum_y_projection', (['test1', 'result'], {}), '(test1, result)\n', (1179, 1194), T... |
import sys
sys.path.insert(0, "../../../")
import argparse
import torch
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data as data_utils
import numpy as np
from paper_experiments.rotated_MNIST.mnist_loader_shifted_label_distribution_rotate import MnistRotatedDist
from paper_experimen... | [
"paper_experiments.rotated_MNIST.mnist_loader_shifted_label_distribution_rotate.MnistRotatedDist",
"torch.utils.data.ConcatDataset",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"paper_experiments.rotated_MNIST.mnist_loader.MnistRotated",
"paper_experiments.rotated_MNIS... | [((11, 42), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../"""'], {}), "(0, '../../../')\n", (26, 42), False, 'import sys\n'), ((1679, 1739), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (1702, 1739), ... |
__author__ = 'sibirrer'
import numpy as np
from astropy.cosmology import default_cosmology
from lenstronomy.Util import class_creator
from lenstronomy.Util import constants as const
from lenstronomy.Cosmo.lens_cosmo import LensCosmo
from lenstronomy.Analysis.kinematics_api import KinematicsAPI
class TDCosmography(... | [
"lenstronomy.Cosmo.lens_cosmo.LensCosmo",
"numpy.var",
"astropy.cosmology.default_cosmology.get",
"numpy.mean",
"lenstronomy.Util.class_creator.create_class_instances"
] | [((2250, 2321), 'lenstronomy.Cosmo.lens_cosmo.LensCosmo', 'LensCosmo', ([], {'z_lens': 'z_lens', 'z_source': 'z_source', 'cosmo': 'self._cosmo_fiducial'}), '(z_lens=z_lens, z_source=z_source, cosmo=self._cosmo_fiducial)\n', (2259, 2321), False, 'from lenstronomy.Cosmo.lens_cosmo import LensCosmo\n'), ((2422, 2542), 'le... |
import os
import random
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
def save_parameters(options, filename):
with open(filename, "w+") as f:
for key in options.keys():
f.write("{}... | [
"matplotlib.pyplot.title",
"seaborn.lineplot",
"numpy.random.seed",
"matplotlib.pyplot.show",
"pandas.read_csv",
"torch.manual_seed",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.close",
"random.seed",
"seaborn.distplot",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((469, 486), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (480, 486), False, 'import random\n'), ((536, 556), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (550, 556), True, 'import numpy as np\n'), ((561, 584), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (57... |
import numpy
from numpy import dot, sqrt
def binarize_vector(u):
return u > 0
def cosine_distance(u, v, binary=False):
"""Return the cosine distance between two vectors."""
if binary:
return cosine_distance_binary(u, v)
return 1.0 - dot(u, v) / (sqrt(dot(u, u)) * sqrt(dot(v, v)))
def cosin... | [
"numpy.dot",
"numpy.asarray",
"numpy.bitwise_or"
] | [((1346, 1362), 'numpy.asarray', 'numpy.asarray', (['u'], {}), '(u)\n', (1359, 1362), False, 'import numpy\n'), ((1371, 1387), 'numpy.asarray', 'numpy.asarray', (['v'], {}), '(v)\n', (1384, 1387), False, 'import numpy\n'), ((592, 607), 'numpy.dot', 'dot', (['diff', 'diff'], {}), '(diff, diff)\n', (595, 607), False, 'fr... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"functools.partial",
"re.split",
"rouge_score.rouge_scorer.RougeScorer",
"torch.argmax",
"rouge_score.scoring.BootstrapAggregator",
"numpy.isclose",
"pytest.mark.skipif",
"torchmetrics.text.rouge.ROUGEScore",
"pytest.raises",
"torchmetrics.functional.text.rouge.rouge_score",
"pytest.mark.paramet... | [((2936, 3004), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not _NLTK_AVAILABLE)'], {'reason': '"""test requires nltk"""'}), "(not _NLTK_AVAILABLE, reason='test requires nltk')\n", (2954, 3004), False, 'import pytest\n'), ((3006, 3429), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['pl_rouge_metric_key'... |
#!/usr/bin/python
# Note : This is designed for Python 3
import numpy as np
class orthogonal_optimization:
def __init__(self, db):
self.cost_function = db['compute_cost']
self.gradient_function = db['compute_gradient']
self.x_opt = None
self.cost_opt = None
self.db = {}
#self.db['run_debug_2'] = True
... | [
"numpy.eye",
"numpy.linalg.qr",
"numpy.linalg.inv",
"numpy.linalg.norm"
] | [((667, 676), 'numpy.eye', 'np.eye', (['d'], {}), '(d)\n', (673, 676), True, 'import numpy as np\n'), ((1154, 1163), 'numpy.eye', 'np.eye', (['d'], {}), '(d)\n', (1160, 1163), True, 'import numpy as np\n'), ((1197, 1219), 'numpy.linalg.norm', 'np.linalg.norm', (['x_init'], {}), '(x_init)\n', (1211, 1219), True, 'import... |
"""
Tests for contingency table analyses.
"""
import os
import warnings
import numpy as np
import statsmodels.stats.contingency_tables as ctab
import pandas as pd
from numpy.testing import assert_allclose, assert_equal
import statsmodels.api as sm
cur_dir = os.path.dirname(os.path.abspath(__file__))
fname = "conting... | [
"numpy.random.seed",
"pandas.read_csv",
"numpy.ones",
"numpy.random.randint",
"numpy.arange",
"os.path.join",
"pandas.DataFrame",
"numpy.full",
"os.path.abspath",
"warnings.simplefilter",
"statsmodels.stats.contingency_tables.mcnemar",
"warnings.catch_warnings",
"numpy.testing.assert_equal",... | [((354, 393), 'os.path.join', 'os.path.join', (['cur_dir', '"""results"""', 'fname'], {}), "(cur_dir, 'results', fname)\n", (366, 393), False, 'import os\n'), ((406, 424), 'pandas.read_csv', 'pd.read_csv', (['fpath'], {}), '(fpath)\n', (417, 424), True, 'import pandas as pd\n'), ((468, 500), 'numpy.asarray', 'np.asarra... |
import numpy as np
#add 1 to each array element
np.add(arr, 1)
#subtract 2 from each array element
np.subtract(arr, 2)
#multiply each array element by 3
np.multiply(arr, 3)
#divide each array element by 4 (returns np.nan for division by zero)
np.divide(arr, 4)
#raise each array element to 5th power
np.power(arr, 5)
| [
"numpy.divide",
"numpy.multiply",
"numpy.subtract",
"numpy.power",
"numpy.add"
] | [((49, 63), 'numpy.add', 'np.add', (['arr', '(1)'], {}), '(arr, 1)\n', (55, 63), True, 'import numpy as np\n'), ((100, 119), 'numpy.subtract', 'np.subtract', (['arr', '(2)'], {}), '(arr, 2)\n', (111, 119), True, 'import numpy as np\n'), ((154, 173), 'numpy.multiply', 'np.multiply', (['arr', '(3)'], {}), '(arr, 3)\n', (... |
import numpy as np
import pandas as pd
import itertools
from sklearn.metrics import roc_auc_score, roc_curve, auc
def augment_agg(X):
mean = np.array(X.mean(axis = 1)).reshape(X.shape[0],1)
std = np.array(X.std(axis = 1)).reshape(X.shape[0],1)
rang = np.array((X.max(axis = 1) - X.min(axis = 1))).reshape(X.... | [
"sklearn.metrics.roc_curve",
"numpy.isinf",
"numpy.append",
"sklearn.metrics.auc",
"pandas.Series",
"itertools.groupby"
] | [((341, 362), 'numpy.append', 'np.append', (['X', 'mean', '(1)'], {}), '(X, mean, 1)\n', (350, 362), True, 'import numpy as np\n'), ((369, 389), 'numpy.append', 'np.append', (['X', 'std', '(1)'], {}), '(X, std, 1)\n', (378, 389), True, 'import numpy as np\n'), ((396, 417), 'numpy.append', 'np.append', (['X', 'rang', '(... |
### Language models and functions
## <NAME>
## Created: March 2020
import pandas as pd
import numpy as np
import math
from scipy.special import comb
## Zipf pmf and cdf
def zipf(k,a):
power_law = np.divide(1,np.power(k,a))
H = np.sum(np.divide(1,np.power(k,a)))
pmf = np.divide(power_law,H)
cdf = [np.sum(pmf[0:i])... | [
"pandas.DataFrame",
"numpy.divide",
"numpy.matrix",
"numpy.multiply",
"numpy.random.seed",
"numpy.sum",
"numpy.std",
"numpy.power",
"scipy.special.comb",
"numpy.mean",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"numpy.random.choice",
"numpy.unique",
"numpy.sqrt"
] | [((273, 296), 'numpy.divide', 'np.divide', (['power_law', 'H'], {}), '(power_law, H)\n', (282, 296), True, 'import numpy as np\n'), ((1608, 1632), 'numpy.random.seed', 'np.random.seed', (['set_seed'], {}), '(set_seed)\n', (1622, 1632), True, 'import numpy as np\n'), ((2192, 2220), 'numpy.multiply', 'np.multiply', (['pm... |
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torch import optim
import matplotlib.pyplot as plt
import random
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print(device)
# Build dataset
class Diagnos... | [
"numpy.pad",
"torch.nn.Dropout",
"torch.utils.data.DataLoader",
"torch.nn.Embedding",
"torch.load",
"torch.nn.CrossEntropyLoss",
"torch.nn.functional.softmax",
"numpy.mean",
"torch.cuda.is_available",
"torch.max",
"numpy.array",
"torch.nn.Linear",
"torch.nn.LSTM",
"torch.no_grad"
] | [((2338, 2411), 'numpy.pad', 'np.pad', (['x_array', '(0, len2pad)'], {'mode': '"""constant"""', 'constant_values': 'pad_value'}), "(x_array, (0, len2pad), mode='constant', constant_values=pad_value)\n", (2344, 2411), True, 'import numpy as np\n'), ((2680, 2737), 'torch.utils.data.DataLoader', 'DataLoader', (['trainset'... |
import datetime
import numbers
import numpy as np
from past.builtins import basestring
import netCDF4
def validate_calendar(calendar):
"""Validate calendar string for CF Conventions.
Parameters
----------
calendar : str
Returns
-------
out : str
same as input if the calendar is ... | [
"netCDF4.Dataset",
"numpy.abs",
"netCDF4.date2num",
"datetime.datetime",
"netCDF4.num2date",
"netCDF4.netcdftime.datetime",
"netCDF4.netcdftime.netcdftime"
] | [((3029, 3058), 'netCDF4.Dataset', 'netCDF4.Dataset', (['nc_file', '"""r"""'], {}), "(nc_file, 'r')\n", (3044, 3058), False, 'import netCDF4\n'), ((3678, 3707), 'netCDF4.Dataset', 'netCDF4.Dataset', (['nc_file', '"""r"""'], {}), "(nc_file, 'r')\n", (3693, 3707), False, 'import netCDF4\n'), ((8254, 8307), 'netCDF4.num2d... |
import numpy as np
import torch
from mmdet.core.bbox.builder import BBOX_CODERS
from mmdet.core.bbox.coder.base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class DeltaOBBCoder(BaseBBoxCoder):
def __init__(self,
target_means=(0., 0., 0., 0., 0.),
target_stds=(0... | [
"numpy.stack",
"torch.stack",
"numpy.log",
"torch.addcmul",
"numpy.ones",
"torch.log",
"mmdet.core.bbox.builder.BBOX_CODERS.register_module"
] | [((148, 177), 'mmdet.core.bbox.builder.BBOX_CODERS.register_module', 'BBOX_CODERS.register_module', ([], {}), '()\n', (175, 177), False, 'from mmdet.core.bbox.builder import BBOX_CODERS\n'), ((2220, 2238), 'torch.log', 'torch.log', (['(gw / pw)'], {}), '(gw / pw)\n', (2229, 2238), False, 'import torch\n'), ((2248, 2266... |
from .Player import Player
from .TileCollection import TileCollection
from .Center import Center
from .TileColor import TileColor
from .AzulAction import AzulAction
import random
import numpy as np
import math
class AzulBoard():
def __init__(self):
self.player1 = Player(1)
self.player2 ... | [
"numpy.random.uniform",
"numpy.random.randint",
"numpy.random.choice"
] | [((1423, 1489), 'numpy.random.choice', 'np.random.choice', ([], {'a': '[True, False]', 'size': '(5, 5)', 'p': '[prob, 1 - prob]'}), '(a=[True, False], size=(5, 5), p=[prob, 1 - prob])\n', (1439, 1489), True, 'import numpy as np\n'), ((2122, 2145), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, ... |
# Uses a learnable embedding for the countries which is fed as input to both encoders (at the respective dense layers).
# Copyright 2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License.
import os
import urllib.request
# Suppress noisy Tensorflow debug logging... | [
"ongoing.predictors.base.convert_ratios_to_total_deaths",
"numpy.ones",
"numpy.clip",
"keras.backend.abs",
"numpy.argmin",
"keras.models.Model",
"pandas.offsets.Day",
"keras.layers.Input",
"keras.layers.Reshape",
"numpy.copy",
"pandas.Timedelta",
"numpy.stack",
"pandas.DataFrame.from_dict",
... | [((1081, 1089), 'keras.backend.abs', 'K.abs', (['w'], {}), '(w)\n', (1086, 1089), True, 'import keras.backend as K\n'), ((6557, 6589), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['forecast'], {}), '(forecast)\n', (6579, 6589), True, 'import pandas as pd\n'), ((7180, 7216), 'numpy.array', 'np.array', (['cn... |
"""
.. todo::
WRITEME
"""
import numpy as np
def is_iterable(obj):
"""
Robustly test whether an object is iterable.
Parameters
----------
obj : object
The object to be checked.
Returns
-------
is_iterable : bool
`True` if the object is iterable, `False` otherwise... | [
"numpy.nanmin",
"numpy.min",
"numpy.max",
"numpy.nanmax"
] | [((1887, 1898), 'numpy.min', 'np.min', (['arr'], {}), '(arr)\n', (1893, 1898), True, 'import numpy as np\n'), ((2575, 2589), 'numpy.nanmax', 'np.nanmax', (['arr'], {}), '(arr)\n', (2584, 2589), True, 'import numpy as np\n'), ((2603, 2617), 'numpy.nanmin', 'np.nanmin', (['arr'], {}), '(arr)\n', (2612, 2617), True, 'impo... |
import bpy
import sys
from mathutils import Vector
import numpy as np
from abc import ABC, ABCMeta, abstractmethod
# Scene parameters
SCALE_FACTOR = 0.05 # factor used to scale an object when close enough to target
ROTATION_VEC = (3.0, 0., 0.) # rotation vector applied to an object when close enough to target
ORIGIN... | [
"numpy.random.rand",
"bpy.ops.mesh.primitive_ico_sphere_add",
"numpy.array",
"bpy.data.objects.new",
"numpy.linspace",
"bpy.app.handlers.frame_change_pre.clear"
] | [((10220, 10311), 'bpy.ops.mesh.primitive_ico_sphere_add', 'bpy.ops.mesh.primitive_ico_sphere_add', ([], {'subdivisions': '(4)', 'radius': '(0.3)', 'location': '(0, 0, 30)'}), '(subdivisions=4, radius=0.3, location=\n (0, 0, 30))\n', (10257, 10311), False, 'import bpy\n'), ((10648, 10689), 'bpy.app.handlers.frame_ch... |
# stdlib imports
import os
from collections import OrderedDict
from datetime import datetime, timedelta
import logging
# third party imports
import numpy as np
from obspy.core.trace import Stats
# local imports
from gmprocess.io.seedname import get_channel_name, get_units_type
from gmprocess.core.stationtrace import ... | [
"logging.debug",
"gmprocess.core.stationtrace.StationTrace",
"obspy.core.trace.Stats",
"os.path.basename",
"logging.warning",
"gmprocess.core.stationstream.StationStream",
"gmprocess.io.seedname.get_channel_name",
"numpy.genfromtxt",
"datetime.datetime.strptime",
"gmprocess.io.utils.is_binary",
... | [((924, 967), 'logging.debug', 'logging.debug', (['"""Checking if format is cwb."""'], {}), "('Checking if format is cwb.')\n", (937, 967), False, 'import logging\n'), ((975, 994), 'gmprocess.io.utils.is_binary', 'is_binary', (['filename'], {}), '(filename)\n', (984, 994), False, 'from gmprocess.io.utils import is_bina... |
import numpy as np
import gym
from gym import spaces
import math
MAX_MARCH = 20
EPSILON = 0.1
DEG_TO_RAD = 0.0174533
WINDOW_SIZE = [300, 300]
#
# Objects
#
def generate_box(pos=None, size=[10, 25], inside_window=True, color=(255, 255, 255), is_goal=False,
is_visible=True, is_obstacle=True):
'''
... | [
"pygame.draw.line",
"numpy.abs",
"numpy.arctan2",
"pygame.Rect",
"gym.spaces.Discrete",
"numpy.argmin",
"numpy.clip",
"pygame.display.update",
"numpy.sin",
"numpy.linalg.norm",
"pygame.display.set_mode",
"numpy.append",
"math.cos",
"numpy.random.choice",
"pygame.draw.polygon",
"pygame.... | [((505, 562), 'numpy.random.uniform', 'np.random.uniform', (['[size[0], size[0]]', '[size[1], size[1]]'], {}), '([size[0], size[0]], [size[1], size[1]])\n', (522, 562), True, 'import numpy as np\n'), ((1185, 1224), 'numpy.random.uniform', 'np.random.uniform', (['radius[0]', 'radius[1]'], {}), '(radius[0], radius[1])\n'... |
from shapely import geometry
from shapely.geometry import shape, Point
import geohash as gh
import numpy as np
import pandas as pd
import numpy as np
import sys
import pandas as pd
import datetime
import random
from random import choices
# get train acc and test acc
# Train acc from 2017 to 2019 May
#Test acc from 2... | [
"pandas.DataFrame",
"numpy.random.uniform",
"pandas.read_csv",
"random.choices",
"random.random",
"datetime.datetime.strptime",
"geohash.bbox",
"pandas.concat"
] | [((692, 709), 'pandas.concat', 'pd.concat', (['frames'], {}), '(frames)\n', (701, 709), True, 'import pandas as pd\n'), ((1090, 1106), 'geohash.bbox', 'gh.bbox', (['geohash'], {}), '(geohash)\n', (1097, 1106), True, 'import geohash as gh\n'), ((1312, 1347), 'numpy.random.uniform', 'np.random.uniform', (['min_lng', 'max... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
import argparse
import logging
import os
import subprocess
import random
import cv2
import numpy as np
import sys
python_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.insert(0, python_dir)
from cuberite_process import CuberitePr... | [
"numpy.load",
"argparse.ArgumentParser",
"numpy.argmax",
"os.path.isfile",
"numpy.mean",
"numpy.sin",
"os.path.join",
"random.randint",
"cuberite_process.CuberiteProcess",
"cv2.imwrite",
"os.path.dirname",
"subprocess.Popen",
"cv2.circle",
"os.path.realpath",
"numpy.cos",
"logging.basi... | [((249, 279), 'sys.path.insert', 'sys.path.insert', (['(0)', 'python_dir'], {}), '(0, python_dir)\n', (264, 279), False, 'import sys\n'), ((354, 424), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s [%(levelname)s]: %(message)s"""'}), "(format='%(asctime)s [%(levelname)s]: %(message)s')\n"... |
from typing import Optional, Union
import itertools as it
from collections import OrderedDict
import numpy as np
import pandas as pd
from ConfigSpace import ConfigurationSpace
class fANOVA:
def __init__(
self,
X: Union[pd.DataFrame, np.ndarray],
Y,
configspace: ConfigurationSpace... | [
"numpy.full",
"ConfigSpace.ConfigurationSpace",
"numpy.random.randn",
"numpy.std",
"sys.path.insert",
"numpy.isfinite",
"deepcave.evaluators.epm.fanova_forest.fANOVAForest",
"itertools.combinations",
"numpy.mean",
"numpy.array",
"ConfigSpace.hyperparameters.UniformFloatHyperparameter",
"collec... | [((10094, 10122), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../"""'], {}), "(0, '../../')\n", (10109, 10122), False, 'import sys\n'), ((10434, 10466), 'ConfigSpace.ConfigurationSpace', 'CS.ConfigurationSpace', ([], {'seed': '(1234)'}), '(seed=1234)\n', (10455, 10466), True, 'import ConfigSpace as CS\n'), ((... |
#!/usr/bin/env python
import functools
import os.path
import random
import sys
import xml.etree.ElementTree
import numpy as np
import matplotlib.pyplot as plt
import skimage.data
import cv2
import PIL.Image
import pickle
def load_pascal_occluder(pascal_voc_root_path):
occluders = []
structuring_element = c... | [
"numpy.clip",
"numpy.random.randint",
"pickle.load",
"cv2.erode",
"numpy.round",
"timer.Timer",
"matplotlib.pyplot.subplots",
"cv2.resize",
"matplotlib.pyplot.show",
"cv2.countNonZero",
"numpy.asarray",
"numpy.concatenate",
"numpy.random.uniform",
"densepose.data.structures.DensePoseResult... | [((319, 371), 'cv2.getStructuringElement', 'cv2.getStructuringElement', (['cv2.MORPH_ELLIPSE', '(8, 8)'], {}), '(cv2.MORPH_ELLIPSE, (8, 8))\n', (344, 371), False, 'import cv2\n'), ((2989, 2996), 'timer.Timer', 'Timer', ([], {}), '()\n', (2994, 2996), False, 'from timer import Timer\n'), ((3043, 3095), 'cv2.getStructuri... |
from __future__ import print_function
import numpy as np
import pandas as pd
import numpy.testing as npt
import pytest
import os
from collections import OrderedDict
import lifetimes.estimation as estimation
import lifetimes.utils as utils
from lifetimes.datasets import load_cdnow_summary, load_cdnow_summary_data_wit... | [
"lifetimes.datasets.load_cdnow_summary",
"os.remove",
"numpy.random.seed",
"numpy.arange",
"numpy.testing.assert_array_almost_equal",
"lifetimes.datasets.load_cdnow_summary_data_with_monetary_value",
"pandas.DataFrame",
"numpy.testing.assert_almost_equal",
"lifetimes.estimation.ModifiedBetaGeoFitter... | [((433, 453), 'lifetimes.datasets.load_cdnow_summary', 'load_cdnow_summary', ([], {}), '()\n', (451, 453), False, 'from lifetimes.datasets import load_cdnow_summary, load_cdnow_summary_data_with_monetary_value, load_donations, load_transaction_data\n'), ((1745, 1761), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n... |
# Copyright (c) 2019, CNRS-LAAS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the... | [
"numpy.isfinite",
"matplotlib.pyplot.figure",
"numpy.where",
"datetime.timedelta",
"datetime.datetime.now"
] | [((5389, 5412), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (5410, 5412), False, 'import datetime\n'), ((6491, 6503), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (6501, 6503), True, 'import matplotlib.pyplot as plt\n'), ((3361, 3454), 'numpy.where', 'np.where', (["((old_fire_map.... |
#runas import numpy as np; n = 20; a = np.arange(n*n*n).reshape((n,n,n)).astype(np.uint8); b = 2. ; goodExpoMeasure(a, b)
#pythran export goodExpoMeasure(uint8[][][], float)
import numpy
def goodExpoMeasure(inRGB, sigma):
'''
Compute the good exposition image quality measure on 1 input image.
'''
R = in... | [
"numpy.round",
"numpy.exp"
] | [((455, 489), 'numpy.exp', 'numpy.exp', (['(-(R - 128) ** 2 / sigma)'], {}), '(-(R - 128) ** 2 / sigma)\n', (464, 489), False, 'import numpy\n'), ((507, 541), 'numpy.exp', 'numpy.exp', (['(-(G - 128) ** 2 / sigma)'], {}), '(-(G - 128) ** 2 / sigma)\n', (516, 541), False, 'import numpy\n'), ((559, 593), 'numpy.exp', 'nu... |
from __future__ import division, print_function
import numpy as np
from dipy.denoise.nlmeans_block import nlmeans_block
def non_local_means(arr, sigma, mask=None, patch_radius=1, block_radius=5,
rician=True):
r""" Non-local means for denoising 3D and 4D images, using
blockwise averagi... | [
"numpy.zeros_like",
"numpy.double",
"numpy.isscalar",
"numpy.ones",
"numpy.int",
"numpy.ascontiguousarray"
] | [((1669, 1732), 'numpy.ones', 'np.ones', (['(arr.shape[0], arr.shape[1], arr.shape[2])'], {'dtype': '"""f8"""'}), "((arr.shape[0], arr.shape[1], arr.shape[2]), dtype='f8')\n", (1676, 1732), True, 'import numpy as np\n'), ((1758, 1796), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['mask'], {'dtype': '"""f8"""'})... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | [
"mxnet.init.Uniform",
"numpy.random.uniform",
"mxnet.initializer.Orthogonal",
"numpy.linalg.svd",
"mxnet.init.Xavier",
"numpy.random.normal",
"numpy.eye",
"mxnet.init.Normal",
"logging.getLogger"
] | [((689, 716), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (706, 716), False, 'import logging\n'), ((1780, 1914), 'mxnet.init.Xavier', 'mx.init.Xavier', ([], {'rnd_type': 'default_init_xavier_rand_type', 'factor_type': 'default_init_xavier_factor_type', 'magnitude': 'default_init_scale'... |
"""
Algorithm entry poing.
Methods of the APPO class initiate all other components (rollout & policy workers and learners) in the main thread,
and then fork their separate processes.
All data structures that are shared between processes are also created during the construction of APPO.
This class contains the algorith... | [
"multi_sample_factory.utils.utils.log.error",
"multi_sample_factory.utils.utils.cfg_file",
"multiprocessing.Lock",
"numpy.mean",
"multi_sample_factory.utils.utils.list_child_processes",
"collections.deque",
"multiprocessing.cpu_count",
"multi_sample_factory.algorithms.appo.population_based_training.Po... | [((2328, 2385), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (2370, 2385), False, 'import torch\n'), ((19399, 19427), 'multi_sample_factory.algorithms.appo.appo_utils.set_global_cuda_envvars', 'set_global_cuda_envvars', (['... |
"""
Module description:
"""
__version__ = '0.3.1'
__author__ = '<NAME>, <NAME>'
__email__ = '<EMAIL>, <EMAIL>'
from types import SimpleNamespace
import typing as t
import numpy as np
import logging as pylog
from elliot.utils import logging
from hyperopt import STATUS_OK
class ModelCoordinator(object):
"""
... | [
"numpy.average",
"types.SimpleNamespace",
"elliot.utils.logging.get_logger"
] | [((916, 1017), 'elliot.utils.logging.get_logger', 'logging.get_logger', (['self.__class__.__name__', '(pylog.CRITICAL if base.config_test else pylog.DEBUG)'], {}), '(self.__class__.__name__, pylog.CRITICAL if base.\n config_test else pylog.DEBUG)\n', (934, 1017), False, 'from elliot.utils import logging\n'), ((1681,... |
import os, sys
import torch
from torch.utils.data import Dataset
import imageio as io
import cv2
from sklearn.model_selection import StratifiedKFold
import numpy as np
from numpy.lib.stride_tricks import as_strided
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
def imread(p):
img = io.imread(p)
# o... | [
"numpy.load",
"torch.LongTensor",
"imageio.imread",
"numpy.ascontiguousarray",
"numpy.transpose",
"numpy.random.RandomState",
"numpy.random.randint",
"numpy.array",
"sklearn.model_selection.StratifiedKFold",
"numpy.lib.stride_tricks.as_strided",
"os.path.splitext",
"os.path.join",
"os.listdi... | [((300, 312), 'imageio.imread', 'io.imread', (['p'], {}), '(p)\n', (309, 312), True, 'import imageio as io\n'), ((343, 401), 'cv2.resize', 'cv2.resize', (['img', '(224, 224)'], {'interpolation': 'cv2.INTER_CUBIC'}), '(img, (224, 224), interpolation=cv2.INTER_CUBIC)\n', (353, 401), False, 'import cv2\n'), ((534, 562), '... |
import matplotlib
matplotlib.use('Agg')
from Swing.util.BoxPlot import BoxPlot
from matplotlib.backends.backend_pdf import PdfPages
from scipy import stats
import pdb
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys
import os
import time
from Swing.util.mplstyle import style1
import s... | [
"pandas.DataFrame",
"pandas.read_csv",
"scipy.stats.ttest_ind",
"time.time",
"seaborn.boxplot",
"matplotlib.use",
"numpy.mean",
"matplotlib.pyplot.subplots",
"os.listdir"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((1417, 1428), 'time.time', 'time.time', ([], {}), '()\n', (1426, 1428), False, 'import time\n'), ((1603, 1614), 'time.time', 'time.time', ([], {}), '()\n', (1612, 1614), False, 'import time\n'), (... |
import numpy as np
from .wavelength import wave_log10
def center2edge(x):
x = np.asarray(x)
dx = np.diff(x)
return np.hstack((x[0] - .5 * dx[0], x[:-1] + .5 * dx, x[-1] + .5 * dx[-1]))
def rebin(wave, flux=None, flux_err=None, mask=None, wave_new=None):
""" Rebin spectrum to a new wavelength grid
... | [
"numpy.zeros_like",
"numpy.ones_like",
"numpy.sum",
"numpy.asarray",
"numpy.floor",
"numpy.ones",
"numpy.isnan",
"numpy.hstack",
"numpy.any",
"numpy.diff",
"numpy.array",
"numpy.arange",
"numpy.sqrt"
] | [((85, 98), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (95, 98), True, 'import numpy as np\n'), ((108, 118), 'numpy.diff', 'np.diff', (['x'], {}), '(x)\n', (115, 118), True, 'import numpy as np\n'), ((130, 202), 'numpy.hstack', 'np.hstack', (['(x[0] - 0.5 * dx[0], x[:-1] + 0.5 * dx, x[-1] + 0.5 * dx[-1])'], {... |
import math
import numpy as np
import openmdao.api as om
from wisdem.commonse.akima import Akima
from wisdem.commonse.csystem import DirectionVector
from wisdem.commonse.utilities import cosd, sind # , linspace_with_deriv, interp_with_deriv, hstack, vstack
from wisdem.commonse.environment import LogWind, PowerWind, L... | [
"numpy.abs",
"wisdem.commonse.environment.PowerWind",
"numpy.arange",
"numpy.interp",
"openmdao.api.Group",
"numpy.zeros_like",
"math.log",
"numpy.log10",
"openmdao.api.Problem",
"matplotlib.pyplot.show",
"numpy.ones_like",
"wisdem.commonse.environment.LinearWaves",
"wisdem.commonse.csystem.... | [((986, 1001), 'numpy.log10', 'np.log10', (['Re_pt'], {}), '(Re_pt)\n', (994, 1001), True, 'import numpy as np\n'), ((1375, 1392), 'numpy.zeros_like', 'np.zeros_like', (['Re'], {}), '(Re)\n', (1388, 1392), True, 'import numpy as np\n'), ((1407, 1424), 'numpy.zeros_like', 'np.zeros_like', (['Re'], {}), '(Re)\n', (1420, ... |
import sys
import numpy as np
import os
import random
import time
import pygame
import math
from constants import *
from chromosome import Chromosome
from bird import Bird
from selection import *
from pillar import Pillar
from pygame.locals import *
# ata = np.zeros((580,600,2))
# y: [-280,300]
# x: [600,0]
"""Agent... | [
"numpy.load",
"numpy.zeros"
] | [((606, 629), 'numpy.zeros', 'np.zeros', (['(2, 118, 600)'], {}), '((2, 118, 600))\n', (614, 629), True, 'import numpy as np\n'), ((707, 727), 'numpy.zeros', 'np.zeros', (['(580, 600)'], {}), '((580, 600))\n', (715, 727), True, 'import numpy as np\n'), ((1619, 1659), 'numpy.load', 'np.load', (["('flappyQData//' + name ... |
import numpy as np
from deepspeaker.audio_ds import read_mfcc
from deepspeaker.batcher import sample_from_mfcc
from deepspeaker.constants import SAMPLE_RATE, NUM_FRAMES, WIN_LENGTH
from deepspeaker.conv_models import DeepSpeakerModel
import tensorflow as tf
def build_model(ckpt_path):
model = DeepSpeakerModel()
... | [
"deepspeaker.audio_ds.read_mfcc",
"tensorflow.config.experimental.set_visible_devices",
"tensorflow.device",
"numpy.expand_dims",
"deepspeaker.conv_models.DeepSpeakerModel",
"tensorflow.config.experimental.list_physical_devices"
] | [((299, 317), 'deepspeaker.conv_models.DeepSpeakerModel', 'DeepSpeakerModel', ([], {}), '()\n', (315, 317), False, 'from deepspeaker.conv_models import DeepSpeakerModel\n'), ((501, 533), 'deepspeaker.audio_ds.read_mfcc', 'read_mfcc', (['audio', 'sr', 'win_length'], {}), '(audio, sr, win_length)\n', (510, 533), False, '... |
import numpy as np
import scipy.stats as st
import cv2
import time
import os
import glob
def gauss_kernel(size=21, sigma=3, inchannels=3, outchannels=3):
interval = (2 * sigma + 1.0) / size
x = np.linspace(-sigma-interval/2,sigma+interval/2,size+1)
ker1d = np.diff(st.norm.cdf(x))
kernel_raw = np.sqrt(n... | [
"cv2.line",
"cv2.circle",
"numpy.minimum",
"numpy.outer",
"numpy.zeros",
"numpy.expand_dims",
"numpy.transpose",
"os.path.getctime",
"scipy.stats.norm.cdf",
"cv2.imread",
"numpy.random.randint",
"numpy.array",
"numpy.tile",
"numpy.linspace",
"glob.glob",
"numpy.cos",
"numpy.sin"
] | [((203, 269), 'numpy.linspace', 'np.linspace', (['(-sigma - interval / 2)', '(sigma + interval / 2)', '(size + 1)'], {}), '(-sigma - interval / 2, sigma + interval / 2, size + 1)\n', (214, 269), True, 'import numpy as np\n'), ((403, 437), 'numpy.array', 'np.array', (['kernel'], {'dtype': 'np.float32'}), '(kernel, dtype... |
# GenerateSpectraPages.py
import argparse
import os
import time
from astropy.coordinates import SkyCoord
from astropy.io import ascii, votable
from astropy.io.votable import parse_single_table, from_table, writeto
from astropy.table import Column, Table
import astropy.units as u
import numpy as np
def parseargs():
... | [
"astropy.io.votable.writeto",
"astropy.io.ascii.read",
"argparse.ArgumentParser",
"astropy.table.Table",
"os.path.dirname",
"os.path.exists",
"time.time",
"astropy.io.votable.from_table",
"astropy.table.Column",
"astropy.coordinates.SkyCoord",
"time.localtime",
"numpy.in1d"
] | [((437, 584), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""Produce preview pages for a set of spectra"""'}), "(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, description=\n 'Produce preview pages for a set o... |
import base64
import os
import sys
import threading
from collections import defaultdict
from functools import partial
from io import BytesIO
from mimetypes import guess_extension
from typing import Any
import numpy as np
import six
from PIL import Image
from ...debugging.log import LoggerRoot
from ..frameworks import... | [
"tensorflow.python.framework.constant_op.constant",
"base64.b64decode",
"collections.defaultdict",
"numpy.histogram",
"numpy.arange",
"numpy.interp",
"google.protobuf.json_format.MessageToDict",
"numpy.atleast_2d",
"tensorflow.py_function",
"numpy.zeros_like",
"tensorflow.python.ops.summary_ops_... | [((9151, 9168), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (9166, 9168), False, 'import threading\n'), ((2812, 2844), 'numpy.random.shuffle', 'np.random.shuffle', (['cur_idx_below'], {}), '(cur_idx_below)\n', (2829, 2844), True, 'import numpy as np\n'), ((5990, 6017), 'numpy.append', 'np.append', (['hist_i... |
import pandas as pd
import hoki.hrdiagrams
import hoki.cmd
import hoki.load as load
from hoki.constants import BPASS_TIME_BINS
import warnings
from hoki.utils.exceptions import HokiFatalError, HokiUserWarning, HokiFormatError, HokiFormatWarning, HokiDeprecationWarning
from hoki.utils.hoki_object import HokiObject
from ... | [
"numpy.sum",
"hoki.utils.exceptions.HokiDeprecationWarning",
"numpy.isnan",
"hoki.utils.hoki_dialogue.HokiDialogue",
"hoki.utils.exceptions.HokiFormatError",
"numpy.array",
"hoki.load.model_output",
"warnings.warn",
"numpy.round",
"hoki.load.unpickle"
] | [((412, 426), 'hoki.utils.hoki_dialogue.HokiDialogue', 'HokiDialogue', ([], {}), '()\n', (424, 426), False, 'from hoki.utils.hoki_dialogue import HokiDialogue\n'), ((792, 827), 'hoki.utils.exceptions.HokiDeprecationWarning', 'HokiDeprecationWarning', (['deprecation'], {}), '(deprecation)\n', (814, 827), False, 'from ho... |
from detectron2.engine import default_argument_parser
from liuy.implementation.CoCoSegModel import CoCoSegModel
from liuy.implementation.RandomSampler import CoCoRandomSampler
import numpy as np
import random
from liuy.utils.reg_dataset import register_coco_instances_from_selected_image_files
from liuy.utils.local_conf... | [
"liuy.utils.reg_dataset.register_coco_instances_from_selected_image_files",
"copy.deepcopy",
"numpy.ceil",
"random.sample",
"detectron2.engine.default_argument_parser",
"liuy.implementation.CoCoSegModel.CoCoSegModel",
"liuy.implementation.RandomSampler.CoCoRandomSampler"
] | [((878, 919), 'random.sample', 'random.sample', (['whole_image_id', 'seed_batch'], {}), '(whole_image_id, seed_batch)\n', (891, 919), False, 'import random\n'), ((970, 1182), 'liuy.utils.reg_dataset.register_coco_instances_from_selected_image_files', 'register_coco_instances_from_selected_image_files', ([], {'name': '"... |
import pytest
import numpy as np
import torch
from pycox.models.utils import pad_col, make_subgrid, cumsum_reverse
@pytest.mark.parametrize('val', [0, 1, 5])
def test_pad_col_start(val):
x = torch.ones((2, 3))
x_pad = pad_col(x, val, where='start')
pad = torch.ones(2, 1) * val
assert (x_pad == torch.ca... | [
"numpy.random.uniform",
"torch.ones",
"pycox.models.utils.make_subgrid",
"numpy.abs",
"torch.manual_seed",
"torch.randn",
"torch.cat",
"numpy.sort",
"pytest.raises",
"numpy.linspace",
"pytest.mark.parametrize",
"pycox.models.utils.pad_col",
"pycox.models.utils.cumsum_reverse"
] | [((117, 158), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""val"""', '[0, 1, 5]'], {}), "('val', [0, 1, 5])\n", (140, 158), False, 'import pytest\n'), ((348, 389), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""val"""', '[0, 1, 5]'], {}), "('val', [0, 1, 5])\n", (371, 389), False, 'import pyt... |
#
# Copyright (c) 2019-2020, NVIDIA 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 ag... | [
"dask.delayed",
"dask_cudf.from_cudf",
"numpy.datetime64",
"bdb_tools.utils.run_query",
"bdb_tools.utils.gpubdb_argparser",
"bdb_tools.cluster_startup.attach_to_cluster",
"bdb_tools.utils.benchmark",
"bdb_tools.readers.build_reader",
"dask_cudf.concat"
] | [((1004, 1129), 'bdb_tools.readers.build_reader', 'build_reader', ([], {'data_format': "config['file_format']", 'basepath': "config['data_dir']", 'split_row_groups': "config['split_row_groups']"}), "(data_format=config['file_format'], basepath=config['data_dir'],\n split_row_groups=config['split_row_groups'])\n", (1... |
# Copyright (C) 2016 <NAME>. 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
# ========================================... | [
"tensorflow.app.flags.DEFINE_float",
"tensorflow.clip_by_value",
"skimage.transform.SimilarityTransform",
"cv2.remap",
"cv2.warpAffine",
"tensorflow.image.resize_bilinear",
"tensorflow.image.decode_png",
"numpy.arange",
"tensorflow.split",
"tensorflow.app.flags.DEFINE_integer",
"tensorflow.nn.mo... | [((1574, 1663), 'tensorflow.app.flags.DEFINE_integer', 'tf.app.flags.DEFINE_integer', (['"""image_size"""', '(299)', '"""Provide square images of this size."""'], {}), "('image_size', 299,\n 'Provide square images of this size.')\n", (1601, 1663), True, 'import tensorflow as tf\n'), ((1692, 1806), 'tensorflow.app.fl... |
# Copyright 2022 Sony Semiconductors Israel, Inc. 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 b... | [
"unittest.main",
"keras.Input",
"model_compression_toolkit.core.tpc_models.keras_tp_models.keras_default.generate_keras_default_tpc",
"keras.Model",
"model_compression_toolkit.core.common.quantization.quantization_analyzer.analyzer_graph",
"model_compression_toolkit.core.common.mixed_precision.bit_width_s... | [((2331, 2397), 'numpy.random.normal', 'np.random.normal', ([], {'size': '[kernel, kernel, in_channels, out_channels]'}), '(size=[kernel, kernel, in_channels, out_channels])\n', (2347, 2397), True, 'import numpy as np\n'), ((2635, 2675), 'keras.Input', 'Input', ([], {'shape': '(16, 16, num_conv_channels)'}), '(shape=(1... |
import numpy as np
import copy
from pommerman import constants
from pommerman import utility
STEP_COUNT_POS = 0
DONE_POS = 1
AMMO_POS = 0
BLAST_STRENGTH_POS = 1
CAN_KICK_POS = 2
ALIVE_POS = 3
ROW_POS = 4
COL_POS = 5
class EnvSimulator:
@staticmethod
def get_initial_game_data(obs, my_id, max_steps=1000):
... | [
"copy.deepcopy",
"numpy.zeros",
"numpy.ones",
"numpy.where",
"pommerman.constants.InvalidAction",
"pommerman.constants.Action",
"pommerman.utility.position_in_items",
"numpy.vstack"
] | [((1538, 1595), 'numpy.vstack', 'np.vstack', (['[game_data, game_info, player1row, player2row]'], {}), '([game_data, game_info, player1row, player2row])\n', (1547, 1595), True, 'import numpy as np\n'), ((14201, 14309), 'pommerman.utility.position_in_items', 'utility.position_in_items', (['game_data', '(next_row, next_c... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 16:33:05 2018
@author: lhe39759
"""
import keras
import os
import PIL
import numpy as np
import tensorflow as tf
import sys
sys.path.append(r'C:\Users\lhe39759\Documents\GitHub/')
from SliceOPy import NetSlice, DataSlice
from model.losses import bce_dice_loss, bce_dic... | [
"sys.path.append",
"numpy.pad",
"keras.layers.MaxPooling2D",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"PIL.Image.open",
"keras.layers.Dense",
"numpy.array",
"keras.layers.Conv2D",
"SliceOPy.NetSlice",
"SliceOPy.DataSlice",
"os.listdir"
] | [((176, 234), 'sys.path.append', 'sys.path.append', (['"""C:\\\\Users\\\\lhe39759\\\\Documents\\\\GitHub/"""'], {}), "('C:\\\\Users\\\\lhe39759\\\\Documents\\\\GitHub/')\n", (191, 234), False, 'import sys\n'), ((3161, 3268), 'SliceOPy.DataSlice', 'DataSlice', ([], {'Features': 'features', 'Labels': 'labels', 'Shuffle':... |
import sklearn, re, nltk, base64, json, urllib2, os
import numpy as np
import cPickle as pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
import os
MIN_RESULTS = 30 # Minimum number of results needed for valid user input
BASE_SEARCH_URL = 'h... | [
"os.getenv",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.multiply",
"json.loads",
"sklearn.feature_extraction.text.TfidfVectorizer",
"urllib2.Request",
"nltk.data.path.append",
"cPickle.load",
"nltk.word_tokenize",
"numpy.argsort",
"os.path.isfile",
"base64.b64encode",
"re.sub"... | [((451, 486), 'nltk.data.path.append', 'nltk.data.path.append', (['"""nltk_data/"""'], {}), "('nltk_data/')\n", (472, 486), False, 'import sklearn, re, nltk, base64, json, urllib2, os\n'), ((607, 634), 'os.path.isfile', 'os.path.isfile', (['"""config.py"""'], {}), "('config.py')\n", (621, 634), False, 'import os\n'), (... |
# -*- coding:utf-8 -*-
"""
股票技术指标接口
Created on 2018/05/26
@author: <NAME>
@group : **
@contact: <EMAIL>
"""
def ma(data, n=10, val_name="close"):
import numpy as np
'''
移动平均线 Moving Average
Parameters
------
data:pandas.DataFrame
通过 get_h_data 取得的股票数据
n:int
... | [
"matplotlib.pyplot.title",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.isclose",
"matplotlib.pyplot.tight_layout",
"numpy.true_divide",
"numpy.std",
"numpy.append",
"matplotlib.pyplot.xticks",
"numpy.average",
"matplotlib.pyplot.show",
"numpy.asarray",
"matplotlib.pyplot.legend",
"matp... | [((685, 699), 'numpy.asarray', 'np.asarray', (['MA'], {}), '(MA)\n', (695, 699), True, 'import numpy as np\n'), ((1257, 1271), 'numpy.asarray', 'np.asarray', (['MD'], {}), '(MD)\n', (1267, 1271), True, 'import numpy as np\n'), ((2290, 2305), 'numpy.asarray', 'np.asarray', (['EMA'], {}), '(EMA)\n', (2300, 2305), True, '... |
import mxnet as mx
import mxnet.ndarray as nd
import mxnet.gluon as gluon
import gluonnlp
from mxnet.io import NDArrayIter
from tqdm import tqdm
import json
import argparse
import pandas as pd
import os
import sys
import numpy as np
from gensim.corpora import Dictionary
from sklearn.metrics import recall_score, confus... | [
"mxnet.ndarray.array",
"argparse.ArgumentParser",
"os.walk",
"mxnet.gluon.nn.Dropout",
"numpy.mean",
"os.path.join",
"sys.path.append",
"json.loads",
"gensim.corpora.Dictionary.load",
"mxnet.io.NDArrayIter",
"mxnet.gpu",
"tqdm.tqdm",
"mxnet.gluon.rnn.LSTM",
"register_experiment.Register",
... | [((368, 377), 'mxnet.cpu', 'mx.cpu', (['(0)'], {}), '(0)\n', (374, 377), True, 'import mxnet as mx\n'), ((450, 508), 'mxnet.ndarray.ones', 'nd.ones', (['(num_lines, SEQ_LENGTH)'], {'dtype': '"""float32"""', 'ctx': 'ctx'}), "((num_lines, SEQ_LENGTH), dtype='float32', ctx=ctx)\n", (457, 508), True, 'import mxnet.ndarray ... |
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
import tensorflow as tf
import numpy as np
import pandas as pd
import time
from numpy import genfromtxt
from scipy import stats
# In[2]:
start_time = time.time()
# In[3]:
def read_data(file_name):
df = pd.rea... | [
"pandas.read_csv",
"numpy.empty",
"tensorflow.reshape",
"tensorflow.matmul",
"scipy.stats.describe",
"tensorflow.one_hot",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.placeholder",
"tensorflow.cast",
"numpy.append",
"tensorflow.equal",
"matplotlib.pyplot.show",
"tensorflow... | [((255, 266), 'time.time', 'time.time', ([], {}), '()\n', (264, 266), False, 'import time\n'), ((1126, 1158), 'numpy.empty', 'np.empty', ([], {'shape': '[1]', 'dtype': 'float'}), '(shape=[1], dtype=float)\n', (1134, 1158), True, 'import numpy as np\n'), ((1178, 1227), 'tensorflow.placeholder', 'tf.placeholder', (['tf.f... |
import os
import sys
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../..'))
from utils.general_class import ModelPlugin
from utils.ortools_op import SolveMaxMatching
from utils.visual_op import matrix_image2big_image
from utils.writer_op import write_pkl, write_gif
from utils.tqdm_op import... | [
"tensorflow.trainable_variables",
"tensorflow.get_collection",
"tensorflow.reset_default_graph",
"utils.eval_op.DisentanglemetricFactorMask",
"os.path.dirname",
"tensorflow.set_random_seed",
"tfops.transform_op.apply_tf_op_multi_output",
"tensorflow.placeholder",
"tensorflow.losses.get_regularizatio... | [((1050, 1074), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (1072, 1074), True, 'import tensorflow as tf\n'), ((1083, 1118), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['self.args.rseed'], {}), '(self.args.rseed)\n', (1101, 1118), True, 'import tensorflow as tf\n'), ((1142, 1... |
from skfda.representation.basis import (Basis, FDataBasis, Constant, Monomial,
BSpline, Fourier)
from skfda.representation.grid import FDataGrid
from skfda import concatenate
import unittest
import numpy as np
class TestBasis(unittest.TestCase):
# def setUp(self): could b... | [
"numpy.sin",
"numpy.arange",
"numpy.testing.assert_array_almost_equal",
"numpy.atleast_2d",
"unittest.main",
"skfda.representation.basis.BSpline",
"numpy.testing.assert_almost_equal",
"numpy.identity",
"numpy.linspace",
"numpy.testing.assert_equal",
"numpy.testing.assert_raises",
"skfda.repres... | [((22203, 22218), 'unittest.main', 'unittest.main', ([], {}), '()\n', (22216, 22218), False, 'import unittest\n'), ((409, 429), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(5)'], {}), '(0, 1, 5)\n', (420, 429), True, 'import numpy as np\n'), ((504, 530), 'skfda.representation.basis.BSpline', 'BSpline', (['(0, 1)'... |
import numpy as np
import sys as sys
import csv
sys.path.insert(1, './../Tools')
from DispersionRelationDeterminantFullConductivityZeff import VectorFinder_auto_Extensive
#************Start of user block******************
#para= [nu, zeff,eta, shat, beta, ky, mu]
para_min=[0.1, 1., 0.5, 0.001,0.0005, 0.01, 0.... | [
"csv.writer",
"sys.path.insert",
"numpy.imag",
"numpy.array",
"DispersionRelationDeterminantFullConductivityZeff.VectorFinder_auto_Extensive",
"numpy.real",
"numpy.random.rand"
] | [((48, 80), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""./../Tools"""'], {}), "(1, './../Tools')\n", (63, 80), True, 'import sys as sys\n'), ((505, 523), 'numpy.array', 'np.array', (['para_min'], {}), '(para_min)\n', (513, 523), True, 'import numpy as np\n'), ((533, 551), 'numpy.array', 'np.array', (['para_max']... |
#!/usr/bin/env python3get_coo
"""
Lattice dynamics model
"""
import h5py
import os
from itertools import product
import numpy as np
from numpy.linalg import norm
import scipy.linalg
import scipy.io
import scipy.sparse
from scipy.sparse import lil_matrix as spmat
from .basic_lattice_model import BasicLatticeModel
f... | [
"numpy.abs",
"numpy.sum",
"f_phonon.f_phonon.get_dm",
"numpy.ones",
"scipy.sparse.lil_matrix",
"os.path.isfile",
"numpy.arange",
"numpy.linalg.norm",
"numpy.mean",
"numpy.exp",
"numpy.full",
"os.path.abspath",
"numpy.zeros_like",
"os.path.dirname",
"numpy.savetxt",
"os.path.exists",
... | [((778, 805), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (795, 805), False, 'import logging\n'), ((6201, 6223), 'numpy.array', 'np.array', (['self.fct_ord'], {}), '(self.fct_ord)\n', (6209, 6223), True, 'import numpy as np\n'), ((11246, 11266), 'numpy.zeros', 'np.zeros', (['self.ncorr... |
import glob
import os
import rawpy
import numpy as np
# Returns a tuble
def getInputImagesList():
# Get all short exposure images
res = glob.glob('./dataset/sony/short/0*.ARW')
res.sort()
return (res, [int(os.path.basename(res)[0:5]) for res in res])
def getGroundtruthImagesList():
# Get all shor... | [
"numpy.maximum",
"os.path.basename",
"numpy.expand_dims",
"glob.glob",
"numpy.concatenate"
] | [((146, 186), 'glob.glob', 'glob.glob', (['"""./dataset/sony/short/0*.ARW"""'], {}), "('./dataset/sony/short/0*.ARW')\n", (155, 186), False, 'import glob\n'), ((348, 387), 'glob.glob', 'glob.glob', (['"""./dataset/sony/long/0*.ARW"""'], {}), "('./dataset/sony/long/0*.ARW')\n", (357, 387), False, 'import glob\n'), ((511... |
# coding=utf-8
import xml.etree.ElementTree as ET
import sys
import os
import glob
import shutil
import cv2
from multiprocessing import Pool
from multiprocessing import Manager
from multiprocessing import Process
import numpy as np
import pickle
def restore_file(path):
df = open(path, 'rb')
file = pickle.load... | [
"xml.etree.ElementTree.parse",
"pickle.dump",
"os.mkdir",
"os.path.basename",
"cv2.imwrite",
"os.path.exists",
"cv2.imread",
"pickle.load",
"numpy.arange",
"glob.glob",
"shutil.copyfile",
"multiprocessing.Process",
"os.listdir",
"cv2.resize"
] | [((309, 324), 'pickle.load', 'pickle.load', (['df'], {}), '(df)\n', (320, 324), False, 'import pickle\n'), ((634, 652), 'xml.etree.ElementTree.parse', 'ET.parse', (['xml_path'], {}), '(xml_path)\n', (642, 652), True, 'import xml.etree.ElementTree as ET\n'), ((1723, 1760), 'glob.glob', 'glob.glob', (['"""cuhk03_annotati... |
#pylint: disable=E1101, E0401, E1102, W0621, W0221
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import random
import time
from random import SystemRandom
import models
import utils
parser = argparse.ArgumentParser()
parser.add_argument('--niters', type=int, default... | [
"utils.get_activity_data",
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.cat",
"torch.randn",
"torch.exp",
"random.seed",
"torch.nn.Linear",
"torch.manual_seed",
"torch.cuda.manual_seed",
"torch.optim.Adam",
"torch.cuda.is_available",
"utils.count_parameters",
"torch.nn.ReLU",
"... | [((245, 270), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (268, 270), False, 'import argparse\n'), ((1963, 1986), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (1980, 1986), False, 'import torch\n'), ((1991, 2011), 'numpy.random.seed', 'np.random.seed', (['seed'], {})... |
"""Gaussian process-based minimization algorithms."""
import numpy as np
from sklearn.utils import check_random_state
from .base import base_minimize
from ..utils import cook_estimator
from ..utils import normalize_dimensions
def gp_minimize(func, dimensions, base_estimator=None,
n_calls=100, n_ran... | [
"sklearn.utils.check_random_state",
"numpy.iinfo"
] | [((10132, 10164), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (10150, 10164), False, 'from sklearn.utils import check_random_state\n'), ((10342, 10360), 'numpy.iinfo', 'np.iinfo', (['np.int32'], {}), '(np.int32)\n', (10350, 10360), True, 'import numpy as np\n')] |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"numpy.abs",
"gan.utils.apply_external_world_force_on_local_point",
"torch.no_grad",
"os.path.join",
"collections.deque",
"gym.utils.seeding.np_random",
"gan.utils.push_recent_value",
"gan.utils.perturb",
"gan.utils.load",
"numpy.minimum",
"numpy.tanh",
"pybullet_utils.bullet_client.BulletClie... | [((3675, 3691), 'collections.deque', 'deque', ([], {'maxlen': '(10)'}), '(maxlen=10)\n', (3680, 3691), False, 'from collections import deque\n'), ((3723, 3739), 'collections.deque', 'deque', ([], {'maxlen': '(10)'}), '(maxlen=10)\n', (3728, 3739), False, 'from collections import deque\n'), ((5809, 5873), 'gym.spaces.Bo... |
"""
This script acts as a placeholder to set a threshold for cands >b
and compare those cands with our gold data.
"""
import csv
import logging
import os
import pickle
from enum import Enum
import numpy as np
from tqdm import tqdm
from hack.transistors.transistor_utils import (
Score,
compare_entities,
en... | [
"os.path.abspath",
"hack.transistors.transistor_utils.Score",
"csv.reader",
"csv.writer",
"hack.transistors.transistor_utils.get_implied_parts",
"logging.StreamHandler",
"hack.transistors.transistor_utils.entity_level_scores",
"pickle.load",
"numpy.linspace",
"hack.transistors.transistor_utils.get... | [((747, 774), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (764, 774), False, 'import logging\n'), ((1041, 1091), 'os.path.join', 'os.path.join', (['dirname', '"""data/parts_by_doc_new.pkl"""'], {}), "(dirname, 'data/parts_by_doc_new.pkl')\n", (1053, 1091), False, 'import os\n'), ((4082... |
import bcolz
import numpy as np
def save_array(fname, arr):
c=bcolz.carray(arr, rootdir=fname, mode='w')
c.flush()
def load_array(fname):
return bcolz.open(fname)[:]
probs = np.load('/home/chicm/ml/kgdata/carvana/results/single/UNet_double_1024_5/submit/049/probs-part10.8.npy')
save_array('/home/chicm/... | [
"numpy.load",
"bcolz.open",
"bcolz.carray"
] | [((191, 305), 'numpy.load', 'np.load', (['"""/home/chicm/ml/kgdata/carvana/results/single/UNet_double_1024_5/submit/049/probs-part10.8.npy"""'], {}), "(\n '/home/chicm/ml/kgdata/carvana/results/single/UNet_double_1024_5/submit/049/probs-part10.8.npy'\n )\n", (198, 305), True, 'import numpy as np\n'), ((68, 110), ... |
"""Driver class for SpaceMouse controller.
This class provides a driver support to SpaceMouse on Mac OS X.
In particular, we assume you are using a SpaceMouse Wireless by default.
To set up a new SpaceMouse controller:
1. Download and install driver from https://www.3dconnexion.com/service/drivers.html
2. Ins... | [
"threading.Thread",
"hid.device",
"spirl.data.block_stacking.src.robosuite.utils.transform_utils.rotation_matrix",
"time.sleep",
"time.time",
"numpy.array",
"collections.namedtuple"
] | [((1320, 1382), 'collections.namedtuple', 'namedtuple', (['"""AxisSpec"""', "['channel', 'byte1', 'byte2', 'scale']"], {}), "('AxisSpec', ['channel', 'byte1', 'byte2', 'scale'])\n", (1330, 1382), False, 'from collections import namedtuple\n'), ((2863, 2875), 'hid.device', 'hid.device', ([], {}), '()\n', (2873, 2875), F... |
import numpy as np
from .combine_data import combination_column_range_map
from .load_dataset import load_dataset_np
def statistics(dataset):
if isinstance(dataset, str):
dataset = load_dataset_np(dataset_name=dataset)
if not isinstance(dataset, np.ndarray):
raise TypeError('dataset must be np... | [
"numpy.nanmedian",
"numpy.nanstd",
"numpy.nanmin",
"numpy.nanvar",
"numpy.nanmax",
"numpy.nanmean"
] | [((373, 391), 'numpy.nanmin', 'np.nanmin', (['dataset'], {}), '(dataset)\n', (382, 391), True, 'import numpy as np\n'), ((402, 420), 'numpy.nanmax', 'np.nanmax', (['dataset'], {}), '(dataset)\n', (411, 420), True, 'import numpy as np\n'), ((434, 455), 'numpy.nanmedian', 'np.nanmedian', (['dataset'], {}), '(dataset)\n',... |
import os
import functools
import numpy as np
from keras.models import Sequential
from keras.layers import Embedding, SimpleRNN, Dense, Dropout
from keras.callbacks import EarlyStopping
from utilnn import accuracy, fscore, coef
def load_data(labels_prefix):
"""
@param labels_prefix: 'classfication' or 'regres... | [
"keras.layers.SimpleRNN",
"functools.partial",
"numpy.load",
"utilnn.coef",
"utilnn.fscore",
"keras.layers.Dropout",
"utilnn.accuracy",
"keras.layers.Dense",
"keras.callbacks.EarlyStopping",
"keras.layers.Embedding",
"keras.models.Sequential",
"os.path.join"
] | [((4815, 4856), 'functools.partial', 'functools.partial', (['rnn'], {'train_embedding': '(0)'}), '(rnn, train_embedding=0)\n', (4832, 4856), False, 'import functools\n'), ((4874, 4915), 'functools.partial', 'functools.partial', (['rnn'], {'train_embedding': '(1)'}), '(rnn, train_embedding=1)\n', (4891, 4915), False, 'i... |
#!/usr/bin/env python
"""test_atom.py: Verify the Atom class functions as it's meant to."""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import unittest as ut
import numpy as np
from miniapp.system import atom
class TestAtom(ut.TestCase):
"""Unit tests for the Atom class.
"""
def test_1(self... | [
"miniapp.system.atom.Atom",
"numpy.array"
] | [((450, 475), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0]'], {}), '([1.0, 1.0, 1.0])\n', (458, 475), True, 'import numpy as np\n'), ((497, 534), 'miniapp.system.atom.Atom', 'atom.Atom', (['atom_type', 'position_vector'], {}), '(atom_type, position_vector)\n', (506, 534), False, 'from miniapp.system import atom\n')] |
import sys
import teca_py
import numpy as np
class teca_tc_wind_radii_stats(teca_py.teca_python_algorithm):
"""
Computes statistics using track wind radii
"""
def __init__(self):
self.basename = 'stats'
self.dpi = 100
self.interactive = False
self.wind_column = 'surface_... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.figure",
"matplotlib.colors.LogNorm",
"matplotlib.pyplot.gca",
"matplotlib.patches.Patch",
"numpy.max",
"teca_py.as_teca_table",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"teca_py.teca_tc_saffir_simpson.get_u... | [((1697, 1730), 'teca_py.as_teca_table', 'teca_py.as_teca_table', (['data_in[0]'], {}), '(data_in[0])\n', (1718, 1730), False, 'import teca_py\n'), ((2053, 2099), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(9.25, 6.75)', 'dpi': 'self.dpi'}), '(figsize=(9.25, 6.75), dpi=self.dpi)\n', (2063, 2099), True,... |
# set the matplotlib backend so figures can be saved in the background
import matplotlib
matplotlib.use("Agg")
# import the necessary packages
from pyimagesearch.convautoencoder import ConvAutoencoder
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.datasets import mnist
import matplotlib.pyplot as p... | [
"matplotlib.pyplot.title",
"pyimagesearch.convautoencoder.ConvAutoencoder.build",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"cv2.imwrite",
"matplotlib.pyplot.legend",
"numpy.expand_dims",
"tensorflow.keras.datasets.mnist.load_data",
"numpy.hstack",
"matplotlib.pyplot.style.use",
"matp... | [((89, 110), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (103, 110), False, 'import matplotlib\n'), ((430, 455), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (453, 455), False, 'import argparse\n'), ((980, 997), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.loa... |
from typing import List, Tuple, Type
import numpy as np
from continuum.datasets.base import _ContinuumDataset
from continuum.datasets.pytorch import (CIFAR10, CIFAR100, KMNIST, MNIST, FashionMNIST)
class Fellowship(_ContinuumDataset):
def __init__(
self,
dataset_list: List[Type[_ContinuumDatase... | [
"numpy.unique",
"numpy.concatenate"
] | [((865, 882), 'numpy.concatenate', 'np.concatenate', (['x'], {}), '(x)\n', (879, 882), True, 'import numpy as np\n'), ((895, 912), 'numpy.concatenate', 'np.concatenate', (['y'], {}), '(y)\n', (909, 912), True, 'import numpy as np\n'), ((832, 850), 'numpy.unique', 'np.unique', (['data[1]'], {}), '(data[1])\n', (841, 850... |
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
from math import log
from random import randint #, shuffle, sample
from functools import reduce
from operator import __or__
import numpy as np
import pytest
from mmgroup.bitfunctions import bit_mat_mul, bit_ma... | [
"mmgroup.clifford12.bitmatrix64_error_pool",
"random.randint",
"mmgroup.clifford12.bitmatrix64_cap_h",
"mmgroup.bitfunctions.bit_mat_inverse",
"mmgroup.clifford12.bitmatrix64_mul",
"mmgroup.clifford12.bitmatrix64_t",
"numpy.zeros",
"mmgroup.clifford12.bitmatrix64_inv",
"numpy.array",
"mmgroup.bitf... | [((929, 942), 'random.randint', 'randint', (['(0)', 'm'], {}), '(0, m)\n', (936, 942), False, 'from random import randint\n'), ((1575, 1597), 'mmgroup.clifford12.bitmatrix64_t', 'bitmatrix64_t', (['m', 'cols'], {}), '(m, cols)\n', (1588, 1597), False, 'from mmgroup.clifford12 import bitmatrix64_t\n'), ((3304, 3343), 'n... |
import numpy as np
import colorlover as cl
from multiagent.scenario import BaseScenario
from mdac.utils.entities import Drone, TargetLandmark, SupplyEntity
from mdac.utils.worlds import DroneWorld
class Scenario(BaseScenario):
def make_world(self):
n_lidar_per_agent = 256
world = DroneWorld(n_lida... | [
"numpy.random.uniform",
"numpy.abs",
"numpy.copy",
"numpy.zeros",
"mdac.utils.entities.TargetLandmark",
"colorlover.to_numeric",
"mdac.utils.entities.Drone",
"numpy.linalg.norm",
"mdac.utils.worlds.DroneWorld",
"numpy.concatenate"
] | [((303, 373), 'mdac.utils.worlds.DroneWorld', 'DroneWorld', ([], {'n_lidar_per_agent': 'n_lidar_per_agent', 'mem_frames': '(1)', 'dt': '(0.08)'}), '(n_lidar_per_agent=n_lidar_per_agent, mem_frames=1, dt=0.08)\n', (313, 373), False, 'from mdac.utils.worlds import DroneWorld\n'), ((1458, 1486), 'numpy.random.uniform', 'n... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.frozen_keras.utils.conv_utils.convert_data_format",
"tensorflow.python.frozen_keras.utils.conv_utils.normalize_data_format",
"tensorflow.python.frozen_keras.utils.conv_utils.conv_input_length",
"numpy.zeros",
"numpy.ones",
"absl.testing.paramete... | [((5908, 5946), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['input_shapes'], {}), '(input_shapes)\n', (5932, 5946), False, 'from absl.testing import parameterized\n'), ((10756, 10767), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10765, 10767), False, 'from tensorfl... |
import numpy as np
from numpy.testing import *
from supreme.register.radial_sum import radial_sum
def test_basic():
x = np.array([[1, 0, 2],
[0, 5, 0],
[3, 0, 4]], dtype=np.double)
R = radial_sum(x)
pi = np.pi
assert_array_equal(R[[135, 45, 225, 315]], [1, 2, 3, 4])... | [
"supreme.register.radial_sum.radial_sum",
"numpy.array"
] | [((126, 186), 'numpy.array', 'np.array', (['[[1, 0, 2], [0, 5, 0], [3, 0, 4]]'], {'dtype': 'np.double'}), '([[1, 0, 2], [0, 5, 0], [3, 0, 4]], dtype=np.double)\n', (134, 186), True, 'import numpy as np\n'), ((231, 244), 'supreme.register.radial_sum.radial_sum', 'radial_sum', (['x'], {}), '(x)\n', (241, 244), False, 'fr... |
from __future__ import print_function
import torch.nn.init as init
import argparse
import time
import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.utils.data
from torch.autograd import Variable
import matplotlib.pyplot ... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"argparse.ArgumentParser",
"seaborn.kdeplot",
"matplotlib.pyplot.figure",
"torch.nn.BCELoss",
"random.randint",
"matplotlib.pyplot.close",
"torch.load",
"matplotlib.pyplot.yticks",
"torch.FloatTensor",
"torch.nn.init.orthogonal",
"time.clock",
... | [((365, 398), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (388, 398), False, 'import warnings\n'), ((558, 583), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (576, 583), True, 'import matplotlib.pyplot as plt\n'), ((594, 619... |
"""
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 writin... | [
"numpy.exp",
"nncf.registry.Registry",
"nncf.config.NNCFConfig",
"numpy.log"
] | [((772, 802), 'nncf.registry.Registry', 'Registry', (['"""pruning_schedulers"""'], {}), "('pruning_schedulers')\n", (780, 802), False, 'from nncf.registry import Registry\n'), ((997, 1009), 'nncf.config.NNCFConfig', 'NNCFConfig', ([], {}), '()\n', (1007, 1009), False, 'from nncf.config import NNCFConfig\n'), ((3807, 38... |
import geopandas as gpd
import numpy as np
import pandas as pd
from shapely.geometry import Point, LineString, Polygon
def convert_geo_list_to_geoseries(geo_list):
for i in range(0, len(geo_list)):
try:
out = out.append(geo_list[i])
except:
out = gpd.GeoSeries(geo_list[i])... | [
"geopandas.GeoSeries",
"shapely.geometry.Polygon",
"numpy.min",
"numpy.max",
"numpy.unique"
] | [((890, 915), 'numpy.unique', 'np.unique', (['scanline.xy[0]'], {}), '(scanline.xy[0])\n', (899, 915), True, 'import numpy as np\n'), ((2032, 2057), 'numpy.unique', 'np.unique', (['scanline.xy[1]'], {}), '(scanline.xy[1])\n', (2041, 2057), True, 'import numpy as np\n'), ((3027, 3136), 'shapely.geometry.Polygon', 'Polyg... |
import os,copy
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict
def read_spectral_k(filename="tc_dos.dat"):
"""
Reads the spectrial thermal conductivity information
"""
tcdos_labels = [
"wavelength",
"k_xx_raw","k_yy_raw","k... | [
"copy.deepcopy",
"matplotlib.pyplot.legend",
"os.path.isfile",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.rc",
"collections.OrderedDict",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join"
] | [((944, 957), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (955, 957), False, 'from collections import OrderedDict\n'), ((1230, 1243), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1241, 1243), False, 'from collections import OrderedDict\n'), ((4479, 4521), 'os.path.join', 'os.path.join', ... |
import sys
import time
import numpy as np
import pyaudio
from scipy import fftpack
from scipy.io import wavfile
import notes
from player import play
if len(sys.argv) < 2:
print(f'Usage: python app.py <WAV_FILE>')
sys.exit(1)
audio_input_file = sys.argv[1]
fs, audio_input = wavfile.read(audio_input_file)
pri... | [
"numpy.abs",
"notes.generate_sound_from_note",
"player.play",
"notes.frequencies_to_notes",
"time.time",
"scipy.io.wavfile.read",
"scipy.fftpack.fft",
"numpy.sort",
"numpy.mean",
"notes.frequencies",
"sys.exit",
"scipy.fftpack.fftfreq",
"numpy.unique"
] | [((286, 316), 'scipy.io.wavfile.read', 'wavfile.read', (['audio_input_file'], {}), '(audio_input_file)\n', (298, 316), False, 'from scipy.io import wavfile\n'), ((366, 438), 'player.play', 'play', (['audio_input'], {'volume': '(1)', 'rate': 'fs', 'channels': '(2)', 'format': 'pyaudio.paInt32'}), '(audio_input, volume=1... |
import torch
import numpy as np
def mpjpe(predicted, target):
"""
Mean per-joint position error (i.e. mean Euclidean distance),
often referred to as "Protocol #1" in many papers.
"""
assert predicted.shape == target.shape
return torch.mean(torch.norm(predicted - target, dim=len(target.shape)-1)... | [
"torch.mean",
"numpy.sum",
"torch.cat",
"torch.det",
"numpy.linalg.svd",
"numpy.mean",
"numpy.diff",
"numpy.matmul",
"numpy.random.rand",
"numpy.linalg.det",
"torch.matmul",
"torch.sum",
"torch.from_numpy"
] | [((921, 960), 'torch.mean', 'torch.mean', (['target'], {'dim': '(1)', 'keepdim': '(True)'}), '(target, dim=1, keepdim=True)\n', (931, 960), False, 'import torch\n'), ((971, 1013), 'torch.mean', 'torch.mean', (['predicted'], {'dim': '(1)', 'keepdim': '(True)'}), '(predicted, dim=1, keepdim=True)\n', (981, 1013), False, ... |
import numpy as np
import pandas as pd
import random
#from data import Data
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import KFold
from sklearn import metrics
from sklearn import svm
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
fr... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.naive_bayes.GaussianNB",
"sklearn.model_selection.cross_val_score",
"numpy.asarray",
"numpy.ones",
"numpy.hstack",
"numpy.append",
"sklearn.linear_model.LogisticRegression",
"sklearn.ensemble.VotingClassifier",
"numpy.mean",
"numpy.exp",
"skl... | [((1381, 1418), 'numpy.append', 'np.append', (['x_train0', 'x_train1'], {'axis': '(0)'}), '(x_train0, x_train1, axis=0)\n', (1390, 1418), True, 'import numpy as np\n'), ((1434, 1473), 'numpy.append', 'np.append', (['train_set1', 'x_train2'], {'axis': '(0)'}), '(train_set1, x_train2, axis=0)\n', (1443, 1473), True, 'imp... |
#! /usr/bin/env python
import tensorflow as tf
import numpy as np
import re
import os
import time
import datetime
import gc
import sys
import shutil
from input_helpers import InputHelper
from siamese_network_semantic import SiameseLSTMw2v
from tensorflow.contrib import learn
import gzip
from random import random
# Par... | [
"tensorflow.nn.zero_fraction",
"tensorflow.ConfigProto",
"tensorflow.global_variables",
"tensorflow.Variable",
"gc.collect",
"shutil.rmtree",
"tensorflow.summary.merge",
"tensorflow.get_default_graph",
"os.path.join",
"os.path.abspath",
"os.path.exists",
"input_helpers.InputHelper",
"tensorf... | [((381, 489), 'tensorflow.flags.DEFINE_string', 'tf.flags.DEFINE_string', (['"""training_filepath"""', '"""data/train_snli.txt"""', '"""training file path (default: None)"""'], {}), "('training_filepath', 'data/train_snli.txt',\n 'training file path (default: None)')\n", (403, 489), True, 'import tensorflow as tf\n'... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 19 10:28:35 2021
@author: <NAME> -Spatial structure index value distribution of urban streetscape
"""
import pickle
from database import postSQL2gpd,gpd2postSQL
import pandas as pd
xian_epsg=32649 #Xi'an WGS84 / UTM zone 49N
wgs84_epsg=4326
poi_classificationName={
... | [
"pandas.DataFrame",
"pickle.dump",
"matplotlib.pyplot.show",
"database.postSQL2gpd",
"numpy.zeros",
"geopandas.GeoDataFrame",
"sklearn.neighbors.NearestNeighbors",
"sklearn.preprocessing.normalize",
"pandas.Series",
"sklearn.cluster.AgglomerativeClustering",
"math.log",
"pandas.concat",
"yel... | [((1137, 1154), 'numpy.zeros', 'np.zeros', (['poi_num'], {}), '(poi_num)\n', (1145, 1154), True, 'import numpy as np\n'), ((1230, 1282), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['geometry', 'frank_e', 'num']"}), "(columns=['geometry', 'frank_e', 'num'])\n", (1242, 1282), True, 'import pandas as pd\n'), ((... |
#!/usr/bin/env python
# Copyright 2019-2021 <NAME>
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL
# This script tests the particle scraping for the embedded boundary in RZ.
# Particles are initialized between r=0.15 and r=0.2
# having a negative radial velocity.
# A cylindrical embedded surface is pla... | [
"openpmd_viewer.OpenPMDTimeSeries",
"os.getcwd",
"sys.path.insert",
"checksumAPI.evaluate_checksum",
"yt.load",
"numpy.all"
] | [((782, 842), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../../../../warpx/Regression/Checksum/"""'], {}), "(1, '../../../../warpx/Regression/Checksum/')\n", (797, 842), False, 'import sys\n'), ((900, 911), 'yt.load', 'yt.load', (['fn'], {}), '(fn)\n', (907, 911), False, 'import yt\n'), ((1310, 1345), 'openpmd_... |
from __future__ import division, print_function
import numpy as np
from scipy import signal as sig
from matplotlib import pyplot as plt
import seaborn as sns
"""https://stackoverflow.com/questions/56551114/fully-monotone-interpolation-in-python """
# see also
# https://en.wikipedia.org/wiki/Monotone-spline aka I-spli... | [
"seaborn.set_style",
"numpy.fmax",
"matplotlib.pyplot.show",
"numpy.abs",
"scipy.signal.filtfilt",
"numpy.asarray",
"matplotlib.pyplot.vlines",
"numpy.cumsum",
"numpy.where",
"numpy.array",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.subplots",
"scipy.signal.butter",
"numpy.gra... | [((533, 555), 'scipy.signal.butter', 'sig.butter', ([], {'N': '(2)', 'Wn': 'Wn'}), '(N=2, Wn=Wn)\n', (543, 555), True, 'from scipy import signal as sig\n'), ((569, 616), 'scipy.signal.filtfilt', 'sig.filtfilt', (['b', 'a', 'x'], {'axis': 'axis', 'method': '"""gust"""'}), "(b, a, x, axis=axis, method='gust')\n", (581, 6... |
import numpy
from matplotlib import pyplot
import chaospy
pyplot.rc("figure", figsize=[3, 2])
COLOR1 = "steelblue"
COLOR2 = "slategray"
def save(name):
pyplot.axis("off")
pyplot.savefig(
f"./{name}.png",
bbox_inches="tight",
transparent=True,
)
pyplot.clf()
def make_distrib... | [
"numpy.random.seed",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.scatter",
"chaospy.Exponential",
"matplotlib.pyplot.bar",
"chaospy.Uniform",
"matplotlib.pyplot.axis",
"chaospy.variable",
"numpy.sin",
"numpy.array",
"matplotlib.pyplot.rc",
"numpy.linspace",
"chaos... | [((59, 94), 'matplotlib.pyplot.rc', 'pyplot.rc', (['"""figure"""'], {'figsize': '[3, 2]'}), "('figure', figsize=[3, 2])\n", (68, 94), False, 'from matplotlib import pyplot\n'), ((160, 178), 'matplotlib.pyplot.axis', 'pyplot.axis', (['"""off"""'], {}), "('off')\n", (171, 178), False, 'from matplotlib import pyplot\n'), ... |
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"tensorflow.compat.v2.nest.map_structure",
"numpy.sum",
"numpy.ones",
"numpy.shape",
"tensorflow.compat.v2.rank",
"numpy.arange",
"dice_rl.data.dataset.convert_to_tfagents_timestep",
"numpy.transpose",
"tensorflow.compat.v2.shape",
"numpy.equal",
"numpy.reshape",
"tf_agents.specs.tensor_spec.i... | [((1038, 1067), 'tf_agents.specs.tensor_spec.is_discrete', 'tensor_spec.is_discrete', (['spec'], {}), '(spec)\n', (1061, 1067), False, 'from tf_agents.specs import tensor_spec\n'), ((1072, 1100), 'tf_agents.specs.tensor_spec.is_bounded', 'tensor_spec.is_bounded', (['spec'], {}), '(spec)\n', (1094, 1100), False, 'from t... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 17 10:49:15 2016
@author: yxl
"""
from imagepy import IPy
import numpy as np
from imagepy.ui.canvasframe import CanvasFrame
from imagepy.core.manager import ImageManager, WindowsManager
from imagepy.core.engine import Simple
from skimage import color
class SplitRGB(Simple... | [
"skimage.color.rgbcie2rgb",
"numpy.maximum",
"skimage.color.hsv2rgb",
"skimage.color.rgb2gray",
"skimage.color.rgb2luv",
"skimage.color.rgb2hsv",
"imagepy.core.manager.ImageManager.close",
"imagepy.IPy.alert",
"skimage.color.lab2rgb",
"skimage.color.rgb2rgbcie",
"skimage.color.rgb2xyz",
"numpy... | [((3325, 3343), 'skimage.color.rgb2hsv', 'color.rgb2hsv', (['img'], {}), '(img)\n', (3338, 3343), False, 'from skimage import color\n'), ((3635, 3687), 'numpy.array', 'np.array', (['(img1.T, img2.T, img3.T)'], {'dtype': 'np.float64'}), '((img1.T, img2.T, img3.T), dtype=np.float64)\n', (3643, 3687), True, 'import numpy ... |
"""The main script for training the model."""
from arima_model import ARIMA
import torch
import numpy as np
import plotly.graph_objects as go
trainSize = 14
sampleData = torch.tensor(np.load('data.npy'))
sampleSize = len(sampleData)
trainData = sampleData[:trainSize]
predictionModel = ARIMA(p=0, d=1, q=1)
predictio... | [
"numpy.load",
"plotly.graph_objects.Figure",
"torch.arange",
"numpy.random.normal",
"torch.zeros",
"torch.no_grad",
"arima_model.ARIMA"
] | [((290, 310), 'arima_model.ARIMA', 'ARIMA', ([], {'p': '(0)', 'd': '(1)', 'q': '(1)'}), '(p=0, d=1, q=1)\n', (295, 310), False, 'from arima_model import ARIMA\n'), ((420, 443), 'torch.zeros', 'torch.zeros', (['sampleSize'], {}), '(sampleSize)\n', (431, 443), False, 'import torch\n'), ((764, 775), 'plotly.graph_objects.... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
import numpy as np
import pdb
from functools import partial
from opts import parser
args = parser.parse_args()
from ops.rstg import *
__all__ = [
'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resne... | [
"torch.nn.Dropout",
"torch.nn.BatchNorm3d",
"torch.nn.ReLU",
"torch.nn.AdaptiveAvgPool3d",
"torch.stack",
"torch.nn.Sequential",
"torch.nn.Conv3d",
"math.ceil",
"torch.load",
"numpy.zeros",
"torch.cat",
"numpy.ones",
"torch.nn.functional.avg_pool3d",
"torch.nn.Linear",
"opts.parser.parse... | [((208, 227), 'opts.parser.parse_args', 'parser.parse_args', ([], {}), '()\n', (225, 227), False, 'from opts import parser\n'), ((469, 558), 'torch.nn.Conv3d', 'nn.Conv3d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_siz... |
import json
from os.path import join as pjoin
import ctl
import nibabel as nib
import numpy as np
from utils import DATA_DIRS
NUM_VIEWS = 360
SDD = 1000.
SID = 750.
NUM_DET_PIXELS = 1024
DET_PIXEL_DIM = 1.
def create_fdk(filename: str):
nib_volume = nib.load(pjoin(DATA_DIRS['datasets'], filename))
nib_sha... | [
"ctl.AcquisitionSetup",
"json.load",
"ctl.VoxelVolumeF",
"ctl.XrayTube",
"ctl.FlatPanelDetector",
"ctl.TubularGantry",
"nibabel.save",
"ctl.CTSystem",
"ctl.ocl.RayCasterProjector",
"ctl.ocl.FDKReconstructor",
"numpy.eye",
"os.path.join",
"ctl.protocols.AxialScanTrajectory"
] | [((509, 523), 'ctl.CTSystem', 'ctl.CTSystem', ([], {}), '()\n', (521, 523), False, 'import ctl\n'), ((769, 808), 'ctl.AcquisitionSetup', 'ctl.AcquisitionSetup', (['system', 'NUM_VIEWS'], {}), '(system, NUM_VIEWS)\n', (789, 808), False, 'import ctl\n'), ((1010, 1038), 'ctl.ocl.RayCasterProjector', 'ctl.ocl.RayCasterProj... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.