code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
import cv2
import math
import itertools
jpeg_quantiz_matrix = np.array([[16, 11, 10, 16, 24, 40, 51, 61],
[12, 12, 14, 19, 26, 58, 60, 55],
[14, 13, 16, 24, 40, 57, 69, 56],
[14, 17, 22, 29, 51, ... | [
"numpy.uint8",
"cv2.imwrite",
"cv2.dct",
"math.ceil",
"cv2.VideoWriter",
"numpy.array",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.idct",
"cv2.cvtColor",
"numpy.zeros_like",
"numpy.float32",
"numpy.round"
] | [((88, 394), 'numpy.array', 'np.array', (['[[16, 11, 10, 16, 24, 40, 51, 61], [12, 12, 14, 19, 26, 58, 60, 55], [14, \n 13, 16, 24, 40, 57, 69, 56], [14, 17, 22, 29, 51, 87, 80, 62], [18, 22,\n 37, 56, 68, 109, 103, 77], [24, 35, 55, 64, 81, 104, 113, 92], [49, 64,\n 78, 87, 103, 121, 120, 101], [72, 92, 95, 9... |
'''
Test file for the dce_models sub-module
'''
import pytest
import os
import sys
import numpy as np
from tempfile import TemporaryDirectory
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'src')))
#---------------------------------------------------------------------------... | [
"QbiPy.dce_models.dibem.concentration_from_model",
"pytest.approx",
"QbiPy.dce_models.two_cxm_model.params_to_DIBEM",
"QbiPy.dce_models.two_cxm_model.params_from_DIBEM",
"QbiPy.dce_models.active_uptake_model.params_to_DIBEM",
"QbiPy.dce_models.active_uptake_model.params_from_DIBEM",
"numpy.linspace",
... | [((697, 762), 'QbiPy.dce_models.active_uptake_model.params_to_DIBEM', 'active_uptake_model.params_to_DIBEM', (['F_p', 'v_ecs', 'k_i', 'k_ef', '(False)'], {}), '(F_p, v_ecs, k_i, k_ef, False)\n', (732, 762), False, 'from QbiPy.dce_models import dibem, two_cxm_model, active_uptake_model\n'), ((795, 854), 'QbiPy.dce_model... |
"""
Currently I only have support for Cora dataset - feel free to add your own graph data.
You can find the details on how Cora was constructed here: http://eliassi.org/papers/ai-mag-tr08.pdf
TL;DR:
The feature vectors are 1433 features long. The authors found the most frequent words across every paper... | [
"networkx.from_dict_of_lists",
"numpy.identity",
"pickle.dump",
"numpy.power",
"networkx.adjacency_matrix",
"numpy.arange",
"pickle.load",
"scipy.sparse.issparse",
"utils.visualizations.plot_in_out_degree_distributions",
"torch.tensor",
"numpy.row_stack",
"utils.visualizations.visualize_graph"... | [((6174, 6207), 'scipy.sparse.issparse', 'sp.issparse', (['node_features_sparse'], {}), '(node_features_sparse)\n', (6185, 6207), True, 'import scipy.sparse as sp\n'), ((7169, 7200), 'scipy.sparse.diags', 'sp.diags', (['node_features_inv_sum'], {}), '(node_features_inv_sum)\n', (7177, 7200), True, 'import scipy.sparse ... |
import unittest
import re
import pytest
import numpy as np
from scipy.optimize import check_grad
from six.moves import xrange
from sklearn.metrics import pairwise_distances
from sklearn.datasets import load_iris, make_classification, make_regression
from numpy.testing import assert_array_almost_equal, assert_array_equa... | [
"numpy.array",
"metric_learn.MMC",
"unittest.main",
"metric_learn.MMC_Supervised",
"numpy.random.RandomState",
"re.search",
"re.split",
"metric_learn.MLKR",
"metric_learn.NCA",
"sklearn.datasets.make_regression",
"numpy.where",
"numpy.testing.assert_almost_equal",
"numpy.random.seed",
"met... | [((825, 863), 'numpy.unique', 'np.unique', (['labels'], {'return_inverse': '(True)'}), '(labels, return_inverse=True)\n', (834, 863), True, 'import numpy as np\n'), ((4410, 4445), 'sklearn.datasets.make_classification', 'make_classification', ([], {'random_state': '(0)'}), '(random_state=0)\n', (4429, 4445), False, 'fr... |
import numpy as np
from core.polymer_chain import Polymer
from core.polymer_chain import RandomChargePolymer
from pymatgen import Molecule
from utils import dihedral_tools
import unittest
__author__ = "<NAME>"
class TestPolymer(unittest.TestCase):
@classmethod
def setUpClass(cls):
# setup for polymer... | [
"numpy.mean",
"numpy.trace",
"numpy.arccos",
"core.polymer_chain.RandomChargePolymer",
"core.polymer_chain.Polymer",
"numpy.cross",
"pymatgen.Molecule",
"numpy.testing.assert_allclose",
"numpy.linalg.norm",
"numpy.array",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"numpy.random.unif... | [((13949, 13964), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13962, 13964), False, 'import unittest\n'), ((498, 608), 'numpy.array', 'np.array', (['[[0.0, -180.0], [0.2, -90.0], [0.3, -45.0], [0.4, 0.0], [0.5, 45.0], [0.6, \n 90.0], [0.8, 180.0]]'], {}), '([[0.0, -180.0], [0.2, -90.0], [0.3, -45.0], [0.4, ... |
import numpy as np
# ResNet-18, 5 classes, 100 linear probing epochs, classical, 8 width, variable epoch size
def results():
accs = np.array([
[(37.94, 9), (40.4, 19), (45.72, 49), (48.2, 99), (53.68, 199), (56.1, 299)],
[(43.32, 9), (47.64, 19), (48.98, 49), (51.96, 99), (53.82, 199), (54.48, 299... | [
"numpy.array"
] | [((138, 566), 'numpy.array', 'np.array', (['[[(37.94, 9), (40.4, 19), (45.72, 49), (48.2, 99), (53.68, 199), (56.1, 299\n )], [(43.32, 9), (47.64, 19), (48.98, 49), (51.96, 99), (53.82, 199), (\n 54.48, 299)], [(43.04, 9), (48.34, 19), (51.9, 49), (56.1, 99), (60.3, \n 199), (62.62, 299)], [(44.86, 9), (47.86,... |
"""a rewrite of cnn.py
this version is mostly inspired by
NIPS2017 (mask cnn).
see https://github.com/leelabcnbc/thesis-proposal-yimeng/blob/master/thesis_proposal/population_neuron_fitting/maskcnn/cnn.py
"""
import torch
from torch import nn, optim
from torch.nn import functional as F
from torch.nn import init as nn... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"math.sqrt",
"numpy.isfinite",
"torch.sum",
"copy.deepcopy",
"torch.nn.AvgPool2d",
"torch.nn.BatchNorm2d",
"numpy.exp",
"collections.OrderedDict",
"torch.abs",
"torch.nn.functional.mse_loss",
"torch.Tensor",
"torch.nn.functional.relu",
"torch.nn.init.... | [((5324, 5337), 'numpy.all', 'np.all', (['(x > 0)'], {}), '(x > 0)\n', (5330, 5337), True, 'import numpy as np\n'), ((18915, 18935), 'copy.deepcopy', 'deepcopy', (['opt_config'], {}), '(opt_config)\n', (18923, 18935), False, 'from copy import deepcopy\n'), ((1065, 1081), 'torch.abs', 'torch.abs', (['input'], {}), '(inp... |
import cv2
import glob, os
import numpy as np
import re
import fnmatch
import pickle
import random
from shutil import copy, copyfile
import json
def saveAnnotation(jointCamPath, positions):
fOut = open(jointCamPath, 'w')
fOut.write("F4_KNU1_A " + str(positions[0][0]) + " " + str(positions[0][1]) + "\n")
f... | [
"re.split",
"os.listdir",
"cv2.projectPoints",
"json.dump",
"os.path.join",
"numpy.array",
"shutil.copyfile",
"fnmatch.filter",
"os.walk"
] | [((2438, 2454), 'os.walk', 'os.walk', (['rootdir'], {}), '(rootdir)\n', (2445, 2454), False, 'import glob, os\n'), ((2768, 2793), 'numpy.array', 'np.array', (['an'], {'dtype': 'float'}), '(an, dtype=float)\n', (2776, 2793), True, 'import numpy as np\n'), ((2906, 2953), 'numpy.array', 'np.array', (['[[Fx, 0, Cx], [0, Fy... |
# import only necessary functions from modules to reduce load
from fdtd_venv import fdtd_mod as fdtd
from numpy import arange, array, where
from matplotlib.pyplot import subplot, plot, xlabel, ylabel, legend, title, suptitle, show, ylim, figure
from scipy.optimize import curve_fit
from os import path
from sys import ar... | [
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.arange",
"fdtd_venv.fdtd_mod.PointSource",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"fdtd_venv.fdtd_mod.Grid",
"matplotlib.pyplot.ylim",
"fdtd_venv.fdtd_mod.LineDetector",
"matplotlib.pyplot.title",
"time.time",
"matplotlib.pyplot.... | [((413, 419), 'time.time', 'time', ([], {}), '()\n', (417, 419), False, 'from time import time\n'), ((524, 582), 'fdtd_venv.fdtd_mod.Grid', 'fdtd.Grid', ([], {'shape': '(200, 1.55e-05, 1)', 'grid_spacing': '(7.75e-08)'}), '(shape=(200, 1.55e-05, 1), grid_spacing=7.75e-08)\n', (533, 582), True, 'from fdtd_venv import fd... |
import unittest
import numpy as np
import torch
from sklearn.metrics import accuracy_score
from pytorch_adapt.validators import AccuracyValidator, ScoreHistory
class TestAccuracyValidator(unittest.TestCase):
def test_accuracy_validator(self):
dataset_size = 1000
ignore_epoch = 0
for sta... | [
"pytorch_adapt.validators.AccuracyValidator",
"numpy.isclose",
"numpy.argmax",
"torch.softmax",
"torch.randint",
"pytorch_adapt.validators.ScoreHistory",
"torch.randn"
] | [((398, 417), 'pytorch_adapt.validators.AccuracyValidator', 'AccuracyValidator', ([], {}), '()\n', (415, 417), False, 'from pytorch_adapt.validators import AccuracyValidator, ScoreHistory\n'), ((446, 496), 'pytorch_adapt.validators.ScoreHistory', 'ScoreHistory', (['validator'], {'ignore_epoch': 'ignore_epoch'}), '(vali... |
import sklearn.datasets as skl_ds
import pandas as pd
import sklearn.model_selection as skl_ms
import sklearn.feature_selection as skl_fs
import sklearn.linear_model as skl_lm
import numpy as np
# Loading the dataset
boston = skl_ds.load_boston()
X = pd.DataFrame(boston.data, columns=boston.feature_names) # Feature ... | [
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_boston",
"numpy.array",
"sklearn.feature_selection.RFE",
"pandas.DataFrame",
"sklearn.linear_model.LinearRegression"
] | [((228, 248), 'sklearn.datasets.load_boston', 'skl_ds.load_boston', ([], {}), '()\n', (246, 248), True, 'import sklearn.datasets as skl_ds\n'), ((253, 308), 'pandas.DataFrame', 'pd.DataFrame', (['boston.data'], {'columns': 'boston.feature_names'}), '(boston.data, columns=boston.feature_names)\n', (265, 308), True, 'imp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 09:48:24 2020
@author: tcandela
"""
# =============================================================================
# IMPORTS
# =============================================================================
import sys
import numpy as np
import mat... | [
"plot_lib.show_start_point",
"netCDF_lib.read_nc",
"plot_lib.plot_map",
"matplotlib.pyplot.savefig",
"plot_lib.display_colorbar",
"numpy.max",
"matplotlib.pyplot.subplot",
"turtle_lib.find_date_death",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"plot_lib.display_trajectories_par... | [((582, 641), 'sys.path.append', 'sys.path.append', (['"""/homelocal-px/px-179/tcandela/STAMM/LIB/"""'], {}), "('/homelocal-px/px-179/tcandela/STAMM/LIB/')\n", (597, 641), False, 'import sys\n'), ((2723, 2834), 'netCDF_lib.read_nc', 'ncl.read_nc', (["(indir + filename + '.nc')", "['traj_lat', 'traj_lon', 'date', 'traj_... |
import tensorflow as tf
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import matplotlib.image as img
import matplotlib.pyplot as plt
sess = tf.Session()
diag = tf.diag([1,1,1,1])
truncated = tf.truncated_normal([2,3])
fill = tf.fill([2,3],5.0)
uniform = tf.random_uniform([3,2])
convert_tensor ... | [
"matplotlib.pyplot.imshow",
"tensorflow.shape",
"tensorflow.fill",
"tensorflow.diag",
"tensorflow.Session",
"matplotlib.image.imread",
"tensorflow.random_shuffle",
"tensorflow.random_uniform",
"tensorflow.random_crop",
"numpy.array",
"tensorflow.constant",
"tensorflow.cast",
"tensorflow.trun... | [((165, 177), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (175, 177), True, 'import tensorflow as tf\n'), ((186, 207), 'tensorflow.diag', 'tf.diag', (['[1, 1, 1, 1]'], {}), '([1, 1, 1, 1])\n', (193, 207), True, 'import tensorflow as tf\n'), ((217, 244), 'tensorflow.truncated_normal', 'tf.truncated_normal', ([... |
import numpy as np
dt = 0.05
number_inputs = 3
number_neurons = 6
V = np.random.rand(number_neurons, number_inputs)*4-2
W = np.random.rand(number_neurons, number_neurons)*4-2
net_type = 'CTRNN3'
u = np.random.rand(number_inputs)*4-2
N = 100
x = np.random.rand(number_neurons)*4-2
for t in range(N):
print("t... | [
"numpy.clip",
"numpy.matmul",
"numpy.random.rand",
"numpy.arctan"
] | [((73, 118), 'numpy.random.rand', 'np.random.rand', (['number_neurons', 'number_inputs'], {}), '(number_neurons, number_inputs)\n', (87, 118), True, 'import numpy as np\n'), ((127, 173), 'numpy.random.rand', 'np.random.rand', (['number_neurons', 'number_neurons'], {}), '(number_neurons, number_neurons)\n', (141, 173), ... |
from PIL import Image
from rembg.bg import remove
import numpy as np
import io
from django.db.models.functions import Radians, Cos, Sin, ASin, Sqrt
from date_site import settings
def add_watermark(image,):
background = np.fromfile(settings.WATERMARK)
result = remove(background)
base_image = Image.open(im... | [
"numpy.fromfile",
"PIL.Image.open",
"PIL.Image.new",
"django.db.models.functions.Radians",
"io.BytesIO",
"django.db.models.functions.Cos",
"rembg.bg.remove",
"django.db.models.functions.Sin"
] | [((226, 257), 'numpy.fromfile', 'np.fromfile', (['settings.WATERMARK'], {}), '(settings.WATERMARK)\n', (237, 257), True, 'import numpy as np\n'), ((271, 289), 'rembg.bg.remove', 'remove', (['background'], {}), '(background)\n', (277, 289), False, 'from rembg.bg import remove\n'), ((307, 324), 'PIL.Image.open', 'Image.o... |
import numpy as np
import soundfile as sf
import argparse
import os
import keras
import sklearn
import librosa
from keras import backend as K
eps = np.finfo(np.float).eps
def class_mae(y_true, y_pred):
return K.mean(
K.abs(
K.argmax(y_pred, axis=-1) - K.argmax(y_true, axis=-1)
),
... | [
"numpy.mean",
"argparse.ArgumentParser",
"os.path.join",
"numpy.argmax",
"sklearn.preprocessing.StandardScaler",
"numpy.linalg.norm",
"numpy.finfo",
"keras.backend.argmax",
"soundfile.read",
"librosa.stft"
] | [((150, 168), 'numpy.finfo', 'np.finfo', (['np.float'], {}), '(np.float)\n', (158, 168), True, 'import numpy as np\n'), ((715, 729), 'numpy.mean', 'np.mean', (['Theta'], {}), '(Theta)\n', (722, 729), True, 'import numpy as np\n'), ((972, 1058), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': ... |
import os
import sys
import time
from pickle import Pickler, Unpickler
from random import shuffle
import numpy as np
from Arena import Arena
from MCTS import MCTS
from connect4.Connect4BoardEvaluate import getBoardScoreTheoretical
from connect4.Connect4Game import Connect4Game
from connect4.Connect4Heuristics import ... | [
"os.path.exists",
"connect4.Connect4Game.Connect4Game",
"MCTS.MCTS",
"connect4.Connect4Heuristics.heuristic2_prob",
"random.shuffle",
"os.makedirs",
"pytorch_classification.utils.AverageMeter",
"os.path.join",
"pickle.Pickler",
"connect4.Connect4BoardEvaluate.getBoardScoreTheoretical",
"os.path.... | [((948, 985), 'MCTS.MCTS', 'MCTS', (['self.game', 'self.nnet', 'self.args'], {}), '(self.game, self.nnet, self.args)\n', (952, 985), False, 'from MCTS import MCTS\n'), ((11743, 11817), 'os.path.join', 'os.path.join', (['self.args.load_folder_file[0]', 'self.args.load_folder_file[1]'], {}), '(self.args.load_folder_file[... |
import numpy as np
positions = np.loadtxt("input.txt", dtype=int, delimiter=",")
part1_fuel = np.abs(
np.tile(positions, (positions.size, 1))
- np.arange(1, positions.size + 1).reshape(-1, 1)
)
part2_fuel = part1_fuel * (part1_fuel + 1) // 2
print("Part 1:", part1_fuel.sum(axis=1).min())
print("Part 2:", par... | [
"numpy.tile",
"numpy.loadtxt",
"numpy.arange"
] | [((32, 81), 'numpy.loadtxt', 'np.loadtxt', (['"""input.txt"""'], {'dtype': 'int', 'delimiter': '""","""'}), "('input.txt', dtype=int, delimiter=',')\n", (42, 81), True, 'import numpy as np\n'), ((108, 147), 'numpy.tile', 'np.tile', (['positions', '(positions.size, 1)'], {}), '(positions, (positions.size, 1))\n', (115, ... |
import numpy
import pandas
from utils import pos_range
class CrossWordPuzzle():
def __init__(self, word_df, layout_df):
assert len(word_df) == len(layout_df)
self.word_list = word_df["word"]
self.puzzle_df = pandas.concat([word_df, layout_df], axis=1)
self.puzzle_df["len"] = [*map(len, self.word_list)]
self... | [
"numpy.array",
"utils.pos_range",
"pandas.concat"
] | [((216, 259), 'pandas.concat', 'pandas.concat', (['[word_df, layout_df]'], {'axis': '(1)'}), '([word_df, layout_df], axis=1)\n', (229, 259), False, 'import pandas\n'), ((899, 933), 'numpy.array', 'numpy.array', (["self.puzzle_df['len']"], {}), "(self.puzzle_df['len'])\n", (910, 933), False, 'import numpy\n'), ((947, 98... |
import numpy as np
import re
import decimal
rule_names=[]
rules=[]
### Parsing
r1=re.compile("(.+): (\d+)-(\d+) or (\d+)-(\d+)")
with open('resources/day_16_tickets-data.txt','r') as f:
while(True):
m=r1.match(f.readline().strip())
if not m:
break
rule_names.append(m.groups()... | [
"numpy.ones",
"re.compile",
"numpy.where",
"numpy.array",
"numpy.vectorize"
] | [((85, 135), 're.compile', 're.compile', (['"""(.+): (\\\\d+)-(\\\\d+) or (\\\\d+)-(\\\\d+)"""'], {}), "('(.+): (\\\\d+)-(\\\\d+) or (\\\\d+)-(\\\\d+)')\n", (95, 135), False, 'import re\n'), ((1300, 1334), 'numpy.ones', 'np.ones', (['valid.shape'], {'dtype': '"""bool"""'}), "(valid.shape, dtype='bool')\n", (1307, 1334)... |
import numpy as np
import torch
import torch.nn as nn
from .utils import register_model, get_model
from . import cos_norm_classifier
@register_model('MannNet')
class MannNet(nn.Module):
"""Defines a Dynamic Meta-Embedding Network."""
def __init__(self, num_cls=10, model='LeNet', src_weights_init=None,
... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"torch.load",
"torch.nn.Linear",
"numpy.load"
] | [((687, 708), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (706, 708), True, 'import torch.nn as nn\n'), ((738, 759), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (757, 759), True, 'import torch.nn as nn\n'), ((2281, 2320), 'torch.nn.Linear', 'nn.Linear', (['self.feat_d... |
import time
from collections import deque
import torch
import numpy as np
from ... import mohex, hex
from . import json, analysis
from .. import common
from rebar import arrdict
from pavlov import stats, runs, logs
from logging import getLogger
import activelo
import pandas as pd
from functools import wraps
from contex... | [
"logging.getLogger",
"pavlov.runs.resolve",
"pavlov.logs.to_run",
"multiprocessing.Process",
"pavlov.stats.to_run",
"time.sleep",
"multiprocessing.set_start_method",
"numpy.arange",
"numpy.diag_indices_from",
"activelo.improvement",
"collections.deque",
"functools.wraps",
"numpy.exp",
"pan... | [((408, 427), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (417, 427), False, 'from logging import getLogger\n'), ((6455, 6470), 'functools.wraps', 'wraps', (['run_sync'], {}), '(run_sync)\n', (6460, 6470), False, 'from functools import wraps\n'), ((940, 974), 'activelo.solve', 'activelo.solve'... |
# Automatic Domain Randomization, see https://arxiv.org/abs/1910.07113 for details
# Implemented by <NAME> and <NAME>
import numpy as np
from gym.spaces import Box
from collections import deque
from TeachMyAgent.teachers.algos.AbstractTeacher import AbstractTeacher
class ADR(AbstractTeacher):
def __init__(self, m... | [
"numpy.mean",
"collections.deque",
"gym.spaces.Box",
"numpy.array",
"numpy.interp",
"TeachMyAgent.teachers.algos.AbstractTeacher.AbstractTeacher.__init__"
] | [((1199, 1277), 'TeachMyAgent.teachers.algos.AbstractTeacher.AbstractTeacher.__init__', 'AbstractTeacher.__init__', (['self', 'mins', 'maxs', 'env_reward_lb', 'env_reward_ub', 'seed'], {}), '(self, mins, maxs, env_reward_lb, env_reward_ub, seed)\n', (1223, 1277), False, 'from TeachMyAgent.teachers.algos.AbstractTeacher... |
import logging
from os.path import dirname, join, realpath
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import astroplan as ap
from scipy.constants import c as c_light_ms
from tqdm import tqdm
from skimage import io
from skimage import transform as tf
from scipy.interpolate import interp1d
... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"exoorbit.orbit.Orbit",
"scipy.interpolate.interp1d",
"numpy.nanmean",
"cats.extractor.runner.CatsRunner",
"scipy.stats.ttest_ind",
"numpy.sin",
"matplotlib.pyplot.imshow",
"numpy.histogram",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"ski... | [((2110, 2121), 'astropy.utils.iers.IERS_Auto', 'IERS_Auto', ([], {}), '()\n', (2119, 2121), False, 'from astropy.utils.iers import IERS_Auto\n'), ((2213, 2254), 'cats.simulator.detector.Crires', 'Crires', (['setting', 'detectors'], {'orders': 'orders'}), '(setting, detectors, orders=orders)\n', (2219, 2254), False, 'f... |
#!/usr/bin/env python
from collections import Iterable, OrderedDict
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plt.ioff()
from RouToolPa.Parsers.Abstract import Record, Collection, Metadata, Header
from RouToolPa.Parsers.VCF import CollectionVCF, MetadataVCF, HeaderVCF
... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.arange",
"numpy.mean",
"RouToolPa.Parsers.VCF.CollectionVCF",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.delete",
"matplotlib.pyplot.close",
"numpy.linspace",
"collections.OrderedDict",
"matplotlib.... | [((107, 128), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (121, 128), False, 'import matplotlib\n'), ((161, 171), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '()\n', (169, 171), True, 'import matplotlib.pyplot as plt\n'), ((4213, 4254), 'numpy.array', 'np.array', (['[record.pos for record ... |
import numpy as np
from .util import ensure_rng
def _hashable(x):
""" ensure that an point is hashable by a python dict """
return tuple(map(float, x))
class TargetSpace(object):
"""
Holds the param-space coordinates (X) and target values (Y)
Allows for constant-time appends while ensuring no du... | [
"numpy.ones_like",
"numpy.asarray",
"numpy.floor",
"numpy.array",
"numpy.empty",
"numpy.concatenate",
"numpy.zeros_like"
] | [((1599, 1628), 'numpy.empty', 'np.empty', ([], {'shape': '(0, self.dim)'}), '(shape=(0, self.dim))\n', (1607, 1628), True, 'import numpy as np\n'), ((1652, 1669), 'numpy.empty', 'np.empty', ([], {'shape': '(0)'}), '(shape=0)\n', (1660, 1669), True, 'import numpy as np\n'), ((5750, 5790), 'numpy.concatenate', 'np.conca... |
"""
Samplers for perses automated molecular design.
TODO
----
* Determine where `System` object should be stored: In `SamplerState` or in `Thermodynamic State`, or both, or neither?
* Can we create a generalized, extensible `SamplerState` that also stores chemical/thermodynamic state information?
* Can we create a gen... | [
"logging.getLogger",
"simtk.openmm.app.PDBFile.writeFile",
"openmmtools.utils.get_fastest_platform",
"perses.utils.openeye.smiles_to_oemol",
"perses.annihilation.ncmc_switching.NCMCEngine",
"openmmtools.states.SamplerState",
"numpy.exp",
"openmmtools.states.ThermodynamicState",
"perses.dispersed.fep... | [((1333, 1352), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1350, 1352), False, 'import logging\n'), ((1394, 1423), 'logging.getLogger', 'logging.getLogger', (['"""samplers"""'], {}), "('samplers')\n", (1411, 1423), False, 'import logging\n'), ((7187, 7220), 'mdtraj.Topology.from_openmm', 'md.Topology.... |
import unittest
import chainer
import chainer.functions as F
import numpy as np
from chainer import testing
import onnx_chainer
@testing.parameterize(
{'ops': 'cast', 'input_shape': (1, 5),
'input_argname': 'x',
'args': {'typ': np.float16}},
{'ops': 'cast', 'input_shape': (1, 5),
'input_argna... | [
"numpy.ones",
"chainer.testing.parameterize",
"chainer.functions.concat",
"numpy.zeros",
"onnx_chainer.export"
] | [((133, 1787), 'chainer.testing.parameterize', 'testing.parameterize', (["{'ops': 'cast', 'input_shape': (1, 5), 'input_argname': 'x', 'args': {'typ':\n np.float16}}", "{'ops': 'cast', 'input_shape': (1, 5), 'input_argname': 'x', 'args': {'typ':\n np.float64}}", "{'ops': 'depth2space', 'input_shape': (1, 12, 6, 6... |
import xml.etree.ElementTree as ET
import sys
import numpy as np
import scipy.sparse.csgraph
from argparse import ArgumentParser
from collections import defaultdict
import wknml
def flatten(l):
return [x for y in l for x in y]
def find(pred, l):
return next(x for x in l if pred(x))
parser = ArgumentParse... | [
"wknml.Tree",
"wknml.parse_nml",
"argparse.ArgumentParser",
"numpy.where",
"wknml.Group",
"collections.defaultdict",
"wknml.write_nml"
] | [((307, 381), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Splits trees in order to fix unlinked nodes."""'}), "(description='Splits trees in order to fix unlinked nodes.')\n", (321, 381), False, 'from argparse import ArgumentParser\n'), ((1197, 1214), 'collections.defaultdict', 'defaultdict', ... |
import numpy as np
import matplotlib.pyplot as plt
import ibllib.dsp.fourier as ft
def lp(ts, fac, pad=0.2):
"""
Smooth the data in frequency domain (assumes a uniform sampling rate), using edge padding
ibllib.dsp.smooth.lp(ts, [.1, .15])
:param ts: input signal to be smoothed
:param fac: 2 elem... | [
"numpy.ceil",
"matplotlib.pyplot.title",
"numpy.ones",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.linspace",
"numpy.sin",
"matplotlib.pyplot.axis",
"numpy.pad",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ion"
] | [((702, 731), 'numpy.pad', 'np.pad', (['ts', 'lpad'], {'mode': '"""edge"""'}), "(ts, lpad, mode='edge')\n", (708, 731), True, 'import numpy as np\n'), ((3002, 3025), 'numpy.linspace', 'np.linspace', (['(-4)', '(4)', '(100)'], {}), '(-4, 4, 100)\n', (3013, 3025), True, 'import numpy as np\n'), ((3034, 3043), 'numpy.sin'... |
from typing import Dict, Tuple
import networkx as nx
from networkx.classes import graph
import numpy as np
from functools import partial
from bokeh.plotting import from_networkx,figure
from bokeh.models import Circle
from bokeh.models import HoverTool
from bokeh.models import MultiLine
from bokeh.models import NodesAnd... | [
"bokeh.models.MultiLine",
"networkx.classes.graph.edges",
"bokeh.models.Range1d",
"networkx.set_edge_attributes",
"networkx.classes.graph.copy",
"matplotlib.lines.Line2D",
"networkx.relabel_nodes",
"bokeh.models.Circle",
"bokeh.plotting.from_networkx",
"networkx.spring_layout",
"matplotlib.pyplo... | [((567, 599), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (580, 599), True, 'import matplotlib.pyplot as plt\n'), ((653, 696), 'matplotlib.lines.Line2D', 'Line2D', (['[0, 1]', '[0, 1]'], {'color': 'clr'}), '([0, 1], [0, 1], color=clr, **kwargs)\n', (659, 696... |
import numpy as np
from time import sleep
from math import exp
import matplotlib.pyplot as plt
from scipy.integrate import trapz
from os import path
import struct
import spectrabuster.functions as sbf
from importlib import import_module
from datetime import date, datetime
from functools import partial
class Spectrum(... | [
"os.path.exists",
"numpy.abs",
"spectrabuster.functions.get_backend",
"numpy.isclose",
"numpy.copy",
"scipy.integrate.trapz",
"numpy.array",
"numpy.negative",
"functools.partial",
"math.exp",
"numpy.amax"
] | [((4551, 4625), 'functools.partial', 'partial', (['self.device.measure'], {'correct_dc': 'correct_dc', 'correct_nl': 'correct_nl'}), '(self.device.measure, correct_dc=correct_dc, correct_nl=correct_nl)\n', (4558, 4625), False, 'from functools import partial\n'), ((5163, 5185), 'os.path.exists', 'path.exists', (['file_p... |
'''Testing for particle_data.py
'''
import copy
from mock import patch, sentinel
import numpy as np
import numpy.testing as npt
import unittest
import galaxy_dive.analyze_data.simulation_data as simulation_data
########################################################################
default_kwargs = {
'data_dir... | [
"mock.patch",
"numpy.random.rand",
"numpy.testing.assert_allclose",
"copy.copy",
"numpy.array",
"galaxy_dive.analyze_data.simulation_data.SnapshotData",
"numpy.random.uniform",
"mock.patch.multiple"
] | [((3202, 3296), 'mock.patch', 'patch', (['"""galaxy_dive.analyze_data.simulation_data.SnapshotData.handle_data_key_error"""'], {}), "(\n 'galaxy_dive.analyze_data.simulation_data.SnapshotData.handle_data_key_error'\n )\n", (3207, 3296), False, 'from mock import patch, sentinel\n'), ((5282, 5666), 'mock.patch.mult... |
# -*- coding: utf-8 -*-
"""
Driver for the Keithley instruments
Manual for the KT2400 found in 'http://research.physics.illinois.edu/bezryadin/
labprotocol/Keithley2400Manual.pdf'
@author: <EMAIL>
"""
import numpy as np
from .generic_instruments import Instrument, INTF_PROLOGIX
def fake_iv_relation(
src_type,
... | [
"numpy.where",
"numpy.random.random",
"numpy.size",
"numpy.log",
"numpy.exp",
"numpy.array"
] | [((743, 759), 'numpy.size', 'np.size', (['src_val'], {}), '(src_val)\n', (750, 759), True, 'import numpy as np\n'), ((872, 896), 'numpy.where', 'np.where', (['(src_val < i_sc)'], {}), '(src_val < i_sc)\n', (880, 896), True, 'import numpy as np\n'), ((637, 649), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (645, 6... |
import numpy as np
import tensorflow as tf
from sklearn.model_selection import StratifiedKFold
class Apply:
class StratifiedMinibatch:
def __init__(self, batch_size, ds_size):
self.batch_size, self.ds_size = batch_size, ds_size
# max number of splits
self.n_splits = se... | [
"tensorflow.py_function",
"tensorflow.data.Dataset.from_generator",
"tensorflow.reduce_max",
"sklearn.model_selection.StratifiedKFold",
"numpy.array",
"tensorflow.concat",
"tensorflow.where",
"tensorflow.gather",
"numpy.concatenate",
"tensorflow.cast",
"numpy.arange",
"tensorflow.random.Genera... | [((426, 479), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': 'self.n_splits', 'shuffle': '(True)'}), '(n_splits=self.n_splits, shuffle=True)\n', (441, 479), False, 'from sklearn.model_selection import StratifiedKFold\n'), ((948, 1146), 'tensorflow.data.Dataset.from_generator', 'tf.data.... |
import os
import time
import logger
import random
import tensorflow as tf
import gym
import numpy as np
from collections import deque
from config import args
from utils import set_global_seeds, sf01, explained_variance
from agent import PPO
from env_wrapper import make_env
def main():
env = make_env()
set_gl... | [
"numpy.mean",
"collections.deque",
"agent.PPO",
"numpy.arange",
"numpy.asarray",
"logger.configure",
"numpy.zeros_like",
"logger.dumpkvs",
"utils.set_global_seeds",
"numpy.zeros",
"logger.logkv",
"numpy.std",
"utils.explained_variance",
"time.time",
"env_wrapper.make_env",
"logger.get_... | [((299, 309), 'env_wrapper.make_env', 'make_env', ([], {}), '()\n', (307, 309), False, 'from env_wrapper import make_env\n'), ((314, 346), 'utils.set_global_seeds', 'set_global_seeds', (['env', 'args.seed'], {}), '(env, args.seed)\n', (330, 346), False, 'from utils import set_global_seeds, sf01, explained_variance\n'),... |
"""
Implements diversity/similarity calculations for JEWEL
"""
import numpy as np
from scipy.spatial.distance import pdist, squareform
from utils.logger import get_logger
# Global variable for logging
logger = get_logger()
# Note for developers: follow the example of `gaussian_similarity` to implement
# additional si... | [
"numpy.exp",
"scipy.spatial.distance.pdist",
"numpy.median",
"utils.logger.get_logger"
] | [((211, 223), 'utils.logger.get_logger', 'get_logger', ([], {}), '()\n', (221, 223), False, 'from utils.logger import get_logger\n'), ((2428, 2453), 'numpy.exp', 'np.exp', (['(-(gamma * D) ** 2)'], {}), '(-(gamma * D) ** 2)\n', (2434, 2453), True, 'import numpy as np\n'), ((2275, 2284), 'scipy.spatial.distance.pdist', ... |
#!/usr/bin/env python
"""Create dataset for predicting lightning using Dataflow.
Copyright Google Inc.
2018 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... | [
"numpy.sum",
"numpy.arange"
] | [((1124, 1181), 'numpy.arange', 'np.arange', (['self.N15', '(ref.shape[0] - self.N15)', 'self.stride'], {}), '(self.N15, ref.shape[0] - self.N15, self.stride)\n', (1133, 1181), True, 'import numpy as np\n'), ((1191, 1248), 'numpy.arange', 'np.arange', (['self.N15', '(ref.shape[1] - self.N15)', 'self.stride'], {}), '(se... |
# Copyright (c) 2018-2021, 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 ... | [
"mxnet.nd.random.uniform",
"math.ceil",
"numpy.random.rand",
"os.makedirs",
"data_loading.dali_loader.get_dali_loader",
"os.path.join",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"multiprocessing.Pool",
"mxnet.nd.expand_dims",
"mxnet.nd.random.randint",
"numpy.a... | [((901, 911), 'numpy.load', 'np.load', (['f'], {}), '(f)\n', (908, 911), True, 'import numpy as np\n'), ((1171, 1177), 'time.time', 'time', ([], {}), '()\n', (1175, 1177), False, 'from time import time\n'), ((1186, 1203), 'multiprocessing.Pool', 'Pool', ([], {'processes': '(8)'}), '(processes=8)\n', (1190, 1203), False... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy import constants
def B21(A21,nu):
'''Returns the Einstein B21 coefficient for stimulated emission, computed
from the Einstein A21 coefficient and the frequency nu.'''
return constants.c**2/(2*constants.h*nu**3)*A21
def B12(A21,nu,g1,g2):
'''Einste... | [
"numpy.abs",
"numpy.where",
"numpy.log",
"numpy.exp",
"numpy.array",
"numpy.errstate",
"numpy.isnan",
"numpy.zeros_like"
] | [((909, 920), 'numpy.array', 'np.array', (['T'], {}), '(T)\n', (917, 920), True, 'import numpy as np\n'), ((1755, 1772), 'numpy.zeros_like', 'np.zeros_like', (['nu'], {}), '(nu)\n', (1768, 1772), True, 'import numpy as np\n'), ((2325, 2338), 'numpy.abs', 'np.abs', (['(a - b)'], {}), '(a - b)\n', (2331, 2338), True, 'im... |
import logging
import os
import time
import warnings
from collections import OrderedDict
from datetime import datetime
import numpy as np
from pandas import DataFrame
from pandas_gbq.exceptions import AccessDenied
logger = logging.getLogger(__name__)
BIGQUERY_INSTALLED_VERSION = None
SHOW_VERBOSE_DEPRECATION = Fa... | [
"logging.getLogger",
"google.cloud.bigquery.QueryJobConfig.from_api_repr",
"pandas_gbq.load.load_chunks",
"google.cloud.bigquery.SchemaField.from_api_repr",
"pandas_gbq.exceptions.AccessDenied",
"tqdm.tqdm",
"os.environ.get",
"datetime.datetime.now",
"pkg_resources.parse_version",
"google.cloud.bi... | [((227, 254), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (244, 254), False, 'import logging\n'), ((761, 798), 'pkg_resources.parse_version', 'pkg_resources.parse_version', (['"""0.32.0"""'], {}), "('0.32.0')\n", (788, 798), False, 'import pkg_resources\n'), ((1468, 1505), 'pkg_resourc... |
import pytest
import numpy as np
def assert_equal(arr, arr2):
assert np.array_equal(arr, arr2)
assert arr.dtype == arr2.dtype
def test_bulk_importer_ndarray(repo):
from hangar.bulk_importer import run_bulk_import
from hangar.bulk_importer import UDF_Return
def make_ndarray(column, key, shape, d... | [
"numpy.prod",
"hangar.bulk_importer.run_bulk_import",
"hangar.bulk_importer.UDF_Return",
"numpy.array_equal",
"pytest.raises",
"numpy.arange"
] | [((75, 100), 'numpy.array_equal', 'np.array_equal', (['arr', 'arr2'], {}), '(arr, arr2)\n', (89, 100), True, 'import numpy as np\n'), ((1041, 1157), 'hangar.bulk_importer.run_bulk_import', 'run_bulk_import', (['repo'], {'branch_name': '"""master"""', 'column_names': "['arr']", 'udf': 'make_ndarray', 'udf_kwargs': 'kwar... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import inspect
import numpy as np
import pprint
from abc import ABCMeta, abstractmethod
from fvcore.transforms.transform import Transform, TransformList
__all__ = ["TransformGen", "apply_transform_gens"]
def check_dtype(i... | [
"inspect.signature",
"fvcore.transforms.transform.TransformList",
"pprint.pformat",
"numpy.random.uniform"
] | [((1884, 1918), 'numpy.random.uniform', 'np.random.uniform', (['low', 'high', 'size'], {}), '(low, high, size)\n', (1901, 1918), True, 'import numpy as np\n'), ((4193, 4212), 'fvcore.transforms.transform.TransformList', 'TransformList', (['tfms'], {}), '(tfms)\n', (4206, 4212), False, 'from fvcore.transforms.transform ... |
import os
import numpy as np
from random import choices
from radar_scenes.sequence import get_training_sequences, get_validation_sequences, Sequence
from radar_scenes.labels import ClassificationLabel
from radar_scenes.evaluation import per_point_predictions_to_json, PredictionFileSchemas
class SemSegNetwork:
"""... | [
"os.path.exists",
"numpy.random.choice",
"radar_scenes.labels.ClassificationLabel",
"numpy.random.random",
"radar_scenes.labels.ClassificationLabel.translation_dict",
"os.path.join",
"os.path.splitext",
"radar_scenes.sequence.get_validation_sequences",
"os.getcwd",
"numpy.array",
"random.choices... | [((9145, 9200), 'os.path.join', 'os.path.join', (['path_to_dataset', '"""data"""', '"""sequences.json"""'], {}), "(path_to_dataset, 'data', 'sequences.json')\n", (9157, 9200), False, 'import os\n'), ((9472, 9509), 'radar_scenes.sequence.get_training_sequences', 'get_training_sequences', (['sequence_file'], {}), '(seque... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split, cross_val_score,\
ShuffleSplit
from sklearn.svm import SVC
from sklearn.metrics import classification_report, confusion_matrix,\
ac... | [
"numpy.mean",
"sklearn.svm.SVC",
"sklearn.metrics.confusion_matrix",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.classification_report",
"sklearn.metrics.accuracy_score",
"sklearn.model_selection.cross_val_score"
] | [((426, 472), 'pandas.read_csv', 'pd.read_csv', (['wine_dataset_csv'], {'index_col': '(False)'}), '(wine_dataset_csv, index_col=False)\n', (437, 472), True, 'import pandas as pd\n'), ((1015, 1078), 'sklearn.model_selection.train_test_split', 'train_test_split', (['dataset', 'label'], {'test_size': '(0.2)', 'random_stat... |
####################################################
#
# @ Authors : <NAME>
# <NAME>
#
# @ Hint: you have to install all requirements
# from requirements.txt
#
####################################################
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
# loa... | [
"matplotlib.pyplot.show",
"cv2.imshow",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.waitKey",
"numpy.arange",
"cv2.imread"
] | [((343, 365), 'cv2.imread', 'cv.imread', (['"""rose.jpeg"""'], {}), "('rose.jpeg')\n", (352, 365), True, 'import cv2 as cv\n'), ((857, 875), 'numpy.zeros', 'np.zeros', (['(256, 1)'], {}), '((256, 1))\n', (865, 875), True, 'import numpy as np\n'), ((1031, 1041), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1... |
import io
import os
from flask import abort
from flask import Flask
from flask import jsonify
from flask import request
from flask import send_file
from flask_cors import CORS
import numpy as np
import PIL
from PIL import Image
from scipy import misc
import tensorflow as tf
import DCSCN
from helper import args
api =... | [
"PIL.Image.open",
"flask_cors.CORS",
"flask.Flask",
"os.environ.get",
"helper.args.flags.DEFINE_string",
"io.BytesIO",
"scipy.misc.toimage",
"numpy.array",
"flask.abort",
"flask.send_file",
"DCSCN.SuperResolution",
"helper.args.get",
"flask.jsonify"
] | [((321, 336), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (326, 336), False, 'from flask import Flask\n'), ((337, 346), 'flask_cors.CORS', 'CORS', (['api'], {}), '(api)\n', (341, 346), False, 'from flask_cors import CORS\n'), ((348, 412), 'helper.args.flags.DEFINE_string', 'args.flags.DEFINE_string', ([... |
import matplotlib.pyplot as plt
import numpy as np
from keras.callbacks import TensorBoard
from keras.datasets import mnist
from keras.layers import Dense, Dropout
from keras.layers import Input
from keras.models import Model
from keras.utils import to_categorical
def main():
# this is the size of our encoded rep... | [
"numpy.prod",
"matplotlib.pyplot.gray",
"keras.datasets.mnist.load_data",
"keras.utils.to_categorical",
"matplotlib.pyplot.subplot",
"keras.callbacks.TensorBoard",
"keras.layers.Input",
"matplotlib.pyplot.figure",
"keras.models.Model",
"keras.layers.Dense",
"keras.layers.Dropout",
"matplotlib.... | [((485, 529), 'keras.layers.Input', 'Input', ([], {'shape': '(784,)', 'name': '"""encode-img-input"""'}), "(shape=(784,), name='encode-img-input')\n", (490, 529), False, 'from keras.layers import Input\n'), ((879, 897), 'keras.layers.Input', 'Input', ([], {'shape': '(32,)'}), '(shape=(32,))\n', (884, 897), False, 'from... |
from collections import Counter, defaultdict
import csv
import json
import os
import random
import sys
from time import time
from metal.contrib.info_extraction.mentions import RelationMention
from metal.contrib.info_extraction.utils import mark_entities
import numpy as np
import torch
from scipy.sparse import issparse... | [
"numpy.ceil",
"random.shuffle",
"torch.LongTensor",
"csv.writer",
"scipy.sparse.issparse",
"random.seed",
"metal.contrib.info_extraction.utils.mark_entities",
"collections.defaultdict",
"csv.reader",
"sys.stdout.flush",
"time.time",
"torch.zeros",
"sys.stdout.write"
] | [((5921, 5938), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (5932, 5938), False, 'from collections import Counter, defaultdict\n'), ((6427, 6489), 'metal.contrib.info_extraction.utils.mark_entities', 'mark_entities', (['tokens', 'positions', 'markers'], {'style': '"""concatenate"""'}), "(token... |
import os
import matplotlib.pyplot as plt
import numpy as np
from utils.util import save_fig
#http://matplotlib.org/examples/pylab_examples/subplots_demo.html
plt.figure(figsize=(12,4))
ks = range(1,10)
ys = [1.0/k for k in ks]
print(ys)
plt.subplot(1,3,1)
plt.plot(ks, np.log(ys), color = 'r')
plt.title('Sublinear c... | [
"numpy.log",
"utils.util.save_fig",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.title",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((161, 188), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 4)'}), '(figsize=(12, 4))\n', (171, 188), True, 'import matplotlib.pyplot as plt\n'), ((241, 261), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(3)', '(1)'], {}), '(1, 3, 1)\n', (252, 261), True, 'import matplotlib.pyplot as plt\n')... |
"""
BlackHole.py
Author: <NAME>
Affiliation: University of Colorado at Boulder
Created on: Mon Jul 8 09:56:38 MDT 2013
Description:
"""
import numpy as np
from .Star import _Planck
from .Source import Source
from types import FunctionType
from scipy.integrate import quad
from ..util.ReadData import read_lit
from... | [
"scipy.integrate.quad",
"numpy.exp",
"numpy.log",
"numpy.log10"
] | [((8536, 8574), 'scipy.integrate.quad', 'quad', (['integrand', 'self.T_out', 'self.T_in'], {}), '(integrand, self.T_out, self.T_in)\n', (8540, 8574), False, 'from scipy.integrate import quad\n'), ((11555, 11611), 'numpy.exp', 'np.exp', (['((1.0 - self.epsilon) / self.epsilon * dt / t_edd)'], {}), '((1.0 - self.epsilon)... |
from distutils.core import setup, Extension
import Cython
from Cython.Build import cythonize
import numpy
setup(
ext_modules=cythonize("special_partition.pyx"),
include_dirs=[numpy.get_include()]
)
"""
Build instructions:
------------------
> cd special_partition
> python setup.py build_ext --inplace
""" | [
"Cython.Build.cythonize",
"numpy.get_include"
] | [((130, 164), 'Cython.Build.cythonize', 'cythonize', (['"""special_partition.pyx"""'], {}), "('special_partition.pyx')\n", (139, 164), False, 'from Cython.Build import cythonize\n'), ((184, 203), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (201, 203), False, 'import numpy\n')] |
import numpy as np
from numba import jit, int32, float32, double, cfunc
from numba.experimental import jitclass
spec = [
('x', double[:]), ('dq', double[:]), ('u', double[:]),
('m', double), ('Iz', double),
('lf', double), ('lr', double),
('Bf', double), ('Cf', double), ('Df', double),
('Br', doubl... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.plot",
"numba.experimental.jitclass",
"numpy.append",
"numpy.array",
"numpy.deg2rad",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.arctan2",
"numpy.arctan",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.axis",
"numpy.zeros_like",
"matplotl... | [((536, 550), 'numba.experimental.jitclass', 'jitclass', (['spec'], {}), '(spec)\n', (544, 550), False, 'from numba.experimental import jitclass\n'), ((4413, 4427), 'numpy.deg2rad', 'np.deg2rad', (['(20)'], {}), '(20)\n', (4423, 4427), True, 'import numpy as np\n'), ((4437, 4455), 'numpy.array', 'np.array', (['[v.x[0]]... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from flags import CONST
from sklearn.model_selection import train_test_split
from keras import backend as K
from tensorflow.keras.models import Sequential, model_from_json
from tensorflow.keras.layers import SimpleRNN, Embedding, Dense, Dropout
... | [
"sklearn.model_selection.train_test_split",
"tensorflow.keras.models.model_from_json",
"keras.backend.clip",
"numpy.asarray",
"tensorflow.keras.callbacks.EarlyStopping",
"tensorflow.keras.layers.Dense",
"keras.backend.clear_session",
"tensorflow.keras.callbacks.ModelCheckpoint",
"keras.backend.epsil... | [((1075, 1160), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data.vector', 'data.label'], {'test_size': 'test_size', 'random_state': '(321)'}), '(data.vector, data.label, test_size=test_size, random_state=321\n )\n', (1091, 1160), False, 'from sklearn.model_selection import train_test_split\n')... |
import argparse
import glob
import os
import pickle
import sys
import time
from itertools import product
import matplotlib.pyplot as plt
import multiprocessing as mp
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.nonparametric.api as smnp
import swifter
import utils
import graphs
N_P... | [
"numpy.log10",
"numpy.log",
"numpy.array",
"numpy.arange",
"os.path.exists",
"numpy.histogram",
"pandas.read_feather",
"numpy.mean",
"argparse.ArgumentParser",
"os.path.split",
"numpy.linspace",
"numpy.dot",
"pandas.DataFrame",
"numpy.trapz",
"graphs.rename_bias_groups",
"time.time",
... | [((542, 593), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""Processed/Real"""', '"""Samples"""'], {}), "(BASE_DIR, 'Processed/Real', 'Samples')\n", (554, 593), False, 'import os\n'), ((605, 660), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""Processed/Real"""', '"""Sample_dist"""'], {}), "(BASE_DIR, 'Processed/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. module:: matrix
:platform: Unix, Windows
:synopsis: Operations on matrices.
.. moduleauthor:: hbldh <<EMAIL>>
Created on 2013-05-15, 10:45
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from... | [
"numpy.zeros",
"numpy.int64"
] | [((981, 1010), 'numpy.zeros', 'np.zeros', (['(9,)'], {'dtype': '"""float"""'}), "((9,), dtype='float')\n", (989, 1010), True, 'import numpy as np\n'), ((2341, 2370), 'numpy.zeros', 'np.zeros', (['(9,)'], {'dtype': '"""int32"""'}), "((9,), dtype='int32')\n", (2349, 2370), True, 'import numpy as np\n'), ((3669, 3690), 'n... |
#!/usr/bin/env python
"""Newtons Cradle example using the visualizer.
This is the same example as provided in [1], but translated into Python and using the `raisimpy` library (which
is a wrapper around `raisimLib` [2] and `raisimOgre` [3]).
References:
- [1] https://github.com/leggedrobotics/raisimOgre/blob/maste... | [
"numpy.identity",
"raisimpy.OgreVis.get",
"numpy.zeros",
"raisimpy.World"
] | [((859, 879), 'raisimpy.OgreVis.get', 'raisim.OgreVis.get', ([], {}), '()\n', (877, 879), True, 'import raisimpy as raisim\n'), ((2034, 2048), 'raisimpy.World', 'raisim.World', ([], {}), '()\n', (2046, 2048), True, 'import raisimpy as raisim\n'), ((2199, 2219), 'raisimpy.OgreVis.get', 'raisim.OgreVis.get', ([], {}), '(... |
import cv2
import numpy as np
def nothing(x):
pass
cap = cv2.VideoCapture(0)
cv2.namedWindow("Settings")
cv2.createTrackbar("Lower-Hue", "Settings", 0, 180, nothing)
cv2.createTrackbar("Lower-Saturation", "Settings", 0, 255, nothing)
cv2.createTrackbar("Lower-Value", "Settings", 0, 255, nothing)
cv2.createTrac... | [
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.approxPolyDP",
"cv2.erode",
"cv2.arcLength",
"cv2.contourArea",
"cv2.waitKey",
"cv2.drawContours",
"numpy.ones",
"cv2.putText",
"cv2.cvtColor",
"cv2.createTrackbar",
"cv2.namedWindow",
"cv2.flip",
"cv2.inRange",
"cv2.VideoCap... | [((65, 84), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (81, 84), False, 'import cv2\n'), ((86, 113), 'cv2.namedWindow', 'cv2.namedWindow', (['"""Settings"""'], {}), "('Settings')\n", (101, 113), False, 'import cv2\n'), ((114, 174), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""Lower-Hue"""', '"... |
import pandas as pd
import os
import re
import numpy as np
from datetime import datetime
from sklearn.decomposition import PCA
# Plotting Packages
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.cbook as cbook
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import inse... | [
"datetime.datetime",
"numpy.mean",
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"matplotlib.dates.MonthLocator",
"sklearn.decomposition.PCA",
"mpl_toolkits.axes_grid1.inset_locator.inset_axes",
"matplotlib.dates.DateFormatter",
"numpy.std",
"numpy.arange",
"numpy.datetime64",
"pandas.DataFr... | [((1111, 1177), 'pandas.read_csv', 'pd.read_csv', (['"""Data\\\\RegRelevant_MonthlySentimentIndex_Jan2021.csv"""'], {}), "('Data\\\\RegRelevant_MonthlySentimentIndex_Jan2021.csv')\n", (1122, 1177), True, 'import pandas as pd\n'), ((1848, 1867), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': '(2)'}), '(n_comp... |
import unittest
import numpy as np
import torch
from torch.autograd import Variable
import torch.nn
from pyoptmat import models, flowrules, utility, hardening, damage
from pyoptmat.temperature import ConstantParameter as CP
torch.set_default_dtype(torch.float64)
class CommonModel:
def test_derivs_strain(self)... | [
"numpy.allclose",
"pyoptmat.models.StrainBasedModel",
"torch.set_default_dtype",
"pyoptmat.models.StressBasedModel",
"torch.tensor",
"numpy.linspace",
"pyoptmat.utility.CheaterBatchTimeSeriesInterpolator",
"torch.zeros_like",
"torch.isnan",
"torch.zeros",
"pyoptmat.temperature.ConstantParameter"... | [((228, 266), 'torch.set_default_dtype', 'torch.set_default_dtype', (['torch.float64'], {}), '(torch.float64)\n', (251, 266), False, 'import torch\n'), ((640, 708), 'pyoptmat.utility.CheaterBatchTimeSeriesInterpolator', 'utility.CheaterBatchTimeSeriesInterpolator', (['self.times', 'strain_rates'], {}), '(self.times, st... |
"""
the code is adapted from:
https://github.com/ibab/tensorflow-wavenet/blob/master/wavenet/model.py (base model)
https://github.com/twidddj/vqvae/blob/master/wavenet/model.py
"""
import numpy as np
import tensorflow as tf
from .ops import causal_conv, mu_law_encode
from .mixture import discretized_mix_logistic_loss... | [
"tensorflow.shape",
"tensorflow.get_variable",
"tensorflow.scatter_update",
"tensorflow.tanh",
"tensorflow.nn.conv1d",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.slice",
"tensorflow.nn.embedding_lookup",
"tensorflow.histogram_summary",
"tensorflow.matmul",
"tensorflow.nn.softmax_... | [((569, 607), 'tensorflow.contrib.layers.xavier_initializer', 'tf.contrib.layers.xavier_initializer', ([], {}), '()\n', (605, 607), True, 'import tensorflow as tf\n'), ((623, 676), 'tensorflow.get_variable', 'tf.get_variable', (['name', 'shape'], {'initializer': 'initializer'}), '(name, shape, initializer=initializer)\... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 16 14:50:14 2018
@author: Kaushik
"""
'''
# Known symmatric distances
locations = ["New York", "Los Angeles", "Chicago", "Minneapolis", "Denver", "Dallas", "Seattle",
"Boston", "San Francisco", "St. Louis", "Houston", "Phoenix", "Salt Lake City"]
dist_ma... | [
"ortools.constraint_solver.pywrapcp.RoutingModel.DefaultSearchParameters",
"numpy.sqrt",
"ortools.constraint_solver.pywrapcp.RoutingModel"
] | [((5085, 5125), 'numpy.sqrt', 'np.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (5092, 5125), True, 'import numpy as np\n'), ((6160, 6207), 'ortools.constraint_solver.pywrapcp.RoutingModel.DefaultSearchParameters', 'pywrapcp.RoutingModel.DefaultSearchParameters', ([], {}), '... |
# Copyright 2021-2022 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 agreed to ... | [
"numpy.array",
"numpy.array_equal",
"numpy.vstack",
"cunumeric.vstack",
"cunumeric.array"
] | [((656, 676), 'cunumeric.array', 'num.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (665, 676), True, 'import cunumeric as num\n'), ((685, 705), 'cunumeric.array', 'num.array', (['[4, 5, 6]'], {}), '([4, 5, 6])\n', (694, 705), True, 'import cunumeric as num\n'), ((714, 732), 'cunumeric.vstack', 'num.vstack', (['(x, y)'... |
# -*- coding: utf-8 -*-
import os
import tempfile
import shutil
import subprocess
import itertools
import sys
from .helpers import sh
from . import Task
try:
import cPickle as pickle
except ImportError:
import pickle
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
... | [
"matplotlib.pyplot.ylabel",
"numpy.polyfit",
"matplotlib.table.Table",
"numpy.array",
"matplotlib.cm.tab10",
"sys.exit",
"numpy.poly1d",
"matplotlib.pyplot.subplot2grid",
"os.remove",
"matplotlib.pyplot.imshow",
"re.split",
"os.listdir",
"matplotlib.cm.tab20c",
"matplotlib.ticker.FuncForma... | [((5670, 5703), 'os.path.splitext', 'os.path.splitext', (['self.targets[0]'], {}), '(self.targets[0])\n', (5686, 5703), False, 'import os\n'), ((8888, 8899), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (8897, 8899), False, 'import os\n'), ((8908, 8932), 'os.chdir', 'os.chdir', (['temp_directory'], {}), '(temp_directory... |
"""
hyperparams.py
====================================
It provides configuration for the tunable hyper-parameter ranges for all the algorithms.
"""
from argparse import ArgumentParser
from hyperopt import hp
from hyperopt.pyll.base import scope
import numpy as np
class HyperparamterLoader:
def __init__(self):
... | [
"hyperopt.hp.choice",
"numpy.log",
"hyperopt.hp.uniform",
"argparse.ArgumentParser"
] | [((4484, 4556), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Knowledge Graph Embedding tunable configs."""'}), "(description='Knowledge Graph Embedding tunable configs.')\n", (4498, 4556), False, 'from argparse import ArgumentParser\n'), ((6437, 6472), 'hyperopt.hp.choice', 'hp.choice', (['"""L... |
# python peripherals
import random
import os
import sys
import math
sys.path.insert(1, os.path.join(sys.path[0], '../..'))
# numpy
import numpy
# pandas
import pandas
# ipython
from IPython.display import display, HTML
# matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib... | [
"common.utils.get_latest_subdirectory",
"numpy.random.shuffle",
"notebooks.utils.utils.plot_curve_signature_comparisons",
"deep_signature.nn.networks.DeepSignatureArcLengthNet",
"deep_signature.data_generation.curve_generation.LevelCurvesGenerator.load_curves",
"torch.load",
"notebooks.utils.utils.plot_... | [((3022, 3055), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (3045, 3055), False, 'import warnings\n'), ((3553, 3573), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (3565, 3573), False, 'import torch\n'), ((3763, 3801), 'torch.set_default_dtype', 't... |
import numpy as np
def random_vec(length):
if type(length) is not int:
raise ValueError("length should be int.")
elif length <= 0:
raise ValueError("length should be a positive number.")
return np.random.rand(length)
def normalize_vec(vector):
return vector / np.linalg.norm(vector... | [
"numpy.random.rand",
"numpy.linalg.norm"
] | [((228, 250), 'numpy.random.rand', 'np.random.rand', (['length'], {}), '(length)\n', (242, 250), True, 'import numpy as np\n'), ((299, 321), 'numpy.linalg.norm', 'np.linalg.norm', (['vector'], {}), '(vector)\n', (313, 321), True, 'import numpy as np\n')] |
# coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
"tensor2tensor.trax.layers.combinators.Serial",
"absl.testing.absltest.main",
"tensor2tensor.trax.layers.base.check_shape_agreement",
"tensor2tensor.trax.backend.random.get_prng",
"numpy.array",
"numpy.sum",
"tensor2tensor.trax.layers.core.Flatten",
"tensor2tensor.trax.layers.core.Dropout",
"tensor2... | [((3850, 3865), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (3863, 3865), False, 'from absl.testing import absltest\n'), ((1097, 1111), 'tensor2tensor.trax.layers.core.Flatten', 'core.Flatten', ([], {}), '()\n', (1109, 1111), False, 'from tensor2tensor.trax.layers import core\n'), ((1176, 1222), 't... |
#!python3
import numpy as np
from magLabUtilities.signalutilities.signals import SignalThread, Signal, SignalBundle
from magLabUtilities.signalutilities.hysteresis import HysteresisSignalBundle, XExpGendey101620
from magLabUtilities.uiutilities.plotting.hysteresis import MofHXofMPlotter
if __name__=='__main__'... | [
"numpy.amin",
"magLabUtilities.uiutilities.plotting.hysteresis.MofHXofMPlotter",
"magLabUtilities.signalutilities.hysteresis.XExpGendey101620",
"numpy.linspace",
"magLabUtilities.signalutilities.signals.Signal.fromThreadPair",
"numpy.amax"
] | [((766, 817), 'magLabUtilities.signalutilities.signals.Signal.fromThreadPair', 'Signal.fromThreadPair', (['mVirginThread', 'tVirginThread'], {}), '(mVirginThread, tVirginThread)\n', (787, 817), False, 'from magLabUtilities.signalutilities.signals import SignalThread, Signal, SignalBundle\n'), ((1002, 1045), 'magLabUtil... |
#Python 2.7.9 (default, Apr 5 2015, 22:21:35)
# full env in environment.yml
import sys, os
'''
This is a full aggregation of the Pulsar Hunters project, including user weighting.
Note it's quite a simple project - basically one Yes/No question - and there is gold-standard data, so the weighting is relatively straig... | [
"pandas.Series",
"numpy.mean",
"json.loads",
"numpy.median",
"pandas.isnull",
"numpy.log10",
"pandas.read_csv",
"pandas.merge",
"numpy.invert",
"numpy.sum",
"numpy.percentile",
"sys.exit",
"pandas.DataFrame",
"os.system"
] | [((14656, 14681), 'pandas.read_csv', 'pd.read_csv', (['classfile_in'], {}), '(classfile_in)\n', (14667, 14681), True, 'import pandas as pd\n'), ((14950, 14972), 'pandas.DataFrame', 'pd.DataFrame', (['talkjson'], {}), '(talkjson)\n', (14962, 14972), True, 'import pandas as pd\n'), ((16050, 16092), 'pandas.read_csv', 'pd... |
import numpy as np
import torch
import torch.nn.functional as F
import torch.nn as nn
from pytorch.utils import flip, _ntuple, HardSigmoid, StochasticDropout, LayerNorm
class ST_round(torch.autograd.Function):
def __init__(self, gradient_factor=1.0):
super(ST_round, self).__init__()
self.gradien... | [
"numpy.prod",
"numpy.sqrt",
"torch.nn.init.constant_",
"numpy.log",
"torch.sqrt",
"torch.nn.functional.linear",
"pytorch.utils._ntuple",
"torch.nn.init.uniform_",
"numpy.abs",
"torch.Tensor",
"torch.ceil",
"torch.nn.init._calculate_fan_in_and_fan_out",
"torch.round",
"torch.nn.functional.r... | [((388, 402), 'torch.round', 'torch.round', (['x'], {}), '(x)\n', (399, 402), False, 'import torch\n'), ((704, 717), 'torch.ceil', 'torch.ceil', (['x'], {}), '(x)\n', (714, 717), False, 'import torch\n'), ((6631, 6664), 'torch.nn.init.constant_', 'nn.init.constant_', (['self.beta', '(0.0)'], {}), '(self.beta, 0.0)\n', ... |
"""
One-element fields
======================
"""
import numpy as np
from bfieldtools.mesh_magnetics import (
scalar_potential_coupling,
vector_potential_coupling,
)
from bfieldtools.mesh_magnetics import (
magnetic_field_coupling,
magnetic_field_coupling_analytic,
)
import trimesh
from mayavi impo... | [
"numpy.linalg.norm",
"mayavi.mlab.figure",
"bfieldtools.mesh_magnetics.magnetic_field_coupling_analytic",
"numpy.array",
"numpy.zeros",
"mayavi.mlab.quiver3d",
"numpy.cos",
"trimesh.Trimesh",
"bfieldtools.mesh_magnetics.scalar_potential_coupling",
"numpy.sin",
"bfieldtools.mesh_magnetics.vector_... | [((354, 371), 'numpy.sin', 'np.sin', (['(np.pi / 6)'], {}), '(np.pi / 6)\n', (360, 371), True, 'import numpy as np\n'), ((376, 393), 'numpy.cos', 'np.cos', (['(np.pi / 6)'], {}), '(np.pi / 6)\n', (382, 393), True, 'import numpy as np\n'), ((404, 500), 'numpy.array', 'np.array', (['[[0, 0, 0], [1, 0, 0], [x, y, 0], [-x,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 <NAME>
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITI... | [
"logging.getLogger",
"logging.basicConfig",
"argparse.ArgumentParser",
"matplotlib.animation.FuncAnimation",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.figure",
"threading.Thread",
"time.time",
"numpy.random.RandomState",
"matplotlib.pyplot.show"
] | [((723, 750), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (740, 750), False, 'import logging\n'), ((1160, 1190), 'numpy.random.RandomState', 'numpy.random.RandomState', (['seed'], {}), '(seed)\n', (1184, 1190), False, 'import numpy\n'), ((7389, 7482), 'argparse.ArgumentParser', 'argpar... |
# 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, ... | [
"backend.svd",
"numpy.prod",
"autodiff.tensordot",
"tensors.quimb_tensors.gauge_transform_mps",
"backend.transpose",
"backend.reshape",
"copy.deepcopy",
"numpy.core.einsumfunc._parse_einsum_input",
"tensors.quimb_tensors.rand_mps",
"autodiff.hessian",
"backend.einsum",
"graph_ops.graph_transfo... | [((1067, 1075), 'attr.s', 'attr.s', ([], {}), '()\n', (1073, 1075), False, 'import attr\n'), ((3390, 3398), 'attr.s', 'attr.s', ([], {}), '()\n', (3396, 3398), False, 'import attr\n'), ((6226, 6234), 'attr.s', 'attr.s', ([], {}), '()\n', (6232, 6234), False, 'import attr\n'), ((1615, 1624), 'attr.ib', 'attr.ib', ([], {... |
"""Private module for the DataIO class."""
import json
import logging
import warnings
from collections import OrderedDict
from copy import deepcopy
from datetime import datetime
from pathlib import Path
from typing import Tuple
import numpy as np
import pandas as pd
try:
import pyarrow as pa
except ImportError:
... | [
"logging.getLogger",
"collections.OrderedDict",
"numpy.unique",
"pathlib.Path",
"datetime.datetime.strptime",
"json.dumps",
"copy.deepcopy",
"warnings.warn",
"pyarrow.feather.write_feather"
] | [((2264, 2291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2281, 2291), False, 'import logging\n'), ((18900, 18923), 'copy.deepcopy', 'deepcopy', (['self.timedata'], {}), '(self.timedata)\n', (18908, 18923), False, 'from copy import deepcopy\n'), ((23141, 23154), 'collections.Ordered... |
#!/usr/bin/env python
import roslib
roslib.load_manifest('crazyflie_control')
import rospy
import sys
from geometry_msgs.msg import Vector3
from nav_msgs.msg import Odometry
from crazyflie_driver.msg import RPYT
import dynamic_reconfigure.server
from crazyflie_control.cfg import CrazyflieControlConfig
from math imp... | [
"rospy.Publisher",
"geometry_msgs.msg.Vector3",
"numpy.transpose",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.get_param",
"rospy.get_rostime",
"roslib.load_manifest",
"rospy.Time",
"rospy.Rate",
"numpy.matrix",
"rospy.Subscriber",
"crazyflie_driver.msg.RPYT",
"rospy.loginfo"
] | [((37, 78), 'roslib.load_manifest', 'roslib.load_manifest', (['"""crazyflie_control"""'], {}), "('crazyflie_control')\n", (57, 78), False, 'import roslib\n'), ((641, 653), 'rospy.Time', 'rospy.Time', ([], {}), '()\n', (651, 653), False, 'import rospy\n'), ((814, 850), 'rospy.init_node', 'rospy.init_node', (['"""crazyfl... |
## data folder: D:\work\project\ITA Refresh\Session4 Oil Prediction
# -*- coding: utf-8 -*-
from __future__ import print_function
import time
import warnings
import numpy as np
import time
import matplotlib.pyplot as plt
from numpy import newaxis
from keras.layers.core import Dense, Activation, Dropout
from keras.la... | [
"numpy.insert",
"numpy.reshape",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"keras.layers.core.Activation",
"keras.layers.recurrent.LSTM",
"matplotlib.pyplot.plot",
"keras.models.Sequential",
"numpy.array",
"matplotlib.pyplot.figure",
"keras.layers.core.Dense",
"keras.layers.core.D... | [((384, 417), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (407, 417), False, 'import warnings\n'), ((1208, 1224), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (1216, 1224), True, 'import numpy as np\n'), ((1315, 1339), 'numpy.random.shuffle', 'np.random.sh... |
r"""undocumented
这个页面的代码很大程度上参考(复制粘贴)了https://github.com/huggingface/pytorch-pretrained-BERT的代码, 如果你发现该代码对你
有用,也请引用一下他们。
"""
__all__ = [
"BertModel",
]
import copy
import json
import math
import os
import torch
from torch import nn
import numpy as np
from ...io.file_utils import _get_file_name_base_on_postf... | [
"torch.nn.Dropout",
"torch.nn.Tanh",
"math.sqrt",
"copy.deepcopy",
"numpy.sin",
"torch.arange",
"torch.nn.LayerNorm",
"os.path.isdir",
"torch.matmul",
"torch.zeros_like",
"torch.nn.Embedding",
"json.loads",
"torch.ones_like",
"torch.is_tensor",
"numpy.cos",
"torch.nn.Softmax",
"numpy... | [((5139, 5167), 'copy.deepcopy', 'copy.deepcopy', (['self.__dict__'], {}), '(self.__dict__)\n', (5152, 5167), False, 'import copy\n'), ((5461, 5490), 'os.path.isdir', 'os.path.isdir', (['json_file_path'], {}), '(json_file_path)\n', (5474, 5490), False, 'import os\n'), ((5873, 5889), 'torch.sigmoid', 'torch.sigmoid', ([... |
import h5py
import numpy as np
import sys
def save_activity(activity, network_params, filename, folder_index, base_path, activity_key='activity',dim=2):
filepath = base_path + 'pattern_formation/data{}d/'.format(dim)
full_name = filepath + filename
f = h5py.File(full_name,'a')
f.create_dataset(folder_index + act... | [
"numpy.max",
"h5py.File"
] | [((258, 283), 'h5py.File', 'h5py.File', (['full_name', '"""a"""'], {}), "(full_name, 'a')\n", (267, 283), False, 'import h5py\n'), ((751, 776), 'h5py.File', 'h5py.File', (['full_name', '"""a"""'], {}), "(full_name, 'a')\n", (760, 776), False, 'import h5py\n'), ((843, 858), 'numpy.max', 'np.max', (['indices'], {}), '(in... |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 18 22:59:59 2020
@author: CS
Check the read-me file for a in-depth summary of the problem
"""
import numpy as np
import sys
sys.path.append('..')
import TrussAnalysis as ta
class environment:
"""
The enviroment will act as a container for the data in the probl... | [
"numpy.abs",
"TrussAnalysis.plotTruss",
"numpy.array",
"numpy.sum",
"TrussAnalysis.runTrussAnalysis",
"sys.path.append"
] | [((174, 195), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (189, 195), False, 'import sys\n'), ((2180, 2277), 'TrussAnalysis.runTrussAnalysis', 'ta.runTrussAnalysis', (['Areas', 'Forces', 'nodeIds', 'xNodeCoords', 'yNodeCoords', 'Connectivity', 'trussMat'], {}), '(Areas, Forces, nodeIds, xNodeC... |
#!/usr/bin/env python
# Created by "Thieu" at 20:22, 12/06/2020 ----------%
# Email: <EMAIL> %
# Github: https://github.com/thieu1995 %
# --------------------------------------------------%
import numpy as np
from copy import deepcopy
from mealpy.optimizer import Optimizer
class BaseSMA... | [
"numpy.abs",
"numpy.log10",
"copy.deepcopy",
"numpy.zeros",
"numpy.random.uniform",
"numpy.arctanh"
] | [((3792, 3841), 'numpy.arctanh', 'np.arctanh', (['(-((epoch + 1) / (self.epoch + 1)) + 1)'], {}), '(-((epoch + 1) / (self.epoch + 1)) + 1)\n', (3802, 3841), True, 'import numpy as np\n'), ((8079, 8128), 'numpy.arctanh', 'np.arctanh', (['(-((epoch + 1) / (self.epoch + 1)) + 1)'], {}), '(-((epoch + 1) / (self.epoch + 1))... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
from sklearn.datasets import load_iris
from sklearn.decomposition import PCA
iris = load_iris()
pca = PCA(n_components=2)
X_pca = pca.fit_transform(iris.data)
colors = ['navy', 'turquoise', 'darkorange']
plt.figure(figsize=(... | [
"sklearn.datasets.load_iris",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.ticker.MaxNLocator",
"numpy.cumsum",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplo... | [((178, 189), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (187, 189), False, 'from sklearn.datasets import load_iris\n'), ((197, 216), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': '(2)'}), '(n_components=2)\n', (200, 216), False, 'from sklearn.decomposition import PCA\n'), ((300, 326), 'ma... |
"""Python module for COVID-19 Survival-Convolution Death Model.
In this module we focus on predicting the number of deaths with a similar
approach to modeling the number of infections.
"""
from typing import Optional, Sequence, Text, Tuple
import numpy as np
import tensorflow as tf
import piecewise_linear_infection_mo... | [
"numpy.ones",
"tensorflow.keras.backend.set_floatx",
"tensorflow.range",
"tensorflow.constant",
"tensorflow.matmul",
"tensorflow.reshape",
"numpy.pad"
] | [((343, 381), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backend.set_floatx', (['"""float64"""'], {}), "('float64')\n", (370, 381), True, 'import tensorflow as tf\n'), ((1548, 1577), 'numpy.ones', 'np.ones', (['[self._n_weights, 1]'], {}), '([self._n_weights, 1])\n', (1555, 1577), True, 'import numpy as np\n'), (... |
"""Training script.
usage: train.py [options]
options:
--inner_learning_rate=ilr Learning rate of inner loop [default: 1e-3]
--outer_learning_rate=olr Learning rate of outer loop [default: 1e-4]
--batch_size=bs Size of task to train with [default: 4]
--inner_epochs=ie Amount o... | [
"numpy.random.normal",
"tensorboardX.SummaryWriter",
"torch.mean",
"torch.load",
"os.path.isfile",
"torch.cat",
"torch.tensor",
"torch.cuda.is_available",
"numpy.concatenate",
"torch.save",
"torch.no_grad",
"torch.autograd.Variable",
"docopt.docopt",
"torch.rand"
] | [((1173, 1201), 'torch.mean', 'torch.mean', (['(inputs * targets)'], {}), '(inputs * targets)\n', (1183, 1201), False, 'import torch\n'), ((1284, 1333), 'torch.rand', 'torch.rand', (['real_batch.shape[0]', '(1)'], {'device': 'device'}), '(real_batch.shape[0], 1, device=device)\n', (1294, 1333), False, 'import torch\n')... |
import os
import numpy as np
import pandas as pd
import tensorflow as tf
from PIL import Image
from matplotlib import pyplot as plt
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
from tqdm import tqdm
CWD_PATH = '/home/ubuntu/rue/object_detector/... | [
"tensorflow.Graph",
"os.listdir",
"PIL.Image.open",
"tensorflow.gfile.GFile",
"tensorflow.Session",
"os.path.join",
"tensorflow.GraphDef",
"object_detection.utils.label_map_util.convert_label_map_to_categories",
"numpy.expand_dims",
"pandas.DataFrame",
"tensorflow.import_graph_def",
"object_de... | [((356, 414), 'os.path.join', 'os.path.join', (['CWD_PATH', '"""export/frozen_inference_graph.pb"""'], {}), "(CWD_PATH, 'export/frozen_inference_graph.pb')\n", (368, 414), False, 'import os\n'), ((432, 483), 'os.path.join', 'os.path.join', (['CWD_PATH', '"""openimage_label_map.pbtxt"""'], {}), "(CWD_PATH, 'openimage_la... |
"""
Evaluates the performance on the UKP ASPECT Corpus with hierachical clustering.
Greedy hierachical clustering.
Merges two clusters if the pairwise mean cluster similarity is larger than a threshold.
Merges clusters with highest similarity first
Uses dev set to determine the threshold for supervised systems
"""
imp... | [
"numpy.mean",
"sklearn.cluster.AgglomerativeClustering",
"sklearn.metrics.f1_score",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.where",
"os.path.join",
"collections.defaultdict",
"csv.reader"
] | [((1520, 1638), 'sklearn.cluster.AgglomerativeClustering', 'AgglomerativeClustering', ([], {'n_clusters': 'None', 'affinity': '"""precomputed"""', 'linkage': '"""average"""', 'distance_threshold': 'threshold'}), "(n_clusters=None, affinity='precomputed', linkage=\n 'average', distance_threshold=threshold)\n", (1543,... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 24 11:38:01 2017
@author: sajid
"""
import numpy as np
import numexpr as ne
import pyfftw
import dask.array as da
'''
contains functions propTF, propFF, prop1FT, propIR
'''
__all__ = ['propTF',
'prop1FT',
'propFF',
'propIR']
'''
Prop... | [
"pyfftw.interfaces.numpy_fft.fftshift",
"numpy.fft.ifft2",
"numpy.fft.fftfreq",
"pyfftw.interfaces.numpy_fft.ifftshift",
"dask.array.meshgrid",
"numpy.fft.fft2",
"numpy.linspace",
"numpy.meshgrid",
"numpy.fft.ifftshift",
"numexpr.evaluate",
"numpy.fft.fftshift",
"numpy.shape"
] | [((800, 811), 'numpy.shape', 'np.shape', (['u'], {}), '(u)\n', (808, 811), True, 'import numpy as np\n'), ((996, 1067), 'numexpr.evaluate', 'ne.evaluate', (['"""exp(-1j*(2*pi*z/wavel)*sqrt(1-wavel**2*(FX**2+FY**2)))*u"""'], {}), "('exp(-1j*(2*pi*z/wavel)*sqrt(1-wavel**2*(FX**2+FY**2)))*u')\n", (1007, 1067), True, 'impo... |
from __future__ import print_function
import logging
import numpy as np
from optparse import OptionParser
# import sys
from time import time
import matplotlib.pyplot as plt
import os
import argparse as ap
# from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
fro... | [
"sklearn.metrics.classification_report",
"sklearn.feature_selection.SelectKBest",
"numpy.array",
"numpy.argsort",
"argparse.Namespace",
"sklearn.feature_extraction.text.HashingVectorizer",
"matplotlib.pyplot.barh",
"numpy.asarray",
"numpy.max",
"matplotlib.pyplot.yticks",
"sklearn.metrics.confus... | [((575, 667), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)s %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(levelname)s %(message)s')\n", (594, 667), False, 'import logging\n'), ((720, 734), 'optparse.OptionParser', 'OptionParse... |
import scipy.stats as st
from sklearn import metrics
from sklearn.metrics import auc
import matplotlib.pyplot as plt
#import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import tensorflow_addons as tfa
import math
import sys
import os.path as osp
import numpy as np
import PIL.Image
import... | [
"numpy.clip",
"tensorflow.compat.v1.disable_v2_behavior",
"sklearn.metrics.auc",
"numpy.array2string",
"keras.backend.learning_phase",
"math.cos",
"numpy.array",
"sklearn.metrics.roc_curve",
"scipy.stats.sem",
"tensorflow.compat.v1.zeros",
"tensorflow.compat.v1.train.GradientDescentOptimizer",
... | [((176, 200), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (198, 200), True, 'import tensorflow.compat.v1 as tf\n'), ((528, 538), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (535, 538), True, 'import numpy as np\n'), ((810, 860), 'sklearn.metrics.roc_curve', 'metrics.roc_cu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import numpy as np
import pandas as pd
import datetime as dt
import netCDF4 as cdf
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import cartopy
cartopy.config['data_dir'] = '/data/project/cartopy/'
import cartopy.crs as ccrs
impor... | [
"sys.path.insert",
"extra_sparqls.get_station_class",
"numpy.sqrt",
"pandas.read_csv",
"icoscp.cpb.dobj.Dobj",
"extra_sparqls.get_icos_stations_atc_samplingheight",
"pandas.to_datetime",
"os.path.exists",
"os.listdir",
"os.readlink",
"netCDF4.num2date",
"netCDF4.Dataset",
"os.path.split",
... | [((597, 614), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (606, 614), False, 'import os\n'), ((615, 667), 'sys.path.insert', 'sys.path.insert', (['(0)', "(my_home + '/new_jupyter/modules')"], {}), "(0, my_home + '/new_jupyter/modules')\n", (630, 667), False, 'import sys\n'), ((2593, 2614), 'netCDF4.Da... |
"""
Population.py
Author: <NAME>
Affiliation: University of Colorado at Boulder
Created on: Fri May 29 18:30:49 MDT 2015
Description:
"""
import numpy as np
import matplotlib.pyplot as pl
from scipy.integrate import cumtrapz
from ..util.ReadData import read_lit
from ..physics.Constants import s_per_yr
from ..util... | [
"numpy.random.normal",
"numpy.abs",
"numpy.trapz",
"numpy.log",
"scipy.integrate.cumtrapz",
"numpy.diff",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.interp",
"matplotlib.pyplot.draw",
"numpy.logspace"
] | [((980, 1038), 'scipy.integrate.cumtrapz', 'cumtrapz', (['integrand'], {'x': 'self.pop.ham.halos.lnM', 'initial': '(0.0)'}), '(integrand, x=self.pop.ham.halos.lnM, initial=0.0)\n', (988, 1038), False, 'from scipy.integrate import cumtrapz\n'), ((2773, 2782), 'matplotlib.pyplot.draw', 'pl.draw', ([], {}), '()\n', (2780,... |
#!/usr/bin/env python
# encoding: utf-8
def acoustics(solver_type='classic',iplot=True,htmlplot=False,outdir='./_output',problem='figure 9.4'):
"""
This example solves the 1-dimensional variable-coefficient acoustics
equations in a medium with a single interface.
"""
from numpy import sqrt, abs... | [
"numpy.abs",
"pyclaw.Grid",
"pyclaw.State",
"pyclaw.Solution",
"pyclaw.plot.interactive_plot",
"pyclaw.SharpClawSolver1D",
"pyclaw.Controller",
"pyclaw.ClawSolver1D",
"pyclaw.plot.html_plot",
"pyclaw.Dimension",
"pyclaw.util.run_app_from_main"
] | [((809, 846), 'pyclaw.Dimension', 'pyclaw.Dimension', (['"""x"""', '(-5.0)', '(5.0)', '(500)'], {}), "('x', -5.0, 5.0, 500)\n", (825, 846), False, 'import pyclaw\n'), ((855, 869), 'pyclaw.Grid', 'pyclaw.Grid', (['x'], {}), '(x)\n', (866, 869), False, 'import pyclaw\n'), ((908, 938), 'pyclaw.State', 'pyclaw.State', (['g... |
# coding=utf-8
##########################################################
# Authors: <NAME>, <NAME>, <NAME>
# Affiliation: University of Geneva
# Version: 1.4.5
# Date: 13.01.2022
# Downscaling of Swiss LCLU data
##########################################################
# import libraries
import numpy, math
import pa... | [
"osgeo.gdal.Open",
"numpy.unique",
"math.sqrt",
"shutil.copyfile",
"pandas.read_excel",
"osgeo.gdal.GetDriverByName"
] | [((1436, 1471), 'shutil.copyfile', 'shutil.copyfile', (['originalp', 'targetp'], {}), '(originalp, targetp)\n', (1451, 1471), False, 'import shutil\n'), ((1541, 1576), 'shutil.copyfile', 'shutil.copyfile', (['originala', 'targeta'], {}), '(originala, targeta)\n', (1556, 1576), False, 'import shutil\n'), ((1643, 1661), ... |
from games.abstract_state import GameState, ArraySlice
from utils import np_one_hot, one_hot_to_int, one_hot_arrays_to_list_of_ints
import numpy as np
from numba import jit
@jit(nopython=True)
def extract_tricks(full_state, first_row, num_played_cards):
finished_tricks = max(0, (num_played_cards - 1) // 3)
fi... | [
"numpy.abs",
"utils.one_hot_arrays_to_list_of_ints",
"utils.np_one_hot",
"games.abstract_state.ArraySlice",
"numpy.sum",
"numba.jit",
"numpy.concatenate",
"utils.one_hot_to_int"
] | [((176, 194), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (179, 194), False, 'from numba import jit\n'), ((804, 838), 'games.abstract_state.ArraySlice', 'ArraySlice', ([], {'slice_in_array': '(-1, 0)'}), '(slice_in_array=(-1, 0))\n', (814, 838), False, 'from games.abstract_state import GameSt... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import threading
import operator
from random import random, randint, gauss, shuffle, choice
from math import exp
from scipy.spatial.distance import euclidean
import numpy as np
import numba as nb
# class GOThread(threading.Thread):
# def __init__(self, target, *a... | [
"numba.vectorize",
"numpy.random.choice",
"numpy.delete",
"numpy.sum",
"numpy.array",
"random.random",
"random.randint",
"numpy.arange"
] | [((2760, 2774), 'numba.vectorize', 'nb.vectorize', ([], {}), '()\n', (2772, 2774), True, 'import numba as nb\n'), ((2917, 2931), 'numba.vectorize', 'nb.vectorize', ([], {}), '()\n', (2929, 2931), True, 'import numba as nb\n'), ((1226, 1236), 'numpy.sum', 'np.sum', (['ps'], {}), '(ps)\n', (1232, 1236), True, 'import num... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... | [
"pywi.io.images.image_generator",
"pywi.processing.filtering.pixel_clusters.filter_pixels_clusters_stats",
"pywi.benchmark.metrics.refbased.mse",
"time.perf_counter",
"traceback.print_tb",
"datetime.datetime.now",
"sys.exc_info",
"numpy.isfinite",
"numpy.nanmax",
"copy.deepcopy",
"numpy.nanmin",... | [((4905, 4924), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (4922, 4924), False, 'import time\n'), ((5060, 5132), 'pywi.io.images.image_generator', 'image_generator', (['input_file_or_dir_path_list'], {'max_num_images': 'max_num_img'}), '(input_file_or_dir_path_list, max_num_images=max_num_img)\n', (507... |
import sys
sys.path.append('..')
import argparse
from batchgenerators.utilities.file_and_folder_operations import *
from nnunet.training.model_restore import load_model_and_checkpoint_files
from fvcore.nn.flop_count import _DEFAULT_SUPPORTED_OPS, FlopCountAnalysis, flop_count
import numpy as np
import torch
import os
j... | [
"argparse.ArgumentParser",
"nnunet.training.model_restore.load_model_and_checkpoint_files",
"fvcore.nn.flop_count.FlopCountAnalysis",
"numpy.array",
"sys.path.append"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((349, 374), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (372, 374), False, 'import argparse\n'), ((725, 828), 'nnunet.training.model_restore.load_model_and_checkpoint_files', ... |
'''
This file contains a dictionary with the standard value of the model parameters.
Unelss otherwise specified the parameters will take this value.
'''
import numpy as np
import copy
# ---- Evaluate mutation probability
L = 50 # lenght of AA chain involved in binding
pmut_per_base_per_division =... | [
"numpy.log",
"copy.deepcopy",
"numpy.power"
] | [((928, 941), 'numpy.log', 'np.log', (['(5e-08)'], {}), '(5e-08)\n', (934, 941), True, 'import numpy as np\n'), ((963, 976), 'numpy.log', 'np.log', (['(5e-07)'], {}), '(5e-07)\n', (969, 976), True, 'import numpy as np\n'), ((998, 1011), 'numpy.log', 'np.log', (['(1e-10)'], {}), '(1e-10)\n', (1004, 1011), True, 'import ... |
# coding: utf8
# Functions used by nipype interface.
# Initiate the pipeline
def init_input_node(pet):
from clinica.utils.filemanip import get_subject_id
from clinica.utils.ux import print_begin_image
# Extract image ID
image_id = get_subject_id(pet)
print_begin_image(image_id)
return pet
... | [
"nipype.interfaces.utility.Rename",
"nibabel.load",
"numpy.where",
"nipype.utils.filemanip.split_filename",
"clinica.utils.filemanip.get_subject_id",
"clinica.utils.stream.cprint",
"os.getcwd",
"nilearn.image.resample_to_img",
"numpy.isnan",
"os.path.basename",
"nibabel.Nifti1Image",
"clinica.... | [((251, 270), 'clinica.utils.filemanip.get_subject_id', 'get_subject_id', (['pet'], {}), '(pet)\n', (265, 270), False, 'from clinica.utils.filemanip import get_subject_id\n'), ((275, 302), 'clinica.utils.ux.print_begin_image', 'print_begin_image', (['image_id'], {}), '(image_id)\n', (292, 302), False, 'from clinica.uti... |
import time
load_start_time = time.time()
import csv
import nltk
import re
import numpy as np
import pandas as pd
from dateutil import parser
import gensim, logging
from gensim.models import Word2Vec
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
from nltk.stem.porter import ... | [
"dateutil.parser.parse",
"nltk.corpus.stopwords.words",
"numpy.where",
"gensim.models.Word2Vec",
"nltk.stem.porter.PorterStemmer",
"numpy.array",
"nltk.tokenize.sent_tokenize",
"csv.reader",
"pandas.DataFrame",
"time.time"
] | [((30, 41), 'time.time', 'time.time', ([], {}), '()\n', (39, 41), False, 'import time\n'), ((398, 424), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (413, 424), False, 'from nltk.corpus import stopwords\n'), ((469, 484), 'nltk.stem.porter.PorterStemmer', 'PorterStemmer', (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.