code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python
"""stereo_rgb.py: Python functions for interacting with stereo RGB Camera sensor data in TERRA-REF project."""
__author__ = "<NAME>, <NAME>"
import logging
import numpy as np
from scipy.ndimage.filters import convolve
from PIL import Image, ImageFilter
from terrautils.formats import create_geo... | [
"logging.getLogger",
"PIL.Image.fromarray",
"numpy.fromfile",
"terrautils.formats.create_geotiff",
"numpy.asarray",
"numpy.count_nonzero",
"numpy.array",
"numpy.zeros",
"scipy.ndimage.filters.convolve",
"numpy.rot90",
"numpy.zeros_like"
] | [((333, 360), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'import logging\n'), ((2746, 2763), 'numpy.zeros_like', 'np.zeros_like', (['im'], {}), '(im)\n', (2759, 2763), True, 'import numpy as np\n'), ((2772, 2789), 'numpy.zeros_like', 'np.zeros_like', (['im'], {}), '... |
import os.path as osp
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
from mmdet.core import BitmapMasks, PolygonMasks
from ..builder import PIPELINES
@PIPELINES.register_module()
class Stack:
def __init__(self):
pass
def __call__(self, results):
"""Call functions to lo... | [
"numpy.concatenate"
] | [((610, 649), 'numpy.concatenate', 'np.concatenate', (['[img, img, img]'], {'axis': '(2)'}), '([img, img, img], axis=2)\n', (624, 649), True, 'import numpy as np\n')] |
#!/usr/bin/python2
try:
import gi
gi.require_version('NumCosmo', '1.0')
gi.require_version('NumCosmoMath', '1.0')
except:
pass
import math
import numpy as np
import matplotlib.pyplot as plt
from gi.repository import GObject
from gi.repository import NumCosmo as Nc
from gi.repository import NumCosmoMath as Nc... | [
"gi.repository.NumCosmo.HIReionCamb.new",
"gi.repository.NumCosmoMath.cfg_init",
"matplotlib.pyplot.savefig",
"gi.repository.NumCosmo.HICosmo.new_from_name",
"gi.repository.NumCosmo.CBE.prec_new",
"gi.repository.NumCosmoMath.Vector.new",
"matplotlib.pyplot.ylabel",
"gi.repository.NumCosmo.HIPrimPowerL... | [((422, 436), 'gi.repository.NumCosmoMath.cfg_init', 'Ncm.cfg_init', ([], {}), '()\n', (434, 436), True, 'from gi.repository import NumCosmoMath as Ncm\n'), ((551, 574), 'gi.repository.NumCosmo.HIPrimPowerLaw.new', 'Nc.HIPrimPowerLaw.new', ([], {}), '()\n', (572, 574), True, 'from gi.repository import NumCosmo as Nc\n'... |
#!/usr/bin/env python3
import pickle
import os
import numpy as np
def get_sweep_parameters(parameters, env_config, index):
"""
Gets the parameters for the hyperparameter sweep defined by the index.
Each hyperparameter setting has a specific index number, and this function
will get the appropriate par... | [
"numpy.sqrt",
"pickle.dump",
"numpy.ones",
"pickle.load",
"os.path.join",
"numpy.argsort",
"numpy.array",
"numpy.stack",
"numpy.std"
] | [((7054, 7078), 'numpy.argsort', 'np.argsort', (['mean_returns'], {}), '(mean_returns)\n', (7064, 7078), True, 'import numpy as np\n'), ((13995, 14055), 'numpy.array', 'np.array', (["data['experiment']['agent']['parameters'][hp_name]"], {}), "(data['experiment']['agent']['parameters'][hp_name])\n", (14003, 14055), True... |
"""
Plot figure 4A, the results of swapping tissue types between cancer types
and the effect on the performance of svMIL2.
"""
## for eah cancer type, get the performance from all swap folders
import os
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
#Names of the cancer... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"seaborn.heatmap",
"os.path.isfile",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.std",
"pandas.DataFrame",
"numpy.loadtxt"
] | [((3141, 3167), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 5)'}), '(figsize=(5, 5))\n', (3151, 3167), True, 'import matplotlib.pyplot as plt\n'), ((3175, 3217), 'pandas.DataFrame', 'pd.DataFrame', (['differencesAcrossCancerTypes'], {}), '(differencesAcrossCancerTypes)\n', (3187, 3217), True, 'impor... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import common_fn as cf
plt.rcParams["svg.hashsalt"]=0
#Input parms
test_lim_arr=np.empty([0,2])
for llim in np.arange(0,1,0.2):
for ulim in np.arange(llim+0.1,1,0.2):
test_lim_arr=np.append(test_lim_arr,[[llim,ulim]],axis=0)
parm_format... | [
"common_fn.mkdirs",
"common_fn.eq_values",
"common_fn.timeseries",
"numpy.array",
"numpy.append",
"numpy.empty",
"common_fn.heatmap_eqvparm",
"numpy.arange"
] | [((152, 168), 'numpy.empty', 'np.empty', (['[0, 2]'], {}), '([0, 2])\n', (160, 168), True, 'import numpy as np\n'), ((180, 200), 'numpy.arange', 'np.arange', (['(0)', '(1)', '(0.2)'], {}), '(0, 1, 0.2)\n', (189, 200), True, 'import numpy as np\n'), ((409, 455), 'numpy.array', 'np.array', (["['l_lim_testTpro', 'u_lim_te... |
import torch
import numpy as np
from bc.dataset.dataset_lmdb import DatasetReader
from sim2real.augmentation import Augmentation
from sim2real.transformations import ImageTransform
CHANNEL2SPAN = {'depth': 1, 'rgb': 3, 'mask': 1}
class Frames:
def __init__(self,
path,
channels=... | [
"numpy.swapaxes",
"torch.tensor",
"sim2real.augmentation.Augmentation.crop",
"bc.dataset.dataset_lmdb.DatasetReader",
"sim2real.augmentation.Augmentation",
"sim2real.transformations.ImageTransform.sample_params",
"torch.cat"
] | [((1069, 1103), 'bc.dataset.dataset_lmdb.DatasetReader', 'DatasetReader', (['path', 'self.channels'], {}), '(path, self.channels)\n', (1082, 1103), False, 'from bc.dataset.dataset_lmdb import DatasetReader\n'), ((1327, 1353), 'sim2real.augmentation.Augmentation', 'Augmentation', (['augmentation'], {}), '(augmentation)\... |
"""
This code is modified by <NAME> from <NAME>'s repository.
https://github.com/linjieli222/VQA_ReGAT
"""
from __future__ import print_function
import os
import sys
import json
import numpy as np
from utils import find_unicode
import argparse
def create_w2v_embedding_init(idx2word, w2v_file):
word2emb = {}
wi... | [
"utils.find_unicode",
"argparse.ArgumentParser",
"os.path.join",
"numpy.array",
"numpy.random.uniform",
"json.load",
"numpy.save"
] | [((2105, 2130), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2128, 2130), False, 'import argparse\n'), ((2303, 2361), 'os.path.join', 'os.path.join', (['opt.data_path', "(opt.data_name + '_vocab.json')"], {}), "(opt.data_path, opt.data_name + '_vocab.json')\n", (2315, 2361), False, 'import o... |
# fileio_backends.py
#
# This file is part of scqubits.
#
# Copyright (c) 2019, <NAME> and <NAME>
# 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.
#######################################################... | [
"scqubits.utils.misc.Required",
"scqubits.io_utils.fileio.read",
"scqubits.utils.misc.to_expression_or_string",
"csv.writer",
"os.path.splitext",
"re.match",
"h5py.File",
"scqubits.io_utils.fileio.IOData",
"ast.literal_eval",
"scqubits.io_utils.fileio.write",
"numpy.savetxt",
"numpy.loadtxt",
... | [((3709, 3739), 'scqubits.utils.misc.Required', 'utils.Required', ([], {'h5py': '_HAS_H5PY'}), '(h5py=_HAS_H5PY)\n', (3723, 3739), True, 'import scqubits.utils.misc as utils\n'), ((6936, 6966), 'scqubits.utils.misc.Required', 'utils.Required', ([], {'h5py': '_HAS_H5PY'}), '(h5py=_HAS_H5PY)\n', (6950, 6966), True, 'impo... |
import torch
import torch.nn as nn
import sys
import json2
import numpy as np
def get_flops(model, input_shape=(3, 224, 224)):
list_conv = []
def conv_hook(self, input, output):
batch_size, input_channels, input_height, input_width = input[0].size()
output_channels, output_height, output_width... | [
"torch.rand",
"numpy.random.randint",
"pdb.set_trace"
] | [((2432, 2447), 'pdb.set_trace', 'pdb.set_trace', ([], {}), '()\n', (2445, 2447), False, 'import pdb\n'), ((1323, 1347), 'torch.rand', 'torch.rand', (['*input_shape'], {}), '(*input_shape)\n', (1333, 1347), False, 'import torch\n'), ((2818, 2838), 'numpy.random.randint', 'np.random.randint', (['(4)'], {}), '(4)\n', (28... |
'''
This File Provides the Funktions for the Montecarlo simulation
To start use MLG.Start
'''
from MLG import path,default_table, message_folder, Version,Subversion
from MLG.Simulation import RawData
from MLG.Simulation import RealData
from MLG.Modeling import fitting_micro , fitting_motion
from MLG.Math import... | [
"MLG.Simulation.RealData.loadRealData",
"MLG.Math.percentile",
"datetime.datetime.today",
"os.remove",
"time.ctime",
"numpy.where",
"numpy.stack",
"numpy.random.seed",
"os.system",
"glob.glob",
"pickle.load",
"time.time",
"MLG.Simulation.RawData.Data",
"MLG.Modeling.fitting_micro.Fit_Micro... | [((9901, 9927), 'pickle.dump', 'pickle.dump', (['MC_Results', 'f'], {}), '(MC_Results, f)\n', (9912, 9927), False, 'import pickle\n'), ((11251, 11265), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (11262, 11265), False, 'import pickle\n'), ((14880, 14891), 'time.time', 'time.time', ([], {}), '()\n', (14889, 1489... |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
setup(
cmdclass = {'build_ext': build_ext},
ext_modules = [Extension("rf_classify_parallel", ["rf_classify_parallel.pyx"])],
extra_compile_args=['/openmp'],
include_dirs ... | [
"distutils.extension.Extension",
"numpy.get_include"
] | [((201, 264), 'distutils.extension.Extension', 'Extension', (['"""rf_classify_parallel"""', "['rf_classify_parallel.pyx']"], {}), "('rf_classify_parallel', ['rf_classify_parallel.pyx'])\n", (210, 264), False, 'from distutils.extension import Extension\n'), ((323, 339), 'numpy.get_include', 'np.get_include', ([], {}), '... |
import numpy as np
import os
import cv2
class VideoStartOrEndOutOfBoundsException(RuntimeError):
'''Invalid start or end location in VideoFile'''
class VideoNotFoundException(RuntimeError):
'''Raise when local video file could not be found'''
class VideoCouldNotBeOpenedException(RuntimeError):
'''Raise wh... | [
"os.path.isfile",
"numpy.array",
"cv2.VideoCapture"
] | [((1127, 1153), 'cv2.VideoCapture', 'cv2.VideoCapture', (['file_loc'], {}), '(file_loc)\n', (1143, 1153), False, 'import cv2\n'), ((2552, 2583), 'cv2.VideoCapture', 'cv2.VideoCapture', (['self.file_loc'], {}), '(self.file_loc)\n', (2568, 2583), False, 'import cv2\n'), ((4764, 4777), 'numpy.array', 'np.array', (['ret'],... |
import numpy
import pandas
from nltk.tag import StanfordNERTagger
# from nltk.tag.corenlp import CoreNLPNERTagger
import os
java_path = "C:/Program Files/Java/jdk-13.0.1/bin/java.exe"
os.environ['JAVAHOME'] = java_path
# TODO: configure these paths!
a1 = 'C:\\Users\\MainUser\\OneDrive\\RAMP-EXTERNAL\\IP-02\\OSTRTA\\m... | [
"pandas.DataFrame",
"nltk.tag.StanfordNERTagger",
"numpy.concatenate",
"pandas.read_excel"
] | [((679, 718), 'pandas.read_excel', 'pandas.read_excel', (['"""./data/source.xlsx"""'], {}), "('./data/source.xlsx')\n", (696, 718), False, 'import pandas\n'), ((756, 780), 'nltk.tag.StanfordNERTagger', 'StanfordNERTagger', (['a1', 'b'], {}), '(a1, b)\n', (773, 780), False, 'from nltk.tag import StanfordNERTagger\n'), (... |
from os import path as osp
import cv2
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import lstsq
from scipy.ndimage import gaussian_filter
from scipy import interpolate
import argparse
import sys
sys.path.append("..")
import Basics.params as pr
import Basics.sensorParams as psp
from Basics.Geome... | [
"numpy.sqrt",
"numpy.array",
"numpy.arctan2",
"scipy.ndimage.gaussian_filter",
"sys.path.append",
"numpy.arange",
"numpy.mean",
"numpy.savez",
"scipy.linalg.lstsq",
"argparse.ArgumentParser",
"numpy.ma.masked_where",
"numpy.meshgrid",
"numpy.ones",
"numpy.floor",
"numpy.nonzero",
"nump... | [((220, 241), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (235, 241), False, 'import sys\n'), ((348, 373), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (371, 373), False, 'import argparse\n'), ((988, 1016), 'os.path.join', 'osp.join', (['fn', '"""dataPack.npz"""'], {... |
"""
Implements the Perception & Adaline Learning Algorithm
Author: <NAME>
Created: May 18, 2010
"""
import numpy as np
import matplotlib.pyplot as plt
class Perception:
"""first artifical neural classifier
Args:
eta: Learning rate (between 0.0 and 1.0)
n_iter: pas... | [
"numpy.dot",
"matplotlib.pyplot.xlabel",
"numpy.random.RandomState",
"matplotlib.pyplot.ylabel"
] | [((1270, 1310), 'numpy.random.RandomState', 'np.random.RandomState', (['self.random_state'], {}), '(self.random_state)\n', (1291, 1310), True, 'import numpy as np\n'), ((4578, 4618), 'numpy.random.RandomState', 'np.random.RandomState', (['self.random_state'], {}), '(self.random_state)\n', (4599, 4618), True, 'import nu... |
from __future__ import division
import numpy as np
from random import shuffle
class Model(object):
def fit(self, data):
raise NotImplementedError
def distance(self, samples):
raise NotImplementedError
class LineModel(Model):
"""
A 2D line model.
"""
def fit(self, data):
... | [
"numpy.where",
"numpy.asarray",
"random.shuffle",
"numpy.concatenate"
] | [((2860, 2876), 'random.shuffle', 'shuffle', (['indices'], {}), '(indices)\n', (2867, 2876), False, 'from random import shuffle\n'), ((2907, 2959), 'numpy.asarray', 'np.asarray', (['[data[i] for i in indices[:min_samples]]'], {}), '([data[i] for i in indices[:min_samples]])\n', (2917, 2959), True, 'import numpy as np\n... |
#encoding=utf-8
#
import os,cv2,sys
from basicFun import XML,FILES,COCO
from tqdm import tqdm
import numpy as np
class info_count():
def init(self, txt=None):
self.info={}
self.num=0
print('init')
if txt:
with open(txt, 'r') as f:
... | [
"basicFun.FILES.get_sorted_files",
"numpy.sqrt",
"matplotlib.pyplot.xlim",
"tqdm.tqdm",
"os.path.join",
"basicFun.XML.read_objects",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"seaborn.barplot",
"matplotlib.pyplot.show"
] | [((1232, 1254), 'basicFun.XML.read_objects', 'XML.read_objects', (['path'], {}), '(path)\n', (1248, 1254), False, 'from basicFun import XML, FILES, COCO\n'), ((2717, 2730), 'tqdm.tqdm', 'tqdm', (['allXmls'], {}), '(allXmls)\n', (2721, 2730), False, 'from tqdm import tqdm\n'), ((3517, 3567), 'pandas.DataFrame', 'pd.Data... |
# Author: Copyright (c) 2021 <NAME>
# License: MIT License
"""
Test normla_factor against standard tables of tolerance factors
as published in ISO 16269-6:2014 Annex F.
A sampling of values from the tables is included here for brevity.
"""
import numpy as np
import toleranceinterval.twoside as ts
import unittest
... | [
"numpy.array",
"numpy.ceil",
"toleranceinterval.twoside.normal_factor",
"numpy.arange"
] | [((691, 701), 'numpy.ceil', 'np.ceil', (['x'], {}), '(x)\n', (698, 701), True, 'import numpy as np\n'), ((1478, 1526), 'numpy.array', 'np.array', (['[2, 8, 16, 35, 100, 300, 1000, np.inf]'], {}), '([2, 8, 16, 35, 100, 300, 1000, np.inf])\n', (1486, 1526), True, 'import numpy as np\n'), ((1599, 1615), 'numpy.arange', 'n... |
#!/usr/bin/env python
# coding: utf-8
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
import requests
from io import BytesIO
from PIL import Image
import numpy as np
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
config_file = "../configs/e2e_mask_rcnn_R_50_FPN_1x_synthia.... | [
"matplotlib.pyplot.imshow",
"maskrcnn_benchmark.config.cfg.merge_from_file",
"io.BytesIO",
"maskrcnn_benchmark.config.cfg.merge_from_list",
"requests.get",
"numpy.array",
"predictor.COCODemo",
"matplotlib.pyplot.axis",
"cv2.imread",
"matplotlib.pyplot.show"
] | [((376, 408), 'maskrcnn_benchmark.config.cfg.merge_from_file', 'cfg.merge_from_file', (['config_file'], {}), '(config_file)\n', (395, 408), False, 'from maskrcnn_benchmark.config import cfg\n'), ((440, 485), 'maskrcnn_benchmark.config.cfg.merge_from_list', 'cfg.merge_from_list', (["['MODEL.DEVICE', 'cuda']"], {}), "(['... |
import cv2
import numpy as np
import os
import random
# Mars surface image (Curiosity rover) labeled data set
def ffzk(input_dir):
imgname_array=[];input_dir=input_dir.strip("\"\'")
for fd_path, _, sb_file in os.walk(input_dir):
for fil in sb_file:imgname_array.append(fd_path.replace('\\','/') + '/' + ... | [
"os.makedirs",
"numpy.average",
"random.randrange",
"os.path.join",
"os.path.isfile",
"cv2.imread",
"os.walk"
] | [((483, 527), 'os.makedirs', 'os.makedirs', (['"""./datasets/mls"""'], {'exist_ok': '(True)'}), "('./datasets/mls', exist_ok=True)\n", (494, 527), False, 'import os\n'), ((527, 571), 'os.makedirs', 'os.makedirs', (['"""./datasets/mls"""'], {'exist_ok': '(True)'}), "('./datasets/mls', exist_ok=True)\n", (538, 571), Fals... |
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | [
"sys.path.insert",
"numpy.random.rand",
"mxnet.nd.zeros",
"mxnet.nd.ones",
"numpy.arange",
"numpy.array",
"numpy.random.randint",
"numpy.argwhere",
"mxnet.kv.create",
"numpy.random.seed",
"mxnet.random.seed",
"mxnet.optimizer.create",
"mxnet.nd.array"
] | [((840, 875), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../python/"""'], {}), "(0, '../../python/')\n", (855, 875), False, 'import sys\n'), ((1270, 1295), 'mxnet.kv.create', 'mx.kv.create', (['"""dist_sync"""'], {}), "('dist_sync')\n", (1282, 1295), True, 'import mxnet as mx\n'), ((1388, 1409), 'mxnet.nd.on... |
import numpy as np
import torch
from PIL import Image
from skimage import exposure, morphology
from skimage.filters import threshold_otsu
from torch import nn
from torchvision import transforms
import inferno
from inferno.extensions.layers import ConvReLU2D
from inferno.extensions import model as inf_model
class All... | [
"torch.nn.Sigmoid",
"skimage.filters.threshold_otsu",
"inferno.extensions.model.ResBlockUNet",
"torch.Tensor",
"numpy.stack",
"skimage.exposure.rescale_intensity",
"numpy.percentile",
"skimage.morphology.binary_opening"
] | [((956, 979), 'numpy.stack', 'np.stack', (['input'], {'axis': '(0)'}), '(input, axis=0)\n', (964, 979), True, 'import numpy as np\n'), ((1360, 1384), 'numpy.stack', 'np.stack', (['result'], {'axis': '(0)'}), '(result, axis=0)\n', (1368, 1384), True, 'import numpy as np\n'), ((1935, 1959), 'skimage.filters.threshold_ots... |
# Copyright (C) 2019-2022, <NAME>.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
"""
Training script for semantic segmentation
"""
import datetime
import os
import time
import matplotlib.pyplot as plt... | [
"wandb.log",
"torch.nn.CrossEntropyLoss",
"torchvision.transforms.functional.to_pil_image",
"torch.initial_seed",
"holocron.optim.AdamP",
"numpy.iinfo",
"wandb.init",
"torchvision.transforms.ColorJitter",
"holocron.nn.MutualChannelLoss",
"transforms.Resize",
"os.cpu_count",
"transforms.ImageTr... | [((1475, 1519), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', 'nb_samples'], {'figsize': '(20, 5)'}), '(2, nb_samples, figsize=(20, 5))\n', (1487, 1519), True, 'import matplotlib.pyplot as plt\n'), ((2090, 2100), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2098, 2100), True, 'import matplotlib.pyp... |
# THIS IS A TESTING FILE AND IS NOT PART OF THE PROJECT
# The code below can be called from a diffrerent file with import face_recon
# and webcam_detection(numpy_array_image, user_name)
# If you want to test this file on your own make sure you install face_recognition lib (tutorial found on Trello board)
# and also... | [
"face_recognition.face_locations",
"face_recognition.face_distance",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"face_recognition.compare_faces",
"face_recognition.face_encodings",
"numpy.argmin",
"cv2.resize",
"cv2.waitKey"
] | [((533, 552), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (549, 552), False, 'import cv2\n'), ((3061, 3084), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3082, 3084), False, 'import cv2\n'), ((642, 686), 'face_recognition.face_encodings', 'face_recognition.face_encodings', ([... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, t
np.random.seed(1)
#%%
N = 1_0
mu = 5
sd = 2
#%%
x = np.random.randn(N)*sd + mu
#%% Z-CI
mu_hat = x.mean()
sigma_hat = x.std(ddof=1)
z_left = norm.ppf(0.0250)
z_right = norm.ppf(0.9750)
left_ci = mu_hat + z_left*sigma_hat/np.sqrt(N)
ri... | [
"numpy.mean",
"numpy.sqrt",
"scipy.stats.norm.ppf",
"numpy.random.seed",
"numpy.random.randn",
"scipy.stats.t.ppf"
] | [((83, 100), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (97, 100), True, 'import numpy as np\n'), ((227, 242), 'scipy.stats.norm.ppf', 'norm.ppf', (['(0.025)'], {}), '(0.025)\n', (235, 242), False, 'from scipy.stats import norm, t\n'), ((254, 269), 'scipy.stats.norm.ppf', 'norm.ppf', (['(0.975)'], {... |
import numpy as np
# Creating vectors (unidimensional arrays)
vector_a = np.arange(5) # 0 to 4 array
vector_b = np.arange(start=3, stop=7, step=1) # start, stop, step
vector_c = np.arange(11, 1, -2)
vector_d = np.linspace(start=0, stop=1, num=11) # Automatic step calculation with explicit array length definition (thi... | [
"numpy.ones",
"numpy.full_like",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"numpy.full",
"numpy.arange"
] | [((75, 87), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (84, 87), True, 'import numpy as np\n'), ((114, 148), 'numpy.arange', 'np.arange', ([], {'start': '(3)', 'stop': '(7)', 'step': '(1)'}), '(start=3, stop=7, step=1)\n', (123, 148), True, 'import numpy as np\n'), ((180, 200), 'numpy.arange', 'np.arange', ([... |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PYTHON VERSION OF MATTHEW LEONAWICZ's DOF/DOT/LOGS R Script
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# Author: <NAME> -- 2019 -- <EMAIL>
# LICENSE: MIT
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def tfg_days( ... | [
"numpy.array",
"numpy.arange",
"os.path.exists",
"numpy.where",
"itertools.product",
"numpy.ctypeslib.as_array",
"numpy.diff",
"numpy.concatenate",
"rasterio.open",
"numpy.warnings.filterwarnings",
"os.path.dirname",
"numpy.isnan",
"numpy.sign",
"multiprocessing.sharedctypes.RawArray",
"... | [((765, 775), 'numpy.sign', 'np.sign', (['x'], {}), '(x)\n', (772, 775), True, 'import numpy as np\n'), ((946, 961), 'numpy.where', 'np.where', (['(s < 0)'], {}), '(s < 0)\n', (954, 961), True, 'import numpy as np\n'), ((5722, 5748), 'numpy.array', 'np.array', (['[dof, dot, grow]'], {}), '([dof, dot, grow])\n', (5730, ... |
import socket
import sys
import threading
import base64
import pytesseract as ocr
import numpy as np
import cv2
import struct
from PIL import Image
hostname = "redesb.space"
HOST = socket.gethostbyname(hostName) # Symbolic name meaning all available interfaces
PORT = 9666 # Arbitrary non-privileged port
H... | [
"socket.gethostbyname",
"PIL.Image.fromarray",
"sys.exit",
"PIL.Image.open",
"socket.socket",
"cv2.threshold",
"numpy.asarray",
"base64.b64decode",
"numpy.array",
"cv2.cvtColor",
"pytesseract.image_to_string"
] | [((193, 223), 'socket.gethostbyname', 'socket.gethostbyname', (['hostName'], {}), '(hostName)\n', (213, 223), False, 'import socket\n'), ((326, 352), 'socket.gethostbyname', 'socket.gethostbyname', (['HOST'], {}), '(HOST)\n', (346, 352), False, 'import socket\n'), ((376, 425), 'socket.socket', 'socket.socket', (['socke... |
"""Module dedicated to framework testing."""
import pytest
import typing as t
import numpy as np
import sklearn.tree
from pymfe import _internal
from pymfe.mfe import MFE
from . import utils
GNAME = "framework-testing"
def summary_exception(values: np.ndarray,
raise_exception: bool = False) -... | [
"pymfe._internal.summarize",
"numpy.array",
"numpy.arange",
"numpy.random.seed",
"pymfe.mfe.MFE",
"numpy.allclose",
"numpy.ones",
"numpy.isnan",
"pytest.raises",
"numpy.copy",
"numpy.isclose",
"pymfe.mfe.MFE.metafeature_description",
"numpy.unique",
"numpy.logical_and",
"pytest.mark.para... | [((8086, 8979), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""groups, summary"""', "[('statistical', 'all'), ('general', 'all'), ('landmarking', 'all'), (\n 'relative', 'all'), ('model-based', 'all'), ('info-theory', 'all'), (\n 'statistical', ('mean', 'sd')), ('general', ('mean', 'sd')), (\n 'la... |
"""This submodule handles all interaction with the LALSuite C API.
It provides a class for inputs and a class for outputs and functions for
reading/writing/comparing them. The inputs method has a 'run' method
for calling the C API.
"""
import numpy as np
import glob
import math
import lal_cuda
# Generate mocks for... | [
"numpy.fromfile",
"lal_cuda.log.error",
"lal_cuda.import_mock_RTD",
"lal_cuda.log.warning",
"numpy.array",
"lal_cuda.log.comment",
"lal_cuda.log.open",
"math.fabs",
"numpy.array_equal",
"numpy.linspace",
"lal_cuda.log.close",
"lal_cuda.full_path_datafile"
] | [((360, 391), 'lal_cuda.import_mock_RTD', 'lal_cuda.import_mock_RTD', (['"""lal"""'], {}), "('lal')\n", (384, 391), False, 'import lal_cuda\n'), ((408, 449), 'lal_cuda.import_mock_RTD', 'lal_cuda.import_mock_RTD', (['"""lalsimulation"""'], {}), "('lalsimulation')\n", (432, 449), False, 'import lal_cuda\n'), ((2221, 224... |
import numpy as np
import gym
from gym.spaces import Discrete
from gym import utils
from gym.utils import seeding
class State:
ZERO = 0
ONE = 1
TWO = 2
THREE = 3
FOUR = 4
class Action:
A = 0
B = 1
class Chain(gym.Env, utils.EzPickle):
def __init__(self, random_slip_prob=True,
... | [
"numpy.array",
"IPython.embed",
"gym.spaces.Discrete",
"gym.utils.seeding.np_random"
] | [((3025, 3040), 'IPython.embed', 'IPython.embed', ([], {}), '()\n', (3038, 3040), False, 'import IPython\n'), ((807, 824), 'gym.spaces.Discrete', 'Discrete', (['self.nA'], {}), '(self.nA)\n', (815, 824), False, 'from gym.spaces import Discrete\n'), ((858, 875), 'gym.spaces.Discrete', 'Discrete', (['self.nS'], {}), '(se... |
import cv2
import numpy as np
import scipy
from scipy import fftpack, signal
from sklearn.neighbors import ball_tree
from scipy.sparse import spdiags
import matplotlib.pyplot as plt
def sinc_psf(window_size=15, edge=15/4):
x = np.expand_dims(np.linspace(-edge, edge, window_size),axis=0)
s = np.sinc(x.T @ x)
... | [
"numpy.array",
"numpy.linalg.norm",
"numpy.arange",
"matplotlib.pyplot.imshow",
"numpy.float64",
"numpy.exp",
"scipy.fftpack.fft2",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.pyplot.cla",
"scipy.signal.convolve2d",
"numpy.abs",
"numpy.tile",
"matplotlib.pyplot.savefig",
"sklearn.nei... | [((302, 318), 'numpy.sinc', 'np.sinc', (['(x.T @ x)'], {}), '(x.T @ x)\n', (309, 318), True, 'import numpy as np\n'), ((442, 476), 'numpy.linspace', 'np.linspace', (['(-edge)', 'edge'], {'num': 'size'}), '(-edge, edge, num=size)\n', (453, 476), True, 'import numpy as np\n'), ((490, 509), 'numpy.meshgrid', 'np.meshgrid'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 2 10:49:13 2020
@author: becker
"""
import numpy as np
import scipy
k = 3
d = 1
def sums(length, total_sum):
if length == 1:
yield (total_sum,)
else:
for value in range(total_sum + 1):
for permutation in sums(... | [
"numpy.array"
] | [((462, 484), 'numpy.array', 'np.array', (['i'], {'dtype': 'int'}), '(i, dtype=int)\n', (470, 484), True, 'import numpy as np\n')] |
import numpy as np
import pandas as pd
import os
from features import *
from util import *
# Handle datasets
def merge_data(key_list, array_list):
all_keys = np.array([kl[i] for kl in key_list for i in range(len(kl))])
all_keys_idxs = np.argsort(all_keys)
all_keys_sorted = np.sort(all_k... | [
"numpy.sort",
"os.path.join",
"numpy.argsort",
"numpy.empty",
"numpy.save"
] | [((263, 283), 'numpy.argsort', 'np.argsort', (['all_keys'], {}), '(all_keys)\n', (273, 283), True, 'import numpy as np\n'), ((307, 324), 'numpy.sort', 'np.sort', (['all_keys'], {}), '(all_keys)\n', (314, 324), True, 'import numpy as np\n'), ((505, 531), 'numpy.empty', 'np.empty', (['all_arrays_shape'], {}), '(all_array... |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import os
from PIL import Image
import imghdr
import base64
from io import BytesIO
import dash
from dash.dependencies import Input,Output,State
import dash_table
import dash_core_components as dcc
import dash_html_components as html
from dash.exceptions im... | [
"numpy.hstack",
"dash_html_components.Button",
"io.BytesIO",
"dash.dependencies.Input",
"numpy.array",
"dash_html_components.Div",
"dash.Dash",
"os.walk",
"dash.dependencies.Output",
"dash_html_components.Br",
"pandas.DataFrame",
"os.path.isfile",
"os.path.dirname",
"PIL.Image.fromarray",
... | [((624, 640), 'os.walk', 'os.walk', (['"""data/"""'], {}), "('data/')\n", (631, 640), False, 'import os\n'), ((2181, 2200), 'numpy.load', 'np.load', (['"""rank.npy"""'], {}), "('rank.npy')\n", (2188, 2200), True, 'import numpy as np\n'), ((2542, 2561), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (2551... |
from xfit.fitting import fit_dataArray, fit_dataArray_models, fit_dataset
import numpy as np
import xarray as xr
from xarray.testing import assert_equal, assert_allclose
bs = xr.DataArray(np.linspace(0,10,6), coords={'b_true': np.linspace(0,10,6)}, dims='b_true')
xs = xr.DataArray(np.linspace(0,10,11), coords={'x': ... | [
"numpy.mean",
"numpy.ones",
"xfit.fitting.fit_dataset",
"xarray.Dataset",
"numpy.linspace",
"numpy.zeros",
"xarray.full_like",
"xfit.fitting.fit_dataArray",
"xarray.testing.assert_equal",
"numpy.arange"
] | [((544, 570), 'xarray.Dataset', 'xr.Dataset', (["{'data': data}"], {}), "({'data': data})\n", (554, 570), True, 'import xarray as xr\n'), ((1231, 1272), 'xarray.full_like', 'xr.full_like', (['expected_yda', 'np.nan', 'float'], {}), '(expected_yda, np.nan, float)\n', (1243, 1272), True, 'import xarray as xr\n'), ((191, ... |
from os import path
import numpy as np
from vision.domain.iCameraCalibration import ICameraCalibration
from vision.domain.iCameraCalibrationFactory import ICameraCalibrationFactory
from vision.infrastructure.fallbackCameraCalibration import FallBackCameraCalibration
from vision.infrastructure.openCvCameraCalibration ... | [
"vision.infrastructure.fallbackCameraCalibration.FallBackCameraCalibration",
"vision.infrastructure.openCvCameraCalibration.OpenCvCameraCalibration",
"numpy.load"
] | [((690, 720), 'numpy.load', 'np.load', (['calibration_file_path'], {}), '(calibration_file_path)\n', (697, 720), True, 'import numpy as np\n'), ((853, 947), 'vision.infrastructure.openCvCameraCalibration.OpenCvCameraCalibration', 'OpenCvCameraCalibration', (['camera_matrix', 'distortion_coefficients', 'image_width', 'i... |
"""
Test script for the ReplayMemory
"""
import unittest
from models.utils.replay_memory import ReplayMemory
import numpy as np
class DummyTupleGenerator:
def __init__(self, input_shape, action_space):
self.state_number = 0
self.last_action = 0
self.input_shape = input_shape
self... | [
"numpy.ones",
"numpy.all",
"models.utils.replay_memory.ReplayMemory"
] | [((1534, 1588), 'models.utils.replay_memory.ReplayMemory', 'ReplayMemory', (['memory_length', 'input_shape', 'action_space'], {}), '(memory_length, input_shape, action_space)\n', (1546, 1588), False, 'from models.utils.replay_memory import ReplayMemory\n'), ((973, 998), 'numpy.ones', 'np.ones', (['self.input_shape'], {... |
# -*- coding: utf-8 -*-
#
# Helper functions for frontend test design
#
# The runner signatures take a callable,
# the `method_call`, as 1st argument
#
# 3rd party imports
import itertools
import numpy as np
from syncopy.shared.errors import SPYValueError, SPYTypeError
# fix random generators
np.random.seed(40203)
... | [
"numpy.random.rand",
"numpy.random.choice",
"itertools.product",
"numpy.diff",
"numpy.max",
"numpy.array",
"numpy.random.randint",
"numpy.isfinite",
"numpy.random.seed",
"numpy.min",
"numpy.all",
"numpy.arange"
] | [((297, 318), 'numpy.random.seed', 'np.random.seed', (['(40203)'], {}), '(40203)\n', (311, 318), True, 'import numpy as np\n'), ((2122, 2153), 'numpy.arange', 'np.arange', (['foilim[0]', 'foilim[1]'], {}), '(foilim[0], foilim[1])\n', (2131, 2153), True, 'import numpy as np\n'), ((2178, 2215), 'numpy.arange', 'np.arange... |
import sys
sys.path.append('./PyScr/')
import numpy as np
import matplotlib.pyplot as plt
import cmath
import math
import copy
import pfprint
import primefac
from scipy.special import comb as choose
_ = None
def ppprint(arg):
global _
pfprint.pfprint(arg)
_ = arg
def frac():
pfprint.frac = not pfprint.frac
retu... | [
"math.factorial",
"matplotlib.pyplot.clf",
"numpy.exp",
"matplotlib.pyplot.close",
"primefac.primes",
"sys.path.append",
"matplotlib.pyplot.cla",
"pfprint.pfprint"
] | [((11, 38), 'sys.path.append', 'sys.path.append', (['"""./PyScr/"""'], {}), "('./PyScr/')\n", (26, 38), False, 'import sys\n'), ((652, 661), 'numpy.exp', 'np.exp', (['(1)'], {}), '(1)\n', (658, 661), True, 'import numpy as np\n'), ((239, 259), 'pfprint.pfprint', 'pfprint.pfprint', (['arg'], {}), '(arg)\n', (254, 259), ... |
import tensorflow as tf
import tensorflow.compat.v2 as v2
import tensorflow.neuron as tfn
import shutil
import numpy as np
import unittest
from tensorflow.neuron.python.unittest_base import TestV1Only
class TestEarlyExit(TestV1Only):
def test_sequential(self):
with self.assertRaises(NotImplementedError):
... | [
"tensorflow.compat.v2.keras.Input",
"tensorflow.compat.v2.keras.layers.Dense",
"numpy.random.rand",
"tensorflow.compat.v2.keras.layers.concatenate",
"tensorflow.saved_model.save",
"tensorflow.compat.v2.keras.Model",
"numpy.random.randint",
"tensorflow.compat.v2.keras.layers.Embedding",
"tensorflow.c... | [((699, 736), 'tensorflow.saved_model.save', 'tf.saved_model.save', (['model', 'model_dir'], {}), '(model, model_dir)\n', (718, 736), True, 'import tensorflow as tf\n'), ((805, 858), 'shutil.rmtree', 'shutil.rmtree', (['compiled_model_dir'], {'ignore_errors': '(True)'}), '(compiled_model_dir, ignore_errors=True)\n', (8... |
import itertools
import random
import numpy as np
class Sudoku:
"""Class for creating and solving Sudoku puzzles"""
def _get_square(self, row, col):
"""
Returns coordinates for the square where the row,col coordinate is
"""
top = int(row / 3) * 3 # (0 or 1 or 2) * 3
... | [
"numpy.copy",
"numpy.where",
"numpy.random.choice",
"numpy.ndindex",
"numpy.logical_xor",
"numpy.invert",
"numpy.count_nonzero",
"numpy.sum",
"numpy.zeros",
"numpy.full",
"numpy.all",
"numpy.transpose"
] | [((939, 962), 'numpy.copy', 'np.copy', (['self.positions'], {}), '(self.positions)\n', (946, 962), True, 'import numpy as np\n'), ((983, 999), 'numpy.ndindex', 'np.ndindex', (['(3)', '(9)'], {}), '(3, 9)\n', (993, 999), True, 'import numpy as np\n'), ((4305, 4348), 'numpy.sum', 'np.sum', (['self.positions[:, row, col]'... |
from unittest import TestCase, skipIf
from ...examples import get_path
from ..alpha_shapes import alpha_shape, alpha_shape_auto
import numpy as np
import os
try:
import geopandas
from shapely import geometry
GEOPANDAS_EXTINCT = False
except ImportError:
GEOPANDAS_EXTINCT = True
this_directory = os.pa... | [
"numpy.hstack",
"numpy.testing.assert_allclose",
"unittest.skipIf",
"os.path.join",
"numpy.column_stack",
"os.path.dirname",
"numpy.vstack"
] | [((315, 340), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (330, 340), False, 'import os\n'), ((344, 416), 'unittest.skipIf', 'skipIf', (['GEOPANDAS_EXTINCT', '"""Geopandas is missing, so test will not run."""'], {}), "(GEOPANDAS_EXTINCT, 'Geopandas is missing, so test will not run.')\n", (... |
import cv2
import math
import torch
import torchvision
import numpy as np
from copy import deepcopy
class AffineTransform(object):
def __init__(self, input_res=256, output_res=64, rotation_prob=0.6):
self.input_res = input_res
self.output_res = output_res
self.rotation_prob = rotation_pro... | [
"cv2.warpAffine",
"numpy.random.random",
"numpy.dot",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"numpy.float32",
"numpy.round"
] | [((430, 483), 'numpy.float32', 'np.float32', (['[[1, 0, pt[0]], [0, 1, pt[1]], [0, 0, 1]]'], {}), '([[1, 0, pt[0]], [0, 1, pt[1]], [0, 0, 1]])\n', (440, 483), True, 'import numpy as np\n'), ((761, 811), 'numpy.float32', 'np.float32', (['[[cs, -sn, 0], [sn, cs, 0], [0, 0, 1]]'], {}), '([[cs, -sn, 0], [sn, cs, 0], [0, 0,... |
"""[summary]
Returns:
[type]: [description]
"""
import pickle
import sys
import numpy as np
def gen_label(x):
"""[summary]
Args:
x ([type]): [description]
Returns:
[type]: [description]
"""
if 1 <= x <= 10:
return 2
if 11 <= x <= 100:
return 1
return ... | [
"numpy.array"
] | [((1723, 1755), 'numpy.array', 'np.array', (['real_label_id_features'], {}), '(real_label_id_features)\n', (1731, 1755), True, 'import numpy as np\n'), ((1757, 1788), 'numpy.array', 'np.array', (['ext_label_id_features'], {}), '(ext_label_id_features)\n', (1765, 1788), True, 'import numpy as np\n')] |
# MIT License
#
# Copyright (c) 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, pub... | [
"numpy.abs",
"numpy.log",
"tqdm.tqdm",
"numpy.argmax",
"utility.extract_spectrum",
"os.path.join",
"os.path.normpath",
"traceback.print_exc",
"utility.create_audio_sample",
"torch.zeros"
] | [((2225, 2246), 'tqdm.tqdm', 'tqdm', (['_h5_video_names'], {}), '(_h5_video_names)\n', (2229, 2246), False, 'from tqdm import tqdm\n'), ((2805, 2829), 'numpy.argmax', 'np.argmax', (['(array > value)'], {}), '(array > value)\n', (2814, 2829), True, 'import numpy as np\n'), ((4295, 4324), 'utility.extract_spectrum', 'ut.... |
import os
import pytest
@pytest.fixture
def test_data():
import numpy as np
test_data_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'data', 'laserembeddings-test-data.npz')
return np.load(test_data_file) if os.path.isfile(test_data_file) else None
| [
"os.path.isfile",
"numpy.load",
"os.path.realpath"
] | [((276, 306), 'os.path.isfile', 'os.path.isfile', (['test_data_file'], {}), '(test_data_file)\n', (290, 306), False, 'import os\n'), ((249, 272), 'numpy.load', 'np.load', (['test_data_file'], {}), '(test_data_file)\n', (256, 272), True, 'import numpy as np\n'), ((133, 159), 'os.path.realpath', 'os.path.realpath', (['__... |
# U-Net Model Construction
import unittest
import numpy as np
import keras
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras.regularizers import l1, l2
from keras import backend as K
def sagittal_spine_unet(input_size, num_classes, filter_multiplier=10, regularization... | [
"keras.backend.sum",
"keras.layers.UpSampling2D",
"keras.backend.square",
"numpy.zeros",
"keras.backend.log",
"keras.regularizers.l1",
"unittest.main",
"keras.backend.variable",
"numpy.log2",
"keras.backend.abs",
"keras.backend.epsilon"
] | [((496, 529), 'numpy.zeros', 'np.zeros', (['[num_layers]'], {'dtype': 'int'}), '([num_layers], dtype=int)\n', (504, 529), True, 'import numpy as np\n'), ((556, 589), 'numpy.zeros', 'np.zeros', (['[num_layers]'], {'dtype': 'int'}), '([num_layers], dtype=int)\n', (564, 589), True, 'import numpy as np\n'), ((617, 650), 'n... |
import numpy as np
data= get_pricing("SPY", start_date="2003-1-1", end_date="2018-1-1")
prices= data['price']
import matplotlib.pyplot as pyplot
uppers= []
lowers= []
stat1=0
stat2=0
statN1=0
stat0=0
limit= 180
prevStat=1
print(len(prices))
for i in range(0, len(prices)):
if i < limit:
uppers.append(pri... | [
"matplotlib.pyplot.plot",
"numpy.min",
"matplotlib.pyplot.legend",
"numpy.max"
] | [((1294, 1350), 'matplotlib.pyplot.plot', 'pyplot.plot', (['prices.index', 'prices.values'], {'label': '"""prices"""'}), "(prices.index, prices.values, label='prices')\n", (1305, 1350), True, 'import matplotlib.pyplot as pyplot\n'), ((1351, 1399), 'matplotlib.pyplot.plot', 'pyplot.plot', (['prices.index', 'uppers'], {'... |
# Archivo: animaciones.py
# Basado en https://matplotlib.org/examples/animation/simple_anim.html
# Autor: <NAME>
# Fecha: 28 de diciembre de 2017
# Descripción: Ejemplo de animacion
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import random
PI = 3.1416
fig, ax = plt.sub... | [
"numpy.ma.array",
"numpy.sin",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((313, 327), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (325, 327), True, 'import matplotlib.pyplot as plt\n'), ((333, 359), 'numpy.arange', 'np.arange', (['(0)', '(4 * PI)', '(0.01)'], {}), '(0, 4 * PI, 0.01)\n', (342, 359), True, 'import numpy as np\n'), ((1304, 1314), 'matplotlib.pyplot.show', ... |
import os
import csv
import numpy as np
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from keras.models import *
from keras import metrics
from keras.layers import *
from keras import optimizers
from keras.preprocessing import text
from keras.utils import to_categorical
from keras.preprocessing import s... | [
"os.path.exists",
"keras.preprocessing.text.Tokenizer",
"keras.callbacks.ModelCheckpoint",
"keras.utils.to_categorical",
"os.path.isfile",
"keras.optimizers.Nadam",
"keras.models.Model",
"os.mkdir",
"matplotlib.pyplot.switch_backend",
"keras.preprocessing.sequence.pad_sequences",
"numpy.load",
... | [((73, 98), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (91, 98), True, 'import matplotlib.pyplot as plt\n'), ((1608, 1650), 'numpy.load', 'np.load', (['"""data/vectorized/Train_title.npy"""'], {}), "('data/vectorized/Train_title.npy')\n", (1615, 1650), True, 'import nump... |
import sys
import os
import numpy as np
sys.path.append(os.path.join(os.path.dirname(__file__), 'pathfind/build'))
from alphazero_general.Game import Game
from .QuoridorLogic import QuoridorBoard
class QuoridorGame(Game):
def __init__(self, n):
super().__init__()
self.n = n
self.action_... | [
"os.path.dirname",
"numpy.array"
] | [((71, 96), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (86, 96), False, 'import os\n'), ((3608, 3641), 'numpy.array', 'np.array', (['pi[pawn_moves:vwa_size]'], {}), '(pi[pawn_moves:vwa_size])\n', (3616, 3641), True, 'import numpy as np\n'), ((3722, 3745), 'numpy.array', 'np.array', (['pi[... |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: kol
#
# Created: 06.02.2020
# Copyright: (c) kol 2020
# Licence: <your licence>
#-------------------------------------------------------------------------------
import sys
import... | [
"img_utils.color_to_cv_color",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"numpy.sin",
"sys.path.append",
"skimage.draw.bezier_curve",
"simpleaudio.stop_all",
"pathlib.Path",
"cv2.VideoWriter",
"numpy.linspace",
"cv2.VideoWriter_fourcc",
"gr.utils.resize3",
"cv2.waitKey",
"ite... | [((636, 662), 'sys.path.append', 'sys.path.append', (['"""..\\\\gbr"""'], {}), "('..\\\\gbr')\n", (651, 662), False, 'import sys\n'), ((16723, 16746), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (16744, 16746), False, 'import cv2\n'), ((2010, 2032), 'cv2.flip', 'cv2.flip', (['self.body', '(1)'],... |
"""
Created on Tue Mar 27 14:34:40 2012
@author: <NAME>
Creates a table of low-pass filter coefficients for demodulating signal.
We design for a pass band of 1/2 the IF frequency and a stop-band of the IF frequency.
We arbitrarily accept 3dB of loss in the pass band and want 30dB of suppression in the stop band.
""... | [
"numpy.arange"
] | [((409, 433), 'numpy.arange', 'np.arange', (['(0.01)', '(1)', '(0.01)'], {}), '(0.01, 1, 0.01)\n', (418, 433), True, 'import numpy as np\n')] |
import argparse
from time import time
from xml.dom.minidom import parseString
from block import Block
from grid import Grid
from os.path import join
from pattern import Pattern
from pattern_utils import de_densify, measure_density, pattern_to_svg, shorten_jumps, \
remove_short
from stitch import Stitch
from svguti... | [
"brother.upload",
"pattern.Pattern",
"svgutils.posturize",
"pattern_utils.remove_short",
"stitch.Stitch",
"svgutils.make_equidistant",
"pattern_utils.shorten_jumps",
"svgutils.write_debug",
"pattern_utils.de_densify",
"svgpathtools.Line",
"argparse.ArgumentParser",
"svgwrite.rgb",
"matplotli... | [((1476, 1592), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate a pes file for brother sewing machines from an svg or png image"""'}), "(description=\n 'Generate a pes file for brother sewing machines from an svg or png image')\n", (1499, 1592), False, 'import argparse\n'), ((... |
#!/usr/bin/env python3
import argparse
import yaml
import logging
import math
from statistics import median
import numpy as np
import tator
if __name__=="__main__":
parser = argparse.ArgumentParser(description=__doc__)
tator.get_parser(parser)
parser.add_argument("--tracklet-type-id", type=int, required=... | [
"argparse.ArgumentParser",
"math.sqrt",
"yaml.load",
"statistics.median",
"tator.get_api",
"numpy.argmin",
"tator.get_parser"
] | [((181, 225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (204, 225), False, 'import argparse\n'), ((230, 254), 'tator.get_parser', 'tator.get_parser', (['parser'], {}), '(parser)\n', (246, 254), False, 'import tator\n'), ((640, 676), 'tator.get_api... |
# coding=utf-8
# Copyright (c) Microsoft Corporation. Licensed under the MIT license.
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... | [
"logging.getLogger",
"torch.max",
"torch.cuda.device_count",
"numpy.equal",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"torch.distributed.barrier",
"transformers.DataCollatorForLanguageModeling",
"os.path.exists",
"transformers.glue_convert_examples_to_features",... | [((2079, 2106), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2096, 2106), False, 'import logging\n'), ((2406, 2428), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (2417, 2428), False, 'import random\n'), ((2433, 2458), 'numpy.random.seed', 'np.random.seed', (['arg... |
#!/usr/bin/env python
# coding: utf-8
# In[80]:
#Кластеризация Piplines
#1 only this implimented
# train BOF[:topN] 20k -> SentenceTransformer -> AgglomerativeClustering -> KNeighborsClassifier
# inference predict KNeighborsClassifier
#2 bs 700k sample -> SentenceTransformer -> BKmeans
#3 bs 50k sapmle -> SentenceT... | [
"sentence_transformers.SentenceTransformer",
"pandas.read_csv",
"torch.mean",
"pickle.load",
"itertools.chain.from_iterable",
"torch.tensor",
"src.utils.Preprocessing_text.PreprocText",
"numpy.linalg.norm"
] | [((1172, 1215), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['self.args.name_embeder'], {}), '(self.args.name_embeder)\n', (1191, 1215), False, 'from sentence_transformers import SentenceTransformer\n'), ((1572, 1607), 'pandas.read_csv', 'pd.read_csv', (['self.args.path_to_data'], {}), '(self.a... |
# @author lucasmiranda42
# encoding: utf-8
# module deepof
"""
Testing module for deepof.train_utils
"""
import os
import numpy as np
import tensorflow as tf
from hypothesis import HealthCheck
from hypothesis import given
from hypothesis import settings
from hypothesis import strategies as st
from hypothesis.extra... | [
"numpy.ones",
"hypothesis.strategies.integers",
"os.path.join",
"hypothesis.strategies.floats",
"hypothesis.strategies.just",
"hypothesis.settings"
] | [((2220, 2311), 'hypothesis.settings', 'settings', ([], {'max_examples': '(16)', 'deadline': 'None', 'suppress_health_check': '[HealthCheck.too_slow]'}), '(max_examples=16, deadline=None, suppress_health_check=[HealthCheck\n .too_slow])\n', (2228, 2311), False, 'from hypothesis import settings\n'), ((3724, 3855), 'h... |
import scipy.io as sio;
import numpy;
from numpy import sin, linspace, pi
from pylab import plot, show, title, xlabel, ylabel, subplot
from scipy import fft, arange
import time;
def getFFT(y, Fs):
L = len(y);
Y = numpy.fft.rfft(y);
freq = numpy.fft.fftfreq(L);
plot(freq, Y.real);
show();
x = sio.... | [
"numpy.asmatrix",
"pylab.plot",
"scipy.io.loadmat",
"numpy.fft.fftfreq",
"numpy.asarray",
"numpy.fft.rfft",
"pylab.show"
] | [((316, 352), 'scipy.io.loadmat', 'sio.loadmat', (['"""Sub1_singletarget.mat"""'], {}), "('Sub1_singletarget.mat')\n", (327, 352), True, 'import scipy.io as sio\n'), ((409, 438), 'numpy.asmatrix', 'numpy.asmatrix', (['eegData[0][0]'], {}), '(eegData[0][0])\n', (423, 438), False, 'import numpy\n'), ((544, 561), 'pylab.p... |
from .learning_curves import LearningCurve
import matplotlib.pyplot as plt
import numpy as np
class LearningCurveCombined():
""" Provide helper functions to plot, fit and extrapolate learning curve using multiple learning curves."""
def __init__(self, n):
""" Instantiante a LearningCurveComb... | [
"numpy.mean",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.errorbar",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.fill_between",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.std",
"matplotlib.pyplot.leg... | [((2927, 2954), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (2937, 2954), True, 'import matplotlib.pyplot as plt\n'), ((3198, 3208), 'matplotlib.pyplot.grid', 'plt.grid', ([], {}), '()\n', (3206, 3208), True, 'import matplotlib.pyplot as plt\n'), ((3218, 3247), 'matplo... |
import pytest
tf = pytest.importorskip("tensorflow")
trt = pytest.importorskip("tensorrt")
uff = pytest.importorskip("uff")
engine_glob = ''
def create_dummy_engine(resourcepath):
global engine_glob
model = tf.placeholder(tf.float32, [None, 28, 28, 1], name='input')
model = tf.layers.conv2d(model, 64,... | [
"pytest.mark.engine",
"pytest.importorskip",
"os.path.join",
"numpy.zeros"
] | [((21, 54), 'pytest.importorskip', 'pytest.importorskip', (['"""tensorflow"""'], {}), "('tensorflow')\n", (40, 54), False, 'import pytest\n'), ((61, 92), 'pytest.importorskip', 'pytest.importorskip', (['"""tensorrt"""'], {}), "('tensorrt')\n", (80, 92), False, 'import pytest\n'), ((99, 125), 'pytest.importorskip', 'pyt... |
import os
import glob
import csv
import pandas as pd
import numpy as np
from collections import deque
from itertools import chain
from utils import rotate_quat, rotate_cross_product
class Sensor(object):
def __init__(self, name, fieldnames, data):
self.name = name
self.fieldnames = fieldnames
... | [
"numpy.mean",
"collections.deque",
"numpy.searchsorted",
"os.path.join",
"os.path.split",
"numpy.sum",
"numpy.isnan",
"utils.rotate_quat",
"numpy.linalg.norm",
"numpy.argmin",
"csv.reader"
] | [((3483, 3490), 'collections.deque', 'deque', ([], {}), '()\n', (3488, 3490), False, 'from collections import deque\n'), ((6937, 6958), 'utils.rotate_quat', 'rotate_quat', (['acc', 'rot'], {}), '(acc, rot)\n', (6948, 6958), False, 'from utils import rotate_quat, rotate_cross_product\n'), ((8201, 8222), 'utils.rotate_qu... |
"""!
Utilities for random number generators.
See isle.random.RNGWrapper for the common interface of wrappers.
"""
from abc import ABC, abstractmethod
import numpy as np
class RNGWrapper(ABC):
"""!
Base for all RNG wrappers.
"""
@property
def NAME(self):
"""!Unique name of the RNG."""
... | [
"numpy.array",
"numpy.random.RandomState"
] | [((2907, 2934), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (2928, 2934), True, 'import numpy as np\n'), ((6203, 6226), 'numpy.array', 'np.array', (["group['keys']"], {}), "(group['keys'])\n", (6211, 6226), True, 'import numpy as np\n')] |
"""
###################
Hammersley 2D-plane
###################
Hammersley points are a series of pseudo random points with a low discrepancy that are suitable for use in solid state NMR simulations where powder averaging is performed.
References
==========
- <NAME>.; <NAME>. (1964). Monte Carlo Methods. doi:10.1007... | [
"numpy.zeros",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1234, 1248), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (1242, 1248), True, 'import numpy as np\n'), ((1259, 1273), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (1267, 1273), True, 'import numpy as np\n'), ((1284, 1298), 'numpy.zeros', 'np.zeros', (['npts'], {}), '(npts)\n', (1292, 1298), True,... |
import numpy as np
import random
from shapely.geometry import Point
from shapely.geometry import Polygon
class Mock(object):
"""
mock = Mock(**{'type':'int','low': 20, 'high': 40, 'size': 1})
mock.get()
"""
low = 0
size = 0
high = 0
polygon = None
minx = None
miny = N... | [
"random.uniform",
"numpy.random.randint",
"shapely.geometry.Polygon",
"random.randrange"
] | [((1804, 1867), 'numpy.random.randint', 'np.random.randint', ([], {'low': 'self.low', 'high': 'self.high', 'size': 'self.size'}), '(low=self.low, high=self.high, size=self.size)\n', (1821, 1867), True, 'import numpy as np\n'), ((1125, 1140), 'shapely.geometry.Polygon', 'Polygon', (['coords'], {}), '(coords)\n', (1132, ... |
from pysc2.env import sc2_env
from pysc2.lib import actions, features, units
import numpy as np
import torch
from absl import flags
FLAGS = flags.FLAGS
FLAGS([''])
class Env:
metadata = {'render.modes': ['human']}
default_settings = {
'map_name': "FindAndDefeatZerglings",
'players': [sc2_en... | [
"pysc2.lib.features.Dimensions",
"pysc2.lib.actions.RAW_FUNCTIONS.raw_move_camera",
"pysc2.env.sc2_env.SC2Env",
"pysc2.lib.actions.RAW_FUNCTIONS.Attack_pt",
"numpy.array",
"numpy.stack",
"pysc2.lib.actions.RAW_FUNCTIONS.no_op",
"pysc2.env.sc2_env.Agent"
] | [((1584, 1606), 'pysc2.env.sc2_env.SC2Env', 'sc2_env.SC2Env', ([], {}), '(**args)\n', (1598, 1606), False, 'from pysc2.env import sc2_env\n'), ((2919, 2980), 'numpy.array', 'np.array', (['raw_obs.observation.feature_minimap.player_relative'], {}), '(raw_obs.observation.feature_minimap.player_relative)\n', (2927, 2980),... |
#
# File:
# scatter1.py
#
# Synopsis:
# Draws a scatter visualization using polymarkers.
#
# Categories:
# Polymarkers
# Tickmarks
# Text
# XY plots
#
# Author:
# <NAME>
#
# Date of initial publication:
# October, 2004
#
# Description:
# This example reads in some dummy of XY coordina... | [
"Ngl.Resources",
"Ngl.xy",
"Ngl.end",
"Ngl.open_wks",
"os.path.join",
"Ngl.polymarker_ndc",
"Ngl.text_ndc",
"Ngl.pynglpath",
"numpy.zeros",
"Ngl.frame",
"Ngl.polymarker",
"numpy.linalg.lstsq"
] | [((1321, 1342), 'Ngl.pynglpath', 'Ngl.pynglpath', (['"""data"""'], {}), "('data')\n", (1334, 1342), False, 'import Ngl\n'), ((1591, 1625), 'Ngl.open_wks', 'Ngl.open_wks', (['wks_type', '"""scatter1"""'], {}), "(wks_type, 'scatter1')\n", (1603, 1625), False, 'import Ngl\n'), ((1663, 1678), 'Ngl.Resources', 'Ngl.Resource... |
# -*- coding: utf-8 -*-
from __future__ import division
import os
import numpy as np
import torch
from cpprb import PrioritizedReplayBuffer
from utils import torchify
class ReplayMemory():
def __init__(self, args, capacity, env):
# Initial importance sampling weight β, annealed to 1 over course of train... | [
"cpprb.PrioritizedReplayBuffer",
"os.makedirs",
"numpy.squeeze"
] | [((624, 1112), 'cpprb.PrioritizedReplayBuffer', 'PrioritizedReplayBuffer', (['capacity', "{'obs': {'shape': env.observation_space.shape, 'dtype': env.\n observation_space.dtype}, 'next_obs': {'shape': env.observation_space.\n shape, 'dtype': env.observation_space.dtype}, 'act': {'shape': 1,\n 'dtype': env.acti... |
import math
import matplotlib.pyplot as plt
import numpy as np
from pf import pf_localization
from ekf_1 import ekf_estimation
from leastsq import lsq_estimation
# Simulation parameter
# Q_sim = np.diag([0.2]) ** 2
# R_sim = np.diag([1.0, np.deg2rad(30.0)]) ** 2
Q_sim = np.diag([0.4]) ** 2
R_sim = np.diag([0.8, np... | [
"matplotlib.pyplot.grid",
"numpy.hstack",
"ekf_1.ekf_estimation",
"math.sqrt",
"math.cos",
"numpy.array",
"math.hypot",
"numpy.arange",
"matplotlib.pyplot.plot",
"numpy.vstack",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.cla",
"numpy.eye",
"numpy.linalg.eig",
"pf.pf_localization",
"m... | [((276, 290), 'numpy.diag', 'np.diag', (['[0.4]'], {}), '([0.4])\n', (283, 290), True, 'import numpy as np\n'), ((746, 762), 'numpy.zeros', 'np.zeros', (['(0, 3)'], {}), '((0, 3))\n', (754, 762), True, 'import numpy as np\n'), ((1379, 1451), 'numpy.array', 'np.array', (['[[1.0, 0, 0, 0], [0, 1.0, 0, 0], [0, 0, 1.0, 0],... |
# <editor-fold desc="Manage Imports">
import tensorflow as tf
import numpy as np
import os
import math
import matplotlib.pyplot as plt
# </editor-fold>
# <editor-fold desc="Get / Prep Data">
#Get/Create Data
numUniqueStages = 4
numDataPoints = 1000
seq_len = 10
numRows, numCols = int(numDataPoints/(seq_len+1)), seq_le... | [
"tensorflow.one_hot",
"tensorflow.unstack",
"tensorflow.contrib.rnn.static_rnn",
"tensorflow.Variable",
"numpy.random.random_integers",
"tensorflow.losses.softmax_cross_entropy",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.contrib.rnn.LSTM... | [((333, 412), 'numpy.random.random_integers', 'np.random.random_integers', ([], {'low': '(1)', 'high': 'numUniqueStages', 'size': '(numRows, numCols)'}), '(low=1, high=numUniqueStages, size=(numRows, numCols))\n', (358, 412), True, 'import numpy as np\n'), ((561, 575), 'numpy.min', 'np.min', (['stages'], {}), '(stages)... |
import abc
import csv
from curses import A_ATTRIBUTES
import typing
import numpy as np
from xbbo.core.trials import Trials
# from xbbo.surrogate.base import Surrogate
from xbbo.surrogate.gaussian_process import GPR_sklearn
from xbbo.surrogate.transfer.tst import BaseModel
from xbbo.utils.constants import VERY_SMALL_NU... | [
"numpy.eye",
"numpy.median",
"numpy.triu_indices",
"numpy.full",
"numpy.delete",
"numpy.asarray",
"numpy.squeeze",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"numpy.empty",
"xbbo.surrogate.gaussian_process.GPR_sklearn",
"numpy.argwhere",
"numpy.linalg.norm",
"numpy.ex... | [((5252, 5292), 'numpy.zeros', 'np.zeros', (['array.shape[1]'], {'dtype': 'np.int64'}), '(array.shape[1], dtype=np.int64)\n', (5260, 5292), True, 'import numpy as np\n'), ((5876, 5913), 'numpy.asarray', 'np.asarray', (['trials._his_observe_value'], {}), '(trials._his_observe_value)\n', (5886, 5913), True, 'import numpy... |
import os
import codecs
import numpy as np
#class CoNLL_Sentence:
# def __init__(self, tokens):
# self.tokens = tokens
#class Simplified_CoNLL_Token:
# def __init__(self, token, token_label, sentence_label):
# self.token = token
# self.token_label = token_label
# self.sentence_label ... | [
"numpy.array",
"os.path.join",
"os.walk"
] | [((1184, 1197), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (1191, 1197), False, 'import os\n'), ((1947, 1958), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1955, 1958), True, 'import numpy as np\n'), ((1960, 1975), 'numpy.array', 'np.array', (['y_arg'], {}), '(y_arg)\n', (1968, 1975), True, 'import numpy as... |
"""Prepares and verifies specific fcs text section parameters to be used in
data extraction.
Required FCS primary TEXT segment keywords:
$BEGINANALYSIS $BEGINDATA $BEGINSTEXT $BYTEORD $DATATYPE $ENDANALYSIS $ENDDATA
$ENDSTEXT $MODE $NEXTDATA $PAR $TOT $PnB $PnE $PnN $PnR
"""
from collections import namedtuple
import... | [
"numpy.dtype",
"collections.namedtuple"
] | [((1736, 1755), 'numpy.dtype', 'np.dtype', (['txt_dtype'], {}), '(txt_dtype)\n', (1744, 1755), True, 'import numpy as np\n'), ((2904, 2933), 'collections.namedtuple', 'namedtuple', (['"""spec"""', 'spec_keys'], {}), "('spec', spec_keys)\n", (2914, 2933), False, 'from collections import namedtuple\n')] |
import matplotlib.pyplot as plt
import numpy as np
a1 = plt.subplot2grid((3,3),(0,0),colspan = 2)
a2 = plt.subplot2grid((3,3),(0,2), rowspan = 3)
a3 = plt.subplot2grid((3,3),(1,0),rowspan = 2, colspan = 2)
x = np.arange(1,10)
a2.plot(x, x*x)
a2.set_title('square')
a1.plot(x, np.exp(x))
a1.set_title('exp')
a3.plot(x... | [
"numpy.log",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplot2grid",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((58, 101), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(3, 3)', '(0, 0)'], {'colspan': '(2)'}), '((3, 3), (0, 0), colspan=2)\n', (74, 101), True, 'import matplotlib.pyplot as plt\n'), ((105, 148), 'matplotlib.pyplot.subplot2grid', 'plt.subplot2grid', (['(3, 3)', '(0, 2)'], {'rowspan': '(3)'}), '((3, 3), ... |
import PySimpleGUI as sg
from PIL import Image
import os
import io
from typing import Literal, Tuple
import pandas as pd
import json
import numpy as np
CACHE = "cachefile.json"
ANNOTATION = "annotation/"
INDENT = 4
SPACE = " "
NEWLINE = "\n"
# This program includes software developed by jterrace and <NAME>
# in htt... | [
"pandas.isnull",
"pandas.read_csv",
"os.path.isfile",
"numpy.issubdtype",
"os.path.basename"
] | [((2449, 2479), 'os.path.isfile', 'os.path.isfile', (['annotation_csv'], {}), '(annotation_csv)\n', (2463, 2479), False, 'import os\n'), ((2511, 2548), 'pandas.read_csv', 'pd.read_csv', (['annotation_csv'], {'header': '(0)'}), '(annotation_csv, header=0)\n', (2522, 2548), True, 'import pandas as pd\n'), ((2002, 2023), ... |
from PIL import Image
import numpy as np
from torchvision import transforms, models
import cv2
def load_image_or_video(img_path, shape=None):
in_transform = transforms.Compose([
transforms.Resize((256,256)),
transforms.ToTensor(),
])
... | [
"PIL.Image.open",
"numpy.array",
"cv2.VideoCapture",
"cv2.cvtColor",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor"
] | [((329, 355), 'cv2.VideoCapture', 'cv2.VideoCapture', (['img_path'], {}), '(img_path)\n', (345, 355), False, 'import cv2\n'), ((1281, 1312), 'numpy.array', 'np.array', (['(0.485, 0.456, 0.406)'], {}), '((0.485, 0.456, 0.406))\n', (1289, 1312), True, 'import numpy as np\n'), ((207, 236), 'torchvision.transforms.Resize',... |
# Auto-ML for predicting relational reasoning.
# The model is based on the auto-sklearn library.
import time
import collections
import numpy as np
import ccobra
import autosklearn.classification
# mapping of cardinal direction input
input_mppng = {"north-west": [1,0,0,1], "north":[1,0,0,0], "north-east":[1,... | [
"numpy.array",
"numpy.apply_along_axis"
] | [((1804, 1815), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1812, 1815), True, 'import numpy as np\n'), ((1839, 1850), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1847, 1850), True, 'import numpy as np\n'), ((2246, 2288), 'numpy.apply_along_axis', 'np.apply_along_axis', (['np.argmax', '(1)', 'train_y'], {})... |
from tensorboardX import summary
import numpy as np
import pytest
import unittest
from tensorboardX.utils import make_grid
class UtilsTest(unittest.TestCase):
def test_to_HWC(self):
test_image = np.random.randint(0, 256, size=(3, 32, 32), dtype=np.uint8)
converted = convert_to_HWC(test_image, 'chw... | [
"numpy.stack",
"numpy.random.randint",
"tensorboardX.utils.make_grid"
] | [((209, 268), 'numpy.random.randint', 'np.random.randint', (['(0)', '(256)'], {'size': '(3, 32, 32)', 'dtype': 'np.uint8'}), '(0, 256, size=(3, 32, 32), dtype=np.uint8)\n', (226, 268), True, 'import numpy as np\n'), ((390, 453), 'numpy.random.randint', 'np.random.randint', (['(0)', '(256)'], {'size': '(16, 3, 32, 32)',... |
import numpy as np
import typing as t
class ProbRelation:
def __init__(self, probs: t.List[t.List[float]], shape:t.Tuple[int, int]):
self.distibution = np.array(probs)
self.shape = shape | [
"numpy.array"
] | [((165, 180), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (173, 180), True, 'import numpy as np\n')] |
from functools import reduce
from teacher.tree import ID3, FDT
from teacher.tree.tests.fdt_legacy_tree import FDT_Legacy
from teacher.tree.tests.id3_legacy_tree import ID3_Legacy
from pytest import fixture
from sklearn import datasets
from sklearn.model_selection import train_test_split
from teacher.fuzzy import get_... | [
"teacher.explanation.m_factual",
"teacher.explanation.c_factual",
"teacher.explanation.mr_factual",
"numpy.random.seed",
"sklearn.datasets.load_iris",
"teacher.fuzzy.get_fuzzy_variables",
"sklearn.model_selection.train_test_split",
"functools.reduce",
"teacher.datasets.load_compas",
"numpy.argmax"... | [((604, 621), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (615, 621), False, 'import random\n'), ((626, 646), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (640, 646), True, 'import numpy as np\n'), ((719, 752), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {'as_frame': '(T... |
import cv2
import numpy as np
def get_coarse_match(conf_matrix, input_height, input_width, resolution):
"""
Predicts coarse matches from conf_matrix
Args:
resolution: image
input_width:
input_height:
conf_matrix: [N, L, S]
Returns:
mkpts0_c: [M, 2]
... | [
"numpy.trunc",
"cv2.cvtColor",
"cv2.resize",
"numpy.zeros_like",
"numpy.arange"
] | [((772, 807), 'numpy.zeros_like', 'np.zeros_like', (['j_ids'], {'dtype': 'np.long'}), '(j_ids, dtype=np.long)\n', (785, 807), True, 'import numpy as np\n'), ((820, 857), 'numpy.arange', 'np.arange', (['feature_num'], {'dtype': 'np.long'}), '(feature_num, dtype=np.long)\n', (829, 857), True, 'import numpy as np\n'), ((1... |
import numpy as np
import pandas as pd
from functools import reduce
from itertools import combinations_with_replacement
from amlearn.featurize.base import create_featurizer_backend
from amlearn.utils.packing import load_radii
from sklearn.base import BaseEstimator, TransformerMixin
try:
from amlearn.featurize.src ... | [
"amlearn.featurize.src.bp_symmfunc.bp_radial",
"amlearn.featurize.src.bp_symmfunc.bp_angular",
"amlearn.featurize.base.create_featurizer_backend",
"itertools.combinations_with_replacement",
"numpy.array",
"amlearn.utils.packing.load_radii",
"numpy.arange"
] | [((3108, 3454), 'amlearn.featurize.src.bp_symmfunc.bp_radial', 'bp_symmfunc.bp_radial', ([], {'center_atom_ids': 'atom_ids', 'center_atom_coords': 'atom_coords', 'atom_ids': 'atom_ids', 'atom_types': 'atom_types', 'atom_type_symbols': 'self.atom_type_symbols', 'atom_coords': 'atom_coords', 'pbc': 'self.pbc', 'bds': 'se... |
import numpy as np
import matplotlib.pyplot as plt
# Returns a list of tuples representing points
def read_input(file_name: str):
with open(file_name, 'r') as input_file:
point_list = input_file.read().split('\n')
x_coords = []
y_coords = []
for point in point_list:
x_s... | [
"numpy.asarray",
"numpy.sign",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((893, 909), 'numpy.asarray', 'np.asarray', (['rhos'], {}), '(rhos)\n', (903, 909), True, 'import numpy as np\n'), ((1116, 1152), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(7)', 'step': '(0.5)'}), '(start=0, stop=7, step=0.5)\n', (1125, 1152), True, 'import numpy as np\n'), ((1456, 1474), 'matplotlib... |
import numpy as np
import pandas as pd
from stock.utils.symbol_util import get_stock_symbols, get_archived_trading_dates
from stock.marketdata.storefactory import get_store
from config import store_type
pd.set_option('display.max_rows', None)
store = get_store(store_type)
def get_equity_value(exsymbols, date):
clo... | [
"pandas.DataFrame",
"numpy.mean",
"stock.marketdata.storefactory.get_store",
"pandas.set_option"
] | [((204, 243), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (217, 243), True, 'import pandas as pd\n'), ((252, 273), 'stock.marketdata.storefactory.get_store', 'get_store', (['store_type'], {}), '(store_type)\n', (261, 273), False, 'from stock.marketdata... |
# -*- coding: utf-8 -*-
"""
Helpers to make constructing features and labels easier.
"""
import numpy as np
from chess_py import color
from chess_py.pieces.piece_const import PieceValues
def extract_features_from_position(board):
"""
Converts board to 1D numpy array consisting of
piece values.
:typ... | [
"numpy.sum",
"chess_py.pieces.piece_const.PieceValues"
] | [((382, 395), 'chess_py.pieces.piece_const.PieceValues', 'PieceValues', ([], {}), '()\n', (393, 395), False, 'from chess_py.pieces.piece_const import PieceValues\n'), ((973, 989), 'numpy.sum', 'np.sum', (['position'], {}), '(position)\n', (979, 989), True, 'import numpy as np\n')] |
"""
Returns an array of probability for each class at timepoints sampled at the specified rate.
e.g. event_detector(filename, model, 40) will sample the input file at 40 frame intervals
and concatenate
"""
import cv2
import numpy as np
from keras.models import load_model
def videoscan(filename, model_file, sampling... | [
"numpy.array",
"cv2.resize",
"keras.models.load_model",
"cv2.VideoCapture"
] | [((1436, 1458), 'keras.models.load_model', 'load_model', (['model_file'], {}), '(model_file)\n', (1446, 1458), False, 'from keras.models import load_model\n'), ((1713, 1739), 'cv2.VideoCapture', 'cv2.VideoCapture', (['filename'], {}), '(filename)\n', (1729, 1739), False, 'import cv2\n'), ((3106, 3121), 'numpy.array', '... |
# -*- coding=utf8 -*-
# !/usr/bin/env python
try:
import cPickle
except:
import pickle as cPickle
import csv
import json
import random
from datetime import datetime
import dateutil
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pylab as plb
import scipy.stats
from sklearn.metri... | [
"matplotlib.pyplot.hist",
"dateutil.relativedelta.relativedelta",
"pandas.read_csv",
"numpy.irr",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"numpy.log",
"numpy.argsort",
"numpy.array",
"sklearn.metrics.roc_curve",
"numpy.nanmin",
"numpy.arange",
"numpy.mean",
"pylab.find",
"nump... | [((848, 874), 'numpy.zeros', 'np.zeros', (['values1.shape[0]'], {}), '(values1.shape[0])\n', (856, 874), True, 'import numpy as np\n'), ((1235, 1260), 'numpy.zeros', 'np.zeros', (['values.shape[0]'], {}), '(values.shape[0])\n', (1243, 1260), True, 'import numpy as np\n'), ((1503, 1528), 'numpy.zeros', 'np.zeros', (['va... |
import numpy as np
import math
from tf_convex_quad_iou import iou_matrix
sqrt2 = math.sqrt(2)
anchors = np.array([
[
[-1, -1],
[1, -1],
[1, 1],
[-1, 1],
],
[
[0, 0],
[2, 0],
[2, 2],
[0, 2],
],
[
[0, sqrt2],
[-sqrt2, 0]... | [
"numpy.array",
"tf_convex_quad_iou.iou_matrix",
"math.sqrt"
] | [((82, 94), 'math.sqrt', 'math.sqrt', (['(2)'], {}), '(2)\n', (91, 94), False, 'import math\n'), ((106, 336), 'numpy.array', 'np.array', (['[[[-1, -1], [1, -1], [1, 1], [-1, 1]], [[0, 0], [2, 0], [2, 2], [0, 2]], [[\n 0, sqrt2], [-sqrt2, 0], [0, -sqrt2], [sqrt2, 0]], [[-1, 1], [0, 0], [1,\n 0], [2, 1]], [[1, 1], ... |
#------------------------------------------------------------------------------
# Create side by side trajectories on video frame and sat image
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Settings and... | [
"numpy.array",
"copy.deepcopy",
"pandas.read_csv",
"modules.homography.PixelMapper"
] | [((505, 547), 'pandas.read_csv', 'pd.read_csv', (['"""../output/2-sample-2020.csv"""'], {}), "('../output/2-sample-2020.csv')\n", (516, 547), True, 'import pandas as pd\n'), ((2616, 2672), 'modules.homography.PixelMapper', 'PixelMapper', (["quad_coords['pixel']", "quad_coords['lonlat']"], {}), "(quad_coords['pixel'], q... |
import numpy as np
def compute_quantity (plan, stype):
if stype == 'stack':
return compute_quantity_stack (plan['packages']['children'])
elif stype == 'shelf':
return compute_quantity_shelf (plan['packages']['children'])
else:
return compute_quantity_apr (plan['packages']['chil... | [
"numpy.roll"
] | [((1847, 1860), 'numpy.roll', 'np.roll', (['y', '(1)'], {}), '(y, 1)\n', (1854, 1860), True, 'import numpy as np\n'), ((1870, 1883), 'numpy.roll', 'np.roll', (['x', '(1)'], {}), '(x, 1)\n', (1877, 1883), True, 'import numpy as np\n')] |
import time
import math
import tempfile
import operator
import os
import json
from typing import Union, List, Tuple
import unittest
import h5py
import numpy as np
from PythonExtras import numpy_extras as npe
from PythonExtras import patching_tools
from PythonExtras import volume_tools
from PythonExtras.CppWrapper imp... | [
"PythonExtras.numpy_extras.var_large_array_masked",
"PythonExtras.numpy_extras.aggregate_attention_volume",
"PythonExtras.BufferedNdArray.BufferedNdArray",
"numpy.fromfile",
"PythonExtras.CppWrapper.CppWrapper.test",
"numpy.logical_not",
"numpy.equal",
"PythonExtras.numpy_extras.abs_diff_hdf_arrays_ma... | [((2484, 2495), 'time.time', 'time.time', ([], {}), '()\n', (2493, 2495), False, 'import time\n'), ((4303, 4337), 'numpy.not_equal', 'np.not_equal', (['allDataY', 'emptyValue'], {}), '(allDataY, emptyValue)\n', (4315, 4337), True, 'import numpy as np\n'), ((4467, 4520), 'numpy.logical_or', 'np.logical_or', (['nonemptyP... |
import odespy
from vib_odespy import run_solvers_and_plot, RHS, \
VibSolverWrapper4Odespy, plt
from numpy import pi, sin
# Primary ODE: m=1, s(u)=(2*pi)**2*u, such that the period is 1.
# Then we add linear damping and a force term A*sin(w*t) where
# w is half and double of the frequency of the free oscillations.... | [
"vib_odespy.VibSolverWrapper4Odespy",
"odespy.CrankNicolson",
"vib_odespy.plt.show",
"vib_odespy.RHS",
"odespy.BackwardEuler",
"vib_odespy.run_solvers_and_plot",
"odespy.ForwardEuler",
"numpy.sin",
"vib_odespy.plt.figure"
] | [((1672, 1682), 'vib_odespy.plt.show', 'plt.show', ([], {}), '()\n', (1680, 1682), False, 'from vib_odespy import run_solvers_and_plot, RHS, VibSolverWrapper4Odespy, plt\n'), ((1555, 1567), 'vib_odespy.plt.figure', 'plt.figure', ([], {}), '()\n', (1565, 1567), False, 'from vib_odespy import run_solvers_and_plot, RHS, V... |
from argparse import ArgumentParser
from pathlib import Path
import os
import time
import glob
import torch
import logging
import json
import random
import numpy as np
import pandas as pd
from contextlib import contextmanager
from collections import namedtuple, defaultdict
from tempfile import TemporaryDirectory
impor... | [
"torch.cuda.device_count",
"numpy.array",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"pytorch_transformers.modeling_bert.BertForPreTraining.from_pretrained",
"utils.Timers",
"torch.distributed.get_rank",
"logging.info",
"os.remove",
"os.path.exists",
"numpy.mea... | [((1091, 1179), 'collections.namedtuple', 'namedtuple', (['"""InputFeatures"""', '"""input_ids input_mask segment_ids lm_label_ids is_next"""'], {}), "('InputFeatures',\n 'input_ids input_mask segment_ids lm_label_ids is_next')\n", (1101, 1179), False, 'from collections import namedtuple, defaultdict\n'), ((1220, 12... |
import pytest
import matplotlib.pyplot as plt
import astropy.units as u
import numpy as np
from ..skySurvey import SkySurvey
# Set up the random number generator.
np.random.seed(1234)
# Local directory:
# "/Users/dk/Data/WHAM/wham-ss-DR1-v161116-170912.fits"
survey = SkySurvey()
BASELINE_DIR = 'baseline'
@pytest.... | [
"cartopy.crs.Stereographic",
"pytest.mark.mpl_image_compare",
"matplotlib.pyplot.figure",
"numpy.random.seed"
] | [((165, 185), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (179, 185), True, 'import numpy as np\n'), ((313, 383), 'pytest.mark.mpl_image_compare', 'pytest.mark.mpl_image_compare', ([], {'baseline_dir': 'BASELINE_DIR', 'tolerance': '(20)'}), '(baseline_dir=BASELINE_DIR, tolerance=20)\n', (342, 3... |
"""
Reads in current year's Arctic sea ice extent from Sea Ice Index 2 (NSIDC)
Website : ftp://sidads.colorado.edu/DATASETS/NOAA/G02135/north/daily/data/
Author : <NAME>
Date : 5 September 2016
"""
### Import modules
import numpy as np
import datetime
import matplotlib.pyplot as plt
from mpl_toolkits.basema... | [
"numpy.reshape",
"matplotlib.pyplot.savefig",
"numpy.where",
"netCDF4.Dataset",
"datetime.datetime.now",
"matplotlib.pyplot.figure",
"mpl_toolkits.basemap.Basemap",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.rc",
"numpy.nanmean",
"numpy.meshgrid",
"numpy.arange"
] | [((561, 584), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (582, 584), False, 'import datetime\n'), ((778, 806), 'numpy.arange', 'np.arange', (['(1979)', '(2010 + 1)', '(1)'], {}), '(1979, 2010 + 1, 1)\n', (787, 806), True, 'import numpy as np\n'), ((950, 973), 'datetime.datetime.now', 'datetime.... |
# #####################################################################################################################
'''
This file is a scratchpad of code used for preparing the folders of the dataset, including:
- Inverting a greyscale image, so that all cells are on a black background
- Pulling a random subset... | [
"os.path.exists",
"PIL.Image.fromarray",
"os.listdir",
"PIL.Image.open",
"random.shuffle",
"pandas.read_csv",
"PIL.Image.merge",
"image_slicer.slice",
"image_slicer.save_tiles",
"numpy.zeros",
"torchvision.transforms.functional._is_pil_image",
"PIL.ImageOps.invert",
"os.system",
"numpy.rou... | [((1576, 1596), 'os.listdir', 'os.listdir', (['file_dir'], {}), '(file_dir)\n', (1586, 1596), False, 'import os\n'), ((2217, 2237), 'os.path.exists', 'os.path.exists', (['mini'], {}), '(mini)\n', (2231, 2237), False, 'import os\n'), ((2269, 2295), 'os.system', 'os.system', (["('mkdir ' + mini)"], {}), "('mkdir ' + mini... |
import tensorflow
from PIL import Image
import numpy
import argparse
import os
import sys
import pandas
from ModelsEnum import Models
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')))
def predict(model, imgPath, imgHeight, imgWidth):
# 如果 imgPath 是数组
if isinstance(imgPat... | [
"os.path.exists",
"PIL.Image.open",
"argparse.ArgumentParser",
"numpy.argmax",
"os.path.isfile",
"os.path.dirname",
"models.modelMulClassi.modelDefinition.model.load_weights",
"tensorflow.expand_dims"
] | [((539, 569), 'tensorflow.expand_dims', 'tensorflow.expand_dims', (['img', '(0)'], {}), '(img, 0)\n', (561, 569), False, 'import tensorflow\n'), ((720, 745), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (743, 745), False, 'import argparse\n'), ((188, 213), 'os.path.dirname', 'os.path.dirname'... |
from mmseg.apis import inference_segmentor, init_segmentor
import mmcv
import os
import numpy as np
import tqdm
import argparse
def show_result(result,
palette=None):
seg = result[0]
palette = np.array(palette)
color_seg = np.zeros((seg.shape[0], seg.shape[1], 3), dtype=np.uint8)... | [
"os.listdir",
"os.makedirs",
"argparse.ArgumentParser",
"mmseg.apis.inference_segmentor",
"tqdm.tqdm",
"os.path.join",
"numpy.array",
"numpy.zeros",
"mmseg.apis.init_segmentor"
] | [((497, 522), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (520, 522), False, 'import argparse\n'), ((724, 763), 'os.makedirs', 'os.makedirs', (['output_path'], {'exist_ok': '(True)'}), '(output_path, exist_ok=True)\n', (735, 763), False, 'import os\n'), ((775, 797), 'os.listdir', 'os.listdir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.