code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python from builtins import * import os import argparse import nibabel as nib import numpy as np FileType=argparse.FileType parser = argparse.ArgumentParser(description='Test multilevel bias corrector.') parser.add_argument('--infile','-i', metavar='INIMAGE', help='input file', re...
[ "numpy.expand_dims", "os.exit", "argparse.ArgumentParser", "nibabel.load" ]
[((152, 222), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test multilevel bias corrector."""'}), "(description='Test multilevel bias corrector.')\n", (175, 222), False, 'import argparse\n'), ((757, 778), 'nibabel.load', 'nib.load', (['args.infile'], {}), '(args.infile)\n', (765, 778),...
# %% """ Example implementations of HARK.ConsumptionSaving.ConsPortfolioModel """ from copy import copy from time import time import matplotlib.pyplot as plt import numpy as np from HARK.ConsumptionSaving.ConsIndShockModel import init_lifecycle from HARK.ConsumptionSaving.ConsPortfolioModel import ( PortfolioCons...
[ "matplotlib.pyplot.figure", "HARK.utilities.plot_funcs", "matplotlib.pyplot.draw", "numpy.linspace", "matplotlib.pyplot.axhline", "HARK.ConsumptionSaving.ConsPortfolioModel.init_portfolio.copy", "matplotlib.pyplot.show", "numpy.ones_like", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "m...
[((550, 573), 'HARK.ConsumptionSaving.ConsPortfolioModel.PortfolioConsumerType', 'PortfolioConsumerType', ([], {}), '()\n', (571, 573), False, 'from HARK.ConsumptionSaving.ConsPortfolioModel import PortfolioConsumerType, init_portfolio\n'), ((597, 603), 'time.time', 'time', ([], {}), '()\n', (601, 603), False, 'from ti...
""" This module collects several standard analysis routines. """ import numpy as np import pickle from tqdm import tqdm from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C import mst_ida.models.mesxr3 as m3 import mst_ida.models....
[ "numpy.maximum", "numpy.sum", "sklearn.gaussian_process.kernels.ConstantKernel", "numpy.argsort", "pickle.load", "mst_ida.data.mesxr.get_smooth_data", "numpy.interp", "numpy.atleast_2d", "numpy.linspace", "sklearn.gaussian_process.GaussianProcessRegressor", "sklearn.gaussian_process.kernels.RBF"...
[((1086, 1176), 'mst_ida.data.mesxr.get_ratio_data', 'mesxr.get_ratio_data', (['self.shot', 'self.frame'], {'smooth': 'self._smooth', 'center': 'self._center'}), '(self.shot, self.frame, smooth=self._smooth, center=\n self._center)\n', (1106, 1176), True, 'import mst_ida.data.mesxr as mesxr\n'), ((1802, 1848), 'mst_...
from tensorflow import keras from tensorflow.keras.preprocessing import image from tensorflow.keras.preprocessing.image import ImageDataGenerator import os import shutil import random import numpy as np def predict_image(img_path, model_name): # models_dir = 'C:/Users/perro/PycharmProjects/cv_proj/models' mod...
[ "tensorflow.keras.preprocessing.image.ImageDataGenerator", "tensorflow.keras.models.load_model", "tensorflow.keras.preprocessing.image.img_to_array", "numpy.expand_dims", "tensorflow.keras.preprocessing.image.load_img", "shutil.copyfile", "os.path.join", "os.listdir", "numpy.vstack" ]
[((361, 397), 'os.path.join', 'os.path.join', (['models_dir', 'model_name'], {}), '(models_dir, model_name)\n', (373, 397), False, 'import os\n'), ((410, 445), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['model_path'], {}), '(model_path)\n', (433, 445), False, 'from tensorflow import keras\n'), (...
from __future__ import print_function, division import numpy as np from scipy.sparse import csr_matrix from scipy.linalg import blas from timeit import default_timer as timer from pyscf.nao.m_blas_wrapper import spmv_wrapper from pyscf.nao.m_tddft_iter_gpu import tddft_iter_gpu_c try: import numba from pyscf.n...
[ "numpy.zeros_like", "pyscf.nao.m_fermi_dirac.fermi_dirac_occupations", "numpy.argmax", "numpy.transpose", "numpy.zeros", "numpy.require", "scipy.linalg.blas.cgemm", "pyscf.nao.m_iter_div_eigenenergy_numba.div_eigenenergy_numba", "scipy.sparse.linalg.LinearOperator", "pyscf.nao.m_blas_wrapper.spmv_...
[((2210, 2268), 'numpy.require', 'np.require', (['sv.wfsx.x'], {'dtype': 'self.dtype', 'requirements': '"""CW"""'}), "(sv.wfsx.x, dtype=self.dtype, requirements='CW')\n", (2220, 2268), True, 'import numpy as np\n'), ((2286, 2348), 'numpy.require', 'np.require', (['sv.wfsx.ksn2e'], {'dtype': 'self.dtype', 'requirements'...
from os.path import join from torchvision.transforms import transforms from tqdm import tqdm from src.plunder_standardize_colors import standardize_colors import numpy as np import torch from os import listdir, makedirs import matplotlib.pyplot as plt from src.pl_modules.vae import VaeModel from PIL import Image if...
[ "numpy.load", "os.makedirs", "PIL.Image.fromarray", "os.path.join", "os.listdir" ]
[((437, 481), 'os.makedirs', 'makedirs', (['reconstruction_path'], {'exist_ok': '(True)'}), '(reconstruction_path, exist_ok=True)\n', (445, 481), False, 'from os import listdir, makedirs\n'), ((500, 520), 'os.listdir', 'listdir', (['images_path'], {}), '(images_path)\n', (507, 520), False, 'from os import listdir, make...
#!/usr/bin/python3.5 """ Draw FeedForward Neural Network Predictions over original videos. """ import sys import os OPENCV_HOME = os.environ['OPENCV_HOME'] sys.path.insert(1, OPENCV_HOME + '/lib/python3.5/dist-packages') import cv2 import numpy as np from Util import print_msg from FFPredict import load_data, param...
[ "cv2.VideoWriter_fourcc", "cv2.polylines", "cv2.waitKey", "cv2.imwrite", "sys.path.insert", "cv2.VideoCapture", "FFPredict.load_data", "numpy.array", "numpy.loadtxt", "cv2.VideoWriter", "cv2.imshow", "sys.exit", "Util.print_msg" ]
[((158, 222), 'sys.path.insert', 'sys.path.insert', (['(1)', "(OPENCV_HOME + '/lib/python3.5/dist-packages')"], {}), "(1, OPENCV_HOME + '/lib/python3.5/dist-packages')\n", (173, 222), False, 'import sys\n'), ((2754, 2796), 'numpy.loadtxt', 'np.loadtxt', (["param_suit['file_predictions']"], {}), "(param_suit['file_predi...
import numpy as np """ used for converting the decoded image to rle mask """ def rle_encode(im): ''' im: numpy array, 1 - mask, 0 - background Returns run length as string formated ''' pixels = im.flatten(order = 'F') pixels = np.concatenate([[0], pixels, [0]]) runs = np.where(pixels[1:] !=...
[ "numpy.asarray", "numpy.where", "numpy.zeros", "numpy.concatenate" ]
[((252, 286), 'numpy.concatenate', 'np.concatenate', (['[[0], pixels, [0]]'], {}), '([[0], pixels, [0]])\n', (266, 286), True, 'import numpy as np\n'), ((600, 635), 'numpy.zeros', 'np.zeros', (['(101 * 101)'], {'dtype': 'np.uint8'}), '(101 * 101, dtype=np.uint8)\n', (608, 635), True, 'import numpy as np\n'), ((486, 510...
import gym import numpy as np class QLearningAgent: def __init__(self, obs_n, act_n, learning_rate=0.01, gamma=0.9, e_greed=0.1): self.act_n = act_n self.lr = learning_rate self.gamma = gamma self.epsilon = e_greed self.Q = np.zeros((obs_n, act_n)) # 根据输入观察值,采样输出的动作值,带...
[ "numpy.random.uniform", "numpy.load", "numpy.save", "gym.make", "numpy.zeros", "numpy.max", "numpy.where", "numpy.random.choice" ]
[((2671, 2698), 'gym.make', 'gym.make', (['"""CliffWalking-v0"""'], {}), "('CliffWalking-v0')\n", (2679, 2698), False, 'import gym\n'), ((3382, 3407), 'numpy.load', 'np.load', (['"""q_table_ql.npy"""'], {}), "('q_table_ql.npy')\n", (3389, 3407), True, 'import numpy as np\n'), ((270, 294), 'numpy.zeros', 'np.zeros', (['...
import os import re import time from multiprocessing import Manager from multiprocessing import Process import PySimpleGUI as sg import numpy as np import phonemizer import pyaudio import pyloudnorm import soundfile as sf import torch from numpy import trim_zeros from pynput import keyboard from torchaudio.transforms ...
[ "numpy.abs", "pyloudnorm.normalize.loudness", "PySimpleGUI.theme", "os.path.exists", "phonemizer.phonemize", "torch.Tensor", "PySimpleGUI.Window", "torch.zeros", "re.sub", "numpy.divide", "pynput.keyboard.Listener", "pyloudnorm.Meter", "time.sleep", "numpy.hstack", "torchaudio.transforms...
[((11101, 11126), 're.sub', 're.sub', (['"""~+"""', '"""~"""', 'phones'], {}), "('~+', '~', phones)\n", (11107, 11126), False, 'import re\n'), ((622, 682), 'torchaudio.transforms.Vad', 'VoiceActivityDetection', ([], {'sample_rate': 'parameters.sampling_rate'}), '(sample_rate=parameters.sampling_rate)\n', (644, 682), Tr...
import numpy as np from ramp_to_hill.hill_system import * from ramp_systems.ramp_system import RampSystem import DSGRN def test_num_unique_vectors(): vectors = [np.array([1,2,3]),np.array([1,1,1]),np.array([1,2,3])] assert(num_unique_vectors(vectors) == 2) vectors = [np.array([1,1,1]),np.array([1,2,3]),np....
[ "numpy.array", "DSGRN.Network", "ramp_systems.ramp_system.RampSystem" ]
[((420, 453), 'DSGRN.Network', 'DSGRN.Network', (['"""X0:~X1 \n X1:~X0"""'], {}), "('X0:~X1 \\n X1:~X0')\n", (433, 453), False, 'import DSGRN\n'), ((559, 598), 'ramp_systems.ramp_system.RampSystem', 'RampSystem', (['net', 'L', 'Delta', 'theta', 'gamma'], {}), '(net, L, Delta, theta, gamma)\n', (569, 598), False, 'from ...
# MegFlow is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2019-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KI...
[ "numpy.maximum", "numpy.concatenate", "numpy.asarray", "time.time", "onnxruntime.InferenceSession", "numpy.argsort", "loguru.logger.info", "cv2.resize" ]
[((518, 557), 'onnxruntime.InferenceSession', 'onnxruntime.InferenceSession', (['onnx_path'], {}), '(onnx_path)\n', (546, 557), False, 'import onnxruntime\n'), ((954, 985), 'cv2.resize', 'cv2.resize', (['image', 'target_shape'], {}), '(image, target_shape)\n', (964, 985), False, 'import cv2\n'), ((2726, 2744), 'numpy.a...
# importing the libraries import numpy as np import string import re from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.tokenize import TweetTokenizer def process_sentence(sentence) : """ Parameters ---------- sentence : a string of words R...
[ "nltk.stem.PorterStemmer", "nltk.tokenize.TweetTokenizer", "nltk.corpus.stopwords.words", "numpy.squeeze", "re.sub" ]
[((442, 457), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (455, 457), False, 'from nltk.stem import PorterStemmer\n'), ((483, 509), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (498, 509), False, 'from nltk.corpus import stopwords\n'), ((570, 601), 're.su...
# -*- coding: utf-8 -*- """Carry out Z-Score based single sample DE analysis.""" from typing import List import numpy as np import pandas as pd def do_z_score( data: pd.DataFrame, design: pd.DataFrame, control: str = 'Control', threshold: float = 2.0, ) -> pd.DataFrame: """Carry...
[ "pandas.DataFrame", "numpy.unique" ]
[((1947, 2018), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'out_z_scores', 'index': 'data.index', 'columns': 'data.columns'}), '(data=out_z_scores, index=data.index, columns=data.columns)\n', (1959, 2018), True, 'import pandas as pd\n'), ((1174, 1201), 'numpy.unique', 'np.unique', (["design['Target']"], {}), "(d...
import glob import os import numpy as np from spydiff import import_difmap_model, clean_difmap from from_fits import create_clean_image_from_fits_file from utils import hdi_of_mcmc import matplotlib label_size = 16 matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 matplotlib.rcParams['xti...
[ "numpy.atleast_2d", "utils.hdi_of_mcmc", "spydiff.import_difmap_model", "numpy.hypot", "matplotlib.pyplot.figure", "numpy.array", "numpy.loadtxt", "os.path.join", "numpy.sqrt" ]
[((971, 1016), 'os.path.join', 'os.path.join', (['base_dir', '"""samples_of_mcmc.txt"""'], {}), "(base_dir, 'samples_of_mcmc.txt')\n", (983, 1016), False, 'import os\n'), ((1038, 1062), 'numpy.loadtxt', 'np.loadtxt', (['mcmc_samples'], {}), '(mcmc_samples)\n', (1048, 1062), True, 'import numpy as np\n'), ((1441, 1468),...
import random import numpy as np def update_target(model, model_target): model_target.load_state_dict(model.state_dict()) class ReplayBuffer(object): def __init__(self, capacity): self.capacity = capacity self.buffer = [] self.next_idx = 0 def push(self, state, action, reward, next_state, done): data = (...
[ "numpy.array" ]
[((922, 936), 'numpy.array', 'np.array', (['obss'], {}), '(obss)\n', (930, 936), True, 'import numpy as np\n'), ((938, 952), 'numpy.array', 'np.array', (['acts'], {}), '(acts)\n', (946, 952), True, 'import numpy as np\n'), ((954, 968), 'numpy.array', 'np.array', (['rews'], {}), '(rews)\n', (962, 968), True, 'import num...
import numpy as np c16 = np.complex128() f8 = np.float64() i8 = np.int64() u8 = np.uint64() c8 = np.complex64() f4 = np.float32() i4 = np.int32() u4 = np.uint32() dt = np.datetime64(0, "D") td = np.timedelta64(0, "D") b_ = np.bool_() b = bool() c = complex() f = float() i = int() AR = np.array([0], dtype=np.float...
[ "numpy.uint32", "numpy.bool_", "numpy.uint64", "numpy.complex128", "numpy.datetime64", "numpy.float32", "numpy.timedelta64", "numpy.array", "numpy.complex64", "numpy.int64", "numpy.int32", "numpy.float64" ]
[((26, 41), 'numpy.complex128', 'np.complex128', ([], {}), '()\n', (39, 41), True, 'import numpy as np\n'), ((47, 59), 'numpy.float64', 'np.float64', ([], {}), '()\n', (57, 59), True, 'import numpy as np\n'), ((65, 75), 'numpy.int64', 'np.int64', ([], {}), '()\n', (73, 75), True, 'import numpy as np\n'), ((81, 92), 'nu...
import numpy as np from respy.python.evaluate.evaluate_auxiliary import create_draws_and_prob_wages from respy.python.evaluate.evaluate_auxiliary import ( simulate_probability_of_agents_observed_choice, ) from respy.python.shared.shared_auxiliary import get_conditional_probabilities def pyth_contributions(state_...
[ "numpy.count_nonzero", "respy.python.evaluate.evaluate_auxiliary.simulate_probability_of_agents_observed_choice", "respy.python.evaluate.evaluate_auxiliary.create_draws_and_prob_wages", "numpy.multiply.reduceat", "numpy.cumsum", "numpy.bincount", "respy.python.shared.shared_auxiliary.get_conditional_pro...
[((2243, 2278), 'numpy.bincount', 'np.bincount', (['data.Identifier.values'], {}), '(data.Identifier.values)\n', (2254, 2278), True, 'import numpy as np\n'), ((2584, 2678), 'respy.python.shared.shared_auxiliary.get_conditional_probabilities', 'get_conditional_probabilities', (["optim_paras['type_shares']", 'agents_init...
__author__ = "<NAME>" # This file contains functions for generating figures used in exploratory analysis of # iCGM Sensitivity Analysis results. # # This includes a number of different visualization for checking different aspects of the results # and all of the figures that were previously made for the non-pairwise ve...
[ "numpy.abs", "datetime.datetime.utcnow", "numpy.mean", "numpy.arange", "tidepool_data_science_metrics.glucose.blood_glucose_risk_index", "os.path.join", "plotly.express.scatter", "numpy.unique", "pandas.DataFrame", "plotly.express.box", "os.path.exists", "tidepool_data_science_metrics.insulin....
[((2034, 2052), 'numpy.abs', 'np.abs', (['icgm_error'], {}), '(icgm_error)\n', (2040, 2052), True, 'import numpy as np\n'), ((2609, 2660), 'numpy.mean', 'np.mean', (["df.loc[df['withinMeasRange'], 'icgmError']"], {}), "(df.loc[df['withinMeasRange'], 'icgmError'])\n", (2616, 2660), True, 'import numpy as np\n'), ((3134,...
seed=123 from keras import backend as K import numpy as np np.random.seed(seed) import tensorflow as tf tf.set_random_seed(seed) import random random.seed(seed) import skimage.io from skimage import img_as_ubyte import model as modellib import pandas as pd import os import my_functions as f import imgaug.augmenters as ...
[ "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "cv2.bilateralFilter", "numpy.mean", "numpy.arange", "cv2.HoughLinesP", "os.path.join", "pandas.DataFrame", "cv2.cvtColor", "matplotlib.pyplot.imshow", "numpy.std", "tensorflow.set_random_seed", "random.seed", "matplotlib.pyplot...
[((59, 79), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (73, 79), True, 'import numpy as np\n'), ((104, 128), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (122, 128), True, 'import tensorflow as tf\n'), ((143, 160), 'random.seed', 'random.seed', (['seed'], {}), ...
import pandas as pd import numpy as np import time import datetime from os import listdir from os.path import isfile, join import random def preprocess(path, timetrack=False): # the path can be both a file or a folder containing multiple files # Should it be a folder, be sure that the folder contains ONLY t...
[ "pandas.DataFrame", "numpy.asarray", "numpy.zeros", "time.time", "random.random", "datetime.timedelta", "os.path.join", "os.listdir" ]
[((2956, 2974), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (2968, 2974), True, 'import pandas as pd\n'), ((592, 603), 'time.time', 'time.time', ([], {}), '()\n', (601, 603), False, 'import time\n'), ((617, 628), 'time.time', 'time.time', ([], {}), '()\n', (626, 628), False, 'import time\n'), ((1269...
import copy from gurobipy import Model, LinExpr, GRB, quicksum import math import numpy as np import pandas as pd import sys class RobustOCT: def __init__(self, X, y, tree, X_col_labels, labels, costs, budget, time_limit, threads, verbose): ''' :param data: The training data :param label: N...
[ "gurobipy.quicksum", "gurobipy.LinExpr", "numpy.arange", "gurobipy.Model" ]
[((791, 820), 'numpy.arange', 'np.arange', (['(0)', 'self.X.shape[0]'], {}), '(0, self.X.shape[0])\n', (800, 820), True, 'import numpy as np\n'), ((2085, 2103), 'gurobipy.Model', 'Model', (['"""RobustOCT"""'], {}), "('RobustOCT')\n", (2090, 2103), False, 'from gurobipy import Model, LinExpr, GRB, quicksum\n'), ((5490, ...
import cv2 import os from argparse import ArgumentParser import numpy as np def lapse(folder: str = None, fps: float = None, name: str = None, gamma: float = None, scale: float = None, extension: str = '.png' ): '''convert sequential png files to mp4''' ...
[ "argparse.ArgumentParser", "cv2.LUT", "numpy.arange", "cv2.VideoWriter", "cv2.destroyAllWindows", "os.path.join", "os.listdir" ]
[((912, 963), 'cv2.VideoWriter', 'cv2.VideoWriter', (['name', 'fourcc', 'fps', '(width, height)'], {}), '(name, fourcc, fps, (width, height))\n', (927, 963), False, 'import cv2\n'), ((1165, 1188), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1186, 1188), False, 'import cv2\n'), ((1246, 1262), 'a...
import numpy as np from argparse import ArgumentParser import json import timeit from basis_generator import basis_gs # Example: # python save_basis.py \ # --dim 2 \ # --num_obs 2 \ # --len_seq 2 \ # --num_out 2 \ # --stop 10000 \ # --save_metadata True \ # --save_data True def main(args...
[ "json.dump", "numpy.save", "argparse.ArgumentParser", "timeit.default_timer", "basis_generator.basis_gs" ]
[((336, 358), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (356, 358), False, 'import timeit\n'), ((374, 483), 'basis_generator.basis_gs', 'basis_gs', (['args.dim', 'args.num_obs', 'args.len_seq', 'args.num_out', 'args.level', 'args.remove_last_out', 'args.stop'], {}), '(args.dim, args.num_obs, arg...
import os, shutil import json import os.path as osp import re import logging import time import random from functools import reduce import resource rlimit = resource.getrlimit(resource.RLIMIT_NOFILE) resource.setrlimit(resource.RLIMIT_NOFILE, (2048, rlimit[1])) import numpy as np import scipy as sp from scipy.spatial....
[ "model.misc.utils.myself", "model.misc.utils.init", "model.datasets.CompositionDataset.CompositionDataset", "model.misc.utils.prepare_train", "torch.cat", "torch.autograd.set_detect_anomaly", "scipy.spatial.distance.pdist", "torch.device", "torch.no_grad", "os.path.join", "json.loads", "model....
[((157, 199), 'resource.getrlimit', 'resource.getrlimit', (['resource.RLIMIT_NOFILE'], {}), '(resource.RLIMIT_NOFILE)\n', (175, 199), False, 'import resource\n'), ((200, 261), 'resource.setrlimit', 'resource.setrlimit', (['resource.RLIMIT_NOFILE', '(2048, rlimit[1])'], {}), '(resource.RLIMIT_NOFILE, (2048, rlimit[1]))\...
#!/usr/bin/env python import numpy as np import pandas as pd import matplotlib.pyplot as plt import pandas from collections import defaultdict from matplotlib.colors import ListedColormap from argparse import ArgumentParser def transform_dict(edge_dict): """ Transforms a dictionary of dictionaries to flip ke...
[ "matplotlib.pyplot.scatter", "collections.defaultdict", "matplotlib.pyplot.contourf", "numpy.arange", "numpy.unique" ]
[((388, 401), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (399, 401), False, 'from collections import defaultdict\n'), ((847, 860), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (858, 860), False, 'from collections import defaultdict\n'), ((1845, 1892), 'matplotlib.pyplot.contourf', 'plt.c...
import numpy as np import matplotlib.pyplot as plt import os datosLF = np.loadtxt('LaxFriedrichs_finalstate.dat') datosUG = np.loadtxt('UpwindGodunov_finalstate.dat') datosAN = np.loadtxt('Analytic.dat') os.system('mkdir Plots/') results=['Density','Velocity','Energy','Pressure'] i=1 for label in results: fig = p...
[ "matplotlib.pyplot.subplot", "os.system", "numpy.amax", "matplotlib.pyplot.figure", "numpy.loadtxt", "matplotlib.pyplot.savefig" ]
[((72, 114), 'numpy.loadtxt', 'np.loadtxt', (['"""LaxFriedrichs_finalstate.dat"""'], {}), "('LaxFriedrichs_finalstate.dat')\n", (82, 114), True, 'import numpy as np\n'), ((125, 167), 'numpy.loadtxt', 'np.loadtxt', (['"""UpwindGodunov_finalstate.dat"""'], {}), "('UpwindGodunov_finalstate.dat')\n", (135, 167), True, 'imp...
import argparse import logging import os import torch from torchvision.models.detection import maskrcnn_resnet50_fpn import transforms as T from dataloader import TinyVocDataset from engine import train_one_epoch, evaluate, my_eval import utils logger = logging.getLogger(__name__) def get_args(): """ Argument p...
[ "torch.optim.lr_scheduler.StepLR", "argparse.ArgumentParser", "engine.my_eval", "logging.getLogger", "os.path.isfile", "torch.device", "torch.no_grad", "os.path.join", "transforms.ColorJitter", "torch.utils.data.DataLoader", "torch.load", "torchvision.models.detection.maskrcnn_resnet50_fpn", ...
[((256, 283), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (273, 283), False, 'import logging\n'), ((368, 393), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (391, 393), False, 'import argparse\n'), ((3618, 3639), 'transforms.Compose', 'T.Compose', (['transform...
import numpy as np import pandas as pd import pandas.util.testing as tm import pytest import pandas_datareader.data as web pytestmark = pytest.mark.stable class TestEcondb(object): def test_get_cdh_e_fos(self): # EUROSTAT # Employed doctorate holders in non managerial and non professional ...
[ "pandas.DataFrame", "pandas.Timestamp", "pandas.util.testing.assert_frame_equal", "pandas.date_range", "pandas.DatetimeIndex", "pandas.MultiIndex.from_product", "numpy.array", "pandas.Series", "pandas.util.testing.assert_series_equal" ]
[((858, 905), 'pandas.MultiIndex.from_product', 'pd.MultiIndex.from_product', (['levels'], {'names': 'names'}), '(levels, names=names)\n', (884, 905), True, 'import pandas as pd\n'), ((924, 990), 'pandas.DatetimeIndex', 'pd.DatetimeIndex', (["['2006-01-01', '2009-01-01']"], {'name': '"""TIME_PERIOD"""'}), "(['2006-01-0...
import cv2 import os import numpy as np image_folder = 'viss' mt_image_folder = '/home/fothar/MaskTrackRCNN/None/' def imFunc(e): return int(e[:-4]) def sceneFunc(e): return int(e) scenes = [scene for scene in os.listdir(image_folder) if os.path.isdir(os.path.join(image_folder, scene))] scenes.sort(key=scen...
[ "cv2.VideoWriter_fourcc", "cv2.destroyAllWindows", "os.path.join", "os.listdir", "numpy.concatenate" ]
[((517, 550), 'os.path.join', 'os.path.join', (['image_folder', 'scene'], {}), '(image_folder, scene)\n', (529, 550), False, 'import os\n'), ((1141, 1164), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1162, 1164), False, 'import cv2\n'), ((222, 246), 'os.listdir', 'os.listdir', (['image_folder']...
# Copyright 2020 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
[ "scipy.stats.norm.rvs", "numpy.zeros", "numpy.ones", "numpy.random.RandomState", "matched_markets.methodology.utils.kwarg_subdict", "matched_markets.methodology.semantics.GroupSemantics", "numpy.hstack", "matched_markets.methodology.semantics.DataFrameNameMapping", "numpy.random.randint", "numpy.a...
[((4305, 4342), 'matched_markets.methodology.utils.kwarg_subdict', 'utils.kwarg_subdict', (['"""key_"""'], {}), "('key_', **kwargs)\n", (4324, 4342), False, 'from matched_markets.methodology import utils\n'), ((4364, 4411), 'matched_markets.methodology.semantics.DataFrameNameMapping', 'semantics.DataFrameNameMapping', ...
# This module is to plot the basic map and stations and epicenter def p(lat0=0,lon0=0,lat=1,lon=1,stlas= [47.761659, 48.7405, 49.755100, 45.737167],stlos= [12.864466, 11.8671, 10.849660, 14.795714],name='stations.pdf',marker='^',color='g'): import numpy as np import matplotlib.pyplot as plt from mpl_toolki...
[ "numpy.arange", "mpl_toolkits.basemap.Basemap", "matplotlib.pyplot.savefig", "matplotlib.pyplot.clf" ]
[((355, 364), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (362, 364), True, 'import matplotlib.pyplot as plt\n'), ((389, 556), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'llcrnrlon': 'lon0', 'llcrnrlat': 'lat0', 'urcrnrlon': '(lon0 + lon)', 'urcrnrlat': '(lat0 + lat)', 'projection': '"""cass"""', 'lat_0...
#!/usr/bin/env python3 import os import sys sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'src')] sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))] import fire import json import os import numpy as np import tensorflow as tf import tflex i...
[ "encoder.get_encoder", "os.path.abspath", "json.load", "numpy.random.seed", "fire.Fire", "tflex.Saver", "random.randint", "tflex.latest_checkpoint", "tensorflow.set_random_seed", "tensorflow.placeholder", "model.default_hparams", "sys.stdout.flush", "sample.sample_sequence", "tensorflow.Gr...
[((2235, 2266), 'encoder.get_encoder', 'encoder.get_encoder', (['model_name'], {}), '(model_name)\n', (2254, 2266), False, 'import model, sample, encoder\n'), ((2281, 2304), 'model.default_hparams', 'model.default_hparams', ([], {}), '()\n', (2302, 2304), False, 'import model, sample, encoder\n'), ((4164, 4189), 'fire....
import torch from torch.nn import ModuleList, Parameter from dpm.distributions import ( Bernoulli, Categorical, Normal, Data, Distribution ) from dpm.train import train from dpm.criterion import cross_entropy import numpy as np class LinearDiscriminantAnalysis(Distribution): def __init__(self, n_classes=2, n...
[ "torch.ones", "dpm.train.train", "torch.eye", "torch.nn.ModuleList", "torch.randn", "dpm.distributions.Data", "numpy.arange", "torch.rand", "dpm.distributions.Normal" ]
[((754, 819), 'dpm.distributions.Normal', 'Normal', (['self.x_means[class_num]', 'self.covariance'], {'learnable': '(False)'}), '(self.x_means[class_num], self.covariance, learnable=False)\n', (760, 819), False, 'from dpm.distributions import Bernoulli, Categorical, Normal, Data, Distribution\n'), ((1658, 1668), 'dpm.d...
import json import hashlib from typing import List, Set from collections import defaultdict import feather import numpy as np import pandas as pd from scipy import sparse as sp import config as cfg class ProductEncoder: def __init__(self, product_csv_path): self.product_idx = {} self.product_pid...
[ "json.loads", "feather.write_dataframe", "pandas.read_csv", "collections.defaultdict", "numpy.array", "pandas.Series" ]
[((3096, 3112), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (3107, 3112), False, 'from collections import defaultdict\n'), ((4081, 4159), 'feather.write_dataframe', 'feather.write_dataframe', (['df_scores', "(cfg.ASSETS_DIR / 'implicit_scores.feather')"], {}), "(df_scores, cfg.ASSETS_DIR / 'impl...
import os os.environ["BLIS_NUM_THREADS"] = '1' os.environ["OPENBLAS_NUM_THREADS"] = '1' os.environ["MKL_NUM_THREADS"] = '1' os.environ["OMP_NUM_THREADS"] = '1' os.environ["NUMEXPR_NUM_THREADS"] = '1' os.environ["VECLIB_MAXIMUM_THREADS"] = "1" os.environ["MKL_DEBUG_CPU_TYPE"] = "5" import numpy as np from numpy import...
[ "pickle.dump", "numpy.random.seed", "argparse.ArgumentParser", "numpy.log", "warnings.filterwarnings", "numpy.random.rand", "numpy.__config__.show", "mkl.set_num_threads", "numpy.zeros", "time.time", "sklearn.linear_model.LogisticRegression", "numpy.arange", "numpy.random.permutation", "nu...
[((512, 574), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (535, 574), False, 'import warnings\n'), ((575, 632), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarn...
import numpy as np import requests import re # generate sentences base on letters. Model is trained with Alice's Adventures in Wonderland # example output "'Oh, I BEL yourt!' Saic 'Alice thing seemst,' # Alice reminused all cranged at the end of everying and bring rause def sigmoid(x): return 1 / (1 + np.exp(-x))...
[ "numpy.sum", "numpy.ones", "numpy.random.randint", "numpy.arange", "numpy.exp", "numpy.zeros_like", "numpy.random.randn", "numpy.max", "requests.get", "re.sub", "numpy.vectorize", "numpy.tanh", "numpy.square", "numpy.random.permutation", "numpy.random.uniform", "numpy.log", "numpy.ze...
[((347, 357), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (354, 357), True, 'import numpy as np\n'), ((8899, 8932), 'numpy.zeros', 'np.zeros', (['(text_size, vocab_size)'], {}), '((text_size, vocab_size))\n', (8907, 8932), True, 'import numpy as np\n'), ((9236, 9271), 'numpy.random.uniform', 'np.random.uniform', (['...
import numpy as np import matplotlib.pyplot as plt import h5py freq = np.linspace(1/30, 3/30, 200) wav = 1/freq with h5py.File("../../build/scat.h5", 'r') as f: inc = f["sources/tfsf/flux"][...] F = f["monitors/box_monitor/monitor_0/force"][...] T = f["monitors/box_monitor/monitor_0/torque"][...] plt...
[ "h5py.File", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.linspace" ]
[((71, 103), 'numpy.linspace', 'np.linspace', (['(1 / 30)', '(3 / 30)', '(200)'], {}), '(1 / 30, 3 / 30, 200)\n', (82, 103), True, 'import numpy as np\n'), ((676, 688), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (686, 688), True, 'import matplotlib.pyplot as plt\n'), ((689, 699), 'matplotlib.pyplot.sho...
# Author: <NAME> (<EMAIL>), <NAME> (<EMAIL>) # GitHub: https://github.com/chhwang/cmcl # ============================================================================== from __future__ import print_function from datetime import datetime import tensorflow as tf import numpy as np import cifar import svhn import time, sys...
[ "tensorflow.app.flags.DEFINE_float", "tensorflow.get_collection", "tensorflow.local_variables_initializer", "tensorflow.ConfigProto", "tensorflow.app.flags.DEFINE_boolean", "sys.stdout.flush", "tensorflow.app.flags.DEFINE_integer", "os.path.exists", "model.build", "tensorflow.summary.FileWriter", ...
[((326, 417), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""data_dir"""', '"""./dataset"""', '"""Directoty to store input dataset"""'], {}), "('data_dir', './dataset',\n 'Directoty to store input dataset')\n", (352, 417), True, 'import tensorflow as tf\n'), ((414, 486), 'tensorflow.app.fl...
# -*- coding: utf-8 -*- # Copyright © 2017-2018 <NAME> # https://github.com/jnsebgosselin/pygld # # This file is part of PyGLD. # Licensed under the terms of the MIT License. # ---- Standard imports import copy # ---- Third party imports import numpy as np from scipy import interpolate import os.path as osp # ---...
[ "numpy.load", "numpy.size", "numpy.copy", "pygld.utils.strformating.array_to_str", "scipy.interpolate.griddata", "copy.copy", "numpy.array", "numpy.interp", "os.path.join" ]
[((3249, 3282), 'pygld.utils.strformating.array_to_str', 'array_to_str', (['self.Tref', '"""{:.1f}"""'], {}), "(self.Tref, '{:.1f}')\n", (3261, 3282), False, 'from pygld.utils.strformating import array_to_str\n'), ((3346, 3378), 'pygld.utils.strformating.array_to_str', 'array_to_str', (['self.rho', '"""{:.2f}"""'], {})...
#!/bin/env python import argparse import numpy as np import matplotlib.pyplot as plt import yt def doit(outfile="hse.png"): low = yt.load("flame_wave_128_plt01600") med = yt.load("flame_wave_256_plt03200") high = yt.load("flame_wave_512_plt06400") fig, ax = plt.subplots(1,1) for ds, l in [(lo...
[ "numpy.argsort", "yt.load", "matplotlib.pyplot.subplots", "argparse.ArgumentParser" ]
[((139, 173), 'yt.load', 'yt.load', (['"""flame_wave_128_plt01600"""'], {}), "('flame_wave_128_plt01600')\n", (146, 173), False, 'import yt\n'), ((184, 218), 'yt.load', 'yt.load', (['"""flame_wave_256_plt03200"""'], {}), "('flame_wave_256_plt03200')\n", (191, 218), False, 'import yt\n'), ((230, 264), 'yt.load', 'yt.loa...
"""***************************************************************************************** MIT License Copyright (c) 2019 <NAME>, <NAME>, <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 Softwa...
[ "numpy.sum", "numpy.abs", "numpy.linalg.qr", "numpy.einsum", "numpy.ones", "helper_functions.test_model", "numpy.linalg.norm", "numpy.diag", "helper_functions.get_new_clf", "numpy.random.randn", "numpy.power", "numpy.append", "numpy.max", "helper_functions.Fast_Caratheodory", "helper_fun...
[((3415, 3432), 'numpy.array', 'np.array', (['[p, p2]'], {}), '([p, p2])\n', (3423, 3432), True, 'import numpy as np\n'), ((4763, 4808), 'helper_functions.Fast_Caratheodory', 'Fast_Caratheodory', (['Qset.P', 'Qset.W', '(Qset.d + 1)'], {}), '(Qset.P, Qset.W, Qset.d + 1)\n', (4780, 4808), False, 'from helper_functions im...
""" Here lie methods for ouputing as images--aka Graphics. R.I.P """ import matplotlib.pyplot as plt import numpy as np from .generate import error def draw_canvas(canvas, max_height): """ Draw the given table """ fig, ax = plt.subplots(1, 1) ax.pcolor(canvas, cmap="RdBu") ax.set_ylim(0, np.m...
[ "matplotlib.pyplot.legend", "numpy.max", "numpy.mean", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((243, 261), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (255, 261), True, 'import matplotlib.pyplot as plt\n'), ((404, 459), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""canvas.jpg"""'], {'dpi': '(500)', 'bbox_inches': '"""tight"""'}), "('canvas.jpg', dpi=500, bbox_inches='tig...
###### IMPORTS ###### # General import os import sys import cv2 import glob import json import shutil import subprocess import argparse import numpy as np # Import other python files import utils.general as general_utils import utils.image as image_utils import utils.ffmpeg as ffmpeg_utils import modules.user_interac...
[ "utils.general.log_data", "argparse.ArgumentParser", "utils.general.select_file", "numpy.product", "utils.general.setup_draw_img", "sys.stdout.flush", "glob.glob", "os.path.join", "utils.image.adaptive_thresholding", "numpy.zeros_like", "cv2.cvtColor", "cv2.imwrite", "numpy.max", "utils.ff...
[((662, 732), 'utils.general.make_directory', 'general_utils.make_directory', (['dirname'], {'root': 'data_root', 'remove_old': '(True)'}), '(dirname, root=data_root, remove_old=True)\n', (690, 732), True, 'import utils.general as general_utils\n'), ((1223, 1263), 'numpy.logical_and', 'np.logical_and', (['condition_1',...
from io import StringIO from numpy import zeros, array def bytes_to_octal(bytestr): # calculate best possible number of digits digits = int(len(bytestr) * 8/3) # generate format string fmt = b"%%0%do" % digits # convert bytes to int and format as octal string octal = fmt % int.from_bytes(bytest...
[ "numpy.array", "io.StringIO", "numpy.zeros" ]
[((1594, 1604), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1602, 1604), False, 'from io import StringIO\n'), ((926, 937), 'numpy.zeros', 'zeros', (['size'], {}), '(size)\n', (931, 937), False, 'from numpy import zeros, array\n'), ((966, 977), 'numpy.array', 'array', (['size'], {}), '(size)\n', (971, 977), False, 'fr...
""" File Name: test_set_random_seed.py Project: dl-project-template File Description: """ import random import unittest from typing import Tuple import torch import numpy as np from src.utilities import set_random_seed _RANDOM_SEED: int = random.randint(0, 100) _TEST_TUPLE_SIZE: Tuple[int, int...
[ "unittest.main", "random.randint", "src.utilities.set_random_seed", "random.random", "numpy.random.random", "torch.rand" ]
[((265, 287), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (279, 287), False, 'import random\n'), ((365, 437), 'src.utilities.set_random_seed', 'set_random_seed', ([], {'random_seed': '_RANDOM_SEED', 'deterministic_cudnn_flag': '(True)'}), '(random_seed=_RANDOM_SEED, deterministic_cudnn_fla...
import gym import numpy as np import pytest import torch as T from pearll.buffers import ReplayBuffer from pearll.buffers.rollout_buffer import RolloutBuffer from pearll.common.type_aliases import Trajectories env = gym.make("CartPole-v0") @pytest.mark.parametrize("buffer_class", [ReplayBuffer, RolloutBuffer]) def ...
[ "gym.vector.make", "gym.make", "numpy.testing.assert_array_almost_equal", "numpy.zeros", "numpy.array", "numpy.random.rand", "pytest.mark.parametrize", "pearll.buffers.ReplayBuffer", "numpy.concatenate" ]
[((218, 241), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (226, 241), False, 'import gym\n'), ((245, 315), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""buffer_class"""', '[ReplayBuffer, RolloutBuffer]'], {}), "('buffer_class', [ReplayBuffer, RolloutBuffer])\n", (268, 315), F...
#!/usr/bin/env python # coding: utf-8 # In[1]: import tensorflow as tf try: from tensorflow.python.framework import ops except: print("No module named 'tensorflow.python.framework'"+tf.__version__) ops.reset_default_graph() # In[2]: print(tf.__version__) # In[3]: tf.compat.v1.disable_eager_execution(...
[ "tensorflow.compat.v1.identity", "tensorflow.zeros_like", "tensorflow.compat.v1.disable_eager_execution", "matplotlib.pyplot.figure", "tensorflow.compat.v1.truncated_normal", "tensorflow.python.framework.ops.reset_default_graph", "tensorflow.compat.v1.random_shuffle", "tensorflow.compat.v1.global_vari...
[((209, 234), 'tensorflow.python.framework.ops.reset_default_graph', 'ops.reset_default_graph', ([], {}), '()\n', (232, 234), False, 'from tensorflow.python.framework import ops\n'), ((283, 321), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (319, 321), True, ...
import numpy as np import pytest import torch from ase import Atoms from schnetpack import environment as env __all__ = [ "single_atom", "two_atoms", "single_site_crystal", "two_site_crystal", "crystal", "h2o", "o2", "simple_env", "ase_env", "torch_env", ] @pytest.fixture def...
[ "schnetpack.environment.SimpleEnvironmentProvider", "pytest.fixture", "torch.device", "schnetpack.environment.AseEnvironmentProvider", "numpy.random.rand", "numpy.eye", "ase.Atoms" ]
[((771, 800), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[0, 1]'}), '(params=[0, 1])\n', (785, 800), False, 'import pytest\n'), ((347, 386), 'ase.Atoms', 'Atoms', (['[6]'], {'positions': '[[0.0, 0.0, 0.0]]'}), '([6], positions=[[0.0, 0.0, 0.0]])\n', (352, 386), False, 'from ase import Atoms\n'), ((433, 492), ...
"""Performs vector and matrix operations. 2020, <NAME> <<EMAIL>> """ # external imports import numpy as np def shift_vector(*, vec: np.ndarray, shift: int) -> np.ndarray: """Shifts positions of a 1d array. If `shift` is negative, values move down. Replaces null values with 0. Output vector has same...
[ "numpy.zeros_like", "numpy.triu", "numpy.sum", "numpy.flip", "numpy.roll", "numpy.apply_along_axis" ]
[((3256, 3268), 'numpy.triu', 'np.triu', (['mat'], {}), '(mat)\n', (3263, 3268), True, 'import numpy as np\n'), ((3283, 3306), 'numpy.sum', 'np.sum', (['aux_mat'], {'axis': '(1)'}), '(aux_mat, axis=1)\n', (3289, 3306), True, 'import numpy as np\n'), ((3915, 3941), 'numpy.triu', 'np.triu', (['mat'], {'k': '(-row_shift)'...
from __future__ import absolute_import, division, print_function, unicode_literals import numpy as np import tensorflow as tf from itertools import cycle DISTRIBUTED_LAYERS = False def gelu(x): """Gaussian Error Linear Unit. This is a smoother version of the RELU. Original paper: https://arxiv.org/abs...
[ "numpy.load", "tensorflow.reduce_sum", "tensorflow.keras.layers.Dense", "tensorflow.reshape", "tensorflow.keras.layers.LayerNormalization", "tensorflow.matmul", "numpy.sqrt", "tensorflow.nn.softmax", "tensorflow.concat", "tensorflow.cast", "tensorflow.squeeze", "tensorflow.broadcast_to", "te...
[((1279, 1312), 'tensorflow.matmul', 'tf.matmul', (['q', 'k'], {'transpose_b': '(True)'}), '(q, k, transpose_b=True)\n', (1288, 1312), True, 'import tensorflow as tf\n'), ((1714, 1761), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['scaled_attention_logits'], {'axis': '(-1)'}), '(scaled_attention_logits, axis=-1)\n', (17...
#!/usr/bin/env python3 import numpy as np #import numpy library #integers i=10 #integer print(type(i)) #print out the data type of i a_i = np.zeros(i,dtype=int) #delcare an array of integers print(type(a_i)) #will return ndarray print(type(a_i[0])) #will return int64 #floats x=119.0 #flo...
[ "numpy.zeros" ]
[((155, 177), 'numpy.zeros', 'np.zeros', (['i'], {'dtype': 'int'}), '(i, dtype=int)\n', (163, 177), True, 'import numpy as np\n'), ((491, 515), 'numpy.zeros', 'np.zeros', (['i'], {'dtype': 'float'}), '(i, dtype=float)\n', (499, 515), True, 'import numpy as np\n')]
# coding: utf-8 from loss import * import pandas as pd import numpy as np import os import time import math import argparse import torch from glob import glob from tqdm import tqdm from torch.utils.data import DataLoader from torch import nn, optim from torch.utils.data.sampler import BatchSampler, RandomSampler, Se...
[ "argparse.ArgumentParser", "numpy.argmax", "pandas.read_csv", "torch.nn.Softmax", "albumentations.Normalize", "os.path.join", "torch.utils.data.dataset.random_split", "torch.utils.data.DataLoader", "albumentations.Cutout", "torch.load", "albumentations.SmallestMaxSize", "data.TestDataset", "...
[((790, 815), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (813, 815), False, 'import argparse\n'), ((3736, 3781), 'data.TrainDataset', 'TrainDataset', (['args'], {'transform': 'train_transform'}), '(args, transform=train_transform)\n', (3748, 3781), False, 'from data import TrainDataset, Tes...
""" CNN Model: Handles anything related to the Convolutional Neural Network """ import torch import numpy as np # import PyTorch Functionalities import torch.nn.functional as F import torch.nn as nn # import own modules import loghub ''' //////////////////////////////////////////////////////////////////////////////...
[ "torch.nn.Dropout", "numpy.asarray", "torch.nn.Conv2d", "torch.nn.BatchNorm2d", "torch.nn.functional.nll_loss", "torch.nn.functional.log_softmax", "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.nn.functional.relu", "torch.no_grad", "numpy.concatenate", "torch.from_numpy" ]
[((4963, 4977), 'numpy.asarray', 'np.asarray', (['[]'], {}), '([])\n', (4973, 4977), True, 'import numpy as np\n'), ((6643, 6657), 'numpy.asarray', 'np.asarray', (['[]'], {}), '([])\n', (6653, 6657), True, 'import numpy as np\n'), ((1639, 1730), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'in_channel', 'out_ch...
from __future__ import print_function from django.core.cache import cache from rest_framework.authentication import BasicAuthentication from drf_disable_csrf import CsrfExemptSessionAuthentication import hashlib import json import logging import numpy as np from os import path from django.http import HttpResponse, ...
[ "fragments.utils.rel_loci_2_obj", "django.http.JsonResponse", "json.dumps", "rest_framework.decorators.authentication_classes", "numpy.around", "fragments.models.ChromInfo.objects.get", "os.path.join", "fragments.models.ChromSizes.objects.get", "django.http.HttpResponse", "fragments.utils.calc_mea...
[((744, 771), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (761, 771), False, 'import logging\n'), ((852, 870), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (860, 870), False, 'from rest_framework.decorators import api_view, authentication_classe...
import numpy as np import cirq import matplotlib.pyplot as plt class QftInverse(cirq.Gate): """Quantum gate for the inverse Quantum Fourier Transformation """ def __init__(self, num_qubits): super(QftInverse, self) self._num_qubits = num_qubits def num_qubits(self): return sel...
[ "matplotlib.pyplot.clf", "numpy.exp", "numpy.round", "cirq.TwoQubitMatrixGate", "cirq.Simulator", "cirq.X.on_each", "matplotlib.pyplot.xticks", "matplotlib.pyplot.axhline", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "cirq.GridQubit", "cirq.H.on_each", "cirq.H", "cirq.SingleQubit...
[((6752, 6804), 'matplotlib.pyplot.plot', 'plt.plot', (['xint', 'Success'], {'label': '"""1 qubit Hamiltonian"""'}), "(xint, Success, label='1 qubit Hamiltonian')\n", (6760, 6804), True, 'import matplotlib.pyplot as plt\n'), ((7076, 7128), 'matplotlib.pyplot.plot', 'plt.plot', (['xint', 'Success'], {'label': '"""2 qubi...
print(__doc__) # ref: http://www.agcross.com/blog/2015/02/05/random-forests-in-python-with-scikit-learn/ from sklearn.ensemble import RandomForestClassifier as RFC from sklearn.datasets import load_iris import numpy as np import pandas as pd import matplotlib.pyplot as plt iris = load_iris() df = pd.DataFrame(iris.da...
[ "pandas.DataFrame", "sklearn.datasets.load_iris", "sklearn.ensemble.RandomForestClassifier", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "pandas.crosstab", "pandas.Categorical.from_codes", "numpy.argsort", "matplotlib.pyplot.figure", "pandas.factorize", "matplotlib.pyplot.xlabel" ]
[((283, 294), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (292, 294), False, 'from sklearn.datasets import load_iris\n'), ((300, 351), 'pandas.DataFrame', 'pd.DataFrame', (['iris.data'], {'columns': 'iris.feature_names'}), '(iris.data, columns=iris.feature_names)\n', (312, 351), True, 'import pandas as...
from typing import List, Iterable, Callable import numpy as np from plotly import graph_objects as go import plotly.express as px import matplotlib.pyplot as plt from matplotlib import offsetbox from sklearn.manifold import TSNE from sklearn.preprocessing import MinMaxScaler def visualize_3d_data(x_data: np.ndarray,...
[ "numpy.sum", "plotly.graph_objects.Scatter3d", "sklearn.preprocessing.MinMaxScaler", "numpy.linalg.norm", "matplotlib.offsetbox.OffsetImage", "matplotlib.pyplot.close", "numpy.max", "numpy.reshape", "matplotlib.pyplot.subplots", "numpy.stack", "plotly.graph_objects.Scatter", "plotly.express.im...
[((923, 934), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (932, 934), True, 'from plotly import graph_objects as go\n'), ((1983, 1994), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (1992, 1994), True, 'from plotly import graph_objects as go\n'), ((4533, 4544), 'plotly.graph_objects.Fi...
import os import sys import sys,os target_prefix = sys.prefix for i in range(len(sys.argv)): a = sys.argv[i] if a=='--prefix': target_prefix=sys.argv[i+1] sp = a.split("--prefix=") if len(sp)==2: target_prefix=sp[1] sys.path.insert(0,os.path.join(target_prefix,'lib','python%i.%i' % sys.v...
[ "os.path.join", "numpy.distutils.core.Extension" ]
[((266, 359), 'os.path.join', 'os.path.join', (['target_prefix', '"""lib"""', "('python%i.%i' % sys.version_info[:2])", '"""site-packages"""'], {}), "(target_prefix, 'lib', 'python%i.%i' % sys.version_info[:2],\n 'site-packages')\n", (278, 359), False, 'import sys, os\n'), ((1326, 1396), 'numpy.distutils.core.Extens...
""" This script computes the persistence landscape of the Cantor triangle. authors: <NAME>, <NAME> """ import numpy as np from ripser import ripser from persim.landscapes import PersLandscapeApprox from persim.landscapes import plot_landscape import matplotlib.pyplot as plt from persim import plot_diagrams #%% Ini...
[ "matplotlib.pyplot.title", "ripser.ripser", "persim.landscapes.plot_landscape", "persim.landscapes.PersLandscapeApprox", "matplotlib.pyplot.scatter", "matplotlib.pyplot.figure", "numpy.array", "persim.plot_diagrams", "numpy.concatenate" ]
[((505, 539), 'numpy.array', 'np.array', (['[[0, 0], [1, 0], [0, 1]]'], {}), '([[0, 0], [1, 0], [0, 1]])\n', (513, 539), True, 'import numpy as np\n'), ((801, 827), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 5)'}), '(figsize=(5, 5))\n', (811, 827), True, 'import matplotlib.pyplot as plt\n'), ((880,...
#!/usr/local/bin/python3 """ This module has the utilities to normalize the reads by a threshold T (the smallest number of total reads among all the samples). To normalize, we get the threshold and then we randomly pick T reads from each sample. NOTE: - column -> sample - row -> family - cell -> number of reads of a c...
[ "pandas.DataFrame", "tqdm.tqdm", "numpy.random.seed", "argparse.ArgumentParser", "dataloader.to_csv", "numpy.count_nonzero", "os.path.basename", "os.path.dirname", "dataloader.load_csv", "numpy.array", "numpy.random.shuffle", "numpy.repeat" ]
[((1378, 1407), 'numpy.array', 'numpy.array', (['non_zero_indexes'], {}), '(non_zero_indexes)\n', (1389, 1407), False, 'import numpy\n'), ((1425, 1477), 'numpy.repeat', 'numpy.repeat', (['non_zero_indexes', 'non_zero_rows_values'], {}), '(non_zero_indexes, non_zero_rows_values)\n', (1437, 1477), False, 'import numpy\n'...
import numpy as np from matplotlib import pyplot as plt ts = np.load("data/33cd9a03-acf3-4b36-8ebc-6937f066196d/output.npy") x = ts[:,0] y = ts[:,1] plt.plot(x,y) plt.show()
[ "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.plot" ]
[((62, 125), 'numpy.load', 'np.load', (['"""data/33cd9a03-acf3-4b36-8ebc-6937f066196d/output.npy"""'], {}), "('data/33cd9a03-acf3-4b36-8ebc-6937f066196d/output.npy')\n", (69, 125), True, 'import numpy as np\n'), ((152, 166), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (160, 166), True, 'from mat...
# python align.py --camera=nikon --focal_length=21 import argparse import glob import tqdm import os import os.path as op import json import utils from dataset import Dataset, SUPPORTED_ANNO_EXT import rawpy import numpy as np import cv2 from skimage.exposure import match_histograms, equalize_hist import skimage.filt...
[ "argparse.ArgumentParser", "cv2.SIFT_create", "os.path.join", "dataset.Dataset", "cv2.cvtColor", "cv2.imwrite", "rawpy.imread", "datetime.datetime.now", "cv2.resize", "tqdm.tqdm", "skimage.exposure.match_histograms", "skimage.exposure.equalize_hist", "cv2.FlannBasedMatcher", "numpy.linalg....
[((3312, 3334), 'rawpy.imread', 'rawpy.imread', (['filepath'], {}), '(filepath)\n', (3324, 3334), False, 'import rawpy\n'), ((3430, 3457), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(2)'}), '(img, axis=2)\n', (3444, 3457), True, 'import numpy as np\n'), ((3639, 3756), 'numpy.concatenate', 'np.concatenat...
import tensorflow as tf import numpy as np from network import network def test_network_build(): """ check whether the network is built sucessfully or not """ x = np.float32(np.random.random((3, 128, 128, 3))) blazeface_extractor = network((128, 128, 3)) feature = blazeface_extractor(x) ...
[ "numpy.random.random", "network.network" ]
[((257, 279), 'network.network', 'network', (['(128, 128, 3)'], {}), '((128, 128, 3))\n', (264, 279), False, 'from network import network\n'), ((194, 228), 'numpy.random.random', 'np.random.random', (['(3, 128, 128, 3)'], {}), '((3, 128, 128, 3))\n', (210, 228), True, 'import numpy as np\n')]
"""Collection of functions to run Viterbi algorithms on haploid genotype data, where the data is structured as samples x variants.""" import numba as nb import numpy as np @nb.jit def viterbi_naive_init(n, m, H, s, e, r): """Initialise naive implementation of LS viterbi.""" V = np.zeros((n, m)) P = np.zer...
[ "numpy.copy", "numpy.argmax", "numpy.zeros", "numpy.ones", "numpy.equal", "numpy.amax", "numpy.max", "numpy.tile", "numpy.diag", "numpy.log10" ]
[((289, 305), 'numpy.zeros', 'np.zeros', (['(n, m)'], {}), '((n, m))\n', (297, 305), True, 'import numpy as np\n'), ((705, 716), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (713, 716), True, 'import numpy as np\n'), ((3686, 3696), 'numpy.ones', 'np.ones', (['m'], {}), '(m)\n', (3693, 3696), True, 'import numpy as ...
from multiprocessing import Pool import matplotlib.pyplot as plt import numpy as np from progress.bar import Bar from network_simulator.components import simulator from network_simulator.helpers import writeSimCache, readSimCache def main(): return simulator(g_init_vars, g_aplist, g_usrlist) def mab(init_vars, ap...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.figure", "network_simulator.components.simulator", "numpy.arange" ]
[((254, 297), 'network_simulator.components.simulator', 'simulator', (['g_init_vars', 'g_aplist', 'g_usrlist'], {}), '(g_init_vars, g_aplist, g_usrlist)\n', (263, 297), False, 'from network_simulator.components import simulator\n'), ((601, 623), 'numpy.arange', 'np.arange', (['(0.5)', '(3)', '(0.5)'], {}), '(0.5, 3, 0....
import shutil import os import fire import numpy as np import cv2 import geopandas as gpd import skimage.io from tqdm import tqdm from scipy import ndimage as ndi from skimage import measure from skimage.morphology import dilation, square, watershed from scipy.ndimage import binary_erosion from multiprocessing.pool imp...
[ "os.mkdir", "shutil.rmtree", "os.path.join", "multiprocessing.cpu_count", "numpy.zeros_like", "os.path.exists", "multiprocessing.pool.Pool", "rasterio.features.rasterize", "geopandas.read_file", "tqdm.tqdm", "scipy.ndimage.binary_dilation", "skimage.morphology.watershed", "skimage.morphology...
[((651, 686), 'numpy.zeros_like', 'np.zeros_like', (['labels'], {'dtype': '"""bool"""'}), "(labels, dtype='bool')\n", (664, 686), True, 'import numpy as np\n'), ((1203, 1256), 'os.path.join', 'os.path.join', (['labels_path', "(_id + '_Buildings.geojson')"], {}), "(labels_path, _id + '_Buildings.geojson')\n", (1215, 125...
import torch from torch.utils.data import DataLoader import numpy as np import json from os.path import join from models import utils, caption from datasets import coco from configuration import Config from engine_cap import train_one_epoch, evaluate, get_model_cider_score from vocab import Vocabulary from train_util...
[ "numpy.random.seed", "torch.optim.lr_scheduler.StepLR", "torch.utils.data.RandomSampler", "datasets.coco.build_dataset", "torch.optim.AdamW", "models.utils.get_rank", "torch.device", "os.path.join", "train_utils.save_ckp", "vocab.Vocabulary", "torch.utils.data.DataLoader", "engine_cap.train_on...
[((407, 434), 'torch.device', 'torch.device', (['config.device'], {}), '(config.device)\n', (419, 434), False, 'import torch\n'), ((526, 549), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (543, 549), False, 'import torch\n'), ((554, 574), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '...
""" =========================== Partial Dependence Plots 2D =========================== Hvass-Labs Dec 2017 <NAME> 2020 .. currentmodule:: skopt Simple example to show the new 2D plots. """ print(__doc__) import numpy as np from math import exp from skopt import gp_minimize from skopt.space import Real, Categorical...
[ "skopt.gp_minimize", "math.exp", "numpy.random.seed", "skopt.space.Categorical", "matplotlib.pyplot.show", "skopt.plots.plot_objective", "skopt.plots.plot_objective_2D", "skopt.space.Integer", "skopt.plots.plot_histogram", "skopt.space.Real", "numpy.random.rand", "skopt.utils.point_asdict" ]
[((441, 460), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (455, 460), True, 'import numpy as np\n'), ((592, 661), 'skopt.space.Real', 'Real', ([], {'name': '"""learning_rate"""', 'low': '(1e-06)', 'high': '(0.01)', 'prior': '"""log-uniform"""'}), "(name='learning_rate', low=1e-06, high=0.01, prio...
import numpy as np def eos_trim(v): try: return (''.join(v[0:np.where(v=='<eos>')[0][0]])).strip() except: return (''.join(v)).strip()
[ "numpy.where" ]
[((74, 96), 'numpy.where', 'np.where', (["(v == '<eos>')"], {}), "(v == '<eos>')\n", (82, 96), True, 'import numpy as np\n')]
# isolated cassie env from cassie_m.cassiemujoco import pd_in_t, state_out_t, CassieSim, CassieVis from loadstep import CassieTrajectory from quaternion_function import * from phase_function import * from math import floor import gym from gym import spaces import numpy as np import os import random import copy import...
[ "numpy.random.uniform", "cassie_m.cassiemujoco.CassieVis", "numpy.sum", "random.randint", "numpy.copy", "numpy.zeros", "numpy.clip", "numpy.array", "gym.spaces.Box", "loadstep.CassieTrajectory", "cassie_m.cassiemujoco.pd_in_t", "numpy.exp", "cassie_m.cassiemujoco.CassieSim", "cassie_m.cass...
[((622, 644), 'cassie_m.cassiemujoco.CassieSim', 'CassieSim', (['self.config'], {}), '(self.config)\n', (631, 644), False, 'from cassie_m.cassiemujoco import pd_in_t, state_out_t, CassieSim, CassieVis\n'), ((1031, 1063), 'numpy.array', 'np.array', (['[100, 100, 88, 96, 50]'], {}), '([100, 100, 88, 96, 50])\n', (1039, 1...
import os import pickle import numpy as np def parse_sigma_output(f): """ Extract the GW results of a calculation with BerkeleyGW. Returns ------- dict : nspin : int Number of spins nkpt : int Number of k-points nband : int Number of b...
[ "numpy.array", "pickle.load", "numpy.zeros", "os.path.join" ]
[((2375, 2410), 'numpy.zeros', 'np.zeros', (['(nkpt, 3)'], {'dtype': 'np.float'}), '((nkpt, 3), dtype=np.float)\n', (2383, 2410), True, 'import numpy as np\n'), ((2429, 2458), 'numpy.zeros', 'np.zeros', (['nband'], {'dtype': 'np.int'}), '(nband, dtype=np.int)\n', (2437, 2458), True, 'import numpy as np\n'), ((2306, 235...
import bilby import numpy as np # This tutorial demonstrates how we can sample a prior in the shape of a ball # Note that this will not end up sampling uniformly in that space, constraint priors are more suitable for that. # This implementation will draw a value for the x-coordinate from p(x), and given that draw a va...
[ "bilby.core.prior.ConditionalUniform", "bilby.core.prior.ConditionalPriorDict", "bilby.core.prior.Uniform", "bilby.run_sampler", "numpy.sqrt" ]
[((1316, 1355), 'bilby.core.prior.ConditionalPriorDict', 'bilby.core.prior.ConditionalPriorDict', ([], {}), '()\n', (1353, 1355), False, 'import bilby\n'), ((1370, 1436), 'bilby.core.prior.Uniform', 'bilby.core.prior.Uniform', ([], {'minimum': '(-1)', 'maximum': '(1)', 'latex_label': '"""$x$"""'}), "(minimum=-1, maximu...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 30 20:52:19 2017 @author: rahul """ import random import math import numpy import config import data_handler import algorithm def init(): qubit = [] for i in range(0, config.NUM_FEATURES): qubit.append(random.uniform(0, 1)*math.pi...
[ "algorithm.cross_validation_score", "random.uniform", "random.sample", "data_handler.dataset_with_feature_subset", "numpy.mean", "algorithm.train_LR", "math.cos" ]
[((2285, 2308), 'random.sample', 'random.sample', (['index', '(3)'], {}), '(index, 3)\n', (2298, 2308), False, 'import random\n'), ((1438, 1487), 'data_handler.dataset_with_feature_subset', 'data_handler.dataset_with_feature_subset', (['clabits'], {}), '(clabits)\n', (1478, 1487), False, 'import data_handler\n'), ((150...
import numpy as np from ml_tooling.utils import DataType, MetricError def lift_score(y_target: DataType, y_predicted: DataType) -> float: """ Calculates lift score for a given estimator. The lift score quantifies how much better the estimator is compared to a random baseline. The formula is defined ...
[ "ml_tooling.utils.MetricError", "numpy.array", "numpy.sum", "numpy.column_stack" ]
[((609, 627), 'numpy.array', 'np.array', (['y_target'], {}), '(y_target)\n', (617, 627), True, 'import numpy as np\n'), ((646, 667), 'numpy.array', 'np.array', (['y_predicted'], {}), '(y_predicted)\n', (654, 667), True, 'import numpy as np\n'), ((935, 975), 'numpy.column_stack', 'np.column_stack', (['[y_target, y_predi...
"""Tests for nonlinear equations lecture.""" import numpy as np from nonlinear_algorithms import bisect from nonlinear_algorithms import fixpoint from nonlinear_algorithms import newton_method from scipy.optimize import bisect as sp_bisect def test_1(): """Bisection method is working.""" def example(x): ...
[ "nonlinear_algorithms.bisect", "numpy.testing.assert_almost_equal", "nonlinear_algorithms.newton_method", "nonlinear_algorithms.fixpoint", "scipy.optimize.bisect", "numpy.sqrt" ]
[((381, 424), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (['y', '(1.259921)'], {}), '(y, 1.259921)\n', (411, 424), True, 'import numpy as np\n'), ((627, 676), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (['y', '(1.0)'], {'decimal': '(3)'}), '(y, 1.0, decimal=3)\n',...
#!/usr/bin/env python # -*- coding: utf-8; py-indent-offset:4 -*- """ Created on Sat Jul 22 21:44:00 2017 @author: <NAME> """ from sklearn.model_selection import TimeSeriesSplit from sklearn.utils import indexable from sklearn.utils.validation import _num_samples import numpy as np class TimeSeriesSplitImproved(Tim...
[ "sklearn.utils.validation._num_samples", "numpy.arange", "sklearn.utils.indexable" ]
[((4050, 4073), 'sklearn.utils.indexable', 'indexable', (['X', 'y', 'groups'], {}), '(X, y, groups)\n', (4059, 4073), False, 'from sklearn.utils import indexable\n'), ((4094, 4109), 'sklearn.utils.validation._num_samples', '_num_samples', (['X'], {}), '(X)\n', (4106, 4109), False, 'from sklearn.utils.validation import ...
import matplotlib.pyplot as plt import numpy as np from numpy import ptp, var, array, sort, abs, mean, log, exp from numpy import sum as npsum, max as npmax from scipy.optimize import fmin def FitGenParetoMLFP(x, p): # This function finds the parameters csi and theta determining the # Generalized Pareto Dist...
[ "scipy.optimize.fmin", "numpy.abs", "numpy.sum", "numpy.log", "numpy.ptp", "numpy.finfo", "numpy.max", "numpy.mean", "numpy.exp", "numpy.var" ]
[((1274, 1280), 'numpy.ptp', 'ptp', (['x'], {}), '(x)\n', (1277, 1280), False, 'from numpy import ptp, var, array, sort, abs, mean, log, exp\n'), ((1907, 1914), 'numpy.mean', 'mean', (['x'], {}), '(x)\n', (1911, 1914), False, 'from numpy import ptp, var, array, sort, abs, mean, log, exp\n'), ((1924, 1930), 'numpy.var',...
from scipy.io import readsav import matplotlib.dates as mdates import matplotlib as mpl from .lofarJ2000xySun import j2000xy import datetime import glob import os from astropy import units as u from astropy.io import fits from astropy.time import Time import numpy as np from skimage import measure from scipy.interpo...
[ "numpy.abs", "astropy.io.fits.PrimaryHDU", "numpy.ones", "skimage.measure.label", "numpy.mean", "numpy.arange", "numpy.sin", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "numpy.exp", "astropy.io.fits.HDUList", "skimage.measure.regionprops", "numpy.meshgrid", "cv2.dilate", "numpy....
[((695, 734), 'matplotlib.dates.set_epoch', 'mdates.set_epoch', (['"""1970-01-01T00:00:00"""'], {}), "('1970-01-01T00:00:00')\n", (711, 734), True, 'import matplotlib.dates as mdates\n'), ((1092, 1124), 'scipy.io.readsav', 'readsav', (['fname'], {'python_dict': '(True)'}), '(fname, python_dict=True)\n', (1099, 1124), F...
import tensorflow as tf from tensorflow.python.tools import freeze_graph from tensorflow.python.tools import optimize_for_inference_lib from keras import backend as K from keras.models import Sequential, load_model from keras.layers.convolutional import Conv2D from keras.layers.convolutional import MaxPooling2D ...
[ "keras.models.load_model", "keras.preprocessing.image.ImageDataGenerator", "PIL.Image.new", "cnn_utils.set_directories", "random.shuffle", "cnn_utils.get_image_pixels", "keras.layers.Flatten", "PIL.ImageDraw.Draw", "tensorflow.GraphDef", "tensorflow.gfile.FastGFile", "tensorflow.train.Saver", ...
[((1272, 1325), 'numpy.random.rand', 'np.random.rand', (['BATCH_SIZE', 'IMAGE_SIZE', 'IMAGE_SIZE', '(3)'], {}), '(BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 3)\n', (1286, 1325), True, 'import numpy as np\n'), ((1333, 1362), 'numpy.random.rand', 'np.random.rand', (['BATCH_SIZE', '(1)'], {}), '(BATCH_SIZE, 1)\n', (1347, 1362), ...
from sklearn.preprocessing import LabelBinarizer from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.optimizers import SGD from imutils import paths import matplotlib.pyplot as plt impo...
[ "matplotlib.pyplot.title", "sklearn.preprocessing.LabelBinarizer", "argparse.ArgumentParser", "sklearn.model_selection.train_test_split", "tensorflow.keras.optimizers.SGD", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "Chapter15.minivgg.MiniVGGNet.build", "numpy.arange", "imutils.pat...
[((486, 511), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (509, 511), False, 'import argparse\n'), ((819, 853), 'imutils.paths.list_images', 'paths.list_images', (["args['dataset']"], {}), "(args['dataset'])\n", (836, 853), False, 'from imutils import paths\n'), ((1161, 1177), 'numpy.array',...
import math import numpy as np import tensorflow as tf default_settings = { 'batch_size': 16, 'permute_data': False, 'multi_input': False, 'multi_output': False, 'inputs_num': 1, 'outputs_num': 1 } class DataLoader(tf.keras.utils.Sequence): """ Define data sequence...
[ "numpy.array" ]
[((2049, 2065), 'numpy.array', 'np.array', (['inputs'], {}), '(inputs)\n', (2057, 2065), True, 'import numpy as np\n'), ((2271, 2287), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (2279, 2287), True, 'import numpy as np\n'), ((3927, 3946), 'numpy.array', 'np.array', (['data_list'], {}), '(data_list)\n', (...
from dataclasses import dataclass, field, fields from typing import Mapping, Optional, Sequence, Type, Union import numpy as np import xarray as xr from bioimageio.core.statistical_measures import Mean, Measure, Percentile, Std from bioimageio.spec.model.raw_nodes import PostprocessingName, PreprocessingName from ._u...
[ "numpy.atleast_1d", "bioimageio.core.statistical_measures.Std", "typing_extensions.get_args", "bioimageio.core.statistical_measures.Mean", "dataclasses.field", "numpy.array", "xarray.DataArray", "dataclasses.fields", "bioimageio.core.statistical_measures.Percentile", "xarray.ufuncs.exp" ]
[((976, 1012), 'xarray.DataArray', 'xr.DataArray', (['fixed'], {'dims': 'fixed_dims'}), '(fixed, dims=fixed_dims)\n', (988, 1012), True, 'import xarray as xr\n'), ((1352, 1379), 'dataclasses.field', 'field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (1357, 1379), False, 'from dataclasses import dat...
import os, subprocess, argparse, shutil, yaml import SimpleITK as sitk import numpy as np from skimage.io import imread, imsave from glob import glob from skimage.transform import resize from h5py import File def parse_args(): #setup the argument parser parser = argparse.ArgumentParser(description='Setup bench...
[ "os.remove", "h5py.File", "argparse.ArgumentParser", "os.makedirs", "skimage.io.imsave", "numpy.invert", "SimpleITK.ReadImage", "os.path.realpath", "shutil.copy", "SimpleITK.GetArrayFromImage", "SimpleITK.WriteImage", "SimpleITK.GetImageFromArray", "os.path.join", "SimpleITK.Cast", "skim...
[((272, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Setup benchmark dataset directories for NN training and testing"""'}), "(description=\n 'Setup benchmark dataset directories for NN training and testing')\n", (295, 379), False, 'import os, subprocess, argparse, shutil, yaml...
import numpy as np # ALPHABET_ID = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7, "H": 8, "I": 9, "J": 10, "K": 11, "L": 12, # "M": 13, "N": 14, "O": 15, "P": 16, "Q": 17, "R": 18, "S": 19, "T": 20, "U": 21, "V": 22, # "W": 23, "X": 24, "Y": 25, "Z": 0} # # CIPHER_ID = "ZABCDE...
[ "numpy.zeros", "numpy.dot", "numpy.append", "numpy.array" ]
[((398, 425), 'numpy.array', 'np.array', (['[]'], {'dtype': '"""int64"""'}), "([], dtype='int64')\n", (406, 425), True, 'import numpy as np\n'), ((1240, 1264), 'numpy.dot', 'np.dot', (['key', 'from_matrix'], {}), '(key, from_matrix)\n', (1246, 1264), True, 'import numpy as np\n'), ((482, 518), 'numpy.zeros', 'np.zeros'...
import numpy as np from numpy.linalg import norm from ..coordinates import _convertSphericalToCartesian __all__ = ["calcNae", "calcDelta", "calcXae", "calcXa", "calcNhat", "calcR1", "calcR2"] x_axis = np.array([1, 0, 0]) y_axis = np.array([0, 1, 0]) z_...
[ "numpy.radians", "numpy.matrix", "numpy.cross", "numpy.identity", "numpy.array", "numpy.linalg.norm", "numpy.dot" ]
[((269, 288), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (277, 288), True, 'import numpy as np\n'), ((298, 317), 'numpy.array', 'np.array', (['[0, 1, 0]'], {}), '([0, 1, 0])\n', (306, 317), True, 'import numpy as np\n'), ((327, 346), 'numpy.array', 'np.array', (['[0, 0, 1]'], {}), '([0, 0, 1])\n',...
import numpy as np import networkx as nx import w20data import itin servername = 'memex.locale' serverport = 18000 G = nx.Graph() wstore = w20data.Wstorage(ediff=itin.ediff, fpdiff=itin.dist, ntyp=itin.ntyp) saddlehistory = [] localhistory = [] types = np.array([0]) wdis = [] wmodes = [] wsads = [] wlocs = [] wvs ...
[ "numpy.array", "w20data.Wstorage", "networkx.Graph" ]
[((121, 131), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (129, 131), True, 'import networkx as nx\n'), ((141, 209), 'w20data.Wstorage', 'w20data.Wstorage', ([], {'ediff': 'itin.ediff', 'fpdiff': 'itin.dist', 'ntyp': 'itin.ntyp'}), '(ediff=itin.ediff, fpdiff=itin.dist, ntyp=itin.ntyp)\n', (157, 209), False, 'import...
#!/usr/bin/env python import numpy as np import rospy from std_msgs.msg import Int32 from geometry_msgs.msg import PoseStamped from styx_msgs.msg import Lane, Waypoint from scipy.spatial import KDTree import math ''' This node will publish waypoints from the car's current position to some `x` distance ahead. As men...
[ "rospy.logerr", "rospy.Subscriber", "math.sqrt", "styx_msgs.msg.Lane", "rospy.Publisher", "rospy.Rate", "rospy.is_shutdown", "numpy.array", "rospy.init_node", "scipy.spatial.KDTree", "styx_msgs.msg.Waypoint" ]
[((1010, 1045), 'rospy.init_node', 'rospy.init_node', (['"""waypoint_updater"""'], {}), "('waypoint_updater')\n", (1025, 1045), False, 'import rospy\n'), ((1063, 1137), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/current_pose"""', 'PoseStamped', 'self.pose_cb'], {'queue_size': '(1)'}), "('/current_pose', PoseStamped...
import numpy as np import math import pandas as pd from precise.skaters.covarianceutil.pdutil import square_to_square_dataframe, square_to_column_series, square_to_index_series # Functions acting on cov, corrcoef matrices and other square matrices # If square pd.DataFrame are supplied instead, index and columns are pr...
[ "numpy.linalg.eigvals", "numpy.sum", "numpy.allclose", "numpy.shape", "numpy.linalg.svd", "numpy.linalg.norm", "numpy.diag", "numpy.ndarray", "numpy.linalg.solve", "numpy.linalg.pinv", "numpy.copy", "numpy.transpose", "numpy.linalg.matrix_rank", "numpy.linalg.cholesky", "numpy.diagonal",...
[((4022, 4045), 'numpy.ndarray', 'np.ndarray', ([], {'shape': 'shape'}), '(shape=shape)\n', (4032, 4045), True, 'import numpy as np\n'), ((10048, 10069), 'numpy.linalg.solve', 'np.linalg.solve', (['a', 'b'], {}), '(a, b)\n', (10063, 10069), True, 'import numpy as np\n'), ((10778, 10793), 'numpy.transpose', 'np.transpos...
#!/usr/bin/env python3 import os import sys import argparse import re import itertools import numpy as np #PREFIX = os.environ['STATIC_ANALYSIS_KERNEL_DIR'] PREFIX = "" parser = argparse.ArgumentParser(description='Get aliased pair from the SVF result.') parser.add_argument('mssa') parser.add_argument('--aset', dest...
[ "numpy.save", "argparse.ArgumentParser", "re.findall", "numpy.array", "itertools.product", "re.sub" ]
[((181, 257), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get aliased pair from the SVF result."""'}), "(description='Get aliased pair from the SVF result.')\n", (204, 257), False, 'import argparse\n'), ((7692, 7710), 'numpy.array', 'np.array', (['SaveList'], {}), '(SaveList)\n', (770...
import numpy as np from glm import mat4 class Robot: def __init__(self): self.joints = None def initialise(self): """ Initialise joints self.joints is structured such that object at index i-1 is the parent of the object at i :return: """ self.joints = [...
[ "numpy.eye", "numpy.array", "Objects3D.coord_3d.copy", "numpy.deg2rad" ]
[((2353, 2368), 'Objects3D.coord_3d.copy', 'coord_3d.copy', ([], {}), '()\n', (2366, 2368), False, 'from Objects3D import coord_3d\n'), ((2524, 2533), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (2530, 2533), True, 'import numpy as np\n'), ((3464, 3603), 'numpy.array', 'np.array', (['[[c_t, -s_t * c_a, s_t * s_a, se...
import numpy as np import matplotlib.pyplot as pl import platform import os from astropy.io import fits from ipdb import set_trace as stop from astropy.io import fits import scipy.io import time import argparse import h5py from matplotlib.widgets import Slider import matplotlib.animation as manimation from tqdm import ...
[ "argparse.ArgumentParser", "ipdb.set_trace", "matplotlib.widgets.Slider", "tensorflow.ConfigProto", "numpy.mean", "keras.backend.tensorflow_backend.set_session", "matplotlib.pyplot.tight_layout", "sys.path.append", "platform.node", "numpy.std", "matplotlib.pyplot.close", "matplotlib.pyplot.col...
[((678, 708), 'sys.path.append', 'sys.path.append', (['"""../training"""'], {}), "('../training')\n", (693, 708), False, 'import sys\n'), ((369, 384), 'platform.node', 'platform.node', ([], {}), '()\n', (382, 384), False, 'import platform\n'), ((521, 536), 'platform.node', 'platform.node', ([], {}), '()\n', (534, 536),...
import numpy as np import matplotlib.pyplot as plt class Neuron: # Constructor def __init__(self, n_inputs, lRate): self.lRate = lRate self.weights = np.random.rand(n_inputs + 1) * 0.2 - 0.1 # Num. features + 1 (bias) # Prediction def predict(self, inputs): activ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.append", "numpy.random.rand", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gcf", "matplotlib.pyplot.xlabel" ]
[((1324, 1344), 'matplotlib.pyplot.plot', 'plt.plot', (['error_list'], {}), '(error_list)\n', (1332, 1344), True, 'import matplotlib.pyplot as plt\n'), ((1353, 1389), 'matplotlib.pyplot.title', 'plt.title', (['"""Quadratic Error x Epoch"""'], {}), "('Quadratic Error x Epoch')\n", (1362, 1389), True, 'import matplotlib....
import time import base64 from io import BytesIO import numpy as np from PIL import Image import cv2 def log_error(e): ''' use this function to log your errors ''' print(e) time.sleep(1) def decode_img(image): ''' Decode String Image getting from request ''' image = base...
[ "io.BytesIO", "numpy.frombuffer", "cv2.imdecode", "base64.b64decode", "time.sleep", "PIL.Image.open", "base64.b64encode", "cv2.imencode" ]
[((200, 213), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (210, 213), False, 'import time\n'), ((316, 339), 'base64.b64decode', 'base64.b64decode', (['image'], {}), '(image)\n', (332, 339), False, 'import base64\n'), ((352, 366), 'io.BytesIO', 'BytesIO', (['image'], {}), '(image)\n', (359, 366), False, 'from io...
# -*- coding: utf-8 -*- """ @author: mojtabasah """ from ntk_equivalence import fc_kernel, nn_fc import numpy as np import torch import matplotlib.pyplot as plt from scipy.linalg import sqrtm import matplotlib.pyplot as plt import pickle from time import time if __name__ == '__main__': plt.style.us...
[ "ntk_equivalence.nn_fc", "matplotlib.pyplot.plot", "ntk_equivalence.fc_kernel", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "time.time", "matplotlib.pyplot.style.use", "scipy.linalg.sqrtm", "torch.cuda.is_available", "matplotlib.pyplot.figure", "numpy.random.normal", "numpy.eye", ...
[((308, 331), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (321, 331), True, 'import matplotlib.pyplot as plt\n'), ((672, 681), 'numpy.eye', 'np.eye', (['p'], {}), '(p)\n', (678, 681), True, 'import numpy as np\n'), ((716, 724), 'scipy.linalg.sqrtm', 'sqrtm', (['S'], {}), '(S)...
import numpy as np from scipy import optimize def lognorm_reff(mu, sigma2): return np.exp(mu + 5./2.*sigma2) def lognorm_sigma2eff(mu, sigma2): return (np.exp(4.*mu + 8.*sigma2) - np.exp(4.*mu + 7.*sigma2))/np.exp(2.*mu + 2.*sigma2) def lognorm_find_mu_sigma2(reff, sigma2eff): def f(x): mu = x[0]**2. sigma2 =...
[ "numpy.log", "numpy.sum", "numpy.exp" ]
[((85, 116), 'numpy.exp', 'np.exp', (['(mu + 5.0 / 2.0 * sigma2)'], {}), '(mu + 5.0 / 2.0 * sigma2)\n', (91, 116), True, 'import numpy as np\n'), ((211, 242), 'numpy.exp', 'np.exp', (['(2.0 * mu + 2.0 * sigma2)'], {}), '(2.0 * mu + 2.0 * sigma2)\n', (217, 242), True, 'import numpy as np\n'), ((755, 782), 'numpy.exp', '...
""" http://www.swharden.com/blog/2013-05-09-realtime-fft-audio-visualization-with-python/ http://julip.co/2012/05/arduino-python-soundlight-spectrum/ """ import ui_plot import sys import numpy as np from PyQt5 import QtCore, QtWidgets import qwt as Qwt from recorder import * try: _fromUtf8 = QtCore.QString.fromU...
[ "ui_plot.Ui_win_plot", "PyQt5.QtCore.QTimer", "qwt.QwtPlotCurve", "numpy.amax", "ui_plot.QtWidgets.QMainWindow", "numpy.mean", "PyQt5.QtWidgets.QApplication", "sys.exit" ]
[((571, 585), 'numpy.mean', 'np.mean', (['tempo'], {}), '(tempo)\n', (578, 585), True, 'import numpy as np\n'), ((1105, 1137), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1127, 1137), False, 'from PyQt5 import QtCore, QtWidgets\n'), ((1158, 1189), 'ui_plot.QtWidgets.QM...
import time import numpy as np import tensorflow as tf import data_saving as dts class CMESolver(object): """The fully connected neural network model.""" def __init__(self, network, config_data): self.network = network self.config_data = config_data lr_schedule = tf.keras.optimizers.s...
[ "tensorflow.reduce_sum", "tensorflow.keras.layers.Dense", "tensorflow.reshape", "tensorflow.math.reduce_std", "numpy.ones", "data_saving.load_save_sampled_trajectories", "tensorflow.matmul", "tensorflow.Variable", "data_saving.save_sampled_trajectories", "tensorflow.abs", "tensorflow.sin", "te...
[((299, 440), 'tensorflow.keras.optimizers.schedules.PiecewiseConstantDecay', 'tf.keras.optimizers.schedules.PiecewiseConstantDecay', (["config_data['net_config']['lr_boundaries']", "config_data['net_config']['lr_values']"], {}), "(config_data[\n 'net_config']['lr_boundaries'], config_data['net_config']['lr_values']...
import visdom import numpy as np class Visualizer(): def __init__(self, env='main', **kwargs): self.vis = visdom.Visdom(env=env) self.index = {} # x, dict self.log_text = '' self.env = env def plot_train_val(self, loss_train=None, loss_val=None): x = self.index.get('t...
[ "numpy.array", "visdom.Visdom", "numpy.column_stack" ]
[((120, 142), 'visdom.Visdom', 'visdom.Visdom', ([], {'env': 'env'}), '(env=env)\n', (133, 142), False, 'import visdom\n'), ((432, 461), 'numpy.column_stack', 'np.column_stack', (['(loss, loss)'], {}), '((loss, loss))\n', (447, 461), True, 'import numpy as np\n'), ((482, 505), 'numpy.column_stack', 'np.column_stack', (...
""" Compares LRP maps optimized models Reference : Barnes et al. [2020, JAMES] Author : <NAME> Date : 29 March 2021 """ ### Import packages import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, addcyclic, shiftgrid import cmocean import palet...
[ "netCDF4.Dataset", "matplotlib.pyplot.subplot", "numpy.meshgrid", "mpl_toolkits.basemap.shiftgrid", "mpl_toolkits.basemap.addcyclic", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.rc", "matplotlib.pyplot.subplots_adjust", "mpl_toolkits.basemap.Basemap", "matplotlib.pyplot.savefi...
[((833, 976), 'netCDF4.Dataset', 'Dataset', (["(directorydata + \n 'LRP_YearlyMaps_%s_20ens_%s_%s_R1-Trials_L2-%s_epochs-%s.nc' % (SAMPLEQ,\n variables[0], seasons[0], 0.01, 500))"], {}), "(directorydata + \n 'LRP_YearlyMaps_%s_20ens_%s_%s_R1-Trials_L2-%s_epochs-%s.nc' % (SAMPLEQ,\n variables[0], seasons[0]...