code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
Utility functions for plotting data.
"""
from typing import Optional, Tuple, List
import numpy as np
from typeguard import typechecked
def sptype_substellar(sptype,
shape):
"""
Parameters
----------
sptype :
shape :
Returns
-------
numpy.ndarray
"""
... | [
"numpy.zeros",
"numpy.linspace"
] | [((334, 349), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (342, 349), True, 'import numpy as np\n'), ((1253, 1268), 'numpy.zeros', 'np.zeros', (['shape'], {}), '(shape)\n', (1261, 1268), True, 'import numpy as np\n'), ((13518, 13566), 'numpy.linspace', 'np.linspace', (['index_start', 'index_end', 'index_ra... |
import unittest
from approvaltests import verify
from tests.helpers import verify_numpy_array
import numpy as np
import homlib
class ValtonenOrnhagArxiv2020ATestCase(unittest.TestCase):
def setUp(self):
self.p1 = np.array([
[-0.170344517767220, 0.108864416575805, 0.661903907097742],
... | [
"numpy.testing.assert_almost_equal",
"numpy.asfortranarray",
"numpy.ones",
"numpy.array",
"tests.helpers.verify_numpy_array"
] | [((228, 360), 'numpy.array', 'np.array', (['[[-0.17034451776722, 0.108864416575805, 0.661903907097742], [\n 1.542599674500269, 0.956408496791784, 2.44146481330665]]'], {}), '([[-0.17034451776722, 0.108864416575805, 0.661903907097742], [\n 1.542599674500269, 0.956408496791784, 2.44146481330665]])\n', (236, 360), T... |
#123import pandas as pd
import numpy as np
import pandas as pd
import lightgbm as lgb
from sklearn.preprocessing import LabelEncoder
import datetime
import gc
from bayes_opt import BayesianOptimization
import warnings
warnings.filterwarnings('ignore')
DATA_PATH ='/Users/Lab408/Desktop/try_model_ashrae_energy_predictio... | [
"pandas.DataFrame",
"bayes_opt.BayesianOptimization",
"warnings.filterwarnings",
"pandas.read_csv",
"lightgbm.Dataset",
"pandas.api.types.is_datetime64_any_dtype",
"numpy.setdiff1d",
"lightgbm.cv",
"sklearn.preprocessing.LabelEncoder",
"numpy.iinfo",
"pandas.api.types.is_categorical_dtype",
"g... | [((218, 251), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (241, 251), False, 'import warnings\n'), ((353, 422), 'pandas.read_csv', 'pd.read_csv', (["(DATA_PATH + 'small_data_train_energy.csv')"], {'nrows': '(1000000)'}), "(DATA_PATH + 'small_data_train_energy.csv', nrow... |
"""Tests for graphein.testing.utils"""
# Graphein
# Author: <NAME> <<EMAIL>>
# License: MIT
# Project Website: https://github.com/a-r-j/graphein
# Code Repository: https://github.com/a-r-j/graphein
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from graphein.protein import construct_gr... | [
"pandas.DataFrame",
"graphein.testing.utils.edge_data_equal",
"graphein.testing.utils.edges_equal",
"graphein.testing.utils.compare_exact",
"graphein.testing.utils.node_data_equal",
"pathlib.Path",
"graphein.testing.utils.graphs_equal",
"graphein.testing.utils.graphs_isomorphic",
"numpy.array",
"g... | [((803, 830), 'graphein.testing.utils.graphs_isomorphic', 'graphs_isomorphic', (['G_1', 'G_2'], {}), '(G_1, G_2)\n', (820, 830), False, 'from graphein.testing.utils import compare_approximate, compare_exact, edge_data_equal, edges_equal, graphs_equal, graphs_isomorphic, node_data_equal, nodes_equal\n'), ((872, 894), 'g... |
import ase
from ase.calculators.emt import EMT
from ase.neb import SingleCalculatorNEB
from ase.optimize import BFGS
from ase.io import read
from ase.build import fcc100, add_adsorbate
from ase.constraints import FixAtoms
from ase.neb import NEBTools
import matplotlib.pyplot as plt
import numpy as np
import c... | [
"copy.deepcopy",
"matplotlib.pyplot.show",
"ase.optimize.BFGS",
"finetuna.base_calcs.morse.MultiMorse",
"ase.build.fcc100",
"ase.calculators.emt.EMT",
"amptorch.trainer.AtomsTrainer",
"ase.constraints.FixAtoms",
"numpy.log10",
"torch.set_num_threads",
"ase.io.read",
"ase.neb.NEBTools",
"ase.... | [((5904, 5928), 'torch.set_num_threads', 'torch.set_num_threads', (['(1)'], {}), '(1)\n', (5925, 5928), False, 'import torch\n'), ((5946, 5951), 'ase.calculators.emt.EMT', 'EMT', ([], {}), '()\n', (5949, 5951), False, 'from ase.calculators.emt import EMT\n'), ((7396, 7416), 'amptorch.trainer.AtomsTrainer', 'AtomsTraine... |
#Parts of code in this file have been taken (copied) from https://github.com/ml-jku/lsc
#Copyright (C) 2018 <NAME>
from __future__ import print_function
from __future__ import division
import numpy as np
import scipy
import scipy.sparse
import pandas as pd
import itertools
import pickle
#import imp
import os
import pat... | [
"pynvml.nvmlInit",
"numpy.set_printoptions",
"numpy.abs",
"argparse.ArgumentParser",
"os.makedirs",
"multiprocessing.Array",
"os.getcwd",
"multiprocessing.Manager",
"os.path.exists",
"tensorflow.ConfigProto",
"numpy.max",
"numpy.array",
"pynvml.nvmlDeviceGetMemoryInfo",
"pynvml.nvmlDeviceG... | [((453, 469), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (467, 469), True, 'import tensorflow as tf\n'), ((590, 601), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (599, 601), False, 'import os\n'), ((724, 759), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': '(1000)'}), '(threshold... |
import json
import argparse
import logging
import os
import csv
from multiprocessing import Pool
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import rankdata
from milieu.data.network import Network
from milieu.... | [
"matplotlib.pyplot.title",
"seaborn.lineplot",
"csv.reader",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"milieu.data.associations.load_diseases",
"pandas.DataFrame",
"numpy.cumsum",
"numpy.bincount",
"numpy.stack",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"matplotlib.pypl... | [((850, 879), 'milieu.util.util.prepare_sns', 'prepare_sns', (['sns', 'self.params'], {}), '(sns, self.params)\n', (861, 879), False, 'from milieu.util.util import set_logger, parse_id_rank_pair, prepare_sns\n'), ((888, 916), 'logging.info', 'logging.info', (['"""Recall Curve"""'], {}), "('Recall Curve')\n", (900, 916)... |
"""
Run MCMC on RV curves for all Troup stars.
TODO:
- Write out chain to an HDF5 file
- Preserve initial orbit guess
- If eccentric_anomaly_from_mean_anomaly() raises a warning, return -np.inf?
- Use: https://github.com/dfm/peerless/blob/master/peerless/pool.py for MPI
"""
from __future__ import division, print_func... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"astropy.log.info",
"ebak.singleline.RVData",
"ebak.SimulatedRVOrbit",
"matplotlib.pyplot.style.use",
"numpy.sin",
"numpy.random.normal",
"astropy.log.debug",
"os.path.join",
"astropy.io.fits.getdata",
"os.path.exists",
"numpy.genfromtxt",
"n... | [((753, 782), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""apw-notebook"""'], {}), "('apw-notebook')\n", (766, 782), True, 'import matplotlib.pyplot as plt\n'), ((1087, 1130), 'os.path.join', 'join', (['_basepath', '"""data"""', '"""troup16-dr12.csv"""'], {}), "(_basepath, 'data', 'troup16-dr12.csv')\n", (1091... |
import numpy as np
from typing import Any
import matplotlib.pyplot as plt
import jax
from jax import numpy as jnp, random, lax, profiler
from flax import struct
@struct.dataclass
class ReplayState():
states: jnp.ndarray
actions: jnp.ndarray
next_states: jnp.ndarray
rewards: jnp.ndarray
max_size:... | [
"jax.numpy.zeros",
"numpy.random.randint",
"numpy.zeros",
"numpy.ones"
] | [((1161, 1195), 'numpy.zeros', 'np.zeros', (['(max_size, *state_shape)'], {}), '((max_size, *state_shape))\n', (1169, 1195), True, 'import numpy as np\n'), ((1213, 1248), 'numpy.zeros', 'np.zeros', (['(max_size, *action_shape)'], {}), '((max_size, *action_shape))\n', (1221, 1248), True, 'import numpy as np\n'), ((1267,... |
#
# _ _ _
# (_) | | |
# ___ _ __ ___ _ ____ ___| | __| |
# / _ \| '_ \ / _ \ '_ \ \ /\ / / | |/ _` |
#| (_) | |_) | __/ | | \ V V /| | | (_| |
# \___/| .__/ \___|_| |_|\_/\_/ |_|_|\__,_|
# | |
# |_|... | [
"shumba.audiocore.AudioUtility",
"shumba.audiocore.AudioCombine",
"shumba.audiocore.AudioFile",
"numpy.max",
"shumba.audiocore.AudioStats.calcSS",
"shumba.audiocore.Beamformer"
] | [((2691, 2719), 'shumba.audiocore.Beamformer', 'audiocore.Beamformer', (['logger'], {}), '(logger)\n', (2711, 2719), False, 'from shumba import audiocore\n'), ((3330, 3366), 'shumba.audiocore.AudioStats.calcSS', 'audiocore.AudioStats.calcSS', (['snippet'], {}), '(snippet)\n', (3357, 3366), False, 'from shumba import au... |
import os
import numpy as np
from waymo_open_dataset.protos import metrics_pb2
import tqdm
from collections import defaultdict
from ipdb import set_trace
def read_bin(file_path):
with open(file_path, 'rb') as f:
objects = metrics_pb2.Objects()
objects.ParseFromString(f.read())
return objects
... | [
"numpy.stack",
"tqdm.tqdm",
"numpy.zeros",
"collections.defaultdict",
"waymo_open_dataset.protos.metrics_pb2.Objects"
] | [((1476, 1493), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1487, 1493), False, 'from collections import defaultdict\n'), ((1542, 1560), 'tqdm.tqdm', 'tqdm.tqdm', (['objects'], {}), '(objects)\n', (1551, 1560), False, 'import tqdm\n'), ((235, 256), 'waymo_open_dataset.protos.metrics_pb2.Objec... |
from math import ceil
import numpy as np
class Spectrum(object):
def __init__(self, data, frequencies, kind):
self.data = data
self.frequencies = frequencies
self.kind = kind
def psd_from_mne_epochs(epochs, tmin=0, tmax=np.inf, fmin=0,
fmax=np.inf) -> Spectrum:
... | [
"numpy.fft.rfftfreq",
"numpy.fft.rfft",
"numpy.abs",
"math.ceil"
] | [((931, 987), 'numpy.fft.rfft', 'np.fft.rfft', (['data[..., time_mask]'], {'axis': '(-1)', 'norm': '"""ortho"""'}), "(data[..., time_mask], axis=-1, norm='ortho')\n", (942, 987), True, 'import numpy as np\n'), ((1146, 1161), 'math.ceil', 'ceil', (['(n_fft / 2)'], {}), '(n_fft / 2)\n', (1150, 1161), False, 'from math im... |
from helpers.base_helper import TrainTestHelper, transform_train, transform_test
from utils import get_channels_axis,save_roc_pr_curve_data, show_roc_pr_curve_data
from models.encoders_decoders import CAE_pytorch
from keras2pytorch_dataset import trainset_pytorch
import torch.utils.data as data
import torch
import tor... | [
"misc.AverageMeter",
"utils.show_roc_pr_curve_data",
"torch.cat",
"keras2pytorch_dataset.testset_pytorch",
"numpy.arange",
"torch.nn.Softmax",
"transformations.Rotate4D",
"torch.utils.data.DataLoader",
"models.densenet_pytorch.DenseNet",
"numpy.max",
"torch.Tensor",
"torch.log",
"numpy.repea... | [((877, 894), 'numpy.squeeze', 'np.squeeze', (['score'], {}), '(score)\n', (887, 894), True, 'import numpy as np\n'), ((912, 926), 'numpy.log2', 'np.log2', (['score'], {}), '(score)\n', (919, 926), True, 'import numpy as np\n'), ((3844, 3989), 'keras2pytorch_dataset.trainset_pytorch', 'trainset_pytorch', ([], {'train_d... |
# This file is part of Frhodo. Copyright © 2020, UChicago Argonne, LLC
# and licensed under BSD-3-Clause. See License.txt in the top-level
# directory for license and copyright information.
import numpy as np
import cantera as ct
import warnings
from scipy.optimize import curve_fit, OptimizeWarning, approx_fprime
fro... | [
"numpy.reciprocal",
"numpy.isnan",
"numpy.mean",
"numpy.exp",
"numpy.zeros_like",
"warnings.simplefilter",
"numpy.copy",
"numpy.finfo",
"numpy.append",
"warnings.catch_warnings",
"numpy.linspace",
"numpy.log10",
"numpy.divide",
"matplotlib.pyplot.show",
"numpy.ones_like",
"scipy.optimi... | [((1463, 1476), 'numpy.log', 'np.log', (['rates'], {}), '(rates)\n', (1469, 1476), True, 'import numpy as np\n'), ((5920, 5939), 'numpy.divide', 'np.divide', (['(10000)', 'T'], {}), '(10000, T)\n', (5929, 5939), True, 'import numpy as np\n'), ((5951, 5966), 'numpy.log10', 'np.log10', (['rates'], {}), '(rates)\n', (5959... |
import numpy as np
from collections import Counter
def get_data_from_file(train_file, batch_size, seq_size):
with open(train_file, encoding='utf-8') as f:
text = f.read()
text = text.split()
word_counts = Counter(text)
sorted_vocab = sorted(word_counts, key=word_counts.get, reverse=True)
... | [
"collections.Counter",
"numpy.zeros_like",
"numpy.reshape",
"numpy.prod"
] | [((228, 241), 'collections.Counter', 'Counter', (['text'], {}), '(text)\n', (235, 241), False, 'from collections import Counter\n'), ((657, 679), 'numpy.zeros_like', 'np.zeros_like', (['in_text'], {}), '(in_text)\n', (670, 679), True, 'import numpy as np\n'), ((756, 793), 'numpy.reshape', 'np.reshape', (['in_text', '(b... |
# For doing math
import numpy as np
# For plotting
import matplotlib.pyplot as plt
import seaborn
# Define our diffusion constant.
D = 10 # in square microns per second
# Generate an array of lengths.
L = np.logspace(-3, 6, 500)
# Determine the diffusion time.
time = L**2 / (2 * D)
plt.figure()
plt.loglog(L, time... | [
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.show",
"numpy.logspace",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((209, 232), 'numpy.logspace', 'np.logspace', (['(-3)', '(6)', '(500)'], {}), '(-3, 6, 500)\n', (220, 232), True, 'import numpy as np\n'), ((289, 301), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (299, 301), True, 'import matplotlib.pyplot as plt\n'), ((302, 321), 'matplotlib.pyplot.loglog', 'plt.loglo... |
#!/usr/bin/env python3
import numpy as np
import pytest
from sklearn.neighbors import NearestNeighbors
import deann
import sys
from extern.brute import BruteNN
from extern.faiss import FaissIVF
import time
def gaussian_kernel(q,X,h):
return np.exp(-np.sum((q[None,:]-X)**2,axis=1)/h/h/2)
def exponenti... | [
"numpy.abs",
"numpy.sum",
"numpy.allclose",
"numpy.ones",
"numpy.random.default_rng",
"numpy.arange",
"deann.NaiveKde",
"numpy.linalg.norm",
"numpy.exp",
"deann.AnnEstimatorPermuted",
"pytest.raises",
"extern.brute.BruteNN",
"deann.RandomSampling",
"deann.LinearScan",
"deann.RandomSampli... | [((769, 966), 'numpy.array', 'np.array', (['[46.49246863044118, -0.47588088931695965, 85.96002889477487, \n 0.16082082564143724, 41.49583968750836, 0.9723626829333547, \n 39.45937341145624, 44.44947427562405, 5.157770821628274]'], {}), '([46.49246863044118, -0.47588088931695965, 85.96002889477487, \n 0.1608208... |
import numpy as np
import openpyxl
import pandas as pd
from ortoolpy import addbinvars, addvars
from pulp import LpProblem, lpSum, value, lpDot
from make_data import FILE_NAME, GROUP_COUNT, USER_COUNT
RESULT_FILE = 'result_optimization.xlsx'
def divide_users():
# デフォルトだと 54 x 54 で読まれるので、不要行は読み込まないようにする
skip... | [
"pulp.lpSum",
"ortoolpy.addbinvars",
"pandas.DataFrame",
"numpy.vectorize",
"ortoolpy.addvars",
"openpyxl.Workbook",
"pandas.read_excel",
"pandas.Series",
"pulp.LpProblem",
"pulp.lpDot"
] | [((403, 470), 'pandas.read_excel', 'pd.read_excel', (['FILE_NAME'], {'header': '(0)', 'index_col': '(0)', 'skiprows': 'skip_rows'}), '(FILE_NAME, header=0, index_col=0, skiprows=skip_rows)\n', (416, 470), True, 'import pandas as pd\n'), ((725, 736), 'pulp.LpProblem', 'LpProblem', ([], {}), '()\n', (734, 736), False, 'f... |
# -*- coding: utf-8 -*-
"""
@author: efourrier
Purpose : Create toolbox functions to use for the different pieces of code ot the package
"""
import warnings
from numpy.random import normal
from numpy.random import choice
import time
import pandas as pd
import numpy as np
def removena_numpy(array):
return arra... | [
"pandas.DataFrame",
"io.StringIO",
"numpy.log",
"numpy.isnan",
"time.time",
"numpy.percentile",
"requests.get",
"numpy.random.choice",
"numpy.random.normal",
"numpy.unique"
] | [((1111, 1164), 'numpy.percentile', 'np.percentile', (['bootstrap_samples', '[low_per, high_per]'], {}), '(bootstrap_samples, [low_per, high_per])\n', (1124, 1164), True, 'import numpy as np\n'), ((2675, 2692), 'numpy.random.normal', 'normal', ([], {'size': '(1000)'}), '(size=1000)\n', (2681, 2692), False, 'from numpy.... |
import cPickle as pk
import numpy
import numpy as np
from sklearn.preprocessing import normalize, MinMaxScaler
import theano
import theano.tensor as T
def load_data(rand_seed=1235):
#############
# LOAD DATA #
#############
f = open('Mark_features_dic_all.pkl')
Mark_features_dic = pk.load(f)
f... | [
"numpy.random.permutation",
"numpy.random.seed",
"numpy.array",
"cPickle.load"
] | [((304, 314), 'cPickle.load', 'pk.load', (['f'], {}), '(f)\n', (311, 314), True, 'import cPickle as pk\n'), ((400, 410), 'cPickle.load', 'pk.load', (['f'], {}), '(f)\n', (407, 410), True, 'import cPickle as pk\n'), ((652, 671), 'numpy.array', 'np.array', (['(X_p + X_n)'], {}), '(X_p + X_n)\n', (660, 671), True, 'import... |
import dohlee.plot as plot; plot.set_style()
import itertools
import tempfile
import numpy as np
import pandas as pd
import seaborn as sns
from collections import Counter
from functools import wraps
from nose.tools import with_setup, raises
from matplotlib.testing.compare import compare_images
def ima... | [
"dohlee.plot.linear_regression",
"numpy.random.randint",
"dohlee.plot.get_axis",
"pandas.DataFrame",
"dohlee.plot.tsne",
"dohlee.plot.pca",
"dohlee.plot.dimensionality_reduction",
"dohlee.plot.stacked_bar_chart",
"numpy.linspace",
"dohlee.plot.save",
"itertools.product",
"collections.Counter",... | [((28, 44), 'dohlee.plot.set_style', 'plot.set_style', ([], {}), '()\n', (42, 44), True, 'import dohlee.plot as plot\n'), ((1197, 1242), 'nose.tools.with_setup', 'with_setup', (['setup_function', 'teardown_function'], {}), '(setup_function, teardown_function)\n', (1207, 1242), False, 'from nose.tools import with_setup,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 24 00:34:49 2021
@author: rachel
"""
import numpy as np
import os
import shutil
import matplotlib.pyplot as plt
import math
import pandas as pd
from extentForPlot import *
from scipy.io import loadmat
import seaborn as sns
from posPred2cPosPred imp... | [
"os.mkdir",
"numpy.load",
"scipy.io.loadmat",
"numpy.empty",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.arange",
"shutil.rmtree",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.path.exists",
"matplotlib.pyplot.colorbar",
"numpy.append",
"pandas.ExcelWriter",
"numpy.size",
"ma... | [((1054, 1081), 'numpy.load', 'np.load', (['self.parameterpath'], {}), '(self.parameterpath)\n', (1061, 1081), True, 'import numpy as np\n'), ((1926, 1948), 'matplotlib.pyplot.cm.get_cmap', 'plt.cm.get_cmap', (['"""jet"""'], {}), "('jet')\n", (1941, 1948), True, 'import matplotlib.pyplot as plt\n'), ((2046, 2075), 'os.... |
import numpy as np
import modulosudoku as msdk
archivo = input ("nombre de archivo a abrir? ")
matriz = np.loadtxt(archivo)
msdk.mostrarSudoku(matriz)
matSol = (np.ones((9,9,9)) * (-10))
for pag in range(9):
for ren in range(9):
for col in range(9):
if matriz[ren,col] == pag+1:
... | [
"numpy.ones",
"modulosudoku.mostrarSudoku",
"numpy.loadtxt"
] | [((105, 124), 'numpy.loadtxt', 'np.loadtxt', (['archivo'], {}), '(archivo)\n', (115, 124), True, 'import numpy as np\n'), ((126, 152), 'modulosudoku.mostrarSudoku', 'msdk.mostrarSudoku', (['matriz'], {}), '(matriz)\n', (144, 152), True, 'import modulosudoku as msdk\n'), ((164, 182), 'numpy.ones', 'np.ones', (['(9, 9, 9... |
# Perform linear regression and print performance.
# Correlation between the number of rooms and the price of the house.
#
# Ref. https://medium.com/@amitg0161/sklearn-linear-regression-tutorial-with-boston-house-dataset-cde74afd460a
import numpy as np
import pandas as pd
from sklearn.datasets import load_boston
bost... | [
"pandas.DataFrame",
"sklearn.model_selection.train_test_split",
"sklearn.linear_model.LinearRegression",
"sklearn.datasets.load_boston",
"numpy.array",
"sklearn.metrics.mean_squared_error"
] | [((333, 346), 'sklearn.datasets.load_boston', 'load_boston', ([], {}), '()\n', (344, 346), False, 'from sklearn.datasets import load_boston\n'), ((359, 430), 'pandas.DataFrame', 'pd.DataFrame', (['boston_housing.data'], {'columns': 'boston_housing.feature_names'}), '(boston_housing.data, columns=boston_housing.feature_... |
# compute and display R2 statistics about how the underlying WHM is doing against historical actuals
# mixin with the WHM of your choice
from Constants import * # GEO_x and POLITY_x
from WHM import *
whm = None # package global
import numpy as np
import copy
from Utils import *
# Control whether we compute and track R... | [
"numpy.sum",
"numpy.zeros",
"copy.copy",
"numpy.where",
"numpy.array",
"numpy.mean"
] | [((5422, 5467), 'numpy.zeros', 'np.zeros', (['self.geography.n_regions'], {'dtype': 'int'}), '(self.geography.n_regions, dtype=int)\n', (5430, 5467), True, 'import numpy as np\n'), ((5850, 5897), 'numpy.zeros', 'np.zeros', (['self.geography.n_regions'], {'dtype': 'float'}), '(self.geography.n_regions, dtype=float)\n', ... |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import numpy as np
from ginga.gw import Widgets
from .base import Stage
class ChannelMixer(Stage):
_stagename = 'channel-mixer'
def __init__(self):
super(ChannelMixer, self).__init__()
... | [
"numpy.sum",
"numpy.copy",
"ginga.gw.Widgets.GridBox",
"ginga.gw.Widgets.Label",
"ginga.gw.Widgets.VBox",
"numpy.array",
"ginga.gw.Widgets.SpinBox",
"ginga.gw.Widgets.Toolbar",
"ginga.gw.Widgets.Frame"
] | [((400, 434), 'numpy.array', 'np.array', (['[0.2126, 0.7152, 0.0722]'], {}), '([0.2126, 0.7152, 0.0722])\n', (408, 434), True, 'import numpy as np\n'), ((454, 471), 'numpy.copy', 'np.copy', (['self.std'], {}), '(self.std)\n', (461, 471), True, 'import numpy as np\n'), ((522, 552), 'ginga.gw.Widgets.Frame', 'Widgets.Fra... |
import numpy as np
from math import degrees
from numpy.linalg import eig, inv
#### ADAPTED FROM
#### http://nicky.vanforeest.com/misc/fitEllipse/fitEllipse.html
def fit_ellipse_get_coeffs(x,y):
x = x[:, np.newaxis]
y = y[:, np.newaxis]
D = np.hstack((x * x, x * y, y * y, x, y, np.ones_like(x)))
S = n... | [
"numpy.abs",
"numpy.ones_like",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.dot",
"numpy.arctan",
"numpy.sqrt"
] | [((319, 333), 'numpy.dot', 'np.dot', (['D.T', 'D'], {}), '(D.T, D)\n', (325, 333), True, 'import numpy as np\n'), ((342, 358), 'numpy.zeros', 'np.zeros', (['[6, 6]'], {}), '([6, 6])\n', (350, 358), True, 'import numpy as np\n'), ((680, 694), 'numpy.dot', 'np.dot', (['D.T', 'D'], {}), '(D.T, D)\n', (686, 694), True, 'im... |
import numpy as np
from globalemu.eval import evaluate
from globalemu.downloads import download
import os
import shutil
import pytest
params = [0.25, 30, 2, 0.056, 1.3, 2, 30]
originalz = np.linspace(10, 20, 100)
def test_existing_dir():
if os.path.exists('T_release/'):
shutil.rmtree('T_release/')
if... | [
"numpy.random.uniform",
"os.path.exists",
"pytest.raises",
"globalemu.eval.evaluate",
"numpy.array",
"numpy.loadtxt",
"numpy.linspace",
"globalemu.downloads.download",
"shutil.rmtree"
] | [((189, 213), 'numpy.linspace', 'np.linspace', (['(10)', '(20)', '(100)'], {}), '(10, 20, 100)\n', (200, 213), True, 'import numpy as np\n'), ((248, 276), 'os.path.exists', 'os.path.exists', (['"""T_release/"""'], {}), "('T_release/')\n", (262, 276), False, 'import os\n'), ((321, 351), 'os.path.exists', 'os.path.exists... |
from datetime import datetime
import math
from time import perf_counter
import numpy as np
import pyspark.sql.functions as F
from pyspark.sql.types import FloatType, ArrayType, StructType, StructField, StringType, TimestampType
import ephem
from sgp4.api import Satrec
from sgp4.api import SGP4_ERRORS
from sgp4.conv... | [
"pyspark.sql.types.StringType",
"pyspark.sql.functions.collect_list",
"pyspark.sql.functions.rand",
"ephem.readtle",
"sgp4.api.Satrec.twoline2rv",
"pyspark.sql.functions.explode",
"astropy.time.Time",
"time.perf_counter",
"pyspark.sql.types.StructField",
"pyspark.sql.types.FloatType",
"sgp4.conv... | [((2082, 2110), 'pyspark.sql.functions.udf', 'F.udf', (['find_lat_long', 'schema'], {}), '(find_lat_long, schema)\n', (2087, 2110), True, 'import pyspark.sql.functions as F\n'), ((7391, 7429), 'pyspark.sql.functions.udf', 'F.udf', (['find_orbital_parameters', 'schema'], {}), '(find_orbital_parameters, schema)\n', (7396... |
import healpy as hp
import numpy as np
from lssutils import CurrentMPIComm
from lssutils.utils import make_overdensity, KMeansJackknifes
__all__ = ['AnaFast', 'get_cl']
def gauleg(ndeg, a=-1.0, b=1.0):
'''
Gauss-Legendre (default interval is [-1, 1])
'''
x, w = np.polynomial.legendre.leggauss(... | [
"numpy.polynomial.legendre.leggauss",
"healpy.get_nside",
"numpy.minimum",
"numpy.zeros_like",
"numpy.polynomial.Legendre.basis",
"numpy.std",
"numpy.allclose",
"numpy.logical_not",
"healpy.nside2pixarea",
"healpy.ma",
"numpy.mean",
"numpy.arange",
"numpy.array",
"numpy.polynomial.legendre... | [((288, 325), 'numpy.polynomial.legendre.leggauss', 'np.polynomial.legendre.leggauss', (['ndeg'], {}), '(ndeg)\n', (319, 325), True, 'import numpy as np\n'), ((837, 857), 'numpy.arange', 'np.arange', (['cell.size'], {}), '(cell.size)\n', (846, 857), True, 'import numpy as np\n'), ((907, 968), 'numpy.polynomial.legendre... |
#%%
import numpy as np
import pandas as pd
from datetime import datetime
import xarray as xr
#%%
def read_netCDF(input_file:str,verbose:bool=False)->np.array:
data_input=xr.open_dataset(input_file)
if verbose:
print(f"Experiment date:\t{datetime.strptime(data_input.experiment_date_time_stamp,'%Y%m%d%H... | [
"numpy.ceil",
"xarray.open_dataset",
"numpy.split",
"datetime.datetime.strptime",
"numpy.array"
] | [((176, 203), 'xarray.open_dataset', 'xr.open_dataset', (['input_file'], {}), '(input_file)\n', (191, 203), True, 'import xarray as xr\n'), ((795, 838), 'numpy.array', 'np.array', (["data_input['mass_values'][:].data"], {}), "(data_input['mass_values'][:].data)\n", (803, 838), True, 'import numpy as np\n'), ((859, 907)... |
import numpy as np
import cv2
image = np.zeros((400, 600, 3), np.uint8)
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(image, 'Text on image', (50, 200), font, 2, (255, 255, 255), 2)
cv2.imshow('Text', image)
cv2.waitKey(0) | [
"cv2.putText",
"cv2.imshow",
"numpy.zeros",
"cv2.waitKey"
] | [((39, 72), 'numpy.zeros', 'np.zeros', (['(400, 600, 3)', 'np.uint8'], {}), '((400, 600, 3), np.uint8)\n', (47, 72), True, 'import numpy as np\n'), ((105, 180), 'cv2.putText', 'cv2.putText', (['image', '"""Text on image"""', '(50, 200)', 'font', '(2)', '(255, 255, 255)', '(2)'], {}), "(image, 'Text on image', (50, 200)... |
from mujoco_py import load_model_from_path, MjSim, MjViewer
import numpy as np
import os
from gym import spaces
import time
class inverted_pendulum_env():
"""
Inverted pendulum environment
"""
def __init__(self) -> None:
model_path = os.path.dirname(__file__)+"/inverted_pendulum.xml"
... | [
"mujoco_py.MjSim",
"numpy.zeros_like",
"mujoco_py.load_model_from_path",
"os.path.dirname",
"gym.spaces.Box",
"mujoco_py.MjViewer"
] | [((335, 367), 'mujoco_py.load_model_from_path', 'load_model_from_path', (['model_path'], {}), '(model_path)\n', (355, 367), False, 'from mujoco_py import load_model_from_path, MjSim, MjViewer\n'), ((387, 404), 'mujoco_py.MjSim', 'MjSim', (['self.model'], {}), '(self.model)\n', (392, 404), False, 'from mujoco_py import ... |
class mufitplot(object):
'''
plotfit class
produces the fitplot
multiple runs sequential produce anim
'''
# a bit of discussion to be removed when done
# plot needs to access a version of mumodel,
# with different ranges for rebinned data,
# denser function plot, original data
# mumodel() is need... | [
"mujpy.aux.aux.int2_method_key",
"mujpy.aux.aux.rebin",
"json.load",
"mujpy.aux.aux.int2min",
"mujpy.mucomponents.mucomponents.mumodel",
"mujpy.aux.aux.mixer",
"mujpy.aux.aux.get_title",
"numpy.ones",
"mujpy.aux.aux.int2min_multigroup",
"mujpy.aux.aux.derange",
"mujpy.aux.aux.userpars",
"mujpy... | [((6365, 6403), 'mujpy.aux.aux.int2min', 'int2min', (['self.dashboard[0][self.model]'], {}), '(self.dashboard[0][self.model])\n', (6372, 6403), False, 'from mujpy.aux.aux import int2min, mixer\n'), ((7585, 7617), 'mujpy.aux.aux.int2min_multigroup', 'int2min_multigroup', (['userpardicts'], {}), '(userpardicts)\n', (7603... |
import cv2
import os
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten,BatchNormalization
import time
import numpy as np
import matplotlib.pyplot as plt
import random
from keras.preprocessing.image import ImageDataGenerator
nrClasses = 0
current_ind =... | [
"matplotlib.pyplot.title",
"keras.preprocessing.image.ImageDataGenerator",
"os.walk",
"matplotlib.pyplot.figure",
"os.chdir",
"cv2.cvtColor",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"numpy.random.shuffle",
"cv2.resize",
"matplotlib.pyplot.show",
"cv2.waitKey",
"keras.layers.Drop... | [((422, 435), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (429, 435), False, 'import os\n'), ((886, 898), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (896, 898), False, 'from keras.models import Sequential\n'), ((3145, 3172), 'numpy.random.shuffle', 'np.random.shuffle', (['fileList'], {}), '(fileLi... |
import numpy as np
import xarray as xr
from starfish import DecodedIntensityTable, IntensityTable
from starfish.core.codebook.test.factories import codebook_array_factory, loaded_codebook
from starfish.core.types import Coordinates, Features
from ..overlap import Area
def synthetic_intensity_table() -> IntensityTabl... | [
"starfish.DecodedIntensityTable.from_intensity_table",
"starfish.IntensityTable.synthetic_intensities",
"starfish.DecodedIntensityTable",
"numpy.linspace",
"numpy.random.choice",
"numpy.random.rand",
"starfish.core.codebook.test.factories.loaded_codebook",
"starfish.core.codebook.test.factories.codebo... | [((1368, 1568), 'starfish.IntensityTable.synthetic_intensities', 'IntensityTable.synthetic_intensities', (['codebook'], {'num_z': 'num_z', 'height': 'height', 'width': 'width', 'n_spots': 'n_spots', 'mean_fluor_per_spot': 'mean_fluor_per_spot', 'mean_photons_per_fluor': 'mean_photons_per_fluor'}), '(codebook, num_z=num... |
"""
Model: Sequential
"""
import os
import numpy as np
from keras import models, layers, losses, metrics
class Model:
"""
Model: NN with FC Layers
Methods:
build - model architecture
train - model training
evaluate - model evaluation
save - h... | [
"keras.models.load_model",
"os.path.dirname",
"keras.models.Model",
"numpy.where",
"keras.layers.Dense",
"keras.layers.Input",
"os.path.join"
] | [((738, 766), 'keras.layers.Input', 'layers.Input', ([], {'shape': '(10000,)'}), '(shape=(10000,))\n', (750, 766), False, 'from keras import models, layers, losses, metrics\n'), ((955, 997), 'keras.models.Model', 'models.Model', ([], {'inputs': 'input', 'outputs': 'output'}), '(inputs=input, outputs=output)\n', (967, 9... |
"""goldhunt
This module contais the code for the 'Gold Hunt' scenario set up to understand
different ways to approach a performance problem and how to optimze it.
This module is written with Python 3.8.x
"""
import sys
import time
import itertools
import multiprocessing
import numpy as np
if sys.version_info < (3, 0... | [
"numpy.dstack",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.einsum",
"time.perf_counter",
"matplotlib.pyplot.axis",
"numpy.array",
"multiprocessing.Pool",
"itertools.chain",
"sys.exit"
] | [((539, 550), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (547, 550), False, 'import sys\n'), ((921, 977), 'matplotlib.pyplot.plot', 'plt.plot', (['x_coords', 'y_coords', '"""."""'], {'color': '"""#A67C00"""', 'ms': '(4)'}), "(x_coords, y_coords, '.', color='#A67C00', ms=4)\n", (929, 977), True, 'import matplotlib.... |
from tensorflow import keras
from keras.layers import Input, Lambda, Dense, Flatten
from keras.models import Model
from keras.applications.vgg16 import VGG16 # import more model as per use
from keras.models import Sequential
import numpy as np
import tensorflow._api.v2.compat.v1 as tf
tf.disable_v2_behavior()
import ss... | [
"tensorflow._api.v2.compat.v1.disable_v2_behavior",
"tensorflow.keras.optimizers.SGD",
"keras.layers.Flatten",
"keras.models.Model",
"numpy.mean",
"keras.layers.Dense",
"tensorflow.keras.optimizers.Adam",
"numpy.array",
"keras.applications.vgg16.VGG16",
"tensorflow.keras.optimizers.RMSprop"
] | [((286, 310), 'tensorflow._api.v2.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (308, 310), True, 'import tensorflow._api.v2.compat.v1 as tf\n'), ((1139, 1191), 'keras.models.Model', 'Model', ([], {'inputs': 'architecture.input', 'outputs': 'prediction'}), '(inputs=architecture.input, outp... |
from __future__ import absolute_import, division, print_function
import os
import logging
import random
import numpy as np
import torch
from torch.utils.data import (DataLoader, RandomSampler, Subset)
from tqdm.auto import tqdm
from tqdm import tqdm
from sklearn.metrics import r2_score
""" from learn_with_meta_... | [
"tqdm.tqdm",
"torch.utils.data.DataLoader",
"sklearn.metrics.r2_score",
"logging.info",
"numpy.array",
"torch.device",
"torch.no_grad",
"logging.getLogger"
] | [((382, 409), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (399, 409), False, 'import logging\n'), ((844, 906), 'torch.utils.data.DataLoader', 'DataLoader', (['eval_dataset'], {'shuffle': '(False)', 'batch_size': 'batch_size'}), '(eval_dataset, shuffle=False, batch_size=batch_size)\n', ... |
import librosa
import numpy as np
class Audio:
"""Performs audio processing such as generating mel specs and normalization."""
def __init__(self,
n_mels: int,
sample_rate: int,
hop_length: int,
win_length: int,
n_filters... | [
"numpy.log",
"numpy.clip",
"librosa.load",
"numpy.exp",
"librosa.feature.melspectrogram"
] | [((663, 702), 'librosa.load', 'librosa.load', (['path'], {'sr': 'self.sample_rate'}), '(path, sr=self.sample_rate)\n', (675, 702), False, 'import librosa\n'), ((770, 966), 'librosa.feature.melspectrogram', 'librosa.feature.melspectrogram', ([], {'y': 'y', 'sr': 'self.sample_rate', 'n_fft': 'self.n_filters', 'n_mels': '... |
#!/usr/bin/env python
import sys, argparse
import os, os.path
import numpy as np
import prmf
from sklearn import decomposition
from sklearn.preprocessing import quantile_transform
import csv
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.model_selection import KFold
def main():
... | [
"sklearn.decomposition.NMF",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.savetxt",
"sklearn.preprocessing.quantile_transform",
"numpy.mean",
"prmf.measure_cv_performance",
"os.path.join"
] | [((330, 797), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\nRun traditional NMF:\n min_{U,V > 0} || X - UV^T ||_F\n\nwhere X has shape (n_obs, n_feature)\n U has shape (n_obs, n_latent)\n V has shape (n_feature, n_latent)\n\nWrites U.csv with the U matrix including row and column n... |
'''
Contains helper functions used to create chart. The plots created are stored in ../output directory.
'''
import numpy as np
import pandas as pd
import plotly
import seaborn as sns
from matplotlib import pyplot as plt
def show_var(btap_data_df: pd.DataFrame) -> None:
num_vars = list(btap_data_df.select_dtypes... | [
"matplotlib.pyplot.title",
"seaborn.heatmap",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.hist",
"numpy.std",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.style.use",
"numpy.mean",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig... | [((445, 492), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""../output/numerical_val_plot.png"""'], {}), "('../output/numerical_val_plot.png')\n", (456, 492), True, 'from matplotlib import pyplot as plt\n'), ((560, 588), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n',... |
#!/usr/bin/env python
from future import standard_library
standard_library.install_aliases()
from builtins import range
import unittest, os, time
import os.path
from math import pi, sqrt
import tempfile
from anuga.file.netcdf import NetCDFFile
from anuga.file.sww import extent_sww
from anuga.config import g, epsilon... | [
"pickle.dump",
"os.remove",
"unittest.TextTestRunner",
"future.standard_library.install_aliases",
"numpy.allclose",
"unittest.makeSuite",
"anuga.shallow_water.boundaries.Reflective_boundary",
"anuga.coordinate_transforms.geo_reference.Geo_reference",
"anuga.abstract_2d_finite_volumes.mesh_factory.re... | [((59, 93), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (91, 93), False, 'from future import standard_library\n'), ((2662, 2678), 'numpy.array', 'num.array', (['point'], {}), '(point)\n', (2671, 2678), True, 'import numpy as num\n'), ((7479, 7520), 'unittest.makeSuit... |
import re
import collections
import operator
import numpy as np
import scipy.sparse as sp
from .osutils import get_linewise
# some helper functions for easy access to the libsvmformat
#
# <label> <index1>:<value1> <index2>:<value2> ... <indexn>:<valuen> # comment
#
def create_libsvmline(label, features, comment=No... | [
"scipy.sparse.csr_matrix",
"numpy.array",
"operator.itemgetter",
"re.compile"
] | [((2219, 2254), 'scipy.sparse.csr_matrix', 'sp.csr_matrix', (['(vals, (rows, cols))'], {}), '((vals, (rows, cols)))\n', (2232, 2254), True, 'import scipy.sparse as sp\n'), ((2291, 2312), 'numpy.array', 'np.array', (['labels', '"""i"""'], {}), "(labels, 'i')\n", (2299, 2312), True, 'import numpy as np\n'), ((2850, 2876)... |
"""
Particular class of large traffic grid
@author: <NAME>
"""
import os, sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
import configparser
import logging
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import time
from envs.env import PhaseMap, PhaseSet, Tr... | [
"os.mkdir",
"logging.basicConfig",
"matplotlib.pyplot.plot",
"large_grid.data.build_file.gen_rou_file",
"seaborn.set_color_codes",
"os.path.dirname",
"os.path.exists",
"time.sleep",
"numpy.sort",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"configparser.ConfigParse... | [((388, 409), 'seaborn.set_color_codes', 'sns.set_color_codes', ([], {}), '()\n', (407, 409), True, 'import seaborn as sns\n'), ((13588, 13598), 'numpy.sort', 'np.sort', (['X'], {}), '(X)\n', (13595, 13598), True, 'import numpy as np\n'), ((13669, 13719), 'matplotlib.pyplot.plot', 'plt.plot', (['sorted_data', 'yvals'],... |
import numpy as np
import sys
import os
class PlotConvergence:
def __init__(self):
self.wspace = 0.45
self.hspace = 0.0
self.figsize = 3, 2
self.figsize_sto = 6, 2
self.legend_bbox_to_anchor = (0.075, 1.0)
self.legend_ncols = 2
self.ylim = None
self.... | [
"seaborn.set_style",
"os.path.abspath",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"os.path.join",
"matplotlib.pyplot.legend",
"numpy.log10",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.subplots_adjust",
"seaborn.set_palette",
"seaborn.s... | [((636, 649), 'seaborn.set', 'seaborn.set', ([], {}), '()\n', (647, 649), False, 'import seaborn\n'), ((658, 688), 'seaborn.set_style', 'seaborn.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (675, 688), False, 'import seaborn\n'), ((697, 723), 'seaborn.set_style', 'seaborn.set_style', (['"""ticks"""'], {}),... |
#!/usr/bin/env python
# This script will run the mdig simulations without using GRASS-GIS.
# <NAME>
# Bio-Protection Research Centre, Lincoln University, NZ
# March 2016
import random
import math
import numpy
import glob, os
import shutil
import multiprocessing
from time import time as now
import numba
import iterto... | [
"numpy.sum",
"numpy.exp",
"numpy.random.random_integers",
"numpy.zeros_like",
"numpy.savetxt",
"os.path.exists",
"numpy.logical_not",
"time.clock",
"numpy.random.standard_cauchy",
"itertools.product",
"numpy.random.binomial",
"math.sqrt",
"multiprocessing.Pool",
"numpy.random.uniform",
"... | [((10074, 10086), 'time.clock', 'time.clock', ([], {}), '()\n', (10084, 10086), False, 'import time\n'), ((10095, 10106), 'time.time', 'time.time', ([], {}), '()\n', (10104, 10106), False, 'import time\n'), ((6619, 6643), 'numpy.zeros', 'numpy.zeros', (['[w, h]', 'int'], {}), '([w, h], int)\n', (6630, 6643), False, 'im... |
import numpy as np
import math
import tempfile
import numba as nb
import pickle, gzip
import os
''' Important functions which can be used throughout the package '''
def num2vect(num,node_num):
'''Converts a binary number into Vector.'''
string = format(num, 'b').zfill(node_num)
arr = np.fromiter(string, ... | [
"tempfile.NamedTemporaryFile",
"pickle.dump",
"numpy.count_nonzero",
"numpy.multiply",
"numpy.copy",
"numpy.where",
"numpy.array",
"numba.jit",
"pickle.load",
"numpy.fromiter",
"math.log",
"numpy.memmap.__new__"
] | [((691, 751), 'numba.jit', 'nb.jit', ([], {'nopython': '(True)', 'cache': '(True)', 'nogil': '(True)', 'fastmath': '(True)'}), '(nopython=True, cache=True, nogil=True, fastmath=True)\n', (697, 751), True, 'import numba as nb\n'), ((2188, 2248), 'numba.jit', 'nb.jit', ([], {'nopython': '(True)', 'cache': '(True)', 'nogi... |
import numpy as np
from autolens.data.array import grids
class MockSubGrid(np.ndarray):
def __new__(cls, sub_grid, *args, **kwargs):
return sub_grid.view(cls)
def __init__(self, sub_grid, sub_to_regular, sub_grid_size):
# noinspection PyArgumentList
super().__init__()
self.s... | [
"numpy.array",
"autolens.data.array.grids.PixGrid",
"autolens.data.array.grids.RegularGrid"
] | [((750, 787), 'autolens.data.array.grids.RegularGrid', 'grids.RegularGrid', (['regular'], {'mask': 'None'}), '(regular, mask=None)\n', (767, 787), False, 'from autolens.data.array import grids\n'), ((835, 873), 'autolens.data.array.grids.RegularGrid', 'grids.RegularGrid', (['blurring'], {'mask': 'None'}), '(blurring, m... |
import json
import numpy as np
def save_data(data, filename, convert=False):
if convert:
if type(data) == np.ndarray:
data = data.tolist()
with open(filename, 'w') as f:
json.dump(data, f)
print(f"Saving the data as {filename}")
def load_data(filename, convert=False):
... | [
"json.dump",
"json.load",
"numpy.array"
] | [((210, 228), 'json.dump', 'json.dump', (['data', 'f'], {}), '(data, f)\n', (219, 228), False, 'import json\n'), ((367, 379), 'json.load', 'json.load', (['f'], {}), '(f)\n', (376, 379), False, 'import json\n'), ((447, 461), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (455, 461), True, 'import numpy as np\n')... |
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | [
"unittest.main",
"textwrap.dedent",
"numpy.datetime64",
"unittest.mock.Mock",
"unittest.mock.patch",
"qf_lib.data_providers.bloomberg_beap_hapi.bloomberg_beap_hapi_parser.BloombergBeapHapiParser"
] | [((1106, 1198), 'unittest.mock.patch', 'patch', (['"""qf_lib.data_providers.bloomberg_beap_hapi.bloomberg_beap_hapi_parser.gzip"""'], {}), "(\n 'qf_lib.data_providers.bloomberg_beap_hapi.bloomberg_beap_hapi_parser.gzip'\n )\n", (1111, 1198), False, 'from unittest.mock import patch, Mock\n'), ((2739, 2831), 'unitt... |
import os
import numpy as np
from youtube8m.utils.io import sort_files_natural
NUM_PREDICTIONS = 20
def prepare_submit(video_ids, predictions_path, output_path):
predictions = []
current_video_id_index = 0
for chunk_name in sort_files_natural(os.listdir(predictions_path)):
chunk_path = os.path.j... | [
"numpy.argsort",
"numpy.load",
"os.path.join",
"os.listdir"
] | [((259, 287), 'os.listdir', 'os.listdir', (['predictions_path'], {}), '(predictions_path)\n', (269, 287), False, 'import os\n'), ((311, 353), 'os.path.join', 'os.path.join', (['predictions_path', 'chunk_name'], {}), '(predictions_path, chunk_name)\n', (323, 353), False, 'import os\n'), ((371, 390), 'numpy.load', 'np.lo... |
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
class FileNaming(object):
def __init__(self, steps, particles):
self.steps_str = str(steps)
self.p_str = str(particles)
self.rho_str = None
self.t_str = None
self.n_str = None
self.a_str ... | [
"matplotlib.pyplot.subplot2grid",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.full",
"numpy.multiply",
"numpy.append",
"numpy.max",
"numpy.loadtxt",
"numpy.linspace",
"scipy.stats.linregress",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.le... | [((11508, 11532), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""default"""'], {}), "('default')\n", (11521, 11532), True, 'import matplotlib.pyplot as plt\n'), ((1522, 1534), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1530, 1534), True, 'import numpy as np\n'), ((1558, 1570), 'numpy.array', 'np.array',... |
# -*- coding: UTF-8 -*-
# \file solvate_maths.py
# \brief This file provides the specific computations functionality for other parts of solvate.
#
# Copyright by the Authors and individual contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are... | [
"solvate.solvate_log.endLog",
"numpy.power",
"numpy.zeros",
"numpy.linalg.svd",
"numpy.linalg.det",
"numpy.where",
"numpy.matmul",
"numpy.array",
"numpy.dot",
"numpy.sqrt"
] | [((15091, 15106), 'numpy.sqrt', 'numpy.sqrt', (['ssX'], {}), '(ssX)\n', (15101, 15106), False, 'import numpy\n'), ((15166, 15181), 'numpy.sqrt', 'numpy.sqrt', (['ssY'], {}), '(ssY)\n', (15176, 15181), False, 'import numpy\n'), ((15724, 15743), 'numpy.dot', 'numpy.dot', (['X0.T', 'Y0'], {}), '(X0.T, Y0)\n', (15733, 1574... |
# autosmartevaluate_rolethemes.py
# This is an automatable version of
# smartevaluate_rolethemes.py, that
# can be called as a function from
# measure_variation.py.
import sys, csv, random
import numpy as np
import pandas as pd
from scipy.spatial.distance import cosine
from collections import Counter
def getdoc(anid... | [
"csv.DictReader",
"scipy.spatial.distance.cosine",
"collections.Counter",
"numpy.array"
] | [((1575, 1608), 'csv.DictReader', 'csv.DictReader', (['f'], {'delimiter': '"""\t"""'}), "(f, delimiter='\\t')\n", (1589, 1608), False, 'import sys, csv, random\n'), ((2178, 2196), 'scipy.spatial.distance.cosine', 'cosine', (['vec1', 'vec2'], {}), '(vec1, vec2)\n', (2184, 2196), False, 'from scipy.spatial.distance impor... |
import math
import time
from progress.bar import Bar
t = time.time()
from scipy import interpolate
from scipy.signal import find_peaks
from scipy.optimize import curve_fit
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.lines import Line2D
from matplotlib import rcParams
rcParams['font.family'] = 'monospace'
... | [
"numpy.load",
"numpy.sum",
"numpy.ones",
"use_desim.use_desim",
"os.path.abspath",
"numpy.savetxt",
"numpy.append",
"minidesim.eta_atm_interp",
"numpy.linspace",
"numpy.loadtxt",
"numpy.log10",
"minidesim.eta_atm_func",
"matplotlib.pyplot.show",
"progress.bar.Bar",
"numpy.hstack",
"mat... | [((57, 68), 'time.time', 'time.time', ([], {}), '()\n', (66, 68), False, 'import time\n'), ((690, 715), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../"""'], {}), "(1, '../')\n", (705, 715), False, 'import sys\n'), ((733, 763), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../desim"""'], {}), "(1, '../desim... |
from feffery_antd_components.AntdButton import AntdButton
import dash
import time
import numpy as np
import pandas as pd
import dash_core_components as dcc
import feffery_antd_components as fac
import dash_html_components as html
from dash.dependencies import Input, Output, State
demo_df = pd.DataFrame({
'排序列1': ... | [
"feffery_antd_components.AntdPagination",
"numpy.random.randint",
"feffery_antd_components.AntdButton",
"feffery_antd_components.AntdNotification",
"feffery_antd_components.AntdTabPane",
"feffery_antd_components.AntdSwitch",
"feffery_antd_components.AntdDivider",
"dash.Dash",
"dash_html_components.D... | [((502, 521), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (511, 521), False, 'import dash\n'), ((30296, 30329), 'dash.dependencies.Output', 'Output', (['"""result-demo"""', '"""subTitle"""'], {}), "('result-demo', 'subTitle')\n", (30302, 30329), False, 'from dash.dependencies import Input, Output, Sta... |
import logging
import os
import random
import torch
import numpy as np
from dataset import Dataset
from dcparser import Parser
from domain import DomainEngine
from detect import DetectEngine
from repair import RepairEngine
from evaluate import EvalEngine
# if not os.path.exists('examples/hospital.log'):
# with o... | [
"detect.DetectEngine",
"logging.debug",
"numpy.random.seed",
"logging.basicConfig",
"dataset.Dataset",
"domain.DomainEngine",
"torch.manual_seed",
"repair.RepairEngine",
"logging.info",
"os.environ.keys",
"random.seed",
"evaluate.EvalEngine",
"dcparser.Parser",
"logging.getLogger"
] | [((361, 484), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - [%(levelname)5s] - %(message)s"""', 'datefmt': '"""%H:%M:%S"""', 'filename': '"""usecase1.log"""'}), "(format='%(asctime)s - [%(levelname)5s] - %(message)s',\n datefmt='%H:%M:%S', filename='usecase1.log')\n", (380, 484), Fa... |
from lxml import html
import requests, urllib, os, pickle, logging
import numpy as n
class DownloadGmaneData:
"""Class for downloading Gmane data to local file system
initialize with a basedir to store email messages
and with a logging_file to store download information:
dl=DownloadGmaneData() # OR
... | [
"os.mkdir",
"pickle.dump",
"os.remove",
"logging.basicConfig",
"numpy.std",
"os.path.isdir",
"os.rename",
"lxml.html.fromstring",
"logging.info",
"os.path.isfile",
"numpy.mean",
"pickle.load",
"urllib.request.urlretrieve",
"requests.get",
"os.path.expanduser",
"os.listdir"
] | [((1575, 1678), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'logging_file', 'format': '"""%(asctime)s: %(message)s"""', 'level': 'logging.DEBUG'}), "(filename=logging_file, format=\n '%(asctime)s: %(message)s', level=logging.DEBUG)\n", (1594, 1678), False, 'import requests, urllib, os, pickle, lo... |
# 2017 JA
import numpy as np
from scipy.linalg import pinv
from scipy.optimize import fmin, fsolve
from .L63_model import lorenz63
###############################################################################
def var3d(x0,t,tobs,y,H,B,R,model,N):
"""Data assimilation routine for both Lorenz 1963 & 1996 using 3DV... | [
"scipy.optimize.fmin",
"numpy.sum",
"numpy.random.randn",
"numpy.empty",
"numpy.empty_like",
"scipy.optimize.fsolve",
"numpy.arange",
"numpy.reshape",
"numpy.mat",
"numpy.eye",
"scipy.linalg.pinv"
] | [((2628, 2635), 'scipy.linalg.pinv', 'pinv', (['B'], {}), '(B)\n', (2632, 2635), False, 'from scipy.linalg import pinv\n'), ((2647, 2654), 'scipy.linalg.pinv', 'pinv', (['R'], {}), '(R)\n', (2651, 2654), False, 'from scipy.linalg import pinv\n'), ((6395, 6402), 'scipy.linalg.pinv', 'pinv', (['B'], {}), '(B)\n', (6399, ... |
"""
Functions to manipulate CESM files
Created 5 Oct 2017
Author: <NAME> <EMAIL>
"""
import os, errno
import netCDF4
import numpy as np
import datetime as dt
import pandas as pd
import xarray as xr
import calendar
from rhwhitepackages3.CESMconst import *
calendar.monthrange(2001,1)[1]
monthstart = [0]
for imonth in ... | [
"numpy.deg2rad",
"numpy.zeros",
"numpy.insert",
"xarray.concat",
"numpy.append",
"numpy.gradient",
"numpy.argwhere",
"numpy.arange",
"numpy.sin",
"numpy.cos",
"calendar.monthrange",
"numpy.concatenate"
] | [((258, 286), 'calendar.monthrange', 'calendar.monthrange', (['(2001)', '(1)'], {}), '(2001, 1)\n', (277, 286), False, 'import calendar\n'), ((539, 562), 'numpy.arange', 'np.arange', (['(0)', 'ndaysyear'], {}), '(0, ndaysyear)\n', (548, 562), True, 'import numpy as np\n'), ((580, 645), 'numpy.zeros', 'np.zeros', (['[nd... |
#!/usr/bin/env python3
# Copyright (C) 2021 megumifox <<EMAIL>>
from telethon import TelegramClient, events, sync
from telethon.tl.types import PeerUser, PeerChat, PeerChannel
from telethon.tl.functions.channels import EditPhotoRequest
from telethon.tl.types import InputChatUploadedPhoto
from datetime import datetime... | [
"yaml.load",
"os.remove",
"urllib.parse.urljoin",
"telethon.TelegramClient",
"cv2.imdecode",
"telethon.tl.functions.channels.EditPhotoRequest",
"cv2.rectangle",
"urllib.parse.urlparse",
"telethon.events.NewMessage",
"random.randint",
"cv2.cvtColor",
"cv2.imwrite",
"magic.detect_from_content"... | [((643, 749), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.INFO)\n", (662, 749), False, 'import logging\n'), ((772, 804), 'logging.... |
# -*- coding: utf-8 -*-
import numpy as np
def analyze_perturb(alg, data, targets, b=None, get_trj=False):
"""Perform signal flow analysis under perturbations.
Parameters
----------
alg : sfa.Algorithm
Algorithm object.
data : sfa.Data
Data object which has perturbation data.
... | [
"numpy.zeros_like",
"numpy.zeros"
] | [((2989, 3010), 'numpy.zeros_like', 'np.zeros_like', (['bigger'], {}), '(bigger)\n', (3002, 3010), True, 'import numpy as np\n'), ((1163, 1193), 'numpy.zeros', 'np.zeros', (['(N,)'], {'dtype': 'np.float'}), '((N,), dtype=np.float)\n', (1171, 1193), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import unittest
import clpy
import numpy
class TestRollaxis(unittest.TestCase):
"""test class of rollaxis"""
def test_import(self):
self.assertTrue(True) # Always OK if no exeption from import
def test_2_3_matrix(self):
npA = numpy.array([[1, 2, 3], [4, 5, 6]])... | [
"unittest.main",
"numpy.array",
"numpy.rollaxis",
"clpy.array",
"clpy.rollaxis"
] | [((1036, 1051), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1049, 1051), False, 'import unittest\n'), ((285, 320), 'numpy.array', 'numpy.array', (['[[1, 2, 3], [4, 5, 6]]'], {}), '([[1, 2, 3], [4, 5, 6]])\n', (296, 320), False, 'import numpy\n'), ((341, 366), 'numpy.rollaxis', 'numpy.rollaxis', (['npA', '(1)',... |
import numpy as np
import scipy.stats as stats
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted, check_array
class SimpleNetworkImputer(BaseEstimator, TransformerMixin):
"""Impute missing values in the network by the most frequent value over
all ti... | [
"numpy.empty",
"numpy.isnan",
"sklearn.utils.validation.check_is_fitted",
"numpy.any",
"sklearn.utils.validation.check_array"
] | [((913, 1048), 'sklearn.utils.validation.check_array', 'check_array', (['Y'], {'dtype': 'np.float64', 'warn_on_dtype': '(True)', 'force_all_finite': '"""allow-nan"""', 'ensure_2d': '(False)', 'allow_nd': '(True)', 'copy': 'self.copy'}), "(Y, dtype=np.float64, warn_on_dtype=True, force_all_finite=\n 'allow-nan', ensu... |
""" Copyright chriskeraly
Copyright (c) 2019 Lumerical Inc. """
import sys
sys.path.append(".")
import os
import numpy as np
from qatools import *
from lumopt.utilities.wavelengths import Wavelengths
from lumopt.utilities.materials import Material
from lumopt.geometries.polygon import FunctionDefinedPolygon
from... | [
"sys.path.append",
"lumopt.optimization.Optimization",
"os.path.dirname",
"numpy.ones",
"lumopt.utilities.wavelengths.Wavelengths",
"lumopt.utilities.materials.Material",
"numpy.array",
"os.path.join",
"lumopt.optimizers.generic_optimizers.ScipyOptimizers"
] | [((80, 100), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (95, 100), False, 'import sys\n'), ((875, 900), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (890, 900), False, 'import os\n'), ((991, 1078), 'os.path.join', 'os.path.join', (['self.file_dir', '"""co_optimizati... |
# -*- coding: utf-8 -*-
""" The improved kl-UCB++ policy, for one-parameter exponential distributions.
Reference: [Menard & Garivier, ALT 2017](https://hal.inria.fr/hal-01475078)
"""
from __future__ import division, print_function # Python 2 compatibility
__author__ = "<NAME>"
__version__ = "0.5"
from math import lo... | [
"numpy.seterr",
"math.log",
"numpy.log"
] | [((341, 367), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (350, 367), True, 'import numpy as np\n'), ((732, 738), 'math.log', 'log', (['x'], {}), '(x)\n', (735, 738), False, 'from math import log\n'), ((1053, 1059), 'math.log', 'log', (['y'], {}), '(y)\n', (1056, 1059), False, ... |
import os
import numpy
import pytest
import scipy.sparse
from hetio.matrix import (
metaedge_to_adjacency_matrix,
sparsify_or_densify,
)
import hetio.readwrite
directory = os.path.dirname(os.path.abspath(__file__))
def get_arrays(edge, dtype, dense_threshold):
# Dictionary with tuples of matrix and per... | [
"os.path.abspath",
"hetio.matrix.metaedge_to_adjacency_matrix",
"numpy.array",
"pytest.mark.parametrize",
"hetio.matrix.sparsify_or_densify",
"os.path.join"
] | [((1419, 1480), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dense_threshold"""', '[0, 0.25, 0.5, 1]'], {}), "('dense_threshold', [0, 0.25, 0.5, 1])\n", (1442, 1480), False, 'import pytest\n'), ((1482, 1557), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dtype"""', '[numpy.bool_, numpy.int6... |
import unittest
import numpy as np
from spn.algorithms.Validity import is_valid
from spn.algorithms.stats.Expectations import Expectation, get_means
from spn.structure.leaves.piecewise.PiecewiseLinear import PiecewiseLinear
class TestGradient(unittest.TestCase):
def test_piecewise_linear_simple(self):
p... | [
"unittest.main",
"numpy.array",
"spn.algorithms.stats.Expectations.get_means",
"spn.algorithms.Validity.is_valid",
"spn.structure.leaves.piecewise.PiecewiseLinear.PiecewiseLinear"
] | [((1762, 1777), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1775, 1777), False, 'import unittest\n'), ((548, 572), 'spn.algorithms.stats.Expectations.get_means', 'get_means', (['piecewise_spn'], {}), '(piecewise_spn)\n', (557, 572), False, 'from spn.algorithms.stats.Expectations import Expectation, get_means\n... |
# -*- coding: utf-8 -*-
from time import time
from collections import deque
import numpy as np
import math,logging
from fastdtw import fastdtw
from concurrent.futures import ProcessPoolExecutor, as_completed
from collections import defaultdict
from utils import *
from heapq import *
import os
limiteDist = 20
#Get the... | [
"concurrent.futures.ProcessPoolExecutor",
"numpy.zeros",
"numpy.ones",
"time.time",
"logging.info",
"numpy.linalg.norm",
"numpy.array",
"numpy.eye",
"math.log",
"concurrent.futures.as_completed",
"collections.deque"
] | [((1082, 1095), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (1090, 1095), True, 'import numpy as np\n'), ((1987, 1993), 'time.time', 'time', ([], {}), '()\n', (1991, 1993), False, 'from time import time\n'), ((2085, 2092), 'collections.deque', 'deque', ([], {}), '()\n', (2090, 2092), False, 'from collections i... |
import numpy as np
from torchtext import vocab
embedder = vocab.GloVe(name='6B')
vecs = []
__labels = ['Pleural Effusion', #0
'abnormal heart size', #1
'Pneumothorax', #2
'Pulmonary lung lesions', #3
'Air space opacities', #4
'Fracture', #5
# 'At... | [
"numpy.stack",
"numpy.save",
"torchtext.vocab.GloVe"
] | [((59, 81), 'torchtext.vocab.GloVe', 'vocab.GloVe', ([], {'name': '"""6B"""'}), "(name='6B')\n", (70, 81), False, 'from torchtext import vocab\n'), ((669, 691), 'numpy.stack', 'np.stack', (['vecs'], {'axis': '(0)'}), '(vecs, axis=0)\n', (677, 691), True, 'import numpy as np\n'), ((711, 747), 'numpy.save', 'np.save', ([... |
import unittest
import numpy as np
class Perceptron:
def __init__(self, bias, weights):
self.bias = bias
self.weights = weights
self.result = 0
self.real_output = 0
def output(self, inputs):
assert self.weights.size == inputs.size, "Mismatch between inputs and weights ... | [
"unittest.main",
"numpy.sum",
"numpy.exp",
"numpy.array"
] | [((2069, 2084), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2082, 2084), False, 'import unittest\n'), ((349, 378), 'numpy.sum', 'np.sum', (['(self.weights * inputs)'], {}), '(self.weights * inputs)\n', (355, 378), True, 'import numpy as np\n'), ((924, 942), 'numpy.array', 'np.array', (['[-1, -1]'], {}), '([-1,... |
from typing import Any, NamedTuple
import pyvisa
import time
import dataclasses
import numpy as np
import datetime
class MagnetOutput(NamedTuple):
timestamp: datetime.datetime
output: float
voltage: float
class MagnetValue(NamedTuple):
timestamp: datetime.datetime
value: float
class MagnetPola... | [
"pyvisa.ResourceManager",
"numpy.abs",
"time.sleep",
"dataclasses.field",
"datetime.datetime.now"
] | [((802, 843), 'dataclasses.field', 'dataclasses.field', ([], {'default': '""""""', 'init': '(False)'}), "(default='', init=False)\n", (819, 843), False, 'import dataclasses\n'), ((865, 906), 'dataclasses.field', 'dataclasses.field', ([], {'default': '""""""', 'init': '(False)'}), "(default='', init=False)\n", (882, 906... |
"""Layers common to multiple models."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from six.moves import range # pylint: disable=redefined-builtin
import tensorflow as tf
from tensorflow.python.framework import function
from tensor... | [
"tensorflow.einsum",
"tensorflow.reduce_sum",
"tensorflow.ones_initializer",
"tensorflow.maximum",
"tensorflow.logging.warning",
"tensorflow.reshape",
"tensorflow.get_variable_scope",
"tensorflow.contrib.eager.in_eager_mode",
"tensorflow.nn.l2_normalize",
"numpy.ones",
"tensorflow.layers.batch_n... | [((2263, 2300), 'tensorflow.nn.dropout', 'tf.nn.dropout', (['x', 'keep_prob'], {}), '(x, keep_prob, **kwargs)\n', (2276, 2300), True, 'import tensorflow as tf\n'), ((2819, 2879), 'tensorflow.reshape', 'tf.reshape', (['x', '[xshape[0], xshape[1] * xshape[2], xshape[3]]'], {}), '(x, [xshape[0], xshape[1] * xshape[2], xsh... |
import numpy, itertools, pickle, warnings as _builtin_warnings, operator
from nutils import evaluable, function, mesh, numeric, types, points, transformseq, transform, element
from nutils.testing import *
_ = numpy.newaxis
class Array(TestCase):
def test_cast_ndim_mismatch(self):
with self.assertRaises(ValueEr... | [
"nutils.function.exp",
"numpy.heaviside",
"nutils.function.norm2",
"nutils.function.dot",
"nutils.mesh.rectilinear",
"numpy.ones",
"nutils.function.broadcast_shapes",
"nutils.function.isarray",
"nutils.function.ones",
"numpy.arange",
"nutils.element.PointReference",
"nutils.function.Array.cast... | [((1268, 1295), 'nutils.function.Array.cast', 'function.Array.cast', (['[1, 2]'], {}), '([1, 2])\n', (1287, 1295), False, 'from nutils import evaluable, function, mesh, numeric, types, points, transformseq, transform, element\n'), ((1834, 1855), 'nutils.mesh.rectilinear', 'mesh.rectilinear', (['[2]'], {}), '([2])\n', (... |
import re
import math
import numpy as np
import pandas as pd
import pretty_midi
#
# Classes
#
class Note:
C, Db, D, Eb, E, F, Gb, G, Ab, A, Bb, B = range(0, 12)
def __init__(self, pitch=0, startBeat=0., startTime=0., durBeats=1.,
durS=1., instrument=1, prevNote=None, nextNote=None, other... | [
"numpy.isin",
"numpy.argmax",
"numpy.ones",
"numpy.exp",
"pandas.DataFrame",
"pretty_midi.Note",
"pretty_midi.PrettyMIDI",
"pretty_midi.Instrument",
"re.search",
"numpy.roll",
"numpy.asarray",
"numpy.min",
"math.exp",
"numpy.log",
"numpy.asanyarray",
"numpy.zeros",
"numpy.expand_dims... | [((8268, 8361), 'numpy.array', 'np.array', (['[0.748, 0.06, 0.488, 0.082, 0.67, 0.46, 0.096, 0.715, 0.104, 0.366, 0.057, 0.4]'], {}), '([0.748, 0.06, 0.488, 0.082, 0.67, 0.46, 0.096, 0.715, 0.104, 0.366,\n 0.057, 0.4])\n', (8276, 8361), True, 'import numpy as np\n'), ((8371, 8468), 'numpy.array', 'np.array', (['[0.7... |
from pathlib import Path
from numpy import isinf
from cilissa.images import Image, ImageCollection, ImagePair
from cilissa.metrics import MSE, PSNR
from cilissa.operations import OperationsList
from cilissa.transformations import Blur, Equalization
from tests.base import BaseTest
class TestOperationsList(BaseTest):... | [
"cilissa.operations.OperationsList",
"cilissa.transformations.Blur",
"cilissa.metrics.PSNR",
"cilissa.transformations.Equalization",
"cilissa.metrics.MSE",
"numpy.isinf",
"pathlib.Path",
"cilissa.images.ImagePair",
"cilissa.images.ImageCollection"
] | [((608, 645), 'cilissa.operations.OperationsList', 'OperationsList', (['[mse, blur, eq, psnr]'], {}), '([mse, blur, eq, psnr])\n', (622, 645), False, 'from cilissa.operations import OperationsList\n'), ((668, 697), 'cilissa.images.ImagePair', 'ImagePair', (['self.im1', 'self.im2'], {}), '(self.im1, self.im2)\n', (677, ... |
# tr.contrib.learn , classifier, prediction
# 1. Dataset
# 2. Classifier
# 3. Train
# 4. Evaluate
# 5. Predict
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
IRIS_TRAINING = "iris_training.csv"
IR... | [
"tensorflow.contrib.learn.datasets.base.load_csv_with_header",
"tensorflow.contrib.layers.real_valued_column",
"numpy.array",
"tensorflow.contrib.learn.DNNClassifier"
] | [((390, 515), 'tensorflow.contrib.learn.datasets.base.load_csv_with_header', 'tf.contrib.learn.datasets.base.load_csv_with_header', ([], {'filename': 'IRIS_TRAINING', 'target_dtype': 'np.int', 'features_dtype': 'np.float'}), '(filename=IRIS_TRAINING,\n target_dtype=np.int, features_dtype=np.float)\n', (441, 515), Tr... |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.axes import Axes
from layout import Layout
from src.simulation import Simulation
from src.utils import count_people, get_population_health_status, get_population_health_status_keys
matplotlib.use("Qt5Agg")
# TODO add animation
# TOD... | [
"matplotlib.pyplot.show",
"layout.Layout",
"src.utils.get_population_health_status",
"src.utils.count_people",
"matplotlib.use",
"numpy.array",
"src.utils.get_population_health_status_keys",
"src.simulation.Simulation"
] | [((268, 292), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (282, 292), False, 'import matplotlib\n'), ((511, 519), 'layout.Layout', 'Layout', ([], {}), '()\n', (517, 519), False, 'from layout import Layout\n'), ((4023, 4033), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4031, ... |
# -*- coding: utf-8 -*-
"""
method_boosters.py - Boosters for least-square solvers
======================================================
This module contains all available boosters for least-square methods, the Cholesky-booster and the Caratheodory-booster.
See the following example of using any booster, i.e cholesky... | [
"numpy.sum",
"ComparedAlgorithms.basic_caratheodory_set.caratheodory_set_python",
"numpy.ravel",
"numpy.einsum",
"numpy.ones",
"numpy.split",
"Infrastructure.utils.compute_serial",
"numpy.hstack",
"numpy.arange",
"numpy.array",
"numpy.array_split",
"numpy.vstack",
"numpy.sqrt"
] | [((1067, 1119), 'numpy.array_split', 'np.array_split', (['all_data_mat', 'cross_validation_folds'], {}), '(all_data_mat, cross_validation_folds)\n', (1081, 1119), True, 'import numpy as np\n'), ((5763, 5815), 'numpy.arange', 'np.arange', (['block_size', 'length', 'block_size'], {'dtype': 'int'}), '(block_size, length, ... |
import torch
import glob
import os
import json
import numpy as np
import cv2
#DEFAULT_SIZE = (256, 512)
DEFAULT_SIZE = (64, 128)
class HomographyPredictionDataset(torch.utils.data.Dataset):
def __init__(self, dataset_path, train=True, size=DEFAULT_SIZE):
# TODO
self.flags = {'train': train, 'size'... | [
"matplotlib.pyplot.show",
"os.path.join",
"json.loads",
"numpy.zeros",
"numpy.mean",
"numpy.int32",
"matplotlib.pyplot.subplots",
"cv2.resize"
] | [((2295, 2313), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (2307, 2313), True, 'import matplotlib.pyplot as plt\n'), ((2353, 2373), 'numpy.mean', 'np.mean', (['img'], {'axis': '(2)'}), '(img, axis=2)\n', (2360, 2373), True, 'import numpy as np\n'), ((2419, 2429), 'matplotlib.pyplot.... |
from matplotlib import pyplot as plt
import numpy as np
from scipy.stats import gmean
from lmfit import Minimizer, Parameters, report_fit
import nmrglue as ng
from scipy.stats import norm
import pickle
try:
from openbabel.openbabel import OBConversion, OBMol, OBAtomAtomIter, OBMolAtomIter
except ImportError:
f... | [
"scipy.stats.gmean",
"numpy.sum",
"openbabel.openbabel.OBMolAtomIter",
"numpy.abs",
"numpy.argmax",
"nmrglue.bruker.guess_udic",
"numpy.maximum",
"nmrglue.fileiobase.create_blank_udic",
"openbabel.openbabel.OBConversion",
"numpy.ones",
"numpy.argmin",
"numpy.argsort",
"openbabel.openbabel.OB... | [((1135, 1146), 'time.time', 'time.time', ([], {}), '()\n', (1144, 1146), False, 'import time\n'), ((1726, 1737), 'time.time', 'time.time', ([], {}), '()\n', (1735, 1737), False, 'import time\n'), ((3620, 3654), 'nmrglue.fileiobase.create_blank_udic', 'ng.fileiobase.create_blank_udic', (['(1)'], {}), '(1)\n', (3651, 36... |
# -*- coding: utf-8 -*-
#GSASII - phase data display routines
########### SVN repository information ###################
# $Date: 2021-01-11 08:12:01 +0900 (月, 11 1月 2021) $
# $Author: toby $
# $Revision: 4759 $
# $URL: https://subversion.xray.aps.anl.gov/pyGSAS/trunk/GSASIIphsGUI.py $
# $Id: GSASIIphsGUI.py 4759 2021... | [
"GSASIIElem.GetBLtable",
"GSASIIlattice.TransformCell",
"numpy.arctan2",
"numpy.sum",
"GSASIImath.UpdateRBUIJ",
"GSASIImath.Q2AVdeg",
"GSASIIpath.GetConfigValue",
"GSASIIspc.SSChoice",
"time.ctime",
"GSASIIctrlGUI.SingleStringDialog",
"numpy.argmin",
"wx.CheckBox",
"wx.grid.GridCellAttr",
... | [((1558, 1606), 'GSASIIpath.SetVersionNumber', 'GSASIIpath.SetVersionNumber', (['"""$Revision: 4759 $"""'], {}), "('$Revision: 4759 $')\n", (1585, 1606), False, 'import GSASIIpath\n'), ((2344, 2368), 'wx.Colour', 'wx.Colour', (['(235)', '(235)', '(235)'], {}), '(235, 235, 235)\n', (2353, 2368), False, 'import wx\n'), (... |
import os
import sys
path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(path)
from src import fcm, equal, da, minmax, shrinkage
from sklearn.datasets import make_blobs
from matplotlib import pyplot as plt
import numpy as np
from seaborn import scatterplot as scatter
from sklearn.met... | [
"sys.path.append",
"src.shrinkage.Shrinkage",
"src.minmax.MinMaxKMeansMinCostFlow",
"src.da.DeterministicAnnealing",
"matplotlib.pyplot.show",
"os.path.abspath",
"seaborn.scatterplot",
"src.equal.SameSizeKMeansHeuristics",
"sklearn.datasets.make_blobs",
"src.fcm.FCM",
"numpy.random.rand",
"col... | [((91, 112), 'sys.path.append', 'sys.path.append', (['path'], {}), '(path)\n', (106, 112), False, 'import sys\n'), ((503, 619), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n_samples', 'n_features': '(2)', 'cluster_std': '(1.0)', 'centers': 'centers', 'shuffle': '(False)', 'random_state': '(42)'}), ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jam 10 3:42 2019
@author: Bob
Summary:
Allows users to search for data and displays it in a useful way.
Details:
After gathering, cleaning, and analyzing data, this program is run to create
the UI. It firsts prompts the user for preferences on a variety of metrics,
includi... | [
"kivy.uix.button.Button",
"os.path.join",
"pandas.DataFrame",
"re.sub",
"functools.partial",
"kivy.lang.Builder.load_file",
"kivy.uix.label.Label",
"sqlite3.connect",
"googlemaps.geocode.GeoCode",
"os.listdir",
"googlemaps.haversine.Haversine",
"re.compile",
"async_gui.toolkits.kivy.KivyEngi... | [((1677, 1689), 'async_gui.toolkits.kivy.KivyEngine', 'KivyEngine', ([], {}), '()\n', (1687, 1689), False, 'from async_gui.toolkits.kivy import KivyEngine\n'), ((1715, 1755), 'sqlite3.connect', 'sqlite3.connect', (['"""Routes-Cleaned.sqlite"""'], {}), "('Routes-Cleaned.sqlite')\n", (1730, 1755), False, 'import sqlite3\... |
import numpy as np
import scipy.optimize
import pyqmc.energy
def optvariance(energy, wf, coords, params=None, **kwargs):
"""Optimizes variance of wave function against parameters indicated by params.
Does not use gradient information, and assumes that only the kinetic energy changes.
Args:
energy:... | [
"numpy.std",
"numpy.array",
"numpy.prod",
"numpy.split"
] | [((828, 878), 'numpy.array', 'np.array', (['[wf.parameters[k].shape for k in params]'], {}), '([wf.parameters[k].shape for k in params])\n', (836, 878), True, 'import numpy as np\n'), ((1610, 1638), 'numpy.split', 'np.split', (['res.x', 'slices[:-1]'], {}), '(res.x, slices[:-1])\n', (1618, 1638), True, 'import numpy as... |
import os
import pdb
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from argparse import ArgumentParser
import rlkit.envs.blocks.mujoco.utils.data_generation_utils as dgu
from mujoco_py import load_model_from_xml, MjSim, MjViewer
MODEL_XML_BASE = """
<mujoco>
<asset>
... | [
"mujoco_py.MjSim",
"numpy.random.uniform",
"copy.deepcopy",
"os.path.abspath",
"numpy.abs",
"argparse.ArgumentParser",
"rlkit.envs.blocks.mujoco.utils.data_generation_utils.make_gif",
"numpy.random.randn",
"rlkit.envs.blocks.mujoco.utils.data_generation_utils.hdf5_to_image",
"numpy.zeros",
"mujo... | [((59, 80), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (73, 80), False, 'import matplotlib\n'), ((1582, 1610), 'numpy.random.randint', 'np.random.randint', (['(0)', 'an_int'], {}), '(0, an_int)\n', (1599, 1610), True, 'import numpy as np\n'), ((10414, 10479), 'numpy.random.randint', 'np.rando... |
import os
import chainer.functions as F
from chainer.dataset import download
from chainer.serializers import npz
from chainer.backends.cuda import get_array_module
import numpy as np
from PIL import Image
from cupy import get_array_module
def convert_caffemodel_to_npz(path_caffemodel, path_npz):
from chainer.links.... | [
"chainer.functions.transpose",
"chainer.links.caffe.caffe_function.CaffeFunction",
"chainer.serializers.npz.save_npz",
"numpy.asarray",
"chainer.serializers.npz.load_npz",
"chainer.dataset.download.cached_download",
"numpy.expand_dims",
"PIL.Image.open",
"chainer.dataset.download.get_dataset_directo... | [((376, 406), 'chainer.links.caffe.caffe_function.CaffeFunction', 'CaffeFunction', (['path_caffemodel'], {}), '(path_caffemodel)\n', (389, 406), False, 'from chainer.links.caffe.caffe_function import CaffeFunction\n'), ((408, 461), 'chainer.serializers.npz.save_npz', 'npz.save_npz', (['path_npz', 'caffemodel'], {'compr... |
# -*- coding: utf-8 -*-
# Copyright (c) 2019 the HERA Project
# Licensed under the MIT License
from hera_qm import omnical_metrics
from hera_qm.data import DATA_PATH
import os
from hera_qm import utils
import sys
from collections import OrderedDict
import pytest
import numpy as np
pytestmark = pytest.mark.filterwarni... | [
"os.remove",
"hera_qm.omnical_metrics.omnical_metrics_run",
"hera_qm.omnical_metrics.write_metrics",
"numpy.isclose",
"os.path.isfile",
"hera_qm.omnical_metrics.load_omnical_metrics",
"os.path.join",
"hera_qm.omnical_metrics.plot_phs_metric",
"sys.path.append",
"hera_qm.utils.get_metrics_ArgumentP... | [((297, 471), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:telescope_location is not set. Using known values for HERA."""', '"""ignore:antenna_positions is not set. Using known values for HERA."""'], {}), "(\n 'ignore:telescope_location is not set. Using known values for HERA.',\n 'ign... |
import argparse
import sys
import numpy as np
sys.path.append('.')
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from math import sqrt
from pyActionRecog.utils.video_funcs import default_aggregation_func
from pyActionRecog.utils.metrics import mean_class_accuracy
pars... | [
"sys.path.append",
"numpy.load",
"numpy.zeros_like",
"pyActionRecog.utils.metrics.mean_class_accuracy",
"argparse.ArgumentParser",
"numpy.set_printoptions",
"numpy.sum",
"numpy.argmax",
"sklearn.metrics.mean_absolute_error",
"numpy.max",
"numpy.arange",
"numpy.array",
"sklearn.metrics.mean_s... | [((46, 66), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (61, 66), False, 'import sys\n'), ((325, 350), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (348, 350), False, 'import argparse\n'), ((2223, 2255), 'numpy.zeros_like', 'np.zeros_like', (['agg_score_list[0]'], {}),... |
from pyscf import scf, gto, lib
from nose import SkipTest
from nose.tools import nottest
from nose.plugins.skip import Skip
from numpy.testing import assert_almost_equal, assert_equal
from mldftdat.pyscf_utils import get_hf_coul_ex_total, get_hf_coul_ex_total_unrestricted,\
run_scf, run... | [
"os.remove",
"mldftdat.pyscf_utils.get_hf_coul_ex_total_unrestricted",
"pyscf.gto.Mole",
"mldftdat.pyscf_utils.get_hf_coul_ex_total",
"numpy.testing.assert_almost_equal",
"mldftdat.analyzers.UHFAnalyzer.from_dict",
"mldftdat.pyscf_utils.run_scf",
"mldftdat.analyzers.RHFAnalyzer.from_dict",
"mldftdat... | [((631, 682), 'pyscf.gto.Mole', 'gto.Mole', ([], {'atom': '"""H 0 0 0; F 0 0 1.1"""', 'basis': '"""sto-3g"""'}), "(atom='H 0 0 0; F 0 0 1.1', basis='sto-3g')\n", (639, 682), False, 'from pyscf import scf, gto, lib\n'), ((725, 748), 'mldftdat.pyscf_utils.run_scf', 'run_scf', (['cls.mol', '"""RHF"""'], {}), "(cls.mol, 'R... |
import os
import re
import numpy as np
def get_pretrained_embeddings(filename, embeddings_path="embeddings"):
# extract the embedding dimension from the filename (simpler solutions are imaginable)
embedding_dimension = int(re.search(r"\d+(?=d)", filename).group(0))
with open(os.path.join(embeddings_path, ... | [
"numpy.random.randn",
"numpy.empty",
"numpy.zeros",
"numpy.array",
"re.search",
"os.path.join"
] | [((752, 818), 'numpy.empty', 'np.empty', (['(vocabulary_size, embedding_dimension)'], {'dtype': 'np.float32'}), '((vocabulary_size, embedding_dimension), dtype=np.float32)\n', (760, 818), True, 'import numpy as np\n'), ((881, 910), 'numpy.zeros', 'np.zeros', (['embedding_dimension'], {}), '(embedding_dimension)\n', (88... |
import random
import numpy as np
from .trainer import Trainer
class CrossValidator():
def __init__(self, dataset, train_loader, test_loader, fold=5):
self.dataset = dataset
self.train_loader = train_loader
self.test_loader = test_loader
self.fold = fold
def evaluate(self, mode... | [
"numpy.std",
"random.shuffle",
"numpy.mean"
] | [((375, 403), 'random.shuffle', 'random.shuffle', (['self.dataset'], {}), '(self.dataset)\n', (389, 403), False, 'import random\n'), ((1225, 1240), 'numpy.mean', 'np.mean', (['scores'], {}), '(scores)\n', (1232, 1240), True, 'import numpy as np\n'), ((1255, 1269), 'numpy.std', 'np.std', (['scores'], {}), '(scores)\n', ... |
# -*- coding: utf-8 -*-
#!/usr/bin/python
#
# Author <NAME>
# E-mail <EMAIL>
# License MIT
# Created 13/10/2016
# Updated 30/01/2017
# Version 1.0.0
#
"""
Description of ghosal.py
======================
:Example:
python ghosal.py
"""
import os
import sys
import json
import math
import utils
import ran... | [
"utils.create_dir",
"sklearn.linear_model.RANSACRegressor",
"utils.read_groundtruths",
"pandas.read_csv",
"sklearn.metrics.accuracy_score",
"statistics.stdev",
"numpy.zeros",
"utils.print_success",
"utils.abs_path_dir",
"numpy.append",
"sklearn.metrics.f1_score",
"sklearn.model_selection.Strat... | [((1727, 1801), 'utils.print_success', 'utils.print_success', (['"""Preprocessing YAAFE\'s features (approx. 2 minutes)"""'], {}), '("Preprocessing YAAFE\'s features (approx. 2 minutes)")\n', (1746, 1801), False, 'import utils\n'), ((1821, 1874), 'utils.read_groundtruths', 'utils.read_groundtruths', (['"""groundtruth... |
import argparse
import numpy as np
from caffe2.python import core, workspace
def benchmark_mul_gradient(args):
workspace.FeedBlob("dC", np.random.rand(args.m, args.n).astype(np.float32))
workspace.FeedBlob("A", np.random.rand(args.m, args.n).astype(np.float32))
workspace.FeedBlob("B", np.random.rand... | [
"caffe2.python.core.Net",
"argparse.ArgumentParser",
"caffe2.python.core.GlobalInit",
"caffe2.python.workspace.CreateNet",
"numpy.random.rand"
] | [((360, 377), 'caffe2.python.core.Net', 'core.Net', (['"""mynet"""'], {}), "('mynet')\n", (368, 377), False, 'from caffe2.python import core, workspace\n'), ((458, 482), 'caffe2.python.workspace.CreateNet', 'workspace.CreateNet', (['net'], {}), '(net)\n', (477, 482), False, 'from caffe2.python import core, workspace\n'... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, print_function, division
"""
This submodule provides a healpy-compatible interface.
"""
import numpy as np
from astropy import units as u
from astropy.coordinates.representation import CartesianRepresentation, Uni... | [
"numpy.atleast_1d",
"astropy.units.Quantity",
"numpy.subtract",
"numpy.isscalar",
"numpy.asarray",
"numpy.transpose",
"numpy.shape",
"astropy.coordinates.representation.UnitSphericalRepresentation",
"astropy.coordinates.representation.CartesianRepresentation",
"numpy.asscalar"
] | [((4062, 4076), 'numpy.isscalar', 'np.isscalar', (['x'], {}), '(x)\n', (4073, 4076), True, 'import numpy as np\n'), ((4904, 4919), 'numpy.asarray', 'np.asarray', (['pix'], {}), '(pix)\n', (4914, 4919), True, 'import numpy as np\n'), ((5177, 5214), 'astropy.coordinates.representation.UnitSphericalRepresentation', 'UnitS... |
import os
import argparse
import random
import pickle
from shutil import copyfile
from typing import Optional, Callable, List
from torchvision.datasets import VisionDataset
from torchvision.datasets.folder import pil_loader
import numpy as np
from PIL import Image
import torchvision.transforms.functional as TVF
from t... | [
"pickle.dump",
"numpy.random.seed",
"argparse.ArgumentParser",
"random.shuffle",
"numpy.mean",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"torchvision.datasets.folder.pil_loader",
"torchvision.models.wide_resnet50_2",
"torch.utils.data.DataLoader",
"random.seed",
"t... | [((1109, 1124), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1122, 1124), False, 'import torch\n'), ((1633, 1648), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (1644, 1648), False, 'import random\n'), ((1653, 1671), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1667, 1671), True, ... |
'''
Created on Aug 27, 2014
@author: <NAME>
'''
import numpy as np
class _Norm(object):
def __init__(self):
pass
def scale_by(self, Y):
"""
Use data matrix Y as normalization space to work in.
"""
raise NotImplementedError
def normalize(self, Y):
"""
... | [
"copy.deepcopy",
"numpy.array",
"numpy.ma.masked_invalid"
] | [((2004, 2029), 'copy.deepcopy', 'copy.deepcopy', (['input_dict'], {}), '(input_dict)\n', (2017, 2029), False, 'import copy\n'), ((2479, 2514), 'numpy.ma.masked_invalid', 'np.ma.masked_invalid', (['Y'], {'copy': '(False)'}), '(Y, copy=False)\n', (2499, 2514), True, 'import numpy as np\n'), ((3782, 3810), 'numpy.array',... |
import os
import time
import numpy as np
import matplotlib.pyplot as plt
from fastuot.uot1d import solve_ot, rescale_potentials, invariant_dual_loss, \
homogeneous_line_search
from fastuot.cvxpy_uot import dual_via_cvxpy
path = os.getcwd() + "/output/"
if not os.path.isdir(path):
os.mkdir(path)
path = path +... | [
"matplotlib.pyplot.title",
"os.mkdir",
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"numpy.isnan",
"fastuot.uot1d.homogeneous_line_search",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"fastuot.uot1d.rescale_potentials",
"numpy.zeros_like",
"matplotlib.pyplot.... | [((455, 478), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['rc'], {}), '(rc)\n', (474, 478), True, 'import matplotlib.pyplot as plt\n'), ((235, 246), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (244, 246), False, 'import os\n'), ((267, 286), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.