code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- coding: utf-8 -*- import random import numpy as np from collections import deque from keras.models import Sequential from keras.layers import Dense from keras.optimizers import Adam ''' INPUT: [0] - Model predicted that the image was of a cat [1] - Model predicted that the image was of a dog OUTPUT: ...
[ "random.randint", "numpy.argmax", "random.sample", "keras.layers.Dense", "random.randrange", "numpy.random.rand", "keras.models.Sequential", "collections.deque" ]
[((992, 1010), 'collections.deque', 'deque', ([], {'maxlen': '(2000)'}), '(maxlen=2000)\n', (997, 1010), False, 'from collections import deque\n'), ((1096, 1108), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1106, 1108), False, 'from keras.models import Sequential\n'), ((1725, 1749), 'numpy.argmax', 'np....
from numpy import ndarray, array, full from pytest import raises from unittest import TestCase from src.enums import BackTrackingHeuristics from src.exceptions import CantRemoveFromBlank, InvalidInsert, NoBlanks from src.sudoku_solver import SudokuSolver class TestSudokuSolver(TestCase): def setUp(self): ...
[ "numpy.full", "src.sudoku_solver.SudokuSolver", "pytest.raises", "numpy.array" ]
[((333, 386), 'src.sudoku_solver.SudokuSolver', 'SudokuSolver', (['"""./tests/sudoku_test_problems/empty.sd"""'], {}), "('./tests/sudoku_test_problems/empty.sd')\n", (345, 386), False, 'from src.sudoku_solver import SudokuSolver\n'), ((423, 480), 'src.sudoku_solver.SudokuSolver', 'SudokuSolver', (['"""./tests/sudoku_te...
import torch import os import numpy from torch import nn from torch.nn import Parameter from enum import IntEnum from typing import Optional, Tuple import onnxruntime as rt plugin_dir = "PLUGIN_DIR" class PluginLstmRnntDec(torch.nn.Module): def __init__(self): super().__init__() print("----------...
[ "onnxruntime.InferenceSession", "numpy.zeros", "os.path.join", "torch.from_numpy" ]
[((451, 489), 'os.path.join', 'os.path.join', (['plugin_dir', '"""model.onnx"""'], {}), "(plugin_dir, 'model.onnx')\n", (463, 489), False, 'import os\n'), ((585, 611), 'onnxruntime.InferenceSession', 'rt.InferenceSession', (['model'], {}), '(model)\n', (604, 611), True, 'import onnxruntime as rt\n'), ((1549, 1602), 'nu...
from unittest import TestCase import trw import trw.train import numpy as np import torch import trw.utils def make_list_dicts(batch): samples = [] for n in range(10): sub_batch = { 'sample_uid': batch['sample_uid'], 'volume': torch.zeros([1, 42]) } samples.app...
[ "trw.train.SamplerSequential", "trw.train.SequenceArray", "numpy.arange", "trw.train.SequenceAsyncReservoir", "torch.zeros", "trw.utils.len_batch" ]
[((658, 699), 'trw.train.SamplerSequential', 'trw.train.SamplerSequential', ([], {'batch_size': '(1)'}), '(batch_size=1)\n', (685, 699), False, 'import trw\n'), ((725, 772), 'trw.train.SequenceArray', 'trw.train.SequenceArray', (['split'], {'sampler': 'sampler'}), '(split, sampler=sampler)\n', (748, 772), False, 'impor...
# stdlib import operator # third party import numpy as np import pytest import torch from sympc.session import Session from sympc.session import SessionManager from sympc.tensor import MPCTensor from sympc.tensor import ShareTensor def test_mpc_tensor_exception(get_clients) -> None: alice_client, bob_client = g...
[ "torch.ones", "sympc.session.Session", "sympc.tensor.MPCTensor.generate_shares", "numpy.allclose", "torch.nn.functional.conv2d", "pytest.raises", "torch.Tensor", "pytest.mark.parametrize", "sympc.session.SessionManager.setup_mpc", "sympc.tensor.MPCTensor", "sympc.tensor.ShareTensor", "torch.te...
[((3433, 3484), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nr_clients"""', '[2, 3, 4, 5]'], {}), "('nr_clients', [2, 3, 4, 5])\n", (3456, 3484), False, 'import pytest\n'), ((3486, 3538), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""op_str"""', "['mul', 'matmul']"], {}), "('op_str', ['mul...
import numpy as np import properties from ....utils.code_utils import deprecate_class from .... import props from ....data import Data from ....utils import mkvc, sdiag from ...base import BaseEMSimulation from ..resistivity.fields import FieldsDC, Fields3DCellCentered, Fields3DNodal from ..resistivity import Simulat...
[ "numpy.zeros", "properties.StringChoice", "numpy.ones", "numpy.hstack" ]
[((745, 848), 'properties.StringChoice', 'properties.StringChoice', (['"""IP data type"""'], {'default': '"""volt"""', 'choices': "['volt', 'apparent_chargeability']"}), "('IP data type', default='volt', choices=['volt',\n 'apparent_chargeability'])\n", (768, 848), False, 'import properties\n'), ((2844, 2864), 'nump...
import path_guiding_kdtree_loader import vtk import sys import os import csv from pprint import pprint, pformat import numpy as np import itertools from vtk.util import numpy_support import matplotlib from matplotlib import pyplot def generate_lut(): colors = vtk.vtkNamedColors() # Colour t...
[ "vtk.vtkNamedColors", "vtk.vtkPoints", "path_guiding_kdtree_loader.read_records", "os.path.isfile", "vtk.vtkAxesActor", "vtk.vtkTextActor", "vtk.vtkPolyDataMapper", "matplotlib.cm.coolwarm", "matplotlib.colors.Normalize", "vtk.vtkAppendPolyData", "vtk.vtkCubeSource", "vtk.vtkActor", "vtk.vtk...
[((284, 304), 'vtk.vtkNamedColors', 'vtk.vtkNamedColors', ([], {}), '()\n', (302, 304), False, 'import vtk\n'), ((349, 379), 'vtk.vtkColorTransferFunction', 'vtk.vtkColorTransferFunction', ([], {}), '()\n', (377, 379), False, 'import vtk\n'), ((769, 789), 'vtk.vtkLookupTable', 'vtk.vtkLookupTable', ([], {}), '()\n', (7...
# /usr/bin/env python3.5 # -*- mode: python -*- # ============================================================================= # @@-COPYRIGHT-START-@@ # # Copyright (c) 2019, Qualcomm Innovation Center, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification,...
[ "copy.deepcopy", "aimet_tensorflow.channel_pruning.weight_reconstruction.WeightReconstructor.reconstruct_params_for_conv2d", "aimet_common.defs.LayerCompRatioPair", "aimet_tensorflow.utils.common.is_op_compressible", "numpy.transpose", "aimet_tensorflow.utils.common.get_ordered_ops", "aimet_tensorflow.c...
[((2981, 3045), 'aimet_common.utils.AimetLogger.get_area_logger', 'AimetLogger.get_area_logger', (['AimetLogger.LogAreas.ChannelPruning'], {}), '(AimetLogger.LogAreas.ChannelPruning)\n', (3008, 3045), False, 'from aimet_common.utils import AimetLogger\n'), ((4720, 4780), 'aimet_tensorflow.utils.op.conv.WeightTensorUtil...
from time import time import os import numpy as np import matplotlib.pyplot as plt from matplotlib import animation, rc rc('animation', html='html5') import matplotlib.animation as animation FFwriter = animation.FFMpegWriter() Writer = animation.writers['ffmpeg'] writer = Writer(fps=150, metadata=dict(artist='Me'), bi...
[ "matplotlib.rc", "matplotlib.pyplot.ylim", "numpy.genfromtxt", "matplotlib.animation.FFMpegWriter", "matplotlib.pyplot.subplots" ]
[((121, 150), 'matplotlib.rc', 'rc', (['"""animation"""'], {'html': '"""html5"""'}), "('animation', html='html5')\n", (123, 150), False, 'from matplotlib import animation, rc\n'), ((203, 227), 'matplotlib.animation.FFMpegWriter', 'animation.FFMpegWriter', ([], {}), '()\n', (225, 227), True, 'import matplotlib.animation...
"""Preprocess""" import numpy as np from scipy.sparse import ( csr_matrix, ) from sklearn.utils import sparsefuncs from skmisc.loess import loess def select_variable_genes(adata, layer='raw', span=0.3, n_top_genes=2000, ...
[ "numpy.square", "numpy.zeros", "scipy.sparse.csr_matrix", "sklearn.utils.sparsefuncs.mean_variance_axis", "numpy.log10", "numpy.sqrt" ]
[((1349, 1390), 'sklearn.utils.sparsefuncs.mean_variance_axis', 'sparsefuncs.mean_variance_axis', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (1379, 1390), False, 'from sklearn.utils import sparsefuncs\n'), ((1415, 1457), 'numpy.zeros', 'np.zeros', (['adata.shape[1]'], {'dtype': 'np.float64'}), '(adata.shape[1], dtype=n...
import pandas as pd import numpy as np # load trajectory df = pd.read_csv(snakemake.input.traj) # load chromatic shift data chromatic_shift_data = np.load(snakemake.input.chromatic_shift) shiftX = chromatic_shift_data['chromatic_shift_X'] shiftY = chromatic_shift_data['chromatic_shift_Y'] shiftZ = chromatic_shift_d...
[ "pandas.read_csv", "numpy.interp", "numpy.load" ]
[((64, 97), 'pandas.read_csv', 'pd.read_csv', (['snakemake.input.traj'], {}), '(snakemake.input.traj)\n', (75, 97), True, 'import pandas as pd\n'), ((150, 190), 'numpy.load', 'np.load', (['snakemake.input.chromatic_shift'], {}), '(snakemake.input.chromatic_shift)\n', (157, 190), True, 'import numpy as np\n'), ((1117, 1...
import numpy as np import multiprocessing as mp from . import perimeter def mesh_to_plane(mesh, bounding_box, parallel): if parallel: pool = mp.Pool(mp.cpu_count()) result_ids = [] # Note: vol should be addressed with vol[z][y][x] vol = np.zeros(bounding_box[::-1], dtype=bool) curre...
[ "numpy.array", "numpy.floor", "numpy.zeros", "multiprocessing.cpu_count" ]
[((269, 309), 'numpy.zeros', 'np.zeros', (['bounding_box[::-1]'], {'dtype': 'bool'}), '(bounding_box[::-1], dtype=bool)\n', (277, 309), True, 'import numpy as np\n'), ((1411, 1444), 'numpy.zeros', 'np.zeros', (['plane_shape'], {'dtype': 'bool'}), '(plane_shape, dtype=bool)\n', (1419, 1444), True, 'import numpy as np\n'...
from typing import Optional import numpy as np from graphviz import Digraph from remat.core.dfgraph import DFGraph from remat.core.schedule import Schedule, OperatorEvaluation, ScheduledResult from remat.core.utils.definitions import PathLike def tensor_plot(g: DFGraph, sched: Schedule, directory, tag=None, format=...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.close", "numpy.max", "graphviz.Digraph", "matplotlib.pyplot.subplots" ]
[((350, 393), 'graphviz.Digraph', 'Digraph', (['f"""!TensorPlot_{tag}"""'], {'engine': '"""dot"""'}), "(f'!TensorPlot_{tag}', engine='dot')\n", (357, 393), False, 'from graphviz import Digraph\n'), ((3524, 3542), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(4)'], {}), '(1, 4)\n', (3536, 3542), True, 'import...
#! /usr/bin/python3 # -*- coding: utf-8 -*- """ ****************** Astronomical tools ****************** """ __author__ = '<NAME>' __copyright__ = 'Copyright 2021, nenupy' __credits__ = ['<NAME>'] __maintainer__ = 'Alan' __email__ = '<EMAIL>' __status__ = 'Production' __all__ = [ "solar_system_sourc...
[ "astropy.coordinates.Longitude", "numpy.moveaxis", "astropy.coordinates.AltAz", "numpy.sin", "numpy.ma.masked_array", "astropy.coordinates.Angle", "astropy.coordinates.get_body", "numpy.degrees", "numpy.arcsin", "astropy.units.spectral", "numpy.arccos", "numpy.repeat", "numpy.radians", "as...
[((1261, 1267), 'enum.auto', 'auto', ([], {}), '()\n', (1265, 1267), False, 'from enum import Enum, auto\n'), ((1279, 1285), 'enum.auto', 'auto', ([], {}), '()\n', (1283, 1285), False, 'from enum import Enum, auto\n'), ((1300, 1306), 'enum.auto', 'auto', ([], {}), '()\n', (1304, 1306), False, 'from enum import Enum, au...
import dpp_nets.my_torch import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from dpp_nets.my_torch.linalg import my_svd from collections import defaultdict class DPPRegressor(nn.Module): def __init__(self, network_params, dtype): """...
[ "numpy.sum", "torch.cat", "collections.defaultdict", "numpy.arange", "numpy.tile", "numpy.random.normal", "numpy.unique", "torch.nn.MSELoss", "numpy.random.randn", "torch.diag", "dpp_nets.my_torch.linalg.my_svd", "numpy.random.choice", "torch.nn.Linear", "torch.autograd.Variable", "torch...
[((1573, 1585), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (1583, 1585), True, 'import torch.nn as nn\n'), ((1872, 1889), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1883, 1889), False, 'from collections import defaultdict\n'), ((1918, 1935), 'collections.defaultdict', 'defaultdict',...
import os import matplotlib.pyplot as plt import numpy as np def create_directories(path): if not os.path.exists('{}'.format(path)): os.makedirs('{}/models'.format(path)) os.makedirs('{}/images'.format(path)) os.makedirs('{}/plots'.format(path)) else: print("path already exist...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.random.randint", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.subplots" ]
[((369, 416), 'numpy.random.randint', 'np.random.randint', (['(0)', 'data.shape[0]', 'batch_size'], {}), '(0, data.shape[0], batch_size)\n', (386, 416), True, 'import numpy as np\n'), ((530, 566), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(4)', '(1)'], {'figsize': '(10, 12)'}), '(4, 1, figsize=(10, 12))\n', (542...
from typing import Any, Optional, Callable, List import pickle import nibabel as nib import numpy as np import scipy.stats as stats from scipy.stats.stats import CumfreqResult def get_datapoints( input_filename:str, mask_filename: Optional[str]=None, mask_indices: Optional[np.ndarray]=None, ...
[ "scipy.stats.cumfreq", "scipy.stats.stats.CumfreqResult", "nibabel.load", "numpy.argmax", "numpy.sort", "numpy.min", "pickle.load", "numpy.array", "numpy.where", "numpy.max", "numpy.int" ]
[((1102, 1126), 'nibabel.load', 'nib.load', (['input_filename'], {}), '(input_filename)\n', (1110, 1126), True, 'import nibabel as nib\n'), ((10358, 10371), 'numpy.sort', 'np.sort', (['data'], {}), '(data)\n', (10365, 10371), True, 'import numpy as np\n'), ((10821, 10840), 'numpy.array', 'np.array', (['x_at_frac'], {})...
import utils.util as util import json import numpy as np import cv2 as cv def addBoxToHeatMap(heatmap, centerPoint, gaussian_width, angle): heatCenterPoint = np.zeros((heatmap.shape[0],heatmap.shape[1],1),np.float32) heatCenterPoint.itemset((centerPoint[0],centerPoint[1],0),1) #add keypoint to image #...
[ "utils.util.polygonbox_width_height", "cv2.GaussianBlur", "utils.util.shuffleArray", "cv2.max", "json.loads", "numpy.multiply", "utils.util.gaussian_radius", "numpy.zeros", "cv2.warpAffine", "cv2.imread", "numpy.array", "utils.util.computerCenterPointPolygon", "utils.util.round_up_to_odd", ...
[((164, 225), 'numpy.zeros', 'np.zeros', (['(heatmap.shape[0], heatmap.shape[1], 1)', 'np.float32'], {}), '((heatmap.shape[0], heatmap.shape[1], 1), np.float32)\n', (172, 225), True, 'import numpy as np\n'), ((670, 785), 'cv2.GaussianBlur', 'cv.GaussianBlur', (['heatCenterPoint', '(gaussian_width, gaussian_width)', '(g...
"""Generate new frames after performing set non malicious modifications on original frames.""" import functools import itertools import pathlib from typing import Generator, List, NamedTuple, Optional import cv2 as cv import numpy as np from dfd.exceptions import DfdError from dfd.datasets.modifications.definitions i...
[ "itertools.permutations", "dfd.datasets.modifications.definitions.IdentityModification", "numpy.random.permutation", "dfd.exceptions.DfdError", "dfd.datasets.modifications.register.ModificationRegister.default", "functools.lru_cache" ]
[((3073, 3103), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (3092, 3103), False, 'import functools\n'), ((4405, 4435), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (4424, 4435), False, 'import functools\n'), ((5511, 5541), 'functoo...
#! /usr/bin/env python3 # # Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # import os import sys from os import path import importlib import onnx import yaml import tvm import tvm.relay.testing.tf as tf_testing import tvm.contrib.graph_runtime as ru...
[ "argparse.ArgumentParser", "tvm.relay.frontend.from_onnx", "pytest.main", "numpy.mean", "yaml.safe_load", "tvm.relay.testing.tf.ProcessGraphDefParam", "tvm.autotvm.tuner.GATuner", "os.path.join", "os.path.sep.join", "tvm.autotvm.tuner.GridSearchTuner", "os.path.abspath", "tensorflow.compat.v1....
[((7728, 7790), 'os.path.join', 'path.join', (["info['output_path']", 'OUTPUT_NETWORK_MODULE_FILENAME'], {}), "(info['output_path'], OUTPUT_NETWORK_MODULE_FILENAME)\n", (7737, 7790), False, 'from os import path\n'), ((7849, 7910), 'os.path.join', 'path.join', (["info['output_path']", 'OUTPUT_NETWORK_GRAPH_FILENAME'], {...
import numpy as np from collections import Counter import kss from konlpy.tag import Okt from eunjeon import Mecab def extract_nouns(news: str) -> dict: return extract_nouns_v1(news) def extract_nouns_v1(news: str) -> dict: """Extract nouns from news. :param news: contents of news. :return: dict()...
[ "eunjeon.Mecab", "numpy.sum", "collections.Counter", "kss.split_sentences", "numpy.array", "numpy.linalg.norm", "numpy.dot", "konlpy.tag.Okt" ]
[((435, 440), 'konlpy.tag.Okt', 'Okt', ([], {}), '()\n', (438, 440), False, 'from konlpy.tag import Okt\n'), ((459, 484), 'kss.split_sentences', 'kss.split_sentences', (['news'], {}), '(news)\n', (478, 484), False, 'import kss\n'), ((1343, 1350), 'eunjeon.Mecab', 'Mecab', ([], {}), '()\n', (1348, 1350), False, 'from eu...
""" Copyright 2020 The OneFlow Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
[ "numpy.sum", "numpy.array_equal", "oneflow.compatible.single_client.scope.placement", "oneflow.compatible.single_client.unittest.skip_unless_1n2d", "unittest.main", "oneflow.compatible.single_client.FunctionConfig", "numpy.random.rand", "oneflow.compatible.single_client.global_function", "oneflow.co...
[((4623, 4655), 'oneflow.compatible.single_client.unittest.skip_unless_1n2d', 'flow.unittest.skip_unless_1n2d', ([], {}), '()\n', (4653, 4655), True, 'from oneflow.compatible import single_client as flow\n'), ((939, 967), 'oneflow.compatible.single_client.clear_default_session', 'flow.clear_default_session', ([], {}), ...
import os import numpy as np import torch from torchvision import models, transforms from torch.utils.data import DataLoader, Dataset from PIL import Image """ #Code to change image filenames from Flicker30k to keep the order from .json files-> 00000.jps, 00001.jpg, ... with open('Flickr30k/dataset.json','rb'...
[ "numpy.save", "torch.utils.data.DataLoader", "numpy.transpose", "torchvision.transforms.ToTensor", "numpy.mean", "torchvision.models.detection.fasterrcnn_resnet50_fpn", "torch.cuda.is_available", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "os.listdir", "torchvision.tr...
[((1414, 1460), 'torch.utils.data.DataLoader', 'DataLoader', (['data'], {'batch_size': '(32)', 'shuffle': '(False)'}), '(data, batch_size=32, shuffle=False)\n', (1424, 1460), False, 'from torch.utils.data import DataLoader, Dataset\n'), ((1511, 1568), 'torchvision.models.detection.fasterrcnn_resnet50_fpn', 'models.dete...
""" This script plot and compare the covariance matrix elements """ import matplotlib matplotlib.use("Agg") import pylab as plt import numpy as np from pspy import so_spectra, so_cov, so_mcm, pspy_utils, so_map, so_dict import scipy.interpolate import sys import SO_noise_utils d = so_dict.so_dict() d.read_from_file(s...
[ "pylab.close", "numpy.load", "pylab.title", "pspy.so_spectra.read_ps", "pylab.semilogy", "pspy.so_dict.so_dict", "pspy.so_cov.selectblock", "pspy.pspy_utils.ps_lensed_theory_to_dict", "pylab.savefig", "matplotlib.use", "pylab.figure", "pylab.clf", "pylab.xlabel", "numpy.sqrt", "pylab.leg...
[((87, 108), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (101, 108), False, 'import matplotlib\n'), ((284, 301), 'pspy.so_dict.so_dict', 'so_dict.so_dict', ([], {}), '()\n', (299, 301), False, 'from pspy import so_spectra, so_cov, so_mcm, pspy_utils, so_map, so_dict\n'), ((572, 632), 'pspy.psp...
from unittest import TestCase import numpy as np from tcontrol.pzmap import pzmap from tcontrol.tests.data_generator import SYSTEMS from tcontrol.transferfunction import tf class TestPzmap(TestCase): def test_pzmap(self): sys_ = tf([1, 2, 2], [1, 2, 1, 1]) p, z = pzmap(sys_, plot=False) ...
[ "numpy.roots", "tcontrol.pzmap.pzmap", "tcontrol.transferfunction.tf" ]
[((245, 272), 'tcontrol.transferfunction.tf', 'tf', (['[1, 2, 2]', '[1, 2, 1, 1]'], {}), '([1, 2, 2], [1, 2, 1, 1])\n', (247, 272), False, 'from tcontrol.transferfunction import tf\n'), ((288, 311), 'tcontrol.pzmap.pzmap', 'pzmap', (['sys_'], {'plot': '(False)'}), '(sys_, plot=False)\n', (293, 311), False, 'from tcontr...
# Copyright 2021 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicab...
[ "torch.ones", "functools.partial", "torch.distributions.Categorical", "torch.stack", "torch.sqrt", "PIL.Image.open", "torch.meshgrid", "torch.linspace", "torch.distributions.MixtureSameFamily", "numpy.array", "torch.utils.data.TensorDataset", "torch.arange", "torch.distributions.Normal", "...
[((1715, 1728), 'torch.ones', 'torch.ones', (['n'], {}), '(n)\n', (1725, 1728), False, 'import torch\n'), ((4003, 4068), 'torch.distributions.MixtureSameFamily', 'D.MixtureSameFamily', (['mixture_distribution', 'component_distribution'], {}), '(mixture_distribution, component_distribution)\n', (4022, 4068), True, 'from...
from argparse import ArgumentParser from os import listdir, path, sep import sys import cv2 import math import numpy as np import warnings COLUMNS = 30 def concat_images(img_num, imga, imgb): """ Combines two image ndarrays. imga is starts from 0, 0 imgb is placed according to the img_num in the app...
[ "cv2.resize", "warnings.simplefilter", "argparse.ArgumentParser", "cv2.imwrite", "os.path.dirname", "numpy.zeros", "math.floor", "cv2.imread", "warnings.catch_warnings", "os.path.join", "os.listdir", "sys.exit" ]
[((426, 455), 'math.floor', 'math.floor', (['(img_num / COLUMNS)'], {}), '(img_num / COLUMNS)\n', (436, 455), False, 'import math\n'), ((629, 673), 'numpy.zeros', 'np.zeros', ([], {'shape': '(max_height, total_width, 4)'}), '(shape=(max_height, total_width, 4))\n', (637, 673), True, 'import numpy as np\n'), ((1115, 115...
from __future__ import print_function import os import cv2 # import debug import torch import torch.nn.functional as F import numpy as np from src.crowd_counting import CrowdCounter from src import network from src.RawLoader import ImageDataLoader, basic_config from src import utils import argparse from src.sampler imp...
[ "os.mkdir", "os.remove", "argparse.ArgumentParser", "torch.cat", "src.timer.Timer", "os.path.isfile", "torch.no_grad", "os.path.join", "src.crowd_counting.CrowdCounter", "os.path.exists", "src.datasets.CreateDataLoader", "torch.Tensor", "torch.zeros", "torch.cuda.set_device", "itertools....
[((729, 754), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (752, 754), False, 'import argparse\n'), ((5195, 5202), 'src.timer.Timer', 'Timer', ([], {}), '()\n', (5200, 5202), False, 'from src.timer import Timer\n'), ((9789, 9796), 'src.timer.Timer', 'Timer', ([], {}), '()\n', (9794, 9796), Fa...
#Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt def initialize_parameters_deep(layer_dims, n): """ This function takes the numbers of layers to be used to build our model as input and otputs a dictonary containing weights and biases as parameters to be learned...
[ "numpy.random.seed", "numpy.maximum", "numpy.sum", "numpy.argmax", "numpy.ones", "numpy.exp", "pandas.DataFrame", "numpy.multiply", "numpy.random.randn", "numpy.max", "numpy.divide", "matplotlib.pyplot.show", "numpy.random.permutation", "numpy.dot", "numpy.squeeze", "matplotlib.pyplot....
[((975, 992), 'numpy.random.seed', 'np.random.seed', (['(3)'], {}), '(3)\n', (989, 992), True, 'import numpy as np\n'), ((2787, 2803), 'numpy.maximum', 'np.maximum', (['(0)', 'Z'], {}), '(0, Z)\n', (2797, 2803), True, 'import numpy as np\n'), ((3370, 3382), 'numpy.array', 'np.array', (['dA'], {}), '(dA)\n', (3378, 3382...
""" This tar archive contains this README and the datasets used in the paper: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. On the Transfer of Disentangled Representations in Realistic Settings. ICLR 2021. If you use any of these datasets, please cite our paper as: @inproceedings{ d...
[ "sklearn.metrics.pairwise_distances", "numpy.asarray", "os.path.exists", "PIL.Image.open", "os.environ.get", "numpy.array", "os.path.join" ]
[((7814, 7833), 'PIL.Image.open', 'Image.open', (['file_fp'], {}), '(file_fp)\n', (7824, 7833), False, 'from PIL import Image\n'), ((4205, 4252), 'os.environ.get', 'os.environ.get', (['"""DISENTANGLEMENT_LIB_DATA"""', '"""."""'], {}), "('DISENTANGLEMENT_LIB_DATA', '.')\n", (4219, 4252), False, 'import os\n'), ((4308, 4...
import numpy as np def X_Z(Z): """a function to calculate equation 3 of KS91 X gives the optical pathlength through the atmosphere at a given zenith distance Z (where Z is given in degrees) """ X = np.power(1 - 0.96*np.sin(Z*np.pi/180.)*np.sin(Z*np.pi/180.), -0.5) return X def B_zee(B...
[ "numpy.power", "numpy.sin", "numpy.abs", "numpy.cos" ]
[((860, 896), 'numpy.power', 'np.power', (['(10)', '(-0.4 * kappa * (X - 1))'], {}), '(10, -0.4 * kappa * (X - 1))\n', (868, 896), True, 'import numpy as np\n'), ((1932, 1963), 'numpy.power', 'np.power', (['(10)', '(6.15 - rho / 40.0)'], {}), '(10, 6.15 - rho / 40.0)\n', (1940, 1963), True, 'import numpy as np\n'), ((2...
import math import warnings import os.path from collections import OrderedDict import numpy as np from astropy.table import Table from astropy import constants as const import astropy.units as u from dust_extinction.parameter_averages import CCM89 from dust_extinction.shapes import _curve_F99_method __all__ = ["St...
[ "numpy.sum", "numpy.nanmedian", "numpy.argsort", "numpy.full", "astropy.constants.c.to", "numpy.power", "numpy.isfinite", "numpy.log10", "numpy.average", "math.sqrt", "numpy.square", "astropy.units.spectral_density", "astropy.table.Table.read", "numpy.concatenate", "dust_extinction.shape...
[((570, 592), 'astropy.constants.c.to', 'const.c.to', (['"""micron/s"""'], {}), "('micron/s')\n", (580, 592), True, 'from astropy import constants as const\n'), ((1668, 1681), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1679, 1681), False, 'from collections import OrderedDict\n'), ((1708, 1721), 'colle...
import json, os import random import cv2 import numpy as np import pandas as pd import umap from sklearn.decomposition import PCA import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.ensemble import RandomForestClassifier as RFC from sklearn.ensemble import ExtraTreesClassifier as ETC ...
[ "numpy.load", "sklearn.externals.joblib.dump", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "numpy.asarray", "umap.UMAP", "matplotlib.pyplot.figure" ]
[((411, 443), 'numpy.load', 'np.load', (['"""./models/features.npy"""'], {}), "('./models/features.npy')\n", (418, 443), True, 'import numpy as np\n'), ((973, 1058), 'umap.UMAP', 'umap.UMAP', ([], {'n_neighbors': '(15)', 'n_components': 'dim', 'metric': '"""euclidean"""', 'random_state': '(10)'}), "(n_neighbors=15, n_c...
# yellowbrick.target.binning # Implementations of histogram with vertical lines to help with balanced binning. # # Author: <NAME> (<EMAIL>) # Author: <NAME> (<EMAIL>) # Created: Tue Mar 13 19:50:54 2018 -0400 # # Copyright (C) 2018 District Data Labs # For license information, see LICENSE.txt # # ID: binning.py ...
[ "numpy.histogram", "yellowbrick.exceptions.YellowbrickValueError" ]
[((2466, 2497), 'numpy.histogram', 'np.histogram', (['y'], {'bins': 'self.bins'}), '(y, bins=self.bins)\n', (2478, 2497), True, 'import numpy as np\n'), ((3213, 3289), 'yellowbrick.exceptions.YellowbrickValueError', 'YellowbrickValueError', (['"""y needs to be an array or Series with one dimension"""'], {}), "('y needs...
import random import numpy as np import pygame import pathlib import math import Environment InterfaceDir = pathlib.Path(pathlib.Path(__file__).resolve().parent, "sprites", "interface") class Unit(pygame.sprite.Sprite): """Элемент на плоскости. Базовый класс.""" # Инициализация класса. Создание внутренних пер...
[ "random.randint", "math.sqrt", "pygame.Surface", "numpy.zeros", "numpy.isnan", "pathlib.Path", "numpy.array", "pygame.sprite.Sprite.__init__" ]
[((413, 431), 'numpy.zeros', 'np.zeros', (['(2)', 'float'], {}), '(2, float)\n', (421, 431), True, 'import numpy as np\n'), ((499, 534), 'pygame.sprite.Sprite.__init__', 'pygame.sprite.Sprite.__init__', (['self'], {}), '(self)\n', (528, 534), False, 'import pygame\n'), ((571, 595), 'pygame.Surface', 'pygame.Surface', (...
"""Some different plots, example of shockwave in ngsim I-80 data, FD plots.""" import havsim import pickle with open('recon-ngsim-old.pkl', 'rb') as f: meas, platooninfo = pickle.load(f) platoon = [1732, 1739, 1746, 1748, 1755, 1765, 1772, 1780, 1793, 1795, 1804, 1810, 1817, 1821, 1829, 1845, 1851, 186...
[ "havsim.simulation.Vehicle", "numpy.divide", "matplotlib.pyplot.plot", "math.tanh", "havsim.simulation.models.IDM_parameters", "havsim.plotting.animatetraj", "havsim.plotting.animatetvhd", "numpy.arange", "pickle.load", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot...
[((588, 692), 'havsim.plotting.animatetraj', 'havsim.plotting.animatetraj', (['meas', 'platooninfo'], {'platoon': 'platoon', 'speed_limit': '[0, 50]', 'show_ID': '(False)'}), '(meas, platooninfo, platoon=platoon, speed_limit\n =[0, 50], show_ID=False)\n', (615, 692), False, 'import havsim\n'), ((689, 754), 'havsim.p...
# Optimal Multi-Loan Payment Scheduler with Minimum Payment Constraints # <NAME> # 2/19/2020 # Main -------------------------- def opt_pay_schedule( term_months=[80, 120, 100, 100], # loan term in months principal_initial=[9871.59, 11040.71, 20879.70, 19940.74], # starting princip...
[ "sys.path.append", "numpy.array", "ortools.linear_solver.pywraplp.Solver" ]
[((828, 866), 'sys.path.append', 'sys.path.append', (['"""C:/gitrepo/or-tools"""'], {}), "('C:/gitrepo/or-tools')\n", (843, 866), False, 'import sys\n'), ((1001, 1022), 'numpy.array', 'np.array', (['rate_yearly'], {}), '(rate_yearly)\n', (1009, 1022), True, 'import numpy as np\n'), ((1187, 1261), 'ortools.linear_solver...
""" Bayesian Search Check out https://www.iro.umontreal.ca/~bengioy/cifar/NCAP2014-summerschool/slides/Ryan_adams_140814_bayesopt_ncap.pdf for explanation of bayesian optimization We do bayesian optimization and handle the cases where some X values are integers as well as the case where X is very large. """ import...
[ "numpy.random.uniform", "math.isnan", "numpy.argmax", "numpy.std", "numpy.empty", "wandb.sweeps.params.HyperParameterSet.from_config", "numpy.isnan", "numpy.append", "numpy.min", "numpy.mean", "numpy.array", "numpy.random.randint", "numpy.logaddexp", "numpy.random.choice", "numpy.exp", ...
[((647, 685), 'wandb.util.get_module', 'get_module', (['"""sklearn.gaussian_process"""'], {}), "('sklearn.gaussian_process')\n", (657, 685), False, 'from wandb.util import get_module\n'), ((700, 725), 'wandb.util.get_module', 'get_module', (['"""scipy.stats"""'], {}), "('scipy.stats')\n", (710, 725), False, 'from wandb...
import sys import numpy as np class Tile(): def __init__(self, id, board): self.id = id self.board = board # N, E, S, W self.edge_values = list() self.edge_values.append(to_number(self.board[0])) self.edge_values.append(to_number(self.board.T[len(self.board) - 1])) ...
[ "numpy.array" ]
[((1640, 1666), 'numpy.array', 'np.array', (['board'], {'dtype': 'int'}), '(board, dtype=int)\n', (1648, 1666), True, 'import numpy as np\n')]
import numpy as np from torch.utils.data.sampler import BatchSampler class MemoryOverSampler(BatchSampler): def __init__(self, y, memory_flags, batch_size=128, **kwargs): self.indexes = self._oversample(y, memory_flags) self.batch_size = batch_size def __len__(self): return len(self.i...
[ "numpy.random.shuffle", "numpy.concatenate", "numpy.where", "numpy.random.choice", "numpy.bincount", "numpy.unique" ]
[((380, 411), 'numpy.random.shuffle', 'np.random.shuffle', (['self.indexes'], {}), '(self.indexes)\n', (397, 411), True, 'import numpy as np\n'), ((1084, 1096), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (1093, 1096), True, 'import numpy as np\n'), ((1193, 1216), 'numpy.concatenate', 'np.concatenate', (['indexe...
#!/usr/bin/env python # Program: polyfold.py # Version: 1.1 # Author: <NAME> <<EMAIL>>/ <NAME> <<EMAIL>> # Description: # Reads an FT1 file with geocentered event times and # folds according to a polyco.dat file generated by tempo2 at the geocenter site ("coe") # Then, fits TOAs and outputs them in tempo2 format. from ...
[ "optparse.OptionParser", "astropy.log.info", "pylab.axes", "numpy.histogram", "pylab.figure", "numpy.arange", "numpy.mean", "pylab.ylabel", "numpy.append", "pylab.ylim", "numpy.linspace", "pylab.xlabel", "numpy.loadtxt", "astropy.log.warning", "pint.fits_utils.read_fits_event_mjds", "a...
[((796, 867), 'optparse.OptionParser', 'OptionParser', ([], {'usage': '""" %prog [options] [FT1_FILENAME]"""', 'description': 'desc'}), "(usage=' %prog [options] [FT1_FILENAME]', description=desc)\n", (808, 867), False, 'from optparse import OptionParser\n'), ((2115, 2134), 'astropy.io.fits.open', 'pyfits.open', (['evn...
#!/usr/bin/env python """ Plot the distribution of the weights of a layer of the NN """ import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.mlab as mlab from argparse import ArgumentParser if __name__ == '__main__': parser = ArgumentParser(description="A si...
[ "numpy.load", "matplotlib.use", "argparse.ArgumentParser", "matplotlib.pyplot.savefig" ]
[((126, 147), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (140, 147), False, 'import matplotlib\n'), ((288, 403), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""A simple utility to plot the distrubtion of weights of tensorpack networks."""'}), "(description=\n 'A simp...
from neural_persona.models import BasicL from neural_persona.common import PROJ_DIR from neural_persona.common.util import partition_labeling, movies_ontology, variation_of_information, purity from allennlp.models.archival import load_archive from sklearn.manifold import TSNE from sklearn.decomposition import PCA impor...
[ "matplotlib.pyplot.title", "numpy.argmax", "numpy.isnan", "matplotlib.pyplot.figure", "pprint.pprint", "glob.glob", "scipy.stats.describe", "neural_persona.common.util.variation_of_information", "matplotlib.pyplot.close", "os.path.dirname", "neural_persona.common.util.partition_labeling", "mat...
[((370, 393), 'matplotlib.use', 'matplotlib.use', (['"""tkagg"""'], {}), "('tkagg')\n", (384, 393), False, 'import matplotlib\n'), ((2323, 2354), 'neural_persona.common.util.partition_labeling', 'partition_labeling', (['(lambda x: x)'], {}), '(lambda x: x)\n', (2341, 2354), False, 'from neural_persona.common.util impor...
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "mindspore.context.set_context", "numpy.random.seed", "numpy.maximum", "mindspore.Tensor", "numpy.random.normal", "mindspore.ops.operations._grad_ops.MaximumGrad" ]
[((1096, 1113), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1110, 1113), True, 'import numpy as np\n'), ((1767, 1862), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'enable_graph_kernel': '(True)', 'device_target': '"""GPU"""'}), "(mode=context.GRAPH_MOD...
# run with python3 # pip install sklearn # pip install seaborn import sys import boto3 import logging import json from sklearn.metrics import confusion_matrix import seaborn as sn import pandas as pd import numpy as np from botocore.exceptions import ClientError # bucket = <<'name of the bucket hosting the mammograph...
[ "logging.error", "boto3.client", "numpy.argmax", "logging.warning", "sys.exit", "logging.info", "sklearn.metrics.confusion_matrix", "logging.getLogger" ]
[((2313, 2332), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (2330, 2332), False, 'import logging\n'), ((2432, 2457), 'boto3.client', 'boto3.client', (['"""sagemaker"""'], {}), "('sagemaker')\n", (2444, 2457), False, 'import boto3\n'), ((2478, 2511), 'boto3.client', 'boto3.client', (['"""runtime.sagemake...
""" GBTIDL SDFITS file ================== GBTIDL SDFITS files representing GBT observing sessions can be read into pyspeckit. Additional documentation is needed. Nodding reduction is supported, frequency switching is not. """ from __future__ import print_function from six import iteritems try: import astropy.io...
[ "pyfits.Header", "pyspeckit.ObsBlock", "numpy.isscalar", "numpy.median", "pyfits.open", "coords.Position", "numpy.float", "numpy.max", "numpy.diff", "pyfits.PrimaryHDU", "numpy.array", "numpy.where", "six.iteritems", "numpy.round", "numpy.unique", "pyspeckit.Spectrum" ]
[((2733, 2748), 'pyfits.Header', 'pyfits.Header', ([], {}), '()\n', (2746, 2748), False, 'import pyfits\n'), ((3045, 3088), 'pyfits.PrimaryHDU', 'pyfits.PrimaryHDU', ([], {'data': 'data', 'header': 'header'}), '(data=data, header=header)\n', (3062, 3088), False, 'import pyfits\n'), ((3098, 3140), 'pyspeckit.Spectrum', ...
# Sort segments import os import cv2 import numpy as np from plantcv.plantcv import dilate from plantcv.plantcv import params from plantcv.plantcv import plot_image from plantcv.plantcv import print_image from plantcv.plantcv import logical_and from plantcv.plantcv.morphology import find_tips def segment_sort(skel_i...
[ "plantcv.plantcv.dilate", "plantcv.plantcv.logical_and", "plantcv.plantcv.plot_image", "numpy.sum", "plantcv.plantcv.morphology.find_tips", "cv2.cvtColor", "numpy.zeros", "cv2.drawContours" ]
[((1504, 1523), 'plantcv.plantcv.morphology.find_tips', 'find_tips', (['skel_img'], {}), '(skel_img)\n', (1513, 1523), False, 'from plantcv.plantcv.morphology import find_tips\n'), ((1539, 1561), 'plantcv.plantcv.dilate', 'dilate', (['tips_img', '(3)', '(1)'], {}), '(tips_img, 3, 1)\n', (1545, 1561), False, 'from plant...
from argparse import ArgumentParser from io import BytesIO from os import makedirs import numpy as np import torch torch.set_printoptions(linewidth=130, sci_mode=False) np.set_printoptions(linewidth=130, suppress=True) def reshard(x, old_shape): import jax.numpy as jnp if len(x.shape) == 1: ...
[ "numpy.stack", "torch.ones", "io.BytesIO", "numpy.set_printoptions", "numpy.load", "os.makedirs", "argparse.ArgumentParser", "torch.stack", "jax.numpy.transpose", "torch.load", "numpy.dtype", "numpy.split", "torch.save", "torch.set_printoptions", "numpy.squeeze", "torch.tensor" ]
[((126, 179), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'linewidth': '(130)', 'sci_mode': '(False)'}), '(linewidth=130, sci_mode=False)\n', (148, 179), False, 'import torch\n'), ((181, 230), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(130)', 'suppress': '(True)'}), '(linewidth=...
"""Dataset interface for MovieLens 100k dataset. MovieLens 100k dataset: https://grouplens.org/datasets/movielens/100k/ """ import os import numpy as np import random as rd from sklearn.preprocessing import OrdinalEncoder from sklearn.model_selection import ShuffleSplit from deep4rec.datasets.dataset import Datase...
[ "random.sample", "numpy.zeros", "os.path.exists", "random.choice", "numpy.array", "sklearn.model_selection.ShuffleSplit", "os.path.join", "deep4rec.utils.maybe_uncompress" ]
[((902, 950), 'os.path.join', 'os.path.join', (['self.output_dir', 'self.dataset_name'], {}), '(self.output_dir, self.dataset_name)\n', (914, 950), False, 'import os\n'), ((1462, 1499), 'deep4rec.utils.maybe_uncompress', 'utils.maybe_uncompress', (['self.zip_path'], {}), '(self.zip_path)\n', (1484, 1499), True, 'import...
""" Prepare templates for use with paintbox. These models have lower resolution in relation to CvD models, but the python-FSPS package provides a simple way to calculate the M/L of the models. """ import os import itertools import numpy as np import astropy.units as u import astropy.constants as const from astropy.tab...
[ "os.mkdir", "tqdm.tqdm", "astropy.table.Table", "fsps.list_filters", "astropy.io.fits.BinTableHDU", "numpy.power", "astropy.io.fits.PrimaryHDU", "os.path.exists", "numpy.array", "numpy.arange", "astropy.table.hstack", "fsps.StellarPopulation", "itertools.product", "astropy.io.fits.HDUList"...
[((735, 754), 'fsps.list_filters', 'fsps.list_filters', ([], {}), '()\n', (752, 754), False, 'import fsps\n'), ((764, 1035), 'fsps.StellarPopulation', 'fsps.StellarPopulation', ([], {'compute_vega_mags': '(False)', 'zcontinuous': '(1)', 'sfh': '(0)', 'logzsol': '(0.0)', 'dust_type': '(2)', 'dust2': '(0.0)', 'add_agb_du...
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*- """ GROM.plotTool ~~~~~~~~~~~~~ This is the main program with its GUI :copyright: (c) 2015 by <NAME>. :license: GPL, see LICENSE for more details. """"" from __future__ import absolute_import import sys import random import matplotlib matplotlib.u...
[ "PyQt5.QtCore.pyqtSignal", "os.remove", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "PyQt5.QtCore.QFileInfo", "PyQt5.QtCore.QThread.start", "PyQt5.QtCore.QFile", "PyQt5.QtCore.QTextStream", "PyQt5.QtWidgets.QFileDialog.getSaveFileName", "matplotlib.use", "numpy.array", "PyQt5.QtCore.py...
[((308, 332), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (322, 332), False, 'import matplotlib\n'), ((2607, 2642), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['QString'], {'name': '"""newData"""'}), "(QString, name='newData')\n", (2617, 2642), False, 'from PyQt5.QtCore import pyqtSignal\...
import numpy as np class Condense: def __init__(self, nbbyzwrks): self.__nbbyzwrks = nbbyzwrks def aggregate(self, gradients, p=0.9): """ NaN-resilient median coordinate-per-coordinate rule. Args: gradients Non-empty list of gradients to aggregate f Number...
[ "numpy.median" ]
[((809, 837), 'numpy.median', 'np.median', (['gradients'], {'axis': '(0)'}), '(gradients, axis=0)\n', (818, 837), True, 'import numpy as np\n')]
import cv2 import numpy as np import glob from util import smart_hsv_range LOWER_HSV, UPPER_HSV = (112, 80, 0), (124, 255, 255) IMAGE_GLOB = 'cryptobox/images/blue*.jpg' MIN_DIMENSION = 360 def nothing(): pass cv2.namedWindow("image") cv2.createTrackbar("open_size", "image", 0, 25, nothing) cv2.createTrackba...
[ "cv2.resize", "cv2.createTrackbar", "util.smart_hsv_range", "cv2.cvtColor", "cv2.morphologyEx", "cv2.waitKey", "cv2.imshow", "numpy.ones", "cv2.imread", "glob.glob", "cv2.getTrackbarPos", "cv2.destroyAllWindows", "cv2.namedWindow" ]
[((220, 244), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (235, 244), False, 'import cv2\n'), ((246, 302), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""open_size"""', '"""image"""', '(0)', '(25)', 'nothing'], {}), "('open_size', 'image', 0, 25, nothing)\n", (264, 302), False, 'impor...
#! /usr/bin/env python2 import numpy as np import sys,os,time import argparse sys.path.append(os.environ['MRFLOW_HOME']) # Local imports from utils import flow_homography as fh from utils import compute_figure def structure_to_flow(structure, q, mu, H, b, params): """Convert structure back to full flow ""...
[ "sys.path.append", "utils.compute_figure.plot_figure_video_pasted_example", "numpy.maximum", "utils.compute_figure.plot_figure_95", "utils.flow_homography.get_full_flow", "sys.exit", "numpy.sqrt" ]
[((80, 122), 'sys.path.append', 'sys.path.append', (["os.environ['MRFLOW_HOME']"], {}), "(os.environ['MRFLOW_HOME'])\n", (95, 122), False, 'import sys, os, time\n'), ((451, 493), 'numpy.sqrt', 'np.sqrt', (['((x - q[0]) ** 2 + (y - q[1]) ** 2)'], {}), '((x - q[0]) ** 2 + (y - q[1]) ** 2)\n', (458, 493), True, 'import nu...
import numpy as np from matplotlib import pyplot as plt import matplotlib.cm as cm def plot_vector(ax,uv,x=0,y=0,color=0): return ax.quiver(x,y,uv[0],uv[1],cm.hot(color,1),angles='xy',scale_units='xy',scale=1) def trans(A,xy): return xy.dot(A.T) def rot(deg): phi=np.pi*deg/180 return np.array([[np.co...
[ "matplotlib.pyplot.show", "numpy.sin", "numpy.array", "numpy.cos", "matplotlib.pyplot.gca", "numpy.sqrt", "matplotlib.pyplot.subplots", "matplotlib.cm.hot" ]
[((526, 540), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (538, 540), True, 'from matplotlib import pyplot as plt\n'), ((677, 693), 'numpy.array', 'np.array', (['[1, 0]'], {}), '([1, 0])\n', (685, 693), True, 'import numpy as np\n'), ((727, 743), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1]...
# coding: utf-8 """ Usage: asr.py run <protocol> <model> <scorer> [--subset=<subset>] asr.py evaluate <protocol> [--subset=<subset>] <protocol> pyannote Protocol, e.g. 'GameOfThrones.SpeakerDiarization.0' <model> path to deepspeech model, e.g. /path/to/deepspeech-0.7.3-models.pbmm <scorer> pa...
[ "docopt.docopt", "numpy.std", "pyannote.database.get_protocol", "spacy.gold.align", "pathlib.Path", "numpy.mean", "pyannote.database.FileFinder", "re.sub", "deepspeech.Model" ]
[((1522, 1533), 'spacy.gold.align', 'align', (['a', 'b'], {}), '(a, b)\n', (1527, 1533), False, 'from spacy.gold import align\n'), ((3205, 3220), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (3211, 3220), False, 'from docopt import docopt\n'), ((3387, 3443), 'pyannote.database.get_protocol', 'get_protoc...
""" precompile-demo.py: Showcasing usage of the precompile functionality Author: <NAME> - Quantum Machines Created: 7/11/2020 Created on QUA version: 0.5.138 """ import time from qm.QuantumMachinesManager import QuantumMachinesManager from qm.qua import * import numpy as np arb_len = 1000 config = { ...
[ "numpy.random.uniform", "numpy.std", "time.time", "numpy.mean", "qm.QuantumMachinesManager.QuantumMachinesManager" ]
[((1378, 1402), 'qm.QuantumMachinesManager.QuantumMachinesManager', 'QuantumMachinesManager', ([], {}), '()\n', (1400, 1402), False, 'from qm.QuantumMachinesManager import QuantumMachinesManager\n'), ((1761, 1772), 'time.time', 'time.time', ([], {}), '()\n', (1770, 1772), False, 'import time\n'), ((1987, 1998), 'time.t...
# -*- coding: utf-8 -*- """Helper classes for the adaptive sampling demo. See sampling.py for further details. Author: <NAME> Created on Thu Aug 21 12:00:00 2020 """ import numpy as np import matplotlib.pyplot as plt def circle_simulator_func(X, power=2): circle_centers = [[1,0], [0,1]] ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "numpy.ravel", "matplotlib.pyplot.scatter", "numpy.power", "numpy.any", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.contourf"...
[((1471, 1498), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (1481, 1498), True, 'import matplotlib.pyplot as plt\n'), ((2422, 2468), 'matplotlib.pyplot.scatter', 'plt.scatter', (['X[f == 0, 0]', 'X[f == 0, 1]'], {'c': '"""r"""'}), "(X[f == 0, 0], X[f == 0, 1], c='r')\n...
import cv2 import numpy as np marker_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_50) for i in range(4): image = np.zeros((512, 512, 1), dtype=np.uint8) cv2.aruco.drawMarker(marker_dict, i, 512, image, 1) cv2.imwrite("marker_%i.jpg" % i, image)
[ "cv2.imwrite", "cv2.aruco.drawMarker", "numpy.zeros", "cv2.aruco.getPredefinedDictionary" ]
[((45, 101), 'cv2.aruco.getPredefinedDictionary', 'cv2.aruco.getPredefinedDictionary', (['cv2.aruco.DICT_4X4_50'], {}), '(cv2.aruco.DICT_4X4_50)\n', (78, 101), False, 'import cv2\n'), ((134, 173), 'numpy.zeros', 'np.zeros', (['(512, 512, 1)'], {'dtype': 'np.uint8'}), '((512, 512, 1), dtype=np.uint8)\n', (142, 173), Tru...
import numpy as np def datacheck(data: list, numstates: int, toltime: float) -> bool: eligiblestates = range(numstates) for exid, example in enumerate(data): states = example[0] times = example[1] if not np.all(np.isin(states, eligiblestates)): raise Exception( ...
[ "numpy.isin", "numpy.unique" ]
[((248, 279), 'numpy.isin', 'np.isin', (['states', 'eligiblestates'], {}), '(states, eligiblestates)\n', (255, 279), True, 'import numpy as np\n'), ((435, 452), 'numpy.unique', 'np.unique', (['states'], {}), '(states)\n', (444, 452), True, 'import numpy as np\n')]
""" clone from https://github.com/scivision/soothing-sounds https://github.com/python-acoustics LICENSE: GPL-3.0 """ """ # Generator The generator module provides signal generators. The following functions calculate `N` samples and return an array containing the samples. For indefinitely long iteration over the sa...
[ "numpy.abs", "scipy.fftpack.rfft", "numpy.random.randn", "numpy.arange", "scipy.fftpack.irfft" ]
[((3844, 3861), 'numpy.arange', 'np.arange', (['X.size'], {}), '(X.size)\n', (3853, 3861), True, 'import numpy as np\n'), ((2617, 2624), 'scipy.fftpack.rfft', 'rfft', (['x'], {}), '(x)\n', (2621, 2624), False, 'from scipy.fftpack import rfft, irfft\n'), ((3055, 3062), 'scipy.fftpack.rfft', 'rfft', (['x'], {}), '(x)\n',...
import numpy as np from os import listdir from os.path import isfile, isdir, join import os #import json import random from subprocess import call random.seed(0) cwd = os.getcwd() source_path = join(cwd, 'source/Plantae') data_path = join(cwd, 'images') if not os.path.exists(data_path): os.makedirs(data_path) sa...
[ "os.makedirs", "os.getcwd", "random.shuffle", "os.path.exists", "numpy.argsort", "random.seed", "subprocess.call", "numpy.array", "os.path.join", "os.listdir" ]
[((148, 162), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (159, 162), False, 'import random\n'), ((170, 181), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (179, 181), False, 'import os\n'), ((196, 223), 'os.path.join', 'join', (['cwd', '"""source/Plantae"""'], {}), "(cwd, 'source/Plantae')\n", (200, 223), Fals...
import copy import numpy as np def solve_ordid(eq): """ Solves a0*x + a1 + ... + aN = b given as a list like `[a0, ..., aN, b]`. """ xloc = np.min(np.argwhere(eq != 0)) eq = np.array([val for val in eq[xloc:]]) return (eq[-1] - sum(eq[1:-1]))/eq[0] def solve_triang_mat(mat, shape = 'upper-rig...
[ "copy.deepcopy", "numpy.nonzero", "numpy.array", "numpy.argwhere", "numpy.concatenate" ]
[((195, 231), 'numpy.array', 'np.array', (['[val for val in eq[xloc:]]'], {}), '([val for val in eq[xloc:]])\n', (203, 231), True, 'import numpy as np\n'), ((942, 960), 'copy.deepcopy', 'copy.deepcopy', (['mat'], {}), '(mat)\n', (955, 960), False, 'import copy\n'), ((164, 184), 'numpy.argwhere', 'np.argwhere', (['(eq !...
from typing import Tuple import pygame import numpy as np class SoundGame: def __init__(self, set_point: float, ctr_interval: Tuple, initial_state=0): self._sample_rate = 44100 self._amp = 4096 self._set_point = set_point self.ctr_interval = ctr_interval self._ctr_action =...
[ "pygame.sndarray.make_sound", "pygame.mixer.init", "numpy.zeros", "numpy.sin", "pygame.sndarray.samples" ]
[((382, 471), 'pygame.mixer.init', 'pygame.mixer.init', ([], {'frequency': 'self._sample_rate', 'size': '(-16)', 'channels': '(2)', 'buffer': '(2 ** 12)'}), '(frequency=self._sample_rate, size=-16, channels=2, buffer\n =2 ** 12)\n', (399, 471), False, 'import pygame\n'), ((553, 602), 'numpy.zeros', 'np.zeros', (['(s...
import gym from gym.wrappers import TimeLimit, Monitor import numpy as np from matplotlib import pyplot as plt from agent_dqn import Agent as DQNAgent # Task 4 from itertools import count import torch import cv2 import os import argparse from torch.utils.tensorboard import SummaryWriter from utils import plot_rewards ...
[ "matplotlib.pyplot.show", "gym.make", "matplotlib.pyplot.ioff", "argparse.ArgumentParser", "numpy.zeros", "numpy.mean", "numpy.array", "utils.plot_rewards", "agent_dqn.Agent" ]
[((489, 514), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (512, 514), False, 'import argparse\n'), ((1637, 1655), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (1645, 1655), False, 'import gym\n'), ((2761, 2871), 'agent_dqn.Agent', 'DQNAgent', (['env_name', 'observation_space_d...
import argparse import os import numpy as np from tqdm import tqdm import sys import torch from collections import OrderedDict from mypath import Path from dataloaders import make_data_loader from modeling.sync_batchnorm.replicate import patch_replication_callback from modeling.deeplab import * from utils.loss import S...
[ "numpy.load", "argparse.ArgumentParser", "numpy.argmax", "torch.cuda.device_count", "os.path.isfile", "torch.no_grad", "torch.ones", "utils.saver.Saver", "utils.loss.SegmentationLosses", "auto_deeplab.AutoDeeplab", "torch.load", "apex.amp.scale_loss", "torch.zeros", "tqdm.tqdm", "torch.m...
[((12698, 12767), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch DeeplabV3Plus Training"""'}), "(description='PyTorch DeeplabV3Plus Training')\n", (12721, 12767), False, 'import argparse\n'), ((19515, 19543), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.s...
import sys import requests import pandas as pd import numpy as np import pickle import shutil # This script will lookup new fx rates and save them # in a file called new_rates.csv # Manually validate the file, then replace the existing # rates.csv file CCY = "ccy" DATE = "date" RATE = "rate" def get_rates(code, ccy...
[ "pandas.read_csv", "numpy.isnan", "pandas.DataFrame.from_records", "shutil.copyfile", "pandas.concat" ]
[((861, 885), 'pandas.read_csv', 'pd.read_csv', (['"""codes.csv"""'], {}), "('codes.csv')\n", (872, 885), True, 'import pandas as pd\n'), ((894, 918), 'pandas.read_csv', 'pd.read_csv', (['"""rates.csv"""'], {}), "('rates.csv')\n", (905, 918), True, 'import pandas as pd\n'), ((1726, 1771), 'shutil.copyfile', 'shutil.cop...
import importlib import numpy import scipy from bench_core import gen_data from bench_core import run_benchmark from gen_graph import dw_graph from pprint import pprint # 10,000-10,000,000 # # 10000 # 100000 # 1000000 # 10000000 shapes = [] modules = ['numpy', 'scipy', 'nlcpy'] # 1-D shapes.append([ (10000,), ...
[ "pickle.dump", "importlib.import_module", "bench_core.gen_data", "bench_core.run_benchmark", "numpy.testing.assert_allclose" ]
[((16869, 16892), 'pickle.dump', 'pickle.dump', (['result', 'fo'], {}), '(result, fo)\n', (16880, 16892), False, 'import pickle\n'), ((2144, 2189), 'numpy.testing.assert_allclose', 'numpy.testing.assert_allclose', (['res_np', 'res_vp'], {}), '(res_np, res_vp)\n', (2173, 2189), False, 'import numpy\n'), ((2202, 2247), '...
import os.path as osp from PIL import Image import numpy as np import pandas as pd import random import torch from torch.utils.data import Dataset from torchvision import transforms ROOT_PATH = './materials/' class MiniImageNet(Dataset): def __init__(self, setname): csv_path = osp.join(ROOT_PATH, setn...
[ "pandas.DataFrame", "pandas.read_csv", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor", "PIL.Image.open", "numpy.array", "numpy.random.choice", "numpy.argwhere", "torchvision.transforms.CenterCrop", "torchvision.transforms.Resize", "os.path.join", "numpy.random.shuffle", ...
[((1676, 1713), 'os.path.join', 'osp.join', (['ROOT_PATH', "(setname + '.csv')"], {}), "(ROOT_PATH, setname + '.csv')\n", (1684, 1713), True, 'import os.path as osp\n'), ((1731, 1768), 'os.path.join', 'osp.join', (['ROOT_PATH', "('unsup' + '.csv')"], {}), "(ROOT_PATH, 'unsup' + '.csv')\n", (1739, 1768), True, 'import o...
import matplotlib import matplotlib.pyplot as plt import numpy as np # Define the image channels CHANNELS = ['R','G','B'] def plot_im_frame(f_path,frame): """ To perform separated plots of each channel of image frame Parameters ---------- f_path : string_like path directory where the im...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.figure", "matplotlib.pyplot.imread", "matplotlib.patches.Rectangle", "matplotlib.pyplot.imshow", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "matplotlib.pyplot.colorbar", "numpy.max", "numpy.linspace", "matplotlib.pyplot.xticks", "matplo...
[((394, 406), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (404, 406), True, 'import matplotlib.pyplot as plt\n'), ((416, 442), 'matplotlib.pyplot.imread', 'plt.imread', (['(f_path % frame)'], {}), '(f_path % frame)\n', (426, 442), True, 'import matplotlib.pyplot as plt\n'), ((445, 459), 'matplotlib.pypl...
import numpy as np import random import torch import torch.nn.functional as F from torch.autograd import Variable from torch.utils.data.sampler import Sampler from sklearn.metrics import confusion_matrix import matplotlib.pyplot as plt import re import itertools import matplotlib matplotlib.use('AGG') import logging im...
[ "torch.ones_like", "copy.deepcopy", "math.exp", "torch.autograd.Variable", "torch.nn.KLDivLoss", "logging.StreamHandler", "numpy.zeros", "torch.nn.functional.cross_entropy", "logging.getLogger", "time.time", "logging.Formatter", "torch.nn.functional.softmax", "matplotlib.use", "torch.nn.fu...
[((281, 302), 'matplotlib.use', 'matplotlib.use', (['"""AGG"""'], {}), "('AGG')\n", (295, 302), False, 'import matplotlib\n'), ((810, 829), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (827, 829), False, 'import logging\n'), ((985, 997), 'os.isatty', 'os.isatty', (['(2)'], {}), '(2)\n', (994, 997), False...
import os import copy import logging import csv import numpy from pprint import pprint logging.basicConfig(format='%(levelname)s at %(asctime)s (file %(filename)s :: %(lineno)d): %(message)s') def convert_mat(mat, dtype): ''' Convert a matrix to a given datatype ''' return numpy.array(mat).astype(dtyp...
[ "copy.deepcopy", "logging.error", "csv.reader", "os.remove", "logging.basicConfig", "numpy.array", "pprint.pprint" ]
[((88, 203), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s at %(asctime)s (file %(filename)s :: %(lineno)d): %(message)s"""'}), "(format=\n '%(levelname)s at %(asctime)s (file %(filename)s :: %(lineno)d): %(message)s'\n )\n", (107, 203), False, 'import logging\n'), ((1629, 1674),...
#!/usr/bin/env python # Copyright 2013-2019 <NAME>, <NAME> (<EMAIL>, <EMAIL>) # # 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 requir...
[ "numpy.zeros_like", "numpy.sum", "numpy.log", "scipy.linalg.cholesky", "numpy.zeros", "numpy.empty_like", "numpy.isinf", "numpy.errstate", "numpy.random.gamma", "numpy.ndim", "numpy.ones", "numpy.expand_dims", "numpy.arange", "numpy.exp", "numpy.matmul", "numpy.eye", "numpy.diag", ...
[((4040, 4049), 'numpy.sum', 'np.sum', (['G'], {}), '(G)\n', (4046, 4049), True, 'import numpy as np\n'), ((4313, 4346), 'numpy.eye', 'np.eye', (['(minDur * maxSpeakers)'], {'k': '(1)'}), '(minDur * maxSpeakers, k=1)\n', (4319, 4346), True, 'import numpy as np\n'), ((4354, 4384), 'numpy.zeros', 'np.zeros', (['(minDur *...
############################################ # imports ############################################ import joblib import numpy as np import pandas as pd from sklearn_extra.cluster import KMedoids from fgclustering.utils import * from fgclustering.statistics import compute_balanced_average_impurity, compute_total_wit...
[ "sklearn_extra.cluster.KMedoids", "fgclustering.statistics.compute_total_within_cluster_variation", "pandas.DataFrame.from_dict", "pandas.read_csv", "numpy.array", "pandas.Series", "fgclustering.statistics.get_feature_importance_clusterwise", "fgclustering.statistics.feature_ranking", "fgclustering....
[((598, 639), 'pandas.Series', 'pd.Series', (['[0, 0, 0, 0, 0, 1, 1, 1, 1, 1]'], {}), '([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])\n', (607, 639), True, 'import pandas as pd\n'), ((652, 692), 'numpy.array', 'np.array', (['[0, 0, 0, 0, 0, 1, 1, 1, 1, 1]'], {}), '([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])\n', (660, 692), True, 'import numpy ...
import argparse import numpy as np import os import pandas as pd from tqdm import tqdm import yaml import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.utils.data.sampler import SequentialSampler, RandomSampler from segmentation_models_pytorch.utils.losses import DiceLoss from segment...
[ "yaml.load", "os.remove", "argparse.ArgumentParser", "pandas.read_csv", "torch.cuda.device_count", "dataset.RSNAPneuAuxDataset", "os.path.isfile", "numpy.mean", "torch.no_grad", "torch.cuda.amp.autocast", "segmentation_models_pytorch.utils.losses.DiceLoss", "torch.optim.lr_scheduler.CosineAnne...
[((535, 568), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (558, 568), False, 'import warnings\n'), ((579, 684), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(descrip...
# -*- coding: utf-8 -*- """ Created on Wed Mar 18 22:06:25 2020 @author: dougl """ import os from pathlib import Path from tensorflow.keras import applications, models, Model from tensorflow.keras.applications.resnet50 import preprocess_input from tensorflow.keras.preprocessing import image import numpy as np from ...
[ "tensorflow.keras.applications.resnet50.ResNet50", "os.path.isfile", "pathlib.Path", "os.path.join", "tensorflow.keras.applications.resnet50.preprocess_input", "pandas.DataFrame", "numpy.char.mod", "os.path.exists", "tensorflow.keras.preprocessing.image.load_img", "tensorflow.keras.models.load_mod...
[((1594, 1636), 'tensorflow.keras.preprocessing.image.load_img', 'image.load_img', (['fp'], {'target_size': '(224, 224)'}), '(fp, target_size=(224, 224))\n', (1608, 1636), False, 'from tensorflow.keras.preprocessing import image\n'), ((1757, 1780), 'tensorflow.keras.preprocessing.image.img_to_array', 'image.img_to_arra...
#!/usr/bin/env python # coding: utf-8 ''' ~~~~~~~~~~~~ JRC Ispra COVID-19 project, June 2020 ~~~~~~~~~~~~ [WORK IN PROGRESS] Python implementation of a family of epidemiological models and associated analysis instruments. We currently include: - /_data (demographic and epidemiological datasets) => see also init.py (d...
[ "getopt.getopt", "pandas.read_csv", "main.main_forecast", "datetime.datetime.utcnow", "numpy.arange", "pandas.DataFrame", "matplotlib.pyplot.close", "os.path.exists", "doc.docgenerator.docgenerator", "datetime.timedelta", "itertools.product", "doc.get_report_entry.get_report_entry", "os.syst...
[((2241, 2295), 'os.path.exists', 'os.path.exists', (['FILE_EPIDEMIOLOGY_WEBCRITECH_COUNTRIES'], {}), '(FILE_EPIDEMIOLOGY_WEBCRITECH_COUNTRIES)\n', (2255, 2295), False, 'import os\n'), ((2387, 2401), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (2396, 2401), False, 'import os\n'), ((2525, 2577), 'os.path.exists'...
import cv2 import numpy as np RED = (0, 0, 255) GREEN = (0, 255, 0) BLUE = (255, 0, 0) CYAN = (255, 255, 0) YELLOW = (0, 255, 255) ORANGE = (0, 165, 255) PURPLE = (255, 0, 255) """COCO_PAIR = [(0, 1), (0, 2), (1, 3), (2, 4), # Head (5, 6), (5, 7), (7, 9), (6, 8), (8, 10), (17, 11...
[ "cv2.circle", "numpy.expand_dims" ]
[((2143, 2195), 'cv2.circle', 'cv2.circle', (['frame', '(cor_x, cor_y)', '(3)', 'p_color[n]', '(-1)'], {}), '(frame, (cor_x, cor_y), 3, p_color[n], -1)\n', (2153, 2195), False, 'import cv2\n'), ((1895, 1941), 'numpy.expand_dims', 'np.expand_dims', (['((pts[1, :] + pts[2, :]) / 2)', '(0)'], {}), '((pts[1, :] + pts[2, :]...
# -*- coding: utf-8 -*- """ Created on Mon May 7 22:15:54 2018 @author: Steven """ import numpy as np def variance(q, AS, f): """ Determines the variance of the number of counts in each channel i of the vectorized version of the 2D coincidence spectrum for the qth iteration: -q(int) is the ...
[ "numpy.shape", "numpy.sum" ]
[((1062, 1073), 'numpy.shape', 'np.shape', (['f'], {}), '(f)\n', (1070, 1073), True, 'import numpy as np\n'), ((1077, 1088), 'numpy.shape', 'np.shape', (['f'], {}), '(f)\n', (1085, 1088), True, 'import numpy as np\n'), ((1112, 1123), 'numpy.shape', 'np.shape', (['f'], {}), '(f)\n', (1120, 1123), True, 'import numpy as ...
#!/usr/bin/env python import pygrib import numpy as np from os.path import exists from pandas import DatetimeIndex class ModelGrid(object): """ Base class for reading 2D model output grids from grib2 files. Given a list of file names, loads the values of a single variable from a model run. Supports model...
[ "numpy.datetime64", "pygrib.open", "os.path.exists", "pandas.DatetimeIndex" ]
[((1323, 1346), 'numpy.datetime64', 'np.datetime64', (['run_date'], {}), '(run_date)\n', (1336, 1346), True, 'import numpy as np\n'), ((1373, 1398), 'numpy.datetime64', 'np.datetime64', (['start_date'], {}), '(start_date)\n', (1386, 1398), True, 'import numpy as np\n'), ((1423, 1446), 'numpy.datetime64', 'np.datetime64...
from operator import is_ import matplotlib import matplotlib.pyplot as plt import numpy as np #get data n = 21 x = np.linspace(-1, 1, n) y = np.linspace(-1, 1, n) xv, yv = np.meshgrid(x, y) z = (xv**2 + yv**2) fig = plt.figure() ax = fig.add_subplot(111) ax.set_aspect(1.0, adjustable='box') h = plt.c...
[ "numpy.meshgrid", "matplotlib.pyplot.figure", "matplotlib.pyplot.contour", "numpy.linspace", "numpy.concatenate" ]
[((123, 144), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', 'n'], {}), '(-1, 1, n)\n', (134, 144), True, 'import numpy as np\n'), ((150, 171), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', 'n'], {}), '(-1, 1, n)\n', (161, 171), True, 'import numpy as np\n'), ((184, 201), 'numpy.meshgrid', 'np.meshgrid', (['x', ...
import numpy as np import os import torch import SimpleITK as sitk def compute_landmark_accuracy(landmarks_pred, landmarks_gt, voxel_size): landmarks_pred = np.round(landmarks_pred) landmarks_gt = np.round(landmarks_gt) difference = landmarks_pred - landmarks_gt difference = np.abs(difference) di...
[ "numpy.abs", "numpy.sum", "torch.stack", "numpy.std", "numpy.fromfile", "numpy.square", "numpy.dtype", "torch.FloatTensor", "SimpleITK.GetArrayFromImage", "torch.meshgrid", "numpy.mean", "torch.clamp", "torch.linspace", "numpy.round", "numpy.prod", "numpy.sqrt" ]
[((163, 187), 'numpy.round', 'np.round', (['landmarks_pred'], {}), '(landmarks_pred)\n', (171, 187), True, 'import numpy as np\n'), ((207, 229), 'numpy.round', 'np.round', (['landmarks_gt'], {}), '(landmarks_gt)\n', (215, 229), True, 'import numpy as np\n'), ((295, 313), 'numpy.abs', 'np.abs', (['difference'], {}), '(d...
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
[ "mindspore.nn.BatchNorm2d", "mindspore.ops.operations.Tanh", "numpy.abs", "mindspore.Tensor", "numpy.ones", "mindspore.ops.operations.Cast", "mindspore.ops.operations.BiasAdd", "numpy.random.randint", "mindspore.ops.operations.AssignSub", "mindspore.ops.operations.Sin", "mindspore.ops.operations...
[((1235, 1303), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': '"""Ascend"""'}), "(mode=context.GRAPH_MODE, device_target='Ascend')\n", (1254, 1303), False, 'from mindspore import context, Tensor\n'), ((1307, 1350), 'pytest.fixture', 'pytest.fixture', ([], {...
""" The Patchmatch Algorithm. The actual algorithm is a nearly line to line port of the original c++ version. The distance calculation is different to leverage numpy's vectorized operations. This version uses 4 images instead of 2. You can supply the same image twice to use patchmatch between 2 images. """ import os ...
[ "os.path.abspath", "numpy.zeros_like", "numpy.zeros", "pycuda.driver.In", "pycuda.driver.InOut", "numpy.int32", "os.path.join", "cv2.resize" ]
[((357, 382), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (372, 382), False, 'import os\n'), ((1494, 1530), 'numpy.zeros_like', 'np.zeros_like', (['img_a'], {'dtype': 'np.float'}), '(img_a, dtype=np.float)\n', (1507, 1530), True, 'import numpy as np\n'), ((2031, 2082), 'numpy.zeros', 'np.z...
""" Class of different utilities related to calculations useful for models """ import math import numpy as np import pandas as pd from sklearn.decomposition import PCA from sklearn.metrics import confusion_matrix def get_optimus_bins(feature_values, number_of_features): """ Get the optimus number of bins fo...
[ "pandas.DataFrame", "numpy.ceil", "math.pow", "numpy.empty", "numpy.power", "numpy.percentile", "math.log", "math.log10", "numpy.append", "sklearn.decomposition.PCA", "numpy.arange", "numpy.array", "sklearn.metrics.confusion_matrix", "numpy.log10", "numpy.unique" ]
[((1280, 1285), 'sklearn.decomposition.PCA', 'PCA', ([], {}), '()\n', (1283, 1285), False, 'from sklearn.decomposition import PCA\n'), ((1596, 1625), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'ncomponents'}), '(n_components=ncomponents)\n', (1599, 1625), False, 'from sklearn.decomposition import PCA\n')...
import gym_electric_motor.physical_systems.converters as cv from tests.testing_utils import PowerElectronicConverterWrapper, DummyConverter import gym_electric_motor as gem from functools import reduce import pytest import numpy as np import tests.conf as cf from gym_electric_motor.utils import make_module from...
[ "numpy.abs", "gym.spaces.Discrete", "numpy.ones", "numpy.random.randint", "numpy.arange", "gym_electric_motor.physical_systems.converters.DiscB6BridgeConverter", "pytest.mark.parametrize", "tests.testing_utils.DummyConverter", "numpy.zeros_like", "gym_electric_motor.physical_systems.converters.Con...
[((570, 600), 'numpy.array', 'np.array', (['[0.0, 1 / 20, 1 / 3]'], {}), '([0.0, 1 / 20, 1 / 3])\n', (578, 600), True, 'import numpy as np\n'), ((735, 748), 'numpy.arange', 'np.arange', (['(15)'], {}), '(15)\n', (744, 748), True, 'import numpy as np\n'), ((778, 822), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, ...
import warnings import torch from ood_samplefree.datasets import Uniform from ood_samplefree.features import OneClassSum from ..features.baselines import BaselineMonitor from ..features.batchnorm import BatchNormMonitor from ..features.latent import LatentMonitor, create_latent_saver from ..features.structures import...
[ "numpy.load", "numpy.save", "os.makedirs", "torch.utils.data.DataLoader", "os.path.exists", "ood_samplefree.features.OneClassSum", "numpy.hstack", "ood_samplefree.datasets.Uniform.same_as", "torch.cuda.is_available", "torch.device", "warnings.warn", "torch.no_grad", "os.path.expanduser", "...
[((904, 929), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (927, 929), False, 'import torch\n'), ((978, 997), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (990, 997), False, 'import torch\n'), ((1338, 1469), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', ([...
import argparse import torchvision.transforms as transforms import torch import torch.nn as nn import torch.optim as opt import numpy as np import srcnn_data_loader as SRCNN_DATA import torch.utils.data as data import srcnn_model import scipy.misc from math import log10 def saveImg(img, outFileName): img = img / 2...
[ "torch.nn.MSELoss", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "numpy.transpose", "torchvision.transforms.ToTensor", "torch.cuda.is_available", "torch.device", "srcnn_data_loader.SRCNN", "torchvision.transforms.Normalize", "srcnn_model.SRCNN" ]
[((457, 509), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch SRCNN"""'}), "(description='PyTorch SRCNN')\n", (480, 509), False, 'import argparse\n'), ((1640, 1732), 'srcnn_data_loader.SRCNN', 'SRCNN_DATA.SRCNN', ([], {'root_dir': '"""./dataset/train"""', 'transform': 'transform',...
""" The following code is from: https://adventuresinmachinelearning.com/reinforcement-learning-tutorial-python-keras/ The github link: https://github.com/adventuresinML/adventures-in-ml-code/blob/master/r_learning_python.py """ import gym import numpy as np from keras.models import Sequential from keras.layers import...
[ "gym.make", "numpy.identity", "matplotlib.pylab.plot", "keras.layers.Dense", "numpy.random.random", "matplotlib.pylab.xlabel", "keras.layers.InputLayer", "numpy.random.randint", "keras.models.Sequential", "matplotlib.pylab.ylabel", "matplotlib.pylab.show" ]
[((377, 398), 'gym.make', 'gym.make', (['"""NChain-v0"""'], {}), "('NChain-v0')\n", (385, 398), False, 'import gym\n'), ((487, 499), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (497, 499), False, 'from keras.models import Sequential\n'), ((1641, 1661), 'matplotlib.pylab.plot', 'plt.plot', (['r_avg_list']...
import numpy as np import math import cv2 import scipy.ndimage as ndimage import matplotlib.pyplot as plot import os from os.path import isfile, join def bwareafilt ( image ): ############Area filtering on binarized image to get rid of any noise######################## #Binary image type force image = image....
[ "cv2.GaussianBlur", "numpy.sum", "numpy.shape", "numpy.around", "numpy.sin", "os.path.join", "numpy.full", "numpy.multiply", "cv2.cvtColor", "cv2.resize", "numpy.square", "cv2.connectedComponentsWithStats", "numpy.cos", "os.listdir", "math.exp", "cv2.threshold", "numpy.zeros", "cv2...
[((6538, 6575), 'os.path.join', 'os.path.join', (['pathOut', '"""/stitch_th3/"""'], {}), "(pathOut, '/stitch_th3/')\n", (6550, 6575), False, 'import os\n'), ((6590, 6627), 'os.path.join', 'os.path.join', (['pathOut', '"""/stitch_th4/"""'], {}), "(pathOut, '/stitch_th4/')\n", (6602, 6627), False, 'import os\n'), ((6644,...
from __future__ import print_function from copy import deepcopy from functools import partial import multiprocessing import time import random import sys import traceback import yaml import weakref import meshcat import meshcat.geometry as meshcat_geom import meshcat.transformations as meshcat_tf import matplotlib.py...
[ "matplotlib.pyplot.title", "pyro.enable_validation", "matplotlib.pyplot.savefig", "random.sample", "scene_generation.data.dataset_utils.ProjectEnvironmentToFeasibility", "torch.set_default_tensor_type", "torch.empty", "matplotlib.pyplot.figure", "networkx.DiGraph.copy", "numpy.linalg.norm", "mat...
[((720, 758), 'torch.multiprocessing.set_sharing_strategy', 'mp.set_sharing_strategy', (['"""file_system"""'], {}), "('file_system')\n", (743, 758), True, 'import torch.multiprocessing as mp\n'), ((15083, 15095), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (15093, 15095), True, 'import networkx as nx\n'), ((166...
import os from os.path import join import argparse import re from collections import Counter, defaultdict import numpy as np def _make_n_gram(sequence, n=2): return (tuple(sequence[i:i+n]) for i in range(len(sequence)-(n-1))) def _count_data(path): """ count number of data in the given path""" matcher =...
[ "argparse.ArgumentParser", "numpy.std", "numpy.array", "collections.Counter", "os.path.join", "os.listdir", "re.compile" ]
[((321, 347), 're.compile', 're.compile', (['"""[0-9]+\\\\.dec"""'], {}), "('[0-9]+\\\\.dec')\n", (331, 347), False, 'import re\n'), ((411, 427), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (421, 427), False, 'import os\n'), ((570, 579), 'collections.Counter', 'Counter', ([], {}), '()\n', (577, 579), False,...
#!/usr/bin/env python # wujian@2018 import os import sys import glob import codecs import pickle import random import warnings import _thread import threading import subprocess from pathlib import Path import librosa as audio_lib import numpy as np import scipy.io as sio from io import TextIOWrapper, BytesIO from ...
[ "numpy.load", "numpy.abs", "scipy.io.loadmat", "random.sample", "pathlib.Path", "pickle.load", "numpy.linalg.norm", "glob.glob", "os.path.abspath", "codecs.open", "os.path.exists", "io.TextIOWrapper", "threading.Thread", "subprocess.Popen", "numpy.save", "io.BytesIO", "numpy.fromfile...
[((782, 872), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(command, shell=True, stdout=subprocess.PIPE, stderr=\n subprocess.PIPE)\n', (798, 872), False, 'import subprocess\n'), ((1405, 1466), 'subprocess.Popen', 'subprocess.P...
import os, numpy as np, cv2 as cv import matplotlib.pyplot as plt, pandas as pd from skimage import measure from skimage.exposure import equalize_adapthist from tqdm import tqdm from PIL import Image def make_clahe(img): clahe = cv.createCLAHE() new_img = img.copy() for c in range(3): new_img[..., ...
[ "numpy.argmax", "pandas.read_csv", "numpy.ones", "cv2.blur", "cv2.imread", "skimage.measure.label", "matplotlib.pyplot.imsave", "cv2.createCLAHE", "matplotlib.pyplot.imread", "os.listdir", "skimage.measure.regionprops", "numpy.sqrt" ]
[((404, 436), 'pandas.read_csv', 'pd.read_csv', (['"""data/metadata.csv"""'], {}), "('data/metadata.csv')\n", (415, 436), True, 'import matplotlib.pyplot as plt, pandas as pd\n'), ((234, 250), 'cv2.createCLAHE', 'cv.createCLAHE', ([], {}), '()\n', (248, 250), True, 'import os, numpy as np, cv2 as cv\n'), ((852, 877), '...
""" Data structures for ytree frontend. """ #----------------------------------------------------------------------------- # Copyright (c) ytree Development Team. All rights reserved. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this...
[ "numpy.full", "h5py.File", "json.loads", "numpy.subtract", "os.path.exists", "numpy.zeros", "numpy.mod", "yt.data_objects.static_output.validate_index_order", "numpy.ones", "numpy.arange", "ytree.utilities.io.parse_h5_attr", "numpy.add", "numpy.digitize", "os.path.join" ]
[((4207, 4237), 'numpy.subtract', 'np.subtract', (['pos', 'dle'], {'out': 'pos'}), '(pos, dle, out=pos)\n', (4218, 4237), True, 'import numpy as np\n'), ((4246, 4270), 'numpy.mod', 'np.mod', (['pos', 'dw'], {'out': 'pos'}), '(pos, dw, out=pos)\n', (4252, 4270), True, 'import numpy as np\n'), ((4279, 4304), 'numpy.add',...
import numpy as np import torch as tr import os import datetime as dt from dateutil.tz import gettz import agent def save_model(model, dicts, experiment_folder, epoch): model_path = '{}/checkpoints'.format(experiment_folder) if not os.path.exists(model_path): os.makedirs(model_path) dkeys = dicts....
[ "dateutil.tz.gettz", "os.path.exists", "os.makedirs", "numpy.random.shuffle" ]
[((1754, 1783), 'numpy.random.shuffle', 'np.random.shuffle', (['population'], {}), '(population)\n', (1771, 1783), True, 'import numpy as np\n'), ((242, 268), 'os.path.exists', 'os.path.exists', (['model_path'], {}), '(model_path)\n', (256, 268), False, 'import os\n'), ((278, 301), 'os.makedirs', 'os.makedirs', (['mode...
from __future__ import division, print_function import os,os.path import logging import pickle on_rtd = os.environ.get('READTHEDOCS') == 'True' if not on_rtd: import numpy as np import pandas as pd import matplotlib.pyplot as plt import numpy.random as rand from scipy.stats import gaussian_kde ...
[ "os.mkdir", "pickle.dump", "numpy.load", "astropy.io.ascii.read", "numpy.absolute", "numpy.isnan", "pickle.load", "os.path.exists", "numpy.loadtxt", "numpy.log10", "numpy.size", "corner.corner", "numpy.save", "matplotlib.pyplot.ylim", "numpy.median", "scipy.stats.gaussian_kde", "matp...
[((106, 135), 'os.environ.get', 'os.environ.get', (['"""READTHEDOCS"""'], {}), "('READTHEDOCS')\n", (120, 135), False, 'import os, os.path\n'), ((913, 929), 'pickle.load', 'pickle.load', (['fin'], {}), '(fin)\n', (924, 929), False, 'import pickle\n'), ((1929, 1946), 'numpy.atleast_1d', 'np.atleast_1d', (['ts'], {}), '(...
import os import time import numpy as np import sqapy import sqaod as sq import pickle from datetime import datetime class RBM: def __init__(self, n_visible=784, n_hidden=100, alpha=0.01, pi=None, save_model=False, save_path="./results"): self.n_visible = n_visible self.n_hidden = n_hidden ...
[ "numpy.random.uniform", "pickle.dump", "numpy.sum", "os.makedirs", "sqapy.BipartiteGraph", "numpy.log", "numpy.random.rand", "numpy.zeros", "numpy.clip", "time.time", "numpy.mean", "numpy.array", "numpy.random.normal", "numpy.matmul", "numpy.random.permutation", "sqaod.is_cuda_availabl...
[((726, 784), 'numpy.random.normal', 'np.random.normal', (['(0)', '(0.01)', '(self.n_visible, self.n_hidden)'], {}), '(0, 0.01, (self.n_visible, self.n_hidden))\n', (742, 784), True, 'import numpy as np\n'), ((953, 976), 'numpy.zeros', 'np.zeros', (['self.n_hidden'], {}), '(self.n_hidden)\n', (961, 976), True, 'import ...
#これを参考にした #https://spcx8.hatenablog.com/entry/2018/10/09/070000 #https://tomosoft.jp/design/?p=29005 import cv2 import matplotlib matplotlib.use("Agg") from matplotlib import pyplot as plt import numpy as np import os import tqdm import yaml with open("config.yaml") as f: config=yaml.safe_load(f) file_path=config...
[ "os.mkdir", "cv2.VideoWriter_fourcc", "matplotlib.pyplot.clf", "matplotlib.pyplot.imshow", "os.path.exists", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.figure", "matplotlib.use", "yaml.safe_load", "numpy.array", "os.path.join", "os.listdir" ]
[((130, 151), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (144, 151), False, 'import matplotlib\n'), ((344, 365), 'os.listdir', 'os.listdir', (['file_path'], {}), '(file_path)\n', (354, 365), False, 'import os\n'), ((695, 737), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (['"""m"""', '...
import math import multiprocessing as mp import numpy import random import socket import time def data_generator(): materials = ['Bronze', 'Iron', 'Steel', 'Black', 'White', 'Mithril', 'Adamant', 'Rune', 'Dragon'] weapons = ['Dagger', 'Sword', 'Scimitar', 'Mace', 'Longsword', '...
[ "random.randint", "math.sqrt", "random.uniform", "socket.socket", "time.sleep", "socket.accept", "numpy.random.normal", "multiprocessing.Process" ]
[((1329, 1378), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1342, 1378), False, 'import socket\n'), ((584, 616), 'random.randint', 'random.randint', (['(0)', '(n_weapons - 1)'], {}), '(0, n_weapons - 1)\n', (598, 616), False, 'import rando...