code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, division import operator import numpy as np from zarr.compat import integer_types, PY2, reduce def normalize_shape(shape): """Convenience function to normalize the `shape` argument.""" if shape is None: raise TypeErro...
[ "numpy.product", "numpy.ceil", "numpy.log10", "zarr.compat.reduce", "numpy.array" ]
[((1165, 1193), 'numpy.array', 'np.array', (['shape'], {'dtype': '"""=f8"""'}), "(shape, dtype='=f8')\n", (1173, 1193), True, 'import numpy as np\n'), ((1319, 1337), 'numpy.product', 'np.product', (['chunks'], {}), '(chunks)\n', (1329, 1337), True, 'import numpy as np\n'), ((2178, 2212), 'numpy.ceil', 'np.ceil', (['(ch...
# Copyright 2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License. import numpy as np np.show_config()
[ "numpy.show_config" ]
[((144, 160), 'numpy.show_config', 'np.show_config', ([], {}), '()\n', (158, 160), True, 'import numpy as np\n')]
from __future__ import unicode_literals from __future__ import absolute_import from __future__ import division from time import time import logging from hcache import cached from limix_math.linalg import sum2diag from numpy import set_printoptions from numpy import argmin from numpy import zeros from numpy import ...
[ "logging.getLogger", "numpy.array", "numpy.zeros", "time.time", "numpy.set_printoptions" ]
[((908, 935), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (925, 935), False, 'import logging\n'), ((3253, 3280), 'numpy.array', 'array', (['self._real_variances'], {}), '(self._real_variances)\n', (3258, 3280), False, 'from numpy import array\n'), ((4058, 4064), 'time.time', 'time', ([...
import numpy from matplotlib import pyplot def forward_difference(f, x0, h): return (f(x0+h) - f(x0)) / h def backward_difference(f, x0, h): return (f(x0) - f(x0-h)) / h def central_difference(f, x0, h): return (f(x0+h) - f(x0-h)) / (2*h) def euler(f, x_end, y0, N): x, dx = numpy.linspace(0, x_end, N+...
[ "matplotlib.pyplot.loglog", "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "numpy.linspace", "matplotlib.pyplot.figure", "numpy.cos", "numpy.sin", "numpy.zeros_like", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((293, 338), 'numpy.linspace', 'numpy.linspace', (['(0)', 'x_end', '(N + 1)'], {'retstep': '(True)'}), '(0, x_end, N + 1, retstep=True)\n', (307, 338), False, 'import numpy\n'), ((1152, 1175), 'numpy.zeros_like', 'numpy.zeros_like', (['h_all'], {}), '(h_all)\n', (1168, 1175), False, 'import numpy\n'), ((1198, 1221), '...
""" Pretty-print a table comparing DF vector threshold versus accuracy and cost """ import numpy as np from pyscf import scf from chemftr import df from chemftr.molecule import rank_reduced_ccsd_t, cas_to_pyscf, pyscf_to_cas def generate_costing_table(pyscf_mf,name='molecule',thresh_range=[0.0001],dE=0.001,chi=10,bet...
[ "chemftr.df.rank_reduce", "chemftr.molecule.rank_reduced_ccsd_t", "chemftr.df.compute_cost", "chemftr.molecule.pyscf_to_cas", "chemftr.df.compute_lambda", "numpy.linalg.norm" ]
[((2562, 2654), 'chemftr.molecule.rank_reduced_ccsd_t', 'rank_reduced_ccsd_t', (['pyscf_mf'], {'eri_rr': 'None', 'use_kernel': 'use_kernel', 'no_triples': 'no_triples'}), '(pyscf_mf, eri_rr=None, use_kernel=use_kernel,\n no_triples=no_triples)\n', (2581, 2654), False, 'from chemftr.molecule import rank_reduced_ccsd_...
import unittest import numpy as np from fit1d.common.model import ModelMock from fit1d.common.fit1d import FitData class TestFitData(unittest.TestCase): def setUp(self): self.x = np.array([1,2, 3, 4]) self.y = np.array([10,20, 30, 40]) self.model = ModelMock({"param1": 5.5}) def test_...
[ "numpy.array", "fit1d.common.fit1d.FitData", "fit1d.common.model.ModelMock" ]
[((193, 215), 'numpy.array', 'np.array', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (201, 215), True, 'import numpy as np\n'), ((232, 258), 'numpy.array', 'np.array', (['[10, 20, 30, 40]'], {}), '([10, 20, 30, 40])\n', (240, 258), True, 'import numpy as np\n'), ((279, 305), 'fit1d.common.model.ModelMock', 'ModelMock',...
import numpy as np from quantities import Hz from neo import AnalogSignal as AnalogSignal n = np.array([[0.1, 0.1, 0.1, 0.1], [-2.0, -2.0, -2.0, -4.0], [0.1, 0.1, 0.1, 0.1], [-0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1], [-3.0, -3.0, -3.0, -3.0...
[ "numpy.array", "neo.AnalogSignal" ]
[((95, 307), 'numpy.array', 'np.array', (['[[0.1, 0.1, 0.1, 0.1], [-2.0, -2.0, -2.0, -4.0], [0.1, 0.1, 0.1, 0.1], [-\n 0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1], [-3.0, -3.0, -3.0, -\n 3.0], [0.1, 0.1, 0.1, 0.1], [0.1, 0.1, 0.1, 0.1]]'], {}), '([[0.1, 0.1, 0.1, 0.1], [-2.0, -2.0, -2.0, -4.0], [0.1, 0.1, 0....
import tensorflow as tf import numpy as np import os import pickle import gzip import urllib.request import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D, Dropout from keras.layers.normalization import BatchNormaliza...
[ "keras.layers.Conv2D", "numpy.random.rand", "keras.layers.Flatten", "keras.models.Sequential", "keras.layers.Dropout", "keras.layers.Activation", "keras.layers.Dense", "keras.backend.set_learning_phase" ]
[((437, 449), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (447, 449), False, 'from keras.models import Sequential\n'), ((995, 1034), 'keras.backend.set_learning_phase', 'keras.backend.set_learning_phase', (['(False)'], {}), '(False)\n', (1027, 1034), False, 'import keras\n'), ((1085, 1114), 'numpy.random...
""" Auxiliar retrievers parsing --------------------------- Tools and utilities to parse heterogenous ways to give retriever information in order to obtain retriever objects. """ import numpy as np from retrievers import BaseRetriever from collectionretrievers import RetrieverManager from pySpatialTools.Discretizat...
[ "pySpatialTools.Discretization._discretization_parsing_creation", "numpy.ones", "collectionretrievers.RetrieverManager", "numpy.where", "numpy.array", "numpy.concatenate" ]
[((5014, 5067), 'pySpatialTools.Discretization._discretization_parsing_creation', '_discretization_parsing_creation', (['discretization_info'], {}), '(discretization_info)\n', (5046, 5067), False, 'from pySpatialTools.Discretization import _discretization_parsing_creation\n'), ((6084, 6137), 'pySpatialTools.Discretizat...
from sleep_tracking.utils import get_root_directory import os from abc import ABC, abstractmethod import pandas as pd import numpy as np from typing import List class AbstractFeature(ABC): WINDOW_SIZE = 10 * 30 - 15 EPOCH_DURATION = 30 def __init__(self, name): self.name = name @abstractme...
[ "numpy.atleast_2d", "numpy.amin", "numpy.where", "sleep_tracking.utils.get_root_directory", "pandas.concat", "numpy.interp", "numpy.amax" ]
[((1141, 1179), 'pandas.concat', 'pd.concat', (['features'], {'ignore_index': '(True)'}), '(features, ignore_index=True)\n', (1150, 1179), True, 'import pandas as pd\n'), ((439, 459), 'sleep_tracking.utils.get_root_directory', 'get_root_directory', ([], {}), '()\n', (457, 459), False, 'from sleep_tracking.utils import ...
import threading import settings as s from collections import namedtuple, deque from api.actions import Actions from analytics_frame import Analytics from api.agent_analytics_frame import AgentAnalyticsFrameAPI import random import math import copy from sklearn.preprocessing import MinMaxScaler import numpy as np imp...
[ "math.exp", "random.sample", "collections.namedtuple", "collections.deque", "torch.nn.Tanh", "torch.autograd.set_detect_anomaly", "torch.Tensor", "torch.tensor", "torch.no_grad", "numpy.array", "torch.nn.Linear", "threading.Thread", "random.random", "sklearn.preprocessing.MinMaxScaler", ...
[((422, 441), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (434, 441), False, 'import torch\n'), ((501, 586), 'collections.namedtuple', 'namedtuple', (['"""Experience"""'], {'field_names': "['state', 'action', 'reward', 'next_state']"}), "('Experience', field_names=['state', 'action', 'reward',\n ...
#!/usr/bin/env python3 from imutils.video import VideoStream import cv2 import argparse import imutils import time import sys import socket import imagezmq from math import acos, pi, cos, asin, sin, sqrt from threading import Thread import robot_controller import asyncio import numpy as np iter_count = 0 dist_1 = 0 ...
[ "math.acos", "time.sleep", "math.cos", "numpy.reshape", "imutils.video.VideoStream", "argparse.ArgumentParser", "cv2.line", "cv2.aruco.Dictionary_get", "asyncio.sleep", "socket.gethostname", "imagezmq.ImageSender", "cv2.aruco.detectMarkers", "cv2.aruco.DetectorParameters_create", "cv2.circ...
[((8941, 8996), 'imagezmq.ImageSender', 'imagezmq.ImageSender', ([], {'connect_to': '"""tcp://localhost:5555"""'}), "(connect_to='tcp://localhost:5555')\n", (8961, 8996), False, 'import imagezmq\n'), ((9010, 9030), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (9028, 9030), False, 'import socket\n'), ((...
#%% import datetime import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from graspologic.embed import AdjacencySpectralEmbed from pkg.data import load_split_connectome from pkg.io import OUT_PATH from pkg.io import glue as default_glue from pkg.io import savefig fro...
[ "numpy.random.default_rng", "numpy.log", "matplotlib.pyplot.autoscale", "datetime.timedelta", "numpy.arange", "matplotlib.pyplot.close", "numpy.concatenate", "pandas.DataFrame", "numpy.tril_indices_from", "graspologic.embed.AdjacencySpectralEmbed", "pkg.io.glue", "numpy.triu_indices_from", "...
[((725, 736), 'time.time', 'time.time', ([], {}), '()\n', (734, 736), False, 'import time\n'), ((743, 770), 'numpy.random.default_rng', 'np.random.default_rng', (['(8888)'], {}), '(8888)\n', (764, 770), True, 'import numpy as np\n'), ((815, 860), 'pkg.data.load_split_connectome', 'load_split_connectome', (['dataset'], ...
""" Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. WSO2 Inc. licenses this file to you 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/LIC...
[ "numpy.copy", "pyro.infer.Trace_ELBO", "numpy.diag", "torch.is_tensor", "torch.tensor", "pyro.set_rng_seed", "numpy.random.seed", "torch.no_grad", "pyro.__version__.startswith" ]
[((736, 772), 'pyro.__version__.startswith', 'pyro.__version__.startswith', (['"""1.0.0"""'], {}), "('1.0.0')\n", (763, 772), False, 'import pyro\n'), ((842, 862), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (856, 862), True, 'import numpy as np\n'), ((863, 886), 'pyro.set_rng_seed', 'pyro.set_rn...
import numpy as np from ..rdkit import smiles_list_to_fingerprints, precursors_from_templates def tanimoto(fp1, fp2): a = fp1.sum() b = fp2.sum() c = float((fp1&fp2).sum()) return c/(a+b-c) def pairwise_tanimoto(arr1, arr2, metric=tanimoto): if arr1.size == 0: return np.array([[]]) ret...
[ "numpy.argsort", "numpy.array", "numpy.fill_diagonal" ]
[((627, 662), 'numpy.fill_diagonal', 'np.fill_diagonal', (['diversity', 'np.nan'], {}), '(diversity, np.nan)\n', (643, 662), True, 'import numpy as np\n'), ((298, 312), 'numpy.array', 'np.array', (['[[]]'], {}), '([[]])\n', (306, 312), True, 'import numpy as np\n'), ((970, 987), 'numpy.argsort', 'np.argsort', (['(-pred...
#!/usr/bin/env python import numpy as np from os import path def createSourceString(config, energy, angle): '''Creates a source file from a configurator object and a specific angle and energy. config: the .yaml file used energy: angle: ''' from utils import getFilenameFromDetails ...
[ "numpy.log10", "os.path.expandvars", "yaml.load", "numpy.linspace", "numpy.rad2deg", "utils.getFilenameFromDetails" ]
[((330, 422), 'utils.getFilenameFromDetails', 'getFilenameFromDetails', (["{'base': config['run']['basename'], 'keV': energy, 'Cos': angle}"], {}), "({'base': config['run']['basename'], 'keV': energy,\n 'Cos': angle})\n", (352, 422), False, 'from utils import getFilenameFromDetails\n'), ((2578, 2703), 'numpy.linspac...
import argparse from numpy.core.fromnumeric import shape from tool.torch_utils import do_detect import torch import torch.backends.cudnn as cudnn from tool.darknet2pytorch import Darknet import timeit, time import os import numpy as np import cv2 import json import random FRAME_SIZES = [64, 96, 128, 160, 192, 224, ...
[ "tool.darknet2pytorch.Darknet", "numpy.array", "torch.cuda.synchronize", "argparse.ArgumentParser", "time.perf_counter", "numpy.random.seed", "numpy.fromstring", "random.randint", "tool.torch_utils.do_detect", "cv2.resize", "torch.cuda.set_device", "torch.cuda.manual_seed_all", "torch.manual...
[((459, 482), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (476, 482), False, 'import torch\n'), ((487, 519), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (513, 519), False, 'import torch\n'), ((609, 629), 'numpy.random.seed', 'np.random.seed', (['seed...
import math import os import re import itertools import matplotlib.cbook as cbook import matplotlib.pyplot as plt import numpy as np from matplotlib.backends.backend_pdf import PdfPages from matplotlib.font_manager import FontProperties from scipy import stats plot_markers = ('D', 'o', '^', 's', 'p', 'd', 'h', '8', r...
[ "matplotlib.pyplot.boxplot", "matplotlib.pyplot.ylabel", "matplotlib.cbook.boxplot_stats", "numpy.array", "numpy.isfinite", "scipy.stats.sem", "matplotlib.pyplot.errorbar", "numpy.mean", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.yscale", "itertools.cycle", "matplotlib.pyplot.gcf", "os.p...
[((4032, 4057), 'matplotlib.cbook.boxplot_stats', 'cbook.boxplot_stats', (['data'], {}), '(data)\n', (4051, 4057), True, 'import matplotlib.cbook as cbook\n'), ((4309, 4342), 'numpy.array', 'np.array', (['confidence_intervals[0]'], {}), '(confidence_intervals[0])\n', (4317, 4342), True, 'import numpy as np\n'), ((4373,...
from job.nclimber import NClimber from math import ceil from multiprocessing.context import Process from behavior.oscillator import Oscillator from multiprocessing import Pool from util.run import Run from numpy import floor import wandb from job.learner import Learner from rl_ctrnn.ctrnn import Ctrnn import itertools ...
[ "job.learner.Learner", "numpy.power", "itertools.product", "numpy.floor", "behavior.oscillator.Oscillator", "rl_ctrnn.ctrnn.Ctrnn.from_dict", "multiprocessing.context.Process", "job.nclimber.NClimber", "random.randint" ]
[((412, 442), 'random.randint', 'random.randint', (['(100000)', '(999999)'], {}), '(100000, 999999)\n', (426, 442), False, 'import random\n'), ((483, 730), 'rl_ctrnn.ctrnn.Ctrnn.from_dict', 'Ctrnn.from_dict', (["{'time_constants': {(0): 1.0, (1): 1.0}, 'biases': {(0): 5.154455202973727,\n (1): -10.756384207938911}, ...
# Copyright (c) 2020, TU Wien, Department of Geodesy and Geoinformation # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice,...
[ "datetime.datetime", "ascat.level1.AscatL1Hdf5", "ascat.level1.AscatL1Image", "ascat.level1.AscatL1Eps", "numpy.testing.assert_allclose", "os.path.join", "numpy.array", "os.path.dirname", "ascat.level1.AscatL1Nc", "ascat.level1.AscatL1Bufr", "numpy.finfo" ]
[((1829, 1849), 'numpy.finfo', 'np.finfo', (['np.float32'], {}), '(np.float32)\n', (1837, 1849), True, 'import numpy as np\n'), ((2085, 2210), 'os.path.join', 'os.path.join', (['data_path', '"""bufr"""', '"""M02-ASCA-ASCSZR1B0200-NA-9.1-20100609013900.000000000Z-20130824233100-1280350.bfr"""'], {}), "(data_path, 'bufr'...
import torch import torch.nn as nn import numpy as np import numpy.random as rand from dset import idx2char # We use cross entropy loss loss_func = nn.CrossEntropyLoss(reduction='mean') def compute_loss(rnn, xNy, h_list, device): """ compute_loss for a given RNN model using loss_func Args: RNN: m...
[ "torch.nn.functional.softmax", "torch.nn.CrossEntropyLoss", "numpy.array", "numpy.random.randint", "torch.no_grad", "torch.zeros" ]
[((148, 185), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'reduction': '"""mean"""'}), "(reduction='mean')\n", (167, 185), True, 'import torch.nn as nn\n'), ((1239, 1266), 'torch.zeros', 'torch.zeros', (['(1, char_size)'], {}), '((1, char_size))\n', (1250, 1266), False, 'import torch\n'), ((1595, 1610), '...
import numpy as np class InputLayer(): def __init__(self, number_neurons): self.number_neurons = number_neurons self.stored_output = [] def calc_feed_forward(self, input): self.input = input self.output = input self.stored_output.append(self.output) return np....
[ "numpy.asarray" ]
[((317, 340), 'numpy.asarray', 'np.asarray', (['self.output'], {}), '(self.output)\n', (327, 340), True, 'import numpy as np\n')]
# Copyright (c) 2018 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, ...
[ "os.path.exists", "numpy.reshape", "os.makedirs", "dataset.DataSet", "urllib.urlretrieve", "os.path.join", "subprocess.call", "numpy.concatenate", "os.stat", "numpy.transpose", "sys.version.startswith" ]
[((1319, 1346), 'sys.version.startswith', 'sys.version.startswith', (['"""3"""'], {}), "('3')\n", (1341, 1346), False, 'import sys\n'), ((1755, 1793), 'os.path.join', 'os.path.join', (['work_directory', 'filename'], {}), '(work_directory, filename)\n', (1767, 1793), False, 'import os\n'), ((3183, 3208), 'numpy.concaten...
""" This module calculates turbulent viscosity at the cell faces. Libraries/Modules: numpy\n """ import numpy as np # from Grid import Grid # class BaldwinLomax(): # @profile def turbulent_viscosity(model, ws, state): """ Baldwin-lomax turbulence model: modtur = 2. Calculates turbulent vi...
[ "numpy.sqrt", "numpy.ones", "numpy.floor", "numpy.argmax", "numpy.square", "numpy.exp", "numpy.argmin" ]
[((1340, 1351), 'numpy.ones', 'np.ones', (['nx'], {}), '(nx)\n', (1347, 1351), True, 'import numpy as np\n'), ((1364, 1375), 'numpy.ones', 'np.ones', (['nx'], {}), '(nx)\n', (1371, 1375), True, 'import numpy as np\n'), ((1386, 1403), 'numpy.ones', 'np.ones', (['(nx, ny)'], {}), '((nx, ny))\n', (1393, 1403), True, 'impo...
import time import cv2 import argparse import numpy as np import serial # khoi tao bo dem #open camera cap = cv2.VideoCapture(0) start = time.time() #image = cv2.imread('199.jpg',1) # Ham tra ve output layer def get_output_layers(net): layer_names = net.getLayerNames() output_layers = [layer_names[i[0] - ...
[ "cv2.rectangle", "cv2.dnn.blobFromImage", "numpy.argmax", "cv2.putText", "cv2.imshow", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.VideoCapture", "cv2.dnn.NMSBoxes", "time.time", "cv2.dnn.readNet" ]
[((112, 131), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (128, 131), False, 'import cv2\n'), ((140, 151), 'time.time', 'time.time', ([], {}), '()\n', (149, 151), False, 'import time\n'), ((947, 994), 'cv2.dnn.readNet', 'cv2.dnn.readNet', (['"""yolov3.weights"""', '"""yolov3.cfg"""'], {}), "('yolov3...
# -*- coding: utf-8 -*- import numpy as np from skimage.util import img_as_float from skimage.segmentation import slic from skimage.io import imread import os from salientdetect.detector import calc_saliency_score def _load_dist_mat(): npy_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "color_dis...
[ "skimage.util.img_as_float", "salientdetect.detector.calc_saliency_score", "skimage.io.imread", "os.path.abspath", "numpy.load" ]
[((339, 356), 'numpy.load', 'np.load', (['npy_path'], {}), '(npy_path)\n', (346, 356), True, 'import numpy as np\n'), ((424, 436), 'skimage.io.imread', 'imread', (['path'], {}), '(path)\n', (430, 436), False, 'from skimage.io import imread\n'), ((617, 667), 'salientdetect.detector.calc_saliency_score', 'calc_saliency_s...
import numpy as np from .lanczos import lanczos_resample_three, lanczos_resample_one def invert_affine_transform_wcs(u, v, wcs): """Invert a galsim.AffineTransform WCS. The AffineTransform WCS forward model is [u, v] = Jac * ([x, y] - origin) + world_origin where the `*` is a matrix multiplica...
[ "numpy.array", "numpy.zeros", "numpy.sum" ]
[((2358, 2408), 'numpy.zeros', 'np.zeros', (['(coadd_dim, coadd_dim)'], {'dtype': 'np.float64'}), '((coadd_dim, coadd_dim), dtype=np.float64)\n', (2366, 2408), True, 'import numpy as np\n'), ((2427, 2477), 'numpy.zeros', 'np.zeros', (['(coadd_dim, coadd_dim)'], {'dtype': 'np.float64'}), '((coadd_dim, coadd_dim), dtype=...
import unittest from mock import Mock from records_mover.records.schema.field.numpy import details_from_numpy_dtype import numpy as np class TestNumpy(unittest.TestCase): def test_details_from_numpy_dtype(self): tests = { np.dtype(str): 'string', np.dtype(int): 'integer', ...
[ "mock.Mock", "numpy.dtype", "records_mover.records.schema.field.numpy.details_from_numpy_dtype" ]
[((248, 261), 'numpy.dtype', 'np.dtype', (['str'], {}), '(str)\n', (256, 261), True, 'import numpy as np\n'), ((285, 298), 'numpy.dtype', 'np.dtype', (['int'], {}), '(int)\n', (293, 298), True, 'import numpy as np\n'), ((323, 346), 'numpy.dtype', 'np.dtype', (['np.datetime64'], {}), '(np.datetime64)\n', (331, 346), Tru...
from typing import Union import numpy as np from gmhazard_calc import gm_data from .SiteInfo import SiteInfo from qcore.geo import closest_location def get_site_from_coords( ensemble: Union[str, gm_data.Ensemble], lat: float, lon: float, user_vs30: float = None, ): """Returns a SiteInfo for the ...
[ "gmhazard_calc.gm_data.Ensemble", "numpy.vstack" ]
[((809, 835), 'gmhazard_calc.gm_data.Ensemble', 'gm_data.Ensemble', (['ensemble'], {}), '(ensemble)\n', (825, 835), False, 'from gmhazard_calc import gm_data\n'), ((1616, 1642), 'gmhazard_calc.gm_data.Ensemble', 'gm_data.Ensemble', (['ensemble'], {}), '(ensemble)\n', (1632, 1642), False, 'from gmhazard_calc import gm_d...
# -*- coding: utf-8 -*- #!/usr/bin/env python ####################################################################### ##### ##### ##### <NAME> ##### ##### <EMAIL> ##### ##### ...
[ "cv2.rectangle", "cv2.BFMatcher", "cv2.normalize", "time.sleep", "cv2.imshow", "numpy.array", "cv2.xfeatures2d.SIFT_create", "cv2.ocl.setUseOpenCL", "cv2.calcHist", "cv2.calcBackProject", "cv2.xfeatures2d.SURF_create", "cv2.ORB_create", "picamera.array.PiRGBArray", "cv2.waitKey", "cv2.me...
[((1590, 1613), 'numpy.array', 'np.array', (['[172, 61, 57]'], {}), '([172, 61, 57])\n', (1598, 1613), True, 'import numpy as np\n'), ((1648, 1673), 'numpy.array', 'np.array', (['[179, 255, 255]'], {}), '([179, 255, 255])\n', (1656, 1673), True, 'import numpy as np\n'), ((1858, 1882), 'numpy.array', 'np.array', (['[111...
# -*- coding: utf-8 -*- """ Created on Tue May 22 14:24:45 2018 @author: yume """ import numpy as np import matplotlib.pyplot as plt import hidden_markov_models def gaussian_paras(x): mean = x.mean() var = x.var() std = x.std() return (mean, var, std) if __name__ == '__main__': sampler = hidde...
[ "numpy.random.normal", "hidden_markov_models.GaussianHMM", "numpy.unique", "numpy.hstack", "numpy.random.choice", "numpy.array", "numpy.linspace", "numpy.meshgrid", "numpy.arange" ]
[((315, 349), 'hidden_markov_models.GaussianHMM', 'hidden_markov_models.GaussianHMM', ([], {}), '()\n', (347, 349), False, 'import hidden_markov_models\n'), ((694, 718), 'numpy.linspace', 'np.linspace', (['(0)', '(K - 1)', 'K'], {}), '(0, K - 1, K)\n', (705, 718), True, 'import numpy as np\n'), ((725, 749), 'numpy.lins...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: <NAME> """ from scipy.stats import multivariate_normal, norm import numpy as np #### Generalized Black Scholes Formula def GBlackScholes(CallPutFlag, S, X, T, r, b, v): d_1 = (np.log(S/X) + (b + v**2/2) * T) / (v * T**(1/2)) d_2 = d_1 - v * T**(1/2)...
[ "scipy.stats.norm.cdf", "numpy.log" ]
[((243, 256), 'numpy.log', 'np.log', (['(S / X)'], {}), '(S / X)\n', (249, 256), True, 'import numpy as np\n'), ((853, 864), 'scipy.stats.norm.cdf', 'norm.cdf', (['d'], {}), '(d)\n', (861, 864), False, 'from scipy.stats import multivariate_normal, norm\n'), ((385, 398), 'scipy.stats.norm.cdf', 'norm.cdf', (['d_1'], {})...
import tensorflow as tf import os import numpy as np import pandas as pd from skimage import io from skimage.transform import resize from skimage.filters import gaussian # from deepflash import unet, preproc, utils from df_resources import unet, preproc, utils, pixelshift37 from skimage.measure import label, regionpr...
[ "numpy.iinfo", "skimage.measure.approximate_polygon", "df_resources.unet.Unet2D", "numpy.array", "shapely.geometry.Polygon", "numpy.moveaxis", "os.path.exists", "numpy.asarray", "numpy.empty", "pandas.DataFrame", "numpy.dtype", "skimage.measure.regionprops", "skimage.io.imread", "df_resour...
[((1104, 1153), 'df_resources.pixelshift37.PixelShifter', 'pixelshift37.PixelShifter', ([], {'jsonfilepath': 'json_file'}), '(jsonfilepath=json_file)\n', (1129, 1153), False, 'from df_resources import unet, preproc, utils, pixelshift37\n'), ((1725, 1748), 'numpy.dstack', 'np.dstack', (['shifted_list'], {}), '(shifted_l...
""" Copyright (C) Cortic Technology Corp. - All Rights Reserved Written by <NAME> <<EMAIL>>, 2021 """ import cv2 import numpy as np FINGER_COLOR = [ (128, 128, 128), (80, 190, 168), (234, 187, 105), (175, 119, 212), (81, 110, 221), ] JOINT_COLOR = [(0, 0, 0), (125, 255, 79), (255, 102, 0), (181,...
[ "cv2.rectangle", "cv2.polylines", "cv2.line", "numpy.array", "cv2.circle" ]
[((3574, 3695), 'cv2.rectangle', 'cv2.rectangle', (['frame', '(40, screen_height - 40)', '(60, screen_height - 40 - screen_height // 3)', '(255, 255, 255)', '(1)', '(1)'], {}), '(frame, (40, screen_height - 40), (60, screen_height - 40 - \n screen_height // 3), (255, 255, 255), 1, 1)\n', (3587, 3695), False, 'import...
import time,calendar,os,json,sys,datetime from requests import get from subprocess import Popen,PIPE from math import sqrt,log,exp from scipy.optimize import minimize import numpy as np np.set_printoptions(precision=3,linewidth=120) def datetoday(x): t=time.strptime(x+'UTC','%Y-%m-%d%Z') return calendar.timegm(t)/...
[ "time.strptime", "os.makedirs", "datetime.datetime.utcnow", "subprocess.Popen", "time.strftime", "os.path.join", "numpy.log", "requests.get", "math.log", "os.path.isfile", "numpy.exp", "calendar.timegm", "numpy.zeros", "math.sqrt", "sys.exit", "time.gmtime", "json.dump", "numpy.set...
[((186, 233), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'linewidth': '(120)'}), '(precision=3, linewidth=120)\n', (205, 233), True, 'import numpy as np\n'), ((2252, 2287), 'os.path.join', 'os.path.join', (['"""apidata"""', 'updatedate'], {}), "('apidata', updatedate)\n", (2264, 2287), F...
#!/usr/bin/env python import argparse import random import numpy as np import numpy.linalg as nplg if __name__ == "__main__": # FLAGS # -------------------------------------------------------------------------- parser = argparse.ArgumentParser( description='Picks imagemagick modulation within ran...
[ "random.randint", "argparse.ArgumentParser", "numpy.linalg.norm" ]
[((235, 421), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': "('Picks imagemagick modulation within range that is reasonably ' +\n 'far from the modulations already done -- to ensure variety of materials.')"}), "(description=\n 'Picks imagemagick modulation within range that is reasona...
from skued import nfft, nfftfreq import unittest import numpy as np np.random.seed(23) class Testnfftfreq(unittest.TestCase): def test_shape_even(self): """ Test that the nfftfreq function returns expected shape """ freqs = nfftfreq(16) self.assertTupleEqual(freqs.shape, (16,)) def ...
[ "numpy.sin", "numpy.fft.fftfreq", "numpy.fft.fft", "numpy.linspace", "numpy.random.seed", "unittest.main", "skued.nfftfreq" ]
[((70, 88), 'numpy.random.seed', 'np.random.seed', (['(23)'], {}), '(23)\n', (84, 88), True, 'import numpy as np\n'), ((879, 894), 'unittest.main', 'unittest.main', ([], {}), '()\n', (892, 894), False, 'import unittest\n'), ((248, 260), 'skued.nfftfreq', 'nfftfreq', (['(16)'], {}), '(16)\n', (256, 260), False, 'from sk...
""" Module: LMR_verify_gridRNL.py Purpose: Generates spatial verification statistics of various LMR gridded fields against 20th century reanalyses. Originator: <NAME>, U. of Washington, March 2016 Revisions: """ import matplotlib # need to do this backend when running remotely or to suppress figures in...
[ "spharm.Spharmt", "matplotlib.pyplot.ylabel", "numpy.array", "numpy.nanmean", "matplotlib.ticker.MaxNLocator", "numpy.isfinite", "matplotlib.ticker.AutoLocator", "sys.path.append", "numpy.arange", "numpy.mean", "os.path.exists", "numpy.reshape", "numpy.where", "matplotlib.pyplot.xlabel", ...
[((332, 353), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (346, 353), False, 'import matplotlib\n'), ((667, 689), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (682, 689), False, 'import glob, os, sys\n'), ((948, 981), 'warnings.filterwarnings', 'warnings.filterwarnin...
import sys sys.path.insert(0, "../") import numpy as np import cv2 import argparse import torch from torchvision.transforms import functional as F from mmcls.apis import init_model import os from tqdm import tqdm class MmClassifier(object): def __init__(self, cls_c, cls_w, device): self.model_w = cls_w ...
[ "sys.path.insert", "onnx.save", "cv2.imshow", "numpy.array", "onnx.load", "os.listdir", "argparse.ArgumentParser", "cv2.multiply", "numpy.max", "cv2.waitKey", "torch.onnx.export", "numpy.ones", "onnxsim.simplify", "os.path.splitext", "numpy.argmax", "torch.save", "cv2.cvtColor", "m...
[((11, 36), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (26, 36), False, 'import sys\n'), ((5345, 5370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5368, 5370), False, 'import argparse\n'), ((5951, 5971), 'cv2.imread', 'cv2.imread', (['img_path'], {}),...
import os import numpy as np import pytest from .. import snapshot from .. import utils _test_dir = os.path.dirname(__file__) _data_dir = os.path.join(_test_dir, "testing_data") def test_load_particle_data(): pd = snapshot.ParticleData(_data_dir+"/snapshot_002.hdf5") assert pd.n_parts == 64**3 assert pd...
[ "numpy.isclose", "numpy.delete", "os.path.join", "os.path.dirname", "numpy.array", "pytest.raises", "numpy.linalg.norm" ]
[((102, 127), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (117, 127), False, 'import os\n'), ((140, 179), 'os.path.join', 'os.path.join', (['_test_dir', '"""testing_data"""'], {}), "(_test_dir, 'testing_data')\n", (152, 179), False, 'import os\n'), ((1011, 1042), 'numpy.delete', 'np.delete...
#script aiming at testing FileListProcessor_input_test import cv2 import matplotlib.pyplot as plt import tensorflow as tf import os import datetime import numpy as np import argparse import DataProvider_input_pipeline workingFolder='test_datapipeline' sessionFolder=os.path.join(workingFolder, datetime.datetime.now()....
[ "tensorflow.train.Int64List", "tensorflow.cast", "argparse.ArgumentParser", "tensorflow.py_function", "matplotlib.pyplot.plot", "numpy.max", "DataProvider_input_pipeline.extractFilenames", "numpy.linspace", "tensorflow.train.FloatList", "numpy.min", "cv2.waitKey", "DataProvider_input_pipeline....
[((352, 378), 'os.makedirs', 'os.makedirs', (['sessionFolder'], {}), '(sessionFolder)\n', (363, 378), False, 'import os\n'), ((379, 402), 'os.chdir', 'os.chdir', (['sessionFolder'], {}), '(sessionFolder)\n', (387, 402), False, 'import os\n'), ((1054, 1125), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'d...
from astropy.io import fits from astropy.stats import sigma_clip, sigma_clipped_stats from astropy.modeling import models, fitting import numpy as np from matplotlib import pyplot as plt from utils import * from tqdm import tqdm def find_slit_edges(master_flat_name, edge_cut=50, threshold=20, gap=20, has_primary=Fa...
[ "numpy.polyfit", "astropy.modeling.models.Gaussian1D", "numpy.array", "astropy.io.fits.open", "numpy.poly1d", "numpy.arange", "matplotlib.pyplot.imshow", "astropy.stats.sigma_clip", "matplotlib.pyplot.plot", "matplotlib.pyplot.axhline", "matplotlib.pyplot.yticks", "numpy.abs", "matplotlib.py...
[((856, 883), 'astropy.io.fits.open', 'fits.open', (['master_flat_name'], {}), '(master_flat_name)\n', (865, 883), False, 'from astropy.io import fits\n'), ((4394, 4421), 'astropy.io.fits.open', 'fits.open', (['master_flat_name'], {}), '(master_flat_name)\n', (4403, 4421), False, 'from astropy.io import fits\n'), ((217...
import unittest import numpy as np from pysal.lib import cg, examples import pysal.explore.spaghetti as spgh class TestNetwork(unittest.TestCase): def setUp(self): self.ntw = spgh.Network(in_data=examples.get_path('streets.shp')) def tearDown(self): pass def test_extract_net...
[ "pysal.explore.spaghetti.dijkstra", "pysal.explore.spaghetti.dijkstra_mp", "pysal.explore.spaghetti.util.snap_points_on_segments", "pysal.explore.spaghetti.util.generatetree", "pysal.lib.cg.shapes.Point", "numpy.testing.assert_array_almost_equal_nulp", "numpy.zeros", "numpy.array", "pysal.explore.sp...
[((10153, 10168), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10166, 10168), False, 'import unittest\n'), ((4329, 4355), 'numpy.zeros', 'np.zeros', (['matrix2.shape[0]'], {}), '(matrix2.shape[0])\n', (4337, 4355), True, 'import numpy as np\n'), ((5161, 5216), 'numpy.testing.assert_array_almost_equal_nulp', 'np...
""" .. _quadtree_gridded-forecast-evaluation: Quadtree Grid-based Forecast Evaluation ======================================= This example demonstrates how to create a quadtree based single resolution-grid and multi-resolution grid. Multi-resolution grid is created using earthquake catalog, in which seismic density ...
[ "csep.core.catalogs.CSEPCatalog.from_dataframe", "pandas.read_csv", "csep.core.regions.QuadtreeGrid2D.from_catalog", "csep.utils.time_utils.decimal_year_to_utc_epoch", "csep.core.forecasts.GriddedForecast", "numpy.array", "csep.core.regions.QuadtreeGrid2D.from_single_resolution", "csep.core.poisson_ev...
[((2674, 2711), 'pandas.read_csv', 'pandas.read_csv', (['"""cat_train_2013.csv"""'], {}), "('cat_train_2013.csv')\n", (2689, 2711), False, 'import pandas\n'), ((3148, 3181), 'csep.core.catalogs.CSEPCatalog.from_dataframe', 'CSEPCatalog.from_dataframe', (['dfcat'], {}), '(dfcat)\n', (3174, 3181), False, 'from csep.core....
import numpy as np import tensorflow as tf ## TensorFlow helper functions WEIGHT_DECAY_KEY = 'WEIGHT_DECAY' def _relu(x, leakness=0.0, name=None): if leakness > 0.0: name = 'lrelu' if name is None else name return tf.maximum(x, x*leakness, name='lrelu') else: name = 'relu' if name is ...
[ "numpy.sqrt", "tensorflow.reduce_sum", "tensorflow.nn.conv1d", "tensorflow.nn.moments", "tensorflow.get_variable_scope", "tensorflow.zeros_initializer", "tensorflow.slice", "tensorflow.diag", "numpy.max", "tensorflow.concat", "tensorflow.histogram_summary", "tensorflow.matmul", "tensorflow.m...
[((6993, 7009), 'tensorflow.add_n', 'tf.add_n', (['S_list'], {}), '(S_list)\n', (7001, 7009), True, 'import tensorflow as tf\n'), ((7014, 7053), 'tensorflow.add_to_collection', 'tf.add_to_collection', (['"""WEIGHT_SPLIT"""', 'S'], {}), "('WEIGHT_SPLIT', S)\n", (7034, 7053), True, 'import tensorflow as tf\n'), ((7157, 7...
# Electron ID [DEEP TRAINING] steering code # # <NAME>, 2020 # <EMAIL> # icenet system paths import _icepaths_ import uproot import math import numpy as np import torch import argparse import pprint import os import datetime import json import pickle import sys import yaml import copy #import graphviz import torch_g...
[ "iceid.common.read_config", "icenet.deep.dopt.model_to_cuda", "icenet.deep.graph.GINENet", "icenet.tools.aux.pdf_2D_hist", "numpy.linspace", "uproot.open", "icenet.deep.graph.DECNet", "numpy.ceil", "icenet.deep.graph.ECNet", "icenet.deep.graph.SUPNet", "icenet.deep.graph.SAGENet", "icenet.deep...
[((967, 1135), 'iceid.graphio.parse_graph_data', 'graphio.parse_graph_data', ([], {'X': 'X[0:100]', 'Y': 'Y[0:100]', 'VARS': 'VARS', 'features': 'features', 'global_on': "args['graph_param']['global_on']", 'coord': "args['graph_param']['coord']"}), "(X=X[0:100], Y=Y[0:100], VARS=VARS, features=\n features, global_on...
import numpy as np def parse_res(res): min = -1 avg = -1 if res != "": if "," not in res: min = int(res) avg = int(res) else: all = np.array([int(r) for r in res.split(",")]) min = np.min(all) avg = np.mean(all) return min,avg ...
[ "numpy.mean", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.concatenate", "numpy.min", "numpy.transpose" ]
[((1822, 1844), 'numpy.array', 'np.array', (['final_result'], {}), '(final_result)\n', (1830, 1844), True, 'import numpy as np\n'), ((1997, 2015), 'numpy.sum', 'np.sum', (['np_topn', '(0)'], {}), '(np_topn, 0)\n', (2003, 2015), True, 'import numpy as np\n'), ((2155, 2188), 'numpy.concatenate', 'np.concatenate', (['(np_...
# APPARENT MAG -> ABSOLUTE MAG WITH DISTANCE INFO. #============================================================ import glob import numpy as np import matplotlib.pyplot as plt from astropy.io import ascii, fits from astropy.table import Table, vstack from astropy import units as u def app2abs(m, mer, d, der): M = m -...
[ "numpy.log", "numpy.log10", "astropy.io.ascii.read" ]
[((547, 569), 'astropy.io.ascii.read', 'ascii.read', (['path_table'], {}), '(path_table)\n', (557, 569), False, 'from astropy.io import ascii, fits\n'), ((717, 728), 'numpy.log10', 'np.log10', (['d'], {}), '(d)\n', (725, 728), True, 'import numpy as np\n'), ((324, 335), 'numpy.log10', 'np.log10', (['d'], {}), '(d)\n', ...
import numpy as np import uncertainties.unumpy as unumpy from uncertainties import ufloat from scipy.stats import sem print('Wellenlaenge') dd1, za = np.genfromtxt('python/wellenlaenge.txt', unpack=True) dd = (dd1*10**(-3))/5.017 lam = 2 * dd / za mlam = np.mean(lam) slam = sem(lam) rlam = ufloat(mlam, slam) np.savetx...
[ "numpy.mean", "numpy.column_stack", "scipy.stats.sem", "uncertainties.ufloat", "numpy.genfromtxt" ]
[((151, 204), 'numpy.genfromtxt', 'np.genfromtxt', (['"""python/wellenlaenge.txt"""'], {'unpack': '(True)'}), "('python/wellenlaenge.txt', unpack=True)\n", (164, 204), True, 'import numpy as np\n'), ((256, 268), 'numpy.mean', 'np.mean', (['lam'], {}), '(lam)\n', (263, 268), True, 'import numpy as np\n'), ((276, 284), '...
"""This module implements an microphone interface""" from time import time import numpy as np try: IMPORT_ERROR = False import sounddevice as sd except Exception as e: IMPORT_ERROR = True print(e) from scipy.fft import rfft class Microphone: """ This class provides a simple interface to the ...
[ "sounddevice.Stream", "numpy.linspace", "time.time", "scipy.fft.rfft" ]
[((3769, 3843), 'numpy.linspace', 'np.linspace', ([], {'start': '(0)', 'stop': '(samplerate // 2)', 'num': '(samplerate * duration // 2)'}), '(start=0, stop=samplerate // 2, num=samplerate * duration // 2)\n', (3780, 3843), True, 'import numpy as np\n'), ((5145, 5151), 'time.time', 'time', ([], {}), '()\n', (5149, 5151...
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE import pytest # noqa: F401 import numpy as np # noqa: F401 import awkward as ak # noqa: F401 jax = pytest.importorskip("jax") jax.config.update("jax_enable_x64", True) def test_from_jax(): jax_array_1d = jax.numpy.arange...
[ "awkward._v2.backend", "awkward._v2.from_jax", "awkward._v2.Array", "awkward._v2.to_list", "numpy.array", "pytest.importorskip" ]
[((192, 218), 'pytest.importorskip', 'pytest.importorskip', (['"""jax"""'], {}), "('jax')\n", (211, 218), False, 'import pytest\n'), ((433, 462), 'awkward._v2.from_jax', 'ak._v2.from_jax', (['jax_array_1d'], {}), '(jax_array_1d)\n', (448, 462), True, 'import awkward as ak\n'), ((485, 514), 'awkward._v2.from_jax', 'ak._...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import platform import multiprocessing.pool from setuptools import setup, Extension lib_name = 'duckdb' extensions = ['parquet', 'icu', 'fts', 'tpch', 'tpcds', 'visualizer'] if platform.system() == 'Windows': extensions = ['parquet', 'icu', 'ft...
[ "os.listdir", "os.getenv", "package_build.get_libraries", "amalgamation.list_includes_files", "sys.argv.append", "os.path.join", "setuptools.setup", "package_build.get_relative_path", "setuptools.Extension", "os.path.realpath", "platform.system", "pybind11.get_include", "numpy.get_include", ...
[((3608, 3651), 'os.path.join', 'os.path.join', (['script_path', '"""src"""', '"""include"""'], {}), "(script_path, 'src', 'include')\n", (3620, 3651), False, 'import os\n'), ((3671, 3703), 'os.path.join', 'os.path.join', (['script_path', '"""src"""'], {}), "(script_path, 'src')\n", (3683, 3703), False, 'import os\n'),...
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[ "tensorflow.random.uniform", "tensorflow.keras.layers.Input", "tensorflow.keras.initializers.RandomNormal", "official.nlp.modeling.models.xlnet.XLNetSpanLabeler.from_config", "absl.testing.parameterized.parameters", "tensorflow.test.main", "numpy.random.randint", "official.nlp.modeling.models.xlnet.XL...
[((3133, 3163), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(1)', '(2)'], {}), '(1, 2)\n', (3157, 3163), False, 'from absl.testing import parameterized\n'), ((5357, 5387), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(1)', '(2)'], {}), '(1, 2)\n', (5381, 5387), Fal...
# -*- coding: utf-8 -*- # Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np import pytest import pandapower as pp import pandapower.shortcircuit as sc @pytest.fixture def w...
[ "pandapower.create_sgen", "numpy.isclose", "numpy.sqrt", "pandapower.create_ext_grid", "pandapower.create_empty_network", "pandapower.create_line_from_parameters", "pandapower.shortcircuit.calc_sc", "pytest.main", "numpy.array", "pandapower.create_line", "pandapower.create_bus" ]
[((351, 376), 'pandapower.create_empty_network', 'pp.create_empty_network', ([], {}), '()\n', (374, 376), True, 'import pandapower as pp\n'), ((387, 427), 'pandapower.create_bus', 'pp.create_bus', (['net'], {'vn_kv': '(110.0)', 'index': '(1)'}), '(net, vn_kv=110.0, index=1)\n', (400, 427), True, 'import pandapower as p...
import numpy as np import os from PIL import Image, ImageDraw from tqdm import tqdm from Detection.AdvancedEAST import cfg from Detection.AdvancedEAST.preprocess import preprocess_single_image,preprocess_no_cfg def point_inside_of_quad(px, py, quad_xy_list, p_min, p_max): if (p_min[0] <= px <= p_max[0]) and (p_min...
[ "numpy.abs", "numpy.copy", "numpy.reshape", "numpy.amin", "numpy.minimum", "numpy.sin", "os.path.join", "numpy.square", "numpy.zeros", "PIL.ImageDraw.Draw", "numpy.sign", "numpy.concatenate", "numpy.cos", "numpy.maximum", "Detection.AdvancedEAST.preprocess.preprocess_no_cfg", "numpy.am...
[((1814, 1857), 'numpy.concatenate', 'np.concatenate', (['(diff_1to3, diff_4)'], {'axis': '(0)'}), '((diff_1to3, diff_4), axis=0)\n', (1828, 1857), True, 'import numpy as np\n'), ((2186, 2198), 'numpy.abs', 'np.abs', (['diff'], {}), '(diff)\n', (2192, 2198), True, 'import numpy as np\n'), ((2245, 2287), 'numpy.arctan',...
'''custom colormaps for use with matplotlib scatter and imshow''' import matplotlib.colors as co import numpy as np def name2color(name): ''' Return the 3-element RGB array of a given color name. ''' return co.hex2color(co.cnames[name]) def one2another(bottom='white', top='red', alphabottom=1.0, alphatop=1.0, N=2...
[ "numpy.random.normal", "matplotlib.pyplot.colorbar", "numpy.linspace", "numpy.vstack", "matplotlib.pyplot.scatter", "matplotlib.colors.hex2color", "numpy.arange", "matplotlib.pyplot.show" ]
[((212, 241), 'matplotlib.colors.hex2color', 'co.hex2color', (['co.cnames[name]'], {}), '(co.cnames[name])\n', (224, 241), True, 'import matplotlib.colors as co\n'), ((476, 517), 'numpy.linspace', 'np.linspace', (['rgb_bottom[0]', 'rgb_top[0]', 'N'], {}), '(rgb_bottom[0], rgb_top[0], N)\n', (487, 517), True, 'import nu...
from os.path import join import argparse import numpy as np import torch import torch.nn.functional as F from torch.autograd import Variable from pt.common.settings import results_path, TRAIN, VAL from pt.common.utils import ( safe_makedirs, append_log, setup_log) from pt.common.optimizers import get_optimizer, ...
[ "pt.common.utils.safe_makedirs", "torch.autograd.Variable", "argparse.ArgumentParser", "torch.nn.functional.nll_loss", "torch.load", "os.path.join", "pt.recog.data.factory.get_data_loader", "torch.cuda.is_available", "pt.common.utils.setup_log", "pt.common.utils.append_log", "numpy.genfromtxt", ...
[((625, 667), 'os.path.join', 'join', (['results_path', 'namespace', 'TRAIN_MODEL'], {}), '(results_path, namespace, TRAIN_MODEL)\n', (629, 667), False, 'from os.path import join\n'), ((690, 726), 'os.path.join', 'join', (['train_model_path', '"""best_model"""'], {}), "(train_model_path, 'best_model')\n", (694, 726), F...
""" SYS-611: Buffon's Needle Experiment Example with Antithetic Variables. This example performs a Monte Carlo simulation of Buffon's Needle Experiment to estimate the probability of a needle of certain length crossing lines on a floor with certain spacing. This probability is proportional to the mathematical constant...
[ "numpy.random.rand", "matplotlib.pyplot.ylabel", "numpy.average", "matplotlib.pyplot.xlabel", "scipy.stats.norm.ppf", "matplotlib.pyplot.figure", "numpy.random.seed", "scipy.stats.sem", "numpy.sin", "matplotlib.pyplot.legend" ]
[((1920, 1937), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1934, 1937), True, 'import numpy as np\n'), ((2111, 2151), 'scipy.stats.norm.ppf', 'stats.norm.ppf', (['(1 - confidence_level / 2)'], {}), '(1 - confidence_level / 2)\n', (2125, 2151), True, 'import scipy.stats as stats\n'), ((2681, 2693), ...
import numpy as np import scipy.spatial.transform from moveit_commander.conversions import list_to_pose_stamped class Rotation(scipy.spatial.transform.Rotation): @classmethod def identity(cls): return cls.from_quat([0.0, 0.0, 0.0, 1.0]) class Transform(object): def __init__(self, rotation, trans...
[ "numpy.array", "numpy.zeros", "numpy.asarray" ]
[((389, 423), 'numpy.asarray', 'np.asarray', (['translation', 'np.double'], {}), '(translation, np.double)\n', (399, 423), True, 'import numpy as np\n'), ((1445, 1470), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (1453, 1470), True, 'import numpy as np\n'), ((1724, 1735), 'numpy.zeros',...
#!/usr/bin/env python3 # load needed modules import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation, Flatten, Dropout, GRU , BatchNormalization from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import pandas as pd imp...
[ "keras.layers.Flatten", "sklearn.model_selection.train_test_split", "numpy.asarray", "keras.models.Sequential", "numpy.array", "numpy.around", "keras.layers.Dense", "keras.layers.BatchNormalization", "numpy.load", "keras.layers.Dropout" ]
[((423, 447), 'numpy.load', 'np.load', (['"""X_egemaps.npy"""'], {}), "('X_egemaps.npy')\n", (430, 447), True, 'import numpy as np\n'), ((452, 476), 'numpy.load', 'np.load', (['"""y_egemaps.npy"""'], {}), "('y_egemaps.npy')\n", (459, 476), True, 'import numpy as np\n'), ((777, 804), 'numpy.array', 'np.array', (['norm_a...
# -------------- # Importing header files import numpy as np # Path of the file has been stored in variable called 'path' data_file='path' # path for the file data = np.genfromtxt(path, delimiter=",", skip_header=1,dtype=str) print("\nData: \n\n", data) print("\nType of data: \n\n", type(data)) #New re...
[ "numpy.mean", "numpy.std", "numpy.asarray", "numpy.max", "numpy.concatenate", "numpy.min", "numpy.genfromtxt" ]
[((174, 234), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)', 'dtype': 'str'}), "(path, delimiter=',', skip_header=1, dtype=str)\n", (187, 234), True, 'import numpy as np\n'), ((418, 460), 'numpy.concatenate', 'np.concatenate', (['(new_record, data)'], {'axis': '(0)'}), '(...
# Walking engine for Starkit Kondo OpenMV # Copyright STARKIT Soccer team of MIPT import math import sys import time import numpy as np class Alpha(object): def compute_alpha_v3(self, xt,yt,zt,x,y,z,w, sizes, limAlpha): from math import sqrt,cos,sin,asin,fabs,tan,atan #t1_start =time.perf_coun...
[ "math.tan", "numpy.random.choice", "math.asin", "math.sqrt", "math.degrees", "time.sleep", "math.radians", "math.cos", "numpy.random.randint", "math.fabs", "math.atan2", "numpy.random.uniform", "math.sin", "sys.path.append", "math.atan" ]
[((506, 522), 'math.cos', 'math.cos', (['alpha5'], {}), '(alpha5)\n', (514, 522), False, 'import math\n'), ((538, 554), 'math.sin', 'math.sin', (['alpha5'], {}), '(alpha5)\n', (546, 554), False, 'import math\n'), ((569, 601), 'math.sqrt', 'math.sqrt', (['(x * x + y * y + z * z)'], {}), '(x * x + y * y + z * z)\n', (578...
from __future__ import print_function, absolute_import, division from future.builtins import * from future import standard_library standard_library.install_aliases() import future.utils from functools import reduce import fractions import operator import os import re import sys import tempfile from html.parser import...
[ "os.path.exists", "re.compile", "os.access", "os.environ.get", "os.path.join", "fractions.Fraction", "future.standard_library.install_aliases", "os.path.dirname", "numpy.zeros", "os.path.isdir", "functools.partial", "tempfile.NamedTemporaryFile", "sys.stdout.flush", "os.path.normcase" ]
[((131, 165), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (163, 165), False, 'from future import standard_library\n'), ((9231, 9273), 're.compile', 're.compile', (['"""-?\\\\d+(\\\\.\\\\d+)?(e[-+]?\\\\d+)"""'], {}), "('-?\\\\d+(\\\\.\\\\d+)?(e[-+]?\\\\d+)')\n", (9241...
# Copyright 2018 the GPflow authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
[ "gpflow.config.Config", "numpy.ones", "gpflow.utilities.set_trainable", "tensorflow.ones", "gpflow.likelihoods.Gaussian", "gpflow.kernels.SquaredExponential", "gpflow.utilities.traversal.leaf_components", "gpflow.Parameter", "pytest.mark.parametrize", "numpy.zeros", "tensorflow.keras.layers.Dens...
[((868, 892), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (889, 892), True, 'import numpy as np\n'), ((12138, 12196), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[A, B, create_kernel, create_model]'}), '(params=[A, B, create_kernel, create_model])\n', (12152, 12196), False, 'im...
""" This module is used to call Quantum Espresso simulation and parse its output The user need to supply a complete input script with single-point scf calculation, CELL_PARAMETERS, ATOMIC_POSITIONS, nat, ATOMIC_SPECIES arguments. It is case sensitive. and the nat line should be the first argument of the line it appear...
[ "flare.struc.get_unique_species", "numpy.array", "subprocess.call", "flare.struc.Structure", "numpy.shape", "numpy.fromstring", "os.remove" ]
[((1834, 1856), 'os.remove', 'os.remove', (['newfilename'], {}), '(newfilename)\n', (1843, 1856), False, 'import os\n'), ((3069, 3097), 'subprocess.call', 'call', (['qe_command'], {'shell': '(True)'}), '(qe_command, shell=True)\n', (3073, 3097), False, 'from subprocess import call\n'), ((4437, 4451), 'numpy.array', 'np...
import numpy as np import random from collections import defaultdict class Agent: def __init__(self, nA=6 ): """ Initialize agent. Params ====== - nA: number of actions available to the agent """ self.nA = nA self.Q = defaultdict(lambda: np.zeros(self.nA)) ...
[ "random.uniform", "numpy.ones", "numpy.random.choice", "numpy.argmax", "numpy.max", "numpy.dot", "numpy.zeros" ]
[((1831, 1866), 'numpy.dot', 'np.dot', (['self.Q[next_state]', 'p_probs'], {}), '(self.Q[next_state], p_probs)\n', (1837, 1866), True, 'import numpy as np\n'), ((907, 931), 'numpy.argmax', 'np.argmax', (['self.Q[state]'], {}), '(self.Q[state])\n', (916, 931), True, 'import numpy as np\n'), ((967, 992), 'numpy.random.ch...
""" Tests for Series cumulative operations. See also -------- tests.frame.test_cumulative """ from itertools import product import numpy as np import pytest import pandas as pd from pandas import _is_numpy_dev import pandas._testing as tm def _check_accum_op(name, series, check_dtype=True): f...
[ "pandas.Series", "pandas._testing.assert_series_equal", "pandas.to_timedelta", "pytest.mark.xfail", "itertools.product", "pytest.mark.parametrize", "pandas._testing.assert_numpy_array_equal", "numpy.array", "pandas.to_datetime" ]
[((621, 692), 'pandas._testing.assert_numpy_array_equal', 'tm.assert_numpy_array_equal', (['result.values', 'expected'], {'check_dtype': '(False)'}), '(result.values, expected, check_dtype=False)\n', (648, 692), True, 'import pandas._testing as tm\n'), ((935, 1046), 'pytest.mark.xfail', 'pytest.mark.xfail', (['_is_nump...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "io.BytesIO", "numpy.array", "pyarrow.feather.write_feather", "pandas.date_range", "pandas.util.testing.assert_frame_equal", "os.remove", "os.path.exists", "numpy.arange", "pytest.mark.xfail", "pyarrow.lib.FeatherWriter", "pandas.Categorical", "numpy.random.seed", "pytest.mark.skipif", "pa...
[((11435, 11508), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""not supported ATM"""', 'raises': 'NotImplementedError'}), "(reason='not supported ATM', raises=NotImplementedError)\n", (11452, 11508), False, 'import pytest\n'), ((12366, 12471), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not os.path....
import sys,os import math import random #import mpmath import operator import csv import numpy as np import matplotlib.pyplot as plt import matplotlib.pylab as pyl import itertools import scipy as sp from scipy import stats from scipy import optimize from scipy.integrate import quad #import scikits.statsmodels as sm ...
[ "numpy.array", "scipy.optimize.fmin", "scipy.optimize.leastsq" ]
[((7735, 7746), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (7743, 7746), True, 'import numpy as np\n'), ((7755, 7766), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (7763, 7766), True, 'import numpy as np\n'), ((7985, 8036), 'scipy.optimize.leastsq', 'optimize.leastsq', (['f', 'p'], {'maxfev': '(10000)', 'full...
#!/usr/bin/env python3 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Author: <NAME>, <NAME> & <NAME> # Copyright 2019, by the California Institute of Technology. ALL RIGHTS # RESERVED. United States Government Sponsorship acknowledged. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
[ "os.path.exists", "os.makedirs", "RAiDER.logger.logger.debug", "RAiDER.logger.logger.error", "os.getcwd", "matplotlib.pyplot.close", "numpy.nanmax", "numpy.nanmin", "RAiDER.logger.logger.warning", "RAiDER.logger.logger.exception", "RAiDER.utilFcns.getTimeFromFile" ]
[((1085, 1118), 'os.makedirs', 'os.makedirs', (['wmLoc'], {'exist_ok': '(True)'}), '(wmLoc, exist_ok=True)\n', (1096, 1118), False, 'import os\n'), ((3260, 3308), 'RAiDER.logger.logger.debug', 'logger.debug', (['f"""Shape of weather model: {shape}"""'], {}), "(f'Shape of weather model: {shape}')\n", (3272, 3308), False...
#!/usr/bin/python # vim: set fileencoding=utf-8 : """Extract counts of each Köppen-Geiger/slope/land cover/soil health for each country, for use in Project Drawdown solution models.""" import argparse import math import os.path import pdb import signal import sys import tempfile import osgeo.gdal import osgeo.gdal...
[ "signal.signal", "pdb.Pdb", "numpy.unique", "argparse.ArgumentParser", "numpy.logical_not", "geoutil.is_sparse", "pandas.set_option", "geoutil.km2_block", "geoutil.blklim", "sys.exit", "numpy.ma.masked_array", "numpy.nansum", "numpy.seterr", "numpy.set_printoptions" ]
[((420, 458), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (433, 458), True, 'import pandas as pd\n'), ((459, 499), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(40)'], {}), "('display.max_columns', 40)\n", (472, 499), True, 'im...
"""--- Day 20: Trench Map ---""" from pathlib import Path from bitarray import bitarray from bitarray.util import ba2int from numpy import array from numpy import byte from numpy import ones from numpy import sum as sum_ from numpy import zeros from aoc import open_utf8 M_RANGE = 3 // 2 # Algorithm horizontal searc...
[ "numpy.ones", "aoc.open_utf8", "numpy.sum", "numpy.zeros", "bitarray.bitarray" ]
[((1422, 1497), 'numpy.zeros', 'zeros', (['(initial_rows + 2 * M_RANGE, initial_cols + 2 * N_RANGE)'], {'dtype': 'byte'}), '((initial_rows + 2 * M_RANGE, initial_cols + 2 * N_RANGE), dtype=byte)\n', (1427, 1497), False, 'from numpy import zeros\n'), ((2898, 2909), 'numpy.sum', 'sum_', (['image'], {}), '(image)\n', (290...
import numpy as np def converge_aitken_series(f, n_start=0, f_startm1=0, eps=1e-6, max_iter=-1, min_consec=2): """Finds the limit of a series using Aitken acceleration an = converge_aitken_series(f, n_start, f_startm1) where f(n, fp) returns the nth member of the sequence given the n-1th member e.g. to...
[ "numpy.isinf", "numpy.asarray", "numpy.isnan" ]
[((765, 778), 'numpy.asarray', 'np.asarray', (['a'], {}), '(a)\n', (775, 778), True, 'import numpy as np\n'), ((794, 805), 'numpy.isnan', 'np.isnan', (['a'], {}), '(a)\n', (802, 805), True, 'import numpy as np\n'), ((848, 859), 'numpy.isinf', 'np.isinf', (['a'], {}), '(a)\n', (856, 859), True, 'import numpy as np\n'), ...
from google.cloud import storage import os from datetime import datetime import firebase_admin from firebase_admin import credentials from firebase_admin import db import googlemaps from time import time import numpy as np import cv2 # Fetch the service account key JSON file contents try: cred = credentials.Certif...
[ "firebase_admin.db.reference", "google.cloud.storage.Client", "cv2.imencode", "firebase_admin.initialize_app", "googlemaps.Client", "datetime.datetime.now", "firebase_admin.credentials.Certificate", "numpy.random.uniform", "time.time" ]
[((701, 730), 'googlemaps.Client', 'googlemaps.Client', ([], {'key': 'appkey'}), '(key=appkey)\n', (718, 730), False, 'import googlemaps\n'), ((302, 396), 'firebase_admin.credentials.Certificate', 'credentials.Certificate', (['"""../smart-waste-locator-firebase-adminsdk-ljjzx-495a7e327a.json"""'], {}), "(\n '../smar...
from numpy.testing import (assert_allclose, assert_almost_equal, assert_array_equal, assert_array_almost_equal_nulp) import numpy as np import pytest import matplotlib.mlab as mlab from matplotlib.cbook.deprecation import MatplotlibDeprecationWarning def _stride_repeat(*args, **kw...
[ "numpy.random.standard_normal", "matplotlib.mlab.detrend_linear", "matplotlib.mlab.specgram", "numpy.iterable", "numpy.prod", "matplotlib.mlab._single_spectrum_helper", "numpy.array", "pytest.fixture", "numpy.sin", "matplotlib.mlab.psd", "numpy.arange", "matplotlib.mlab.apply_window", "numpy...
[((32566, 32661), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""iscomplex"""', '[False, True]'], {'ids': "['real', 'complex']", 'scope': '"""class"""'}), "('iscomplex', [False, True], ids=['real', 'complex'],\n scope='class')\n", (32589, 32661), False, 'import pytest\n'), ((32686, 32775), 'pytest.mark....
# @Author: Ivan # @LastEdit: 2020/9/25 import os import random import cv2 # install import numpy as np # install def load_img_from_folder(root, nb_classes, nb_per_class, width, height, depth, train_proportion, valid_proportion, test_proportion, shuffle=True, rescale=True, normalize=True): ...
[ "cv2.imwrite", "numpy.fromfile", "os.listdir", "random.shuffle", "os.rename", "os.path.join", "numpy.asarray", "cv2.medianBlur", "numpy.array", "numpy.ndarray.flatten", "os.path.isdir", "cv2.cvtColor", "cv2.resize", "cv2.imread", "os.remove" ]
[((2090, 2106), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (2100, 2106), False, 'import os\n'), ((4370, 4407), 'numpy.array', 'np.array', (['train_data'], {'dtype': '"""float32"""'}), "(train_data, dtype='float32')\n", (4378, 4407), True, 'import numpy as np\n'), ((4426, 4462), 'numpy.array', 'np.array', (...
import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt alpha = 0.5 beta = 0.2 b = np.array( [ 1 - alpha, 0, -( 1 - alpha ) ] ) a = np.array( [ 2, -2 * beta * ( 1 + alpha ), 2 * alpha ] ) w, H = signal.freqz( b, a ) H1 = abs( H ) alpha = 0.5 beta = 0.5 b = np.array( [ 1 - alpha, 0, -( 1 - alp...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "scipy.signal.freqz", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((109, 147), 'numpy.array', 'np.array', (['[1 - alpha, 0, -(1 - alpha)]'], {}), '([1 - alpha, 0, -(1 - alpha)])\n', (117, 147), True, 'import numpy as np\n'), ((158, 207), 'numpy.array', 'np.array', (['[2, -2 * beta * (1 + alpha), 2 * alpha]'], {}), '([2, -2 * beta * (1 + alpha), 2 * alpha])\n', (166, 207), True, 'imp...
# USAGE # python quantize_example.py # import the necessary packages from __future__ import print_function from ir import BagOfVisualWords from sklearn.metrics import pairwise import numpy as np # randomly generate the vocabulary/cluster centers along with the feature # vectors -- we'll generate 10 feature vectos con...
[ "ir.BagOfVisualWords", "numpy.zeros", "numpy.random.seed", "numpy.random.uniform", "numpy.argmin" ]
[((403, 421), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (417, 421), True, 'import numpy as np\n'), ((430, 460), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(3, 6)'}), '(size=(3, 6))\n', (447, 460), True, 'import numpy as np\n'), ((472, 503), 'numpy.random.uniform', 'np.random.unif...
""" Copyright (c) 2018-2020 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wri...
[ "numpy.argmin", "numpy.array", "pathlib.Path", "copy.deepcopy" ]
[((5995, 6017), 'copy.deepcopy', 'deepcopy', (['self._config'], {}), '(self._config)\n', (6003, 6017), False, 'from copy import deepcopy\n'), ((6305, 6325), 'copy.deepcopy', 'deepcopy', (['self._meta'], {}), '(self._meta)\n', (6313, 6325), False, 'from copy import deepcopy\n'), ((3077, 3109), 'pathlib.Path', 'Path', ([...
import os import math import torch import numpy as np class EvaluationSinhalaSongsDataset(torch.utils.data.Dataset): def __init__(self, root_dir, trim_seconds=10, indexing=False): self.dir = root_dir self.feature_list = sorted(os.listdir(self.dir)) self.trim_seconds = trim_seconds ...
[ "os.listdir", "math.floor", "os.path.join", "torch.from_numpy", "torch.is_tensor", "numpy.load", "torch.cat" ]
[((828, 848), 'torch.is_tensor', 'torch.is_tensor', (['idx'], {}), '(idx)\n', (843, 848), False, 'import torch\n'), ((1039, 1089), 'os.path.join', 'os.path.join', (['self.dir', 'self.feature_list[file_id]'], {}), '(self.dir, self.feature_list[file_id])\n', (1051, 1089), False, 'import os\n'), ((1112, 1149), 'numpy.load...
import os import numpy as np from utils.utils import json_from_file, get_files_from_dir, get_module_attr # get list of themes (excluding python system files) def get_themes(dir): theme_dir = 'themes/{dir}'.format(dir=dir) themes = get_files_from_dir(theme_dir) return themes # pick random theme from a libr...
[ "numpy.random.choice", "os.path.splitext", "utils.utils.get_files_from_dir" ]
[((240, 269), 'utils.utils.get_files_from_dir', 'get_files_from_dir', (['theme_dir'], {}), '(theme_dir)\n', (258, 269), False, 'from utils.utils import json_from_file, get_files_from_dir, get_module_attr\n'), ((415, 439), 'numpy.random.choice', 'np.random.choice', (['themes'], {}), '(themes)\n', (431, 439), True, 'impo...
# This artist can be used to deal with the sampling of the data as well as any # RGB blending. from __future__ import absolute_import import numpy as np from glue.utils import view_shape from matplotlib.colors import ColorConverter, Colormap from astropy.visualization import (LinearStretch, SqrtStretch, AsinhStretc...
[ "numpy.product", "numpy.clip", "matplotlib.colors.ColorConverter", "numpy.atleast_2d", "astropy.visualization.ContrastBiasStretch", "numpy.isscalar", "numpy.ones", "numpy.any", "glue.utils.view_shape", "numpy.zeros", "numpy.isnan", "astropy.visualization.ManualInterval" ]
[((457, 473), 'matplotlib.colors.ColorConverter', 'ColorConverter', ([], {}), '()\n', (471, 473), False, 'from matplotlib.colors import ColorConverter, Colormap\n'), ((5140, 5162), 'numpy.product', 'np.product', (['self.shape'], {}), '(self.shape)\n', (5150, 5162), True, 'import numpy as np\n'), ((2610, 2640), 'astropy...
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "logging.getLogger", "time.sleep", "pytorch_lightning.utilities.exceptions.MisconfigurationException", "pytorch_lightning.utilities.rank_zero_warn", "pytorch_lightning.overrides.distributed.prepare_for_backward", "pytorch_lightning.utilities.seed.reset_seed", "pytorch_lightning.utilities.exceptions.Dead...
[((2703, 2730), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2720, 2730), False, 'import logging\n'), ((6903, 6988), 'torch.nn.parallel.distributed.DistributedDataParallel', 'DistributedDataParallel', ([], {'module': 'model', 'device_ids': 'device_ids'}), '(module=model, device_ids=dev...
# In[] import cv2 import numpy as np import os from operator import eq import random import matplotlib.pyplot as plt BasePath = "D:/[Data]/[Cardiomegaly]/1_ChestPA_Labeled_Baeksongyi/[PNG]_2_Generated_Data(2k)/Generated_Data_20180410_191400_Seg_Base_Expand_20pixel_Cropped_Detected" ImgPath = BasePath + '/Imgs/te...
[ "matplotlib.pyplot.imshow", "cv2.rectangle", "os.listdir", "numpy.bitwise_or", "matplotlib.pyplot.savefig", "matplotlib.pyplot.Axes", "numpy.asarray", "os.path.isfile", "matplotlib.pyplot.figure", "numpy.zeros", "cv2.imread", "matplotlib.pyplot.show" ]
[((554, 573), 'os.listdir', 'os.listdir', (['ImgPath'], {}), '(ImgPath)\n', (564, 573), False, 'import os\n'), ((587, 619), 'cv2.imread', 'cv2.imread', (["(ImgPath + '/' + file)"], {}), "(ImgPath + '/' + file)\n", (597, 619), False, 'import cv2\n'), ((630, 660), 'numpy.asarray', 'np.asarray', (['img'], {'dtype': '"""ui...
import tensorflow as tf import numpy as np import time def constfn(val): def f(frac): return val * frac return f class Model(object): def __init__(self, env, world, policies, ncommtime=20, nminibatches=4, noptepochs=4): self.env = env self.world = world self.policies = poli...
[ "numpy.mean", "numpy.hstack", "numpy.where", "numpy.array", "tensorflow.constant", "numpy.nonzero", "numpy.std", "numpy.arange", "numpy.random.shuffle" ]
[((1313, 1339), 'numpy.hstack', 'np.hstack', (['actions_n[:n_a]'], {}), '(actions_n[:n_a])\n', (1322, 1339), True, 'import numpy as np\n'), ((2586, 2603), 'numpy.arange', 'np.arange', (['nbatch'], {}), '(nbatch)\n', (2595, 2603), True, 'import numpy as np\n'), ((3141, 3168), 'numpy.mean', 'np.mean', (['mblossvals'], {'...
# KNN으로 기술적분석 지표들과 변동성을 Feature로 향후 20일 동안 # 목표 수익률을 달성할 가능성이 있는지를 추정한다. # # 2018.08.20, 아마추어퀀트 (조성현) # -------------------------------------------------------- import tensorflow as tf import matplotlib.pyplot as plt import numpy as np import pandas as pd from MyUtil import YahooData, TaFeatureSet stocks = {'005380':'...
[ "tensorflow.reset_default_graph", "pandas.read_csv", "matplotlib.pyplot.ylabel", "numpy.where", "matplotlib.pyplot.legend", "tensorflow.placeholder", "tensorflow.Session", "matplotlib.pyplot.xlabel", "MyUtil.TaFeatureSet.getTaFeatureSet", "tensorflow.negative", "numpy.array", "matplotlib.pyplo...
[((1701, 1741), 'pandas.read_csv', 'pd.read_csv', (['"""dataset/3-6.TaDataset.csv"""'], {}), "('dataset/3-6.TaDataset.csv')\n", (1712, 1741), True, 'import pandas as pd\n'), ((1956, 1990), 'numpy.array', 'np.array', (['ds.iloc[0:trainLen, 0:6]'], {}), '(ds.iloc[0:trainLen, 0:6])\n', (1964, 1990), True, 'import numpy as...
""" Benchmark processing in Dask This mimics the overall structure and workload of our processing. <NAME> 8 November 2017 <EMAIL> """ import csv import numpy from dask import delayed from distributed import Client, wait, LocalCluster # Make some randomly located points on 2D plane def sparse(n, margin=0.1): num...
[ "csv.DictWriter", "time.sleep", "dask.bag.from_sequence", "copy.deepcopy", "distributed.LocalCluster", "argparse.ArgumentParser", "seqfile.findNextFile", "numpy.fft.fft", "numpy.max", "numpy.random.seed", "pprint.PrettyPrinter", "distributed.Client", "socket.gethostname", "numpy.round", ...
[((317, 343), 'numpy.random.seed', 'numpy.random.seed', (['(8753193)'], {}), '(8753193)\n', (334, 343), False, 'import numpy\n'), ((594, 629), 'numpy.zeros', 'numpy.zeros', (['shape'], {'dtype': '"""complex"""'}), "(shape, dtype='complex')\n", (605, 629), False, 'import numpy\n'), ((855, 876), 'copy.deepcopy', 'copy.de...
import pandas as pd from scipy.io import wavfile import numpy as np import argparse def stock_to_wav(filename): prices = pd.read_csv(f"{filename}.csv").Close.values prices = np.diff(prices) scale = (2**15) * 0.8 / max(map(abs, [prices.max(), prices.min()])) prices = (prices * scale) mx, mn = price...
[ "scipy.io.wavfile.write", "numpy.diff", "argparse.ArgumentParser", "pandas.read_csv" ]
[((184, 199), 'numpy.diff', 'np.diff', (['prices'], {}), '(prices)\n', (191, 199), True, 'import numpy as np\n'), ((459, 505), 'scipy.io.wavfile.write', 'wavfile.write', (['f"""{filename}.wav"""', '(2000)', 'prices'], {}), "(f'{filename}.wav', 2000, prices)\n", (472, 505), False, 'from scipy.io import wavfile\n'), ((54...
import json import os from concurrent import futures import numpy as np from elf.io import open_file from tqdm import tqdm from ..metadata import read_dataset_metadata def compute_contrast_limits( source_prefix, dataset_folder, lower_percentile, upper_percentile, n_threads, cache_path=None ): if cache_path i...
[ "os.path.exists", "numpy.median", "elf.io.open_file", "concurrent.futures.ThreadPoolExecutor", "os.path.join", "json.load", "numpy.percentile", "json.dump" ]
[((1239, 1277), 'numpy.median', 'np.median', (['[res[0] for res in results]'], {}), '([res[0] for res in results])\n', (1248, 1277), True, 'import numpy as np\n'), ((1289, 1327), 'numpy.median', 'np.median', (['[res[1] for res in results]'], {}), '([res[1] for res in results])\n', (1298, 1327), True, 'import numpy as n...
#/usr/bin/env python """ Input/Output classes that are used by 3D-DAOSTORM, sCMOS, Spliner and Multiplane analysis. Hazen 09/17 """ import numpy import os import sys from xml.etree import ElementTree import storm_analysis.sa_library.datareader as datareader import storm_analysis.sa_library.parameters as params impor...
[ "numpy.ones_like", "os.path.exists", "storm_analysis.sa_library.datareader.inferReader", "storm_analysis.sa_library.sa_h5py.SAH5Py", "xml.etree.ElementTree.tostring", "numpy.max", "numpy.sum", "storm_analysis.sa_library.static_background.StaticBGEstimator", "storm_analysis.sa_library.writeinsight3.I...
[((772, 811), 'numpy.load', 'numpy.load', (['filename'], {'allow_pickle': '(True)'}), '(filename, allow_pickle=True)\n', (782, 811), False, 'import numpy\n'), ((1416, 1455), 'numpy.load', 'numpy.load', (['filename'], {'allow_pickle': '(True)'}), '(filename, allow_pickle=True)\n', (1426, 1455), False, 'import numpy\n'),...
""" Credits: Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise) Copyright (c) 2017-2022 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> (Sinergise) Copyright (c) 2019-2020 <NAME>, <NAME> (Sinergise) Copyright (c) 2017-2019 <NAME>, <NAME>, <NAME> (Sinergise) This source code is licensed under the MIT lic...
[ "eolearn.mask.SnowMaskTask", "pytest.mark.parametrize", "numpy.sum", "pytest.raises", "eolearn.mask.TheiaSnowMaskTask" ]
[((529, 649), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params"""', "[{'dem_params': (100, 100, 100)}, {'red_params': 45}, {'ndsi_params': (0.2, 3)}\n ]"], {}), "('params', [{'dem_params': (100, 100, 100)}, {\n 'red_params': 45}, {'ndsi_params': (0.2, 3)}])\n", (552, 649), False, 'import pytest\...
""" MS COCO object detection dataset. """ import os import cv2 import logging import mxnet as mx import numpy as np from PIL import Image import torch.utils.data as data from .dataset_metainfo import DatasetMetaInfo __all__ = ['CocoDetMetaInfo'] class CocoDetDataset(data.Dataset): """ MS COCO detection datas...
[ "numpy.clip", "mxnet.Context", "numpy.hstack", "numpy.array_split", "numpy.array", "numpy.sin", "os.path.exists", "pycocotools.coco.COCO", "numpy.asarray", "numpy.stack", "numpy.dot", "mxnet.nd.array", "numpy.maximum", "os.path.expanduser", "mxnet.nd.stack", "cv2.warpAffine", "numpy....
[((23766, 23822), 'numpy.array', 'np.array', (['[orig_w / 2.0, orig_h / 2.0]'], {'dtype': 'np.float32'}), '([orig_w / 2.0, orig_h / 2.0], dtype=np.float32)\n', (23774, 23822), True, 'import numpy as np\n'), ((2537, 2561), 'os.path.expanduser', 'os.path.expanduser', (['root'], {}), '(root)\n', (2555, 2561), False, 'impo...
# ref: https://github.com/Cysu/open-reid/blob/master/reid/evaluation_metrics/ranking.py from collections import defaultdict from .utils import * import numpy as np from sklearn.metrics import average_precision_score def _unique_sample(ids_dict, num): mask = np.zeros(num, dtype=np.bool) for _, indices in ids_...
[ "numpy.mean", "numpy.ones", "numpy.random.choice", "sklearn.metrics.average_precision_score", "numpy.where", "numpy.asarray", "numpy.any", "numpy.argsort", "numpy.zeros", "collections.defaultdict", "numpy.nonzero", "numpy.arange" ]
[((265, 293), 'numpy.zeros', 'np.zeros', (['num'], {'dtype': 'np.bool'}), '(num, dtype=np.bool)\n', (273, 293), True, 'import numpy as np\n'), ((1028, 1049), 'numpy.asarray', 'np.asarray', (['query_ids'], {}), '(query_ids)\n', (1038, 1049), True, 'import numpy as np\n'), ((1068, 1091), 'numpy.asarray', 'np.asarray', ([...
from __future__ import print_function, absolute_import from timeit import default_timer as time import numpy as np import numpy.core.umath_tests as ut from numba import void, float32, float64 from numba import guvectorize from numba import cuda from numba import unittest_support as unittest from numba.cuda.testing i...
[ "numba.unittest_support.main", "numba.cuda.device_array", "numpy.tile", "numpy.allclose", "timeit.default_timer", "numpy.testing.assert_allclose", "numpy.zeros_like", "numba.cuda.stream", "numba.cuda.to_device", "numba.void", "numpy.core.umath_tests.matrix_multiply", "numba.cuda.testing.skip_o...
[((393, 450), 'numba.cuda.testing.skip_on_cudasim', 'skip_on_cudasim', (['"""ufunc API unsupported in the simulator"""'], {}), "('ufunc API unsupported in the simulator')\n", (408, 450), False, 'from numba.cuda.testing import skip_on_cudasim\n'), ((10766, 10781), 'numba.unittest_support.main', 'unittest.main', ([], {})...
""" This module provides the Scan Op See scan.py for details on scan """ from __future__ import print_function __docformat__ = 'restructedtext en' __authors__ = ("<NAME> " "<NAME> " "<NAME> " "<NAME> ") __copyright__ = "(c) 2010, Universite de Montreal" __contact__ = "<NAM...
[ "logging.getLogger", "numpy.int8", "theano.shared", "numpy.int64", "theano.function", "theano.tensor.opt.Shape_i", "theano.compile.profilemode.ProfileMode", "numpy.asarray", "theano.compile.mode.get_mode", "theano.gof.Apply", "six.moves.xrange", "theano.compat.izip", "theano.gof.graph.is_sam...
[((686, 733), 'logging.getLogger', 'logging.getLogger', (['"""theano.scan_module.scan_op"""'], {}), "('theano.scan_module.scan_op')\n", (703, 733), False, 'import logging\n'), ((1729, 1761), 'theano.compile.mode.get_mode', 'compile.mode.get_mode', (['self.mode'], {}), '(self.mode)\n', (1750, 1761), False, 'from theano ...
# # Hello World client in Python # Connects REQ socket to tcp://localhost:5555 # Sends "Hello" to server, expects "World" back # import zmq import cv2 import json import numpy as np from zeromq.SerializingContext import SerializingContext print("Connecting to hello world server…") context = SerializingContext()...
[ "cv2.flip", "numpy.ascontiguousarray", "cv2.VideoCapture", "cv2.cvtColor", "cv2.resize", "cv2.waitKey", "zeromq.SerializingContext.SerializingContext" ]
[((300, 320), 'zeromq.SerializingContext.SerializingContext', 'SerializingContext', ([], {}), '()\n', (318, 320), False, 'from zeromq.SerializingContext import SerializingContext\n'), ((756, 775), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (772, 775), False, 'import cv2\n'), ((841, 879), 'cv2.cvtCo...
from __future__ import print_function, division import sys,os qspin_path = os.path.join(os.getcwd(),"../") sys.path.insert(0,qspin_path) from quspin.basis import spinless_fermion_basis_1d from quspin.basis import spinless_fermion_basis_general import numpy as np from itertools import product def check_ME(b1,b2,opstr...
[ "sys.path.insert", "quspin.basis.spinless_fermion_basis_1d", "numpy.testing.assert_allclose", "itertools.product", "os.getcwd", "quspin.basis.spinless_fermion_basis_general" ]
[((108, 138), 'sys.path.insert', 'sys.path.insert', (['(0)', 'qspin_path'], {}), '(0, qspin_path)\n', (123, 138), False, 'import sys, os\n'), ((89, 100), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (98, 100), False, 'import sys, os\n'), ((1373, 1403), 'itertools.product', 'product', (['Nfs', 'kblocks', 'pblocks'], {}),...
""" Mask, padding and batching. """ import numpy as np def pad_batch_data(insts, pad_idx=0, return_pos=False, return_input_mask=False, return_max_len=False, return_num_token=False, return_seq_lens=False)...
[ "numpy.expand_dims" ]
[((1371, 1411), 'numpy.expand_dims', 'np.expand_dims', (['input_mask_data'], {'axis': '(-1)'}), '(input_mask_data, axis=-1)\n', (1385, 1411), True, 'import numpy as np\n')]
# Copyright 2021 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, ...
[ "absl.app.UsageError", "numpy.sqrt", "absl.flags.DEFINE_float", "sklearn.datasets.load_boston", "absl.app.run", "numpy.dot", "jax.numpy.dot", "jaxopt.proximal_gradient2.ProximalGradient", "sklearn.preprocessing.Normalizer", "numpy.abs", "numpy.vdot", "numpy.sign", "time.time", "absl.flags....
[((1023, 1095), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""dataset"""'], {'default': '"""boston"""', 'help': '"""Dataset to use."""'}), "('dataset', default='boston', help='Dataset to use.')\n", (1042, 1095), False, 'from absl import flags\n'), ((1098, 1174), 'absl.flags.DEFINE_bool', 'flags.DEFINE_bool',...
# -*- coding: utf-8 -*- # mypy: ignore-errors import jax.numpy as jnp import numpy as np import tinygp def check_noise_model(noise, dense_rep): random = np.random.default_rng(6675) np.testing.assert_allclose(noise.diagonal(), jnp.diag(dense_rep)) np.testing.assert_allclose(noise + np.zeros_like(dense_r...
[ "tinygp.noise.Diagonal", "numpy.random.default_rng", "tinygp.noise.Dense", "numpy.triu_indices", "numpy.testing.assert_allclose", "numpy.zeros_like", "numpy.diag", "numpy.zeros", "tinygp.noise.Banded", "numpy.tril_indices", "numpy.arange", "jax.numpy.diag" ]
[((161, 188), 'numpy.random.default_rng', 'np.random.default_rng', (['(6675)'], {}), '(6675)\n', (182, 188), True, 'import numpy as np\n'), ((386, 440), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['(noise + y1)', '(dense_rep + y1)'], {}), '(noise + y1, dense_rep + y1)\n', (412, 440), True, 'import ...