code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#Name: <NAME> #e-mail: <EMAIL> """ Python code for getting slice from a nifti volume """ import numpy as np import SimpleITK as sitk import os def get_axial_Slice_from_Nifti(path_to_volume,coord): """ Routine to get axial slice from Nifti volume. Parameters ---------- path...
[ "numpy.asarray", "os.path.dirname", "SimpleITK.GetArrayFromImage" ]
[((561, 588), 'SimpleITK.GetArrayFromImage', 'sitk.GetArrayFromImage', (['img'], {}), '(img)\n', (583, 588), True, 'import SimpleITK as sitk\n'), ((647, 670), 'numpy.asarray', 'np.asarray', (['axial_slice'], {}), '(axial_slice)\n', (657, 670), True, 'import numpy as np\n'), ((502, 527), 'os.path.dirname', 'os.path.dirn...
#!/usr/bin/python # # Copyright 2019 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 ag...
[ "tensorflow.contrib.layers.l2_regularizer", "tensorflow.constant_initializer", "tensorflow.reshape", "trainer.make_estimator", "tensorflow.reduce_max", "tensorflow.layers.batch_normalization", "tensorflow.nn.relu", "tensorflow.gather", "tensorflow.pad", "tensorflow.variable_scope", "tensorflow.s...
[((5372, 5448), 'tensorflow.nn.sparse_softmax_cross_entropy_with_logits', 'tf.nn.sparse_softmax_cross_entropy_with_logits', ([], {'labels': 'labels', 'logits': 'logits'}), '(labels=labels, logits=logits)\n', (5418, 5448), True, 'import tensorflow as tf\n'), ((5465, 5485), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['...
from numpy.core.numeric import identity from .model import Model from ..util.metrics import mse import numpy as np class LinearRegression(Model): def __init__(self, gd=False, epochs=1000, lr=0.001): """Linear regression Model epochs: number of epochs lr: learning rate for GD """ ...
[ "numpy.full", "numpy.eye", "numpy.zeros", "numpy.ones", "numpy.hstack", "numpy.dot" ]
[((913, 939), 'numpy.dot', 'np.dot', (['self.X', 'self.theta'], {}), '(self.X, self.theta)\n', (919, 939), True, 'import numpy as np\n'), ((1305, 1316), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1313, 1316), True, 'import numpy as np\n'), ((1657, 1676), 'numpy.hstack', 'np.hstack', (['([1], X)'], {}), '(([1], X...
import numpy as np import torch from torch.distributions import Categorical, Normal import rl_sandbox.constants as c class RLAgent(): def __init__(self, model, learning_algorithm): self.model = model self.learning_algorithm = learning_algorithm def update(self, curr_obs, curr_h_state, actio...
[ "numpy.array", "torch.tensor" ]
[((1110, 1146), 'numpy.array', 'np.array', (['[np.nan]'], {'dtype': 'np.float32'}), '([np.nan], dtype=np.float32)\n', (1118, 1146), True, 'import numpy as np\n'), ((1506, 1523), 'torch.tensor', 'torch.tensor', (['obs'], {}), '(obs)\n', (1518, 1523), False, 'import torch\n'), ((1595, 1621), 'torch.tensor', 'torch.tensor...
from torch.utils.data import Dataset from mol_tree import MolTree import numpy as np class MoleculeDataset(Dataset): def __init__(self, data_file): with open(data_file) as f: self.data = [line.strip("\r\n ").split()[0] for line in f] def __len__(self): return len(self.data) ...
[ "numpy.loadtxt", "mol_tree.MolTree" ]
[((665, 680), 'mol_tree.MolTree', 'MolTree', (['smiles'], {}), '(smiles)\n', (672, 680), False, 'from mol_tree import MolTree\n'), ((861, 882), 'numpy.loadtxt', 'np.loadtxt', (['prop_file'], {}), '(prop_file)\n', (871, 882), True, 'import numpy as np\n'), ((1131, 1146), 'mol_tree.MolTree', 'MolTree', (['smiles'], {}), ...
import numpy as np import math from scipy.special import comb def pwm(x, n=4): r"""Return a list with the n first probability weighted moments (:math:`b_r`). .. math:: b_r = \frac{\sum_{i=1}^{n_s} x_i {i \choose r}}{n_s {n_s - 1\choose r}} where: :math:`n_s` --- size of the sample *...
[ "numpy.log", "scipy.special.comb", "math.sin", "numpy.sort", "numpy.exp" ]
[((654, 664), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (661, 664), True, 'import numpy as np\n'), ((2959, 2980), 'math.sin', 'math.sin', (['(k * math.pi)'], {}), '(k * math.pi)\n', (2967, 2980), False, 'import math\n'), ((4571, 4592), 'numpy.log', 'np.log', (['(1 - shape * x)'], {}), '(1 - shape * x)\n', (4577, 4...
import tempfile import numpy as np import pytest from openff.evaluator import unit from openff.evaluator.backends import ComputeResources from openff.evaluator.protocols.reweighting import ( ConcatenateObservables, ConcatenateTrajectories, ReweightDielectricConstant, ReweightObservable, ) from openff....
[ "tempfile.TemporaryDirectory", "openff.evaluator.protocols.reweighting.ConcatenateObservables", "openff.evaluator.utils.get_data_filename", "numpy.zeros", "numpy.ones", "openff.evaluator.backends.ComputeResources", "mdtraj.load", "openff.evaluator.thermodynamics.ThermodynamicState", "openff.evaluato...
[((585, 633), 'openff.evaluator.utils.get_data_filename', 'get_data_filename', (['"""test/trajectories/water.pdb"""'], {}), "('test/trajectories/water.pdb')\n", (602, 633), False, 'from openff.evaluator.utils import get_data_filename\n'), ((656, 704), 'openff.evaluator.utils.get_data_filename', 'get_data_filename', (['...
from sklearn.preprocessing import scale import numpy as np def preprocess(X): """ R(N*M) :param X: :return: """ X_average = X.mean(axis=0) X = X - X_average # sklearn does'nt make the variance to 1, cs229 suggest to do that. # that a difference # std_sigma = X.std(axis=0) ...
[ "sklearn.preprocessing.scale", "numpy.zeros", "numpy.linalg.eig", "numpy.sort", "numpy.linalg.svd", "numpy.dot", "numpy.cov" ]
[((358, 374), 'sklearn.preprocessing.scale', 'scale', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (363, 374), False, 'from sklearn.preprocessing import scale\n'), ((520, 536), 'numpy.linalg.svd', 'np.linalg.svd', (['X'], {}), '(X)\n', (533, 536), True, 'import numpy as np\n'), ((601, 627), 'numpy.dot', 'np.dot', (['X', ...
import os import sqlite3 as db import datetime import socket import numpy as np import healpy as hp import pandas as pd import matplotlib.path as mplPath from rubin_sim.utils import _hpid2RaDec, xyz_angular_radius, _buildTree, _xyz_from_ra_dec from rubin_sim.site_models import FieldsDatabase import rubin_sim def smal...
[ "rubin_sim.utils.xyz_angular_radius", "os.remove", "numpy.arctan2", "numpy.empty", "rubin_sim.utils._hpid2RaDec", "numpy.floor", "healpy.ud_grade", "numpy.argsort", "numpy.sin", "numpy.arange", "numpy.round", "numpy.unique", "pandas.DataFrame", "numpy.degrees", "socket.gethostname", "n...
[((5308, 5322), 'numpy.unique', 'np.unique', (['ids'], {}), '(ids)\n', (5317, 5322), True, 'import numpy as np\n'), ((5335, 5350), 'numpy.argsort', 'np.argsort', (['ids'], {}), '(ids)\n', (5345, 5350), True, 'import numpy as np\n'), ((5428, 5475), 'numpy.searchsorted', 'np.searchsorted', (['ordered_ids', 'uids'], {'sid...
# A NADE that has Bernoullis for output distribution from __future__ import division from Model.Model import SizeParameter, TensorParameter from NADE import NADE from ParameterInitialiser import Gaussian from Utils.Estimation import Estimation from Utils.nnet import sigmoid, logsumexp from Utils.theano_helpers import c...
[ "numpy.sum", "Utils.Estimation.Estimation.sample_mean_from_sum_and_sum_sq", "ParameterInitialiser.Gaussian", "theano.tensor.nnet.sigmoid", "theano.tensor.log", "numpy.random.shuffle", "theano.tensor.dot", "Model.Model.TensorParameter", "numpy.dot", "NADE.NADE.__init__", "theano.tensor.matrix", ...
[((544, 598), 'NADE.NADE.__init__', 'NADE.__init__', (['self', 'n_visible', 'n_hidden', 'nonlinearity'], {}), '(self, n_visible, n_hidden, nonlinearity)\n', (557, 598), False, 'from NADE import NADE\n'), ((1994, 2012), 'ParameterInitialiser.Gaussian', 'Gaussian', ([], {'std': '(0.01)'}), '(std=0.01)\n', (2002, 2012), F...
# -*- coding: utf-8 -*- """ Created on Sun Nov 24 15:18:38 2019 @author: lrreid Quick script to test the reading and plotting of the history data file Plotting is now complete and moved to main script """ import numpy as np import matplotlib.pyplot as plt import datetime from matplotlib.dates import DateFormatter f...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.amin", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.axis", "numpy.amax", "matplotlib.dates.DateFormatter", "numpy.array", "numpy.arange", "matplotlib.pyplot.gca", "matplotlib.pyplot.tick_params", "matp...
[((612, 650), 'numpy.array', 'np.array', (['num2date'], {'dtype': '"""datetime64"""'}), "(num2date, dtype='datetime64')\n", (620, 650), True, 'import numpy as np\n'), ((667, 687), 'numpy.array', 'np.array', (['[2.0, 2.0]'], {}), '([2.0, 2.0])\n', (675, 687), True, 'import numpy as np\n'), ((1328, 1342), 'numpy.amin', '...
from typing import List import numpy as np from opendp.meas import make_base_geometric from opendp.mod import enable_features enable_features("contrib") def histogramdd_indexes(x: np.ndarray, category_lengths: List[int]) -> np.ndarray: """Compute counts of each combination of categories in d dimensions. Disc...
[ "opendp.meas.make_base_geometric", "opendp.mod.enable_features", "numpy.empty", "numpy.array", "numpy.ravel_multi_index", "numpy.prod" ]
[((127, 153), 'opendp.mod.enable_features', 'enable_features', (['"""contrib"""'], {}), "('contrib')\n", (142, 153), False, 'from opendp.mod import enable_features\n'), ((879, 922), 'numpy.ravel_multi_index', 'np.ravel_multi_index', (['x.T', 'category_lengths'], {}), '(x.T, category_lengths)\n', (899, 922), True, 'impo...
import numpy as np N = int(input()) A = [] for i in range(N): A_in = list(map(float, input().split())) A.append(A_in) print(round(np.linalg.det(A),2)) # -- another answer N = int(input()) A = np.array([input().split() for _ in range(N)], float) print(round(np.linalg.det(A),2))
[ "numpy.linalg.det" ]
[((141, 157), 'numpy.linalg.det', 'np.linalg.det', (['A'], {}), '(A)\n', (154, 157), True, 'import numpy as np\n'), ((271, 287), 'numpy.linalg.det', 'np.linalg.det', (['A'], {}), '(A)\n', (284, 287), True, 'import numpy as np\n')]
# Copyright 2018 DeepMind Technologies Limited. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
[ "numpy.zeros", "tree.flatten", "dm_env.specs.BoundedArray", "numpy.concatenate" ]
[((1237, 1259), 'numpy.concatenate', 'np.concatenate', (['leaves'], {}), '(leaves)\n', (1251, 1259), True, 'import numpy as np\n'), ((2439, 2561), 'dm_env.specs.BoundedArray', 'dm_env.specs.BoundedArray', ([], {'shape': 'dummy_obs.shape', 'dtype': 'dummy_obs.dtype', 'minimum': '(-np.inf)', 'maximum': 'np.inf', 'name': ...
import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib.collections import PatchCollection import json #Get the stating phase information def getStartingPhases(): with open('/nojournal/bin/OptimizationResults.txt') as f: first_line = f.readline() return first_line #Appendi...
[ "json.load", "matplotlib.pyplot.show", "matplotlib.patches.Rectangle", "numpy.insert", "numpy.cumsum", "numpy.arange", "matplotlib.pyplot.subplots", "matplotlib.pyplot.grid" ]
[((7260, 7287), 'numpy.cumsum', 'np.cumsum', (['ring_Phase_Times'], {}), '(ring_Phase_Times)\n', (7269, 7287), True, 'import numpy as np\n'), ((7366, 7403), 'numpy.insert', 'np.insert', (['cum_Ring_Phase_Times', '(0)', '(0)'], {}), '(cum_Ring_Phase_Times, 0, 0)\n', (7375, 7403), True, 'import numpy as np\n'), ((8550, 8...
import numpy as np import pytest from scipy.integrate._ivp import rk from probnum import diffeq import probnum.problems.zoo.diffeq as diffeq_zoo _ADAPTIVE_STEPS = diffeq.stepsize.AdaptiveSteps(atol=1e-4, rtol=1e-4, firststep=0.1) _CONSTANT_STEPS = diffeq.stepsize.ConstantSteps(0.1) def setup_solver(y0, ode, steprul...
[ "probnum.diffeq.stepsize.ConstantSteps", "probnum.diffeq.perturbed.scipy_wrapper.WrappedScipyRungeKutta", "probnum.problems.zoo.diffeq.lotkavolterra", "probnum.diffeq.stepsize.AdaptiveSteps", "numpy.array", "pytest.mark.parametrize", "scipy.integrate._ivp.rk.RK45", "probnum.problems.zoo.diffeq.lorenz6...
[((165, 235), 'probnum.diffeq.stepsize.AdaptiveSteps', 'diffeq.stepsize.AdaptiveSteps', ([], {'atol': '(0.0001)', 'rtol': '(0.0001)', 'firststep': '(0.1)'}), '(atol=0.0001, rtol=0.0001, firststep=0.1)\n', (194, 235), False, 'from probnum import diffeq\n'), ((250, 284), 'probnum.diffeq.stepsize.ConstantSteps', 'diffeq.s...
''' _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ ...
[ "torch.nn.modules.Sigmoid", "torch.nn.modules.loss.BCELoss", "torch.nn.modules.Linear", "numpy.argmax", "data_loader.loadDataSet", "torch.nn.modules.ReLU", "torch.nn.modules.AvgPool2d", "torch.nn.modules.Conv2d", "torch.load", "torch.softmax", "torch.save", "torch.cuda.is_available", "torch....
[((3379, 3537), 'data_loader.loadDataSet', 'data_loader.loadDataSet', (['"""../database/HandwrittenDatas/train-images.idx3-ubyte"""', '"""../database/HandwrittenDatas/train-labels.idx1-ubyte"""', '(60000)', 'Batch_Size'], {}), "('../database/HandwrittenDatas/train-images.idx3-ubyte',\n '../database/HandwrittenDatas/...
# -*- coding: utf-8 -*- ############################################################################# # @package ad_hmi # @Config file generation. ############################################################################# # @author <NAME> # @copyright (c) All rights reserved. ########################################...
[ "threading.Thread", "os.remove", "copy.deepcopy", "asammdf.Signal", "logging.FileHandler", "numpy.ubyte", "numpy.frombuffer", "socket.socket", "os.path.exists", "struct.unpack", "collections.deque", "time.sleep", "logging.Formatter", "time.time", "asammdf.MDF", "logging.getLogger" ]
[((657, 684), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (674, 684), False, 'import logging\n'), ((1060, 1093), 'os.path.exists', 'os.path.exists', (['"""XCP_Service.log"""'], {}), "('XCP_Service.log')\n", (1074, 1093), False, 'import os\n'), ((1154, 1192), 'logging.FileHandler', 'log...
#! /usr/bin/python3 import click import numpy as np from Tkinter import * @click.command() def main(): """ CoordSys :: Conv is a GUI application for conversion between the various coordinate systems. Steps involved in conversion : 1) Enter the values of known coordinates separated by ',' ...
[ "click.command", "numpy.sin", "numpy.cos", "numpy.arctan", "numpy.arccos" ]
[((78, 93), 'click.command', 'click.command', ([], {}), '()\n', (91, 93), False, 'import click\n'), ((1305, 1321), 'numpy.arctan', 'np.arctan', (['(y / x)'], {}), '(y / x)\n', (1314, 1321), True, 'import numpy as np\n'), ((2278, 2294), 'numpy.arccos', 'np.arccos', (['(z / r)'], {}), '(z / r)\n', (2287, 2294), True, 'im...
import numpy as np perms = [] for i in range(0, 5): arr = np.random.permutation(9) arr = [x+1 for x in arr] perms += arr print(arr) print(perms)
[ "numpy.random.permutation" ]
[((63, 87), 'numpy.random.permutation', 'np.random.permutation', (['(9)'], {}), '(9)\n', (84, 87), True, 'import numpy as np\n')]
## Lindenmayer system functions and classes # Imports import itertools import numpy import pandas from evolve_soft_2d import utility from evolve_soft_2d.unit import rep_grid ################################################################################ class vocabulary: """The L-system vocabulary """ ...
[ "pandas.DataFrame", "numpy.random.choice", "numpy.random.seed", "evolve_soft_2d.utility.clean_str", "evolve_soft_2d.utility.gen_random", "evolve_soft_2d.utility.unique_list", "evolve_soft_2d.utility.list_to_str", "evolve_soft_2d.utility.normalise_list", "itertools.groupby" ]
[((8353, 8385), 'pandas.DataFrame', 'pandas.DataFrame', (['c'], {'columns': 'col'}), '(c, columns=col)\n', (8369, 8385), False, 'import pandas\n'), ((8433, 8484), 'evolve_soft_2d.utility.normalise_list', 'utility.normalise_list', (['c.x', '(template.x_e / 2 - 0.5)'], {}), '(c.x, template.x_e / 2 - 0.5)\n', (8455, 8484)...
# -*- coding: UTF-8 -*- ''' Data preprocessing for slot tagging and intent prediction. Replace the unseen tokens in the test/dev set with <unk> for user intents, user slot tags and agent actions. Author : <NAME> Email : <EMAIL> Created Date: Dec. 31, 2016 ''' from DataSetCSV import DataS...
[ "ipdb.set_trace", "keras.preprocessing.sequence.pad_sequences", "numpy.asarray", "utils.to_categorical", "numpy.zeros" ]
[((1588, 1659), 'keras.preprocessing.sequence.pad_sequences', 'sequence.pad_sequences', (['encode', 'maxlen'], {'padding': '"""pre"""', 'truncating': '"""pre"""'}), "(encode, maxlen, padding='pre', truncating='pre')\n", (1610, 1659), False, 'from keras.preprocessing import sequence\n'), ((2229, 2269), 'numpy.zeros', 'n...
# Standard library import argparse import os import pathlib import shutil import sys import simulacra.star import simulacra.tellurics import simulacra.detector import simulacra.gascell # Third-party import numpy as np # from threadpoolctl import threadpool_limits # Package # from .helpers import get_parser # from .....
[ "numpy.random.uniform", "numpy.random.seed", "argparse.ArgumentParser", "astropy.time.Time", "numpy.ones", "random.seed", "numpy.exp", "astropy.coordinates.SkyCoord", "astropy.coordinates.EarthLocation.of_site", "sys.exit" ]
[((440, 462), 'random.seed', 'random.seed', (['(102102102)'], {}), '(102102102)\n', (451, 462), False, 'import random\n'), ((463, 488), 'numpy.random.seed', 'np.random.seed', (['(102102102)'], {}), '(102102102)\n', (477, 488), True, 'import numpy as np\n'), ((630, 698), 'astropy.time.Time', 'at.Time', (['"""2020-01-01T...
import sys import os import base64 import dash from jupyter_dash import JupyterDash import dash_core_components as dcc import dash_html_components as html from dash.exceptions import PreventUpdate import torch import numpy as np import crepe import scipy from scipy.io import wavfile import psola import io import nemo f...
[ "crepe.predict", "os.remove", "dash_core_components.Textarea", "numpy.sum", "numpy.absolute", "numpy.abs", "numpy.argmax", "numpy.empty", "json.dumps", "scipy.io.wavfile.read", "scipy.signal.firwin", "nemo.collections.tts.models.TalkNetDursModel.restore_from", "nemo.collections.tts.models.Ta...
[((726, 753), 'sys.path.append', 'sys.path.append', (['"""hifi-gan"""'], {}), "('hifi-gan')\n", (741, 753), False, 'import sys\n'), ((899, 920), 'jupyter_dash.JupyterDash', 'JupyterDash', (['__name__'], {}), '(__name__)\n', (910, 920), False, 'from jupyter_dash import JupyterDash\n'), ((951, 980), 'torch.set_grad_enabl...
#! /usr/bin/env python # -*- coding: utf-8 -*- """Driver program to train a CNN on MNIST dataset. """ from math import log10 import keras import matplotlib.pyplot as plt import numpy as np from keras import backend as K from keras.datasets import mnist from keras.layers import Input from keras.models import load_model...
[ "keras.models.load_model", "numpy.argmax", "custom_models.two_conv_layer_model", "utils.plot_learning_curve", "keras.models.Model", "matplotlib.pyplot.figure", "numpy.mean", "numpy.random.normal", "keras.layers.Input", "custom_callbacks.LossHistory", "numpy.full", "utils.preprocess_image_data"...
[((1452, 1469), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (1467, 1469), False, 'from keras.datasets import mnist\n'), ((1505, 1566), 'utils.preprocess_image_data', 'preprocess_image_data', (['X_train', 'X_test', 'img_rows', 'img_cols', 'K'], {}), '(X_train, X_test, img_rows, img_cols, K)\n'...
from base.base_data_loader import BaseDataLoader from utils.uts_classification.utils import readucr,readmts,transform_labels,readmts_uci_har,readmts_ptb,readmts_ptb_aug import sklearn import numpy as np import os import pickle as dill from collections import Counter class UtsClassificationDataLoader(BaseDataLoader): ...
[ "utils.uts_classification.utils.readmts_uci_har", "utils.uts_classification.utils.transform_labels", "utils.uts_classification.utils.readucr", "numpy.argmax", "utils.AFClassication.data_challenge2018.loaddata", "utils.uts_classification.utils.readmts_ptb_aug", "utils.uts_classification.utils.readmts", ...
[((4414, 4451), 'sklearn.preprocessing.OneHotEncoder', 'sklearn.preprocessing.OneHotEncoder', ([], {}), '()\n', (4449, 4451), False, 'import sklearn\n'), ((783, 793), 'utils.AFClassication.data_challenge2018.loaddata', 'loaddata', ([], {}), '()\n', (791, 793), False, 'from utils.AFClassication.data_challenge2018 import...
""" Tests for basis module of the PySplineFit Module Released under MIT License. See LICENSE file for details Copyright (C) 2019 <NAME> Requires pytest """ from .context import pysplinefit from pysplinefit import basis import pytest import numpy as np def test_basis_functions(): degree = 2 ...
[ "pysplinefit.basis.one_basis_function", "numpy.sum", "numpy.allclose", "pysplinefit.basis.basis_function_ders", "pysplinefit.basis.basis_functions", "numpy.isclose", "numpy.array", "pysplinefit.basis.one_basis_function_ders" ]
[((499, 558), 'pysplinefit.basis.basis_functions', 'basis.basis_functions', (['knot_span', 'knot', 'degree', 'knot_vector'], {}), '(knot_span, knot, degree, knot_vector)\n', (520, 558), False, 'from pysplinefit import basis\n'), ((575, 605), 'numpy.array', 'np.array', (['[0.125, 0.75, 0.125]'], {}), '([0.125, 0.75, 0.1...
#-*- coding: utf-8 -*- import random import string import numpy as np import matplotlib.pyplot as plt from PIL import Image from image import ImageCaptcha chars = string.digits + string.ascii_lowercase + string.ascii_uppercase #生成随机验证码文本 def random_captcha_text(char_set=chars, captcha_size=5): captcha_text = [] fo...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "random.choice", "PIL.Image.open", "matplotlib.pyplot.figure", "numpy.array", "image.ImageCaptcha" ]
[((641, 660), 'PIL.Image.open', 'Image.open', (['captcha'], {}), '(captcha)\n', (651, 660), False, 'from PIL import Image\n'), ((678, 701), 'numpy.array', 'np.array', (['captcha_image'], {}), '(captcha_image)\n', (686, 701), True, 'import numpy as np\n'), ((354, 377), 'random.choice', 'random.choice', (['char_set'], {}...
""" TODO: -add ground truth steady-state distribution in phi -determine correct boudnary condition Trying to apply upwind/downwind to our problem. The equation I derived is ...see below """ import time #import matplotlib #import matplotlib.pyplot as plt import numpy as np from scipy.integrate import solve...
[ "numpy.abs", "numpy.floor", "matplotlib.pyplot.figure", "numpy.arange", "numpy.zeros_like", "numpy.add.reduce", "matplotlib.pyplot.close", "scipy.integrate.solve_ivp", "numpy.append", "numpy.linspace", "lib.libMotorPDE.gauss", "lib.libMotorPDE.get_time_index", "matplotlib.pyplot.show", "nu...
[((3417, 3438), 'numpy.zeros_like', 'np.zeros_like', (['self.x'], {}), '(self.x)\n', (3430, 3438), True, 'import numpy as np\n'), ((3591, 3617), 'numpy.linspace', 'np.linspace', (['(0)', 'self.T', 'TN'], {}), '(0, self.T, TN)\n', (3602, 3617), True, 'import numpy as np\n'), ((3683, 3695), 'numpy.zeros', 'np.zeros', (['...
""" Integration using Scipy-provided tool ODEs in the system go as follows: first all coordinate (x, y, z) equations in the order of body_config, then all velocity (vx, vy, vz) ones. """ import time from math import sqrt import numpy as np import scipy.integrate from scipy.constants import G from ..common import Sys...
[ "math.sqrt", "numpy.zeros", "time.time", "numpy.array", "numpy.linspace" ]
[((2494, 2598), 'numpy.linspace', 'np.linspace', (['global_config.dt', '(global_config.dt * global_config.iter_num)'], {'num': 'global_config.iter_num'}), '(global_config.dt, global_config.dt * global_config.iter_num,\n num=global_config.iter_num)\n', (2505, 2598), True, 'import numpy as np\n'), ((2687, 2698), 'time...
import os import logging from os.path import join as opj import numpy as np from tempfile import TemporaryDirectory import rasterio from ost.helpers import vector as vec, utils as h logger = logging.getLogger(__name__) def mosaic( filelist, outfile, cut_to_aoi=False ): check_file = opj(...
[ "ost.helpers.vector.wkt_to_gdf", "os.remove", "rasterio.open", "tempfile.TemporaryDirectory", "numpy.ma.masked_where", "os.path.basename", "os.path.dirname", "ost.helpers.utils.run_command", "os.path.isfile", "ost.helpers.utils.check_out_tiff", "rasterio.mask.mask", "logging.getLogger" ]
[((193, 220), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (210, 220), False, 'import logging\n'), ((2262, 2287), 'ost.helpers.utils.check_out_tiff', 'h.check_out_tiff', (['outfile'], {}), '(outfile)\n', (2278, 2287), True, 'from ost.helpers import vector as vec, utils as h\n'), ((329, ...
import numpy as np import matplotlib.pyplot as plt from wisdem.ccblade.ccblade import CCAirfoil, CCBlade plot_flag = False # geometry Rhub = 1.5 Rtip = 63.0 r = np.array( [ 2.8667, 5.6000, 8.3333, 11.7500, 15.8500, 19.9500, 24.0500, 28.1500, ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.axis", "wisdem.ccblade.ccblade.CCBlade", "numpy.array", "matplotlib.pyplot.grid", "matplotlib.pyplot.savefig" ]
[((166, 303), 'numpy.array', 'np.array', (['[2.8667, 5.6, 8.3333, 11.75, 15.85, 19.95, 24.05, 28.15, 32.25, 36.35, \n 40.45, 44.55, 48.65, 52.75, 56.1667, 58.9, 61.6333]'], {}), '([2.8667, 5.6, 8.3333, 11.75, 15.85, 19.95, 24.05, 28.15, 32.25, \n 36.35, 40.45, 44.55, 48.65, 52.75, 56.1667, 58.9, 61.6333])\n', (17...
import numpy as np from rdkit import Chem # bond mapping bond_dict = {'SINGLE': 0, 'DOUBLE': 1, 'TRIPLE': 2, "AROMATIC": 3} number_to_bond = {0: Chem.rdchem.BondType.SINGLE, 1: Chem.rdchem.BondType.DOUBLE, 2: Chem.rdchem.BondType.TRIPLE, 3: Chem.rdchem.BondType.ARO...
[ "numpy.array" ]
[((7060, 7167), 'numpy.array', 'np.array', (['[28, 31, 33, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,\n 53, 55, 58, 84]'], {}), '([28, 31, 33, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, \n 49, 50, 51, 53, 55, 58, 84])\n', (7068, 7167), True, 'import numpy as np\n'), ((8570, 8677), 'n...
import numpy as np import configparser import json import heapq import tensorflow as tf class KNN_Sequence: def __init__(self): self.graph = None self.sess = None self.dtype = tf.float32 return def train(self, training_data, labels, train_set_sample_ids, samples_length): ...
[ "numpy.load", "json.load", "numpy.sum", "tensorflow.nn.top_k", "numpy.zeros", "tensorflow.Session", "tensorflow.pow", "tensorflow.placeholder", "tensorflow.Variable", "numpy.mean", "tensorflow.Graph", "numpy.savez", "configparser.ConfigParser" ]
[((9620, 9647), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (9645, 9647), False, 'import configparser\n'), ((9939, 9980), 'numpy.load', 'np.load', (["common_para['path']['data_file']"], {}), "(common_para['path']['data_file'])\n", (9946, 9980), True, 'import numpy as np\n'), ((3155, 3198...
import json import numpy as np import numba import sys if sys.version_info < (3,): integer_types = (int, long,) else: integer_types = (int,) eps = np.finfo(np.float64).eps def timeparams(ntimesamples=None, fs=None, duration=None): # we need enough info from duration, fs and ntimesamples havents = not...
[ "json.dumps", "numpy.finfo", "tempfile.mkdtemp", "numpy.array", "sys.getsizeof", "shutil.rmtree", "math.log" ]
[((157, 177), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (165, 177), True, 'import numpy as np\n'), ((428, 464), 'numpy.array', 'np.array', (['[havents, havefs, havedur]'], {}), '([havents, havefs, havedur])\n', (436, 464), True, 'import numpy as np\n'), ((3698, 3723), 'tempfile.mkdtemp', 'tempf...
""" Our implementation of obstacle detection pipeline steps @authors: <NAME>, <NAME>, <NAME>, <NAME> """ import numpy as np import pandas as pd from datetime import datetime from scipy.spatial import ConvexHull from scipy.ndimage.interpolation import rotate def roi_filter_rounded(pcloud, verbose=True, **params): ...
[ "numpy.arctan2", "numpy.concatenate", "numpy.nanmax", "numpy.square", "numpy.zeros", "numpy.transpose", "numpy.nanmin", "numpy.argmin", "numpy.mod", "numpy.array", "numpy.cos", "numpy.dot", "scipy.spatial.ConvexHull", "datetime.datetime.now", "numpy.unique" ]
[((2736, 2750), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2748, 2750), False, 'from datetime import datetime\n'), ((3291, 3305), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (3303, 3305), False, 'from datetime import datetime\n'), ((4617, 4652), 'numpy.array', 'np.array', (['([z_min] * 4...
from __future__ import absolute_import, division, print_function from os.path import join from absl import flags import os, collections, json, codecs, pickle, re, xlnet import numpy as np import tensorflow as tf import sentencepiece as spm from xlnet_config import FLAGS from data_utils import SEP_ID, VOCAB_SIZE...
[ "tensorflow.gfile.Exists", "tensorflow.reduce_sum", "pickle.dump", "sentencepiece.SentencePieceProcessor", "tensorflow.logging.info", "tensorflow.trainable_variables", "tensorflow.logging.set_verbosity", "os.path.isfile", "tensorflow.estimator.Estimator", "pickle.load", "xlnet.create_run_config"...
[((665, 794), 'logging.basicConfig', 'logger.basicConfig', ([], {'format': '"""%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s"""', 'level': 'logger.INFO'}), "(format=\n '%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s',\n level=logger.INFO)\n", (683, 794), True, ...
import os import json import h5py import numpy as np import torch from torch.utils.data import Dataset from torch.nn import functional as F from .datasets import register_dataset from .data_utils import truncate_feats @register_dataset("anet") class ActivityNetDataset(Dataset): def __init__( self, ...
[ "h5py.File", "json.load", "numpy.load", "torch.stack", "numpy.asarray", "os.path.exists", "numpy.zeros", "numpy.linspace", "os.path.join", "torch.from_numpy" ]
[((1276, 1303), 'os.path.exists', 'os.path.exists', (['feat_folder'], {}), '(feat_folder)\n', (1290, 1303), False, 'import os\n'), ((1308, 1333), 'os.path.exists', 'os.path.exists', (['json_file'], {}), '(json_file)\n', (1322, 1333), False, 'import os\n'), ((2821, 2847), 'numpy.linspace', 'np.linspace', (['(0.5)', '(0....
# coding: utf-8 import sys from python_environment_check import check_packages import networkx as nx import numpy as np import torch from torch.nn.parameter import Parameter import torch.nn.functional as F from torch.utils.data import Dataset from torch.utils.data import DataLoader # # Machine Learning with PyTorch ...
[ "torch.cat", "torch.mm", "numpy.arange", "networkx.adjacency_matrix", "python_environment_check.check_packages", "torch.utils.data.DataLoader", "torch.nn.Linear", "torch.zeros", "torch.manual_seed", "networkx.draw", "torch.rand", "networkx.get_node_attributes", "numpy.dot", "torch.sum", ...
[((466, 490), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (481, 490), False, 'import sys\n'), ((615, 632), 'python_environment_check.check_packages', 'check_packages', (['d'], {}), '(d)\n', (629, 632), False, 'from python_environment_check import check_packages\n'), ((2155, 2165), 'n...
# coding=utf-8 # 导入自己的函数包d2lzh_pytorch,注意要先将目标包的父路径添加到系统路径中 import sys sys.path.append(r".") from d2lzh_pytorch import train, plot import numpy as np import torch import math """ 这一节重新开始详细介绍和实验梯度下降相关的算法 """ # 写一个一维的梯度下降函数进行测试,这里假定目标函数是x**2,因此导数是2*x # 这里的eta是一个比较小的值,也就是学习率,代表了往梯度方向移动的步伐大小 def gd(eta): # 设置初始值 ...
[ "sys.path.append", "d2lzh_pytorch.plot.set_figsize", "d2lzh_pytorch.plot.plt.show", "d2lzh_pytorch.train.train_2d", "d2lzh_pytorch.plot.plt.plot", "d2lzh_pytorch.plot.plt.ylabel", "numpy.arange", "numpy.random.normal", "d2lzh_pytorch.plot.plt.xlabel" ]
[((72, 92), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (87, 92), False, 'import sys\n'), ((645, 666), 'numpy.arange', 'np.arange', (['(-n)', 'n', '(0.1)'], {}), '(-n, n, 0.1)\n', (654, 666), True, 'import numpy as np\n'), ((671, 689), 'd2lzh_pytorch.plot.set_figsize', 'plot.set_figsize', ([], {...
#!/usr/bin/python # -*- coding: utf-8 -*- """ For each measurement configuration, the sensitivity distribution and the center of mass of its values is computed. Then for all measurements sensitivities and centers of mass are plotted in the grid. This might give a better overview on the sensitivities of our measurement...
[ "numpy.abs", "optparse.OptionParser", "numpy.savetxt", "numpy.zeros", "numpy.isnan", "numpy.nanmin", "numpy.mod", "crtomo.grid.crt_grid", "numpy.array", "numpy.loadtxt", "shutil.rmtree", "numpy.round", "numpy.nanmax" ]
[((1286, 1300), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (1298, 1300), False, 'from optparse import OptionParser\n'), ((13135, 13184), 'numpy.savetxt', 'np.savetxt', (['"""center.dat"""', 'center_obj.sens_centers'], {}), "('center.dat', center_obj.sens_centers)\n", (13145, 13184), True, 'import numpy ...
#!/usr/bin/env python import rospy from gazebo_msgs.srv import GetModelState, ApplyBodyWrenchRequest, ApplyBodyWrench, ApplyBodyWrenchResponse from sub8_gazebo.srv import SetTurbulence from mil_ros_tools import msg_helpers import numpy as np class Turbulizor(): def __init__(self, mag, freq): rospy.wait_...
[ "numpy.random.uniform", "rospy.ServiceProxy", "rospy.Time", "rospy.sleep", "rospy.wait_for_service", "rospy.loginfo", "mil_ros_tools.msg_helpers.make_wrench_stamped", "rospy.is_shutdown", "rospy.init_node", "gazebo_msgs.srv.ApplyBodyWrenchRequest", "gazebo_msgs.srv.ApplyBodyWrenchResponse", "r...
[((2778, 2807), 'rospy.init_node', 'rospy.init_node', (['"""turbulator"""'], {}), "('turbulator')\n", (2793, 2807), False, 'import rospy\n'), ((2838, 2850), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (2848, 2850), False, 'import rospy\n'), ((309, 360), 'rospy.wait_for_service', 'rospy.wait_for_service', (['"""/gazeb...
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Module test_measured_model - Contains the unit tests for the classes in the datamodels.miri_measured_model module. :History: 15 Jan 2013: Created. 21 Jan 2013: Warning messages controlled with Python warnings module. 05 Feb 2013: File closing problem solved by using ...
[ "unittest.main", "miri.datamodels.miri_measured_model.MiriRampModel", "os.remove", "numpy.ones_like", "miri.datamodels.miri_measured_model.MiriMeasuredModel", "warnings.simplefilter", "numpy.asarray", "numpy.allclose", "numpy.all", "os.path.isfile", "numpy.mean", "warnings.catch_warnings", "...
[((45407, 45422), 'unittest.main', 'unittest.main', ([], {}), '()\n', (45420, 45422), False, 'import unittest\n'), ((4238, 4273), 'numpy.linspace', 'np.linspace', (['(0.0)', '(100000.0)', '(64 * 64)'], {}), '(0.0, 100000.0, 64 * 64)\n', (4249, 4273), True, 'import numpy as np\n'), ((4335, 4368), 'miri.datamodels.miri_m...
# This file is used to run the CIFAR and KITTI experiments easily with different hyper paramters # Note that the MNIST experiment has its own runner since no hyper parameter exploration was used from training_classification import train as train_c from training_classification import getModel as model_c from train...
[ "quaternion_layers.utils.Params", "numpy.random.seed", "click.argument", "training_segmentation.getModel", "training_classification.getModel", "click.option", "click.command", "training_classification.train", "training_segmentation.train", "os.path.join" ]
[((521, 540), 'numpy.random.seed', 'np.random.seed', (['(314)'], {}), '(314)\n', (535, 540), True, 'import numpy as np\n'), ((545, 560), 'click.command', 'click.command', ([], {}), '()\n', (558, 560), False, 'import click\n'), ((563, 585), 'click.argument', 'click.argument', (['"""task"""'], {}), "('task')\n", (577, 58...
import time import os import math import matplotlib.pyplot as plt from scipy.io import loadmat from mpl_toolkits.mplot3d.art3d import Line3D, Poly3DCollection import matplotlib.animation as animation import numpy as np from plot import plot_component from components import fgnetfdm def render_in_flightgear(trajs, n...
[ "components.fgnetfdm.FGNetFDM", "plot.plot_component", "numpy.asarray", "os.path.realpath", "numpy.zeros", "math.sin", "time.time", "matplotlib.animation.FuncAnimation", "mpl_toolkits.mplot3d.art3d.Poly3DCollection", "matplotlib.pyplot.figure", "time.monotonic", "numpy.array", "math.cos", ...
[((1000, 1019), 'components.fgnetfdm.FGNetFDM', 'fgnetfdm.FGNetFDM', ([], {}), '()\n', (1017, 1019), False, 'from components import fgnetfdm\n'), ((1040, 1056), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (1054, 1056), False, 'import time\n'), ((2283, 2344), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], ...
""" Auxilary functions """ import os import glob import shutil import logging import hashlib import itertools import json from collections import OrderedDict from copy import deepcopy import dill from tqdm import tqdm_notebook import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.colo...
[ "os.remove", "numpy.argmax", "logging.Formatter", "numpy.mean", "glob.glob", "shutil.rmtree", "itertools.cycle", "os.path.join", "pandas.DataFrame", "logging.FileHandler", "numpy.std", "os.path.dirname", "os.path.exists", "dill.load", "matplotlib.colors.TABLEAU_COLORS.keys", "matplotli...
[((1417, 1456), 'glob.glob', 'glob.glob', (['f"""{research_name}/configs/*"""'], {}), "(f'{research_name}/configs/*')\n", (1426, 1456), False, 'import glob\n'), ((2385, 2426), 'shutil.rmtree', 'shutil.rmtree', (['f"""{research_name}/configs"""'], {}), "(f'{research_name}/configs')\n", (2398, 2426), False, 'import shuti...
import numpy as np import argparse import scipy.linalg as la import time from . import leapUtils import scipy.linalg.blas as blas from . import leapMain np.set_printoptions(precision=3, linewidth=200) def eigenDecompose(bed, kinshipFile=None, outFile=None, ignore_neig=False): if (kinshipFile is None): #Compute kin...
[ "numpy.set_printoptions", "argparse.ArgumentParser", "time.time", "numpy.savez_compressed", "numpy.loadtxt", "scipy.linalg.blas.dsyrk" ]
[((153, 200), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'linewidth': '(200)'}), '(precision=3, linewidth=200)\n', (172, 200), True, 'import numpy as np\n'), ((899, 924), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (922, 924), False, 'import argparse\n'), ((37...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from typing import Optional import numpy as np from ax.models.random.base import RandomModel from scipy.stats import uniform class UniformGenerator(RandomModel): """This class specifies a uniform random generation alg...
[ "scipy.stats.uniform.rvs", "numpy.random.RandomState" ]
[((696, 728), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'seed'}), '(seed=seed)\n', (717, 728), True, 'import numpy as np\n'), ((1081, 1136), 'scipy.stats.uniform.rvs', 'uniform.rvs', ([], {'size': '(n, tunable_d)', 'random_state': 'self._rs'}), '(size=(n, tunable_d), random_state=self._rs)\n', ...
from collections import defaultdict import numpy as np import random from amplification.tasks.core import idk, Task, sequences #yields edges of a random tree on [a, b) #if b = a+1, yields nothing #if point to is not none, all edges (x, y) have y closer to point_to def random_tree(a, b, point_to=None): if a + 1 < ...
[ "numpy.isin", "numpy.minimum", "random.sample", "random.choice", "collections.defaultdict", "numpy.random.randint", "numpy.random.choice", "amplification.tasks.core.sequences", "numpy.all", "numpy.sqrt" ]
[((339, 366), 'numpy.random.randint', 'np.random.randint', (['(a + 1)', 'b'], {}), '(a + 1, b)\n', (356, 366), True, 'import numpy as np\n'), ((377, 404), 'numpy.random.randint', 'np.random.randint', (['a', 'split'], {}), '(a, split)\n', (394, 404), True, 'import numpy as np\n'), ((417, 444), 'numpy.random.randint', 'n...
import time import numpy as np from multiprocessing import Pool, cpu_count from KosarajuSCC import Node, Graph # Variation of Papadimitriou's 2SAT algorithm with less time complexity. def papadimitriou(n_vars: int, clause_array: np.ndarray, variable_dict: dict) -> list or None: # Choose random initial assignment...
[ "numpy.sum", "numpy.logical_not", "numpy.dtype", "KosarajuSCC.Graph", "time.time", "KosarajuSCC.Node", "numpy.random.choice" ]
[((338, 398), 'numpy.random.choice', 'np.random.choice', ([], {'a': '[False, True]', 'size': 'n_vars', 'replace': '(True)'}), '(a=[False, True], size=n_vars, replace=True)\n', (354, 398), True, 'import numpy as np\n'), ((5777, 5788), 'time.time', 'time.time', ([], {}), '()\n', (5786, 5788), False, 'import time\n'), ((4...
import math import random import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import tensorflow as tf import keras_cv from keras_cv.metrics import coco def produce_random_data(include_confidence=False, num_images=128, num_classes=20): """Generates a fake list...
[ "pandas.DataFrame", "seaborn.lineplot", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "keras_cv.bounding_box.pad_batch_to_shape", "random.uniform", "keras_cv.metrics.coco.COCOMeanAveragePrecision", "tensorflow.constant", "time.time", "tensorflow.stack", "numpy.random.rand", "matplotlib....
[((2191, 2363), 'pandas.DataFrame', 'pd.DataFrame', (["{'n_images': n_images, 'update_state_runtimes': update_state_runtimes,\n 'result_runtimes': result_runtimes, 'end_to_end_runtimes':\n end_to_end_runtimes}"], {}), "({'n_images': n_images, 'update_state_runtimes':\n update_state_runtimes, 'result_runtimes':...
# -*- coding: utf-8 -*- ''' Copyright (c) 2018 by <NAME> This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY). :author: <NAME> ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from . impor...
[ "numpy.random.uniform", "numpy.abs", "numpy.zeros", "time.time", "numpy.random.normal" ]
[((3632, 3683), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'old_par', 'scale': 'self.stepsizes'}), '(loc=old_par, scale=self.stepsizes)\n', (3648, 3683), True, 'import numpy as np\n'), ((4704, 4726), 'numpy.zeros', 'np.zeros', (['self.nChains'], {}), '(self.nChains)\n', (4712, 4726), True, 'import numpy as...
import numpy as np import pandas as pd from IPython.display import display np.random.seed(100) # setting up a 9 x 4 matrix rows = 9 cols = 4 a = np.random.randn(rows,cols) df = pd.DataFrame(a) display(df) print(df.mean()) print(df.std()) display(df**2) df.columns = ['First', 'Second', 'Third', 'Fourth'] df.index = np...
[ "pandas.DataFrame", "numpy.random.seed", "numpy.random.randn", "IPython.display.display", "numpy.arange", "pylab.plt.style.use" ]
[((75, 94), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (89, 94), True, 'import numpy as np\n'), ((145, 172), 'numpy.random.randn', 'np.random.randn', (['rows', 'cols'], {}), '(rows, cols)\n', (160, 172), True, 'import numpy as np\n'), ((177, 192), 'pandas.DataFrame', 'pd.DataFrame', (['a'], {}),...
import ROOT as R from gna.bindings import patchROOTClass import numpy as N @patchROOTClass(R.DataType.Hist('DataType'), '__str__') def DataType__Hist____str__(self): dt=self.cast() if len(dt.shape)==1: edges = N.asanyarray(dt.edges) if edges.size<2: return 'hist, {:3d} bins, edges ...
[ "ROOT.DataType.Hist", "numpy.asanyarray", "ROOT.DataType.Points", "numpy.allclose" ]
[((93, 120), 'ROOT.DataType.Hist', 'R.DataType.Hist', (['"""DataType"""'], {}), "('DataType')\n", (108, 120), True, 'import ROOT as R\n'), ((1323, 1352), 'ROOT.DataType.Points', 'R.DataType.Points', (['"""DataType"""'], {}), "('DataType')\n", (1340, 1352), True, 'import ROOT as R\n'), ((228, 250), 'numpy.asanyarray', '...
from abc import ABC, abstractmethod import numpy as np from gym.envs.mujoco import MujocoEnv class MujocoWrapper(ABC, MujocoEnv): @abstractmethod def qposvel_from_obs(self, obs): pass def set_state_from_obs(self, obs): qpos, qvel = self.qposvel_from_obs(obs) self.set_state(qpos, ...
[ "numpy.full_like" ]
[((529, 556), 'numpy.full_like', 'np.full_like', (['state', 'np.nan'], {}), '(state, np.nan)\n', (541, 556), True, 'import numpy as np\n')]
#!/usr/bin/env python # -*- coding: UTF-8 no BOM -*- """ General math module for crystal orientation related calculation. Most of the conventions used in this module is based on: D Rowenhorst et al. Consistent representations of and conversions between 3D rotations 10.1088/0965-0393/23/8/083501 with the...
[ "numpy.arctan2", "concurrent.futures.ProcessPoolExecutor", "hexomap.npmath.normalize", "numpy.argmin", "numpy.isclose", "numpy.sin", "numpy.linalg.norm", "pprint.pprint", "hexomap.npmath.norm", "hexomap.utility.iszero", "hexomap.utility.isone", "numpy.append", "hexomap.utility.standarize_eul...
[((16477, 16499), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (16486, 16499), False, 'from dataclasses import dataclass\n'), ((17109, 17128), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (17117, 17128), True, 'import numpy as np\n'), ((17150, 17169), 'numpy.a...
import math import numpy as np from radon_server.radon_thread import RadonTransformThread class DSSRadon(RadonTransformThread): def get_algorithm_name(self): return "dss" def run_transform(self, image, n, variant=None): M = int(np.shape(image)[0]) N = int(np.shape(image)[1]) ...
[ "math.floor", "numpy.zeros", "numpy.shape", "numpy.sin", "numpy.arange", "numpy.where", "numpy.cos" ]
[((333, 366), 'numpy.zeros', 'np.zeros', (['(n, n)'], {'dtype': '"""float64"""'}), "((n, n), dtype='float64')\n", (341, 366), True, 'import numpy as np\n'), ((4432, 4476), 'numpy.arange', 'np.arange', (['pmin', '(pmin + dp * H)', 'dp', 'np.float'], {}), '(pmin, pmin + dp * H, dp, np.float)\n', (4441, 4476), True, 'impo...
import multiprocessing import numpy as np from multi_mesh.components.interpolator import inverse_transform from multi_mesh.components.interpolator import get_coefficients from pykdtree.kdtree import KDTree from tqdm import tqdm def map_to_ellipse(base_mesh, mesh): """Takes a base mesh with ellipticity topography ...
[ "numpy.sum", "numpy.concatenate", "numpy.copy", "numpy.vectorize", "numpy.abs", "numpy.zeros", "numpy.asfortranarray", "multi_mesh.components.interpolator.inverse_transform", "numpy.isnan", "multiprocessing.cpu_count", "numpy.shape", "pykdtree.kdtree.KDTree", "numpy.where", "numpy.array", ...
[((657, 709), 'numpy.unique', 'np.unique', (['base_mesh.connectivity'], {'return_index': '(True)'}), '(base_mesh.connectivity, return_index=True)\n', (666, 709), True, 'import numpy as np\n'), ((967, 992), 'numpy.copy', 'np.copy', (['base_mesh.points'], {}), '(base_mesh.points)\n', (974, 992), True, 'import numpy as np...
#!/usr/bin/env python # encoding: utf-8 # The MIT License (MIT) # Copyright (c) 2018-2020 CNRS # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limita...
[ "pyannote.pipeline.blocks.clustering.HierarchicalAgglomerativeClustering", "pyannote.core.utils.numpy.one_hot_decoding", "numpy.mean", "pyannote.pipeline.blocks.clustering.AffinityPropagationClustering", "pyannote.audio.features.wrapper.Wrapper", "numpy.vstack" ]
[((3129, 3152), 'pyannote.audio.features.wrapper.Wrapper', 'Wrapper', (['self.embedding'], {}), '(self.embedding)\n', (3136, 3152), False, 'from pyannote.audio.features.wrapper import Wrapper, Wrappable\n'), ((5917, 5944), 'pyannote.core.utils.numpy.one_hot_decoding', 'one_hot_decoding', (['y', 'window'], {}), '(y, win...
from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import numpy as np from sklearn.cross_validation import StratifiedKFold NUM_BIZ_TRAIN = 2000 NUM_BIZ_TEST = 10000 def makeKFold(n_folds, y, reps): assert y.shape[0...
[ "numpy.sum", "numpy.floor", "numpy.apply_along_axis", "numpy.mean", "numpy.arange", "numpy.reshape", "sklearn.cross_validation.StratifiedKFold" ]
[((394, 451), 'sklearn.cross_validation.StratifiedKFold', 'StratifiedKFold', (['y_compact'], {'n_folds': 'n_folds', 'shuffle': '(True)'}), '(y_compact, n_folds=n_folds, shuffle=True)\n', (409, 451), False, 'from sklearn.cross_validation import StratifiedKFold\n'), ((854, 877), 'numpy.sum', 'np.sum', (['(pred_list > 0.5...
import numpy as np import pickle import os from tqdm import tqdm import pandas as pd import argparse import matplotlib.pyplot as plt import matplotlib font = {'family' : 'normal', 'weight' : 'bold', 'size' : 10} matplotlib.rc('font', **font) def get_args(): parser = argparse.Arg...
[ "pandas.DataFrame", "matplotlib.rc", "argparse.ArgumentParser", "numpy.asarray", "os.system", "numpy.argsort", "pickle.load", "numpy.arange", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((245, 274), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (258, 274), False, 'import matplotlib\n'), ((730, 773), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['index', 'sequence']"}), "(columns=['index', 'sequence'])\n", (742, 773), True, 'import pandas as pd\n'), ((917, 949)...
import os import subprocess import sys from setuptools import Extension, find_packages, setup from setuptools.command.build_py import build_py try: from numpy import get_include except ImportError: subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy==1.19.2"]) from numpy import get_incl...
[ "subprocess.run", "setuptools.Extension", "subprocess.check_call", "Cython.Build.cythonize", "numpy.get_include", "setuptools.command.build_py.build_py.run", "os.path.join", "setuptools.find_packages" ]
[((1675, 1727), 'os.path.join', 'os.path.join', (['"""spokestack/extensions/webrtc"""', 'source'], {}), "('spokestack/extensions/webrtc', source)\n", (1687, 1727), False, 'import os\n'), ((3108, 3259), 'setuptools.Extension', 'Extension', (['"""spokestack.extensions.webrtc.agc"""', "(['spokestack/extensions/webrtc/agc....
import sys import numpy as np def main() -> int: a = np.array([[1, 2, ], [3, 4, ]], dtype=np.float32) print(a) print("np.min(a, axis=0): ", np.min(a, axis=0)) print("np.max(a, axis=0): ", np.max(a, axis=0)) print("np.min(a, axis=1): ", np.min(a, axis=1)) print("np.max(a, axis=1): ", np.max(...
[ "numpy.mean", "numpy.min", "numpy.max", "numpy.array" ]
[((60, 104), 'numpy.array', 'np.array', (['[[1, 2], [3, 4]]'], {'dtype': 'np.float32'}), '([[1, 2], [3, 4]], dtype=np.float32)\n', (68, 104), True, 'import numpy as np\n'), ((156, 173), 'numpy.min', 'np.min', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (162, 173), True, 'import numpy as np\n'), ((208, 225), 'numpy.max',...
# Copyright 2021 by <NAME>. All rights reserved. # # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Tests for Bio.Align.nexus module.""" import unittest from io import StringIO from Bio.Align.nexu...
[ "unittest.main", "io.StringIO", "unittest.TextTestRunner", "Bio.Align.nexus.AlignmentWriter", "Bio.MissingPythonDependencyError", "Bio.Align.nexus.AlignmentIterator", "numpy.array", "numpy.array_equal" ]
[((17090, 17126), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (17113, 17126), False, 'import unittest\n'), ((17131, 17163), 'unittest.main', 'unittest.main', ([], {'testRunner': 'runner'}), '(testRunner=runner)\n', (17144, 17163), False, 'import unittest\n'), ((4...
from data_loader.bw_data_loader import MyDataLoader from models.bw_model import MyModel from trainers.my_trainer import MyModelTrainer from utils.config import process_config from utils.dirs import create_dirs from utils.utils import get_args import numpy as np from matplotlib import pyplot as plt plt.ion() def main(...
[ "numpy.transpose", "models.bw_model.MyModel", "utils.dirs.create_dirs", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "utils.config.process_config", "data_loader.bw_data_loader.MyDataLoader", "numpy.random.choice", "utils.utils.get_args" ]
[((300, 309), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (307, 309), True, 'from matplotlib import pyplot as plt\n'), ((616, 705), 'utils.dirs.create_dirs', 'create_dirs', (['[config.callbacks.tensorboard_log_dir, config.callbacks.checkpoint_dir]'], {}), '([config.callbacks.tensorboard_log_dir, config.callba...
import logging import anndata import igraph as ig import leidenalg import numpy as np import scanpy from anndata import AnnData from sklearn.cluster import (DBSCAN, AgglomerativeClustering, Birch, KMeans, SpectralClustering) from sklearn.mixture import GaussianMixture from sklearn.neighbor...
[ "sklearn.cluster.DBSCAN", "numpy.sum", "warnings.filterwarnings", "igraph.Graph", "leidenalg.find_partition", "numpy.array", "numpy.unique" ]
[((736, 759), 'numpy.array', 'np.array', (['[2, 4, 8, 16]'], {}), '([2, 4, 8, 16])\n', (744, 759), True, 'import numpy as np\n'), ((3278, 3301), 'numpy.array', 'np.array', (['[2, 4, 8, 16]'], {}), '([2, 4, 8, 16])\n', (3286, 3301), True, 'import numpy as np\n'), ((5100, 5123), 'numpy.array', 'np.array', (['[2, 4, 8, 16...
import os import numpy as np try: import matplotlib.cm as mplcm from matplotlib.animation import FuncAnimation from mpl_toolkits.mplot3d import Axes3D except ImportError: pass import openpifpaf from .transforms import transform_skeleton CAR_KEYPOINTS_24 = [ 'front_up_right', # 1 'front...
[ "os.makedirs", "mpl_toolkits.mplot3d.Axes3D", "matplotlib.cm.get_cmap", "openpifpaf.show.KeypointPainter", "matplotlib.animation.FuncAnimation", "numpy.any", "openpifpaf.show.canvas", "numpy.max", "numpy.min", "numpy.array", "openpifpaf.show.Canvas.blank", "openpifpaf.annotation.Annotation" ]
[((3250, 3815), 'numpy.array', 'np.array', (['[[-2.9, 4.0, FRONT * 0.5], [2.9, 4.0, FRONT * 0.5], [-2.0, 2.0, FRONT], [\n 2.0, 2.0, FRONT], [-2.5, 0.0, FRONT], [2.5, 0.0, FRONT], [2.6, 4.2, 0.0\n ], [3.2, 0.2, FRONT * 0.7], [3.0, 0.3, BACK * 0.7], [3.1, 2.1, BACK * \n 0.5], [2.4, 4.3, BACK * 0.35], [-2.4, 4.3,...
# ActivitySim # See full license in LICENSE.txt. import sys import os import logging import yaml import numpy as np import pandas as pd from activitysim.abm.models.util import tour_frequency as tf from activitysim.core.util import reindex logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) # create...
[ "pandas.DataFrame", "yaml.load", "pandas.merge", "logging.StreamHandler", "logging.Formatter", "activitysim.abm.models.util.tour_frequency.set_tour_index", "numpy.where", "pandas.Series", "activitysim.core.util.reindex", "os.path.join", "pandas.concat", "logging.getLogger" ]
[((252, 279), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'import logging\n'), ((366, 389), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (387, 389), False, 'import logging\n'), ((24632, 24670), 'os.path.join', 'os.path.join', (['data_dir', '"""...
import numpy as np import pygame, OpenGL from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from OpenGL.GLUT.freeglut import * def setup_lighting(): draw_2side=False c=[1.0,1.0,1.0] glColor3fv(c) mat_specular=[0.18, 0.18, 0.18, 0.18 ] ...
[ "numpy.array" ]
[((1399, 1442), 'numpy.array', 'np.array', (['[-1, 1, -1, 1, 1, -1]', 'np.float32'], {}), '([-1, 1, -1, 1, 1, -1], np.float32)\n', (1407, 1442), True, 'import numpy as np\n')]
#!/usr/bin/env python # -*- animation -*- """ Animation of a double pendulum """ from numpy import sin, cos, pi, array import time import gr try: from time import perf_counter except ImportError: from time import clock as perf_counter g = 9.8 # gravitational constant def rk4(x, h, y, f): k1 = h *...
[ "gr.updatews", "gr.setviewport", "gr.setmarkertype", "gr.polyline", "time.clock", "time.sleep", "gr.setwindow", "gr.fillarea", "gr.polymarker", "numpy.sin", "numpy.array", "gr.clearws", "numpy.cos", "gr.setmarkersize", "gr.setmarkercolorind" ]
[((1878, 1892), 'time.clock', 'perf_counter', ([], {}), '()\n', (1890, 1892), True, 'from time import clock as perf_counter\n'), ((899, 988), 'numpy.array', 'array', (['[w1, (e * d - b * f) / (a * d - c * b), w2, (a * f - c * e) / (a * d - c * b)]'], {}), '([w1, (e * d - b * f) / (a * d - c * b), w2, (a * f - c * e) / ...
import networkx as nx import numpy as np from scipy.optimize import minimize from cirq import PauliString, Pauli, Simulator, GridQubit from .qaoa import QAOA from .pauli_operations import CirqPauliSum, add_pauli_strings def print_fun(x): print(x) class CirqMaxCutSolver: """ CirqMaxCutSolver creates the...
[ "numpy.conj", "cirq.PauliString", "cirq.GridQubit", "cirq.Simulator", "numpy.hstack", "networkx.Graph", "cirq.Pauli.by_index" ]
[((7135, 7161), 'numpy.hstack', 'np.hstack', (['(betas, gammas)'], {}), '((betas, gammas))\n', (7144, 7161), True, 'import numpy as np\n'), ((7277, 7288), 'cirq.Simulator', 'Simulator', ([], {}), '()\n', (7286, 7288), False, 'from cirq import PauliString, Pauli, Simulator, GridQubit\n'), ((4721, 4736), 'cirq.GridQubit'...
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: ls-checkpoint.py # Author: <NAME> <<EMAIL>> import tensorflow as tf import numpy as np import six import sys import pprint from tensorpack.tfutils.varmanip import get_checkpoint_path if __name__ == '__main__': fpath = sys.argv[1] if fpath.endswith('.npy'...
[ "numpy.load", "tensorflow.train.NewCheckpointReader", "pprint.pprint", "tensorpack.tfutils.varmanip.get_checkpoint_path", "six.iteritems" ]
[((737, 755), 'pprint.pprint', 'pprint.pprint', (['dic'], {}), '(dic)\n', (750, 755), False, 'import pprint\n'), ((599, 631), 'tensorpack.tfutils.varmanip.get_checkpoint_path', 'get_checkpoint_path', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (618, 631), False, 'from tensorpack.tfutils.varmanip import get_checkpoint_pat...
#%% from tsbooster.cv import TimeseriesHoldout import pandas as pd import numpy as np #%% def test_holdout_cv(): data = { "time": np.arange(0, 30), "vals": np.arange(10, 40), "dates": pd.date_range( pd.Timestamp("2020-01-01"), pd.Timestamp("2020-01-30"), freq="1 d" ).val...
[ "pandas.DataFrame", "tsbooster.cv.TimeseriesHoldout", "pandas.Timestamp", "numpy.arange" ]
[((340, 358), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (352, 358), True, 'import pandas as pd\n'), ((428, 454), 'pandas.Timestamp', 'pd.Timestamp', (['"""2020-01-16"""'], {}), "('2020-01-16')\n", (440, 454), True, 'import pandas as pd\n'), ((465, 526), 'tsbooster.cv.TimeseriesHoldout', 'Timeserie...
import numpy as np def iterative_mean(i_iter, current_mean, x): """Iteratively calculates mean using http://www.heikohoffmann.de/htmlthesis/node134.html. Originally implemented in treeexplainer https://github.com/andosa/treeexplainer/pull/24 :param i_iter: [int > 0] Current iteration. :param curr...
[ "numpy.true_divide", "numpy.errstate", "numpy.isfinite" ]
[((1079, 1125), 'numpy.errstate', 'np.errstate', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (1090, 1125), True, 'import numpy as np\n'), ((1139, 1159), 'numpy.true_divide', 'np.true_divide', (['a', 'b'], {}), '(a, b)\n', (1153, 1159), True, 'import numpy as np\...
import enum import time import gpflow as gpf import numpy as np import tensorflow as tf from absl import flags from absl.flags import FLAGS from gpflow import config from gpflow.kernels import SquaredExponential from gpflow.models import GPR from tensorflow_probability.python.experimental.mcmc import ProgressBarReduce...
[ "gpflow.config.default_float", "pssgp.kernels.Matern32", "numpy.mean", "pssgp.kernels.Matern52", "pssgp.kernels.Periodic", "tensorflow_probability.python.experimental.mcmc.make_tqdm_progress_bar_fn", "tensorflow_probability.python.mcmc.HamiltonianMonteCarlo", "tensorflow_probability.python.mcmc.sample...
[((925, 990), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""device"""', '"""/cpu:0"""', '"""Device on which to run"""'], {}), "('device', '/cpu:0', 'Device on which to run')\n", (944, 990), False, 'from absl import flags\n'), ((3350, 3447), 'gpflow.optimizers.SamplingHelper', 'gpf.optimizers.SamplingHelper',...
# Copyright 2020 Makani Technologies 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...
[ "makani.config.mconfig.Config", "numpy.linalg.norm", "numpy.deg2rad" ]
[((715, 847), 'makani.config.mconfig.Config', 'mconfig.Config', ([], {'deps': "{'flight_plan': 'common.flight_plan', 'propellers': 'prop.propellers',\n 'wing_serial': 'common.wing_serial'}"}), "(deps={'flight_plan': 'common.flight_plan', 'propellers':\n 'prop.propellers', 'wing_serial': 'common.wing_serial'})\n",...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 6 17:47:09 2019 @author: avelinojaver """ import numpy as np import tables _filters = tables.Filters( complevel=5, complib='blosc:lz4', shuffle=True, fletcher32=True) def save_data(save_name, src_files, images, ce...
[ "tables.Filters", "numpy.array" ]
[((160, 239), 'tables.Filters', 'tables.Filters', ([], {'complevel': '(5)', 'complib': '"""blosc:lz4"""', 'shuffle': '(True)', 'fletcher32': '(True)'}), "(complevel=5, complib='blosc:lz4', shuffle=True, fletcher32=True)\n", (174, 239), False, 'import tables\n'), ((444, 516), 'numpy.array', 'np.array', (['src_files', "[...
def demo(): ''' Get jpg image for UGC 01962, view it, and remove temporary jpg file. ''' jpg = SdssJpg(37.228, 0.37) jpg.show() def simg(ra=37.228,dec=0.37, scale=0.396, width=512, height=512, savename=None, DR=14, init_download=True,show=True): ''' Get jpg image for UGC 01962,...
[ "pandas.io.parsers.read_csv", "matplotlib.pylab.show", "os.makedirs", "matplotlib.pylab.subplot", "matplotlib.pylab.imshow", "os.path.exists", "matplotlib.pylab.clf", "numpy.genfromtxt", "matplotlib.pylab.axis", "PIL.Image.open", "urllib.request.urlretrieve", "matplotlib.pylab.ion", "matplot...
[((826, 883), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': '""""""', 'unpack': '(True)', 'dtype': '"""U"""'}), "(file, delimiter='', unpack=True, dtype='U')\n", (839, 883), True, 'import numpy as np\n'), ((3034, 3042), 'matplotlib.pylab.ion', 'pl.ion', ([], {}), '()\n', (3040, 3042), True, 'import matp...
# Assess the convergence of the harmonics as the integration domain increases import numpy as np from IPython import embed import pickle import matplotlib import matplotlib.pyplot as plt import itertools # Name of transducer transducer_name = 'H131' power = 100 material = 'liver' # How many harmonics have been comput...
[ "matplotlib.pyplot.xlim", "numpy.zeros_like", "numpy.flip", "numpy.abs", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "numpy.zeros", "matplotlib.pyplot.figure", "pickle.load", "numpy.linalg.norm", "matplotlib.pyplot.rc", "...
[((393, 438), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 24}"], {}), "({'font.size': 24})\n", (419, 438), False, 'import matplotlib\n'), ((439, 469), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (445, 469), True, 'import m...
"""Fitting routines.""" import dataclasses from typing import Callable, Generic, Optional, Tuple, TypeVar import numpy as np from .npt_compat import ArrayLike, NDArray1D, NDArray2D T = TypeVar("T") @dataclasses.dataclass(frozen=True, repr=True) class Model(Generic[T]): """Fitted model.""" f: Callable[......
[ "numpy.diag", "typing.TypeVar", "dataclasses.dataclass" ]
[((189, 201), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (196, 201), False, 'from typing import Callable, Generic, Optional, Tuple, TypeVar\n'), ((205, 250), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'frozen': '(True)', 'repr': '(True)'}), '(frozen=True, repr=True)\n', (226, 250), False, '...
import os import sys import logging import netCDF4 as nc import numpy as np import concurrent.futures import pandas as pd from skimage.draw import polygon from pathlib import Path from skimage.transform import resize from sen3r import commons dd = commons.DefaultDicts() utils = commons.Utils() class NcEngine: ""...
[ "sen3r.commons.DefaultDicts", "pathlib.Path", "numpy.linalg.norm", "skimage.transform.resize", "os.path.join", "numpy.ndarray", "netCDF4.Dataset", "pandas.DataFrame", "sen3r.commons.Utils", "numpy.append", "numpy.dstack", "skimage.draw.polygon", "os.path.basename", "os.listdir", "sys.exi...
[((249, 271), 'sen3r.commons.DefaultDicts', 'commons.DefaultDicts', ([], {}), '()\n', (269, 271), False, 'from sen3r import commons\n'), ((280, 295), 'sen3r.commons.Utils', 'commons.Utils', ([], {}), '()\n', (293, 295), False, 'from sen3r import commons\n'), ((630, 651), 'pathlib.Path', 'Path', (['input_nc_folder'], {}...
import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import numpy as np from actions.action import Action import actions.condition_ops as cond # WaitYears class WaitYears(Action): def __init__(self, features): super().__init__(name='WaitYears', description='Wait x amount of ...
[ "tensorflow.compat.v1.square", "numpy.abs", "actions.condition_ops.op_lt", "numpy.square", "actions.condition_ops.op_gt", "tensorflow.compat.v1.abs", "tensorflow.compat.v1.disable_v2_behavior" ]
[((34, 58), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (56, 58), True, 'import tensorflow.compat.v1 as tf\n'), ((6229, 6260), 'actions.condition_ops.op_gt', 'cond.op_gt', (['age', '(15)', 'use_tensor'], {}), '(age, 15, use_tensor)\n', (6239, 6260), True, 'import actions.cond...
import csv import glob import os from pathlib import Path from shutil import rmtree, copy import numpy as np import math import ipdb from embeddings import get_embeddings def distance_(embeddings0): # Distance based on cosine similarity cos_similarity = np.dot(embeddings, embeddings.T) cos_similarity = cos...
[ "os.mkdir", "csv.writer", "shutil.rmtree", "os.getcwd", "embeddings.get_embeddings", "numpy.dot", "os.path.join", "os.listdir", "shutil.copy" ]
[((478, 491), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (488, 491), False, 'import csv\n'), ((909, 925), 'os.mkdir', 'os.mkdir', (['"""temp"""'], {}), "('temp')\n", (917, 925), False, 'import os\n'), ((263, 295), 'numpy.dot', 'np.dot', (['embeddings', 'embeddings.T'], {}), '(embeddings, embeddings.T)\n', (269, ...
import re import cv2 as cv import numpy as np import requests URL_REGEX = re.compile(r"http://|https://|ftp://") def imread(uri, flags=1): # flags(0: grayscale, 1: color) if isinstance(uri, str): if URL_REGEX.match(uri): buffer = requests.get(uri).content nparr = np.frombuffe...
[ "cv2.cvtColor", "numpy.frombuffer", "cv2.imdecode", "cv2.imread", "requests.get", "re.compile" ]
[((76, 113), 're.compile', 're.compile', (['"""http://|https://|ftp://"""'], {}), "('http://|https://|ftp://')\n", (86, 113), False, 'import re\n'), ((400, 421), 'cv2.imread', 'cv.imread', (['uri', 'flags'], {}), '(uri, flags)\n', (409, 421), True, 'import cv2 as cv\n'), ((470, 498), 'numpy.frombuffer', 'np.frombuffer'...
import warnings from pathlib import Path from typing import Optional import click import joblib import librosa import numpy as np from click.types import Choice from click_option_group import RequiredAnyOptionGroup, optgroup from matplotlib import pyplot as plt from ertk.dataset import get_audio_paths, write_features...
[ "matplotlib.pyplot.title", "numpy.random.default_rng", "librosa.core.load", "matplotlib.pyplot.figure", "librosa.power_to_db", "numpy.mean", "ertk.dataset.get_audio_paths", "librosa.feature.melspectrogram", "ertk.utils.PathlibPath", "warnings.simplefilter", "matplotlib.pyplot.imshow", "click.c...
[((2110, 2125), 'click.command', 'click.command', ([], {}), '()\n', (2123, 2125), False, 'import click\n'), ((2127, 2161), 'click.argument', 'click.argument', (['"""corpus"""'], {'type': 'str'}), "('corpus', type=str)\n", (2141, 2161), False, 'import click\n'), ((2235, 2294), 'click_option_group.optgroup.group', 'optgr...
# Built-in libaries import argparse import os import logging # External libraries from datetime import datetime, timedelta import numpy as np import pandas as pd import pickle #import rasterio #import xarray as xr # Local libraries from oggm import cfg from oggm.utils import entity_task #from oggm.core.gis import raste...
[ "pickle.dump", "argparse.ArgumentParser", "pandas.read_csv", "os.path.exists", "pygem.pygem_modelsetup.selectglaciersrgitable", "numpy.percentile", "numpy.where", "pandas.to_datetime", "datetime.timedelta", "oggm.utils.entity_task", "numpy.round", "os.listdir", "logging.getLogger" ]
[((535, 562), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (552, 562), False, 'import logging\n'), ((1309, 1344), 'oggm.utils.entity_task', 'entity_task', (['log'], {'writes': "['mb_obs']"}), "(log, writes=['mb_obs'])\n", (1320, 1344), False, 'from oggm.utils import entity_task\n'), ((3...
import unittest import numpy as np from fastestimator.op.numpyop.univariate import Reshape from fastestimator.test.unittest_util import is_equal class TestReshape(unittest.TestCase): @classmethod def setUpClass(cls): cls.single_input = [np.array([1, 2, 3, 4])] cls.single_output = [np.array([...
[ "fastestimator.test.unittest_util.is_equal", "fastestimator.op.numpyop.univariate.Reshape", "numpy.array" ]
[((516, 562), 'fastestimator.op.numpyop.univariate.Reshape', 'Reshape', ([], {'inputs': '"""x"""', 'outputs': '"""x"""', 'shape': '(2, 2)'}), "(inputs='x', outputs='x', shape=(2, 2))\n", (523, 562), False, 'from fastestimator.op.numpyop.univariate import Reshape\n'), ((729, 775), 'fastestimator.op.numpyop.univariate.Re...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "deepC.dnnc.sign", "numpy.maximum", "numpy.abs", "numpy.arccosh", "numpy.sin", "deepC.dnnc.erf", "deepC.dnnc.cos", "unittest.main", "deepC.dnnc.tan", "numpy.logical_not", "deepC.dnnc.asinh", "numpy.arcsin", "deepC.dnnc.log", "numpy.tan", "numpy.arcsinh", "numpy.arccos", "deepC.dnnc.l...
[((9260, 9275), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9273, 9275), False, 'import unittest, random, math\n'), ((1283, 1310), 'random.randrange', 'random.randrange', (['(20)', '(50)', '(3)'], {}), '(20, 50, 3)\n', (1299, 1310), False, 'import unittest, random, math\n'), ((1341, 1370), 'random.randrange', ...
import argparse from collections import Counter import json import logging import os import operator import random import sys import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from tqdm import tqdm from sklearn.linear_model import LinearRegression sys.path.app...
[ "argparse.ArgumentParser", "random.shuffle", "torch.nn.LSTMCell", "torch.utils.data.TensorDataset", "torch.device", "torch.no_grad", "os.path.join", "torch.utils.data.DataLoader", "os.path.dirname", "torch.load", "random.seed", "collections.Counter", "torch.manual_seed", "os.path.realpath"...
[((382, 409), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (399, 409), False, 'import logging\n'), ((952, 974), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (963, 974), False, 'import random\n'), ((979, 1007), 'torch.manual_seed', 'torch.manual_seed', (['args.seed...
from sklearn.metrics import multilabel_confusion_matrix, accuracy_score from tensorflow.keras.callbacks import TensorBoard from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential from tensorflow.keras.utils import to_categorical from sklearn.model_selection import train_test_split...
[ "os.listdir", "tensorflow.keras.utils.to_categorical", "tensorflow.keras.layers.Dense", "sklearn.model_selection.train_test_split", "tensorflow.lite.TFLiteConverter.from_saved_model", "numpy.array", "tensorflow.keras.models.Sequential", "tensorflow.keras.layers.LSTM", "os.path.join", "tensorflow.k...
[((563, 586), 'os.path.join', 'os.path.join', (['"""MP_Data"""'], {}), "('MP_Data')\n", (575, 586), False, 'import os\n'), ((1234, 1253), 'numpy.array', 'np.array', (['sequences'], {}), '(sequences)\n', (1242, 1253), True, 'import numpy as np\n'), ((1328, 1365), 'sklearn.model_selection.train_test_split', 'train_test_s...
# -*- coding: utf-8 -*- from __future__ import division, unicode_literals import numpy as np import scipy.interpolate as interp __all__ = ['ideal_eos', 'FreeStreamer'] __version__ = '1.0.1' """ References: [1] <NAME>, <NAME>, <NAME> Pre-equilibrium evolution effects on heavy-ion collision observables PRC...
[ "numpy.empty", "numpy.einsum", "numpy.sin", "numpy.inner", "numpy.diag", "numpy.copy", "numpy.linalg.eig", "numpy.linspace", "numpy.ones_like", "numpy.ceil", "numpy.asarray", "scipy.interpolate.RectBivariateSpline", "numpy.cos", "numpy.iscomplexobj", "numpy.zeros", "numpy.subtract.oute...
[((1379, 1398), 'numpy.asarray', 'np.asarray', (['initial'], {}), '(initial)\n', (1389, 1398), True, 'import numpy as np\n'), ((2041, 2075), 'numpy.linspace', 'np.linspace', (['(-xymax)', 'xymax', 'nsteps'], {}), '(-xymax, xymax, nsteps)\n', (2052, 2075), True, 'import numpy as np\n'), ((3104, 3154), 'numpy.linspace', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 4 13:56:33 2018 @author: haoxiangyang """ from os import path import matplotlib import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from matplotlib.pyplot import plot matplotlib.use('agg') #To plot on linux import ...
[ "scipy.stats.norm.ppf", "pickle.dump", "numpy.std", "scipy.stats.norm.cdf", "numpy.mean", "matplotlib.use", "numpy.exp", "numpy.sqrt" ]
[((273, 294), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (287, 294), False, 'import matplotlib\n'), ((622, 641), 'numpy.mean', 'np.mean', (['demandScen'], {}), '(demandScen)\n', (629, 641), True, 'import numpy as np\n'), ((654, 672), 'numpy.std', 'np.std', (['demandScen'], {}), '(demandScen)\...
import numpy as np import uuid import os import tables as t import nose from nose.tools import assert_true, assert_equal, assert_raises from numpy.testing import assert_array_equal from cyclopts import cyclopts_io as cycio class TestIO: def setUp(self): self.db = ".tmp_{0}".format(uuid.uuid4()) i...
[ "os.remove", "uuid.uuid4", "cyclopts.cyclopts_io.Table", "nose.tools.assert_true", "numpy.empty", "numpy.dtype", "os.path.exists", "numpy.testing.assert_array_equal", "nose.tools.assert_equal", "cyclopts.cyclopts_io.IOManager", "tables.open_file" ]
[((322, 345), 'os.path.exists', 'os.path.exists', (['self.db'], {}), '(self.db)\n', (336, 345), False, 'import os\n'), ((400, 430), 'tables.open_file', 't.open_file', (['self.db'], {'mode': '"""w"""'}), "(self.db, mode='w')\n", (411, 430), True, 'import tables as t\n'), ((476, 503), 'numpy.dtype', 'np.dtype', (["[('dat...
if __name__ == '__main__' and __package__ is None: from os import sys, path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import os import sys import time import random import numpy as np from PIL import Image import torch.nn as nn import math import torch NYU14_name_list = ['Unknown', '...
[ "os.path.abspath", "torch.nn.ReLU", "os.makedirs", "random.randint", "os.sys.stdout.isatty", "os.path.exists", "numpy.zeros", "math.floor", "time.time", "PIL.Image.fromarray", "os.sys.stdout.write", "torch.FloatTensor", "os.sys.stdout.flush", "torch.utils.tensorboard.SummaryWriter", "tor...
[((2973, 2998), 'numpy.zeros', 'np.zeros', (['(height, width)'], {}), '((height, width))\n', (2981, 2998), True, 'import numpy as np\n'), ((12622, 12647), 'torch.rand', 'torch.rand', (['(1)', '(30)', '(30)', '(30)'], {}), '(1, 30, 30, 30)\n', (12632, 12647), False, 'import torch\n'), ((12755, 12779), 'torch.utils.tenso...
"""train.py Developer: <NAME> Date: 2-19-2022 Description: Tensorflow API """ ################################## Imports ################################### import os import tensorflow as tf import numpy as np from sklearn.metrics import confusion_matrix from sklearn.metrics import accuracy_score, precision_s...
[ "tensorflow.random.set_seed", "numpy.ravel", "tensorflow.keras.layers.Dense", "sklearn.metrics.accuracy_score", "sklearn.metrics.recall_score", "tensorflow.keras.optimizers.Adam", "sklearn.metrics.precision_score", "sklearn.metrics.confusion_matrix" ]
[((544, 566), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(42)'], {}), '(42)\n', (562, 566), True, 'import tensorflow as tf\n'), ((685, 729), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', (['(13)'], {'activation': '"""relu"""'}), "(13, activation='relu')\n", (706, 729), True, 'import tensorflow a...
import math import random import os import json from time import time from PIL import Image import blobfile as bf from mpi4py import MPI import numpy as np from scipy.ndimage import gaussian_filter from torch.utils.data import DataLoader, Dataset from transformers import GPT2TokenizerFast import torch.nn.functional as ...
[ "transformers.GPT2TokenizerFast.from_pretrained", "random.shuffle", "blobfile.BlobFile", "blobfile.join", "torch.cat", "torch.utils.data.DataLoader", "scipy.ndimage.gaussian_filter", "numpy.transpose", "os.path.exists", "mpi4py.MPI.COMM_WORLD.Get_size", "blobfile.isdir", "math.ceil", "mpi4py...
[((2383, 2389), 'time.time', 'time', ([], {}), '()\n', (2387, 2389), False, 'from time import time\n'), ((6530, 6549), 'numpy.array', 'np.array', (['pil_image'], {}), '(pil_image)\n', (6538, 6549), True, 'import numpy as np\n'), ((6828, 6865), 'math.ceil', 'math.ceil', (['(image_size / max_crop_frac)'], {}), '(image_si...
import numpy as np from stores import locations import matplotlib.pyplot as plt from itertools import combinations from sklearn.cluster import KMeans from credentials import API_KEY import urllib.request import json import pandas as pd import sys from htmlparser import duration COLOR = ('red', 'blue') locations = np.a...
[ "pandas.DataFrame", "sklearn.cluster.KMeans", "numpy.array", "htmlparser.duration" ]
[((316, 335), 'numpy.array', 'np.array', (['locations'], {}), '(locations)\n', (324, 335), True, 'import numpy as np\n'), ((1488, 1509), 'pandas.DataFrame', 'pd.DataFrame', (['results'], {}), '(results)\n', (1500, 1509), True, 'import pandas as pd\n'), ((634, 684), 'numpy.array', 'np.array', (['[locations[seed[0]], loc...
import os import os.path import hashlib import errno import torch from torchvision import transforms import numpy as np import random import PIL from PIL import Image, ImageEnhance, ImageOps from torchvision import transforms as T import cv2 dataset_stats = { 'CIFAR10' : {'mean': (0.49139967861519607, 0.4821584083...
[ "PIL.ImageEnhance.Brightness", "numpy.clip", "os.path.isfile", "numpy.random.randint", "numpy.sin", "torchvision.transforms.Normalize", "os.path.join", "random.randint", "PIL.ImageOps.invert", "PIL.ImageEnhance.Sharpness", "torchvision.transforms.Compose", "six.moves.urllib.request.urlretrieve...
[((2362, 2396), 'torchvision.transforms.Compose', 'transforms.Compose', (['transform_list'], {}), '(transform_list)\n', (2380, 2396), False, 'from torchvision import transforms\n'), ((2497, 2510), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (2508, 2510), False, 'import hashlib\n'), ((2841, 2865), 'os.path.expanduse...
# Credit for setup : https://www.analyticsvidhya.com/blog/2018/11/introduction-text-summarization-textrank-python/ import math import os import nltk from nltk.tokenize import sent_tokenize from nltk.corpus import stopwords from nltk.tokenize import word_tokenize import numpy as np import pandas as pd from sklearn.met...
[ "numpy.asarray", "numpy.zeros", "networkx.from_numpy_array", "nltk.tokenize.sent_tokenize", "pandas.Series", "nltk.corpus.stopwords.words", "os.listdir" ]
[((793, 816), 'os.listdir', 'os.listdir', (['upload_path'], {}), '(upload_path)\n', (803, 816), False, 'import os\n'), ((834, 860), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (849, 860), False, 'from nltk.corpus import stopwords\n'), ((1146, 1165), 'nltk.tokenize.sent_to...
import h5py import os import pickle import numpy as np import matplotlib.pyplot as plt from utils import * model = dict() channels,channel_dat,channel_norms = draw_sample(data_path="data",total_samples=10000) channel_to_idx = {ch: i for i,ch in enumerate(channels)} model['data'] = dict() model['channels'] = channels...
[ "numpy.save", "matplotlib.pyplot.imshow", "numpy.asarray", "numpy.square", "matplotlib.pyplot.figure", "numpy.asmatrix", "matplotlib.pyplot.savefig" ]
[((1320, 1341), 'numpy.asmatrix', 'np.asmatrix', (['params_M'], {}), '(params_M)\n', (1331, 1341), True, 'import numpy as np\n'), ((1342, 1371), 'numpy.save', 'np.save', (['"""params_M"""', 'params_M'], {}), "('params_M', params_M)\n", (1349, 1371), True, 'import numpy as np\n'), ((1382, 1401), 'numpy.square', 'np.squa...