code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import sys
sys.path.append('../code')
import argparse
import GPUtil
import os
from pyhocon import ConfigFactory
import torch
import numpy as np
import cvxpy as cp
from PIL import Image
import math
import utils.general as utils
import utils.plots as plt
from utils import rend_util
def evaluate(**kwargs):
torch.set... | [
"argparse.ArgumentParser",
"torch.nn.Embedding",
"utils.general.mkdir_ifnotexists",
"numpy.ones",
"torch.set_default_dtype",
"numpy.mean",
"torch.arange",
"torch.no_grad",
"os.path.join",
"sys.path.append",
"torch.ones",
"torch.utils.data.DataLoader",
"GPUtil.getAvailable",
"torch.diag",
... | [((11, 37), 'sys.path.append', 'sys.path.append', (['"""../code"""'], {}), "('../code')\n", (26, 37), False, 'import sys\n'), ((311, 349), 'torch.set_default_dtype', 'torch.set_default_dtype', (['torch.float32'], {}), '(torch.float32)\n', (334, 349), False, 'import torch\n'), ((362, 402), 'pyhocon.ConfigFactory.parse_f... |
#!/usr/bin/env python3
# coding: utf-8
"""
@file: cluster.py
@description:
@author: <NAME>
@email: <EMAIL>
@last modified by: <NAME>
change log:
2021/07/23 create file.
"""
import numpy as np
import leidenalg as la
from ..core.tool_base import ToolBase
from ..log_manager import logger
from stereo.algorithm.neigh... | [
"pandas.DataFrame",
"leidenalg.ModularityVertexPartition",
"phenograph.cluster",
"stereo.algorithm.neighbors.Neighbors",
"numpy.array",
"leidenalg.Optimiser"
] | [((3435, 3463), 'stereo.algorithm.neighbors.Neighbors', 'Neighbors', (['x', 'self.neighbors'], {}), '(x, self.neighbors)\n', (3444, 3463), False, 'from stereo.algorithm.neighbors import Neighbors\n'), ((4508, 4522), 'leidenalg.Optimiser', 'la.Optimiser', ([], {}), '()\n', (4520, 4522), True, 'import leidenalg as la\n')... |
import hashlib
import math
import re
import typing
import cv2 as cv
import numpy as np
import torch.utils.data
def project_points(points, projection_matrix, view_matrix, width, height):
p_3d_cam = np.concatenate((points, np.ones_like(points[:, :1])), axis=-1).T
p_2d_proj = np.matmul(projection_matrix, p_3d_c... | [
"numpy.ones_like",
"numpy.copy",
"math.sqrt",
"numpy.histogram",
"numpy.array",
"numpy.matmul",
"cv2.Laplacian"
] | [((285, 323), 'numpy.matmul', 'np.matmul', (['projection_matrix', 'p_3d_cam'], {}), '(projection_matrix, p_3d_cam)\n', (294, 323), True, 'import numpy as np\n'), ((461, 478), 'numpy.copy', 'np.copy', (['p_2d_ndc'], {}), '(p_2d_ndc)\n', (468, 478), True, 'import numpy as np\n'), ((732, 764), 'math.sqrt', 'math.sqrt', ([... |
import os
import json
import argparse
import numpy as np
import skimage.io as io
import matplotlib.pyplot as plt
from shapely.geometry import Polygon
from descartes.patch import PolygonPatch
from misc.panorama import draw_boundary_from_cor_id
from misc.colors import colormap_255
def visualize_panorama(args):
""... | [
"matplotlib.pyplot.title",
"json.load",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"shapely.geometry.Polygon",
"descartes.patch.PolygonPatch",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.array",
"misc.panorama.draw_boundary_from_cor_id",
"... | [((372, 441), 'os.path.join', 'os.path.join', (['args.path', "('scene_%05d' % (args.scene,))", '"""2D_rendering"""'], {}), "(args.path, 'scene_%05d' % (args.scene,), '2D_rendering')\n", (384, 441), False, 'import os\n'), ((983, 1052), 'os.path.join', 'os.path.join', (['args.path', "('scene_%05d' % (args.scene,))", '"""... |
########################################
# MIT License
#
# Copyright (c) 2020 <NAME>
########################################
'''
Some utilities to plot data and PDFs using matplotlib.
'''
from ..base import parameters
from ..base import data_types
from ..pdfs import dataset
import numpy as np
__all__ = ['data_plotti... | [
"numpy.meshgrid",
"numpy.sum",
"numpy.logical_and",
"numpy.histogramdd",
"numpy.prod"
] | [((796, 814), 'numpy.prod', 'np.prod', (['m'], {'axis': '(0)'}), '(m, axis=0)\n', (803, 814), True, 'import numpy as np\n'), ((3447, 3473), 'numpy.sum', 'np.sum', (['pdf_values'], {'axis': 'i'}), '(pdf_values, axis=i)\n', (3453, 3473), True, 'import numpy as np\n'), ((5845, 5868), 'numpy.sum', 'np.sum', (['values'], {'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
I/O objects for phys2bids.
"""
import logging
from itertools import groupby
import numpy as np
LGR = logging.getLogger(__name__)
def is_valid(var, var_type, list_type=None):
"""
Checks that the var is of a certain type.
If type is list and list_type i... | [
"numpy.std",
"numpy.asarray",
"numpy.mean",
"itertools.groupby",
"numpy.delete",
"logging.getLogger"
] | [((156, 183), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (173, 183), False, 'import logging\n'), ((14231, 14270), 'numpy.delete', 'np.delete', (['self.timeseries', 'idx'], {'axis': '(1)'}), '(self.timeseries, idx, axis=1)\n', (14240, 14270), True, 'import numpy as np\n'), ((14885, 149... |
import random
import time
import copy
import math
import itertools
import statistics
import matplotlib
import matplotlib.pyplot as plot
import numpy as np
n = 800 #liczba wierzcholkow
populacja = 10 #licznosc populacji
wstepnaPop... | [
"matplotlib.pyplot.title",
"copy.deepcopy",
"statistics.fmean",
"random.randint",
"matplotlib.pyplot.plot",
"math.sqrt",
"random.shuffle",
"statistics.stdev",
"time.strftime",
"numpy.ones",
"time.time",
"random.random",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matp... | [((12185, 12219), 'time.strftime', 'time.strftime', (['"""%d_%m_%y_%H_%M_%S"""'], {}), "('%d_%m_%y_%H_%M_%S')\n", (12198, 12219), False, 'import time\n'), ((2557, 2579), 'copy.deepcopy', 'copy.deepcopy', (['indeksy'], {}), '(indeksy)\n', (2570, 2579), False, 'import copy\n'), ((2584, 2608), 'random.shuffle', 'random.sh... |
"""
==========
References
==========
Implementation of Morphological Layers [1]_, [2]_, [3]_, [4]_
.. [1] <NAME>. (1983) Image Analysis and Mathematical Morphology.
Academic Press, Inc. Orlando, FL, USA
.. [2] <NAME>. (1999). Morphological Image Analysis. Springer-Verlag
"""
import tensorflow as tf
import nu... | [
"morpholayers.constraints.SEconstraint",
"tensorflow.einsum",
"tensorflow.keras.layers.MaxPooling2D",
"numpy.ones",
"tensorflow.keras.backend.max",
"tensorflow.python.keras.activations.get",
"tensorflow.repeat",
"tensorflow.reduce_max",
"tensorflow.keras.initializers.get",
"tensorflow.abs",
"ten... | [((372, 412), 'tensorflow.keras.backend.set_image_data_format', 'K.set_image_data_format', (['"""channels_last"""'], {}), "('channels_last')\n", (395, 412), True, 'from tensorflow.keras import backend as K\n'), ((1502, 1531), 'tensorflow.keras.backend.stack', 'K.stack', (['FilterLines'], {'axis': '(-1)'}), '(FilterLine... |
import numpy as np
from . import RandomAction, BestAction
class EpsilonGreedy:
def __init__(self, all_actions: int, **kwargs):
self.all_actions = all_actions
self.epsilon = kwargs['epsilon']
assert 0 <= self.epsilon < 1
def __call__(self, population) -> int:
if np.random.ran... | [
"numpy.random.rand"
] | [((307, 323), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (321, 323), True, 'import numpy as np\n')] |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"kws_streaming.layers.compat.tf.keras.layers.Input",
"kws_streaming.layers.spectrogram_augment.SpecAugment",
"numpy.ones",
"kws_streaming.layers.test_utils.set_seed",
"kws_streaming.layers.compat.tf1.disable_eager_execution",
"numpy.array",
"kws_streaming.layers.compat.tf.test.main",
"kws_streaming.la... | [((849, 878), 'kws_streaming.layers.compat.tf1.disable_eager_execution', 'tf1.disable_eager_execution', ([], {}), '()\n', (876, 878), False, 'from kws_streaming.layers.compat import tf1\n'), ((2636, 2650), 'kws_streaming.layers.compat.tf.test.main', 'tf.test.main', ([], {}), '()\n', (2648, 2650), False, 'from kws_strea... |
###############################
#
# Created by <NAME>
# 3/18/2021
#
###############################
from typing import Tuple, Literal, Union, Callable
import torch as t
import numpy as np
from .Neighborhood import Neighborhood
from .Static import Static
class _Grid(Neighborhood):
"""
Grid neighborhood in arbi... | [
"numpy.zeros",
"torch.tensor",
"numpy.arange",
"numpy.prod"
] | [((1774, 1793), 'numpy.arange', 'np.arange', (['pop_size'], {}), '(pop_size)\n', (1783, 1793), True, 'import numpy as np\n'), ((1611, 1631), 'numpy.prod', 'np.prod', (['self._shape'], {}), '(self._shape)\n', (1618, 1631), True, 'import numpy as np\n'), ((1851, 1905), 'numpy.zeros', 'np.zeros', (['(pop_size, 2 * size * ... |
# https://github.com/zudi-lin/pytorch_connectomics/blob/master/connectomics/data/augmentation/augmentor.py
import numpy as np
class DataAugment(object):
"""
DataAugment interface.
A data transform needs to conduct the following steps:
1. Set :attr:`sample_params` at initialization to compute required ... | [
"numpy.array"
] | [((700, 725), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0]'], {}), '([1.0, 1.0, 1.0])\n', (708, 725), True, 'import numpy as np\n'), ((746, 765), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (754, 765), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib
matplotlib.rcParams['font.size'] = 30
matplotlib.rcParams['figure.figsize'] = [9., 8.]
# Function to create samples of delta function
class Sampling(object):
def __init__(self, nsamples=500, xyrange=[-10.5, 10.5],
... | [
"matplotlib.pyplot.xlim",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.scatter",
"numpy.float32",
"numpy.zeros",
"numpy.ones",
"matplotlib.pyplot.colorbar",
"numpy.random.random",
"numpy.arange",
"numpy.arcsinh",
"numpy.random.normal",
"numpy.... | [((373, 393), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (387, 393), True, 'import numpy as np\n'), ((2302, 2330), 'numpy.zeros', 'np.zeros', (['(self.nsamples, M)'], {}), '((self.nsamples, M))\n', (2310, 2330), True, 'import numpy as np\n'), ((2348, 2360), 'numpy.arange', 'np.arange', (['M'], {... |
import numpy as np
from pymatgen.electronic_structure.bandstructure import BandStructure
from pymatgen.io.vasp import Vasprun
from tetrados.settings import zero_weighted_kpoints
def get_band_structure(
vasprun: Vasprun, zero_weighted: str = zero_weighted_kpoints
) -> BandStructure:
"""
Get a band structu... | [
"numpy.any",
"pymatgen.electronic_structure.bandstructure.BandStructure",
"numpy.where",
"numpy.array"
] | [((1795, 1975), 'pymatgen.electronic_structure.bandstructure.BandStructure', 'BandStructure', (['kpoints', 'eigenvalues', 'vasprun.final_structure.lattice.reciprocal_lattice'], {'efermi': 'vasprun.efermi', 'structure': 'vasprun.final_structure', 'projections': 'projections'}), '(kpoints, eigenvalues, vasprun.final_stru... |
import numpy as np
import math
class fCSA:
def __init__(self, init_mean, init_variance=1.0, noise_adaptation=False, popsize=None):
# variables of the normal distribution
self.mean = init_mean
self.variance = init_variance
# integer variables for population and dimensionality
... | [
"numpy.sum",
"numpy.abs",
"math.sqrt",
"numpy.asarray",
"numpy.zeros",
"numpy.mean",
"numpy.exp",
"math.log",
"numpy.all",
"numpy.repeat"
] | [((598, 614), 'numpy.zeros', 'np.zeros', (['self.n'], {}), '(self.n)\n', (606, 614), True, 'import numpy as np\n'), ((898, 922), 'math.sqrt', 'math.sqrt', (['self.variance'], {}), '(self.variance)\n', (907, 922), False, 'import math\n'), ((1253, 1277), 'math.sqrt', 'math.sqrt', (['self.variance'], {}), '(self.variance)... |
from __future__ import annotations
from typing import Tuple, Optional, Union
import numpy as np
import scipy.io as sio
# Preprocessing distributions
mat_contents = sio.loadmat('data/windTunnel_signalEnergy_data_win1s.mat')
seTW = mat_contents['seTW_filt']
AoAs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1... | [
"numpy.vectorize",
"scipy.io.loadmat",
"numpy.mean",
"numpy.array",
"numpy.cov",
"numpy.var",
"numpy.concatenate",
"numpy.sqrt"
] | [((167, 225), 'scipy.io.loadmat', 'sio.loadmat', (['"""data/windTunnel_signalEnergy_data_win1s.mat"""'], {}), "('data/windTunnel_signalEnergy_data_win1s.mat')\n", (178, 225), True, 'import scipy.io as sio\n'), ((1530, 1551), 'numpy.mean', 'np.mean', (['seTW'], {'axis': '(0)'}), '(seTW, axis=0)\n', (1537, 1551), True, '... |
import numpy as np
import scipy.io as scio
import argparse
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description='Coverage Updating Plot')
parser.add_argument('--output', dest='filename', default='./log_folder/record.txt', help='')
parser.add_argument('--m... | [
"matplotlib.pyplot.title",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"scipy.io.loadmat",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((77, 98), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (91, 98), False, 'import matplotlib\n'), ((141, 202), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Coverage Updating Plot"""'}), "(description='Coverage Updating Plot')\n", (164, 202), False, 'import argp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Some data related viewer."""
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import PatchCollection
from matplotlib.colors import LogNorm, Normalize
from matplotlib.patches import Rectangle, Wedge
import pygimli as pg
from .utils import ... | [
"matplotlib.patches.Wedge",
"matplotlib.colors.LogNorm",
"pygimli.viewer.mpl.cmapFromName",
"numpy.arange",
"numpy.sin",
"numpy.unique",
"matplotlib.colors.Normalize",
"matplotlib.patches.Rectangle",
"numpy.max",
"pygimli.viewer.mpl.createColorBar",
"matplotlib.pyplot.subplots",
"numpy.ma.mask... | [((4650, 4671), 'matplotlib.collections.PatchCollection', 'PatchCollection', (['recs'], {}), '(recs)\n', (4665, 4671), False, 'from matplotlib.collections import PatchCollection\n'), ((8263, 8284), 'matplotlib.collections.PatchCollection', 'PatchCollection', (['recs'], {}), '(recs)\n', (8278, 8284), False, 'from matplo... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"numpy.random.uniform",
"torch.from_numpy",
"torch.jit.trace",
"cv2.cvtColor",
"tvm.relay.frontend.pytorch_utils.rewrite_nms_to_batched_nms",
"tvm.transform.PassContext",
"tvm.ir.structural_equal",
"tvm.runtime.vm.VirtualMachine",
"tvm.relay.frontend.from_pytorch",
"tvm.device",
"tvm.relay.front... | [((1352, 1387), 'cv2.resize', 'cv2.resize', (['img', '(in_size, in_size)'], {}), '(img, (in_size, in_size))\n', (1362, 1387), False, 'import cv2\n'), ((1398, 1434), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (1410, 1434), False, 'import cv2\n'), ((1510, 1538), 'tor... |
# Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
#
# 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
#... | [
"numpy.random.uniform",
"batchgenerators.augmentations.utils.uniform",
"skimage.transform.resize",
"numpy.array",
"numpy.round",
"builtins.range"
] | [((2264, 2295), 'numpy.array', 'np.array', (['data_sample.shape[1:]'], {}), '(data_sample.shape[1:])\n', (2272, 2295), True, 'import numpy as np\n'), ((2551, 2588), 'batchgenerators.augmentations.utils.uniform', 'uniform', (['zoom_range[0]', 'zoom_range[1]'], {}), '(zoom_range[0], zoom_range[1])\n', (2558, 2588), False... |
import numpy as np
import cv2 as cv
import random
import os
from skimage import io, color
import matplotlib.pyplot as plt
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
def get_adjacent_black_white_pixels(img):
r, c = img.shape
white = []
black = []
for i i... | [
"cv2.calcOpticalFlowFarneback",
"cv2.erode",
"cv2.absdiff",
"cv2.imshow",
"numpy.unique",
"skimage.color.rgb2lab",
"skimage.color.rgb2gray",
"random.randint",
"numpy.copy",
"cv2.dilate",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.exists",
"numpy.max",
"numpy.ceil",
"cv2.waitKey",
"cv2.m... | [((991, 1006), 'numpy.array', 'np.array', (['white'], {}), '(white)\n', (999, 1006), True, 'import numpy as np\n'), ((1019, 1043), 'numpy.unique', 'np.unique', (['white'], {'axis': '(0)'}), '(white, axis=0)\n', (1028, 1043), True, 'import numpy as np\n'), ((1057, 1072), 'numpy.array', 'np.array', (['black'], {}), '(bla... |
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import confusion_matrix
from skimage.transform import resize
import cv2
def plot_confusion_matrix(cls_pred, cls_true, num_classes):
'''
:param cls_pred: numpy array with class prediction
:param cls_true: numpy array with class labels
... | [
"sklearn.metrics.confusion_matrix",
"numpy.sum",
"numpy.maximum",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"skimage.transform.resize",
"cv2.cvtColor",
"matplotlib.pyplot.close",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.matshow",
"matplotlib.pyplot.colorbar",
"numpy.max... | [((958, 1003), 'matplotlib.pyplot.matshow', 'plt.matshow', (['cm_normalized'], {'cmap': 'plt.cm.Greys'}), '(cm_normalized, cmap=plt.cm.Greys)\n', (969, 1003), True, 'import matplotlib.pyplot as plt\n'), ((1052, 1066), 'matplotlib.pyplot.colorbar', 'plt.colorbar', ([], {}), '()\n', (1064, 1066), True, 'import matplotlib... |
import os
import matplotlib.pyplot as plt
import numpy as np
import igibson
from igibson.envs.igibson_env import iGibsonEnv
from igibson.utils.assets_utils import download_assets, download_demo_data
from igibson.utils.motion_planning_wrapper import MotionPlanningWrapper
def test_occupancy_grid():
print("Test en... | [
"igibson.utils.assets_utils.download_assets",
"numpy.sum",
"os.path.join",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.colorbar",
"igibson.envs.igibson_env.iGibsonEnv",
"igibson.utils.motion_planning_wrapper.MotionPlanningWrapper",
"igibson.utils.assets_utils.download_demo_data",
"matplotlib.pypl... | [((328, 345), 'igibson.utils.assets_utils.download_assets', 'download_assets', ([], {}), '()\n', (343, 345), False, 'from igibson.utils.assets_utils import download_assets, download_demo_data\n'), ((350, 370), 'igibson.utils.assets_utils.download_demo_data', 'download_demo_data', ([], {}), '()\n', (368, 370), False, 'f... |
from random import random, seed, sample
import numpy as np
import datetime
import time
# import Code.preprocessing as pp
from Code.dynamic_library import method_info
def remove_subject(rsub):
pn_list = list()
for target in rsub:
pn, cn = target.endswith('.csv').spliat('_')
pn_list.append((pn, ... | [
"numpy.zeros",
"random.seed",
"numpy.arange",
"numpy.vstack",
"datetime.datetime.now",
"numpy.concatenate"
] | [((16478, 16490), 'random.seed', 'seed', (['repeat'], {}), '(repeat)\n', (16482, 16490), False, 'from random import random, seed, sample\n'), ((17888, 17900), 'random.seed', 'seed', (['repeat'], {}), '(repeat)\n', (17892, 17900), False, 'from random import random, seed, sample\n'), ((34395, 34407), 'random.seed', 'seed... |
import sys
import argparse
import json
import itertools
import struct
import logging
import simpleubjson
import msgpack
import bitstring
import numpy as np
from scipy.cluster.vq import vq, kmeans, whiten
weight_first_list = [
'timeDistributedDense', 'denseLayer', 'embeddingLayer',
'batchNormalizationLayer', 'para... | [
"numpy.sum",
"argparse.ArgumentParser",
"json.dumps",
"numpy.linalg.svd",
"numpy.diag",
"numpy.array_split",
"bitstring.BitArray",
"numpy.cumsum",
"simpleubjson.encode",
"itertools.chain",
"argparse.FileType",
"numpy.square",
"numpy.concatenate",
"numpy.matrix",
"json.load",
"logging.b... | [((4585, 4624), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (4604, 4624), False, 'import logging\n'), ((4637, 4658), 'json.load', 'json.load', (['args.ifile'], {}), '(args.ifile)\n', (4646, 4658), False, 'import json\n'), ((5642, 5727), 'argparse.ArgumentPars... |
from __future__ import division
import time
from datetime import datetime
import sys
import numpy as np
import faiss
import pandas as pd
import os
'''
* Create a GitHub repo to house the code and results.
* Show results with different:
X vector length - 96, 300, 4096
* dataset vector count
* batch size
... | [
"pandas.DataFrame",
"numpy.load",
"faiss.GpuMultipleClonerOptions",
"faiss.index_cpu_to_all_gpus",
"pandas.read_csv",
"time.time",
"os.path.isfile",
"numpy.mean",
"sys.stdout.flush",
"numpy.random.rand",
"faiss.IndexFlatL2",
"faiss.get_num_gpus"
] | [((5318, 5353), 'pandas.read_csv', 'pd.read_csv', (['"""max_dataset_size.csv"""'], {}), "('max_dataset_size.csv')\n", (5329, 5353), True, 'import pandas as pd\n'), ((6492, 6536), 'numpy.load', 'np.load', (['"""210000000_x_96.npy"""'], {'mmap_mode': '"""r"""'}), "('210000000_x_96.npy', mmap_mode='r')\n", (6499, 6536), T... |
import sys
import numpy
import matplotlib
import pandas
import sklearn
print('Python: {}'.format(sys.version))
print('Numpy: {}'.format(numpy.__version__))
print('matplotlib: {}'.format(matplotlib.__version__))
print('Python: {}'.format(pandas.__version__))
print('Python: {}'.format(sklearn.__version__))
... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.cross_val_score",
"sklearn.metrics.accuracy_score",
"sklearn.model_selection.KFold",
"sklearn.metrics.classification_report",
"sklearn.neighbors.KNeighborsClassifier",
"numpy.array",
"... | [((987, 1024), 'pandas.read_csv', 'pd.read_csv', (['"""data1.csv"""'], {'names': 'names'}), "('data1.csv', names=names)\n", (998, 1024), True, 'import pandas as pd\n'), ((1324, 1334), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1332, 1334), True, 'import matplotlib.pyplot as plt\n'), ((1367, 1403), 'pandas... |
"""
Functions to load sample data
"""
import numpy as np
import pandas as pd
from .download import fetch_data
def _setup_map(ax, xticks, yticks, crs, region, land=None, ocean=None):
"""
Setup a Cartopy map with land and ocean features and proper tick labels.
"""
import cartopy.feature as cfeature
... | [
"pandas.read_csv",
"cartopy.mpl.ticker.LongitudeFormatter",
"numpy.arange",
"cartopy.crs.PlateCarree",
"cartopy.mpl.ticker.LatitudeFormatter"
] | [((1679, 1719), 'pandas.read_csv', 'pd.read_csv', (['data_file'], {'compression': '"""xz"""'}), "(data_file, compression='xz')\n", (1690, 1719), True, 'import pandas as pd\n'), ((4475, 4515), 'pandas.read_csv', 'pd.read_csv', (['data_file'], {'compression': '"""xz"""'}), "(data_file, compression='xz')\n", (4486, 4515),... |
# -*- coding: utf-8 -*-
import os
import glob
import math
import numpy as np
from .write_xml import *
import auto_pose.meshrenderer.meshrenderer as mr
import auto_pose.meshrenderer.meshrenderer_phong as mr_phong
import cv2
from .pysixd import view_sampler
from .pysixd import transform
class SceneRenderer(object):
... | [
"numpy.dstack",
"numpy.random.uniform",
"auto_pose.meshrenderer.meshrenderer_phong.Renderer",
"numpy.minimum",
"numpy.maximum",
"numpy.random.triangular",
"auto_pose.meshrenderer.meshrenderer.Renderer",
"numpy.random.randint",
"numpy.array",
"numpy.linalg.norm",
"numpy.random.choice",
"os.path... | [((1155, 1172), 'numpy.array', 'np.array', (['obj_ids'], {}), '(obj_ids)\n', (1163, 1172), True, 'import numpy as np\n'), ((2560, 2595), 'numpy.random.choice', 'np.random.choice', (['self.all_views', 'N'], {}), '(self.all_views, N)\n', (2576, 2595), True, 'import numpy as np\n'), ((4049, 4098), 'cv2.resize', 'cv2.resiz... |
# -*- coding: utf-8 -*-
"""Tests for utilities."""
import hashlib
import os
import tempfile
import unittest
from pathlib import Path
import numpy as np
import pandas as pd
from pystow.utils import (
HexDigestError,
download,
getenv_path,
mkdir,
mock_envvar,
n,
name_from_url,
read_tar... | [
"pandas.DataFrame",
"pystow.utils.write_zipfile_np",
"hashlib.md5",
"tempfile.TemporaryDirectory",
"pystow.utils.n",
"pystow.utils.getenv_path",
"pystow.utils.mkdir",
"pathlib.Path",
"numpy.array",
"pystow.utils.name_from_url",
"pystow.utils.mock_envvar",
"numpy.array_equal",
"os.getenv",
... | [((1983, 1986), 'pystow.utils.n', 'n', ([], {}), '()\n', (1984, 1986), False, 'from pystow.utils import HexDigestError, download, getenv_path, mkdir, mock_envvar, n, name_from_url, read_tarfile_csv, read_zip_np, read_zipfile_csv, write_tarfile_csv, write_zipfile_csv, write_zipfile_np\n'), ((2653, 2688), 'pandas.DataFra... |
import numpy
from fframework import asfunction, OpFunction
__all__ = ['Angle']
class Angle(OpFunction):
"""Transforms a mesh into the angle of the mesh to the x axis."""
def __init__(self, mesh):
"""*mesh* is the mesh Function."""
self.mesh = asfunction(mesh)
def __call__(self, ps):
... | [
"fframework.asfunction",
"numpy.arctan2"
] | [((271, 287), 'fframework.asfunction', 'asfunction', (['mesh'], {}), '(mesh)\n', (281, 287), False, 'from fframework import asfunction, OpFunction\n'), ((458, 491), 'numpy.arctan2', 'numpy.arctan2', (['meshT[0]', 'meshT[1]'], {}), '(meshT[0], meshT[1])\n', (471, 491), False, 'import numpy\n')] |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Power law model variants
"""
# pylint: disable=invalid-name
import numpy as np
from astropy.units import Quantity
from .core import Fittable1DModel
from .parameters import InputParameterError, Parameter
__all__ = ['PowerLaw1D', 'BrokenPowerLaw1D', '... | [
"numpy.zeros_like",
"numpy.abs",
"numpy.log",
"astropy.units.Quantity",
"numpy.any",
"numpy.where",
"numpy.exp"
] | [((3420, 3459), 'numpy.where', 'np.where', (['(x < x_break)', 'alpha_1', 'alpha_2'], {}), '(x < x_break, alpha_1, alpha_2)\n', (3428, 3459), True, 'import numpy as np\n'), ((3708, 3747), 'numpy.where', 'np.where', (['(x < x_break)', 'alpha_1', 'alpha_2'], {}), '(x < x_break, alpha_1, alpha_2)\n', (3716, 3747), True, 'i... |
#!/usr/bin/env python
from __future__ import print_function
import unittest
import sys
import hashlib
import os
import numpy as np
import cv2
import cv2.cv as cv
# Python 3 moved urlopen to urllib.requests
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
class OpenCVTes... | [
"cv2.contourArea",
"cv2.cv.DecodeImageM",
"cv2.cv.NamedWindow",
"cv2.intersectConvexConvex",
"cv2.cv.WaitKey",
"os.path.isfile",
"numpy.array",
"cv2.cv.ShowImage",
"cv2.cv.DestroyAllWindows",
"cv2.setRNGSeed",
"numpy.fromstring"
] | [((5503, 5553), 'numpy.array', 'np.array', (['[[x1, y1], [x2, y1], [x2, y2], [x1, y2]]'], {}), '([[x1, y1], [x2, y1], [x2, y2], [x1, y2]])\n', (5511, 5553), True, 'import numpy as np\n'), ((5587, 5637), 'numpy.array', 'np.array', (['[[x1, y1], [x2, y1], [x2, y2], [x1, y2]]'], {}), '([[x1, y1], [x2, y1], [x2, y2], [x1, ... |
# -*- coding: utf-8 -*-
"""TSoft format reader.
"""
import re
import numpy as np
import pandas as pd
# possible tags in TSoft format
_TAGS = ['TSF-file', 'TIMEFORMAT', 'COUNTINFO', 'INCREMENT', 'CHANNELS',
'UNITS', 'UNDETVAL', 'COMMENT', 'DATA', 'LABEL',
'LININTERPOL', 'CUBINTERPOL', 'GAP', 'STEP']... | [
"pandas.DataFrame",
"numpy.asarray",
"pandas.to_datetime"
] | [((1644, 1680), 'pandas.to_datetime', 'pd.to_datetime', (['df[datetime_columns]'], {}), '(df[datetime_columns])\n', (1658, 1680), True, 'import pandas as pd\n'), ((1375, 1405), 'numpy.asarray', 'np.asarray', (["blocks['CHANNELS']"], {}), "(blocks['CHANNELS'])\n", (1385, 1405), True, 'import numpy as np\n'), ((1539, 158... |
# 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.empty",
"detectron.modeling.FPN.map_rois_to_fpn_levels",
"numpy.argsort",
"detectron.datasets.json_dataset.add_proposals",
"numpy.where",
"detectron.roi_data.cascade_rcnn.add_cascade_rcnn_blobs",
"detectron.utils.blob.py_op_copy_blob",
"detectron.roi_data.cascade_rcnn.get_cascade_rcnn_blob_name... | [((3146, 3204), 'detectron.modeling.FPN.map_rois_to_fpn_levels', 'fpn.map_rois_to_fpn_levels', (['rois[:, 1:5]', 'lvl_min', 'lvl_max'], {}), '(rois[:, 1:5], lvl_min, lvl_max)\n', (3172, 3204), True, 'import detectron.modeling.FPN as fpn\n'), ((3475, 3489), 'numpy.empty', 'np.empty', (['(0,)'], {}), '((0,))\n', (3483, 3... |
# Currently this script is configured to use the note-generator model.
from config import sequence_length, output_dir, note_generator_dir
from helper import loadChorales, loadModelAndWeights, createPitchSpecificVocabularies, createDurationVocabularySpecific
from music21 import note, instrument, stream, duration
import... | [
"helper.createDurationVocabularySpecific",
"helper.createPitchSpecificVocabularies",
"numpy.argmax",
"os.path.realpath",
"helper.loadChorales",
"music21.stream.Stream",
"music21.note.Rest",
"music21.instrument.Piano",
"numpy.array",
"numpy.reshape",
"numpy.random.choice",
"numpy.eye",
"os.pa... | [((850, 864), 'helper.loadChorales', 'loadChorales', ([], {}), '()\n', (862, 864), False, 'from helper import loadChorales, loadModelAndWeights, createPitchSpecificVocabularies, createDurationVocabularySpecific\n'), ((945, 1002), 'helper.createPitchSpecificVocabularies', 'createPitchSpecificVocabularies', (['[x[0] for ... |
# Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
from mmdet.core import INSTANCE_OFFSET
from mmdet.core.visualization import imshow_det_bboxes
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .single_stage import SingleStageDetector
@DETECTORS.register_module... | [
"mmdet.core.visualization.imshow_det_bboxes",
"numpy.array",
"mmcv.imread",
"numpy.unique"
] | [((6552, 6568), 'mmcv.imread', 'mmcv.imread', (['img'], {}), '(img)\n', (6563, 6568), False, 'import mmcv\n'), ((6826, 6890), 'numpy.array', 'np.array', (['[(id % INSTANCE_OFFSET) for id in ids]'], {'dtype': 'np.int64'}), '([(id % INSTANCE_OFFSET) for id in ids], dtype=np.int64)\n', (6834, 6890), True, 'import numpy as... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import nibabel
import numpy
from glob import glob
__version__ = open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
'version')).read()
def run(command, env={}):
merged_env = os.environ
merged_env.upda... | [
"subprocess.Popen",
"argparse.ArgumentParser",
"nibabel.load",
"os.path.realpath",
"numpy.array",
"os.path.split",
"os.path.join"
] | [((805, 879), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Example BIDS App entrypoint script."""'}), "(description='Example BIDS App entrypoint script.')\n", (828, 879), False, 'import argparse\n'), ((342, 449), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdout': 'subproc... |
"""
## Pump curve fitting and drawing
- Establish an equation for the pump curve from measured points on the curve in the pump's data sheet
- Get the coefficients of the 2nd order polynomial describing the pump curve and determined via curve fitting
- Draw the pump curve in a diagram
"""
from typing import List, Tupl... | [
"quantities.VolumeFlowRate",
"nummath.graphing2.LineGraph",
"quantities.Pressure",
"numpy.array",
"numpy.linspace"
] | [((3883, 3919), 'quantities.Pressure', 'qty.Pressure', (['(1.0)', "units['pressure']"], {}), "(1.0, units['pressure'])\n", (3895, 3919), True, 'import quantities as qty\n'), ((3936, 3979), 'quantities.VolumeFlowRate', 'qty.VolumeFlowRate', (['(1.0)', "units['flow_rate']"], {}), "(1.0, units['flow_rate'])\n", (3954, 397... |
# Purpose: takes a list of filenames AND/OR publically accessible urls.
# Returns a tiled image file of tiles SIZExSIZE, separated by spaces of width
# DIFF, in rows if length ROWSIZE.
# files that can't be retrieved are returned blank.
import os
import numpy as np
from PIL import Image
import urllib.request
impor... | [
"numpy.full",
"os.remove",
"os.makedirs",
"numpy.asarray",
"os.path.exists",
"validators.url",
"numpy.hstack",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"numpy.concatenate"
] | [((2356, 2380), 'validators.url', 'validators.url', (['filename'], {}), '(filename)\n', (2370, 2380), False, 'import validators\n'), ((3512, 3571), 'numpy.full', 'np.full', (['(space, tileSize, 4)', '[255, 255, 255, 0]', 'np.uint8'], {}), '((space, tileSize, 4), [255, 255, 255, 0], np.uint8)\n', (3519, 3571), True, 'im... |
import math
import numpy as np
import vsketch
class RandomFlowerSketch(vsketch.SketchClass):
num_line = vsketch.Param(200, 1)
point_per_line = vsketch.Param(100, 1)
rdir_range = vsketch.Param(math.pi / 6)
def draw(self, vsk: vsketch.Vsketch) -> None:
vsk.size("a4", landscape=True)
v... | [
"numpy.cumsum",
"numpy.sin",
"vsketch.Param",
"numpy.cos",
"numpy.linspace"
] | [((112, 133), 'vsketch.Param', 'vsketch.Param', (['(200)', '(1)'], {}), '(200, 1)\n', (125, 133), False, 'import vsketch\n'), ((155, 176), 'vsketch.Param', 'vsketch.Param', (['(100)', '(1)'], {}), '(100, 1)\n', (168, 176), False, 'import vsketch\n'), ((194, 220), 'vsketch.Param', 'vsketch.Param', (['(math.pi / 6)'], {}... |
from __future__ import print_function
from nose.tools import assert_equal
from numpy.testing import assert_almost_equal
from matplotlib.transforms import Affine2D, BlendedGenericTransform
from matplotlib.path import Path
from matplotlib.scale import LogScale
from matplotlib.testing.decorators import cleanup
import nump... | [
"matplotlib.pyplot.axes",
"numpy.testing.assert_almost_equal",
"numpy.allclose",
"matplotlib.pyplot.draw",
"matplotlib.path.Path",
"matplotlib.transforms.Transform.__init__",
"numpy.array",
"matplotlib.scale.LogScale.Log10Transform",
"matplotlib.transforms.Affine2D.from_values",
"matplotlib.transf... | [((1640, 1650), 'matplotlib.pyplot.axes', 'plt.axes', ([], {}), '()\n', (1648, 1650), True, 'import matplotlib.pyplot as plt\n'), ((1714, 1724), 'matplotlib.pyplot.draw', 'plt.draw', ([], {}), '()\n', (1722, 1724), True, 'import matplotlib.pyplot as plt\n'), ((1909, 1919), 'matplotlib.pyplot.draw', 'plt.draw', ([], {})... |
"""Test embed_text."""
import shutil
import numpy as np
from fetch_embed import embed_text
shutil.rmtree("./joblibcache", ignore_errors=True)
def test_embed_text():
"""Test embed_text."""
texts = ["test 1", "测试1"] * 17
res = embed_text(texts)
assert np.array(res).shape == (34, 512)
assert np.arr... | [
"shutil.rmtree",
"fetch_embed.embed_text",
"numpy.array"
] | [((91, 141), 'shutil.rmtree', 'shutil.rmtree', (['"""./joblibcache"""'], {'ignore_errors': '(True)'}), "('./joblibcache', ignore_errors=True)\n", (104, 141), False, 'import shutil\n'), ((240, 257), 'fetch_embed.embed_text', 'embed_text', (['texts'], {}), '(texts)\n', (250, 257), False, 'from fetch_embed import embed_te... |
import numpy as np
import Particle
class Swarm:
def __init__(self, population, x_min, x_max, fitness_function, c1=2, c2=2, w=0.9):
self.c1 = c1
self.c2 = c2
self.w = w
self.population = population
self.X_min_position = Particle.np.array(x_min)
self.X_max_position =... | [
"Particle.np.array",
"numpy.linspace",
"Particle.Particle"
] | [((266, 290), 'Particle.np.array', 'Particle.np.array', (['x_min'], {}), '(x_min)\n', (283, 290), False, 'import Particle\n'), ((321, 345), 'Particle.np.array', 'Particle.np.array', (['x_max'], {}), '(x_max)\n', (338, 345), False, 'import Particle\n'), ((665, 794), 'Particle.Particle', 'Particle.Particle', (['self.X_mi... |
"""Functions operating on arrays
"""
# Any commits made to this module between 2015-05-01 and 2017-03-01
# by <NAME> are developed for the EC project “Fidelity and
# Uncertainty in Climate Data Records from Earth Observations (FIDUCEO)”.
# Grant agreement: 638822
#
# All those contributions are dual-licensed under t... | [
"numpy.ma.median",
"numpy.zeros",
"numpy.ones",
"numpy.hstack",
"numpy.arange",
"numpy.linspace"
] | [((1015, 1092), 'numpy.hstack', 'numpy.hstack', (['(False, (arr[1:-1] < arr[0:-2]) & (arr[1:-1] < arr[2:]), False)'], {}), '((False, (arr[1:-1] < arr[0:-2]) & (arr[1:-1] < arr[2:]), False))\n', (1027, 1092), False, 'import numpy\n'), ((2414, 2450), 'numpy.ones', 'numpy.ones', ([], {'shape': 'M.shape', 'dtype': '"""?"""... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from galeritas.utils.creditas_palette import get_palette
import seaborn as sns
import warnings
__all__ = ["plot_ecdf_curve"]
def plot_ecdf_curve(
df,
column_to_plot,
drop_na=True,
hue=None,
hue_labels=None,... | [
"pandas.DataFrame",
"numpy.divide",
"pandas.MultiIndex.from_tuples",
"matplotlib.pyplot.show",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplots",
"numpy.percentile",
"numpy.sort",
"numpy.arange",
"warnings.warn",
"galeritas.utils.creditas_palette.get_palette",
"matplotlib.pyplot.grid"
] | [((7202, 7243), 'matplotlib.pyplot.grid', 'plt.grid', (['(True)'], {'alpha': '(0.6)', 'linestyle': '"""--"""'}), "(True, alpha=0.6, linestyle='--')\n", (7210, 7243), True, 'import matplotlib.pyplot as plt\n'), ((7806, 7819), 'numpy.sort', 'np.sort', (['data'], {}), '(data)\n', (7813, 7819), True, 'import numpy as np\n'... |
# adapted from https://github.com/Hephaest/sktime/blob/master/setup.py
import os
import platform
import sktime
import shutil
import sys
from distutils.command.clean import clean as Clean # noqa
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
MIN_PYTHON_VERSION = "3.6"
MIN_REQUIR... | [
"platform.python_version",
"os.path.join",
"distutils.core.setup",
"os.path.dirname",
"os.walk",
"distutils.command.clean.clean.run",
"os.path.exists",
"skshapelet._build_utils.openmp_helpers.get_openmp_flag",
"os.path.splitext",
"shutil.rmtree",
"numpy.distutils.command.build_ext.build_ext.buil... | [((6203, 6220), 'distutils.core.setup', 'setup', ([], {}), '(**metadata)\n', (6208, 6220), False, 'from distutils.core import setup\n'), ((2426, 2441), 'distutils.command.clean.clean.run', 'Clean.run', (['self'], {}), '(self)\n', (2435, 2441), True, 'from distutils.command.clean import clean as Clean\n'), ((2741, 2764)... |
import numpy as np
# quad model parameters
m = 1 # mass of quadrotor (kg)
L = 0.25 # length from center of mass to point of thrust (meters)
J = 8.1e-3 # moments of inertia in (kg*m^2)
gr = 9.81 # gravity (m/s^2)
states = 6 # number of states
num_controllers = 2
total_time = 10 # total time duration (s)
dt = 0.... | [
"numpy.diag",
"numpy.zeros",
"numpy.eye"
] | [((409, 430), 'numpy.zeros', 'np.zeros', (['[states, 1]'], {}), '([states, 1])\n', (417, 430), True, 'import numpy as np\n'), ((546, 584), 'numpy.diag', 'np.diag', (['[0.1, 0.1, 0.1, 0.1, 10, 0.1]'], {}), '([0.1, 0.1, 0.1, 0.1, 10, 0.1])\n', (553, 584), True, 'import numpy as np\n'), ((595, 629), 'numpy.diag', 'np.diag... |
import json
import time
import numpy as np
import argparse
from pathlib import Path
from itertools import product
from pprint import PrettyPrinter
from grl.generalized_experiment import GeneralizedExperiment
from grl.agents import DQNAgent
# from grl.agents import SarsaTCAgent
from grl.envs.mountaincar import Mountain... | [
"json.dump",
"json.load",
"numpy.average",
"argparse.ArgumentParser",
"time.strftime",
"pprint.PrettyPrinter",
"pathlib.Path",
"grl.generalized_experiment.GeneralizedExperiment",
"itertools.product"
] | [((482, 507), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (505, 507), False, 'import argparse\n'), ((788, 811), 'pprint.PrettyPrinter', 'PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (801, 811), False, 'from pprint import PrettyPrinter\n'), ((1345, 1374), 'pathlib.Path', 'Path', (... |
# 30/03/2018, <NAME>, Postdoc., Edinburgh,
# Edited from original code by <NAME>.
# Read in either BOSS (lens) or K1000 (Source) N(z)
# and make a single FITS file used by kcap ini file, magnifcation_gt.ini
import sys
import os
import numpy as np
import pylab as plt
from matplotlib.ticker import ScalarFormatter
imp... | [
"numpy.copy",
"pyfits.open",
"numpy.loadtxt",
"numpy.linspace",
"pyfits.Column",
"numpy.interp",
"pyfits.ColDefs",
"pyfits.BinTableHDU.from_columns"
] | [((679, 705), 'numpy.linspace', 'np.linspace', (['(0.0)', '(2.0)', '(201)'], {}), '(0.0, 2.0, 201)\n', (690, 705), True, 'import numpy as np\n'), ((3169, 3189), 'pyfits.ColDefs', 'pyfits.ColDefs', (['cols'], {}), '(cols)\n', (3183, 3189), False, 'import pyfits\n'), ((3212, 3253), 'pyfits.BinTableHDU.from_columns', 'pyf... |
"""
This script cleans the data
"""
import json
import lightgbm as lgb
import numpy as np
import pandas as pd
from scipy.signal import savgol_filter as sg
from sklearn.feature_selection import RFECV
from sklearn.metrics import make_scorer
from sklearn.model_selection import GridSearchCV
import shap
from auxiliary imp... | [
"pandas.DataFrame",
"json.dump",
"scipy.signal.savgol_filter",
"json.load",
"pandas.date_range",
"auxiliary.BlockingTimeSeriesSplit",
"numpy.abs",
"pandas.read_csv",
"config.DYNAMIC_SPACE.items",
"lightgbm.Dataset",
"pandas.read_excel",
"shap.TreeExplainer",
"sklearn.metrics.make_scorer",
... | [((10374, 10423), 'sklearn.metrics.make_scorer', 'make_scorer', (['scorer_rmse'], {'greater_is_better': '(False)'}), '(scorer_rmse, greater_is_better=False)\n', (10385, 10423), False, 'from sklearn.metrics import make_scorer\n'), ((10458, 10526), 'lightgbm.LGBMRegressor', 'lgb.LGBMRegressor', ([], {'n_jobs': '(1)', 'me... |
"""
<NAME>, <NAME> - 18/11/2020
e-mail: <EMAIL>, <EMAIL>
The goal of this routine is to create quantities that can be "correlated" to obtain regions interesting for reconnection.
Basic fields (J,B,Ve,n,E) must be loaded in the format [3,nx,ny,nz], where nx,ny and nz are the grid dimensions.
--------------------------... | [
"utilities_unsup.calc_grady",
"numpy.absolute",
"utilities_unsup.calc_gradz",
"numpy.zeros",
"utilities_unsup.calc_cross",
"utilities_unsup.calc_gradx",
"utilities_unsup.calc_scalr",
"numpy.sqrt"
] | [((960, 1029), 'numpy.sqrt', 'np.sqrt', (['(J[0, :, :, :] ** 2 + J[1, :, :, :] ** 2 + J[2, :, :, :] ** 2)'], {}), '(J[0, :, :, :] ** 2 + J[1, :, :, :] ** 2 + J[2, :, :, :] ** 2)\n', (967, 1029), True, 'import numpy as np\n'), ((1132, 1182), 'numpy.sqrt', 'np.sqrt', (['(Ve[0, :, :, :] ** 2 + Ve[1, :, :, :] ** 2)'], {}),... |
import math
import random
import cv2
import numpy as np
import pygame
from tqdm import tqdm
from .images import overlay, cv2shape
from .colors import lighter, lighter_with_alpha, inverse_color_rgb, random_unique_color
from .math import to_rad
__all__ = ['Visualizer2D']
class Visualizer2D:
def __init__(self, **c... | [
"cv2.rectangle",
"pygame.display.quit",
"numpy.full",
"cv2.line",
"pygame.font.SysFont",
"cv2.cvtColor",
"random.Random",
"pygame.display.set_mode",
"cv2.resize",
"pygame.quit",
"tqdm.tqdm",
"cv2.circle",
"pygame.init",
"cv2.flip",
"pygame.time.Clock",
"pygame.display.flip",
"cv2.imr... | [((1190, 1208), 'random.Random', 'random.Random', (['(100)'], {}), '(100)\n', (1203, 1208), False, 'import random\n'), ((1476, 1489), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1487, 1489), False, 'import pygame\n'), ((1589, 1665), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(self.img_width, self.img... |
import pandas as pd
import numpy as np
import pandas_profiling as pdf
class DataCleaner(object):
def __init__(self, file_path, test_data_path="NULL"):
self.data = pd.read_csv(file_path)
self.original_data = self.data
if test_data_path == "NULL":
self.test_data = []
... | [
"pandas.read_csv",
"pandas_profiling.ProfileReport",
"numpy.where",
"pandas.notnull"
] | [((178, 200), 'pandas.read_csv', 'pd.read_csv', (['file_path'], {}), '(file_path)\n', (189, 200), True, 'import pandas as pd\n'), ((393, 420), 'pandas.read_csv', 'pd.read_csv', (['test_data_path'], {}), '(test_data_path)\n', (404, 420), True, 'import pandas as pd\n'), ((850, 878), 'pandas_profiling.ProfileReport', 'pdf... |
"""
Tketris
Tetris using tkinter
Author: <NAME>
Created: 10 - 11 - 2018
"""
import numpy as np
from copy import copy
"""
These are the actions that the user can perform in the game They are grouped
into mixins by their required functionality. Each of these actions are bound
by a key. They have a condition function ... | [
"numpy.array"
] | [((1922, 1939), 'numpy.array', 'np.array', (['[0, -1]'], {}), '([0, -1])\n', (1930, 1939), True, 'import numpy as np\n'), ((2420, 2436), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (2428, 2436), True, 'import numpy as np\n'), ((2909, 2925), 'numpy.array', 'np.array', (['[1, 0]'], {}), '([1, 0])\n', (2917... |
"""
Script entry point
"""
from src.calrissian.particle_vector_n_network import ParticleVectorNNetwork
from src.calrissian.layers.particle_vector_n import ParticleVectorN
from src.calrissian.layers.particle_vector_n import ParticleVectorNInput
import numpy as np
def main():
# train_X = np.asarray([[0.2, -0.3]]... | [
"src.calrissian.layers.particle_vector_n.ParticleVectorNInput",
"numpy.asarray",
"src.calrissian.layers.particle_vector_n.ParticleVectorN",
"numpy.random.seed"
] | [((383, 422), 'numpy.asarray', 'np.asarray', (['[[0.45, 3.33], [0.0, 2.22]]'], {}), '([[0.45, 3.33], [0.0, 2.22]])\n', (393, 422), True, 'import numpy as np\n'), ((437, 473), 'numpy.asarray', 'np.asarray', (['[[1.0, 0.0], [0.0, 1.0]]'], {}), '([[1.0, 0.0], [0.0, 1.0]])\n', (447, 473), True, 'import numpy as np\n'), ((8... |
import numpy as np
from sklearn.linear_model import LogisticRegression
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
from scipy.stats import norm
import utils
utils.set_mpl_params()
def rot(xy, radians):
"""Use numpy to build a rotation matrix and take the dot product."""
x = xy[:,0]... | [
"scipy.spatial.distance.cdist",
"utils.plot_fig_label",
"scipy.stats.norm",
"utils.set_mpl_params",
"numpy.around",
"numpy.sin",
"numpy.array",
"numpy.mean",
"numpy.linspace",
"numpy.cos",
"numpy.dot",
"matplotlib.pyplot.subplots"
] | [((187, 209), 'utils.set_mpl_params', 'utils.set_mpl_params', ([], {}), '()\n', (207, 209), False, 'import utils\n'), ((471, 489), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {}), '(1, 3)\n', (483, 489), True, 'import matplotlib.pyplot as plt\n'), ((1671, 1692), 'numpy.array', 'np.array', (['[-0.1078... |
# -*- coding: utf-8 -*-
"""Test views."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import numpy as np
from phylib.io.mock import artificial_waveforms
from phylib.utils import Bunch, conne... | [
"phy.plot.tests.mouse_click",
"phylib.utils.color.ClusterColorSelector",
"phylib.io.mock.artificial_waveforms",
"phylib.utils.connect",
"numpy.arange"
] | [((769, 794), 'numpy.arange', 'np.arange', (['(n_clusters + 2)'], {}), '(n_clusters + 2)\n', (778, 794), True, 'import numpy as np\n'), ((1296, 1321), 'numpy.arange', 'np.arange', (['(n_clusters + 2)'], {}), '(n_clusters + 2)\n', (1305, 1321), True, 'import numpy as np\n'), ((1340, 1361), 'numpy.arange', 'np.arange', (... |
import pandas as pd # 用于分析数据
import os # 导入os模块
import xlwt
import xlrd
import copy
import numpy as np
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QFileDialog
import sys
# 加载窗口
class MyWindow(QtWidgets.QWidget):
def __init__(self):
super(MyWindow, self).__init__()
def msg(self):
... | [
"os.remove",
"xlwt.Workbook",
"copy.deepcopy",
"xlrd.open_workbook",
"os.path.exists",
"numpy.isnan",
"pandas.read_excel",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtWidgets.QApplication"
] | [((787, 817), 'pandas.read_excel', 'pd.read_excel', (['"""data_name.xls"""'], {}), "('data_name.xls')\n", (800, 817), True, 'import pandas as pd\n'), ((1226, 1254), 'xlrd.open_workbook', 'xlrd.open_workbook', (['filename'], {}), '(filename)\n', (1244, 1254), False, 'import xlrd\n'), ((2171, 2202), 'xlwt.Workbook', 'xlw... |
"""Module to store RiboCop output in loom format"""
from ast import literal_eval
import os
from joblib import Parallel, delayed
from tqdm import tqdm
from .helpers import mkdir_p
import numpy as np
import pandas as pd
import loompy
def _create_index_for_annotation_row(row):
"""Parse the row from annotation fil... | [
"tqdm.tqdm",
"ast.literal_eval",
"os.path.dirname",
"loompy.connect",
"loompy.create",
"os.path.isfile",
"numpy.array",
"joblib.Parallel",
"pandas.read_table",
"joblib.delayed",
"os.path.join",
"numpy.delete"
] | [((1914, 1944), 'os.path.isfile', 'os.path.isfile', (['loom_file_path'], {}), '(loom_file_path)\n', (1928, 1944), False, 'import os\n'), ((6598, 6632), 'pandas.read_table', 'pd.read_table', (['annotation_filepath'], {}), '(annotation_filepath)\n', (6611, 6632), True, 'import pandas as pd\n'), ((998, 1111), 'pandas.read... |
"""
A couple of auxiliary functions
"""
import numpy as np
def sidekick(w1, w2, dt, T, A=1):
"""
This function crates the sidekick time series provided
the two mixing frequencies w1, w2, the time resolution dt
and the total time T.
returns the expresion A * (cos(w1 * t) + cos(w2 * t))
where t... | [
"numpy.log",
"numpy.arange",
"numpy.exp",
"numpy.cos",
"numpy.sqrt"
] | [((419, 436), 'numpy.cos', 'np.cos', (['(w1 * time)'], {}), '(w1 * time)\n', (425, 436), True, 'import numpy as np\n'), ((446, 463), 'numpy.cos', 'np.cos', (['(w2 * time)'], {}), '(w2 * time)\n', (452, 463), True, 'import numpy as np\n'), ((1993, 2012), 'numpy.log', 'np.log', (['(arg1 / arg2)'], {}), '(arg1 / arg2)\n',... |
#!/usr/bin/env python3
import argparse
import math
import numpy as np
import os
import pickle
import statistics
import sys
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable, Function
from common.discretization import *
from common.loss import *
from common.utils import... | [
"numpy.stack",
"torch.from_numpy",
"statistics.median",
"argparse.ArgumentParser",
"torch.manual_seed",
"torch.load",
"numpy.zeros",
"math.floor",
"torch.nn.Linear",
"torch.cuda.manual_seed_all",
"torch.cuda.is_available",
"numpy.array",
"torch.device",
"torch.zeros",
"torch.nn.LSTM",
... | [((335, 360), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (358, 360), False, 'import torch\n'), ((370, 413), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (382, 413), False, 'import torch\n'), ((2929, 2977), 'numpy.concatenate... |
# -*- coding: utf-8 -*-
from os import path, listdir, mkdir
import numpy as np
from skimage.color import label2rgb
np.random.seed(1)
import random
random.seed(1)
import timeit
import cv2
import os
from multiprocessing import Pool
import lightgbm as lgb
from train_classifier import get_inputs
pred_folder = path.join... | [
"numpy.zeros_like",
"numpy.random.seed",
"os.makedirs",
"train_classifier.get_inputs",
"skimage.color.label2rgb",
"timeit.default_timer",
"numpy.zeros",
"random.seed",
"multiprocessing.Pool",
"os.path.join",
"os.listdir"
] | [((117, 134), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (131, 134), True, 'import numpy as np\n'), ((150, 164), 'random.seed', 'random.seed', (['(1)'], {}), '(1)\n', (161, 164), False, 'import random\n'), ((311, 335), 'os.path.join', 'path.join', (['"""predictions"""'], {}), "('predictions')\n", (3... |
#!/usr/bin/env python
"""Functions for downloading and reading MNIST data."""
import gzip #Biblioteka rozpakowuje cyfry spakowane do formatu .gz
# Przy tak niewielkiej próbce (150) raczej nie będę musiał ich pakować,
# więc część kodu z funkcji zapewne też odpadnie.
import os #Ta biblioteka mi się tym razem nie przyd... | [
"os.mkdir",
"gzip.open",
"numpy.multiply",
"os.stat",
"numpy.frombuffer",
"numpy.dtype",
"numpy.zeros",
"os.path.exists",
"numpy.arange",
"six.moves.urllib.request.urlretrieve",
"os.path.join",
"numpy.random.shuffle"
] | [((1073, 1111), 'os.path.join', 'os.path.join', (['work_directory', 'filename'], {}), '(work_directory, filename)\n', (1085, 1111), False, 'import os\n'), ((3732, 3770), 'numpy.zeros', 'numpy.zeros', (['(num_labels, num_classes)'], {}), '((num_labels, num_classes))\n', (3743, 3770), False, 'import numpy\n'), ((993, 102... |
# Copyright (C) 2012-2016, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT (see COPYING.MIT file)
import numpy as np
from . import _imread
from .special import special
def _parse_formatstr(filename, formatstr, funcname):
if formatstr is not None:
return formatstr
... | [
"numpy.array",
"os.path.splitext",
"numpy.dot",
"numpy.ascontiguousarray",
"numpy.issubdtype"
] | [((352, 375), 'os.path.splitext', 'path.splitext', (['filename'], {}), '(filename)\n', (365, 375), False, 'from os import path\n'), ((759, 786), 'numpy.array', 'np.array', (['[0.3, 0.59, 0.11]'], {}), '([0.3, 0.59, 0.11])\n', (767, 786), True, 'import numpy as np\n'), ((802, 823), 'numpy.dot', 'np.dot', (['im', 'transf... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import numpy as np
from dash.dependencies import Input, Output
from plotly import graph_objs as go
import plotly.express as px
from plotly.graph_objs import *
from datetime import datetime as dt
from pathlib import P... | [
"numpy.load",
"dash.Dash",
"dash_html_components.Br",
"plotly.graph_objs.Scatter",
"dash_html_components.Div",
"dash.dependencies.Input",
"dash_html_components.P",
"pickle.load",
"dash_html_components.H1",
"dash_core_components.Dropdown",
"dash_core_components.Graph",
"plotly.graph_objs.Figure... | [((974, 1064), 'dash.Dash', 'dash.Dash', (['__name__'], {'meta_tags': "[{'name': 'viewport', 'content': 'width=device-width'}]"}), "(__name__, meta_tags=[{'name': 'viewport', 'content':\n 'width=device-width'}])\n", (983, 1064), False, 'import dash\n'), ((8936, 8985), 'dash.dependencies.Output', 'dash.dependencies.O... |
"""`load_video`, `save_video`, `video2stim`"""
import numpy as np
import logging
from .image import image2stim
from ..stimuli import TimeSeries
from ..utils import deprecated
# Rather than trying to import these all over, try once and then remember
# by setting a flag.
try:
import skimage
import skimage.trans... | [
"skvideo.setLibAVPath",
"numpy.minimum",
"skvideo.setFFmpegPath",
"numpy.abs",
"skvideo.io.LibAVReader",
"skvideo.utils.vshape",
"numpy.zeros",
"numpy.transpose",
"logging.getLogger",
"skvideo.io.vwrite",
"skvideo.io.vread",
"skimage.transform.resize",
"skvideo.io.FFmpegReader",
"skimage.i... | [((2438, 2466), 'skvideo.io.ffprobe', 'skvideo.io.ffprobe', (['filename'], {}), '(filename)\n', (2456, 2466), False, 'import skvideo\n'), ((5731, 5785), 'skvideo.io.vread', 'svio.vread', (['filename'], {'as_grey': 'as_gray', 'backend': 'backend'}), '(filename, as_grey=as_gray, backend=backend)\n', (5741, 5785), True, '... |
import numpy as np
def sorter(data, dtype, grain, sorter):
buffer = np.zeros((2, data.shape[-1] + grain.size), dtype=dtype)
return buffer
| [
"numpy.zeros"
] | [((74, 129), 'numpy.zeros', 'np.zeros', (['(2, data.shape[-1] + grain.size)'], {'dtype': 'dtype'}), '((2, data.shape[-1] + grain.size), dtype=dtype)\n', (82, 129), True, 'import numpy as np\n')] |
import shap
import joblib
import numpy as np
def get_age(req_data, model):
result = model.predict(req_data)
return result[0]
def get_shap(req_data, model):
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(np.array(req_data))
explainer = shap.TreeExplainer(model)
cols =... | [
"shap.TreeExplainer",
"numpy.array"
] | [((182, 207), 'shap.TreeExplainer', 'shap.TreeExplainer', (['model'], {}), '(model)\n', (200, 207), False, 'import shap\n'), ((284, 309), 'shap.TreeExplainer', 'shap.TreeExplainer', (['model'], {}), '(model)\n', (302, 309), False, 'import shap\n'), ((248, 266), 'numpy.array', 'np.array', (['req_data'], {}), '(req_data)... |
import os
import torch
import itertools
import numpy as np
import random
EXP="../experiments/"
def get_relpath(main_dir, train_params):
return main_dir+"_lr="+str(train_params["lr"])+"_dt="+str(train_params["dt"])+\
"_horizon="+str(train_params["horizon"])+"_train_steps="+str(train_params["train_steps"]... | [
"numpy.random.seed",
"os.makedirs",
"torch.manual_seed",
"torch.load",
"torch.cuda.manual_seed",
"torch.cuda.manual_seed_all",
"random.seed",
"numpy.random.choice",
"os.path.join"
] | [((1104, 1136), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (1115, 1136), False, 'import os\n'), ((1230, 1258), 'os.path.join', 'os.path.join', (['path', 'atk_name'], {}), '(path, atk_name)\n', (1242, 1258), False, 'import os\n'), ((1274, 1302), 'os.path.join', 'os.path.... |
#!/usr/bin/env python
import numpy as np
from keras.models import Sequential
import numpy as np
import pandas
import rospy
import tensorflow
import tf
import geometry_msgs.msg
from pyquaternion import Quaternion
from keras.layers import Dense, Activation
from keras.models import model_from_json
import pandas
import ros... | [
"numpy.amin",
"std_msgs.msg.Header",
"pandas.read_csv",
"math.atan2",
"numpy.sin",
"numpy.linalg.norm",
"rospy.Duration",
"rospy.Time.now",
"numpy.transpose",
"numpy.identity",
"rospy.Rate",
"rospy.is_shutdown",
"pyquaternion.Quaternion",
"rospy.init_node",
"math.sqrt",
"rospy.loginfo"... | [((1355, 1370), 'numpy.transpose', 'np.transpose', (['R'], {}), '(R)\n', (1367, 1370), True, 'import numpy as np\n'), ((1394, 1407), 'numpy.dot', 'np.dot', (['Rt', 'R'], {}), '(Rt, R)\n', (1400, 1407), True, 'import numpy as np\n'), ((1416, 1445), 'numpy.identity', 'np.identity', (['(3)'], {'dtype': 'R.dtype'}), '(3, d... |
"""Random policy for Bayesian Monte Carlo."""
from typing import Callable
import numpy as np
from probnum.quad.solvers.bq_state import BQState
from ._policy import Policy
# pylint: disable=too-few-public-methods, fixme
class RandomPolicy(Policy):
"""Random sampling from an objective.
Parameters
----... | [
"numpy.random.default_rng"
] | [((742, 765), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (763, 765), True, 'import numpy as np\n')] |
"""Plot Milky Way spiral arm models."""
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from astropy.units import Quantity
from gammapy.astro.population.spatial import ValleeSpiral, FaucherSpiral
from gammapy.utils.mpl_style import gammapy_mpl_style
plt.style.use(gammapy_mpl... | [
"gammapy.astro.population.spatial.ValleeSpiral",
"matplotlib.pyplot.style.use",
"matplotlib.use",
"matplotlib.pyplot.figure",
"numpy.arange",
"gammapy.astro.population.spatial.FaucherSpiral"
] | [((77, 98), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (91, 98), False, 'import matplotlib\n'), ((295, 327), 'matplotlib.pyplot.style.use', 'plt.style.use', (['gammapy_mpl_style'], {}), '(gammapy_mpl_style)\n', (308, 327), True, 'import matplotlib.pyplot as plt\n'), ((334, 362), 'matplotlib.p... |
import pandas as pd
import plotly.graph_objects as go
import numpy as np
import warnings
from dotenv import load_dotenv
import os
load_dotenv()
warnings.filterwarnings("ignore", 'This pattern has match groups')
pd.options.mode.chained_assignment = None # default='warn'
FAMILY = "PT Sans"
MAPBOX_TOKEN = os.getenv("M... | [
"numpy.stack",
"warnings.filterwarnings",
"plotly.graph_objects.scattermapbox.Marker",
"dotenv.load_dotenv",
"os.getenv",
"plotly.graph_objects.layout.mapbox.Center"
] | [((131, 144), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (142, 144), False, 'from dotenv import load_dotenv\n'), ((146, 212), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '"""This pattern has match groups"""'], {}), "('ignore', 'This pattern has match groups')\n", (169, 212), Fals... |
# -*- coding: utf-8 -*-
"""
Assignment 4
Helper methods for image feature extraction and detection
@author: <NAME>
"""
import cv2
import json
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import random
import re
import seaborn as sns
import skimage
from skimage import exposure
im... | [
"cv2.GaussianBlur",
"numpy.empty",
"skimage.exposure.rescale_intensity",
"numpy.ones",
"numpy.arange",
"numpy.interp",
"cv2.erode",
"cv2.imshow",
"os.path.sep.join",
"cv2.subtract",
"cv2.dilate",
"cv2.cvtColor",
"cv2.LUT",
"cv2.split",
"cv2.convertScaleAbs",
"cv2.hconcat",
"cv2.drawC... | [((1265, 1305), 'cv2.cvtColor', 'cv2.cvtColor', (['img_in', 'cv2.COLOR_BGR2GRAY'], {}), '(img_in, cv2.COLOR_BGR2GRAY)\n', (1277, 1305), False, 'import cv2\n'), ((1357, 1388), 'numpy.percentile', 'np.percentile', (['img_tmp', '(2, 98)'], {}), '(img_tmp, (2, 98))\n', (1370, 1388), True, 'import numpy as np\n'), ((1403, 1... |
import os
import sys
from collections import Counter
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from bounding_box import BoundingBox
from enumerators import BBFormat, CoordinatesType, MethodAveragePrecision
def calculate_ap_every_point(rec, prec):
mrec = []
mrec.append(0)
[mre... | [
"matplotlib.pyplot.title",
"numpy.sum",
"os.path.join",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"numpy.cumsum",
"bounding_box.BoundingBox.iou",
"numpy.linspace",
"matplotlib.pyplot.pause",
"numpy.divide",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
... | [((1076, 1106), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'recall_vals'], {}), '(0, 1, recall_vals)\n', (1087, 1106), True, 'import numpy as np\n'), ((9083, 9094), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (9092, 9094), True, 'import matplotlib.pyplot as plt\n'), ((10376, 10396), 'matplotlib.pypl... |
from glob import glob
from shutil import rmtree
from os import mkdir
from os.path import basename, isfile
from contextlib import suppress
import cv2
import dlib
import numpy as np
from skimage.io import imread, imsave
from skimage.transform import resize
from eye_detector.const import CLASSES
def load(filepath):
... | [
"os.mkdir",
"numpy.sum",
"numpy.concatenate",
"os.path.basename",
"cv2.cvtColor",
"contextlib.suppress",
"os.path.isfile",
"dlib.get_frontal_face_detector",
"glob.glob",
"cv2.normalize",
"dlib.shape_predictor",
"skimage.io.imread"
] | [((413, 431), 'os.path.basename', 'basename', (['filepath'], {}), '(filepath)\n', (421, 431), False, 'from os.path import basename, isfile\n'), ((329, 345), 'skimage.io.imread', 'imread', (['filepath'], {}), '(filepath)\n', (335, 345), False, 'from skimage.io import imread, imsave\n'), ((790, 822), 'dlib.get_frontal_fa... |
import os, glob
import numpy as np
from skimage.io import imread, imsave, imshow
from PIL import Image, ImageTk
from tqdm.notebook import trange
from core.imageprep import create_crop_idx, crop_to_patch, construct_from_patch, create_crop_idx_whole
import time
import matplotlib.pyplot as plt
def stack_predict(input_im... | [
"numpy.full",
"os.path.basename",
"core.imageprep.construct_from_patch",
"time.time",
"core.imageprep.crop_to_patch",
"numpy.reshape",
"PIL.Image.fromarray",
"skimage.io.imread",
"numpy.nanmean"
] | [((762, 778), 'skimage.io.imread', 'imread', (['inputimg'], {}), '(inputimg)\n', (768, 778), False, 'from skimage.io import imread, imsave, imshow\n'), ((947, 1003), 'core.imageprep.crop_to_patch', 'crop_to_patch', (['img_tmp', 'cropidx', '(IMG_HEIGHT, IMG_WIDTH)'], {}), '(img_tmp, cropidx, (IMG_HEIGHT, IMG_WIDTH))\n',... |
#Purpose: create filters to go over images in an effort to extract
#infomation
#import external packages
from PIL import Image, ImageFilter, ImageEnhance
import numpy as np
from matplotlib import pyplot as plt
#import internal packages
from rockstarlifestyle import fouriertransform, edges, preprocessing
#Function 1: ... | [
"rockstarlifestyle.edges.low_pass_filter",
"rockstarlifestyle.preprocessing.color_split_fshift",
"numpy.logical_and",
"rockstarlifestyle.edges.band_pass_filter",
"rockstarlifestyle.edges.high_pass_filter",
"numpy.zeros",
"numpy.ones",
"rockstarlifestyle.fouriertransform.inverse_fourier",
"matplotlib... | [((716, 770), 'rockstarlifestyle.preprocessing.color_split_fshift', 'preprocessing.color_split_fshift', (['image', 'desired_color'], {}), '(image, desired_color)\n', (748, 770), False, 'from rockstarlifestyle import fouriertransform, edges, preprocessing\n'), ((961, 983), 'numpy.ones', 'np.ones', (['(row, column)'], {}... |
from __future__ import absolute_import
import numpy as np
from ..preprocess import preprocess, crop_resample
from ..utils import ALAMOS_MASK
from .ds_view import DatasetView
from ._search import parse_query
from .metadata import (
is_metadata, PrimaryKeyMetadata, LookupMetadata, TagMetadata)
class Dataset(object... | [
"numpy.asarray",
"numpy.asanyarray",
"numpy.diff",
"numpy.array",
"numpy.column_stack"
] | [((2750, 2766), 'numpy.asarray', 'np.asarray', (['traj'], {}), '(traj)\n', (2760, 2766), True, 'import numpy as np\n'), ((4068, 4084), 'numpy.asarray', 'np.asarray', (['ints'], {}), '(ints)\n', (4078, 4084), True, 'import numpy as np\n'), ((7018, 7038), 'numpy.asanyarray', 'np.asanyarray', (['bands'], {}), '(bands)\n',... |
# -*- coding: utf-8 -*-
import numpy as np
import xgboost as xgb
import itertools
import re
import scipy
import scipy.special
dpath = 'demo/data/'
rng = np.random.RandomState(1994)
class TestSHAP:
def test_feature_importances(self):
data = np.random.randn(100, 5)
target = np.array([0, 1] * 50)
... | [
"numpy.random.seed",
"numpy.sum",
"numpy.diag_indices_from",
"numpy.random.randn",
"xgboost.train",
"numpy.zeros",
"numpy.random.RandomState",
"itertools.combinations",
"numpy.array",
"numpy.linalg.norm",
"re.search",
"xgboost.DMatrix"
] | [((154, 181), 'numpy.random.RandomState', 'np.random.RandomState', (['(1994)'], {}), '(1994)\n', (175, 181), True, 'import numpy as np\n'), ((256, 279), 'numpy.random.randn', 'np.random.randn', (['(100)', '(5)'], {}), '(100, 5)\n', (271, 279), True, 'import numpy as np\n'), ((297, 318), 'numpy.array', 'np.array', (['([... |
import numpy as np
import scipy.sparse as sp
from src.const import *
def parse_tracks(filename="tracks.csv"):
"""
Builds the tracks matrix #tracks x #attributes (20635 x 4)
where attributes are track_id,album_id,artist_id,duration_sec
"""
with open(os.path.join(data_path, filename), "r") as f:
... | [
"scipy.sparse.dok_matrix",
"numpy.int32"
] | [((521, 576), 'scipy.sparse.dok_matrix', 'sp.dok_matrix', (['(NUM_ALBUMS, NUM_TRACKS)'], {'dtype': 'np.uint8'}), '((NUM_ALBUMS, NUM_TRACKS), dtype=np.uint8)\n', (534, 576), True, 'import scipy.sparse as sp\n'), ((598, 654), 'scipy.sparse.dok_matrix', 'sp.dok_matrix', (['(NUM_ARTISTS, NUM_TRACKS)'], {'dtype': 'np.uint8'... |
#!/usr/bin/env python3
import sys
if sys.version_info[0] < 3:
raise Exception("Must be using Python 3")
import time
import socket
import struct
import numpy as np
import matplotlib.pyplot as plt
import open3d
from quanergyM8 import Quanergy_M8_Parser, MAGIC_SIGNATURE
if len(sys.argv) != 2:
print('usage: %s ... | [
"open3d.visualization.Visualizer",
"socket.socket",
"open3d.geometry.PointCloud",
"struct.unpack",
"time.time",
"quanergyM8.Quanergy_M8_Parser",
"numpy.linspace",
"open3d.utility.Vector3dVector",
"sys.exit"
] | [((413, 433), 'quanergyM8.Quanergy_M8_Parser', 'Quanergy_M8_Parser', ([], {}), '()\n', (431, 433), False, 'from quanergyM8 import Quanergy_M8_Parser, MAGIC_SIGNATURE\n'), ((497, 530), 'open3d.visualization.Visualizer', 'open3d.visualization.Visualizer', ([], {}), '()\n', (528, 530), False, 'import open3d\n'), ((602, 63... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 30 17:21:30 2019
@author: jlee
"""
import time
start_time = time.time()
import numpy as np
import glob, os
import g0_init_cfg as ic
# ----- Line number (to be revised!) ----- #
pk_line = 1400
'''
Line for finding peaks (gfreduce)
Line/column for... | [
"os.getcwd",
"os.system",
"time.time",
"pyraf.iraf.copy",
"numpy.loadtxt",
"pyraf.iraf.gfextract",
"pyraf.iraf.gfreduce",
"pyraf.iraf.unlearn",
"pyraf.iraf.chdir",
"os.chdir",
"pyraf.iraf.imdelete"
] | [((132, 143), 'time.time', 'time.time', ([], {}), '()\n', (141, 143), False, 'import time\n'), ((471, 482), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (480, 482), False, 'import glob, os\n'), ((483, 504), 'os.chdir', 'os.chdir', (['ic.dir_iraf'], {}), '(ic.dir_iraf)\n', (491, 504), False, 'import glob, os\n'), ((566, ... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | [
"qiskit.aqua.utils.validation.validate_min",
"numpy.binary_repr",
"numpy.zeros",
"numpy.where",
"qiskit.aqua.utils.validation.validate_in_set",
"qiskit.aqua.circuits.PhaseEstimationCircuit",
"numpy.diag",
"logging.getLogger"
] | [((1138, 1165), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1155, 1165), False, 'import logging\n'), ((2325, 2376), 'qiskit.aqua.utils.validation.validate_min', 'validate_min', (['"""num_time_slices"""', 'num_time_slices', '(1)'], {}), "('num_time_slices', num_time_slices, 1)\n", (233... |
import dict_update
import copy
import json
import numpy as np
import pandas as pd
update = dict_update.update
def afn_surface(surface_name, open_fac=1, schedule_name="Sch_Ocupacao",
control_mode="Temperature",component="Janela", temperature_setpoint="Temp_setpoint",
enthalpy_difference=300000, tem... | [
"copy.deepcopy",
"numpy.tan",
"json.dumps"
] | [((15409, 15437), 'copy.deepcopy', 'copy.deepcopy', (['interior_wall'], {}), '(interior_wall)\n', (15422, 15437), False, 'import copy\n'), ((15640, 15668), 'copy.deepcopy', 'copy.deepcopy', (['interior_wall'], {}), '(interior_wall)\n', (15653, 15668), False, 'import copy\n'), ((15933, 15961), 'copy.deepcopy', 'copy.dee... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import numpy as np
import pandas as pd
import joblib
from six.moves import urllib
import tensorflow as tf
import pdb
ADULT_SOURCE_URL =\
'http://archive.ics.uci.edu/ml/machine-lea... | [
"numpy.sum",
"tensorflow.io.gfile.exists",
"pandas.get_dummies",
"joblib.dump",
"tensorflow.io.gfile.makedirs",
"six.moves.urllib.request.urlretrieve",
"os.path.join",
"pandas.concat",
"numpy.concatenate",
"tensorflow.io.gfile.GFile"
] | [((1851, 1897), 'os.path.join', 'os.path.join', (["(DATA_DIRECTORY + 'raw')", 'filename'], {}), "(DATA_DIRECTORY + 'raw', filename)\n", (1863, 1897), False, 'import os\n'), ((2347, 2393), 'os.path.join', 'os.path.join', (["(DATA_DIRECTORY + 'raw')", 'filename'], {}), "(DATA_DIRECTORY + 'raw', filename)\n", (2359, 2393)... |
from collections import namedtuple
import numpy as np
Genotype = namedtuple('Genotype', 'down down_concat up up_concat')
CellLinkDownPos = [
'avg_pool',
'max_pool',
'down_cweight',
'down_dil_conv',
'down_dep_conv',
'down_conv'
]
CellLinkUpPos = [
'up_cweight',
'up_dep_conv',
'up_c... | [
"numpy.zeros",
"collections.namedtuple"
] | [((66, 121), 'collections.namedtuple', 'namedtuple', (['"""Genotype"""', '"""down down_concat up up_concat"""'], {}), "('Genotype', 'down down_concat up up_concat')\n", (76, 121), False, 'from collections import namedtuple\n'), ((980, 1004), 'numpy.zeros', 'np.zeros', (['nc'], {'dtype': 'bool'}), '(nc, dtype=bool)\n', ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2021 <NAME>. All rights reserved.
# Licensed under the MIT License. See the LICENSE file in the project root for more information.
#
# Name: utilityFunctions.py - Version 1.0.0
# Author: cdrisko
# Date: 04/26/2019-11:46:42
# Description: A collection o... | [
"numpy.size",
"numpy.loadtxt"
] | [((606, 647), 'numpy.loadtxt', 'np.loadtxt', (['fileName'], {'delimiter': 'delimiter'}), '(fileName, delimiter=delimiter)\n', (616, 647), True, 'import numpy as np\n'), ((657, 670), 'numpy.size', 'np.size', (['data'], {}), '(data)\n', (664, 670), True, 'import numpy as np\n')] |
# 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... | [
"tensorflow.contrib.data.python.ops.batching.map_and_batch",
"os.remove",
"tensorflow.python.util.compat.as_bytes",
"numpy.random.seed",
"numpy.mean",
"tensorflow.python.data.ops.dataset_ops.Dataset.from_tensor_slices",
"tensorflow.python.ops.array_ops.check_numerics",
"hashlib.sha1",
"numpy.std",
... | [((10241, 10252), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10250, 10252), False, 'from tensorflow.python.platform import test\n'), ((5624, 5671), 'itertools.product', 'itertools.product', (['[1]', '[1]', '[1, 2, 4, 8]', '[16]'], {}), '([1], [1], [1, 2, 4, 8], [16])\n', (5641, 5671), False... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.Dense",
"tensorflowjs.converters.converter.dispatch_keras_h5_to_tfjs_layers_model_conversion",
"tensorflow.keras.Sequential",
"shutil.rmtree",
"os.path.join",
"tensorflowjs.converters.converter.dispatch_keras_h5_to_tfjs_graph_model_conversion",... | [((29355, 29370), 'unittest.main', 'unittest.main', ([], {}), '()\n', (29368, 29370), False, 'import unittest\n'), ((1262, 1280), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1278, 1280), False, 'import tempfile\n'), ((1357, 1385), 'os.path.isdir', 'os.path.isdir', (['self._tmp_dir'], {}), '(self._tmp_dir... |
#!/usr/bin/env python
# coding: utf8
#
# Copyright (c) 2020 Centre National d'Etudes Spatiales (CNES).
#
# This file is part of PANDORA
#
# https://github.com/CNES/Pandora_pandora
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#... | [
"warnings.filterwarnings",
"numba.njit",
"numpy.zeros",
"numpy.nanmin",
"numpy.isnan",
"json_checker.And",
"numpy.arange",
"warnings.catch_warnings",
"json_checker.Checker",
"numba.prange",
"numpy.nanmean",
"numpy.nanmax",
"numpy.repeat"
] | [((5205, 5308), 'numba.njit', 'njit', (['"""Tuple((f4[:, :],f4[:, :]))(f4[:, :, :], f4[:, :, :], f4, f4, f4)"""'], {'parallel': '(True)', 'cache': '(True)'}), "('Tuple((f4[:, :],f4[:, :]))(f4[:, :, :], f4[:, :, :], f4, f4, f4)',\n parallel=True, cache=True)\n", (5209, 5308), False, 'from numba import njit, prange\n'... |
import os
import numpy as np
#from astropy.table import Table, Column, Row
from scipy.interpolate import interp1d, InterpolatedUnivariateSpline, UnivariateSpline
from lmfit import Model, Parameters
import time
import warnings
# Set constants
c_kms = 299792.458
# Read in the galaxy eigenspectra
eigen_galaxy = np.load(... | [
"numpy.matrix",
"numpy.load",
"numpy.sum",
"numpy.median",
"numpy.square",
"numpy.isfinite",
"numpy.isnan",
"numpy.where",
"numpy.arange",
"numpy.linalg.inv",
"lmfit.Model",
"scipy.interpolate.interp1d",
"numpy.diag",
"lmfit.Parameters"
] | [((312, 381), 'numpy.load', 'np.load', (["(os.environ['REDSHIFTING'] + '/eigenspectra/eigen_galaxy.npy')"], {}), "(os.environ['REDSHIFTING'] + '/eigenspectra/eigen_galaxy.npy')\n", (319, 381), True, 'import numpy as np\n'), ((450, 578), 'scipy.interpolate.interp1d', 'interp1d', (["eigen_galaxy['wave']", "eigen_galaxy['... |
"""
Stochastic Model FBPH
---------------------
This model follows allows for the department to hire and then promote
faculty.
Notes:
5/7/2016 - This is an alternative model for the range models. It is based
upon allowing the size of the department to vary but with greater probability
for male hires. So I will se... | [
"pandas.DataFrame",
"numpy.random.binomial",
"numpy.ones",
"numpy.where",
"numpy.random.choice",
"operator.neg"
] | [((21060, 21082), 'pandas.DataFrame', 'pd.DataFrame', (['self.res'], {}), '(self.res)\n', (21072, 21082), True, 'import pandas as pd\n'), ((6555, 6626), 'numpy.random.binomial', 'binomial', (['prev_number_of_females_level_3', 'attrition_rate_female_level_3'], {}), '(prev_number_of_females_level_3, attrition_rate_female... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Author : windz
Date : 2021-10-14 21:00:58
LastEditTime : 2021-10-15 14:57:19
LastEditors : windz
FilePath : /flair/script/quantify_isoforms.py
Description : quantifying isoform usage across samples using bedtools intersect,
only trans... | [
"os.path.basename",
"pandas.read_csv",
"click.option",
"click.command",
"collections.Counter",
"numpy.fromstring"
] | [((1631, 1646), 'click.command', 'click.command', ([], {}), '()\n', (1644, 1646), False, 'import click\n'), ((1648, 1687), 'click.option', 'click.option', (['"""--infile"""'], {'required': '(True)'}), "('--infile', required=True)\n", (1660, 1687), False, 'import click\n'), ((1689, 1729), 'click.option', 'click.option',... |
def process_volumes(parameters):
'''process original volumes and save into nifti format'''
import os
import copy
import numpy as np
from scipy import interpolate
from types import SimpleNamespace
from voluseg._tools.load_volume import load_volume
from voluseg._tools.save_volume import s... | [
"copy.deepcopy",
"numpy.meshgrid",
"os.makedirs",
"voluseg._tools.evenly_parallelize.evenly_parallelize",
"voluseg._tools.plane_name.plane_name",
"voluseg._tools.save_volume.save_volume",
"numpy.percentile",
"os.path.isfile",
"numpy.arange",
"voluseg._tools.load_volume.load_volume",
"os.path.joi... | [((522, 551), 'types.SimpleNamespace', 'SimpleNamespace', ([], {}), '(**parameters)\n', (537, 551), False, 'from types import SimpleNamespace\n'), ((574, 648), 'voluseg._tools.evenly_parallelize.evenly_parallelize', 'evenly_parallelize', (['(p.volume_names0 if p.planes_packed else p.volume_names)'], {}), '(p.volume_nam... |
import os
import xmltodict
import numpy as np
from skimage import io
from tqdm import tqdm
data_dir = "/home/atchelet/Downloads/data_training/"
out_dir = "/home/atchelet/Dataset"
os.makedirs(os.path.join(out_dir, "images"), exist_ok=True)
os.makedirs(os.path.join(out_dir, "labels"), exist_ok=True)
w_px = h_px = 40
f... | [
"numpy.zeros",
"os.walk",
"os.path.join",
"os.path.basename"
] | [((347, 364), 'os.walk', 'os.walk', (['data_dir'], {}), '(data_dir)\n', (354, 364), False, 'import os\n'), ((192, 223), 'os.path.join', 'os.path.join', (['out_dir', '"""images"""'], {}), "(out_dir, 'images')\n", (204, 223), False, 'import os\n'), ((252, 283), 'os.path.join', 'os.path.join', (['out_dir', '"""labels"""']... |
import config
import numpy as np
from utils.LRScheduler.LRScheduler import LearningRateScheduler
class CosineAnneling(LearningRateScheduler):
def __init__(self):
super().__init__()
self.cosine_iters = config.steps_per_epoch * config.epochs - config.burn_in_steps
def get_lr(self, ... | [
"numpy.cos"
] | [((759, 826), 'numpy.cos', 'np.cos', (['(np.pi * (g_step - config.burn_in_steps) / self.cosine_iters)'], {}), '(np.pi * (g_step - config.burn_in_steps) / self.cosine_iters)\n', (765, 826), True, 'import numpy as np\n')] |
""""Distributed data loaders for loading data into device meshes."""
import collections
import itertools
import jax
from jax.interpreters import pxla, xla
import numpy as np
import ray
from alpa.device_mesh import LocalPhysicalDeviceMesh, DistributedArray
from alpa.mesh_executable import create_remote_buffer_refs
c... | [
"jax.tree_flatten",
"jax.interpreters.xla.abstractify",
"jax.device_put",
"alpa.device_mesh.LocalPhysicalDeviceMesh",
"numpy.prod",
"ray.is_initialized",
"jax.tree_unflatten",
"itertools.islice",
"alpa.mesh_executable.create_remote_buffer_refs",
"alpa.device_mesh.DistributedArray",
"collections.... | [((909, 928), 'collections.deque', 'collections.deque', ([], {}), '()\n', (926, 928), False, 'import collections\n'), ((1072, 1118), 'itertools.islice', 'itertools.islice', (['self.input_iter', 'num_batches'], {}), '(self.input_iter, num_batches)\n', (1088, 1118), False, 'import itertools\n'), ((3028, 3052), 'numpy.pro... |
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Copyright (c) 2022. <NAME>, Deakin University +
# Email: <EMAIL> +
# +
# Licensed under the Apach... | [
"os.path.abspath",
"h5py.File",
"tensorflow.strings.split",
"numpy.argmax",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.python.keras.saving.hdf5_format.load_model_from_hdf5",
"tensorflow.keras.layers.StringLookup",
"numpy.array",
"tensorflow.io.read_file",
"tensorflow.image.resize",
... | [((2323, 2352), 'numpy.array', 'np.array', (['input_shape[0][1:3]'], {}), '(input_shape[0][1:3])\n', (2331, 2352), True, 'import numpy as np\n'), ((2518, 2561), 'tensorflow.keras.layers.StringLookup', 'keras.layers.StringLookup', ([], {'vocabulary': 'vocab'}), '(vocabulary=vocab)\n', (2543, 2561), False, 'from tensorfl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.