code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# --------------------------------------------------------
# Motion R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, based on code by <NAME>
# --------------------------------------------------------
from __future__ import absolute_import, division, print_function
import numpy as n... | [
"tensorflow.train.Coordinator",
"numpy.random.seed",
"tensorflow.contrib.slim.get_variables_to_restore",
"numpy.argmax",
"numpy.allclose",
"layers.mask_util.binary_mask",
"tensorflow.local_variables_initializer",
"tensorflow.ConfigProto",
"tensorflow.multiply",
"tensorflow.Variable",
"sys.stdout... | [((12214, 12278), 'tensorflow.Variable', 'tf.Variable', (['value'], {'dtype': 'tf.float32', 'name': 'name', 'trainable': '(False)'}), '(value, dtype=tf.float32, name=name, trainable=False)\n', (12225, 12278), True, 'import tensorflow as tf\n'), ((12283, 12337), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['(pref... |
'''
FEN -> Similar to Forsyth–Edwards Notation in chess
Starting fen => "B3B/5/5/5/B3B G 0"
{"B3B/5/5/5/B3B"(similar to chess,"B" - Bagh, "G" - Goat)}
{"G" or "B" represents who has next move}
{"0" number of moves by goat}
PGN -> Portable Game Notation like in chess
Move to move trac... | [
"PIL.Image.new",
"os.path.dirname",
"numpy.zeros",
"PIL.Image.open",
"re.findall",
"os.chdir"
] | [((805, 839), 'os.path.dirname', 'os.path.dirname', (['baghchal.__file__'], {}), '(baghchal.__file__)\n', (820, 839), False, 'import os\n'), ((840, 857), 'os.chdir', 'os.chdir', (['BASEDIR'], {}), '(BASEDIR)\n', (848, 857), False, 'import os\n'), ((871, 906), 'PIL.Image.open', 'Image.open', (['"""images/board.png"""', ... |
##############################################################
# #
# <NAME> and <NAME> (2017) #
# Machine Learning for the Quantified Self #
# Springer #
# Chapter 5 ... | [
"pandas.DataFrame",
"numpy.multiply",
"sklearn.neighbors.DistanceMetric.get_metric",
"sklearn.metrics.pairwise.euclidean_distances",
"numpy.isnan",
"scipy.stats.norm.fit",
"scipy.stats.ks_2samp"
] | [((2856, 2895), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'index', 'columns': 'cols'}), '(index=index, columns=cols)\n', (2868, 2895), True, 'import pandas as pd\n'), ((3677, 3720), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'index', 'columns': 'new_cols'}), '(index=index, columns=new_cols)\n', (3689, ... |
from spear import *
import numpy.random as rnd
import matplotlib.pyplot as plt
import numpy
from statistics import mean
a = 0.5
az0 = 0.75
az12 = 0.75
az23 = 0.75
g = 9.81
t_step = 0.1 #duration of a tick in seconds
q_max = 6.0
q_step = q_max/5.0
q_med = q_max/2.0
l_max = 20.0
l_min = 0.0
l_goal =... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.std",
"statistics.mean",
"numpy.random.normal",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"numpy.sqrt"
] | [((5011, 5025), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (5023, 5025), True, 'import matplotlib.pyplot as plt\n'), ((5204, 5235), 'matplotlib.pyplot.title', 'plt.title', (['"""Standard deviation"""'], {}), "('Standard deviation')\n", (5213, 5235), True, 'import matplotlib.pyplot as plt\n'), ((523... |
# coding: utf-8
from PIL import Image
import numpy as np
def up_side_down(array):
up_side_down=[]
for i in range(len(array)-1,-1,-1):
up_side_down.append(array[i])
up_side_down=np.array(up_side_down)
up_side_down = Image.fromarray(up_side_down)
return up_side_down
def right_side_left(arra... | [
"PIL.Image.fromarray",
"numpy.array",
"PIL.Image.open"
] | [((934, 956), 'PIL.Image.open', 'Image.open', (['"""lena.bmp"""'], {}), "('lena.bmp')\n", (944, 956), False, 'from PIL import Image\n'), ((963, 977), 'numpy.array', 'np.array', (['lena'], {}), '(lena)\n', (971, 977), True, 'import numpy as np\n'), ((199, 221), 'numpy.array', 'np.array', (['up_side_down'], {}), '(up_sid... |
import os, time, sys
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from scipy.stats import bayes_mvs as bayesest
sys.path.insert(0, '../../PyEcoLib')
from simulator import Simulator
mean_size = 3 # micron
doubling_time = 18 #min
tmax = 180 #min
sample_time = 2 #min
div_steps = 10
ncells ... | [
"numpy.log",
"os.makedirs",
"pandas.read_csv",
"os.path.exists",
"sys.path.insert",
"numpy.var",
"time.time",
"numpy.random.gamma",
"numpy.min",
"numpy.mean",
"numpy.array",
"numpy.arange",
"numpy.max",
"matplotlib.pyplot.subplots_adjust",
"scipy.stats.bayes_mvs",
"matplotlib.pyplot.su... | [((144, 180), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../PyEcoLib"""'], {}), "(0, '../../PyEcoLib')\n", (159, 180), False, 'import os, time, sys\n'), ((605, 616), 'time.time', 'time.time', ([], {}), '()\n', (614, 616), False, 'import os, time, sys\n'), ((623, 754), 'simulator.Simulator', 'Simulator', ([],... |
import tensorflow as tf
import numpy as np
import pandas as pd
from pyfaidx import Fasta
from functools import partial
from random import randrange
# efficient way for one hot encoding DNA sequence from string
# modified from https://gist.github.com/hannes-brt/54ca5d4094b3d96237fa2e820c0945dd
embed = np.zeros([89, 4... | [
"functools.partial",
"pandas.read_csv",
"tensorflow.convert_to_tensor",
"tensorflow.nn.embedding_lookup",
"pyfaidx.Fasta",
"numpy.zeros",
"tensorflow.cast",
"numpy.array",
"tensorflow.data.Dataset.from_generator",
"tensorflow.name_scope"
] | [((305, 334), 'numpy.zeros', 'np.zeros', (['[89, 4]', 'np.float32'], {}), '([89, 4], np.float32)\n', (313, 334), True, 'import numpy as np\n'), ((353, 375), 'numpy.array', 'np.array', (['[1, 0, 0, 0]'], {}), '([1, 0, 0, 0])\n', (361, 375), True, 'import numpy as np\n'), ((394, 416), 'numpy.array', 'np.array', (['[0, 1,... |
"""
Implementation of the method proposed in the paper:
'Adversarial Attacks on Classification Models for Graphs'
by <NAME>, <NAME>, <NAME>, <NAME>
Published at ICML 2018 in Stockholm, Sweden.
Copyright (C) 2018
<NAME>
Technical University of Munich
"""
#import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LE... | [
"tensorflow.compat.v1.stack",
"tensorflow.compat.v1.zeros",
"numpy.sum",
"tensorflow.compat.v1.InteractiveSession",
"tensorflow.compat.v1.log",
"tensorflow.compat.v1.reduce_mean",
"tensorflow.compat.v1.data.Dataset.from_generator",
"tensorflow.compat.v1.matmul",
"tensorflow.compat.v1.get_variable_sc... | [((366, 390), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (388, 390), True, 'import tensorflow.compat.v1 as tf\n'), ((568, 610), 'tensorflow.compat.v1.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (592, 610), True, 'im... |
from abc import ABCMeta, abstractmethod
import logging
import numpy as np
from pygam import LogisticGAM, s
from sklearn.metrics import roc_auc_score as auc
from sklearn.linear_model import LogisticRegressionCV
from sklearn.model_selection import StratifiedKFold, train_test_split
import xgboost as xgb
logger = logging... | [
"numpy.logspace",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.roc_auc_score",
"pygam.s",
"sklearn.linear_model.LogisticRegressionCV",
"numpy.finfo",
"numpy.where",
"numpy.linspace",
"xgboost.XGBClassifier",
"logging.getLogger"
] | [((313, 342), 'logging.getLogger', 'logging.getLogger', (['"""causalml"""'], {}), "('causalml')\n", (330, 342), False, 'import logging\n'), ((6949, 6990), 'numpy.where', 'np.where', (['(p < 0 + eps)', '(0 + eps * 1.001)', 'p'], {}), '(p < 0 + eps, 0 + eps * 1.001, p)\n', (6957, 6990), True, 'import numpy as np\n'), ((6... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# HarmonicNet.
# Copyright (C) 2021 <NAME>, <NAME>, S.Koppers, <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 Liceense at
#
# http://www.a... | [
"numpy.maximum",
"csv.reader",
"numpy.ones",
"numpy.clip",
"numpy.mean",
"dataloader.augmenter.intensity_augmenter",
"os.path.join",
"numpy.pad",
"scipy.ndimage.distance_transform_edt",
"os.path.abspath",
"numpy.zeros_like",
"numpy.std",
"numpy.transpose",
"numpy.max",
"numpy.reshape",
... | [((3069, 3104), 'numpy.min', 'np.min', (["self.data_statistics['min']"], {}), "(self.data_statistics['min'])\n", (3075, 3104), True, 'import numpy as np\n'), ((3143, 3178), 'numpy.max', 'np.max', (["self.data_statistics['max']"], {}), "(self.data_statistics['max'])\n", (3149, 3178), True, 'import numpy as np\n'), ((321... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
LISTA_cpss_robust.py
author: xhchrn
<EMAIL>
date : 2018-09-07
Implementation of Learned ISTA with support selection and coupled weights like
in LAMP. With A and W given, we train a set of step sizes and thresholds that
are robust to small turbulence in A.
"""... | [
"tensorflow.abs",
"tensorflow.logical_and",
"tensorflow.contrib.distributions.percentile",
"tensorflow.stop_gradient",
"tensorflow.variable_scope",
"tensorflow.sign",
"numpy.clip",
"numpy.ones",
"tensorflow.multiply",
"tensorflow.matmul",
"tensorflow.zeros",
"numpy.arange",
"tensorflow.to_fl... | [((1078, 1093), 'tensorflow.abs', 'tf.abs', (['inputs_'], {}), '(inputs_)\n', (1084, 1093), True, 'import tensorflow as tf\n'), ((1109, 1185), 'tensorflow.contrib.distributions.percentile', 'tf.contrib.distributions.percentile', (['abs_', '(100.0 - q)'], {'axis': '(0)', 'keep_dims': '(True)'}), '(abs_, 100.0 - q, axis=... |
from torch import random
from replay_buffer import ReplayBuffer
import torch
import torch.optim as optim
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
import logging
import numpy as np
import random
from dqn import DQN
from replay_buffer import ReplayBuffer
class TrajectoryPlanner:
d... | [
"numpy.dstack",
"torch.nn.functional.mse_loss",
"dqn.DQN",
"logging.info",
"random.random",
"replay_buffer.ReplayBuffer",
"numpy.arange",
"torch.no_grad",
"torch.from_numpy"
] | [((1351, 1394), 'replay_buffer.ReplayBuffer', 'ReplayBuffer', (['buffer_size'], {'gpu': 'gpu', 'her': 'her'}), '(buffer_size, gpu=gpu, her=her)\n', (1363, 1394), False, 'from replay_buffer import ReplayBuffer\n'), ((1404, 1432), 'logging.info', 'logging.info', (['self.dqn_local'], {}), '(self.dqn_local)\n', (1416, 1432... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from image_processing.processing import denormalize_img
from scipy import stats
from scipy.signal import convolve2d
def get_most_frequent_color(data, return_count=False):
'''
Find the most frequent color in the arrays given. The color dimen... | [
"numpy.pad",
"numpy.load",
"numpy.quantile",
"numpy.abs",
"image_processing.processing.denormalize_img",
"scipy.signal.convolve2d",
"numpy.std",
"numpy.median",
"numpy.ones",
"numpy.mean",
"numpy.array",
"numpy.reshape",
"numpy.all"
] | [((876, 913), 'numpy.reshape', 'np.reshape', (['arr', '(-1, data.shape[-1])'], {}), '(arr, (-1, data.shape[-1]))\n', (886, 913), True, 'import numpy as np\n'), ((5806, 5833), 'numpy.std', 'np.std', (['images'], {'axis': '(1, 2)'}), '(images, axis=(1, 2))\n', (5812, 5833), True, 'import numpy as np\n'), ((8859, 8881), '... |
# -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
import pandas as pd
from src.utils.config import Config
from src.features import build_features
from dotenv import find_dotenv, load_dotenv
from sklearn.manifold import TSNE
import umap
from sklearn.decomposition import PCA
import numpy as np... | [
"pandas.DataFrame",
"sklearn.preprocessing.StandardScaler",
"logging.basicConfig",
"dotenv.find_dotenv",
"pandas.read_csv",
"sklearn.preprocessing.RobustScaler",
"pandas.merge",
"sklearn.manifold.TSNE",
"src.features.build_features.top_k_variance",
"click.command",
"umap.UMAP",
"pathlib.Path",... | [((5140, 5155), 'click.command', 'click.command', ([], {}), '()\n', (5153, 5155), False, 'import click\n'), ((549, 597), 'pandas.read_csv', 'pd.read_csv', (["(project_dir / 'data/raw/labels.csv')"], {}), "(project_dir / 'data/raw/labels.csv')\n", (560, 597), True, 'import pandas as pd\n'), ((620, 666), 'pandas.read_csv... |
# encoding: utf-8
#
# @Author: <NAME>, <NAME>
# @Date: Nov 15, 2021
# @Filename: field.py
# @License: BSD 3-Clause
# @Copyright: <NAME>, <NAME>
import astropy.units as u
import numpy as np
import pyphot
import progressbar
# import matplotlib.pyplot as plt
# from pyphot import unit
from astropy.io import fits
from ast... | [
"astropy.coordinates.SkyCoord",
"numpy.abs",
"astropy.io.fits.PrimaryHDU",
"pyphot.get_library",
"numpy.argmin",
"lvmdatasimulator.log.warning",
"os.path.isfile",
"lvmdatasimulator.log.info",
"astropy.io.fits.HDUList",
"os.path.join",
"astropy.io.fits.ImageHDU",
"numpy.append",
"spectres.spe... | [((22804, 22834), 'numpy.abs', 'np.abs', (["(properties['T'] - temp)"], {}), "(properties['T'] - temp)\n", (22810, 22834), True, 'import numpy as np\n'), ((22845, 22861), 'numpy.argmin', 'np.argmin', (['delta'], {}), '(delta)\n', (22854, 22861), True, 'import numpy as np\n'), ((23601, 23638), 'astroquery.gaia.Gaia.cone... |
import stk
from rdkit.Chem import AllChem as rdkit
import numpy as np
import itertools as it
from typing import List
from rdkit_tools import (
get_cavity_size,
get_windows,
get_max_diameter,
set_position,
)
from pymongo import MongoClient
import random
from pymongo.errors import DuplicateKeyError
import... | [
"pymongo.MongoClient",
"functools.partial",
"tqdm.tqdm",
"rdkit_tools.set_position",
"argparse.ArgumentParser",
"numpy.std",
"random.shuffle",
"os.environ.get",
"itertools.combinations",
"numpy.mean",
"rdkit_tools.get_windows",
"rdkit_tools.get_cavity_size",
"rdkit_tools.get_max_diameter",
... | [((1714, 1732), 'numpy.mean', 'np.mean', (['diff_sums'], {}), '(diff_sums)\n', (1721, 1732), True, 'import numpy as np\n'), ((2347, 2366), 'pymongo.MongoClient', 'MongoClient', (['db_url'], {}), '(db_url)\n', (2358, 2366), False, 'from pymongo import MongoClient\n'), ((2623, 2639), 'rdkit_tools.get_windows', 'get_windo... |
# import unittest
from testinfrastructure.InDirTest import InDirTest
import numpy as np
from sympy import symbols, Matrix
from CompartmentalSystems.smooth_reservoir_model import SmoothReservoirModel
from CompartmentalSystems.smooth_model_run import SmoothModelRun
from CompartmentalSystems.smooth_model_run_14C import S... | [
"CompartmentalSystems.pwc_model_run_14C.PWCModelRun_14C",
"sympy.symbols",
"numpy.allclose",
"CompartmentalSystems.pwc_model_run_fd.PWCModelRunFD.from_gross_fluxes",
"sympy.Matrix",
"CompartmentalSystems.smooth_model_run_14C.SmoothModelRun_14C",
"CompartmentalSystems.discrete_model_run.DiscreteModelRun.... | [((765, 781), 'sympy.symbols', 'symbols', (['"""x y t"""'], {}), "('x y t')\n", (772, 781), False, 'from sympy import symbols, Matrix\n'), ((805, 819), 'sympy.Matrix', 'Matrix', (['[x, y]'], {}), '([x, y])\n', (811, 819), False, 'from sympy import symbols, Matrix\n'), ((832, 862), 'sympy.Matrix', 'Matrix', (['[[-1, 1.5... |
# -*- coding: utf-8 -*-
"""
pysteps.decorators
==================
Decorators used to define reusable building blocks that can change or extend
the behavior of some functions in pysteps.
.. autosummary::
:toctree: ../generated/
postprocess_import
check_input_frames
prepare_interpolator
memoize
"""... | [
"numpy.ma.getmaskarray",
"numpy.zeros",
"numpy.ones",
"numpy.isfinite",
"collections.defaultdict",
"uuid.uuid1",
"functools.wraps",
"numpy.array_split",
"inspect.cleandoc"
] | [((781, 820), 'inspect.cleandoc', 'inspect.cleandoc', (['extra_kwargs_doc_text'], {}), '(extra_kwargs_doc_text)\n', (797, 820), False, 'import inspect\n'), ((847, 884), 'inspect.cleandoc', 'inspect.cleandoc', (['target_func.__doc__'], {}), '(target_func.__doc__)\n', (863, 884), False, 'import inspect\n'), ((986, 1037),... |
# A class for generating minibatches. Uses sampling without
# replacement. Returns batches of indices for each minibatch.
import numpy as np
class batch_gen(object):
def __init__(self, batch_size, num_indices, distribution=None,
replace=False, max_batches=-1):
self.batch_size = batch_siz... | [
"numpy.array",
"numpy.random.choice"
] | [((841, 928), 'numpy.random.choice', 'np.random.choice', (['self.indices', 'self.batch_size'], {'replace': '(True)', 'p': 'self.distribution'}), '(self.indices, self.batch_size, replace=True, p=self.\n distribution)\n', (857, 928), True, 'import numpy as np\n'), ((1032, 1054), 'numpy.array', 'np.array', (['self.indi... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import unittest, os
from unittest.case import skip
import numpy as np
from pyis.python import ops
from pyis.python import save, load
# @unittest.skip("local dependencies and already verified")
# class TestOrtSessionWithCust... | [
"unittest.main",
"pyis.python.load",
"pyis.python.save",
"os.path.dirname",
"pyis.python.ops.OrtSession.initialize_ort",
"numpy.array",
"pyis.python.ops.OrtSession"
] | [((2298, 2313), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2311, 2313), False, 'import unittest, os\n'), ((1245, 1276), 'pyis.python.ops.OrtSession.initialize_ort', 'ops.OrtSession.initialize_ort', ([], {}), '()\n', (1274, 1276), False, 'from pyis.python import ops\n'), ((1438, 1535), 'pyis.python.ops.OrtSess... |
import numpy as np
import torch
import torch.distributions as td
import torch.nn as nn
class ObservationEncoder(nn.Module):
def __init__(self, depth=2, stride=2, shape=(3, 64, 64), activation=nn.ReLU, padding=1):
super().__init__()
self.convolutions = nn.Sequential(
nn.Conv2d(shape[0],... | [
"torch.reshape",
"torch.nn.Conv2d",
"torch.nn.ConvTranspose2d",
"numpy.prod"
] | [((774, 814), 'torch.reshape', 'torch.reshape', (['embed', '(*batch_shape, -1)'], {}), '(embed, (*batch_shape, -1))\n', (787, 814), False, 'import torch\n'), ((2707, 2758), 'torch.reshape', 'torch.reshape', (['x', '(squeezed_size, *self.conv_shape)'], {}), '(x, (squeezed_size, *self.conv_shape))\n', (2720, 2758), False... |
from __future__ import print_function
import argparse
import os
import sys
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
from sklearn.linear_model impor... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"torchvision.datasets.CIFAR10",
"numpy.arange",
"numpy.exp",
"models.densenet.DenseNet3",
"torchvision.transforms.Normalize",
"os.path.join",
"torch.utils.data.DataLoader",
"utils.metric",
"os.path.exists",
"torchvision.transforms.ToPILImage",
... | [((653, 762), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Pytorch Detecting Out-of-distribution examples in neural networks"""'}), "(description=\n 'Pytorch Detecting Out-of-distribution examples in neural networks')\n", (676, 762), False, 'import argparse\n'), ((1801, 1821), 'torc... |
import numpy as np
from sklearn.metrics import pairwise_distances
class KMeans:
'''
K-Means clustering algorithm using euclidean and mahalanobis distance
'''
def __init__(self, n_clusters, max_iterations=200, distance='euclidean', seed=2):
'''
Inputs:
- n_clusters... | [
"numpy.random.seed",
"numpy.ravel",
"sklearn.metrics.pairwise_distances",
"numpy.argmin",
"numpy.random.randint",
"numpy.array",
"numpy.mean",
"numpy.where",
"numpy.linalg.inv",
"numpy.dot"
] | [((931, 956), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (945, 956), True, 'import numpy as np\n'), ((1072, 1121), 'numpy.random.randint', 'np.random.randint', (['(0)', 'num_points', 'self.n_clusters'], {}), '(0, num_points, self.n_clusters)\n', (1089, 1121), True, 'import numpy as np\... |
import math
import collections
import numpy as np
import pandas as pd
import scipy
import scipy.stats
import remixt.utils
import remixt.likelihood
import remixt.analysis.experiment
import remixt.simulations.balanced
MAX_SEED = 2**32
class RearrangedGenome(object):
""" Rearranged genome with stored history.
... | [
"numpy.absolute",
"numpy.random.seed",
"numpy.sum",
"numpy.random.negative_binomial",
"numpy.argsort",
"numpy.random.randint",
"numpy.random.normal",
"pandas.DataFrame",
"scipy.misc.logsumexp",
"numpy.random.poisson",
"numpy.random.choice",
"collections.Counter",
"numpy.random.shuffle",
"n... | [((39057, 39081), 'numpy.where', 'np.where', (['is_0', 'x_0', 'x_1'], {}), '(is_0, x_0, x_1)\n', (39065, 39081), True, 'import numpy as np\n'), ((39147, 39181), 'numpy.random.beta', 'np.random.beta', (['(M * p)', '(M * (1 - p))'], {}), '(M * p, M * (1 - p))\n', (39161, 39181), True, 'import numpy as np\n'), ((39190, 39... |
import logging
import os
import numpy as np
import pandas as pd
import torch
from torch.utils.data import TensorDataset, DataLoader, SequentialSampler, RandomSampler
from setting import data_path
from utils.helper import Scaler
class TrafficDataset:
def __init__(self, path, train_prop, valid_prop,
... | [
"numpy.stack",
"numpy.load",
"torch.utils.data.DataLoader",
"torch.utils.data.RandomSampler",
"numpy.zeros",
"numpy.expand_dims",
"numpy.transpose",
"logging.info",
"numpy.savez_compressed",
"numpy.timedelta64",
"torch.utils.data.SequentialSampler",
"numpy.tile",
"utils.helper.Scaler",
"os... | [((416, 463), 'logging.info', 'logging.info', (['"""initialize %s DataWrapper"""', 'path'], {}), "('initialize %s DataWrapper', path)\n", (428, 463), False, 'import logging\n'), ((865, 897), 'logging.info', 'logging.info', (['"""initialize graph"""'], {}), "('initialize graph')\n", (877, 897), False, 'import logging\n'... |
import numpy as np
from aegis.panconfiguration import pan
class Environment:
"""Modifier of fitness landscape
Modifies topology of fitness landscape over time by changing the interpretation of zeros and ones in genomes.
"""
def __init__(self, gstruc_shape, ENVIRONMENT_CHANGE_RATE):
if ENVI... | [
"aegis.panconfiguration.pan.skip",
"numpy.logical_xor",
"numpy.zeros",
"aegis.panconfiguration.pan.rng.integers"
] | [((445, 473), 'numpy.zeros', 'np.zeros', (['gstruc_shape', 'bool'], {}), '(gstruc_shape, bool)\n', (453, 473), True, 'import numpy as np\n'), ((691, 725), 'numpy.logical_xor', 'np.logical_xor', (['self.map_', 'genomes'], {}), '(self.map_, genomes)\n', (705, 725), True, 'import numpy as np\n'), ((817, 855), 'aegis.panco... |
"""
cube.py
Read a cube file to an array for manipulation. Use the translational symmtry of
a supercell to average a cube file into a smaller subsection, eg the unit cell.
The number of grid points must be exactly divisible by the folding factors, FX
FY FZ.
Modified version for faps, provides Cube object.
"""
impor... | [
"numpy.sum",
"bz2.BZ2File",
"numpy.mean",
"numpy.linalg.norm",
"glob.glob",
"numpy.prod",
"logging.error",
"numpy.std",
"numpy.ndim",
"numpy.dot",
"numpy.matrix",
"scipy.ndimage.filters.gaussian_filter",
"scipy.ndimage.morphology.binary_erosion",
"logging.debug",
"scipy.ndimage.filters.m... | [((961, 970), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (967, 970), True, 'import numpy as np\n'), ((997, 1009), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1005, 1009), True, 'import numpy as np\n'), ((8345, 8363), 'numpy.linalg.norm', 'norm', (['self.cell[0]'], {}), '(self.cell[0])\n', (8349, 8363), Fals... |
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import *
from tensorflow.keras.layers import *
class SingleAttention(Layer):
def __init__(self, d_k, d_v):
super(SingleAttention, self).__init__()
self.d_k = d_k
self.d_v = d_v
def build(self, input_shape):
self.query = Dense... | [
"tensorflow.matmul",
"tensorflow.nn.softmax",
"tensorflow.concat",
"numpy.sqrt"
] | [((1005, 1038), 'tensorflow.matmul', 'tf.matmul', (['q', 'k'], {'transpose_b': '(True)'}), '(q, k, transpose_b=True)\n', (1014, 1038), True, 'import tensorflow as tf\n'), ((1132, 1168), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['attn_weights'], {'axis': '(-1)'}), '(attn_weights, axis=-1)\n', (1145, 1168), True, 'impo... |
from plug_nozzle_angelino import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy import interpolate
from scipy import optimize
import numpy as np
import gasdynamics as gd
from matplotlib import cm
import copy
#### MOC DESCRIPTION
class chr_point():
def __init__(self,gamma,x,... | [
"gasdynamics.prandtl_meyer",
"numpy.abs",
"numpy.ones",
"numpy.isnan",
"numpy.sin",
"numpy.unique",
"gasdynamics.mach_angle",
"gasdynamics.PR_expansion_mach",
"numpy.append",
"numpy.tan",
"numpy.linspace",
"scipy.interpolate.splrep",
"numpy.trapz",
"scipy.interpolate.griddata",
"gasdynam... | [((916, 946), 'matplotlib.pyplot.plot', 'plt.plot', (['self.x', 'self.y', '"""bx"""'], {}), "(self.x, self.y, 'bx')\n", (924, 946), True, 'import matplotlib.pyplot as plt\n'), ((953, 988), 'matplotlib.pyplot.plot', 'plt.plot', (['self.x', '(self.y * -1)', '"""bx"""'], {}), "(self.x, self.y * -1, 'bx')\n", (961, 988), T... |
#coding:utf-8
import numpy as np
from pylab import *
"""4.1.4 フィッシャーの線形判別(p.185)"""
N = 100 # データ数
def f(x, a, b):
return a * x + b
if __name__ == "__main__":
# 訓練データを作成
cls1 = []
cls2 = []
# データは正規分布に従って生成
mean1 = [1, 3] # クラス1の平均
mean2 = [3, 1] # クラス2の平均
cov = [[2.0,0.0], [0.0,... | [
"numpy.mean",
"numpy.array",
"numpy.linalg.inv",
"numpy.random.multivariate_normal",
"numpy.linspace"
] | [((518, 539), 'numpy.mean', 'np.mean', (['cls1'], {'axis': '(0)'}), '(cls1, axis=0)\n', (525, 539), True, 'import numpy as np\n'), ((549, 570), 'numpy.mean', 'np.mean', (['cls2'], {'axis': '(0)'}), '(cls2, axis=0)\n', (556, 570), True, 'import numpy as np\n'), ((1008, 1025), 'numpy.linalg.inv', 'np.linalg.inv', (['Sw']... |
import json
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import sys
def unistring(s):
"""Encodes our Unicode string to ASCII, then back to Unicode.
In the translation, we ignore all unknown characters, which removes
all of the non-ASCII characters that break our strin... | [
"numpy.poly1d",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.polyfit",
"numpy.arange"
] | [((1558, 1609), 'numpy.polyfit', 'np.polyfit', ([], {'x': 'data_dict[x]', 'y': 'data_dict[y]', 'deg': 'deg'}), '(x=data_dict[x], y=data_dict[y], deg=deg)\n', (1568, 1609), True, 'import numpy as np\n'), ((2094, 2111), 'numpy.poly1d', 'np.poly1d', (['coeffs'], {}), '(coeffs)\n', (2103, 2111), True, 'import numpy as np\n... |
import unittest
from action.watermark import watermarkImage, watermarkText
import cv2 as cv
import numpy as np
class WatermarkTest((unittest.TestCase)):
@classmethod
def setUpClass(self):
self.testImage = cv.imread('examples/img1.jpg')
self.watermarkLogo = cv.imread('examples/wm-logo.png')
... | [
"numpy.any",
"cv2.imread",
"action.watermark.watermarkText",
"action.watermark.watermarkImage"
] | [((223, 253), 'cv2.imread', 'cv.imread', (['"""examples/img1.jpg"""'], {}), "('examples/img1.jpg')\n", (232, 253), True, 'import cv2 as cv\n'), ((283, 316), 'cv2.imread', 'cv.imread', (['"""examples/wm-logo.png"""'], {}), "('examples/wm-logo.png')\n", (292, 316), True, 'import cv2 as cv\n'), ((410, 460), 'action.waterm... |
import sys, os
import numpy as np
from .EQ_kernel import *
import scipy.linalg as spalg
import scipy as scipy
import pprint as pp
import time
from .tools import *
from scipy.cluster.vq import vq, kmeans2
from scipy.spatial.distance import cdist
class FITC_network:
def __init__(self, Ntrain, layer_sizes, no_pseu... | [
"scipy.linalg.solve",
"numpy.sum",
"numpy.argmax",
"numpy.ones",
"numpy.exp",
"numpy.copy",
"numpy.random.randn",
"numpy.std",
"numpy.reshape",
"numpy.linspace",
"scipy.spatial.distance.cdist",
"numpy.median",
"numpy.triu_indices",
"numpy.diag_indices",
"scipy.cluster.vq.kmeans2",
"num... | [((6165, 6183), 'numpy.zeros', 'np.zeros', (['(Douti,)'], {}), '((Douti,))\n', (6173, 6183), True, 'import numpy as np\n'), ((6201, 6219), 'numpy.zeros', 'np.zeros', (['(Douti,)'], {}), '((Douti,))\n', (6209, 6219), True, 'import numpy as np\n'), ((6267, 6285), 'numpy.exp', 'np.exp', (['(2.0 * sf_i)'], {}), '(2.0 * sf_... |
import torch
import numpy as np
def create_1toN_adj(n):
a = np.zeros((n,n))
a[0].fill(1)
a[:,0].fill(1)
# a[0,0] = 0.0
return torch.tensor(a, requires_grad=False)
def create_fc_adj(n):
# return torch.ones(n,n)
return torch.ones(n,n)-torch.eye(n) | [
"torch.ones",
"torch.eye",
"numpy.zeros",
"torch.tensor"
] | [((66, 82), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (74, 82), True, 'import numpy as np\n'), ((148, 184), 'torch.tensor', 'torch.tensor', (['a'], {'requires_grad': '(False)'}), '(a, requires_grad=False)\n', (160, 184), False, 'import torch\n'), ((248, 264), 'torch.ones', 'torch.ones', (['n', 'n'], {}... |
import numpy as np
import json
import os
import copy
import math
RANDOM_SEED = 626
np.random.seed(RANDOM_SEED)
def demo_postprocess(QAList, selected_video_ids = [], show_shuffle = True):
if QAList is None or len(QAList) == 0:
print('QA List is null.')
return None
# select
if selected_vide... | [
"copy.deepcopy",
"numpy.random.seed",
"numpy.std",
"json.dumps",
"numpy.array",
"numpy.random.permutation",
"math.log"
] | [((84, 111), 'numpy.random.seed', 'np.random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (98, 111), True, 'import numpy as np\n'), ((5182, 5252), 'numpy.array', 'np.array', (['[statistic[key] for key in statistic if statistic[key] != 0]'], {}), '([statistic[key] for key in statistic if statistic[key] != 0])\n', (5... |
# Initial crack at an ABM for predicting vaccine strategies for COVID-19
import numpy as np
# import pandas as pd
# Objects:
class universe:
def __init__(self, cName = "Untitled", nSize=1000):
self.nSize = nSize
self.cName = cName
self.nDays = 0
self.nAlive = self.nSize
sel... | [
"numpy.random.randint"
] | [((2137, 2158), 'numpy.random.randint', 'np.random.randint', (['(12)'], {}), '(12)\n', (2154, 2158), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 19:31:51 2020
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import learning_curve
from sklearn.tree import DecisionTreeClassifier
from sklearn.datasets import load_iris
def plot_learning_curve(estimat... | [
"matplotlib.pyplot.title",
"sklearn.datasets.load_iris",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"sklearn.tree.DecisionTreeClassifier",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"m... | [((3432, 3443), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (3441, 3443), False, 'from sklearn.datasets import load_iris\n'), ((3545, 3583), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {'random_state': '(0)'}), '(random_state=0)\n', (3567, 3583), False, 'from sklearn.tree impo... |
import argparse
import os
import re
import sys
parser = argparse.ArgumentParser()
parser.add_argument(
"in_dir"
)
parser.add_argument(
"out_dir"
)
parser.add_argument(
"--length",
type=int,
default=64000
)
parser.add_argument(
"--sample_rate",
type=int,
default=16000
)
parser.add_argument(
"--pitch"... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.path.isdir",
"librosa.util.normalize",
"numpy.zeros",
"re.match",
"librosa.load",
"os.path.splitext",
"soundfile.write",
"sys.stderr.flush",
"os.path.join",
"os.listdir"
] | [((57, 82), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (80, 82), False, 'import argparse\n'), ((513, 531), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (529, 531), False, 'import sys\n'), ((563, 603), 're.match', 're.match', (['"""^(.*?)((?:\\\\.[^.]*)*)$"""', 'name'], {}), "('... |
#!/usr/bin/python
# Author: <NAME>
# All rights reserved
#import calendar;
#import fileinput;
from makeAzo import *;
import math;
import numpy;
import os;
#from pxfuncs import *;
import pylab;
import re;
import scipy;
import shutil;
import subprocess;
#import sys;
#import time;
def adjustPhase(radar_path, wavel... | [
"fnmatch.filter",
"subprocess.Popen",
"numpy.size",
"os.mkdir",
"os.readlink",
"os.getcwd",
"numpy.fromfile",
"os.path.isdir",
"os.walk",
"os.path.exists",
"scipy.matrix",
"subprocess.call",
"os.chdir",
"glob.glob",
"shutil.rmtree",
"os.symlink",
"re.search",
"os.listdir"
] | [((782, 825), 'scipy.matrix', 'scipy.matrix', (['radar_unw_data', 'scipy.float32'], {}), '(radar_unw_data, scipy.float32)\n', (794, 825), False, 'import scipy\n'), ((993, 1004), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1002, 1004), False, 'import os\n'), ((1036, 1072), 'glob.glob', 'glob.glob', (["(path + '/int*/*_... |
from __future__ import annotations
from typing import Sequence, TYPE_CHECKING
from dataclasses import field, dataclass
from anndata import AnnData
import numpy as np
from squidpy.im import ImageContainer # type: ignore[attr-defined]
from squidpy._utils import NDArrayA, _unique_order_preserving
from squidpy.gr._uti... | [
"squidpy._constants._constants.Symbol",
"squidpy._utils._unique_order_preserving",
"squidpy.gr._utils._assert_spatial_basis",
"squidpy.pl._utils.ALayer",
"squidpy.gr._utils._assert_categorical_obs",
"numpy.insert",
"dataclasses.field",
"squidpy._constants._pkg_constants.Key.uns.spot_diameter"
] | [((795, 838), 'dataclasses.field', 'field', ([], {'default': 'Key.obsm.spatial', 'repr': '(False)'}), '(default=Key.obsm.spatial, repr=False)\n', (800, 838), False, 'from dataclasses import field, dataclass\n'), ((1015, 1043), 'dataclasses.field', 'field', ([], {'default': '(0)', 'init': '(False)'}), '(default=0, init=... |
# this file contains functions required for loading the data for training or evaluation
import numpy as np
from flags import *
from os import listdir
import torch
import h5py
def load_dataset():
# loading data
if (DATASET == 'moving_mnist'):
dataset = data_moving_mnist(DATA_PATH)
elif (DATASET == 'ds... | [
"h5py.File",
"os.listdir",
"numpy.reshape",
"numpy.load"
] | [((546, 564), 'os.listdir', 'listdir', (['DATA_PATH'], {}), '(DATA_PATH)\n', (553, 564), False, 'from os import listdir\n'), ((1056, 1076), 'h5py.File', 'h5py.File', (['file', '"""r"""'], {}), "(file, 'r')\n", (1065, 1076), False, 'import h5py\n'), ((581, 603), 'numpy.load', 'np.load', (['(DATA_PATH + f)'], {}), '(DATA... |
"""The evaluation module of deterior
This module provides methods to validate a trained models and
cross-validate models on given dataset.
"""
from itertools import chain
from collections import namedtuple
import sys
import numpy as np
from .models import Model
from .dataset import Record
from .training import prepar... | [
"numpy.set_printoptions",
"numpy.sum",
"collections.namedtuple",
"itertools.chain",
"numpy.random.shuffle",
"numpy.sqrt"
] | [((362, 425), 'collections.namedtuple', 'namedtuple', (['"""Reulst"""', "['expect', 'actual', 'var', 'std', 'err']"], {}), "('Reulst', ['expect', 'actual', 'var', 'std', 'err'])\n", (372, 425), False, 'from collections import namedtuple\n'), ((647, 664), 'numpy.sum', 'np.sum', (['(diff ** 2)'], {}), '(diff ** 2)\n', (6... |
import numpy as np
import pickle
import tensorflow as tf
from time import time
from evaluate import evaluate_model, evaluate_model_recall_precision
class MF():
def __init__(self, rating_matrix):
#### 參數設定
self.num_u = rating_matrix.shape[0] # 5551
self.num_v = rating_matrix.shape[1] # 169... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.resize",
"evaluate.evaluate_model",
"numpy.ones",
"tensorflow.matmul",
"pickle.load",
"numpy.random.normal",
"numpy.linalg.pinv",
"numpy.mat",
"tensorflow.placeholder",
"tensorflow.nn.l2_loss",
"numpy.random.binomial",
"tensorflow.glob... | [((10047, 10064), 'numpy.random.seed', 'np.random.seed', (['(5)'], {}), '(5)\n', (10061, 10064), True, 'import numpy as np\n'), ((10113, 10160), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run CDL."""'}), "(description='Run CDL.')\n", (10136, 10160), False, 'import argparse\n'), ((195... |
import tensorflow as tf
import numpy as np
import json
import soundfile as sf
import os
import argparse
def nsynth_generator(tfrecords):
for serialized_example in tf.python_io.tf_record_iterator(tfrecords):
example = tf.train.Example()
example.ParseFromString(serialized_example)
f = exampl... | [
"json.dump",
"argparse.ArgumentParser",
"os.makedirs",
"tensorflow.train.Example",
"os.path.exists",
"numpy.array",
"soundfile.write",
"os.path.join",
"tensorflow.python_io.tf_record_iterator"
] | [((169, 211), 'tensorflow.python_io.tf_record_iterator', 'tf.python_io.tf_record_iterator', (['tfrecords'], {}), '(tfrecords)\n', (200, 211), True, 'import tensorflow as tf\n'), ((1583, 1608), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1606, 1608), False, 'import argparse\n'), ((231, 249),... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021-2022 the DerivX authors
# All rights reserved.
#
# The project sponsor and lead author is <NAME>.
# E-mail: <EMAIL>, QQ: 277195007, WeChat: ustc_xrd
# See the contributors file for names of other contributors.
#
# Commercial use of this code in source and binary forms is
#... | [
"matplotlib.pyplot.title",
"numpy.maximum",
"matplotlib.pyplot.subplot2grid",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.set_printoptions",
"numpy.random.poisson",
"numpy.linalg.cholesky",
"matplotlib.pyplot.show",
"numpy.random.standard_normal",
"matplotlib.pyplot.subplots_adjust",
"nump... | [((816, 850), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (835, 850), True, 'import numpy as np\n'), ((865, 902), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (884, 902), True, 'import numpy as np\n'), ((1... |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 21:48:04 2020
@author: <NAME>
Creates elements of Figs. 5 and 7 (results) from the PPSN 2020 paper.
"""
import os
import csv
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import rcParams
import seaborn as sns; sns.set(color_codes... | [
"csv.reader",
"os.path.join",
"matplotlib.pyplot.ylim",
"numpy.zeros",
"numpy.hstack",
"StandardTestFunctions.get_M2_pareto_front",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.max",
"StandardTestFunctions.get_function_definition",
"matplotlib.pyplot.ylabel"... | [((301, 326), 'seaborn.set', 'sns.set', ([], {'color_codes': '(True)'}), '(color_codes=True)\n', (308, 326), True, 'import seaborn as sns\n'), ((390, 413), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (403, 413), True, 'import matplotlib.pyplot as plt\n'), ((680, 717), 'Standa... |
#encoding:utf-8
import torch
import numpy as np
import torch.nn as nn
from functools import reduce
from torch.nn import Module, Softmax, Parameter
from .customize import PyramidPooling
__all__ = ['AttGate1', 'AttGate2', 'AttGate3', 'AttGate3a', 'AttGate3b', 'AttGate4c', 'AttGate5c', 'AttGate6', 'AttGate9']
# class At... | [
"torch.mean",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.ReLU",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"numpy.log2",
"torch.nn.Conv2d",
"torch.nn.Conv1d",
"torch.cat",
"torch.nn.BatchNorm1d",
"torch.nn.BatchNorm2d",
"torch.nn.Softmax",
"torch.nn.Linear",
"functools.reduce",
"torch.su... | [((1921, 1949), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1, 1)'], {}), '((1, 1))\n', (1941, 1949), True, 'import torch.nn as nn\n'), ((3061, 3089), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(1, 1)'], {}), '((1, 1))\n', (3081, 3089), True, 'import torch.nn as nn\n'), ((3345, 3362), 'torch... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | [
"numpy.array",
"qiskit.QuantumCircuit"
] | [((1266, 1312), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['qubit.register', 'clbit.register'], {}), '(qubit.register, clbit.register)\n', (1280, 1312), False, 'from qiskit import QuantumCircuit\n'), ((1960, 1990), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['qubit.register'], {}), '(qubit.register)\n', (1974, 1990)... |
from argparse import ArgumentParser
from typing import Any, Dict
from typing import Tuple
import os
import numpy as np
from sklearn.datasets import dump_svmlight_file
def generate_dummy_data(
num_queries: int, results_len: int, num_labels: int, num_features: int) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:... | [
"os.makedirs",
"argparse.ArgumentParser",
"numpy.random.randint",
"numpy.arange",
"numpy.random.rand",
"os.path.join"
] | [((403, 458), 'numpy.random.rand', 'np.random.rand', (['(num_queries * results_len)', 'num_features'], {}), '(num_queries * results_len, num_features)\n', (417, 458), True, 'import numpy as np\n'), ((467, 530), 'numpy.random.randint', 'np.random.randint', (['(0)', '(num_labels - 1)', '(num_queries * results_len)'], {})... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
"""Invert a block diagonal covariance matrix.
"""
import os
import re
import sys
import argparse
impor... | [
"os.remove",
"traceback.format_exception",
"toast.mpi.get_world",
"argparse.ArgumentParser",
"toast.map.covariance_invert",
"toast.map.DistPixels",
"re.match",
"os.path.isfile",
"numpy.arange",
"sys.exc_info",
"healpy.read_map",
"toast.dist.distribute_uniform",
"toast.utils.Logger.get",
"n... | [((558, 570), 'toast.utils.Logger.get', 'Logger.get', ([], {}), '()\n', (568, 570), False, 'from toast.utils import Logger\n'), ((585, 674), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Read a toast covariance matrix and invert it."""'}), "(description=\n 'Read a toast covariance ma... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 15 17:32:44 2020
@author: pengning
"""
import numpy as np
import mpmath
from mpmath import mp
import sys
sys.path.append('../')
from dualbound.Arnoldi.spherical_multiRegion_Green_Arnoldi import spherical_multiRegion_Green_Arnoldi_Mmn_Uconverge, s... | [
"dualbound.Lagrangian.spatialProjopt_Zops_numpy.get_ZTT_mineig",
"numpy.abs",
"dualbound.Lagrangian.spatialProjopt_dualgradHess_fullSvec_numpy.get_inc_spatialProj_dualgradHess_fullS",
"sys.path.append",
"numpy.zeros_like",
"dualbound.Lagrangian.spatialProjopt_feasiblept.spatialProjopt_find_feasiblept",
... | [((178, 200), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (193, 200), False, 'import sys\n'), ((10902, 11031), 'dualbound.Optimization.modSource_opt.modS_opt', 'modS_opt', (['Lags[include]', 'S1list', 'dgHfunc', 'mineigfunc'], {'opttol': 'opttol', 'modSratio': 'modSratio', 'check_iter_period... |
"""
Script to make training dataset for 6*6
"""
# %%
import os,sys
from numpy.lib.npyio import save
import vtk,vtktools
import u2r
import numpy as np
import matplotlib.pyplot as plt
import random
from nirom_dd_tools import *
import copy
### MY version of nirom_dd_orig.py for Buildings Case Time Dependent Data
# som... | [
"numpy.amin",
"matplotlib.pyplot.figure",
"numpy.rot90",
"numpy.sin",
"matplotlib.pyplot.tight_layout",
"random.randint",
"matplotlib.pyplot.close",
"numpy.transpose",
"numpy.max",
"numpy.radians",
"numpy.save",
"matplotlib.pyplot.legend",
"vtktools.vtu",
"numpy.cos",
"matplotlib.pyplot.... | [((8647, 8669), 'numpy.array', 'np.array', (['(0.01, 0.01)'], {}), '((0.01, 0.01))\n', (8655, 8669), True, 'import numpy as np\n'), ((9010, 9032), 'vtktools.vtu', 'vtktools.vtu', (['filename'], {}), '(filename)\n', (9022, 9032), False, 'import vtk, vtktools\n'), ((9701, 9732), 'numpy.zeros', 'np.zeros', (['(nEl * nloc)... |
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import pyeparse as pp
fname = '../pyeparse/tests/data/test_raw.edf'
raw = pp.read_raw(fname)
# visualize initial calibration
raw.plot_calibration(title='5-Point Calibration')
# create heatmap
raw.plot_heatma... | [
"matplotlib.pyplot.show",
"pyeparse.read_raw",
"pyeparse.Epochs",
"numpy.isnan",
"matplotlib.pyplot.subplots"
] | [((185, 203), 'pyeparse.read_raw', 'pp.read_raw', (['fname'], {}), '(fname)\n', (196, 203), True, 'import pyeparse as pp\n'), ((466, 536), 'pyeparse.Epochs', 'pp.Epochs', (['raw'], {'events': 'events', 'event_id': 'event_id', 'tmin': 'tmin', 'tmax': 'tmax'}), '(raw, events=events, event_id=event_id, tmin=tmin, tmax=tma... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import scipy.io
import torch
import torch.nn as nn
import numpy as np
from glob import glob
import scipy.misc as sic
import subprocess
import models.network as net
import argparse
import ra... | [
"numpy.absolute",
"numpy.random.seed",
"argparse.ArgumentParser",
"models.network.UNet",
"numpy.tile",
"torch.device",
"glob.glob",
"torch.no_grad",
"torch.nn.MSELoss",
"models.network",
"vgg.VGG19",
"random.seed",
"numpy.less",
"subprocess.Popen",
"torch.manual_seed",
"imageio.imread"... | [((372, 397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (395, 397), False, 'import argparse\n'), ((1280, 1300), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1294, 1300), True, 'import numpy as np\n'), ((1301, 1324), 'torch.manual_seed', 'torch.manual_seed', (['seed']... |
# 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.ndenumerate",
"numpy.empty",
"numpy.zeros",
"numpy.array",
"numpy.eye",
"mindspore.dataset.GraphData"
] | [((1483, 1502), 'numpy.empty', 'np.empty', (['adj.shape'], {}), '(adj.shape)\n', (1491, 1502), True, 'import numpy as np\n'), ((1726, 1748), 'mindspore.dataset.GraphData', 'ds.GraphData', (['data_dir'], {}), '(data_dir)\n', (1738, 1748), True, 'import mindspore.dataset as ds\n'), ((2240, 2290), 'numpy.zeros', 'np.zeros... |
import cv2
import numpy as np
o = cv2.imread(r"..\lena.jpg", cv2.IMREAD_UNCHANGED)
kernel = np.ones((9, 9), np.uint8)
erosion = cv2.erode(o, kernel, iterations=5)
cv2.imshow("original", o)
cv2.imshow("erosion", erosion)
cv2.waitKey()
cv2.destroyAllWindows()
| [
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.ones",
"cv2.imread",
"cv2.erode",
"cv2.imshow"
] | [((35, 83), 'cv2.imread', 'cv2.imread', (['"""..\\\\lena.jpg"""', 'cv2.IMREAD_UNCHANGED'], {}), "('..\\\\lena.jpg', cv2.IMREAD_UNCHANGED)\n", (45, 83), False, 'import cv2\n'), ((93, 118), 'numpy.ones', 'np.ones', (['(9, 9)', 'np.uint8'], {}), '((9, 9), np.uint8)\n', (100, 118), True, 'import numpy as np\n'), ((129, 163... |
#
#
import numpy as np
def read_eigenbody (filename):
eigenbody = []
f_eigen = open(filename,'r')
for line in f_eigen:
eigenbody.append(float(line))
return np.array(eigenbody)
def compose_vertices_eigenmat (eigenmat):
eigenvertices = []
for i in range(0,len(eigenmat),3):
eige... | [
"numpy.array"
] | [((183, 202), 'numpy.array', 'np.array', (['eigenbody'], {}), '(eigenbody)\n', (191, 202), True, 'import numpy as np\n'), ((393, 416), 'numpy.array', 'np.array', (['eigenvertices'], {}), '(eigenvertices)\n', (401, 416), True, 'import numpy as np\n')] |
import numpy as np
class ReplayBuffer(object):
'''
Standard FIFO Replay Buffer implementation using NumPy
Arguments
obs_dim - int
The dimensionality of observations
action_dim - int
The dimension of action vectors
max_size - int
The maximum number of time steps of data... | [
"numpy.random.randint",
"numpy.zeros"
] | [((607, 654), 'numpy.zeros', 'np.zeros', (['(max_size, obs_dim)'], {'dtype': 'np.float32'}), '((max_size, obs_dim), dtype=np.float32)\n', (615, 654), True, 'import numpy as np\n'), ((679, 729), 'numpy.zeros', 'np.zeros', (['(max_size, action_dim)'], {'dtype': 'np.float32'}), '((max_size, action_dim), dtype=np.float32)\... |
import numpy as np
import cv2
import scipy
import scipy.signal
def createGaussianPyramid(im, sigma0=1, k=np.sqrt(2), levels=[-1,0,1,2,3,4]):
if len(im.shape)==3:
im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
if im.max()>10:
im = np.float32(im)/255
im_pyramid = []
for i in levels:
si... | [
"numpy.stack",
"cv2.GaussianBlur",
"cv2.circle",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.asarray",
"cv2.cvtColor",
"numpy.float32",
"numpy.split",
"numpy.argwhere",
"cv2.imread",
"numpy.append",
"cv2.normalize",
"cv2.imshow",
"numpy.ndarray",
"cv2.Sobel",
"numpy.concatenate",
... | [((106, 116), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (113, 116), True, 'import numpy as np\n'), ((419, 448), 'numpy.stack', 'np.stack', (['im_pyramid'], {'axis': '(-1)'}), '(im_pyramid, axis=-1)\n', (427, 448), True, 'import numpy as np\n'), ((521, 570), 'numpy.split', 'np.split', (['im_pyramid', 'im_pyramid.... |
"""
Providing an abstraction of input block for pwscf in control of ATOMIC_SPECIES, ATOMIC_POSITIONS, KPOINTS,
CELL_PARAMETERS, CONSTRAINTS, OCCUPATIONS, ATOMIC_FORCES
"""
import numpy as np
import os
import sys
import re
import pymatflow.base as base
from pymatflow.base.xyz import BaseXyz
from pymatflow.... | [
"os.path.abspath",
"numpy.zeros",
"re.match",
"numpy.array",
"numpy.linalg.inv",
"pymatflow.base.xyz.BaseXyz",
"os.listdir",
"sys.exit",
"numpy.sqrt"
] | [((473, 494), 'os.path.abspath', 'os.path.abspath', (['"""./"""'], {}), "('./')\n", (488, 494), False, 'import os\n'), ((711, 731), 'os.listdir', 'os.listdir', (['self.dir'], {}), '(self.dir)\n', (721, 731), False, 'import os\n'), ((1206, 1215), 'pymatflow.base.xyz.BaseXyz', 'BaseXyz', ([], {}), '()\n', (1213, 1215), F... |
import numpy as np
import pandas as pd
import staircase as sc
def _not_arithmetic_op(series_op):
return series_op not in (
pd.Series.add,
pd.Series.sub,
pd.Series.mul,
pd.Series.div,
)
def _reindex_deltas(new_index, deltas, initial_value):
mask = deltas.where(np.isnan(de... | [
"pandas.DataFrame",
"numpy.isnan"
] | [((309, 332), 'numpy.isnan', 'np.isnan', (['deltas.values'], {}), '(deltas.values)\n', (317, 332), True, 'import numpy as np\n'), ((435, 458), 'numpy.isnan', 'np.isnan', (['initial_value'], {}), '(initial_value)\n', (443, 458), True, 'import numpy as np\n'), ((2523, 2554), 'numpy.isnan', 'np.isnan', (['stairs1.initial_... |
"""
'########:'##::::'##::::'##:::
##.....::. ##::'##:::'####:::
##::::::::. ##'##::::.. ##:::
######:::::. ###::::::: ##:::
##...:::::: ## ##:::::: ##:::
##:::::::: ##:. ##::::: ##:::
########: ##:::. ##::'######:
........::..:::::..:::......::
"""
... | [
"matplotlib.pyplot.show",
"numpy.ceil",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"numpy.cumsum",
"numpy.histogram",
"cv2.imread",
"numpy.min",
"numpy.max",
"numpy.array_equal"
] | [((1696, 1706), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1704, 1706), True, 'import matplotlib.pyplot as plt\n'), ((2999, 3064), 'numpy.histogram', 'np.histogram', (['norm_255', 'NUM_OF_PIXELS_256', '[0, NUM_OF_PIXELS_256]'], {}), '(norm_255, NUM_OF_PIXELS_256, [0, NUM_OF_PIXELS_256])\n', (3011, 3064), ... |
import sys
import torch
from uuid import uuid4
import numpy as np
from glove import Corpus
from ..task.nlp import GloveDataset
from ..utils import infer_model_device, defaultdict, check_numpy, JobServer
from . import GloveModel
JOB_TYPE_REGULAR, JOB_TYPE_NORMS = "JOB_TYPE_REGULAR", "JOB_TYPE_NORMS"
class Distribut... | [
"torch.cat",
"uuid.uuid4",
"numpy.array",
"numpy.arange"
] | [((1711, 1718), 'uuid.uuid4', 'uuid4', ([], {}), '()\n', (1716, 1718), False, 'from uuid import uuid4\n'), ((1781, 1819), 'numpy.array', 'np.array', (['[null_vertex]'], {'dtype': '"""int32"""'}), "([null_vertex], dtype='int32')\n", (1789, 1819), True, 'import numpy as np\n'), ((1851, 1889), 'numpy.arange', 'np.arange',... |
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping, CSVLogger
from tensorflow.keras.applications.inception_v3 import preprocess_input
from tensorflow.keras.preprocessing.image import ImageDataGenerator
IM_WIDTH, IM_HEIGHT = ... | [
"matplotlib.pyplot.title",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"os.walk",
"os.path.exists",
"tensorflow.keras.callbacks.CSVLogger",
"matplotlib.pyplot.figure",
"glob.glob",
"os.path.join",
"tensorflow.keras.callbacks.Earl... | [((676, 703), 'glob.glob', 'glob.glob', (["(TRAIN_DIR + '/*')"], {}), "(TRAIN_DIR + '/*')\n", (685, 703), False, 'import glob\n'), ((1115, 1174), 'tensorflow.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'preprocessing_function': 'preprocess_input'}), '(preprocessing_function=preprocess_inp... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | [
"tensorflow.test.main",
"coltran.utils.base_utils.rgb_to_ycbcr",
"tensorflow.range",
"coltran.utils.base_utils.convert_bits",
"tensorflow.random.uniform",
"coltran.utils.base_utils.labels_to_bins",
"tensorflow.convert_to_tensor",
"numpy.allclose",
"coltran.utils.base_utils.bins_to_labels",
"numpy.... | [((2834, 2848), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (2846, 2848), True, 'import tensorflow as tf\n'), ((917, 949), 'tensorflow.range', 'tf.range', (['(0)', '(256)'], {'dtype': 'tf.int32'}), '(0, 256, dtype=tf.int32)\n', (925, 949), True, 'import tensorflow as tf\n'), ((1160, 1191), 'tensorflow.ran... |
"""
This file defines an "energy balance" snowmelt component and related
functions. It inherits from the snowmelt "base class" in
"snow_base.py".
"""
#-----------------------------------------------------------------------
#
# Copyright (c) 2001-2014, <NAME>
#
# Sep 2014. Cleanup and testing.
# Own vers... | [
"topoflow.utils.model_input.open_file",
"numpy.zeros",
"topoflow.utils.model_input.read_next",
"numpy.float64",
"numpy.all"
] | [((14220, 14239), 'numpy.all', 'np.all', (['are_scalars'], {}), '(are_scalars)\n', (14226, 14239), True, 'import numpy as np\n'), ((17344, 17389), 'numpy.zeros', 'np.zeros', (['[self.ny, self.nx]'], {'dtype': '"""float64"""'}), "([self.ny, self.nx], dtype='float64')\n", (17352, 17389), True, 'import numpy as np\n'), ((... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf
from setup_cifar import CIFAR, CIFARModel
from neuromask import NeuroMask
flags = tf.app.flags
flags.DEFINE_integer('test_idx', 1, help='Index for test example.')
flags.DEFINE_integer('num_iters', 2000, help='Number of iter... | [
"setup_cifar.CIFARModel",
"matplotlib.pyplot.show",
"numpy.argmax",
"tensorflow.reset_default_graph",
"tensorflow.Session",
"setup_cifar.CIFAR",
"neuromask.NeuroMask",
"tensorflow.placeholder",
"matplotlib.pyplot.subplots"
] | [((813, 820), 'setup_cifar.CIFAR', 'CIFAR', ([], {}), '()\n', (818, 820), False, 'from setup_cifar import CIFAR, CIFARModel\n'), ((893, 917), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (915, 917), True, 'import tensorflow as tf\n'), ((1615, 1634), 'matplotlib.pyplot.subplots', 'plt.su... |
import tensorflow as tf
import numpy as np
import tflearn
def running_mean(net, sizes, penalties, out_classes, name=None):
"""
Args:
net -> (max_len, batch_size, num_classes)
sizes -> sizes of running mean window
penalties -> penalty per size
out_classes -> number of output... | [
"tensorflow.batch_to_space_nd",
"tensorflow.reduce_sum",
"tensorflow.space_to_batch_nd",
"tensorflow.trainable_variables",
"model_small.model.restore",
"numpy.arange",
"tensorflow.nn.conv1d",
"tflearn.get_training_mode",
"tensorflow.nn.elu",
"tensorflow.nn.log_softmax",
"tensorflow.to_int64",
... | [((5194, 5206), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (5204, 5206), True, 'import tensorflow as tf\n'), ((346, 375), 'tensorflow.name_scope', 'tf.name_scope', (['"""running_mean"""'], {}), "('running_mean')\n", (359, 375), True, 'import tensorflow as tf\n'), ((391, 419), 'tensorflow.transpose', 'tf.tran... |
"""Read, write, create Brainvoyager SSM file format."""
import struct
import numpy as np
# =============================================================================
def read_ssm(filename):
"""Read Brainvoyager SSM (surface to surface mapping) file.
Parameters
----------
filename : string
... | [
"numpy.zeros"
] | [((1269, 1302), 'numpy.zeros', 'np.zeros', (["header['Nr vertices 1']"], {}), "(header['Nr vertices 1'])\n", (1277, 1302), True, 'import numpy as np\n')] |
# %% Integer opcode computer
from __future__ import annotations
from collections import defaultdict
from itertools import tee, islice
from typing import Iterable, List
from dataclasses import dataclass
import matplotlib.pyplot as plt
import numpy as np
@dataclass
class Point:
x: int
y: int
def distance_... | [
"matplotlib.pyplot.imshow",
"numpy.min",
"numpy.max",
"matplotlib.pyplot.show"
] | [((4104, 4128), 'matplotlib.pyplot.imshow', 'plt.imshow', (['registration'], {}), '(registration)\n', (4114, 4128), True, 'import matplotlib.pyplot as plt\n'), ((4129, 4139), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4137, 4139), True, 'import matplotlib.pyplot as plt\n'), ((4256, 4280), 'matplotlib.pypl... |
# 3rd party
import neurokit2 as nk
from neurokit2 import signal_period
import datetime
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from tqdm import tqdm
plt.rcParams['figure.figsize'] = [30, 25] # Bigger images
pd.set_option('display.width', 400)
pd.set_opt... | [
"preprocess_mit.read_mit_bit_files",
"seaborn.heatmap",
"numpy.abs",
"numpy.sum",
"pandas.read_csv",
"neurokit2.ecg_peaks",
"numpy.mean",
"pandas.set_option",
"pandas.DataFrame",
"numpy.set_printoptions",
"neurokit2.signal_period",
"numpy.std",
"preprocess_ludb.read_ludb_files",
"datetime.... | [((273, 308), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(400)'], {}), "('display.width', 400)\n", (286, 308), True, 'import pandas as pd\n'), ((310, 350), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(25)'], {}), "('display.max_columns', 25)\n", (323, 350), True, 'import p... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
import pytest
import sys
import argparse
funcs = {
'tanh': 'np.tanh(a)',
'neg': 'np.negative(a)',
'exp': 'np.exp(a)',
'sigmoid': '1/(1+np.exp(-a))',
'sqrt': 'np.sqrt(a)',
'log': 'np.log(a)',
'abs': 'np.abs(a)'... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.abs",
"tensorflow.device",
"tensorflow.placeholder",
"tensorflow.ConfigProto",
"tensorflow.Graph",
"numpy.random.choice",
"sys.exit"
] | [((2572, 2583), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2580, 2583), False, 'import sys\n'), ((2611, 2636), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2634, 2636), False, 'import argparse\n'), ((1381, 1400), 'tensorflow.device', 'tf.device', (['"""/gpu:0"""'], {}), "('/gpu:0')\n",... |
from setuptools import Extension, setup, find_packages
from Cython.Build import cythonize
import numpy
setup(
name='pyjpegls',
version='0.0.1',
description='Encode and decode jpeg-ls files from and to numpy arrays.',
install_requires = [
'numpy'
],
packages=find_packages('src'),
package_dir={'':'src'},
ext_m... | [
"numpy.get_include",
"setuptools.find_packages"
] | [((267, 287), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (280, 287), False, 'from setuptools import Extension, setup, find_packages\n'), ((763, 782), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (780, 782), False, 'import numpy\n')] |
import unittest
import numpy as np
from functools import partial
from scipy import stats
import sympy as sp
from pyapprox.univariate_polynomials.quadrature import \
gauss_jacobi_pts_wts_1D, gauss_hermite_pts_wts_1D, \
clenshaw_curtis_pts_wts_1D, leja_growth_rule, \
constant_increment_growth_rule
from pyapp... | [
"numpy.random.seed",
"pyapprox.variables.float_rv_discrete",
"numpy.allclose",
"numpy.ones",
"unittest.TestLoader",
"numpy.random.normal",
"pyapprox.utilities.gaussian_pdf",
"scipy.stats.norm",
"pyapprox.variables.transform_scale_parameters",
"scipy.stats.hypergeom",
"functools.partial",
"pyap... | [((675, 692), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (689, 692), True, 'import numpy as np\n'), ((1019, 1068), 'pyapprox.univariate_polynomials.quadrature.gauss_jacobi_pts_wts_1D', 'gauss_jacobi_pts_wts_1D', (['(2)', 'alpha_poly', 'beta_poly'], {}), '(2, alpha_poly, beta_poly)\n', (1042, 1068), ... |
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from sklearn.linear_model import LogisticRegression
#
# Download and convert the MNIST data set
# see the ... | [
"matplotlib.pyplot.subplot",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.show",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.cumsum",
"matplotlib.pyplot.figure",
"sklearn.linear_model.LogisticRegression",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.subpl... | [((396, 431), 'pandas.read_csv', 'pd.read_csv', (['"""data/mnist_train.csv"""'], {}), "('data/mnist_train.csv')\n", (407, 431), True, 'import pandas as pd\n'), ((671, 697), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 4)'}), '(figsize=(8, 4))\n', (681, 697), True, 'import matplotlib.pyplot as plt\n')... |
from keras.models import Sequential, Model
from keras.layers import Conv2D, Lambda, Input, Flatten
import numpy as np
import math
import sys
from keras.models import load_model
import os
import keras.backend as K
GRID_LENGTH = 9
GRID_SIZE = (GRID_LENGTH, GRID_LENGTH)
RIM_SIZE = 2
SAMPLE_SIZE = 10 * 1000
EPOCHS = 100
... | [
"keras.models.load_model",
"numpy.random.uniform",
"numpy.zeros",
"os.path.exists",
"numpy.array",
"keras.layers.Conv2D",
"keras.models.Sequential",
"keras.backend.argmax"
] | [((2079, 2098), 'numpy.zeros', 'np.zeros', (['GRID_SIZE'], {}), '(GRID_SIZE)\n', (2087, 2098), True, 'import numpy as np\n'), ((2497, 2509), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2507, 2509), False, 'from keras.models import Sequential, Model\n'), ((2915, 2933), 'keras.backend.argmax', 'K.argmax',... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
MobileNetV1 for ImageNet using TL models
- mobilenetv2 : https://github.com/tensorflow/models/tree/master/research/slim/nets/mobilenet
- tf.slim : https://github.com/tensorflow/models/tree/master/research/slim#pre-trained-models
"""
import time
import numpy as np
imp... | [
"tensorflow.nn.softmax",
"tensorlayer.vis.read_image",
"tensorlayer.logging.set_verbosity",
"tensorlayer.models.MobileNetV1",
"tensorflow.logging.set_verbosity",
"time.time",
"numpy.argsort",
"tensorflow.placeholder",
"tensorlayer.prepro.imresize",
"tensorflow.InteractiveSession"
] | [((427, 469), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.DEBUG'], {}), '(tf.logging.DEBUG)\n', (451, 469), True, 'import tensorflow as tf\n'), ((470, 512), 'tensorlayer.logging.set_verbosity', 'tl.logging.set_verbosity', (['tl.logging.DEBUG'], {}), '(tl.logging.DEBUG)\n', (494, 512), ... |
import numpy as np
from sklearn.linear_model import Ridge
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import PolynomialFeatures
from pysurrogate.surrogate import Surrogate
class PolynomialRegression(Surrogate):
def __init__(self, n_degree):
Surrogate.__init__(self)
self.... | [
"pysurrogate.surrogate.Surrogate.__init__",
"sklearn.preprocessing.PolynomialFeatures",
"numpy.zeros",
"sklearn.linear_model.Ridge"
] | [((282, 306), 'pysurrogate.surrogate.Surrogate.__init__', 'Surrogate.__init__', (['self'], {}), '(self)\n', (300, 306), False, 'from pysurrogate.surrogate import Surrogate\n'), ((446, 466), 'numpy.zeros', 'np.zeros', (['X.shape[0]'], {}), '(X.shape[0])\n', (454, 466), True, 'import numpy as np\n'), ((522, 555), 'sklear... |
#TSOPOURIDIS GRIGORIOS, AM:3358
import numpy as np
import sys
from PIL import Image
import matplotlib.pyplot as plt
#FIX TRACES OF OLD REMAINS
#affine transformation function
def affineTransformation(inputPath, outputPath, a1 ,a2 , a3, a4, a5, a6):
inImage = np.array(Image.open(inputPath))
#affine transform... | [
"matplotlib.pyplot.imshow",
"PIL.Image.open",
"numpy.array",
"matplotlib.pyplot.imsave",
"numpy.matmul"
] | [((616, 632), 'numpy.array', 'np.array', (['affine'], {}), '(affine)\n', (624, 632), True, 'import numpy as np\n'), ((1092, 1115), 'numpy.array', 'np.array', (['centeredCoord'], {}), '(centeredCoord)\n', (1100, 1115), True, 'import numpy as np\n'), ((1321, 1355), 'numpy.matmul', 'np.matmul', (['centeredCoord', 'affine.... |
import os
import sys
from os.path import join as opj
import base64
import struct
import copy
import numpy as np
from scipy.spatial.distance import cdist
import cv2
def parse_pt(pt_file):
with open(pt_file) as f:
lines = f.readlines()
img_rects = dict()
for line in lines:
line = line.strip()... | [
"base64.b64decode",
"numpy.mean",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((1277, 1297), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (1287, 1297), False, 'import os\n'), ((2043, 2063), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (2053, 2063), False, 'import os\n'), ((514, 540), 'base64.b64decode', 'base64.b64decode', (['line[-1]'], {}), '(line[-1])\n'... |
import numpy as np
import pymc3 as pm
class LinearModel:
def __init__(self, name):
self.name = name
self.gmm = None
def fit(self, y, yerr, x, gmm_params, sample_kwargs={}):
"""
yerr :
The uncertainties (standard deviations) in measured y.
"""
x = np... | [
"pymc3.sample",
"pymc3.Model",
"pymc3.HalfNormal",
"numpy.asarray",
"pymc3.Deterministic",
"pymc3.Normal",
"pymc3.Normal.dist",
"pymc3.math.sqrt",
"pymc3.Uniform",
"pymc3.Mixture"
] | [((318, 331), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (328, 331), True, 'import numpy as np\n'), ((344, 357), 'numpy.asarray', 'np.asarray', (['y'], {}), '(y)\n', (354, 357), True, 'import numpy as np\n'), ((373, 389), 'numpy.asarray', 'np.asarray', (['yerr'], {}), '(yerr)\n', (383, 389), True, 'import num... |
"""
detects cards using a web cam.
needs a bit of hand-calibration.
calibrate:
- MIN_CARD_AREA, set to be minimum area for detecting a card
- THRESHOLD, for thresholding dark/light values of the image
- FILTER, for smoothing the image
"""
import cv2
import pygame
import imutils
import numpy as np
import pygame.camer... | [
"cv2.approxPolyDP",
"cv2.arcLength",
"pygame.event.get",
"cv2.bilateralFilter",
"pygame.display.update",
"pygame.camera.init",
"cv2.contourArea",
"cv2.cvtColor",
"pygame.display.set_mode",
"pygame.camera.list_cameras",
"pygame.transform.scale",
"cv2.drawContours",
"cv2.boundingRect",
"pyga... | [((670, 707), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (682, 707), False, 'import cv2\n'), ((719, 777), 'cv2.bilateralFilter', 'cv2.bilateralFilter', (['gray', 'FILTER[0]', 'FILTER[1]', 'FILTER[2]'], {}), '(gray, FILTER[0], FILTER[1], FILTER[2])\n', (738, 777),... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from warnings import warn
from itertools import count
import symengine
import numpy as np
from jitcdde.past import Past, Anchor
import jitcdde._python_core as python_core
from jitcxde_common import jitcxde, checker
from jitcxde_common.helpers import sort_helpers, sympify_hel... | [
"jitcxde_common.symbolic.count_calls",
"symengine.Symbol",
"numpy.linalg.norm",
"symengine.sympify",
"chspy.CubicHermiteSpline",
"numpy.full",
"numpy.ndim",
"numpy.isfinite",
"jitcdde._python_core.dde_integrator",
"numpy.linspace",
"jitcxde_common.symbolic.collect_arguments",
"sympy.Function",... | [((1038, 1070), 'symengine.Symbol', 'symengine.Symbol', (['"""t"""'], {'real': '(True)'}), "('t', real=True)\n", (1054, 1070), False, 'import symengine\n'), ((3086, 3117), 'symengine.Function', 'symengine.Function', (['"""current_y"""'], {}), "('current_y')\n", (3104, 3117), False, 'import symengine\n'), ((3647, 3675),... |
from datetime import datetime
import numpy as np
import pandas as pd
from nwbext_ecog.ecog_manual import CorticalSurfaces, ECoGSubject
from pynwb import NWBFile, TimeSeries, NWBHDF5IO, get_manager
from pynwb.ecephys import ElectricalSeries
from pytz import timezone
from scipy.io.wavfile import read as wavread
# get_m... | [
"pandas.DataFrame",
"pynwb.NWBHDF5IO",
"pynwb.ecephys.ElectricalSeries",
"numpy.random.randn",
"scipy.io.wavfile.read",
"nwbext_ecog.ecog_manual.CorticalSurfaces",
"datetime.datetime",
"numpy.random.randint",
"nwbext_ecog.ecog_manual.ECoGSubject",
"numpy.array",
"pytz.timezone",
"pynwb.get_man... | [((369, 382), 'pynwb.get_manager', 'get_manager', ([], {}), '()\n', (380, 382), False, 'from pynwb import NWBFile, TimeSeries, NWBHDF5IO, get_manager\n'), ((687, 726), 'numpy.unique', 'np.unique', (['devices'], {'return_inverse': '(True)'}), '(devices, return_inverse=True)\n', (696, 726), True, 'import numpy as np\n'),... |
# -*- coding: utf-8 -*-
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from copy import deepcopy
import numpy as np
from scipy import linalg
import warnings
from ._event import Discrete
from .viz import plot_epochs
from .utils import pupil_kernel
from ._fixes import string_types, nanmean, nanstd
from .parall... | [
"numpy.sum",
"numpy.ones",
"numpy.argmin",
"scipy.linalg.svd",
"numpy.arange",
"numpy.interp",
"numpy.unique",
"scipy.optimize.fmin_slsqp",
"numpy.logical_not",
"copy.deepcopy",
"numpy.sort",
"numpy.dot",
"numpy.delete",
"numpy.concatenate",
"numpy.isscalar",
"numpy.asanyarray",
"num... | [((22657, 22684), 'numpy.zeros', 'np.zeros', (['conv_mat.shape[1]'], {}), '(conv_mat.shape[1])\n', (22665, 22684), True, 'import numpy as np\n'), ((23318, 23362), 'numpy.argmin', 'np.argmin', (['[e.shape[0] for e in event_times]'], {}), '([e.shape[0] for e in event_times])\n', (23327, 23362), True, 'import numpy as np\... |
import itertools
import copy
import numpy as np
import scipy
import scipy.linalg
from functools import reduce
__all__ = ['ImplicitSurface',
'ImplicitCollection',
'ImplicitPlane',
'ImplicitSphere',
'ImplicitXAlignedCylinder',
'ImplicitEllipse',
'Implici... | [
"copy.deepcopy",
"numpy.zeros_like",
"numpy.maximum",
"numpy.abs",
"numpy.ones_like",
"numpy.minimum",
"numpy.max",
"numpy.where",
"numpy.array",
"numpy.linalg.norm",
"numpy.iterable",
"numpy.random.rand",
"numpy.dot"
] | [((1298, 1319), 'numpy.iterable', 'np.iterable', (['items[0]'], {}), '(items[0])\n', (1309, 1319), True, 'import numpy as np\n'), ((1593, 1604), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (1601, 1604), True, 'import numpy as np\n'), ((1622, 1633), 'numpy.array', 'np.array', (['n'], {}), '(n)\n', (1630, 1633), Tru... |
import glob, os, shutil
import numpy as np
def copy_file(image_dir, photo, output_dir):
image_path = os.path.join(image_dir, "%s.jpg" % photo)
if os.path.isfile(image_path):
if not os.path.isdir(output_dir):
os.makedirs(output_dir)
shutil.copy(image_path, output_dir)
meta_dir = "... | [
"numpy.load",
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"os.path.isfile",
"os.path.join",
"shutil.copy"
] | [((626, 669), 'os.path.join', 'os.path.join', (['dataset_dir', '"""train"""', '"""query"""'], {}), "(dataset_dir, 'train', 'query')\n", (638, 669), False, 'import glob, os, shutil\n'), ((688, 731), 'os.path.join', 'os.path.join', (['dataset_dir', '"""train"""', '"""index"""'], {}), "(dataset_dir, 'train', 'index')\n", ... |
import os
import io
import base64
import face_recognition
import numpy as np
from PIL import Image, ImageDraw
class PythonPredictor:
def __init__(self, config):
# extract face features of the following person
image_data = [['<NAME>', 'assets/face.jpg']]
self.known_face_encodings = []
... | [
"io.BytesIO",
"face_recognition.face_distance",
"face_recognition.compare_faces",
"face_recognition.face_encodings",
"base64.b64decode",
"numpy.argmin",
"PIL.Image.fromarray",
"PIL.ImageDraw.Draw",
"face_recognition.face_locations",
"face_recognition.load_image_file"
] | [((974, 1019), 'face_recognition.load_image_file', 'face_recognition.load_image_file', (['check_image'], {}), '(check_image)\n', (1006, 1019), False, 'import face_recognition\n'), ((1115, 1161), 'face_recognition.face_locations', 'face_recognition.face_locations', (['unknown_image'], {}), '(unknown_image)\n', (1146, 11... |
# read the csv files to get raw data
import pandas as pd
import numpy as np
def read_data(filename):
'''
Phyphox can output raw data as csv files.
For a gyroscope data, it has such format:
time, gyroscope x, gyroscope y, gyroscope z, absolute value.
'''
try:
# only if the file i... | [
"pandas.read_csv",
"numpy.zeros",
"numpy.array"
] | [((363, 384), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (374, 384), True, 'import pandas as pd\n'), ((400, 440), 'numpy.zeros', 'np.zeros', (['(file.shape[1], file.shape[0])'], {}), '((file.shape[1], file.shape[0]))\n', (408, 440), True, 'import numpy as np\n'), ((467, 493), 'numpy.array', '... |
"""
Python program that uses scipy for generating a valid arm trajectory
A few useful resources
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.NonlinearConstraint.html#scipy.optimize.NonlinearConstraint
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html#scipy.optimize... | [
"numpy.shape",
"scipy.optimize.least_squares",
"klampt.WorldModel",
"numpy.linspace",
"SuspensionMatrices.Suspension_8legs",
"matplotlib.pyplot.subplots",
"scipy.signal.butter",
"numpy.stack",
"scipy.optimize.fmin",
"matplotlib.pyplot.show",
"csv.writer",
"numpy.dot",
"numpy.delete",
"nump... | [((14518, 14536), 'SuspensionMatrices.Suspension_8legs', 'Suspension_8legs', ([], {}), '()\n', (14534, 14536), False, 'from SuspensionMatrices import Suspension_8legs\n'), ((14631, 14650), 'klampt.WorldModel', 'klampt.WorldModel', ([], {}), '()\n', (14648, 14650), False, 'import klampt\n'), ((15012, 15023), 'numpy.zero... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 20 11:24:21 2019
@author: bwc
"""
# standard imports
import numpy as np
import matplotlib.pyplot as plt
# custom imports
import apt_fileio
import plotting_stuff
import peak_param_determination as ppd
from histogram_functions import bin_dat
import scipy.interpolate
im... | [
"numpy.abs",
"matplotlib.pyplot.close",
"apt_fileio.read_epos_numpy",
"time.time",
"numpy.cumsum",
"sel_align_m2q_log_xcorr.get_all_scale_coeffs",
"matplotlib.pyplot.figure",
"numpy.diff",
"numpy.max",
"matplotlib.pyplot.pause",
"plotting_stuff.plot_TOF_vs_time"
] | [((420, 436), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (429, 436), True, 'import matplotlib.pyplot as plt\n'), ((1031, 1065), 'apt_fileio.read_epos_numpy', 'apt_fileio.read_epos_numpy', (['euv_fn'], {}), '(euv_fn)\n', (1057, 1065), False, 'import apt_fileio\n'), ((1109, 1203), 'plotting... |
"""
Module: System
This module shall be used to implement subclasses of system. It wraps all information needed and generated by a simulation.
"""
import os
import warnings
import numpy as np
import pandas as pd
import scipy.constants as const
from tqdm import tqdm
pd.options.mode.use_inf_as_na = True
# Typing
f... | [
"os.path.abspath",
"os.path.dirname",
"numpy.float",
"numpy.isnan",
"ensembler.samplers.stochastic.metropolisMonteCarloIntegrator",
"numpy.linalg.norm",
"numpy.random.normal",
"ensembler.potentials.OneD.harmonicOscillatorPotential",
"numpy.random.rand",
"numpy.add",
"warnings.warn",
"numpy.sqr... | [((7362, 7391), 'ensembler.potentials.OneD.harmonicOscillatorPotential', 'harmonicOscillatorPotential', ([], {}), '()\n', (7389, 7391), False, 'from ensembler.potentials.OneD import metadynamicsPotential as metadynamicsPotential1D, harmonicOscillatorPotential\n'), ((7413, 7445), 'ensembler.samplers.stochastic.metropoli... |
#! /usr/bin/env python
# System imports
from setuptools import setup, Extension, find_packages
from os import path
import io
try:
from Cython.Distutils import build_ext
except ImportError:
USE_CYTHON = False
else:
USE_CYTHON = True
packages = find_packages()
# versioning
MAJOR = 1
MINOR = 2
MICRO = 5
IS... | [
"setuptools.Extension",
"setuptools.setup",
"os.path.dirname",
"numpy.get_numpy_include",
"numpy.get_include",
"os.path.join",
"setuptools.find_packages"
] | [((258, 273), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (271, 273), False, 'from setuptools import setup, Extension, find_packages\n'), ((413, 435), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (425, 435), False, 'from os import path\n'), ((450, 488), 'os.path.join', 'path... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
from matplotlib.animation import FuncAnimation
import sklearn
from sklearn import manifold
from numpy import linalg
class tsneAnimate():
def __init__(self,tsne):
self.tsne =... | [
"numpy.zeros_like",
"numpy.ones_like",
"matplotlib.pyplot.get_cmap",
"matplotlib.colors.Normalize",
"matplotlib.pyplot.show",
"numpy.invert",
"matplotlib.cm.ScalarMappable",
"numpy.abs",
"numpy.clip",
"matplotlib.animation.FuncAnimation",
"numpy.finfo",
"matplotlib.pyplot.figure",
"numpy.max... | [((4017, 4029), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (4027, 4029), True, 'import matplotlib.pyplot as plt\n'), ((4113, 4132), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""jet"""'], {}), "('jet')\n", (4125, 4132), True, 'import matplotlib.pyplot as plt\n'), ((4151, 4189), 'matplotlib.colors... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
class ResidualBlock(nn.Module):
"""Residual Block with instance normalization."""
def __init__(self, dim_in, dim_out):
super(ResidualBlock, self).__init__()
self.main = nn.Sequential(
n... | [
"torch.nn.ReLU",
"torch.nn.ConvTranspose2d",
"torch.nn.Sequential",
"torch.nn.Tanh",
"numpy.power",
"torch.nn.Conv2d",
"torch.nn.InstanceNorm2d",
"torch.nn.Linear",
"torch.nn.LeakyReLU",
"math.log2"
] | [((940, 978), 'torch.nn.Linear', 'nn.Linear', (['c_dim', 'conv_dim'], {'bias': '(False)'}), '(c_dim, conv_dim, bias=False)\n', (949, 978), True, 'import torch.nn as nn\n'), ((1582, 1604), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (1595, 1604), True, 'import torch.nn as nn\n'), ((2516, 25... |
import theanets
import numpy as np
INS = 3
OUTS = 2
STEPS = 11
ALL = 30
BATCH = 10
class TestFunctions:
def setUp(self):
self.samples = np.random.randn(2 * STEPS, INS)
self.labels = np.random.randn(2 * STEPS, OUTS)
def test_batches_labeled(self):
f = theanets.recurrent.batches(
... | [
"theanets.recurrent.Classifier",
"numpy.random.seed",
"theanets.recurrent.Autoencoder",
"numpy.random.randn",
"theanets.recurrent.Regressor",
"theanets.recurrent.Predictor",
"theanets.recurrent.batches"
] | [((151, 182), 'numpy.random.randn', 'np.random.randn', (['(2 * STEPS)', 'INS'], {}), '(2 * STEPS, INS)\n', (166, 182), True, 'import numpy as np\n'), ((205, 237), 'numpy.random.randn', 'np.random.randn', (['(2 * STEPS)', 'OUTS'], {}), '(2 * STEPS, OUTS)\n', (220, 237), True, 'import numpy as np\n'), ((287, 375), 'thean... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.2
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
import pandas as pd
# %%
lat_CHC = -16.35
lon_C... | [
"useful_scit.imps.plt.xlim",
"useful_scit.imps.plt.legend",
"oas_erf.constants.get_plotpath",
"oas_erf.util.practical_functions.make_folders",
"pathlib.Path",
"matplotlib.colors.LogNorm",
"useful_scit.imps.plt.xscale",
"useful_scit.imps.plt.title",
"oas_erf.util.Nd.sizedist_class_v2.Sizedistribution... | [((515, 543), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['_dic'], {}), '(_dic)\n', (537, 543), True, 'import pandas as pd\n'), ((2470, 2502), 'oas_erf.constants.get_plotpath', 'get_plotpath', (['"""measurement_comp"""'], {}), "('measurement_comp')\n", (2482, 2502), False, 'from oas_erf.constants import g... |
import matplotlib.pyplot as plt
import numpy as np
import pyk4a
from pyk4a import Config, PyK4A
MAX_SAMPLES = 1000
def set_default_data(data):
data["acc_x"] = MAX_SAMPLES * [data["acc_x"][-1]]
data["acc_y"] = MAX_SAMPLES * [data["acc_y"][-1]]
data["acc_z"] = MAX_SAMPLES * [data["acc_z"][-1]]
data["... | [
"numpy.zeros",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.subplots",
"pyk4a.Config"
] | [((717, 726), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (724, 726), True, 'import matplotlib.pyplot as plt\n'), ((743, 772), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)'], {'sharex': '(False)'}), '(3, sharex=False)\n', (755, 772), True, 'import matplotlib.pyplot as plt\n'), ((1151, 1172), 'numpy.ze... |
from typing import Union
import numpy as np
from experiments.utils import sample_uniform_weights
from simulation.outcome_generators import OutcomeGenerator, generate_outcome_sw
class SmallWorldSimulator(OutcomeGenerator):
def __init__(
self,
id_to_graph_dict: dict,
noise_mean: float = 0.... | [
"simulation.outcome_generators.generate_outcome_sw",
"experiments.utils.sample_uniform_weights",
"numpy.array",
"numpy.expand_dims"
] | [((581, 649), 'experiments.utils.sample_uniform_weights', 'sample_uniform_weights', ([], {'num_weights': '(3)', 'dim_covariates': 'dim_covariates'}), '(num_weights=3, dim_covariates=dim_covariates)\n', (603, 649), False, 'from experiments.utils import sample_uniform_weights\n'), ((1086, 1114), 'numpy.expand_dims', 'np.... |
"""a bunch of functions to generate fake data"""
import numpy as np
from scipy.sparse import csr_matrix
import scanpy as sc
def pancakes(n_pts=100, n_cor=2, n_anticor=2, n_noise=2, minor_fraction=0.5, random_fraction=0.5, marker_fraction=0.9,
noise_level=0.1, dropout_clust=True):
# split = [0] * int... | [
"numpy.ceil",
"numpy.floor",
"scipy.sparse.csr_matrix",
"numpy.array",
"numpy.random.choice",
"numpy.vstack",
"numpy.concatenate"
] | [((784, 820), 'numpy.vstack', 'np.vstack', (['(markers_on, markers_off)'], {}), '((markers_on, markers_off))\n', (793, 820), True, 'import numpy as np\n'), ((1244, 1280), 'numpy.vstack', 'np.vstack', (['(markers_on, markers_off)'], {}), '((markers_on, markers_off))\n', (1253, 1280), True, 'import numpy as np\n'), ((129... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.