code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Loads h5 files and some associated information """ import os from typing import List import h5py import numpy as np from deepreg.dataset.loader.interface import FileLoader DATA_KEY_FORMAT = "group-{}-{}" class H5FileLoader(FileLoader): """Generalized loader for h5 files""" def __init__(self, dir_paths...
[ "numpy.asarray", "os.path.join", "h5py.File", "os.path.exists" ]
[((4657, 4720), 'numpy.asarray', 'np.asarray', (['self.h5_files[dir_path][data_key]'], {'dtype': 'np.float32'}), '(self.h5_files[dir_path][data_key], dtype=np.float32)\n', (4667, 4720), True, 'import numpy as np\n'), ((1426, 1467), 'os.path.join', 'os.path.join', (['dir_path', "(self.name + '.h5')"], {}), "(dir_path, s...
import numpy as np import matplotlib.pyplot as plt from utils import sigmoid # visualize sigmoid function def sigmoid_visual(): z = np.arange(-7, 7, 0.1) phi_z = sigmoid(z) plt.plot(z, phi_z) plt.axvline(0.0, color='k') plt.ylim(-0.1, 1.1) plt.xlabel('z') plt.ylabel('$\phi (z)$') pl...
[ "matplotlib.pyplot.axvline", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.yticks", "utils.sigmoid", "numpy.arange", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.tight_layout" ]
[((140, 161), 'numpy.arange', 'np.arange', (['(-7)', '(7)', '(0.1)'], {}), '(-7, 7, 0.1)\n', (149, 161), True, 'import numpy as np\n'), ((174, 184), 'utils.sigmoid', 'sigmoid', (['z'], {}), '(z)\n', (181, 184), False, 'from utils import sigmoid\n'), ((189, 207), 'matplotlib.pyplot.plot', 'plt.plot', (['z', 'phi_z'], {}...
""" Cluster and data analysis functions. Author: <NAME> Contact: <EMAIL> Date: 2013, 2014, 2021 """ from sklearn import metrics from collections import Counter import numpy as np def analyse_clusters(labels_true, labels_pred, labels_select=None): """ Analyse clusters and return a list of dict describing the...
[ "collections.Counter", "sklearn.metrics.homogeneity_completeness_v_measure", "numpy.where", "numpy.array", "sklearn.metrics.adjusted_rand_score" ]
[((694, 715), 'numpy.array', 'np.array', (['labels_true'], {}), '(labels_true)\n', (702, 715), True, 'import numpy as np\n'), ((734, 755), 'numpy.array', 'np.array', (['labels_pred'], {}), '(labels_pred)\n', (742, 755), True, 'import numpy as np\n'), ((2451, 2472), 'numpy.array', 'np.array', (['labels_true'], {}), '(la...
import os from lib.utils.linemod.opengl_renderer import OpenGLRenderer import numpy as np from PIL import Image import tqdm from skimage import measure import cv2 import json from lib.utils.base_utils import read_pickle from lib.utils.linemod.linemod_config import linemod_cls_names, linemod_K, blender_K import matplotl...
[ "numpy.load", "numpy.sum", "numpy.maximum", "skimage.measure.find_contours", "os.path.join", "numpy.pad", "os.path.exists", "numpy.max", "json.dump", "tqdm.tqdm", "os.path.basename", "numpy.min", "numpy.dot", "lib.utils.linemod.opengl_renderer.OpenGLRenderer", "numpy.flip", "numpy.subt...
[((931, 1133), 'numpy.array', 'np.array', (['[[min_x, min_y, min_z], [min_x, min_y, max_z], [min_x, max_y, min_z], [\n min_x, max_y, max_z], [max_x, min_y, min_z], [max_x, min_y, max_z], [\n max_x, max_y, min_z], [max_x, max_y, max_z]]'], {}), '([[min_x, min_y, min_z], [min_x, min_y, max_z], [min_x, max_y,\n m...
import kfserving from enum import Enum from typing import List, Any, Dict, Mapping, Optional import numpy as np import kfserving.protocols.seldon_http as seldon from kfserving.protocols.seldon_http import SeldonRequestHandler import requests import json import logging from alibiexplainer.anchor_tabular import AnchorTab...
[ "logging.basicConfig", "json.dumps", "alibiexplainer.anchor_tabular.AnchorTabular", "numpy.array", "kfserving.protocols.seldon_http.create_request", "requests.post" ]
[((415, 476), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'kfserving.server.KFSERVER_LOGLEVEL'}), '(level=kfserving.server.KFSERVER_LOGLEVEL)\n', (434, 476), False, 'import logging\n'), ((1099, 1151), 'alibiexplainer.anchor_tabular.AnchorTabular', 'AnchorTabular', (['self._predict_fn', 'explainer'], {}...
#!/usr/bin/env python # encoding:utf8 import os from s_defaults import default_inputs, default_model_save_iter, has_flag # 0 = all messages are logged (default behavior) # 1 = INFO messages are not printed # 2 = INFO and WARNING messages are not printed # 3 = INFO, WARNING, and ERROR messages are not printed os.environ...
[ "s_graph.inspect_graph", "tensorflow.contrib.rnn.BasicRNNCell", "tensorflow.trainable_variables", "tensorflow.identity", "numpy.empty", "tensorflow.reshape", "tensorflow.logging.set_verbosity", "tensorflow.matmul", "s_save_model.SessModelSaver", "tensorflow.contrib.rnn.static_rnn", "s_console_pr...
[((992, 1022), 's_console_prompt.prompt_progress', 'prompt_progress', (['"""LoadDataset"""'], {}), "('LoadDataset')\n", (1007, 1022), False, 'from s_console_prompt import prompt_yellow, prompt_blue, prompt_green, prompt_red, prompt_progress\n'), ((1028, 1038), 's_data_loader.load_all', 'load_all', ([], {}), '()\n', (10...
# Copyright 2019, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
[ "tensorflow.test.main", "tensorflow.keras.losses.SparseCategoricalCrossentropy", "tensorflow.keras.metrics.SparseCategoricalAccuracy", "numpy.ones", "tensorflow_federated.backends.native.set_local_execution_context", "absl.logging.info", "collections.namedtuple", "absl.testing.parameterized.named_para...
[((1093, 1136), 'collections.namedtuple', 'collections.namedtuple', (['"""Batch"""', "['x', 'y']"], {}), "('Batch', ['x', 'y'])\n", (1115, 1136), False, 'import collections\n'), ((1479, 1546), 'tensorflow_federated.simulation.models.mnist.create_keras_model', 'tff.simulation.models.mnist.create_keras_model', ([], {'com...
# Copyright (c) 2016-2018, <NAME> # 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 lis...
[ "sys.stderr.write", "numpy.where", "numpy.array" ]
[((1896, 1910), 'numpy.where', 'np.where', (['out1'], {}), '(out1)\n', (1904, 1910), True, 'import numpy as np\n'), ((2200, 2213), 'numpy.array', 'np.array', (['sol'], {}), '(sol)\n', (2208, 2213), True, 'import numpy as np\n'), ((2683, 2747), 'sys.stderr.write', 'sys.stderr.write', (['"""\'ismember\' error: invalid co...
__all__ = ["nufft1", "nufft2"] from functools import partial, reduce import numpy as np from jax import core, jit from jax import numpy as jnp from jax.interpreters import ad, batching, xla from . import shapes, translation @partial(jit, static_argnums=(0,), static_argnames=("iflag", "eps")) def nufft1(output_shap...
[ "functools.partial", "jax.core.Primitive", "jax.interpreters.xla.register_translation", "jax.interpreters.batching.moveaxis", "numpy.floor", "numpy.ones", "jax.interpreters.ad.Zero.from_value", "numpy.atleast_1d", "jax.numpy.repeat", "jax.numpy.stack", "jax.interpreters.ad.is_undefined_primal" ]
[((230, 297), 'functools.partial', 'partial', (['jit'], {'static_argnums': '(0,)', 'static_argnames': "('iflag', 'eps')"}), "(jit, static_argnums=(0,), static_argnames=('iflag', 'eps'))\n", (237, 297), False, 'from functools import partial, reduce\n'), ((1140, 1186), 'functools.partial', 'partial', (['jit'], {'static_a...
import numpy as np import matplotlib.pyplot as plt from hplots.general_2d_plot import General2dBinningPlot import hplots.response_scale hplots.response_scale.register() class EfficiencyFoLocalFractionPlot(General2dBinningPlot): def __init__(self, bins=np.array([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]...
[ "numpy.ones_like", "numpy.sum", "numpy.logical_and", "numpy.std", "numpy.histogram", "numpy.mean", "numpy.array", "matplotlib.pyplot.subplots", "numpy.concatenate" ]
[((260, 321), 'numpy.array', 'np.array', (['[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]'], {}), '([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1])\n', (268, 321), True, 'import numpy as np\n'), ((594, 655), 'numpy.array', 'np.array', (['[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]'], {}), '([0, 0.1, ...
""" sample_usage.py Created on Oct 18 2020 15:05 @author: <NAME> <EMAIL> """ import numpy as np from basic_usage.sketchformer import continuous_embeddings import time import warnings import random import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt # warnings.filterwarnings("ignore") class Ba...
[ "basic_usage.sketchformer.continuous_embeddings", "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.use", "numpy.linalg.norm", "basic_usage.sketchformer.continuous_embeddings.get_pretrained_model", "numpy.concatenate" ]
[((217, 240), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (231, 240), False, 'import matplotlib\n'), ((497, 552), 'numpy.load', 'np.load', (['filename'], {'encoding': '"""latin1"""', 'allow_pickle': '(True)'}), "(filename, encoding='latin1', allow_pickle=True)\n", (504, 552), True, 'import...
import asyncio from threading import Thread from time import sleep import requests import datetime import numpy import urllib3 class Task: def __init__(self, sites=['https://www.google.com', 'https://www.bloomberg.com']): urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) self.sit...
[ "asyncio.gather", "threading.Thread", "asyncio.get_event_loop", "numpy.median", "requests.get", "datetime.datetime.now", "urllib3.disable_warnings" ]
[((236, 303), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (260, 303), False, 'import urllib3\n'), ((747, 801), 'requests.get', 'requests.get', (['site'], {'verify': '(False)', 'timeout': 'self.timeout'}), '...
import unittest import numpy as np from diffpriv_laplace.anonymizer.max import DiffPrivMaxAnonymizer class TestDiffPrivMaxAnonymizer(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def set_seed(self): np.random.seed(31337) def test_global_sensitivity_gette...
[ "numpy.array", "numpy.testing.assert_almost_equal", "numpy.random.seed", "diffpriv_laplace.anonymizer.max.DiffPrivMaxAnonymizer" ]
[((260, 281), 'numpy.random.seed', 'np.random.seed', (['(31337)'], {}), '(31337)\n', (274, 281), True, 'import numpy as np\n'), ((372, 402), 'diffpriv_laplace.anonymizer.max.DiffPrivMaxAnonymizer', 'DiffPrivMaxAnonymizer', (['epsilon'], {}), '(epsilon)\n', (393, 402), False, 'from diffpriv_laplace.anonymizer.max import...
import numpy as np from numpy.testing import (assert_array_almost_equal as assert_close, assert_equal, assert_raises) from scipy import ndimage as ndi from skimage.feature import peak np.random.seed(21) def test_trivial_case(): trivial = np.zeros((25, 25)) peak_indices = peak.peak...
[ "numpy.random.uniform", "numpy.zeros_like", "numpy.random.seed", "numpy.testing.run_module_suite", "numpy.zeros", "numpy.ones", "skimage.feature.peak.peak_local_max", "numpy.arange", "numpy.array", "numpy.random.rand", "numpy.testing.assert_array_almost_equal", "numpy.all", "scipy.ndimage.ma...
[((213, 231), 'numpy.random.seed', 'np.random.seed', (['(21)'], {}), '(21)\n', (227, 231), True, 'import numpy as np\n'), ((273, 291), 'numpy.zeros', 'np.zeros', (['(25, 25)'], {}), '((25, 25))\n', (281, 291), True, 'import numpy as np\n'), ((311, 369), 'skimage.feature.peak.peak_local_max', 'peak.peak_local_max', (['t...
import argparse import time import os import numpy as np from tsn.models.TSN import TSN from tsn.utils.checkpoint import load_checkpoint import oneflow as flow from tsn.datasets.transform import * from tsn.datasets.dataset import TSNDataSet import warnings warnings.filterwarnings("ignore", category=UserWarning) def...
[ "oneflow.load", "argparse.ArgumentParser", "warnings.filterwarnings", "tsn.models.TSN.TSN", "oneflow.no_grad", "oneflow.nn.CrossEntropyLoss", "numpy.argsort", "oneflow.InitEagerGlobalSession", "time.time", "numpy.mean", "numpy.array", "os.path.join", "oneflow.device" ]
[((259, 314), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (282, 314), False, 'import warnings\n'), ((348, 412), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test an action recognizer"""'}),...
#!/usr/bin/python ########################################################################### # ProcessNet.py ########################################################################### from __future__ import division import os, sys, json import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy ...
[ "matplotlib.image.imread", "caffe.set_mode_gpu", "os.makedirs", "numpy.zeros", "os.path.exists", "os.path.isfile", "matplotlib.pyplot.imsave", "caffe.Net", "os.path.join", "sys.exit" ]
[((579, 622), 'os.path.join', 'os.path.join', (['caffe_root', '"""data"""', 'proj_name'], {}), "(caffe_root, 'data', proj_name)\n", (591, 622), False, 'import os, sys, json\n'), ((645, 684), 'os.path.join', 'os.path.join', (['hardDrive_root', 'proj_name'], {}), '(hardDrive_root, proj_name)\n', (657, 684), False, 'impor...
import numpy as np import torch from transformers import GPT2LMHeadModel, GPT2Tokenizer from .utils import get_available_devices class GPTLM(): def __init__(self, model_name_or_path='gpt2'): self.start_token = "<|endoftext|>" self.tokenizer = GPT2Tokenizer.from_pretrained(model_name_or_path, bo...
[ "transformers.GPT2LMHeadModel.from_pretrained", "torch.softmax", "torch.cuda.is_available", "numpy.arange", "torch.cuda.empty_cache", "transformers.GPT2Tokenizer.from_pretrained" ]
[((268, 345), 'transformers.GPT2Tokenizer.from_pretrained', 'GPT2Tokenizer.from_pretrained', (['model_name_or_path'], {'bos_token': 'self.start_token'}), '(model_name_or_path, bos_token=self.start_token)\n', (297, 345), False, 'from transformers import GPT2LMHeadModel, GPT2Tokenizer\n'), ((368, 419), 'transformers.GPT2...
""" Create on 08/03/2022 @author: <NAME> This dataset uses for HCC/ABN/NFD cls base on 2D model """ #__Import Libraries__ import numpy as np import random import torch from torchvision import transforms from torch.utils.data import Dataset import monai from PIL import Image from PIL import ImageFile ImageFile.LOAD_TR...
[ "numpy.load", "monai.transforms.Resize", "monai.transforms.ToTensor", "numpy.linspace", "numpy.random.choice" ]
[((1815, 1836), 'numpy.load', 'np.load', (['volpath', '"""r"""'], {}), "(volpath, 'r')\n", (1822, 1836), True, 'import numpy as np\n'), ((416, 469), 'monai.transforms.Resize', 'monai.transforms.Resize', (['input_shape'], {'size_mode': '"""all"""'}), "(input_shape, size_mode='all')\n", (439, 469), False, 'import monai\n...
import pytest import numpy as np from bayes_opt import BayesianOptimization from bayes_opt.util import UtilityFunction, Colours from bayes_opt.util import acq_max, load_logs, ensure_rng from sklearn.gaussian_process.kernels import Matern from sklearn.gaussian_process import GaussianProcessRegressor def get_globals(...
[ "bayes_opt.BayesianOptimization", "numpy.argmax", "bayes_opt.util.ensure_rng", "bayes_opt.util.load_logs", "bayes_opt.util.Colours._wrap_colour", "pytest.main", "sklearn.gaussian_process.kernels.Matern", "pytest.raises", "numpy.array", "numpy.arange", "bayes_opt.util.UtilityFunction" ]
[((331, 462), 'numpy.array', 'np.array', (['[[0.0, 0.0], [0.99, 0.99], [0.0, 0.99], [0.99, 0.0], [0.5, 0.5], [0.25, 0.5\n ], [0.5, 0.25], [0.75, 0.5], [0.5, 0.75]]'], {}), '([[0.0, 0.0], [0.99, 0.99], [0.0, 0.99], [0.99, 0.0], [0.5, 0.5], [\n 0.25, 0.5], [0.5, 0.25], [0.75, 0.5], [0.5, 0.75]])\n', (339, 462), Tru...
""" This file offers some standard functions that are useful for rotations. Two mainfunctions: - Rotation matrix to euler angles - Euler angles to rotation matrix """ import numpy as np import math def _isRotationMatrix(R) : Rt = np.transpose(R) shouldBeIdentity = np.dot(Rt, R) I = np.identity(3, d...
[ "math.sqrt", "math.atan2", "numpy.transpose", "numpy.identity", "math.sin", "numpy.linalg.norm", "numpy.array", "math.cos", "numpy.dot" ]
[((243, 258), 'numpy.transpose', 'np.transpose', (['R'], {}), '(R)\n', (255, 258), True, 'import numpy as np\n'), ((282, 295), 'numpy.dot', 'np.dot', (['Rt', 'R'], {}), '(Rt, R)\n', (288, 295), True, 'import numpy as np\n'), ((304, 333), 'numpy.identity', 'np.identity', (['(3)'], {'dtype': 'R.dtype'}), '(3, dtype=R.dty...
from unittest import TestCase from niaaml import Pipeline, OptimizationStats from niaaml.classifiers import RandomForest, AdaBoost from niaaml.preprocessing.feature_selection import SelectKBest, SelectPercentile from niaaml.preprocessing.feature_transform import StandardScaler, Normalizer from niaaml.data import CSVDat...
[ "niaaml.preprocessing.feature_transform.Normalizer", "os.path.abspath", "tempfile.TemporaryDirectory", "niaaml.classifiers.RandomForest", "niaaml.preprocessing.feature_selection.SelectKBest", "numpy.ones", "niaaml.preprocessing.feature_transform.StandardScaler", "niaaml.classifiers.AdaBoost", "numpy...
[((4685, 4930), 'numpy.array', 'numpy.array', (["['Class 1', 'Class 1', 'Class 1', 'Class 2', 'Class 1', 'Class 2',\n 'Class 2', 'Class 2', 'Class 2', 'Class 1', 'Class 1', 'Class 2',\n 'Class 1', 'Class 2', 'Class 1', 'Class 1', 'Class 1', 'Class 1',\n 'Class 2', 'Class 1']"], {}), "(['Class 1', 'Class 1', 'C...
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # 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 # # ht...
[ "nvidia.dali.plugin.tf.DALIDataset", "argparse.ArgumentParser", "tensorflow.keras.layers.Dense", "tensorflow.losses.SparseCategoricalCrossentropy", "nvidia.dali.fn.decoders.image", "numpy.mean", "nvidia.dali.fn.normalize", "os.path.join", "numpy.std", "tensorflow.keras.mixed_precision.Policy", "...
[((2575, 2707), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TensorFlow2 Keras Horovod Example"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='TensorFlow2 Keras Horovod Example',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (2598, ...
import numpy as np from Grid_World import print_policy, print_values, negative_grid ALL_POSSIBLE_ACTIONS = ("U", "D", "L", "R") GAMMA = 0.9 def random_action(a, eps = 0.1): p = np.random.random() if p < (1 - eps): return a else: tmp = list(ALL_POSSIBLE_ACTIONS) tmp.remo...
[ "Grid_World.negative_grid", "Grid_World.print_values", "Grid_World.print_policy", "numpy.random.random", "numpy.mean", "numpy.random.choice" ]
[((190, 208), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (206, 208), True, 'import numpy as np\n'), ((1380, 1410), 'Grid_World.negative_grid', 'negative_grid', ([], {'step_cost': '(-0.24)'}), '(step_cost=-0.24)\n', (1393, 1410), False, 'from Grid_World import print_policy, print_values, negative_grid\...
import pandas as pd import numpy as np from sklearn import preprocessing # Simple class to perform basic data encoding, train/test splitting etc. on a file # note that the data need to be learning ready - means it has to contain all the data of appropriate format # aside from the target variable - it is automaticall...
[ "pandas.read_csv", "pandas.get_dummies", "sklearn.preprocessing.MinMaxScaler", "numpy.random.permutation" ]
[((470, 496), 'pandas.read_csv', 'pd.read_csv', (['csv_file_name'], {}), '(csv_file_name)\n', (481, 496), True, 'import pandas as pd\n'), ((668, 696), 'sklearn.preprocessing.MinMaxScaler', 'preprocessing.MinMaxScaler', ([], {}), '()\n', (694, 696), False, 'from sklearn import preprocessing\n'), ((1175, 1203), 'pandas.g...
# Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
[ "sys.path.append", "numpy.atleast_2d", "torch.nn.MSELoss", "layers_torch.GaussLinearStandardized", "numpy.log", "scipy.stats.norm.logpdf", "numpy.square", "numpy.zeros", "layers_torch.ScaledRelu", "RecursiveKernel.DeepArcCosine", "numpy.random.RandomState", "time.time", "numpy.array", "sci...
[((578, 600), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (593, 600), False, 'import sys\n'), ((6221, 6273), 'scipy.stats.norm.logpdf', 'norm.logpdf', (['Y_test'], {'loc': 'train_mean', 'scale': 'train_std'}), '(Y_test, loc=train_mean, scale=train_std)\n', (6232, 6273), False, 'from scipy.st...
import cv2 import numpy as np import os def change_image_size_to_dct(image): row = image.shape[0] col = image.shape[1] mod_r_8 = row % 8 mod_c_8 = col % 8 r_padding = 0 c_padding = 0 if mod_r_8 != 0: r_padding += (8 - mod_r_8) if mod_c_8 != 0: c_padding += (8...
[ "cv2.imread", "numpy.zeros", "cv2.resize", "cv2.imwrite" ]
[((358, 405), 'numpy.zeros', 'np.zeros', (['(row + r_padding, col + c_padding, 3)'], {}), '((row + r_padding, col + c_padding, 3))\n', (366, 405), True, 'import numpy as np\n'), ((663, 688), 'cv2.imread', 'cv2.imread', (['"""test/13.jpg"""'], {}), "('test/13.jpg')\n", (673, 688), False, 'import cv2\n'), ((760, 795), 'c...
from __future__ import absolute_import from __future__ import print_function import numpy as np import argparse import os import imp import re from mimic3models.decompensation import utils from mimic3benchmark.readers import DecompensationReader from mimic3models.preprocessing import Discretizer, Normalizer from mim...
[ "argparse.ArgumentParser", "mimic3models.keras_utils.DecompensationMetrics", "os.path.basename", "mimic3models.decompensation.utils.BatchGen", "keras.callbacks.ModelCheckpoint", "mimic3models.common_utils.add_common_arguments", "os.path.dirname", "os.path.exists", "os.makedirs", "mimic3models.deco...
[((670, 695), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (693, 695), False, 'import argparse\n'), ((696, 737), 'mimic3models.common_utils.add_common_arguments', 'common_utils.add_common_arguments', (['parser'], {}), '(parser)\n', (729, 737), False, 'from mimic3models import common_utils\n')...
# -*- coding: utf-8 -*- # This file is part of QuTiP: Quantum Toolbox in Python. # # Copyright (c) 2014 and later, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1....
[ "numpy.trace", "numpy.abs", "numpy.sum", "qutip.logging_utils.get_logger", "qutip.control.errors.UsageError", "timeit.default_timer", "numpy.angle", "numpy.zeros", "numpy.isnan", "numpy.real", "warnings.warn" ]
[((2845, 2865), 'qutip.logging_utils.get_logger', 'logging.get_logger', ([], {}), '()\n', (2863, 2865), True, 'import qutip.logging_utils as logging\n'), ((3072, 3132), 'warnings.warn', 'warnings.warn', (['message', 'FutureWarning'], {'stacklevel': 'stacklevel'}), '(message, FutureWarning, stacklevel=stacklevel)\n', (3...
import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.autograd import Variable import librosa from stft import STFT import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"]="1" class MelSpectrogram(torch.nn.Module): """ Example: ...
[ "numpy.log", "stft.STFT", "librosa.filters.mel" ]
[((961, 1027), 'stft.STFT', 'STFT', ([], {'filter_length': 'self.filter_length', 'hop_length': 'self.hop_length'}), '(filter_length=self.filter_length, hop_length=self.hop_length)\n', (965, 1027), False, 'from stft import STFT\n'), ((1050, 1122), 'librosa.filters.mel', 'librosa.filters.mel', (['self.sample_rate', 'self...
# -*- coding: utf-8 -*- '''An implementation of sequence to sequence learning for predicting phonetic scribes from itself. Phonetic scribe: "/'wed\u026a\u014b/" ("wedding") Padding is handled by using a repeated sentinel character (space) Adapted from Keras example "addition_rnn.py" Input may optionally be inverted, ...
[ "numpy.random.shuffle", "os.makedirs", "json.loads", "keras.layers.Activation", "os.path.exists", "numpy.array", "keras.models.Sequential", "keras.layers.RepeatVector", "datetime.datetime.now", "sys.exit" ]
[((3827, 3853), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (3844, 3853), True, 'import numpy as np\n'), ((4162, 4174), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (4172, 4174), False, 'from keras.models import Sequential\n'), ((887, 1013), 'sys.exit', 'sys.exit', (['""...
import pandas as pd import numpy as np import datetime from nltk.tokenize import sent_tokenize import networkx as nx import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.ticker as mtick from matplotlib import cm from itertools import combinations def figure1(dataframe)...
[ "matplotlib.pyplot.savefig", "matplotlib.dates.MonthLocator", "numpy.sum", "matplotlib.cm.get_cmap", "numpy.argsort", "numpy.mean", "networkx.draw_networkx_nodes", "networkx.draw_networkx_labels", "numpy.unique", "pandas.DataFrame", "matplotlib.dates.DateFormatter", "numpy.linspace", "matplo...
[((759, 788), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12, 8)'}), '(figsize=(12, 8))\n', (771, 788), True, 'import matplotlib.pyplot as plt\n'), ((1074, 1140), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""data_distribution.png"""'], {'dpi': '(300)', 'bbox_inches': '"""tight"""'}), "('data_d...
import scanorama import numpy as np def data_gen(): X1 = np.random.rand(100, 10) genes1 = [ 'g' + str(i) for i in range(10) ] X2 = np.random.rand(200, 12) genes2 = list(reversed([ 'g' + str(i) for i in range(12) ])) return [ X1, X2 ], [ genes1, genes2 ] def test_scanorama_integrate(): """ ...
[ "pandas.DataFrame", "scanorama.integrate", "scanorama.integrate_scanpy", "scanorama.correct_scanpy", "numpy.random.rand", "anndata.AnnData" ]
[((62, 85), 'numpy.random.rand', 'np.random.rand', (['(100)', '(10)'], {}), '(100, 10)\n', (76, 85), True, 'import numpy as np\n'), ((145, 168), 'numpy.random.rand', 'np.random.rand', (['(200)', '(12)'], {}), '(200, 12)\n', (159, 168), True, 'import numpy as np\n'), ((520, 561), 'scanorama.integrate', 'scanorama.integr...
from flare.framework.algorithm import Model from flare.framework.computation_task import ComputationTask from flare.algorithm_zoo.simple_algorithms import SimpleAC, SimpleQ from flare.model_zoo.simple_models import SimpleModelDeterministic, SimpleModelAC, SimpleModelQ from test_algorithm import TestAlgorithm from torc...
[ "unittest.main", "numpy.random.uniform", "copy.deepcopy", "flare.framework.computation_task.ComputationTask", "torch.nn.ReLU", "flare.model_zoo.simple_models.SimpleModelQ", "numpy.random.choice", "torch.nn.Conv2d", "numpy.zeros", "numpy.ones", "torch.nn.Softmax", "flare.model_zoo.simple_models...
[((8046, 8061), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8059, 8061), False, 'import unittest\n'), ((3706, 3746), 'flare.framework.computation_task.ComputationTask', 'ComputationTask', (['"""test"""'], {'algorithm': 'q_cnn'}), "('test', algorithm=q_cnn)\n", (3721, 3746), False, 'from flare.framework.computa...
import numpy as np import openmdao.api as om import wisdem.drivetrainse.layout as lay import wisdem.drivetrainse.drive_structure as ds import wisdem.drivetrainse.drive_components as dc from wisdem.drivetrainse.hub import Hub_System from wisdem.drivetrainse.gearbox import Gearbox from wisdem.drivetrainse.generator impor...
[ "wisdem.drivetrainse.hub.Hub_System", "wisdem.drivetrainse.drive_components.DriveDynamics", "wisdem.drivetrainse.drive_structure.HSS_Frame", "openmdao.api.LinearBlockGS", "wisdem.drivetrainse.gearbox.Gearbox", "wisdem.drivetrainse.drive_components.Brake", "numpy.mean", "wisdem.drivetrainse.drive_compo...
[((3513, 3545), 'numpy.mean', 'np.mean', (["inputs['E_mat']"], {'axis': '(1)'}), "(inputs['E_mat'], axis=1)\n", (3520, 3545), True, 'import numpy as np\n'), ((3558, 3590), 'numpy.mean', 'np.mean', (["inputs['G_mat']"], {'axis': '(1)'}), "(inputs['G_mat'], axis=1)\n", (3565, 3590), True, 'import numpy as np\n'), ((7376,...
from robosuite.wrappers import VisualizationWrapper import robosuite as suite from robosuite.wrappers import GymWrapper import numpy as np from typing import Callable, List, Optional, Tuple, Union import os import gym import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint from scipy.inter...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "robosuite.make", "matplotlib.pyplot.plot", "numpy.random.randn", "scipy.integrate.odeint", "matplotlib.pyplot.legend", "numpy.sqrt", "matplotlib.pyplot.figure", "numpy.array", "robosuite.wrappers.VisualizationWrapper", "scipy.interpolate....
[((1533, 1545), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1543, 1545), True, 'import matplotlib.pyplot as plt\n'), ((1557, 1573), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(311)'], {}), '(311)\n', (1568, 1573), True, 'import matplotlib.pyplot as plt\n'), ((1838, 1854), 'matplotlib.pyplot.subplot...
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Copyright 2017 <NAME> # # 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 b...
[ "tensorflow.matrix_band_part", "numpy.abs", "tensorflow.trainable_variables", "numpy.argmax", "tensorflow.get_collection", "parser.structs.conllu_dataset.CoNLLUDevset", "curses.wrapper", "numpy.greater", "tensorflow.ConfigProto", "tensorflow.global_variables", "tensorflow.Variable", "numpy.mea...
[((1240, 1252), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1250, 1252), False, 'import uuid\n'), ((5354, 5379), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(12345)'], {}), '(12345)\n', (5372, 5379), True, 'import tensorflow as tf\n'), ((5393, 5456), 'parser.structs.conllu_dataset.CoNLLUTrainset', 'conllu...
# Copyright (C) 2009 <NAME> # Copyright (C) 2010-2011 <NAME> # # 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 applicab...
[ "numpy.conj", "numpy.angle", "numpy.zeros", "numpy.sin", "numpy.cos" ]
[((955, 966), 'numpy.zeros', 'zeros', (['ngen'], {}), '(ngen)\n', (960, 966), False, 'from numpy import ones, zeros, angle, sin, cos, arange, pi, conj, r_\n'), ((978, 989), 'numpy.zeros', 'zeros', (['ngen'], {}), '(ngen)\n', (983, 989), False, 'from numpy import ones, zeros, angle, sin, cos, arange, pi, conj, r_\n'), (...
#!/usr/bin/python ######################################################################################################################## # # Copyright (c) 2014, Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permi...
[ "imp.find_module", "os.path.exists", "laygo.GridLayoutGenerator", "numpy.array", "bag.BagProject", "numpy.vstack" ]
[((1829, 1846), 'numpy.array', 'np.array', (['[-1, 1]'], {}), '([-1, 1])\n', (1837, 1846), True, 'import numpy as np\n'), ((2975, 2991), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (2983, 2991), True, 'import numpy as np\n'), ((12426, 12442), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (12...
""""Default values for bodies and contact parameters. Should be change in bodydef.py if needed. """ from siconos.mechanisms import mbtb import numpy as np import array mbtb.MBTB_MAX_BODIES_NUMBER mbtb.MBTB_MAX_CONTACTS_NUMBER mbtb.MBTB_MAX_JOINTS_NUMBER initVel = np.array([(0, 0, 0, 0, 0, 0) for i...
[ "numpy.array" ]
[((1049, 1072), 'numpy.array', 'np.array', (['[]'], {'dtype': 'int'}), '([], dtype=int)\n', (1057, 1072), True, 'import numpy as np\n')]
import math import numpy as np def prob_to_angles(prob, previous=1.0): "Calculates the angles to encode the given probabilities" def calc_angle(x): try: return 2 * math.acos(math.sqrt(x)) except: print(x) raise() if len(prob) == 2: return [c...
[ "numpy.sum", "math.sqrt", "numpy.split" ]
[((397, 414), 'numpy.split', 'np.split', (['prob', '(2)'], {}), '(prob, 2)\n', (405, 414), True, 'import numpy as np\n'), ((580, 591), 'numpy.sum', 'np.sum', (['lhs'], {}), '(lhs)\n', (586, 591), True, 'import numpy as np\n'), ((654, 665), 'numpy.sum', 'np.sum', (['rhs'], {}), '(rhs)\n', (660, 665), True, 'import numpy...
import os import h5py import numpy as np from xml.etree import ElementTree as ET from .util import subsample_data def np_to_bdv(array, fname='myfile', subsamp=((1, 1, 1), (1, 2, 2)), chunks=((4, 32, 32), (16, 16, 16)), compression='gzip', dx = 1.0,...
[ "numpy.divide", "h5py.File", "os.path.basename", "numpy.empty", "xml.etree.ElementTree.Element", "numpy.empty_like", "numpy.dtype", "numpy.fliplr", "numpy.array", "os.path.splitext", "xml.etree.ElementTree.SubElement", "numpy.squeeze", "xml.etree.ElementTree.ElementTree" ]
[((3843, 3860), 'numpy.empty', 'np.empty', (['(nr, 3)'], {}), '((nr, 3))\n', (3851, 3860), True, 'import numpy as np\n'), ((3872, 3891), 'numpy.empty_like', 'np.empty_like', (['ress'], {}), '(ress)\n', (3885, 3891), True, 'import numpy as np\n'), ((5364, 5386), 'xml.etree.ElementTree.Element', 'ET.Element', (['"""SpimD...
# # <NAME> generated this file from the information available in # https://www.ppic.org/data-set/ppic-statewide-survey-data-2018/ # import numpy as np metainfo = { 'id': { 'full': 'ID', 'short': 'id', 'use': 0, 'code_num': lambda a: int(a), 'type': 'categorical' }, '...
[ "numpy.isnan" ]
[((540, 551), 'numpy.isnan', 'np.isnan', (['a'], {}), '(a)\n', (548, 551), True, 'import numpy as np\n'), ((2858, 2869), 'numpy.isnan', 'np.isnan', (['a'], {}), '(a)\n', (2866, 2869), True, 'import numpy as np\n'), ((3393, 3404), 'numpy.isnan', 'np.isnan', (['a'], {}), '(a)\n', (3401, 3404), True, 'import numpy as np\n...
import numpy as np from test.util import generate_kernel_test_case, wrap_template from webdnn.graph.graph import Graph from webdnn.graph.order import OrderCNHW, OrderNHWC from webdnn.graph.variable import Variable @wrap_template def template(x_order=OrderNHWC, y_order=OrderNHWC, value=4, description: str = ""): ...
[ "numpy.random.rand", "numpy.transpose", "webdnn.graph.variable.Variable", "webdnn.graph.graph.Graph" ]
[((394, 429), 'webdnn.graph.variable.Variable', 'Variable', (['vx.shape'], {'order': 'OrderNHWC'}), '(vx.shape, order=OrderNHWC)\n', (402, 429), False, 'from webdnn.graph.variable import Variable\n'), ((325, 351), 'numpy.random.rand', 'np.random.rand', (['(2)', '(3)', '(4)', '(5)'], {}), '(2, 3, 4, 5)\n', (339, 351), T...
import numpy as np import pandas as pd import src.utils as utils from . import SubRunner from src.core.states import RunningState class AVRunner(SubRunner): signature = "av" callback_group = "av" def __init__(self, config: dict, state: RunningState): super().__init__(config, state) def run...
[ "src.utils.timer", "pandas.concat", "numpy.concatenate", "src.core.states.RunningState" ]
[((719, 755), 'numpy.concatenate', 'np.concatenate', (['[target_0, target_1]'], {}), '([target_0, target_1])\n', (733, 755), True, 'import numpy as np\n'), ((770, 826), 'src.utils.timer', 'utils.timer', (['"""Adversarial Validation"""', 'self.state.logger'], {}), "('Adversarial Validation', self.state.logger)\n", (781,...
import os import json import numpy as np from PIL import Image import torchvision.transforms as transforms BASEDIR = "/home/batman/imagenet" train_files = open(os.path.join(BASEDIR, "train_files")).read().strip().split("\n") val_files = open(os.path.join(BASEDIR, "val_files")).read().strip().split("\n") ci = json.load...
[ "numpy.array", "torchvision.transforms.RandomResizedCrop", "os.path.join", "PIL.Image.open" ]
[((429, 462), 'torchvision.transforms.RandomResizedCrop', 'transforms.RandomResizedCrop', (['(224)'], {}), '(224)\n', (457, 462), True, 'import torchvision.transforms as transforms\n'), ((326, 376), 'os.path.join', 'os.path.join', (['BASEDIR', '"""imagenet_class_index.json"""'], {}), "(BASEDIR, 'imagenet_class_index.js...
import numpy as np import pytest from xoak import IndexAdapter, IndexRegistry from xoak.index.base import ( IndexRegistrationWarning, XoakIndexWrapper, normalize_index, register_default, ) from xoak.index.scipy_adapters import ScipyKDTreeAdapter class DummyIndex: def __init__(self, points, option...
[ "xoak.index.base.XoakIndexWrapper", "pytest.warns", "numpy.zeros", "numpy.ones", "xoak.IndexRegistry", "pytest.raises", "xoak.index.base.register_default", "xoak.index.base.normalize_index" ]
[((1325, 1340), 'xoak.IndexRegistry', 'IndexRegistry', ([], {}), '()\n', (1338, 1340), False, 'from xoak import IndexAdapter, IndexRegistry\n'), ((1412, 1444), 'xoak.IndexRegistry', 'IndexRegistry', ([], {'use_default': '(False)'}), '(use_default=False)\n', (1425, 1444), False, 'from xoak import IndexAdapter, IndexRegi...
""" Main ChemKED module """ # Standard libraries from os.path import exists, isabs, dirname, join from collections import namedtuple from warnings import warn from copy import deepcopy import xml.etree.ElementTree as etree import xml.dom.minidom as minidom from itertools import chain import numpy as np # Local import...
[ "pandas.DataFrame", "os.path.isabs", "os.path.dirname", "xml.etree.ElementTree.Element", "os.path.exists", "numpy.genfromtxt", "pandas.Index", "xml.dom.minidom.parse", "numpy.array", "collections.namedtuple", "xml.etree.ElementTree.SubElement", "warnings.warn", "os.path.join", "xml.etree.E...
[((473, 520), 'collections.namedtuple', 'namedtuple', (['"""VolumeHistory"""', "['time', 'volume']"], {}), "('VolumeHistory', ['time', 'volume'])\n", (483, 520), False, 'from collections import namedtuple\n'), ((835, 890), 'collections.namedtuple', 'namedtuple', (['"""TimeHistory"""', "['time', 'quantity', 'type']"], {...
""" pynet dense fonctional brain networks extraction ================================================ Credit: <NAME> Spatiotemporal Attention Autoencoder (STAAE) for ADHD Classification, MICCAI, 2020. DEEP VARIATIONAL AUTOENCODER FOR MODELING FUNCTIONAL BRAIN NETWORKS AND ADHD IDENTIFICATION, ISBI 2020. """ import o...
[ "numpy.load", "numpy.random.seed", "numpy.sum", "nilearn.plotting.show", "nilearn.plotting.plot_prob_atlas", "os.path.isfile", "pynet.interfaces.STAAENetEncoder", "nilearn.datasets.fetch_adhd", "os.path.join", "nilearn.image.resampling.resample_to_img", "nibabel.save", "nilearn.image.iter_img"...
[((1187, 1222), 'os.path.join', 'os.path.join', (['WORKDIR', '"""ADHD40.npy"""'], {}), "(WORKDIR, 'ADHD40.npy')\n", (1199, 1222), False, 'import os\n'), ((1234, 1277), 'os.path.join', 'os.path.join', (['WORKDIR', '"""ADHD40_mask.nii.gz"""'], {}), "(WORKDIR, 'ADHD40_mask.nii.gz')\n", (1246, 1277), False, 'import os\n'),...
## Helper functions for the Arenas et al model [1,2] import numpy as np # NG : cardinality of the age strata # NP : number of patches (regions) def f(pop_dens_i, ξ): ''' Returns the influence of population density, where `pop_dens_i`: effective population in patch i / surface in patch i in km^2 ''' ...
[ "numpy.array", "numpy.dot", "numpy.transpose", "numpy.exp" ]
[((334, 357), 'numpy.exp', 'np.exp', (['(-ξ * pop_dens_i)'], {}), '(-ξ * pop_dens_i)\n', (340, 357), True, 'import numpy as np\n'), ((1385, 1405), 'numpy.dot', 'np.dot', (['n_ig', '(1 - pg)'], {}), '(n_ig, 1 - pg)\n', (1391, 1405), True, 'import numpy as np\n'), ((2061, 2079), 'numpy.transpose', 'np.transpose', (['C_gh...
# -*- coding: utf-8 -*- """ Created on Sun Nov 17 16:33:09 2019 @author: Administrador """ # -*- coding: utf-8 -*- """ Created on Sat Nov 16 16:27:06 2019 @author: Administrador """ import pandas as pd import spacy import networkx as nx from itertools import combinations from collections import defaultdict import o...
[ "pandas.DataFrame", "json.dump", "pandas.read_csv", "collections.defaultdict", "sqlite3.connect", "numpy.array", "pandas.read_sql_query", "operator.itemgetter" ]
[((426, 465), 'sqlite3.connect', 'sqlite3.connect', (['"""stackoverflow-red.db"""'], {}), "('stackoverflow-red.db')\n", (441, 465), False, 'import sqlite3\n'), ((804, 820), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (815, 820), False, 'from collections import defaultdict\n'), ((1060, 1077), 'co...
import numpy as np array1 = [[1,2],[3,4]] array2 = [[5,6],[7,8]] print("Concatenate") print("_________") array3_0 = np.concatenate((array1,array2), axis=0) print(array3_0) """ [[1 2] [3 4] [5 6] [7 8]] """ array3_1 = np.concatenate((array1,array2), axis=1) print(array3_1) """ [[1 2 5 6] [3 4 7 8]] """ p...
[ "numpy.stack", "numpy.concatenate" ]
[((121, 161), 'numpy.concatenate', 'np.concatenate', (['(array1, array2)'], {'axis': '(0)'}), '((array1, array2), axis=0)\n', (135, 161), True, 'import numpy as np\n'), ((227, 267), 'numpy.concatenate', 'np.concatenate', (['(array1, array2)'], {'axis': '(1)'}), '((array1, array2), axis=1)\n', (241, 267), True, 'import ...
# Copyright <NAME> 2019 # Author: <NAME> """ This script processes the light curve .dat file for Mrk 335. mkn335_xrt_uvot_lc.dat contains the UVW2 data in magnitudes whilst mkn335_xrt_w2_lc.dat contains the UVW2 data in count rates. UVW2 Count rate data goes up to 59234.47 days whereas magnitude data goes up to 58626.2...
[ "matplotlib.pyplot.title", "pickle.dump", "matplotlib.pyplot.show", "matplotlib.pyplot.clf", "matplotlib.pyplot.scatter", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((3114, 3153), 'numpy.array', 'np.array', (['x_ray_times'], {'dtype': 'np.float64'}), '(x_ray_times, dtype=np.float64)\n', (3122, 3153), True, 'import numpy as np\n'), ((3183, 3233), 'numpy.array', 'np.array', (['x_ray_band_count_rates'], {'dtype': 'np.float64'}), '(x_ray_band_count_rates, dtype=np.float64)\n', (3191,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on 14/09/17 @author: <NAME> """ import numpy as np import scipy.sparse as sps import zipfile def loadCSVintoSparse (filePath, header = False, separator="::"): values, rows, cols = [], [], [] fileHandle = open(filePath, "r") ...
[ "numpy.logical_not", "scipy.sparse.coo_matrix", "scipy.sparse.csr_matrix", "numpy.random.choice" ]
[((871, 927), 'scipy.sparse.csr_matrix', 'sps.csr_matrix', (['(values, (rows, cols))'], {'dtype': 'np.float32'}), '((values, (rows, cols)), dtype=np.float32)\n', (885, 927), True, 'import scipy.sparse as sps\n'), ((2527, 2621), 'numpy.random.choice', 'np.random.choice', (['[True, False]', 'numInteractions'], {'p': '[tr...
# -*- coding: utf-8 -*- # # code for adaptive spatial binning of 2D fits files. # requieres: - asciidata # - numpy 1.3.0 (essential for the numpy.histogram routine!!!) # - pyfits # - plt (just for plotting, alternatively start program with quiet=True) # #############...
[ "numpy.sum", "numpy.argmax", "astropy.io.fits.PrimaryHDU", "numpy.ones", "numpy.argmin", "numpy.argsort", "numpy.histogram", "numpy.mean", "numpy.arange", "matplotlib.pyplot.figure", "numpy.unique", "numpy.copy", "numpy.std", "numpy.logical_not", "numpy.append", "numpy.max", "matplot...
[((6007, 6024), 'numpy.sum', 'numpy.sum', (['signal'], {}), '(signal)\n', (6016, 6024), False, 'import numpy\n'), ((6223, 6241), 'numpy.mean', 'numpy.mean', (['signal'], {}), '(signal)\n', (6233, 6241), False, 'import numpy\n'), ((6556, 6616), 'numpy.argmin', 'numpy.argmin', (['(((x - xnode) ** 2 + (y - ynode) ** 2) * ...
""" Video reading and writing interfaces for different formats. """ import os import shutil import h5py as h5 import cv2 import imgstore import numpy as np import attr import cattr import logging import multiprocessing from typing import Iterable, List, Optional, Tuple, Union, Text from sleap.util import json_loads...
[ "os.remove", "numpy.load", "attr.s", "cv2.imdecode", "os.path.isfile", "cv2.imencode", "shutil.rmtree", "os.path.abspath", "os.path.dirname", "os.path.exists", "numpy.transpose", "numpy.max", "numpy.stack", "h5py.File", "os.path.basename", "imgstore.new_for_format", "attr.ib", "att...
[((343, 370), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (360, 370), False, 'import logging\n'), ((374, 410), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)', 'cmp': '(False)'}), '(auto_attribs=True, cmp=False)\n', (380, 410), False, 'import attr\n'), ((940, 976), 'attr.s', 'attr.s...
import random from multiprocessing import Process, Lock import pickle import os import matplotlib import numpy from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit matplotlib.use('Agg') import sys from AdaFair import AdaFair sys.path.insert(0, 'DataPreprocessing') # import funcs_disp_mist as fd...
[ "pickle.dump", "os.remove", "my_useful_functions.calculate_performance", "multiprocessing.Lock", "pickle.load", "numpy.arange", "AdaFair.AdaFair", "os.path.exists", "load_bank.load_bank", "load_compas_data.load_compas", "my_useful_functions.plot_results_of_c_impact", "matplotlib.use", "load_...
[((185, 206), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (199, 206), False, 'import matplotlib\n'), ((249, 288), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""DataPreprocessing"""'], {}), "(0, 'DataPreprocessing')\n", (264, 288), False, 'import sys\n'), ((2016, 2048), 'numpy.arange', 'nu...
# Copyright 2019 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[ "numpy.sum", "numpy.ones", "numpy.random.randint", "numpy.arange", "numpy.exp", "akg.utils.kernel_exec.product_is_mini", "akg.tvm.create_schedule", "akg.tvm.PrintTensorRecursively", "test_op.focalloss_ad.focalloss_ad.focalloss_ad", "numpy.prod", "numpy.full", "akg.utils.kernel_exec.gen_name_ke...
[((1039, 1072), 'numpy.max', 'np.max', (['x'], {'axis': '(-1)', 'keepdims': '(True)'}), '(x, axis=-1, keepdims=True)\n', (1045, 1072), True, 'import numpy as np\n'), ((1200, 1233), 'numpy.max', 'np.max', (['x'], {'axis': '(-1)', 'keepdims': '(True)'}), '(x, axis=-1, keepdims=True)\n', (1206, 1233), True, 'import numpy ...
import os import numpy as np from PIL import Image import tensorflow as tf from absl import app, flags, logging from absl.flags import FLAGS from tqdm import trange import contextlib2 import pandas as pd flags.DEFINE_string('dataset', '../dataset/train_5fold.csv', '训练集路径') flags.DEFINE_string('train_record_path', '../...
[ "tensorflow.train.BytesList", "tensorflow.train.Int64List", "tqdm.trange", "pandas.read_csv", "tensorflow.train.Example", "tensorflow.train.Features", "PIL.Image.open", "absl.flags.DEFINE_string", "absl.logging.info", "absl.app.run", "numpy.array", "contextlib2.ExitStack", "tensorflow.io.TFR...
[((205, 274), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dataset"""', '"""../dataset/train_5fold.csv"""', '"""训练集路径"""'], {}), "('dataset', '../dataset/train_5fold.csv', '训练集路径')\n", (224, 274), False, 'from absl import app, flags, logging\n'), ((275, 364), 'absl.flags.DEFINE_string', 'flags.DEFINE_string...
# coding=utf-8 import numpy as np import random import time COLOR_BLACK = -1 COLOR_WHITE = 1 COLOR_NONE = 0 h_5 = 20000 #连5 h_4 = 2000 #活4 c_4 = 300 #冲4 tc_4 = 250 #跳冲4 h_3 = 450 #活3 c_3 = 50 #冲3 tc_3 = 300 #跳冲3 h_2 = 100 # 活2 c_2 = 30 # 冲2 # MAX_NODE = 5 random.seed(5544) # don't change the class name cla...
[ "numpy.zeros", "random.seed", "time.time" ]
[((267, 284), 'random.seed', 'random.seed', (['(5544)'], {}), '(5544)\n', (278, 284), False, 'import random\n'), ((1028, 1039), 'time.time', 'time.time', ([], {}), '()\n', (1037, 1039), False, 'import time\n'), ((1206, 1275), 'numpy.zeros', 'np.zeros', (['(self.chessboard_size, self.chessboard_size)'], {'dtype': '"""in...
import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import matplotlib.cbook as cbook from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score def plot_coeffs(coeffs, cols, axs = None, **kwargs): """ Plot to show coefficients :param coeffs: list...
[ "seaborn.set_style", "numpy.abs", "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.arange" ]
[((495, 521), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (508, 521), True, 'import seaborn as sns\n'), ((2172, 2194), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (2185, 2194), True, 'import seaborn as sns\n'), ((3393, 3419), 'seaborn.set_style', '...
# This file is part of GridCal. # # GridCal is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # GridCal is distributed in the hope that...
[ "math.sqrt", "numpy.empty", "numba.njit", "numpy.zeros", "numba.typed.List.empty_list" ]
[((763, 783), 'numba.njit', 'nb.njit', (['"""i4[:](i8)"""'], {}), "('i4[:](i8)')\n", (770, 783), True, 'import numba as nb\n'), ((841, 861), 'numba.njit', 'nb.njit', (['"""f8[:](i8)"""'], {}), "('f8[:](i8)')\n", (848, 861), True, 'import numba as nb\n'), ((921, 984), 'numba.njit', 'nb.njit', (['"""Tuple((i8, i8, i4[:],...
import numpy as np from .strategy import BaseStrategy class GreedyStrategy(BaseStrategy): """ Allows to visit nodes of parameters' grid in a particular order. The rough idea: We are given grid of (values1 x values2 x values3). This strategy will find best value among points of form [v...
[ "numpy.asarray" ]
[((4046, 4068), 'numpy.asarray', 'np.asarray', (['cur_scores'], {}), '(cur_scores)\n', (4056, 4068), True, 'import numpy as np\n'), ((3002, 3026), 'numpy.asarray', 'np.asarray', (['found_values'], {}), '(found_values)\n', (3012, 3026), True, 'import numpy as np\n')]
""" Docstring goes here """ import pickle import os from igraph import * import leidenalg as la import pandas as pd from pcst_fast import * import numpy as np import matplotlib import matplotlib.pyplot as plot from sklearn.metrics import confusion_matrix, normalized_mutual_info_score matplotlib.rcParams['pdf.fonttype'...
[ "pandas.DataFrame", "os.mkdir", "pandas.DataFrame.from_dict", "pandas.read_csv", "sklearn.metrics.normalized_mutual_info_score", "numpy.zeros", "numpy.append", "leidenalg.find_partition", "leidenalg.find_partition_multiplex", "numpy.array", "leidenalg.Optimiser", "pandas.concat", "matplotlib...
[((22652, 22728), 'pandas.read_csv', 'pd.read_csv', (['"""data/human.name_2_string.tsv"""', '"""\t"""'], {'skiprows': '[0]', 'header': 'None'}), "('data/human.name_2_string.tsv', '\\t', skiprows=[0], header=None)\n", (22663, 22728), True, 'import pandas as pd\n'), ((22817, 22893), 'pandas.read_csv', 'pd.read_csv', (['"...
import numpy as np from PIL import Image import sys def read_image(file_name: str) -> np.array: return np.asarray(Image.open(file_name), dtype=np.uint8) def image_from_array(array: np.array, mode) -> Image: return Image.fromarray(array, mode=mode) def display_image(file_name: str) -> None: image = Ima...
[ "PIL.Image.fromarray", "numpy.array", "PIL.Image.open" ]
[((570, 613), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 1, 0], [0, 0, 0]]'], {}), '([[0, 0, 0], [0, 1, 0], [0, 0, 0]])\n', (578, 613), True, 'import numpy as np\n'), ((650, 697), 'numpy.array', 'np.array', (['[[0, -1, 0], [-1, 5, -1], [0, -1, 0]]'], {}), '([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])\n', (658, 697), True...
#!/usr/bin/env python # coding: utf-8 # Deterministic selection # (c) 2019 <NAME>. This work is licensed under a [Creative Commons # Attribution License CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/). # All code contained herein is licensed under an [MIT # license](https://opensource.org/licenses/MIT) #%% ...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "pandas.read_excel", "matplotlib.pyplot.figure", "statgen.viz.pboc_style_mpl", "numpy.linspace", "numpy.exp", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig" ]
[((579, 607), 'statgen.viz.pboc_style_mpl', 'statgen.viz.pboc_style_mpl', ([], {}), '()\n', (605, 607), False, 'import statgen\n'), ((846, 907), 'pandas.read_excel', 'pd.read_excel', (['"""../../fig/fig_names.xlsx"""'], {'sheet_name': 'CHAPTER'}), "('../../fig/fig_names.xlsx', sheet_name=CHAPTER)\n", (859, 907), True, ...
import numpy as np import matplotlib.pyplot as plt import math from math import pi,pow from PyPonding import FE from PyPonding.structures import basic_structure class osu_test: # Plan Dimensions L = 48*12 Le = 4 S = 67 Se = 5 # Joist and Beam Section Properties E ...
[ "numpy.empty", "PyPonding.FE.Model", "math.sqrt" ]
[((1215, 1261), 'PyPonding.FE.Model', 'FE.Model', (["('OSU Test Model, %s' % self.specimen)"], {}), "('OSU Test Model, %s' % self.specimen)\n", (1223, 1261), False, 'from PyPonding import FE\n'), ((14030, 14058), 'numpy.empty', 'np.empty', (['[2 * self.nele, 1]'], {}), '([2 * self.nele, 1])\n', (14038, 14058), True, 'i...
import re import numpy as np import babel from babel import numbers from wtq import evaluator def average_token_embedding(tks, model, embedding_size=300): arrays = [] for tk in tks: if tk in model: arrays.append(model[tk]) else: arrays.append(np.zeros(embedding_size)) return ...
[ "numpy.zeros", "babel.numbers.parse_decimal", "wtq.evaluator.target_values_map", "re.search", "numpy.vstack" ]
[((2864, 2900), 'wtq.evaluator.target_values_map', 'evaluator.target_values_map', (['*answer'], {}), '(*answer)\n', (2891, 2900), False, 'from wtq import evaluator\n'), ((331, 348), 'numpy.vstack', 'np.vstack', (['arrays'], {}), '(arrays)\n', (340, 348), True, 'import numpy as np\n'), ((556, 580), 'numpy.zeros', 'np.ze...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # This code is based on a code and ideas by <NAME> and <NAME>, # University Clermont Auvergne, CNRS, SIGMA Clermont, Ins...
[ "matplotlib.pyplot.subplot", "numpy.tanh", "numpy.concatenate", "matplotlib.pyplot.clf", "numpy.zeros", "math.sin", "numpy.arange", "math.cos", "numpy.cos", "numpy.random.rand", "matplotlib.pyplot.savefig" ]
[((4351, 4385), 'numpy.random.rand', 'np.random.rand', (['num_thermal_plants'], {}), '(num_thermal_plants)\n', (4365, 4385), True, 'import numpy as np\n'), ((5394, 5415), 'numpy.zeros', 'np.zeros', (['(num_dams,)'], {}), '((num_dams,))\n', (5402, 5415), True, 'import numpy as np\n'), ((11003, 11012), 'matplotlib.pyplot...
from __future__ import print_function, division import numpy as np import copy class ParticleSwarmOptimizedNN(): """ Particle Swarm Optimization of Neural Network. Parameters: ----------- n_individuals: int The number of neural networks that are allowed in the population at a time. model_b...
[ "numpy.random.uniform", "numpy.zeros_like", "copy.copy", "numpy.clip" ]
[((1778, 1801), 'copy.copy', 'copy.copy', (['model.layers'], {}), '(model.layers)\n', (1787, 1801), False, 'import copy\n'), ((2606, 2625), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (2623, 2625), True, 'import numpy as np\n'), ((2639, 2658), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '(...
import numpy as np from matplotlib import pyplot as plt ''' COMPRESSOR MODEL Objective: build an equivalent compressor excitation to the acoustic FE model Output: volumetric flow (acoustic volume velocity) Assumptions: 1) Stead flow; 2) Ideal gas behaviour; 3) Compression and e...
[ "numpy.abs", "matplotlib.pyplot.show", "numpy.remainder", "numpy.fft.fft", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.tile", "numpy.linspace", "numpy.array", "numpy.cos", "numpy.min", "numpy.mean", "matplotlib.pyplot.grid", "numpy.sqrt" ]
[((654, 665), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (662, 665), True, 'import numpy as np\n'), ((910, 937), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '[12, 7]'}), '(figsize=[12, 7])\n', (920, 937), True, 'from matplotlib import pyplot as plt\n'), ((1261, 1271), 'matplotlib.pyplot.grid', 'plt...
import sys sys.path.append("..") # Adds higher directory to python modules path. import numpy as np import matplotlib.pyplot as plt import torch from torch.autograd import Variable import time from cassie import CassieEnv import argparse import pickle parser = argparse.ArgumentParser() parser.add_argument("--path",...
[ "sys.path.append", "matplotlib.pyplot.tight_layout", "argparse.ArgumentParser", "numpy.concatenate", "torch.load", "numpy.zeros", "torch.Tensor", "numpy.linalg.norm", "numpy.linspace", "cassie.CassieEnv", "torch.no_grad", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((265, 290), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (288, 290), False, 'import argparse\n'), ((817, 989), 'cassie.CassieEnv', 'CassieEnv', ([], {'traj': 'run_args.traj', '...
import cv2 import numpy as np import bilinear import patchreg from utils import get_x, get_y from skimage.util import view_as_windows def bilinear_interpolation_of_patch_registration(master_srcdata, target_srcdata, wsize): print("Beginning bilinear_interpolation_of_patch_registration...") w_shape = (wsize, ws...
[ "patchreg.calcPlateMorphs", "bilinear.quilter", "utils.get_x", "cv2.remap", "cv2.DescriptorMatcher_create", "utils.get_y", "cv2.absdiff", "cv2.line", "cv2.warpPerspective", "patchreg.calc_id_patches", "cv2.contourArea", "cv2.cvtColor", "cv2.imwrite", "cv2.copyMakeBorder", "numpy.append",...
[((489, 584), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (['master_srcdata', 'padding', 'padding', 'padding', 'padding', 'cv2.BORDER_REFLECT'], {}), '(master_srcdata, padding, padding, padding, padding, cv2.\n BORDER_REFLECT)\n', (507, 584), False, 'import cv2\n'), ((597, 692), 'cv2.copyMakeBorder', 'cv2.copyMakeBo...
from data import DataPreparation, Query, result_df, r_squared import pandas as pd import matplotlib.pyplot as plt import numpy as np import xgboost as xgb from joblib import dump from mlxtend.regressor import StackingRegressor from sklearn.linear_model import LinearRegression from sklearn.preprocessing import MinMaxSca...
[ "xgboost.plot_importance", "numpy.random.seed", "matplotlib.pyplot.show", "sklearn.feature_selection.RFE", "joblib.dump", "sklearn.linear_model.LinearRegression", "xgboost.XGBRegressor", "data.DataPreparation", "mlxtend.regressor.StackingRegressor" ]
[((374, 407), 'xgboost.XGBRegressor', 'xgb.XGBRegressor', ([], {'n_estimators': '(50)'}), '(n_estimators=50)\n', (390, 407), True, 'import xgboost as xgb\n'), ((463, 481), 'numpy.random.seed', 'np.random.seed', (['(32)'], {}), '(32)\n', (477, 481), True, 'import numpy as np\n'), ((488, 514), 'data.DataPreparation', 'Da...
import numpy as np def randomize(x, y=None, seed=0): """ Randomize numpy array.""" index = [i for i in range(len(x))] np.random.seed(seed) np.random.shuffle(index) if y is not None: return x[index], y[index] else: return x[index] class BatchFeeder: """ Batch feeder for tr...
[ "numpy.vstack", "numpy.random.seed", "numpy.random.shuffle", "numpy.hstack" ]
[((132, 152), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (146, 152), True, 'import numpy as np\n'), ((157, 181), 'numpy.random.shuffle', 'np.random.shuffle', (['index'], {}), '(index)\n', (174, 181), True, 'import numpy as np\n'), ((2326, 2361), 'numpy.hstack', 'np.hstack', (['[_y0[:_ind], _y1[:...
from unittest import TestCase import numpy as np class Board: def __init__(self, numbers): self.numbers = np.array(numbers) self.seen = np.array([[False] * 5] * 5) self.has_won = False def has_bingo(self): if 5 in np.sum(self.seen, axis=0): self.has_won = True ...
[ "numpy.multiply", "numpy.sum", "numpy.invert", "unittest.TestCase", "numpy.array" ]
[((918, 949), 'numpy.array', 'np.array', (['numbs_for_card_boards'], {}), '(numbs_for_card_boards)\n', (926, 949), True, 'import numpy as np\n'), ((122, 139), 'numpy.array', 'np.array', (['numbers'], {}), '(numbers)\n', (130, 139), True, 'import numpy as np\n'), ((160, 187), 'numpy.array', 'np.array', (['([[False] * 5]...
#!/usr/bin/env python """ dem.py (python2) <NAME>, May 2019 Copyright (c) 2019 Distributed Robotic Exploration and Mapping Systems Laboratory, ASU """ import os import numpy as np import matplotlib import matplotlib.pyplot as plt import elevation import richdem as rd import cv2 from skimage import morphology from...
[ "matplotlib.pyplot.title", "numpy.maximum", "skimage.morphology.medial_axis", "cv2.fillPoly", "skimage.morphology.erosion", "os.path.isfile", "matplotlib.pyplot.figure", "skimage.transform.resize", "matplotlib.pyplot.contourf", "matplotlib.pyplot.contour", "numpy.arange", "matplotlib.pyplot.gc...
[((10437, 10488), 'cv2.imwrite', 'cv2.imwrite', (['"""../contours/refined0_contour.jpg"""', 'ct'], {}), "('../contours/refined0_contour.jpg', ct)\n", (10448, 10488), False, 'import cv2\n'), ((10558, 10609), 'cv2.imwrite', 'cv2.imwrite', (['"""../contours/refined1_contour.jpg"""', 'ct'], {}), "('../contours/refined1_con...
#!/usr/bin/python # -*- coding: latin-1 -*- import sys, os, subprocess import GenericUsefulScripts as GUS import PhotometryScripts as PhotoScripts sys.path.insert(0, '../') import magphys_read import DustpediaScripts as DS import MainSequences as MS import numpy as np import pandas as pd from tqdm import tqdm, trange f...
[ "matplotlib.pyplot.title", "matplotlib.rc", "astropy.io.ascii.read", "numpy.nan_to_num", "numpy.sum", "numpy.ravel", "pandas.read_csv", "sklearn.preprocessing.StandardScaler", "astropy.io.fits.PrimaryHDU", "matplotlib.cm.inferno", "numpy.shape", "matplotlib.pyplot.figure", "astropy.cosmology...
[((147, 172), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (162, 172), False, 'import sys, os, subprocess\n'), ((759, 806), 'astropy.cosmology.Planck15.arcsec_per_kpc_comoving', 'cosmo.arcsec_per_kpc_comoving', (['GalProp.z_source'], {}), '(GalProp.z_source)\n', (788, 806), True, 'f...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 17-9-22 下午7:47 # @Author : <NAME> # @Site : http://github.com/TJCVRS # @File : write_text_tfrecords.py # @IDE: PyCharm Community Edition """ Write text features into tensorflow records """ import os import os.path as ops import argparse import math impor...
[ "sys.path.append", "argparse.ArgumentParser", "os.makedirs", "math.ceil", "os.path.exists", "data_provider.data_provider.TextDataProvider", "cv2.cv2.resize", "numpy.reshape", "local_utils.data_utils.TextFeatureIO" ]
[((429, 458), 'sys.path.append', 'sys.path.append', (['"""/data/code"""'], {}), "('/data/code')\n", (444, 458), False, 'import sys\n'), ((679, 704), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (702, 704), False, 'import argparse\n'), ((1362, 1544), 'data_provider.data_provider.TextDataProvid...
# Copyright (c) 2016 by <NAME> and the other collaborators on GitHub at # https://github.com/rmjarvis/Piff All rights reserved. # # Piff is free software: Redistribution and use in source and binary forms # with or without modification, are permitted provided that the following # conditions are met: # # 1. Redistribut...
[ "fitsio.write", "coord.Angle.from_hms", "fitsio.read", "piff.PSF.read", "os.path.join", "piff.process", "piff.Star", "coord.Angle.from_dms", "galsim.PositionD", "warnings.simplefilter", "numpy.testing.assert_almost_equal", "galsim.Image", "numpy.random.RandomState", "piff_test_helper.Captu...
[((1705, 1740), 'galsim.config.BuildImage', 'galsim.config.BuildImage', (['gs_config'], {}), '(gs_config)\n', (1729, 1740), False, 'import galsim\n'), ((2533, 2596), 'galsim.CelestialCoord', 'galsim.CelestialCoord', (['(0 * galsim.degrees)', '(-25 * galsim.degrees)'], {}), '(0 * galsim.degrees, -25 * galsim.degrees)\n'...
""" LF-Font Copyright (c) 2020-present NAVER Corp. MIT license """ from pathlib import Path from itertools import chain import numpy as np import random from PIL import Image import torch from base.dataset import BaseTrainDataset, BaseDataset, sample, render, read_font class LF1TrainDataset(BaseTrainDataset): d...
[ "torch.LongTensor", "numpy.zeros", "torch.cat", "pathlib.Path", "base.dataset.read_font", "base.dataset.sample", "base.dataset.render", "itertools.chain" ]
[((1106, 1131), 'base.dataset.render', 'render', (['self.source', 'char'], {}), '(self.source, char)\n', (1112, 1131), False, 'from base.dataset import BaseTrainDataset, BaseDataset, sample, render, read_font\n'), ((1561, 1590), 'base.dataset.sample', 'sample', (['avail_chars', 'n_sample'], {}), '(avail_chars, n_sample...
import numpy as np import os import scipy.io import scipy.interpolate import falco.utils from falco.utils import _spec_arg import collections _influence_function_file = os.path.join( os.path.dirname(os.path.abspath(__file__)), "influence_dm5v2.mat") def falco_gen_dm_poke_cube(dm, mp, dx_dm, flagGenCube=True): ...
[ "numpy.radians", "os.path.abspath", "numpy.meshgrid", "numpy.sum", "numpy.abs", "falco.utils._spec_arg", "numpy.ceil", "numpy.floor", "numpy.zeros", "numpy.ones", "numpy.isnan", "numpy.arange", "collections.namedtuple", "numpy.array", "numpy.dot", "numpy.round", "numpy.sqrt" ]
[((1397, 1424), 'numpy.meshgrid', 'np.meshgrid', (['x_inf0', 'x_inf0'], {}), '(x_inf0, x_inf0)\n', (1408, 1424), True, 'import numpy as np\n'), ((2646, 2668), 'numpy.zeros', 'np.zeros', (['(Npad, Npad)'], {}), '((Npad, Npad))\n', (2654, 2668), True, 'import numpy as np\n'), ((2992, 3011), 'numpy.meshgrid', 'np.meshgrid...
import numpy as np import pandas as pd from sklearn.metrics import roc_curve, roc_auc_score from .stats import IV from .tadpole import tadpole from .tadpole.utils import HEATMAP_CMAP, MAX_STYLE, add_annotate, add_text, reset_ylim from .utils import unpack_tuple, generate_str def badrate_plot(frame, x = None, target =...
[ "numpy.zeros_like", "sklearn.metrics.roc_curve", "sklearn.metrics.roc_auc_score", "pandas.Grouper", "pandas.to_datetime", "numpy.triu_indices_from", "pandas.concat" ]
[((2918, 2952), 'numpy.zeros_like', 'np.zeros_like', (['corr'], {'dtype': 'np.bool'}), '(corr, dtype=np.bool)\n', (2931, 2952), True, 'import numpy as np\n'), ((4538, 4562), 'sklearn.metrics.roc_curve', 'roc_curve', (['target', 'score'], {}), '(target, score)\n', (4547, 4562), False, 'from sklearn.metrics import roc_cu...
# %% import pandas as pd import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("../shared") from analytic_tools import fractal_latent_heat_alex from wednesdaySPEED import simulation # %% tau = 9 pi_2_vals = [0.0, 0.1, 0.2, 0.3, 0.5] plt.figure(figsize=(10,5)) for i, val in enumerate(pi_2_va...
[ "sys.path.append", "matplotlib.pyplot.xlim", "wednesdaySPEED.simulation", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((90, 118), 'sys.path.append', 'sys.path.append', (['"""../shared"""'], {}), "('../shared')\n", (105, 118), False, 'import sys\n'), ((262, 289), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 5)'}), '(figsize=(10, 5))\n', (272, 289), True, 'import matplotlib.pyplot as plt\n'), ((718, 743), 'matplotli...
import numpy as np from numpy import log as ln from numpy import log10 as log from numpy import exp from numba import jit @jit(nopython=True) def model_Test_Model_EPSP(y, t, params): BLL = y[0] IL = y[1] AL = y[2] A = y[3] BL = y[4] B = y[5] DLL = y[6] D = y[7] ILL = y[8] DL = y[9] I = y[10] ...
[ "numpy.array", "numba.jit" ]
[((126, 144), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (129, 144), False, 'from numba import jit\n'), ((2367, 2437), 'numpy.array', 'np.array', (['[dBLL, dIL, dAL, dA, dBL, dB, dDLL, dD, dILL, dDL, dI, dALL]'], {}), '([dBLL, dIL, dAL, dA, dBL, dB, dDLL, dD, dILL, dDL, dI, dALL])\n', (2375,...
import copy import pytest import os import yaml import numpy.testing as npt from pyam import iiasa # check to see if we can do online testing of db authentication TEST_ENV_USER = 'IIASA_CONN_TEST_USER' TEST_ENV_PW = 'IIASA_CONN_TEST_PW' CONN_ENV_AVAILABLE = TEST_ENV_USER in os.environ and TEST_ENV_PW in os.environ C...
[ "copy.deepcopy", "pyam.iiasa.read_iiasa", "numpy.testing.assert_array_equal", "yaml.dump", "pyam.iiasa.Connection.convert_regions_payload", "pytest.raises", "pytest.mark.skipif", "pyam.iiasa.Connection" ]
[((660, 726), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not CONN_ENV_AVAILABLE)'], {'reason': 'CONN_ENV_REASON'}), '(not CONN_ENV_AVAILABLE, reason=CONN_ENV_REASON)\n', (678, 726), False, 'import pytest\n'), ((1059, 1125), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not CONN_ENV_AVAILABLE)'], {'reason': 'CONN...
# -*- coding: utf-8 -*- """ 動くタマをプロットする ===================== 要は ReflectiveMovingObject の動作確認 """ # import standard libraries import os from pathlib import Path # import third-party libraries import numpy as np from numpy.random import rand, seed import cv2 import test_pattern_generator2 as tpg from multiprocessing...
[ "numpy.dstack", "os.path.abspath", "cv2.circle", "numpy.random.seed", "numpy.random.rand", "cv2.imwrite", "numpy.zeros", "numpy.ones", "cv2.imread", "numpy.max", "reflective_moving_object.ReflectiveMovingObject", "pathlib.Path", "test_pattern_generator2.merge_with_alpha2", "common.MeasureE...
[((749, 766), 'common.MeasureExecTime', 'MeasureExecTime', ([], {}), '()\n', (764, 766), False, 'from common import MeasureExecTime\n'), ((847, 854), 'numpy.random.seed', 'seed', (['(0)'], {}), '(0)\n', (851, 854), False, 'from numpy.random import rand, seed\n'), ((2374, 2418), 'numpy.zeros', 'np.zeros', (['(height, wi...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 25 15:21:14 2020 @author: fearthekraken """ import sys import re import os.path import numpy as np import pandas as pd import copy from itertools import chain from functools import reduce import matplotlib import matplotlib.patches as patches import...
[ "numpy.sum", "numpy.ones", "matplotlib.pyplot.figure", "numpy.arange", "numpy.exp", "sleepy.load_stateidx", "matplotlib.pyplot.fill_between", "scipy.signal.convolve2d", "matplotlib.patches.Rectangle", "matplotlib.pyplot.draw", "numpy.max", "sleepy.box_off", "matplotlib.pyplot.subplots", "n...
[((2157, 2176), 'numpy.zeros', 'np.zeros', (['(n_down,)'], {}), '((n_down,))\n', (2165, 2176), True, 'import numpy as np\n'), ((5080, 5092), 'numpy.array', 'np.array', (['x2'], {}), '(x2)\n', (5088, 5092), True, 'import numpy as np\n'), ((25311, 25337), 'numpy.zeros', 'np.zeros', (['(nmice, nstates)'], {}), '((nmice, n...
"""main.py""" import argparse import numpy as np import torch from solver import Solver from utils import str2bool torch.backends.cudnn.enabled = True torch.backends.cudnn.benchmark = True def main(args): seed = args.seed torch.manual_seed(seed) torch.cuda.manual_seed(seed) np.random.seed(seed) ...
[ "solver.Solver", "numpy.random.seed", "argparse.ArgumentParser", "torch.manual_seed", "torch.cuda.manual_seed" ]
[((236, 259), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (253, 259), False, 'import torch\n'), ((264, 292), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['seed'], {}), '(seed)\n', (286, 292), False, 'import torch\n'), ((297, 317), 'numpy.random.seed', 'np.random.seed', (['seed'], {}),...
from gibson2.robots.turtlebot_robot import Turtlebot from gibson2.robots.husky_robot import Husky from gibson2.robots.ant_robot import Ant from gibson2.robots.humanoid_robot import Humanoid from gibson2.robots.jr2_robot import JR2 from gibson2.robots.jr2_kinova_robot import JR2_Kinova from gibson2.robots.quadrotor_robo...
[ "gibson2.robots.ant_robot.Ant", "gibson2.robots.quadrotor_robot.Quadrotor", "gibson2.scenes.stadium_scene.StadiumScene", "gibson2.robots.jr2_robot.JR2", "gibson2.robots.husky_robot.Husky", "gibson2.robots.turtlebot_robot.Turtlebot", "gibson2.robots.fetch_robot.Fetch", "gibson2.robots.jr2_kinova_robot....
[((644, 661), 'gibson2.utils.assets_utils.download_assets', 'download_assets', ([], {}), '()\n', (659, 661), False, 'from gibson2.utils.assets_utils import download_assets\n'), ((684, 736), 'os.path.join', 'os.path.join', (['gibson2.root_path', '"""../test/test.yaml"""'], {}), "(gibson2.root_path, '../test/test.yaml')\...
""" Functionality for reading Radarsat (RS2 and RCM) data into a SICD model. """ __classification__ = "UNCLASSIFIED" __author__ = ("<NAME>", "<NAME>", "<NAME>", "<NAME>") import logging import re import os from datetime import datetime from xml.etree import ElementTree from typing import Tuple, List, Union import n...
[ "numpy.sum", "sarpy.io.complex.sicd_elements.CollectionInfo.RadarModeType", "sarpy.io.complex.sicd_elements.GeoData.SCPType", "os.path.isfile", "numpy.polynomial.polynomial.polyval", "numpy.linalg.norm", "numpy.arange", "numpy.convolve", "sarpy.io.complex.utils.fit_time_coa_polynomial", "os.path.j...
[((2041, 2068), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2058, 2068), False, 'import logging\n'), ((2497, 2520), 'sarpy.io.general.utils.is_file_like', 'is_file_like', (['file_name'], {}), '(file_name)\n', (2509, 2520), False, 'from sarpy.io.general.utils import get_seconds, parse_...
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "numpy.testing.assert_array_equal", "mindspore.dataset.transforms.c_transforms.Concatenate", "mindspore.dataset.GeneratorDataset", "pytest.raises", "numpy.array", "mindspore.dataset.NumpySlicesDataset" ]
[((959, 1010), 'numpy.array', 'np.array', (['[1.4, 2.0, 3.0, 4.0, 4.5]'], {'dtype': 'np.float'}), '([1.4, 2.0, 3.0, 4.0, 4.5], dtype=np.float)\n', (967, 1010), True, 'import numpy as np\n'), ((1028, 1077), 'numpy.array', 'np.array', (['[9.0, 10.3, 11.0, 12.0]'], {'dtype': 'np.float'}), '([9.0, 10.3, 11.0, 12.0], dtype=...
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 2 # language: python # name: python2 # --- # # Particle in a box with two ...
[ "warnings.filterwarnings", "matplotlib.pylab.title", "numpy.zeros", "matplotlib.pylab.rcParams.update", "numpy.sin", "numpy.exp", "numpy.linspace", "numpy.cos", "matplotlib.pylab.subplots", "numpy.sqrt", "numpy.sinh", "IPython.display.Image", "IPython.display.HTML", "matplotlib.pylab.show"...
[((1265, 1736), 'IPython.display.HTML', 'HTML', (['"""<script>\ncode_show=true; \nfunction code_toggle() {\n if (code_show){\n $(\'div.input\').hide();\n } else {\n $(\'div.input\').show();\n }\n code_show = !code_show\n} \n$( document ).ready(code_toggle);\n</script>\nThe raw code for this IPython notebook is by defau...
import argparse import h5py import multiprocessing as mp import numpy as np import os import sys import tensorflow as tf import time import julia backend = 'TkAgg' import matplotlib matplotlib.use(backend) import matplotlib.pyplot as plt matplotlib.use('TkAgg') from contexttimer import Timer import hgail.misc.utils...
[ "math.hypot", "numpy.load", "argparse.ArgumentParser", "tensorflow.reset_default_graph", "matplotlib.pyplot.style.use", "numpy.mean", "os.path.isfile", "numpy.tile", "julia.Julia", "preprocessing.clean_holo.create_lane", "os.path.join", "numpy.unique", "numpy.random.randn", "numpy.std", ...
[((184, 207), 'matplotlib.use', 'matplotlib.use', (['backend'], {}), '(backend)\n', (198, 207), False, 'import matplotlib\n'), ((241, 264), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (255, 264), False, 'import matplotlib\n'), ((759, 782), 'matplotlib.pyplot.style.use', 'plt.style.use', ([...
""" This module contains useful functions to compute distances and errors on on circles and spheres. """ from __future__ import division import numpy as np def circ_dist(azimuth1, azimuth2, r=1.0): """ Returns the shortest distance between two points on a circle Parameters ---------- azimuth1: ...
[ "numpy.radians", "numpy.abs", "numpy.zeros", "numpy.argmin", "numpy.min", "numpy.sin", "numpy.array", "numpy.reshape", "numpy.cos" ]
[((951, 978), 'numpy.abs', 'np.abs', (['(azimuth1 - azimuth2)'], {}), '(azimuth1 - azimuth2)\n', (957, 978), True, 'import numpy as np\n'), ((2294, 2313), 'numpy.array', 'np.array', (['[x, y, z]'], {}), '([x, y, z])\n', (2302, 2313), True, 'import numpy as np\n'), ((2865, 2899), 'numpy.reshape', 'np.reshape', (['x1', '...
import cv2 import numpy as np import os from pkg_resources import resource_filename, Requirement is_initialized = False prototxt = None caffemodel = None net = None def detect_face(image, threshold=0.5, enable_gpu=False): if image is None: return None global is_initialized global prototxt ...
[ "pkg_resources.Requirement.parse", "cv2.dnn.blobFromImage", "numpy.array", "cv2.dnn.readNetFromCaffe" ]
[((1228, 1296), 'cv2.dnn.blobFromImage', 'cv2.dnn.blobFromImage', (['image', '(1.0)', '(300, 300)', '(104.0, 177.0, 123.0)'], {}), '(image, 1.0, (300, 300), (104.0, 177.0, 123.0))\n', (1249, 1296), False, 'import cv2\n'), ((902, 948), 'cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (['prototxt', 'caffemodel'], ...
"""Hardware related classes and functions. Various classes and functions to simulate and interface with physical hardware. .. admonition:: Disclaimer This module is not related to Ultraleap as a company, and it not part of their SDK. It is simply a non-programmer's way around testing everything in C++. S...
[ "numpy.abs", "os.makedirs", "numpy.fromfile", "numpy.asarray", "os.path.dirname", "os.path.exists" ]
[((1389, 1414), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (1404, 1414), False, 'import os\n'), ((1495, 1521), 'numpy.asarray', 'np.asarray', (['complex_values'], {}), '(complex_values)\n', (1505, 1521), True, 'import numpy as np\n'), ((1426, 1451), 'os.path.exists', 'os.path.exists', (['...
""" The extropy """ from ..helpers import RV_MODES from ..math.ops import get_ops import numpy as np def extropy(dist, rvs=None, rv_mode=None): """ Returns the extropy J[X] over the random variables in `rvs`. If the distribution represents linear probabilities, then the extropy is calculated with u...
[ "numpy.nansum", "dit.ScalarDistribution" ]
[((2093, 2109), 'numpy.nansum', 'np.nansum', (['terms'], {}), '(terms)\n', (2102, 2109), True, 'import numpy as np\n'), ((1433, 1473), 'dit.ScalarDistribution', 'dit.ScalarDistribution', (['[dist, 1 - dist]'], {}), '([dist, 1 - dist])\n', (1455, 1473), False, 'import dit\n')]
import numpy as np from scipy import signal import logging logger = logging.getLogger(__name__) def filter_win(rec, cutoff, sample_rate, numtaps, axis=-1): """ low pass filter, returns filtered signal using FIR window filter Args: rec: record to filter cutoff: cutoff frequency ...
[ "numpy.outer", "numpy.multiply", "scipy.signal.lfilter", "numpy.ones", "scipy.signal.firwin", "numpy.sin", "numpy.arange", "numpy.array", "numpy.cos", "logging.getLogger" ]
[((68, 95), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (85, 95), False, 'import logging\n'), ((521, 562), 'scipy.signal.firwin', 'signal.firwin', (['numtaps', '(cutoff / nyq_rate)'], {}), '(numtaps, cutoff / nyq_rate)\n', (534, 562), False, 'from scipy import signal\n'), ((582, 629), ...
# -*- coding: utf-8 -*- """ Created on Thu Aug 3 21:08:49 2017 Author: <NAME> """ import pytest import numpy as np from numpy.testing import assert_allclose import sm2.api as sm from sm2.discrete.discrete_model import NegativeBinomialP import sm2.discrete.tests.results.results_count_margins as res_stata # load da...
[ "sm2.api.datasets.cpunish.load", "sm2.api.add_constant", "numpy.testing.assert_allclose", "numpy.log" ]
[((360, 401), 'sm2.api.datasets.cpunish.load', 'sm.datasets.cpunish.load', ([], {'as_pandas': '(False)'}), '(as_pandas=False)\n', (384, 401), True, 'import sm2.api as sm\n'), ((428, 459), 'numpy.log', 'np.log', (['cpunish_data.exog[:, 3]'], {}), '(cpunish_data.exog[:, 3])\n', (434, 459), True, 'import numpy as np\n'), ...
''' Created on Oct 21, 2019 @author: <NAME> ''' import tensorflow as tf #Not supported for windows 32bit from keras.preprocessing import image #It needs tensorflow import pytesseract import numpy as np import os import imutils import cv2 from wand.image import Image as wi from wand.api import library import ctypes imp...
[ "tensorflow.keras.models.load_model", "os.path.join", "numpy.expand_dims", "pytesseract.image_to_string", "time.time", "keras.preprocessing.image.img_to_array", "imutils.rotate", "wand.image.Image", "cv2.resize" ]
[((1000, 1033), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['model'], {}), '(model)\n', (1026, 1033), True, 'import tensorflow as tf\n'), ((1880, 1907), 'cv2.resize', 'cv2.resize', (['img', '(800, 800)'], {}), '(img, (800, 800))\n', (1890, 1907), False, 'import cv2\n'), ((1920, 1941), 'keras.p...