code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python
# coding=utf-8
import io
import os
import logging
import tempfile
import unittest
import simplejson as json
from copy import deepcopy
from pathlib import Path
import numpy as np
import numpy.testing as npt
from ruamel.yaml import YAML
from ioos_qc.config import QcConfig
from ioos_qc.qartod impor... | [
"logging.getLogger",
"logging.StreamHandler",
"ioos_qc.config.QcConfig",
"ioos_qc.qartod.ClimatologyConfig",
"ioos_qc.qartod.ClimatologyConfig.convert",
"pathlib.Path",
"os.close",
"ruamel.yaml.YAML",
"numpy.array",
"numpy.datetime64",
"copy.deepcopy",
"io.StringIO",
"tempfile.mkstemp",
"n... | [((346, 374), 'logging.getLogger', 'logging.getLogger', (['"""ioos_qc"""'], {}), "('ioos_qc')\n", (363, 374), False, 'import logging\n'), ((447, 463), 'ruamel.yaml.YAML', 'YAML', ([], {'typ': '"""safe"""'}), "(typ='safe')\n", (451, 463), False, 'from ruamel.yaml import YAML\n'), ((414, 437), 'logging.StreamHandler', 'l... |
import numpy as np
class Perceptron:
"""A single neuron with the sigmoid activation function.
Attributes:
inputs: The number of inputs in the perceptron, not counting the bias.
bias: The bias term. By defaul it's 1.0."""
def __init__(self, inputs, bias = 1.0):
"""Return a ... | [
"numpy.append",
"numpy.array",
"numpy.exp",
"numpy.random.rand"
] | [((807, 823), 'numpy.array', 'np.array', (['w_init'], {}), '(w_init)\n', (815, 823), True, 'import numpy as np\n'), ((1423, 1453), 'numpy.array', 'np.array', (['layers'], {'dtype': 'object'}), '(layers, dtype=object)\n', (1431, 1453), True, 'import numpy as np\n'), ((3057, 3082), 'numpy.array', 'np.array', (['x'], {'dt... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import os.path
import tempfile... | [
"gensim.matutils.sparse2full",
"gensim.models.rpmodel.RpModel",
"numpy.array",
"unittest.main",
"gensim.corpora.Dictionary",
"gensim.models.ldamodel.LdaModel",
"numpy.random.seed",
"numpy.allclose",
"gensim.matutils.corpus2dense",
"logging.warning",
"os.path.dirname",
"gensim.models.ldamallet.... | [((543, 568), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (558, 568), False, 'import os\n'), ((1103, 1120), 'gensim.corpora.Dictionary', 'Dictionary', (['texts'], {}), '(texts)\n', (1113, 1120), False, 'from gensim.corpora import mmcorpus, Dictionary\n'), ((660, 705), 'os.path.join', 'os.p... |
import argparse
import tensorflow as tf
from tensorflow.keras.models import load_model
from tensorflow.keras.datasets import cifar10
import numpy as np
import os
parser = argparse.ArgumentParser(description='DeepJudge Seed Selection Process')
parser.add_argument('--model', required=True, type=str, help='victim model ... | [
"os.path.exists",
"numpy.savez",
"tensorflow.keras.utils.to_categorical",
"argparse.ArgumentParser",
"os.makedirs",
"tensorflow.config.experimental.set_memory_growth",
"numpy.argmax",
"numpy.argsort",
"tensorflow.keras.datasets.cifar10.load_data",
"tensorflow.keras.models.load_model",
"tensorflo... | [((173, 244), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""DeepJudge Seed Selection Process"""'}), "(description='DeepJudge Seed Selection Process')\n", (196, 244), False, 'import argparse\n'), ((758, 809), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental... |
# -*- coding: utf-8 -*-
import logging
import math
import cmath
import os
from functools import reduce
from six import string_types
import numpy as np
# Ditto imports
from ditto.readers.abstract_reader import AbstractReader
from ditto.store import Store
from ditto.models.position import Position
from ditto.models.no... | [
"logging.getLogger",
"numpy.sqrt",
"ditto.models.wire.Wire",
"ditto.models.feeder_metadata.Feeder_metadata",
"ditto.models.base.Unicode",
"ditto.models.photovoltaic.Photovoltaic",
"math.sqrt",
"ditto.models.winding.Winding",
"ditto.models.storage.Storage",
"ditto.modify.system_structure.system_str... | [((1152, 1179), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1169, 1179), False, 'import logging\n'), ((35145, 35200), 'numpy.any', 'np.any', (['[(x in line) for x in self.header_mapping[obj]]'], {}), '([(x in line) for x in self.header_mapping[obj]])\n', (35151, 35200), True, 'import ... |
import math
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import tensorflow_hub as hub
import tensorflow_datasets as tfds
from tensorflow.keras import layers
import logging
logger = tf.get_logger()
logger.setLevel(logging.ERROR)
# %%
splits = ["train[:70%]", "train[70%:]"]
(training_se... | [
"math.floor",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"matplotlib.pyplot.plot",
"tensorflow_hub.KerasLayer",
"matplotlib.pyplot.savefig",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"numpy.argmax",
"tensorflow.saved_model.save",
"tensorf... | [((214, 229), 'tensorflow.get_logger', 'tf.get_logger', ([], {}), '()\n', (227, 229), True, 'import tensorflow as tf\n'), ((347, 420), 'tensorflow_datasets.load', 'tfds.load', (['"""tf_flowers"""'], {'with_info': '(True)', 'as_supervised': '(True)', 'split': 'splits'}), "('tf_flowers', with_info=True, as_supervised=Tru... |
import numpy as np
from sklearn.model_selection import train_test_split
from utilities_test import get_data, \
get_feature_vector_from_mfcc
_DATA_PATH = '../korean_dataset'
_CLASS_LABELS = ("angry", "disappoint", "fear", "neutral", "sad", "surrender")
def extract_data(flatten):
data, labels = get_data(_DATA... | [
"sklearn.model_selection.train_test_split",
"numpy.array",
"utilities_test.get_feature_vector_from_mfcc",
"utilities_test.get_data"
] | [((306, 371), 'utilities_test.get_data', 'get_data', (['_DATA_PATH'], {'class_labels': '_CLASS_LABELS', 'flatten': 'flatten'}), '(_DATA_PATH, class_labels=_CLASS_LABELS, flatten=flatten)\n', (314, 371), False, 'from utilities_test import get_data, get_feature_vector_from_mfcc\n'), ((439, 501), 'sklearn.model_selection.... |
import os
import pandas as p
import numpy as np
from PIL import ImageEnhance
from PIL import Image, ImageChops, ImageOps
import keras
from keras import optimizers
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, LeakyReLU, Conv2D, MaxPooling2D, Dropout, Lambda
os.environ["CUDA_DE... | [
"keras.layers.Conv2D",
"numpy.random.rand",
"PIL.ImageEnhance.Contrast",
"numpy.array",
"keras.layers.Activation",
"keras.layers.Dense",
"numpy.sort",
"numpy.asarray",
"PIL.ImageEnhance.Color",
"keras.callbacks.EarlyStopping",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"keras.layers.Ma... | [((13293, 13326), 'keras.optimizers.Adam', 'optimizers.Adam', ([], {'lr': 'learning_rate'}), '(lr=learning_rate)\n', (13308, 13326), False, 'from keras import optimizers\n'), ((13459, 13528), 'keras.callbacks.EarlyStopping', 'keras.callbacks.EarlyStopping', ([], {'patience': '(25)', 'restore_best_weights': '(True)'}), ... |
#!/usr/bin/env python
import sys
import os
import numpy as np
import sqlite3
import pandas as pd
import astropy.table as at
from astroquery.irsa_dust import IrsaDust
import astropy.coordinates as coord
import astropy.units as u
def main():
db = sqlite3.connect('test_schedule_v8_msip.db')
table = pd.read_sql_qu... | [
"pandas.read_sql_query",
"numpy.log10",
"numpy.sqrt",
"numpy.unique",
"sqlite3.connect",
"astropy.table.Table.from_pandas",
"astropy.coordinates.SkyCoord",
"astroquery.irsa_dust.IrsaDust.get_query_table"
] | [((250, 293), 'sqlite3.connect', 'sqlite3.connect', (['"""test_schedule_v8_msip.db"""'], {}), "('test_schedule_v8_msip.db')\n", (265, 293), False, 'import sqlite3\n'), ((306, 352), 'pandas.read_sql_query', 'pd.read_sql_query', (['"""SELECT * from SUMMARY"""', 'db'], {}), "('SELECT * from SUMMARY', db)\n", (323, 352), T... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CIE xyY Colourspace
===================
Defines the *CIE xyY* colourspace transformations:
- :func:`XYZ_to_xyY`
- :func:`xyY_to_XYZ`
- :func:`xy_to_XYZ`
- :func:`XYZ_to_xy`
See Also
--------
`CIE xyY Colourspace IPython Notebook
<http://nbviewer.ipython.org/... | [
"numpy.ravel",
"numpy.array",
"colour.colorimetry.ILLUMINANTS.get"
] | [((1969, 1982), 'numpy.ravel', 'np.ravel', (['XYZ'], {}), '(XYZ)\n', (1977, 1982), True, 'import numpy as np\n'), ((2897, 2910), 'numpy.ravel', 'np.ravel', (['xyY'], {}), '(xyY)\n', (2905, 2910), True, 'import numpy as np\n'), ((2036, 2079), 'numpy.array', 'np.array', (['[illuminant[0], illuminant[1], Y]'], {}), '([ill... |
import argparse
import os
import numpy as np
from tqdm import tqdm
import torch.backends.cudnn as cudnn
# from mypath import Path
from common import config
from data import make_data_loader
from model.sync_batchnorm.replicate import patch_replication_callback
from model.deeplab import *
from utils.loss import Segmentat... | [
"torch.cuda.is_available",
"os.path.exists",
"argparse.ArgumentParser",
"os.mkdir",
"utils.metrics.Evaluator",
"torch.optim.SGD",
"data.make_data_loader",
"numpy.argmax",
"os.path.isfile",
"torch.device",
"torch.manual_seed",
"utils.loss.SimilarityLosses",
"torch.load",
"tqdm.tqdm",
"os.... | [((7575, 7644), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch DeeplabV3Plus Training"""'}), "(description='PyTorch DeeplabV3Plus Training')\n", (7598, 7644), False, 'import argparse\n'), ((9581, 9609), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n... |
from __future__ import absolute_import, print_function
import glob
import json
import os
import pickle
from typing import Dict
import numpy as np
from loguru import logger
from tqdm import tqdm
_VALID_SUBSETS = ['train', 'test']
class LaSOT(object):
r"""`LaSOT <https://cis.temple.edu/lasot/>`_ Datasets.
P... | [
"os.path.exists",
"os.listdir",
"pickle.dump",
"tqdm.tqdm",
"os.path.join",
"pickle.load",
"os.path.isfile",
"os.path.dirname",
"os.path.isdir",
"json.load",
"numpy.loadtxt"
] | [((4299, 4319), 'os.listdir', 'os.listdir', (['root_dir'], {}), '(root_dir)\n', (4309, 4319), False, 'import os\n'), ((4866, 4890), 'os.path.dirname', 'os.path.dirname', (['seq_dir'], {}), '(seq_dir)\n', (4881, 4890), False, 'import os\n'), ((5138, 5170), 'os.path.join', 'os.path.join', (['seq_dir', '"""nlp.txt"""'], {... |
""" Layer common utilities """
import pickle
import numpy as np
import tensorflow as tf
from absl import logging
def init_word_embedding(vocab_size, num_units, we_trainable, we_file=None, name_prefix="w"):
"""Initialize word embeddings from random initialization or pretrained word embedding """
if not we_fi... | [
"tensorflow.shape",
"tensorflow.compat.v1.get_variable",
"tensorflow.io.gfile.GFile",
"tensorflow.reduce_logsumexp",
"absl.logging.info",
"tensorflow.range",
"tensorflow.concat",
"tensorflow.compat.v1.constant_initializer",
"tensorflow.name_scope",
"numpy.finfo",
"tensorflow.convert_to_tensor",
... | [((3384, 3408), 'tensorflow.gather_nd', 'tf.gather_nd', (['x', 'indices'], {}), '(x, indices)\n', (3396, 3408), True, 'import tensorflow as tf\n'), ((3562, 3595), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['t'], {'name': '"""t"""'}), "(t, name='t')\n", (3582, 3595), True, 'import tensorflow as tf\n'), ((... |
import tensorflow as tf
import numpy as np
import glob
import random
import os
import cv2
import csv
class DataGenerator(tf.keras.utils.Sequence):
# 'Generates data for tf.keras'
def __init__(self, args, shuffle=True,):
self.shuffle = shuffle
# self.input_dir = os.path.join(args.base_data_dir,... | [
"numpy.load",
"numpy.empty",
"glob.glob",
"numpy.random.shuffle"
] | [((1517, 1550), 'numpy.empty', 'np.empty', (['(self.batch_size, 4, 2)'], {}), '((self.batch_size, 4, 2))\n', (1525, 1550), True, 'import numpy as np\n'), ((1561, 1595), 'numpy.empty', 'np.empty', (['(self.batch_size, 52, 3)'], {}), '((self.batch_size, 52, 3))\n', (1569, 1595), True, 'import numpy as np\n'), ((3864, 390... |
"""Author: <NAME>, Copyright 2019.
Functions to help serialize a caption dataset.
"""
import nltk
import numpy as np
import collections
stemmer = nltk.stem.snowball.SnowballStemmer("english")
def sentence_to_ngrams(sentence, n):
current_grams = collections.defaultdict(int)
lemmas = tuple(st... | [
"collections.OrderedDict",
"numpy.log",
"numpy.array",
"nltk.stem.snowball.SnowballStemmer",
"collections.defaultdict",
"numpy.linalg.norm"
] | [((160, 205), 'nltk.stem.snowball.SnowballStemmer', 'nltk.stem.snowball.SnowballStemmer', (['"""english"""'], {}), "('english')\n", (194, 205), False, 'import nltk\n'), ((269, 297), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (292, 297), False, 'import collections\n'), ((615, 640), '... |
# This file is part of the pyMOR project (https://www.pymor.org).
# Copyright pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
"""Visualization of grid data using OpenGL.
This module provides a widget for displaying patch plots of
s... | [
"OpenGL.GL.glGetProgramiv",
"numpy.ascontiguousarray",
"numpy.array",
"ctypes.c_void_p",
"OpenGL.GL.glCreateShader",
"OpenGL.GL.glAttachShader",
"OpenGL.GL.glEnableClientState",
"pymor.core.logger.getLogger",
"OpenGL.GL.glViewport",
"OpenGL.GL.glGetProgramInfoLog",
"OpenGL.GL.glDrawElements",
... | [((593, 613), 'pymor.core.config.config.require', 'config.require', (['"""QT"""'], {}), "('QT')\n", (607, 613), False, 'from pymor.core.config import config\n'), ((614, 640), 'pymor.core.config.config.require', 'config.require', (['"""QTOPENGL"""'], {}), "('QTOPENGL')\n", (628, 640), False, 'from pymor.core.config impo... |
import copy
from pathlib import Path
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from .builder import DATASETS
from .pipelines import Compose
@DATASETS.register_module()
class HemaAutoRegDataset(Dataset):
"""Hema Auto dataset
Args:
root_dir (... | [
"numpy.clip",
"torch.nn.functional.mse_loss",
"torch.nn.functional.l1_loss",
"pathlib.Path",
"numpy.array",
"copy.deepcopy",
"numpy.load"
] | [((2256, 2312), 'numpy.array', 'np.array', (["[data['gt_label'] for data in self.data_infos]"], {}), "([data['gt_label'] for data in self.data_infos])\n", (2264, 2312), True, 'import numpy as np\n'), ((2394, 2429), 'copy.deepcopy', 'copy.deepcopy', (['self.data_infos[idx]'], {}), '(self.data_infos[idx])\n', (2407, 2429... |
import sys
import h5py
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import animation
class WingPlot3d:
def __init__(self):
self.xyz_to_yzx = True
self.elem_step = 4
filename = sys.argv[1]
h5f= h5py.File(filename,'r')... | [
"matplotlib.animation.FuncAnimation",
"h5py.File",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((297, 321), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (306, 321), False, 'import h5py\n'), ((386, 411), 'numpy.array', 'np.array', (["h5f['ax_array']"], {}), "(h5f['ax_array'])\n", (394, 411), True, 'import numpy as np\n'), ((436, 461), 'numpy.array', 'np.array', (["h5f['le_array']... |
import functools
import caffe2.python.hypothesis_test_util as hu
import caffe2.python.serialized_test.serialized_test_util as serial
import hypothesis.strategies as st
import numpy as np
from caffe2.python import core
from caffe2.python.operator_test.adagrad_test_helper import (
adagrad_sparse_test_helper,... | [
"numpy.abs",
"hypothesis.strategies.sampled_from",
"caffe2.python.hypothesis_test_util.tensors",
"caffe2.python.operator_test.adagrad_test_helper.adagrad_sparse_test_helper",
"hypothesis.strategies.floats",
"numpy.array",
"numpy.empty",
"functools.partial",
"hypothesis.settings",
"caffe2.python.co... | [((815, 839), 'hypothesis.settings', 'settings', ([], {'deadline': '(10000)'}), '(deadline=10000)\n', (823, 839), False, 'from hypothesis import HealthCheck, given, settings\n'), ((1890, 1914), 'hypothesis.settings', 'settings', ([], {'deadline': '(10000)'}), '(deadline=10000)\n', (1898, 1914), False, 'from hypothesis ... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"paddle.fluid.dygraph.guard",
"paddle.fluid.dygraph.to_variable",
"numpy.random.random",
"numpy.asarray",
"numpy.array",
"numpy.random.randint",
"numpy.random.uniform",
"unittest.main"
] | [((9292, 9307), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9305, 9307), False, 'import unittest\n'), ((4645, 4687), 'numpy.random.randint', 'np.random.randint', (['(1)', '(100)'], {'size': 'self.shape'}), '(1, 100, size=self.shape)\n', (4662, 4687), True, 'import numpy as np\n'), ((4703, 4745), 'numpy.random.... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Nipype translation of ANTs' workflows."""
# general purpose
from collections import OrderedDict
from multiprocessing import cpu_count
from pkg_resources import resource_filename as pkgr_fn
from warnings... | [
"numpy.uint8",
"nipype.algorithms.metrics.FuzzyOverlap",
"nibabel.load",
"multiprocessing.cpu_count",
"numpy.asanyarray",
"nipype.interfaces.utility.IdentityInterface",
"nipype.pipeline.engine.Workflow",
"nipype.interfaces.utility.Select",
"pathlib.Path",
"nipype.interfaces.ants.N4BiasFieldCorrect... | [((939, 1003), 'collections.OrderedDict', 'OrderedDict', (["[('nclasses', 3), ('csf', 1), ('gm', 2), ('wm', 3)]"], {}), "([('nclasses', 3), ('csf', 1), ('gm', 2), ('wm', 3)])\n", (950, 1003), False, 'from collections import OrderedDict\n'), ((1016, 1080), 'collections.OrderedDict', 'OrderedDict', (["[('nclasses', 3), (... |
# -*- coding: utf-8 -*-
# https://github.com/openai/gym/wiki/CartPole-v0
# Must read - https://www.nervanasys.com/demystifying-deep-reinforcement-learning/
import tensorflow as tf
import gym
import numpy as np
# 하이퍼파라미터
max_episodes = 10000
# 네트워크 클래스 구성
class DQN:
def __init__(self, session, input_size, output_s... | [
"numpy.reshape",
"tensorflow.variable_scope",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.matmul",
"tensorflow.zeros",
"gym.make",
"tensorflow.truncated_normal"
] | [((2041, 2064), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (2049, 2064), False, 'import gym\n'), ((1392, 1440), 'numpy.reshape', 'np.reshape', (['state'], {'newshape': '[1, self.input_size]'}), '(state, newshape=[1, self.input_size])\n', (1402, 1440), True, 'import numpy as np\n'), ((2237... |
#!/usr/bin/env python
import sys
sys.path.append('.')
import os
import shutil
import tools_for_tests
import numpy as np
import pytest
import eval_pp
import analysis_driver
# directory of test input files
main_test_inputs_dir = os.path.join(os.getcwd(), 'tests', 'test_inputs_integration')
def test_eval_pp_main_no_co... | [
"numpy.isclose",
"analysis_driver.main",
"eval_pp.main",
"os.path.join",
"os.getcwd",
"os.chdir",
"tools_for_tests.TemporaryDirectory",
"pytest.raises",
"os.mkdir",
"sys.path.append"
] | [((33, 53), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (48, 53), False, 'import sys\n'), ((241, 252), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (250, 252), False, 'import os\n'), ((431, 486), 'os.path.join', 'os.path.join', (['main_test_inputs_dir', '"""eval_pp_main_test"""'], {}), "(main_tes... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
""" Stochastic Dynamic Programming library
Implements naive methods of Dynamic Programming (Value Iteration)
to solve *simple* Optimal Stochastic Control problems
classes : SysDescription, DPSolver
"""
from __future__ import division, print_function, unicode_literals, absolu... | [
"numpy.prod",
"numpy.sqrt",
"numpy.array",
"stodynprog.dolointerpolation.multilinear_cython.multilinear_interpolation",
"numpy.reshape",
"itertools.product",
"numpy.max",
"numpy.linspace",
"numpy.min",
"numpy.abs",
"numpy.ceil",
"numpy.inner",
"numpy.broadcast_arrays",
"matplotlib.pyplot.s... | [((34042, 34078), 'scipy.stats.norm', 'stats.norm', ([], {'loc': '(0)', 'scale': 'innov_scale'}), '(loc=0, scale=innov_scale)\n', (34052, 34078), True, 'import scipy.stats as stats\n'), ((36128, 36152), 'numpy.zeros', 'np.zeros', (['(N_E, N_P_req)'], {}), '((N_E, N_P_req))\n', (36136, 36152), True, 'import numpy as np\... |
data_dir = '/mnt/lareaulab/cfbuenabadn/SingleCell/data/'
######################
# load_data_short.py #
######################
print('loading data')
import numpy as np
import pandas as pd
import os
import matplotlib.cm as cm
from matplotlib import pyplot as plt
from scipy import stats as st
import seaborn as sns
imp... | [
"numpy.abs",
"single_cell_plots.get_bins_table2",
"sklearn.cluster.AgglomerativeClustering",
"sys.path.insert",
"pandas.read_csv",
"numpy.random.choice",
"tqdm.tqdm",
"numpy.max",
"numpy.exp",
"numpy.sum",
"splicing_utils.get_int_events",
"sklearn.neighbors.NearestNeighbors",
"pandas.DataFra... | [((353, 427), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/mnt/lareaulab/cfbuenabadn/sc_binary_splicing/utils/"""'], {}), "(0, '/mnt/lareaulab/cfbuenabadn/sc_binary_splicing/utils/')\n", (368, 427), False, 'import sys\n'), ((745, 846), 'pandas.read_csv', 'pd.read_csv', (["(data_dir + 'chen/processed_tables/chen.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 11 12:43:36 2021
@author: ziyi
"""
import numpy as np
import json
import networkx as nx
import math
import torch
# CLS and DTW method copy from: https://github.com/aimagelab/perceive-transform-and-act/
class CLS(object):
""" Coverage weighted ... | [
"networkx.all_pairs_dijkstra_path",
"networkx.all_simple_paths",
"networkx.Graph",
"numpy.sum",
"numpy.array",
"networkx.set_node_attributes",
"numpy.min",
"json.load",
"networkx.all_pairs_dijkstra_path_length"
] | [((848, 913), 'networkx.all_pairs_dijkstra_path_length', 'nx.all_pairs_dijkstra_path_length', (['self.graph'], {'weight': 'self.weight'}), '(self.graph, weight=self.weight)\n', (881, 913), True, 'import networkx as nx\n'), ((1539, 1551), 'numpy.sum', 'np.sum', (['lens'], {}), '(lens)\n', (1545, 1551), True, 'import num... |
# anvil_mods.py
import pandas as pd
import numpy as np
import shapely
import geopandas as gpd
import quandl
from fred import Fred
# demo api key
quandl.ApiConfig.api_key = "<KEY>"
def formatIndicatorLikeQuandl(indicator, **kwargs):
"""
Uses the FRED module to access data not included
in QUANDL's datas... | [
"pandas.Series",
"pandas.DataFrame",
"numpy.round",
"pandas.Timedelta",
"pandas.io.json.json_normalize",
"fred.Fred",
"pandas.concat",
"quandl.get",
"shapely.geometry.shape",
"geopandas.GeoDataFrame",
"geopandas.tools.sjoin",
"pandas.to_datetime"
] | [((10649, 10666), 'pandas.Series', 'pd.Series', (['counts'], {}), '(counts)\n', (10658, 10666), True, 'import pandas as pd\n'), ((15218, 15237), 'numpy.round', 'np.round', (['latest', '(3)'], {}), '(latest, 3)\n', (15226, 15237), True, 'import numpy as np\n'), ((680, 721), 'fred.Fred', 'Fred', ([], {'api_key': '"""<KEY... |
# coding: utf-8
import argparse
import os
import pickle
import numpy as np
from supervised_model_common import *
def pickle_load(file):
with open(file, 'rb') as f:
return pickle.load(f)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--data_prefix', type=st... | [
"os.path.exists",
"argparse.ArgumentParser",
"pickle.load",
"numpy.array",
"os.mkdir",
"numpy.load",
"numpy.random.permutation"
] | [((246, 271), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (269, 271), False, 'import argparse\n'), ((1421, 1442), 'numpy.array', 'np.array', (['train_paths'], {}), '(train_paths)\n', (1429, 1442), True, 'import numpy as np\n'), ((1997, 2041), 'numpy.array', 'np.array', (['[classes[i] for i i... |
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import base64
import os
import struct
import urllib.parse
import urllib.request
import zlib
import numpy as np
from . import BaseDriver
from .helper import guess_mime, array2pb, pb2array
class BaseConvertDriver(Ba... | [
"os.path.exists",
"mimetypes.types_map.values",
"base64.encodebytes",
"magic.from_buffer",
"base64.b64encode",
"urllib.parse.quote",
"struct.pack",
"zlib.compress",
"urllib.parse.quote_from_bytes",
"zlib.crc32",
"mimetypes.guess_type",
"numpy.frombuffer"
] | [((5254, 5275), 'os.path.exists', 'os.path.exists', (['d.uri'], {}), '(d.uri)\n', (5268, 5275), False, 'import os\n'), ((2145, 2173), 'mimetypes.types_map.values', 'mimetypes.types_map.values', ([], {}), '()\n', (2171, 2173), False, 'import mimetypes\n'), ((2197, 2232), 'mimetypes.guess_type', 'mimetypes.guess_type', (... |
# Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
"nnabla.ext_utils.import_extension_module",
"nnabla.set_default_context",
"args.get_micro_args",
"micro_CNN.get_data_stats",
"nnabla.ext_utils.get_extension_context",
"micro_CNN.show_arch",
"numpy.load"
] | [((859, 875), 'args.get_micro_args', 'get_micro_args', ([], {}), '()\n', (873, 875), False, 'from args import get_micro_args\n'), ((1000, 1096), 'nnabla.ext_utils.get_extension_context', 'get_extension_context', (['args.context'], {'device_id': 'args.device_id', 'type_config': 'args.type_config'}), '(args.context, devi... |
# Author: <NAME>
# License: Apache-2.0
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import OneHotEncoder
from sklearn.utils.validation import as_float_array
from xgboost im... | [
"numpy.intersect1d",
"sklearn.utils.validation.as_float_array",
"numpy.hstack",
"numpy.format_float_positional",
"numpy.delete",
"sklearn.preprocessing.OneHotEncoder",
"numpy.invert",
"numpy.array",
"numpy.sum",
"xgboost.XGBRegressor",
"numpy.isnan",
"numpy.setdiff1d",
"sklearn.impute.Simple... | [((2717, 2753), 'numpy.array', 'np.array', (['categorical_features_index'], {}), '(categorical_features_index)\n', (2725, 2753), True, 'import numpy as np\n'), ((3118, 3139), 'numpy.arange', 'np.arange', (['X.shape[1]'], {}), '(X.shape[1])\n', (3127, 3139), True, 'import numpy as np\n'), ((3278, 3295), 'sklearn.utils.v... |
"""skeleton image used by SKNW and then by AmiGraph
This class had a lot of mess and has been refactored"""
import logging
from pathlib import Path
import numpy as np
import networkx as nx
import sknw # must pip install sknw
import os
import matplotlib.pyplot as plt
from skimage import io
# local
from ..pyimage.ami_... | [
"logging.getLogger",
"matplotlib.pyplot.savefig",
"numpy.reshape",
"pathlib.Path",
"skimage.io.show",
"numpy.min",
"numpy.max",
"os.remove",
"numpy.array",
"numpy.negative",
"numpy.append",
"numpy.empty",
"skimage.io.imshow",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((803, 836), 'logging.getLogger', 'logging.getLogger', (['"""ami_skeleton"""'], {}), "('ami_skeleton')\n", (820, 836), False, 'import logging\n'), ((1716, 1726), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (1720, 1726), False, 'from pathlib import Path\n'), ((2247, 2257), 'pathlib.Path', 'Path', (['path'], {})... |
import pytest
import numpy as np
from encomp.units import Q
from encomp.fluids import Fluid, HumidAir, Water
from encomp.utypes import Density
def test_Fluid():
fld = Fluid('R123', P=Q(2, 'bar'), T=Q(25, '°C'))
assert fld.get('S') == Q(1087.7758824621442, 'J/(K kg)')
assert fld.D == fld.get('D')
w... | [
"encomp.units.Q.get_unit",
"encomp.fluids.Fluid",
"encomp.fluids.HumidAir",
"encomp.units.Q",
"numpy.array",
"numpy.linspace",
"numpy.isnan",
"pytest.raises"
] | [((3281, 3291), 'encomp.units.Q', 'Q', (['(20)', '"""C"""'], {}), "(20, 'C')\n", (3282, 3291), False, 'from encomp.units import Q\n'), ((3300, 3312), 'encomp.units.Q', 'Q', (['(20)', '"""bar"""'], {}), "(20, 'bar')\n", (3301, 3312), False, 'from encomp.units import Q\n'), ((3321, 3331), 'encomp.units.Q', 'Q', (['(20)',... |
#! /usr/bin/env python
from __future__ import division
from builtins import range
from LLC_Membranes.llclib import file_rw, transform, topology
import mdtraj as md
import numpy as np
import matplotlib.path as mplPath
import mdtraj as md
from random import randint
import tqdm
class region:
"""
Define a region... | [
"numpy.argsort",
"builtins.range",
"numpy.linalg.norm",
"numpy.sin",
"numpy.mean",
"matplotlib.path.Path",
"numpy.histogram",
"numpy.histogramdd",
"LLC_Membranes.llclib.transform.translate",
"numpy.where",
"numpy.asarray",
"numpy.fft.fftn",
"numpy.max",
"numpy.linspace",
"numpy.vstack",
... | [((5320, 5346), 'numpy.mean', 'np.mean', (['box[equil:, 2, 2]'], {}), '(box[equil:, 2, 2])\n', (5327, 5346), True, 'import numpy as np\n'), ((6596, 6610), 'numpy.zeros', 'np.zeros', (['[nT]'], {}), '([nT])\n', (6604, 6610), True, 'import numpy as np\n'), ((6624, 6633), 'builtins.range', 'range', (['nT'], {}), '(nT)\n',... |
# Copyright (c) 2011-2020, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
# Written by <NAME>, <NAME>, and <NAME>
# e-mail: <EMAIL>
# LLNL-CODE-507071
# All rights reserved.
# This file is part of PDV. For details, see <URL describing code and
# how to downlo... | [
"numpy.power",
"numpy.where",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.isnan",
"numpy.empty",
"numpy.interp",
"numpy.linalg.norm"
] | [((3437, 3448), 'numpy.empty', 'np.empty', (['(0)'], {}), '(0)\n', (3445, 3448), True, 'import numpy as np\n'), ((3457, 3468), 'numpy.empty', 'np.empty', (['(0)'], {}), '(0)\n', (3465, 3468), True, 'import numpy as np\n'), ((9942, 10021), 'scipy.interpolate.interp1d', 'interpolate.interp1d', (['a.x', 'a.y'], {'kind': '... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 15 15:26:29 2015
@author: J-R
"""
import numpy as np
import astropy.io.fits as pf
from configobj import ConfigObj
import ipdb
import matplotlib.pyplot as plt
import medis.speckle_nulling.sn_hardware as hardware
import medis.speckle_nulling.dm_functions as DM
import flatm... | [
"shift.shift",
"Estimation_1ref.Estimation_1ref",
"medis.speckle_nulling.sn_hardware.PHARO_COM",
"numpy.zeros",
"numpy.dot",
"flatmapfunctions.convert_hodm_telem",
"numpy.concatenate",
"astropy.io.fits.open",
"medis.speckle_nulling.sn_hardware.P3K_COM"
] | [((1017, 1051), 'astropy.io.fits.open', 'pf.open', (["(dirwr + 'Freq_start.fits')"], {}), "(dirwr + 'Freq_start.fits')\n", (1024, 1051), True, 'import astropy.io.fits as pf\n'), ((1150, 1181), 'astropy.io.fits.open', 'pf.open', (["(dirwr + 'Mat_com.fits')"], {}), "(dirwr + 'Mat_com.fits')\n", (1157, 1181), True, 'impor... |
from __future__ import print_function
import numpy as np
import powderday.config as cfg
import yt
from yt.frontends.sph.data_structures import ParticleDataset
from yt.geometry.selection_routines import AlwaysSelector
import pdb
ParticleDataset.filter_bbox = True
ParticleDataset._skip_cache = True
def octree_zoom_bb... | [
"numpy.asarray",
"numpy.sum",
"numpy.array",
"yt.load",
"yt.geometry.selection_routines.AlwaysSelector"
] | [((7825, 7848), 'yt.load', 'yt.load', (['"""temp_enzo.h5"""'], {}), "('temp_enzo.h5')\n", (7832, 7848), False, 'import yt\n'), ((548, 601), 'numpy.sum', 'np.sum', (["(ad['gasdensity'] * ad['gascoordinates'][:, 0])"], {}), "(ad['gasdensity'] * ad['gascoordinates'][:, 0])\n", (554, 601), True, 'import numpy as np\n'), ((... |
# coding: utf8
# !/usr/env/python
# This file has tests for the old style output writers to ensure backwards
# compatibility. All of the existing tests for output writers are kept as is.
# There are a few new ones too.
import glob
import os
import numpy as np
from terrainbento import Basic, NotCoreNodeBaselevelHand... | [
"numpy.mean",
"os.path.join",
"os.path.dirname",
"terrainbento.NotCoreNodeBaselevelHandler",
"numpy.min",
"terrainbento.Basic",
"terrainbento.utilities.filecmp",
"glob.glob",
"os.remove"
] | [((387, 420), 'os.path.join', 'os.path.join', (['os.curdir', '"""output"""'], {}), "(os.curdir, 'output')\n", (399, 420), False, 'import os\n'), ((451, 476), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (466, 476), False, 'import os\n'), ((534, 574), 'os.path.join', 'os.path.join', (['_TEST... |
"""Auto pipeline for object detection task"""
# pylint: disable=bad-whitespace,missing-class-docstring,bare-except
import time
import os
import math
import copy
import logging
import pprint
import json
import pickle
from typing import Union, Tuple
import uuid
import shutil
import numpy as np
import pandas as pd
from a... | [
"logging.getLogger",
"autogluon.core.utils.get_cpu_count",
"pickle.dumps",
"gluoncv.auto.estimators.base_estimator.BaseEstimator.load",
"autogluon.core.Categorical",
"pickle.loads",
"copy.copy",
"logging.info",
"autogluon.core.utils.get_gpu_count_all",
"os.listdir",
"json.dumps",
"os.path.isdi... | [((1057, 1127), 'autogluon.core.Categorical', 'ag.Categorical', (['"""ssd_512_mobilenet1.0_coco"""', '"""yolo3_mobilenet1.0_coco"""'], {}), "('ssd_512_mobilenet1.0_coco', 'yolo3_mobilenet1.0_coco')\n", (1071, 1127), True, 'import autogluon.core as ag\n'), ((1523, 1658), 'autogluon.core.Categorical', 'ag.Categorical', (... |
#coding:utf-8
import cv2
import numpy as np
import sys
import os
COLOR_BG = (255,0,0)
COLOR_FG = (0,255,0)
def mask2color(mask):
r,c = mask.shape[:2]
color = np.zeros((r,c,3),np.uint8)
color[np.where((mask==0)|(mask==2))] = COLOR_BG
color[np.where((mask==1)|(mask==3))] = COLOR_FG
return color
def... | [
"cv2.setMouseCallback",
"numpy.copy",
"os.path.exists",
"numpy.clip",
"os.listdir",
"os.makedirs",
"numpy.where",
"cv2.grabCut",
"cv2.setTrackbarPos",
"os.path.join",
"cv2.imshow",
"cv2.putText",
"numpy.zeros",
"cv2.circle",
"cv2.getTrackbarPos",
"cv2.waitKey",
"cv2.createTrackbar",
... | [((168, 197), 'numpy.zeros', 'np.zeros', (['(r, c, 3)', 'np.uint8'], {}), '((r, c, 3), np.uint8)\n', (176, 197), True, 'import numpy as np\n'), ((377, 403), 'numpy.zeros', 'np.zeros', (['(r, c)', 'np.uint8'], {}), '((r, c), np.uint8)\n', (385, 403), True, 'import numpy as np\n'), ((205, 240), 'numpy.where', 'np.where',... |
import os
import cv2
import xml.etree.ElementTree as ET
import numpy as np
# This function is used to load data
# Path to image file, and xml_file are given as input, and it returns image, bounding_box, class as output
def read_sample(image_path, label_path):
image_path = image_path.strip("\n")
label_path = l... | [
"os.path.exists",
"xml.etree.ElementTree.parse",
"os.path.isfile",
"numpy.array",
"os.path.isdir",
"cv2.imread"
] | [((353, 379), 'os.path.exists', 'os.path.exists', (['image_path'], {}), '(image_path)\n', (367, 379), False, 'import os\n'), ((421, 447), 'os.path.exists', 'os.path.exists', (['label_path'], {}), '(label_path)\n', (435, 447), False, 'import os\n'), ((491, 513), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_... |
#!/usr/bin/env python
"""Auxiliary numerical tools
"""
from math import acos, pi, sqrt
from warnings import warn
#from . import log as log
import anuga.utilities.log as anuga_log
import numpy as num
#After having migrated to numpy we should use the native NAN.
#num.seterr(divide='warn')
num.seterr(divide='ignore') ... | [
"math.acos",
"numpy.sort",
"math.sqrt",
"numpy.inner",
"numpy.ascontiguousarray",
"numpy.array",
"numpy.sum",
"numpy.ravel",
"numpy.seterr",
"numpy.arange"
] | [((292, 319), 'numpy.seterr', 'num.seterr', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (302, 319), True, 'import numpy as num\n'), ((1147, 1154), 'math.acos', 'acos', (['x'], {}), '(x)\n', (1151, 1154), False, 'from math import acos, pi, sqrt\n'), ((1904, 1921), 'numpy.inner', 'num.inner', (['v1', 'v2'], ... |
import cv2
import numpy
from PIL import Image
def LoadImage(path):
pilImage = Image.open(path)
npImage = numpy.array(pilImage)
loadedImage = cv2.cvtColor(npImage, cv2.COLOR_RGB2BGR)
return loadedImage | [
"numpy.array",
"PIL.Image.open",
"cv2.cvtColor"
] | [((83, 99), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (93, 99), False, 'from PIL import Image\n'), ((114, 135), 'numpy.array', 'numpy.array', (['pilImage'], {}), '(pilImage)\n', (125, 135), False, 'import numpy\n'), ((154, 194), 'cv2.cvtColor', 'cv2.cvtColor', (['npImage', 'cv2.COLOR_RGB2BGR'], {}), '... |
import numpy as np
import random
import time
import json
from model.model_wrapper import Models
from socketIO_client import SocketIO
from utils.model_dump import *
import os
import logging
import argparse
logging.getLogger('socketIO-client').setLevel(logging.WARNING)
random.seed(2018)
datestr = time.strftime('%m%d')... | [
"logging.getLogger",
"os.path.exists",
"logging.StreamHandler",
"argparse.ArgumentParser",
"numpy.nan_to_num",
"logging.Formatter",
"time.strftime",
"os.path.join",
"random.seed",
"os.path.basename",
"json.load",
"random.random",
"time.time",
"random.randint",
"socketIO_client.SocketIO"
... | [((271, 288), 'random.seed', 'random.seed', (['(2018)'], {}), '(2018)\n', (282, 288), False, 'import random\n'), ((299, 320), 'time.strftime', 'time.strftime', (['"""%m%d"""'], {}), "('%m%d')\n", (312, 320), False, 'import time\n'), ((331, 375), 'os.path.join', 'os.path.join', (['"""experiments"""', '"""logs"""', 'date... |
"""Usage: run_K_maps.py <R_s>
Generates various TeslaMax models, using common paramaters and
the value of the external radius <R_s>, and optimizes them for several
ramp profile.
The results are saved in a file 'map_K_Rs_<R_s>.txt', with the argument
printed in mm. The first lines of this file are a string representat... | [
"numpy.ones",
"pathlib.Path",
"pathlib.Path.home",
"numpy.array",
"teslamax.TeslaMaxPreDesign",
"docopt.docopt",
"numpy.arange"
] | [((871, 897), 'docopt.docopt', 'docopt', (['__doc__'], {'help': '(True)'}), '(__doc__, help=True)\n', (877, 897), False, 'from docopt import docopt\n'), ((1665, 1694), 'pathlib.Path', 'Path', (["('map_K_Rs_%d.txt' % R_s)"], {}), "('map_K_Rs_%d.txt' % R_s)\n", (1669, 1694), False, 'from pathlib import Path\n'), ((2072, ... |
"""This file contains utilities for processing list files."""
from typing import List, Tuple
from numba import njit
import numpy as np
from .lst_to_crd import LST2CRD
def ascii_to_ndarray(
data_list: List[str], fmt: LST2CRD.ASCIIFormat, channel: int, tag: int = None
) -> Tuple[np.ndarray, np.ndarray]:
"""T... | [
"numpy.where"
] | [((4190, 4228), 'numpy.where', 'np.where', (['(data_sort[:, 1] <= ion_range)'], {}), '(data_sort[:, 1] <= ion_range)\n', (4198, 4228), True, 'import numpy as np\n')] |
# ----------------------------------------------------------------------------
# Copyright (c) 2016--, Calour development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# -----------------------------------------------... | [
"calour.read_ms",
"calour.read_amplicon",
"numpy.testing.assert_array_equal"
] | [((532, 619), 'calour.read_amplicon', 'ca.read_amplicon', (['self.test1_biom', 'self.test1_samp'], {'min_reads': '(1000)', 'normalize': '(10000)'}), '(self.test1_biom, self.test1_samp, min_reads=1000,\n normalize=10000)\n', (548, 619), True, 'import calour as ca\n'), ((785, 928), 'calour.read_ms', 'ca.read_ms', (['s... |
import numpy as np
from . import _fastmath_ext
__all__ = ['polar_dec']
def polar_dec(matrices):
"""
Batched polar decomposition of an array of stacked matrices,
e.g. given matrices [M1, M2, ..., Mn], decomposes each matrix
into rotation and skew-symmetric matrices.
>>> matrices = np.random.rand... | [
"numpy.asarray"
] | [((482, 502), 'numpy.asarray', 'np.asarray', (['matrices'], {}), '(matrices)\n', (492, 502), True, 'import numpy as np\n')] |
import os
import re
import cv2
import numpy as np
from PIL import Image
import torch
from torch.utils.data import Dataset
class RealVideos(Dataset):
def __init__(self):
self.img_dir = '/shared/results/Skopia/videos_8frames'
self.ch, self.duration, self.h, self.w = 3, 8, 1024, 1024
self.vi... | [
"torch.as_tensor",
"os.listdir",
"PIL.Image.open",
"re.compile",
"numpy.empty"
] | [((398, 422), 'os.listdir', 'os.listdir', (['self.img_dir'], {}), '(self.img_dir)\n', (408, 422), False, 'import os\n'), ((442, 482), 're.compile', 're.compile', (['"""([0-9]+_[0-9]+)_[0-7]+.jpg"""'], {}), "('([0-9]+_[0-9]+)_[0-7]+.jpg')\n", (452, 482), False, 'import re\n'), ((699, 767), 'numpy.empty', 'np.empty', (['... |
import numpy as np
from gam.clustering import KMedoids
from gam.spearman_distance import spearman_squared_distance
def test_kmedoids():
""""Run kmedoids on sample attributions"""
kmedoids_2 = KMedoids(2, dist_func=spearman_squared_distance, max_iter=1000, tol=0.0001, init_medoids=None)
attributions = np.a... | [
"gam.clustering.KMedoids",
"numpy.array"
] | [((202, 300), 'gam.clustering.KMedoids', 'KMedoids', (['(2)'], {'dist_func': 'spearman_squared_distance', 'max_iter': '(1000)', 'tol': '(0.0001)', 'init_medoids': 'None'}), '(2, dist_func=spearman_squared_distance, max_iter=1000, tol=0.0001,\n init_medoids=None)\n', (210, 300), False, 'from gam.clustering import KMe... |
import copy
import numpy as np
import torch
class Memory:
def __init__(self, memory_size, nb_total_classes, rehearsal, fixed=True):
self.memory_size = memory_size
self.nb_total_classes = nb_total_classes
self.rehearsal = rehearsal
self.fixed = fixed
self.x = self.y = self... | [
"numpy.mean",
"numpy.savez",
"numpy.unique",
"torch.utils.data.DataLoader",
"numpy.where",
"numpy.random.choice",
"numpy.power",
"numpy.linalg.norm",
"numpy.argmax",
"numpy.argsort",
"numpy.sum",
"numpy.zeros",
"numpy.dot",
"numpy.concatenate",
"copy.deepcopy",
"torch.no_grad",
"nump... | [((5237, 5357), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': '(128)', 'num_workers': '(2)', 'pin_memory': '(True)', 'drop_last': '(False)', 'shuffle': '(False)'}), '(dataset, batch_size=128, num_workers=2,\n pin_memory=True, drop_last=False, shuffle=False)\n', (5264, 535... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 10 19:54:46 2021
@author: marina
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from os import listdir
# Root Mean Squared Error calculation
def rmse_error(df, str_1, str_2):
mse = sum((df[str_1] - df[str_2])**2)/df... | [
"numpy.sqrt",
"pandas.read_csv",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((700, 720), 'pandas.read_csv', 'pd.read_csv', (['csvfile'], {}), '(csvfile)\n', (711, 720), True, 'import pandas as pd\n'), ((785, 800), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (797, 800), True, 'import matplotlib.pyplot as plt\n'), ((1767, 1785), 'matplotlib.pyplot.tight_layout', 'plt.t... |
from scipy.optimize import linear_sum_assignment
import numpy as np
import matplotlib.pyplot as plt
import os
import pickle
from sklearn.neighbors import NearestNeighbors as KNN # http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html
from sklearn.decomposition import PCA
import... | [
"numpy.mean",
"os.path.exists",
"pickle.dump",
"matplotlib.pyplot.savefig",
"os.makedirs",
"numpy.random.rand",
"sklearn.decomposition.PCA",
"numpy.array2string",
"numpy.where",
"matplotlib.pyplot.clf",
"pickle.load",
"numpy.asarray",
"numpy.zeros",
"sklearn.neighbors.NearestNeighbors",
... | [((330, 363), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (353, 363), False, 'import warnings\n'), ((9097, 9161), 'sklearn.neighbors.NearestNeighbors', 'KNN', ([], {'n_neighbors': '(n_neighbors + 1)', 'algorithm': '"""kd_tree"""', 'n_jobs': '(-1)'}), "(n_neighbors=n_nei... |
import pandas as pd
import numpy as np
from swmmtoolbox import swmmtoolbox as swmm
# Get some labels to extract
filename = 'frutal.out'
c = swmm.catalog(filename)
c = pd.DataFrame(c)
# Get nodes only
item_names = c[c[0] == 'node'][1].values
items = pd.Series(np.repeat(item_names, 3)).astype(str)
# Get depth head and i... | [
"swmmtoolbox.swmmtoolbox.catalog",
"swmmtoolbox.swmmtoolbox.fast_extract",
"pandas.DataFrame",
"numpy.repeat"
] | [((141, 163), 'swmmtoolbox.swmmtoolbox.catalog', 'swmm.catalog', (['filename'], {}), '(filename)\n', (153, 163), True, 'from swmmtoolbox import swmmtoolbox as swmm\n'), ((168, 183), 'pandas.DataFrame', 'pd.DataFrame', (['c'], {}), '(c)\n', (180, 183), True, 'import pandas as pd\n'), ((588, 624), 'swmmtoolbox.swmmtoolbo... |
from climpy.utils.file_path_utils import get_root_storage_path_on_hpc
import netCDF4
from climpy.utils.diag_decorators import time_interval_selection
# from climpy.utils.time_utils import process_time_range_impl
from climpy.utils.netcdf_utils import generate_netcdf_uniform_time_data
import numpy as np
__author__ = '<N... | [
"climpy.utils.netcdf_utils.generate_netcdf_uniform_time_data",
"netCDF4.Dataset",
"climpy.utils.file_path_utils.get_root_storage_path_on_hpc",
"numpy.squeeze"
] | [((697, 723), 'netCDF4.Dataset', 'netCDF4.Dataset', (['file_path'], {}), '(file_path)\n', (712, 723), False, 'import netCDF4\n'), ((741, 796), 'climpy.utils.netcdf_utils.generate_netcdf_uniform_time_data', 'generate_netcdf_uniform_time_data', (["nc.variables['time']"], {}), "(nc.variables['time'])\n", (774, 796), False... |
from math import log, exp, sqrt, tanh, sin, cos, tan, atan2, ceil, pi
import numpy as np
from OpenGL.GL import *
from PyEngine3D.Common import logger
from PyEngine3D.App import CoreManager
from PyEngine3D.OpenGLContext import CreateTexture, Texture2D, Texture2DArray, Texture3D, FrameBuffer
from PyEngine3D.Render impo... | [
"PyEngine3D.App.CoreManager.instance",
"math.sqrt",
"PyEngine3D.Render.ScreenQuad.get_vertex_array_buffer",
"math.log",
"math.cos",
"numpy.zeros",
"math.sin",
"math.atan2",
"PyEngine3D.Render.Plane",
"PyEngine3D.OpenGLContext.CreateTexture"
] | [((3477, 3513), 'PyEngine3D.Render.ScreenQuad.get_vertex_array_buffer', 'ScreenQuad.get_vertex_array_buffer', ([], {}), '()\n', (3511, 3513), False, 'from PyEngine3D.Render import RenderTarget, ScreenQuad, Plane\n'), ((3538, 3642), 'PyEngine3D.Render.Plane', 'Plane', (['"""FFT_Grid"""'], {'mode': 'GL_QUADS', 'width': '... |
import numpy as np
import warnings
from time import time
import pandas as pd
from itertools import count, product
from copy import deepcopy
from scipy import optimize
from sklearn import linear_model as LM
from sklearn.svm import SVC, LinearSVC
from sklearn.neural_network import MLPClassifier
from sklearn.exceptions i... | [
"core.base.sc.SeldonianClassifier",
"numpy.array",
"baselines.fair_robust.unlabeled.UnlabeledFairRobust",
"sklearn.linear_model.SGDClassifier",
"utils.experiments.demographic_shift.make_intervals",
"numpy.dot",
"pandas.DataFrame",
"warnings.simplefilter",
"baselines.fair_classification.utils.train_m... | [((1053, 1115), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (1074, 1115), False, 'import warnings\n'), ((1116, 1183), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'cat... |
# Program 21d: Animation of a JJ limit cycle bifurcation.
# See Figure 21.9.
from matplotlib import pyplot as plt
from matplotlib.animation import ArtistAnimation
import numpy as np
from scipy.integrate import odeint
fig = plt.figure()
myimages = []
bj = 1.2
tmax = 100
def jj_ode(x, t):
return [x[1], kappa - bj... | [
"scipy.integrate.odeint",
"matplotlib.animation.ArtistAnimation",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((225, 237), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (235, 237), True, 'from matplotlib import pyplot as plt\n'), ((350, 373), 'numpy.arange', 'np.arange', (['(0)', 'tmax', '(0.1)'], {}), '(0, tmax, 0.1)\n', (359, 373), True, 'import numpy as np\n'), ((403, 425), 'numpy.arange', 'np.arange', (['(0.... |
import sys
import numpy as np
import math
import librosa
import soundfile as sf
import json
from librosa.core.spectrum import power_to_db
import scipy
file_path = sys.argv[1]
data, samplerate = sf.read(file_path)
#data = np.clip(data*3, -1, 1)
with open("MfccConfig.json", "r") as f:
config = json.load(f)
frame_s... | [
"numpy.abs",
"librosa.filters.get_window",
"librosa.core.spectrum.stft",
"math.log",
"librosa.util.pad_center",
"numpy.dot",
"scipy.fftpack.dct",
"librosa.filters.mel",
"librosa.core.spectrum.power_to_db",
"json.load",
"soundfile.read"
] | [((195, 213), 'soundfile.read', 'sf.read', (['file_path'], {}), '(file_path)\n', (202, 213), True, 'import soundfile as sf\n'), ((788, 832), 'librosa.filters.get_window', 'get_window', (['"""hann"""', 'frame_size'], {'fftbins': '(True)'}), "('hann', frame_size, fftbins=True)\n", (798, 832), False, 'from librosa.filters... |
# Copyright 2019-21 by <NAME>. All rights reserved.
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""SCADIO: write OpenSCAD prog... | [
"Bio.PDB.vectors.homog_scale_mtx",
"numpy.dot",
"Bio.File.as_handle",
"Bio.PDB.internal_coords.IC_Chain"
] | [((7667, 7689), 'Bio.PDB.vectors.homog_scale_mtx', 'homog_scale_mtx', (['scale'], {}), '(scale)\n', (7682, 7689), False, 'from Bio.PDB.vectors import homog_scale_mtx\n'), ((9573, 9593), 'Bio.File.as_handle', 'as_handle', (['file', '"""w"""'], {}), "(file, 'w')\n", (9582, 9593), False, 'from Bio.File import as_handle\n'... |
import numpy as np
import random
import torch.nn.functional as F
import torch
import argparse
import json
def parse_args():
parser = argparse.ArgumentParser(description="Evaluation embedding based on link prediction")
parser.add_argument('--embedding_path', default=None)
parser.add_argument('--edgelist... | [
"argparse.ArgumentParser",
"torch.nn.functional.cosine_similarity",
"numpy.sum",
"numpy.array",
"numpy.zeros",
"numpy.load",
"torch.FloatTensor"
] | [((142, 231), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluation embedding based on link prediction"""'}), "(description=\n 'Evaluation embedding based on link prediction')\n", (165, 231), False, 'import argparse\n'), ((675, 714), 'numpy.sum', 'np.sum', (['((matrix1 - matrix2) ... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from collections import OrderedDict
import os
import warnings
import numpy as np
from typing import Any, Callable, Dict, List, Tuple, Union
from pathlib import Path
import matplotlib.pyplot as plt
import torch.cuda as cuda
fr... | [
"apex.amp.scale_loss",
"torch.nn.CrossEntropyLoss",
"io.BytesIO",
"time.sleep",
"numpy.array",
"apex.amp.initialize",
"torch.cuda.is_available",
"torch.nn.functional.softmax",
"utils_cv.action_recognition.dataset.get_transforms",
"collections.deque",
"torch.set_grad_enabled",
"decord.VideoRead... | [((3786, 3881), 'torch.hub.load', 'torch.hub.load', (['TORCH_R2PLUS1D', 'model_name'], {'num_classes': 'MODELS[model_name]', 'pretrained': '(True)'}), '(TORCH_R2PLUS1D, model_name, num_classes=MODELS[model_name],\n pretrained=True)\n', (3800, 3881), False, 'import torch\n'), ((5409, 5446), 'os.makedirs', 'os.makedir... |
import numpy as np
from .geometry import Point, Rectangle, Circle
from typing import Union
import copy
class Entity:
def __init__(self, center: Point, heading: float, movable: bool = True, friction: float = 0):
self.center = center # this is x, y
self.heading = heading
self.movable = movable
self.color = 'gh... | [
"numpy.clip",
"numpy.array",
"numpy.zeros",
"numpy.cos",
"copy.deepcopy",
"numpy.sin"
] | [((2457, 2476), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (2470, 2476), False, 'import copy\n'), ((2997, 3031), 'numpy.zeros', 'np.zeros', (['(4, 2)'], {'dtype': 'np.float32'}), '((4, 2), dtype=np.float32)\n', (3005, 3031), True, 'import numpy as np\n'), ((3558, 3598), 'numpy.array', 'np.array', (['... |
import unittest
import tlpy.defect
import tlpy.host
import numpy as np
from unittest.mock import Mock
class DefectTestCase( unittest.TestCase ):
"""Test for `defect.py`"""
def setUp( self ):
elemental_energies = { 'Ge' : -4.48604,
'P' : -5.18405,
'O' : ... | [
"unittest.main",
"numpy.array",
"numpy.allclose"
] | [((4321, 4336), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4334, 4336), False, 'import unittest\n'), ((3252, 3293), 'numpy.allclose', 'np.allclose', (['tl_profile', 'expected_profile'], {}), '(tl_profile, expected_profile)\n', (3263, 3293), True, 'import numpy as np\n'), ((3444, 3478), 'numpy.array', 'np.arra... |
import numpy as np
def spiral_data(points, classes):
# https://cs231n.github.io/neural-networks-case-study/
X = np.zeros((points*classes, 2))
y = np.zeros(points*classes, dtype='uint8')
for class_number in range(classes):
ix = range(points*class_number, points*(class_number+1))
... | [
"numpy.zeros",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.random.randn"
] | [((127, 158), 'numpy.zeros', 'np.zeros', (['(points * classes, 2)'], {}), '((points * classes, 2))\n', (135, 158), True, 'import numpy as np\n'), ((166, 207), 'numpy.zeros', 'np.zeros', (['(points * classes)'], {'dtype': '"""uint8"""'}), "(points * classes, dtype='uint8')\n", (174, 207), True, 'import numpy as np\n'), ... |
import numpy as np
import matplotlib.pyplot as plt
from utils import *
import lr_funcs as lr
XTrain_Orig, YTrain, XTest_Orig, YTest, classes = load_datasets(False)
XTrain = lr.reshape_features(XTrain_Orig)/255.
XTest = lr.reshape_features(XTest_Orig)/255.
# print_stats(XTrain_Orig, YTrain, XTest_Orig, YTest)
def ... | [
"lr_funcs.reshape_features",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.squeeze",
"lr_funcs.model",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((176, 208), 'lr_funcs.reshape_features', 'lr.reshape_features', (['XTrain_Orig'], {}), '(XTrain_Orig)\n', (195, 208), True, 'import lr_funcs as lr\n'), ((222, 253), 'lr_funcs.reshape_features', 'lr.reshape_features', (['XTest_Orig'], {}), '(XTest_Orig)\n', (241, 253), True, 'import lr_funcs as lr\n'), ((694, 712), 'm... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 26 18:29:41 2019
@author: <NAME>
"""
import cv2
from PIL import Image
import matplotlib.pyplot as plt
import tools
import numpy as np
from scipy import ndimage
#from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
#%%
#images
#PS... | [
"matplotlib.pyplot.imshow",
"tools.generate_template",
"PIL.Image.fromarray",
"cv2.imwrite",
"PIL.Image.open",
"tools.concatenate",
"numpy.sum",
"numpy.zeros",
"numpy.random.randint",
"tools.sharp",
"tools.register_image",
"cv2.resize",
"cv2.imread",
"tools.stretch_8bit",
"matplotlib.pyp... | [((758, 781), 'cv2.imread', 'cv2.imread', (['"""rocks.jpg"""'], {}), "('rocks.jpg')\n", (768, 781), False, 'import cv2\n'), ((847, 866), 'tools.sharp', 'tools.sharp', (['img', '(3)'], {}), '(img, 3)\n', (858, 866), False, 'import tools\n'), ((879, 902), 'tools.stretch_8bit', 'tools.stretch_8bit', (['img'], {}), '(img)\... |
from .tprofile import TemperatureProfile
import numpy as np
class TemperatureArray(TemperatureProfile):
"""
Temperature profile loaded from array
"""
def __init__(self, tp_array=[2000, 1000]):
super().__init__(self.__class__.__name__)
self._tp_profile = np.array(tp_array)
@pro... | [
"numpy.array",
"numpy.linspace",
"numpy.interp"
] | [((292, 310), 'numpy.array', 'np.array', (['tp_array'], {}), '(tp_array)\n', (300, 310), True, 'import numpy as np\n'), ((616, 664), 'numpy.linspace', 'np.linspace', (['(0.0)', '(1.0)', 'self._tp_profile.shape[0]'], {}), '(0.0, 1.0, self._tp_profile.shape[0])\n', (627, 664), True, 'import numpy as np\n'), ((692, 727), ... |
#!/usr/bin/env python
import os
import subprocess
import argparse
import sys
import nibabel as nib
from builtins import str
import matplotlib.pyplot as plt
import numpy as np
import nipype.algorithms.confounds as npalg
import nilearn.plotting as nlp
import nilearn.image as nimg
import nilearn.signal as sgn
from... | [
"nilearn.image.new_img_like",
"subprocess.check_output",
"numpy.mean",
"PIL.Image.open",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"nibabel.load",
"numpy.floor",
"PIL.ImageFont.truetype",
"nilearn.plotting.plot_epi",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.figure"... | [((470, 528), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Save QA check Plots"""'}), "(description='Save QA check Plots')\n", (493, 528), False, 'import argparse\n'), ((1722, 1783), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 20, 'font.weight': 'bold'}... |
import bitarray
import numpy as np
import subprocess as sp
from qubit_interaction import to_qubits, to_cbits
from qiskit import QuantumCircuit, execute, Aer
from qiskit.visualization import plot_histogram, plot_bloch_multivector
def compare_bases(bases1, bases2, bits):
formed_key = []
for i in range(len(bases1... | [
"numpy.array",
"numpy.array_equal",
"numpy.random.seed",
"subprocess.call",
"qubit_interaction.to_qubits",
"qubit_interaction.to_cbits",
"bitarray.bitarray"
] | [((459, 487), 'subprocess.call', 'sp.call', (['"""clear"""'], {'shell': '(True)'}), "('clear', shell=True)\n", (466, 487), True, 'import subprocess as sp\n'), ((942, 970), 'subprocess.call', 'sp.call', (['"""clear"""'], {'shell': '(True)'}), "('clear', shell=True)\n", (949, 970), True, 'import subprocess as sp\n'), ((1... |
import random
import os
import pickle
import librosa as lb
import numpy as np
import musdb
import yaml
# ignore warning about unsafe loaders in pyYAML 5.1 (used in musdb)
# https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
yaml.warnings({'YAMLLoadWarning': False})
def musdb_pre_processing(pat... | [
"os.path.exists",
"random.sample",
"librosa.util.frame",
"pickle.dump",
"os.makedirs",
"yaml.warnings",
"librosa.to_mono",
"os.path.join",
"random.seed",
"musdb.DB",
"librosa.core.resample",
"numpy.arange"
] | [((248, 289), 'yaml.warnings', 'yaml.warnings', (["{'YAMLLoadWarning': False}"], {}), "({'YAMLLoadWarning': False})\n", (261, 289), False, 'import yaml\n'), ((731, 771), 'os.path.join', 'os.path.join', (['path_to_save_data', '"""train"""'], {}), "(path_to_save_data, 'train')\n", (743, 771), False, 'import os\n'), ((799... |
# Feature extraction example
import numpy as np
import librosa
np.seterr(divide='ignore', invalid='ignore')
# Load the example clip
audio_path = './generated-audio/test.mp3'
y, sr = librosa.load(audio_path)
# Separate harmonics and percussives into two waveforms
y_harmonic, y_percussive = librosa.effects.hpss(y)
# ... | [
"librosa.feature.sync",
"librosa.feature.chroma_cqt",
"librosa.feature.delta",
"librosa.beat.beat_track",
"librosa.feature.mfcc",
"numpy.vstack",
"numpy.seterr",
"librosa.effects.hpss",
"librosa.load"
] | [((64, 108), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (73, 108), True, 'import numpy as np\n'), ((184, 208), 'librosa.load', 'librosa.load', (['audio_path'], {}), '(audio_path)\n', (196, 208), False, 'import librosa\n'), ((293, 31... |
import torch
import numpy as np
import pandas as pd
import os
class MNIST:
def __init__(self, DATASET_DIR='./dataset/MNIST/'):
self.DATASET_DIR = DATASET_DIR
def fit_normalizer(self, x):
self.min = np.min(x)
self.max = np.max(x)
def transform_normalizer(self, x):
return (x - self.min)/(self.max - self.min... | [
"numpy.max",
"torch.from_numpy",
"pandas.read_csv",
"numpy.min"
] | [((206, 215), 'numpy.min', 'np.min', (['x'], {}), '(x)\n', (212, 215), True, 'import numpy as np\n'), ((229, 238), 'numpy.max', 'np.max', (['x'], {}), '(x)\n', (235, 238), True, 'import numpy as np\n'), ((446, 488), 'pandas.read_csv', 'pd.read_csv', (["(self.DATASET_DIR + 'test.csv')"], {}), "(self.DATASET_DIR + 'test.... |
from __future__ import division
import numpy as np
import climlab
import pytest
from climlab.radiation.rrtm import _climlab_to_rrtm, _rrtm_to_climlab
from climlab.tests.xarray_test import to_xarray
num_lev = 30
@pytest.mark.compiled
@pytest.mark.fast
def test_rrtmg_lw_creation():
state = climlab.column_state(num_... | [
"climlab.radiation.RRTMG",
"climlab.tests.xarray_test.to_xarray",
"climlab.radiation.CAM3",
"climlab.radiation.AnnualMeanInsolation",
"climlab.radiation.CAM3_LW",
"numpy.diff",
"numpy.exp",
"climlab.process_like",
"numpy.linspace",
"climlab.couple",
"climlab.convection.ConvectiveAdjustment",
"... | [((295, 349), 'climlab.column_state', 'climlab.column_state', ([], {'num_lev': 'num_lev', 'water_depth': '(5.0)'}), '(num_lev=num_lev, water_depth=5.0)\n', (315, 349), False, 'import climlab\n'), ((359, 398), 'climlab.radiation.RRTMG_LW', 'climlab.radiation.RRTMG_LW', ([], {'state': 'state'}), '(state=state)\n', (385, ... |
"""
Low level interface to the SBIG Unversal Driver/Library.
Reproduces in Python (using ctypes) the C interface provided by SBIG's shared
library, i.e. 1 function that does 72 different things selected by passing an
integer as the first argument. This is basically a direct translation of the
enums and structs defined... | [
"ctypes.util.find_library",
"ctypes.byref",
"astropy.time.Time.now",
"astropy.io.fits.PrimaryHDU",
"threading.Lock",
"threading.Timer",
"time.sleep",
"os.path.dirname",
"numpy.zeros",
"ctypes.CDLL",
"astropy.io.fits.Header",
"numpy.ctypeslib.as_ctypes",
"_ctypes.dlclose",
"ctypes.sizeof"
] | [((2242, 2267), 'ctypes.CDLL', 'ctypes.CDLL', (['library_path'], {}), '(library_path)\n', (2253, 2267), False, 'import ctypes\n'), ((3999, 4005), 'threading.Lock', 'Lock', ([], {}), '()\n', (4003, 4005), False, 'from threading import Timer, Lock\n'), ((4656, 4691), '_ctypes.dlclose', '_ctypes.dlclose', (['self._CDLL._h... |
# Adapt from https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly
import numpy as np
import keras
import os
from sklearn import preprocessing
class DataGenerator(keras.utils.Sequence):
'Generates data for Keras'
def __init__(self, list_IDs, batch_size=32, dim=(32,32,32), n_channels=1,
... | [
"keras.utils.to_categorical",
"numpy.empty",
"numpy.moveaxis",
"numpy.load",
"numpy.random.shuffle"
] | [((1511, 1549), 'numpy.empty', 'np.empty', (['(self.batch_size, *self.dim)'], {}), '((self.batch_size, *self.dim))\n', (1519, 1549), True, 'import numpy as np\n'), ((1562, 1598), 'numpy.empty', 'np.empty', (['self.batch_size'], {'dtype': 'int'}), '(self.batch_size, dtype=int)\n', (1570, 1598), True, 'import numpy as np... |
#!/usr/bin/env python
# Copyright (c) 2019, IRIS-HEP
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list o... | [
"numpy.array",
"struct.unpack"
] | [((3368, 3395), 'struct.unpack', 'struct.unpack', (['"""ddd"""', 'bytes'], {}), "('ddd', bytes)\n", (3381, 3395), False, 'import struct\n'), ((3803, 3831), 'numpy.array', 'numpy.array', (['[1.1, 2.2, 3.3]'], {}), '([1.1, 2.2, 3.3])\n', (3814, 3831), False, 'import numpy\n'), ((3872, 3900), 'numpy.array', 'numpy.array',... |
# white_signals.py
"""Contains class factories for white noise signals. White noise signals are
defined as the class of signals that only modifies the white noise matrix `N`.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import scipy.sparse
from enterprise.... | [
"enterprise.signals.selections.Selection",
"numpy.ones_like",
"enterprise.signals.signal_base.BlockMatrix",
"numpy.ones",
"enterprise.signals.utils.create_quantization_matrix",
"enterprise.signals.signal_base.csc_matrix_alt",
"enterprise.signals.signal_base.ShermanMorrison",
"enterprise.signals.signal... | [((524, 558), 'enterprise.signals.selections.Selection', 'Selection', (['selections.no_selection'], {}), '(selections.no_selection)\n', (533, 558), False, 'from enterprise.signals.selections import Selection\n'), ((2130, 2157), 'enterprise.signals.parameter.Uniform', 'parameter.Uniform', (['(0.5)', '(1.5)'], {}), '(0.5... |
import networkx as nx
import numpy as np
import pandas as pd
from tqdm import tqdm
from feature_engineering.tools import lit_eval_nan_proof
# this script computes some features by considering the bidirectional graph of citations: jaccard, adar,
# preferential_attachment, resource_allocation_index and common_neighbor... | [
"pandas.read_csv",
"tqdm.tqdm",
"networkx.Graph",
"networkx.all_shortest_paths",
"numpy.zeros"
] | [((613, 692), 'pandas.read_csv', 'pd.read_csv', (["(path_to_data + 'nodes_preprocessed.csv')"], {'converters': 'converter_dict'}), "(path_to_data + 'nodes_preprocessed.csv', converters=converter_dict)\n", (624, 692), True, 'import pandas as pd\n'), ((740, 791), 'pandas.read_csv', 'pd.read_csv', (["(path_to_data + 'trai... |
"""
First run tsne_encoder.py until the visualizations look good, and then set tsne_cache path to that experiment dir.
"""
import time
import numpy as np
import os
import matplotlib
import mlflow
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import argparse
import ... | [
"time.sleep",
"numpy.argsort",
"numpy.array",
"matplotlib.rc",
"seaborn.scatterplot",
"matplotlib.pyplot.Line2D",
"os.walk",
"numpy.mean",
"argparse.ArgumentParser",
"seaborn.color_palette",
"mlflow.set_tracking_uri",
"mlflow.list_run_infos",
"_pickle.load",
"matplotlib.colors.ListedColorm... | [((1171, 1188), 'os.walk', 'os.walk', (['exp_path'], {}), '(exp_path)\n', (1178, 1188), False, 'import os\n'), ((3394, 3416), 'skimage.io.imread', 'skio.imread', (['file_path'], {}), '(file_path)\n', (3405, 3416), True, 'import skimage.io as skio\n'), ((3475, 3515), 'skimage.transform.resize', 'skts.resize', (['img', '... |
from six import assertRaisesRegex
from unittest import TestCase
from tempfile import mkstemp
from os import close, unlink, write
from contextlib import contextmanager
from io import StringIO
from json import dumps, loads
import numpy as np
from pysam import CHARD_CLIP, CMATCH
from dark.reads import Read, ReadFilter
f... | [
"dark.reads.Read",
"os.close",
"json.dumps",
"dark.sam._hardClip",
"dark.sam.SAMFilter",
"numpy.array_equal",
"os.unlink",
"six.assertRaisesRegex",
"dark.sam.DistanceMatrix",
"dark.reads.ReadFilter",
"dark.sam.samReferencesToStr",
"io.StringIO",
"tempfile.mkstemp"
] | [((983, 992), 'tempfile.mkstemp', 'mkstemp', ([], {}), '()\n', (990, 992), False, 'from tempfile import mkstemp\n'), ((1033, 1042), 'os.close', 'close', (['fd'], {}), '(fd)\n', (1038, 1042), False, 'from os import close, unlink, write\n'), ((1066, 1082), 'os.unlink', 'unlink', (['filename'], {}), '(filename)\n', (1072,... |
import matplotlib.pyplot as plt
from matplotlib import colors, ticker, cm
import numpy as np
from scipy.interpolate import interp1d, CubicSpline
def calc_wa(sep, alpha, d_obs):
# sep should be in au
# alpha should be in degrees
# d_obs should be in parsecs
# returns wa in radians
sep = sep*au_to_m
... | [
"numpy.mean",
"numpy.sqrt",
"numpy.where",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.cos",
"numpy.sin",
"numpy.loadtxt"
] | [((9127, 9178), 'numpy.loadtxt', 'np.loadtxt', (['solar_spec'], {'unpack': '(True)', 'usecols': '(0, 1)'}), '(solar_spec, unpack=True, usecols=(0, 1))\n', (9137, 9178), True, 'import numpy as np\n'), ((9190, 9219), 'scipy.interpolate.interp1d', 'interp1d', (['ref_wl', 'ref_flambda'], {}), '(ref_wl, ref_flambda)\n', (91... |
import numpy as np
from itertools import combinations
import dask.array as dsa
from ..core import (
histogram,
_ensure_correctly_formatted_bins,
_ensure_correctly_formatted_range,
)
from .fixtures import empty_dask_array
import pytest
bins_int = 10
bins_str = "auto"
bins_arr = np.linspace(-4, 4, 10)
ra... | [
"numpy.ones_like",
"numpy.histogram",
"numpy.ones",
"numpy.testing.assert_allclose",
"numpy.diff",
"pytest.mark.parametrize",
"numpy.linspace",
"numpy.array",
"numpy.outer",
"numpy.random.seed",
"numpy.sum",
"numpy.einsum",
"numpy.histogram_bin_edges",
"pytest.raises",
"numpy.random.rand... | [((295, 317), 'numpy.linspace', 'np.linspace', (['(-4)', '(4)', '(10)'], {}), '(-4, 4, 10)\n', (306, 317), True, 'import numpy as np\n'), ((337, 386), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""density"""', '[False, True]'], {}), "('density', [False, True])\n", (360, 386), False, 'import pytest\n'), ((... |
# Define and solve equality constrained QP
from cvxpy.reductions.solvers.qp_solvers.qp_solver import QpSolver
import cvxpy.settings as cps
import cvxpy.interface as intf
import cvxpy.settings as s
import scipy.sparse as spa
from cvxpy.reductions import Solution
from cvxpy.constraints import Zero
import numpy as np
# ... | [
"cvxpy.reductions.Solution",
"scipy.sparse.linalg.spsolve",
"warnings.catch_warnings",
"numpy.sum",
"numpy.zeros",
"scipy.sparse.linalg.factorized",
"scipy.sparse.hstack",
"numpy.isnan",
"numpy.concatenate",
"numpy.array",
"warnings.simplefilter",
"scipy.sparse.csc_matrix",
"time.time",
"w... | [((1175, 1205), 'scipy.sparse.csc_matrix', 'spa.csc_matrix', (['(n_con, n_con)'], {}), '((n_con, n_con))\n', (1189, 1205), True, 'import scipy.sparse as spa\n'), ((1451, 1503), 'numpy.concatenate', 'np.concatenate', (["(-data[cps.Q], data[cps.B + '_red'])"], {}), "((-data[cps.Q], data[cps.B + '_red']))\n", (1465, 1503)... |
import numpy as np
import azure.functions as func
import json
from .app import upload
from azure.storage.blob import BlobServiceClient, BlobClient, ContentSettings
import uuid
def main(req: func.HttpRequest) -> func.HttpResponse:
headers = {
"Content-type": "application/json",
"Access-Control-Allow... | [
"json.dumps",
"uuid.uuid4",
"azure.storage.blob.ContentSettings",
"azure.storage.blob.BlobClient.from_connection_string",
"numpy.fromstring"
] | [((1496, 1544), 'numpy.fromstring', 'np.fromstring', (['blob_data_as_bytes'], {'dtype': '"""uint8"""'}), "(blob_data_as_bytes, dtype='uint8')\n", (1509, 1544), True, 'import numpy as np\n'), ((804, 1063), 'azure.storage.blob.BlobClient.from_connection_string', 'BlobClient.from_connection_string', ([], {'conn_str': '"""... |
import os
from math import pi
import numpy as np
import scipy as sp
from scipy import stats as spst
import matplotlib.pyplot as plt
import cifar10_data
import classifier_cnn
def ensemble_part_norm():
# ####################################################
# make data
# ######################... | [
"numpy.sqrt",
"numpy.array",
"cifar10_data.Cifar10_1Label",
"numpy.arange",
"numpy.max",
"numpy.linspace",
"os.path.isdir",
"numpy.min",
"numpy.average",
"numpy.logical_xor",
"numpy.square",
"cifar10_data.Cifar10_Dog_Cat",
"classifier_cnn.BinaryClassifierCnnWithPartNormDist",
"os.makedirs"... | [((441, 471), 'cifar10_data.Cifar10_Dog_Cat', 'cifar10_data.Cifar10_Dog_Cat', ([], {}), '()\n', (469, 471), False, 'import cifar10_data\n'), ((2541, 2563), 'numpy.array', 'np.array', (['_expecs_pred'], {}), '(_expecs_pred)\n', (2549, 2563), True, 'import numpy as np\n'), ((2586, 2606), 'numpy.array', 'np.array', (['_va... |
# -*- coding: utf-8 -*-
"""pre_processamento.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1pIAmElMKuzHOV9YnGVRT7CCD-99bMydI
Importação das bibliotecas utilizadas
"""
from numpy import any as numpy_any
"""Criação da funções para o pré-process... | [
"numpy.any"
] | [((1539, 1571), 'numpy.any', 'numpy_any', (['rows[target_variable]'], {}), '(rows[target_variable])\n', (1548, 1571), True, 'from numpy import any as numpy_any\n')] |
import sys
import numpy as np
from seisflows.tools import unix
from seisflows.tools.array import loadnpy, savenpy
from seisflows.tools.array import grid2mesh, mesh2grid, stack
from seisflows.tools.tools import exists
from seisflows.config import ParameterError, custom_import
from seisflows.tools.math import nabla, tv... | [
"numpy.mean",
"seisflows.config.custom_import",
"seisflows.tools.math.tv",
"seisflows.tools.array.mesh2grid",
"seisflows.tools.array.grid2mesh"
] | [((510, 552), 'seisflows.config.custom_import', 'custom_import', (['"""postprocess"""', '"""regularize"""'], {}), "('postprocess', 'regularize')\n", (523, 552), False, 'from seisflows.config import ParameterError, custom_import\n'), ((1075, 1093), 'seisflows.tools.array.mesh2grid', 'mesh2grid', (['g', 'mesh'], {}), '(g... |
# Copyright All Rights Reserved.
"""Generates data for training/validation and save it to disk."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import multiprocessing
import os
import yaml
from absl import app
from absl import flags
fro... | [
"os.makedirs",
"datasets.ProcessedImageFolder",
"numpy.hstack",
"numpy.random.random",
"tqdm.tqdm",
"os.path.join",
"absl.logging.info",
"multiprocessing.cpu_count",
"datasets.data_prep.kitti_loader.KittiRaw",
"numpy.array_split",
"torch.cuda.is_available",
"numpy.random.seed",
"multiprocess... | [((803, 845), 'os.makedirs', 'os.makedirs', (['FLAGS.save_dir'], {'exist_ok': '(True)'}), '(FLAGS.save_dir, exist_ok=True)\n', (814, 845), False, 'import os\n'), ((2981, 3001), 'numpy.random.seed', 'np.random.seed', (['(8964)'], {}), '(8964)\n', (2995, 3001), True, 'import numpy as np\n'), ((3019, 3046), 'multiprocessi... |
import numpy
from fvm import utils
from fvm import BoundaryConditions
from fvm import Discretization
class CylindricalDiscretization(Discretization):
'''Finite volume discretization of the incompressible Navier-Stokes
equations on a (possibly non-uniform) Arakawa C-grid in a
cylindrical coordinate system.... | [
"fvm.Discretization.u_v_x",
"fvm.Discretization._mass_x",
"fvm.Discretization.u_w_x",
"fvm.utils.create_state_vec",
"fvm.utils.create_padded_state_mtx",
"fvm.BoundaryConditions",
"fvm.Discretization.v_v_y",
"fvm.Discretization.__init__",
"numpy.zeros",
"fvm.Discretization.v_w_y",
"fvm.Discretiza... | [((1305, 1390), 'fvm.Discretization.__init__', 'Discretization.__init__', (['self', 'parameters', 'nr', 'ntheta', 'nz', 'dim', 'dof', 'r', 'theta', 'z'], {}), '(self, parameters, nr, ntheta, nz, dim, dof, r, theta, z\n )\n', (1328, 1390), False, 'from fvm import Discretization\n'), ((2998, 3126), 'fvm.utils.create_p... |
import numpy as np
from test.runtime.frontend_test.onnx_test.util import make_node, make_tensor_value_info, make_model
from test.util import wrap_template, generate_kernel_test_case
from webdnn.frontend.onnx import ONNXConverter
@wrap_template
def template(x_shape, axes, keepdims=None, description: str = ""):
vx... | [
"test.runtime.frontend_test.onnx_test.util.make_tensor_value_info",
"numpy.random.rand",
"test.util.generate_kernel_test_case",
"test.runtime.frontend_test.onnx_test.util.make_model",
"webdnn.frontend.onnx.ONNXConverter",
"test.runtime.frontend_test.onnx_test.util.make_node"
] | [((323, 347), 'numpy.random.rand', 'np.random.rand', (['*x_shape'], {}), '(*x_shape)\n', (337, 347), True, 'import numpy as np\n'), ((445, 482), 'test.runtime.frontend_test.onnx_test.util.make_tensor_value_info', 'make_tensor_value_info', (['"""x"""', 'vx.shape'], {}), "('x', vx.shape)\n", (467, 482), False, 'from test... |
import dash_html_components as html
import string
import os
import json
import urllib
import numpy as np
from dash.dependencies import Input, Output, State
from matscholar.rest import Rester
# Get the rester and random docs on import
rester = Rester()
local_dir = os.path.dirname(__file__)
with open(os.path.join(local_... | [
"numpy.random.choice",
"dash.dependencies.Output",
"json.dumps",
"os.path.join",
"urllib.parse.quote",
"dash.dependencies.Input",
"os.path.dirname",
"dash_html_components.Div",
"dash_html_components.Label",
"json.load",
"dash.dependencies.State",
"matscholar.rest.Rester",
"dash_html_componen... | [((244, 252), 'matscholar.rest.Rester', 'Rester', ([], {}), '()\n', (250, 252), False, 'from matscholar.rest import Rester\n'), ((265, 290), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (280, 290), False, 'import os\n'), ((390, 402), 'json.load', 'json.load', (['f'], {}), '(f)\n', (399, 402... |
#!/usr/bin/env python
"""Implementation of Closed-Form Matting.
This module implements natural image matting method described in:
<NAME>, <NAME>, and <NAME>. "A closed-form solution to natural image matting."
IEEE Transactions on Pattern Analysis and Machine Intelligence 30.2 (2008): 228-242.
The code can be... | [
"logging.basicConfig",
"numpy.mean",
"cv2.imwrite",
"numpy.eye",
"numpy.tile",
"numpy.repeat",
"argparse.ArgumentParser",
"solve_foreground_background.solve_foreground_background",
"numpy.ones",
"numpy.lib.stride_tricks.as_strided",
"numpy.sum",
"numpy.einsum",
"numpy.concatenate",
"loggin... | [((1853, 1896), 'numpy.lib.stride_tricks.as_strided', 'as_strided', (['A'], {'shape': 'shape', 'strides': 'strides'}), '(A, shape=shape, strides=strides)\n', (1863, 1896), False, 'from numpy.lib.stride_tricks import as_strided\n'), ((3289, 3325), 'numpy.mean', 'np.mean', (['winI'], {'axis': '(1)', 'keepdims': '(True)'}... |
import numpy as np
import pandas as pd
import os
import re
import tensorflow as tf
import seaborn as sns
import matplotlib.pyplot as plt
import keras
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
from keras.preprocessing import image
from tensorflow.keras.models im... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Conv2D",
"keras.layers.Flatten",
"sklearn.preprocessing.OneHotEncoder",
"numpy.array",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.Model",
"numpy.save",
"tensorflow.keras.layers.MaxPool2D"
] | [((623, 648), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(84, 150, 3)'}), '(shape=(84, 150, 3))\n', (628, 648), False, 'from tensorflow.keras.layers import Dense, Input, Dropout, Conv2D, MaxPool2D, GlobalAveragePooling2D, Concatenate, BatchNormalization\n'), ((960, 982), 'tensorflow.keras.models.Model', ... |
#K-means Clustering
#%reset -f
#Importing Libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import DBSCAN
from pyclustertend import hopkins
from sklearn.cluster import MeanShift, estimate_bandwidth
from sklearn.metrics import silhouette_score
#I... | [
"pandas.plotting.parallel_coordinates",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"pandas.value_counts",
"numpy.array",
"seaborn.scatterplot",
"sklearn.cluster.MeanShift",
"seaborn.pairplot",
"sklearn.cluster.DBSCAN",
"pandas.to_datetime",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.sc... | [((342, 370), 'pandas.read_csv', 'pd.read_csv', (['"""appdata10.csv"""'], {}), "('appdata10.csv')\n", (353, 370), True, 'import pandas as pd\n'), ((439, 471), 'pandas.concat', 'pd.concat', (['[df_user, df]'], {'axis': '(1)'}), '([df_user, df], axis=1)\n', (448, 471), True, 'import pandas as pd\n'), ((572, 603), 'pandas... |
"""Evaluation function handler for sequential or cascaded."""
import numpy as np
import sys
import torch
import torch.nn.functional as F
class SequentialEvalLoop:
"""Evaluation loop for sequential model."""
def __init__(
self,
num_classes,
keep_logits=False,
keep_embeddings=False,
... | [
"torch.nn.functional.softmax",
"torch.eye",
"torch.stack",
"torch.eq",
"numpy.sum",
"torch.no_grad",
"sys.stdout.flush",
"torch.zeros",
"torch.cat",
"torch.argmax"
] | [((1739, 1763), 'torch.nn.functional.softmax', 'F.softmax', (['logits'], {'dim': '(1)'}), '(logits, dim=1)\n', (1748, 1763), True, 'import torch.nn.functional as F\n'), ((1779, 1807), 'torch.argmax', 'torch.argmax', (['softmax'], {'dim': '(1)'}), '(softmax, dim=1)\n', (1791, 1807), False, 'import torch\n'), ((1956, 197... |
import sys
import numpy as np
n, q, *lr = map(int, sys.stdin.read().split())
l, r = np.array(lr).reshape(q, 2).T
l -= 1
r -= 1
def main():
res = np.zeros(n + 1, dtype=np.int32)
np.add.at(res, l, 1)
np.subtract.at(res, r + 1, 1)
np.cumsum(res, out=res)
print("".join((res[:-1] & 1).... | [
"numpy.subtract.at",
"numpy.array",
"numpy.zeros",
"numpy.add.at",
"numpy.cumsum",
"sys.stdin.read"
] | [((164, 195), 'numpy.zeros', 'np.zeros', (['(n + 1)'], {'dtype': 'np.int32'}), '(n + 1, dtype=np.int32)\n', (172, 195), True, 'import numpy as np\n'), ((201, 221), 'numpy.add.at', 'np.add.at', (['res', 'l', '(1)'], {}), '(res, l, 1)\n', (210, 221), True, 'import numpy as np\n'), ((227, 256), 'numpy.subtract.at', 'np.su... |
import sys
import time
import yaml
import math
import signal
import datetime
import threading
import traceback
import numpy as np
from cvxopt import matrix, solvers
#from scipy.spatial import ConvexHull
import matplotlib.patches as ptc
import matplotlib.pyplot as plt
import matplotlib.animation as animatio... | [
"numpy.sqrt",
"matplotlib.pyplot.Polygon",
"yaml.load",
"time.sleep",
"numpy.array",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.sin",
"cvxopt.matrix",
"numpy.meshgrid",
"numpy.isnan",
"numpy.cos",
"time.time",
"matplotlib.pyplot.show",
"traceback.format_exc",
"signal.signal",
"nump... | [((824, 846), 'numpy.arctan2', 'np.arctan2', (['v[1]', 'v[0]'], {}), '(v[1], v[0])\n', (834, 846), True, 'import numpy as np\n'), ((16127, 16171), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'ctrl_c_handler'], {}), '(signal.SIGINT, ctrl_c_handler)\n', (16140, 16171), False, 'import signal\n'), ((2765, 2776), '... |
# Copyright (c) 2020, <NAME>. All rights reserved.
#
# This work is licensed under the MIT License.
# To view a copy of this license, visit https://opensource.org/licenses/MIT
import numpy as np
class BasicAction(object):
@staticmethod
def normalize_line_length(line_length, line_length_max):
# [0,l... | [
"numpy.isscalar"
] | [((9288, 9315), 'numpy.isscalar', 'np.isscalar', (['scaling_factor'], {}), '(scaling_factor)\n', (9299, 9315), True, 'import numpy as np\n')] |
from humpday.objectives.classic import CLASSIC_OBJECTIVES
import logging
import numpy as np
import math
import warnings
try:
from hebo.design_space.design_space import DesignSpace
from hebo.optimizers.hebo import HEBO
using_hebo = True
except ImportError:
using_hebo = False
if using_hebo:
loggin... | [
"logging.getLogger",
"hebo.optimizers.hebo.HEBO",
"math.floor",
"hebo.design_space.design_space.DesignSpace",
"numpy.argmin",
"time.time"
] | [((664, 675), 'hebo.optimizers.hebo.HEBO', 'HEBO', (['space'], {}), '(space)\n', (668, 675), False, 'from hebo.optimizers.hebo import HEBO\n'), ((1358, 1390), 'numpy.argmin', 'np.argmin', (['[y[0] for y in opt.y]'], {}), '([y[0] for y in opt.y])\n', (1367, 1390), True, 'import numpy as np\n'), ((314, 339), 'logging.get... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.