code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import argparse
import copy
import logging
import os
import numpy as np
from astropy.wcs import Sip
from scipy import optimize as optimize
from CatalogMatcher import CatalogMatcher
from ReferenceCatalogProvider import refcat2
from wcsfitsdatabase import wcsfitdatabase
__author__ = '<EMAIL>'
log = logging.getLogger(_... | [
"logging.getLogger",
"astropy.wcs.Sip",
"argparse.ArgumentParser",
"scipy.optimize.minimize",
"wcsfitsdatabase.wcsfitdatabase",
"ReferenceCatalogProvider.refcat2",
"numpy.zeros",
"os.path.basename",
"copy.deepcopy",
"CatalogMatcher.CatalogMatcher.createMatchedCatalogForLCO"
] | [((301, 328), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (318, 328), False, 'import logging\n'), ((4205, 4228), 'os.path.basename', 'os.path.basename', (['image'], {}), '(image)\n', (4221, 4228), False, 'import os\n'), ((4525, 4655), 'CatalogMatcher.CatalogMatcher.createMatchedCatalog... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import numpy as np
import trimesh
# color palette for nyu40 labels
def create_color_palette():
return [
(0, 0, 0),
... | [
"numpy.eye",
"numpy.cross",
"trimesh.load_mesh",
"math.sqrt",
"math.cos",
"numpy.array",
"numpy.dot",
"math.fabs",
"numpy.cos",
"trimesh.Trimesh",
"numpy.sin",
"math.sin",
"math.fmod"
] | [((1567, 1655), 'trimesh.Trimesh', 'trimesh.Trimesh', ([], {'vertices': 'vertices', 'vertex_colors': 'colors', 'faces': 'faces', 'process': '(False)'}), '(vertices=vertices, vertex_colors=colors, faces=faces,\n process=False)\n', (1582, 1655), False, 'import trimesh\n'), ((1726, 1768), 'trimesh.load_mesh', 'trimesh.... |
import json
from collections import defaultdict
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt, patches
from dataset_utils.kitti_datum import KITTIDataset
from dataset_utils.mot_datum import MOTDataset
from trainer.dataset_info import kitti_classes_reverse
from vis_utils.vis_datum imp... | [
"dataset_utils.kitti_datum.KITTIDataset",
"matplotlib.pyplot.waitforbuttonpress",
"vis_utils.vis_datum.ImageBoxes",
"dataset_utils.mot_datum.MOTDataset",
"matplotlib.pyplot.imread",
"numpy.argmax",
"matplotlib.pyplot.close",
"numpy.array",
"numpy.zeros",
"collections.defaultdict",
"numpy.concate... | [((765, 782), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (776, 782), False, 'from collections import defaultdict\n'), ((8451, 8487), 'numpy.concatenate', 'np.concatenate', (['(conf, dist)'], {'axis': '(0)'}), '((conf, dist), axis=0)\n', (8465, 8487), True, 'import numpy as np\n'), ((11542, 11... |
__all__ = ['extract_ssi', 'extract_ssi_to_file',
'extract_eta', 'extract_eta_to_file',
'extract_Q_channel', 'extract_Q_down',
'extract_overland_volume', 'extract_overland_volume_to_file']
from datetime import timedelta
from configparser import SafeConfigParser
import h5py
import numpy... | [
"numpy.ma.masked_values",
"numpy.ones",
"numpy.ma.array",
"h5py.File",
"numpy.ma.masked_where",
"datetime.timedelta",
"numpy.loadtxt",
"numpy.genfromtxt",
"configparser.SafeConfigParser"
] | [((994, 1012), 'configparser.SafeConfigParser', 'SafeConfigParser', ([], {}), '()\n', (1010, 1012), False, 'from configparser import SafeConfigParser\n'), ((1117, 1142), 'h5py.File', 'h5py.File', (['sim_fname', '"""r"""'], {}), "(sim_fname, 'r')\n", (1126, 1142), False, 'import h5py\n'), ((1810, 1828), 'configparser.Sa... |
from __future__ import print_function
import torch
import numpy as np
import util
# getting started
def getting_started():
print(util.Section('Getting Started'))
# construction
print(util.SubSection('Construction'))
xa1 = torch.empty(5, 3) # uninitialized
xa2 = torch.rand(5, 3) # randomly initi... | [
"torch.ones_like",
"torch.ones",
"numpy.ones",
"numpy.add",
"util.SubSection",
"torch.device",
"torch.from_numpy",
"torch.tensor",
"torch.randn_like",
"torch.add",
"torch.cuda.is_available",
"util.Section",
"torch.no_grad",
"torch.empty",
"torch.zeros",
"torch.rand",
"torch.randn"
] | [((241, 258), 'torch.empty', 'torch.empty', (['(5)', '(3)'], {}), '(5, 3)\n', (252, 258), False, 'import torch\n'), ((286, 302), 'torch.rand', 'torch.rand', (['(5)', '(3)'], {}), '(5, 3)\n', (296, 302), False, 'import torch\n'), ((344, 379), 'torch.zeros', 'torch.zeros', (['(5)', '(3)'], {'dtype': 'torch.long'}), '(5, ... |
#############################################################
# Copyright (C) 2015 <NAME>, <NAME>
#
# Distributed under the MIT License.
# (See accompanying file LICENSE or copy at
# http://opensource.org/licenses/MIT)
##############################################################
import copy
import numpy as np
impo... | [
"numpy.ones",
"sobol_lib.i4_sobol_generate",
"grid.GridMap",
"numpy.max",
"ei.expected_improvement",
"pygp.learning.optimization.optimize_random_start"
] | [((2471, 2507), 'grid.GridMap', 'grid.GridMap', (['self.flat_search_space'], {}), '(self.flat_search_space)\n', (2483, 2507), False, 'import grid\n'), ((2542, 2592), 'sobol_lib.i4_sobol_generate', 'sobol_lib.i4_sobol_generate', (['dims', 'grid_size', '(9001)'], {}), '(dims, grid_size, 9001)\n', (2569, 2592), False, 'im... |
#!/usr/bin/env python3
"""
Rescores words-as-classifier scores using sequence prediction
Uses data generated by "structural_model_weighting_trainer.py".
"""
__author__ = "<NAME> <<EMAIL>>"
__copyright__ = "Copyright 2017 <NAME>"
__license__ = "Apache License, Version 2.0"
import argparse
import random
import sys
i... | [
"structural_model_weighting_trainer.TrainingFile.RANDOM_SEED.value.read",
"argparse.ArgumentParser",
"structural_model_weighting_trainer.TrainingFile.VOCAB_LABELS.value.read",
"structural_model_weighting_trainer.TrainingFile.ONEHOT_ENCODINGS.value.read",
"structural_model_weighting_trainer.TokenSequenceSequ... | [((2174, 2201), 'structural_model_weighting_trainer.group_seq_xy_by_len', 'group_seq_xy_by_len', (['seq_xy'], {}), '(seq_xy)\n', (2193, 2201), False, 'from structural_model_weighting_trainer import SequenceFeatureExtractor, TokenSequenceSequence, TrainingFile, group_seq_xy_by_len\n'), ((2457, 2498), 'structural_model_w... |
#!/usr/bin/env python3
"""
Contains a class to use an atlas to look up your location inside a brain.
Created 2/8/2021 by <NAME>.
"""
from pathlib import Path
from typing import Dict, Tuple
import templateflow.api
import pandas
import nibabel
import numpy
from functools import cached_property
from dataclasses import d... | [
"numpy.repeat",
"pandas.read_csv",
"nibabel.load",
"numpy.asarray",
"numpy.ma.masked_array"
] | [((1649, 1673), 'nibabel.load', 'nibabel.load', (['nifti_path'], {}), '(nifti_path)\n', (1661, 1673), False, 'import nibabel\n'), ((2105, 2148), 'pandas.read_csv', 'pandas.read_csv', (['tsv_lookup'], {'delimiter': '"""\t"""'}), "(tsv_lookup, delimiter='\\t')\n", (2120, 2148), False, 'import pandas\n'), ((3513, 3558), '... |
# Internal modules
from processing.data_management import load_excel, load_document
import processing.preprocessors as pp
from config import config
from graphs import graphs
# External libraries
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from utils import Hea... | [
"processing.data_management.load_excel",
"numpy.sqrt",
"utils.Header",
"dash_html_components.Br",
"dash_html_components.H5",
"dash_html_components.H6",
"graphs.graphs.linechart",
"processing.data_management.load_document"
] | [((470, 508), 'processing.data_management.load_excel', 'load_excel', ([], {'file_name': 'config.DATA_FILE'}), '(file_name=config.DATA_FILE)\n', (480, 508), False, 'from processing.data_management import load_excel, load_document\n'), ((700, 711), 'utils.Header', 'Header', (['app'], {}), '(app)\n', (706, 711), False, 'f... |
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | [
"commoncode.hash.get_hasher",
"samecode.halohash.hamming_distance",
"unittest.case.skipUnless",
"unittest.skipIf",
"os.path.os.remove",
"os.path.join",
"pympler.asizeof.asizeof",
"pstats.Stats",
"numpy.vstack",
"itertools.izip",
"os.path.os.path.dirname",
"samecode.halohash.BaseBucketHaloHash.... | [((10925, 10976), 'unittest.case.skipUnless', 'skipUnless', (['PERF_TEST_ENABLED', '"""Perf test disabled"""'], {}), "(PERF_TEST_ENABLED, 'Perf test disabled')\n", (10935, 10976), False, 'from unittest.case import skipUnless\n'), ((1833, 1858), 'os.path.os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file_... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
#
# pylint: disable=redefined-outer-name
#
"""Ensure correctness of the order parameters."""
import numpy as np
import pytest
from sdanalysis import order, read
INFI... | [
"sdanalysis.order.relative_distances",
"sdanalysis.order.compute_voronoi_neighs",
"sdanalysis.order.num_neighbours",
"sdanalysis.order.create_orient_ordering",
"sdanalysis.order.relative_orientations",
"sdanalysis.order.orientational_order",
"numpy.isfinite",
"pytest.fixture",
"sdanalysis.order.comp... | [((476, 522), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': 'INFILES'}), "(scope='module', params=INFILES)\n", (490, 522), False, 'import pytest\n'), ((716, 795), 'sdanalysis.order.compute_neighbours', 'order.compute_neighbours', (['frame.box', 'frame.position', 'max_radius', 'max_neighbo... |
from src.utils.words import GET_POLARTIY
from src.utils.utils import convert_dict_to_list
from sklearn import svm
from datetime import datetime
from sklearn.metrics import accuracy_score, confusion_matrix, precision_score,recall_score
from tqdm import tqdm
from scipy.sparse import coo_matrix
import numpy as np
from sk... | [
"sklearn.linear_model.SGDClassifier",
"numpy.asarray",
"datetime.datetime.now",
"scipy.sparse.coo_matrix",
"src.utils.utils.convert_dict_to_list",
"sklearn.metrics.accuracy_score"
] | [((1959, 1974), 'sklearn.linear_model.SGDClassifier', 'SGDClassifier', ([], {}), '()\n', (1972, 1974), False, 'from sklearn.linear_model import SGDClassifier\n'), ((3241, 3257), 'numpy.asarray', 'np.asarray', (['data'], {}), '(data)\n', (3251, 3257), True, 'import numpy as np\n'), ((3269, 3285), 'numpy.asarray', 'np.as... |
import numpy as np
import matplotlib.pyplot as plt
import torch
from modules.distributions import NormalDistribution, BernoulliDistribution
from modules.models import HierarchicalModel
from modules.networks import TriResNet
K = 30
mean_sigma = 1.
scale_mu = 0.1
scale_sigma = 0.1
n_children = 10
emission_sigma_list =... | [
"numpy.random.normal",
"modules.networks.TriResNet",
"modules.models.HierarchicalModel",
"modules.distributions.NormalDistribution",
"torch.exp",
"torch.matmul",
"matplotlib.pyplot.show"
] | [((376, 396), 'modules.distributions.NormalDistribution', 'NormalDistribution', ([], {}), '()\n', (394, 396), False, 'from modules.distributions import NormalDistribution, BernoulliDistribution\n'), ((410, 430), 'modules.distributions.NormalDistribution', 'NormalDistribution', ([], {}), '()\n', (428, 430), False, 'from... |
"""calc_metrics module for calculating metrics
Module contains functions for calculating metrics
TODO
"""
import numpy as np
from stonesoup.types.track import Track
from stonesoup.types.groundtruth import GroundTruthPath
from stonesoup.types.state import State
from stonesoup.types.groundtruth import GroundTruthState
... | [
"numpy.array",
"scipy.linalg.cholesky",
"scipy.linalg.solve_triangular",
"numpy.sqrt"
] | [((1558, 1585), 'numpy.sqrt', 'np.sqrt', (['mean_squared_error'], {}), '(mean_squared_error)\n', (1565, 1585), True, 'import numpy as np\n'), ((713, 749), 'scipy.linalg.cholesky', 'la.cholesky', (['state.covar'], {'lower': '(True)'}), '(state.covar, lower=True)\n', (724, 749), True, 'import scipy.linalg as la\n'), ((84... |
# Data here: https://www.kaggle.com/c/instant-gratification/data
# Original source here: https://www.kaggle.com/prashantkikani/ig-pca-nusvc-knn-lr-stack
import argparse
import pickle
import time
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from instant_utils import *
fr... | [
"numpy.intersect1d",
"pandas.read_csv",
"numpy.hstack",
"sklearn.model_selection.train_test_split",
"argparse.ArgumentParser",
"numpy.append",
"numpy.argsort",
"time.time",
"willump.evaluation.willump_executor.willump_execute"
] | [((451, 476), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (474, 476), False, 'import argparse\n'), ((886, 960), 'willump.evaluation.willump_executor.willump_execute', 'willump_execute', ([], {'disable': 'args.disable', 'eval_cascades': 'cascades', 'top_k': 'top_K'}), '(disable=args.disable, ... |
import numpy as np
import pytest
from ndcube.tests.helpers import assert_cubes_equal
from ndcube.utils.wcs import WCS
import astropy.units as u
from astropy.time import Time, TimeDelta
from sunraster import SpectrogramCube
import sunraster.spectrogram
# Define a sample wcs object
H0 = {
'CTYPE1': 'WAVE ', 'C... | [
"numpy.sqrt",
"ndcube.utils.wcs.WCS",
"numpy.array",
"pytest.mark.parametrize",
"numpy.zeros",
"ndcube.tests.helpers.assert_cubes_equal",
"pytest.raises",
"sunraster.SpectrogramCube",
"astropy.time.Time",
"numpy.arange"
] | [((604, 627), 'ndcube.utils.wcs.WCS', 'WCS', ([], {'header': 'H0', 'naxis': '(3)'}), '(header=H0, naxis=3)\n', (607, 627), False, 'from ndcube.utils.wcs import WCS\n'), ((939, 971), 'ndcube.utils.wcs.WCS', 'WCS', ([], {'header': 'H_NO_COORDS', 'naxis': '(3)'}), '(header=H_NO_COORDS, naxis=3)\n', (942, 971), False, 'fro... |
'''
this is EMU^r (recursive computation of expected marginal utility) algorithm of Bhattacharjee et.al
REFERENCES:
<NAME>., <NAME>., <NAME>., <NAME>.: Bridging the gap: Manyobjective optimization and informed decision-making. IEEE Trans. Evolutionary
Computation 21(5), 813{820 (2017)
'''
import numpy as np
impor... | [
"numpy.ones",
"math.factorial",
"numpy.asarray",
"sklearn.cluster.AffinityPropagation",
"copy.copy",
"numpy.argsort",
"numpy.dot",
"numpy.argmin",
"numpy.loadtxt"
] | [((973, 1009), 'numpy.asarray', 'np.asarray', (['[i.direction for i in w]'], {}), '([i.direction for i in w])\n', (983, 1009), True, 'import numpy as np\n'), ((1022, 1044), 'numpy.dot', 'np.dot', (['w_mat', 'obj_mat'], {}), '(w_mat, obj_mat)\n', (1028, 1044), True, 'import numpy as np\n'), ((2674, 2710), 'numpy.asarray... |
"""
PhaseShift operator
====================
This example shows how to use the :class:`pylops.waveeqprocessing.PhaseShift`
operator to perform frequency-wavenumber shift of an input multi-dimensional
signal. Such a procedure is applied in a variety of disciplines including
geophysics, medical imaging and non-destructiv... | [
"numpy.fft.rfftfreq",
"pylops.waveeqprocessing.PhaseShift",
"pylops.utils.seismicevents.hyperbolic2d",
"numpy.fft.fftfreq",
"pylops.utils.tapers.taper3d",
"matplotlib.pyplot.close",
"pylops.utils.seismicevents.makeaxis",
"pylops.utils.seismicevents.hyperbolic3d",
"numpy.pad",
"pylops.utils.tapers.... | [((403, 419), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (412, 419), True, 'import matplotlib.pyplot as plt\n'), ((711, 751), 'pylops.utils.seismicevents.makeaxis', 'pylops.utils.seismicevents.makeaxis', (['par'], {}), '(par)\n', (746, 751), False, 'import pylops\n'), ((966, 1031), 'pylop... |
import numpy as np
import scipy.signal
import tensorflow as tf
import imageio
import os
from ACNetwork import ACNetwork
class Trainer():
def __init__(self, settings, sess, number, coord, globalEpisodes):
self.settings = settings
self.coord = coord
self.sess = sess
self.name = 'tra... | [
"os.path.exists",
"ACNetwork.ACNetwork",
"tensorflow.Summary",
"os.makedirs",
"tensorflow.Variable",
"numpy.asarray",
"tensorflow.summary.FileWriter",
"tensorflow.get_collection"
] | [((508, 578), 'tensorflow.Variable', 'tf.Variable', (['(0)'], {'dtype': 'tf.int32', 'name': '"""local_episodes"""', 'trainable': '(False)'}), "(0, dtype=tf.int32, name='local_episodes', trainable=False)\n", (519, 578), True, 'import tensorflow as tf\n'), ((774, 824), 'tensorflow.summary.FileWriter', 'tf.summary.FileWri... |
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing.image import *
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense, ZeroPadding2D
from keras.layers import BatchNormalization
from keras import ini... | [
"keras.models.load_model",
"sklearn.metrics.classification_report",
"numpy.argmax",
"keras.preprocessing.image.ImageDataGenerator",
"keras.metrics.top_k_categorical_accuracy",
"sklearn.metrics.confusion_matrix"
] | [((1111, 1131), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (1129, 1131), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((1915, 2026), 'keras.models.load_model', 'load_model', (['"""FINAL.h5"""'], {'custom_objects': "{'top_3_accuracy': top_3_accuracy, ... |
import pytest
import sys
sys.path.append('..')
from app.src.mnist import train_mnist
deterministic_training = True
if deterministic_training:
# Code snippet for reproducibility in Keras (https://stackoverflow.com/questions/48631576/reproducible-results-using-keras-with-tensorflow-backend)
# Note: Perfect reprod... | [
"pytest.approx",
"keras.backend.set_session",
"app.src.mnist.train_mnist",
"random.seed",
"numpy.random.seed",
"tensorflow.ConfigProto",
"tensorflow.set_random_seed",
"sys.path.append",
"tensorflow.get_default_graph"
] | [((27, 48), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (42, 48), False, 'import sys\n'), ((844, 867), 'random.seed', 'random.seed', (['seed_value'], {}), '(seed_value)\n', (855, 867), False, 'import random\n'), ((952, 978), 'numpy.random.seed', 'np.random.seed', (['seed_value'], {}), '(seed_v... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import gzip
import six
import numpy as np
from scipy.special import expit
def _maybe_download(target_dir):
target_path = os.path.join(target_dir, "mnist.pkl.gz")
if not os.path.exists(target_dir)... | [
"numpy.clip",
"numpy.mean",
"os.path.exists",
"gzip.open",
"numpy.log",
"os.path.join",
"numpy.dot",
"numpy.vstack",
"pickle._Unpickler",
"cPickle.load",
"numpy.random.binomial"
] | [((244, 284), 'os.path.join', 'os.path.join', (['target_dir', '"""mnist.pkl.gz"""'], {}), "(target_dir, 'mnist.pkl.gz')\n", (256, 284), False, 'import os\n'), ((527, 567), 'os.path.join', 'os.path.join', (['target_dir', '"""mnist.pkl.gz"""'], {}), "(target_dir, 'mnist.pkl.gz')\n", (539, 567), False, 'import os\n'), ((5... |
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import time
import datetime
from dateutil.parser import parse
from btcTrans import ordered
from pytrends.request import TrendReq
def graphTwo(x, y, yaxis, xaxis):
meanx = np.mean(x)
meany = np.mean(y)
varx = np.var(x)
... | [
"numpy.mean",
"matplotlib.pyplot.grid",
"numpy.sqrt",
"numpy.unique",
"matplotlib.pyplot.ylabel",
"numpy.polyfit",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.var",
"matplotlib.pyplot.show"
] | [((265, 275), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (272, 275), True, 'import numpy as np\n'), ((288, 298), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (295, 298), True, 'import numpy as np\n'), ((310, 319), 'numpy.var', 'np.var', (['x'], {}), '(x)\n', (316, 319), True, 'import numpy as np\n'), ((331, 340),... |
import os
import numpy as np
import pandas as pd
import pytest
from terra.utils import ensure_dir_exists
from terra.io import Artifact, json_dump, rm_nested_artifacts, json_load
import terra.database as tdb
from .testbed import BaseTestBed
@pytest.fixture()
def testbed(request, tmpdir):
testbed_class, config = r... | [
"terra.database.get_artifact_loads",
"numpy.allclose",
"numpy.random.rand",
"pandas.DataFrame",
"terra.utils.ensure_dir_exists",
"os.path.join",
"terra.io.Artifact.dump",
"terra.database.get_artifact_dumps",
"terra.io.rm_nested_artifacts",
"pytest.fixture"
] | [((244, 260), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (258, 260), False, 'import pytest\n'), ((523, 549), 'terra.utils.ensure_dir_exists', 'ensure_dir_exists', (['run_dir'], {}), '(run_dir)\n', (540, 549), False, 'from terra.utils import ensure_dir_exists\n'), ((558, 577), 'numpy.random.rand', 'np.random.... |
#----------------------------
# Author: <NAME>
#----------------------------
from collections import namedtuple
import numpy as np
import math
FILE_TYPE = "P2" # to verify the file type
PGMFile = namedtuple('PGMFile', ['max_shade', 'data']) # named tuple
# This function receives the name of a file, reads it in, v... | [
"numpy.clip",
"numpy.flip",
"numpy.copy",
"collections.namedtuple",
"numpy.add",
"math.pow",
"numpy.delete",
"math.sqrt",
"numpy.subtract",
"numpy.array",
"numpy.sum",
"numpy.arctan2",
"numpy.transpose",
"numpy.amax"
] | [((199, 243), 'collections.namedtuple', 'namedtuple', (['"""PGMFile"""', "['max_shade', 'data']"], {}), "('PGMFile', ['max_shade', 'data'])\n", (209, 243), False, 'from collections import namedtuple\n'), ((3029, 3059), 'numpy.flip', 'np.flip', (['pgm_file.data'], {'axis': '(1)'}), '(pgm_file.data, axis=1)\n', (3036, 30... |
from PyCommon.modules.Motion import ysBipedAnalysis as yba
from PyCommon.modules.Math import mmMath as mm
from PyCommon.modules.Math import ysFunctionGraph as yfg
from PyCommon.modules.Motion import ysMotionAnalysis as yma
import numpy as np
stitch_func = lambda xx : 1. - yfg.hermite2nd(xx)
#TODO:
if False:
stf_s... | [
"PyCommon.modules.Math.ysFunctionGraph.hermite2nd",
"PyCommon.modules.Math.mmMath.projectionOnPlane",
"numpy.cross",
"PyCommon.modules.Motion.ysMotionAnalysis.offsetInterval",
"PyCommon.modules.Math.mmMath.projectionOnVector2",
"numpy.dot",
"PyCommon.modules.Math.mmMath.clampExp",
"PyCommon.modules.Ma... | [((336, 400), 'PyCommon.modules.Math.ysFunctionGraph.concatenate', 'yfg.concatenate', (['[yfg.hermite2nd, yfg.one]', '[c_landing_duration]'], {}), '([yfg.hermite2nd, yfg.one], [c_landing_duration])\n', (351, 400), True, 'from PyCommon.modules.Math import ysFunctionGraph as yfg\n'), ((275, 293), 'PyCommon.modules.Math.y... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
x = np.linspace(-10, 10, 300)
plt.plot(x, np.sin(x), 'r-', label="Sinus")
plt.plot(x, -0.7 * np.cos(x), 'b-', label='- Cosinus')
plt.xlim(-10, 10)
plt.ylim(-2.5,2.5)
plt.xlabel(r"$x$")
plt.ylabel(r"$f(x)$")
plt.legend(loc='upper rig... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.tight_layout",
"numpy.sin",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.legend"
] | [((92, 117), 'numpy.linspace', 'np.linspace', (['(-10)', '(10)', '(300)'], {}), '(-10, 10, 300)\n', (103, 117), True, 'import numpy as np\n'), ((217, 234), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(-10)', '(10)'], {}), '(-10, 10)\n', (225, 234), True, 'import matplotlib.pyplot as plt\n'), ((235, 254), 'matplotlib.pyplo... |
import os
from abc import ABC, abstractmethod
from queue import PriorityQueue
import numpy as np
import pickle
import torch
class AgentBase(ABC):
def __init__(self, CONFIG, CONFIG_ENV):
super().__init__(CONFIG, CONFIG_ENV)
self.config = CONFIG
self.rng = np.random.default_rng(seed=CONFIG.... | [
"numpy.random.default_rng",
"torch.load",
"pickle.load",
"os.path.join",
"queue.PriorityQueue"
] | [((286, 325), 'numpy.random.default_rng', 'np.random.default_rng', ([], {'seed': 'CONFIG.SEED'}), '(seed=CONFIG.SEED)\n', (307, 325), True, 'import numpy as np\n'), ((921, 936), 'queue.PriorityQueue', 'PriorityQueue', ([], {}), '()\n', (934, 936), False, 'from queue import PriorityQueue\n'), ((5551, 5586), 'os.path.joi... |
import random
import numpy as np
from math import pow,sqrt
from utils.vocab import Vocab
class NEG:
def __init__(self, vocab: Vocab, alpha: float=0.75, size: int=20, subsampling: bool=False, subsample_thr:float = 1e-3):
random.seed(42)
np.random.seed(42)
self.alpha = alpha
self.voc... | [
"math.pow",
"math.sqrt",
"random.seed",
"numpy.sum",
"numpy.array",
"numpy.random.seed",
"numpy.cumsum",
"random.random",
"random.randint"
] | [((234, 249), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (245, 249), False, 'import random\n'), ((258, 276), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (272, 276), True, 'import numpy as np\n'), ((1346, 1361), 'numpy.sum', 'np.sum', (['sampler'], {}), '(sampler)\n', (1352, 1361), True... |
import os
import shutil
import unittest
import matrix_io
import numpy
import scipy
import scipy.io
class TestMatrixIO(unittest.TestCase):
TEMP_DIR_NAME = 'tmp'
@classmethod
def setUpClass(cls):
shutil.rmtree(cls.TEMP_DIR_NAME, ignore_errors=True)
os.makedirs(cls.TEMP_DIR_NAME)
@class... | [
"matrix_io.write_csv",
"scipy.sparse.rand",
"matrix_io.write_sparse_binary_matrix",
"matrix_io.write_matrix",
"matrix_io.read_matrix",
"numpy.array",
"unittest.main",
"matrix_io.read_dense_float64",
"matrix_io.write_dense_float64_matrix_as_tensor",
"matrix_io.read_csv",
"matrix_io.read_dense_flo... | [((10217, 10232), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10230, 10232), False, 'import unittest\n'), ((217, 269), 'shutil.rmtree', 'shutil.rmtree', (['cls.TEMP_DIR_NAME'], {'ignore_errors': '(True)'}), '(cls.TEMP_DIR_NAME, ignore_errors=True)\n', (230, 269), False, 'import shutil\n'), ((278, 308), 'os.mak... |
if __name__ == '__main__':
import matplotlib
matplotlib.use('Agg')
from matplotlib import rc
rc('font',**{'family':'serif','serif':'Computer Modern Roman','size':12})
rc('text', usetex=True)
import numpy as np
import os as os
import pylab as plt
def drawblock(x, y, size, label):
px = x + size *... | [
"pylab.axis",
"pylab.axes",
"matplotlib.use",
"pylab.plot",
"pylab.savefig",
"pylab.figure",
"numpy.array",
"matplotlib.rc",
"pylab.text",
"pylab.Arrow",
"pylab.gca"
] | [((53, 74), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (67, 74), False, 'import matplotlib\n'), ((109, 188), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'serif', 'serif': 'Computer Modern Roman', 'size': 12})\n", (111, 188), False, 'from matplotlib import rc\n'), ((187... |
# Copyright (c) 2020 Spanish National Research Council
#
# 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 ... | [
"download.install",
"os.listdir",
"numpy.repeat",
"pandas.read_csv",
"os.makedirs",
"datetime.datetime.strptime",
"multiprocessing.pool.ThreadPool",
"pandas.read_excel",
"pandas.DataFrame",
"datetime.timedelta",
"pandas.concat",
"pandas.to_datetime"
] | [((831, 846), 'download.install', 'install', (['"""xlrd"""'], {}), "('xlrd')\n", (838, 846), False, 'from download import install\n'), ((1183, 1296), 'pandas.read_csv', 'pd.read_csv', (['src'], {'sep': '"""|"""', 'thousands': '"""."""', 'dtype': "{'origen': 'string', 'destino': 'string'}", 'compression': '"""gzip"""'})... |
'''
Max-Planck-Gesellschaft zur Foerderung der Wissenschaften e.V. (MPG) is holder of all proprietary rights on this computer program.
Using this computer program means that you agree to the terms in the LICENSE file (https://flame.is.tue.mpg.de/modellicense) included
with the FLAME model. Any use not explicitly gran... | [
"scipy.sparse.linalg.cg",
"numpy.union1d",
"numpy.random.rand",
"fitting.util.write_simple_obj",
"fitting.util.safe_mkdir",
"smpl_webuser.serialization.load_model",
"numpy.arange",
"os.path.join",
"fitting.landmarks.load_embedding",
"fitting.landmarks.landmark_error_3d",
"fitting.util.get_unit_f... | [((2280, 2311), 'numpy.union1d', 'np.union1d', (['shape_idx', 'expr_idx'], {}), '(shape_idx, expr_idx)\n', (2290, 2311), True, 'import numpy as np\n'), ((2782, 2938), 'fitting.landmarks.landmark_error_3d', 'landmark_error_3d', ([], {'mesh_verts': 'model', 'mesh_faces': 'model.f', 'lmk_3d': 'lmk_3d', 'lmk_face_idx': 'lm... |
import argparse
import os
import re
import time
import numpy as np
from time import sleep
from datasets import audio
import tensorflow as tf
from hparams import hparams, hparams_debug_string
from infolog import log
from tacotron.synthesizer import Synthesizer
from tqdm import tqdm
def generate_fast(model, text):
mod... | [
"tacotron.synthesizer.Synthesizer",
"os.makedirs",
"tqdm.tqdm",
"os.path.join",
"infolog.log",
"time.sleep",
"os.path.normpath",
"tensorflow.train.get_checkpoint_state",
"datasets.audio.inv_mel_spectrogram",
"os.path.basename",
"hparams.hparams_debug_string",
"time.time",
"numpy.save"
] | [((505, 518), 'tacotron.synthesizer.Synthesizer', 'Synthesizer', ([], {}), '()\n', (516, 518), False, 'from tacotron.synthesizer import Synthesizer\n'), ((719, 733), 'infolog.log', 'log', (['greetings'], {}), '(greetings)\n', (722, 733), False, 'from infolog import log\n'), ((1119, 1151), 'os.path.join', 'os.path.join'... |
# 引入类库
import tensorflow as tf
import numpy as np
from tensorflow import keras
# 使用下述语句来查看tensorflow版本,以下代码都是2.0版的
print(tf.__version__)
# 使用array来组织数据整理
xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)
ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float)
# 定义模型model,该模型是具有一个输入(input_shape[1])和一个... | [
"numpy.array",
"tensorflow.keras.layers.Dense"
] | [((161, 215), 'numpy.array', 'np.array', (['[-1.0, 0.0, 1.0, 2.0, 3.0, 4.0]'], {'dtype': 'float'}), '([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)\n', (169, 215), True, 'import numpy as np\n'), ((222, 277), 'numpy.array', 'np.array', (['[-3.0, -1.0, 1.0, 3.0, 5.0, 7.0]'], {'dtype': 'float'}), '([-3.0, -1.0, 1.0, 3.0, ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 6 15:54:30 2018
@author: Brendan
"""
"""
######################
# run with:
# $ mpiexec -n N python preProcessFITS.py --processed_dir DIR --raw_dir DIR
# N = = number of processors
######################
"""
import glob
import numpy as np
import astropy.units as u
from... | [
"sunpy.physics.solar_rotation.calculate_solar_rotate_shift",
"numpy.hstack",
"numpy.array_split",
"numpy.array",
"sys.exit",
"numpy.save",
"os.remove",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.empty",
"numpy.min",
"numpy.argmin",
"glob.glob",
"numpy.abs",
"n... | [((857, 913), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""preProcessFITS.py"""'}), "(description='preProcessFITS.py')\n", (880, 913), False, 'import argparse\n'), ((4966, 4979), 'sunpy.map.Map', 'Map', (['flist[0]'], {}), '(flist[0])\n', (4969, 4979), False, 'from sunpy.map import Map... |
from distutils.core import setup, Extension
import os
import numpy
H2PACK_DIR = ".."
extra_cflags = ["-I"+H2PACK_DIR+"/include"]
extra_cflags += ["-g", "-std=gnu99", "-O3"]
extra_cflags += ["-DUSE_MKL", "-qopenmp", "-xHost", "-mkl"]
LIB = [H2PACK_DIR+"/lib/libH2Pack.a"]
extra_lflags = LIB + ["-g", "-O3", "-qopenmp"... | [
"numpy.get_include"
] | [((717, 736), 'numpy.get_include', 'numpy.get_include', ([], {}), '()\n', (734, 736), False, 'import numpy\n')] |
import torch
from torch import nn
import numpy as np
import pytorch_lightning as pl
from .interpolations import TrilinearInterpolation
from .utils import *
class DirectVolumeRendering(nn.Module):
def __init__(self,
n_ray_samples,
feature_img_resolution,
depth_ran... | [
"numpy.radians",
"torch.ones_like",
"torch.rand_like",
"torch.stack",
"torch.cat",
"torch.randn_like",
"torch.arange",
"torch.tensor",
"torch.inverse",
"torch.linspace",
"torch.zeros",
"torch.all",
"torch.ones"
] | [((10269, 10310), 'torch.cat', 'torch.cat', (['[di_mid, di[..., -1:]]'], {'dim': '(-1)'}), '([di_mid, di[..., -1:]], dim=-1)\n', (10278, 10310), False, 'import torch\n'), ((10328, 10368), 'torch.cat', 'torch.cat', (['[di[..., :1], di_mid]'], {'dim': '(-1)'}), '([di[..., :1], di_mid], dim=-1)\n', (10337, 10368), False, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
GOAL
Compute time-mean OHF in each grid cell
PROGRAMMER
<NAME>
LAST UPDATE
29/04/2020
'''
# Options
exp = 'D012'
save_var = True
start_year = 2130
end_year = 2179
# Standard libraries
import numpy as np
from netCDF4 import Dataset
import time
start_time ... | [
"numpy.size",
"netCDF4.Dataset",
"numpy.nanmean",
"numpy.load",
"time.time",
"numpy.save"
] | [((322, 333), 'time.time', 'time.time', ([], {}), '()\n', (331, 333), False, 'import time\n'), ((668, 685), 'numpy.load', 'np.load', (['filename'], {}), '(filename)\n', (675, 685), True, 'import numpy as np\n'), ((773, 800), 'netCDF4.Dataset', 'Dataset', (['filename'], {'mode': '"""r"""'}), "(filename, mode='r')\n", (7... |
#!/usr/bin/env python3
import os, sys, platform, math
import ctypes as ct
import numpy as np
class DubinsWrapper:
libgdip = None
def init_library(self):
try:
file_extension = '.so'
if platform.system() =='cli':
file_extension = '.dll'
elif platform... | [
"ctypes.CFUNCTYPE",
"os.path.dirname",
"platform.system",
"ctypes.c_double",
"ctypes.CDLL",
"numpy.arange"
] | [((3432, 3445), 'ctypes.c_double', 'ct.c_double', ([], {}), '()\n', (3443, 3445), True, 'import ctypes as ct\n'), ((4623, 4636), 'ctypes.c_double', 'ct.c_double', ([], {}), '()\n', (4634, 4636), True, 'import ctypes as ct\n'), ((6274, 6287), 'ctypes.c_double', 'ct.c_double', ([], {}), '()\n', (6285, 6287), True, 'impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 18 13:40:20 2020
@author: tjards
This module implements potential fields for obstacle avoidance
based on the technique @ ref: https://arxiv.org/pdf/1704.04672.pdf
"""
import numpy as np
class potentialField:
def __init__(self, traj, Po, ga... | [
"numpy.multiply",
"numpy.power",
"numpy.squeeze",
"numpy.array",
"numpy.zeros",
"numpy.linalg.norm"
] | [((1551, 1575), 'numpy.zeros', 'np.zeros', (['(3, self.nObs)'], {}), '((3, self.nObs))\n', (1559, 1575), True, 'import numpy as np\n'), ((1640, 1664), 'numpy.zeros', 'np.zeros', (['(1, self.nObs)'], {}), '((1, self.nObs))\n', (1648, 1664), True, 'import numpy as np\n'), ((1707, 1723), 'numpy.zeros', 'np.zeros', (['(3, ... |
import argparse
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import scipy as sp
import scipy.stats
import pyemma
from pyemma.util.contexts import settings
import MDAnalysis as mda
# My own functions
from pensa import *
def workflow_torsions_jsd(args, feat_a, feat_b, data_a, data_b, to... | [
"numpy.array",
"argparse.ArgumentParser"
] | [((5651, 5676), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5674, 5676), False, 'import argparse\n'), ((1442, 1457), 'numpy.array', 'np.array', (['relen'], {}), '(relen)\n', (1450, 1457), True, 'import numpy as np\n'), ((3317, 3332), 'numpy.array', 'np.array', (['ksana'], {}), '(ksana)\n', ... |
import numpy as np
import pytest
from nanomesh import MeshContainer, Mesher3D, TetraMesh, TriangleMesh
from nanomesh.image2mesh._mesher3d import BoundingBox, pad
@pytest.fixture
def image_cube():
from nanomesh import Volume
data = np.ones([10, 10, 10], dtype=int)
data[2:7, 2:7, 2:7] = 0
return Volu... | [
"nanomesh.image2mesh._mesher3d.BoundingBox",
"numpy.ones",
"numpy.unique",
"nanomesh.TriangleMesh",
"nanomesh.image2mesh._mesher3d.BoundingBox.from_points",
"nanomesh.Volume",
"pytest.mark.parametrize",
"numpy.array",
"nanomesh.image2mesh._mesher3d.pad",
"pytest.raises",
"nanomesh.Mesher3D"
] | [((2247, 2800), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""side,label,name,expected_labels"""', "(('left', None, None, {(1): 633, (2): 1729, (3): 290}), ('front', 1, None,\n {(1): 857, (2): 1851}), ('back', 2, None, {(1): 620, (2): 1966}), (\n 'left', 3, None, {(1): 633, (2): 1729, (3): 290}), ('... |
from __future__ import division
from glob import glob
import os.path as osp
import os
import random
import subprocess
import argparse
import tensorflow as tf
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from utils.data import load_img , darken, gen_istd
os.environ["CUDA_VISIBLE_DEVICES"]=str... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"subprocess.Popen",
"os.path.join",
"random.seed",
"utils.data.gen_istd",
"numpy.random.seed",
"tensorflow.set_random_seed"
] | [((505, 525), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (519, 525), True, 'import numpy as np\n'), ((526, 550), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (544, 550), True, 'import tensorflow as tf\n'), ((551, 568), 'random.seed', 'random.seed', (['seed'], {... |
import csv
import cv2
import numpy as np
import math
import tensorflow as tf
import time
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from keras.preprocessing.image import ImageDataGenerator
from keras import regularizers
from keras.models import Sequential
from keras.layers i... | [
"keras.layers.Conv2D",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.array",
"keras.layers.Dense",
"keras.layers.Cropping2D",
"numpy.random.random",
"numpy.concatenate",
"csv.reader",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"sklearn.model_selectio... | [((5890, 5901), 'time.time', 'time.time', ([], {}), '()\n', (5899, 5901), False, 'import time\n'), ((1921, 1993), 'sklearn.model_selection.train_test_split', 'train_test_split', (['images', 'measurements'], {'test_size': 'split', 'random_state': '(40)'}), '(images, measurements, test_size=split, random_state=40)\n', (1... |
"""
Simple main file to test the cython wrappers for the c functions
"""
from dummy_data import py_get_numbers
import numpy as np
if __name__ == "__main__":
numbers = np.array(py_get_numbers(5))
print(numbers)
print("Sum of numbers: ", np.sum(numbers))
| [
"numpy.sum",
"dummy_data.py_get_numbers"
] | [((182, 199), 'dummy_data.py_get_numbers', 'py_get_numbers', (['(5)'], {}), '(5)\n', (196, 199), False, 'from dummy_data import py_get_numbers\n'), ((250, 265), 'numpy.sum', 'np.sum', (['numbers'], {}), '(numbers)\n', (256, 265), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import numpy as np
from dbquery import DBQuery
class Evaluator(object):
def __init__(self, data_dir, cfg):
self.db = DBQuery(data_dir)
self.cfg = cfg
def _init_dict(self):
dic = {}
for domain in self.cfg.belief_domains:
dic[domain] = {}
... | [
"numpy.mean",
"dbquery.DBQuery"
] | [((156, 173), 'dbquery.DBQuery', 'DBQuery', (['data_dir'], {}), '(data_dir)\n', (163, 173), False, 'from dbquery import DBQuery\n'), ((4067, 4081), 'numpy.mean', 'np.mean', (['score'], {}), '(score)\n', (4074, 4081), True, 'import numpy as np\n')] |
# Variables
DATASET_PATH = '../data/'
MODEL = 'ResNet13'
RESULT_PATH = './result_' + MODEL + '/'
DEBUG = False
GPU = True
# Shared parameters
epochs = 20
momentum = 0.9
# Import the necessary libraries
import numpy as np
import torch
import matplotlib.pyplot as plt
import json
import time
from tqdm import tqdm
# Dev... | [
"mlp4.MLP4",
"torch.nn.CrossEntropyLoss",
"torch.exp",
"numpy.array",
"torch.cuda.is_available",
"time.process_time_ns",
"lenet.LeNet5",
"resnet.resnet28_13",
"matplotlib.pyplot.subplots",
"torchvision.transforms.ToTensor",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.savefig",
"vgg11.VGG11",... | [((3256, 3344), 'torchvision.datasets.FashionMNIST', 'datasets.FashionMNIST', (['DATASET_PATH'], {'download': '(True)', 'train': '(True)', 'transform': 'transform'}), '(DATASET_PATH, download=True, train=True, transform=\n transform)\n', (3277, 3344), False, 'from torchvision import datasets\n'), ((3356, 3445), 'tor... |
from principal_DNN_MNIST import *
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
# Reloading modules just in case
if __name__ == "__main__" :
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data(path="mnist.npz")
data_mnist = scale_and_read_img(x_train)
... | [
"matplotlib.pyplot.grid",
"tensorflow.keras.datasets.mnist.load_data",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend"
] | [((221, 272), 'tensorflow.keras.datasets.mnist.load_data', 'tf.keras.datasets.mnist.load_data', ([], {'path': '"""mnist.npz"""'}), "(path='mnist.npz')\n", (254, 272), True, 'import tensorflow as tf\n'), ((2462, 2489), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 6)'}), '(figsize=(15, 6))\n', (2472, ... |
import os
import time
import sqlalchemy
import numpy as np
import pandas as pd
import datetime as dt
# Used to record elapsed time
start_time = time.time()
# Define unit constants
CUBE_IN_PER_GALLON = 231
CUBE_IN_PER_CUBIC_FT = 1728
# The default length of time between 'prior_date' and 'current_date' if incomplete d... | [
"pandas.isnull",
"pandas.DataFrame",
"datetime.datetime.strptime",
"sqlalchemy.create_engine",
"os.path.join",
"datetime.timedelta",
"numpy.timedelta64",
"numpy.datetime64",
"pandas.read_sql_table",
"pandas.ExcelWriter",
"time.time"
] | [((145, 156), 'time.time', 'time.time', ([], {}), '()\n', (154, 156), False, 'import time\n'), ((400, 450), 'os.path.join', 'os.path.join', (['"""SQLiteWaterUsage"""', '"""student.sqlite"""'], {}), "('SQLiteWaterUsage', 'student.sqlite')\n", (412, 450), False, 'import os\n'), ((460, 508), 'sqlalchemy.create_engine', 's... |
from ast import literal_eval
import json
import requests
import csv
from io import StringIO
from flask import Flask, request, jsonify, Response
import psycopg2
from numpy import transpose, array
from bm25 import BM25L
from preprocessing import preprocess
SELECT_CORPUS_FIELDS = "SELECT code, name, txt_ementa FROM corp... | [
"psycopg2.connect",
"preprocessing.preprocess",
"json.loads",
"requests.Session",
"flask.Flask",
"bm25.BM25L",
"flask.request.data.decode",
"ast.literal_eval",
"numpy.array",
"flask.Response",
"io.StringIO",
"numpy.transpose",
"csv.reader",
"flask.jsonify"
] | [((832, 850), 'requests.Session', 'requests.Session', ([], {}), '()\n', (848, 850), False, 'import requests\n'), ((891, 996), 'psycopg2.connect', 'psycopg2.connect', ([], {'host': '"""ulyssesdb"""', 'database': '"""admin"""', 'user': '"""admin"""', 'password': '"""<PASSWORD>"""', 'port': '(5432)'}), "(host='ulyssesdb',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 25 07:32:21 2019
@author: thomas
"""
import numpy as np
import sounddevice as sd
from scipy.io.wavfile import read
import matplotlib.pyplot as plt
# quantize samples
def quantize(x,Rmin,Rmax):
xhat=np.zeros(np.size(x))
indx=0
for... | [
"matplotlib.pyplot.savefig",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.size",
"sounddevice.play",
"numpy.array",
"scipy.io.wavfile.read",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.ylim",
"matplotlib.pypl... | [((497, 522), 'numpy.arange', 'np.arange', (['minv', 'maxv', 'Dv'], {}), '(minv, maxv, Dv)\n', (506, 522), True, 'import numpy as np\n'), ((592, 644), 'scipy.io.wavfile.read', 'read', (['"""/usr/share/sounds/alsa/Rear_Center.wav"""', '"""rb"""'], {}), "('/usr/share/sounds/alsa/Rear_Center.wav', 'rb')\n", (596, 644), Fa... |
import os
import re
#from tqdm import tqdm
import numpy as np
import pandas as pd
import preprocessor as tp
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
tp.set_options(tp.OPT.URL,tp.OPT.MENTION)
#import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_spli... | [
"pandas.read_csv",
"re.compile",
"jsonlines.open",
"numpy.array",
"copy.deepcopy",
"os.path.exists",
"preprocessor.clean",
"os.listdir",
"pandas.set_option",
"sklearn.naive_bayes.MultinomialNB",
"pandas.DataFrame",
"os.path.getsize",
"json.loads",
"sklearn.model_selection.train_test_split"... | [((109, 148), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (122, 148), True, 'import pandas as pd\n'), ((149, 191), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (162, 191), True, '... |
import os
import cv2
import copy
import shutil
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
from sklearn.metrics import roc_auc_score
from models.scse import SCSEUnet
gpu_ids = '0, 1'
os.environ['CUDA_VISIBLE_DEVICES'] = gpu_i... | [
"numpy.uint8",
"torch.utils.data.DataLoader",
"numpy.logical_not",
"torch.from_numpy",
"numpy.array",
"copy.deepcopy",
"os.path.exists",
"numpy.mean",
"os.listdir",
"models.scse.SCSEUnet",
"numpy.max",
"numpy.concatenate",
"numpy.min",
"torchvision.transforms.ToTensor",
"numpy.ones",
"... | [((2342, 2418), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'test_dataset', 'batch_size': '(1)', 'shuffle': '(False)', 'num_workers': '(1)'}), '(dataset=test_dataset, batch_size=1, shuffle=False, num_workers=1)\n', (2352, 2418), False, 'from torch.utils.data import DataLoader, Dataset\n'), ((2849, 290... |
import pandas as pd
import numpy as np
import os
import glob
from datetime import datetime, timedelta
import gzip
import time
import pkg_resources
import logging
from joblib import Parallel, delayed
from tempset.logger import Logger
class AggregateOutput(Logger):
def __init__(self,
... | [
"datetime.datetime",
"pandas.read_csv",
"gzip.open",
"pandas.to_datetime",
"os.path.join",
"logging.info",
"os.getcwd",
"os.chdir",
"pandas.concat",
"glob.glob",
"pandas.DataFrame",
"datetime.timedelta",
"time.time",
"numpy.arange"
] | [((563, 574), 'time.time', 'time.time', ([], {}), '()\n', (572, 574), False, 'import time\n'), ((601, 667), 'os.path.join', 'os.path.join', (['output_dir', 'f"""tempset_logfile_{self.start_time}.log"""'], {}), "(output_dir, f'tempset_logfile_{self.start_time}.log')\n", (613, 667), False, 'import os\n'), ((873, 927), 'l... |
#! /usr/bin/env python
"""
This is a small self-contained application that demonstrates usage of networks deployed from Barista
in other applications. If net definition and weight's files obtained by training the caffe mnist example
are supplied via command line parameters, the user can draw digits [0-9] in the window... | [
"pygame.draw.circle",
"pygame.quit",
"argparse.ArgumentParser",
"caffe.io.Transformer",
"pygame.display.set_mode",
"pygame.display.flip",
"numpy.round",
"pygame.event.wait",
"numpy.zeros",
"pygame.PixelArray",
"caffe.Net",
"numpy.transpose",
"numpy.arange"
] | [((733, 905), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Interactively classify handwritten digits using neural nets."""', 'epilog': '__doc__', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description=\n 'Interactively classify handwritten digits using neural nets.', ep... |
import logging
import numpy as np
from .spaic2 import spaic2_betaspect as bs
from .spaic2 import spaic2_pot2density as p2d
logging.basicConfig(level=logging.INFO)
EPS = 1.0**-6
class Spaic2Solver:
logger = logging.getLogger(name='Spaic2Solver')
default_woodsaxon_params = np.array([
0.84, 0.39,... | [
"logging.basicConfig",
"logging.getLogger",
"matplotlib.pyplot.grid",
"numpy.float64",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((125, 164), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (144, 164), False, 'import logging\n'), ((215, 253), 'logging.getLogger', 'logging.getLogger', ([], {'name': '"""Spaic2Solver"""'}), "(name='Spaic2Solver')\n", (232, 253), False, 'import logging\n'), (... |
import numpy as np
from scipy import stats
def create_data(N = 10):
a = np.random.randn(N) + 2 #mean = 2, var = 1
b = np.random.randn(N) #mean = 0, var = 1
return a, b
def variance(a,b):
var_a = a.var(ddof = 1) #Numpy uses the population (N) and not sample (N-1), thus pass ddof = 1
var_b = b.var... | [
"scipy.stats.t.cdf",
"numpy.sqrt",
"numpy.random.randn",
"scipy.stats.ttest_ind"
] | [((127, 145), 'numpy.random.randn', 'np.random.randn', (['N'], {}), '(N)\n', (142, 145), True, 'import numpy as np\n'), ((461, 489), 'numpy.sqrt', 'np.sqrt', (['((var_a + var_b) / 2)'], {}), '((var_a + var_b) / 2)\n', (468, 489), True, 'import numpy as np\n'), ((984, 1005), 'scipy.stats.ttest_ind', 'stats.ttest_ind', (... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import collections
import csv
import json
import sys
import numpy as np
EXISTING = 'existing'
OCCURRENCE = 'occurrence'
EXISTING_PERCENTAGE = 'existing_percentage'
NOTEXISTING_PERCENTAGE = 'notexisting_percentage'
NOTEXISTING = 'notexisting'
UNIQUE = 'unique... | [
"csv.DictWriter",
"numpy.mean",
"json.loads",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.std",
"numpy.var"
] | [((6162, 6285), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""return field statistics of an line-delimited JSON Document or Input-Stream"""'}), "(description=\n 'return field statistics of an line-delimited JSON Document or Input-Stream'\n )\n", (6185, 6285), False, 'import argpar... |
import numpy as np
import BPNN_model, KNN_sequence_Model
import RNN_models, CNN_models, AttentionModel, Incremental_Learning_models
import configparser
import json
import time
def rnn_exams(sequence_fix_length, foresight_steps, class_num, data, training_sample_ids, test_sample_ids, cell_type, random_seed=None):
p... | [
"BPNN_model.BPNN",
"configparser.ConfigParser",
"RNN_models.FixedLengthRNN",
"KNN_sequence_Model.KNN_Sequence",
"numpy.load",
"AttentionModel.CNN_Attention",
"json.load",
"Incremental_Learning_models.Incremental_CNN_Attention",
"time.time",
"CNN_models.ConvSequence2One"
] | [((448, 567), 'RNN_models.FixedLengthRNN', 'RNN_models.FixedLengthRNN', (['sequence_fix_length', "data['features'].shape[1]"], {'class_num': 'class_num', 'cell_type': 'cell_type'}), "(sequence_fix_length, data['features'].shape[1],\n class_num=class_num, cell_type=cell_type)\n", (473, 567), False, 'import RNN_models... |
'''
###############################################################################
"MajoranaNanowire" Python3 Module
v 1.0 (2020)
Created by <NAME> (2018)
###############################################################################
... | [
"numpy.prod",
"numpy.sqrt",
"numpy.random.rand",
"numpy.argsort",
"numpy.array",
"numpy.sin",
"numpy.gradient",
"numpy.arange",
"numpy.repeat",
"numpy.isscalar",
"numpy.ndim",
"numpy.exp",
"numpy.linspace",
"numpy.dot",
"numpy.concatenate",
"numpy.meshgrid",
"numpy.abs",
"numpy.til... | [((1494, 1518), 'numpy.seterr', 'np.seterr', ([], {'over': '"""ignore"""'}), "(over='ignore')\n", (1503, 1518), True, 'import numpy as np\n'), ((1523, 1549), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (1532, 1549), True, 'import numpy as np\n'), ((2929, 2956), 'numpy.seterr', ... |
#%%
import pytest
import numpy as np
from natural_bm import dbm
import natural_bm.backend as B
from natural_bm.utils_testing import nnet_for_testing
#%%
def test_prep_topology():
topology_dict = {0: {1}}
pairs, topology_input_dict = dbm.prep_topology(topology_dict)
assert pairs == [(0, 1)]
assert top... | [
"natural_bm.utils_testing.nnet_for_testing",
"natural_bm.dbm.prep_topology",
"pytest.main",
"pytest.mark.parametrize",
"numpy.zeros",
"pytest.raises",
"natural_bm.backend.eval"
] | [((974, 1081), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nnet_type"""', "['rbm', 'dbm', 'dbm_complex']"], {'ids': "['rbm', 'dbm', 'dbm_complex']"}), "('nnet_type', ['rbm', 'dbm', 'dbm_complex'], ids=[\n 'rbm', 'dbm', 'dbm_complex'])\n", (997, 1081), False, 'import pytest\n'), ((1677, 1784), 'pytest... |
import numpy as np
import pandas as pd
import RecSysALS
import RecSysKNN
import RecSysNMF
from RecSysExampleData20Items import RecSysExampleData20Items
class ArticleAntidoteData():
def __init__(self, n_users, n_movies, top_users, top_movies, l, theta, k):
self.n_users = n_users
self.n_movi... | [
"pandas.Series",
"numpy.nanmean",
"RecSysExampleData20Items.RecSysExampleData20Items.read_movieitems",
"RecSysALS.als_RecSysALS",
"RecSysExampleData20Items.RecSysExampleData20Items"
] | [((7170, 7191), 'pandas.Series', 'pd.Series', (['omega_user'], {}), '(omega_user)\n', (7179, 7191), True, 'import pandas as pd\n'), ((7636, 7653), 'pandas.Series', 'pd.Series', (['losses'], {}), '(losses)\n', (7645, 7653), True, 'import pandas as pd\n'), ((8472, 8500), 'pandas.Series', 'pd.Series', (['user_group_losses... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 12 12:05:47 2020
@author: Samyak
"""
#==============================================================================
# REGRESSION MODEL - PREDICTING PRICE OF PRE OWNED CARS
#==============================================================================
import numpy as n... | [
"numpy.mean",
"seaborn.set",
"seaborn.regplot",
"numpy.sqrt",
"sklearn.ensemble.RandomForestRegressor",
"pandas.read_csv",
"seaborn.distplot",
"sklearn.model_selection.train_test_split",
"numpy.log",
"pandas.crosstab",
"pandas.set_option",
"seaborn.boxplot",
"pandas.get_dummies",
"sklearn.... | [((385, 424), 'seaborn.set', 'sns.set', ([], {'rc': "{'figure.figsize': (10, 8)}"}), "(rc={'figure.figsize': (10, 8)})\n", (392, 424), True, 'import seaborn as sns\n'), ((484, 515), 'pandas.read_csv', 'pd.read_csv', (['"""cars_sampled.csv"""'], {}), "('cars_sampled.csv')\n", (495, 515), True, 'import pandas as pd\n'), ... |
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
from src.models.text_classifier import run_model_on_file
from src.models.text_classifier import TextClassifier
from utils import get_conf_labels as get_conf_labels
from utils.bootstrap import my_bootstrap
from utils.get_pars_data import g... | [
"numpy.unique",
"pandas.read_csv",
"utils.clean_n_split.clean_n_split",
"pandas.concat",
"utils.get_pars_data.get_par_data"
] | [((1111, 1168), 'pandas.concat', 'pd.concat', (['[full_par_data, false_data]'], {'ignore_index': '(True)'}), '([full_par_data, false_data], ignore_index=True)\n', (1120, 1168), True, 'import pandas as pd\n'), ((1411, 1515), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\develop\\\\code\\\\semi-supervised-text-classifica... |
import numpy as np
def generate_noise(size, beta):
white_noise = np.random.randn(*size)
white_noise_fft = np.fft.fftn(white_noise)
ndims = len(size)
freq_along_axis = []
for axis in range(ndims):
freq_along_axis.append(np.fft.fftfreq(size[axis]))
grids = np.meshgrid(*freq_along_ax... | [
"numpy.abs",
"numpy.sqrt",
"numpy.power",
"numpy.fft.fftfreq",
"numpy.fft.fftn",
"numpy.meshgrid",
"numpy.fft.ifftn",
"numpy.random.randn"
] | [((75, 97), 'numpy.random.randn', 'np.random.randn', (['*size'], {}), '(*size)\n', (90, 97), True, 'import numpy as np\n'), ((120, 144), 'numpy.fft.fftn', 'np.fft.fftn', (['white_noise'], {}), '(white_noise)\n', (131, 144), True, 'import numpy as np\n'), ((294, 323), 'numpy.meshgrid', 'np.meshgrid', (['*freq_along_axis... |
# -*- coding: utf-8 -*-
import numpy as np
import math
import numpy as np
from collections import Counter
def createDataSet():
X = []
Y = []
filename = 'credit.txt'
temp_X = []
data = np.genfromtxt(filename, delimiter=None,dtype=str)
for n in range(1, len(data)):
Y.append(data[n][6])
... | [
"numpy.array",
"numpy.genfromtxt",
"math.log"
] | [((204, 254), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': 'None', 'dtype': 'str'}), '(filename, delimiter=None, dtype=str)\n', (217, 254), True, 'import numpy as np\n'), ((486, 497), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (494, 497), True, 'import numpy as np\n'), ((506, 517), 'numpy.arr... |
import math
import quaternion
import numpy as np
from plyfile import PlyData, PlyElement
def write_ply(points, filename, text=True):
""" input: Nx3, write points to filename as PLY format. """
points = [(points[i,0], points[i,1], points[i,2]) for i in range(points.shape[0])]
vertex = np.array(points, dtyp... | [
"numpy.argsort",
"numpy.array",
"numpy.sin",
"numpy.where",
"numpy.max",
"numpy.stack",
"numpy.dot",
"numpy.vstack",
"plyfile.PlyElement.describe",
"numpy.concatenate",
"numpy.maximum",
"numpy.eye",
"numpy.ones",
"numpy.random.choice",
"math.atan2",
"numpy.cos",
"numpy.quaternion",
... | [((299, 362), 'numpy.array', 'np.array', (['points'], {'dtype': "[('x', 'f4'), ('y', 'f4'), ('z', 'f4')]"}), "(points, dtype=[('x', 'f4'), ('y', 'f4'), ('z', 'f4')])\n", (307, 362), True, 'import numpy as np\n'), ((371, 431), 'plyfile.PlyElement.describe', 'PlyElement.describe', (['vertex', '"""vertex"""'], {'comments'... |
#!/usr/bin/env python3.5
import argparse
import logging
import time
import cv2
import numpy as np
import tensorflow as tf
from tf_pose import common
from tf_pose.estimator import TfPoseEstimator
from tf_pose.networks import get_graph_path, model_wh
import datetime
from threading import Thread
import pickle
import i... | [
"logging.getLogger",
"logging.StreamHandler",
"time.sleep",
"tensorflow.train.Int64List",
"cv2.imshow",
"cv2.destroyAllWindows",
"tf_pose.networks.model_wh",
"argparse.ArgumentParser",
"tf_pose.networks.get_graph_path",
"tensorflow.train.FloatList",
"cv2.waitKey",
"numpy.floor",
"pickle.load... | [((1889, 1932), 'logging.getLogger', 'logging.getLogger', (['"""TfPoseEstimator-WebCam"""'], {}), "('TfPoseEstimator-WebCam')\n", (1906, 1932), False, 'import logging\n'), ((1969, 1992), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1990, 1992), False, 'import logging\n'), ((2032, 2105), 'logging... |
# -*- coding: utf-8 -*-
"""Tests for the models.model_api of hydromt."""
import os
from os.path import join, isfile
import xarray as xr
import numpy as np
from affine import Affine
import logging
from pyflwdir import core_d8
import hydromt
from hydromt import raster
from hydromt.models import MODELS
from hydromt.mode... | [
"logging.getLogger",
"numpy.random.rand",
"hydromt.raster.RasterDataset.from_numpy",
"os.path.join",
"xarray.Dataset",
"os.path.isfile",
"numpy.array",
"numpy.random.randint",
"xarray.where",
"affine.Affine",
"xarray.open_dataset",
"pyflwdir.core_d8._ds.ravel"
] | [((381, 408), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (398, 408), False, 'import logging\n'), ((2596, 2615), 'pyflwdir.core_d8._ds.ravel', 'core_d8._ds.ravel', ([], {}), '()\n', (2613, 2615), False, 'from pyflwdir import core_d8\n'), ((2709, 2743), 'numpy.array', 'np.array', (['[0,... |
import datetime
import random
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import torch
import torch.nn as nn
from absl import app, flags, logging
from loguru import logger
from scipy import stats
from sklearn import metrics, model_selection
from sklear... | [
"torch.manual_seed",
"torch.utils.tensorboard.SummaryWriter",
"loguru.logger.add",
"engine.predict_fn",
"loguru.logger.info",
"random.seed",
"absl.flags.DEFINE_boolean",
"model.BERTBaseUncased",
"absl.app.run",
"datetime.datetime.now",
"numpy.random.seed",
"dataset.BERTDataset",
"torch.utils... | [((633, 650), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (644, 650), False, 'import random\n'), ((651, 671), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (665, 671), True, 'import numpy as np\n'), ((672, 695), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (68... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import math
mpl.rcParams['text.usetex'] = True
def plotPD(data1, label1, data2, label2, fname):
max1 = np.amax(data1)
max2 = np.amax(data2)
maxx = 1.1*max(max1, max2)
data1[data1[:,1] == -1, ... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.hlines",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.tight_layout",
"numpy.loadtxt",
... | [((1441, 1491), 'numpy.loadtxt', 'np.loadtxt', (["(dirr + 'ripsdragon.txt')"], {'delimiter': '""","""'}), "(dirr + 'ripsdragon.txt', delimiter=',')\n", (1451, 1491), True, 'import numpy as np\n'), ((1498, 1563), 'numpy.loadtxt', 'np.loadtxt', (['"""Datasets/Dragon/DoryH1_pers_data.txt"""'], {'delimiter': '""","""'}), "... |
# -*- coding: utf-8 -*-
"""
Helper functions and classes for general use.
"""
from __future__ import division
from functools import partial, update_wrapper
from time import localtime, strftime
import numpy as np
from numpy.linalg import norm
import rospy
from geometry_msgs.msg import Point, PoseStamped, Quaternion
f... | [
"tf.transformations.euler_from_quaternion",
"numpy.identity",
"numpy.sqrt",
"numpy.cross",
"numpy.arccos",
"numpy.asarray",
"numpy.append",
"numpy.array",
"rospy.Time.now",
"geometry_msgs.msg.Point",
"functools.partial",
"geometry_msgs.msg.PoseStamped",
"geometry_msgs.msg.Quaternion",
"num... | [((779, 796), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {}), '(v)\n', (793, 796), True, 'import numpy as np\n'), ((859, 872), 'numpy.asarray', 'np.asarray', (['v'], {}), '(v)\n', (869, 872), True, 'import numpy as np\n'), ((989, 1015), 'functools.update_wrapper', 'update_wrapper', (['self', 'func'], {}), '(self, f... |
"""
let's be simple
"""
import os
import sys
sys.path.append("../../../../")
import swhlab
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
import time
class ABF2(swhlab.ABF):
def simple(self,plotToo=True):
# RMS percentile
perRMS=75
perPSC=1... | [
"numpy.copy",
"numpy.arange",
"matplotlib.pyplot.plot",
"os.path.join",
"matplotlib.pyplot.axhline",
"numpy.nanmean",
"matplotlib.pyplot.figure",
"numpy.percentile",
"matplotlib.pyplot.title",
"numpy.load",
"sys.path.append",
"matplotlib.pyplot.margins",
"matplotlib.pyplot.show"
] | [((46, 77), 'sys.path.append', 'sys.path.append', (['"""../../../../"""'], {}), "('../../../../')\n", (61, 77), False, 'import sys\n'), ((2468, 2496), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 10)'}), '(figsize=(15, 10))\n', (2478, 2496), True, 'import matplotlib.pyplot as plt\n'), ((2626, 2636),... |
import numpy as np
def shift_mutation(perm):
"""
Performs a shift mutation on a permutation
"""
n = len(perm)
i = np.random.choice(n, 2, replace = False)
i = np.sort(i)
i0 = i[0]
i1 = i[1]
perm = np.concatenate((perm[i1:], perm[i0:i1], perm[:i0][::-1]))
return perm
def swap_m... | [
"numpy.roll",
"numpy.random.choice",
"numpy.sort",
"numpy.exp",
"numpy.concatenate",
"numpy.random.uniform",
"numpy.arange"
] | [((136, 173), 'numpy.random.choice', 'np.random.choice', (['n', '(2)'], {'replace': '(False)'}), '(n, 2, replace=False)\n', (152, 173), True, 'import numpy as np\n'), ((184, 194), 'numpy.sort', 'np.sort', (['i'], {}), '(i)\n', (191, 194), True, 'import numpy as np\n'), ((234, 291), 'numpy.concatenate', 'np.concatenate'... |
from collections import defaultdict
from typing import Dict
from matplotlib.animation import FuncAnimation
import matplotlib.gridspec as gs
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
import pandas as pd
def plot_infection_history(
g: nx.Graph,
pos: Dict[int, np.ndarray]... | [
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"collections.defaultdict",
"matplotlib.gridspec.GridSpecFromSubplotSpec",
"numpy.arange"
] | [((773, 800), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(16, 9)'}), '(figsize=(16, 9))\n', (783, 800), True, 'import matplotlib.pyplot as plt\n'), ((812, 874), 'matplotlib.gridspec.GridSpec', 'gs.GridSpec', ([], {'ncols': '(2)', 'nrows': '(1)', 'figure': 'fig', 'width_ratios': '[3, 2]'}), '(ncols=2, n... |
"""Pi-kalman"""
import numpy as np
from typing import Tuple
class LinearGaussianStateSpaceModel(object):
""" Minimal implementation of a linear gaussian (LG) state space model (SSM)
A (stationary) linear gaussian state space model is defined as:
z' = A * z + B * U + 𝛆 (transition model)
y' = C... | [
"numpy.eye",
"numpy.diag",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.concatenate"
] | [((4891, 4908), 'numpy.dot', 'np.dot', (['self.C', 'X'], {}), '(self.C, X)\n', (4897, 4908), True, 'import numpy as np\n'), ((6142, 6173), 'numpy.concatenate', 'np.concatenate', (['X_list'], {'axis': '(-1)'}), '(X_list, axis=-1)\n', (6156, 6173), True, 'import numpy as np\n'), ((8417, 8435), 'numpy.eye', 'np.eye', (['l... |
import numpy as np
class KMeans:
def __init__(self, k, dataset):
self.dataset = dataset
self.k = k
self.centroids = []
# Randomly choose centroids
self.randomize_centroids()
@staticmethod
def distance(point, centroid):
return np.linalg.norm(point-centroid... | [
"numpy.where",
"numpy.sum",
"numpy.linalg.norm"
] | [((291, 323), 'numpy.linalg.norm', 'np.linalg.norm', (['(point - centroid)'], {}), '(point - centroid)\n', (305, 323), True, 'import numpy as np\n'), ((710, 739), 'numpy.where', 'np.where', (['(self.predicted == c)'], {}), '(self.predicted == c)\n', (718, 739), True, 'import numpy as np\n'), ((1705, 1722), 'numpy.sum',... |
import sys
import math
import copy
import functools
from scipy.stats import binom
import numpy as np
import matplotlib.pyplot as plt
import collections as col
import scipy.optimize
nan = float("nan")
minf = float("-inf")
def is_smth_near(profile, v1, rng=2):
"""
Return index of something near if something e... | [
"numpy.hstack",
"math.log",
"numpy.array",
"copy.deepcopy",
"math.exp",
"numpy.mean",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.savefig",
"math.factorial",
"numpy.isnan",
"matplotlib.pyplot.title",
"numpy.vectorize",
"scipy.stats.binom.pmf",
"numpy.sum",
"... | [((3064, 3094), 'numpy.array', 'np.array', (['profiles.loc[sample]'], {}), '(profiles.loc[sample])\n', (3072, 3094), True, 'import numpy as np\n'), ((7255, 7290), 'numpy.zeros_like', 'np.zeros_like', (['deletes'], {'dtype': 'float'}), '(deletes, dtype=float)\n', (7268, 7290), True, 'import numpy as np\n'), ((7768, 7795... |
#! /usr/bin/env python
from __future__ import absolute_import, division, print_function
import argparse
import logging
import os
import numpy as np
import re
logger = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)-5.5s %(name)-20.20s %(levelname)-7.7s %(message)s",
datefmt="%H:%M",
l... | [
"logging.getLogger",
"logging.basicConfig",
"logging.debug",
"argparse.ArgumentParser",
"re.compile",
"numpy.logical_and",
"os.walk",
"logging.warning",
"numpy.sum",
"numpy.concatenate",
"numpy.savez_compressed",
"numpy.load",
"logging.error",
"numpy.save",
"numpy.random.permutation"
] | [((170, 197), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (187, 197), False, 'import logging\n'), ((198, 335), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)-5.5s %(name)-20.20s %(levelname)-7.7s %(message)s"""', 'datefmt': '"""%H:%M"""', 'level': 'logging... |
import os
import random
import torch
import numpy as np
def seed_torch(seed=0):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
seed_torch(9)
class attention_par... | [
"torch.manual_seed",
"torch.nn.Softmax",
"random.seed",
"numpy.random.seed",
"torch.cuda.manual_seed",
"torch.ones"
] | [((86, 103), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (97, 103), False, 'import random\n'), ((153, 173), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (167, 173), True, 'import numpy as np\n'), ((178, 201), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (195,... |
# -*- coding: utf-8 -*-
"""
@author: jzh
"""
import numpy as np, keras.backend as K
import tensorflow as tf
from keras.optimizers import Adam
from keras.layers import Input
from keras.models import Model
from src.VAE import get_gcn, get_gcn_vae_id, get_gcn_vae_exp
from src.data_utils import normalize_fromfile... | [
"numpy.fromfile",
"keras.backend.reshape",
"numpy.array",
"src.data_utils.normalize_fromfile",
"src.data_utils.data_recover",
"src.data_utils.denormalize_fromfile",
"numpy.save",
"numpy.arange",
"numpy.mean",
"numpy.repeat",
"scipy.sparse.eye",
"src.VAE.get_gcn",
"scipy.sparse.linalg.eigen.a... | [((1270, 1308), 'scipy.sparse.eye', 'sp.eye', (['adj.shape[0]'], {'dtype': 'np.float32'}), '(adj.shape[0], dtype=np.float32)\n', (1276, 1308), True, 'import scipy.sparse as sp\n'), ((1410, 1430), 'scipy.sparse.eye', 'sp.eye', (['adj.shape[0]'], {}), '(adj.shape[0])\n', (1416, 1430), True, 'import scipy.sparse as sp\n')... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 15 14:52:02 2021
@author: <NAME>
"""
# Importing Librries
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from sklearn.model_selection import train_test_split
from utils import boilerplate_model
#for creating ... | [
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.metrics.Precision",
"tensorflow.keras.metrics.Recall",
"numpy.array",
"tensorflow.keras.layers.Dense",
"pandas.DataFrame",
"tensorflow.keras.opt... | [((486, 511), 'pandas.read_csv', 'pd.read_csv', (['"""train1.csv"""'], {}), "('train1.csv')\n", (497, 511), True, 'import pandas as pd\n'), ((547, 570), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (558, 570), True, 'import pandas as pd\n'), ((740, 754), 'sklearn.preprocessing.LabelEnco... |
import numpy as np
""""
PARALLEL
"""
A = np.array([0,23,24,24])
A = np.ones((200))
dimension = 200
precision = 10
security = 100
ts = TemplateSecurity(A,precision,4)
wires_mult,wires_euc,et_list,et_euc,gc_euc,list_of_gc, keys_euc,keys_list_mult,square_sum_query,current,m = ts.parallel_euc_setup()
available_keys_euc =... | [
"numpy.array",
"numpy.zeros",
"numpy.ones"
] | [((43, 68), 'numpy.array', 'np.array', (['[0, 23, 24, 24]'], {}), '([0, 23, 24, 24])\n', (51, 68), True, 'import numpy as np\n'), ((70, 82), 'numpy.ones', 'np.ones', (['(200)'], {}), '(200)\n', (77, 82), True, 'import numpy as np\n'), ((402, 426), 'numpy.array', 'np.array', (['keys_list_mult'], {}), '(keys_list_mult)\n... |
"""
Unit test for selection operators.
"""
import random
from math import nan
import numpy as np
import pytest
from leap_ec import Individual
from leap_ec import ops, statistical_helpers
from leap_ec.binary_rep.problems import MaxOnes
from leap_ec.data import test_population
from leap_ec.real_rep.problems import ... | [
"leap_ec.ops.truncation_selection",
"leap_ec.ops.naive_cyclic_selection",
"leap_ec.binary_rep.problems.MaxOnes",
"leap_ec.ops.sus_selection",
"leap_ec.real_rep.problems.SpheroidProblem",
"leap_ec.ops.tournament_selection",
"leap_ec.ops.random_selection",
"leap_ec.statistical_helpers.stochastic_equals"... | [((751, 786), 'leap_ec.Individual.evaluate_population', 'Individual.evaluate_population', (['pop'], {}), '(pop)\n', (781, 786), False, 'from leap_ec import Individual\n'), ((915, 937), 'leap_ec.ops.sus_selection', 'ops.sus_selection', (['pop'], {}), '(pop)\n', (932, 937), False, 'from leap_ec import ops, statistical_he... |
import nnfs
import numpy as np
nnfs.init()
layer_outputs = [[4.8, 1.21, 2.385],
[8.9, -1.81, 0.2],
[1.41, 1.051, 0.026]]
exp_values = np.exp(layer_outputs)
norm_values = exp_values / np.sum(exp_values, axis=1, keepdims=True)
print(norm_values)
# print(sum(norm_values))
| [
"numpy.exp",
"numpy.sum",
"nnfs.init"
] | [((32, 43), 'nnfs.init', 'nnfs.init', ([], {}), '()\n', (41, 43), False, 'import nnfs\n'), ((171, 192), 'numpy.exp', 'np.exp', (['layer_outputs'], {}), '(layer_outputs)\n', (177, 192), True, 'import numpy as np\n'), ((221, 262), 'numpy.sum', 'np.sum', (['exp_values'], {'axis': '(1)', 'keepdims': '(True)'}), '(exp_value... |
import time
import numpy as np
import pickle
import argparse
from parse_args import parse_args
from evaluator import Evaluator
class ItemToItemRecommender:
def __init__(self, algorithm, dataset):
with open('datasets/'+dataset+'/item_to_item_similarity_'+algorithm, 'rb') as f1:
self.model = ... | [
"evaluator.Evaluator",
"numpy.random.choice",
"parse_args.parse_args",
"pickle.load",
"numpy.random.seed",
"time.time"
] | [((998, 1015), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1012, 1015), True, 'import numpy as np\n'), ((1068, 1079), 'time.time', 'time.time', ([], {}), '()\n', (1077, 1079), False, 'import time\n'), ((1092, 1104), 'parse_args.parse_args', 'parse_args', ([], {}), '()\n', (1102, 1104), False, 'from ... |
import numpy as np
import pytest
import math
from sklearn.base import clone
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestRegressor
import doubleml as dml
from ._utils import draw_smpls
from ._utils_irm_manual import fit_irm, boot_irm, tune_nuisance_irm
@pytest.fixtu... | [
"doubleml.DoubleMLIRM",
"numpy.allclose",
"math.isclose",
"sklearn.ensemble.RandomForestRegressor",
"sklearn.base.clone",
"sklearn.linear_model.LogisticRegression",
"numpy.array",
"doubleml.DoubleMLData.from_arrays",
"numpy.random.seed",
"pytest.fixture",
"numpy.logspace"
] | [((571, 625), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': "['ATE', 'ATTE']"}), "(scope='module', params=['ATE', 'ATTE'])\n", (585, 625), False, 'import pytest\n'), ((690, 737), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': "['dml2']"}), "(scope='module', p... |
import logging
import traceback
import decimal
import json
import numpy
import django
from django.db import models # we're going to geodjango this one - might not need it, but could make some things nicer
from django.db.models import Q
from django.contrib.auth.models import Group
from django.contrib.auth import get_... | [
"logging.getLogger",
"django.db.models.TextField",
"django.db.models.IntegerField",
"Dapper.worst_case.default_worst_case_scaling_function",
"django.db.models.PositiveSmallIntegerField",
"Dapper.get_version",
"django.db.models.Index",
"django.contrib.auth.get_user_model",
"django.db.models.FloatFiel... | [((338, 354), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (352, 354), False, 'from django.contrib.auth import get_user_model\n'), ((694, 732), 'logging.getLogger', 'logging.getLogger', (['"""waterspout.models"""'], {}), "('waterspout.models')\n", (711, 732), False, 'import logging\n'), ((2... |
"""Test generate entities."""
import os
import shutil
import unittest
import emmental
import numpy as np
import torch
import ujson
import bootleg.extract_all_entities as extract_all_entities
import bootleg.run as run
from bootleg.utils import utils
from bootleg.utils.parser import parser_utils
class TestGenEntities... | [
"os.path.exists",
"bootleg.run.run_model",
"os.makedirs",
"os.path.join",
"bootleg.extract_all_entities.run_model",
"bootleg.utils.utils.exists_dir",
"shutil.rmtree",
"unittest.main",
"bootleg.utils.parser.parser_utils.parse_boot_and_emm_args",
"torch.multiprocessing.set_start_method",
"emmental... | [((2624, 2639), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2637, 2639), False, 'import unittest\n'), ((446, 518), 'bootleg.utils.parser.parser_utils.parse_boot_and_emm_args', 'parser_utils.parse_boot_and_emm_args', (['"""tests/run_args/test_end2end.json"""'], {}), "('tests/run_args/test_end2end.json')\n", (48... |
from matplotlib import pyplot
import numpy
data = numpy.loadtxt(fname='../data/inflammation-01.csv', delimiter=',')
image = pyplot.imshow(data)
pyplot.show(image)
ave_inflammation = data.mean(axis=0)
ave_plot = pyplot.plot(ave_inflammation)
pyplot.show(ave_plot)
max_plot = pyplot.plot(data.max(axis=0))
pyplot.sho... | [
"matplotlib.pyplot.imshow",
"numpy.loadtxt",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((52, 117), 'numpy.loadtxt', 'numpy.loadtxt', ([], {'fname': '"""../data/inflammation-01.csv"""', 'delimiter': '""","""'}), "(fname='../data/inflammation-01.csv', delimiter=',')\n", (65, 117), False, 'import numpy\n'), ((128, 147), 'matplotlib.pyplot.imshow', 'pyplot.imshow', (['data'], {}), '(data)\n', (141, 147), Fa... |
import os
import sys
import pandas as pd
import numpy as np
import scipy.stats as stats
from scipy.special import logsumexp, softmax, gammaln, logit, expit
from scipy import linalg
import joblib
from time import time
import flipflop_model
import dynesty
from dynesty import NestedSampler
def runModel(S, lam, mu, gam... | [
"flipflop_model.beta_lpdf",
"scipy.stats.beta.rvs",
"scipy.stats.truncnorm.ppf",
"dynesty.NestedSampler",
"numpy.log",
"numpy.any",
"numpy.array",
"numpy.linspace",
"flipflop_model.runModel",
"numpy.isfinite",
"time.time",
"numpy.shape",
"scipy.stats.halfnorm.ppf",
"scipy.special.logsumexp... | [((341, 388), 'flipflop_model.runModel', 'flipflop_model.runModel', (['S', 'lam', 'mu', 'gamma', 'age'], {}), '(S, lam, mu, gamma, age)\n', (364, 388), False, 'import flipflop_model\n'), ((432, 472), 'flipflop_model.beta_lpdf', 'flipflop_model.beta_lpdf', (['y', 'alpha', 'beta'], {}), '(y, alpha, beta)\n', (456, 472), ... |
import numpy as np
import matplotlib
def normalize(v, p=2):
''' project vector on to unit L-p ball. '''
norm=np.linalg.norm(v, ord=p)
if norm==0:
norm=np.finfo(v.dtype).eps
return v/norm
def matplotlib_init():
''' Initialize matplotlib parameters for pretty figures. '''
matplotlib.rcP... | [
"numpy.finfo",
"numpy.linalg.norm"
] | [((118, 142), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {'ord': 'p'}), '(v, ord=p)\n', (132, 142), True, 'import numpy as np\n'), ((172, 189), 'numpy.finfo', 'np.finfo', (['v.dtype'], {}), '(v.dtype)\n', (180, 189), True, 'import numpy as np\n')] |
"""
Script for extracting features stats for featurization for RL experiment.
Uncomment code fragment in autoascend/combat/rl_scoring.py to generate the observations.txt file.
"""
import base64
import json
import pickle
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import seab... | [
"numpy.nanstd",
"matplotlib.pyplot.xticks",
"seaborn.histplot",
"matplotlib.pyplot.sca",
"base64.b64decode",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.nanmean",
"collections.defaultdict",
"numpy.isnan",
"matplotlib.pyplot.tight_layout",
"numpy.nanmin",
"json.dump",
"matplotlib.pypl... | [((1441, 1458), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (1452, 1458), False, 'from collections import defaultdict\n'), ((397, 414), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (408, 414), False, 'from collections import defaultdict\n'), ((1006, 1048), 'matplotlib.... |
from node import Node
from collections import deque
from queue import PriorityQueue
import heapq
import numpy as np
import math
######################################
# Workspace
######################################
def isValidWorkspace(pt,r = 1,radiusClearance=0): #To be modified
x,y = pt
#----... | [
"math.floor",
"math.sqrt",
"math.radians",
"math.cos",
"numpy.array",
"heapq.heappop",
"node.Node",
"heapq.heappush",
"math.sin"
] | [((5882, 5901), 'math.floor', 'math.floor', (['(300 / r)'], {}), '(300 / r)\n', (5892, 5901), False, 'import math\n'), ((5910, 5929), 'math.floor', 'math.floor', (['(200 / r)'], {}), '(200 / r)\n', (5920, 5929), False, 'import math\n'), ((6696, 6738), 'math.sqrt', 'math.sqrt', (['((gx - sx) ** 2 + (gy - sy) ** 2)'], {}... |
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.express as px
import dash_bootstrap_components as dbc
import pandas as pd
import pickle as pk
import plotly.graph_objects as go
import numpy as np
from sklearn.preprocessi... | [
"pandas.read_csv",
"dash.dependencies.Input",
"numpy.linalg.norm",
"dash_html_components.Div",
"dash.Dash",
"numpy.mean",
"dash.dependencies.Output",
"dash_html_components.H5",
"plotly.graph_objects.Scatter",
"dash_bootstrap_components.Card",
"pandas.DataFrame",
"dash_core_components.Checklist... | [((427, 481), 'pandas.read_csv', 'pd.read_csv', (['"""full_corpus.csv"""'], {'index_col': '"""Unnamed: 0"""'}), "('full_corpus.csv', index_col='Unnamed: 0')\n", (438, 481), True, 'import pandas as pd\n'), ((6492, 6556), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': '[dbc.themes.BOOTSTRAP]'}), '(__na... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 24 20:47:24 2019
@author: elif.ayvali
"""
import pandas as pd
import numpy as np
import matplotlib.collections as mc
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from matplotlib.patches import Rectangle
def create_uniform_grid(low, high, bins=(1... | [
"matplotlib.patches.Rectangle",
"numpy.digitize",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.concatenate",
"matplotlib.pyplot.FixedLocator",
"matplotlib.lines.Line2D",
"matplotlib.pyplot.subplots"
] | [((2210, 2240), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (2222, 2240), True, 'import matplotlib.pyplot as plt\n'), ((3809, 3839), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(10, 10)'}), '(figsize=(10, 10))\n', (3821, 3839), True, 'import m... |
import os
import random
from glob import glob
import cv2
import numpy as np
from augraphy.augmentations.lib import sobel
from augraphy.base.augmentation import Augmentation
from augraphy.utilities import *
class BleedThrough(Augmentation):
"""Emulates bleed through effect from the combination of ink bleed and
... | [
"random.uniform",
"cv2.flip",
"os.getcwd",
"random.random",
"augraphy.augmentations.lib.sobel",
"cv2.resize",
"cv2.GaussianBlur",
"numpy.vectorize",
"random.randint",
"glob.glob",
"cv2.imread"
] | [((3478, 3532), 'random.uniform', 'random.uniform', (['intensity_range[0]', 'intensity_range[1]'], {}), '(intensity_range[0], intensity_range[1])\n', (3492, 3532), False, 'import random\n'), ((3737, 3763), 'numpy.vectorize', 'np.vectorize', (['add_noise_fn'], {}), '(add_noise_fn)\n', (3749, 3763), True, 'import numpy a... |
import numpy as np
import torch
import glob
import os
import pickle
import argparse
from torch.utils.data import DataLoader
from torch.utils.data.dataset import (TensorDataset,
ConcatDataset)
from i2i.cyclegan import CycleGAN
from util import (convert_to_rgb,
H5Da... | [
"argparse.ArgumentParser",
"numpy.min",
"util.convert_to_rgb",
"numpy.zeros",
"pdb.set_trace",
"torch.utils.data.DataLoader",
"os.path.abspath",
"util.H5Dataset",
"torchvision.utils.save_image",
"skimage.transform.rescale",
"glob.glob",
"torch.utils.data.dataset.ConcatDataset"
] | [((764, 815), 'util.H5Dataset', 'H5Dataset', (['filename_celeba_swap', '"""imgs"""'], {'train': '(True)'}), "(filename_celeba_swap, 'imgs', train=True)\n", (773, 815), False, 'from util import convert_to_rgb, H5Dataset, DatasetFromFolder\n'), ((837, 889), 'util.H5Dataset', 'H5Dataset', (["('%s' % filename_vgg)", '"""sr... |
"""Allows you to do math in any base."""
from __future__ import annotations
import sys
import numpy
import contextlib
from io import StringIO
from typing import Union
from .exceptions import *
def _execWithOutput(code:str, stdout=None):
try:
old = sys.stdout
if not stdout:
stdout = St... | [
"io.StringIO",
"numpy.base_repr"
] | [((2702, 2740), 'numpy.base_repr', 'numpy.base_repr', (['self.value', 'self.base'], {}), '(self.value, self.base)\n', (2717, 2740), False, 'import numpy\n'), ((318, 328), 'io.StringIO', 'StringIO', ([], {}), '()\n', (326, 328), False, 'from io import StringIO\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.