code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import os import h5py import numpy as np import pandas as pd import multiprocessing as mp class Scaler: def __init__(self, mean=None, std=None): self.mean = mean self.std = std def fit(self, data): self.mean = np.mean(data) self.std = np.std(data) def set_mean(self, mean): self.mean = me...
[ "numpy.mean", "numpy.reshape", "h5py.File", "numpy.array", "numpy.isnan", "multiprocessing.Pool", "numpy.std", "pandas.DataFrame", "numpy.fromstring" ]
[((562, 586), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (571, 586), False, 'import h5py\n'), ((758, 782), 'h5py.File', 'h5py.File', (['filename', '"""w"""'], {}), "(filename, 'w')\n", (767, 782), False, 'import h5py\n'), ((897, 938), 'numpy.fromstring', 'np.fromstring', (['s'], {'dty...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #AUTHOR: <NAME> #DATE: Wed Apr 3 16:15:13 2019 #VERSION: #PYTHON_VERSION: 3.6 ''' DESCRIPTION ''' import numpy as np import matplotlib.pyplot as plt from matplotlib.animation import FuncAnimation from neural_network import neural_network stimuli = np.random.rand(6, 11) ...
[ "matplotlib.pyplot.subplots", "neural_network.neural_network", "numpy.random.rand", "matplotlib.pyplot.show" ]
[((298, 319), 'numpy.random.rand', 'np.random.rand', (['(6)', '(11)'], {}), '(6, 11)\n', (312, 319), True, 'import numpy as np\n'), ((324, 371), 'neural_network.neural_network', 'neural_network', ([], {'stimuli': 'stimuli', 'threshold': '(0.05)'}), '(stimuli=stimuli, threshold=0.05)\n', (338, 371), False, 'from neural_...
"""System utilities.""" import socket import sys import os import csv import yaml import torch import torchvision import random import numpy as np import datetime import hydra from omegaconf import OmegaConf, open_dict import logging def system_startup(process_idx, local_group_size, cfg): """Decide and prin...
[ "logging.getLogger", "omegaconf.open_dict", "csv.DictWriter", "torch.as_tensor", "torch.cuda.device_count", "torch.cuda.is_available", "torch.distributed.get_rank", "sys.version.split", "datetime.timedelta", "torchvision.utils.save_image", "hydra.utils.get_original_cwd", "numpy.asarray", "os...
[((502, 576), 'torch.multiprocessing.set_sharing_strategy', 'torch.multiprocessing.set_sharing_strategy', (['cfg.case.impl.sharing_strategy'], {}), '(cfg.case.impl.sharing_strategy)\n', (544, 576), False, 'import torch\n'), ((1314, 1339), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1337, 13...
""" Modified from https://github.com/microsoft/Swin-Transformer/blob/main/main.py """ import os import time import argparse import datetime import numpy as np import oneflow as flow import oneflow.backends.cudnn as cudnn from flowvision.loss.cross_entropy import ( LabelSmoothingCrossEntropy, SoftTargetCrossEn...
[ "flowvision.loss.cross_entropy.SoftTargetCrossEntropy", "utils.reduce_tensor", "flowvision.utils.metrics.accuracy", "argparse.ArgumentParser", "oneflow.env.get_rank", "flowvision.utils.metrics.AverageMeter", "oneflow.nn.CrossEntropyLoss", "models.build_model", "data.build_loader", "oneflow.no_grad...
[((9189, 9203), 'oneflow.no_grad', 'flow.no_grad', ([], {}), '()\n', (9201, 9203), True, 'import oneflow as flow\n'), ((10709, 10723), 'oneflow.no_grad', 'flow.no_grad', ([], {}), '()\n', (10721, 10723), True, 'import oneflow as flow\n'), ((754, 868), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Flowvisi...
# import json import copy import itertools import multiprocessing import os import sys import time from functools import partial import numpy as np from numpy import linalg from tqdm import tqdm import rmsd import quantum import clockwork import merge import similarity_fchl19 as sim from chemhelp import cheminfo fro...
[ "clockwork.generate_torsion_combinations", "similarity_fchl19.get_representation", "quantum.optmize_conformation", "chemhelp.cheminfo.convert_atom", "communication.rediscomm.Taskqueue", "chemhelp.cheminfo.sdfstr_to_molobj", "numpy.array", "copy.deepcopy", "numpy.linalg.norm", "rdkit.Chem.rdMolTran...
[((528, 562), 'joblib.Memory', 'joblib.Memory', (['cachedir'], {'verbose': '(0)'}), '(cachedir, verbose=0)\n', (541, 562), False, 'import joblib\n'), ((653, 681), 'os.path.expanduser', 'os.path.expanduser', (['filepath'], {}), '(filepath)\n', (671, 681), False, 'import os\n'), ((726, 779), 'rdkit.Chem.ChemicalForceFiel...
import pickle from matplotlib import pyplot as plt import torch import seaborn as sns import numpy as np from src.src_vvCV_MD1P.stein_operators import * from src.src_vvCV_MD1P.sv_CV import * from src.src_vvCV_MD1P.vv_CV_MD1P import * from src.src_vvCV_MD1P.vv_CV_FixB_MD1P import * from src.src_vvCV_MD1P.vv_CV_unbalan...
[ "numpy.sqrt", "torch.sqrt", "seaborn.set_style", "numpy.arange", "seaborn.color_palette", "torch.eye", "numpy.linspace", "torch.randn", "torch.Tensor", "pickle.load", "torch.cat", "matplotlib.pyplot.show", "torch.manual_seed", "torch.stack", "torch.zeros", "torch.no_grad", "matplotli...
[((495, 515), 'torch.Tensor', 'torch.Tensor', (['[1, 1]'], {}), '([1, 1])\n', (507, 515), False, 'import torch\n'), ((9837, 9859), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (9850, 9859), True, 'import seaborn as sns\n'), ((9868, 9894), 'torch.cat', 'torch.cat', (['(X1, X2)'], {'dim': '...
import re import itertools import os import pandas as pd import numpy as np from prettytable import PrettyTable from tqdm import tqdm def get_char(seq): """split string int sequence of chars returned in pandas.Series""" chars = list(seq) return pd.Series(chars) class SeqProcessConfig(object): def __i...
[ "pandas.Series", "prettytable.PrettyTable", "numpy.where", "itertools.product", "tqdm.tqdm", "os.path.join", "pandas.DataFrame", "pandas.concat" ]
[((259, 275), 'pandas.Series', 'pd.Series', (['chars'], {}), '(chars)\n', (268, 275), True, 'import pandas as pd\n'), ((1640, 1653), 'prettytable.PrettyTable', 'PrettyTable', ([], {}), '()\n', (1651, 1653), False, 'from prettytable import PrettyTable\n'), ((2618, 2631), 'prettytable.PrettyTable', 'PrettyTable', ([], {}...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Using CNN to create descriptors and neural layer to predict object recognition in images. By: <NAME>, <NAME>, and <NAME>. MLDM Master's Year 2 Fall Semester 2017 """ import os ############################################################################### #Set Params...
[ "keras.preprocessing.image.img_to_array", "keras.applications.inception_v3.preprocess_input", "matplotlib.pyplot.imshow", "os.listdir", "xml.etree.ElementTree.parse", "numpy.repeat", "matplotlib.pyplot.barh", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.yticks", "pandas.DataFrame", "matplotlib...
[((331, 398), 'os.listdir', 'os.listdir', (['"""D:/GD/MLDM/Computer_Vision_Project/cnn5/data/training"""'], {}), "('D:/GD/MLDM/Computer_Vision_Project/cnn5/data/training')\n", (341, 398), False, 'import os\n'), ((8223, 8240), 'keras.models.load_model', 'load_model', (['model'], {}), '(model)\n', (8233, 8240), False, 'f...
from typing import List,Dict import torch from torch import nn import numpy as np from torch.nn import functional as F from functools import partial from detectron2.config import configurable from detectron2.layers import Conv2d, ConvTranspose2d, cat, interpolate, DeformConv from detectron2.structures import ...
[ "numpy.tile", "torch.nn.ReLU", "torch.nn.GroupNorm", "numpy.repeat", "numpy.sqrt", "torch.nn.init.constant_", "numpy.arange", "torch.nn.Sequential", "detectron2.layers.DeformConv", "numpy.log", "torch.nn.Conv2d", "numpy.stack", "torch.tensor", "detectron2.utils.registry.Registry", "funct...
[((531, 556), 'detectron2.utils.registry.Registry', 'Registry', (['"""REPPOINT_HEAD"""'], {}), "('REPPOINT_HEAD')\n", (539, 556), False, 'from detectron2.utils.registry import Registry\n'), ((803, 844), 'torch.nn.init.normal_', 'nn.init.normal_', (['module.weight', 'mean', 'std'], {}), '(module.weight, mean, std)\n', (...
""" The :mod:`pyfan.graph.example.scatterline3` generates a graprh with three lines. This is the functionalized vesrion of `plot_randgrid Example <https://pyfan.readthedocs.io/en/latest/auto_examples/plot_randgrid.html#sphx-glr-auto-examples-plot-randgrid-py>`_. Includes method :func:`gph_scatter_line_rand`. """ impo...
[ "matplotlib.pyplot.grid", "pyfan.util.timer.timer.getDateTime", "argparse.ArgumentParser", "matplotlib.pyplot.ylabel", "pyfan.aws.general.path.save_img", "matplotlib.pyplot.xlabel", "numpy.column_stack", "pyfan.gen.rand.randgrid.ar_draw_random_normal", "matplotlib.pyplot.title", "matplotlib.pyplot...
[((611, 636), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (634, 636), False, 'import argparse\n'), ((3535, 3649), 'pyfan.gen.rand.randgrid.ar_draw_random_normal', 'pyfan_gen_rand.ar_draw_random_normal', (['fl_mu', 'fl_sd', 'it_draws', 'it_seed', 'it_draw_type', 'fl_lower_sd', 'fl_higher_sd']...
import gym from gym import error, spaces, utils from gym.utils import seeding import numpy as np import torch import random import sys import os class UDNEnv(gym.Env): metadata = {} def __init__(self): self.BSposition = np.loadtxt('BSposition.csv', delimiter=',') self.BSnum = len(self.BSpo...
[ "numpy.mean", "numpy.log10", "numpy.ones", "numpy.log2", "numpy.linalg.norm", "gym.spaces.Discrete", "numpy.sum", "numpy.random.randint", "numpy.zeros", "numpy.cos", "numpy.argmin", "numpy.random.uniform", "numpy.sin", "numpy.loadtxt" ]
[((242, 285), 'numpy.loadtxt', 'np.loadtxt', (['"""BSposition.csv"""'], {'delimiter': '""","""'}), "('BSposition.csv', delimiter=',')\n", (252, 285), True, 'import numpy as np\n'), ((369, 424), 'numpy.loadtxt', 'np.loadtxt', (['"""InterferenceBSposition.csv"""'], {'delimiter': '""","""'}), "('InterferenceBSposition.csv...
import numpy as np import sys import qoi as qoi import parallel as par # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ! # ~~~~ Selection without replacement # ~~~~ Sample K numbers from an array 0...N-1 and output them # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
[ "numpy.random.normal", "numpy.mean", "numpy.random.rand", "parallel.printRoot", "numpy.floor", "parallel.partitionSim", "numpy.exp", "numpy.linspace", "numpy.zeros", "numpy.argwhere", "numpy.sum", "sys.exit", "numpy.load", "numpy.amax" ]
[((1027, 1056), 'parallel.partitionSim', 'par.partitionSim', (["Sim['NRep']"], {}), "(Sim['NRep'])\n", (1043, 1056), True, 'import parallel as par\n'), ((1855, 1895), 'numpy.linspace', 'np.linspace', (['minLevel', 'maxLevel', 'nLevels'], {}), '(minLevel, maxLevel, nLevels)\n', (1866, 1895), True, 'import numpy as np\n'...
#!/usr/bin/env python # coding: utf-8 """ run consensus analysis to identify overall pattern analysis method developed by <NAME> and <NAME> """ import os import sys import glob import numpy import nibabel import nilearn.plotting import nilearn.input_data import matplotlib.pyplot as plt from statsmodels.stats.multites...
[ "numpy.sqrt", "nibabel.load", "statsmodels.stats.multitest.multipletests", "os.path.exists", "numpy.mean", "sys._getframe", "matplotlib.pyplot.close", "os.mkdir", "numpy.eye", "numpy.ones", "numpy.corrcoef", "numpy.triu_indices_from", "nibabel.Nifti1Image", "utils.log_to_file", "narps.Na...
[((879, 900), 'numpy.ones', 'numpy.ones', (['(npts, 1)'], {}), '((npts, 1))\n', (889, 900), False, 'import numpy\n'), ((1653, 1691), 'utils.log_to_file', 'log_to_file', (['logfile', "('%s' % func_name)"], {}), "(logfile, '%s' % func_name)\n", (1664, 1691), False, 'from utils import log_to_file\n'), ((3597, 3635), 'util...
import numpy as np from multiprocessing import Process, Queue from mxnet.io import DataIter, DataBatch import mxnet as mx import numpy as np from mxnet.io import DataIter from PIL import Image import os import preprocessing import logging import sys #rgb_mean=(140.5192, 59.6655, 63.8419), #mean on tote trainval cla...
[ "PIL.Image.fromarray", "numpy.random.rand", "preprocessing.calc_crop_params", "multiprocessing.Process", "os.path.join", "mxnet.io.DataBatch", "preprocessing.pad_image", "numpy.array", "preprocessing.random_flip", "numpy.concatenate", "numpy.expand_dims", "mxnet.nd.array", "multiprocessing.Q...
[((1715, 1734), 'multiprocessing.Queue', 'Queue', ([], {'maxsize': '(1000)'}), '(maxsize=1000)\n', (1720, 1734), False, 'from multiprocessing import Process, Queue\n'), ((1764, 1804), 'multiprocessing.Process', 'Process', ([], {'target': 'self._produce_flist_item'}), '(target=self._produce_flist_item)\n', (1771, 1804),...
from .. import Utils from SimPEG.EM.Base import BaseEMProblem from .SurveyDC import Survey from .FieldsDC import FieldsDC, Fields_CC, Fields_N import numpy as np import scipy as sp from SimPEG.Utils import Zero from .BoundaryUtils import getxBCyBC_CC class BaseDCProblem(BaseEMProblem): """ Base DC Problem ...
[ "numpy.ones_like", "numpy.hstack", "numpy.zeros", "scipy.sparse.find", "SimPEG.Utils.Zero" ]
[((1663, 1676), 'numpy.hstack', 'np.hstack', (['Jv'], {}), '(Jv)\n', (1672, 1676), True, 'import numpy as np\n'), ((1934, 1950), 'numpy.zeros', 'np.zeros', (['m.size'], {}), '(m.size)\n', (1942, 1950), True, 'import numpy as np\n'), ((5010, 5016), 'SimPEG.Utils.Zero', 'Zero', ([], {}), '()\n', (5014, 5016), False, 'fro...
""" Mask R-CNN Common utility functions and classes. Copyright (c) 2017 Matterport, Inc. Licensed under the MIT License (see LICENSE_MATTERPORT for details) Written by <NAME> Copyright (c) 2021 Skinet Team Licensed under the MIT License (see LICENSE for details) Updated/Modified by <NAME> """ import json import loggi...
[ "zipfile.ZipFile", "datasetTools.datasetDivider.getBWCount", "numpy.argsort", "numpy.array", "scipy.ndimage.zoom", "numpy.arange", "numpy.divide", "os.path.exists", "numpy.multiply", "numpy.where", "numpy.delete", "numpy.max", "numpy.empty", "numpy.concatenate", "mrcnn.visualize.create_m...
[((2388, 2407), 'datasetTools.datasetDivider.getBWCount', 'dD.getBWCount', (['mask'], {}), '(mask)\n', (2401, 2407), True, 'from datasetTools import datasetDivider as dD\n'), ((3369, 3425), 'numpy.pad', 'np.pad', (['base_mask', '(1)'], {'mode': '"""constant"""', 'constant_values': '(0)'}), "(base_mask, 1, mode='constan...
# Copyright 2020 Adap GmbH. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
[ "numpy.random.choice", "numpy.array", "statistics.mean", "numpy.max" ]
[((4713, 4780), 'numpy.random.choice', 'np.random.choice', (['indices'], {'size': 'sample_size', 'replace': '(False)', 'p': 'probs'}), '(indices, size=sample_size, replace=False, p=probs)\n', (4729, 4780), True, 'import numpy as np\n'), ((4680, 4696), 'numpy.array', 'np.array', (['logits'], {}), '(logits)\n', (4688, 46...
import pickle import random import cv2 as cv import numpy as np import torch from torch.utils.data import Dataset from torchvision import transforms from config import pickle_file, num_workers from utils import align_face # Data augmentation and normalization for training # Just normalization for validation data_tra...
[ "cv2.imwrite", "random.sample", "torchvision.transforms.ToPILImage", "torchvision.transforms.ToTensor", "pickle.load", "torchvision.transforms.RandomHorizontalFlip", "torchvision.transforms.Normalize", "torch.utils.data.DataLoader", "cv2.resize", "cv2.imread", "utils.align_face", "numpy.random...
[((1861, 1895), 'random.sample', 'random.sample', (["data['samples']", '(10)'], {}), "(data['samples'], 10)\n", (1874, 1895), False, 'import random\n'), ((2399, 2517), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_dataset'], {'batch_size': '(256)', 'shuffle': '(True)', 'num_workers': 'num_worke...
#%% import matplotlib.pyplot as plt import cv2 import numpy as np import os import re from pathlib import Path #%% def find_contours(img): # img channels assumed to be RGB img_bw = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) _, thresh = cv2.threshold(img_bw, 0, 255, cv2.THRESH_BINARY_INV) contours, _ = cv2....
[ "cv2.fillPoly", "os.path.exists", "cv2.imwrite", "os.makedirs", "pathlib.Path", "cv2.threshold", "cv2.bitwise_and", "os.path.join", "os.path.splitext", "cv2.contourArea", "numpy.zeros", "cv2.cvtColor", "cv2.findContours", "cv2.imread", "cv2.boundingRect" ]
[((191, 228), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (203, 228), False, 'import cv2\n'), ((245, 297), 'cv2.threshold', 'cv2.threshold', (['img_bw', '(0)', '(255)', 'cv2.THRESH_BINARY_INV'], {}), '(img_bw, 0, 255, cv2.THRESH_BINARY_INV)\n', (258, 297), False, ...
from sklearn.preprocessing import scale import numpy as np class GradientDescent: learning_rate = 0.01 max_iter = 2000 scale = False new_theta = [] def __init__(self, learning_rate=0.01, max_iter=2000, scale=False): self.learning_rate = learning_rate self.max_ite...
[ "numpy.array", "numpy.dot", "numpy.transpose", "sklearn.preprocessing.scale" ]
[((616, 634), 'numpy.array', 'np.array', (['[zeroes]'], {}), '([zeroes])\n', (624, 634), True, 'import numpy as np\n'), ((467, 475), 'sklearn.preprocessing.scale', 'scale', (['X'], {}), '(X)\n', (472, 475), False, 'from sklearn.preprocessing import scale\n'), ((697, 713), 'numpy.dot', 'np.dot', (['theta', 'X'], {}), '(...
# -*- coding: utf-8 -*- """ @author: miko """ from sklearn.feature_extraction import DictVectorizer import csv from sklearn import tree from sklearn import preprocessing from sklearn.externals.six import StringIO import numpy as np np.set_printoptions(threshold = 1e6)#设置打印数量的阈值 # Read in the csv file and put feat...
[ "sklearn.preprocessing.LabelBinarizer", "sklearn.feature_extraction.DictVectorizer", "sklearn.tree.DecisionTreeClassifier", "csv.reader", "numpy.set_printoptions" ]
[((236, 276), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': '(1000000.0)'}), '(threshold=1000000.0)\n', (255, 276), True, 'import numpy as np\n'), ((512, 542), 'csv.reader', 'csv.reader', (['allElectronicsData'], {}), '(allElectronicsData)\n', (522, 542), False, 'import csv\n'), ((1073, 1089), 'sk...
"""Data generator for image datasets.""" import itertools import random import numpy as np from kaishi.image.util import swap_channel_dimension from kaishi.image import ops def augment_and_label(imobj): """Augment an image with common issues and return the modified image + label vector. Labels at output laye...
[ "itertools.cycle", "kaishi.image.util.swap_channel_dimension", "random.shuffle", "kaishi.image.ops.add_stretching", "numpy.random.random", "random.seed", "numpy.stack", "numpy.zeros", "kaishi.image.ops.add_rotation", "numpy.random.seed", "kaishi.image.ops.extract_patch" ]
[((684, 698), 'numpy.zeros', 'np.zeros', (['(6,)'], {}), '((6,))\n', (692, 698), True, 'import numpy as np\n'), ((966, 984), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (982, 984), True, 'import numpy as np\n'), ((1422, 1440), 'numpy.random.random', 'np.random.random', ([], {}), '()\n', (1438, 1440), T...
import os; import abc; import math; import multiprocessing; import psutil; import numpy as np; import matplotlib.pyplot as plt; from Errors import *; from KMeans import *; from UnaryLinearRegression import *; class _Node: def __init__(self, samplesCount, featureIndex = None, featureValue = None, leftChild = None...
[ "numpy.mat", "numpy.mean", "numpy.random.random", "numpy.random.choice", "numpy.log", "matplotlib.pyplot.plot", "numpy.quantile", "matplotlib.pyplot.figure", "psutil.cpu_count", "numpy.arange", "matplotlib.pyplot.show" ]
[((6468, 6506), 'numpy.quantile', 'np.quantile', (['scores', 'self.__proportion'], {}), '(scores, self.__proportion)\n', (6479, 6506), True, 'import numpy as np\n'), ((11234, 11254), 'numpy.mat', 'np.mat', (['self._curves'], {}), '(self._curves)\n', (11240, 11254), True, 'import numpy as np\n'), ((2021, 2030), 'numpy.l...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 15 15:13:29 2018 @author: kazuki.onodera """ import numpy as np import pandas as pd import os, gc from glob import glob from tqdm import tqdm import sys sys.path.append(f'/home/{os.environ.get("USER")}/PythonLibrary') import lgbextension as ex imp...
[ "numpy.clip", "pandas.read_csv", "utils.send_line", "numpy.log", "multiprocessing.cpu_count", "utils.start", "lightgbm.Dataset", "utils.submit", "utils.savefig_sub", "pandas.read_feather", "pandas.DataFrame", "glob.glob", "utils.stop_instance", "numpy.ones", "utils.savefig_imp", "gc.co...
[((392, 413), 'utils.start', 'utils.start', (['__file__'], {}), '(__file__)\n', (403, 413), False, 'import utils\n'), ((627, 650), 'numpy.random.randint', 'np.random.randint', (['(9999)'], {}), '(9999)\n', (644, 650), True, 'import numpy as np\n'), ((2473, 2485), 'gc.collect', 'gc.collect', ([], {}), '()\n', (2483, 248...
from __future__ import print_function import os import warnings import shutil import re import numpy as np import sami from astropy.io import fits class Tester(): """This class handles the testing of the SAMI pipeline. To run it requires additional data: 1) the folder ``sami_ppl_test_data``, i.e. th...
[ "os.path.exists", "re.compile", "numpy.testing.assert_allclose", "shutil.rmtree", "os.path.basename", "astropy.io.fits.open", "warnings.warn", "numpy.all", "os.walk", "sami.manager.Manager" ]
[((5894, 5937), 'sami.manager.Manager', 'sami.manager.Manager', (['output_dir'], {'fast': 'fast'}), '(output_dir, fast=fast)\n', (5914, 5937), False, 'import sami\n'), ((8989, 9006), 'numpy.all', 'np.all', (['all_equal'], {}), '(all_equal)\n', (8995, 9006), True, 'import numpy as np\n'), ((11015, 11032), 're.compile', ...
#!/usr/bin/env python3 import os, re, random import numpy as np from myClass import Theta from functions import grad_loss from hyperParameters import hyperParameters # hyperParameters T, D = hyperParameters.T, hyperParameters.D alpha, epsilon = hyperParameters.alpha, hyperParameters.epsilon moment = hyperParameters.m...
[ "functions.grad_loss", "os.listdir", "os.getcwd", "numpy.array", "numpy.zeros", "re.search" ]
[((359, 370), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (368, 370), False, 'import os, re, random\n'), ((430, 445), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (440, 445), False, 'import os, re, random\n'), ((449, 478), 're.search', 're.search', (['"""_graph.txt"""', 'file'], {}), "('_graph.txt', file)\n", ...
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import random as rdm # temporary variable, only used in testing, replace with actual graph inputs # currently, generates 100 evenly spaced numbers between 0 and pi ps1 = np.linspace(0, 1 * np.pi, 100) # create the graph plot f...
[ "numpy.sin", "numpy.linspace", "matplotlib.pyplot.pause", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((263, 293), 'numpy.linspace', 'np.linspace', (['(0)', '(1 * np.pi)', '(100)'], {}), '(0, 1 * np.pi, 100)\n', (274, 293), True, 'import numpy as np\n'), ((329, 343), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (341, 343), True, 'import matplotlib.pyplot as plt\n'), ((622, 643), 'matplotlib.pyplot.s...
import torch import numpy as np from torch import nn from torch import optim from torch.utils.data import TensorDataset, DataLoader from forPython.datasets.uci import load_mhealth from forPython.models.torch.cnn import SimpleCNN from forPython.utility.trainer import TorchSimpleTrainer np.random.seed(0) torch.random.m...
[ "torch.random.manual_seed", "forPython.utility.trainer.TorchSimpleTrainer", "forPython.models.torch.cnn.SimpleCNN", "torch.nn.CrossEntropyLoss", "torch.utils.data.TensorDataset", "torch.tensor", "numpy.random.seed", "torch.utils.data.DataLoader", "forPython.datasets.uci.load_mhealth" ]
[((288, 305), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (302, 305), True, 'import numpy as np\n'), ((306, 333), 'torch.random.manual_seed', 'torch.random.manual_seed', (['(0)'], {}), '(0)\n', (330, 333), False, 'import torch\n'), ((375, 389), 'forPython.datasets.uci.load_mhealth', 'load_mhealth', (...
###------------------------------------------------------### ### Replay and Remember Memory Class ### ###------------------------------------------------------### import numpy as np from hyperparameters import * # expand dimensions to (1, 84, 84, 5) from (84, 84, 5) # normalize 0-255 -> 0-1 to re...
[ "numpy.random.choice", "numpy.zeros" ]
[((1868, 1907), 'numpy.zeros', 'np.zeros', (['[memory_size]'], {'dtype': 'np.uint8'}), '([memory_size], dtype=np.uint8)\n', (1876, 1907), True, 'import numpy as np\n'), ((1338, 1437), 'numpy.zeros', 'np.zeros', (['[memory_size, self.state_height, self.state_width, self.state_depth]'], {'dtype': 'np.uint8'}), '([memory_...
import numpy as np import scipy.stats as stat from utils import dichotomic_search """ Implementation of last particle variant """ def ImportanceSplittingLp(gen,kernel,h,tau=0,N=100,s=0.1,decay=0.9,T = 20, accept_ratio = 0.9, alpha_est = 0.95, alpha_test=0.99,verbose=1, gain_thresh=0.01, check_every=3, p_c = 10**(-2...
[ "numpy.abs", "numpy.sqrt", "numpy.ones", "numpy.where", "numpy.delete", "numpy.log", "scipy.stats.norm.ppf", "utils.dichotomic_search", "numpy.array", "numpy.zeros", "numpy.argsort", "numpy.argmin", "numpy.arange" ]
[((2177, 2251), 'utils.dichotomic_search', 'dichotomic_search', ([], {'f': 'confidence_level_m', 'a': '(100)', 'b': 'n_max', 'thresh': 'alpha_test'}), '(f=confidence_level_m, a=100, b=n_max, thresh=alpha_test)\n', (2194, 2251), False, 'from utils import dichotomic_search\n'), ((2611, 2622), 'numpy.zeros', 'np.zeros', (...
""" this is a stripped down version of the SWHear class. It's designed to hold only a single audio sample in memory. check my githib for a more complete version: http://github.com/swharden """ import serial, os, pty import time import numpy as np from threading import Thread import random class Spo...
[ "random.uniform", "time.sleep", "numpy.append", "numpy.sin", "threading.Thread", "numpy.arange" ]
[((714, 749), 'numpy.arange', 'np.arange', (['(0)', 'time_interval', 'period'], {}), '(0, time_interval, period)\n', (723, 749), True, 'import numpy as np\n'), ((768, 801), 'numpy.sin', 'np.sin', (['(2 * np.pi * self.x * freq)'], {}), '(2 * np.pi * self.x * freq)\n', (774, 801), True, 'import numpy as np\n'), ((889, 91...
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib import animation # thermal conductivity c = 1.0 # define the discretization grid xmin = -5.0 # left/bottom bound xmax = 5.0 # right/top bound dx = 0.1 # space increment (default 0.1) nx = int((xmax-xmin)/dx) # ...
[ "matplotlib.pyplot.imshow", "matplotlib.animation.FuncAnimation", "numpy.zeros", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.ylim", "matplotlib.pyplot.show" ]
[((440, 458), 'numpy.zeros', 'np.zeros', (['(nx, nx)'], {}), '((nx, nx))\n', (448, 458), True, 'import numpy as np\n'), ((1263, 1275), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1273, 1275), True, 'import matplotlib.pyplot as plt\n'), ((1282, 1370), 'matplotlib.pyplot.imshow', 'plt.imshow', (['u0'], {...
from __future__ import print_function from __future__ import absolute_import from __future__ import division import better.marketdata.globaldatamatrix as gdm import numpy as np import pandas as pd import logging from better.tools.configprocess import parse_time from better.tools.data import get_volume_forward, get_type...
[ "better.tools.data.get_volume_forward", "better.tools.data.get_type_list", "numpy.arange", "numpy.array", "numpy.split", "better.marketdata.replaybuffer.ReplayBuffer", "pandas.DataFrame", "better.marketdata.globaldatamatrix.HistoryManager", "logging.info", "better.tools.configprocess.parse_time" ]
[((1773, 1802), 'better.tools.data.get_type_list', 'get_type_list', (['feature_number'], {}), '(feature_number)\n', (1786, 1802), False, 'from better.tools.data import get_volume_forward, get_type_list\n'), ((1909, 1979), 'better.tools.data.get_volume_forward', 'get_volume_forward', (['(self.__end - start)', 'test_port...
# How to Do Linear Regression using Gradient Descent - Live session from 3/29/17 # https://www.youtube.com/watch?v=XdM6ER7zTLk # https://github.com/llSourcell/linear_regression_live # My modification, that uses Numpy to the full extent, which can be faster. import numpy as np def computeErrorForGivenPoints(m...
[ "numpy.genfromtxt", "numpy.square" ]
[((391, 417), 'numpy.square', 'np.square', (['(y - (m * x + b))'], {}), '(y - (m * x + b))\n', (400, 417), True, 'import numpy as np\n'), ((1139, 1179), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data.csv"""'], {'delimiter': '""","""'}), "('data.csv', delimiter=',')\n", (1152, 1179), True, 'import numpy as np\n')]
import numpy as np from pyNN.random import NumpyRNG from sklearn.linear_model import LinearRegression import math def gaussian_convolution(spikes,dt): #---- takes a spiketrain and the simulation time constant # and computes the smoothed spike rate #-----works only after the simulation has run; not onli...
[ "numpy.identity", "numpy.mean", "pyNN.random.NumpyRNG", "numpy.convolve", "math.ceil", "math.floor", "numpy.size", "numpy.sum", "sklearn.linear_model.LinearRegression" ]
[((558, 577), 'numpy.mean', 'np.mean', (['gauss_rate'], {}), '(gauss_rate)\n', (565, 577), True, 'import numpy as np\n'), ((1862, 1880), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (1878, 1880), False, 'from sklearn.linear_model import LinearRegression\n'), ((1975, 1993), 'sklearn.lin...
import numpy as np from PIL import Image from scipy.ndimage import gaussian_filter, sobel from scipy.ndimage.filters import laplace def calc_gradients_test(test_dir): for i in range(24): calc_gradients(test_dir + '/test{}'.format(i)) def calc_gradients(dir): g_noisy_dir = dir + '/g_noisy.png' p_no...
[ "PIL.Image.fromarray", "PIL.Image.open", "numpy.asarray", "scipy.ndimage.gaussian_filter" ]
[((365, 388), 'PIL.Image.open', 'Image.open', (['g_noisy_dir'], {}), '(g_noisy_dir)\n', (375, 388), False, 'from PIL import Image\n'), ((403, 422), 'numpy.asarray', 'np.asarray', (['g_noisy'], {}), '(g_noisy)\n', (413, 422), True, 'import numpy as np\n'), ((437, 460), 'PIL.Image.open', 'Image.open', (['p_noisy_dir'], {...
''' Created on Dec 5, 2016 @author: wjadams ''' import numpy as np class AhpNode(object): def __init__(self, parent_tree, name, nalts, pw=None): self.children = [] self.name = name self.alt_scores = np.zeros([nalts]) self.nalts = nalts self.parent_tree = parent_tree ...
[ "numpy.append", "numpy.array", "numpy.zeros", "numpy.max" ]
[((234, 251), 'numpy.zeros', 'np.zeros', (['[nalts]'], {}), '([nalts])\n', (242, 251), True, 'import numpy as np\n'), ((702, 731), 'numpy.append', 'np.append', (['self.alt_scores', '(0)'], {}), '(self.alt_scores, 0)\n', (711, 731), True, 'import numpy as np\n'), ((1010, 1030), 'numpy.array', 'np.array', (['new_scores']...
#!/usr/bin/env python """ Bevington & Robinson's model of dual exponential decay References:: [5] Bevington & Robinson (1992). Data Reduction and Error Analysis for the Physical Sciences, Second Edition, McGraw-Hill, Inc., New York. """ from numpy import exp, sqrt, vstack, array, asarray def dual_expone...
[ "numpy.exp", "numpy.array", "numpy.sqrt", "numpy.asarray" ]
[((557, 1255), 'numpy.array', 'array', (['[[15, 775], [30, 479], [45, 380], [60, 302], [75, 185], [90, 157], [105, \n 137], [120, 119], [135, 110], [150, 89], [165, 74], [180, 61], [195, 66\n ], [210, 68], [225, 48], [240, 54], [255, 51], [270, 46], [285, 55], [\n 300, 29], [315, 28], [330, 37], [345, 49], [36...
import cv2 import numpy as np import face_recognition import os from datetime import datetime path = 'ImageAttendance' images = [] classNames = [] myList = os.listdir(path) print(myList) for cl in myList: curImg = cv2.imread(f'{path}/{cl}') images.append(curImg) classNames.append(os.path.splitext(cl)[0]) ...
[ "cv2.rectangle", "face_recognition.face_locations", "os.listdir", "os.path.splitext", "cv2.imshow", "cv2.putText", "datetime.datetime.now", "face_recognition.face_distance", "cv2.waitKey", "cv2.VideoCapture", "cv2.cvtColor", "face_recognition.face_encodings", "face_recognition.compare_faces"...
[((157, 173), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (167, 173), False, 'import os\n'), ((1066, 1085), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (1082, 1085), False, 'import cv2\n'), ((220, 246), 'cv2.imread', 'cv2.imread', (['f"""{path}/{cl}"""'], {}), "(f'{path}/{cl}')\n", (230,...
import matplotlib.pyplot as plt import numpy as np import os from federatedscope.core.message import Message import logging logger = logging.getLogger(__name__) def plot_target_loss(loss_list, outdir): ''' Args: loss_list: the list of loss regrading the target data outdir: the directory to s...
[ "logging.getLogger", "matplotlib.pyplot.plot", "os.path.join", "matplotlib.pyplot.close", "numpy.vstack" ]
[((134, 161), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (151, 161), False, 'import logging\n'), ((367, 387), 'numpy.vstack', 'np.vstack', (['loss_list'], {}), '(loss_list)\n', (376, 387), True, 'import numpy as np\n'), ((432, 458), 'matplotlib.pyplot.plot', 'plt.plot', (['target_data...
import numpy as np import os, sys, re import mpi4py import time from mpi4py import MPI # Paths MACHINE_NAME = 'tmp' TUNER_NAME = 'tmp' ROOTDIR = os.path.abspath(os.path.join(os.path.realpath(__file__), os.pardir, os.pardir)) EXPDIR = os.path.abspath(os.path.join(ROOTDIR, "hypre-driver/exp", MACHINE_NAME + '/' + TUNER_...
[ "numpy.mean", "os.makedirs", "os.path.join", "time.sleep", "mpi4py.MPI.Info.Create", "os.path.realpath", "numpy.array", "mpi4py.MPI.COMM_SELF.Spawn", "os.getpid", "os.system", "re.findall" ]
[((251, 325), 'os.path.join', 'os.path.join', (['ROOTDIR', '"""hypre-driver/exp"""', "(MACHINE_NAME + '/' + TUNER_NAME)"], {}), "(ROOTDIR, 'hypre-driver/exp', MACHINE_NAME + '/' + TUNER_NAME)\n", (263, 325), False, 'import os, sys, re\n'), ((353, 395), 'os.path.join', 'os.path.join', (['ROOTDIR', '"""hypre/src/test/ij"...
import math import numpy as np import random import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.fc1 = nn.Linear(2, 96) self.fc2 = nn.Lin...
[ "random.choice", "numpy.random.rand", "torch.nn.CrossEntropyLoss", "numpy.nanmax", "torch.nn.Linear" ]
[((278, 294), 'torch.nn.Linear', 'nn.Linear', (['(2)', '(96)'], {}), '(2, 96)\n', (287, 294), True, 'import torch.nn as nn\n'), ((314, 331), 'torch.nn.Linear', 'nn.Linear', (['(96)', '(96)'], {}), '(96, 96)\n', (323, 331), True, 'import torch.nn as nn\n'), ((351, 368), 'torch.nn.Linear', 'nn.Linear', (['(96)', '(96)'],...
import numpy as np import cv2 as cv from abc import ABC class ins_pos_kalman_filter(ABC): def __init__(self, F, Q, H, R, initial_state_mean, initial_state_covariance): """ abstract initialization of kalman filter for INS data fusion for position estimation Matrix notation matches that prov...
[ "numpy.block", "numpy.eye", "numpy.hstack", "numpy.array", "numpy.zeros", "cv2.KalmanFilter" ]
[((1212, 1251), 'cv2.KalmanFilter', 'cv.KalmanFilter', (['F.shape[1]', 'Q.shape[1]'], {}), '(F.shape[1], Q.shape[1])\n', (1227, 1251), True, 'import cv2 as cv\n'), ((2369, 2378), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (2375, 2378), True, 'import numpy as np\n'), ((2392, 2408), 'numpy.zeros', 'np.zeros', (['(3, ...
import code.book_plots as bp import code.gh_internal as gh import matplotlib.pyplot as plt import matplotlib.pyplot as plt import numpy as np; from filterpy.discrete_bayes import normalize def scaled_update (hall, belief, z, prob): scale_ = prob/(1-prob) belief[hall==1] *=scale_ normalize(belief) ...
[ "filterpy.discrete_bayes.normalize", "numpy.array", "matplotlib.pyplot.figure", "code.book_plots.bar_plot" ]
[((332, 352), 'numpy.array', 'np.array', (['([0.1] * 10)'], {}), '([0.1] * 10)\n', (340, 352), True, 'import numpy as np\n'), ((361, 401), 'numpy.array', 'np.array', (['[1, 1, 0, 0, 0, 0, 0, 0, 1, 0]'], {}), '([1, 1, 0, 0, 0, 0, 0, 0, 1, 0])\n', (369, 401), True, 'import numpy as np\n'), ((545, 557), 'matplotlib.pyplot...
# mfield / mfield.py import numpy as np try: import matlab import matlab.engine except ImportError: pass import time import io import os class MField(object): ''' Implementation of FIELD II using the MATLAB engine for python. ''' def __init__(self, path=None): # set default pat...
[ "matlab.engine.start_matlab", "time.sleep", "os.path.normpath", "numpy.array", "os.path.abspath", "io.StringIO" ]
[((7976, 7998), 'numpy.array', 'np.array', (['[0, 0, 0.03]'], {}), '([0, 0, 0.03])\n', (7984, 7998), True, 'import numpy as np\n'), ((8062, 8075), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (8070, 8075), True, 'import numpy as np\n'), ((8172, 8194), 'numpy.array', 'np.array', (['[0, 0, 0.03]'], {}), '([0, 0, ...
import librosa from numba import jit import numpy as np @jit(nopython=True, cache=True) def __C_to_DE(C: np.ndarray = None, dn: np.ndarray = np.array([1, 1, 0], np.int64), dm: np.ndarray = np.array([1, 0, 1], np.int64), dw: np.ndarray = np.array([1.0, 1.0, 1.0], np.float64), ...
[ "numpy.ones", "numpy.max", "numpy.array", "numpy.zeros", "numba.jit" ]
[((59, 89), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (62, 89), False, 'from numba import jit\n'), ((2478, 2508), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (2481, 2508), False, 'from numba import jit\...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright INRIA # Contributors: <NAME> (<EMAIL>) # <NAME> (<EMAIL>) # # This software is governed by the CeCILL license under French law and abiding # by the rules of distribution of free software. Yo...
[ "numpy.linspace", "numpy.ones" ]
[((2374, 2411), 'numpy.linspace', 'np.linspace', (['(-np.pi / 2)', '(np.pi / 2)', 'n'], {}), '(-np.pi / 2, np.pi / 2, n)\n', (2385, 2411), True, 'import numpy as np\n'), ((2961, 2981), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'n'], {}), '(0, 1, n)\n', (2972, 2981), True, 'import numpy as np\n'), ((4499, 4536), ...
"""Unit tests for radar_statistics.py.""" import unittest import numpy from gewittergefahr.gg_utils import radar_statistics as radar_stats TOLERANCE = 1e-6 FAKE_STATISTIC_NAME = 'foo' FAKE_PERCENTILE_LEVEL = -9999. # The following constants are used to test # radar_field_and_statistic_to_column_name, # radar_field_a...
[ "gewittergefahr.gg_utils.radar_statistics._check_statistic_params", "gewittergefahr.gg_utils.radar_statistics.get_spatial_statistics", "numpy.allclose", "gewittergefahr.gg_utils.radar_statistics.radar_field_and_percentile_to_column_name", "numpy.array", "gewittergefahr.gg_utils.radar_statistics.radar_fiel...
[((815, 947), 'numpy.array', 'numpy.array', (['[[-1, -1, 10, 20, 30, 40], [-1, 5, 15, 25, 35, 50], [5, 10, 25, 40, 55, 70],\n [10, 30, 50, 70, 75, -1]]'], {'dtype': 'float'}), '([[-1, -1, 10, 20, 30, 40], [-1, 5, 15, 25, 35, 50], [5, 10, 25,\n 40, 55, 70], [10, 30, 50, 70, 75, -1]], dtype=float)\n', (826, 947), F...
from sklearn.decomposition import NMF from nltk.tokenize import sent_tokenize import numpy as np class NonNegativeFactorization(): def __init__(self, A, r, feature_names, num_top_words, num_top_documents, corpus): self.A = A self.r = r self.features_names = feature_names self.corpu...
[ "numpy.argsort", "sklearn.decomposition.NMF" ]
[((475, 582), 'sklearn.decomposition.NMF', 'NMF', ([], {'n_components': 'self.r', 'init': '"""nndsvdar"""', 'solver': '"""mu"""', 'beta_loss': '"""frobenius"""', 'tol': '(0.1)', 'random_state': '(1)'}), "(n_components=self.r, init='nndsvdar', solver='mu', beta_loss=\n 'frobenius', tol=0.1, random_state=1)\n", (478, ...
from ..utils import entropy_gaussian from ..core import cmutinf, centropy, ncmutinf from ..metrics import (AlphaAngleTransferEntropy, ContactTransferEntropy, DihedralTransferEntropy) from msmbuilder.example_datasets import FsPeptide import numpy as np from numpy.testing import assert_almost_eq...
[ "numpy.atleast_2d", "msmbuilder.example_datasets.FsPeptide", "numpy.array", "numpy.dot", "numpy.testing.assert_almost_equal", "numpy.random.RandomState" ]
[((362, 387), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (383, 387), True, 'import numpy as np\n'), ((409, 462), 'numpy.array', 'np.array', (['[[1, 0.5, 0.25], [0.5, 1, 0], [0.25, 0, 1]]'], {}), '([[1, 0.5, 0.25], [0.5, 1, 0], [0.25, 0, 1]])\n', (417, 462), True, 'import numpy as np\...
import tensorflow as tf import numpy as np import os from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Activation from sklearn.utils import shuffle import matplotlib.pyplot as plt from dl_utils.tf.plot_weights import plot_weights # CUDA GPU os.environ['CUDA_DEVICE_ORDER']='PCI_B...
[ "tensorflow.keras.utils.to_categorical", "tensorflow.reduce_sum", "tensorflow.placeholder", "tensorflow.Session", "sklearn.utils.shuffle", "tensorflow.nn.softmax_cross_entropy_with_logits_v2", "numpy.max", "tensorflow.train.GradientDescentOptimizer", "tensorflow.examples.tutorials.mnist.input_data.r...
[((750, 807), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data/"""'], {'one_hot': 'one_hot'}), "('MNIST_data/', one_hot=one_hot)\n", (775, 807), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((1606, 1618), 'tensorflow.keras.models.S...
#!/usr/local/bin/python import pybullet import time import pybullet_data import math, random import sys import numpy import OpenGL import pygame from pygame.locals import * from OpenGL.GL import * from OpenGL.GLU import * import ctypes from OpenGL.GL import shaders import render.cubeRender as cubeRender import rende...
[ "pygame.init", "pygame.quit", "math.floor", "pybullet.setGravity", "math.cos", "numpy.array", "gui.inventory.inv_contains", "pybullet.createCollisionShape", "gui.inventory.add_to_inv", "render.renderLoop.gui_render", "gui.inventory.remove_from_inv", "pygame.mouse.set_pos", "pygame.display.se...
[((889, 919), 'numpy.array', 'numpy.array', (['[]', 'numpy.float32'], {}), '([], numpy.float32)\n', (900, 919), False, 'import numpy\n'), ((932, 962), 'numpy.array', 'numpy.array', (['[]', 'numpy.float32'], {}), '([], numpy.float32)\n', (943, 962), False, 'import numpy\n'), ((1135, 1165), 'numpy.array', 'numpy.array', ...
import numpy as np import tensorflow as tf from gym import utils from gym.envs.mujoco import mujoco_env from meta_mb.meta_envs.base import MetaEnv class InvertedPendulumEnv(mujoco_env.MujocoEnv, utils.EzPickle, MetaEnv): def __init__(self): utils.EzPickle.__init__(self) mujoco_env.MujocoEnv.__in...
[ "numpy.concatenate", "gym.utils.EzPickle.__init__", "gym.envs.mujoco.mujoco_env.MujocoEnv.__init__", "tensorflow.square" ]
[((257, 286), 'gym.utils.EzPickle.__init__', 'utils.EzPickle.__init__', (['self'], {}), '(self)\n', (280, 286), False, 'from gym import utils\n'), ((295, 358), 'gym.envs.mujoco.mujoco_env.MujocoEnv.__init__', 'mujoco_env.MujocoEnv.__init__', (['self', '"""inverted_pendulum.xml"""', '(2)'], {}), "(self, 'inverted_pendul...
#!/usr/bin/env python # coding: utf-8 """ Script to train a resnet to determine if a Stokes-I radio cutout contains a giant radio galaxy candidate. Copyright (c) 2022 <NAME> See LICENSE.md in root directory for full BSD-3 license. Adapted from Author: <NAME> License: BSD Source: https://pytorch.org/tutorials/beginner...
[ "numpy.clip", "numpy.sqrt", "torch.nn.CrossEntropyLoss", "torch.max", "torchvision.models.resnet18", "torch.cuda.is_available", "torch.sum", "datetime.datetime.today", "torchvision.utils.make_grid", "matplotlib.pyplot.imshow", "torch.set_grad_enabled", "torchvision.transforms.ToTensor", "soc...
[((979, 990), 'time.time', 'time.time', ([], {}), '()\n', (988, 990), False, 'import time\n'), ((1070, 1090), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1088, 1090), False, 'import socket\n'), ((1525, 1562), 'os.path.join', 'os.path.join', (['base_path', 'dataset_name'], {}), '(base_path, dataset_na...
import matplotlib.pyplot as plt import numpy as np from sklearn.metrics import mean_squared_error from sklearn.metrics import r2_score, roc_auc_score from sklearn.preprocessing import RobustScaler from sklearn.linear_model import LogisticRegression from sklearn.linear_model import LinearRegression from sklearn.model_se...
[ "src.plotutils.set_mpl_default_settings", "matplotlib.pyplot.grid", "pandas.read_csv", "math.floor", "matplotlib.pyplot.ylabel", "src.model.lupts.LogisticStatLUPTS", "numpy.array", "numpy.mean", "matplotlib.pyplot.xlabel", "src.model.baseline.LogisticBaseline", "numpy.random.seed", "sklearn.mo...
[((2145, 2166), 'pandas.read_csv', 'pd.read_csv', (['set_path'], {}), '(set_path)\n', (2156, 2166), True, 'import pandas as pd\n'), ((2870, 2913), 'pandas.get_dummies', 'pd.get_dummies', (['D'], {'columns': 'cols_categorical'}), '(D, columns=cols_categorical)\n', (2884, 2913), True, 'import pandas as pd\n'), ((5554, 55...
import numpy as np import itertools import math class SubwayFinder: def find_subways(self, grouped_classifications): if not all(letter in grouped_classifications for letter in ("S","U","B","W","A","Y")): print("Can not find all parts of logo") return [] sorted_classificatio...
[ "numpy.mean", "itertools.product", "numpy.vectorize", "numpy.polyfit" ]
[((1286, 1305), 'numpy.polyfit', 'np.polyfit', (['x', 'y', '(1)'], {}), '(x, y, 1)\n', (1296, 1305), True, 'import numpy as np\n'), ((1327, 1360), 'numpy.vectorize', 'np.vectorize', (['(lambda x: a * x + b)'], {}), '(lambda x: a * x + b)\n', (1339, 1360), True, 'import numpy as np\n'), ((465, 507), 'itertools.product',...
import numpy as np import pandas as pd from autodcf.models._base import AbstractDCF from datetime import datetime class DCF(AbstractDCF): """Class for flexible DCF. Note that all _to_sales args take either an iterable or float. If given a float, the DCF will use this constant across all time periods (ex...
[ "numpy.repeat", "numpy.arange", "numpy.diff", "datetime.datetime.now", "numpy.concatenate", "numpy.cumprod" ]
[((8472, 8504), 'numpy.diff', 'np.diff', (["self._forecast['Sales']"], {}), "(self._forecast['Sales'])\n", (8479, 8504), True, 'import numpy as np\n'), ((8632, 8675), 'numpy.concatenate', 'np.concatenate', (['([0.0], future_changes_nwc)'], {}), '(([0.0], future_changes_nwc))\n', (8646, 8675), True, 'import numpy as np\...
import numpy as np import heapq from typing import Union class Graph: def __init__(self, adjacency_mat: Union[np.ndarray, str]): """ Unlike project 2, this Graph class takes an adjacency matrix as input. `adjacency_mat` can either be a 2D numpy array of floats or the path to a CSV file containing ...
[ "heapq.heappush", "numpy.loadtxt", "heapq.heapify", "heapq.heappop" ]
[((2752, 2772), 'heapq.heapify', 'heapq.heapify', (['queue'], {}), '(queue)\n', (2765, 2772), False, 'import heapq\n'), ((925, 953), 'numpy.loadtxt', 'np.loadtxt', (['f'], {'delimiter': '""","""'}), "(f, delimiter=',')\n", (935, 953), True, 'import numpy as np\n'), ((3040, 3060), 'heapq.heappop', 'heapq.heappop', (['qu...
# # Copyright 2021 <NAME> # # MIT License # # 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, publish...
[ "numpy.ones_like", "numpy.roll", "numpy.amin", "numpy.arange", "numpy.where", "numpy.asarray", "scipy.special.erfinv", "numpy.fft.rfftn", "numpy.sum", "numpy.array", "json.dump" ]
[((1429, 1463), 'numpy.arange', 'np.arange', (['(0)', 'nx'], {'dtype': 'np.float64'}), '(0, nx, dtype=np.float64)\n', (1438, 1463), True, 'import numpy as np\n'), ((1472, 1520), 'numpy.where', 'np.where', (['(qx <= nx // 2)', '(qx / Lx)', '((nx - qx) / Lx)'], {}), '(qx <= nx // 2, qx / Lx, (nx - qx) / Lx)\n', (1480, 15...
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import Tuple import numpy as np import pytest from aicsimageio import exceptions from aicsimageio.readers.default_reader import DefaultReader from ..conftest import get_resource_full_path, host from ..image_container_test_utils import run_image_file_checks ...
[ "numpy.dtype", "pytest.mark.raises", "pytest.raises", "aicsimageio.readers.default_reader.DefaultReader" ]
[((2099, 2121), 'pytest.raises', 'pytest.raises', (['IOError'], {}), '(IOError)\n', (2112, 2121), False, 'import pytest\n'), ((2156, 2227), 'aicsimageio.readers.default_reader.DefaultReader', 'DefaultReader', (['"""https://archive.org/embed/archive-video-files/test.mp4"""'], {}), "('https://archive.org/embed/archive-vi...
import collections import numpy as np class Vectorizer(object): def __init__(self): self.mapping = {} self.inverse_mapping = {} self.embedding_size = 0 def vectorize_string(self, s): vec = np.empty(len(s)) for i in range(0,len(s)): char = s[i] if...
[ "numpy.array" ]
[((1519, 1536), 'numpy.array', 'np.array', (['vectors'], {}), '(vectors)\n', (1527, 1536), True, 'import numpy as np\n')]
import threading import numpy as np import time import rospy from sensor_msgs import point_cloud2 from std_msgs.msg import Header from sensor_msgs.msg import PointCloud2, PointField from stella_nav_core.geometry_utils import GeometryUtils from stella_nav_core.config import CostConfig, MotionConfig class State(object)...
[ "numpy.array", "stella_nav_core.geometry_utils.GeometryUtils.get_yaw", "numpy.linalg.norm", "numpy.sin", "stella_nav_core.config.MotionConfig", "numpy.cross", "threading.RLock", "stella_nav_core.config.CostConfig", "numpy.linspace", "sensor_msgs.point_cloud2.create_cloud", "numpy.vstack", "num...
[((1289, 1310), 'stella_nav_core.config.CostConfig', 'CostConfig', (['(0.01)', '(1.0)'], {}), '(0.01, 1.0)\n', (1299, 1310), False, 'from stella_nav_core.config import CostConfig, MotionConfig\n'), ((1330, 1351), 'stella_nav_core.config.CostConfig', 'CostConfig', (['(0.01)', '(1.0)'], {}), '(0.01, 1.0)\n', (1340, 1351)...
"""Easily convert RGB video data (e.g. .avi) to the TensorFlow tfrecords file format with the provided 3 color channels. Allows to subsequently train a neural network in TensorFlow with the generated tfrecords. Due to common hardware/GPU RAM limitations, this implementation allows to limit the number of frames per v...
[ "cv2.normalize", "math.floor", "tensorflow.train.Int64List", "numpy.array", "numpy.asarray", "tensorflow.python_io.TFRecordWriter", "cv2.calcOpticalFlowFarneback", "cv2.waitKey", "tensorflow.python.platform.app.run", "tensorflow.python.platform.flags.DEFINE_integer", "tensorflow.train.BytesList"...
[((1141, 1241), 'tensorflow.python.platform.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""num_videos"""', '(1000)', '"""Number of videos stored in one single tfrecords file"""'], {}), "('num_videos', 1000,\n 'Number of videos stored in one single tfrecords file')\n", (1161, 1241), False, 'from tensorflow.pyth...
import numpy as np import SimpleITK as sitk def reference_image_build(spacing, size, direction, template_size, dim): #template size: image(array) dimension to resize to: a list of three elements reference_spacing = np.array(size)/np.array(template_size)*np.array(spacing) reference_spacing[0] = 1.2 reference_...
[ "numpy.random.rand", "SimpleITK.AffineTransform", "numpy.array", "numpy.sin", "numpy.reshape", "numpy.fft.fft2", "numpy.matmul", "numpy.min", "SimpleITK.Resample", "numpy.eye", "SimpleITK.TranslationTransform", "numpy.ceil", "SimpleITK.Image", "numpy.squeeze", "numpy.cos", "SimpleITK.C...
[((357, 385), 'SimpleITK.Image', 'sitk.Image', (['template_size', '(0)'], {}), '(template_size, 0)\n', (367, 385), True, 'import SimpleITK as sitk\n'), ((628, 659), 'SimpleITK.AffineTransform', 'sitk.AffineTransform', (['dimension'], {}), '(dimension)\n', (648, 659), True, 'import SimpleITK as sitk\n'), ((873, 909), 'S...
import re import math import numpy as np class UpstreamAUG: def __init__(self, allow_ORF=True, verbose_output=False): """ Constructor :param allow_ORF: bool, True by default, whether to check uORFs :param verbose_output: bool, False by default, whether to return dictionaries in pr...
[ "numpy.array", "math.ceil", "re.finditer" ]
[((2560, 2579), 'numpy.array', 'np.array', (['ATG_frame'], {}), '(ATG_frame)\n', (2568, 2579), True, 'import numpy as np\n'), ((4952, 4971), 'numpy.array', 'np.array', (['ATG_frame'], {}), '(ATG_frame)\n', (4960, 4971), True, 'import numpy as np\n'), ((2235, 2254), 'numpy.array', 'np.array', (['ATG_frame'], {}), '(ATG_...
""" The script expects the MViT (MDef-DETR or MDETR) detections in .txt format. For example, there should be, One .txt file for each image and each line in the file represents a detection. The format of a single detection should be "<label> <confidence> <x1> <y1> <x2> <y2> Please see the 'mvit_detections' for referenc...
[ "os.path.exists", "os.listdir", "xml.etree.ElementTree.parse", "numpy.minimum", "argparse.ArgumentParser", "os.makedirs", "fvcore.common.file_io.PathManager.open", "numpy.max", "numpy.array", "xml.etree.ElementTree.Element", "xml.etree.ElementTree.ElementTree", "os.path.dirname", "os.path.ba...
[((2699, 2724), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2722, 2724), False, 'import argparse\n'), ((4540, 4560), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (4554, 4560), False, 'import os\n'), ((6880, 6900), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path...
# <NAME> # initial version of the webcam detector, can be used to test HSV settings, radius, etc import cv2 #import time import numpy as np #from infer_imagenet import * FRAME_WIDTH = 640 FRAME_HEIGHT = 480 # load in the video cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FRAME_WIDTH,FRAME_WIDTH) cap.se...
[ "numpy.copy", "cv2.drawContours", "cv2.dilate", "cv2.inRange", "cv2.erode", "cv2.minEnclosingCircle", "cv2.imshow", "numpy.sum", "numpy.zeros", "cv2.circle", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.cvtColor", "cv2.moments", "cv2.findContours", "cv2.resize", "cv2.GaussianBlu...
[((246, 265), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (262, 265), False, 'import cv2\n'), ((4141, 4164), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (4162, 4164), False, 'import cv2\n'), ((938, 967), 'cv2.resize', 'cv2.resize', (['frame', '(640, 480)'], {}), '(frame, (640...
import os import imutils import pickle import time import cv2 import threading import numpy as np from PIL import ImageFont, ImageDraw, Image import json import datetime import requests from faced import FaceDetector from faced.utils import annotate_image from config_reader import read_config ZM_URL = 'http://18.179...
[ "cv2.dnn.blobFromImage", "requests.post", "cv2.dnn.readNetFromTorch", "config_reader.read_config", "numpy.argmax", "time.sleep", "os.path.isfile", "imutils.resize", "faced.FaceDetector", "datetime.datetime.now", "cv2.VideoCapture", "cv2.cvtColor", "threading.Thread", "cv2.imread" ]
[((521, 549), 'requests.post', 'requests.post', ([], {'url': 'LOGIN_URL'}), '(url=LOGIN_URL)\n', (534, 549), False, 'import requests\n'), ((768, 793), 'cv2.VideoCapture', 'cv2.VideoCapture', (['new_url'], {}), '(new_url)\n', (784, 793), False, 'import cv2\n'), ((942, 970), 'cv2.VideoCapture', 'cv2.VideoCapture', (['str...
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2017-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
[ "pyFAI.gui.model.PeakModel.PeakModel", "pyFAI.control_points.ControlPoints", "numpy.array", "numpy.empty", "pyFAI.gui.CalibrationContext.CalibrationContext.instance" ]
[((2173, 2230), 'pyFAI.control_points.ControlPoints', 'ControlPoints', ([], {'calibrant': 'calibrant', 'wavelength': 'wavelength'}), '(calibrant=calibrant, wavelength=wavelength)\n', (2186, 2230), False, 'from pyFAI.control_points import ControlPoints\n'), ((2904, 2946), 'numpy.empty', 'numpy.empty', ([], {'shape': '(c...
# %% [markdown] # ## Imports # %% import numpy as np import scipy import skimage import cv2 # %% class CornerDetector: """Corner detector for an image. Args: img (array-like): matrix representation of input image. May be a grayscale or RGB image. Attributes: img (numpy.ndarray...
[ "matplotlib.pyplot.imshow", "numpy.copy", "scipy.signal.convolve2d", "os.listdir", "numpy.minimum", "cv2.fastNlMeansDenoising", "cv2.fastNlMeansDenoisingColored", "skimage.filters.threshold_otsu", "skimage.filters.sobel", "os.path.join", "numpy.array", "matplotlib.pyplot.figure", "numpy.dot"...
[((9931, 9955), 'imageio.imread', 'imageio.imread', (['file_img'], {}), '(file_img)\n', (9945, 9955), False, 'import imageio\n'), ((9960, 9988), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n', (9970, 9988), True, 'import matplotlib.pyplot as plt\n'), ((9993, 10009), 'mat...
__copyright__ = '2017 <NAME>. All Rights Reserved.' __author__ = '<NAME>' """ Mic file geometry and processing. """ import numpy as np from xdm_toolkit import xdm_assert as xassert def generate_vertices(mic_snp, sidewidth): T_GEN_IDX = 4 # Triangle generation index. T_DIR_IDX = 3 # Triangle direction inde...
[ "numpy.copy", "numpy.sqrt", "numpy.hstack", "numpy.squeeze", "numpy.vstack" ]
[((807, 838), 'numpy.squeeze', 'np.squeeze', (['mic_snp[up_idx, 2:]'], {}), '(mic_snp[up_idx, 2:])\n', (817, 838), True, 'import numpy as np\n'), ((855, 888), 'numpy.squeeze', 'np.squeeze', (['mic_snp[down_idx, 2:]'], {}), '(mic_snp[down_idx, 2:])\n', (865, 888), True, 'import numpy as np\n'), ((1403, 1421), 'numpy.cop...
#! /usr/bin/env python """Make history files into timeseries""" import os import sys from subprocess import check_call, Popen, PIPE from glob import glob import re import click import yaml import tempfile import logging import cftime import xarray as xr import numpy as np import globus from workflow import task_man...
[ "logging.getLogger", "numpy.mean", "click.argument", "logging.StreamHandler", "os.path.exists", "os.makedirs", "click.option", "os.path.join", "globus.listdir", "xarray.open_dataset", "os.path.realpath", "workflow.task_manager.wait", "yaml.safe_load", "workflow.task_manager.submit", "glo...
[((341, 368), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (358, 368), False, 'import logging\n'), ((415, 448), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (436, 448), False, 'import logging\n'), ((3246, 3261), 'click.command', 'click.comman...
#!/usr/bin/python # -*- coding: utf-8 -*- import unittest import numpy import quantities quantities.set_default_units('si') quantities.UnitQuantity('kilocalorie', 1000.0*quantities.cal, symbol='kcal') quantities.UnitQuantity('kilojoule', 1000.0*quantities.J, symbol='kJ') from rmgpy.chem.molecule import Molecule from...
[ "pylab.ylabel", "quantities.set_default_units", "pylab.subplot", "unittest.TextTestRunner", "pylab.xlabel", "pylab.legend", "rmgpy.chem.kinetics.Arrhenius", "pylab.figure", "numpy.array", "rmgpy.chem.thermo.ThermoData", "rmgpy.chem.molecule.Molecule", "pylab.semilogx", "rmgpy.solver.simple.S...
[((91, 125), 'quantities.set_default_units', 'quantities.set_default_units', (['"""si"""'], {}), "('si')\n", (119, 125), False, 'import quantities\n'), ((126, 204), 'quantities.UnitQuantity', 'quantities.UnitQuantity', (['"""kilocalorie"""', '(1000.0 * quantities.cal)'], {'symbol': '"""kcal"""'}), "('kilocalorie', 1000...
from typing import List, Tuple, Optional import numpy as np def rmse(x: List[float], y: List[float]) -> float: r = 0 for (a, b) in zip(x, y): r += (a - b) ** 2 return r def lin_reg(data: List[Tuple[float, float]]) -> Tuple[float, float]: d = np.array(data) m = d.shape[0] p = np.sum(d...
[ "numpy.array", "numpy.sum" ]
[((270, 284), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (278, 284), True, 'import numpy as np\n'), ((312, 327), 'numpy.sum', 'np.sum', (['d[:, 0]'], {}), '(d[:, 0])\n', (318, 327), True, 'import numpy as np\n'), ((336, 351), 'numpy.sum', 'np.sum', (['d[:, 1]'], {}), '(d[:, 1])\n', (342, 351), True, 'import...
import csv import gzip import json import re import sys from ast import literal_eval from collections import Counter from math import exp import numpy as np from nltk.stem.porter import PorterStemmer from nltk.tokenize import word_tokenize OPINION_EXP = re.compile(r"(.*)<o>(.*?)</o>(.*)") ASPECT_EXP = re.compile(r"(....
[ "re.compile", "gzip.open", "collections.Counter", "numpy.array", "nltk.stem.porter.PorterStemmer", "ast.literal_eval", "numpy.zeros", "numpy.count_nonzero", "sys.exc_info", "json.load", "re.sub", "numpy.shape", "json.dump", "math.exp" ]
[((256, 290), 're.compile', 're.compile', (['"""(.*)<o>(.*?)</o>(.*)"""'], {}), "('(.*)<o>(.*?)</o>(.*)')\n", (266, 290), False, 'import re\n'), ((305, 339), 're.compile', 're.compile', (['"""(.*)<f>(.*?)</f>(.*)"""'], {}), "('(.*)<f>(.*?)</f>(.*)')\n", (315, 339), False, 'import re\n'), ((354, 384), 're.compile', 're....
# Copyright (c) 2012-2020 Jicamarca Radio Observatory # All rights reserved. # # Distributed under the terms of the BSD 3-clause license. """Base class to create plot operations """ import os import sys import zmq import time import numpy import datetime from collections import deque from functools import wraps from ...
[ "numpy.sqrt", "time.sleep", "zmq.Poller", "numpy.isfinite", "numpy.sin", "datetime.timedelta", "numpy.arange", "datetime.datetime", "collections.deque", "matplotlib.ticker.FuncFormatter", "numpy.where", "functools.wraps", "matplotlib._pylab_helpers.Gcf.get_active", "numpy.vstack", "mpl_t...
[((1323, 1366), 'matplotlib.pyplot.register_cmap', 'matplotlib.pyplot.register_cmap', ([], {'cmap': 'ncmap'}), '(cmap=ncmap)\n', (1354, 1366), False, 'import matplotlib\n'), ((395, 432), 'matplotlib.use', 'matplotlib.use', (["os.environ['BACKEND']"], {}), "(os.environ['BACKEND'])\n", (409, 432), False, 'import matplotl...
import gym import numpy as np from copy import deepcopy from gym_fabrikatioRL.envs.core import Core from gym_fabrikatioRL.envs.core_state import State from gym_fabrikatioRL.envs.interface_input import Input from gym_fabrikatioRL.envs.env_utils import UndefinedOptimizerConfiguration from gym_fabrikatioRL.envs.env_utils...
[ "gym_fabrikatioRL.envs.env_utils.UndefinedOptimizerTargetMode", "gym.spaces.Discrete", "gym.spaces.Box", "gym_fabrikatioRL.envs.interface_input.Input", "numpy.array", "gym_fabrikatioRL.envs.env_utils.UndefinedOptimizerConfiguration", "copy.deepcopy", "gym_fabrikatioRL.envs.env_utils.IllegalAction", ...
[((999, 1048), 'gym_fabrikatioRL.envs.interface_input.Input', 'Input', (['scheduling_inputs', 'init_seed', 'logfile_path'], {}), '(scheduling_inputs, init_seed, logfile_path)\n', (1004, 1048), False, 'from gym_fabrikatioRL.envs.interface_input import Input\n'), ((3739, 3762), 'gym_fabrikatioRL.envs.core.Core', 'Core', ...
# -*- coding: utf-8 -*- """ main program for IMRT QA PDF report parser Created on Thu May 30 2019 @author: <NAME>, PhD """ from os.path import isdir, join, splitext, normpath from os import walk, listdir import zipfile from datetime import datetime from dateutil.parser import parse as date_parser import numpy as np im...
[ "numpy.mean", "dateutil.parser.parse", "os.listdir", "zipfile.ZipFile", "datetime.datetime.strptime", "os.path.join", "numpy.diff", "os.path.splitext", "os.path.normpath", "numpy.array", "os.path.isdir", "datetime.datetime.today", "codecs.open", "os.walk" ]
[((6035, 6046), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (6043, 6046), True, 'import numpy as np\n'), ((6066, 6076), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (6073, 6076), True, 'import numpy as np\n'), ((6970, 6990), 'os.walk', 'walk', (['init_directory'], {}), '(init_directory)\n', (6974, 6990), False, ...
import numpy as np from PIL import Image from retina.retina import warp_image class DatasetGenerator(object): def __init__(self, data, output_dim=28, scenario=1, noise_var=None, common_dim=200): """ DatasetGenerator initialization. :param data: original dataset, MNIST :param output_dim: th...
[ "numpy.mean", "PIL.Image.fromarray", "numpy.zeros", "numpy.random.randn", "retina.retina.warp_image", "numpy.std", "numpy.zeros_like" ]
[((1868, 1886), 'numpy.zeros_like', 'np.zeros_like', (['out'], {}), '(out)\n', (1881, 1886), True, 'import numpy as np\n'), ((1903, 1928), 'numpy.mean', 'np.mean', (['out'], {'axis': '(1, 2)'}), '(out, axis=(1, 2))\n', (1910, 1928), True, 'import numpy as np\n'), ((1944, 1968), 'numpy.std', 'np.std', (['out'], {'axis':...
from FeatureProcess import * import pandas as pd import numpy as np fsd = FeaturesStandard() data = [[0, 0], [0, 0], [1, 1], [1, 1]] scr=fsd.fit(data) print(scr.mean_) print(scr.transform(data)) print('--------------------') fe = FeaturesEncoder(handle_unknown='ignore') X = [['Male', 1], ['Female', 3], ['Female', 2...
[ "numpy.array" ]
[((586, 650), 'numpy.array', 'np.array', (['[[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]'], {}), '([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])\n', (594, 650), True, 'import numpy as np\n')]
import matplotlib.pyplot as plt import numpy as np import os import pandas as pd from pathlib import Path import ptitprince as pt # ---------- # Loss Plots # ---------- def save_loss_plot(path, loss_function, v_path=None, show=True): df = pd.read_csv(path) if v_path is not None: vdf = pd.read_csv(v_pa...
[ "matplotlib.pyplot.savefig", "pandas.read_csv", "pathlib.Path", "ptitprince.RainCloud", "os.path.join", "numpy.concatenate", "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((245, 262), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (256, 262), True, 'import pandas as pd\n'), ((361, 371), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (365, 371), False, 'from pathlib import Path\n'), ((423, 455), 'os.path.join', 'os.path.join', (['d', "(n + '_loss.png')"], {}), "(d, n...
################################################################################ # # test_xtram.py - testing the pyfeat xtram class # # author: <NAME> <<EMAIL>> # author: <NAME> <<EMAIL>> # ################################################################################ from nose.tools import assert_raises, asse...
[ "numpy.ones" ]
[((531, 570), 'numpy.ones', 'np.ones', ([], {'shape': '(2, 3, 3)', 'dtype': 'np.intc'}), '(shape=(2, 3, 3), dtype=np.intc)\n', (538, 570), True, 'import numpy as np\n'), ((578, 610), 'numpy.ones', 'np.ones', ([], {'shape': '(10)', 'dtype': 'np.intc'}), '(shape=10, dtype=np.intc)\n', (585, 610), True, 'import numpy as n...
import numpy as np from os.path import join from os import listdir from .utils import * from sklearn.preprocessing import normalize from sklearn.preprocessing import scale from sklearn.preprocessing import MinMaxScaler from scipy.signal import resample from scipy.signal import decimate import warnings def load_data():...
[ "numpy.mean", "os.listdir", "numpy.std", "numpy.asarray", "os.path.join", "numpy.angle", "scipy.signal.decimate", "numpy.split", "numpy.zeros", "numpy.cos", "numpy.concatenate", "numpy.linalg.norm", "numpy.sin", "numpy.loadtxt", "sklearn.preprocessing.scale" ]
[((478, 513), 'os.path.join', 'join', (['""".."""', '"""PaHaW"""', '"""PaHaW_public"""'], {}), "('..', 'PaHaW', 'PaHaW_public')\n", (482, 513), False, 'from os.path import join\n'), ((551, 569), 'os.listdir', 'listdir', (['data_path'], {}), '(data_path)\n', (558, 569), False, 'from os import listdir\n'), ((608, 649), '...
import matplotlib.pyplot as plt import numpy as np import os import pickle def get_mean_stds(data): return np.mean(data), np.std(data) / np.sqrt(len(data)) * 1.96 if __name__ == '__main__': labels = ['OpenTAL', 'EDL', 'SoftMax'] result_folders = ['edl_oshead_iou', 'edl_15kc', 'default'] colors = ['k...
[ "numpy.mean", "os.makedirs", "os.path.join", "pickle.load", "numpy.array", "numpy.zeros", "matplotlib.pyplot.yticks", "matplotlib.pyplot.tight_layout", "numpy.std", "matplotlib.pyplot.subplots" ]
[((595, 631), 'os.makedirs', 'os.makedirs', (['fig_path'], {'exist_ok': '(True)'}), '(fig_path, exist_ok=True)\n', (606, 631), False, 'import os\n'), ((681, 715), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(8, 5)'}), '(1, 1, figsize=(8, 5))\n', (693, 715), True, 'import matplotlib.pyplo...
from textwrap import dedent import os import subprocess import numpy import pandas from wqio.tests import helpers from wqio.utils import numutils def _sig_figs(x): """ Wrapper around `utils.sigFig` (n=3, tex=True) requiring only argument for the purpose of easily "apply"-ing it to a pandas dataframe. ...
[ "textwrap.dedent", "wqio.utils.numutils.sigFigs", "pandas.read_csv", "os.getcwd", "os.path.isfile", "numpy.array", "os.chdir", "os.path.dirname", "wqio.tests.helpers.checkdep_tex", "subprocess.call", "numpy.nonzero", "os.remove" ]
[((338, 372), 'wqio.utils.numutils.sigFigs', 'numutils.sigFigs', (['x'], {'n': '(3)', 'tex': '(True)'}), '(x, n=3, tex=True)\n', (354, 372), False, 'from wqio.utils import numutils\n'), ((687, 714), 'numpy.array', 'numpy.array', (['df.index.names'], {}), '(df.index.names)\n', (698, 714), False, 'import numpy\n'), ((725...
import asyncio import json import multiprocessing import random from functools import partial from typing import Set, Callable, List, Iterator import numpy as np import torch from torch import nn import backgammon.game as bg class RandomAgent(bg.Agent): """Random Player.""" def get_action(self, available_m...
[ "backgammon.game.Board.from_schema", "asyncio.start_server", "json.dumps", "torch.from_numpy", "numpy.zeros", "asyncio.open_connection", "functools.partial", "numpy.argmin", "multiprocessing.Pipe" ]
[((2669, 2694), 'functools.partial', 'partial', (['cls'], {'model': 'model'}), '(cls, model=model)\n', (2676, 2694), False, 'from functools import partial\n'), ((4171, 4198), 'multiprocessing.Pipe', 'multiprocessing.Pipe', (['(False)'], {}), '(False)\n', (4191, 4198), False, 'import multiprocessing\n'), ((937, 982), 'n...
import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) def log_loss(x, y, eps=1e-6): x = np.clip(x, eps, 1-eps) return -(y*np.log(x) + (1-y)*np.log(1-x))
[ "numpy.clip", "numpy.exp", "numpy.log" ]
[((109, 133), 'numpy.clip', 'np.clip', (['x', 'eps', '(1 - eps)'], {}), '(x, eps, 1 - eps)\n', (116, 133), True, 'import numpy as np\n'), ((57, 67), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (63, 67), True, 'import numpy as np\n'), ((147, 156), 'numpy.log', 'np.log', (['x'], {}), '(x)\n', (153, 156), True, 'impo...
import random import _jsonnet, json import logging import hashlib import os from copy import deepcopy import pandas as pd from tqdm import tqdm import math from LeapOfThought.resources.teachai_kb import TeachAIKB from LeapOfThought.common.general import num2words1, bc from LeapOfThought.common.data_utils import unifor...
[ "logging.getLogger", "copy.deepcopy", "numpy.random.RandomState", "pandas.set_option", "numpy.random.seed", "pandas.DataFrame", "random.sample", "hashlib.md5", "random.shuffle", "LeapOfThought.common.data_utils.pandas_multi_column_agg", "os.path.abspath", "logging.basicConfig", "pandas.Serie...
[((413, 451), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (426, 451), True, 'import pandas as pd\n'), ((452, 493), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(500)'], {}), "('display.max_columns', 500)\n", (465, 493), True, '...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This file is covered by the LICENSE file in the root of this project. from __future__ import annotations import typing import cv2 import numpy as np class PiRandomTransform: """A transformation that can act on raster and sparse two-dimensional data.""" def ...
[ "numpy.clip", "numpy.eye", "cv2.warpAffine", "numpy.ones", "numpy.cos", "cv2.cvtColor", "numpy.sin", "cv2.GaussianBlur", "numpy.remainder" ]
[((4723, 4748), 'numpy.eye', 'np.eye', (['(3)'], {'dtype': 'np.float'}), '(3, dtype=np.float)\n', (4729, 4748), True, 'import numpy as np\n'), ((4879, 4904), 'numpy.eye', 'np.eye', (['(3)'], {'dtype': 'np.float'}), '(3, dtype=np.float)\n', (4885, 4904), True, 'import numpy as np\n'), ((5115, 5140), 'numpy.eye', 'np.eye...
from __future__ import print_function import tikzplots as tkz import argparse import numpy as np import re def parse_data_file(fname): with open(fname, 'r') as fp: lines = fp.readlines() # Read in the first line, and find the comma-separated values # in the header hline = lines[0] ...
[ "numpy.ceil", "numpy.log10", "tikzplots.get_legend_entry", "argparse.ArgumentParser", "tikzplots.get_2d_plot", "numpy.max", "tikzplots.get_2d_axes", "numpy.array", "numpy.linspace", "tikzplots.get_end_tikz", "tikzplots.get_begin_tikz", "numpy.min", "tikzplots.get_header" ]
[((861, 886), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (884, 886), False, 'import argparse\n'), ((2602, 2642), 'numpy.linspace', 'np.linspace', (['xmin', 'xmax', '(xmax - xmin + 1)'], {}), '(xmin, xmax, xmax - xmin + 1)\n', (2613, 2642), True, 'import numpy as np\n'), ((3535, 3551), 'tikz...
import tensorflow as tf import numpy as np import os class TFModel(object): ''' This class contains the general functions for a tensorflow model ''' def __init__(self, config): # Limit the TensorFlow's logs #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '4' # tf.logging.set_verbosi...
[ "os.path.exists", "numpy.savez", "tensorflow.reset_default_graph", "os.makedirs", "tensorflow.Session", "tensorflow.train.Saver", "tensorflow.global_variables_initializer", "tensorflow.ConfigProto" ]
[((847, 916), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'allow_soft_placement': '(True)', 'log_device_placement': '(False)'}), '(allow_soft_placement=True, log_device_placement=False)\n', (861, 916), True, 'import tensorflow as tf\n'), ((1022, 1050), 'tensorflow.Session', 'tf.Session', ([], {'config': 'sess_con...
import tensorflow as tf import numpy as np from interfaces import AbstractSelfAdaptingStrategy def _get_category_encoding_layer(size): return lambda feature: tf.one_hot(feature, size + 1) # +1 since classes are labeled from 1 def _prepare_inputs(): all_inputs = tf.keras.Input(shape=(2,), dtype='int32') ...
[ "tensorflow.one_hot", "tensorflow.losses.Poisson", "tensorflow.config.threading.set_intra_op_parallelism_threads", "tensorflow.keras.layers.Concatenate", "tensorflow.convert_to_tensor", "numpy.array", "tensorflow.keras.experimental.CosineDecay", "tensorflow.keras.layers.Dense", "tensorflow.config.th...
[((275, 316), 'tensorflow.keras.Input', 'tf.keras.Input', ([], {'shape': '(2,)', 'dtype': '"""int32"""'}), "(shape=(2,), dtype='int32')\n", (289, 316), True, 'import tensorflow as tf\n'), ((1006, 1055), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'all_inputs', 'outputs': 'output'}), '(inputs=all_inputs,...
# -*- coding: utf-8 -*- import numpy as np # Note: careful as np.multiply does an elementwise multiply on numpy arrays # asterisk (*) does the same but will perfom matrix multiplication on mat (numpy matrices) class L1Regularization: """ **Lasso Regression (L1Regularization)** L1Regularization ad...
[ "numpy.multiply", "numpy.sign", "numpy.linalg.norm" ]
[((2270, 2304), 'numpy.multiply', 'np.multiply', (['self._lambda', 'weights'], {}), '(self._lambda, weights)\n', (2281, 2304), True, 'import numpy as np\n'), ((1102, 1125), 'numpy.linalg.norm', 'np.linalg.norm', (['weights'], {}), '(weights)\n', (1116, 1125), True, 'import numpy as np\n'), ((1204, 1220), 'numpy.sign', ...
""" Ref: https://github.com/htwang14/CAT/blob/1152f7095d6ea0026c7344b00fefb9f4990444f2/models/FiLM.py#L35 """ import numpy as np import torch.nn as nn from torch.nn import functional as F from torch.nn.modules.batchnorm import _BatchNorm class SwitchableLayer1D(nn.Module): """1-dimensional switchable layer. T...
[ "torch.nn.functional.linear", "torch.nn.functional.conv2d", "numpy.ceil", "torch.nn.ModuleList", "torch.nn.functional.batch_norm" ]
[((961, 983), 'torch.nn.ModuleList', 'nn.ModuleList', (['modules'], {}), '(modules)\n', (974, 983), True, 'import torch.nn as nn\n'), ((6404, 6656), 'torch.nn.functional.batch_norm', 'F.batch_norm', (['input', '(self.running_mean if not self.training or self.track_running_stats else None)', '(self.running_var if not se...
#!/usr/bin/env python # coding: utf-8 # In[2]: # import matplotlib.pyplot as plt # from scipy import interpolate import numpy as np # step = np.array([12, 6, 4, 3, 2]) # MAP5 = np.array([0.6480, 0.6797, 0.6898, 0.6921, 0.6982]) # step_new = np.arange(step.min(), step.max(), 0.1) # # step_new = n...
[ "numpy.mean" ]
[((1794, 1808), 'numpy.mean', 'np.mean', (['diffs'], {}), '(diffs)\n', (1801, 1808), True, 'import numpy as np\n'), ((1834, 1846), 'numpy.mean', 'np.mean', (['mvs'], {}), '(mvs)\n', (1841, 1846), True, 'import numpy as np\n'), ((1874, 1888), 'numpy.mean', 'np.mean', (['flows'], {}), '(flows)\n', (1881, 1888), True, 'im...
import cv2 import numpy as np thres = 0.45 nms_threshold = 0.2 #Default Camera Capture cap = cv2.VideoCapture(0) cap.set(3, 1280) cap.set(4, 720) cap.set(10, 150) ##Importing the COCO dataset in a list classNames= [] classFile = 'coco.names' with open(classFile,'rt') as f: classNames = f.read().rstrip('\n').spli...
[ "cv2.rectangle", "cv2.imshow", "numpy.array", "cv2.dnn_DetectionModel", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.dnn.NMSBoxes", "cv2.waitKey" ]
[((95, 114), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (111, 114), False, 'import cv2\n'), ((522, 569), 'cv2.dnn_DetectionModel', 'cv2.dnn_DetectionModel', (['weightsPath', 'configPath'], {}), '(weightsPath, configPath)\n', (544, 569), False, 'import cv2\n'), ((1444, 1467), 'cv2.destroyAllWindows'...
import os from skimage.transform import resize import imageio import numpy as np import glob import scipy def main(): rootdir = "/home/nbayat5/Desktop/celebA/identities" #os.mkdir("/home/nbayat5/Desktop/celebA/face_recognition_srgan") for subdir, dirs, files in os.walk(rootdir): for dir ...
[ "imageio.imwrite", "os.walk", "os.path.join", "numpy.asarray", "os.chdir", "numpy.array", "scipy.misc.imread", "scipy.misc.imresize", "glob.glob" ]
[((285, 301), 'os.walk', 'os.walk', (['rootdir'], {}), '(rootdir)\n', (292, 301), False, 'import os\n'), ((1291, 1305), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (1299, 1305), False, 'import os\n'), ((1438, 1463), 'glob.glob', 'glob.glob', (['"""./test/*.jpg"""'], {}), "('./test/*.jpg')\n", (1447, 1463), Fals...
#!/usr/bin/env python # coding: utf-8 # # Gender Recognition by Voice Kaggle [ Test Accuracy : 99.08 % ] # In[ ]: # ## CONTENTS:: # [ **1 ) Importing Various Modules and Loading the Dataset**](#content1) # [ **2 ) Exploratory Data Analysis (EDA)**](#content2) # [ **3 ) OutlierTreatment**](#content3) # [ **4...
[ "pandas.read_csv", "sklearn.neighbors.KNeighborsClassifier", "missingno.matrix", "numpy.array", "matplotlib.style.use", "seaborn.set", "seaborn.distplot", "sklearn.tree.DecisionTreeClassifier", "pandas.DataFrame", "numpy.tril_indices_from", "sklearn.model_selection.train_test_split", "matplotl...
[((600, 633), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (623, 633), False, 'import warnings\n'), ((634, 667), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (657, 667), False, 'import warnings\n'), ((945, 973), 'matplotli...
import tclab import time import numpy as np import sys import first_principles_model as fp def doublet_test(data_file='step_test.csv', show_plot=True): '''doublet test the system and save data to given file path''' import Adafruit_DHT # Only importable on the Pi itself tc1 = tclab.TCLab() tc1.LED(100...
[ "tclab.TCLab", "numpy.ones", "Adafruit_DHT.read_retry", "numpy.zeros", "numpy.vstack", "numpy.savetxt", "time.time" ]
[((291, 304), 'tclab.TCLab', 'tclab.TCLab', ([], {}), '()\n', (302, 304), False, 'import tclab\n'), ((588, 599), 'time.time', 'time.time', ([], {}), '()\n', (597, 599), False, 'import time\n'), ((2418, 2431), 'tclab.TCLab', 'tclab.TCLab', ([], {}), '()\n', (2429, 2431), False, 'import tclab\n'), ((2730, 2741), 'time.ti...
import numpy as np import matplotlib.pyplot as plt import pandas as pd #################### def ld_to_dl(ld): dl = {} for i, d in enumerate(ld): for key in d.keys(): value = d[key] if i == 0: dl[key] = [value] else: dl[key].append(v...
[ "numpy.load", "pandas.DataFrame.from_dict" ]
[((374, 415), 'numpy.load', 'np.load', (['"""results.npy"""'], {'allow_pickle': '(True)'}), "('results.npy', allow_pickle=True)\n", (381, 415), True, 'import numpy as np\n'), ((449, 480), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['results'], {}), '(results)\n', (471, 480), True, 'import pandas as pd\n')...