code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from pathlib import PurePath
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
filedir = PurePath(__file__).parent
styledir = filedir.parents[1] / "./style"
plt.style.use(str(styledir / "./base.mplstyle"))
mpl.use("pgf")
mpl.rc("pgf", preamble="\\usepackage{" + (styledir / "./matplotlib").as... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.sin",
"pathlib.PurePath",
"numpy.linspace"
] | [((234, 248), 'matplotlib.use', 'mpl.use', (['"""pgf"""'], {}), "('pgf')\n", (241, 248), True, 'import matplotlib as mpl\n'), ((375, 387), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (385, 387), True, 'import matplotlib.pyplot as plt\n'), ((442, 469), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'x'], {... |
from math import ceil
import numpy as np
import torchvision.transforms.functional as F
class TianchiOCRDynamicResize(object):
def __init__(self, divisible_by=16):
self.divider = divisible_by
def __call__(self, img, label):
size = img.size
short_side = min(size)
try_times = in... | [
"math.ceil",
"torchvision.transforms.functional.resize",
"numpy.maximum",
"numpy.hstack"
] | [((1296, 1331), 'numpy.hstack', 'np.hstack', (['(xmin, ymin, xmax, ymax)'], {}), '((xmin, ymin, xmax, ymax))\n', (1305, 1331), True, 'import numpy as np\n'), ((322, 353), 'math.ceil', 'ceil', (['(short_side / self.divider)'], {}), '(short_side / self.divider)\n', (326, 353), False, 'from math import ceil\n'), ((799, 83... |
import argparse, os
import torch
from torch.autograd import Variable
from scipy.ndimage import imread
from PIL import Image
import numpy as np
import time, math
#import matplotlib.pyplot as plt
import os
import easyargs
import progressbar
import imageio
import glob
import cv2
parser = argparse.Argumen... | [
"argparse.ArgumentParser",
"os.walk",
"numpy.mean",
"os.path.join",
"cv2.cvtColor",
"cv2.imwrite",
"torch.load",
"os.path.dirname",
"os.path.exists",
"math.log10",
"imageio.get_reader",
"os.path.basename",
"torch.cuda.is_available",
"progressbar.ProgressBar",
"torch.from_numpy",
"os.ma... | [((304, 360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch VDSR Demo"""'}), "(description='PyTorch VDSR Demo')\n", (327, 360), False, 'import argparse, os\n'), ((1391, 1438), 'numpy.zeros', 'np.zeros', (['(y.shape[0], y.shape[1], 3)', 'np.uint8'], {}), '((y.shape[0], y.shape[1]... |
import matplotlib.pyplot as plt
from singlecellmultiomics.bamProcessing import random_sample_bam
import singlecellmultiomics.pyutils as pyutils
import collections
import pandas as pd
import matplotlib
import numpy as np
import seaborn as sns
matplotlib.rcParams['figure.dpi'] = 160
matplotlib.use('Agg')
def plot_lorent... | [
"matplotlib.pyplot.title",
"singlecellmultiomics.bamProcessing.random_sample_bam",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"seaborn.despine",
"matplotlib.use",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((282, 303), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (296, 303), False, 'import matplotlib\n'), ((360, 388), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(6, 6)'}), '(figsize=(6, 6))\n', (372, 388), True, 'import matplotlib.pyplot as plt\n'), ((958, 970), 'matplotlib.py... |
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import numpy as np
import pickle
import cv2
from os import path
class Classifier:
def __init__(self, defaultModel, label_file):
self.defaultModel = defaultModel
self.modelPath = defaultModel
self.model = ... | [
"keras.models.load_model",
"numpy.argmax",
"numpy.expand_dims",
"keras.preprocessing.image.img_to_array",
"cv2.resize"
] | [((320, 346), 'keras.models.load_model', 'load_model', (['self.modelPath'], {}), '(self.modelPath)\n', (330, 346), False, 'from keras.models import load_model\n'), ((519, 545), 'keras.models.load_model', 'load_model', (['self.modelPath'], {}), '(self.modelPath)\n', (529, 545), False, 'from keras.models import load_mode... |
"""
ABFs can be created when signals are applied using the DAC. If these "stimulus
waveforms" are used, they either come from an epoch table or from a DAC file.
Code in this file determines where the stimulus comes from and returns it for
a given sweep and channel.
If the stimulus waveform comes from a file, code her... | [
"numpy.full",
"os.path.abspath",
"pyabf.waveform.EpochTable",
"os.path.basename",
"os.path.dirname",
"os.path.realpath",
"os.path.exists",
"pyabf.ABF",
"pyabf.ATF",
"os.path.join"
] | [((3503, 3530), 'os.path.basename', 'os.path.basename', (['stimFname'], {}), '(stimFname)\n', (3519, 3530), False, 'import os\n'), ((3547, 3579), 'os.path.dirname', 'os.path.dirname', (['abf.abfFilePath'], {}), '(abf.abfFilePath)\n', (3562, 3579), False, 'import os\n'), ((3601, 3632), 'os.path.join', 'os.path.join', ([... |
import numpy as np
def mincorr_cost_func(tmp, cost_func):
if cost_func in ['sum', 'avg']:
# corr sum of each "available" k to the "selected" i
sk = np.sum(tmp, axis=0)
elif cost_func in ['sqrt', 'squared']:
sk = np.sum(np.power(tmp, 2), axis=0)
elif cost_func in ['mu_max']:
... | [
"numpy.abs",
"numpy.sum",
"numpy.tril",
"numpy.power",
"numpy.argmin",
"numpy.min",
"numpy.mean",
"numpy.max"
] | [((634, 657), 'numpy.abs', 'np.abs', (['cmat'], {'order': '"""C"""'}), "(cmat, order='C')\n", (640, 657), True, 'import numpy as np\n'), ((1050, 1063), 'numpy.argmin', 'np.argmin', (['si'], {}), '(si)\n', (1059, 1063), True, 'import numpy as np\n'), ((1185, 1208), 'numpy.argmin', 'np.argmin', (['absrho[i, :]'], {}), '(... |
from copy import deepcopy
from unittest import TestCase
import numpy as np
import visualiser
from env import Env
from samplers.informedSampler import InformedSampler
from tests.common_vars import template_args
from utils import planner_registry
class TestInformedSampler(TestCase):
def setUp(self) -> None:
... | [
"copy.deepcopy",
"numpy.random.seed",
"samplers.informedSampler.InformedSampler",
"env.Env",
"visualiser.VisualiserSwitcher.choose_visualiser",
"numpy.array",
"numpy.linalg.norm"
] | [((330, 353), 'copy.deepcopy', 'deepcopy', (['template_args'], {}), '(template_args)\n', (338, 353), False, 'from copy import deepcopy\n'), ((362, 417), 'visualiser.VisualiserSwitcher.choose_visualiser', 'visualiser.VisualiserSwitcher.choose_visualiser', (['"""base"""'], {}), "('base')\n", (409, 417), False, 'import vi... |
############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # # # # #
#
# Python-based Tool for interaction with the 10micron mounts
# GUI with PyQT5 fo... | [
"skyfield.functions.to_spherical",
"numpy.degrees",
"gui.extWindows.simulator.tools.linkModel",
"gui.extWindows.simulator.materials.Materials",
"PyQt5.Qt3DExtras.QCylinderMesh",
"PyQt5.QtGui.QVector3D",
"PyQt5.Qt3DCore.QEntity"
] | [((1375, 1391), 'PyQt5.Qt3DCore.QEntity', 'QEntity', (['rEntity'], {}), '(rEntity)\n', (1382, 1391), False, 'from PyQt5.Qt3DCore import QEntity\n'), ((2893, 2920), 'skyfield.functions.to_spherical', 'functions.to_spherical', (['(-PD)'], {}), '(-PD)\n', (2915, 2920), False, 'from skyfield import functions\n'), ((2934, 2... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.contrib.layers.l2_regularizer",
"numpy.argsort",
"tensorflow.global_variables",
"numpy.mean",
"tensorflow.image.per_image_standardization",
"input_data.read_clip_and_label",
"tensorflow.get_variable",
"tensorflow.concat",
"tensorflow.plac... | [((1993, 2099), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(batch_size, num_frame_per_clib, crop_size, crop_size, rgb_channels)'}), '(tf.float32, shape=(batch_size, num_frame_per_clib, crop_size,\n crop_size, rgb_channels))\n', (2007, 2099), True, 'import tensorflow as tf\n'), ((2367, 24... |
import kornia_rs as K
from kornia_rs import Tensor as cvTensor
import torch
import numpy as np
def test_smoke():
# dumy test
H, W, C = 2, 2, 3
data = [i for i in range(H * W * C)]
cv_tensor = cvTensor([H, W, C], data)
assert cv_tensor.shape == [H, W, C]
assert len(data) == len(cv_tensor.data)
... | [
"kornia_rs.cvtensor_to_dlpack",
"kornia_rs.Tensor",
"numpy._from_dlpack",
"torch.utils.dlpack.from_dlpack"
] | [((210, 235), 'kornia_rs.Tensor', 'cvTensor', (['[H, W, C]', 'data'], {}), '([H, W, C], data)\n', (218, 235), True, 'from kornia_rs import Tensor as cvTensor\n'), ((466, 491), 'kornia_rs.Tensor', 'cvTensor', (['[H, W, C]', 'data'], {}), '([H, W, C], data)\n', (474, 491), True, 'from kornia_rs import Tensor as cvTensor\... |
import numpy as np
from lizardanalysis.utils import auxiliaryfunctions
# TODO: calculate frame wise for step-phases not average over all! Or do both in 2 different functions
def climbing_speed(**kwargs):
"""
Uses the Nose tracking point to determine the climbing speed.
Takes the absolute value of t... | [
"os.getcwd",
"pathlib.Path",
"lizardanalysis.utils.auxiliaryfunctions.read_config",
"numpy.zeros"
] | [((863, 874), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (872, 874), False, 'import os\n'), ((926, 969), 'lizardanalysis.utils.auxiliaryfunctions.read_config', 'auxiliaryfunctions.read_config', (['config_file'], {}), '(config_file)\n', (956, 969), False, 'from lizardanalysis.utils import auxiliaryfunctions\n'), ((2084... |
"""Autocorrelation plot of data."""
import numpy as np
from ..data import convert_to_dataset
from ..stats import autocorr
from .plot_utils import (
_scale_fig_size,
default_grid,
make_label,
xarray_var_iter,
_create_axes_grid,
filter_plotters_list,
)
from ..utils import _var_names
def plot_au... | [
"numpy.arange",
"numpy.atleast_2d"
] | [((3075, 3094), 'numpy.atleast_2d', 'np.atleast_2d', (['axes'], {}), '(axes)\n', (3088, 3094), True, 'import numpy as np\n'), ((3322, 3343), 'numpy.arange', 'np.arange', (['(0)', 'max_lag'], {}), '(0, max_lag)\n', (3331, 3343), True, 'import numpy as np\n')] |
from typing import Tuple
import numpy as np
from ..utils.events.dataclass import Property, evented_dataclass
@evented_dataclass
class GridCanvas:
"""Grid for canvas.
Right now the only grid mode that is still inside one canvas with one
camera, but future grid modes could support multiple canvases.
... | [
"numpy.ceil",
"numpy.sqrt"
] | [((2052, 2086), 'numpy.ceil', 'np.ceil', (['(n_grid_squares / n_column)'], {}), '(n_grid_squares / n_column)\n', (2059, 2086), True, 'import numpy as np\n'), ((1991, 2014), 'numpy.sqrt', 'np.sqrt', (['n_grid_squares'], {}), '(n_grid_squares)\n', (1998, 2014), True, 'import numpy as np\n'), ((2153, 2187), 'numpy.ceil', ... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 27 11:13:15 2019
@author: jkern
"""
from __future__ import division
import pandas as pd
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
def hydro(sim_years):
#################################################################... | [
"pandas.DataFrame",
"numpy.dstack",
"numpy.sum",
"pandas.read_csv",
"numpy.zeros",
"pandas.read_excel",
"numpy.append",
"numpy.min",
"numpy.max",
"numpy.vstack"
] | [((805, 875), 'pandas.read_excel', 'pd.read_excel', (['"""CA_hydropower/sites.xlsx"""'], {'sheet_name': '"""ORCA"""', 'header': '(0)'}), "('CA_hydropower/sites.xlsx', sheet_name='ORCA', header=0)\n", (818, 875), True, 'import pandas as pd\n'), ((1014, 1065), 'pandas.read_excel', 'pd.read_excel', (['"""CA_hydropower/upp... |
import numpy as np
import matplotlib.pyplot as plt
import mdtraj as md
from scattering.van_hove import compute_van_hove
from scattering.utils.io import get_fn
def test_van_hove():
trj = md.load(
get_fn('spce.xtc'),
top=get_fn('spce.gro')
)[:100]
chunk_length = 2
r, t, g_r_t = compute... | [
"numpy.shape",
"scattering.utils.io.get_fn",
"numpy.mean",
"matplotlib.pyplot.subplots",
"scattering.van_hove.compute_van_hove"
] | [((313, 361), 'scattering.van_hove.compute_van_hove', 'compute_van_hove', (['trj'], {'chunk_length': 'chunk_length'}), '(trj, chunk_length=chunk_length)\n', (329, 361), False, 'from scattering.van_hove import compute_van_hove\n'), ((547, 561), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (559, 561), ... |
import numpy as np
import torch
import warnings
from .communication import MPI
from . import constants
from . import dndarray
from . import factories
from . import stride_tricks
from . import tiling
from . import types
from . import operations
__all__ = [
"concatenate",
"diag",
"diagonal",
"expand_d... | [
"torch.diagonal",
"torch.empty",
"torch.cat",
"torch.empty_like",
"torch.arange",
"torch.flatten",
"torch.gather",
"numpy.cumsum",
"torch.Tensor",
"torch.zeros",
"torch.topk",
"torch.unique",
"torch.zeros_like",
"torch.where",
"numpy.frombuffer",
"torch.argsort",
"torch.nn.ConstantPa... | [((24842, 24878), 'torch.flip', 'torch.flip', (['a._DNDarray__array', 'axis'], {}), '(a._DNDarray__array, axis)\n', (24852, 24878), False, 'import torch\n'), ((25350, 25440), 'torch.empty', 'torch.empty', (['new_lshape'], {'dtype': 'a._DNDarray__array.dtype', 'device': 'a.device.torch_device'}), '(new_lshape, dtype=a._... |
import sys
sys.path.append('../..')
import os
import json
import logging
import argparse
import numpy as np
from datetime import datetime
from seqeval import metrics
from seqeval.scheme import IOB2
from data_constr.Src.IO import set_logging
logger = logging.getLogger(__name__)
_time = datetime.now().strftime("%m.%d.... | [
"sys.path.append",
"json.dump",
"json.load",
"argparse.ArgumentParser",
"os.path.join",
"os.path.basename",
"numpy.asarray",
"data_constr.Src.IO.set_logging",
"seqeval.metrics.f1_score",
"datetime.datetime.now",
"logging.getLogger"
] | [((11, 35), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (26, 35), False, 'import sys\n'), ((253, 280), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (270, 280), False, 'import logging\n'), ((352, 378), 'os.path.basename', 'os.path.basename', (['__file__'],... |
"""Matplotlib dotplot."""
import math
import warnings
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import _pylab_helpers
from ...plot_utils import _scale_fig_size
from . import backend_kwarg_defaults, create_axes_grid, backend_show
from ...plot_utils import plot_point_interval
from ...dotplot imp... | [
"numpy.quantile",
"matplotlib.pyplot.show",
"math.sqrt",
"matplotlib.pyplot.Circle",
"numpy.linspace",
"warnings.warn",
"matplotlib._pylab_helpers.Gcf.get_active"
] | [((1301, 1332), 'matplotlib._pylab_helpers.Gcf.get_active', '_pylab_helpers.Gcf.get_active', ([], {}), '()\n', (1330, 1332), False, 'from matplotlib import _pylab_helpers\n'), ((1939, 2044), 'warnings.warn', 'warnings.warn', (['"""nquantiles must be less than or equal to the number of data points"""', 'UserWarning'], {... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... | [
"mvpa2.clfs.sg.svm.SVM",
"numpy.random.randn",
"numpy.asanyarray",
"mvpa2.kernels.sg.LinearSGKernel",
"mvpa2.measures.base.ProxyMeasure",
"numpy.zeros",
"time.time",
"mvpa2.base.dataset.vstack",
"mvpa2.clfs.libsvmc.svm.SVM",
"mvpa2.generators.partition.NFoldPartitioner",
"mvpa2.mappers.fx.Binary... | [((1902, 1908), 'time.time', 'time', ([], {}), '()\n', (1906, 1908), False, 'from time import time\n'), ((1994, 2000), 'time.time', 'time', ([], {}), '()\n', (1998, 2000), False, 'from time import time\n'), ((2078, 2084), 'time.time', 'time', ([], {}), '()\n', (2082, 2084), False, 'from time import time\n'), ((2895, 29... |
#!python
# External dependencies
import numpy as np
import pandas as pd
"""
Usage :
data = {
"data": {
"candles": [
["05-09-2013", 5553.75, 5625.75, 5552.700195, 5592.950195, 274900],
["06-09-2013", 5617.450195, 5688.600098, 5566.149902, 5680.399902... | [
"numpy.logical_not",
"numpy.where"
] | [((10551, 10595), 'numpy.where', 'np.where', (['(df[ohlc[3]] < df[st])', '"""down"""', '"""up"""'], {}), "(df[ohlc[3]] < df[st], 'down', 'up')\n", (10559, 10595), True, 'import numpy as np\n'), ((12155, 12182), 'numpy.logical_not', 'np.logical_not', (['(df[fE] == 0)'], {}), '(df[fE] == 0)\n', (12169, 12182), True, 'imp... |
import os
import numpy as np
import pandas as pd
import torch
import torch.utils.data as data
import yaml
from PIL import Image
from sklearn.preprocessing import MinMaxScaler
from .transformer import ScaleTransformer
class LaparoDataset(data.Dataset):
def __init__(self, ds_num, phase, transform):
# ... | [
"numpy.stack",
"numpy.radians",
"yaml.load",
"os.getcwd",
"sklearn.preprocessing.MinMaxScaler",
"numpy.array",
"torch.tensor"
] | [((1267, 1318), 'numpy.stack', 'np.stack', (['[X, Y, Z, N, N, NZ, GAMMA, GAMMA, PHI]', '(0)'], {}), '([X, Y, Z, N, N, NZ, GAMMA, GAMMA, PHI], 0)\n', (1275, 1318), True, 'import numpy as np\n'), ((1342, 1356), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\n', (1354, 1356), False, 'from sklearn.prep... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import weight_norm
from .backbones import *
class Chomp1d(nn.Module):
def __init__(self, chomp_size):
super(Chomp1d, self).__init__()
self.chomp_size = chomp_size
def forward(self, x):
return x[:,... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.stack",
"factory.models.tcn.ImageTCN",
"torch.nn.Sequential",
"torch.nn.Conv1d",
"numpy.zeros",
"numpy.ones",
"torch.sigmoid",
"torch.nn.Linear"
] | [((4956, 5016), 'factory.models.tcn.ImageTCN', 'ImageTCN', (['"""se_resnext50"""', '(1)', '(0.5)', 'None', '(50)', '[50, 50, 50, 50]'], {}), "('se_resnext50', 1, 0.5, None, 50, [50, 50, 50, 50])\n", (4964, 5016), False, 'from factory.models.tcn import ImageTCN\n'), ((766, 775), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()... |
import numpy as np
import dgramCreate as dc
import numpy as np
import dgramCreate as dc
import os, pickle, json, base64
from psana.dgrammanager import DgramManager
from psana import DataSource
def load_json(filename):
with open(filename, 'r') as f:
data = json.load(f)
event_dict = []
for event i... | [
"os.remove",
"json.load",
"numpy.dtype",
"dgramCreate.alg",
"dgramCreate.nameinfo",
"base64.b64decode",
"dgramCreate.CyDgram"
] | [((822, 846), 'dgramCreate.alg', 'dc.alg', (['"""cfg"""', '[1, 2, 3]'], {}), "('cfg', [1, 2, 3])\n", (828, 846), True, 'import dgramCreate as dc\n'), ((863, 931), 'dgramCreate.nameinfo', 'dc.nameinfo', (["('my' + det_type)", 'det_type', '"""serialnum1234"""', 'cfg_namesId'], {}), "('my' + det_type, det_type, 'serialnum... |
import numpy as np
import math
import matplotlib.pyplot as plt
from sklearn import datasets
from scipy.io import loadmat
import pandas as pd
'''
The Principal Component Analysis gives us the directions which holds the most
of the variation in the dataset
Works by finding the eigenvectors of the covariance matrix
Uns... | [
"matplotlib.pyplot.title",
"sklearn.datasets.load_iris",
"matplotlib.pyplot.show",
"numpy.sum",
"scipy.io.loadmat",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.power",
"numpy.searchsorted",
"matplotlib.pyplot.figure",
"numpy.where",
"numpy.cov",
"matplotlib.pyplot.ylabel"... | [((372, 408), 'scipy.io.loadmat', 'loadmat', (['"""Datasets\\\\mnist_train.mat"""'], {}), "('Datasets\\\\mnist_train.mat')\n", (379, 408), False, 'from scipy.io import loadmat\n'), ((1973, 1997), 'sklearn.datasets.load_iris', 'datasets.load_iris', (['(True)'], {}), '(True)\n', (1991, 1997), False, 'from sklearn import ... |
import unittest
import hylite
from hylite import HyFeature
from hylite.reference.features import Minerals
import numpy as np
class MyTestCase(unittest.TestCase):
def test_construct(self):
assert Minerals.Mica_K is not None
assert Minerals.Chlorite_Fe is not None
def test_multigauss(self):
... | [
"unittest.main",
"hylite.HyFeature.gaussian",
"hylite.HyFeature.multi_gauss",
"numpy.max",
"numpy.min",
"numpy.linspace"
] | [((934, 949), 'unittest.main', 'unittest.main', ([], {}), '()\n', (947, 949), False, 'import unittest\n'), ((328, 360), 'numpy.linspace', 'np.linspace', (['(2100.0)', '(2400.0)', '(500)'], {}), '(2100.0, 2400.0, 500)\n', (339, 360), True, 'import numpy as np\n'), ((372, 413), 'hylite.HyFeature.gaussian', 'HyFeature.gau... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import matplotlib.pyplot as plt
import numpy as np
import os
from os.path import split, dirname, abspath
from scipy.optimize import minimize
import sys
sys.path.append(split(split(dirname(abspath(__file__)))[0])[0])
import ... | [
"os.path.abspath",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.imag",
"numpy.array",
"numpy.linspace",
"numpy.real",
"numpy.random.rand",
"matplotlib.pyplot.grid"
] | [((978, 1008), 'numpy.linspace', 'np.linspace', (['(0)', 'tau_max', 'tau_n'], {}), '(0, tau_max, tau_n)\n', (989, 1008), True, 'import numpy as np\n'), ((3069, 3099), 'numpy.linspace', 'np.linspace', (['(0)', 'tau_max', 'tau_n'], {}), '(0, tau_max, tau_n)\n', (3080, 3099), True, 'import numpy as np\n'), ((3491, 3503), ... |
#!/usr/bin/python3
import math
import numpy as np
def direction(d):
three_points = []
direct = []
for i in range(0, len(d), 3):
j = i
while j < (i + 3) and j < len(d):
three_points.append(d[j])
j = j + 1
if len(three_points) == 3:
direct.append(c... | [
"numpy.std",
"math.sqrt"
] | [((399, 413), 'numpy.std', 'np.std', (['direct'], {}), '(direct)\n', (405, 413), True, 'import numpy as np\n'), ((545, 573), 'math.sqrt', 'math.sqrt', (['(x1 * x1 + y1 * y1)'], {}), '(x1 * x1 + y1 * y1)\n', (554, 573), False, 'import math\n')] |
"""Exercise object that can effectively be utilized in workout class"""
import random
from statistics import mean
from copy import deepcopy
from typing import List, Tuple
import numpy as np
from rengine.config import EXERCISE_CATEGORY_DATA, EquipmentAvailable, MuscleGroup
from rengine.config import ExerciseLoad, Exerc... | [
"rengine.config.EXERCISE_DF.copy",
"copy.deepcopy",
"statistics.mean",
"numpy.random.choice"
] | [((893, 911), 'rengine.config.EXERCISE_DF.copy', 'EXERCISE_DF.copy', ([], {}), '()\n', (909, 911), False, 'from rengine.config import ExerciseLoad, ExerciseType, EXERCISE_DF\n'), ((1587, 1600), 'copy.deepcopy', 'deepcopy', (['obj'], {}), '(obj)\n', (1595, 1600), False, 'from copy import deepcopy\n'), ((4157, 4216), 'nu... |
#!/usr/bin/env python
# coding: utf-8
# In[53]:
import tensorflow as tf
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, LSTM, Embedding, Flatten, Reshape
high = 100000000
digits = 12 #len(str(high))
pad = 12
from num2words import num2words
import... | [
"tensorflow.keras.preprocessing.text.Tokenizer",
"tensorflow.keras.models.load_model",
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.Dense",
"numpy.array",
"tensorflow.keras.models.Sequential",
"random.randrange",
"num2words.num2words",
"tensorflow.keras.layers.Embedding",
"numpy.con... | [((1738, 1796), 'tensorflow.keras.preprocessing.text.Tokenizer', 'tf.keras.preprocessing.text.Tokenizer', ([], {'num_words': 'num_words'}), '(num_words=num_words)\n', (1775, 1796), True, 'import tensorflow as tf\n'), ((2199, 2227), 'tensorflow.keras.models.Sequential', 'tf.keras.models.Sequential', ([], {}), '()\n', (2... |
from sciapp.action import Filter, Simple
from pystackreg import StackReg
import numpy as np
import pandas as pd
from skimage import transform as tf
import scipy.ndimage as ndimg
class Register(Simple):
title = "Stack Register"
note = ["8-bit", "16-bit", "int", "float", "stack"]
para = {
"trans": ... | [
"numpy.zeros_like",
"scipy.ndimage.gaussian_filter",
"skimage.transform.ProjectiveTransform",
"skimage.transform.resize",
"numpy.array",
"skimage.transform.warp"
] | [((3087, 3127), 'numpy.zeros_like', 'np.zeros_like', (['ips.img'], {'dtype': 'np.float64'}), '(ips.img, dtype=np.float64)\n', (3100, 3127), True, 'import numpy as np\n'), ((1544, 1558), 'numpy.array', 'np.array', (['news'], {}), '(news)\n', (1552, 1558), True, 'import numpy as np\n'), ((2166, 2209), 'skimage.transform.... |
"""Defines `DesignMatrix` and `DesignMatrixCollection`.
These classes are intended to make linear regression problems with a large
design matrix more easy.
"""
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from .. import MPLSTYLE
from ..utils import LightkurveWarning, plot_im... | [
"pandas.DataFrame",
"numpy.copy",
"numpy.nanmedian",
"numpy.nanstd",
"matplotlib.pyplot.style.context",
"fbpca.pca",
"numpy.hstack",
"numpy.isfinite",
"numpy.append",
"numpy.ones",
"numpy.linalg.matrix_rank",
"numpy.arange",
"numpy.exp",
"numpy.random.normal",
"numpy.linspace",
"numpy.... | [((4218, 4267), 'numpy.random.normal', 'np.random.normal', (['self.prior_mu', 'self.prior_sigma'], {}), '(self.prior_mu, self.prior_sigma)\n', (4234, 4267), True, 'import numpy as np\n'), ((5324, 5349), 'numpy.append', 'np.append', (['(0)', 'row_indices'], {}), '(0, row_indices)\n', (5333, 5349), True, 'import numpy as... |
import glob
import os
import numpy as np
import pytest
from sklearn.datasets import load_breast_cancer
from fedot.core.composer.cache import OperationsCache
from fedot.core.data.data import InputData
from fedot.core.data.data_split import train_test_data_setup
from fedot.core.pipelines.node import PrimaryNode, Second... | [
"fedot.core.data.data_split.train_test_data_setup",
"os.remove",
"numpy.random.seed",
"fedot.core.repository.tasks.Task",
"fedot.core.pipelines.pipeline.Pipeline",
"fedot.core.composer.cache.OperationsCache",
"pytest.fixture",
"sklearn.datasets.load_breast_cancer",
"glob.glob",
"fedot.core.pipelin... | [((504, 520), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (518, 520), False, 'import pytest\n'), ((2259, 2304), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (2273, 2304), False, 'import pytest\n'), ((550, 584), 'fedot.core.repo... |
import os, sys, shutil, copy #, argparse, re
import cv2
import numpy as np
OPTFLOW_METHOD = "Brox" # Farneback, Brox, TODO: Horn-Schunck
USE_RENDER = True
CUDA_ID = "3"
if USE_RENDER:
if __name__=="__main__":
if CUDA_ID is None:
from tools.GPUmonitor import getAvailableGPU
gpu_available = getAvai... | [
"numpy.load",
"numpy.abs",
"numpy.amin",
"cv2.remap",
"numpy.mean",
"numpy.linalg.norm",
"numpy.arange",
"numpy.sin",
"cv2.normalize",
"os.path.join",
"sys.path.append",
"numpy.pad",
"cv2.cvtColor",
"cv2.imwrite",
"numpy.arccos",
"numpy.repeat",
"numpy.log2",
"numpy.asarray",
"te... | [((739, 772), 'sys.path.append', 'sys.path.append', (['"""path/to/pyflow"""'], {}), "('path/to/pyflow')\n", (754, 772), False, 'import os, sys, shutil, copy\n'), ((4869, 4893), 'numpy.arange', 'np.arange', (['flow.shape[1]'], {}), '(flow.shape[1])\n', (4878, 4893), True, 'import numpy as np\n'), ((4960, 5006), 'cv2.rem... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10
@author: jaehyuk
"""
import numpy as np
import scipy.stats as ss
import scipy.optimize as sopt
import scipy.integrate as spint
import pyfeng as pf
from . import normal
from . import bsm
'''
MC model class for Beta=1
'''
class ModelBsmMC:
beta = 1.0 # fixed (not... | [
"numpy.zeros_like",
"numpy.random.seed",
"pyfeng.Bsm",
"numpy.log",
"numpy.ones_like",
"numpy.maximum",
"numpy.zeros",
"numpy.ones",
"pyfeng.Norm",
"numpy.exp",
"numpy.random.normal",
"scipy.integrate.simps",
"numpy.sqrt"
] | [((818, 853), 'pyfeng.Bsm', 'pf.Bsm', (['sigma'], {'intr': 'intr', 'divr': 'divr'}), '(sigma, intr=intr, divr=divr)\n', (824, 853), True, 'import pyfeng as pf\n'), ((1498, 1519), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (1512, 1519), True, 'import numpy as np\n'), ((1538, 1563), 'numpy.exp... |
from glob import glob
import xarray as xr
import numpy as np
def load(sg_num, var, dataPath):
filenames=sorted(glob(dataPath+'p'+str(sg_num)+'*.nc'))
filenames
for i,f in enumerate(filenames):
ds = xr.open_dataset(f)
ds_sg_data = ds[var]
coords = ['log_g... | [
"xarray.open_dataset",
"numpy.array",
"xarray.concat"
] | [((234, 252), 'xarray.open_dataset', 'xr.open_dataset', (['f'], {}), '(f)\n', (249, 252), True, 'import xarray as xr\n'), ((1444, 1500), 'xarray.concat', 'xr.concat', (['[ds_sg_data_main, ds_sg_data]'], {'dim': '"""ctd_time"""'}), "([ds_sg_data_main, ds_sg_data], dim='ctd_time')\n", (1453, 1500), True, 'import xarray a... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from pprint import pprint
from sklearn import preprocessing
import data_helpers
import torch
import torch.optim as optim
import torch.utils.data as data_utils
import torch.autograd as autograd
import torch.nn as nn
import numpy as np
import argpar... | [
"sklearn.preprocessing.LabelBinarizer",
"numpy.random.seed",
"argparse.ArgumentParser",
"data_helpers.build_vocab",
"numpy.argmax",
"data_helpers.pad_sentences",
"numpy.arange",
"pprint.pprint",
"torch.utils.data.TensorDataset",
"data_helpers.tokenize_and_lower",
"torch.utils.data.DataLoader",
... | [((402, 419), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (416, 419), True, 'import numpy as np\n'), ((421, 441), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (438, 441), False, 'import torch\n'), ((475, 545), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descripti... |
import sys
import datetime
import platform
import random
import taichi
def get_os_name():
name = platform.platform()
# in python 3.8, platform.platform() uses mac_ver() on macOS
# it will return 'macOS-XXXX' instead of 'Darwin-XXXX'
if name.lower().startswith('darwin') or name.lower().startswith('maco... | [
"taichi.tc_core.set_core_trigger_gdb_when_crash",
"taichi.core.flush_log",
"numpy.ones",
"numpy.clip",
"taichi.Vector",
"taichi.tc_core.set_logging_level",
"random.randint",
"taichi.vec",
"inspect.getframeinfo",
"taichi.tc_core.logging_effective",
"taichi.tc_core.duplicate_stdout_to_file",
"ta... | [((103, 122), 'platform.platform', 'platform.platform', ([], {}), '()\n', (120, 122), False, 'import platform\n'), ((947, 962), 'copy.copy', 'copy.copy', (['args'], {}), '(args)\n', (956, 962), False, 'import copy\n'), ((1227, 1254), 'taichi.tc_core.config_from_dict', 'tc_core.config_from_dict', (['d'], {}), '(d)\n', (... |
# Author: <NAME> (<EMAIL>)
# Center for Machine Perception, Czech Technical University in Prague
import os
import sys
import glob
import numpy as np
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from pysixd import inout
from params.dataset_params import get_dataset_params
par = get_dat... | [
"os.path.abspath",
"pysixd.inout.save_depth",
"pysixd.inout.load_depth",
"params.dataset_params.get_dataset_params",
"numpy.round"
] | [((313, 349), 'params.dataset_params.get_dataset_params', 'get_dataset_params', (['"""hinterstoisser"""'], {}), "('hinterstoisser')\n", (331, 349), False, 'from params.dataset_params import get_dataset_params\n'), ((756, 784), 'pysixd.inout.load_depth', 'inout.load_depth', (['depth_path'], {}), '(depth_path)\n', (772, ... |
from PyQt5 import QtCore, QtGui, QtWidgets
import res_rc
import ui as gui
import global_ as g
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as Navi... | [
"numpy.abs",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtWidgets.QApplication",
"global_.theo_peaks_y.append",
"global_.Spectrum.Boltzmann_weight_IR",
"matplotlib.figure.Figure",
"numpy.max",
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.__init__",
"numpy.loadtxt",
"PyQt5.QtWid... | [((11104, 11136), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (11126, 11136), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((11154, 11177), 'PyQt5.QtWidgets.QMainWindow', 'QtWidgets.QMainWindow', ([], {}), '()\n', (11175, 11177), False, 'from PyQt5 import QtC... |
import numpy as np
import pandas as pd
import altair as alt
def _outliers(data):
bottom, middle, top = np.percentile(data, [25, 50, 75])
iqr = top - bottom
top_whisker = min(top + 1.5*iqr, data.max())
bottom_whisker = max(bottom - 1.5*iqr, data.min())
outliers = data[(data > top_whisker) | (data < ... | [
"pandas.DataFrame",
"altair.Y",
"altair.X2",
"altair.Chart",
"numpy.percentile",
"numpy.sort",
"altair.X",
"altair.Axis",
"pandas.Series",
"pandas.Categorical",
"altair.Tooltip",
"altair.Y2",
"pandas.concat",
"numpy.concatenate",
"altair.Color"
] | [((108, 141), 'numpy.percentile', 'np.percentile', (['data', '[25, 50, 75]'], {}), '(data, [25, 50, 75])\n', (121, 141), True, 'import numpy as np\n'), ((618, 743), 'pandas.Series', 'pd.Series', (["{'middle': middle, 'bottom': bottom, 'top': top, 'top_whisker': top_whisker,\n 'bottom_whisker': bottom_whisker}"], {})... |
from abc import ABCMeta, abstractmethod
from abcpy.graphtools import GraphTools
import numpy as np
from sklearn.covariance import ledoit_wolf
from glmnet import LogitNet
class Approx_likelihood(metaclass = ABCMeta):
"""This abstract base class defines the approximate likelihood
function.
"""
@abs... | [
"numpy.matrix",
"numpy.multiply",
"sklearn.covariance.ledoit_wolf",
"glmnet.LogitNet",
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"numpy.random.RandomState",
"numpy.mean",
"numpy.linalg.inv",
"numpy.array",
"numpy.linalg.det",
"numpy.concatenate",
"numpy.sqrt"
] | [((2996, 3016), 'numpy.mean', 'np.mean', (['stat_sim', '(0)'], {}), '(stat_sim, 0)\n', (3003, 3016), True, 'import numpy as np\n'), ((3097, 3118), 'sklearn.covariance.ledoit_wolf', 'ledoit_wolf', (['stat_sim'], {}), '(stat_sim)\n', (3108, 3118), False, 'from sklearn.covariance import ledoit_wolf\n'), ((3150, 3172), 'nu... |
import pandas as pd
import numpy as np
def polyvalHelperFunction(x,p):
# The problem with applying "polyval" to data series is that the "x" is the second argument of the function
# instead of being the first. So we use this function to invert the two, waiting to find a better way
output = np.polyval(p,x)
... | [
"numpy.polyval"
] | [((303, 319), 'numpy.polyval', 'np.polyval', (['p', 'x'], {}), '(p, x)\n', (313, 319), True, 'import numpy as np\n'), ((649, 668), 'numpy.polyval', 'np.polyval', (['p[1]', 'x'], {}), '(p[1], x)\n', (659, 668), True, 'import numpy as np\n'), ((670, 689), 'numpy.polyval', 'np.polyval', (['p[0]', 'x'], {}), '(p[0], x)\n',... |
"""
probe.py
"""
import numpy as np
from scipy.io import FortranFile
class Probe():
def __init__(self, **kwargs):
self.dtype = np.float64
for arg, val in kwargs.items():
if arg == "file":
self.file = val
elif arg == "variables":
s... | [
"numpy.fromfile",
"scipy.io.FortranFile"
] | [((1171, 1198), 'scipy.io.FortranFile', 'FortranFile', (['self.file', '"""r"""'], {}), "(self.file, 'r')\n", (1182, 1198), False, 'from scipy.io import FortranFile\n'), ((683, 714), 'numpy.fromfile', 'np.fromfile', (['bindat', 'self.dtype'], {}), '(bindat, self.dtype)\n', (694, 714), True, 'import numpy as np\n')] |
# <NAME> 2014-2020
# mlxtend Machine Learning Library Extensions
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
from mlxtend.evaluate import scoring
import numpy as np
def test_metric_argument():
"Test exception is raised when user provides invalid metric argument"
try:
scoring(y_target=[1], y_... | [
"mlxtend.evaluate.scoring",
"numpy.array"
] | [((773, 836), 'mlxtend.evaluate.scoring', 'scoring', ([], {'y_target': 'y_targ', 'y_predicted': 'y_pred', 'metric': '"""accuracy"""'}), "(y_target=y_targ, y_predicted=y_pred, metric='accuracy')\n", (780, 836), False, 'from mlxtend.evaluate import scoring\n'), ((990, 1050), 'mlxtend.evaluate.scoring', 'scoring', ([], {'... |
#!/usr/bin/env python3
import numpy as np
def regularization(theta, lambda_):
"""
Computes the regularization term of a non-empty numpy.ndarray with a for-loop.
Args:
theta: has to be numpy.ndarray, a vector of dimensions n*1.
lambda_: has to be a float.
Returns:
The... | [
"numpy.array",
"numpy.sum"
] | [((650, 686), 'numpy.array', 'np.array', (['[0, 15, -9, 7, 12, 3, -21]'], {}), '([0, 15, -9, 7, 12, 3, -21])\n', (658, 686), True, 'import numpy as np\n'), ((548, 566), 'numpy.sum', 'np.sum', (['(theta ** 2)'], {}), '(theta ** 2)\n', (554, 566), True, 'import numpy as np\n')] |
import unittest
import numpy as np
import jax
from jax import random
from jaxdl.rl.networks.actor_nets import NormalDistPolicy
from jaxdl.rl.networks.conv_actor_nets import NormalConvDistPolicy
from jaxdl.rl.networks.critic_nets import DoubleCriticNetwork
from jaxdl.rl.networks.conv_critic_nets import DoubleConvCriticN... | [
"unittest.main",
"jax.random.uniform",
"jaxdl.rl.networks.conv_actor_nets.NormalConvDistPolicy",
"jaxdl.rl.networks.temperature_nets.Temperature",
"jaxdl.rl.networks.critic_nets.DoubleCriticNetwork",
"jaxdl.rl.networks.actor_nets.NormalDistPolicy",
"jaxdl.rl.networks.conv_critic_nets.DoubleConvCriticNet... | [((2482, 2497), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2495, 2497), False, 'import unittest\n'), ((473, 518), 'numpy.array', 'np.array', (['[[5.0, 5.0, 5.0]]'], {'dtype': 'np.float32'}), '([[5.0, 5.0, 5.0]], dtype=np.float32)\n', (481, 518), True, 'import numpy as np\n'), ((526, 543), 'jax.random.PRNGKey'... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.context.set_context",
"os.path.abspath",
"src.finetune_eval_model.BertCLSModel",
"mindspore.export",
"src.utils.convert_labels_to_index",
"mindspore.load_checkpoint",
"numpy.zeros",
"src.model_utils.config.config.use_crf.lower",
"src.finetune_eval_model.BertSquadModel",
"src.bert_for_fi... | [((1588, 1637), 'src.model_utils.moxing_adapter.moxing_wrapper', 'moxing_wrapper', ([], {'pre_process': 'modelarts_pre_process'}), '(pre_process=modelarts_pre_process)\n', (1602, 1637), False, 'from src.model_utils.moxing_adapter import moxing_wrapper\n'), ((1282, 1297), 'src.model_utils.device_adapter.get_device_id', ... |
"""
Tax-Calculator federal income and payroll tax Calculator class.
"""
# CODING-STYLE CHECKS:
# pycodestyle calculator.py
# pylint --disable=locally-disabled calculator.py
#
# pylint: disable=too-many-lines,no-value-for-parameter
import copy
import numpy as np
import pandas as pd
import paramtools
from t... | [
"taxcalc.calcfunctions.EITC",
"taxcalc.calcfunctions.UBI",
"taxcalc.utils.pch_graph_plot",
"taxcalc.utils.ce_aftertax_expanded_income",
"taxcalc.utils.create_diagnostic_table",
"numpy.allclose",
"taxcalc.calcfunctions.TaxInc",
"taxcalc.calcfunctions.C1040",
"taxcalc.policy.Policy.read_json_reform",
... | [((7458, 7492), 'taxcalc.calcfunctions.UBI', 'UBI', (['self.__policy', 'self.__records'], {}), '(self.__policy, self.__records)\n', (7461, 7492), False, 'from taxcalc.calcfunctions import TaxInc, SchXYZTax, GainsTax, AGIsurtax, NetInvIncTax, AMT, EI_PayrollTax, Adj, DependentCare, ALD_InvInc_ec_base, CapGains, SSBenefi... |
# import start
import ast
import asyncio
import calendar
import platform
import subprocess as sp
import time
import traceback
import xml.etree.ElementTree as Et
from collections import defaultdict
from datetime import datetime
import math
import numpy as np
import pandas as pd
from Utility.CDPConfigValues import CDPC... | [
"pandas.read_csv",
"WebConnection.WebConnection.WebConnection",
"pandas.DatetimeIndex",
"collections.defaultdict",
"Utility.Utilities.Utilities.format_url",
"pandas.DataFrame",
"Utility.Utilities.Utilities.create_batches",
"traceback.print_tb",
"pandas.merge",
"Utility.WebConstants.WebConstants",
... | [((1966, 2016), 'Utility.CDPConfigValues.CDPConfigValues.configFetcher.get', 'CDPConfigValues.configFetcher.get', (['"""name"""', 'project'], {}), "('name', project)\n", (1999, 2016), False, 'from Utility.CDPConfigValues import CDPConfigValues\n'), ((2046, 2067), 'Utility.WebConstants.WebConstants', 'WebConstants', (['... |
import os.path
import numpy as np
import tensorflow as tf
import SharedArray as sa
from musegan2.models import GAN, RefineGAN, End2EndGAN
from config import TF_CONFIG, EXP_CONFIG, MODEL_CONFIG, TRAIN_CONFIG
NUM_BATCH = 50
def main():
with tf.Session(config=TF_CONFIG) as sess:
gan = GAN(sess, MODEL_CONFIG)... | [
"numpy.random.uniform",
"tensorflow.Session",
"numpy.random.normal",
"musegan2.models.GAN"
] | [((245, 273), 'tensorflow.Session', 'tf.Session', ([], {'config': 'TF_CONFIG'}), '(config=TF_CONFIG)\n', (255, 273), True, 'import tensorflow as tf\n'), ((297, 320), 'musegan2.models.GAN', 'GAN', (['sess', 'MODEL_CONFIG'], {}), '(sess, MODEL_CONFIG)\n', (300, 320), False, 'from musegan2.models import GAN, RefineGAN, En... |
#from __future__ import absolute_import
#from __future__ import print_function
import os
import sys
import math
import json
import random
import numpy as np
import traceback
from scipy.stats import lognorm
from scipy.stats import uniform
from scipy.stats import weibull_min
from scipy.stats import gamma
############... | [
"scipy.stats.gamma.cdf",
"scipy.stats.uniform.cdf",
"numpy.square",
"scipy.stats.weibull_min.cdf",
"numpy.dot"
] | [((1070, 1109), 'scipy.stats.weibull_min.cdf', 'weibull_min.cdf', (['x_upper', 'c', 'loc', 'scale'], {}), '(x_upper, c, loc, scale)\n', (1085, 1109), False, 'from scipy.stats import weibull_min\n'), ((1107, 1146), 'scipy.stats.weibull_min.cdf', 'weibull_min.cdf', (['x_lower', 'c', 'loc', 'scale'], {}), '(x_lower, c, lo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ╔═════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
# ║ ║
# ║ __ __ ... | [
"numpy.sum",
"numpy.int64"
] | [((2251, 2271), 'numpy.int64', 'np.int64', (['(pred / 255)'], {}), '(pred / 255)\n', (2259, 2271), True, 'import numpy as np\n'), ((2281, 2299), 'numpy.int64', 'np.int64', (['(gt / 255)'], {}), '(gt / 255)\n', (2289, 2299), True, 'import numpy as np\n'), ((2417, 2437), 'numpy.int64', 'np.int64', (['(pred / 255)'], {}),... |
'''
The goal of this script is to compare the output of nrutils' strain calculation
method to the output of an independent MATLAB code of the same method. For convinience,
ascii data for the MATLAB routine's output is saved within this repository.
-- <EMAIL> 2016 --
'''
# Import useful things
from os.path import dirna... | [
"matplotlib.rc",
"numpy.loadtxt",
"os.system"
] | [((444, 459), 'os.system', 'system', (['"""clear"""'], {}), "('clear')\n", (450, 459), False, 'from os import system\n'), ((546, 613), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']})\n", (548, 613), False, 'from matplotlib import rc\n'), ((610, 633), 'matp... |
import os
import time
import torch
import torch.nn as nn
import utils
from torch.autograd import Variable
import datetime
import numpy as np
import sys
def LangMCriterion(input, target):
target = target.view(-1, 1)
logprob_select = torch.gather(input, 1, target)
mask = target.data.gt(0) # generate the ma... | [
"utils.create_dir",
"torch.masked_select",
"torch.gather",
"torch.sum",
"torch.autograd.Variable",
"datetime.datetime.now",
"time.time",
"numpy.array",
"os.path.join",
"torch.sort"
] | [((241, 271), 'torch.gather', 'torch.gather', (['input', '(1)', 'target'], {}), '(input, 1, target)\n', (253, 271), False, 'import torch\n'), ((424, 465), 'torch.masked_select', 'torch.masked_select', (['logprob_select', 'mask'], {}), '(logprob_select, mask)\n', (443, 465), False, 'import torch\n'), ((594, 617), 'datet... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 6 19:56:58 2018
@author: mirandayuan
"""
import numpy as np
#Transmission Probabilities (order:Verb, Noun, Adv.) e1
#TProb = [[0.3,0.2,0],[0.1,0.4,0.4],[0.3,0.1,0.1],[0,0,0.1]]
TProb = [[3,2,0],[1,4,4],[3,1,1],[0,0,0.1]]
#Emission Probabilities e... | [
"numpy.multiply"
] | [((642, 678), 'numpy.multiply', 'np.multiply', (['Viterbi[0][0]', 'TProb[0]'], {}), '(Viterbi[0][0], TProb[0])\n', (653, 678), True, 'import numpy as np\n'), ((809, 853), 'numpy.multiply', 'np.multiply', (['Viterbi[i - 1][j]', 'TProb[j + 1]'], {}), '(Viterbi[i - 1][j], TProb[j + 1])\n', (820, 853), True, 'import numpy ... |
from copy import copy
import sys
import codecs
import nltk
from nltk import ne_chunk, pos_tag, word_tokenize
from nltk.corpus import stopwords
from nltk.tree import Tree
import numpy as np
import os
import re
from wordcloud import WordCloud, ImageColorGenerator
import random
from PIL import Image
from icon_font_to_png... | [
"os.mkdir",
"PIL.Image.new",
"wordcloud.WordCloud",
"icon_font_to_png.IconFont",
"os.path.join",
"nltk.word_tokenize",
"random.randint",
"icon_font_to_png.FontAwesomeDownloader",
"os.path.dirname",
"re.findall",
"requests.get",
"functools.partial",
"nltk.corpus.stopwords.words",
"os.path.i... | [((1008, 1033), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1023, 1033), False, 'import os\n'), ((1044, 1078), 'os.path.join', 'os.path.join', (['CUR_DIR', '"""exported/"""'], {}), "(CUR_DIR, 'exported/')\n", (1056, 1078), False, 'import os\n'), ((1092, 1123), 'os.path.join', 'os.path.joi... |
import pandas as pd
import torch
from tqdm import tqdm
from sklearn.preprocessing import minmax_scale
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# load the data, and form the tensor dataset
from opt import LeastSquaresProxPointOptimizer
# load data
df = pd.read_csv('boston.csv')
inputs ... | [
"pandas.DataFrame",
"seaborn.lineplot",
"tqdm.tqdm",
"opt.LeastSquaresProxPointOptimizer",
"matplotlib.pyplot.show",
"pandas.DataFrame.from_dict",
"torch.utils.data.DataLoader",
"torch.sum",
"pandas.read_csv",
"numpy.geomspace",
"torch.empty",
"numpy.ones",
"torch.nn.init.normal_",
"seabor... | [((287, 312), 'pandas.read_csv', 'pd.read_csv', (['"""boston.csv"""'], {}), "('boston.csv')\n", (298, 312), True, 'import pandas as pd\n'), ((730, 758), 'numpy.geomspace', 'np.geomspace', (['(0.001)', '(100)', '(30)'], {}), '(0.001, 100, 30)\n', (742, 758), True, 'import numpy as np\n'), ((806, 891), 'pandas.DataFrame'... |
import numpy as np
def rotate(angle, desired_angle):
xa = [np.cos(angle), np.sin(angle)]
rot = np.array([[np.cos(-desired_angle), -np.sin(-desired_angle)], [np.sin(-desired_angle), np.cos(-desired_angle)]])
delta_v = np.dot(rot, xa)
delta = np.arctan2(delta_v[1], delta_v[0])
return delta
def is_... | [
"numpy.arctan2",
"numpy.eye",
"numpy.ravel",
"numpy.sin",
"numpy.array",
"numpy.linalg.norm",
"numpy.cos",
"numpy.dot"
] | [((231, 246), 'numpy.dot', 'np.dot', (['rot', 'xa'], {}), '(rot, xa)\n', (237, 246), True, 'import numpy as np\n'), ((259, 293), 'numpy.arctan2', 'np.arctan2', (['delta_v[1]', 'delta_v[0]'], {}), '(delta_v[1], delta_v[0])\n', (269, 293), True, 'import numpy as np\n'), ((390, 407), 'numpy.linalg.norm', 'np.linalg.norm',... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, pub... | [
"sklearn.neighbors.KDTree",
"numpy.argsort",
"numpy.zeros"
] | [((2520, 2540), 'numpy.zeros', 'np.zeros', (['X.shape[1]'], {}), '(X.shape[1])\n', (2528, 2540), True, 'import numpy as np\n'), ((2561, 2570), 'sklearn.neighbors.KDTree', 'KDTree', (['X'], {}), '(X)\n', (2567, 2570), False, 'from sklearn.neighbors import KDTree\n'), ((3488, 3519), 'numpy.argsort', 'np.argsort', (['self... |
import numpy as np
class ZernikeCoefficients(object):
FIRST_ZERNIKE_MODE = 2
def __init__(self, coefficients, counter=0):
self._coefficients = coefficients
self._counter = counter
def zernikeIndexes(self):
return np.arange(self.FIRST_ZERNIKE_MODE,
self.FI... | [
"numpy.array_equal",
"numpy.array"
] | [((915, 949), 'numpy.array', 'np.array', (['coefficientsAsNumpyArray'], {}), '(coefficientsAsNumpyArray)\n', (923, 949), True, 'import numpy as np\n'), ((1187, 1238), 'numpy.array_equal', 'np.array_equal', (['self._coefficients', 'o._coefficients'], {}), '(self._coefficients, o._coefficients)\n', (1201, 1238), True, 'i... |
import cv2
import numpy as np
import tensorflow as tf
import glob
import argparse
import os
INPUT_SIZE = 512 # input image size for Generator
ATTENTION_SIZE = 32 # size of contextual attention
def sort(str_lst):
return [s for s in sorted(str_lst)]
# reconstruct residual from patches
def reconstruct_residual_... | [
"argparse.ArgumentParser",
"numpy.clip",
"numpy.mean",
"glob.glob",
"cv2.imwrite",
"numpy.transpose",
"os.path.exists",
"numpy.reshape",
"tensorflow.GraphDef",
"cv2.resize",
"cv2.bitwise_not",
"os.path.basename",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"tensorflo... | [((4505, 4530), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4528, 4530), False, 'import argparse\n'), ((369, 446), 'numpy.reshape', 'np.reshape', (['residual', '[ATTENTION_SIZE, ATTENTION_SIZE, multiple, multiple, 3]'], {}), '(residual, [ATTENTION_SIZE, ATTENTION_SIZE, multiple, multiple, 3... |
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # <--- This is important for 3d plotting
from scipy.interpolate import griddata
PI = np.pi
### MESH PART
# Mesh input parameters
fparms = 'parameters.inp'
nc_col,nc_row = np.loadtxt(fparms)[:]
nc_co... | [
"numpy.meshgrid",
"numpy.savetxt",
"numpy.zeros",
"numpy.flipud",
"numpy.min",
"numpy.loadtxt",
"numpy.vstack"
] | [((390, 406), 'numpy.zeros', 'np.zeros', (['nc_col'], {}), '(nc_col)\n', (398, 406), True, 'import numpy as np\n'), ((412, 428), 'numpy.zeros', 'np.zeros', (['nc_row'], {}), '(nc_row)\n', (420, 428), True, 'import numpy as np\n'), ((641, 660), 'numpy.meshgrid', 'np.meshgrid', (['cx', 'cy'], {}), '(cx, cy)\n', (652, 660... |
#!/usr/bin/env python
# Copyright (c) 2011-2020, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Digital Elevation Model Data I/O
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Provide surface/terrain elevation information from SRTM data
.. autosummary::
:nosignatures:
:toctree: ... | [
"requests.utils.urlparse",
"os.makedirs",
"osgeo.gdal.Warp",
"numpy.floor",
"os.path.exists",
"os.environ.get",
"wradlib.util.get_wradlib_data_path",
"osgeo.gdal.Open",
"os.path.join"
] | [((1849, 1895), 'os.environ.get', 'os.environ.get', (['"""WRADLIB_EARTHDATA_USER"""', 'None'], {}), "('WRADLIB_EARTHDATA_USER', None)\n", (1863, 1895), False, 'import os\n'), ((1906, 1952), 'os.environ.get', 'os.environ.get', (['"""WRADLIB_EARTHDATA_PASS"""', 'None'], {}), "('WRADLIB_EARTHDATA_PASS', None)\n", (1920, 1... |
import numpy as np
#
# Your previous Plain Text content is preserved below:
#
#
# N x M Matrix
# Point located at x;y coordinate
#
# After K moves, What is the probability the point is dead
#
# x=1
# y=0
#
initial_matrix = np.array([[1, 2, 3],
[4, 5, 6]])
#
# K=1
# Initial Matrix
#
# M = [[... | [
"numpy.array",
"numpy.ones"
] | [((232, 264), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (240, 264), True, 'import numpy as np\n'), ((596, 625), 'numpy.ones', 'np.ones', (['initial_matrix.shape'], {}), '(initial_matrix.shape)\n', (603, 625), True, 'import numpy as np\n')] |
import pprint
# import json
import time
from gurobipy import *
from tqdm import tqdm
import numpy as np
"""
This code is for the most part written by <NAME> and is taken and
adapted from the repository https://github.com/chenhongge/RobustTrees.
It is an implementation of the MILP attack from:
Kantchelian, <NAME>.... | [
"numpy.sum",
"numpy.abs",
"numpy.copy",
"time.time",
"numpy.array",
"numpy.linalg.norm",
"pprint.pprint"
] | [((1408, 1452), 'numpy.linalg.norm', 'np.linalg.norm', (['(X - X_adv)'], {'ord': 'order', 'axis': '(1)'}), '(X - X_adv, ord=order, axis=1)\n', (1422, 1452), True, 'import numpy as np\n'), ((12637, 12652), 'numpy.copy', 'np.copy', (['sample'], {}), '(sample)\n', (12644, 12652), True, 'import numpy as np\n'), ((15338, 15... |
# --- For cmd.py
from __future__ import division, print_function
import os
import subprocess
import multiprocessing
import collections
import glob
import pandas as pd
import numpy as np
import distutils.dir_util
import shutil
import stat
import re
# --- External library for io
try:
import weio
except:
try:
... | [
"os.remove",
"welib.weio.read",
"numpy.floor",
"numpy.ones",
"numpy.isnan",
"numpy.argsort",
"os.path.isfile",
"numpy.arange",
"shutil.rmtree",
"os.path.join",
"numpy.unique",
"multiprocessing.cpu_count",
"pandas.DataFrame",
"os.path.abspath",
"numpy.meshgrid",
"os.path.dirname",
"os... | [((827, 845), 'welib.weio.FASTWndFile', 'weio.FASTWndFile', ([], {}), '()\n', (843, 845), True, 'import welib.weio as weio\n'), ((857, 897), 'numpy.arange', 'np.arange', (['WSmin', '(WSmax + WSstep)', 'WSstep'], {}), '(WSmin, WSmax + WSstep, WSstep)\n', (866, 897), True, 'import numpy as np\n'), ((970, 992), 'numpy.zer... |
#!/usr/bin/env python
import os
import sys
import glob
import hashlib
import numpy as np
import h5py
sys.path.insert(0, os.pardir)
from testing_harness import PyAPITestHarness
import openmc
import openmc.mgxs
from openmc.examples import pwr_pin_cell
np.set_printoptions(formatter={'float_kind': '{:.8e}'.format})
... | [
"openmc.examples.pwr_pin_cell",
"openmc.StatePoint",
"h5py.File",
"numpy.set_printoptions",
"os.remove",
"os.getcwd",
"os.path.exists",
"sys.path.insert",
"hashlib.sha512",
"openmc.mgxs.EnergyGroups",
"openmc.mgxs.Library"
] | [((104, 133), 'sys.path.insert', 'sys.path.insert', (['(0)', 'os.pardir'], {}), '(0, os.pardir)\n', (119, 133), False, 'import sys\n'), ((255, 317), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'formatter': "{'float_kind': '{:.8e}'.format}"}), "(formatter={'float_kind': '{:.8e}'.format})\n", (274, 317), True,... |
from math import sin, pi
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
from common_math.math import safe_log10
from example_setups.setup import setup
class rfController:
def __init__(self, Fs, length=2 ** 14, resolution=2 ** 16):
self.Fs = int(Fs)
self.length = len... | [
"numpy.sum",
"numpy.abs",
"matplotlib.pyplot.close",
"numpy.zeros",
"math.sin",
"numpy.min",
"numpy.max",
"numpy.arange",
"common_math.math.safe_log10",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((1564, 1607), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'constrained_layout': '(True)'}), '(1, 1, constrained_layout=True)\n', (1576, 1607), True, 'import matplotlib.pyplot as plt\n'), ((2158, 2172), 'matplotlib.pyplot.close', 'plt.close', (['fig'], {}), '(fig)\n', (2167, 2172), True, 'import ma... |
"""Functions for building the training loop"""
import numpy as np
import pandas as pd
import torch
from .embeddings import DynamicBernoulliEmbeddingModel
from .preprocessing import Data
def train_model(
dataset,
dictionary,
validation=None,
notebook=True,
m=300,
num_epochs=10,
lr=2e-3,
... | [
"pandas.DataFrame",
"torch.zeros_like",
"numpy.random.random",
"torch.cuda.is_available",
"torch.no_grad",
"numpy.repeat"
] | [((1546, 1580), 'numpy.repeat', 'np.repeat', (['(False)', 'dataset.shape[0]'], {}), '(False, dataset.shape[0])\n', (1555, 1580), True, 'import numpy as np\n'), ((3949, 4039), 'pandas.DataFrame', 'pd.DataFrame', (['loss_history'], {'columns': "['loss', 'l_pos', 'l_neg', 'l_prior', 'l_pos_val']"}), "(loss_history, column... |
# -*- coding: utf-8 -*-
# Copyright StateOfTheArt.quant.
#
# * Commercial Usage: please contact <EMAIL>
# * Non-Commercial Usage:
# 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
#
... | [
"numpy.random.randint",
"numpy.random.seed",
"torch.tensor",
"numpy.random.randn"
] | [((10653, 10672), 'numpy.random.seed', 'np.random.seed', (['(520)'], {}), '(520)\n', (10667, 10672), True, 'import numpy as np\n'), ((10689, 10711), 'numpy.random.randn', 'np.random.randn', (['(10)', '(3)'], {}), '(10, 3)\n', (10704, 10711), True, 'import numpy as np\n'), ((10727, 10771), 'torch.tensor', 'torch.tensor'... |
import os
import math
import numpy as np
import matplotlib as matplot
import matplotlib.pyplot as plt
from netCDF4 import Dataset
import csv
from wrf import (to_np, getvar, smooth2d, get_cartopy, cartopy_xlim,
cartopy_ylim, latlon_coords)
# List the colors that will be used for tracing the track.
co... | [
"netCDF4.Dataset",
"csv.writer",
"numpy.amin",
"numpy.square",
"numpy.amax",
"wrf.getvar",
"os.chdir",
"os.listdir"
] | [((1494, 1509), 'os.listdir', 'os.listdir', (['Dir'], {}), '(Dir)\n', (1504, 1509), False, 'import os\n'), ((1980, 1999), 'os.chdir', 'os.chdir', (['Dir_local'], {}), '(Dir_local)\n', (1988, 1999), False, 'import os\n'), ((3711, 3730), 'csv.writer', 'csv.writer', (['csvfile'], {}), '(csvfile)\n', (3721, 3730), False, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from numpy import array, arange, amin, amax, histogram
from numpy import column_stack, median, mean, sum
from plotting import Plotter
from datetime import timedelta
from filter_provider import DatasetFilter, AcceptanceTester
class DatasetContainer:
"""Contains one sing... | [
"filter_provider.AcceptanceTester",
"numpy.amin",
"numpy.amax",
"numpy.histogram",
"numpy.array",
"datetime.timedelta",
"numpy.arange",
"numpy.column_stack"
] | [((602, 622), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(1)'}), '(minutes=1)\n', (611, 622), False, 'from datetime import timedelta\n'), ((1662, 1690), 'filter_provider.AcceptanceTester', 'AcceptanceTester', (['self._type'], {}), '(self._type)\n', (1678, 1690), False, 'from filter_provider import DatasetFilt... |
import pathlib
import warnings
import functools
import numpy as np
import xarray as xr
try:
from fastprogress.fastprogress import progress_bar
fastprogress = 1
except ImportError:
fastprogress = None
import shutil
def temp_write_split(
ds_in,
folder,
method="dimension",
dim="time",
... | [
"pathlib.Path",
"numpy.array",
"functools.wraps",
"xarray.open_zarr",
"shutil.rmtree",
"warnings.warn"
] | [((3633, 3651), 'pathlib.Path', 'pathlib.Path', (['path'], {}), '(path)\n', (3645, 3651), False, 'import pathlib\n'), ((5324, 5345), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (5339, 5345), False, 'import functools\n'), ((3738, 3802), 'warnings.warn', 'warnings.warn', (['f"""Folder {path} does al... |
import numpy as np
import glob
from PIL import Image
from matplotlib import pyplot as plt
''' to determine accuracy of the predictions '''
''' since only 10 ground truth labels are created '''
target_files = []
prediction_files = []
accuracy_arr = np.zeros((11,4))
i = 0
for fname in glob.glob("/Users/shivani/Documen... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.zeros",
"PIL.Image.open",
"glob.glob",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((250, 267), 'numpy.zeros', 'np.zeros', (['(11, 4)'], {}), '((11, 4))\n', (258, 267), True, 'import numpy as np\n'), ((287, 377), 'glob.glob', 'glob.glob', (['"""/Users/shivani/Documents/approach2_testresults/ground_truth_labels/*.jpg"""'], {}), "(\n '/Users/shivani/Documents/approach2_testresults/ground_truth_labe... |
import numpy as np
from scipy.optimize import curve_fit
from ChromProcess.Utils import deconvolution as d_c
def _1gaussian(x, amp1, cen1, sigma1):
"""
A single gaussian function
Parameters
----------
x: array
x axis data
amp1: float
amplitude of the function
... | [
"ChromProcess.Utils.deconvolution._1gaussian",
"numpy.average",
"ChromProcess.Utils.deconvolution.fit_gaussian_peaks",
"ChromProcess.Utils.deconvolution._2gaussian",
"scipy.optimize.curve_fit",
"numpy.amax",
"numpy.where",
"numpy.array",
"numpy.exp",
"numpy.interp",
"numpy.sqrt"
] | [((4426, 4457), 'numpy.array', 'np.array', (['[*chromatogram.peaks]'], {}), '([*chromatogram.peaks])\n', (4434, 4457), True, 'import numpy as np\n'), ((4739, 4782), 'ChromProcess.Utils.deconvolution.fit_gaussian_peaks', 'd_c.fit_gaussian_peaks', (['time', 'signal', 'peaks'], {}), '(time, signal, peaks)\n', (4761, 4782)... |
from typing import List
import logging
import numpy as np
import torch
import yacs.config
from gaze_estimation.gaze_estimator.common import Camera, Face, FacePartsName, MODEL3D
from .head_pose_estimation import HeadPoseNormalizer, LandmarkEstimator
from gaze_estimation import (GazeEstimationMethod, create_model,
... | [
"gaze_estimation.gaze_estimator.common.MODEL3D.estimate_head_pose",
"gaze_estimation.create_transform",
"gaze_estimation.gaze_estimator.common.MODEL3D.compute_face_eye_centers",
"gaze_estimation.gaze_estimator.common.Camera",
"gaze_estimation.gaze_estimator.common.MODEL3D.compute_3d_pose",
"torch.stack",
... | [((397, 424), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (414, 424), False, 'import logging\n'), ((708, 751), 'gaze_estimation.gaze_estimator.common.Camera', 'Camera', (['config.gaze_estimator.camera_params'], {}), '(config.gaze_estimator.camera_params)\n', (714, 751), False, 'from ga... |
import numpy as np
import matplotlib.pyplot as plt
x = np.loadtxt("data.txt", delimiter=",")
plt.scatter(x[:, 3], x[:, 4])
plt.scatter(x[:, 4], x[:, 5])
plt.scatter(x[:, 3], x[:, 5])
plt.show()
| [
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show",
"numpy.loadtxt"
] | [((57, 94), 'numpy.loadtxt', 'np.loadtxt', (['"""data.txt"""'], {'delimiter': '""","""'}), "('data.txt', delimiter=',')\n", (67, 94), True, 'import numpy as np\n'), ((95, 124), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x[:, 3]', 'x[:, 4]'], {}), '(x[:, 3], x[:, 4])\n', (106, 124), True, 'import matplotlib.pyplot a... |
# -*- coding: utf-8 -*-
"""DesicionTree.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1se7pQXAOQnadOsiQ7Kjha-ksznl9OGm8
"""
import pandas as pd
from sklearn import tree
from sklearn.model_selection import train_test_split
from google.colab imp... | [
"matplotlib.pyplot.title",
"seaborn.heatmap",
"sklearn.model_selection.train_test_split",
"numpy.asarray",
"pandas.read_pickle",
"matplotlib.pyplot.ylabel",
"sklearn.tree.DecisionTreeClassifier",
"matplotlib.pyplot.figure",
"google.colab.drive.mount",
"sklearn.metrics.confusion_matrix",
"matplot... | [((361, 410), 'google.colab.drive.mount', 'drive.mount', (['"""/content/drive"""'], {'force_remount': '(True)'}), "('/content/drive', force_remount=True)\n", (372, 410), False, 'from google.colab import drive\n'), ((419, 490), 'pandas.read_pickle', 'pd.read_pickle', (['"""drive/MyDrive/Colab Notebooks/working_balanced_... |
from __future__ import print_function
import time
import os
os.chdir("d:/assignment")
import json
import matplotlib.pyplot as plt
import tensorflow as tf
from utils.classifiers.squeezenet import SqueezeNet
from utils.data_utils import load_tiny_imagenet
from utils.image_utils import SQUEEZENET_MEAN, SQUEEZENET_STD
from... | [
"matplotlib.pyplot.title",
"scipy.ndimage.filters.gaussian_filter1d",
"numpy.argmax",
"tensorflow.reset_default_graph",
"tensorflow.ConfigProto",
"matplotlib.pyplot.figure",
"numpy.arange",
"utils.classifiers.squeezenet.SqueezeNet",
"tensorflow.reduce_max",
"os.chdir",
"tensorflow.abs",
"matpl... | [((60, 85), 'os.chdir', 'os.chdir', (['"""d:/assignment"""'], {}), "('d:/assignment')\n", (68, 85), False, 'import os\n'), ((866, 890), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (888, 890), True, 'import tensorflow as tf\n'), ((1023, 1065), 'utils.classifiers.squeezenet.SqueezeNet', ... |
from math import sqrt
import numpy as np
import torch
from scipy.stats import truncnorm
from ...support import utilities
class MultiScalarTruncatedNormalDistribution:
####################################################################################################################
### Constructor:
##... | [
"numpy.sum",
"math.sqrt",
"numpy.ndenumerate",
"scipy.stats.truncnorm.stats",
"numpy.zeros",
"numpy.min",
"torch.sum"
] | [((1278, 1287), 'math.sqrt', 'sqrt', (['var'], {}), '(var)\n', (1282, 1287), False, 'from math import sqrt\n'), ((1940, 1965), 'numpy.zeros', 'np.zeros', (['self.mean.shape'], {}), '(self.mean.shape)\n', (1948, 1965), True, 'import numpy as np\n'), ((1993, 2018), 'numpy.ndenumerate', 'np.ndenumerate', (['self.mean'], {... |
import argparse
import numpy as np
import torch
from torch import nn
from core.layers import LinearGaussian, ReluGaussian
from core.losses import ClassificationLoss
from core.utils import generate_classification_data, draw_classification_results
np.random.seed(42)
EPS = 1e-6
parser = argparse.ArgumentParser()
par... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"core.layers.LinearGaussian",
"core.utils.generate_classification_data",
"torch.argmax",
"core.layers.ReluGaussian",
"core.losses.ClassificationLoss",
"torch.cuda.is_available",
"core.utils.draw_classification_results",
"torch.no_grad",
"torch.opti... | [((249, 267), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (263, 267), True, 'import numpy as np\n'), ((290, 315), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (313, 315), False, 'import argparse\n'), ((2413, 2447), 'core.utils.generate_classification_data', 'generate_clas... |
"""
pyuvwsim
--------
Experimental python interface to uvwsim.
"""
import _pyuvwsim
from numpy import asarray
from .version import __version__
def load_station_coords(file_name):
"""
Loads station coordinates from an ASCII layout file. The layout file
should be 2 or 3 columns of coordinates, which are e... | [
"_pyuvwsim.convert_enu_to_ecef",
"_pyuvwsim.evaluate_station_uvw",
"numpy.asarray",
"_pyuvwsim.evaluate_baseline_uvw_ha_dec",
"_pyuvwsim.load_station_coords",
"_pyuvwsim.evaluate_baseline_uvw",
"_pyuvwsim.evaluate_station_uvw_ha_dec",
"_pyuvwsim.datetime_to_mjd"
] | [((535, 575), '_pyuvwsim.load_station_coords', '_pyuvwsim.load_station_coords', (['file_name'], {}), '(file_name)\n', (564, 575), False, 'import _pyuvwsim\n'), ((1131, 1141), 'numpy.asarray', 'asarray', (['x'], {}), '(x)\n', (1138, 1141), False, 'from numpy import asarray\n'), ((1150, 1160), 'numpy.asarray', 'asarray',... |
from __future__ import print_function
# standard library imports
import sys
import os
from os import path
# third party
import numpy as np
from collections import Counter
# local application imports
sys.path.append(path.dirname( path.dirname( path.abspath(__file__))))
from utilities import *
from wrappers import Mole... | [
"os.path.abspath",
"wrappers.Molecule.from_options",
"coordinate_systems.Angle",
"os.getcwd",
"coordinate_systems.Distance",
"collections.Counter",
"coordinate_systems.Dihedral",
"sys.stdout.flush",
"numpy.linalg.norm",
"numpy.sign",
"numpy.dot",
"coordinate_systems.OutOfPlane",
"wrappers.Mo... | [((20819, 20888), 'wrappers.Molecule.from_options', 'Molecule.from_options', ([], {'fnm': 'filepath1', 'PES': 'pes1', 'coordinate_type': '"""DLC"""'}), "(fnm=filepath1, PES=pes1, coordinate_type='DLC')\n", (20840, 20888), False, 'from wrappers import Molecule\n'), ((1108, 1126), 'sys.stdout.flush', 'sys.stdout.flush', ... |
import flowio
import numpy
f = flowio.FlowData('fcs_files/data1.fcs')
n = numpy.reshape(f.events, (-1, f.channel_count))
print(n.shape)
| [
"flowio.FlowData",
"numpy.reshape"
] | [((32, 70), 'flowio.FlowData', 'flowio.FlowData', (['"""fcs_files/data1.fcs"""'], {}), "('fcs_files/data1.fcs')\n", (47, 70), False, 'import flowio\n'), ((75, 121), 'numpy.reshape', 'numpy.reshape', (['f.events', '(-1, f.channel_count)'], {}), '(f.events, (-1, f.channel_count))\n', (88, 121), False, 'import numpy\n')] |
#!/usr/bin/python -*- coding: utf-8 -*-
#
# Merlin - Almost Native Python Machine Learning Library: Gaussian Distribution
#
# Copyright (C) 2014-2015 alvations
# URL:
# For license information, see LICENSE.md
import numpy as np
"""
Class for univariate gaussian
p(x) = 1/sqrt(2*pi*simga^2) * e ^ - (x-miu)^2/2*sigma^2
... | [
"numpy.mean",
"numpy.var",
"numpy.random.normal"
] | [((788, 801), 'numpy.mean', 'np.mean', (['X', '(0)'], {}), '(X, 0)\n', (795, 801), True, 'import numpy as np\n'), ((816, 828), 'numpy.var', 'np.var', (['X', '(0)'], {}), '(X, 0)\n', (822, 828), True, 'import numpy as np\n'), ((554, 604), 'numpy.random.normal', 'np.random.normal', (['self.mean', 'self.variance', 'points... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division
import numpy as np
from .abc import Codec
from .compat import ensure_ndarray, ndarray_copy
class PackBits(Codec):
"""Codec to pack elements of a boolean array into bits in a uint8 array.
Examples
--------
>>>... | [
"numpy.empty",
"numpy.packbits",
"numpy.unpackbits"
] | [((1244, 1284), 'numpy.empty', 'np.empty', (['(n_bytes_packed + 1)'], {'dtype': '"""u1"""'}), "(n_bytes_packed + 1, dtype='u1')\n", (1252, 1284), True, 'import numpy as np\n'), ((1523, 1539), 'numpy.packbits', 'np.packbits', (['arr'], {}), '(arr)\n', (1534, 1539), True, 'import numpy as np\n'), ((1879, 1901), 'numpy.un... |
#!/usr/bin/env python3
import DiagnoseObsStatisticsArgs
import binning_utils as bu
import predefined_configs as pconf
import config as conf
from copy import deepcopy
import diag_utils as du
import fnmatch
import glob
from JediDB import JediDB
from JediDBArgs import obsFKey
import logging
import logsetup
import multip... | [
"JediDB.JediDB",
"var_utils.splitObsVarGrp",
"var_utils.varAttributes",
"predefined_configs.binVarConfigs.get",
"stat_utils.calcStats",
"var_utils.ensSuffix",
"binning_utils.BinMethod",
"numpy.isnan",
"stat_utils.write_stats_nc",
"multiprocessing.Pool",
"logging.getLogger"
] | [((451, 478), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (468, 478), False, 'import logging\n'), ((790, 818), 'logging.getLogger', 'logging.getLogger', (['self.name'], {}), '(self.name)\n', (807, 818), False, 'import logging\n'), ((1892, 1957), 'logging.getLogger', 'logging.getLogger'... |
#!/usr/bin/python
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial.distance import pdist, cdist
class fuzzykmeans(object):
def __init__(self, train_data, K, debug=True):
'''train_data is the the dataset where each row is a sample
and K is the number of clusters that need to be... | [
"matplotlib.pyplot.title",
"scipy.spatial.distance.cdist",
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.random.randn",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.hold",
"numpy.zeros",
"numpy.identity",
"numpy.max",
"numpy.exp",
"numpy.dot",
"numpy.vstack",
"numpy.random.shuffle"
] | [((2511, 2537), 'numpy.vstack', 'np.vstack', (['(CL1, CL2, CL3)'], {}), '((CL1, CL2, CL3))\n', (2520, 2537), True, 'import numpy as np\n'), ((2542, 2562), 'numpy.random.shuffle', 'np.random.shuffle', (['X'], {}), '(X)\n', (2559, 2562), True, 'import numpy as np\n'), ((2586, 2615), 'matplotlib.pyplot.scatter', 'plt.scat... |
import numpy as np
import pytest
import pandas as pd
from pandas.util import testing as tm
def test_error():
df = pd.DataFrame(
{"A": pd.Series([[0, 1, 2], np.nan, [], (3, 4)], index=list("abcd")), "B": 1}
)
with pytest.raises(ValueError):
df.explode(list("AA"))
df.columns = list("AA... | [
"pandas.DataFrame",
"pandas.MultiIndex.from_tuples",
"pandas.util.testing.assert_frame_equal",
"pandas.Index",
"pytest.raises",
"numpy.array"
] | [((754, 793), 'pandas.util.testing.assert_frame_equal', 'tm.assert_frame_equal', (['result', 'expected'], {}), '(result, expected)\n', (775, 793), True, 'from pandas.util import testing as tm\n'), ((1598, 1637), 'pandas.util.testing.assert_frame_equal', 'tm.assert_frame_equal', (['result', 'expected'], {}), '(result, e... |
#!/usr/bin/python3.5
# -*- coding: utf-8 -*-
import sys
import os
import time
import random
import numpy as np
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
from PIL import Image
SIZE = 1280
WIDTH = 32
HEIGHT = 40
NUM_CLASSES = 6
iterations = 300
SAVER_DIR = "train-saver/prov... | [
"os.walk",
"tensorflow.compat.v1.matmul",
"tensorflow.compat.v1.truncated_normal",
"tensorflow.compat.v1.compat.v1.disable_eager_execution",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.placeholder",
"tensorflow.compat.v1.constant",
"os.path.exists",
"tensorflow.compat.... | [((152, 190), 'tensorflow.compat.v1.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (188, 190), True, 'import tensorflow.compat.v1 as tf\n'), ((515, 526), 'time.time', 'time.time', ([], {}), '()\n', (524, 526), False, 'import time\n'), ((573, 619), 'tensorflow.compat.v1.pla... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
class Categorical(object):
def __init__(self, logits):
self.logits = logits
def logp(self, x):
return -tf.nn.sparse_softmax_cross_entropy_with_logits(lo... | [
"tensorflow.reduce_sum",
"tensorflow.square",
"numpy.log",
"tensorflow.multinomial",
"tensorflow.shape",
"tensorflow.exp",
"tensorflow.log",
"tensorflow.reduce_max",
"tensorflow.split",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits"
] | [((469, 479), 'tensorflow.exp', 'tf.exp', (['a0'], {}), '(a0)\n', (475, 479), True, 'import tensorflow as tf\n'), ((489, 546), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['ea0'], {'reduction_indices': '[1]', 'keep_dims': '(True)'}), '(ea0, reduction_indices=[1], keep_dims=True)\n', (502, 546), True, 'import tensorflow ... |
#!/usr/bin/env python3
import numpy as _np
from keras.datasets import mnist as _mnist # also requires tensorflow
def make_MNIST(mnist_fpath):
'''
Save the following data to .npy file:
train_images: np.array[28x28x60000]
test_images: np.array[28x28x10000]
train_labels: np.array[60000x1]
test_labels: np.array... | [
"keras.datasets.mnist.load_data",
"numpy.save"
] | [((754, 772), 'keras.datasets.mnist.load_data', '_mnist.load_data', ([], {}), '()\n', (770, 772), True, 'from keras.datasets import mnist as _mnist\n'), ((912, 940), 'numpy.save', '_np.save', (['mnist_fpath', 'mnist'], {}), '(mnist_fpath, mnist)\n', (920, 940), True, 'import numpy as _np\n')] |
from sklearn.metrics import classification_report, confusion_matrix
import sklearn.ensemble
from sklearn import metrics
from sklearn import svm
from scipy.fftpack import fft
import pickle
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import Ra... | [
"matplotlib.pyplot.title",
"sklearn.model_selection.GridSearchCV",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.cross_val_score",
"myo_sign_language.data_processing.files_processing.process_from_files",
"hpsklearn.knn",
"mlbox.preprocessing.Drift_thresholder",
"numpy.mean",
"... | [((1949, 1975), 'myo_sign_language.data_processing.files_processing.process_from_files', 'process_from_files', (['"""test"""'], {}), "('test')\n", (1967, 1975), False, 'from myo_sign_language.data_processing.files_processing import process_from_files\n'), ((6447, 6486), 'sklearn.model_selection.GridSearchCV', 'GridSear... |
from logs import logDecorator as lD
from lib.odeModels import simpleODE as sOde
import json
import numpy as np
from time import time
from datetime import datetime as dt
import matplotlib.pyplot as plt
from scipy import signal
config = json.load(open('../config/config.json'))
logBase = config['logging']['logBase']... | [
"numpy.set_printoptions",
"numpy.abs",
"numpy.tanh",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"lib.odeModels.simpleODE.simpleODE",
"time.time",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linspace",
"numpy.random.rand",
"scipy.signal.square",
"logs.logDecorator.log",
"dat... | [((2322, 2354), 'logs.logDecorator.log', 'lD.log', (["(logBase + '.doSomething')"], {}), "(logBase + '.doSomething')\n", (2328, 2354), True, 'from logs import logDecorator as lD\n'), ((5465, 5490), 'logs.logDecorator.log', 'lD.log', (["(logBase + '.main')"], {}), "(logBase + '.main')\n", (5471, 5490), True, 'from logs ... |
# stdlib
import argparse
from pathlib import Path
# 3p
from joblib import Parallel, delayed
from tqdm import tqdm
import numpy as np
import scipy.io as sio
from scipy.sparse import csr_matrix
from sklearn import neighbors
from sklearn.utils.graph import graph_shortest_path
import trimesh
import networkx as nx
# project... | [
"trimesh.Trimesh",
"tqdm.tqdm",
"sklearn.utils.graph.graph_shortest_path",
"argparse.ArgumentParser",
"scipy.io.savemat",
"utils.shot.shot.compute",
"joblib.Parallel",
"pathlib.Path",
"numpy.mean",
"scipy.sparse.csr_matrix",
"utils.laplace_decomposition.laplace_decomposition",
"utils.io.read_m... | [((595, 654), 'trimesh.Trimesh', 'trimesh.Trimesh', ([], {'vertices': 'verts', 'faces': 'faces', 'process': '(False)'}), '(vertices=verts, faces=faces, process=False)\n', (610, 654), False, 'import trimesh\n'), ((851, 941), 'sklearn.neighbors.kneighbors_graph', 'neighbors.kneighbors_graph', (['verts'], {'n_neighbors': ... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from collections import OrderedDict
import numpy as np
from random import randint, shuffle, choice
# from random import random ... | [
"torch.ones",
"torch.LongTensor",
"torch.ByteTensor",
"random.shuffle",
"numpy.argsort",
"random.random",
"numpy.array",
"ncc.data.tools.truncate.truncate_seq"
] | [((2536, 2592), 'torch.LongTensor', 'torch.LongTensor', (["[s['segment_labels'] for s in samples]"], {}), "([s['segment_labels'] for s in samples])\n", (2552, 2592), False, 'import torch\n'), ((2934, 2986), 'torch.LongTensor', 'torch.LongTensor', (["[s['masked_ids'] for s in samples]"], {}), "([s['masked_ids'] for s in... |
"""
Задача 4:
Найти в массиве те элементы, значение которых меньше среднего арифметического, взятого от
всех элементов массива.
"""
from random import randint
import numpy as np
def main():
try:
n = int(input("Введите кол-во строк в матрице -> "))
m = int(input("Введите кол-во столбцов в матрице... | [
"numpy.nditer",
"numpy.mean",
"random.randint"
] | [((575, 590), 'numpy.mean', 'np.mean', (['matrix'], {}), '(matrix)\n', (582, 590), True, 'import numpy as np\n'), ((657, 674), 'numpy.nditer', 'np.nditer', (['matrix'], {}), '(matrix)\n', (666, 674), True, 'import numpy as np\n'), ((458, 476), 'random.randint', 'randint', (['(-100)', '(100)'], {}), '(-100, 100)\n', (46... |
import numpy as np
from numbers import Number
from pytest import raises, warns
from hypothesis import given, strategies, unlimited
from hypothesis import settings as hyp_settings
from hypothesis import HealthCheck
from kernelmethods.numeric_kernels import DEFINED_KERNEL_FUNCS, PolyKernel, \
GaussianKernel, LinearK... | [
"kernelmethods.base.KernelMatrix",
"numpy.random.seed",
"kernelmethods.utils.check_callable",
"kernelmethods.operations.is_positive_semidefinite",
"kernelmethods.numeric_kernels.LaplacianKernel",
"kernelmethods.numeric_kernels.SigmoidKernel",
"kernelmethods.numeric_kernels.LinearKernel",
"pytest.raise... | [((723, 741), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (737, 741), True, 'import numpy as np\n'), ((997, 1016), 'numpy.random.rand', 'np.random.rand', (['dim'], {}), '(dim)\n', (1011, 1016), True, 'import numpy as np\n'), ((1175, 1214), 'numpy.random.rand', 'np.random.rand', (['num_samples', 'sa... |
"""
Date: Oct 2018
Author: <NAME>
This is a script that outputs a list of names of samples for training development and test sets.
This list is then used to create batches for training validation and testing.
The speakers / session names in each subset have been hard-coded.
The sample names are listed and in the case... | [
"numpy.random.seed",
"os.makedirs",
"ultrasync.create_experiment_data_utils.split_name",
"os.path.exists",
"random.seed",
"ultrasync.create_experiment_data_utils.get_sync_file_names",
"os.path.join",
"pandas.concat",
"numpy.random.shuffle"
] | [((519, 536), 'random.seed', 'random.seed', (['(2018)'], {}), '(2018)\n', (530, 536), False, 'import random\n'), ((537, 557), 'numpy.random.seed', 'np.random.seed', (['(2018)'], {}), '(2018)\n', (551, 557), True, 'import numpy as np\n'), ((4259, 4284), 'ultrasync.create_experiment_data_utils.get_sync_file_names', 'get_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.