code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import argparse
import os
import cv2
import numpy as np
def otsu(source_path, destination_path):
# Load image into memory. Convert it to grayscale
image = cv2.imread(source_path, cv2.IMREAD_GRAYSCALE)
# Calculate histogram and center of the bins
hist, edges = np.histogram(image.flatten(), 256, [0, 2... | [
"cv2.imread",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.cumsum"
] | [((166, 211), 'cv2.imread', 'cv2.imread', (['source_path', 'cv2.IMREAD_GRAYSCALE'], {}), '(source_path, cv2.IMREAD_GRAYSCALE)\n', (176, 211), False, 'import cv2\n'), ((441, 456), 'numpy.cumsum', 'np.cumsum', (['hist'], {}), '(hist)\n', (450, 456), True, 'import numpy as np\n'), ((468, 491), 'numpy.cumsum', 'np.cumsum',... |
import matplotlib.pyplot as plt
import numpy as np
import torch
from model.generator import Generator
from model.discriminator import Discriminator
from loss.WGANGP import PG_Gradient_Penalty
from torch.utils.data import DataLoader
from torchvision.datasets import ImageFolder
from torchvision.transforms import Compose... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.close",
"numpy.transpose",
"matplotlib.pyplot.axis",
"torch.randn",
"matplotlib.pyplot.figure",
"model.generator.Generator",
"torch.device",
"matplotlib.pyplot.pause"
] | [((1274, 1296), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (1286, 1296), False, 'import torch\n'), ((2170, 2203), 'numpy.transpose', 'np.transpose', (['image', '(0, 2, 3, 1)'], {}), '(image, (0, 2, 3, 1))\n', (2182, 2203), True, 'import numpy as np\n'), ((1320, 1329), 'matplotlib.pyplot.clf... |
__all__ = ['extract_multiedge', 'summarize_multigraph']
import sys
import traceback
import warnings
from functools import partial
from multiprocessing import Manager, Pool
from os.path import getsize, isfile
from sys import version_info
import hiwenet
import networkx as nx
import numpy as np
if version_info.major > ... | [
"graynet.utils.warn_nan",
"networkx.MultiGraph",
"graynet.utils.check_weights",
"os.path.isfile",
"networkx.info",
"graynet.utils.import_features",
"graynet.utils.make_output_path_graph",
"graynet.utils.save_graph",
"traceback.print_exc",
"graynet.utils.stamp_expt_multiedge",
"graynet.utils.chec... | [((7632, 7748), 'graynet.utils.check_params_multiedge', 'check_params_multiedge', (['base_feature_list', 'input_dir', 'atlas', 'smoothing_param', 'node_size', 'out_dir', 'return_results'], {}), '(base_feature_list, input_dir, atlas, smoothing_param,\n node_size, out_dir, return_results)\n', (7654, 7748), False, 'fro... |
#!/usr/bin/python3
# coding: utf-8
import numpy as np
import plotly.graph_objects as go
from scipy import fftpack
def fft_denoise(x, y, showFigure=True, freq_int=0.15, freq_th=0.18, freq_min_A=0.03):
n = len(x)
if showFigure:
fig = go.Figure()
fig.add_trace(go.Scatter(x=x, y=y))
fig.s... | [
"plotly.graph_objects.Scatter",
"numpy.abs",
"plotly.graph_objects.Figure",
"scipy.fftpack.fft",
"scipy.fftpack.ifft",
"scipy.fftpack.fftfreq"
] | [((492, 520), 'scipy.fftpack.fftfreq', 'fftpack.fftfreq', (['n', 'freq_int'], {}), '(n, freq_int)\n', (507, 520), False, 'from scipy import fftpack\n'), ((251, 262), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (260, 262), True, 'import plotly.graph_objects as go\n'), ((339, 353), 'scipy.fftpack.fft', ... |
import plotly.graph_objects as go
import numpy as np
from styles.graphs import (
GRAPH_BACKGROUND_COLOR,
summary_bar_graph_colors,
LINE_GRAPH_GRID_COLOR,
)
from faker import Faker
fake = Faker()
def simple_bar_chart_logic():
"""Generates simple bar chart figure
Returns:
obj: Plotly figur... | [
"numpy.random.uniform",
"faker.Faker",
"plotly.graph_objects.Bar",
"numpy.random.randint",
"numpy.round"
] | [((200, 207), 'faker.Faker', 'Faker', ([], {}), '()\n', (205, 207), False, 'from faker import Faker\n'), ((2968, 2998), 'numpy.round', 'np.round', (['y_values'], {'decimals': '(2)'}), '(y_values, decimals=2)\n', (2976, 2998), True, 'import numpy as np\n'), ((399, 433), 'numpy.random.randint', 'np.random.randint', (['(1... |
import gym
import numpy
import random
import os
from gym import error, spaces, utils
from gym.utils import seeding
from matplotlib import pyplot
from collections import OrderedDict
import gym_sted
from gym_sted import rewards, defaults
from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get_foreground,... | [
"gym_sted.rewards.MORewardCalculator",
"numpy.argmax",
"numpy.clip",
"numpy.argsort",
"gym.utils.seeding.np_random",
"numpy.zeros_like",
"gym_sted.utils.BleachSampler",
"gym_sted.utils.SynapseGenerator",
"gym_sted.prefnet.load_demonstrations",
"matplotlib.pyplot.subplots",
"numpy.stack",
"matp... | [((2383, 2507), 'gym_sted.utils.SynapseGenerator', 'SynapseGenerator', ([], {'mode': '"""mushroom"""', 'seed': 'None', 'n_nanodomains': '(3, 15)', 'n_molecs_in_domain': '(molecules * 20, molecules * 35)'}), "(mode='mushroom', seed=None, n_nanodomains=(3, 15),\n n_molecs_in_domain=(molecules * 20, molecules * 35))\n"... |
import numpy as np
def getRating(matchData, plyrPubKey):
# the matchData is formatted as {pubKey: {rating: int,...},...}
"""
use highest parameter based total parameter values of all players
:param matchData: any data type to process by your function
:param plyrPubKey: to get the rating... | [
"numpy.asarray"
] | [((744, 766), 'numpy.asarray', 'np.asarray', (['ratingBase'], {}), '(ratingBase)\n', (754, 766), True, 'import numpy as np\n')] |
'''
Based on
https://www.tensorflow.org/tutorials/images/cnn
'''
import tensorflow as tf
from tensorflow.keras import datasets, layers, models
import matplotlib.pyplot as plt
from collections.abc import Iterable
import numpy as np
'''
Define Swish Function
'''
from tensorflow.keras.layers import Layer
im... | [
"matplotlib.pyplot.title",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dense",
"matplotlib.pyplot.figure",
"numpy.arange",
"tensorflow.keras.models.Sequential",
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.backend.... | [((1498, 1526), 'tensorflow.keras.datasets.cifar10.load_data', 'datasets.cifar10.load_data', ([], {}), '()\n', (1524, 1526), False, 'from tensorflow.keras import datasets, layers, models\n'), ((1767, 1795), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (1777, 1795), Tr... |
# import clingo
import numpy as np
import copy
import random
#
# import torch
# from torch import nn
# import torch.nn.functional as F
# from torch import optim
import math
from HierarchicalAgentFlatQ import *
import pandas as pd
class Recursive_Maze():
def __init__(self, shape_maze,simple,manager_la... | [
"numpy.maximum",
"numpy.floor",
"numpy.zeros",
"random.choice",
"copy.copy",
"numpy.where"
] | [((912, 942), 'copy.copy', 'copy.copy', (['self.super_managers'], {}), '(self.super_managers)\n', (921, 942), False, 'import copy\n'), ((1516, 1551), 'numpy.maximum', 'np.maximum', (['(4)', 'self.search_lims[-1]'], {}), '(4, self.search_lims[-1])\n', (1526, 1551), True, 'import numpy as np\n'), ((2946, 2972), 'random.c... |
# Copyright 2021 NVIDIA Corporation
#
# 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 wr... | [
"math.isnan",
"legate.pandas.Series",
"math.fabs",
"numpy.random.randn"
] | [((1258, 1270), 'legate.pandas.Series', 'lp.Series', (['s'], {}), '(s)\n', (1267, 1270), True, 'from legate import pandas as lp\n'), ((955, 967), 'legate.pandas.Series', 'lp.Series', (['s'], {}), '(s)\n', (964, 967), True, 'from legate import pandas as lp\n'), ((1474, 1492), 'math.isnan', 'math.isnan', (['out_pd'], {})... |
from random import seed
import numpy as np
seed(42)
np.random.seed(42)
| [
"numpy.random.seed",
"random.seed"
] | [((44, 52), 'random.seed', 'seed', (['(42)'], {}), '(42)\n', (48, 52), False, 'from random import seed\n'), ((53, 71), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (67, 71), True, 'import numpy as np\n')] |
import numpy as np
from rlbench import tasks
from rlbench.environment import SUPPORTED_ROBOTS
from rlbench.observation_config import ObservationConfig
from rlbench.action_modes import ArmActionMode, ActionMode
from rlbench.environment import Environment as RLEnvironment
from rlbench.task_environment import _DT, Quatern... | [
"rlbench.task_environment.Quaternion",
"rlbench.observation_config.ObservationConfig",
"pickle.dump",
"rlbench.environment.Environment",
"numpy.random.seed",
"core.utilities.convenience.get_named_class",
"random.randint",
"numpy.asarray",
"numpy.zeros",
"rlbench.environment.SUPPORTED_ROBOTS.keys",... | [((615, 638), 'rlbench.environment.SUPPORTED_ROBOTS.keys', 'SUPPORTED_ROBOTS.keys', ([], {}), '()\n', (636, 638), False, 'from rlbench.environment import SUPPORTED_ROBOTS\n'), ((2604, 2623), 'rlbench.observation_config.ObservationConfig', 'ObservationConfig', ([], {}), '()\n', (2621, 2623), False, 'from rlbench.observa... |
import copy
import warnings
import numpy as np
from ... import AudioSignal, play_utils
class SeparationBase(object):
"""Base class for all separation algorithms in nussl.
Do not call this. It will not do anything.
Parameters:
input_audio_signal (AudioSignal). AudioSignal` object.
T... | [
"copy.deepcopy",
"gradio.Interface",
"numpy.array",
"numpy.array_equal",
"warnings.warn",
"gradio.inputs.Audio"
] | [((2148, 2181), 'copy.deepcopy', 'copy.deepcopy', (['input_audio_signal'], {}), '(input_audio_signal)\n', (2161, 2181), False, 'import copy\n'), ((5513, 5573), 'gradio.inputs.Audio', 'gradio.inputs.Audio', ([], {'source': 'source', 'type': '"""file"""', 'label': 'label'}), "(source=source, type='file', label=label)\n",... |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
"""
Unit tests for evaluation operations, each operation is tested for
the forward ... | [
"numpy.sum",
"cntk.nce_loss",
"numpy.allclose",
"numpy.ones",
"cntk.parameter",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"pytest.mark.parametrize",
"cntk.times",
"cntk.ops.tests.ops_test_utils.AA",
"numpy.ones_like",
"cntk.ops.tests.ops_test_utils._test_binary_op",
"cntk.random_sample",
... | [((751, 824), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""target_vector, output_vector"""', 'TARGET_OUT_PAIRS'], {}), "('target_vector, output_vector', TARGET_OUT_PAIRS)\n", (774, 824), False, 'import pytest\n'), ((2191, 2284), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""target_vector, o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Digital signal processing functions; pyo table, file, & sample conversions
"""
from __future__ import absolute_import, division, print_function
import os
import sys
import time
import numpy as np
from scipy.signal import butter, lfilter
try:
import pyo64 as pyo
ex... | [
"numpy.ones",
"os.path.isfile",
"numpy.mean",
"numpy.arange",
"numpy.tile",
"numpy.sin",
"numpy.convolve",
"ctypes.byref",
"scipy.signal.lfilter",
"numpy.std",
"numpy.hanning",
"scipy.signal.butter",
"pyo.SndTable",
"pyo.savefileFromTable",
"numpy.concatenate",
"numpy.zeros",
"numpy.... | [((625, 634), 'ctypes.c_int64', 'c_int64', ([], {}), '()\n', (632, 634), False, 'from ctypes import byref, c_int64, windll\n'), ((649, 658), 'ctypes.c_int64', 'c_int64', ([], {}), '()\n', (656, 658), False, 'from ctypes import byref, c_int64, windll\n'), ((2388, 2407), 'scipy.signal.lfilter', 'lfilter', (['b', 'a', 'da... |
#%%
import os
import json
import pathlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from utils import tsplot, path2valuestimes
from rliable import library as rly
from rliable import metrics
from rliable import plot_utils
paths_and_names = [
("diagonal_runs/", "Diagonal"),
("hessianf... | [
"rliable.metrics.aggregate_iqm",
"pandas.read_csv",
"numpy.isnan",
"pathlib.Path",
"os.path.isfile",
"rliable.metrics.aggregate_median",
"utils.tsplot",
"pandas.DataFrame",
"rliable.metrics.aggregate_mean",
"rliable.library.get_interval_estimates",
"matplotlib.pyplot.subplots",
"pandas.concat"... | [((7815, 7852), 'pathlib.Path', 'pathlib.Path', (['"""../runs/5e6_baseline/"""'], {}), "('../runs/5e6_baseline/')\n", (7827, 7852), False, 'import pathlib\n'), ((7871, 7910), 'pathlib.Path', 'pathlib.Path', (['"""../runs/baseline_speed/"""'], {}), "('../runs/baseline_speed/')\n", (7883, 7910), False, 'import pathlib\n'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 13 21:30:59 2019
@author: charles
"""
import argparse
import numpy as np
from scipy.io.wavfile import read, write
import os
def normalize(x: np.ndarray):
return x/np.max(x);
def split_file(file, time_before=0.025, time_after=0.2, trigger=1000... | [
"argparse.ArgumentParser",
"numpy.asarray",
"scipy.io.wavfile.read",
"numpy.max",
"numpy.array"
] | [((402, 412), 'scipy.io.wavfile.read', 'read', (['file'], {}), '(file)\n', (406, 412), False, 'from scipy.io.wavfile import read, write\n'), ((421, 445), 'numpy.array', 'np.array', (['a'], {'dtype': 'float'}), '(a, dtype=float)\n', (429, 445), True, 'import numpy as np\n'), ((1065, 1132), 'argparse.ArgumentParser', 'ar... |
# TODO: Write more tests!
import numpy as np
from tests.plottools import popplot
from nmrtools.nmrplot import dnmrplot_2spin
from tests.testdata import TWOSPIN_SLOW, AB_WINDNMR # , TWOSPIN_COALESCE, TWOSPIN_FAST
from nmrtools.nmrmath import two_spin, d2s_func, TwoSinglets, dnmr_AB
def get_intensity(spectrum, x):
... | [
"numpy.abs",
"numpy.testing.assert_almost_equal",
"nmrtools.nmrmath.dnmr_AB",
"nmrtools.nmrmath.two_spin",
"numpy.linspace",
"tests.plottools.popplot",
"nmrtools.nmrmath.TwoSinglets",
"nmrtools.nmrmath.d2s_func"
] | [((1546, 1571), 'numpy.linspace', 'np.linspace', (['(85)', '(215)', '(800)'], {}), '(85, 215, 800)\n', (1557, 1571), True, 'import numpy as np\n'), ((1580, 1598), 'nmrtools.nmrmath.two_spin', 'two_spin', (['x', '*args'], {}), '(x, *args)\n', (1588, 1598), False, 'from nmrtools.nmrmath import two_spin, d2s_func, TwoSing... |
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import os
def plot_kmers() :
plt.rcParams['figure.figsize'] = 12, 8
plt.rcParams['xtick.labelsize'] = 14
plt.rcParams['ytick.labelsize'] = 14
ip_dir = "data"
kmers_from_reads = ip_dir + "/kmers_from_reads"
trusted_DSK_co... | [
"seaborn.set_style",
"os.remove",
"os.makedirs",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"os.path.exists",
"numpy.percentile",
"os.path.isfile",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.tic... | [((652, 675), 'os.path.isfile', 'os.path.isfile', (['op_file'], {}), '(op_file)\n', (666, 675), False, 'import os\n'), ((1182, 1204), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (1195, 1204), True, 'import seaborn as sns\n'), ((1224, 1250), 'numpy.linspace', 'np.linspace', (['(0)', '(100... |
#!/usr/bin/env python
""" create a figure showing an adjacency matrix in brain space
"""
import networkx as nx
import numpy as N
import matplotlib.pyplot as plt
import nibabel as nib
roilabelfile='/work/01329/poldrack/software_lonestar/atlases/sc_HO_atlas/ROIlabels.txt'
atlasroifile='/scratch/01329/poldrack/openfmri... | [
"matplotlib.pyplot.subplot",
"numpy.load",
"matplotlib.pyplot.show",
"networkx.from_numpy_matrix",
"numpy.genfromtxt",
"networkx.draw_networkx",
"matplotlib.pyplot.figure",
"numpy.min"
] | [((1111, 1135), 'numpy.genfromtxt', 'N.genfromtxt', (['adjmtxfile'], {}), '(adjmtxfile)\n', (1123, 1135), True, 'import numpy as N\n'), ((1174, 1199), 'networkx.from_numpy_matrix', 'nx.from_numpy_matrix', (['adj'], {}), '(adj)\n', (1194, 1199), True, 'import networkx as nx\n'), ((1303, 1340), 'matplotlib.pyplot.figure'... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import utils as tu
from config import cfg
from LeeNet import LeeNet
x_train, y_train = tu.load_data(True)
# GPU 메모리 증가 허용
config = tf.ConfigProto(allow_soft_placement=True, gpu_options=tf.GPUOptions(allow_growth=True))
# initi... | [
"matplotlib.pyplot.title",
"utils.load_data",
"matplotlib.pyplot.show",
"tensorflow.train.Saver",
"utils.random_mini_batches",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"tensorflow.GPUOptions",
"tensorflow.summary.FileWriter",
"numpy.squeeze",
"matplotlib.pyplot.ylabel",
... | [((172, 190), 'utils.load_data', 'tu.load_data', (['(True)'], {}), '(True)\n', (184, 190), True, 'import utils as tu\n'), ((334, 359), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (344, 359), True, 'import tensorflow as tf\n'), ((369, 391), 'LeeNet.LeeNet', 'LeeNet', (['sess', '"... |
"""@package reduced_cg
Reduced conjugate gradient solver for the trust region problem with linear constraints.
"""
import numpy as np
import numpy.linalg as la
from .model_minimizer import trust_region_intersect, model_minimizer
def reduced_cg(g, c, a, b, delta):
""" Solves a quadratic problem subjected to linear... | [
"numpy.zeros",
"numpy.shape",
"numpy.finfo",
"numpy.max",
"numpy.linalg.norm",
"numpy.linalg.inv",
"numpy.matmul",
"numpy.dot",
"numpy.diag"
] | [((2741, 2752), 'numpy.shape', 'np.shape', (['a'], {}), '(a)\n', (2749, 2752), True, 'import numpy as np\n'), ((3163, 3180), 'numpy.matmul', 'np.matmul', (['y', 'x_y'], {}), '(y, x_y)\n', (3172, 3180), True, 'import numpy as np\n'), ((4099, 4111), 'numpy.linalg.inv', 'la.inv', (['w_zz'], {}), '(w_zz)\n', (4105, 4111), ... |
"""
Defines the Instrument class
"""
#***************************************************************************************************
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain ... | [
"collections.OrderedDict.__init__",
"pygsti.modelmembers.modelmember.ModelMember.__init__",
"pygsti.baseobjs.label.Label",
"pygsti.baseobjs.statespace.StateSpace.from_nice_serialization",
"numpy.empty",
"pygsti.tools.slicetools.to_array",
"pygsti.modelmembers.states.StaticState",
"collections.OrderedD... | [((4994, 5040), 'collections.OrderedDict.__init__', '_collections.OrderedDict.__init__', (['self', 'items'], {}), '(self, items)\n', (5027, 5040), True, 'import collections as _collections\n'), ((5049, 5101), 'pygsti.modelmembers.modelmember.ModelMember.__init__', '_mm.ModelMember.__init__', (['self', 'state_space', 'e... |
# coding: utf-8
# Copyright (c) 2017-present, Facebook, Inc.
#
# 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 applica... | [
"pylab.show",
"numpy.random.randn",
"pylab.plot",
"numpy.random.RandomState",
"time.time",
"numpy.sin",
"numpy.array",
"pylab.figure",
"pykalman.UnscentedKalmanFilter",
"numpy.cos",
"numpy.eye",
"pylab.legend",
"numpy.linalg.cholesky"
] | [((8539, 8555), 'numpy.array', 'np.array', (['states'], {}), '(states)\n', (8547, 8555), True, 'import numpy as np\n'), ((8575, 8597), 'numpy.array', 'np.array', (['observations'], {}), '(observations)\n', (8583, 8597), True, 'import numpy as np\n'), ((8629, 8663), 'numpy.array', 'np.array', (['filtered_state_estimates... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import numpy as np
from Base.Recommender import Recommender
from Base.Recommender_utils import check_matrix
class TopPop(Recommender):
"""Top Popular recommender"""
RECOMMENDER_NAME = "TopPopRecommender"
def __init__(self, URM_trai... | [
"Base.Recommender_utils.check_matrix",
"numpy.asarray",
"numpy.diff",
"numpy.ediff1d",
"numpy.repeat"
] | [((448, 496), 'Base.Recommender_utils.check_matrix', 'check_matrix', (['URM_train', '"""csc"""'], {'dtype': 'np.float32'}), "(URM_train, 'csc', dtype=np.float32)\n", (460, 496), False, 'from Base.Recommender_utils import check_matrix\n'), ((810, 843), 'numpy.ediff1d', 'np.ediff1d', (['self.URM_train.indptr'], {}), '(se... |
import logging
from typing import Union
from jigsawpy import jigsaw_msh_t, jigsaw_jig_t
from jigsawpy import libsaw
import numpy as np
from pyproj import CRS
from ocsmesh import utils
from ocsmesh.mesh import Mesh
from ocsmesh.hfun import Hfun
from ocsmesh.hfun.base import BaseHfun
from ocsmesh.geom import Geom
from... | [
"pyproj.CRS.from_user_input",
"ocsmesh.utils.reproject",
"ocsmesh.utils.finalize_mesh",
"ocsmesh.mesh.Mesh",
"numpy.min",
"numpy.max",
"jigsawpy.jigsaw_msh_t",
"jigsawpy.libsaw.jigsaw",
"jigsawpy.jigsaw_jig_t",
"logging.getLogger"
] | [((366, 393), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (383, 393), False, 'import logging\n'), ((2100, 2114), 'jigsawpy.jigsaw_msh_t', 'jigsaw_msh_t', ([], {}), '()\n', (2112, 2114), False, 'from jigsawpy import jigsaw_msh_t, jigsaw_jig_t\n'), ((2221, 2245), 'numpy.min', 'np.min', (... |
# coding=utf-8
# Author: <NAME> <<EMAIL>>
import numpy as np
from perturbation_classifiers.base import BasePerC
from perturbation_classifiers.estimation import estimate_mean_vector_per_class, estimate_covariance_matrix_per_class, estimate_delta_mean_vector_per_class, estimate_delta_covariance_matrix_per_class
from p... | [
"perturbation_classifiers.perturbation.perturbation_covariance",
"perturbation_classifiers.estimation.estimate_mean_vector_per_class",
"perturbation_classifiers.estimation.estimate_covariance_matrix_per_class",
"perturbation_classifiers.perturbation.perturbation_combination",
"perturbation_classifiers.pertu... | [((1118, 1150), 'numpy.unique', 'np.unique', (['y'], {'return_counts': '(True)'}), '(y, return_counts=True)\n', (1127, 1150), True, 'import numpy as np\n'), ((1315, 1387), 'perturbation_classifiers.estimation.estimate_mean_vector_per_class', 'estimate_mean_vector_per_class', (['X', 'y', 'self.classes_', 'self.count_cla... |
"""This module contains the classes for recharge models.
This module contains the different classes that can be used to simulate the
effect of precipitation and evapotranspiration on groundwater levels.
Depending on the mathematical formulation this effect may be interpreted as:
1. seepage to the groundwater
2... | [
"pandas.DataFrame",
"numpy.multiply",
"numpy.nan_to_num",
"numpy.zeros",
"numpy.exp",
"numpy.vstack"
] | [((1904, 1966), 'pandas.DataFrame', 'DataFrame', ([], {'columns': "['initial', 'pmin', 'pmax', 'vary', 'name']"}), "(columns=['initial', 'pmin', 'pmax', 'vary', 'name'])\n", (1913, 1966), False, 'from pandas import DataFrame\n'), ((2753, 2815), 'pandas.DataFrame', 'DataFrame', ([], {'columns': "['initial', 'pmin', 'pma... |
import numpy as np
from point import Point
from vertex import Vertex
from cluster import Cluster
from edge import Edge
from corrolation import Corroloation
import tensorflow as tf
import scipy
import queue
"""
"""
class Network:
def __init__(self, task_queue = None, result_queue = None, num_points=1000, num_dims=3... | [
"numpy.random.random_integers",
"numpy.sum",
"corrolation.Corroloation",
"cluster.Cluster",
"vertex.Vertex",
"queue.Queue"
] | [((2449, 2462), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (2460, 2462), False, 'import queue\n'), ((2487, 2496), 'cluster.Cluster', 'Cluster', ([], {}), '()\n', (2494, 2496), False, 'from cluster import Cluster\n'), ((954, 962), 'vertex.Vertex', 'Vertex', ([], {}), '()\n', (960, 962), False, 'from vertex import V... |
import hashlib
import json
from typing import List, Set
import numpy as np
import pandas as pd
import torch
from scipy import sparse as sp
import src.config as cfg
class ProductEncoderMini:
def __init__(self, top_products):
self._all_pids = top_products
self.idx = {}
self.pid = {}
... | [
"numpy.array"
] | [((2026, 2042), 'numpy.array', 'np.array', (['values'], {}), '(values)\n', (2034, 2042), True, 'import numpy as np\n')] |
'''
based on https://github.com/asmith26/wide_resnets_keras
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import range
import os
import logging
logging.basicConfig(level=logging.DEBUG)
import sys
sys.stdout = sys.stderr
# Prevent reach... | [
"keras.regularizers.l2",
"keras.layers.convolutional.AveragePooling2D",
"numpy.random.seed",
"keras.datasets.cifar10.load_data",
"logging.debug",
"logging.basicConfig",
"keras.optimizers.SGD",
"keras.layers.Activation",
"keras.layers.Dropout",
"keras.layers.Flatten",
"keras.models.Model",
"os.... | [((228, 268), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (247, 268), False, 'import logging\n'), ((375, 405), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(2 ** 20)'], {}), '(2 ** 20)\n', (396, 405), False, 'import sys\n'), ((426, 449), 'numpy.rand... |
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
"""Extracts the embedding from a model trained by lstm_lm.py."""
from __future__ import absolute_import, division, print_function
from argparse import ArgumentParser
import os
import numpy as np
import tensorflow as tf
from emLam.utils import openall
def pars... | [
"argparse.ArgumentParser",
"tensorflow.get_collection",
"tensorflow.Session",
"tensorflow.train.latest_checkpoint",
"emLam.utils.openall",
"numpy.savez",
"os.path.join"
] | [((348, 441), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Extracts the embedding from a model trained by lstm_lm.py."""'}), "(description=\n 'Extracts the embedding from a model trained by lstm_lm.py.')\n", (362, 441), False, 'from argparse import ArgumentParser\n'), ((858, 877), 'emLam.uti... |
import glm
import numpy
class OBJ:
def __init__(self, file):
self.vertices = []
self.textures = []
self.normals = []
self.indices = []
with open('model\\data\\models\\'+file, 'r') as f:
for l in f:
l = l.strip('\n')
ll = l.split(' '... | [
"numpy.array"
] | [((1906, 1956), 'numpy.array', 'numpy.array', (['self.vertexArray'], {'dtype': 'numpy.float32'}), '(self.vertexArray, dtype=numpy.float32)\n', (1917, 1956), False, 'import numpy\n'), ((1985, 2036), 'numpy.array', 'numpy.array', (['self.normalsArray'], {'dtype': 'numpy.float32'}), '(self.normalsArray, dtype=numpy.float3... |
import os
import numpy as np
from mpunet.callbacks import init_callback_objects
from mpunet.logging import ScreenLogger
from mpunet.callbacks import (SavePredictionImages, Validation,
FGBatchBalancer, DividerLine,
LearningCurve, MemoryConsumption,
... | [
"numpy.ceil",
"mpunet.train.utils.init_metrics",
"mpunet.logging.ScreenLogger",
"mpunet.callbacks.remove_validation_callbacks",
"mpunet.callbacks.LearningCurve",
"mpunet.utils.plotting.save_images",
"mpunet.callbacks.FGBatchBalancer",
"mpunet.callbacks.DividerLine",
"mpunet.train.utils.init_optimize... | [((3190, 3219), 'mpunet.utils.ensure_list_or_tuple', 'ensure_list_or_tuple', (['metrics'], {}), '(metrics)\n', (3210, 3219), False, 'from mpunet.utils import ensure_list_or_tuple\n'), ((3237, 3263), 'mpunet.utils.ensure_list_or_tuple', 'ensure_list_or_tuple', (['loss'], {}), '(loss)\n', (3257, 3263), False, 'from mpune... |
# 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
# distribu... | [
"numpy.abs",
"numpy.angle",
"numpy.zeros",
"numpy.isclose",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"numpy.testing.assert_allclose"
] | [((703, 718), 'numpy.zeros', 'numpy.zeros', (['(10)'], {}), '(10)\n', (714, 718), False, 'import numpy\n'), ((992, 1016), 'numpy.linspace', 'numpy.linspace', (['(0)', '(1)', '(11)'], {}), '(0, 1, 11)\n', (1006, 1016), False, 'import numpy\n'), ((2238, 2266), 'numpy.array', 'numpy.array', (['[0.4, 0.5, 0.8]'], {}), '([0... |
#!/usr/bin/env python3
from mayavi import mlab
mlab.options.offscreen = True
import numpy as np
from glob import glob
import pandas as pd
import os.path
import cv2
import sys
import skvideo.io
from tqdm import tqdm, trange
import sys
from collections import defaultdict
from matplotlib.pyplot import get_cmap
from .co... | [
"mayavi.mlab.figure",
"numpy.sum",
"pandas.read_csv",
"numpy.ones",
"numpy.isnan",
"collections.defaultdict",
"numpy.arange",
"numpy.copy",
"mayavi.mlab.points3d",
"matplotlib.pyplot.get_cmap",
"tqdm.trange",
"mayavi.mlab.clf",
"numpy.percentile",
"mayavi.mlab.close",
"mayavi.mlab.view",... | [((1474, 1499), 'pandas.read_csv', 'pd.read_csv', (['labels_fname'], {}), '(labels_fname)\n', (1485, 1499), True, 'import pandas as pd\n'), ((2597, 2651), 'numpy.percentile', 'np.percentile', (['all_points_flat[check]', '[5, 95]'], {'axis': '(0)'}), '(all_points_flat[check], [5, 95], axis=0)\n', (2610, 2651), True, 'im... |
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import json
import pandas as pd
import sys
from os.path import exists
from datetime import datetime
import numpy as np
import matplotlib.pyplot as plt
#__________________________________________________________
def plot(val,date,ind,i):
f = plt.figure()
ax = f.add_s... | [
"pandas.DataFrame",
"json.load",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.plot",
"numpy.std",
"matplotlib.pyplot.close",
"os.path.exists",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xl... | [((291, 303), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (301, 303), True, 'import matplotlib.pyplot as plt\n'), ((336, 377), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""indicator reliability score"""'], {}), "('indicator reliability score')\n", (346, 377), True, 'import matplotlib.pyplot as plt\n'... |
"""Preprocess the us census bridged race statistics dataset."""
import io
import numpy as np
import pandas as pd
def _fixed_width_to_csv(file, blocks):
slices = [slice(*b) for b in blocks]
with open(file, "r") as f:
data = f.readlines()
fixed_lines = [",".join([line[s].strip() for s in slices]) ... | [
"pandas.read_csv",
"numpy.arange",
"pandas.concat"
] | [((1038, 1099), 'pandas.read_csv', 'pd.read_csv', (['csv_f_obj'], {'names': "['adm2', 'age', 'N']", 'dtype': 'int'}), "(csv_f_obj, names=['adm2', 'age', 'N'], dtype=int)\n", (1049, 1099), True, 'import pandas as pd\n'), ((1348, 1426), 'pandas.read_csv', 'pd.read_csv', (['"""../included_data/population/territory_pop.csv... |
import torch
import torch.nn as nn
import numpy as np
class Q1(nn.Module):
def __init__(self, in_ch, out_ch):
super(Q1, self).__init__()
self.mask = torch.from_numpy(np.array([[1, 1, 0], [1, 0, 0], [0, 0, 0]], dtype=np.float32)).cuda()
self.conv1 = nn.Conv2d(in_channels=in_ch, out_channel... | [
"torch.nn.PReLU",
"torch.nn.Conv2d",
"numpy.array",
"torch.stack"
] | [((280, 355), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'in_ch', 'out_channels': 'out_ch', 'padding': '(1)', 'kernel_size': '(3)'}), '(in_channels=in_ch, out_channels=out_ch, padding=1, kernel_size=3)\n', (289, 355), True, 'import torch.nn as nn\n'), ((787, 903), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_cha... |
#!/usr/bin/env python
"""odeint.py: Demonstrate solving an ordinary differential equation by using
odeint.
References:
* Solving Ordinary Differential Equations (ODEs) using Python
"""
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
# pylint: disable=invalid-name
# Solve y''(t... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.integrate.odeint",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((607, 635), 'numpy.linspace', 'np.linspace', (['(0.0)', '(10.0)', '(1000)'], {}), '(0.0, 10.0, 1000)\n', (618, 635), True, 'import numpy as np\n'), ((644, 667), 'numpy.array', 'np.array', (['[0.0005, 0.2]'], {}), '([0.0005, 0.2])\n', (652, 667), True, 'import numpy as np\n'), ((689, 715), 'scipy.integrate.odeint', 'o... |
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
#Code starts here
#analyzing age distribution
census = np.conc... | [
"numpy.sum",
"warnings.filterwarnings",
"numpy.std",
"numpy.genfromtxt",
"numpy.max",
"numpy.min",
"numpy.mean",
"numpy.concatenate"
] | [((82, 115), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (105, 115), False, 'import warnings\n'), ((203, 252), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (216, 252), True, 'i... |
# -*- coding: utf-8 -*-
###########################################################################################
# Implementation of CURE (Clustering Using Representatives) Clustering Algorithm
# Author for codes: <NAME>(<EMAIL>)
# Paper: https://www.sciencedirect.com/science/article/pii/S0306437901000084
# Referen... | [
"numpy.power",
"numpy.mod",
"numpy.append",
"numpy.min",
"scipy.spatial.distance.pdist",
"numpy.delete",
"numpy.vstack"
] | [((3279, 3317), 'numpy.vstack', 'np.vstack', (['(self.points, clust.points)'], {}), '((self.points, clust.points))\n', (3288, 3317), True, 'import numpy as np\n'), ((3339, 3373), 'numpy.append', 'np.append', (['self.index', 'clust.index'], {}), '(self.index, clust.index)\n', (3348, 3373), True, 'import numpy as np\n'),... |
# Taken from
# https://sourceware.org/ml/gdb/2013-04/msg00104.html
import gdb
import cv2.cv as cv
import numpy as np
class PcvCommand(gdb.Command):
def __init__(self):
super(PcvCommand, self).__init__("pcv",
gdb.COMMAND_DATA,
... | [
"gdb.lookup_type",
"numpy.asarray",
"cv2.cv.SetData",
"gdb.selected_inferior",
"gdb.string_to_argv",
"gdb.parse_and_eval",
"cv2.cv.CreateImageHeader"
] | [((404, 427), 'gdb.string_to_argv', 'gdb.string_to_argv', (['arg'], {}), '(arg)\n', (422, 427), False, 'import gdb\n'), ((581, 608), 'gdb.parse_and_eval', 'gdb.parse_and_eval', (['args[0]'], {}), '(args[0])\n', (599, 608), False, 'import gdb\n'), ((1766, 1818), 'cv2.cv.CreateImageHeader', 'cv.CreateImageHeader', (['ima... |
import numpy as np
from ._ReadDataIndex import _ReadDataIndex
from ._UpdateDataIndex import _UpdateDataIndex
import os
def _DeleteDate(Date,fname,path,Confirm=True):
'''
Delete a single day of data for an instrument
Inputs
======
Date : int
Integer date in format yyyymmdd
fname : str
Full name and path o... | [
"numpy.where",
"numpy.zeros",
"os.system"
] | [((757, 789), 'numpy.zeros', 'np.zeros', (['idx.size'], {'dtype': '"""bool"""'}), "(idx.size, dtype='bool')\n", (765, 789), True, 'import numpy as np\n'), ((567, 593), 'numpy.where', 'np.where', (['(idx.Date == Date)'], {}), '(idx.Date == Date)\n', (575, 593), True, 'import numpy as np\n'), ((1051, 1077), 'numpy.where'... |
import time
# Start Time
start_time = time.time()
from tensorflow.keras.models import load_model
from time import sleep
from keras.preprocessing.image import img_to_array
from keras.preprocessing import image
import cv2
import numpy as np
import os
from mtcnn import MTCNN
num_classes = 5 # we have 5 kinds of em... | [
"tensorflow.keras.models.load_model",
"cv2.cvtColor",
"numpy.expand_dims",
"time.time",
"keras.preprocessing.image.img_to_array",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((39, 50), 'time.time', 'time.time', ([], {}), '()\n', (48, 50), False, 'import time\n'), ((433, 461), 'os.path.join', 'os.path.join', (['"""Flickr"""', '"""yo"""'], {}), "('Flickr', 'yo')\n", (445, 461), False, 'import os\n'), ((635, 668), 'os.path.join', 'os.path.join', (['"""model"""', 'model_name'], {}), "('model'... |
import imutils
import numpy as np
import argparse
import imutils
import dlib
import cv2
from collections import OrderedDict
def rect_to_bb(rect):
x = rect.left()
y = rect.top()
w = rect.right() - x
h = rect.bottom() - y
return (x, y, w, h)
def shape_to_np(shape, dtype="int"):
coords = np.zeros((shape.num... | [
"cv2.circle",
"argparse.ArgumentParser",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"numpy.zeros",
"cv2.imread",
"dlib.get_frontal_face_detector",
"collections.OrderedDict",
"dlib.shape_predictor",
"imutils.resize"
] | [((485, 700), 'collections.OrderedDict', 'OrderedDict', (["[('mouth', (48, 68)), ('inner_mouth', (60, 68)), ('right_eyebrow', (17, 22)\n ), ('left_eyebrow', (22, 27)), ('right_eye', (36, 42)), ('left_eye', (\n 42, 48)), ('nose', (27, 36)), ('jaw', (0, 17))]"], {}), "([('mouth', (48, 68)), ('inner_mouth', (60, 68)... |
from typing import List, Optional
import numpy as np
import copy
from ..classification import ClassificationAttacker, Classifier, ClassifierGoal
from ...text_process.tokenizer import Tokenizer, get_default_tokenizer
from ...attack_assist.substitute.word import WordSubstitute, get_default_substitute
from ...utils impor... | [
"numpy.random.uniform",
"copy.deepcopy",
"numpy.sum",
"numpy.argmax",
"numpy.sign",
"numpy.argsort",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.exp",
"numpy.random.choice"
] | [((9768, 9785), 'copy.deepcopy', 'copy.deepcopy', (['x2'], {}), '(x2)\n', (9781, 9785), False, 'import copy\n'), ((10391, 10407), 'copy.deepcopy', 'copy.deepcopy', (['x'], {}), '(x)\n', (10404, 10407), False, 'import copy\n'), ((10814, 10824), 'numpy.sum', 'np.sum', (['tn'], {}), '(tn)\n', (10820, 10824), True, 'import... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
@contact:
@Created on: DATE{TIME}
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ['CrossEntropy2D', 'BinaryCrossEntropy2D', 'ImageBasedCrossEntropy2D', 'BoundariesRelaxation2D',
'LabelSmoothCrossEntr... | [
"torch.randint",
"torch.nn.LogSoftmax",
"torch.histc",
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.randn",
"torch.nn.functional.softmax",
"numpy.arange",
"numpy.array",
"torch.clear_autocast_cache",
"torch.nn.functional.log_softmax",
"torch.nn.AvgPool2d",
"torch.log",
"tor... | [((20210, 20238), 'torch.clear_autocast_cache', 'torch.clear_autocast_cache', ([], {}), '()\n', (20236, 20238), False, 'import torch\n'), ((2127, 2192), 'torch.histc', 'torch.histc', (['target'], {'bins': 'num_classes', 'min': '(0)', 'max': '(num_classes - 1)'}), '(target, bins=num_classes, min=0, max=num_classes - 1)\... |
"""
Mask R-CNN
Configurations and data loading code for MS COCO.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by <NAME>
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for examples), or run from
... | [
"sys.path.append",
"os.path.abspath",
"numpy.array",
"os.path.join",
"numpy.sqrt"
] | [((1256, 1281), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (1271, 1281), False, 'import os\n'), ((1302, 1327), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (1317, 1327), False, 'import sys\n'), ((1493, 1536), 'os.path.join', 'os.path.join', (['ROOT_DIR', '... |
import numpy as np
from ndsimulator.data import AllData
from ndsimulator.constant import kB
class PEBias(AllData):
"""The PE_bias object implements bias that based on potential energy
It penalize all the configuration that has a potential energy lower than a thredshold
"""
def __init__(
sel... | [
"numpy.array",
"ndsimulator.data.AllData.__init__",
"numpy.zeros"
] | [((481, 516), 'ndsimulator.data.AllData.__init__', 'AllData.__init__', (['self'], {'run': 'pointer'}), '(self, run=pointer)\n', (497, 516), False, 'from ndsimulator.data import AllData\n'), ((992, 1011), 'numpy.zeros', 'np.zeros', (['self.ndim'], {}), '(self.ndim)\n', (1000, 1011), True, 'import numpy as np\n'), ((1468... |
from __future__ import annotations
import numpy as np
from edutorch.typing import NPArray
from .module import Module
class SpatialGroupNorm(Module):
def __init__(self, num_features: int, G: int, eps: float = 1e-5) -> None:
super().__init__()
self.eps = eps
self.G = G
self.gamma... | [
"numpy.sum",
"numpy.zeros",
"numpy.mean",
"numpy.var",
"numpy.sqrt"
] | [((323, 345), 'numpy.zeros', 'np.zeros', (['num_features'], {}), '(num_features)\n', (331, 345), True, 'import numpy as np\n'), ((366, 388), 'numpy.zeros', 'np.zeros', (['num_features'], {}), '(num_features)\n', (374, 388), True, 'import numpy as np\n'), ((1565, 1583), 'numpy.mean', 'np.mean', (['x'], {'axis': '(0)'}),... |
# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited.
#
# 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 applic... | [
"copy.deepcopy",
"absl.logging.exception",
"android_env.components.specs.base_action_spec",
"time.time",
"absl.logging.info",
"time.sleep",
"android_env.components.specs.base_observation_spec",
"numpy.array",
"absl.logging.error"
] | [((3314, 3338), 'android_env.components.specs.base_action_spec', 'specs.base_action_spec', ([], {}), '()\n', (3336, 3338), False, 'from android_env.components import specs\n'), ((3468, 3540), 'android_env.components.specs.base_observation_spec', 'specs.base_observation_spec', ([], {'height': 'screen_dims[0]', 'width': ... |
"""Functions to enable BMS transformations of waveforms
BMS transformations include the usual Poincaré group — time and space
translations, rotations, and boosts — as well as "supertranslations", which are
a more general form of translations. Essentially, a supertranslation is a
direction-dependent time translation.
... | [
"numpy.arctanh",
"spinsfast.map2salm",
"numpy.tensordot",
"numpy.cross",
"numpy.zeros",
"quaternionic.array.from_vector_part",
"numpy.diff",
"numpy.linalg.norm",
"numpy.array",
"numpy.exp",
"spherical.Ysize",
"numpy.tan",
"quaternionic.array.from_spherical_coordinates",
"spherical.theta_ph... | [((2733, 2749), 'numpy.array', 'np.array', (['uprime'], {}), '(uprime)\n', (2741, 2749), True, 'import numpy as np\n'), ((3682, 3700), 'numpy.linalg.norm', 'np.linalg.norm', (['v⃗'], {}), '(v⃗)\n', (3696, 3700), True, 'import numpy as np\n'), ((3771, 3784), 'numpy.arctanh', 'np.arctanh', (['β'], {}), '(β)\n', (3781, 37... |
import numpy as np
import pandas as pd
from nltk.tokenize.treebank import TreebankWordDetokenizer
latex_special_token = ["!@#$%^&*()"]
def generate(text_list, attention_list, latex_file, color='red', rescale_value=False):
assert(len(text_list) == len(attention_list))
if rescale_value:
attention_list ... | [
"random.shuffle",
"numpy.asarray",
"numpy.zeros",
"pandas.read_json",
"numpy.max",
"numpy.min",
"random.seed",
"nltk.tokenize.treebank.TreebankWordDetokenizer"
] | [((1185, 1207), 'numpy.asarray', 'np.asarray', (['input_list'], {}), '(input_list)\n', (1195, 1207), True, 'import numpy as np\n'), ((1222, 1239), 'numpy.max', 'np.max', (['the_array'], {}), '(the_array)\n', (1228, 1239), True, 'import numpy as np\n'), ((1254, 1271), 'numpy.min', 'np.min', (['the_array'], {}), '(the_ar... |
import random
import unittest
import numpy as np
from scipy.sparse import coo_matrix
from rlscore.learner import CGRankRLS
from rlscore.learner.cg_rankrls import PCGRankRLS
from rlscore.learner import QueryRankRLS
class Test(unittest.TestCase):
def setUp(self):
np.random.seed(100)
random.se... | [
"numpy.random.seed",
"numpy.sum",
"random.randint",
"rlscore.learner.CGRankRLS",
"rlscore.learner.cg_rankrls.PCGRankRLS",
"numpy.zeros",
"numpy.identity",
"numpy.ones",
"rlscore.learner.QueryRankRLS",
"numpy.max",
"scipy.sparse.coo_matrix",
"random.seed",
"numpy.array",
"numpy.arange",
"... | [((283, 302), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (297, 302), True, 'import numpy as np\n'), ((311, 327), 'random.seed', 'random.seed', (['(100)'], {}), '(100)\n', (322, 327), False, 'import random\n'), ((3061, 3080), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (307... |
import argparse
import csv
import glob
import json
import time
from pathlib import Path
import cv2
import numpy as np
import pandas as pd
Land_cover_Classes = {
'Mixed forest': 0,
'Coniferous forest': 1,
'Non-irrigated arable land': 2,
'Transitional woodland/shrub': 3,
'Broad-leaved forest': 4,
... | [
"numpy.stack",
"json.dump",
"numpy.quantile",
"json.load",
"argparse.ArgumentParser",
"csv.writer",
"pandas.read_csv",
"time.time",
"cv2.imread",
"pathlib.Path",
"glob.glob",
"glob.iglob",
"pathlib.Path.cwd"
] | [((6974, 7030), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""BigEarthNet utils"""'}), "(description='BigEarthNet utils')\n", (6997, 7030), False, 'import argparse\n'), ((2066, 2082), 'pathlib.Path', 'Path', (['big_e_path'], {}), '(big_e_path)\n', (2070, 2082), False, 'from pathlib impo... |
"""
test features_retriever
-----------------------
Testing the feature retriever.
"""
import numpy as np
from itertools import product
from pySpatialTools.FeatureManagement.features_retriever import\
FeaturesManager, _features_parsing_creation,\
_featuresmanager_parsing_creation
from pySpatialTools.FeatureM... | [
"pySpatialTools.FeatureManagement.features_objects.ExplicitFeatures",
"pySpatialTools.FeatureManagement.Descriptors.DummyDescriptor",
"pySpatialTools.FeatureManagement.aux_resulter_building.creation_initialization_output_list",
"pySpatialTools.FeatureManagement.aux_resulter_building.creation_initialization_ou... | [((2331, 2355), 'numpy.random.randint', 'np.random.randint', (['(1)', '(20)'], {}), '(1, 20)\n', (2348, 2355), True, 'import numpy as np\n'), ((2519, 2531), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (2528, 2531), True, 'import numpy as np\n'), ((2682, 2716), 'pySpatialTools.utils.perturbations.PermutationPertu... |
import numpy as np
import os
root = '/home/user4/database/BosphorusDB/'
train_data = os.path.join(root, 'bosphorus_id_train.txt')
train_label = os.path.join(root, 'bosphorus_label_train.txt')
test_data = os.path.join(root, 'bosphorus_id_test.txt')
test_label = os.path.join(root, 'bosphorus_label_test.txt')
def _get_d... | [
"numpy.array",
"numpy.arange",
"numpy.int",
"os.path.join",
"numpy.random.shuffle"
] | [((86, 130), 'os.path.join', 'os.path.join', (['root', '"""bosphorus_id_train.txt"""'], {}), "(root, 'bosphorus_id_train.txt')\n", (98, 130), False, 'import os\n'), ((145, 192), 'os.path.join', 'os.path.join', (['root', '"""bosphorus_label_train.txt"""'], {}), "(root, 'bosphorus_label_train.txt')\n", (157, 192), False,... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 22 23:11:34 2021
@author: Ioana
"""
import numpy as np
import tensorflow as tf
from dipy.io.streamline import load_tractogram
## Load data and labels as per Jean-Bernard's/Juan Jose's code
# function to convert each streamline into a fibermap
def get_fi... | [
"numpy.concatenate",
"numpy.zeros",
"tensorflow.data.Dataset.from_tensor_slices",
"numpy.tile",
"numpy.vstack"
] | [((1402, 1456), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['(map1, all_labels)'], {}), '((map1, all_labels))\n', (1436, 1456), True, 'import tensorflow as tf\n'), ((361, 388), 'numpy.zeros', 'np.zeros', (['[2 * n, 2 * n, 3]'], {}), '([2 * n, 2 * n, 3])\n', (369, 388), True, 'i... |
from math import log
from ..ch3.models import LeastSquareModel, LinearModel
import numpy as np
from numpy import linalg as LA
from ..utils import lazy_method
from ..base import ClassificationMixin
__all__ = ['LinearRegressionIndicatorMatrix', 'LDAModel', 'QDAModel', 'RDAModel', 'LDAForComputation',
'Reduce... | [
"numpy.sum",
"numpy.diagflat",
"numpy.zeros",
"numpy.insert",
"numpy.linalg.eigh",
"numpy.fliplr",
"numpy.linalg.norm",
"numpy.exp",
"numpy.linalg.det",
"math.log",
"numpy.linalg.pinv"
] | [((1845, 1861), 'numpy.zeros', 'np.zeros', (['(K, p)'], {}), '((K, p))\n', (1853, 1861), True, 'import numpy as np\n'), ((1880, 1896), 'numpy.zeros', 'np.zeros', (['(K, 1)'], {}), '((K, 1))\n', (1888, 1896), True, 'import numpy as np\n'), ((1922, 1938), 'numpy.zeros', 'np.zeros', (['(p, p)'], {}), '((p, p))\n', (1930, ... |
import h5py
import oneflow as flow
import shutil
import numpy as np
import os
def save_net(fname, net):
with h5py.File(fname, "w") as h5f:
for k, v in net.state_dict().items():
h5f.create_dataset(k, data=v.cpu().numpy())
def load_net(fname, net):
with h5py.File(fname, "r") as h5f:
... | [
"h5py.File",
"os.remove",
"shutil.rmtree",
"os.path.isdir",
"numpy.asarray",
"os.path.exists",
"oneflow.save",
"os.path.isfile",
"shutil.copytree",
"os.path.join",
"os.listdir"
] | [((564, 614), 'oneflow.save', 'flow.save', (["state['state_dict']", '(filename + task_id)'], {}), "(state['state_dict'], filename + task_id)\n", (573, 614), True, 'import oneflow as flow\n'), ((890, 914), 'os.path.exists', 'os.path.exists', (['filepath'], {}), '(filepath)\n', (904, 914), False, 'import os\n'), ((115, 1... |
import numpy as np
from sklearn.neighbors import KNeighborsClassifier as SKKNeighborsClassifier
from skopt.space import Integer
from evalml.model_family import ModelFamily
from evalml.pipelines.components.estimators import Estimator
from evalml.problem_types import ProblemTypes
class KNeighborsClassifier(Estimator):... | [
"numpy.zeros",
"skopt.space.Integer",
"sklearn.neighbors.KNeighborsClassifier"
] | [((454, 468), 'skopt.space.Integer', 'Integer', (['(2)', '(12)'], {}), '(2, 12)\n', (461, 468), False, 'from skopt.space import Integer\n'), ((599, 614), 'skopt.space.Integer', 'Integer', (['(10)', '(30)'], {}), '(10, 30)\n', (606, 614), False, 'from skopt.space import Integer\n'), ((629, 642), 'skopt.space.Integer', '... |
# Environment
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from scipy.stats import beta
class Env_Gaussian(object):
'''
A collection of functions to implement and visualize a Gaussian environment.
Rewards are drawn from a Gaussian distirubtion with unit vari... | [
"pandas.DataFrame",
"numpy.random.uniform",
"numpy.random.binomial",
"numpy.random.seed",
"numpy.sum",
"numpy.random.beta",
"numpy.empty",
"numpy.transpose",
"numpy.ones",
"numpy.random.normal",
"matplotlib.pyplot.subplots",
"seaborn.violinplot"
] | [((548, 593), 'numpy.random.normal', 'np.random.normal', ([], {'loc': '(0)', 'scale': '(1)', 'size': 'self.k'}), '(loc=0, scale=1, size=self.k)\n', (564, 593), True, 'import numpy as np\n'), ((621, 636), 'numpy.ones', 'np.ones', (['self.k'], {}), '(self.k)\n', (628, 636), True, 'import numpy as np\n'), ((780, 880), 'nu... |
"""
Validating IOU of a trained model.
Configurations
scannet_dir: root dir of scannet
device: for saving
model_name: trained DNN
data_type: Random, Grid, Hierarchy
specify_id: if want to valid specific ids
n_scene: how many scenes to validate
Results saved ... | [
"sparseconvnet.BatchNormReLU",
"numpy.array_str",
"torch.cat",
"torch.no_grad",
"os.path.join",
"multiprocessing.cpu_count",
"sparseconvnet.Sequential",
"torch.load",
"numpy.savetxt",
"os.path.exists",
"sparseconvnet.SubmanifoldConvolution",
"sparseconvnet.OutputLayer",
"math.cos",
"torch.... | [((2452, 2488), 'os.path.join', 'os.path.join', (['"""../Model"""', 'model_name'], {}), "('../Model', model_name)\n", (2464, 2488), False, 'import os\n'), ((2525, 2547), 'torch.load', 'torch.load', (['model_file'], {}), '(model_file)\n', (2535, 2547), False, 'import torch\n'), ((2675, 2699), 'os.path.exists', 'os.path.... |
import os
import sys
import gym
import numpy as np
sys.path.append(os.getcwd())
from data.helpers import dodict
from data.trainer import Trainer
from game.game import Game
from data.replay_buffer import ReplayBuffer
# Importing Agents
from data.agent import BaseAgent
from agents.random_agent import RandomAgent
from age... | [
"os.getcwd",
"numpy.mean",
"gym.make",
"data.replay_buffer.ReplayBuffer"
] | [((67, 78), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (76, 78), False, 'import os\n'), ((3174, 3252), 'data.replay_buffer.ReplayBuffer', 'ReplayBuffer', (['self.config.buffer_size', 'self.config.batch_size', 'self.input_dims'], {}), '(self.config.buffer_size, self.config.batch_size, self.input_dims)\n', (3186, 3252),... |
# ==============================================================================
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
imp... | [
"numpy.copy",
"numpy.product",
"numpy.random.randint",
"numpy.arange",
"numpy.alltrue",
"numpy.random.permutation",
"numpy.ascontiguousarray"
] | [((561, 589), 'numpy.random.permutation', 'np.random.permutation', (['(i + 1)'], {}), '(i + 1)\n', (582, 589), True, 'import numpy as np\n'), ((737, 754), 'numpy.product', 'np.product', (['shape'], {}), '(shape)\n', (747, 754), True, 'import numpy as np\n'), ((775, 793), 'numpy.arange', 'np.arange', (['entries'], {}), ... |
"""
@author: <NAME>
__license__= "LGPL"
"""
import numpy as np
import easyvvuq as uq
import os
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib.ticker import ScalarFormatter, NullFormatter
plt.rcParams.update({'font.size': 18, 'legend.fontsize': 15})
plt.rcParams['figure.figsize'] = 12,9
"""
*****... | [
"easyvvuq.Campaign",
"easyvvuq.analysis.QMCAnalysis",
"matplotlib.pyplot.show",
"numpy.log",
"os.path.dirname",
"numpy.sort",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.rcParams.update",
"numpy.arange",
"matplotlib.ticker.NullFormatter",
"matplotlib.pyplot.tight_layout"
] | [((210, 271), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 18, 'legend.fontsize': 15}"], {}), "({'font.size': 18, 'legend.fontsize': 15})\n", (229, 271), True, 'import matplotlib.pyplot as plt\n'), ((563, 634), 'easyvvuq.Campaign', 'uq.Campaign', ([], {'state_file': '"""campaign_state_FC... |
# Copyright 2020 The MuLT 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 applicable la... | [
"skopt.gp_minimize",
"skopt.space.Categorical",
"warnings.filterwarnings",
"skopt.utils.use_named_args",
"skopt.space.Integer",
"sklearn.metrics.log_loss",
"skopt.space.Real",
"numpy.mean",
"sklearn.model_selection.StratifiedKFold",
"numpy.exp",
"sklearn.svm.SVC"
] | [((958, 991), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (981, 991), False, 'import warnings\n'), ((2221, 2242), 'skopt.utils.use_named_args', 'use_named_args', (['space'], {}), '(space)\n', (2235, 2242), False, 'from skopt.utils import use_named_args\n'), ((1042, 1060... |
import argparse
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def main():
parser = argparse.ArgumentParser(description='Visualize two random malware bitstring.')
parser.add_argument('dataset', type=str, help='Dataset (csv.xz) file location.')
args = parser.parse_args()
df ... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"pandas.read_csv",
"matplotlib.pyplot.yticks",
"numpy.reshape",
"numpy.fromiter",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.subplots"
] | [((117, 195), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Visualize two random malware bitstring."""'}), "(description='Visualize two random malware bitstring.')\n", (140, 195), False, 'import argparse\n'), ((322, 347), 'pandas.read_csv', 'pd.read_csv', (['args.dataset'], {}), '(args.... |
import numpy as np
from scipy import sparse
def spectrum(L, k=6):
"""
Compute the smallest k eigenvalues and corresponding eigenvectors
of the graph laplacian.
Parameters:
- - - - -
L: float, array
sparse laplacian matrix
k: int
number of eigenvectors / values to compute
... | [
"numpy.argsort",
"numpy.diag",
"scipy.sparse.linalg.eigs",
"numpy.real"
] | [((459, 497), 'scipy.sparse.linalg.eigs', 'sparse.linalg.eigs', (['L'], {'k': 'k', 'which': '"""SM"""'}), "(L, k=k, which='SM')\n", (477, 497), False, 'from scipy import sparse\n'), ((511, 526), 'numpy.real', 'np.real', (['Lambda'], {}), '(Lambda)\n', (518, 526), True, 'import numpy as np\n'), ((535, 545), 'numpy.real'... |
"""MatterSim API.
Authors:
- <NAME> (<EMAIL>)
- <NAME> (<EMAIL>)
"""
from __future__ import division, print_function, unicode_literals
import os
import MatterSim
import math
import numpy as np
import modules.vis_utils
# https://github.com/peteanderson80/Matterport3DSimulator/blob/master/src/driver/driver.py
clas... | [
"math.radians",
"MatterSim.Simulator",
"numpy.rad2deg",
"numpy.array"
] | [((784, 816), 'math.radians', 'math.radians', (["params['hfov_DEG']"], {}), "(params['hfov_DEG'])\n", (796, 816), False, 'import math\n'), ((931, 961), 'numpy.rad2deg', 'np.rad2deg', (["params['vfov_RAD']"], {}), "(params['vfov_RAD'])\n", (941, 961), True, 'import numpy as np\n'), ((2223, 2244), 'MatterSim.Simulator', ... |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import time
import torch
from options.train_options import TrainOptions
from data.data_loa... | [
"torch.mean",
"torch.ones",
"torch.nn.MSELoss",
"tensorboardX.SummaryWriter",
"numpy.abs",
"numpy.sum",
"torch.zeros_like",
"torch.sum",
"numpy.angle",
"data.data_loader.CreateDataLoader",
"torch.log1p",
"numpy.mean",
"torch.device",
"options.train_options.TrainOptions",
"torch.nn.DataPa... | [((6703, 6723), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (6715, 6723), False, 'import torch\n'), ((7267, 7281), 'models.customBM_models.ModelBuilder', 'ModelBuilder', ([], {}), '()\n', (7279, 7281), False, 'from models.customBM_models import ModelBuilder\n'), ((7627, 7654), 'models.modelRatio... |
import numpy as np
import cv2
def obj_read(mesh,texture_normal=None):
obj_file = open(mesh,'r')
vertices = []
vertex_colors = []
vertex_color_uv = []
faces = []
vertex_text_map = []
new_vertex_color_uv = []
vertex_colors_normal = []
vertex_no = 0;
vertex_text_no = 0;
... | [
"numpy.flip",
"numpy.zeros",
"cv2.imread",
"numpy.array",
"numpy.round_"
] | [((1711, 1729), 'numpy.array', 'np.array', (['vertices'], {}), '(vertices)\n', (1719, 1729), True, 'import numpy as np\n'), ((1743, 1758), 'numpy.array', 'np.array', (['faces'], {}), '(faces)\n', (1751, 1758), True, 'import numpy as np\n'), ((1780, 1803), 'numpy.array', 'np.array', (['vertex_colors'], {}), '(vertex_col... |
# Preppin' Data 2021 Week 25
import pandas as pd
import numpy as np
# Load data
gen_1 = pd.read_excel('unprepped_data\\PD 2021 Wk 25 Input - 2021W25 Input.xlsx', sheet_name='Gen 1')
evolution_group = pd.read_excel('unprepped_data\\PD 2021 Wk 25 Input - 2021W25 Input.xlsx', sheet_name='Evolution Group')
evolutions = pd... | [
"pandas.read_excel",
"pandas.merge",
"pandas.concat",
"numpy.int64"
] | [((89, 186), 'pandas.read_excel', 'pd.read_excel', (['"""unprepped_data\\\\PD 2021 Wk 25 Input - 2021W25 Input.xlsx"""'], {'sheet_name': '"""Gen 1"""'}), "('unprepped_data\\\\PD 2021 Wk 25 Input - 2021W25 Input.xlsx',\n sheet_name='Gen 1')\n", (102, 186), True, 'import pandas as pd\n'), ((201, 308), 'pandas.read_exc... |
import numpy as np
import pytest
from pydantic import ValidationError
from bigearthnet_patch_interface.band_interface import *
def test_band_shape_validator():
with pytest.raises(ValueError):
Band(name="B01", spatial_resolution=10, data=np.array([1]), data_shape=((2, 1)))
@pytest.mark.parametrize(
... | [
"pytest.mark.parametrize",
"pytest.raises",
"numpy.array"
] | [((291, 350), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""invalid_data"""', "[[[1]], 1, 1, '1']"], {}), "('invalid_data', [[[1]], 1, 1, '1'])\n", (314, 350), False, 'import pytest\n'), ((773, 849), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""invalid_name"""', "['wrong_name', 'B09', 'B01'... |
from classes import Point, Cluster
import serial
import json
import pandas as pd
import numpy as np
import time
import glob
import matplotlib.pyplot as plt
import re
def find_serial_port(man=""):
if len(man) != 0:
return man
ports = glob.glob("/dev/tty.usb*")
print(ports)
if len(ports) > 1:
... | [
"pandas.DataFrame",
"matplotlib.pyplot.xlim",
"json.loads",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.clf",
"time.sleep",
"matplotlib.pyplot.figure",
"classes.Cluster",
"numpy.column_stack",
"glob.glob",
"matplotlib.pyplot.pause",
"re.compile"
] | [((251, 277), 'glob.glob', 'glob.glob', (['"""/dev/tty.usb*"""'], {}), "('/dev/tty.usb*')\n", (260, 277), False, 'import glob\n'), ((1445, 1470), 'numpy.column_stack', 'np.column_stack', (['(Xs, Ys)'], {}), '((Xs, Ys))\n', (1460, 1470), True, 'import numpy as np\n'), ((1485, 1529), 'classes.Cluster', 'Cluster', (['clus... |
"""
Tests for the conversion module.
"""
import unittest
import numpy as np
from vlnm.conversion import (
hz_to_bark,
hz_to_erb,
hz_to_mel)
class TestHzToBark(unittest.TestCase):
"""
Test the hz_to_bark function.
"""
def setUp(self):
self.convert = lambda frq: 26.81 * frq / (fr... | [
"numpy.log",
"numpy.random.randn",
"vlnm.conversion.hz_to_mel",
"numpy.array_equal",
"vlnm.conversion.hz_to_erb",
"vlnm.conversion.hz_to_bark"
] | [((502, 518), 'vlnm.conversion.hz_to_bark', 'hz_to_bark', (['data'], {}), '(data)\n', (512, 518), False, 'from vlnm.conversion import hz_to_bark, hz_to_erb, hz_to_mel\n'), ((643, 663), 'numpy.random.randn', 'np.random.randn', (['(100)'], {}), '(100)\n', (658, 663), True, 'import numpy as np\n'), ((719, 735), 'vlnm.conv... |
import numpy as np
from msdsl import *
m = MixedSignalModel('rc')
dt = m.add_analog_input('dt')
alpha = m.add_analog_output('alpha')
func = lambda dt: np.exp(-dt)
f = m.make_function(func, domain=[0, 10], numel=512, order=1)
m.set_from_sync_func(alpha, f, dt)
m.compile_and_print(VerilogGenerator()) | [
"numpy.exp"
] | [((151, 162), 'numpy.exp', 'np.exp', (['(-dt)'], {}), '(-dt)\n', (157, 162), True, 'import numpy as np\n')] |
import numpy as np
class Statistics(object):
def __init__(self):
self.histogram_db = {}
def train(self, images):
for image in images:
local_image_id = image['img_id']
if local_image_id not in self.histogram_db.keys():
self.histogram_db[local_image_id] ... | [
"numpy.linalg.norm",
"numpy.array"
] | [((570, 589), 'numpy.array', 'np.array', (['local_img'], {}), '(local_img)\n', (578, 589), True, 'import numpy as np\n'), ((743, 789), 'numpy.linalg.norm', 'np.linalg.norm', (['(local_target_hist[0] - hist[0])'], {}), '(local_target_hist[0] - hist[0])\n', (757, 789), True, 'import numpy as np\n'), ((821, 867), 'numpy.l... |
# -*- coding: utf-8 -*-
"""
Using Unicode everywhere 🤗
===========================
This example demonstrates how to include non-ASCII characters, mostly emoji 🎉
to stress test the build and test environments that parse the example files.
"""
from __future__ import unicode_literals
# 🎉 👍
# Code source: <NAME>
# Li... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.random.randn",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.figure",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((517, 529), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (527, 529), True, 'import matplotlib.pyplot as plt\n'), ((637, 676), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y', 's'], {'marker': '"""$\\\\oint$"""'}), "(x, y, s, marker='$\\\\oint$')\n", (648, 676), True, 'import matplotlib.pyplot as... |
import argparse
import numpy as np
import os
import time
import torch
import random
import yaml
import gym
import csv
import multiprocessing as mp
from numba import njit
import scipy.stats as sps
import pickle
from concurrent.futures import ThreadPoolExecutor
from mpc import lattice_planner,pure_pursuit_utils
import sy... | [
"numpy.load",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.random.seed",
"csv.reader",
"numpy.empty",
"numba.njit",
"numpy.ones",
"numpy.clip",
"numpy.isnan",
"numpy.savez_compressed",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.linalg.norm",
"yaml.safe_load",
"numpy.sin",
... | [((323, 349), 'sys.path.append', 'sys.path.append', (['"""./flows"""'], {}), "('./flows')\n", (338, 349), False, 'import sys\n'), ((403, 418), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (416, 418), False, 'import torch\n'), ((2862, 2887), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', ... |
import numpy as np
class ReservoirSampler(object):
"""Finds a random subset k elements from a stream of data in O(k) space.
See https://en.wikipedia.org/wiki/Reservoir_sampling.
"""
def __init__(self, k):
self.samples = []
self.num_seen = 0
self.k = k
def add(self, item):... | [
"numpy.random.rand"
] | [((436, 453), 'numpy.random.rand', 'np.random.rand', (['(1)'], {}), '(1)\n', (450, 453), True, 'import numpy as np\n')] |
import numpy as np
import _pickle as cPickle
import copy
from pommerman import forward_model
from pommerman import constants
from pommerman import characters
from pommerman import utility
class EnvSimulator:
@staticmethod
def get_initial_game_data(obs, my_id, max_steps=1000):
game_data = GameData()
... | [
"copy.deepcopy",
"_pickle.loads",
"pommerman.forward_model.ForwardModel.step",
"_pickle.dumps",
"numpy.ones",
"pommerman.forward_model.ForwardModel.get_done",
"pommerman.utility.get_direction",
"numpy.where",
"pommerman.constants.InvalidAction",
"pommerman.constants.Action",
"pommerman.utility.p... | [((1926, 2053), 'pommerman.forward_model.ForwardModel.get_done', 'forward_model.ForwardModel.get_done', (['game_data.agents', 'game_data.step_count', 'game_data.max_steps', 'game_data.game_type', 'None'], {}), '(game_data.agents, game_data.step_count,\n game_data.max_steps, game_data.game_type, None)\n', (1961, 2053... |
#coding=utf-8
import numpy as np
import bisect
class Spline:
"""
三次样条类
"""
def __init__(self, x, y):
self.a, self.b, self.c, self.d = [], [], [], []
self.x = x
self.y = y
self.nx = len(x) # dimension of x
h = np.diff(x)
# calc coefficient c
... | [
"numpy.zeros",
"numpy.diff",
"numpy.linalg.solve",
"bisect.bisect"
] | [((271, 281), 'numpy.diff', 'np.diff', (['x'], {}), '(x)\n', (278, 281), True, 'import numpy as np\n'), ((451, 472), 'numpy.linalg.solve', 'np.linalg.solve', (['A', 'B'], {}), '(A, B)\n', (466, 472), True, 'import numpy as np\n'), ((1334, 1362), 'numpy.zeros', 'np.zeros', (['(self.nx, self.nx)'], {}), '((self.nx, self.... |
import os
import h5py
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.layers import (
AveragePooling2D, Convolution2D, MaxPooling2D, ZeroPadding2D)
from tensorflow.keras.models import Sequential
from image_analogy import img_utils
def img_from_vgg(x):
'''Decondition an image... | [
"image_analogy.img_utils.reshape_weights",
"h5py.File",
"os.path.exists",
"tensorflow.keras.layers.ZeroPadding2D",
"numpy.array",
"tensorflow.keras.models.Sequential",
"tensorflow.keras.layers.Convolution2D"
] | [((1101, 1113), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1111, 1113), False, 'from tensorflow.keras.models import Sequential\n'), ((4385, 4413), 'os.path.exists', 'os.path.exists', (['weights_path'], {}), '(weights_path)\n', (4399, 4413), False, 'import os\n'), ((4482, 4505), 'h5py.File', ... |
import numpy as np
from collections.abc import Iterable
from typing import Tuple
def fmt_row(width, row):
out = " | ".join(fmt_item(x, width) for x in row)
return out
def fmt_item(x, l):
if isinstance(x, np.ndarray):
assert x.ndim == 0
x = x.item()
if isinstance(x, float):
rep... | [
"numpy.iinfo"
] | [((1038, 1056), 'numpy.iinfo', 'np.iinfo', (['np.int32'], {}), '(np.int32)\n', (1046, 1056), True, 'import numpy as np\n')] |
import numpy as np
from . import itrainer
from .. import network
from typing import Callable, List, Tuple
class StochasticGradientDescent(itrainer.ITrainer):
@staticmethod
def numerical_gradient(f: Callable, x: np.array, delta: float = 1e-4) -> np.array:
grad = np.zeros_like(x)
it = np.nditer... | [
"numpy.nditer",
"numpy.zeros_like",
"numpy.random.choice"
] | [((280, 296), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (293, 296), True, 'import numpy as np\n'), ((311, 370), 'numpy.nditer', 'np.nditer', (['x'], {'flags': "['multi_index']", 'op_flags': "['readwrite']"}), "(x, flags=['multi_index'], op_flags=['readwrite'])\n", (320, 370), True, 'import numpy as np\... |
# Copyright 2019 GreenWaves Technologies, SAS
# 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 i... | [
"numpy.multiply",
"numpy.zeros",
"numpy.sum",
"logging.getLogger"
] | [((661, 700), 'logging.getLogger', 'logging.getLogger', (["('nntool.' + __name__)"], {}), "('nntool.' + __name__)\n", (678, 700), False, 'import logging\n'), ((1071, 1108), 'numpy.zeros', 'np.zeros', (['out_dims.shape'], {'dtype': 'dtype'}), '(out_dims.shape, dtype=dtype)\n', (1079, 1108), True, 'import numpy as np\n')... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import numpy as np
def _mZdif(data_difuse, cbus, Sb):
bus = cbus.tbus
nP = cbus.nP
busP = cbus.mbusp
zdif = np.zeros([nP, 3])
zcent = np.zeros([nP, 1])
auxDeltaZ = np.zeros([nP, 3])
for i in range(bus):
for j in range(nP):
i... | [
"numpy.matrix",
"numpy.subtract",
"numpy.zeros",
"numpy.matmul",
"numpy.concatenate"
] | [((172, 189), 'numpy.zeros', 'np.zeros', (['[nP, 3]'], {}), '([nP, 3])\n', (180, 189), True, 'import numpy as np\n'), ((202, 219), 'numpy.zeros', 'np.zeros', (['[nP, 1]'], {}), '([nP, 1])\n', (210, 219), True, 'import numpy as np\n'), ((236, 253), 'numpy.zeros', 'np.zeros', (['[nP, 3]'], {}), '([nP, 3])\n', (244, 253),... |
#!/usr/bin/env python
#
# Copyright 2019 <NAME>.
#
# This file is part of Mi3-GPU.
#
# Mi3-GPU 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, version 3 of the License.
#
# Mi3-GPU is distributed in the hope t... | [
"atexit.register",
"numpy.load",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.sum",
"utils.printsome",
"mpmath.mpf",
"numpy.mean",
"numpy.arange",
"os.path.isfile",
"scipy.special.logsumexp",
"numpy.random.randint",
"mpi_manager.MPI_worker",
"numpy.float64",
"os.path.join",
"... | [((2096, 2131), 'os.path.join', 'os.path.join', (['scriptPath', '"""mcmc.cl"""'], {}), "(scriptPath, 'mcmc.cl')\n", (2108, 2131), False, 'import sys, os, errno, time, datetime, socket, signal, atexit, glob, argparse\n'), ((2055, 2081), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (2071, 2... |
#
# * The source code in this file is based on the soure code of CuPy.
#
# # NLCPy License #
#
# Copyright (c) 2020-2021 NEC Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are ... | [
"nlcpy.testing.for_all_dtypes_combination",
"nlcpy.testing.product",
"nlcpy.testing.shaped_arange",
"nlcpy.testing.shaped_random",
"nlcpy.sum",
"nlcpy.testing.for_float_dtypes",
"nlcpy.testing.numpy_nlcpy_raises",
"numpy.can_cast",
"nlcpy.testing.for_all_dtypes",
"nlcpy.cumsum",
"nlcpy.testing.w... | [((9751, 9787), 'nlcpy.testing.with_requires', 'testing.with_requires', (['"""numpy>=1.14"""'], {}), "('numpy>=1.14')\n", (9772, 9787), False, 'from nlcpy import testing\n'), ((3071, 3095), 'nlcpy.testing.for_all_dtypes', 'testing.for_all_dtypes', ([], {}), '()\n', (3093, 3095), False, 'from nlcpy import testing\n'), (... |
import os
# Disable Tensorflow's INFO and WARNING messages
# See http://stackoverflow.com/questions/35911252
if 'TF_CPP_MIN_LOG_LEVEL' not in os.environ:
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import numpy as np
import numpy.random
import os.path
import random
import tensorflow as tf
import dm_celeba
import dm... | [
"tensorflow.gfile.Exists",
"numpy.random.seed",
"tensorflow.ConfigProto",
"tensorflow.assign",
"tensorflow.Variable",
"tensorflow.set_random_seed",
"tensorflow.train.start_queue_runners",
"random.seed",
"tensorflow.gfile.DeleteRecursively",
"tensorflow.app.run",
"tensorflow.train.get_checkpoint_... | [((511, 553), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'log_device_placement': '(False)'}), '(log_device_placement=False)\n', (525, 553), True, 'import tensorflow as tf\n'), ((602, 627), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (612, 627), True, 'import tensorflow as... |
import time
import numpy as np
from .integrators import BackwardsEuler, make_symmetric_random
# ==================================
class SimulatorEnv:
"""class for simulation environment
Usage:
env = SimulatorEnv(coefficient, init_state, target_state, time_limit, euler_limit, delta, eps_euler, eps... | [
"numpy.random.uniform",
"numpy.random.seed",
"numpy.random.random_sample",
"numpy.abs",
"numpy.zeros",
"time.time",
"numpy.random.randint",
"numpy.exp",
"numpy.random.rand",
"numpy.concatenate"
] | [((5802, 5873), 'numpy.random.uniform', 'np.random.uniform', (['(-self.max_action)', 'self.max_action', 'self.action_space'], {}), '(-self.max_action, self.max_action, self.action_space)\n', (5819, 5873), True, 'import numpy as np\n'), ((6602, 6630), 'numpy.random.seed', 'np.random.seed', (['seed_network'], {}), '(seed... |
#!/usr/bin/env python
# license removed for brevity
import os
import sys
current_folder = os.path.dirname(os.path.realpath(__file__))
sys.path.append(current_folder)
import numpy as np
import subprocess
from subprocess import Popen, PIPE
class SYS_UTILS:
#PUBLIC
#PRIVATE
def __init__(s... | [
"sys.path.append",
"subprocess.Popen",
"subprocess.check_output",
"os.path.realpath",
"numpy.append"
] | [((139, 170), 'sys.path.append', 'sys.path.append', (['current_folder'], {}), '(current_folder)\n', (154, 170), False, 'import sys\n'), ((110, 136), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (126, 136), False, 'import os\n'), ((468, 516), 'subprocess.Popen', 'Popen', (['cmd'], {'stdout... |
# Copyright (C) 2019 ByteDance Inc
# 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,... | [
"argparse.ArgumentParser",
"effective_transformer.get_sequence_output",
"tensorflow.compat.v1.disable_eager_execution",
"numpy.random.randint",
"modeling.BertConfig.from_json_file",
"numpy.tile",
"tensorflow.compat.v1.global_variables_initializer",
"numpy.random.randn",
"tensorflow.keras.mixed_preci... | [((807, 869), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.compat.v1.logging.set_verbosity', (['tf.compat.v1.logging.ERROR'], {}), '(tf.compat.v1.logging.ERROR)\n', (841, 869), True, 'import tensorflow as tf\n'), ((871, 909), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', (... |
import warnings
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
warnings.simplefilter(action='ignore', category=FutureWarning)
warnings.simplefilter(action='ignore', category=Warning)
import tensorflow as tf
import numpy as np
from pprint import pprint
import time
import platform
H=256
W=256
THREADS=4
# MODEL='flyi... | [
"warnings.simplefilter",
"numpy.ones",
"time.perf_counter",
"platform.platform",
"tensorflow.lite.Interpreter"
] | [((65, 127), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (86, 127), False, 'import warnings\n'), ((128, 184), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
from gym import spaces
import neurogym as ngym
import matplotlib.pyplot as plt
class CVLearning(ngym.TrialEnv):
r"""Implements shaping for the delay-response task, in which agents
have to integrate two stimuli and report which one is larger on... | [
"numpy.random.choice",
"numpy.abs",
"matplotlib.pyplot.close",
"numpy.empty",
"numpy.zeros",
"neurogym.utils.plot_env",
"gym.spaces.Discrete",
"numpy.mean",
"numpy.array",
"gym.spaces.Box",
"numpy.sign",
"numpy.sqrt"
] | [((13584, 13600), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (13593, 13600), True, 'import matplotlib.pyplot as plt\n'), ((13681, 13720), 'neurogym.utils.plot_env', 'ngym.utils.plot_env', (['env'], {'num_steps': '(200)'}), '(env, num_steps=200)\n', (13700, 13720), True, 'import neurogym a... |
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import sys
import collections
import warnings
import numpy as np
# If numba is installed, import jit. Otherwise, define an empty decorator with
# the same name.
try:
from numba import jit
except:
def j... | [
"numpy.log2",
"numpy.asarray",
"numpy.float",
"numpy.diff",
"numpy.arange"
] | [((1549, 1562), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (1559, 1562), True, 'import numpy as np\n'), ((1804, 1839), 'numpy.arange', 'np.arange', (['(0)', 'y.shape[0]', 'step_size'], {}), '(0, y.shape[0], step_size)\n', (1813, 1839), True, 'import numpy as np\n'), ((2303, 2321), 'numpy.asarray', 'np.asarray... |
"""Utility functions for posterior inference"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability import edward2 as ed
tfd = tfp.distributions
def make_value_setter(**model_kwargs):
"""Creates a value-setting interceptor for VI under Edward2."""
def... | [
"tensorflow_probability.edward2.interceptable",
"tensorflow.convert_to_tensor",
"tensorflow.eye",
"tensorflow.Session",
"tensorflow.matmul",
"tensorflow_probability.edward2.Normal",
"tensorflow_probability.bijectors.Sigmoid",
"tensorflow.tensordot",
"numpy.matmul",
"numpy.eye",
"numpy.linalg.pin... | [((2225, 2280), 'tensorflow.matmul', 'tf.matmul', (['Kzz_chol_inv', 'Kzz_chol_inv'], {'transpose_a': '(True)'}), '(Kzz_chol_inv, Kzz_chol_inv, transpose_a=True)\n', (2234, 2280), True, 'import tensorflow as tf\n'), ((2305, 2351), 'tensorflow.matmul', 'tf.matmul', (['Kxz', 'Kzz_chol_inv'], {'transpose_b': '(True)'}), '(... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ##... | [
"math.isnan",
"nibabel.load",
"datalad.log.log_progress",
"numpy.array",
"datalad.dochelpers.exc_str",
"numpy.asscalar",
"os.path.join",
"logging.getLogger"
] | [((474, 529), 'logging.getLogger', 'logging.getLogger', (['"""datalad.metadata.extractors.nifti1"""'], {}), "('datalad.metadata.extractors.nifti1')\n", (491, 529), False, 'import logging\n'), ((1972, 1983), 'numpy.array', 'np.array', (['(0)'], {}), '(0)\n', (1980, 1983), True, 'import numpy as np\n'), ((7525, 7626), 'd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.