code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
# @Time : 2017/7/12 下午2:23
# @Author : play4fun
# @File : 一个重要的事.py
# @Software: PyCharm
"""
一个重要的事.py:
当我们可以 参 数 -1 来 定 出图像的深度 数据类型 与原图像保持一致
但是我们在代 码中使用的却是 cv2.CV_64F。 是为什么呢 ?
想象一下一个从黑到白的边界的导数是整数,而一个从白到黑的边界点导数却是负数。
如果原图像的深度是 np.int8 时 所有的负值 会 截断变成 0
换句话就是把边界丢失掉。
所以如果 两种边界你 想检测到
最好的的办法... | [
"matplotlib.pyplot.title",
"numpy.absolute",
"matplotlib.pyplot.subplot",
"numpy.uint8",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"cv2.imread",
"matplotlib.pyplot.xticks",
"cv2.Sobel"
] | [((501, 533), 'cv2.imread', 'cv2.imread', (['"""../data/box.jpg"""', '(0)'], {}), "('../data/box.jpg', 0)\n", (511, 533), False, 'import cv2\n'), ((573, 613), 'cv2.Sobel', 'cv2.Sobel', (['img', 'cv2.CV_8U', '(1)', '(0)'], {'ksize': '(5)'}), '(img, cv2.CV_8U, 1, 0, ksize=5)\n', (582, 613), False, 'import cv2\n'), ((703,... |
import numpy as np
import hera_stats as hs
from pyuvdata import UVData
from hera_stats.data import DATA_PATH
from hera_pspec.data import DATA_PATH as PSPEC_DATA_PATH
import os, sys, copy
import nose.tools as nt
import unittest
class test_flag(unittest.TestCase):
def setUp(self):
self.datafile = os.path.j... | [
"copy.deepcopy",
"pyuvdata.UVData",
"hera_stats.flag.flag_channels",
"numpy.abs",
"numpy.sum",
"nose.tools.assert_true",
"numpy.testing.assert_almost_equal",
"numpy.ones",
"hera_stats.flag.construct_factorizable_mask",
"hera_stats.flag.apply_random_flags",
"numpy.arange",
"nose.tools.assert_ra... | [((311, 368), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""zen.odd.xx.LST.1.28828.uvOCRSA"""'], {}), "(DATA_PATH, 'zen.odd.xx.LST.1.28828.uvOCRSA')\n", (323, 368), False, 'import os, sys, copy\n'), ((388, 396), 'pyuvdata.UVData', 'UVData', ([], {}), '()\n', (394, 396), False, 'from pyuvdata import UVData\n'), ((1... |
import torch
from typing import List, Union, Callable, Optional, Dict
from ignite.engine import Engine
from dataclasses import dataclass
from ignite.metrics.metric import BatchWise, Metric
import numpy as np
from torch.nn.modules.loss import BCELoss
from utils import epsilon_f32
import torchvision.transforms.functiona... | [
"torch.mean",
"torch.flatten",
"torch.numel",
"torch.multinomial",
"torch.argsort",
"torch.cat",
"torch.nonzero",
"numpy.cumsum",
"numpy.array",
"torch.arange",
"scipy.interpolate.interp1d",
"torch.no_grad",
"torch.sum",
"torch.tensor",
"numpy.repeat"
] | [((776, 787), 'numpy.array', 'np.array', (['v'], {}), '(v)\n', (784, 787), True, 'import numpy as np\n'), ((796, 825), 'scipy.interpolate.interp1d', 'interp1d', (['t', 'v'], {'kind': '"""linear"""'}), "(t, v, kind='linear')\n", (804, 825), False, 'from scipy.interpolate import interp1d\n'), ((2676, 2695), 'torch.cat', ... |
import os
import pybedtools
import numpy as np
"""
Tools for working with data across sessions.
"""
def load_features_and_arrays(prefix, mmap_mode='r'):
"""
Returns the features and NumPy arrays that were saved with
save_features_and_arrays.
Parameters
----------
prefix : str
Path t... | [
"numpy.load",
"os.path.abspath",
"pybedtools.BedTool",
"numpy.savez_compressed",
"numpy.savez"
] | [((484, 524), 'pybedtools.BedTool', 'pybedtools.BedTool', (["(prefix + '.features')"], {}), "(prefix + '.features')\n", (502, 524), False, 'import pybedtools\n'), ((538, 583), 'numpy.load', 'np.load', (["(prefix + '.npz')"], {'mmap_mode': 'mmap_mode'}), "(prefix + '.npz', mmap_mode=mmap_mode)\n", (545, 583), True, 'imp... |
# vim: fdm=marker
'''
author: <NAME>
date: 25/02/14
content: Check the demultiplexed reads.
'''
# Modules
import os
import argparse
import numpy as np
import gzip
from itertools import izip
from Bio import SeqIO
from hivwholeseq.sequencing.filenames import get_read_filenames
from hivwholeseq.sequencing.sa... | [
"Bio.SeqIO.parse",
"hivwholeseq.sequencing.filenames.get_read_filenames",
"argparse.ArgumentParser",
"gzip.open",
"numpy.sort",
"numpy.arange",
"itertools.izip",
"numpy.random.shuffle"
] | [((461, 548), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Collect a few reads to perform basic checks"""'}), "(description=\n 'Collect a few reads to perform basic checks')\n", (484, 548), False, 'import argparse\n'), ((1284, 1333), 'hivwholeseq.sequencing.filenames.get_read_filena... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
#project 1 algorithms 1-4
w = np.array([.017, .033, .132, .716, 3.697, 22.931, 324.724, 1927.502, 145405.554, 1170605.957])
x = np.array([.013, .048, .845, 1.143, 3.895, 44.312, 229.968, 2182.506, 14950.93, 179258.975])
y = np.array([.017, .04... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.margins",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tight_layout"
] | [((105, 207), 'numpy.array', 'np.array', (['[0.017, 0.033, 0.132, 0.716, 3.697, 22.931, 324.724, 1927.502, 145405.554, \n 1170605.957]'], {}), '([0.017, 0.033, 0.132, 0.716, 3.697, 22.931, 324.724, 1927.502, \n 145405.554, 1170605.957])\n', (113, 207), True, 'import numpy as np\n'), ((205, 304), 'numpy.array', 'n... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
"socket.socket",
"mxnet.nd.argsort",
"socket.gethostname",
"mxnet.cpu",
"collections.Counter",
"mxnet.gpu",
"numpy.vstack",
"pickle.dumps"
] | [((3567, 3588), 'collections.Counter', 'collections.Counter', ([], {}), '()\n', (3586, 3588), False, 'import collections\n'), ((1014, 1025), 'mxnet.gpu', 'mx.gpu', (['gpu'], {}), '(gpu)\n', (1020, 1025), True, 'import mxnet as mx\n'), ((1056, 1064), 'mxnet.cpu', 'mx.cpu', ([], {}), '()\n', (1062, 1064), True, 'import m... |
import numpy as np
import torch
from torchvision.ops import nms
from .utils import from_config
def get_anchor_boxes(feature_map_size, anchor_areas, aspect_ratios):
"""
Parameters
----------
feature_map_size : tuple
Tuple of (width, height) representing the size of the feature map.
anchor_... | [
"numpy.meshgrid",
"torch.where",
"torch.split",
"torch.cat",
"torchvision.ops.nms",
"torch.exp",
"numpy.arange",
"numpy.array",
"numpy.vstack",
"torch.log",
"torch.tensor",
"numpy.sqrt"
] | [((722, 755), 'numpy.arange', 'np.arange', (['width'], {'dtype': '"""float32"""'}), "(width, dtype='float32')\n", (731, 755), True, 'import numpy as np\n'), ((771, 805), 'numpy.arange', 'np.arange', (['height'], {'dtype': '"""float32"""'}), "(height, dtype='float32')\n", (780, 805), True, 'import numpy as np\n'), ((825... |
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import train_test_split
from keras.models import Sequential, Model
from keras.layers import LSTM, Dense, Bidirectional, Dropout, Input, Embedding, GlobalMaxPool1D, TimeDistributed, RepeatVe... | [
"codecs.open",
"keras.layers.dot",
"keras.layers.Activation",
"keras.preprocessing.sequence.pad_sequences",
"keras.layers.LSTM",
"numpy.argmax",
"os.walk",
"numpy.zeros",
"keras.models.Model",
"json.dumps",
"keras.preprocessing.text.Tokenizer",
"keras.layers.Dense",
"numpy.array",
"keras.l... | [((575, 627), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'char_level': '(True)', 'filters': 'None', 'lower': '(True)'}), '(char_level=True, filters=None, lower=True)\n', (584, 627), False, 'from keras.preprocessing.text import Tokenizer\n'), ((886, 906), 'keras.layers.Input', 'Input', ([], {'shape': '(Non... |
# -*- coding: utf-8 -*-
"""
Model definitions.
Author: <NAME>
"""
import importlib
from functools import reduce
import operator
import torch
import numpy as np
from .init import manual_seeds, init_model
def get_model(cfg, shapes, dtypes, num_classes=None, device_ids=None):
"""
Return a Model for the given... | [
"numpy.asarray",
"numpy.maximum",
"numpy.all",
"importlib.import_module"
] | [((457, 513), 'importlib.import_module', 'importlib.import_module', (["('.' + cfg['model'])", '__package__'], {}), "('.' + cfg['model'], __package__)\n", (480, 513), False, 'import importlib\n'), ((5176, 5200), 'numpy.asarray', 'np.asarray', (['size', 'np.int'], {}), '(size, np.int)\n', (5186, 5200), True, 'import nump... |
#!\usr\bin\python3
# -*- coding: utf-8 -*-
'''
Created on Nov. 2019
Electric Dynamic Chapter 7
http://172.16.202.204:801
@author: ZYW @ BNU
'''
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
pixels = 1024
c = 10
l = 75
k = 2*np.pi/l
v = 30
t_1 = 50
start = 300
A_0 = ... | [
"numpy.meshgrid",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.savefig"
] | [((342, 389), 'numpy.zeros', 'np.zeros', ([], {'shape': '(pixels, pixels)', 'dtype': '"""float"""'}), "(shape=(pixels, pixels), dtype='float')\n", (350, 389), True, 'import numpy as np\n'), ((393, 440), 'numpy.zeros', 'np.zeros', ([], {'shape': '(pixels, pixels)', 'dtype': '"""float"""'}), "(shape=(pixels, pixels), dty... |
# -*- coding: utf-8 -*-
"""Testing the functions in typhon.utils.
"""
import warnings
import numpy
import xarray
from time import sleep
from datetime import timedelta
import pytest
from typhon import utils
class TestUtils:
"""Testing the typhon.utils functions."""
def test_deprecated(self):
"""Test ... | [
"typhon.utils.unique",
"warnings.simplefilter",
"numpy.allclose",
"numpy.dtype",
"time.sleep",
"typhon.utils.Timer",
"pytest.raises",
"warnings.catch_warnings",
"datetime.timedelta",
"numpy.array",
"typhon.utils.image2mpeg",
"typhon.utils.undo_xarray_floatification"
] | [((1461, 1497), 'typhon.utils.undo_xarray_floatification', 'utils.undo_xarray_floatification', (['ds'], {}), '(ds)\n', (1493, 1497), False, 'from typhon import utils\n'), ((1615, 1648), 'numpy.allclose', 'numpy.allclose', (["ds['a']", "ds2['a']"], {}), "(ds['a'], ds2['a'])\n", (1629, 1648), False, 'import numpy\n'), ((... |
# ---------------------------------------------------------------
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the NVIDIA Source Code License
# for OSCAR. To view a copy of this license, see the LICENSE file.
# -----------------------------------------------------------... | [
"oscar.utils.object_utils.create_hollow_cylinder",
"torch.nn.CosineSimilarity",
"torch.arange",
"torch.ones",
"isaacgym.gymapi.Quat",
"numpy.power",
"torch.zeros",
"numpy.log10",
"torch.log",
"isaacgym.gymapi.AssetOptions",
"oscar.utils.torch_utils.quat2axisangle",
"isaacgym.gymapi.Vec3",
"t... | [((3540, 3594), 'isaacgym.gymapi.Vec3', 'gymapi.Vec3', (['(-self.env_spacing)', '(-self.env_spacing)', '(0.0)'], {}), '(-self.env_spacing, -self.env_spacing, 0.0)\n', (3551, 3594), False, 'from isaacgym import gymapi\n'), ((3611, 3676), 'isaacgym.gymapi.Vec3', 'gymapi.Vec3', (['self.env_spacing', 'self.env_spacing', 's... |
import numpy as np
import os
from sklearn.decomposition import PCA
from sklearn import preprocessing
def scale_data(data, scale=[0, 1], dtype=np.float32):
min_data, max_data = [float(np.min(data)), float(np.max(data))]
min_scale, max_scale = [float(scale[0]), float(scale[1])]
data = ((max_scale - min_scal... | [
"numpy.save",
"gzip.open",
"numpy.min",
"numpy.max",
"sklearn.decomposition.PCA",
"sklearn.preprocessing.normalize",
"os.path.join"
] | [((1667, 1719), 'os.path.join', 'os.path.join', (['path', "('%s-labels-idx1-ubyte.gz' % kind)"], {}), "(path, '%s-labels-idx1-ubyte.gz' % kind)\n", (1679, 1719), False, 'import os\n'), ((1800, 1852), 'os.path.join', 'os.path.join', (['path', "('%s-images-idx3-ubyte.gz' % kind)"], {}), "(path, '%s-images-idx3-ubyte.gz' ... |
import os
import sys
import numpy as np
from PIL import Image
class DavisDataset:
def __init__(self, train_list, test_list, root='.', data_aug=False):
"""Load DAVIS 2017 dataset object, based on code from @scaelles
:param train_list: textfile or list with paths to images for training
:par... | [
"sys.stdout.write",
"PIL.Image.open",
"numpy.array",
"numpy.arange",
"numpy.random.shuffle"
] | [((3419, 3451), 'numpy.array', 'np.array', (['self.images_train_path'], {}), '(self.images_train_path)\n', (3427, 3451), True, 'import numpy as np\n'), ((3485, 3517), 'numpy.array', 'np.array', (['self.labels_train_path'], {}), '(self.labels_train_path)\n', (3493, 3517), True, 'import numpy as np\n'), ((4247, 4273), 'n... |
import numpy as np
import matplotlib.pyplot as plt
def write_probe_file():
domain = (2000., 1000.)
num_probes = (41, 21)
hub_height = 119.0
probe_positions_x = np.linspace(0,domain[0],num_probes[0])
probe_positions_y = np.linspace(0,domain[1],num_probes[1])
probe_position_array = np.zeros((nu... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linalg.norm",
"numpy.linspace"
] | [((178, 218), 'numpy.linspace', 'np.linspace', (['(0)', 'domain[0]', 'num_probes[0]'], {}), '(0, domain[0], num_probes[0])\n', (189, 218), True, 'import numpy as np\n'), ((241, 281), 'numpy.linspace', 'np.linspace', (['(0)', 'domain[1]', 'num_probes[1]'], {}), '(0, domain[1], num_probes[1])\n', (252, 281), True, 'impor... |
import os
import numpy as np
import argparse
import sys
import math
import time
import os
def time_pattern_to_byte_timestamp(time, pattern, dt_units_ps=125):
"""
time in units of ps
retrieve time and pattern with:
time = (b << 17) + (c >> 15)
pattern = c & 0xf
"""
assert type(patte... | [
"numpy.uint64",
"argparse.ArgumentParser",
"math.ceil",
"numpy.fromfile",
"sys.stdout.fileno",
"time.time",
"time.sleep",
"numpy.append",
"numpy.diff"
] | [((364, 393), 'math.ceil', 'math.ceil', (['(time / dt_units_ps)'], {}), '(time / dt_units_ps)\n', (373, 393), False, 'import math\n'), ((1402, 1420), 'numpy.diff', 'np.diff', (['time_list'], {}), '(time_list)\n', (1409, 1420), True, 'import numpy as np\n'), ((1442, 1481), 'numpy.append', 'np.append', (['time_list[0]', ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 15:26:16 2017
@author: kcarnold
"""
import numpy as np
from keras.layers import Dense, Input, Flatten
from keras.layers import Conv1D, MaxPooling1D, Embedding
from keras.models import Model
from keras.callbacks import ModelCheckpoint, TensorBoard, EarlyStopping
import... | [
"keras.callbacks.ModelCheckpoint",
"keras.layers.Flatten",
"keras.models.Model",
"keras.layers.Conv1D",
"numpy.max",
"keras.layers.MaxPooling1D",
"keras.layers.Dense",
"keras.layers.Embedding",
"keras.callbacks.EarlyStopping",
"keras.layers.Input",
"numpy.eye",
"joblib.load"
] | [((343, 381), 'joblib.load', 'joblib.load', (['"""keras_training_data.pkl"""'], {}), "('keras_training_data.pkl')\n", (354, 381), False, 'import joblib\n'), ((727, 804), 'keras.layers.Embedding', 'Embedding', (['num_words', 'EMBEDDING_DIM'], {'input_length': 'MAX_SEQ_LEN', 'trainable': '(True)'}), '(num_words, EMBEDDIN... |
import timeit
import sys
import os
import pprint
import numpy as np
import hdf5plugin
import h5py
# cpuinfo is in hdf5plugin root folder (one up from bench)
sys.path.append( os.path.join( os.path.dirname( __file__ ), ".." ) )
import cpuinfo
G = 1e-9 # decimal
def make_signal( shape, signal ):
return np.random.p... | [
"os.remove",
"h5py.File",
"numpy.random.seed",
"cpuinfo.get_cpu_info",
"os.stat",
"numpy.roll",
"timeit.default_timer",
"os.path.dirname",
"hdf5plugin.Bitshuffle",
"numpy.zeros",
"os.system",
"os.cpu_count",
"numpy.min",
"numpy.random.randint",
"sys.stdout.flush",
"numpy.random.poisson... | [((309, 341), 'numpy.random.poisson', 'np.random.poisson', (['signal', 'shape'], {}), '(signal, shape)\n', (326, 341), True, 'import numpy as np\n'), ((543, 568), 'numpy.zeros', 'np.zeros', (['shape', 'np.uint8'], {}), '(shape, np.uint8)\n', (551, 568), True, 'import numpy as np\n'), ((700, 746), 'numpy.random.randint'... |
import os
from typing import List, Dict
import shutil
import numpy as np
import cv2
import kapture as kt
from kapture import CameraType
from kapture.io.csv import kapture_from_dir, kapture_to_dir
from kapture.io.features import get_keypoints_fullpath, image_keypoints_to_file
from kapture.io.records import ... | [
"kapture.PoseTransform",
"kapture.Points3d",
"kapture.Camera",
"numpy.argsort",
"kapture.io.csv.kapture_from_dir",
"numpy.isclose",
"kapture.io.features.get_keypoints_fullpath",
"shutil.rmtree",
"os.path.join",
"kapture.Sensors",
"kapture.Keypoints",
"cv2.imwrite",
"os.path.dirname",
"os.p... | [((1004, 1029), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (1018, 1029), False, 'import os\n'), ((1278, 1317), 'kapture.io.csv.kapture_to_dir', 'kapture_to_dir', (['self.path', 'self.kapture'], {}), '(self.path, self.kapture)\n', (1292, 1317), False, 'from kapture.io.csv import kapture_fr... |
# -*- coding: utf-8 -*-
# Utools for setup.py files
from __future__ import absolute_import, division, print_function
import sys
import textwrap
from os.path import exists, join, dirname, split, splitext
import os
from utool import util_cplat
from utool import util_path
from utool import util_io
from utool import util_s... | [
"utool.doctest_funcs",
"utool.util_regex.regex_parse",
"utool.is_funclike",
"utool.util_cplat.shell",
"sys.argv.remove",
"utool.util_io.read_from",
"utool.codeblock",
"utool.dirsplit",
"utool.util_path.ls_moduledirs",
"utool.get_funcname",
"utool.get_argflag",
"utool.util_cplat.python_executab... | [((2388, 2418), 'utool.util_cplat.python_executable', 'util_cplat.python_executable', ([], {}), '()\n', (2416, 2418), False, 'from utool import util_cplat\n'), ((3211, 3229), 'os.path.split', 'split', (['setup_fpath'], {}), '(setup_fpath)\n', (3216, 3229), False, 'from os.path import exists, join, dirname, split, split... |
'''
Description:
This is a utils package to do the correctness test using CPU, based on convolution definition.
Usage:
from utils import *
Function introduction:
conv_cpu: test the correctness of serial, naive, and redundant boundary algorithm;
FilterTest: test the correctness of separable filter al... | [
"numpy.zeros_like"
] | [((793, 811), 'numpy.zeros_like', 'np.zeros_like', (['pic'], {}), '(pic)\n', (806, 811), True, 'import numpy as np\n'), ((1857, 1875), 'numpy.zeros_like', 'np.zeros_like', (['pic'], {}), '(pic)\n', (1870, 1875), True, 'import numpy as np\n'), ((1886, 1904), 'numpy.zeros_like', 'np.zeros_like', (['pic'], {}), '(pic)\n',... |
import numpy as np
import cv2
import time
from grabscreen import grab_screen
from directkeys import PressKey,ReleaseKey,W, A, S, D
from getkeys import key_check
from alexnet import alexnet
WIDTH = 80
HEIGHT = 60
LR = 1e-3 #学习效率
EPOCHS = 8
MODEL_NAME = 'py-car-{}-{}-{}-epochs.model'.format(LR,'alexnetv2',EPOCHS... | [
"alexnet.alexnet",
"cv2.cvtColor",
"time.time",
"time.sleep",
"directkeys.PressKey",
"directkeys.ReleaseKey",
"numpy.around",
"grabscreen.grab_screen",
"getkeys.key_check",
"cv2.resize"
] | [((615, 641), 'alexnet.alexnet', 'alexnet', (['WIDTH', 'HEIGHT', 'LR'], {}), '(WIDTH, HEIGHT, LR)\n', (622, 641), False, 'from alexnet import alexnet\n'), ((344, 355), 'directkeys.PressKey', 'PressKey', (['W'], {}), '(W)\n', (352, 355), False, 'from directkeys import PressKey, ReleaseKey, W, A, S, D\n'), ((360, 373), '... |
import numpy as np
import cv2
import sys
image_path = sys.argv[1]
width = int(sys.argv[2])
height = int(sys.argv[3])
channel_values = [0, 0, 0]
i = 0
for c in sys.argv[4:6]:
channel_values[i] = int(c)
i += 1
image = np.ones((width, height, 3))
for c in range(3):
image[:, :, c] = channel_values[2 - c]
... | [
"cv2.imwrite",
"numpy.ones"
] | [((229, 256), 'numpy.ones', 'np.ones', (['(width, height, 3)'], {}), '((width, height, 3))\n', (236, 256), True, 'import numpy as np\n'), ((320, 350), 'cv2.imwrite', 'cv2.imwrite', (['image_path', 'image'], {}), '(image_path, image)\n', (331, 350), False, 'import cv2\n')] |
# -*- coding: utf-8 -*-
"""
quickpipeline module implements QuickPipeline class that do all the necessary
things to prepare data for machine learning tasks.
2017 (c) <NAME>
License: MIT
"""
from collections import defaultdict
import pandas as pd
import numpy as np
from sklearn.preprocessing import (
Imputer, St... | [
"pandas.DataFrame",
"sklearn.preprocessing.StandardScaler",
"numpy.log",
"sklearn.preprocessing.Imputer",
"sklearn.preprocessing.LabelEncoder",
"collections.defaultdict",
"pandas.api.types.is_categorical_dtype",
"pandas.Series"
] | [((11623, 11675), 'pandas.Series', 'pd.Series', (['[1, 2, 3, np.nan, 4, 5]'], {'dtype': 'np.float16'}), '([1, 2, 3, np.nan, 4, 5], dtype=np.float16)\n', (11632, 11675), True, 'import pandas as pd\n'), ((11680, 11724), 'pandas.Series', 'pd.Series', (["['A', 'B', np.nan, 'A', 'C', 'B']"], {}), "(['A', 'B', np.nan, 'A', '... |
import pprint
import zulip
import sys
import re
import json
import httplib2
import os
import random
import numpy as np
import pickle
import json
import nltk
from tensorflow.keras.models import load_model
from nltk.stem import WordNetLemmatizer
p = pprint.PrettyPrinter()
BOT_MAIL = "<EMAIL>"
lemmatizer = WordNetLemmat... | [
"tensorflow.keras.models.load_model",
"nltk.stem.WordNetLemmatizer",
"zulip.Client",
"random.choice",
"pprint.PrettyPrinter",
"numpy.array",
"nltk.download",
"nltk.word_tokenize",
"sys.exit"
] | [((249, 271), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (269, 271), False, 'import pprint\n'), ((307, 326), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (324, 326), False, 'from nltk.stem import WordNetLemmatizer\n'), ((327, 349), 'nltk.download', 'nltk.download', (['"""... |
import os
import cv2
import numpy as np
from sklearn.cluster import KMeans
from sklearn import metrics
import config as cfg
from get_calibration_error import get_calibration_error
from get_video_order import get_video_order
def choose_cluster(data, labels, n_clusters):
# Choose best cluster based on cluster siz... | [
"numpy.average",
"numpy.polyfit",
"os.path.isdir",
"cv2.getPerspectiveTransform",
"numpy.float32",
"sklearn.cluster.KMeans",
"numpy.column_stack",
"os.walk",
"cv2.VideoCapture",
"sklearn.metrics.silhouette_score",
"get_video_order.get_video_order",
"numpy.array",
"os.path.normpath",
"get_c... | [((824, 848), 'numpy.average', 'np.average', (['data'], {'axis': '(0)'}), '(data, axis=0)\n', (834, 848), True, 'import numpy as np\n'), ((2276, 2313), 'os.path.join', 'os.path.join', (['subject', '"""calibrations"""'], {}), "(subject, 'calibrations')\n", (2288, 2313), False, 'import os\n'), ((2427, 2459), 'os.path.isd... |
#! /usr/bin/env python2.7
prefixes = ('af', 'as', 'au', 'ca', 'eu', 'na', 'sa')
import dem as d
import numpy as np
suffix = '0_4'
for prefix in prefixes:
import copy
ksi = d.Ksi.load(prefix + '_ksi_2000000_' + suffix)
relief = d.ScaledRelief.load(prefix + '_relief_2000000_' + suffix)
... | [
"dem.Ksi.load",
"dem.ScaledRelief.load",
"copy.deepcopy",
"numpy.divide"
] | [((194, 239), 'dem.Ksi.load', 'd.Ksi.load', (["(prefix + '_ksi_2000000_' + suffix)"], {}), "(prefix + '_ksi_2000000_' + suffix)\n", (204, 239), True, 'import dem as d\n'), ((253, 310), 'dem.ScaledRelief.load', 'd.ScaledRelief.load', (["(prefix + '_relief_2000000_' + suffix)"], {}), "(prefix + '_relief_2000000_' + suffi... |
import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
- X:... | [
"numpy.zeros_like",
"numpy.sum",
"numpy.log",
"numpy.zeros",
"numpy.max",
"numpy.arange",
"numpy.exp"
] | [((735, 751), 'numpy.zeros_like', 'np.zeros_like', (['W'], {}), '(W)\n', (748, 751), True, 'import numpy as np\n'), ((1491, 1511), 'numpy.arange', 'np.arange', (['num_train'], {}), '(num_train)\n', (1500, 1511), True, 'import numpy as np\n'), ((2530, 2546), 'numpy.zeros_like', 'np.zeros_like', (['W'], {}), '(W)\n', (25... |
import argparse
import numpy as np
import pandas as pd
import time
import os
import json
import initpath_alg
initpath_alg.init_sys_path()
import utilmlab
import data_loader_mlab
def normalize_array(a):
Dim = a.shape[1]
Min_Val = np.zeros(Dim)
Max_Val = np.zeros(Dim)
for i in range(Dim):
Min_V... | [
"pandas.DataFrame",
"utilmlab.introduce_missing",
"json.dump",
"argparse.ArgumentParser",
"data_loader_mlab.dataset_log_properties",
"os.path.dirname",
"numpy.zeros",
"time.sleep",
"initpath_alg.init_sys_path",
"numpy.min",
"numpy.max",
"data_loader_mlab.get_dataset"
] | [((109, 137), 'initpath_alg.init_sys_path', 'initpath_alg.init_sys_path', ([], {}), '()\n', (135, 137), False, 'import initpath_alg\n'), ((239, 252), 'numpy.zeros', 'np.zeros', (['Dim'], {}), '(Dim)\n', (247, 252), True, 'import numpy as np\n'), ((267, 280), 'numpy.zeros', 'np.zeros', (['Dim'], {}), '(Dim)\n', (275, 28... |
import os
import numpy as onp
import jax.numpy as jnp
import jax.random as jr
from sklearn.mixture import GaussianMixture
from . import util
from . import util_io
# =====================================================================
def _fit_obs_error_parameters(positions, observations, camera_matrice... | [
"jax.numpy.array",
"numpy.load",
"numpy.empty",
"numpy.zeros",
"numpy.isnan",
"jax.numpy.asarray",
"jax.numpy.nanmean",
"jax.numpy.linalg.norm",
"jax.numpy.nanvar",
"os.path.join"
] | [((1544, 1571), 'numpy.empty', 'onp.empty', (['[C, K, D_obs, M]'], {}), '([C, K, D_obs, M])\n', (1553, 1571), True, 'import numpy as onp\n'), ((1596, 1620), 'numpy.empty', 'onp.empty', (['[C, K, D_obs]'], {}), '([C, K, D_obs])\n', (1605, 1620), True, 'import numpy as onp\n'), ((3825, 3887), 'jax.numpy.linalg.norm', 'jn... |
import numpy as np
import pyro
import pytest
import torch
from pyro.distributions import MixtureOfDiagNormals, Normal
from pyro.poutine import trace
import src.models as models
pyro.set_rng_seed(123)
pyro.clear_param_store()
rng = np.random.default_rng(123)
@pytest.mark.skip(reason="Passed plenty times before and i... | [
"numpy.abs",
"numpy.sum",
"numpy.ones",
"numpy.random.default_rng",
"numpy.isclose",
"numpy.arange",
"numpy.exp",
"pytest.mark.parametrize",
"pyro.clear_param_store",
"pytest.mark.skip",
"torch.no_grad",
"pyro.poutine.trace",
"torch.ones",
"numpy.meshgrid",
"numpy.random.randn",
"src.m... | [((179, 201), 'pyro.set_rng_seed', 'pyro.set_rng_seed', (['(123)'], {}), '(123)\n', (196, 201), False, 'import pyro\n'), ((202, 226), 'pyro.clear_param_store', 'pyro.clear_param_store', ([], {}), '()\n', (224, 226), False, 'import pyro\n'), ((233, 259), 'numpy.random.default_rng', 'np.random.default_rng', (['(123)'], {... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/li... | [
"federatedml.secureprotol.iterative_affine.DeterministicIterativeAffineCiphertext",
"functools.partial",
"numpy.equal.outer",
"numpy.cumsum",
"uuid.uuid1",
"scipy.sparse.csc_matrix",
"numpy.array"
] | [((1976, 2256), 'functools.partial', 'functools.partial', (['FastFeatureHistogram.batch_calculate_histogram'], {'node_map': 'node_map', 'bin_num': 'bin_num', 'phrase_num': 'phrase_num', 'cipher_split_num': 'cipher_split_num', 'valid_features': 'valid_features', 'use_missing': 'use_missing', 'zero_as_missing': 'zero_as_... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#Author: <NAME>
#Creation date 20th December 2020
#Last edition date 20th December 2020
#Description: Generate testing networks
import snap
import numpy as np
def saveResults(graph, nameFile):
snap.PrintInfo(graph, "Python type PUNGraph", "descriptions/"+nameFile, False)
... | [
"snap.GenSmallWorld",
"numpy.array2string",
"snap.GenPrefAttach",
"snap.GenRndGnm",
"snap.TRnd",
"snap.PrintInfo",
"snap.SaveEdgeList",
"numpy.append",
"numpy.array",
"snap.GetDegSeqV",
"snap.TIntV"
] | [((711, 722), 'snap.TRnd', 'snap.TRnd', ([], {}), '()\n', (720, 722), False, 'import snap\n'), ((752, 785), 'snap.GenPrefAttach', 'snap.GenPrefAttach', (['(2000)', '(20)', 'Rnd'], {}), '(2000, 20, Rnd)\n', (770, 785), False, 'import snap\n'), ((786, 835), 'snap.SaveEdgeList', 'snap.SaveEdgeList', (['ScaleFree20', '"""S... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import skimage.io
from loguru import logger
import unittest
import os
from pathlib import Path
# import shutil
import pandas as pd
# import openslide
import exsu.report
import numpy as np
import pytest
pytest_plugins = "pytester"
# class ReportTest(unittest.TestCase):
... | [
"os.remove",
"matplotlib.pyplot.show",
"matplotlib.pyplot.close",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.axis",
"pandas.read_excel",
"pathlib.Path",
"matplotlib.pyplot.figure",
"pytest.raises",
"numpy.random.rand",
"pytest.mark.parametrize",
"loguru.logger.debug"
] | [((9572, 9632), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""suffix"""', "['.xls', '.xlsx', '.xls']"], {}), "('suffix', ['.xls', '.xlsx', '.xls'])\n", (9595, 9632), False, 'import pytest\n'), ((504, 526), 'pathlib.Path', 'Path', (['"""./test_report/"""'], {}), "('./test_report/')\n", (508, 526), False, '... |
# %%
import numpy as np
import matplotlib.pyplot as plt
from copy import deepcopy
from sklearn import datasets
# from sklearn.base import clone
from sklearn.linear_model import (LinearRegression, LogisticRegression, SGDRegressor, Ridge, Lasso, ElasticNet)
from sklearn.metrics import mean_squared_error
from sklearn.mode... | [
"sklearn.datasets.load_iris",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"numpy.linalg.pinv",
"numpy.set_printoptions",
"numpy.random.randn",
"sklearn.linear_model.ElasticNet",
"numpy.linsp... | [((546, 573), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (556, 573), True, 'import matplotlib.pyplot as plt\n'), ((574, 591), 'matplotlib.pyplot.scatter', 'plt.scatter', (['X', 'y'], {}), '(X, y)\n', (585, 591), True, 'import matplotlib.pyplot as plt\n'), ((592, 602),... |
#! /usr/bin/env python
# encoding: utf-8
"""
# test_hickle_helpers.py
Unit tests for hickle module -- helper functions.
"""
import pytest
# %% IMPORTS
# Package imports
import numpy as np
import pickle
import operator
import numpy as np
import h5py
# hickle imports
from hickle.helpers import (
PyContainer,H5No... | [
"pickle.loads",
"hickle.helpers.convert_str_list_attr",
"h5py.File",
"hickle.fileio.file_opener",
"_pytest.fixtures.FixtureRequest",
"hickle.helpers.H5NodeFilterProxy",
"hickle.helpers.convert_str_attr",
"hickle.helpers.PyContainer",
"hickle.fileio.not_io_base_like",
"pytest.raises",
"hickle.hel... | [((1396, 1418), 'h5py.File', 'h5.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (1403, 1418), True, 'import h5py as h5\n'), ((2515, 2545), 'hickle.helpers.PyContainer', 'PyContainer', (['{}', "b'list'", 'list'], {}), "({}, b'list', list)\n", (2526, 2545), False, 'from hickle.helpers import PyContainer, H5No... |
import random
import numpy as np
import cv2
import lmdb
import torch
import torch.utils.data as data
import data.util as util
class LQGTDataset(data.Dataset):
'''
Read LQ (Low Quality, here is LR) and GT audio pairs.
The pair is ensured by 'sorted' function, so please check the name convention.
'''
... | [
"random.randint",
"data.util.read_audio",
"numpy.transpose",
"data.util.get_audio_paths",
"data.util.augment"
] | [((555, 595), 'data.util.get_audio_paths', 'util.get_audio_paths', (["opt['dataroot_GT']"], {}), "(opt['dataroot_GT'])\n", (575, 595), True, 'import data.util as util\n'), ((635, 675), 'data.util.get_audio_paths', 'util.get_audio_paths', (["opt['dataroot_LQ']"], {}), "(opt['dataroot_LQ'])\n", (655, 675), True, 'import ... |
import os
import time
import numpy as np
import progress.bar
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from . import utils
def train(opts, model, train_data, val_data, num_epochs, resume_from_epoch=None):
train_loader = DataLoader(train_data,
b... | [
"tensorboardX.SummaryWriter",
"os.makedirs",
"torch.utils.data.DataLoader",
"time.perf_counter",
"numpy.array",
"os.path.join"
] | [((266, 388), 'torch.utils.data.DataLoader', 'DataLoader', (['train_data'], {'batch_size': 'opts.batch_size', 'shuffle': '(True)', 'num_workers': 'opts.dataloader_workers', 'pin_memory': '(True)'}), '(train_data, batch_size=opts.batch_size, shuffle=True,\n num_workers=opts.dataloader_workers, pin_memory=True)\n', (2... |
import numpy as np
import pyaudio
import time
import unireedsolomon as urs
# Audio sampling rate
SAMPLING_RATE = 44100
# Length of a symbol in audio samples.
# Must divide SAMPLING_RATE with zero remainder
SYMBOL_LENGTH = 200
# The lowest frequency in a symbol
FREQ_OFFSET = 4410
FREQ_STEP = SAMPLING_RATE/SYMBOL... | [
"numpy.fft.rfft",
"numpy.abs",
"numpy.argmax",
"numpy.fromfile",
"numpy.zeros",
"numpy.sin",
"pyaudio.PyAudio",
"numpy.random.normal",
"unireedsolomon.rs.RSCoder",
"numpy.log10"
] | [((5100, 5137), 'unireedsolomon.rs.RSCoder', 'urs.rs.RSCoder', (['LEN_CODE', 'LEN_PAYLOAD'], {}), '(LEN_CODE, LEN_PAYLOAD)\n', (5114, 5137), True, 'import unireedsolomon as urs\n'), ((2332, 2370), 'numpy.random.normal', 'np.random.normal', (['mean', 'std'], {'size': 'size'}), '(mean, std, size=size)\n', (2348, 2370), T... |
"""OREBA-SHA dataset"""
from collections import Counter
import numpy as np
import datetime as dt
import csv
import os
import logging
import xml.etree.cElementTree as etree
import tensorflow as tf
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s: %(message)s',
datefmt='%H:%M:%S', level=logging.INFO)
F... | [
"csv.reader",
"tensorflow.train.Int64List",
"numpy.empty",
"os.walk",
"os.path.isfile",
"tensorflow.train.FloatList",
"os.path.join",
"numpy.unique",
"xml.etree.cElementTree.parse",
"datetime.timedelta",
"collections.Counter",
"tensorflow.train.BytesList",
"csv.writer",
"numpy.asarray",
... | [((198, 324), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(name)s %(levelname)s: %(message)s"""', 'datefmt': '"""%H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s %(name)s %(levelname)s: %(message)s', datefmt='%H:%M:%S',\n level=logging.INFO)\n", (217, 324), Fals... |
import numpy as np
from scipy.stats import beta
import matplotlib.pyplot as plt
x = np.linspace(0.01, 0.99, 100)
y = []
for a in [0.1, 0.3, 0.5, 1, 10, 100]:
y.append(beta.pdf(x, a, a))
plt.plot(x, np.array(y).T)
plt.show() | [
"numpy.array",
"scipy.stats.beta.pdf",
"matplotlib.pyplot.show",
"numpy.linspace"
] | [((85, 113), 'numpy.linspace', 'np.linspace', (['(0.01)', '(0.99)', '(100)'], {}), '(0.01, 0.99, 100)\n', (96, 113), True, 'import numpy as np\n'), ((221, 231), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (229, 231), True, 'import matplotlib.pyplot as plt\n'), ((174, 191), 'scipy.stats.beta.pdf', 'beta.pdf'... |
from __future__ import print_function
import argparse
import os
import time
import numpy as np
import skimage
import skimage.io
from PIL import Image
import skimage.transform
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
from torch.autograd import Variable
from psmnet.models imp... | [
"psmnet.utils.preprocess.get_transform",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.isdir",
"torch.manual_seed",
"torch.load",
"torch.cuda.manual_seed",
"torch.nn.DataParallel",
"time.time",
"torch.squeeze",
"PIL.Image.open",
"torch.cuda.is_available",
"numpy.reshape",
"numpy.lib.p... | [((487, 532), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PSMNet"""'}), "(description='PSMNet')\n", (510, 532), False, 'import argparse\n'), ((1529, 1557), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (1546, 1557), False, 'import torch\n'), ((1654, 1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 10 22:50:08 2018
@author: anshul
"""
import time
from PIL import Image
import pandas as pd
import numpy as np
import scipy as sci
from sklearn.decomposition import PCA
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
... | [
"numpy.isin",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.classification_report",
"numpy.shape",
"os.path.isfile",
"sklearn.svm.SVC",
"pandas.DataFrame",
"numpy.asarray",
"os.listdir",
"numpy.vstack",
"numpy.matrix",
"PI... | [((961, 982), 'os.listdir', 'os.listdir', (['path_save'], {}), '(path_save)\n', (971, 982), False, 'import os, sys\n'), ((1098, 1148), 'pandas.read_csv', 'pd.read_csv', (['"""Data_Entry_2017.csv"""'], {'usecols': '[0, 1]'}), "('Data_Entry_2017.csv', usecols=[0, 1])\n", (1109, 1148), True, 'import pandas as pd\n'), ((12... |
from tqdm import tqdm
from rts.core.pts import ParaTaskSet
from rts.gen.egen import Egen
from rts.sched.bcl_naive import BCLNaive
from rts.sched.bcl import BCL
from rts.sched.bar import BAR
from rts.op.stat import Stat
from rts.popt.cho import Cho
import tikzplotlib
import numpy as np
import matplotlib.pyplot as plt
fr... | [
"rts.popt.cho.Cho",
"rts.gen.egen.Egen",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"rts.sched.bcl.BCL",
"matplotlib.pyplot.legend",
"rts.core.pts.ParaTaskSet",
"matplotlib.pyplot.axis",
"rts.sched.bcl_naive.BCLNaive",
"rts.op.stat.Stat",
"tikzplotlib.save",
"numpy.arange",
"rts.pop... | [((949, 966), 'rts.gen.egen.Egen', 'Egen', ([], {}), '(**gen_param)\n', (953, 966), False, 'from rts.gen.egen import Egen\n'), ((1075, 1093), 'rts.op.stat.Stat', 'Stat', ([], {}), '(**stat_param)\n', (1079, 1093), False, 'from rts.op.stat import Stat\n'), ((1105, 1123), 'rts.op.stat.Stat', 'Stat', ([], {}), '(**stat_pa... |
import numpy as np
import sys
import cv2
import tensorflow as tf
class GradCamPlusPlus(object):
TOP3 = 1
COLOR_THRESHOLD = 200
def __init__(self, logit, last_conv_layer, input_tensor):
self._build_net(logit, last_conv_layer, input_tensor)
def _build_net(self, logit, last_conv_layer, input_te... | [
"numpy.sum",
"numpy.maximum",
"numpy.ones",
"numpy.argsort",
"tensorflow.multiply",
"cv2.imshow",
"cv2.cvtColor",
"numpy.transpose",
"tensorflow.placeholder",
"numpy.max",
"numpy.append",
"tensorflow.exp",
"tensorflow.gradients",
"cv2.resize",
"numpy.uint8",
"cv2.waitKey",
"cv2.addWe... | [((557, 607), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, logit.shape[1]]'], {}), '(tf.float32, [None, logit.shape[1]])\n', (571, 607), True, 'import tensorflow as tf\n'), ((635, 658), 'tensorflow.placeholder', 'tf.placeholder', (['"""int64"""'], {}), "('int64')\n", (649, 658), True, 'import ten... |
import numpy as np
import math
import scipy.sparse.linalg
from scipy.sparse import csr_matrix as csr
from scipy.sparse import bmat
from fineProc import *
from coarseProc import *
class jacobi():
def __init__(self, fineProcs):
self.nP = len(fineProcs)
self.fine = fineProcs
def init(self)... | [
"numpy.zeros"
] | [((609, 620), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (617, 620), True, 'import numpy as np\n')] |
# You need to implement your own query method
# See the batch_sampling method at the bottom. Currently it's running in sequential. Please modify it accordingly if you need parallel implementation (which is straightforward).
import numpy as np
num_queries = 0
# Example 1: a simple sparse linear function, please unc... | [
"numpy.random.seed",
"numpy.random.randint",
"numpy.zeros",
"numpy.random.random"
] | [((3811, 3822), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (3819, 3822), True, 'import numpy as np\n'), ((976, 1000), 'numpy.random.randint', 'np.random.randint', (['(10000)'], {}), '(10000)\n', (993, 1000), True, 'import numpy as np\n'), ((1009, 1026), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n... |
# ===========================================================================
# Conclusion:
# Stack parameters and precompute_inputs significantly increase speed
# ===========================================================================
from __future__ import print_function, division
import os
os.environ['ODIN'] = ... | [
"odin.tensor.concatenate",
"odin.tensor.transpose",
"odin.tensor.dot",
"time.time",
"numpy.random.rand",
"odin.tensor.function",
"odin.tensor.zeros"
] | [((752, 791), 'odin.tensor.concatenate', 'T.concatenate', (['(W1, W2, W3, W4)'], {'axis': '(1)'}), '((W1, W2, W3, W4), axis=1)\n', (765, 791), True, 'from odin import tensor as T\n'), ((809, 820), 'odin.tensor.dot', 'T.dot', (['X', 'W'], {}), '(X, W)\n', (814, 820), True, 'from odin import tensor as T\n'), ((855, 867),... |
import numpy as np
import torch
class StateExtractor:
"""
This whole class assumes a very specific structure of the state :
points come first, angles next, and target is last
"""
PARTIAL_STATE_OPTIONS = ["position", "angles", "velocity", "target", "raw_angles"]
def __init__(self, num_points, po... | [
"numpy.array",
"numpy.arctan2",
"torch.cat",
"numpy.concatenate"
] | [((2323, 2345), 'numpy.arctan2', 'np.arctan2', (['s_th', 'c_th'], {}), '(s_th, c_th)\n', (2333, 2345), True, 'import numpy as np\n'), ((4197, 4276), 'numpy.array', 'np.array', (['[point[0] * self.img_w, point[1] * self.img_h, point[2] * self.img_d]'], {}), '([point[0] * self.img_w, point[1] * self.img_h, point[2] * sel... |
#######################
# #
# Halo models #
# #
#######################
################
# Explanations #
################
#This program contains the Standard Halo Model
##########
# Import #
##########
#This part of the code imports the necessary Python libraries.... | [
"numpy.minimum",
"numpy.sum",
"scipy.special.erf",
"numericalunits.reset_units",
"numpy.array",
"numpy.exp",
"numpy.sqrt"
] | [((534, 550), 'numericalunits.reset_units', 'nu.reset_units', ([], {}), '()\n', (548, 550), True, 'import numericalunits as nu\n'), ((957, 1025), 'numpy.minimum', 'minimum', (['(1)', '((v_esc ** 2 - v_earth ** 2 - v ** 2) / (2 * v_earth * v))'], {}), '(1, (v_esc ** 2 - v_earth ** 2 - v ** 2) / (2 * v_earth * v))\n', (9... |
import pandas as pd
import numpy as np
import torch.optim as optim
import json
import sys
import time
import torch
import math
from torch import nn
# from skorch import NeuralNetClassifier
from rf import one_h_suits, get_tree_info, create_unstructured_example
from rf import process_structured_test_examples, cache_dir,... | [
"torch.nn.Dropout",
"nsl.utils.add_cmd_line_args",
"numpy.random.seed",
"numpy.sum",
"numpy.argmax",
"pandas.read_csv",
"json.dumps",
"sklearn.tree.DecisionTreeClassifier",
"numpy.mean",
"experiment_config.process_custom_args",
"torch.nn.Softmax",
"torch.device",
"torch.no_grad",
"sys.path... | [((615, 633), 'os.path.realpath', 'realpath', (['__file__'], {}), '(__file__)\n', (623, 633), False, 'from os.path import dirname, realpath\n'), ((645, 663), 'os.path.dirname', 'dirname', (['file_path'], {}), '(file_path)\n', (652, 663), False, 'from os.path import dirname, realpath\n'), ((677, 694), 'os.path.dirname',... |
import pytest
import os, datetime, tempfile
import numpy as np
import pandas as pd
import datacompy
from ccgcrv.ccgcrv import ccgcrv
from ccgcrv.ccg_dates import datesOk, intDate, \
getDate, toMonthDay, getDatetime, getTime, dec2date,\
dateFromDecimalDate, datetimeFromDateAndTime
@pytest.fixture
def curvefil... | [
"ccgcrv.ccg_dates.getDatetime",
"tempfile.TemporaryDirectory",
"pandas.read_csv",
"datacompy.Compare",
"ccgcrv.ccg_dates.getDate",
"ccgcrv.ccg_dates.datetimeFromDateAndTime",
"datetime.date",
"datetime.datetime",
"ccgcrv.ccg_dates.datesOk",
"ccgcrv.ccg_dates.toMonthDay",
"pytest.raises",
"ccgc... | [((357, 410), 'os.path.join', 'os.path.join', (['rootdir', '"""test_data"""', '"""mlotestdata.txt"""'], {}), "(rootdir, 'test_data', 'mlotestdata.txt')\n", (369, 410), False, 'import os, datetime, tempfile\n'), ((1215, 1282), 'os.path.join', 'os.path.join', (['rootdir', '"""test_data"""', '"""expected_curvefit_results.... |
# Common
import os
import logging
import warnings
import argparse
import numpy as np
from tqdm import tqdm
# torch
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
# my module
from dataset.semkitti_trainset import Se... | [
"torch.cuda.synchronize",
"network.RandLANet.Network",
"os.mkdir",
"argparse.ArgumentParser",
"torch.cuda.device_count",
"os.path.isfile",
"utils.metric.compute_acc",
"utils.metric.IoUCalculator",
"torch.no_grad",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.load",
"os.path.exists",... | [((556, 589), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (579, 589), False, 'import warnings\n'), ((599, 624), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (622, 624), False, 'import argparse\n'), ((1565, 1609), 'os.path.join', 'os.path.join'... |
import tensorflow as tf
import numpy as np
import time
from utils.logger import log, Logger
from pprint import pprint
from core.buffers.buffer import Buffer_PPO
from core.PPO.policy_categorical import Policy_PPO_Categorical
from core.PPO.policy_continuous import Policy_PPO_Continuous
from core.Env import UnityEnv
from... | [
"tensorflow.random.set_seed",
"numpy.random.seed",
"core.SIL.policy_sil.SIL",
"core.PPO.policy_continuous.Policy_PPO_Continuous",
"core.buffers.buffer.Buffer_PPO",
"utils.logger.Logger",
"pprint.pprint",
"utils.logger.log",
"core.PPO.policy_categorical.Policy_PPO_Categorical"
] | [((1236, 1260), 'utils.logger.log', 'log', (['"""Policy Parameters"""'], {}), "('Policy Parameters')\n", (1239, 1260), False, 'from utils.logger import log, Logger\n'), ((1269, 1310), 'pprint.pprint', 'pprint', (['policy_params'], {'indent': '(5)', 'width': '(10)'}), '(policy_params, indent=5, width=10)\n', (1275, 1310... |
""" TensorMONK :: plots """
import torch
import torch.nn.functional as F
import torchvision.utils as tutils
import visdom
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib
from PIL import Image as ImPIL
from torchvision import transforms
matplotlib.use('Agg'... | [
"pandas.DataFrame",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.close",
"visdom.Visdom",
"torch.cat",
"PIL.Image.open",
"matplotlib.use",
"torchvision.utils.save_image",
"numpy.array",
"torch.nn.functional.interpolate",
"matplotlib.pyplot.subplots",
"sea... | [((300, 321), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (314, 321), False, 'import matplotlib\n'), ((334, 355), 'torchvision.transforms.ToTensor', 'transforms.ToTensor', ([], {}), '()\n', (353, 355), False, 'from torchvision import transforms\n'), ((724, 746), 'visdom.Visdom', 'visdom.Visdom... |
"""Test energycal.py"""
import pytest
import numpy as np
import becquerel as bq
TEST_DATA_LENGTH = 256
TEST_COUNTS = 4
TEST_GAIN = 8.23
TEST_EDGES_KEV = np.arange(TEST_DATA_LENGTH + 1) * TEST_GAIN
@pytest.fixture(params=[0.37, 3.7, 1, 2])
def slope(request):
return request.param
@pytest.fixture(params=[-4, 0... | [
"becquerel.LinearEnergyCal.from_points",
"numpy.sum",
"becquerel.LinearEnergyCal.from_coeffs",
"numpy.isscalar",
"numpy.allclose",
"becquerel.Spectrum",
"pytest.fixture",
"numpy.any",
"numpy.append",
"pytest.raises",
"numpy.arange",
"numpy.random.poisson",
"numpy.array",
"becquerel.LinearE... | [((203, 243), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[0.37, 3.7, 1, 2]'}), '(params=[0.37, 3.7, 1, 2])\n', (217, 243), False, 'import pytest\n'), ((292, 327), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[-4, 0, 1.1]'}), '(params=[-4, 0, 1.1])\n', (306, 327), False, 'import pytest\n'), ((3029, 333... |
## File: simple_regression.py
## Date Created: 01/27/2019
## Author: Wambugu "Innocent" Kironji
## Class: ECE 580 - Introduction to Machine Learning
## Description:
## Doing a simple regression model of specific automobile data taken from UCI database
import matplotlib.pyplot as plt
import numpy as np
import itertool... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.close",
"numpy.asarray",
"numpy.transpose",
"sklearn.linear_model.LinearRegression",
"itertools.combinations",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.p... | [((3181, 3198), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y'], {}), '(x, y)\n', (3192, 3198), True, 'import matplotlib.pyplot as plt\n'), ((3200, 3216), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (3209, 3216), True, 'import matplotlib.pyplot as plt\n'), ((3218, 3236), 'matplotlib.py... |
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.signal import find_peaks
import csv
import os
def find_vel(i,x_list,y_list):
if i < 1 or i >= len(x_list):
return 0
if (x_list[i-1] == 0 and y_list[i-1] == 0) or (x_list[i] == 0 and y_list[i] == 0):
return 0
return (ab... | [
"csv.reader",
"csv.writer",
"numpy.abs",
"pandas.read_csv",
"os.path.isfile",
"scipy.signal.find_peaks"
] | [((1931, 1956), 'pandas.read_csv', 'pd.read_csv', (['denoise_file'], {}), '(denoise_file)\n', (1942, 1956), True, 'import pandas as pd\n'), ((2237, 2284), 'scipy.signal.find_peaks', 'find_peaks', (['y_denoise'], {'prominence': '(8)', 'distance': '(5)'}), '(y_denoise, prominence=8, distance=5)\n', (2247, 2284), False, '... |
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from glob import glob
from pybind11.setup_helpers import Pybind11Extension, build_ext
from setuptools import setup
import shlex
import subproce... | [
"subprocess.check_output",
"numpy.get_include",
"setuptools.setup",
"glob.glob"
] | [((1138, 1406), 'setuptools.setup', 'setup', ([], {'name': '"""pyrbgt"""', 'version': '"""0.0.1"""', 'author': '"""<NAME>"""', 'url': '"""https://github.com/facebookresearch/pyrobot.git"""', 'license': '"""MIT"""', 'python_requires': '""">=3.6"""', 'package_dir': "{'': 'src'}", 'packages': "['pyrbgt']", 'cmdclass': "{'... |
import numpy as np
import warnings
from pyquil.numpy_simulator import NumpyWavefunctionSimulator
from forest.benchmarking.quantum_volume import *
from forest.benchmarking.quantum_volume import _naive_program_generator
np.random.seed(1)
def test_ideal_sim_heavy_probs(qvm):
qvm.qam.random_seed = 1
depths = [2,... | [
"numpy.random.seed",
"warnings.simplefilter",
"warnings.catch_warnings",
"numpy.testing.assert_allclose",
"pyquil.numpy_simulator.NumpyWavefunctionSimulator"
] | [((219, 236), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (233, 236), True, 'import numpy as np\n'), ((735, 793), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['probs', 'target_probs'], {'atol': '(0.05)'}), '(probs, target_probs, atol=0.05)\n', (761, 793), True, 'import numpy as np... |
import numpy as np
from Kernel import Kernel
class LinearKernel(Kernel):
def __init__(self):
pass
def eval(self, X, Y):
return np.dot(X, Y) | [
"numpy.dot"
] | [((153, 165), 'numpy.dot', 'np.dot', (['X', 'Y'], {}), '(X, Y)\n', (159, 165), True, 'import numpy as np\n')] |
"""Create isometric logratio transformed coordinates for MRI data."""
from matplotlib.colors import LogNorm
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import os
import numpy as np
import compoda.core as tet
from compoda.utils import truncate_range, scale_range
from nibabel import load, save, ... | [
"numpy.ones",
"matplotlib.patches.Polygon",
"matplotlib.pyplot.figure",
"compoda.core.perturb",
"compoda.core.closure",
"numpy.copy",
"numpy.power",
"matplotlib.pyplot.colorbar",
"numpy.linspace",
"compoda.utils.scale_range",
"nibabel.Nifti1Image",
"matplotlib.pyplot.show",
"compoda.utils.tr... | [((352, 381), 'nibabel.load', 'load', (['"""/path/to/file1.nii.gz"""'], {}), "('/path/to/file1.nii.gz')\n", (356, 381), False, 'from nibabel import load, save, Nifti1Image\n'), ((389, 418), 'nibabel.load', 'load', (['"""/path/to/file2.nii.gz"""'], {}), "('/path/to/file2.nii.gz')\n", (393, 418), False, 'from nibabel imp... |
import matplotlib
matplotlib.use('Agg')
import os
from os.path import join
import argparse
import torch
import numpy as np
import pickle
import sys
import datetime
sys.path.append('./utils')
from torch import optim
from torch import nn
from torch import multiprocessing
from torch.optim import lr_scheduler
from torch.a... | [
"argparse.ArgumentParser",
"utils.builder_utils.time_stamped",
"torch.cat",
"torch.cuda.device_count",
"numpy.mean",
"os.path.join",
"sys.path.append",
"torch.utils.data.DataLoader",
"utils.builder_utils.ensure_folder",
"utils.builder_utils.distance",
"torch.load",
"torch.optim.lr_scheduler.Re... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((164, 190), 'sys.path.append', 'sys.path.append', (['"""./utils"""'], {}), "('./utils')\n", (179, 190), False, 'import sys\n'), ((1419, 1448), 'sys.path.append', 'sys.path.append', (['EXP_ROOT_DIR... |
import matplotlib.pyplot as plt
import numpy as np
import itertools as itt
import pathlib as pl
from dPCA import dPCA
import src.visualization.fancy_plots
from src.data.load import load
from src.metrics.reliability import signal_reliability
from src.data import dPCA as cdPCA, rasters as tp
all_sites = ['ley070a', # ... | [
"src.metrics.reliability.signal_reliability",
"src.data.dPCA.format_raster",
"matplotlib.pyplot.subplot2grid",
"src.data.rasters.make_full_array",
"dPCA.dPCA.dPCA",
"src.data.load.load",
"matplotlib.pyplot.figure",
"pathlib.Path",
"numpy.arange"
] | [((837, 847), 'src.data.load.load', 'load', (['site'], {}), '(site)\n', (841, 847), False, 'from src.data.load import load\n'), ((1018, 1085), 'src.metrics.reliability.signal_reliability', 'signal_reliability', (['sig', '"""\\\\ASTIM_*"""'], {'threshold': "meta['reliability']"}), "(sig, '\\\\ASTIM_*', threshold=meta['r... |
import arms.sensor.tcp as tcp
import sys
import arms.utils.log as log
from arms.config import config as c
import numpy as np
from threading import Thread
from time import sleep
"""
A simple implementation with an initialization that can take a different ip adress
if necessary.
The connect method connects and the disc... | [
"numpy.radians",
"numpy.divide",
"arms.sensor.tcp.sensorConnect",
"time.sleep",
"arms.sensor.tcp.sensorDisconnect",
"numpy.sin",
"numpy.array",
"arms.sensor.tcp.ping",
"numpy.cos",
"numpy.dot",
"arms.utils.log.sensor.info",
"arms.sensor.tcp.sensorRead"
] | [((2005, 2027), 'numpy.radians', 'np.radians', (['self.angle'], {}), '(self.angle)\n', (2015, 2027), True, 'import numpy as np\n'), ((2089, 2116), 'numpy.array', 'np.array', (['((c, -s), (s, c))'], {}), '(((c, -s), (s, c)))\n', (2097, 2116), True, 'import numpy as np\n'), ((2160, 2186), 'arms.sensor.tcp.sensorConnect',... |
import numpy as np
import math
class Ikernal23:
"""
实现对局部数据的拟合,并求出相应的各阶偏导数,
进而得到相应的滤波算子
程序可以对二维数据和三维数据进行工作
"""
def __init__(self, ker_size, p1, p2, sigam2, gama, step, dimension):
"""
:param ker_size:核的“半径”,卷积核的尺寸为:2n+1*2n+1
:param p1:多项式的阶数
:param ... | [
"numpy.zeros",
"numpy.ones",
"numpy.transpose",
"numpy.array",
"numpy.linalg.inv",
"numpy.matmul",
"numpy.eye"
] | [((1488, 1522), 'numpy.zeros', 'np.zeros', (['(ker_n, ker_n)', 'np.float'], {}), '((ker_n, ker_n), np.float)\n', (1496, 1522), True, 'import numpy as np\n'), ((1781, 1797), 'numpy.linalg.inv', 'np.linalg.inv', (['K'], {}), '(K)\n', (1794, 1797), True, 'import numpy as np\n'), ((1811, 1830), 'numpy.ones', 'np.ones', (['... |
import numpy as np
a = [np.array([-4.05176567e-05, 1.32266985e-01, 8.89532573e+02])]
b = np.array(a).reshape(3,)
print(b) | [
"numpy.array"
] | [((25, 77), 'numpy.array', 'np.array', (['[-4.05176567e-05, 0.132266985, 889.532573]'], {}), '([-4.05176567e-05, 0.132266985, 889.532573])\n', (33, 77), True, 'import numpy as np\n'), ((92, 103), 'numpy.array', 'np.array', (['a'], {}), '(a)\n', (100, 103), True, 'import numpy as np\n')] |
import cv2
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.timer import Timer
from utils.blob import im_list_to_blob
from fast_rcnn.nms_wrapper import nms
from rpn_msr.proposal_layer import proposal_layer as proposal_layer_py
from rpn... | [
"numpy.argmax",
"network.np_to_variable",
"torch.nn.functional.dropout",
"torch.cat",
"fast_rcnn.bbox_transform.bbox_transform_inv",
"numpy.round",
"network.set_trainable",
"numpy.max",
"roi_pooling.modules.roi_pool.RoIPool",
"faster_rcnn.RPN",
"fast_rcnn.bbox_transform.clip_boxes",
"cv2.resiz... | [((1324, 1434), 'numpy.asarray', 'np.asarray', (["['Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting', 'Cyclist', 'Tram',\n 'Misc', 'DontCare']"], {}), "(['Car', 'Van', 'Truck', 'Pedestrian', 'Person_sitting',\n 'Cyclist', 'Tram', 'Misc', 'DontCare'])\n", (1334, 1434), True, 'import numpy as np\n'), ((1518, 15... |
import numpy as np
import pandas as pd
import argparse
import glob
import os
import time
import re
from multiprocessing import Pool
'''
****************************************************************
GLOBAL VARIABLES
****************************************************************
'''
MAX_ENTITY_LENGTH = 20
MAX_ENTI... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_csv",
"time.time",
"re.findall",
"numpy.array",
"pandas.Series",
"pandas.concat",
"os.listdir",
"re.compile"
] | [((501, 700), 're.compile', 're.compile', (['"""\\\\b(Inc|Incorporation|Corp|Corporation|Institute|\\\\\nUniversity|School|College|Department|Org|Organization|Times|Committee|Foundation|\\\\\nParty|Agency|Council|News)\\\\b"""', 're.I'], {}), '(\n """\\\\b(Inc|Incorporation|Corp|Corporation|Institute|\\\\\nUniversit... |
import os
import tensorflow as tf
from tensorflow.keras.datasets import mnist
from PIL import Image, ImageOps
import numpy as np
from tqdm import tqdm
import argparse
import shutil
# parser = argparse.ArgumentParser(description='Create Colored (Red, Blue, Yelllow, Green, Purple) MNIST dataset.')
# parser.add_argument(... | [
"os.mkdir",
"numpy.random.seed",
"os.path.exists",
"tensorflow.keras.datasets.mnist.load_data",
"numpy.where",
"numpy.arange",
"PIL.ImageOps.colorize",
"shutil.move",
"numpy.random.normal",
"PIL.Image.fromarray",
"numpy.random.shuffle"
] | [((990, 1007), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (1005, 1007), False, 'from tensorflow.keras.datasets import mnist\n'), ((777, 815), 'os.path.exists', 'os.path.exists', (["(output_path + '/train')"], {}), "(output_path + '/train')\n", (791, 815), False, 'import os\n'), ((... |
import numpy
import keras
from keras.models import Sequential
from keras.layers import LSTM, Dropout, Dense, Conv1D, MaxPooling1D, Activation
from keras.layers.embeddings import Embedding
from keras.callbacks import EarlyStopping
from termcolor import cprint
from ...tools import check_argument as check
CLF_INFO = {
... | [
"keras.layers.embeddings.Embedding",
"numpy.random.seed",
"keras.layers.Activation",
"keras.layers.Dropout",
"keras.layers.LSTM",
"keras.optimizers.Adam",
"keras.layers.Conv1D",
"keras.layers.MaxPooling1D",
"keras.layers.Dense",
"keras.callbacks.EarlyStopping",
"keras.models.Sequential",
"term... | [((3735, 3771), 'numpy.random.seed', 'numpy.random.seed', (['self.random_state'], {}), '(self.random_state)\n', (3752, 3771), False, 'import numpy\n'), ((4151, 4163), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (4161, 4163), False, 'from keras.models import Sequential\n'), ((4737, 4851), 'keras.optimizer... |
# "magictoken" is used for markers as beginning and ending of example text.
import unittest
# magictoken.ex_structref_type_definition.begin
import numpy as np
from numba import njit
from numba.core import types
from numba.experimental import structref
from numba.tests.support import skip_unless_scipy
# Define a S... | [
"numba.experimental.structref.define_proxy",
"numpy.random.seed",
"numpy.zeros",
"numpy.random.random",
"numpy.linalg.norm",
"numba.core.types.unliteral",
"numba.core.extending.overload_method",
"numba.experimental.structref.StructRefProxy.__new__",
"numba.core.errors.TypingError"
] | [((2369, 2435), 'numba.experimental.structref.define_proxy', 'structref.define_proxy', (['MyStruct', 'MyStructType', "['name', 'vector']"], {}), "(MyStruct, MyStructType, ['name', 'vector'])\n", (2391, 2435), False, 'from numba.experimental import structref\n'), ((1378, 1429), 'numba.experimental.structref.StructRefPro... |
import cv2
import numpy as np
# 매칭을 위한 이미지 읽기
target = cv2.imread('img/4star.jpg') # 매칭 대상
shapes = cv2.imread('img/shapestomatch.jpg') # 여러 도형
# 그레이 스케일 변환
targetGray = cv2.cvtColor(target, cv2.COLOR_BGR2GRAY)
shapesGray = cv2.cvtColor(shapes, cv2.COLOR_BGR2GRAY)
# 바이너리 스케일 변환
ret, targetTh = cv2.threshold(targetGray... | [
"cv2.matchShapes",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"cv2.destroyAllWindows",
"numpy.shape",
"cv2.imread",
"numpy.array",
"cv2.drawContours",
"cv2.imshow",
"cv2.findContours"
] | [((56, 83), 'cv2.imread', 'cv2.imread', (['"""img/4star.jpg"""'], {}), "('img/4star.jpg')\n", (66, 83), False, 'import cv2\n'), ((101, 136), 'cv2.imread', 'cv2.imread', (['"""img/shapestomatch.jpg"""'], {}), "('img/shapestomatch.jpg')\n", (111, 136), False, 'import cv2\n'), ((171, 211), 'cv2.cvtColor', 'cv2.cvtColor', ... |
if __name__== "__main__":
import librosa, librosa.display
import numpy as np
import matplotlib.pyplot as plt
# import torch
file = "example5guitar.wav"
'''able to convert any .wav file to spectrogram in pytorch and back'''
# torch.set_printoptions(precision=10)
#numpy array ... | [
"matplotlib.pyplot.title",
"numpy.abs",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.colorbar",
"librosa.load",
"librosa.core.stft",
"librosa.amplitude_to_db",
"librosa.display.specshow",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xlabel"
] | [((343, 371), 'librosa.load', 'librosa.load', (['file'], {'sr': '(44100)'}), '(file, sr=44100)\n', (355, 371), False, 'import librosa, librosa.display\n'), ((382, 435), 'librosa.core.stft', 'librosa.core.stft', (['signal'], {'hop_length': '(512)', 'n_fft': '(2048)'}), '(signal, hop_length=512, n_fft=2048)\n', (399, 435... |
import scipy.io as sio
import numpy as np
import os
import sys
sys.path.append('/data/jux/BBL/projects/pncControlEnergy/scripts/Replication/10th_PredictAge');
import Ridge_CZ_Sort
ReplicationFolder = '/data/jux/BBL/projects/pncControlEnergy/results/Replication';
DataFolder = ReplicationFolder + '/data/Age_Prediction'... | [
"sys.path.append",
"scipy.io.loadmat",
"numpy.transpose",
"Ridge_CZ_Sort.Ridge_Weight",
"numpy.arange"
] | [((64, 168), 'sys.path.append', 'sys.path.append', (['"""/data/jux/BBL/projects/pncControlEnergy/scripts/Replication/10th_PredictAge"""'], {}), "(\n '/data/jux/BBL/projects/pncControlEnergy/scripts/Replication/10th_PredictAge'\n )\n", (79, 168), False, 'import sys\n'), ((354, 414), 'scipy.io.loadmat', 'sio.loadma... |
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
# Import data manipulation libraries
from io import BytesIO
import tarfile
from enum import Enum
from zipfile import ZipFile
# Import scientific
import numpy as np
import pandas as pd
#from . import utils
import utils
from quaternion_ma... | [
"pandas.DataFrame",
"utils.load_json",
"zipfile.ZipFile",
"pandas.read_csv",
"numpy.empty",
"os.path.dirname",
"utils.load_binaryfile_npy",
"numpy.where",
"numpy.linalg.norm",
"numpy.loadtxt",
"utils.create_json"
] | [((3757, 3771), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3769, 3771), True, 'import pandas as pd\n'), ((44, 69), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (59, 69), False, 'import sys, os\n'), ((3795, 3809), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3807, 3809)... |
# pylint: disable=invalid-name
# pylint: disable=too-many-arguments
"""
Useful routines for step-index planar waveguides.
See <https://ofiber.readthedocs.io> for usage examples.
A step-index planar waveguide is a flat waveguide that consists of three layers.
Let z be the direction of light propagation through the wav... | [
"scipy.optimize.brentq",
"numpy.empty",
"numpy.empty_like",
"numpy.sign",
"numpy.sin",
"numpy.tan",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"numpy.sqrt"
] | [((2154, 2182), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (2166, 2182), True, 'import matplotlib.pyplot as plt\n'), ((2220, 2259), 'numpy.linspace', 'np.linspace', (['abit', '(np.pi / 2 - abit)', '(50)'], {}), '(abit, np.pi / 2 - abit, 50)\n', (2231, 2259), True, '... |
from .myqt import QT
import pyqtgraph as pg
import numpy as np
from .. import labelcodes
from .base import WidgetBase
class ClusterBaseList(WidgetBase):
"""
Base for ClusterPeakList (catalogue window) and ClusterSpikeList (Peeler window)
"""
def __init__(self, controller=None, parent=None):
... | [
"numpy.argsort",
"numpy.abs",
"numpy.arange",
"numpy.searchsorted"
] | [((2158, 2182), 'numpy.arange', 'np.arange', (['clusters.size'], {}), '(clusters.size)\n', (2167, 2182), True, 'import numpy as np\n'), ((2245, 2283), 'numpy.argsort', 'np.argsort', (["clusters['max_on_channel']"], {}), "(clusters['max_on_channel'])\n", (2255, 2283), True, 'import numpy as np\n'), ((4333, 4378), 'numpy... |
import numpy as np
import matplotlib.pyplot as plt
import math
vxo=1
vyo=1
vzo=1
vo=np.array([vxo,vyo,vzo])
Bx=0
By=0
Bz=1
B= np.array([Bx,By,Bz])
q=-1 #particle charge
m=1 #particle mass
C=np.cross(vo,B)
f=q*C #magnetic force acting on the particle
a=f/m #acc.
vx=[vxo]
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"numpy.cross",
"numpy.array",
"numpy.sqrt"
] | [((96, 121), 'numpy.array', 'np.array', (['[vxo, vyo, vzo]'], {}), '([vxo, vyo, vzo])\n', (104, 121), True, 'import numpy as np\n'), ((146, 168), 'numpy.array', 'np.array', (['[Bx, By, Bz]'], {}), '([Bx, By, Bz])\n', (154, 168), True, 'import numpy as np\n'), ((225, 240), 'numpy.cross', 'np.cross', (['vo', 'B'], {}), '... |
#!/usr/bin/env python3
__description__ = \
"""
Calculate enrichment of peptides given their counts in an experiment with and
without competitor added. This can also coarse-grain this calculation and
calculate enrichment of clusters and assign those enrichments to individual
cluster members.
"""
__author__ = "<NAME>"
_... | [
"numpy.sum",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show",
"numpy.log",
"numpy.std",
"numpy.ones",
"numpy.isnan",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"numpy.arange",
"numpy.random.normal",
"numpy.sqrt"
] | [((1334, 1350), 'numpy.array', 'np.array', (['params'], {}), '(params)\n', (1342, 1350), True, 'import numpy as np\n'), ((2884, 2907), 'numpy.array', 'np.array', (['param_guesses'], {}), '(param_guesses)\n', (2892, 2907), True, 'import numpy as np\n'), ((4291, 4309), 'numpy.array', 'np.array', (['aic_list'], {}), '(aic... |
import numpy as np
def buildBottomTile(geom, offset):
xLow = 0
yLow = 0
xHigh = xLow + geom["tile"]["long"]
yHigh = yLow + geom["tile"]["short"]
return (xLow + offset[0], xHigh + offset[0]), (yLow + offset[1], yHigh + offset[1])
def buildRightTile(geom, offset):
xLow = geom["tile"]["long... | [
"numpy.array"
] | [((1580, 1654), 'numpy.array', 'np.array', (["[[xRangeA, yRangeA, (z - 0.5, z + 0.5)] for z in geom['z']['a']]"], {}), "([[xRangeA, yRangeA, (z - 0.5, z + 0.5)] for z in geom['z']['a']])\n", (1588, 1654), True, 'import numpy as np\n'), ((1667, 1741), 'numpy.array', 'np.array', (["[[xRangeC, yRangeC, (z - 0.5, z + 0.5)]... |
"""
This file defines the core research contribution
"""
import os
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, Sequence
import random
import copy
from PIL import Image
import numpy as np
import glob
import warnings
import json
import collections
import contextlib
import subproces... | [
"argparse.ArgumentParser",
"torch.set_num_threads",
"glob.glob",
"torchvision.transforms.Normalize",
"os.path.join",
"subprocess.check_call",
"torch.utils.data.DataLoader",
"evaluate.ensemble_runs_evaulate",
"torchvision.transforms.ToTensor",
"socket.gethostname",
"easydict.EasyDict",
"numpy.l... | [((10676, 10698), 'copy.deepcopy', 'copy.deepcopy', (['hparams'], {}), '(hparams)\n', (10689, 10698), False, 'import copy\n'), ((10995, 11043), 'tqdm.auto.tqdm.write', 'tqdm.write', (['"""Check for existing checkpoints ..."""'], {}), "('Check for existing checkpoints ...')\n", (11005, 11043), False, 'from tqdm.auto imp... |
import abc
from collections import OrderedDict, Iterable
from numbers import Real, Integral
from xml.etree import ElementTree as ET
import sys
import warnings
import numpy as np
import openmc
import openmc.checkvalue as cv
from openmc.surface import Halfspace
from openmc.region import Region, Intersection, Complement... | [
"warnings.simplefilter",
"openmc.checkvalue.check_length",
"openmc.checkvalue.check_greater_than",
"numpy.ravel",
"openmc.region.Intersection",
"openmc.checkvalue.check_type",
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.SubElement",
"collections.OrderedDict",
"warnings.warn",
"openmc... | [((439, 490), 'warnings.simplefilter', 'warnings.simplefilter', (['"""always"""', 'DeprecationWarning'], {}), "('always', DeprecationWarning)\n", (460, 490), False, 'import warnings\n'), ((6207, 6263), 'openmc.checkvalue.check_type', 'cv.check_type', (['"""cell rotation"""', 'rotation', 'Iterable', 'Real'], {}), "('cel... |
#!/usr/bin/env python3
#coding=utf-8
import numpy as np
import time
from math import cos, sin, sqrt, pi, atan, asin, atan, atan2
from scipy.optimize import least_squares
from scipy.spatial.transform import Rotation
from angles import normalize_angle
import rospy
from origarm_ros.srv import ik
from origarm_ros.msg impo... | [
"math.atan",
"rospy.Subscriber",
"math.sqrt",
"angles.normalize_angle",
"math.sin",
"scipy.optimize.least_squares",
"scipy.spatial.transform.Rotation.from_quat",
"rospy.init_node",
"math.cos",
"numpy.array",
"rospy.spin",
"rospy.Service"
] | [((986, 1011), 'rospy.init_node', 'rospy.init_node', (['"""ik_srv"""'], {}), "('ik_srv')\n", (1001, 1011), False, 'import rospy\n'), ((1024, 1067), 'rospy.Service', 'rospy.Service', (['"""ik"""', 'ik', 'self.handle_ik_srv'], {}), "('ik', ik, self.handle_ik_srv)\n", (1037, 1067), False, 'import rospy\n'), ((1077, 1138),... |
import numpy as np
from scipy.sparse import csc_matrix
from .. import resources
resources.silx_integration()
from silx.opencl.processing import OpenclProcessing
import pyopencl.array as parray
from pyopencl.tools import dtype_to_ctype
class BaseCorrelator(object):
"Abstract base class for all Correlators"
de... | [
"numpy.sum",
"numpy.isscalar",
"numpy.dtype",
"numpy.ones",
"pyopencl.tools.dtype_to_ctype",
"pyopencl.array.to_device",
"scipy.sparse.csc_matrix",
"numpy.arange",
"silx.opencl.processing.OpenclProcessing.__init__",
"numpy.array",
"numpy.iterable",
"numpy.ascontiguousarray",
"numpy.prod"
] | [((1080, 1098), 'numpy.isscalar', 'np.isscalar', (['shape'], {}), '(shape)\n', (1091, 1098), True, 'import numpy as np\n'), ((1765, 1807), 'numpy.arange', 'np.arange', (['(self.n_bins + 1)'], {'dtype': 'np.int32'}), '(self.n_bins + 1, dtype=np.int32)\n', (1774, 1807), True, 'import numpy as np\n'), ((1907, 1922), 'nump... |
# Random Forest Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
# train\valid
# n_estimator_sample = [10, 70, 100, 300, 500, 600, 700]
# max_depths_sample = [10, 14, 15, 16, 17, 19, 25, 70, 150]
n_estimator_sample = [10, 20, 30]
max_depths_sample = [10, 14, 16]
# Importing the... | [
"numpy.load",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.plot",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"sklearn.ensemble.RandomForestRegressor"
] | [((336, 375), 'numpy.load', 'np.load', (['"""data\\\\sdss_galaxy_colors.npy"""'], {}), "('data\\\\sdss_galaxy_colors.npy')\n", (343, 375), True, 'import numpy as np\n'), ((771, 837), 'sklearn.model_selection.train_test_split', 'train_test_split', (['features', 'targets'], {'test_size': '(0.2)', 'random_state': '(0)'}),... |
from sklearn.preprocessing import scale
from PIL import Image
import numpy as np
import json
import csv
def generate_csv(image_data, source_dir, dest):
with open(dest, 'w') as f:
writer = csv.writer(f)
writer.writerow(list(range(4096)) + ["target"])
for index, subject in enumera... | [
"json.load",
"csv.writer",
"sklearn.preprocessing.scale",
"PIL.Image.open",
"numpy.append"
] | [((211, 224), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (221, 224), False, 'import csv\n'), ((794, 806), 'json.load', 'json.load', (['f'], {}), '(f)\n', (803, 806), False, 'import json\n'), ((401, 443), 'PIL.Image.open', 'Image.open', (["(source_dir + '\\\\' + image_name)"], {}), "(source_dir + '\\\\' + image_n... |
# Copyright (c) 2020 PaddlePaddle 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 appli... | [
"paddle.fluid.initializer.ConstantInitializer",
"numpy.random.seed",
"numpy.ones",
"paddle.fluid.dygraph.SpectralNorm",
"numpy.arange",
"paddle.fluid.layers.concat",
"paddle.fluid.layers.reduce_sum",
"paddle.fluid.dygraph.guard",
"paddle.fluid.layers.sums",
"paddle.fluid.dygraph.BackwardStrategy",... | [((838, 854), 'paddle.fluid.CPUPlace', 'fluid.CPUPlace', ([], {}), '()\n', (852, 854), True, 'import paddle.fluid as fluid\n'), ((937, 963), 'paddle.fluid.dygraph.guard', 'fluid.dygraph.guard', (['place'], {}), '(place)\n', (956, 963), True, 'import paddle.fluid as fluid\n'), ((1063, 1083), 'numpy.random.seed', 'np.ran... |
import numpy as np
from benchml.accumulator import Accumulator
from benchml.logger import log
def read_split_props_single(split):
props = {k: v for kv in split.split(";") for k, v in [kv.split("=")]}
props["id"] = split
props["train:test"] = list(map(int, props["train:test"].split(":")))
return props... | [
"numpy.zeros_like",
"numpy.argsort",
"numpy.sort",
"numpy.mean",
"numpy.array"
] | [((1292, 1303), 'numpy.array', 'np.array', (['P'], {}), '(P)\n', (1300, 1303), True, 'import numpy as np\n'), ((1316, 1331), 'numpy.array', 'np.array', (['P_std'], {}), '(P_std)\n', (1324, 1331), True, 'import numpy as np\n'), ((1340, 1351), 'numpy.array', 'np.array', (['S'], {}), '(S)\n', (1348, 1351), True, 'import n... |
import numpy as np
import pytest
from galois_field.core import primitive_roots as pr
from galois_field.core.ElementInGFp import ElementInGFp
from galois_field.core.ElementInGFpn import ElementInGFpn
@pytest.mark.parametrize('inputs, expected', [
((ElementInGFp(2, 5),), True),
((ElementInGFp(4, 5),), False),
... | [
"galois_field.core.primitive_roots.is_primtive_root",
"galois_field.core.primitive_roots.random_primitive_root_over_Fp",
"galois_field.core.ElementInGFp.ElementInGFp",
"numpy.poly1d",
"galois_field.core.primitive_roots.random_primitive_root_over_Fpn",
"numpy.array",
"pytest.mark.parametrize"
] | [((1514, 2463), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""p, expected_contain"""', '[(5, [2, 3]), (31, [3, 11, 12, 13, 17, 21, 22, 24]), (499, [7, 10, 11, 15, \n 17, 19, 23, 28, 35, 40, 41, 42, 44, 50, 53, 58, 60, 61, 63, 65, 66, 68,\n 71, 75, 76, 79, 85, 86, 87, 89, 90, 92, 94, 95, 98, 99, 102,... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import axes3d, Axes3D
import cv2
def sphere(n):
theta = np.arange(-n, n + 1, 2) / n * np.pi
phi = np.arange(-n, n + 1, 2).T / n * np.pi / 2
theta = theta.reshape(1, n + 1)
phi = phi.reshape(n + 1, 1)... | [
"numpy.roll",
"cv2.cvtColor",
"matplotlib.pyplot.close",
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"matplotlib.cm.jet",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"numpy.cos",
"numpy.array",
"numpy.dot",
"numpy.arccos"
] | [((335, 346), 'numpy.cos', 'np.cos', (['phi'], {}), '(phi)\n', (341, 346), True, 'import numpy as np\n'), ((400, 413), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (406, 413), True, 'import numpy as np\n'), ((507, 531), 'numpy.dot', 'np.dot', (['cosphi', 'sintheta'], {}), '(cosphi, sintheta)\n', (513, 531), Tru... |
import random, pylab, numpy
#set line width
pylab.rcParams['lines.linewidth'] = 4
#set font size for titles
pylab.rcParams['axes.titlesize'] = 20
#set font size for labels on axes
pylab.rcParams['axes.labelsize'] = 20
#set size of numbers on x-axis
pylab.rcParams['xtick.labelsize'] = 16
#set size of numbers on y-axis... | [
"pylab.title",
"random.randint",
"numpy.std",
"pylab.ylabel",
"random.choice",
"random.random",
"random.seed",
"pylab.xlabel"
] | [((4283, 4310), 'pylab.xlabel', 'pylab.xlabel', (['"""Mean Return"""'], {}), "('Mean Return')\n", (4295, 4310), False, 'import random, pylab, numpy\n'), ((4311, 4338), 'pylab.ylabel', 'pylab.ylabel', (['"""Probability"""'], {}), "('Probability')\n", (4323, 4338), False, 'import random, pylab, numpy\n'), ((4339, 4396), ... |
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
'''Tests for bootstrapped... | [
"bootstrapped.bootstrap.BootstrapResults",
"bootstrapped.bootstrap.bootstrap_ab",
"bootstrapped.compare_functions.percent_change",
"numpy.random.seed",
"warnings.filterwarnings",
"bootstrapped.compare_functions.ratio",
"scipy.sparse.csr_matrix",
"numpy.array",
"numpy.mean",
"numpy.random.normal",
... | [((886, 903), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (900, 903), True, 'import numpy as np\n'), ((936, 969), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (959, 969), False, 'import warnings\n'), ((1023, 1052), 'bootstrapped.bootstrap.BootstrapResu... |
import numpy as np
import pandas as pd
import operator
import folium
import branca
from matplotlib import colors as mpl_colors
from matplotlib import cm as mpl_cm
paired_cmap = mpl_cm.get_cmap('Paired')
def make_flickr_link(row):
return 'https://www.flickr.com/photos/{owner}/{photoid}'.format(
photoid=r... | [
"operator.index",
"pandas.DataFrame",
"folium.map.Marker",
"matplotlib.cm.get_cmap",
"folium.Popup",
"branca.element.IFrame",
"numpy.argsort",
"folium.Map",
"folium.CircleMarker"
] | [((179, 204), 'matplotlib.cm.get_cmap', 'mpl_cm.get_cmap', (['"""Paired"""'], {}), "('Paired')\n", (194, 204), True, 'from matplotlib import cm as mpl_cm\n'), ((8785, 8932), 'folium.Map', 'folium.Map', ([], {'location': '(default_longlat.latitude, default_longlat.longitude)', 'zoom_start': '(13)', 'tiles': '"""cartodbp... |
from sklearn.model_selection import KFold
from torch.utils.data import Dataset, DataLoader
import matplotlib.pyplot as plt
from tqdm import tqdm
import seaborn as sns
import pandas as pd
import numpy as np
import opendp
import torch
def methodology2(data: pd.DataFrame, explanatories, responses: list):
"""
Fun... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"pandas.read_csv",
"torch.device",
"torch.no_grad",
"pandas.DataFrame",
"torch.nn.BCELoss",
"torch.utils.data.DataLoader",
"torch.FloatTensor",
"torch.nn.Linear",
"matplotlib.pyplot.show",
"torch.manual_seed",
"torch.max",
"torch.unsqueeze",
... | [((9704, 9891), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/fabiorodp/IN_STK5000_Adaptive_methods_for_data_based_decision_making/main/project1/data/observation_features.csv.gz"""'], {'header': 'None'}), "(\n 'https://raw.githubusercontent.com/fabiorodp/IN_STK5000_Adaptive_methods_for_da... |
# Import necessary modules
#from __future__ import division # Added by <NAME>
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from os import path
import logging
import pywcs
# Header
__author__ = "<NAME> & <NAME>"
__version__ = "2.0"
# HISTORY... | [
"numpy.sum",
"numpy.floor",
"astropy.io.fits.PrimaryHDU",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.sin",
"astropy.io.fits.getdata",
"re.search",
"matplotlib.pyplot.subplots",
"numpy.radians",
"matplotlib.pyplot.show",
"numpy.average",
"os.path.basename",
"numpy.cos",
"os.listdir... | [((7123, 7143), 'numpy.floor', 'np.floor', (['init_guess'], {}), '(init_guess)\n', (7131, 7143), True, 'import numpy as np\n'), ((9532, 9550), 'numpy.sum', 'np.sum', (['newGrid', '(0)'], {}), '(newGrid, 0)\n', (9538, 9550), True, 'import numpy as np\n'), ((9566, 9584), 'numpy.sum', 'np.sum', (['newGrid', '(1)'], {}), '... |
import json
# Training history, saving to disk and visualization
class History(object):
def __init__(self, log_path):
self.first_view = True
self.log_path = log_path
self.train_rewards = []
self.train_noise = []
self.train_steps = []
self.test_rewards = []
... | [
"matplotlib.pyplot.subplot",
"json.dump",
"json.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ion",
"numpy.cumsum",
"matplotlib.pyplot.figure"
] | [((3279, 3306), 'numpy.cumsum', 'np.cumsum', (['self.train_steps'], {}), '(self.train_steps)\n', (3288, 3306), True, 'import numpy as np\n'), ((3404, 3469), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(7, 4)', 'dpi': '(300)', 'facecolor': '"""w"""', 'edgecolor': '"""k"""'}), "(figsize=(7, 4), dpi=300, f... |
import numpy as np
import pdb
from pylayers.antprop.slab import *
from pylayers.antprop.diffRT import *
#
# Metalic case : MacNamara Page 202
#
Nf=100
Nr=100
fGHz = np.linspace(1,10,Nf)
N = 320/180.*np.ones(Nr)#320/180.
phi0 = np.ones(Nr)#np.linspace(0.01,2*np.pi-0.01,Nr)#40*np.pi/180.
phi = np.linspace(0.01,2*np.pi-0... | [
"numpy.abs",
"numpy.ones",
"numpy.shape",
"numpy.exp",
"numpy.linspace",
"numpy.cos"
] | [((166, 188), 'numpy.linspace', 'np.linspace', (['(1)', '(10)', 'Nf'], {}), '(1, 10, Nf)\n', (177, 188), True, 'import numpy as np\n'), ((228, 239), 'numpy.ones', 'np.ones', (['Nr'], {}), '(Nr)\n', (235, 239), True, 'import numpy as np\n'), ((294, 333), 'numpy.linspace', 'np.linspace', (['(0.01)', '(2 * np.pi - 0.01)',... |
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law... | [
"utils.resnet_model.resnet_configs.keys",
"argparse.ArgumentParser",
"torch.load",
"utils.resnet_model.build_resnet",
"numpy.argsort",
"utils.alexnet_model.build_alexnet",
"utils.dataloaders.load_jpeg_from_file",
"torch.no_grad"
] | [((1242, 1277), 'utils.resnet_model.resnet_configs.keys', 'resnet_models.resnet_configs.keys', ([], {}), '()\n', (1275, 1277), True, 'import utils.resnet_model as resnet_models\n'), ((3040, 3104), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch ImageNet Training"""'}), "(descripti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.