code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"""Utility functions.""" import h5py import numpy as np from torch.utils import data def save_dict_h5py(data, fname): """Save dictionary containing numpy arrays to h5py file.""" with h5py.File(fname, 'w') as hf: for key in data.keys(): hf.create_dataset(key, data=data[key]) def load_di...
[ "h5py.File", "numpy.array", "torch.utils.data.keys" ]
[((621, 657), 'numpy.array', 'np.array', (['np_array'], {'dtype': 'np.float32'}), '(np_array, dtype=np.float32)\n', (629, 657), True, 'import numpy as np\n'), ((195, 216), 'h5py.File', 'h5py.File', (['fname', '"""w"""'], {}), "(fname, 'w')\n", (204, 216), False, 'import h5py\n'), ((243, 254), 'torch.utils.data.keys', '...
# -------------------------------------------------------- # Face Datasets # Licensed under The MIT License [see LICENSE for details] # Copyright 2019 smarsu. All Rights Reserved. # -------------------------------------------------------- import os.path as osp import numpy as np class Dataset(object): ...
[ "numpy.random.shuffle", "time.time", "numpy.array", "os.path.join", "numpy.concatenate" ]
[((6278, 6289), 'time.time', 'time.time', ([], {}), '()\n', (6287, 6289), False, 'import time\n'), ((6375, 6386), 'time.time', 'time.time', ([], {}), '()\n', (6384, 6386), False, 'import time\n'), ((2074, 2100), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (2091, 2100), True, 'import n...
# Copyright 2020-2021 OpenDR European Project # # 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 agree...
[ "numpy.load", "argparse.ArgumentParser", "numpy.transpose", "numpy.lib.format.open_memmap", "scipy.spatial.Delaunay" ]
[((744, 774), 'numpy.transpose', 'np.transpose', (['x[0, :, 0, :, 0]'], {}), '(x[0, :, 0, :, 0])\n', (756, 774), True, 'import numpy as np\n'), ((809, 825), 'scipy.spatial.Delaunay', 'Delaunay', (['points'], {}), '(points)\n', (817, 825), False, 'from scipy.spatial import Delaunay\n'), ((1412, 1498), 'numpy.lib.format....
import itertools import numpy import six from chainer.backends import cuda from chainer.utils.conv import get_conv_outsize from chainer.utils import conv_nd_kernel def as_tuple(x, n): if hasattr(x, '__getitem__'): assert len(x) == n return tuple(x) return (x,) * n def im2col_nd_cpu(img, ksi...
[ "numpy.pad", "chainer.utils.conv_nd_kernel.Col2imNDKernel.generate", "six.moves.range", "chainer.utils.conv.get_conv_outsize", "numpy.zeros", "chainer.utils.conv_nd_kernel.Im2colNDKernel.generate", "numpy.ndarray", "chainer.backends.cuda.elementwise", "chainer.backends.cuda.cupy.empty" ]
[((860, 927), 'numpy.pad', 'numpy.pad', (['img', 'pad_width'], {'mode': '"""constant"""', 'constant_values': '(pval,)'}), "(img, pad_width, mode='constant', constant_values=(pval,))\n", (869, 927), False, 'import numpy\n'), ((1114, 1151), 'numpy.ndarray', 'numpy.ndarray', (['shape'], {'dtype': 'img.dtype'}), '(shape, d...
""" PDBBind dataset loader. """ import logging import multiprocessing import os import re import time import deepchem import numpy as np import pandas as pd import tarfile from deepchem.feat import RdkitGridFeaturizer from deepchem.feat import ComplexNeighborListFragmentAtomicCoordinates from deepchem.feat.graph_featu...
[ "deepchem.splits.ScaffoldSplitter", "pandas.read_csv", "deepchem.feat.WeaveFeaturizer", "deepchem.splits.RandomSplitter", "os.path.join", "deepchem.feat.RdkitGridFeaturizer", "deepchem.feat.RawFeaturizer", "deepchem.feat.CircularFingerprint", "os.path.exists", "deepchem.splits.TimeSplitterPDBbind"...
[((362, 389), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (379, 389), False, 'import logging\n'), ((409, 449), 'deepchem.utils.data_utils.get_data_dir', 'deepchem.utils.data_utils.get_data_dir', ([], {}), '()\n', (447, 449), False, 'import deepchem\n'), ((618, 658), 'deepchem.utils.dat...
# Copyright (c) 2017-present, Facebook, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
[ "numpy.minimum", "numpy.concatenate", "utils.fpn.map_rois_to_fpn_levels", "numpy.zeros", "numpy.hstack", "numpy.append", "utils.fpn.add_multilevel_roi_blobs", "numpy.where", "numpy.array", "utils.blob.ones", "utils.boxes.rois_union", "numpy.random.choice", "logging.getLogger" ]
[((1224, 1251), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1241, 1251), False, 'import logging\n'), ((2527, 2596), 'numpy.minimum', 'np.minimum', (['fg_pairs_per_image', '(gt_pair_inds.size + fg_pair_inds.size)'], {}), '(fg_pairs_per_image, gt_pair_inds.size + fg_pair_inds.size)\n', ...
from numpy import empty as npempty from numpy import int8 as npint8 from numpy import stack as npstack from numpy import squeeze as npsqueeze from numpy import where as npwhere from numpy import absolute as npabsolute from numpy import shape as npshape from astropy.io import fits import re import sys from gethdrinfo im...
[ "numpy.stack", "numpy.absolute", "uspexampcor.uspexampcor", "numpy.empty", "astropy.io.fits.getdata", "numpy.where", "astropy.io.fits.open", "gethdrinfo.gethdrinfo", "numpy.squeeze", "sys.exit", "idlrotate.idlrotate", "re.search", "imgpoly.imgpoly" ]
[((2965, 2991), 'astropy.io.fits.open', 'fits.open', (["lininfo['bias']"], {}), "(lininfo['bias'])\n", (2974, 2991), False, 'from astropy.io import fits\n'), ((3415, 3449), 'numpy.empty', 'npempty', (['(nimages, NAXIS2, NAXIS1)'], {}), '((nimages, NAXIS2, NAXIS1))\n', (3422, 3449), True, 'from numpy import empty as npe...
#!/usr/bin/env python # # texture.py - The Texture and Texture2D classes. # # Author: <NAME> <<EMAIL>> # """This module provides the :class:`Texture` class, which is the base classes for all other FSLeyes texture types. See also the :class:`.Texture2D` and :class:`.Texture3D` classes. """ import logging ...
[ "fsleyes_widgets.utils.status.reportErrorDecorator", "functools.partial", "fsl.utils.idle.TaskThread", "OpenGL.GL.glGenTextures", "OpenGL.GL.glBindTexture", "OpenGL.GL.glDeleteTextures", "numpy.asarray", "numpy.nanmax", "numpy.nanmin", "OpenGL.GL.glActiveTexture", "numpy.eye", "fsl.utils.idle....
[((747, 774), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (764, 774), False, 'import logging\n'), ((3061, 3096), 'OpenGL.GL.glDeleteTextures', 'gl.glDeleteTextures', (['self.__texture'], {}), '(self.__texture)\n', (3080, 3096), True, 'import OpenGL.GL as gl\n'), ((20613, 20622), 'numpy...
# -*- coding: utf-8 -*- import numpy as np import os import pandas as pd import time import scanpy as sc import scipy.sparse as ssp from .. import help_functions as hf from .. import plotting as CSpl from .optimal_transport import * from .. import settings from .. import logging as logg #################### # Con...
[ "scanpy.AnnData", "numpy.load", "numpy.sum", "scipy.sparse.issparse", "scanpy.pp.neighbors", "numpy.ones", "numpy.argsort", "scipy.sparse.lil_matrix", "numpy.mean", "scipy.sparse.save_npz", "os.path.exists", "numpy.cumsum", "numpy.max", "numpy.save", "scipy.sparse.load_npz", "scipy.spa...
[((6890, 6901), 'time.time', 'time.time', ([], {}), '()\n', (6899, 6901), False, 'import time\n'), ((7093, 7125), 'scipy.sparse.issparse', 'ssp.issparse', (['initial_similarity'], {}), '(initial_similarity)\n', (7105, 7125), True, 'import scipy.sparse as ssp\n'), ((7958, 7969), 'time.time', 'time.time', ([], {}), '()\n...
import pygame import numpy as np class Obstacle(): def __init__(self, origin, w,y): self.origin = origin self.x = w self.y = y def render(self,screen, ppm = 1): py_rect = pygame.Rect(ppm*self.origin[0], ppm*self.origin[1],ppm*self.x,ppm*self.y) pygame.draw.rect(screen, (...
[ "pygame.draw.rect", "pygame.Rect", "numpy.array", "numpy.subtract" ]
[((211, 298), 'pygame.Rect', 'pygame.Rect', (['(ppm * self.origin[0])', '(ppm * self.origin[1])', '(ppm * self.x)', '(ppm * self.y)'], {}), '(ppm * self.origin[0], ppm * self.origin[1], ppm * self.x, ppm *\n self.y)\n', (222, 298), False, 'import pygame\n'), ((294, 345), 'pygame.draw.rect', 'pygame.draw.rect', (['sc...
#!/usr/bin/env/ python3 """ Convert NetCDF4 files to ASCII (plain text) """ import sys import argparse import numpy as np import netCDF4 args = [] if __name__ == '__main__': parser = argparse.ArgumentParser(description='convert file from netCDF to ASCII format', formatter_cla...
[ "netCDF4.Dataset", "numpy.array", "argparse.ArgumentParser", "sys.exit" ]
[((951, 1007), 'numpy.array', 'np.array', (["datafile_read.variables['velocity_x'][:, :, :]"], {}), "(datafile_read.variables['velocity_x'][:, :, :])\n", (959, 1007), True, 'import numpy as np\n'), ((1012, 1068), 'numpy.array', 'np.array', (["datafile_read.variables['velocity_y'][:, :, :]"], {}), "(datafile_read.variab...
import torch from .disc_loss import DiscriminativeLoss from .unet import UNet from pytorch_lightning.core.lightning import LightningModule from defects_dlmbl.segment_affinities import mutex_watershed import numpy as np from skimage.io import imsave import io import PIL from sklearn.decomposition import PCA from inferno...
[ "io.BytesIO", "skimage.io.imsave", "torch.nn.L1Loss", "torch.nn.Tanh", "matplotlib.pyplot.close", "torch.nn.Conv2d", "inferno.extensions.criteria.set_similarity_measures.SorensenDiceLoss", "PIL.Image.open", "defects_dlmbl.segment_affinities.mutex_watershed", "torch.sigmoid", "sklearn.decompositi...
[((1203, 1225), 'inferno.extensions.criteria.set_similarity_measures.SorensenDiceLoss', 'sim.SorensenDiceLoss', ([], {}), '()\n', (1223, 1225), True, 'from inferno.extensions.criteria import set_similarity_measures as sim\n'), ((1834, 1855), 'torch.sigmoid', 'torch.sigmoid', (['logits'], {}), '(logits)\n', (1847, 1855)...
#!python3 #-*- coding: utf-8 -*- import os import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../") import random import numpy as np import torch from torch import nn from torch import optim import torch.nn.functional as F from torch.autograd import Variable #import torchvision.models as models...
[ "utils.random_replaymemory.RandomReplayMemory", "os.path.abspath", "pickle.dump", "numpy.random.uniform", "torch.multinomial", "torch.autograd.Variable", "torch.load", "torch.cat", "torch.nn.functional.softmax", "utils.permemory.PERMemory", "pickle.load", "torch.cuda.is_available", "networks...
[((1220, 1257), 'networks.maskNet.MaskNet', 'MaskNet', (['self.num_actions'], {'duel': '(False)'}), '(self.num_actions, duel=False)\n', (1227, 1257), False, 'from networks.maskNet import MaskNet\n'), ((1284, 1321), 'networks.maskNet.MaskNet', 'MaskNet', (['self.num_actions'], {'duel': '(False)'}), '(self.num_actions, d...
import random import gym import numpy as np # noinspection PyUnresolvedReferences import rps3env import tensorflow as tf OBS_SHAPE = [None, 28, 1, 3] NUM_ACTIONS = 28 * 28 LEARN_RATE = 0.001 DECAY_RATE = 0.95 NUM_EPISODES = 100 def deep_conv_net(input_layer): with tf.name_scope('conv'): conv1 = tf.lay...
[ "tensorflow.reset_default_graph", "tensorflow.multiply", "tensorflow.train.latest_checkpoint", "tensorflow.layers.max_pooling2d", "tensorflow.get_default_graph", "tensorflow.summary.merge", "tensorflow.placeholder", "numpy.max", "tensorflow.summary.FileWriter", "tensorflow.summary.histogram", "t...
[((1838, 1862), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (1860, 1862), True, 'import tensorflow as tf\n'), ((1882, 1939), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', 'OBS_SHAPE'], {'name': '"""state_input"""'}), "(tf.float32, OBS_SHAPE, name='state_input')\n", (1896,...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Unit tests for KinwaveImplicitOverlandFlowModel. Created on Sat Apr 1 10:49:33 2017 @author: gtucker """ import numpy as np from landlab import RasterModelGrid from landlab.components import KinwaveImplicitOverlandFlow def test_initialization(): """Test init...
[ "numpy.amax", "landlab.components.KinwaveImplicitOverlandFlow", "landlab.RasterModelGrid", "numpy.amin" ]
[((368, 407), 'landlab.RasterModelGrid', 'RasterModelGrid', (['(3, 4)'], {'xy_spacing': '(2.0)'}), '((3, 4), xy_spacing=2.0)\n', (383, 407), False, 'from landlab import RasterModelGrid\n'), ((471, 502), 'landlab.components.KinwaveImplicitOverlandFlow', 'KinwaveImplicitOverlandFlow', (['rg'], {}), '(rg)\n', (498, 502), ...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os import sys import torch import numpy as np from PIL import Image import random import imageio from data import BaseDataset from data.randaugment import RandAugmentMC class Synthia_loader(BaseDataset): """ Synthia synthetic ...
[ "data.randaugment.RandAugmentMC", "numpy.asarray", "imageio.imread", "numpy.zeros", "numpy.ones", "PIL.Image.open", "imageio.plugins.freeimage.download", "numpy.array", "PIL.Image.fromarray", "os.path.join", "os.listdir", "numpy.unique", "torch.from_numpy" ]
[((560, 580), 'data.randaugment.RandAugmentMC', 'RandAugmentMC', (['(2)', '(10)'], {}), '(2, 10)\n', (573, 580), False, 'from data.randaugment import RandAugmentMC\n'), ((781, 811), 'os.path.join', 'os.path.join', (['self.root', '"""RGB"""'], {}), "(self.root, 'RGB')\n", (793, 811), False, 'import os\n'), ((843, 879), ...
# Licensed under a 3-clause BSD style license - see LICENSE.rst import pytest import numpy as np from numpy.testing import assert_allclose, assert_equal import astropy.units as u from astropy.table import Table from astropy.time import Time from astropy.visualization import quantity_support from gammapy.data import GTI...
[ "gammapy.maps.MapAxis.from_energy_bounds", "gammapy.data.GTI.read", "astropy.visualization.quantity_support", "gammapy.maps.MapAxis.from_nodes", "numpy.arange", "matplotlib.pyplot.gca", "pytest.mark.parametrize", "gammapy.maps.TimeMapAxis.from_table", "gammapy.utils.testing.requires_dependency", "...
[((1091, 1123), 'numpy.array', 'np.array', (['[0.25, 0.75, 1.0, 2.0]'], {}), '([0.25, 0.75, 1.0, 2.0])\n', (1099, 1123), True, 'import numpy as np\n'), ((1982, 2013), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1996, 2013), False, 'import pytest\n'), ((2234, 2346), 'pyt...
import artm import gc import json import logging import numpy as np import os import pandas as pd import sys import tempfile import tqdm import warnings from collections import defaultdict from distutils.util import strtobool from topicnet.cooking_machine.dataset import Dataset from topicnet.cooking_machine.models imp...
[ "os.remove", "numpy.sum", "topnum.search_methods.topic_bank.one_model_train_funcs._get_topic_model", "json.dumps", "collections.defaultdict", "gc.collect", "os.path.isfile", "os.close", "os.path.dirname", "numpy.random.RandomState", "topnum.search_methods.topic_bank.phi_initialization.utils._saf...
[((2022, 2041), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (2039, 2041), False, 'import logging\n'), ((8825, 8857), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'seed'}), '(seed=seed)\n', (8846, 8857), True, 'import numpy as np\n'), ((9514, 9586), 'topnum.search_methods.topic_bank...
"""Classes that represent the state of the entire system and entities within. These classes wrap protobufs, which are basically a fancy NamedTuple that is generated by the `build` Makefile target. You can read more about protobufs online, but mainly they're helpful for serializing data over the network.""" import log...
[ "vpython.vector", "numpy.asarray", "orbitx.orbitx_pb2.Navmode.values", "orbitx.orbitx_pb2.PhysicalState", "numpy.mod", "numpy.array", "logging.getLogger" ]
[((503, 522), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (520, 522), False, 'import logging\n'), ((1577, 1600), 'orbitx.orbitx_pb2.Navmode.values', 'protos.Navmode.values', ([], {}), '()\n', (1598, 1600), True, 'from orbitx import orbitx_pb2 as protos\n'), ((2670, 2725), 'vpython.vector', 'vpython.vect...
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt import netCDF4 as nc import iris from subprocess import call # write the google earth file header info def WriteGEHeader( outp, collection_name ): outp.write('<?xml version="1.0" encoding="UTF-8"?>\n') outp.write('<kml xmlns="http://www...
[ "iris.analysis.cartography.unrotate_pole", "numpy.float", "numpy.mod", "numpy.shape", "numpy.max", "numpy.min", "subprocess.call" ]
[((16446, 16574), 'subprocess.call', 'call', (["['zip', '-r', workdir + '/' + modelname + '_' + regname + '.kmz', workdir +\n '/' + modelname + '_' + regname + '.kml']"], {}), "(['zip', '-r', workdir + '/' + modelname + '_' + regname + '.kmz', \n workdir + '/' + modelname + '_' + regname + '.kml'])\n", (16450, 16...
# # Copyright The NOMAD Authors. # # This file is part of NOMAD. # See https://nomad-lab.eu for further info. # # 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/lic...
[ "nomad.metainfo.SectionProxy", "nomad.metainfo.legacy.LegacyDefinition", "numpy.dtype" ]
[((1141, 1190), 'nomad.metainfo.legacy.LegacyDefinition', 'LegacyDefinition', ([], {'name': '"""dmol3.nomadmetainfo.json"""'}), "(name='dmol3.nomadmetainfo.json')\n", (1157, 1190), False, 'from nomad.metainfo.legacy import LegacyDefinition\n'), ((1350, 1409), 'nomad.metainfo.legacy.LegacyDefinition', 'LegacyDefinition'...
#!/usr/bin/env python """ This class runs the regression YAMLs in the ASV format. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from collections import defaultdict import numpy as np import os import yaml import ray from ray import tune CONFIG_DIR ...
[ "ray.init", "os.path.abspath", "yaml.load", "numpy.median", "collections.defaultdict", "ray.shutdown", "ray.tune.run_experiments", "os.path.join" ]
[((338, 363), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (353, 363), False, 'import os\n'), ((573, 583), 'ray.init', 'ray.init', ([], {}), '()\n', (581, 583), False, 'import ray\n'), ((597, 630), 'ray.tune.run_experiments', 'tune.run_experiments', (['experiments'], {}), '(experiments)\n',...
""" <NAME> University of Manitoba February 13th, 2020 """ import numpy as np ############################################################################### def aug_hor_ref(data, metadata): """Horizontally-reflects samples to generate augmented samples Performs data augmentation to obtain hor...
[ "numpy.size", "numpy.zeros_like", "numpy.array", "numpy.flip" ]
[((1733, 1761), 'numpy.array', 'np.array', (['reflected_metadata'], {}), '(reflected_metadata)\n', (1741, 1761), True, 'import numpy as np\n'), ((4092, 4121), 'numpy.array', 'np.array', (['translated_metadata'], {}), '(translated_metadata)\n', (4100, 4121), True, 'import numpy as np\n'), ((1208, 1229), 'numpy.size', 'n...
# -*- coding: utf-8 -*- """Taken from https://github.com/riannevdberg/sylvester-flows/blob/32dde9b7d696fee94f946a338182e542779eecfe/models/layers.py""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter class Identity(nn.Module): def __in...
[ "torch.nn.ConvTranspose2d", "torch.autograd.Variable", "torch.nn.Conv2d", "torch.nn.functional.conv2d", "numpy.ones", "torch.FloatTensor", "torch.cuda.is_available", "torch.nn.init.kaiming_normal", "torch.nn.Sigmoid" ]
[((670, 682), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (680, 682), True, 'import torch.nn as nn\n'), ((701, 787), 'torch.nn.Conv2d', 'nn.Conv2d', (['input_channels', 'output_channels', 'kernel_size', 'stride', 'padding', 'dilation'], {}), '(input_channels, output_channels, kernel_size, stride, padding,\n ...
import argparse import json import pdb import re import string import numpy as np from nltk.tokenize import WordPunctTokenizer from simmc_dataset import SIMMCDatasetForResponseGeneration # for single embedding FIELDS_TO_EMBED = ['type', 'color', 'embellishments', 'pattern', 'brand'] FIELD2STR = SIMMCDatasetForRespon...
[ "numpy.stack", "json.load", "re.split", "argparse.ArgumentParser", "numpy.asarray", "numpy.array", "numpy.random.rand", "nltk.tokenize.WordPunctTokenizer", "numpy.concatenate" ]
[((1359, 1379), 'nltk.tokenize.WordPunctTokenizer', 'WordPunctTokenizer', ([], {}), '()\n', (1377, 1379), False, 'from nltk.tokenize import WordPunctTokenizer\n'), ((5078, 5103), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5101, 5103), False, 'import argparse\n'), ((1215, 1228), 'json.load'...
# 트리의 앙상블 # 램덤포레스트 import numpy as np import pandas as pd from sklearn.model_selection import train_test_split wine = pd.read_csv('https://bit.ly/wine-date') data = wine[['alcohol', 'sugar', 'pH']].to_numpy() target = wine['class'].to_numpy() train_input, test_input, train_target, test_target = train_test_split(data...
[ "sklearn.ensemble.RandomForestClassifier", "sklearn.ensemble.HistGradientBoostingClassifier", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.model_selection.cross_validate", "sklearn.ensemble.ExtraTreesClassifier", "sklearn.ensemble.GradientBoostingClassifier", "numpy.mean" ]
[((119, 158), 'pandas.read_csv', 'pd.read_csv', (['"""https://bit.ly/wine-date"""'], {}), "('https://bit.ly/wine-date')\n", (130, 158), True, 'import pandas as pd\n'), ((299, 361), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'target'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(dat...
import torch import numpy as np from lagom.core.transform import ExpFactorCumSum from .base_history import BaseHistory class Trajectory(BaseHistory): r"""Define a trajectory of successive transitions from a single episode. .. note:: It is not necessarily a complete episode (final state i...
[ "lagom.core.transform.ExpFactorCumSum", "torch.is_tensor", "numpy.array" ]
[((3002, 3025), 'torch.is_tensor', 'torch.is_tensor', (['last_V'], {}), '(last_V)\n', (3017, 3025), False, 'import torch\n'), ((4219, 4239), 'numpy.array', 'np.array', (['self.all_r'], {}), '(self.all_r)\n', (4227, 4239), True, 'import numpy as np\n'), ((2620, 2640), 'lagom.core.transform.ExpFactorCumSum', 'ExpFactorCu...
#versie 219/12/2018 import math import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd from peepo.pp.v3.sensory_input import SensoryInput from pgmpy.estimators import BayesianEstimator from pgmpy.factors.discrete import TabularCPD from pgmpy.models import BayesianModel from peepo...
[ "numpy.full", "pandas.DataFrame", "pgmpy.models.BayesianModel", "peepo.playground.simple_color_recognition_old_with_pgmpy.utilities.utilities.Utilities", "matplotlib.pyplot.show", "peepo.playground.simple_color_recognition_old_with_pgmpy.CeePeeDees.CPD.create_random_child", "numpy.asarray", "matplotli...
[((1143, 1155), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (1153, 1155), True, 'import networkx as nx\n'), ((1183, 1198), 'pgmpy.models.BayesianModel', 'BayesianModel', ([], {}), '()\n', (1196, 1198), False, 'from pgmpy.models import BayesianModel\n'), ((1222, 1234), 'networkx.DiGraph', 'nx.DiGraph', ([], {}),...
import csv import cv2 import numpy as np import platform import math import random import os import os.path import matplotlib.pyplot as plt from matplotlib.pyplot import imshow from matplotlib import image as image from keras.models import Sequential, Model from keras.layers import Dense, Dropout, Lambda, SpatialDro...
[ "matplotlib.pyplot.title", "keras.models.load_model", "csv.reader", "keras.layers.Cropping2D", "tensorflow.ConfigProto", "os.path.isfile", "numpy.unique", "cv2.cvtColor", "keras.layers.Flatten", "keras.layers.SpatialDropout2D", "matplotlib.pyplot.show", "keras.layers.Dropout", "matplotlib.py...
[((5067, 5083), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (5081, 5083), True, 'import tensorflow as tf\n'), ((5759, 5797), 'numpy.concatenate', 'np.concatenate', (['[X_train, X_train_rev]'], {}), '([X_train, X_train_rev])\n', (5773, 5797), True, 'import numpy as np\n'), ((5810, 5848), 'numpy.concate...
import seaborn as sns import matplotlib.pyplot as plt import matplotlib.colors as mcolors import pandas as pd import numpy as np import arviz as az def plot_ltv(empirical_ltv, inference_data=None, hdi_prob=.95, extra_label_text='', ax=None): if ax is None: fig, ax = plt.subplots(figsize=(20, 10)) if i...
[ "pandas.DataFrame", "seaborn.axes_style", "seaborn.heatmap", "numpy.median", "numpy.arange", "matplotlib.pyplot.subplots", "matplotlib.colors.ListedColormap" ]
[((281, 311), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (293, 311), True, 'import matplotlib.pyplot as plt\n'), ((1247, 1277), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (1259, 1277), True, 'import matpl...
import numpy from matplotlib import pyplot x = numpy.linspace(0, 10, 80) y = numpy.linspace(0, 1, 20) X, Y = numpy.meshgrid(x, y) U = 4*numpy.sin(2*numpy.pi*Y)*numpy.cos(numpy.pi*X/2) V = -numpy.cos(2*numpy.pi*Y)*numpy.sin(numpy.pi*X/2) fig = pyplot.figure(figsize=(10, 2), frameon=True) ax = fig.add_subplot(1, 1, 1...
[ "numpy.meshgrid", "matplotlib.pyplot.figure", "numpy.sin", "numpy.cos", "numpy.linspace", "numpy.sqrt" ]
[((48, 73), 'numpy.linspace', 'numpy.linspace', (['(0)', '(10)', '(80)'], {}), '(0, 10, 80)\n', (62, 73), False, 'import numpy\n'), ((78, 102), 'numpy.linspace', 'numpy.linspace', (['(0)', '(1)', '(20)'], {}), '(0, 1, 20)\n', (92, 102), False, 'import numpy\n'), ((111, 131), 'numpy.meshgrid', 'numpy.meshgrid', (['x', '...
# Distributed under the MIT License. # See LICENSE.txt for details. import itertools as it import numpy as np import PointwiseFunctions.GeneralRelativity.Christoffel as ch import PointwiseFunctions.GeneralRelativity.ComputeGhQuantities as gh import PointwiseFunctions.GeneralRelativity.ProjectionOperators as proj impo...
[ "PointwiseFunctions.GeneralRelativity.WeylPropagating.weyl_propagating_mode_minus", "PointwiseFunctions.GeneralRelativity.WeylPropagating.weyl_propagating_mode_plus", "numpy.sum", "PointwiseFunctions.GeneralRelativity.Christoffel.christoffel_first_kind", "numpy.zeros", "numpy.einsum", "PointwiseFunction...
[((823, 880), 'numpy.zeros', 'np.zeros', (['[spatial_dim, 1 + spatial_dim, 1 + spatial_dim]'], {}), '([spatial_dim, 1 + spatial_dim, 1 + spatial_dim])\n', (831, 880), True, 'import numpy as np\n'), ((2090, 2210), 'numpy.einsum', 'np.einsum', (['"""a,cb,d,cd->ab"""', 'incoming_null_one_form', 'projection_Ab', 'outgoing_...
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, division import csv from datetime import date import itertools from operator import itemgetter import subprocess import gzip import logging from allel.compat import zip_longest, PY2, text_type, range, unquote_plus import numpy as np i...
[ "allel.compat.zip_longest", "subprocess.Popen", "gzip.open", "csv.writer", "numpy.dtype", "datetime.date.today", "logging.getLogger", "allel.compat.range", "allel.compat.unquote_plus", "operator.itemgetter", "itertools.repeat" ]
[((343, 370), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (360, 370), False, 'import logging\n'), ((4775, 4796), 'itertools.repeat', 'itertools.repeat', (['"""."""'], {}), "('.')\n", (4791, 4796), False, 'import itertools\n'), ((6028, 6085), 'csv.writer', 'csv.writer', (['vcf_file'], {...
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np def draw_ellipse(position, covariance, ax=None, **kwargs): """Draw an ellipse with a given position and covariance""" ax = ax or plt.gca() # Convert covariance to principal axes if covariance.shape == (2, 2): U, s, Vt...
[ "matplotlib.rc", "matplotlib.pyplot.show", "numpy.arctan2", "matplotlib.patches.Ellipse", "matplotlib.pyplot.figure", "numpy.linalg.svd", "numpy.array", "matplotlib.pyplot.gca", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((674, 701), 'matplotlib.rc', 'mpl.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (680, 701), True, 'import matplotlib as mpl\n'), ((702, 732), 'matplotlib.rc', 'mpl.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (708, 732), True, 'import matplotlib as mpl\n'),...
""" Python in Astronomy 2016 is the second iteration of the Python in Astronomy conference series. This is the docstring for the pyastro module, this gets included as the description for the module. """ import numpy as np def times(a, b): """ Multiply a by b. Parameters ---------- a : `numpy.n...
[ "numpy.multipy" ]
[((499, 515), 'numpy.multipy', 'np.multipy', (['a', 'b'], {}), '(a, b)\n', (509, 515), True, 'import numpy as np\n')]
#!/usr/bin/env python import mirheo as mir import numpy as np import trimesh, argparse parser = argparse.ArgumentParser() parser.add_argument("--readFrom", choices=["off", 'trimesh']) args = parser.parse_args() path = "ply/" pvname = "rbc" off = "rbc_mesh.off" ranks = (1, 1, 1) domain = (12, 8, 10) u = mir....
[ "mirheo.InitialConditions.Membrane", "trimesh.load", "argparse.ArgumentParser", "mirheo.Mirheo", "numpy.savetxt", "mirheo.ParticleVectors.MembraneVector", "mirheo.Plugins.createDumpMesh", "mirheo.ParticleVectors.MembraneMesh" ]
[((98, 123), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (121, 123), False, 'import trimesh, argparse\n'), ((316, 402), 'mirheo.Mirheo', 'mir.Mirheo', (['ranks', 'domain'], {'dt': '(0)', 'debug_level': '(3)', 'log_filename': '"""log"""', 'no_splash': '(True)'}), "(ranks, domain, dt=0, debug_...
import pytest import unittest import numpy as np import numpy.testing as npt from lenstronomy.Util import sampling_util def test_unit2gaussian(): mu, sigma = 5, 1 cube = np.linspace(0, 1, 3) cube = sampling_util.unit2gaussian(cube, mu, sigma) npt.assert_equal(cube, [-np.inf, mu, np.inf]) def test_un...
[ "lenstronomy.Util.sampling_util.unit2uniform", "lenstronomy.Util.sampling_util.uniform2unit", "lenstronomy.Util.sampling_util.scale_limits", "lenstronomy.Util.sampling_util.sample_ball", "numpy.testing.assert_almost_equal", "numpy.std", "numpy.ones", "pytest.main", "lenstronomy.Util.sampling_util.cu...
[((180, 200), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(3)'], {}), '(0, 1, 3)\n', (191, 200), True, 'import numpy as np\n'), ((212, 256), 'lenstronomy.Util.sampling_util.unit2gaussian', 'sampling_util.unit2gaussian', (['cube', 'mu', 'sigma'], {}), '(cube, mu, sigma)\n', (239, 256), False, 'from lenstronomy.Uti...
# 2019-11-20 21:35:12(JST) import sys import numpy as np # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # ...
[ "scipy.misc.comb", "sys.stdin.readline", "numpy.searchsorted" ]
[((578, 599), 'numpy.searchsorted', 'np.searchsorted', (['a', '(1)'], {}), '(a, 1)\n', (593, 599), True, 'import numpy as np\n'), ((498, 518), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (516, 518), False, 'import sys\n'), ((450, 470), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (468...
""" Everything in this file was written by us. """ import argparse import time import numpy as np import torch.nn as nn import torch.optim as optim from environments.FourRooms import * from models.NEC import * from models.DND import * from models.MFEC import * from utils.atari_wrappers import make_atari, wrap_deepmind...
[ "numpy.stack", "numpy.save", "numpy.sum", "argparse.ArgumentParser", "utils.atari_wrappers.make_atari", "time.time", "numpy.mean", "numpy.array", "utils.atari_wrappers.wrap_deepmind" ]
[((372, 397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (395, 397), False, 'import argparse\n'), ((9301, 9324), 'numpy.array', 'np.array', (['score_history'], {}), '(score_history)\n', (9309, 9324), True, 'import numpy as np\n'), ((9342, 9370), 'numpy.array', 'np.array', (['num_frames_hist...
#!/usr/bin/env python import numpy as np from generate_solution import generate_solution from calculate_feroments import calculate_feroments np.set_printoptions(precision=3) np.random.seed(0) T = 100 q = np.random.choice(np.arange(1, 5), size=T) w = np.random.choice(np.arange(10, 20), size=T) u = np.random.choice(np...
[ "numpy.set_printoptions", "numpy.random.seed", "numpy.arange", "calculate_feroments.calculate_feroments", "generate_solution.generate_solution", "numpy.repeat" ]
[((142, 174), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)'}), '(precision=3)\n', (161, 174), True, 'import numpy as np\n'), ((176, 193), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (190, 193), True, 'import numpy as np\n'), ((224, 239), 'numpy.arange', 'np.arange', (['(1)...
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import matplotlib.patches as mpatches import matplotlib.cm as cm from mpl_toolkits.mplot3d import Axes3D from matplotlib.lines import Line2D import copy from Utility import Utility from FactorAnalyzer import FactorAnalyzer fr...
[ "matplotlib.pyplot.title", "seaborn.heatmap", "scipy.cluster.hierarchy.fcluster", "scipy.cluster.hierarchy.linkage", "sklearn.mixture.GaussianMixture", "matplotlib.pyplot.figure", "numpy.arange", "FactorAnalyzer.FactorAnalyzer", "itertools.cycle", "sklearn.metrics.silhouette_samples", "matplotli...
[((803, 830), 'scipy.cluster.hierarchy.dendrogram', 'dendrogram', (['*args'], {}), '(*args, **kwargs)\n', (813, 830), False, 'from scipy.cluster.hierarchy import dendrogram, linkage\n'), ((881, 940), 'matplotlib.pyplot.title', 'plt.title', (['"""Hierarchical Clustering Dendrogram (truncated)"""'], {}), "('Hierarchical ...
import os import setuptools from torch.utils.data import DataLoader import numpy as np from pytorch_lightning import LightningModule, Trainer import torch import torch.nn as nn import torchmetrics import pytorch_lightning.loggers as pl_loggers import pytorch_lightning.callbacks as pl_callbacks from lightning_nets...
[ "numpy.asarray", "torch.tensor", "torch.utils.data.DataLoader", "torch.device" ]
[((735, 814), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataloader.dataset', 'batch_size': 'num_samples', 'shuffle': 'shuffle'}), '(dataset=dataloader.dataset, batch_size=num_samples, shuffle=shuffle)\n', (745, 814), False, 'from torch.utils.data import DataLoader\n'), ((3204, 3223), 'torch.device'...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Mar 1 14:08:37 2018 @author: nadine """ import numpy as np def coralGrowthRate(depth): """ Doctest: >>> depth = np.array([-1.,0.,1.,2.,]) >>> G = coralgrowth(depth) >>> G np.array([0,0,...,...]) """ Gm = .012 # max upw...
[ "numpy.where", "numpy.exp" ]
[((604, 625), 'numpy.where', 'np.where', (['(depth > 0.0)'], {}), '(depth > 0.0)\n', (612, 625), True, 'import numpy as np\n'), ((658, 683), 'numpy.exp', 'np.exp', (['(-k * depth[below])'], {}), '(-k * depth[below])\n', (664, 683), True, 'import numpy as np\n')]
import numpy as np import cv2 import matplotlib.pyplot as plt imPath = "target/myim.png" imPath2 = "target/myim2.png" image = np.zeros((100, 200, 3),np.uint8) cv2.line(image, (5,5), (31,31), (0,0,255),3) cv2.imwrite(imPath, image) image = cv2.imread(imPath) cv2.line(image, (50,50), (31,31), (0,255,0),3) cv2.imwrite(...
[ "cv2.line", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "cv2.imwrite", "numpy.zeros", "cv2.imread", "matplotlib.pyplot.savefig" ]
[((128, 161), 'numpy.zeros', 'np.zeros', (['(100, 200, 3)', 'np.uint8'], {}), '((100, 200, 3), np.uint8)\n', (136, 161), True, 'import numpy as np\n'), ((161, 210), 'cv2.line', 'cv2.line', (['image', '(5, 5)', '(31, 31)', '(0, 0, 255)', '(3)'], {}), '(image, (5, 5), (31, 31), (0, 0, 255), 3)\n', (169, 210), False, 'imp...
import time import autopy import cv2 import numpy as np import level_3.module.hand_tracking_module as htm ################### wCam, hCam = 520, 370 frameR_h = 160 # Frame Reduction frameR_w = 90 smoothening = 8 ######################### def main_avm(queue_shared): pTime = 0 detector = htm.HandDetecto...
[ "level_3.module.hand_tracking_module.HandDetector", "cv2.circle", "cv2.waitKey", "autopy.screen.size", "autopy.mouse.move", "time.time", "cv2.VideoCapture", "cv2.rectangle", "numpy.interp", "cv2.destroyAllWindows", "cv2.resize" ]
[((305, 333), 'level_3.module.hand_tracking_module.HandDetector', 'htm.HandDetector', ([], {'maxHands': '(1)'}), '(maxHands=1)\n', (321, 333), True, 'import level_3.module.hand_tracking_module as htm\n'), ((351, 371), 'autopy.screen.size', 'autopy.screen.size', ([], {}), '()\n', (369, 371), False, 'import autopy\n'), (...
import tensorflow as tf import json import numpy as np from scipy import signal, stats from matplotlib import pyplot as plt import pickle from warnings import simplefilter from stable_baselines.results_plotter import load_results, ts2xy stiffness_versions = 9 RL_method = "PPO1" total_MC_runs = 42 # starts from 1 exper...
[ "matplotlib.pyplot.show", "json.loads", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.array" ]
[((490, 551), 'numpy.zeros', 'np.zeros', (['[total_MC_runs, stiffness_versions, total_episodes]'], {}), '([total_MC_runs, stiffness_versions, total_episodes])\n', (498, 551), True, 'import numpy as np\n'), ((1302, 1371), 'matplotlib.pyplot.legend', 'plt.legend', (["['0', '500', '1K', '2K', '4K', '7K', '10K', '15K', '20...
from typing import Dict, List, Optional, Tuple, Union import numpy as np def floyd_warshall(graph: np.ndarray, path_reconstruction=False) -> Union[np.ndarray, Optional[Tuple[np.ndarray, np.ndarray]]]: """Finds all shortest paths in a weigh...
[ "numpy.full", "numpy.fill_diagonal", "numpy.ndenumerate" ]
[((1287, 1315), 'numpy.full', 'np.full', (['graph.shape', 'np.inf'], {}), '(graph.shape, np.inf)\n', (1294, 1315), True, 'import numpy as np\n'), ((1415, 1436), 'numpy.ndenumerate', 'np.ndenumerate', (['graph'], {}), '(graph)\n', (1429, 1436), True, 'import numpy as np\n'), ((1575, 1607), 'numpy.fill_diagonal', 'np.fil...
# -*- coding: utf-8 -*- # Copyright: 2020, <NAME>, Berlin . All rights reserved. import sys import numpy as np import matplotlib.pyplot as plt from common import load_fft_data N = 1024 T = 1.0 / 1000.0 NOTCHES = [ (253, 259), (285, 290), (464, 472), ] START = 250 END = 2010 THRESHOLD = -170.0 def mai...
[ "matplotlib.pyplot.show", "common.load_fft_data", "matplotlib.pyplot.imshow", "numpy.log10", "matplotlib.pyplot.grid" ]
[((336, 362), 'common.load_fft_data', 'load_fft_data', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (349, 362), False, 'from common import load_fft_data\n'), ((644, 732), 'matplotlib.pyplot.imshow', 'plt.imshow', (['ffts'], {'origin': '"""lower"""', 'cmap': '"""jet"""', 'interpolation': '"""nearest"""', 'aspect': '"""auto...
import numpy as np def EaseInSine(t): return 1-np.sin((1-t)*np.pi/2) def EaseOutSine(t): return np.sin(t*np.pi/2) def EaseInOutSine(t): return 0.5-0.5*np.sin((1-t*2)*np.pi/2) def EaseInQuad(t): return t**2 def EaseOutQuad(t): return 1-EaseInQuad(1-t) def EaseInOutQuad(t): return (t<0.5) * ...
[ "numpy.sin", "numpy.sqrt" ]
[((106, 127), 'numpy.sin', 'np.sin', (['(t * np.pi / 2)'], {}), '(t * np.pi / 2)\n', (112, 127), True, 'import numpy as np\n'), ((52, 79), 'numpy.sin', 'np.sin', (['((1 - t) * np.pi / 2)'], {}), '((1 - t) * np.pi / 2)\n', (58, 79), True, 'import numpy as np\n'), ((1265, 1284), 'numpy.sqrt', 'np.sqrt', (['(1 - t ** 2)']...
import cv2 import os import numpy as np from PIL import Image recogniser = cv2.face.createLBPHFaceRecognizer() path = 'C:\\Users\\MY PC\\PycharmProjects\\untitled\\Images' def getimageIds(path): imagepaths = [os.path.join(path,f) for f in os.listdir(path)] faces = [] Ids = [] for imagepath in imagepa...
[ "cv2.waitKey", "cv2.destroyAllWindows", "PIL.Image.open", "cv2.face.createLBPHFaceRecognizer", "numpy.array", "cv2.imshow", "os.path.join", "os.listdir", "os.path.split" ]
[((77, 112), 'cv2.face.createLBPHFaceRecognizer', 'cv2.face.createLBPHFaceRecognizer', ([], {}), '()\n', (110, 112), False, 'import cv2\n'), ((764, 787), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (785, 787), False, 'import cv2\n'), ((700, 713), 'numpy.array', 'np.array', (['Ids'], {}), '(Ids)\...
from flask import Flask, request, Response, jsonify, send_from_directory import json import config import util import os import traceback import numpy as np import tensorflow as tf import time import wikipedia port = 5000 if os.getenv("PORT"): port = int(os.getenv("PORT")) app = Flask(__name__, static_url_path=...
[ "util.load_graph", "flask.Flask", "tensorflow.Session", "time.time", "flask.jsonify", "socket.getfqdn", "flask.request.get_data", "wikipedia.summary", "util.load_labels", "numpy.squeeze", "util.read_tensor_from_image_file", "os.getenv", "flask.request.get_json" ]
[((227, 244), 'os.getenv', 'os.getenv', (['"""PORT"""'], {}), "('PORT')\n", (236, 244), False, 'import os\n'), ((288, 330), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '"""/static"""'}), "(__name__, static_url_path='/static')\n", (293, 330), False, 'from flask import Flask, request, Response, jsonify, se...
import datetime import time import typing import cv2 import imutils import imutils.video import numpy as np from ..common.fps import FPSTracker class MotionDetector: video_stream: imutils.video.VideoStream target_frame: np.array = None current_frame: np.array = None marked_frame: np.array = None ...
[ "cv2.GaussianBlur", "cv2.contourArea", "cv2.putText", "numpy.copy", "cv2.dilate", "cv2.cvtColor", "cv2.destroyAllWindows", "cv2.threshold", "cv2.imshow", "time.sleep", "cv2.rectangle", "datetime.timedelta", "imutils.grab_contours", "cv2.absdiff", "cv2.boundingRect", "datetime.datetime....
[((405, 435), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(20)'}), '(seconds=20)\n', (423, 435), False, 'import datetime\n'), ((1522, 1545), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1543, 1545), False, 'import datetime\n'), ((1612, 1664), 'cv2.cvtColor', 'cv2.cvtColor', (['...
# The MIT License (MIT) # # Copyright (c) 2020 ETH Zurich # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify...
[ "numpy.sum", "os.path.isdir", "exputil.LocalShell", "exputil.read_csv_direct_in_columns", "os.listdir" ]
[((1175, 1195), 'exputil.LocalShell', 'exputil.LocalShell', ([], {}), '()\n', (1193, 1195), False, 'import exputil\n'), ((3150, 3244), 'exputil.read_csv_direct_in_columns', 'exputil.read_csv_direct_in_columns', (["(logs_ns3_dir + '/timing_results.csv')", '"""string,pos_int"""'], {}), "(logs_ns3_dir + '/timing_results.c...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ *This introductory sentence should state the intent and goal of the tutorial. Keep it brief. This next block should state any assumptions that you the writer are making. Present them in list form.* Let us start with ... .. math:: \nabla\cdot( A \cdot \nabla u ) ...
[ "pylab.show", "numpy.linspace" ]
[((3073, 3081), 'pylab.show', 'P.show', ([], {}), '()\n', (3079, 3081), True, 'import pylab as P\n'), ((1682, 1704), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(20)'], {}), '(-1, 1, 20)\n', (1693, 1704), True, 'import numpy as np\n'), ((1708, 1730), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(20)'], {})...
# Transform a picture into a mesh from vedo import Picture, dataurl, show import numpy as np pic = Picture(dataurl+"images/dog.jpg").smooth(5) msh = pic.tomesh() # make a quad-mesh out of it # build a scalar array with intensities rgb = msh.pointdata["RGBA"] intensity = np.sum(rgb, axis=1) intensityz = np.zeros_lik...
[ "numpy.zeros_like", "numpy.sum", "vedo.show", "vedo.Picture" ]
[((275, 294), 'numpy.sum', 'np.sum', (['rgb'], {'axis': '(1)'}), '(rgb, axis=1)\n', (281, 294), True, 'import numpy as np\n'), ((308, 326), 'numpy.zeros_like', 'np.zeros_like', (['rgb'], {}), '(rgb)\n', (321, 326), True, 'import numpy as np\n'), ((101, 136), 'vedo.Picture', 'Picture', (["(dataurl + 'images/dog.jpg')"],...
import os, sys import numpy as np import matplotlib import matplotlib.pyplot as plt import scipy.signal from classy import Class from helper import cache_grendel, cropsave, grendel_dir """ For just one of the boxes, plot the absolute CONCEPT and GADGET spectra over time, including a = a_begin. """ textwidth = 504...
[ "helper.cache_grendel", "numpy.cbrt", "numpy.log", "matplotlib.rcParams.update", "helper.cropsave", "matplotlib.pyplot.figure", "numpy.sin", "numpy.mean", "numpy.loadtxt", "numpy.linspace", "classy.Class", "numpy.exp", "numpy.array", "numpy.log10", "numpy.max", "os.path.isfile", "num...
[((948, 1182), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'text.usetex': True, 'font.family': 'serif', 'font.serif': 'cmr10',\n 'font.size': fontsize, 'mathtext.fontset': 'cm',\n 'axes.formatter.use_mathtext': True, 'text.latex.preamble': latex_preamble}"], {}), "({'text.usetex': True, 'font....
#!/usr/bin/env python import numpy as np import h5py import re import sys import operator import argparse from random import sample, seed from math import ceil import nltk nltk.data.path.append('/ssd-playpen/home/shiyue/oposum/cache') from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer fr...
[ "tqdm.tqdm", "h5py.File", "argparse.ArgumentParser", "h5py.special_dtype", "nltk.data.path.append", "numpy.dtype", "random.seed", "numpy.array", "nltk.corpus.stopwords.words", "nltk.stem.wordnet.WordNetLemmatizer", "operator.itemgetter", "re.sub" ]
[((173, 235), 'nltk.data.path.append', 'nltk.data.path.append', (['"""/ssd-playpen/home/shiyue/oposum/cache"""'], {}), "('/ssd-playpen/home/shiyue/oposum/cache')\n", (194, 235), False, 'import nltk\n'), ((1684, 1695), 'tqdm.tqdm', 'tqdm', (['lines'], {}), '(lines)\n', (1688, 1695), False, 'from tqdm import tqdm\n'), ((...
""" Sources: https://pjreddie.com/darknet/yolo/ https://www.youtube.com/watch?v=1LCb1PVqzeY """ import cv2 import numpy as np # import serial_cmd # Instantiate serial command # control = serial_cmd.Serial_cmd() # Load yolo weights and configuration files net = cv2.dnn.readNet('yolov3-tiny.weights', 'yolov3-tiny.cfg')...
[ "cv2.dnn.NMSBoxes", "numpy.argmax", "cv2.waitKey", "cv2.dnn.blobFromImage", "cv2.imshow", "cv2.dnn.readNet", "cv2.VideoCapture", "cv2.rectangle", "cv2.destroyAllWindows" ]
[((263, 320), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""yolov3-tiny.weights"""', '"""yolov3-tiny.cfg"""'], {}), "('yolov3-tiny.weights', 'yolov3-tiny.cfg')\n", (278, 320), False, 'import cv2\n'), ((328, 347), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (344, 347), False, 'import cv2\n'), ((2226, 2...
""" Weather Panel Displays current weather and some forecast information for multiple locations. Automatically updates the weather information on a regular basis. """ from typing import Optional, Tuple, List, Union import os import numpy as np from datetime import datetime from tokenize import String from pyowm imp...
[ "kivy.properties.ListProperty", "os.path.abspath", "pyowm.OWM", "kivy.properties.DictProperty", "kivy.clock.Clock.schedule_interval", "kivy_garden.graph.ScatterPlot", "kivy.properties.StringProperty", "numpy.random.RandomState", "kivy_garden.graph.MeshLinePlot", "os.environ.get", "kivy.lang.buil...
[((760, 2086), 'kivy.lang.builder.Builder.load_string', 'Builder.load_string', (['"""\n<WeatherPanel>:\n orientation: \'vertical\'\n canvas.before:\n Color: \n rgba: root.bg_color\n Rectangle:\n pos: self.pos\n size: self.size\n BoxLayout:\n orientation: \'...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import numpy as np import common def load_json(filename): with open(filename, "r") as f: return json.load(f) def load_data(filename): j = load_json(filename) return j["nsamples"], np.array(j["vx"]), np.array(j["vy"]) # PDF for velocity...
[ "common.plotHist", "json.load", "numpy.array" ]
[((170, 182), 'json.load', 'json.load', (['f'], {}), '(f)\n', (179, 182), False, 'import json\n'), ((263, 280), 'numpy.array', 'np.array', (["j['vx']"], {}), "(j['vx'])\n", (271, 280), True, 'import numpy as np\n'), ((282, 299), 'numpy.array', 'np.array', (["j['vy']"], {}), "(j['vy'])\n", (290, 299), True, 'import nump...
# Copyright (c) 2020, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the follow...
[ "onnx.helper.make_node", "os.remove", "numpy.random.seed", "onnx.helper.make_tensor_value_info", "finn.transformation.double_to_single_float.DoubleToSingleFloat", "finn.transformation.infer_shapes.InferShapes", "finn.core.onnx_exec.execute_onnx", "finn.transformation.general.GiveUniqueNodeNames", "n...
[((4267, 4302), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ch"""', '[64]'], {}), "('ch', [64])\n", (4290, 4302), False, 'import pytest\n'), ((4313, 4355), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ifmdim"""', '[-1, 7]'], {}), "('ifmdim', [-1, 7])\n", (4336, 4355), False, 'import pytes...
"""Extract data from MALA file types and output into useful formats.""" from os.path import splitext from numpy import fromstring from glob import glob #from .gpr import get_file_path #from .filesystem import get_file_path from .calculations import distance, time def file_extensions(): """Return a l...
[ "os.path.splitext", "numpy.concatenate" ]
[((1449, 1485), 'numpy.concatenate', 'np.concatenate', (['[i for i in array.T]'], {}), '([i for i in array.T])\n', (1463, 1485), True, 'import numpy as np\n'), ((2678, 2692), 'os.path.splitext', 'splitext', (['path'], {}), '(path)\n', (2686, 2692), False, 'from os.path import splitext\n'), ((3389, 3403), 'os.path.split...
import numpy as np class RandomGenerator: def __init__(self, n_symbols, smart=False, offset=2): self.n_symbols = n_symbols self.smart = smart self.offset = offset def next_symbols(self, n): if not self.smart: symbols = np.random.randint(0...
[ "numpy.random.randint", "numpy.random.shuffle" ]
[((301, 340), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.n_symbols', 'n'], {}), '(0, self.n_symbols, n)\n', (318, 340), True, 'import numpy as np\n'), ((417, 443), 'numpy.random.shuffle', 'np.random.shuffle', (['symbols'], {}), '(symbols)\n', (434, 443), True, 'import numpy as np\n'), ((898, 930), 'num...
import os from transformers import ( PreTrainedModel, PreTrainedTokenizer, RobertaConfig, RobertaForMaskedLM, RobertaTokenizer ) import csv, re import torch, numpy as np, pandas as pd from torch.nn import functional as F from torch.utils.data import DataLoader, Dataset from argparse import Argumen...
[ "pandas.DataFrame", "torch.mean", "csv.reader", "argparse.ArgumentParser", "torch.stack", "transformers.RobertaTokenizer.from_pretrained", "numpy.array", "torch.nn.Linear", "torch.tensor", "re.search", "re.sub" ]
[((1238, 1263), 'torch.nn.Linear', 'torch.nn.Linear', (['(768)', '(256)'], {}), '(768, 256)\n', (1253, 1263), False, 'import torch, numpy as np, pandas as pd\n'), ((1282, 1305), 'torch.nn.Linear', 'torch.nn.Linear', (['(256)', '(1)'], {}), '(256, 1)\n', (1297, 1305), False, 'import torch, numpy as np, pandas as pd\n'),...
from os.path import sep from pathlib import Path from typing import List, Tuple try: from typing import Literal except ImportError: from typing_extensions import Literal import cv2 import numpy as np import torch from NaMAZU.functional.image_control import apply_mask_to from PIL import Image from PIL.Image i...
[ "torch.hub.load_state_dict_from_url", "torch.nn.BCELoss", "PIL.Image.open", "cv2.imread", "pathlib.Path", "numpy.array", "torch.max", "NaMAZU.functional.image_control.apply_mask_to", "PIL.Image.fromarray", "torch.min" ]
[((3038, 3056), 'cv2.imread', 'cv2.imread', (['x_path'], {}), '(x_path)\n', (3048, 3056), False, 'import cv2\n'), ((3332, 3344), 'torch.max', 'torch.max', (['d'], {}), '(d)\n', (3341, 3344), False, 'import torch\n'), ((3358, 3370), 'torch.min', 'torch.min', (['d'], {}), '(d)\n', (3367, 3370), False, 'import torch\n'), ...
""" Alanine.py - Python module. - Includes the AlanineDipeptideSimulation class - Includes functions for generating the coarse model - Includes functions for running the reinjection WE process """ import numpy as np from scipy.spatial import KDTree, Voronoi, voronoi_plot_2d fr...
[ "sys.path.append", "pathos.multiprocessing.ProcessPool", "WeightedEnsemble.Bins", "simtk.openmm.CustomTorsionForce", "mdtraj.compute_dihedrals", "openmmtools.testsystems.AlanineDipeptideVacuum", "numpy.zeros", "numpy.ones", "numpy.array", "numpy.linalg.norm", "numpy.linspace", "scipy.spatial.K...
[((660, 682), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (675, 682), False, 'import sys\n'), ((6440, 6471), 'numpy.linspace', 'np.linspace', (['(-π)', 'π', '(nx_bins + 1)'], {}), '(-π, π, nx_bins + 1)\n', (6451, 6471), True, 'import numpy as np\n'), ((6480, 6511), 'numpy.linspace', 'np.lins...
# Area, Perimeter, Center, Curvature import numpy as np import cv2 img=cv2.imread('detect_blob.png') gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) thresh=cv2.adaptiveThreshold(gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,115,1) _,contours,hierarchy=cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE...
[ "cv2.contourArea", "cv2.circle", "cv2.cvtColor", "cv2.waitKey", "cv2.arcLength", "cv2.moments", "numpy.zeros", "cv2.imshow", "cv2.adaptiveThreshold", "cv2.imread", "cv2.drawContours", "cv2.destroyAllWindows", "cv2.findContours" ]
[((72, 101), 'cv2.imread', 'cv2.imread', (['"""detect_blob.png"""'], {}), "('detect_blob.png')\n", (82, 101), False, 'import cv2\n'), ((107, 144), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (119, 144), False, 'import cv2\n'), ((151, 247), 'cv2.adaptiveThreshold',...
# ------------------------------------------------------------------ # PyTorch implementation of # "ROAM: Recurrently Optimizing Tracking Model", CVPR, 2020 # Licensed under The MIT License [see LICENSE for details] # Written by <NAME> (<EMAIL>) # ------------------------------------------------------------------ imp...
[ "os.path.abspath", "networks.FeatureExtractor", "utils.compute_success_overlap", "time.time", "PIL.Image.open", "numpy.array", "tracker.Tracker", "os.path.join", "os.listdir" ]
[((610, 667), 'os.path.join', 'os.path.join', (['data_root', 'seq_name', '"""groundtruth_rect.txt"""'], {}), "(data_root, seq_name, 'groundtruth_rect.txt')\n", (622, 667), False, 'import os\n'), ((871, 911), 'os.path.join', 'os.path.join', (['data_root', 'seq_name', '"""img"""'], {}), "(data_root, seq_name, 'img')\n", ...
"""Remap landcover codes based on distance from stream.""" import datetime import os import sys import logging import zipfile from osgeo import gdal from osgeo import osr import pygeoprocessing import pygeoprocessing.routing import pygeoprocessing.symbolic import numpy import taskgraph import ecoshard LOGGER = loggin...
[ "pygeoprocessing.rasterize", "taskgraph.TaskGraph", "numpy.empty", "logging.getLogger", "numpy.isclose", "os.path.join", "osgeo.gdal.GetDriverByName", "numpy.copy", "os.path.dirname", "numpy.empty_like", "ecoshard.download_url", "datetime.datetime.now", "pygeoprocessing.get_raster_info", "...
[((314, 341), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (331, 341), False, 'import logging\n'), ((343, 429), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(message)s"""', 'stream': 'sys.stdout'}), "(level=logging.DEBUG, format='%(message...
print(__doc__) import matplotlib.pyplot as plt import numpy as np import cPickle from sklearn.neural_network import MLPClassifier from sklearn import preprocessing # rescale the data, use the traditional train/test split # mlp = MLPClassifier(hidden_layer_sizes=(100, 100), max_iter=400, alpha=1e-4, # ...
[ "sklearn.preprocessing.scale", "numpy.array", "sklearn.neural_network.MLPClassifier", "numpy.ravel" ]
[((445, 473), 'numpy.array', 'np.array', (["data['train_data']"], {}), "(data['train_data'])\n", (453, 473), True, 'import numpy as np\n'), ((484, 514), 'numpy.array', 'np.array', (["data['train_labels']"], {}), "(data['train_labels'])\n", (492, 514), True, 'import numpy as np\n'), ((525, 552), 'numpy.array', 'np.array...
import pickle import pandas as pd import sklearn.linear_model as linear_model from sklearn.linear_model import ElasticNetCV import statsmodels.api as sm from sklearn.model_selection import train_test_split import numpy as np import os from sklearn.linear_model import LassoCV from sklearn.feature_selection import Select...
[ "sklearn.linear_model.LassoCV", "statsmodels.api.OLS", "numpy.square", "sklearn.linear_model.LinearRegression", "numpy.where", "numpy.column_stack", "os.path.join", "numpy.sqrt" ]
[((2462, 2513), 'numpy.column_stack', 'np.column_stack', (['(gamma_ct, S_matrix_new, Z_matrix)'], {}), '((gamma_ct, S_matrix_new, Z_matrix))\n', (2477, 2513), True, 'import numpy as np\n'), ((3829, 3874), 'sklearn.linear_model.LinearRegression', 'linear_model.LinearRegression', ([], {'normalize': '(True)'}), '(normaliz...
import itertools import math import copy import numpy as np __all__ = ['HybridModeling'] __docformat__ = "restructuredtext en" class HybridModeling(object): """Class containing a collection of methods needed for seismic inversion in the frequency domain. This collection is designed so that a collecti...
[ "matplotlib.pyplot.title", "numpy.random.seed", "pysit.PML", "pysit.modeling.HybridModeling", "matplotlib.pyplot.figure", "numpy.imag", "numpy.linalg.norm", "numpy.exp", "pysit.Shot", "pysit.vis.plot", "numpy.prod", "pysit.RickerWavelet", "pysit.RectangularDomain", "matplotlib.pyplot.color...
[((26145, 26177), 'pysit.PML', 'PML', (['(0.3)', '(100)'], {'ftype': '"""quadratic"""'}), "(0.3, 100, ftype='quadratic')\n", (26148, 26177), False, 'from pysit import PML, RectangularDomain, CartesianMesh, PointSource, ReceiverSet, Shot, ConstantDensityAcousticWave, generate_seismic_data, PointReceiver, RickerWavelet, ...
import numpy as np from pyglet.window import key from core import constants from core.entities.tank import tank class Player(tank.Tank): """ A tank taking input from the keyboard and representing a play in-game. """ def __init__(self, **kwargs): super().__init__(**kwargs) self.speed =...
[ "numpy.array", "pyglet.window.key.KeyStateHandler", "numpy.zeros" ]
[((423, 444), 'pyglet.window.key.KeyStateHandler', 'key.KeyStateHandler', ([], {}), '()\n', (442, 444), False, 'from pyglet.window import key\n'), ((483, 499), 'numpy.zeros', 'np.zeros', (['(2)', 'int'], {}), '(2, int)\n', (491, 499), True, 'import numpy as np\n'), ((1866, 1884), 'numpy.array', 'np.array', (['[dx, dy]'...
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ "os.mkdir", "os.path.join", "pandas.read_csv", "numpy.unique", "sklearn.preprocessing.OneHotEncoder", "os.path.exists", "numpy.where", "tensorflow.gfile.Open", "tensorflow.gfile.Remove", "sklearn.preprocessing.OrdinalEncoder", "numpy.concatenate" ]
[((1910, 1953), 'os.path.join', 'os.path.join', (['self.url', 'self.train_filename'], {}), '(self.url, self.train_filename)\n', (1922, 1953), False, 'import os\n'), ((1978, 2020), 'os.path.join', 'os.path.join', (['self.url', 'self.test_filename'], {}), '(self.url, self.test_filename)\n', (1990, 2020), False, 'import o...
import numpy as np import tensorflow as tf seed: int = 13371337 # reproducibility np.random.seed(seed) tf.set_random_seed(seed) class ImageDataLoader: def __init__(self, patch_shape: tuple = (128, 128), channels: int = 3, n_patches: int = 16): self.patc...
[ "tensorflow.image.rot90", "numpy.random.seed", "tensorflow.image.flip_up_down", "tensorflow.reshape", "tensorflow.set_random_seed", "tensorflow.image.decode_png", "tensorflow.cast", "numpy.random.randint", "tensorflow.read_file", "tensorflow.expand_dims", "numpy.sqrt" ]
[((84, 104), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (98, 104), True, 'import numpy as np\n'), ((105, 129), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (123, 129), True, 'import tensorflow as tf\n'), ((1512, 1531), 'tensorflow.read_file', 'tf.read_file', ([...
#pylint: disable=bare-except, invalid-name, too-many-arguments """ Merging tools for REF_M """ from __future__ import (absolute_import, division, print_function) import sys import os import pytz import json import time import datetime import pandas import numpy as np import mantid import mantid.simpleapi as api fr...
[ "numpy.sum", "mantid.simpleapi.Stitch1D", "pandas.read_csv", "mantid.simpleapi.CreateWorkspace", "mantid.simpleapi.ConvertToHistogram", "time.strftime", "finddata.publish_plot.plot1d", "json.dumps", "datetime.datetime.now", "os.path.isfile", "mantid.simpleapi.CloneWorkspace", "pytz.timezone", ...
[((776, 855), 'mantid.simpleapi.logger.notice', 'api.logger.notice', (["('Matching for IPTS-%s r%s [%s]' % (ipts, run, cross_section))"], {}), "('Matching for IPTS-%s r%s [%s]' % (ipts, run, cross_section))\n", (793, 855), True, 'import mantid.simpleapi as api\n'), ((1976, 2001), 'os.path.isfile', 'os.path.isfile', (['...
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.4.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- import sys sys.path.appen...
[ "gpflow.config.default_float", "attr.s", "tensorflow.identity", "tensorflow.zeros_like", "tensorflow.matmul", "tensorflow.split", "gpflow.utilities.triangular", "gpflow.conditionals.sample_conditional", "sys.path.append", "gpflow.kullback_leiblers.gauss_kl", "numpy.random.randn", "tensorflow.T...
[((306, 348), 'sys.path.append', 'sys.path.append', (['"""/home/dgp_iwvi_gpflow2/"""'], {}), "('/home/dgp_iwvi_gpflow2/')\n", (321, 348), False, 'import sys\n'), ((31564, 31589), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (31570, 31589), False, 'import attr\n'), ((31663, 31688), 'att...
import os import sys import time import logging import collections import csv import numpy as np import torch import torch.utils.data as data import torchvision.transforms as transforms from .datasets import Landmarks def _read_csv(path: str): """Reads a csv file, and returns the content inside a list of dictiona...
[ "logging.error", "torch.utils.data.DataLoader", "torchvision.transforms.RandomHorizontalFlip", "csv.DictReader", "torchvision.transforms.Normalize", "numpy.ones", "numpy.clip", "torchvision.transforms.ToTensor", "collections.defaultdict", "numpy.random.randint", "torchvision.transforms.CenterCro...
[((4141, 4170), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (4164, 4170), False, 'import collections\n'), ((5791, 5880), 'torch.utils.data.DataLoader', 'data.DataLoader', ([], {'dataset': 'train_ds', 'batch_size': 'train_bs', 'shuffle': '(True)', 'drop_last': '(False)'}), '(dataset...
import argparse import torch import torch.nn as nn import torch.optim as optim import sys import os import random import numpy as np import torch.nn.functional as F from torch.utils.data import DataLoader from apl import models from apl import memory_store from datasets import omniglot N_CLASSES = 200 N_NEIGHBOURS = ...
[ "argparse.ArgumentParser", "torch.argmax", "numpy.mean", "apl.memory_store.MemoryStore", "torch.device", "torch.load", "torch.Tensor", "torch.mean", "torch.autograd.Variable", "torch.nn.functional.cross_entropy", "apl.models.Encoder", "torch.cuda.is_available", "torch.max", "torch.sum", ...
[((1537, 1562), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1560, 1562), False, 'import argparse\n'), ((2553, 2596), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (2565, 2596), False, 'import torch\n'), ((2608, 2624), 'apl.mo...
from pdb import set_trace as T import numpy as np from nmmo.lib import overlay from nmmo.lib.colors import Neon from nmmo.systems import combat class OverlayRegistry: def __init__(self, config, realm): '''Manager class for overlays Args: config: A Config object realm: An environme...
[ "nmmo.systems.combat.level", "nmmo.lib.overlay", "numpy.sum", "nmmo.systems.combat.wilderness", "numpy.argmax", "numpy.std", "nmmo.lib.overlay.norm", "numpy.zeros", "numpy.mean", "numpy.array", "nmmo.lib.overlay.twoTone", "nmmo.lib.overlay.update" ]
[((1731, 1763), 'numpy.zeros', 'np.zeros', (['(self.size, self.size)'], {}), '((self.size, self.size))\n', (1739, 1763), True, 'import numpy as np\n'), ((2301, 2347), 'numpy.zeros', 'np.zeros', (['(self.size, self.size, self.nSkills)'], {}), '((self.size, self.size, self.nSkills))\n', (2309, 2347), True, 'import numpy ...
import time import os import datetime import tensorflow as tf import matplotlib.pyplot as plt import utils import numpy as np from sklearn import svm import pickle tf.flags.DEFINE_string("datasetPath", './data/appearance_spliced_images/appearance.p', "dataset path") tf.flags.DEFINE_integer("max", 10000, "max number of...
[ "numpy.random.binomial", "numpy.argmax", "tensorflow.Session", "utils.loadlabel", "numpy.equal", "sklearn.svm.OneClassSVM", "tensorflow.train.latest_checkpoint", "tensorflow.Graph", "tensorflow.flags.DEFINE_integer", "utils.load_whole_dataset", "tensorflow.flags.DEFINE_string" ]
[((165, 271), 'tensorflow.flags.DEFINE_string', 'tf.flags.DEFINE_string', (['"""datasetPath"""', '"""./data/appearance_spliced_images/appearance.p"""', '"""dataset path"""'], {}), "('datasetPath',\n './data/appearance_spliced_images/appearance.p', 'dataset path')\n", (187, 271), True, 'import tensorflow as tf\n'), (...
# Licensed under a 3-clause BSD style license - see LICENSE.rst # -*- coding: utf-8 -*- """This module corresponds to the sdss directory in idlutils. """ import os import re import numpy as np from astropy.io import fits from astropy.utils.data import download_file from . import PydlutilsException from .spheregroup imp...
[ "numpy.uint64", "numpy.zeros", "re.match", "numpy.recarray", "numpy.array", "numpy.bitwise_and", "astropy.io.fits.open", "astropy.utils.data.download_file", "os.getenv" ]
[((3901, 3932), 'numpy.zeros', 'np.zeros', (['run.shape'], {'dtype': 'bool'}), '(run.shape, dtype=bool)\n', (3909, 3932), True, 'import numpy as np\n'), ((6637, 6657), 'numpy.uint64', 'np.uint64', (['flagvalue'], {}), '(flagvalue)\n', (6646, 6657), True, 'import numpy as np\n'), ((6668, 6680), 'numpy.uint64', 'np.uint6...
from __future__ import print_function from __future__ import division import time import sys import numpy as np from numpy import * from scipy.ndimage.filters import gaussian_filter1d import config class ExpFilter: """Temporal exponential smoothing filter """ def __init__(self, val=0.0, alpha_decay=0.5, al...
[ "numpy.zeros_like", "numpy.abs", "numpy.argmax", "numpy.roll", "numpy.zeros", "numpy.ones", "numpy.argsort", "numpy.sort", "numpy.fliplr", "numpy.array", "numpy.dot", "numpy.round" ]
[((1811, 1847), 'numpy.dot', 'np.dot', (['self.matrix', 'newNoteSpectrum'], {}), '(self.matrix, newNoteSpectrum)\n', (1817, 1847), True, 'import numpy as np\n'), ((1917, 1946), 'numpy.argmax', 'np.argmax', (['self.keySums.value'], {}), '(self.keySums.value)\n', (1926, 1946), True, 'import numpy as np\n'), ((1994, 2021)...
import matplotlib.pyplot as plt import numpy as np import networkx as nx import re import math from collections import Counter, defaultdict from matplotlib.font_manager import FontProperties from matplotlib import gridspec from scipy.optimize import minimize # from .bundle import PathBundle def checkEqual2(iterator)...
[ "matplotlib.pyplot.clf", "collections.defaultdict", "matplotlib.pyplot.figure", "networkx.draw_networkx_nodes", "matplotlib.pyplot.contour", "networkx.draw_networkx_labels", "matplotlib.pyplot.fill_between", "scipy.optimize.minimize", "numpy.meshgrid", "matplotlib.font_manager.FontProperties", "...
[((1646, 1704), 'numpy.linspace', 'np.linspace', (['sortedpoints[0][0]', 'sortedpoints[1][0]'], {'num': '(2)'}), '(sortedpoints[0][0], sortedpoints[1][0], num=2)\n', (1657, 1704), True, 'import numpy as np\n'), ((1714, 1772), 'numpy.linspace', 'np.linspace', (['sortedpoints[1][0]', 'sortedpoints[2][0]'], {'num': '(2)'}...
import numpy as np from numba import float64, int64, boolean, deferred_type from numba.experimental import jitclass from polygon import Polygon from numba_utils import NanMean12, NbRound1, NbRound2, Mean0, Any1, NotInInt from linalg_utils import CheckCircleIntersect, Normalize, CircleLineIntersectDiscriminant, Ful...
[ "numpy.isnan", "numpy.linalg.norm", "numpy.unique", "numpy.full", "numpy.zeros_like", "linalg_utils.MirrorPoints", "numba_utils.NbRound1", "numba.experimental.jitclass", "numpy.transpose", "numpy.max", "numba_utils.NotInInt", "numpy.column_stack", "numba_utils.NbRound2", "numba_utils.Mean0...
[((369, 384), 'numba.deferred_type', 'deferred_type', ([], {}), '()\n', (382, 384), False, 'from numba import float64, int64, boolean, deferred_type\n'), ((897, 916), 'numba.experimental.jitclass', 'jitclass', (['pack_spec'], {}), '(pack_spec)\n', (905, 916), False, 'from numba.experimental import jitclass\n'), ((3836,...
#-*- coding:utf-8 -*- """ qmap.py author: <NAME> (2013/05/17) 量子系の計算を行います. 具体的には, 1. 与えられた初期条件の時間発展を行います 2. 系の時間発展演算子の固有値及び固有ベクトルを求めますよ. """ import numpy from SimpleQmap.state import * twopi = 2.0*numpy.pi class SplitHamiltonian(ScaleInfo): def __init__(self, dim, domain): super().__init__(dim...
[ "numpy.fft.ifft", "numpy.abs", "numpy.fft.fft", "numpy.zeros", "numpy.transpose", "numpy.linalg.eig", "numpy.fft.fftshift", "numpy.eye", "doctest.testmod" ]
[((6568, 6585), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (6583, 6585), False, 'import doctest\n'), ((587, 622), 'numpy.eye', 'numpy.eye', (['dim'], {'dtype': 'numpy.complex'}), '(dim, dtype=numpy.complex)\n', (596, 622), False, 'import numpy\n'), ((637, 681), 'numpy.zeros', 'numpy.zeros', (['(dim, dim)']...
#!/usr/bin/env python # vim: set fileencoding=utf-8 : # <NAME> <<EMAIL>> # Wed Nov 16 13:27:15 2011 +0100 # # Copyright (C) 2011-2013 Idiap Research Institute, Martigny, Switzerland """A combined test for all built-in types of Array/interaction in python. """ import os import sys import numpy import nose.tools from ...
[ "os.unlink", "numpy.allclose", "os.path.exists", "os.path.splitext", "numpy.random.normal", "numpy.array_equal" ]
[((984, 1013), 'numpy.allclose', 'numpy.allclose', (['f[0]', 'objs[0]'], {}), '(f[0], objs[0])\n', (998, 1013), False, 'import numpy\n'), ((1023, 1052), 'numpy.allclose', 'numpy.allclose', (['f[1]', 'objs[1]'], {}), '(f[1], objs[1])\n', (1037, 1052), False, 'import numpy\n'), ((1062, 1093), 'numpy.allclose', 'numpy.all...
import numpy as np from scipy.spatial.distance import cdist class KMeans: def __init__( self, k: int, metric: str = "euclidean", tol: float = 1e-6, max_iter: int = 100): """ inputs: k: int the number of centroid...
[ "numpy.random.seed", "numpy.argmin", "numpy.mean", "numpy.array", "numpy.random.choice" ]
[((2154, 2170), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (2168, 2170), True, 'import numpy as np\n'), ((2328, 2365), 'numpy.random.choice', 'np.random.choice', (['n', 'k'], {'replace': '(False)'}), '(n, k, replace=False)\n', (2344, 2365), True, 'import numpy as np\n'), ((4546, 4564), 'numpy.array', 'np....
# Inputs: Database containing: # - origin-destination pairs (table) # - a subset of the destinations that contain services of interest (table) # Maximum duration of walking # Output: Table containing O-D pairs only for the destinations of interest import pandas as pd...
[ "pandas.DataFrame", "logging.basicConfig", "pandas.merge", "numpy.unique", "numpy.where", "sqlite3.connect", "logging.getLogger" ]
[((382, 421), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (401, 421), False, 'import logging\n'), ((431, 458), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (448, 458), False, 'import logging\n'), ((857, 879), 'sqlite3.connect'...
import pickle import numpy as np import pandas as pd from fugue import FugueWorkflow from pytest import raises from sklearn.base import is_classifier, is_regressor from sklearn.linear_model import LinearRegression, Ridge, LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble impo...
[ "numpy.random.seed", "fugue_tune.space.Grid", "fugue_tune.sklearn._to_model", "fugue_tune.sklearn.sk_space", "fugue.FugueWorkflow", "numpy.random.randint", "numpy.random.rand", "fugue_tune.sklearn._to_model_str" ]
[((3430, 3445), 'fugue.FugueWorkflow', 'FugueWorkflow', ([], {}), '()\n', (3443, 3445), False, 'from fugue import FugueWorkflow\n'), ((5628, 5643), 'fugue.FugueWorkflow', 'FugueWorkflow', ([], {}), '()\n', (5641, 5643), False, 'from fugue import FugueWorkflow\n'), ((6501, 6518), 'numpy.random.seed', 'np.random.seed', (...
#!/usr/bin/env python import numpy as np import pandas as pd import torch from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from sklearn.neighbors import KNeighborsClassifier, KNeighborsRegressor from sklearn.preprocessing import MinMaxScaler as Scaler from sklearn.cross_decomposition import PL...
[ "sklearn.preprocessing.MinMaxScaler", "joblib.dump", "sklearn.svm.SVC", "pandas.read_table", "pandas.DataFrame", "torch.utils.data.DataLoader", "torch.Tensor", "pandas.concat", "sklearn.ensemble.RandomForestClassifier", "copy.deepcopy", "sklearn.ensemble.RandomForestRegressor", "sklearn.cross_...
[((2135, 2152), 'numpy.zeros', 'np.zeros', (['y.shape'], {}), '(y.shape)\n', (2143, 2152), True, 'import numpy as np\n'), ((2164, 2185), 'numpy.zeros', 'np.zeros', (['y_ind.shape'], {}), '(y_ind.shape)\n', (2172, 2185), True, 'import numpy as np\n'), ((4420, 4437), 'numpy.zeros', 'np.zeros', (['y.shape'], {}), '(y.shap...
import numpy as np from numpy.linalg import norm """ This gets the cost function that lead to a certain coordinate x and y. """ def get_point_cost_function(target_x, target_y, x_weight, y_weight, control_weight): def cost_function(state, control): x_dist_to_target = target_x - state[0] y_dist_to_ta...
[ "numpy.sin", "numpy.linalg.norm", "numpy.array", "numpy.exp", "numpy.cos", "numpy.sqrt" ]
[((1191, 1257), 'numpy.sqrt', 'np.sqrt', (['((circle_center[0] - x) ** 2 + (circle_center[1] - y) ** 2)'], {}), '((circle_center[0] - x) ** 2 + (circle_center[1] - y) ** 2)\n', (1198, 1257), True, 'import numpy as np\n'), ((1470, 1489), 'numpy.array', 'np.array', (['[x, y, 0]'], {}), '([x, y, 0])\n', (1478, 1489), True...
import numpy as np import pandas as pd from matplotlib import pyplot as plt import tensorflow as tf from tensorflow import keras from tensorflow.keras.callbacks import EarlyStopping from sklearn import preprocessing with tf.device('/gpu:1'): Arm1_CS_State = pd.read_csv('/home/kiyanoushs/Kiyanoush Codes/Needle Ins...
[ "pandas.DataFrame", "numpy.load", "sklearn.preprocessing.StandardScaler", "tensorflow.keras.layers.Conv2D", "tensorflow.keras.layers.Dense", "pandas.read_csv", "tensorflow.device", "numpy.ones", "tensorflow.keras.models.Model", "numpy.max", "tensorflow.keras.layers.concatenate", "numpy.where",...
[((225, 244), 'tensorflow.device', 'tf.device', (['"""/gpu:1"""'], {}), "('/gpu:1')\n", (234, 244), True, 'import tensorflow as tf\n'), ((264, 376), 'pandas.read_csv', 'pd.read_csv', (['"""/home/kiyanoushs/Kiyanoush Codes/Needle Insertion/Data/Arm2_CS_ordered.csv"""'], {'header': 'None'}), "(\n '/home/kiyanoushs/Kiy...
""" Continuous NSGA-II, NSGA-III """ from xopt import creator, vocs_tools, fitness_with_constraints from xopt import creator, vocs_tools, fitness_with_constraints from xopt.tools import full_path, random_settings_arrays, DummyExecutor, load_config, NpEncoder from xopt import __version__ from deap import algorithms,...
[ "xopt.vocs_tools.var_maxs", "xopt.tools.DummyExecutor", "xopt.vocs_tools.weight_list", "xopt.vocs_tools.evaluate_constraints", "os.path.join", "deap.base.Toolbox", "os.path.exists", "deap.algorithms.varAnd", "random.seed", "xopt.tools.random_settings_arrays", "traceback.format_exc", "xopt.crea...
[((418, 445), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (435, 445), False, 'import logging\n'), ((2200, 2221), 'xopt.vocs_tools.skeys', 'vocs_tools.skeys', (['var'], {}), '(var)\n', (2216, 2221), False, 'from xopt import creator, vocs_tools, fitness_with_constraints\n'), ((2239, 2260...
""" Extract robot positions from Ignition SQLite log file """ import cv2 import numpy as np import re import sqlite3 import xml.etree.ElementTree as ET from datetime import timedelta from subt.ign_pb2 import Pose_V COLORS = [ (255, 255, 255), (0, 255, 0), (0, 0, 255), (255, 0, 0), (0, 255, 255)...
[ "subt.ign_pb2.Pose_V", "argparse.ArgumentParser", "xml.etree.ElementTree.fromstring", "cv2.imwrite", "numpy.zeros", "cv2.drawMarker", "sqlite3.connect", "datetime.timedelta", "cv2.applyColorMap", "re.compile" ]
[((848, 873), 'sqlite3.connect', 'sqlite3.connect', (['filename'], {}), '(filename)\n', (863, 873), False, 'import sqlite3\n'), ((1061, 1069), 'subt.ign_pb2.Pose_V', 'Pose_V', ([], {}), '()\n', (1067, 1069), False, 'from subt.ign_pb2 import Pose_V\n'), ((1972, 1997), 'sqlite3.connect', 'sqlite3.connect', (['filename'],...
""" Screen timeseries for anomalies and impute missing and anomalous values. The screening methods were originally designed to identify unrealistic data in the electricity demand timeseries reported to EIA on Form 930, and have also been applied to the FERC Form 714, and various historical demand timeseries published ...
[ "numpy.isin", "numpy.moveaxis", "numpy.sum", "numpy.abs", "numpy.nanmedian", "numpy.maximum", "numpy.empty", "numpy.einsum", "numpy.ones", "numpy.isnan", "numpy.random.default_rng", "numpy.argsort", "numpy.linalg.svd", "numpy.mean", "numpy.linalg.norm", "numpy.arange", "numpy.diag", ...
[((3024, 3040), 'numpy.empty_like', 'np.empty_like', (['x'], {}), '(x)\n', (3037, 3040), True, 'import numpy as np\n'), ((4201, 4214), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (4211, 4214), True, 'import numpy as np\n'), ((4331, 4356), 'numpy.array', 'np.array', (['(x[1:] != x[:-1])'], {}), '(x[1:] != x[:-1...
# coding=utf-8 # Copyright 2020 The Adp Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
[ "jax.experimental.stax.BatchNorm", "jax.experimental.optimizers.unpack_optimizer_state", "tensorflow.compat.v1.io.gfile.Open", "jax.experimental.stax.serial", "jax.random.PRNGKey", "tensorflow.compat.v1.io.gfile.MakeDirs", "numpy.mean", "absl.flags.DEFINE_boolean", "pickle.load", "adp.data.DataChu...
[((1378, 1429), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""config"""', '""""""', '"""Configuration."""'], {}), "('config', '', 'Configuration.')\n", (1397, 1429), False, 'from absl import flags\n'), ((1435, 1533), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""dpsgd"""', '(True)', '"""True, tr...
from PIL import Image from filepath.file_relative_paths import ImagePathAndProps from filepath.file_relative_paths import GuiCheckImagePathAndPropsOrdered from filepath.file_relative_paths import FilePaths from utils import resource_path from utils import img_to_string from utils import img_remove_background_and_enhanc...
[ "traceback.print_exc", "numpy.count_nonzero", "utils.resource_path", "cv2.cvtColor", "cv2.waitKey", "cv2.threshold", "bot_related.aircve.find_all_template", "bot_related.aircve.find_template", "utils.img_to_string", "numpy.array", "PIL.Image.fromarray", "cv2.absdiff", "cv2.imshow" ]
[((559, 586), 'cv2.absdiff', 'cv2.absdiff', (['image1', 'image2'], {}), '(image1, image2)\n', (570, 586), False, 'import cv2\n'), ((2236, 2284), 'bot_related.aircve.find_all_template', 'aircv.find_all_template', (['imsrc', 'imsch', 'threshold'], {}), '(imsrc, imsch, threshold)\n', (2259, 2284), True, 'from bot_related ...
import luigi import numpy as np from pathlib import Path from common import utils from tasks.reg.rollings import RollingFeatures class PolyFeatures(luigi.Task): uuid = luigi.Parameter() task = luigi.Parameter() def requires(self): return RollingFeatures(self.uuid, self.task) def output(self...
[ "luigi.Parameter", "numpy.log", "tasks.reg.rollings.RollingFeatures" ]
[((175, 192), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (190, 192), False, 'import luigi\n'), ((204, 221), 'luigi.Parameter', 'luigi.Parameter', ([], {}), '()\n', (219, 221), False, 'import luigi\n'), ((262, 299), 'tasks.reg.rollings.RollingFeatures', 'RollingFeatures', (['self.uuid', 'self.task'], {}), '...
from model_framework import model_loader from data_generators import get_subject_names from math import pow, sqrt import numpy as np import matplotlib.pyplot as plt from scipy.stats import f def calculate_f_score(unrestricted_RSS,restricted_RSS,p1,p2,n,ci=0.05,visualize=True): assert (p2 > p1) #Calculate ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.yscale", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "math.pow", "math.sqrt", "matplotlib.pyplot.legend", "data_generators.get_subject_names", "model_framework.model_loader", "numpy.array", "matplotlib.pyplot.yl...
[((659, 678), 'scipy.stats.f.isf', 'f.isf', (['ci', 'df1', 'df2'], {}), '(ci, df1, df2)\n', (664, 678), False, 'from scipy.stats import f\n'), ((1057, 1079), 'model_framework.model_loader', 'model_loader', (['filename'], {}), '(filename)\n', (1069, 1079), False, 'from model_framework import model_loader\n'), ((1246, 12...