code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python3 import sys sys.path.append('../..') import numpy as np from neml.cp import crystallography from neml.math import rotations import matplotlib.pyplot as plt if __name__ == "__main__": N = 300 orientations = rotations.random_orientations(N) sgroup = crystallography.SymmetryGroup("432") ...
[ "matplotlib.pyplot.hist", "neml.cp.crystallography.SymmetryGroup", "neml.math.rotations.random_orientations", "matplotlib.pyplot.figure", "numpy.rad2deg", "sys.path.append", "matplotlib.pyplot.show" ]
[((35, 59), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (50, 59), False, 'import sys\n'), ((238, 270), 'neml.math.rotations.random_orientations', 'rotations.random_orientations', (['N'], {}), '(N)\n', (267, 270), False, 'from neml.math import rotations\n'), ((283, 319), 'neml.cp.crystall...
import numpy as np import scipy as sp import ast import os from quchem.Unitary_Partitioning.Graph import Clique_cover_Hamiltonian import quchem.Misc_functions.conversion_scripts as conv_scr from copy import deepcopy from quchem.Unitary_Partitioning.Unitary_partitioning_LCU_method import LCU_linalg_Energy from openf...
[ "os.listdir", "pickle.dump", "numpy.isclose", "os.path.join", "pickle.load", "os.getcwd", "quchem.Unitary_Partitioning.Unitary_partitioning_LCU_method.LCU_linalg_Energy", "quchem.Misc_functions.conversion_scripts.Get_Openfermion_Hamiltonian", "datetime.datetime.now", "copy.deepcopy", "os.path.ab...
[((554, 591), 'os.path.join', 'os.path.join', (['working_dir', '"""Analysis"""'], {}), "(working_dir, 'Analysis')\n", (566, 591), False, 'import os\n'), ((613, 670), 'os.path.join', 'os.path.join', (['Analysis_dir', '"""SeqRot_LCU_script_A_results"""'], {}), "(Analysis_dir, 'SeqRot_LCU_script_A_results')\n", (625, 670)...
# Copyright 2019 Systems & Technology Research, LLC # Use of this software is governed by the license.txt file. import os import numpy as np import torch import torch.nn as nn import torchvision.transforms as transforms import torch.nn.functional as F from PIL import ImageFilter def prepare_vggface_image(img): ...
[ "torchvision.transforms.CenterCrop", "torch.nn.ReLU", "torch.nn.Dropout", "numpy.random.random", "torch.load", "numpy.rollaxis", "torchvision.transforms.Lambda", "torch.from_numpy", "torch.nn.Conv2d", "torch.nn.functional.normalize", "numpy.array", "torchvision.transforms.RandomCrop", "torch...
[((730, 759), 'numpy.rollaxis', 'np.rollaxis', (['img_bgr_fp', '(2)', '(0)'], {}), '(img_bgr_fp, 2, 0)\n', (741, 759), True, 'import numpy as np\n'), ((1862, 1896), 'torchvision.transforms.Compose', 'transforms.Compose', (['transform_list'], {}), '(transform_list)\n', (1880, 1896), True, 'import torchvision.transforms ...
from collections import defaultdict from pathlib import Path from typing import Dict, List, Optional import hydra import numpy as np import pandas as pd from omegaconf import DictConfig, OmegaConf from pytorch_lightning import ( Callback, LightningDataModule, LightningModule, Trainer, seed_everythi...
[ "src.utils.utils.get_logger", "pandas.read_csv", "src.utils.utils.log_cv_result", "pathlib.Path", "hydra.utils.instantiate", "pytorch_lightning.seed_everything", "src.utils.utils.log_hyperparameters", "numpy.array_split", "src.train.PrepareTmpFile", "collections.defaultdict", "src.utils.utils._l...
[((499, 525), 'src.utils.utils.get_logger', 'utils.get_logger', (['__name__'], {}), '(__name__)\n', (515, 525), False, 'from src.utils import utils\n'), ((1376, 1412), 'src.utils.utils._locate', 'utils._locate', (['config.model._target_'], {}), '(config.model._target_)\n', (1389, 1412), False, 'from src.utils import ut...
from __future__ import print_function import numpy as np import os class BFGS_Hessian(object): """ Class to evaluate the update to inverse Hessian matrix in the L-BFGS scheme. (see wikipedia article if nothing else). H is B^-1 form that article. B_k+1 = B + yy^t / (y^ts) - B s s^t B / (s^t Bk s)...
[ "os.path.exists", "numpy.random.set_state", "os.path.join", "numpy.max", "numpy.sum", "numpy.load", "numpy.save", "os.remove" ]
[((1529, 1569), 'numpy.load', 'np.load', (['self.paths2ys[n]'], {'mmap_mode': '"""r"""'}), "(self.paths2ys[n], mmap_mode='r')\n", (1536, 1569), True, 'import numpy as np\n'), ((1606, 1646), 'numpy.load', 'np.load', (['self.paths2ss[n]'], {'mmap_mode': '"""r"""'}), "(self.paths2ss[n], mmap_mode='r')\n", (1613, 1646), Tr...
# Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME> # # This file is pa...
[ "numpy.abs", "src.constants.VIEWS.is_cc", "numpy.array", "numpy.zeros", "src.constants.VIEWS.is_mlo", "numpy.expand_dims", "numpy.concatenate", "cv2.resize", "numpy.round" ]
[((2308, 2386), 'cv2.resize', 'cv2.resize', (['image_to_resize', '(size[1], size[0])'], {'interpolation': 'cv2.INTER_CUBIC'}), '(image_to_resize, (size[1], size[0]), interpolation=cv2.INTER_CUBIC)\n', (2318, 2386), False, 'import cv2\n'), ((3833, 3857), 'numpy.array', 'np.array', (['max_crop_noise'], {}), '(max_crop_no...
import numpy as np import matplotlib.pyplot as plt from astropy import units as u from astropy.coordinates import SkyCoord from astropy.io import fits from astropy.nddata import CCDData from astropy.nddata import Cutout2D from astropy.stats import sigma_clipped_stats from astropy.wcs.utils import proj_plane_pixel_scale...
[ "numpy.sqrt", "astropy.table.Table", "numpy.array", "photutils.source_properties", "photutils.psf.extract_stars", "astropy.io.fits.open", "numpy.arange", "matplotlib.pyplot.imshow", "photutils.EPSFBuilder", "astropy.units.degree.to", "astropy.visualization.make_lupton_rgb", "astropy.nddata.CCD...
[((5528, 5594), 'astropy.stats.sigma_clipped_stats', 'sigma_clipped_stats', (['self.data.data'], {'mask': 'self.data.mask'}), '(self.data.data, mask=self.data.mask, **kwargs)\n', (5547, 5594), False, 'from astropy.stats import sigma_clipped_stats\n'), ((7580, 7605), 'numpy.abs', 'np.abs', (['(xlim[1] - xlim[0])'], {}),...
import cv2 import numpy as np class TapeTracker(object): min_thresh = np.array( [80,0,0] ) max_thresh = np.array( [90, 255, 255] ) def __init_(self): self.img = np.zeros((500,500)) def pipeline(self, img): self.img = cv2.resize(img, (300,300), cv2.INTER_NEAREST) self.img = cv2.cvtColor(self.img, c...
[ "cv2.rectangle", "numpy.copy", "cv2.drawContours", "numpy.ones", "cv2.inRange", "cv2.contourArea", "numpy.array", "numpy.zeros", "cv2.circle", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.cvtColor", "cv2.moments", "cv2.findContours", "cv2.resize", "cv2.imread", "cv2.boundingRect" ]
[((74, 94), 'numpy.array', 'np.array', (['[80, 0, 0]'], {}), '([80, 0, 0])\n', (82, 94), True, 'import numpy as np\n'), ((110, 134), 'numpy.array', 'np.array', (['[90, 255, 255]'], {}), '([90, 255, 255])\n', (118, 134), True, 'import numpy as np\n'), ((1765, 1788), 'cv2.imread', 'cv2.imread', (['"""img/1.jpg"""'], {}),...
import sys # in this case local import sys.path.append("../") import mag2dpoly as mag import numpy as np # induced magnetization Jind = mag.MagnetizVector(mod=4.9,Ideg=90.0,Ddeg=45.0) # remanent magnetization Jrem = mag.MagnetizVector(mod=3.1,Ideg=45.0,Ddeg=0.0) # angle with the North axis northxax = 90.0 # numb...
[ "numpy.ones", "mag2dpoly.tmagpolybodies2Dgen", "mag2dpoly.MagnetizVector", "mag2dpoly.MagPolyBodies2D", "matplotlib.pyplot.plot", "matplotlib.pyplot.subplot", "numpy.array", "matplotlib.pyplot.figure", "numpy.append", "numpy.empty", "numpy.linspace", "matplotlib.pyplot.title", "sys.path.appe...
[((41, 63), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (56, 63), False, 'import sys\n'), ((141, 190), 'mag2dpoly.MagnetizVector', 'mag.MagnetizVector', ([], {'mod': '(4.9)', 'Ideg': '(90.0)', 'Ddeg': '(45.0)'}), '(mod=4.9, Ideg=90.0, Ddeg=45.0)\n', (159, 190), True, 'import mag2dpoly as mag...
from funlib.show.neuroglancer import add_layer, ScalePyramid import argparse import daisy import glob import neuroglancer import numpy as np import os import webbrowser from swc_parser import _parse_swc from pathlib import Path import itertools import random import logging ngid = itertools.count(start=1) parser = arg...
[ "logging.basicConfig", "funlib.show.neuroglancer.add_layer", "argparse.ArgumentParser", "pathlib.Path", "neuroglancer.Viewer", "numpy.round", "time.sleep", "neuroglancer.set_server_bind_address", "numpy.array", "itertools.count", "neuroglancer.AnnotationLayer", "logging.info", "swc_parser._p...
[((282, 306), 'itertools.count', 'itertools.count', ([], {'start': '(1)'}), '(start=1)\n', (297, 306), False, 'import itertools\n'), ((317, 342), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (340, 342), False, 'import argparse\n'), ((1419, 1466), 'neuroglancer.set_server_bind_address', 'neuro...
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error import glob, random import sklearn from sklearn.decomposition import PCA from xgboost.sklearn import XGBRegressor from sklearn.tr...
[ "sklearn.preprocessing.LabelEncoder", "pandas.read_csv", "sklearn.model_selection.train_test_split", "numpy.isin", "catboost.CatBoostRegressor", "os.path.abspath", "numpy.load" ]
[((691, 705), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}), '()\n', (703, 705), False, 'from sklearn.preprocessing import LabelEncoder\n'), ((828, 862), 'pandas.read_csv', 'pd.read_csv', (["(folder + '/Train.csv')"], {}), "(folder + '/Train.csv')\n", (839, 862), True, 'import pandas as pd\n'), ((2214,...
from MELC.utils.myDatasets import generate_workingRaw_from_raw, MELCStructureDataset import numpy as np import tifffile as tiff from MELC.utils.registration_daria import register import matplotlib.pyplot as plt import cv2 from MELC.utils.Files import create_folder from skimage import img_as_float, img_as_uint from MELC...
[ "MELC.utils.registration_daria.register", "MELC.utils.myDatasets.MELCStructureDataset", "tifffile.imread", "argparse.ArgumentParser", "skimage.img_as_uint", "numpy.where", "numpy.int16", "os.path.join", "MELC.utils.Files.create_folder", "tifffile.imsave", "numpy.percentile", "MELC.utils.myData...
[((550, 615), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run Training of Mask R-CNN"""'}), "(description='Run Training of Mask R-CNN')\n", (573, 615), False, 'import argparse\n'), ((1600, 1627), 'MELC.utils.myDatasets.MELCStructureDataset', 'MELCStructureDataset', (['w_raw'], {}), '(...
import numpy as np from utils import C_bohr __all__ = ['Grid'] class Grid: def __init__(self, npoints, rgrid, solver='sinc', alpha=0.0, rbar=0.0): self.ngrid = npoints self.rmin = rgrid[0] / C_bohr self.rmax = rgrid[1] / C_bohr rbar = rbar / C_bohr self.solver = solver.l...
[ "numpy.ones", "numpy.power", "numpy.sinc", "numpy.zeros", "numpy.linspace", "numpy.empty" ]
[((346, 365), 'numpy.ones', 'np.ones', (['self.ngrid'], {}), '(self.ngrid)\n', (353, 365), True, 'import numpy as np\n'), ((384, 404), 'numpy.zeros', 'np.zeros', (['self.ngrid'], {}), '(self.ngrid)\n', (392, 404), True, 'import numpy as np\n'), ((1523, 1602), 'numpy.linspace', 'np.linspace', (['self.rmin', 'self.rmax']...
import os import glob from tqdm import tqdm import argparse from PIL import Image import numpy as np import pandas as pd import torch import torch.nn as nn import torch.utils.data as data from torchvision import transforms, datasets from networks.dan import DAN def parse_args(): parser = argparse.ArgumentParse...
[ "torch.nn.CrossEntropyLoss", "pandas.read_csv", "torch.max", "torch.pow", "torch.eq", "torch.cuda.is_available", "torch.arange", "os.path.exists", "argparse.ArgumentParser", "tqdm.tqdm.write", "torchvision.datasets.ImageFolder", "torch.nn.AdaptiveAvgPool2d", "pandas.DataFrame", "torchvisio...
[((298, 323), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (321, 323), False, 'import argparse\n'), ((5792, 5817), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (5815, 5817), False, 'import torch\n'), ((5972, 6025), 'networks.dan.DAN', 'DAN', ([], {'num_class': 'args...
# Licensed under an MIT open source license - see LICENSE ''' Test functions for VCA ''' from unittest import TestCase import numpy as np import numpy.testing as npt from ..statistics import VCA, VCA_Distance from ._testing_data import \ dataset1, dataset2, computed_data, computed_distances class testVCA(Test...
[ "numpy.testing.assert_almost_equal", "numpy.allclose" ]
[((627, 682), 'numpy.allclose', 'np.allclose', (['self.tester.ps1D', "computed_data['vca_val']"], {}), "(self.tester.ps1D, computed_data['vca_val'])\n", (638, 682), True, 'import numpy as np\n'), ((858, 949), 'numpy.testing.assert_almost_equal', 'npt.assert_almost_equal', (['self.tester_dist.distance', "computed_distan...
# -*- coding:utf-8 -*- import numpy as np def sin_sin(x,y): return 1000*abs(np.sin(x/2000*np.pi) + np.sin(y/2000.0*np.pi))+100
[ "numpy.sin" ]
[((80, 104), 'numpy.sin', 'np.sin', (['(x / 2000 * np.pi)'], {}), '(x / 2000 * np.pi)\n', (86, 104), True, 'import numpy as np\n'), ((103, 129), 'numpy.sin', 'np.sin', (['(y / 2000.0 * np.pi)'], {}), '(y / 2000.0 * np.pi)\n', (109, 129), True, 'import numpy as np\n')]
from __future__ import division import numpy as np from path import Path from imageio import imread from skimage.transform import resize as imresize from kitti_util import pose_from_oxts_packet, generate_depth_map, read_calib_file, transform_from_rot_trans from datetime import datetime class KittiRawLoader(object): ...
[ "numpy.eye", "kitti_util.read_calib_file", "numpy.reshape", "numpy.genfromtxt", "datetime.datetime.strptime", "path.Path", "numpy.array", "numpy.dot", "kitti_util.generate_depth_map", "kitti_util.transform_from_rot_trans", "numpy.zeros", "numpy.cos", "numpy.linalg.norm", "imageio.imread", ...
[((6194, 6221), 'kitti_util.read_calib_file', 'read_calib_file', (['calib_file'], {}), '(calib_file)\n', (6209, 6221), False, 'from kitti_util import pose_from_oxts_packet, generate_depth_map, read_calib_file, transform_from_rot_trans\n'), ((6239, 6298), 'numpy.reshape', 'np.reshape', (["filedata['P_rect_' + scene_data...
import pickle import numpy as np import feature_extraction as fe """ source : https://www.census.gov/quickfacts/fact/table/alleghenycountypennsylvania/PST045216 """ CURR_YEAR = 2015 # gender FEMALE_PERCENT = 0.517 # 4327 # MALE = 0.483 # 3134 # age # BELOW_18 = 0.189 # 0 OVER_65_PERCENT = 0.18 # 4353 # OTHER = 0.631 #...
[ "numpy.random.randint" ]
[((3692, 3712), 'numpy.random.randint', 'np.random.randint', (['(2)'], {}), '(2)\n', (3709, 3712), True, 'import numpy as np\n')]
# -*- coding: UTF-8 -*- import socket import pyaudio import numpy as np import time import logging address = ('127.0.0.1', 8301) RATE = 8000 RECORD_SECONDS = 10 #录制时长,单位秒 FORMAT = pyaudio.paInt16 CHANNELS = 1 CHUNK=256 DEBUG=1 def start_client (): #socket init tcpClient = socket.socket(socket.AF_INET, sock...
[ "logging.basicConfig", "logging.debug", "socket.socket", "numpy.zeros", "time.time", "pyaudio.PyAudio", "logging.info" ]
[((286, 335), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (299, 335), False, 'import socket\n'), ((373, 436), 'logging.info', 'logging.info', (["(' connect to %s:%s OK' % (address[0], address[1]))"], {}), "(' connect to %s:%s OK' % (address...
# add LDDMM shooting code into path import sys sys.path.append('../vectormomentum/Code/Python'); sys.path.append('../library') from subprocess import call import argparse import os.path #Add deep learning related libraries from collections import Counter import torch import prediction_network import util import numpy...
[ "PyCA.Common.ImFromNPArr", "PyCA.Common.SaveITKField", "sys.exit", "PyCA.Common.FieldFromNPArr", "sys.path.append", "numpy.divide", "argparse.ArgumentParser", "PyCA.Common.LoadITKImage", "util.predict_momentum", "subprocess.call", "registration_methods.geodesic_shooting", "skimage.exposure.equ...
[((47, 95), 'sys.path.append', 'sys.path.append', (['"""../vectormomentum/Code/Python"""'], {}), "('../vectormomentum/Code/Python')\n", (62, 95), False, 'import sys\n'), ((97, 126), 'sys.path.append', 'sys.path.append', (['"""../library"""'], {}), "('../library')\n", (112, 126), False, 'import sys\n'), ((638, 743), 'ar...
#!/usr/bin/env python3 import math from typing import Iterable, Optional, Tuple, Union import numpy as np from analysis import linearity from utils import utils from unit_test import unit_test from processor import ProcessorBase from generation import signal_generation def generate_impulse(n_samp, am...
[ "utils.utils.approx_equal", "numpy.zeros", "numpy.ones", "numpy.arange" ]
[((354, 388), 'numpy.zeros', 'np.zeros', (['n_samp'], {'dtype': 'np.float64'}), '(n_samp, dtype=np.float64)\n', (362, 388), True, 'import numpy as np\n'), ((640, 671), 'utils.utils.approx_equal', 'utils.approx_equal', (['y[0]', 'slope'], {}), '(y[0], slope)\n', (658, 671), False, 'from utils import utils\n'), ((681, 71...
""" Copyright 2021 Objectiv B.V. """ import datetime import warnings from abc import ABC from enum import Enum from typing import Union, cast, List, Tuple, Optional, Any import numpy import pandas from sqlalchemy.engine import Dialect from bach import DataFrame from bach.series import Series, SeriesString, SeriesBool...
[ "datetime.datetime.utcfromtimestamp", "bach.series.utils.datetime_formats.parse_c_code_to_bigquery_code", "datetime.timedelta", "bach.series.series.ToPandasInfo", "bach.DataFrame.from_pandas", "bach.expression.Expression.construct", "numpy.datetime64", "warnings.warn", "bach.series.utils.datetime_fo...
[((2410, 2555), 'warnings.warn', 'warnings.warn', (['"""Call to deprecated method, we recommend to use SeriesAbstractDateTime.dt.strftime instead"""'], {'category': 'DeprecationWarning'}), "(\n 'Call to deprecated method, we recommend to use SeriesAbstractDateTime.dt.strftime instead'\n , category=DeprecationWarn...
import os import logging from timeit import default_timer as timer import numpy as np from automon import AutomonNode from automon.zmq_socket_utils import init_client_socket from function_def import func_inner_product logging.getLogger('automon').setLevel(logging.INFO) def time_to_wait_for_next_sample_milliseconds(st...
[ "logging.getLogger", "numpy.random.normal", "os.getenv", "timeit.default_timer", "automon.AutomonNode" ]
[((516, 583), 'automon.AutomonNode', 'AutomonNode', ([], {'idx': 'NODE_IDX', 'func_to_monitor': 'func_inner_product', 'd': '(40)'}), '(idx=NODE_IDX, func_to_monitor=func_inner_product, d=40)\n', (527, 583), False, 'from automon import AutomonNode\n'), ((1027, 1034), 'timeit.default_timer', 'timer', ([], {}), '()\n', (1...
#!/usr/bin/python #-*- coding: utf-8 -*- # >.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>. # Licensed under the Apache License, Version 2.0 (the "License") # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # --- File Name: shapes3d.py # --- Creation Date: 16-01-2021 # --- Last Modified: Tue 13 A...
[ "PIL.Image.fromarray", "os.path.join", "h5py.File", "numpy.array", "random.choices", "numpy.dot", "numpy.random.randint", "datasets.transforms.PairTransform", "torch.zeros", "torch.rand" ]
[((1353, 1385), 'numpy.array', 'np.array', (['[10, 10, 10, 8, 4, 15]'], {}), '([10, 10, 10, 8, 4, 15])\n', (1361, 1385), True, 'import numpy as np\n'), ((2578, 2589), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2586, 2589), True, 'import numpy as np\n'), ((2631, 2669), 'os.path.join', 'os.path.join', (['self.file...
# -*- coding: utf-8 -*- # Name: <NAME> # NUSP: 9778985 # Course Code: SCC0251 # Semester: 2019/1 # Assignment: 2 - Image enhancement and filtering # - import numpy as np import imageio # ## Defining functions # + # method 1 - limiarization def limiarization(img, t0): t = 0.5 * (np.nanmean(np.where(img > t0, img...
[ "numpy.median", "numpy.where", "numpy.zeros", "imageio.imread", "numpy.pad" ]
[((632, 655), 'numpy.where', 'np.where', (['(img > t)', '(1)', '(0)'], {}), '(img > t, 1, 0)\n', (640, 655), True, 'import numpy as np\n'), ((765, 805), 'numpy.zeros', 'np.zeros', (['imgFlat.shape'], {'dtype': 'np.double'}), '(imgFlat.shape, dtype=np.double)\n', (773, 805), True, 'import numpy as np\n'), ((1087, 1128),...
from functools import reduce import numpy as np import json import tensorflow as tf from scipy.optimize import linear_sum_assignment import os import time def deleteDuplicate_v1(input_dict_lst): f = lambda x,y:x if y in x else x + [y] return reduce(f, [[], ] + input_dict_lst) def get_context_pair(resp, l): label_w...
[ "tensorflow.gfile.Open", "numpy.reshape", "scipy.optimize.linear_sum_assignment", "tensorflow.contrib.predictor.from_saved_model", "functools.reduce", "json.dumps", "os.path.join", "tensorflow.logging.set_verbosity", "numpy.mod", "time.time" ]
[((2296, 2337), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (2320, 2337), True, 'import tensorflow as tf\n'), ((2830, 2875), 'os.path.join', 'os.path.join', (['FLAGS.buckets', 'FLAGS.input_file'], {}), '(FLAGS.buckets, FLAGS.input_file)\n', (2842, 28...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np def residuals(fit, obs): """Calculate residuals for fit compared to observed data :fit: list of discrete fit data points :obs: list of observed data points :returns: fit minus observed data points """ return fit-obs def fit_...
[ "numpy.sum", "numpy.mean", "numpy.sqrt" ]
[((486, 504), 'numpy.sum', 'np.sum', (['(resid ** 2)'], {}), '(resid ** 2)\n', (492, 504), True, 'import numpy as np\n'), ((1022, 1041), 'numpy.sum', 'np.sum', (['(resids ** 2)'], {}), '(resids ** 2)\n', (1028, 1041), True, 'import numpy as np\n'), ((1266, 1286), 'numpy.mean', 'np.mean', (['(resids ** 2)'], {}), '(resi...
"""Helper functions and classes for users. They should not be used in skorch directly. """ from collections import Sequence from collections import namedtuple from functools import partial import numpy as np from sklearn.base import BaseEstimator from sklearn.base import TransformerMixin import torch from skorch.cl...
[ "torch.unique", "numpy.flatnonzero", "numpy.stack", "numpy.issubdtype", "skorch.utils.to_tensor", "functools.partial", "skorch.utils.is_torch_data_type" ]
[((8580, 8618), 'functools.partial', 'partial', (['_make_split'], {'valid_ds': 'dataset'}), '(_make_split, valid_ds=dataset)\n', (8587, 8618), False, 'from functools import partial\n'), ((15120, 15140), 'numpy.stack', 'np.stack', (['Xf'], {'axis': '(1)'}), '(Xf, axis=1)\n', (15128, 15140), True, 'import numpy as np\n')...
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
[ "numpy.copy", "numpy.shape", "cv2.warpAffine", "numpy.minimum", "numpy.random.random", "numpy.exp", "numpy.array", "numpy.zeros", "numpy.random.randint", "cv2.cvtColor", "numpy.maximum", "numpy.mod", "numpy.arange" ]
[((1091, 1119), 'numpy.arange', 'np.arange', (['(0)', 'size', '(1)', 'float'], {}), '(0, size, 1, float)\n', (1100, 1119), True, 'import numpy as np\n'), ((1212, 1271), 'numpy.exp', 'np.exp', (['(-((x - x0) ** 2 + (y - y0) ** 2) / (2 * sigma ** 2))'], {}), '(-((x - x0) ** 2 + (y - y0) ** 2) / (2 * sigma ** 2))\n', (121...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ """ import sys import matplotlib.pyplot as plt import numpy as np # from tomo_encoders.misc_utils.feature_maps_vis import view_midplanes import cupy as cp import time import h5py #from recon_subvol import fbp_filter, recon_patch # from tomo_encoders import ...
[ "numpy.random.normal", "numpy.mean", "numpy.ceil", "cupy.cuda.Stream", "cupy.get_array_module", "time.time", "cupy.zeros" ]
[((621, 646), 'cupy.get_array_module', 'cp.get_array_module', (['data'], {}), '(data)\n', (640, 646), True, 'import cupy as cp\n'), ((877, 913), 'cupy.get_array_module', 'cp.get_array_module', (['vol[ss, ss, ss]'], {}), '(vol[ss, ss, ss])\n', (896, 913), True, 'import cupy as cp\n'), ((1436, 1452), 'cupy.cuda.Stream', ...
#!/usr/bin/env python """ Extract MFCC and filterbank features for the Buckeye dataset. Author: <NAME> Contact: <EMAIL> Date: 2019, 2021 """ from datetime import datetime from os import path from tqdm import tqdm import argparse import numpy as np import os import sys sys.path.append("..") from paths import buckey...
[ "features.extract_vad", "features.speaker_mvn", "os.makedirs", "os.path.join", "utils.segments_from_npz", "utils.read_vad_from_fa", "datetime.datetime.now", "os.path.isfile", "os.path.isdir", "utils.write_samediff_words", "numpy.savez_compressed", "sys.path.append" ]
[((273, 294), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (288, 294), False, 'import sys\n'), ((586, 649), 'os.path.join', 'path.join', (['""".."""', '"""data"""', "('buckeye_' + subset + '_speakers.list')"], {}), "('..', 'data', 'buckeye_' + subset + '_speakers.list')\n", (595, 649), False, '...
#ミニバッチ学習 import numpy as np from dataset.mnist import load_mnist (x_train, t_train), (x_test, t_test) =\ load_mnist(normalize=True, one_hot_label=True) print(x_train.shape) print(t_train.shape) train_size = x_train.shape[0] batch_size = 10 batch_mask = np.random.choice(train_size, batch_size) x_batch = x_train[b...
[ "numpy.random.choice", "dataset.mnist.load_mnist" ]
[((110, 156), 'dataset.mnist.load_mnist', 'load_mnist', ([], {'normalize': '(True)', 'one_hot_label': '(True)'}), '(normalize=True, one_hot_label=True)\n', (120, 156), False, 'from dataset.mnist import load_mnist\n'), ((260, 300), 'numpy.random.choice', 'np.random.choice', (['train_size', 'batch_size'], {}), '(train_si...
import numpy as np import torch import matplotlib.animation as animation import matplotlib.pyplot as plt from PIL import Image import ThinPlateSpline as TPS # 2048x2048.jpg size: 2048 x 2048 def on_press(event): p = np.array([ [693.55, 531.26], [1069.85, 1243.04], [1243.74, 1238.69], ...
[ "matplotlib.pyplot.imshow", "PIL.Image.open", "numpy.array", "matplotlib.pyplot.figure", "ThinPlateSpline.solve_system", "ThinPlateSpline.point_transform", "matplotlib.pyplot.show" ]
[((224, 651), 'numpy.array', 'np.array', (['[[693.55, 531.26], [1069.85, 1243.04], [1243.74, 1238.69], [472.82, 664.85],\n [552.5, 1460.07], [1021.03, 368.02], [1260.78, 1571.9], [93.16, 911.26],\n [234.85, 914.14], [383.34, 1140.97], [375.46, 853.36], [256.73, 597.61],\n [338.32, 502.28], [754.67, 337.95], [1...
import collections import os from itertools import product from pathlib import Path from typing import Dict, Iterator, List, NamedTuple, Optional, OrderedDict, Sequence, Tuple, Union import numpy as np import xarray as xr from tqdm import tqdm from bioimageio.core import image_helper from bioimageio.core import load_...
[ "bioimageio.core.load_resource_description", "bioimageio.core.image_helper.load_tensors", "bioimageio.core.prediction_pipeline.create_prediction_pipeline", "itertools.product", "tqdm.tqdm", "bioimageio.core.image_helper.save_image", "numpy.zeros", "xarray.DataArray", "bioimageio.core.image_helper.pa...
[((1538, 1554), 'itertools.product', 'product', (['*ranges'], {}), '(*ranges)\n', (1545, 1554), False, 'from itertools import product\n'), ((14736, 14802), 'bioimageio.core.image_helper.load_tensors', 'image_helper.load_tensors', (['inputs', 'prediction_pipeline.input_specs'], {}), '(inputs, prediction_pipeline.input_s...
import random import numpy as np def set_seed(random_state: int = 42) -> None: """Function fixes random state to ensure results are reproducible""" np.random.seed(random_state) random.seed(random_state)
[ "numpy.random.seed", "random.seed" ]
[((159, 187), 'numpy.random.seed', 'np.random.seed', (['random_state'], {}), '(random_state)\n', (173, 187), True, 'import numpy as np\n'), ((192, 217), 'random.seed', 'random.seed', (['random_state'], {}), '(random_state)\n', (203, 217), False, 'import random\n')]
#!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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, merg...
[ "numpy.eye", "transformations.euler_from_matrix", "transformations.euler_matrix", "anim_utils.animation_data.SkeletonBuilder", "numpy.asarray", "anim_utils.utilities.custom_math.angle_between_vectors", "numpy.array", "numpy.zeros", "numpy.dot", "numpy.deg2rad", "numpy.linalg.norm", "numpy.rad2...
[((2074, 2083), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (2080, 2083), True, 'import numpy as np\n'), ((3114, 3149), 'numpy.zeros', 'np.zeros', (['(self.n_frames, LEN_ROOT)'], {}), '((self.n_frames, LEN_ROOT))\n', (3122, 3149), True, 'import numpy as np\n'), ((4780, 4797), 'numpy.asarray', 'np.asarray', (['speed'...
import numpy as np import pydensecrf.densecrf as dcrf from pydensecrf.utils import compute_unary, create_pairwise_bilateral, create_pairwise_gaussian, unary_from_softmax def dense_crf(img, prob): ''' input: img: numpy array of shape (num of channels, height, width) prob: numpy array of shape (9, hei...
[ "pydensecrf.densecrf.DenseCRF2D", "numpy.argmax", "numpy.ascontiguousarray", "numpy.swapaxes", "pydensecrf.utils.unary_from_softmax" ]
[((733, 755), 'numpy.swapaxes', 'np.swapaxes', (['img', '(0)', '(2)'], {}), '(img, 0, 2)\n', (744, 755), True, 'import numpy as np\n'), ((848, 871), 'numpy.swapaxes', 'np.swapaxes', (['prob', '(1)', '(2)'], {}), '(prob, 1, 2)\n', (859, 871), True, 'import numpy as np\n'), ((945, 1001), 'pydensecrf.densecrf.DenseCRF2D',...
import os import numpy import scipy import scipy.optimize from cryspy.A_functions_base.symmetry_elements import \ calc_asymmetric_unit_cell_indexes from cryspy.A_functions_base.mempy import \ calc_mem_col, \ calc_mem_chi, \ calc_symm_elem_points_by_index_points, \ get_uniform_density_col, \ re...
[ "numpy.prod", "cryspy.A_functions_base.orbital_functions.calc_density_spherical", "cryspy.A_functions_base.flip_ratio.calc_flip_ratio_by_iint", "numpy.sqrt", "cryspy.A_functions_base.matrix_operations.calc_vv_as_v1_v2_v1", "numpy.logical_not", "numpy.array", "cryspy.A_functions_base.flip_ratio.calc_as...
[((4346, 4403), 'cryspy.A_functions_base.symmetry_elements.calc_asymmetric_unit_cell_indexes', 'calc_asymmetric_unit_cell_indexes', (['n_abc', 'full_symm_elems'], {}), '(n_abc, full_symm_elems)\n', (4379, 4403), False, 'from cryspy.A_functions_base.symmetry_elements import calc_asymmetric_unit_cell_indexes\n'), ((4424,...
import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from tqdm import tqdm import torch from torch.utils.data import DataLoader import torch.nn.functional as F from model.model import BaseNet from model.config import arguments from dataset.dataset import FlowerData def ge...
[ "torch.max", "dataset.dataset.FlowerData", "torch.cuda.is_available", "matplotlib.pyplot.switch_backend", "model.config.arguments", "torch.nn.functional.softmax", "numpy.save", "matplotlib.pyplot.close", "model.model.BaseNet", "matplotlib.pyplot.savefig", "numpy.ones", "torch.device", "matpl...
[((485, 518), 'model.model.BaseNet', 'BaseNet', ([], {'num_class': 'args.class_num'}), '(num_class=args.class_num)\n', (492, 518), False, 'from model.model import BaseNet\n'), ((820, 894), 'numpy.zeros', 'np.zeros', (['(args.class_num * args.num_image_per_class // 2, args.class_num)'], {}), '((args.class_num * args.num...
# Copyright 2021 The TensorFlow Probability 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 o...
[ "numpy.array" ]
[((1821, 2027), 'numpy.array', 'np.array', (['[1.4802036, 1.8915913, -0.011120212, 1.1328301, 1.2841645, 0.6033605, -\n 1.887041, -2.012894, 0.046582267, 1.5555662, 0.4305847, -1.7179363, -\n 1.1399889, -0.4432812, -1.4721184, 0.35457477]'], {}), '([1.4802036, 1.8915913, -0.011120212, 1.1328301, 1.2841645, \n ...
import pytest import numpy as np import pandas as pd import xarray as xr import bmorph from bmorph.util import mizuroute_utils as mizutil reference = xr.open_dataset("./bmorph/tests/data/test_reference.nc") routed = xr.open_dataset("./bmorph/tests/data/test_routed.nc") topo = xr.open_dataset("./bmorph/tests/data/tes...
[ "bmorph.util.mizuroute_utils.find_up", "bmorph.util.mizuroute_utils.find_max_kge", "bmorph.util.mizuroute_utils.find_min_kldiv", "bmorph.util.mizuroute_utils.map_headwater_sites", "bmorph.util.mizuroute_utils.find_max_r2", "numpy.isnan", "bmorph.util.mizuroute_utils.map_ref_sites", "xarray.open_datase...
[((153, 209), 'xarray.open_dataset', 'xr.open_dataset', (['"""./bmorph/tests/data/test_reference.nc"""'], {}), "('./bmorph/tests/data/test_reference.nc')\n", (168, 209), True, 'import xarray as xr\n'), ((219, 272), 'xarray.open_dataset', 'xr.open_dataset', (['"""./bmorph/tests/data/test_routed.nc"""'], {}), "('./bmorph...
''' Main function to be called from GCE's cloud function This function is in charge of adding training data to the datastore for later generation of models and feature study ''' import sys import os import time import numpy as np from google.cloud import datastore from google.cloud import storage from google.api_core...
[ "google.cloud.storage.Client", "os.path.exists", "sys.path.insert", "os.makedirs", "google.cloud.datastore.Entity", "google.cloud.datastore.Client", "imports.video_asset_processor.VideoAssetProcessor", "numpy.around", "time.time", "google.api_core.retry.if_exception_type", "google.api_core.retry...
[((381, 410), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""imports"""'], {}), "(0, 'imports')\n", (396, 410), False, 'import sys\n'), ((494, 512), 'google.cloud.datastore.Client', 'datastore.Client', ([], {}), '()\n', (510, 512), False, 'from google.cloud import datastore\n'), ((530, 546), 'google.cloud.storage.C...
#!/usr/bin/env python3.5 import sys import os import logging import numpy as np import musm from sklearn.utils import check_random_state from textwrap import dedent #1Social Choice _LOG = musm.get_logger('adt17') PROBLEMS = { 'synthetic': musm.Synthetic, 'pc': musm.PC, } USERS = { 'noiseless': musm.Noi...
[ "logging.basicConfig", "numpy.abs", "textwrap.dedent", "sklearn.utils.check_random_state", "logging.StreamHandler", "argparse.ArgumentParser", "musm.musm", "musm.dump", "numpy.append", "numpy.array", "numpy.zeros", "numpy.dot", "musm.get_logger", "numpy.seterr", "musm.subdict", "musm.l...
[((191, 215), 'musm.get_logger', 'musm.get_logger', (['"""adt17"""'], {}), "('adt17')\n", (206, 215), False, 'import musm\n'), ((1014, 1036), 'numpy.array', 'np.array', (['w'], {'copy': '(True)'}), '(w, copy=True)\n', (1022, 1036), True, 'import numpy as np\n'), ((1965, 1986), 'sklearn.utils.check_random_state', 'check...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Aug 4 15:57:47 2017 @author: wangronin """ import pdb import numpy as np from deap import benchmarks from GaussianProcess_old import GaussianProcess_extra as GaussianProcess from BayesOpt import BayesOpt, RandomForest, RrandomForest np.random.seed(1...
[ "numpy.ones", "numpy.random.rand", "GaussianProcess_old.GaussianProcess_extra", "deap.benchmarks.himmelblau", "numpy.array", "numpy.random.seed", "BayesOpt.BayesOpt" ]
[((304, 321), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (318, 321), True, 'import numpy as np\n'), ((416, 436), 'numpy.array', 'np.array', (['([-6] * dim)'], {}), '([-6] * dim)\n', (424, 436), True, 'import numpy as np\n'), ((442, 461), 'numpy.array', 'np.array', (['([6] * dim)'], {}), '([6] * dim)...
import numpy as np from compmech.stiffpanelbay import StiffPanelBay from compmech.analysis import freq, lb def test_freq_models(): print('Testing frequency analysis for StiffPanelBay with 2 plates') # From Table 4 of # Lee and Lee. "Vibration analysis of anisotropic plates with eccentric # stiffen...
[ "compmech.stiffpanelbay.StiffPanelBay", "numpy.allclose", "compmech.analysis.lb", "numpy.isclose", "compmech.analysis.freq" ]
[((1542, 1557), 'compmech.stiffpanelbay.StiffPanelBay', 'StiffPanelBay', ([], {}), '()\n', (1555, 1557), False, 'from compmech.stiffpanelbay import StiffPanelBay\n'), ((2164, 2187), 'compmech.analysis.lb', 'lb', (['k0', 'kG'], {'silent': '(True)'}), '(k0, kG, silent=True)\n', (2166, 2187), False, 'from compmech.analysi...
""" Script to export a PyTorch-based Pyrado policy to C++ """ import numpy as np import torch as to from rcsenv import ControlPolicy from pyrado.policies.linear import LinearPolicy from pyrado.policies.rnn import RNNPolicy from pyrado.spaces.box import BoxSpace from pyrado.utils.data_types import EnvSpec from pyrado.p...
[ "torch.get_default_dtype", "torch.set_printoptions", "rcsenv.ControlPolicy", "torch.set_default_dtype", "numpy.array", "pyrado.policies.features.FeatureStack", "pyrado.spaces.box.BoxSpace", "numpy.set_printoptions" ]
[((963, 994), 'torch.set_default_dtype', 'to.set_default_dtype', (['to.double'], {}), '(to.double)\n', (983, 994), True, 'import torch as to\n'), ((1346, 1377), 'rcsenv.ControlPolicy', 'ControlPolicy', (['"""torch"""', 'tmpfile'], {}), "('torch', tmpfile)\n", (1359, 1377), False, 'from rcsenv import ControlPolicy\n'), ...
# Author: <NAME> ''' Hierarchy of subroutines:: hh_param_from_profile |--- _calc_rho() |--- helper_site_response.thk2dep() |--- _calc_Gmax() |--- _calc_vertical_stress() |--- _calc_OCR() |--- _calc_K0() |--- _calc_PI() |--- _calc_shear_strength() |--- _calc_K0() |--- pro...
[ "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "numpy.log", "numpy.column_stack", "numpy.array", "numpy.linalg.norm", "numpy.arange", "numpy.mean", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.zeros_like", "numpy.max", "numpy.linspace", "numpy.min", "numpy.argmin",...
[((15961, 15981), 'numpy.zeros_like', 'np.zeros_like', (['GGmax'], {}), '(GGmax)\n', (15974, 15981), True, 'import numpy as np\n'), ((16313, 16331), 'numpy.zeros_like', 'np.zeros_like', (['OCR'], {}), '(OCR)\n', (16326, 16331), True, 'import numpy as np\n'), ((17257, 17279), 'numpy.zeros', 'np.zeros', (['(9, n_layer)']...
import time import functools import numpy as np def time_compute(fun): @functools.wraps(fun) def wrapper(*args, **kwargs): start_time = time.time() tmp = fun(*args, **kwargs) end_time = time.time() print('{} cost {} s.'.format(fun.__name__, end_time-start_time)) return ...
[ "numpy.array", "time.time", "functools.wraps" ]
[((78, 98), 'functools.wraps', 'functools.wraps', (['fun'], {}), '(fun)\n', (93, 98), False, 'import functools\n'), ((378, 398), 'functools.wraps', 'functools.wraps', (['fun'], {}), '(fun)\n', (393, 398), False, 'import functools\n'), ((154, 165), 'time.time', 'time.time', ([], {}), '()\n', (163, 165), False, 'import t...
import numpy as np arr1 = np.ones (2, dtype=float) print("1D Array with ones ") print(arr1) #[1. 1.]
[ "numpy.ones" ]
[((27, 50), 'numpy.ones', 'np.ones', (['(2)'], {'dtype': 'float'}), '(2, dtype=float)\n', (34, 50), True, 'import numpy as np\n')]
import matplotlib.pyplot as plt import numpy as np import operator import os import sys import tensorflow as tf # 256*256 映射到 0~1 区间 def Transform(input): if not (operator.eq(input.shape, (256, 256))): print("not matched") sys.exit(1) max = np.max(input) min = np.min(input) for i in r...
[ "os.path.exists", "matplotlib.pyplot.savefig", "numpy.ones", "sys.exit", "os.makedirs", "numpy.max", "numpy.min", "operator.eq", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.show" ]
[((774, 806), 'numpy.ones', 'np.ones', (['(256, 256)'], {'dtype': 'float'}), '((256, 256), dtype=float)\n', (781, 806), True, 'import numpy as np\n'), ((268, 281), 'numpy.max', 'np.max', (['input'], {}), '(input)\n', (274, 281), True, 'import numpy as np\n'), ((292, 305), 'numpy.min', 'np.min', (['input'], {}), '(input...
import tensorflow as tf from keras.preprocessing.image import ImageDataGenerator import numpy as np from keras.preprocessing import image import zipfile import os import pickle from keras.models import model_from_json from django.conf import settings from django.conf import settings def training(): zip_ref = zipf...
[ "keras.preprocessing.image.img_to_array", "tensorflow.keras.layers.Conv2D", "zipfile.ZipFile", "keras.preprocessing.image.ImageDataGenerator", "keras.models.model_from_json", "tensorflow.keras.layers.Dense", "numpy.expand_dims", "os.path.abspath", "tensorflow.keras.layers.Flatten", "tensorflow.ker...
[((316, 349), 'zipfile.ZipFile', 'zipfile.ZipFile', (['"""check.zip"""', '"""r"""'], {}), "('check.zip', 'r')\n", (331, 349), False, 'import zipfile\n'), ((434, 530), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255)', 'shear_range': '(0.2)', 'zoom_range': '(0.2)', 'hor...
from pyHalo.Rendering.SpatialDistributions.uniform import LensConeUniform import numpy as np from copy import deepcopy from pyHalo.Rendering.MassFunctions.power_law import GeneralPowerLaw from pyHalo.Rendering.rendering_class_base import RenderingClassBase class TwoHaloContribution(RenderingClassBase): """ Th...
[ "pyHalo.Rendering.MassFunctions.power_law.GeneralPowerLaw", "numpy.array", "pyHalo.Rendering.SpatialDistributions.uniform.LensConeUniform", "copy.deepcopy" ]
[((1205, 1269), 'pyHalo.Rendering.SpatialDistributions.uniform.LensConeUniform', 'LensConeUniform', (["keywords_master['cone_opening_angle']", 'geometry'], {}), "(keywords_master['cone_opening_angle'], geometry)\n", (1220, 1269), False, 'from pyHalo.Rendering.SpatialDistributions.uniform import LensConeUniform\n'), ((2...
import vtreat.util import pandas import numpy def test_range(): # https://github.com/WinVector/pyvtreat/blob/master/Examples/Bugs/asarray_issue.md # https://github.com/WinVector/pyvtreat/issues/7 numpy.random.seed(2019) arr = numpy.random.randint(2, size=10) sparr = pandas.arrays.SparseArray(arr, ...
[ "pandas.arrays.SparseArray", "numpy.random.randint", "numpy.random.seed" ]
[((210, 233), 'numpy.random.seed', 'numpy.random.seed', (['(2019)'], {}), '(2019)\n', (227, 233), False, 'import numpy\n'), ((244, 276), 'numpy.random.randint', 'numpy.random.randint', (['(2)'], {'size': '(10)'}), '(2, size=10)\n', (264, 276), False, 'import numpy\n'), ((289, 333), 'pandas.arrays.SparseArray', 'pandas....
import numpy as np def directional_coupler_lc(wavelength_nm, n_eff_1, n_eff_2): ''' Calculates the coherence length (100% power transfer) of a directional coupler. Args: wavelength_nm (float): The wavelength in [nm] the directional coupler should operate at. n_eff_1 (float...
[ "numpy.radians", "numpy.abs" ]
[((2038, 2051), 'numpy.abs', 'np.abs', (['kappa'], {}), '(kappa)\n', (2044, 2051), True, 'import numpy as np\n'), ((1900, 1931), 'numpy.radians', 'np.radians', (['incidence_angle_deg'], {}), '(incidence_angle_deg)\n', (1910, 1931), True, 'import numpy as np\n')]
import os from typing import IO from PySDDP.newave.script.templates.confhd import ConfhdTemplate from matplotlib import pyplot as plt import numpy as np from random import randint from mpl_toolkits.mplot3d import Axes3D class Confhd(ConfhdTemplate): def __init__(self): super().__init__() self.li...
[ "numpy.sqrt", "matplotlib.pyplot.ylabel", "numpy.count_nonzero", "numpy.array", "numpy.arange", "numpy.mean", "numpy.where", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.barh", "os.path.split", "numpy.max", "numpy.linspace", "matplotlib.pyplot.yticks", "numpy....
[((29927, 29952), 'numpy.where', 'np.where', (['(incremental < 0)'], {}), '(incremental < 0)\n', (29935, 29952), True, 'import numpy as np\n'), ((31508, 31533), 'numpy.where', 'np.where', (['(incremental < 0)'], {}), '(incremental < 0)\n', (31516, 31533), True, 'import numpy as np\n'), ((32292, 32333), 'numpy.array', '...
import glob import os import subprocess import time import matplotlib.pyplot as plt import numpy import torch def viz( batch: torch.Tensor, episodes=1000, video=True, folder='output', ) -> None: ## Visualize GoodAI Breakout Dataset fig = plt.figure(1) ax = fig.add_subplot(111) ax.set_title("B...
[ "matplotlib.pyplot.figure", "numpy.zeros", "subprocess.call", "time.time", "glob.glob", "os.remove" ]
[((261, 274), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (271, 274), True, 'import matplotlib.pyplot as plt\n'), ((454, 465), 'time.time', 'time.time', ([], {}), '()\n', (463, 465), False, 'import time\n'), ((348, 372), 'numpy.zeros', 'numpy.zeros', (['(84, 84, 4)'], {}), '((84, 84, 4))\n', (359,...
import torch import numpy as np import cv2 def tonumpyimg(img): """ Convert a normalized tensor image to unnormalized uint8 numpy image For single channel image, no unnormalization is done. :param img: torch, normalized, (3, H, W), (H, W) :return: numpy: (H, W, 3), (H, W). uint8 """ ...
[ "numpy.repeat", "torch.Tensor", "torch.argmax", "torch.from_numpy", "torch.tensor", "cv2.warpPerspective", "cv2.cvtColor", "torch.device" ]
[((2321, 2351), 'torch.argmax', 'torch.argmax', (['attention'], {'dim': '(0)'}), '(attention, dim=0)\n', (2333, 2351), False, 'import torch\n'), ((2707, 2748), 'cv2.warpPerspective', 'cv2.warpPerspective', (['map', 'H'], {'dsize': '(w, h)'}), '(map, H, dsize=(w, h))\n', (2726, 2748), False, 'import cv2\n'), ((3586, 360...
# MIT License # Copyright 2020 <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, di...
[ "morpheus_core.helpers.fits_helper.open_file", "pytest.mark.filterwarnings", "numpy.arange", "morpheus_core.tests.helpers.make_sample_file2", "morpheus_core.helpers.fits_helper.dtype_to_bytes_per_value", "os.path.join", "morpheus_core.tests.helpers.make_sample_file", "astropy.io.fits.getdata", "pyte...
[((2846, 2895), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore::UserWarning"""'], {}), "('ignore::UserWarning')\n", (2872, 2895), False, 'import pytest\n'), ((1447, 1461), 'morpheus_core.tests.helpers.setup', 'helper.setup', ([], {}), '()\n', (1459, 1461), True, 'import morpheus_core.tests.hel...
#!/usr/bin/env python # Created by "Thieu" at 00:16, 15/03/2022 ----------% # Email: <EMAIL> % # Github: https://github.com/thieu1995 % ...
[ "mealpy.bio_based.BBO.OriginalBBO", "pytest.mark.parametrize", "numpy.sum", "pytest.raises", "pytest.fixture", "mealpy.bio_based.BBO.BaseBBO" ]
[((485, 515), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (499, 515), False, 'import pytest\n'), ((3242, 3489), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""problem, p_m, system_code"""', "[(problem, None, 0), (problem, 'hello', 0), (problem, -1.0, 0), (prob...
""" Mask R-CNN Train on the toy Balloon dataset and implement color splash effect. Copyright (c) 2018 Matterport, Inc. Licensed under the MIT License (see LICENSE for details) Written by <NAME> ------------------------------------------------------------""" import os import sys import json import numpy as...
[ "mrcnn.model.MaskRCNN", "os.path.join", "numpy.array", "mrcnn.visualize.display_instances", "os.path.abspath", "sys.path.append", "matplotlib.pyplot.subplots" ]
[((541, 566), 'os.path.abspath', 'os.path.abspath', (['"""../../"""'], {}), "('../../')\n", (556, 566), False, 'import os\n'), ((590, 615), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (605, 615), False, 'import sys\n'), ((1185, 1215), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs"...
# -*- coding: utf-8 -*- """ Created on Tue Nov 10 22:12:12 2020 @author: vxr131730 """ import glob import os import sys import random import time import numpy as np import cv2 from test import * from casadi import * from numpy import random as npr from casadi.tools import * try: sys.path.appe...
[ "time.sleep", "carla.Client", "carla.Color", "numpy.transpose", "glob.glob" ]
[((633, 664), 'carla.Client', 'carla.Client', (['"""localhost"""', '(2000)'], {}), "('localhost', 2000)\n", (645, 664), False, 'import carla\n'), ((4756, 4773), 'numpy.transpose', 'np.transpose', (['lbx'], {}), '(lbx)\n', (4768, 4773), True, 'import numpy as np\n'), ((4785, 4802), 'numpy.transpose', 'np.transpose', (['...
""" Collection of functions to calculate lag correlations and significance following Ebisuzaki 97 JCLIM """ def phaseran(recblk, nsurr,ax): """ Phaseran by <NAME>: http://www.mathworks.nl/matlabcentral/fileexchange/32621-phase-randomization/content/phaseran.m Args: recblk (2D array): Row: time sample....
[ "numpy.tile", "numpy.mean", "numpy.flip", "numpy.random.rand", "numpy.flipud", "numpy.fft.fft", "numpy.ndim", "numpy.exp", "numpy.zeros", "ds21grl.misc.AxRoll", "numpy.concatenate", "numpy.std", "numpy.moveaxis", "numpy.percentile", "numpy.fft.ifft", "numpy.arange" ]
[((1166, 1184), 'ds21grl.misc.AxRoll', 'AxRoll', (['recblk', 'ax'], {}), '(recblk, ax)\n', (1172, 1184), False, 'from ds21grl.misc import AxRoll\n'), ((1453, 1478), 'numpy.arange', 'np.arange', (['(1)', '(len_ser + 1)'], {}), '(1, len_ser + 1)\n', (1462, 1478), True, 'import numpy as np\n'), ((1491, 1520), 'numpy.arang...
import argparse import os import mlflow import numpy as np import pandas as pd import torch import torch.optim as optim from matplotlib import pyplot as plt from matplotlib.backends.backend_agg import FigureCanvasAgg from mlflow import log_metric, log_param, get_artifact_uri from skimage.io import imsave from sklearn.m...
[ "mlflow.create_experiment", "matplotlib.pyplot.grid", "numpy.sqrt", "matplotlib.pyplot.ylabel", "mlflow.log_param", "torch.cuda.is_available", "argparse.Namespace", "numpy.arange", "sklearn.model_selection.ParameterGrid", "transform.transforms", "torch.set_grad_enabled", "argparse.ArgumentPars...
[((6499, 6585), 'sampler.TomoBatchSampler', 'TomoBatchSampler', ([], {'batch_size': 'args.batch_size', 'data_frame': 'dataset_train.data_frame'}), '(batch_size=args.batch_size, data_frame=dataset_train.\n data_frame)\n', (6515, 6585), False, 'from sampler import TomoBatchSampler\n'), ((6687, 6800), 'torch.utils.data...
import numpy as np def point_to_seg(x1, x2) -> np.ndarray: ''' Method: ------- Transform 2 points into a parametrized segment. Implicitely phi is in [-pi/2; pi/2], it is the oriented angle the segment makes with the horizontal line passing through its middle c. ''' c = (x1[:2] + x2[:2]...
[ "numpy.abs", "numpy.hstack", "numpy.sum", "numpy.cos", "numpy.sign", "numpy.sin" ]
[((793, 815), 'numpy.hstack', 'np.hstack', (['[c, r, phi]'], {}), '([c, r, phi])\n', (802, 815), True, 'import numpy as np\n'), ((395, 417), 'numpy.sum', 'np.sum', (['((x2 - x1) ** 2)'], {}), '((x2 - x1) ** 2)\n', (401, 417), True, 'import numpy as np\n'), ((472, 494), 'numpy.sum', 'np.sum', (['((x2 - x1) ** 2)'], {}),...
# -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>), <NAME>(<EMAIL>) @description: Graph classify """ import numpy from sklearn.metrics import f1_score, accuracy_score from sklearn.multiclass import OneVsRestClassifier from sklearn.preprocessing import MultiLabelBinarizer class TopKRanker(OneVsRestClassifier): d...
[ "sklearn.metrics.f1_score", "numpy.asarray", "numpy.random.seed", "sklearn.preprocessing.MultiLabelBinarizer", "sklearn.metrics.accuracy_score" ]
[((702, 727), 'numpy.asarray', 'numpy.asarray', (['all_labels'], {}), '(all_labels)\n', (715, 727), False, 'import numpy\n'), ((894, 933), 'sklearn.preprocessing.MultiLabelBinarizer', 'MultiLabelBinarizer', ([], {'sparse_output': '(True)'}), '(sparse_output=True)\n', (913, 933), False, 'from sklearn.preprocessing impor...
# 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...
[ "numpy.ones", "tvm.relay.backend.contrib.ethosu.codegen._create_cascader", "tvm.contrib.ethosu.cascader.EthosuDeviceConfig", "pytest.importorskip", "tvm.contrib.ethosu.cascader.MemoryRegion", "tvm.IRModule", "tvm.relay.transform.InferType", "tvm.relay.analysis.free_vars", "tvm.relay.var" ]
[((906, 940), 'pytest.importorskip', 'pytest.importorskip', (['"""ethosu.vela"""'], {}), "('ethosu.vela')\n", (925, 940), False, 'import pytest\n'), ((1329, 1461), 'tvm.contrib.ethosu.cascader.MemoryRegion', 'MemoryRegion', ([], {'name': '"""SRAM"""', 'size': '(10 ** 6)', 'read_bandwidth': '(16)', 'write_bandwidth': '(...
# encoding: utf-8 ''' Created on Dec 18, 2018 @author: <NAME> ''' import time from array import * from ctypes import * from sys import exit from multiprocessing import Process from multiprocessing import Queue import numpy as np class EmotivDeviceReader(object): ''' classdocs This class is used to read ...
[ "multiprocessing.Process", "time.sleep", "numpy.array", "sys.exit", "multiprocessing.Queue" ]
[((9695, 9708), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (9705, 9708), False, 'import time\n'), ((494, 511), 'multiprocessing.Queue', 'Queue', ([], {'maxsize': '(-1)'}), '(maxsize=-1)\n', (499, 511), False, 'from multiprocessing import Queue\n'), ((8523, 8548), 'multiprocessing.Process', 'Process', ([], {'ta...
import scipy import matplotlib.pyplot as plt import numpy as np x = [ 0.001, 0.019, 0.039, 0.058, 0.080, 0.098, 0.119, 0.139, 0.159, 0.180, 0.198, 0.249, 0.298, 0.349, 0.398, 0.419, 0.439, 0.460, 0.479, 0.499, 0.519, 0.540, 0.558, 0.578, 0.598, 0.649, 0.698, 0.749, 0.798, 0.819, 0.839, 0.859, 0.879...
[ "numpy.polyfit", "numpy.poly1d", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((724, 738), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (736, 738), True, 'import matplotlib.pyplot as plt\n'), ((1037, 1047), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1045, 1047), True, 'import matplotlib.pyplot as plt\n'), ((827, 862), 'numpy.polyfit', 'np.polyfit', (['x', 'y', '...
import unittest import numpy as np import torch from torch import optim from spn.structure.Base import Product, Sum from spn.structure.Base import assign_ids, rebuild_scopes_bottom_up from spn.structure.leaves.parametric.Parametric import Gaussian, Categorical from spn.gpu.TensorFlow import spn_to_tf_graph, optimize_...
[ "pytorch.SumNode.from_spn", "spn.structure.Base.Sum", "numpy.log", "spn.algorithms.Inference.log_likelihood", "spn.structure.leaves.parametric.Parametric.Gaussian", "numpy.array", "unittest.main", "pytorch.GaussianNode.from_spn", "spn.structure.leaves.parametric.Parametric.Categorical", "tensorflo...
[((7532, 7547), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7545, 7547), False, 'import unittest\n'), ((790, 817), 'torch.log', 'torch.log', (['x[:, self.scope]'], {}), '(x[:, self.scope])\n', (799, 817), False, 'import torch\n'), ((1172, 1197), 'numpy.array', 'np.array', (['[0.1, 0.4, 0.5]'], {}), '([0.1, 0.4...
import numpy as np import pandas as pd from welib.tools.clean_exceptions import * from welib.FEM.graph import Node as GraphNode from welib.FEM.graph import Element as GraphElement from welib.FEM.graph import NodeProperty from welib.FEM.graph import GraphModel class MaterialProperty(NodeProperty): def __init__(se...
[ "welib.FEM.graph.Element.__init__", "welib.FEM.reduction.CraigBampton", "numpy.zeros", "welib.FEM.graph.Node.__init__", "welib.FEM.graph.GraphModel.__init__", "numpy.set_printoptions" ]
[((2329, 2363), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(500)'}), '(linewidth=500)\n', (2348, 2363), True, 'import numpy as np\n'), ((464, 501), 'welib.FEM.graph.Node.__init__', 'GraphNode.__init__', (['self', 'ID', 'x', 'y', 'z'], {}), '(self, ID, x, y, z)\n', (482, 501), True, 'from welib...
from __future__ import print_function from astrometry.util.fits import * import pylab as plt import numpy as np from glob import glob from astrometry.util.plotutils import * from astrometry.libkd.spherematch import * from astrometry.util.resample import * from astrometry.util.util import * ps = PlotSequence('cosmos') ...
[ "pylab.title", "numpy.log10", "pylab.hist", "numpy.sqrt", "pylab.subplot", "numpy.round", "numpy.flatnonzero", "pylab.xlabel", "pylab.legend", "numpy.zeros", "numpy.deg2rad", "glob.glob", "pylab.xlim", "pylab.clf", "pylab.suptitle", "pylab.imshow" ]
[((4483, 4558), 'numpy.flatnonzero', 'np.flatnonzero', (['((galdepthA[yy, xx] > thresh) * (galdepthB[yy, xx] > thresh))'], {}), '((galdepthA[yy, xx] > thresh) * (galdepthB[yy, xx] > thresh))\n', (4497, 4558), True, 'import numpy as np\n'), ((4795, 4870), 'numpy.flatnonzero', 'np.flatnonzero', (['((galdepthA[yy, xx] > t...
import gym import numpy as np import matplotlib.pyplot as plt def policy(state, theta): """ TODO: return probabilities for actions under softmax action selection """ h = state @ theta return np.exp(h)/np.sum(np.exp(h)) def generate_episode(env, theta, display=False): """ enerates one episode and ret...
[ "matplotlib.pyplot.savefig", "numpy.random.rand", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.exp", "numpy.zeros", "matplotlib.pyplot.title", "gym.make", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((913, 933), 'numpy.random.rand', 'np.random.rand', (['(4)', '(2)'], {}), '(4, 2)\n', (927, 933), True, 'import numpy as np\n'), ((2139, 2162), 'gym.make', 'gym.make', (['"""CartPole-v1"""'], {}), "('CartPole-v1')\n", (2147, 2162), False, 'import gym\n'), ((2200, 2221), 'matplotlib.pyplot.plot', 'plt.plot', (['mean_ep...
import numpy as np import pandas as pd from sklearn.model_selection import StratifiedKFold import lightgbm as lgb import xgboost as xgb # read dataset df_train = pd.read_csv('train.csv') df_test = pd.read_csv('test.csv') # gini function def gini(actual, pred, cmpcol = 0, sortcol = 1): assert( len(actual) == len(p...
[ "pandas.read_csv", "xgboost.train", "lightgbm.train", "sklearn.model_selection.StratifiedKFold", "numpy.lexsort", "lightgbm.Dataset", "pandas.DataFrame", "xgboost.DMatrix", "numpy.zeros_like" ]
[((163, 187), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (174, 187), True, 'import pandas as pd\n'), ((198, 221), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (209, 221), True, 'import pandas as pd\n'), ((1012, 1060), 'sklearn.model_selection.Stratif...
import torch import torch.nn as nn import torch.nn.functional as F import torchvision.models import torchvision.datasets.folder import torchvision.transforms as transforms import torchvision.transforms.functional as Ft from pytorch_transformers import BertTokenizer import os import db from PIL import Image import cv2 i...
[ "numpy.uint8", "numpy.prod", "numpy.copyto", "sys.path.insert", "numpy.sqrt", "qa_classifier", "cv2.rectangle", "fast_rcnn.test.im_detect", "torchvision.transforms.functional.to_pil_image", "torch.LongTensor", "numpy.hstack", "numpy.log", "time.sleep", "torch.exp", "numpy.argsort", "to...
[((380, 424), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./bottom-up-attention/"""'], {}), "(0, './bottom-up-attention/')\n", (395, 424), False, 'import sys\n'), ((425, 482), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./bottom-up-attention/caffe/python/"""'], {}), "(0, './bottom-up-attention/caffe/pytho...
import cv2 import numpy as np from pyautogui import screenshot from pyautogui import size as get_screen_size from core.screen.screen_rectangle import ScreenRectangle class ScreenshotImage: def __init__(self, in_region: ScreenRectangle = None): screen_width, screen_height = get_screen_size() regio...
[ "cv2.threshold", "numpy.array", "pyautogui.screenshot", "pyautogui.size" ]
[((289, 306), 'pyautogui.size', 'get_screen_size', ([], {}), '()\n', (304, 306), True, 'from pyautogui import size as get_screen_size\n'), ((554, 591), 'pyautogui.screenshot', 'screenshot', ([], {'region': 'region_coordinates'}), '(region=region_coordinates)\n', (564, 591), False, 'from pyautogui import screenshot\n'),...
import random import logging import numpy as np import tensorflow as tf class DeepQNetworkModel: def __init__(self, session, layers_size, memory, default_batch_size=None, default_learning_rate=None, default_epsil...
[ "tensorflow.compat.v1.placeholder", "tensorflow.compat.v1.variable_scope", "logging.debug", "tensorflow.compat.v1.get_variable_scope", "tensorflow.compat.v1.train.AdamOptimizer", "numpy.argmax", "logging.info", "numpy.squeeze", "tensorflow.reduce_max", "tensorflow.exp", "numpy.zeros", "tensorf...
[((8348, 8363), 'random.random', 'random.random', ([], {}), '()\n', (8361, 8363), False, 'import random\n'), ((10521, 10590), 'tensorflow.compat.v1.placeholder', 'tf.compat.v1.placeholder', ([], {'shape': '(None, output_size)', 'dtype': 'tf.float32'}), '(shape=(None, output_size), dtype=tf.float32)\n', (10545, 10590), ...
# The original GA algorithm is here: import numpy as np, random, operator, pandas as pd, matplotlib.pyplot as plt import math class City: def __init__(self, x, y): self.x = x self.y = y def distance(self, city): xDis = abs(self.x - city.x) yDis = abs(self.y - city.y) ...
[ "random.sample", "matplotlib.pyplot.savefig", "numpy.sqrt", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.clf", "numpy.asarray", "matplotlib.pyplot.plot", "matplotlib.pyplot.scatter", "operator.itemgetter", "random.random" ]
[((4760, 4774), 'numpy.asarray', 'np.asarray', (['l1'], {}), '(l1)\n', (4770, 4774), True, 'import numpy as np, random, operator, pandas as pd, matplotlib.pyplot as plt\n'), ((4779, 4788), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (4786, 4788), True, 'import numpy as np, random, operator, pandas as pd, matp...
# ------------------------------------------------------------------------------ # Copyright 2020 Forschungszentrum Jülich GmbH # "Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements; and to You under the Apache License, Version 2.0. " # # Forschungszentrum Jülich # In...
[ "EBRAINS_InterscaleHUB.refactored_modular.interscalehub_mediator.spike_to_rate", "time.sleep", "numpy.array", "mpi4py.MPI.Status", "numpy.empty", "os.getpid" ]
[((4387, 4409), 'numpy.empty', 'np.empty', (['(1)'], {'dtype': '"""b"""'}), "(1, dtype='b')\n", (4395, 4409), True, 'import numpy as np\n'), ((4425, 4447), 'numpy.empty', 'np.empty', (['(1)'], {'dtype': '"""i"""'}), "(1, dtype='i')\n", (4433, 4447), True, 'import numpy as np\n'), ((4488, 4500), 'mpi4py.MPI.Status', 'MP...
import tensorflow as tf import numpy as np import resnet_block def LeakyRelu(x, leak=0.2, name="LeakyRelu"): with tf.variable_scope(name): leak_c = tf.constant(0.1) leak = tf.Variable(leak_c) f1 = 0.5 * (1 + leak) f2 = 0.5 * (1 - leak) return f1 * x + f2 * tf.abs(x) def...
[ "numpy.sqrt", "tensorflow.shape", "tensorflow.nn.moments", "resnet_block.identity_block", "tensorflow.cast", "tensorflow.random_normal", "tensorflow.placeholder", "tensorflow.Session", "tensorflow.concat", "tensorflow.nn.conv2d", "tensorflow.variable_scope", "tensorflow.Variable", "tensorflo...
[((584, 597), 'tensorflow.nn.relu', 'tf.nn.relu', (['x'], {}), '(x)\n', (594, 597), True, 'import tensorflow as tf\n'), ((608, 628), 'tensorflow.constant', 'tf.constant', (['[255.0]'], {}), '([255.0])\n', (619, 628), True, 'import tensorflow as tf\n'), ((640, 658), 'tensorflow.minimum', 'tf.minimum', (['x', 'Max'], {})...
# Copyright (c) 2016-2018, University of Idaho # All rights reserved. # # <NAME> (<EMAIL>) # # The project described was supported by NSF award number IIA-1301792 # from the NSF Idaho EPSCoR Program and by the National Science Foundation. import os from os.path import exists as _exists from os.path import join as _joi...
[ "wepppy.nodb.Rhem.getInstance", "os.path.join", "numpy.array", "wepppy.nodb.watershed.Watershed.getInstance", "os.path.abspath", "wepppy.rhem.out.RhemSummary" ]
[((1829, 1860), 'os.path.join', '_join', (['self.wd', '"""rhempost.nodb"""'], {}), "(self.wd, 'rhempost.nodb')\n", (1834, 1860), True, 'from os.path import join as _join\n'), ((1912, 1948), 'os.path.join', '_join', (['self.wd', '"""rhempost.nodb.lock"""'], {}), "(self.wd, 'rhempost.nodb.lock')\n", (1917, 1948), True, '...
import numpy as np import pandas as pd import decorators from scipy import optimize import settings import utility_functions as utilfunc import agent_mutation import PySAM.Battwatts as battery import PySAM.BatteryTools as batt_tools import PySAM.Utilityrate5 as utility import PySAM.Cashloan as cashloan #===========...
[ "settings.init_model_settings", "PySAM.Utilityrate5.default", "numpy.array", "agent_mutation.elec.get_and_apply_agent_load_profiles", "pandas.notnull", "PySAM.Battwatts.default", "numpy.where", "PySAM.Cashloan.default", "scipy.optimize.minimize_scalar", "PySAM.BatteryTools.size_li_ion_battery", ...
[((411, 432), 'utility_functions.get_logger', 'utilfunc.get_logger', ([], {}), '()\n', (430, 432), True, 'import utility_functions as utilfunc\n'), ((55274, 55332), 'decorators.fn_timer', 'decorators.fn_timer', ([], {'logger': 'logger', 'tab_level': '(2)', 'prefix': '""""""'}), "(logger=logger, tab_level=2, prefix='')\...
from pathlib import Path import os import re from decimal import Decimal import csv import numpy from Utils import TextProcessingUtils from Utils import DefinedConstants def readEmbeddingsFromTxtFile(inFile): w2v = {} with open(inFile, "r") as f: for l in f.readlines(): if not l.strip(): ...
[ "Utils.DefinedConstants.CNGstrategy.replace", "Utils.TextProcessingUtils.getCleanEmbeddingModelTokens", "os.walk", "os.path.join", "re.match", "numpy.zeros", "decimal.Decimal" ]
[((1639, 1656), 'os.walk', 'os.walk', (['inFolder'], {}), '(inFolder)\n', (1646, 1656), False, 'import os\n'), ((1706, 1735), 're.match', 're.match', (['regFilter', 'filename'], {}), '(regFilter, filename)\n', (1714, 1735), False, 'import re\n'), ((7973, 7993), 'numpy.zeros', 'numpy.zeros', (['numBins'], {}), '(numBins...
from ai_safety_gridworlds.environments.shared import safety_game from collections import defaultdict import experiments.environment_helper as environment_helper import numpy as np class ModelFreeAUPAgent: name = "Model-free AUP" pen_epsilon, AUP_epsilon = .2, .9 # chance of choosing greedy action in training...
[ "numpy.clip", "numpy.copy", "numpy.random.choice", "numpy.random.random", "experiments.environment_helper.run_episode", "numpy.zeros", "experiments.environment_helper.derive_possible_rewards", "collections.defaultdict" ]
[((1883, 1926), 'numpy.zeros', 'np.zeros', (['(self.trials, self.episodes / 10)'], {}), '((self.trials, self.episodes / 10))\n', (1891, 1926), True, 'import numpy as np\n'), ((2065, 2076), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (2073, 2076), True, 'import numpy as np\n'), ((1547, 1594), 'experiments.environ...
import six import time import signal import multiprocessing from functools import partial import numpy as np from astropy.utils.console import (_get_stdout, isatty, isiterable, human_file_size, _CAN_RESIZE_TERMINAL, terminal_size, color_print, human...
[ "astropy.utils.console.color_print", "astropy.utils.console.terminal_size", "signal.signal", "astropy.utils.console.human_time", "astropy.utils.console.human_file_size", "numpy.floor", "multiprocessing.cpu_count", "astropy.utils.console.isatty", "functools.partial", "multiprocessing.Pool", "astr...
[((3767, 3793), 'astropy.utils.console.isiterable', 'isiterable', (['total_or_items'], {}), '(total_or_items)\n', (3777, 3793), False, 'from astropy.utils.console import _get_stdout, isatty, isiterable, human_file_size, _CAN_RESIZE_TERMINAL, terminal_size, color_print, human_time\n'), ((4200, 4211), 'time.time', 'time....
import numpy from keras.models import Sequential from keras.layers import Dense #loading pima indians dataset from the csv # fix random seed for reproducibility numpy.random.seed(7) dataset = numpy.loadtxt( "./data/pima-indians-diabetes.csv", delimiter="," ) #split into input (X) and (Y) variables X = dataset[:,...
[ "keras.layers.Dense", "numpy.loadtxt", "numpy.random.seed", "keras.models.Sequential" ]
[((162, 182), 'numpy.random.seed', 'numpy.random.seed', (['(7)'], {}), '(7)\n', (179, 182), False, 'import numpy\n'), ((193, 257), 'numpy.loadtxt', 'numpy.loadtxt', (['"""./data/pima-indians-diabetes.csv"""'], {'delimiter': '""","""'}), "('./data/pima-indians-diabetes.csv', delimiter=',')\n", (206, 257), False, 'import...
# Copyright 2022 Huawei Technologies Co., Ltd # # 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...
[ "mindspore.train.serialization.load_checkpoint", "numpy.argmax", "src.dataset.classification_dataset", "mindspore.save_checkpoint", "mindspore.train.serialization.load_param_into_net", "src.c3d_model.C3D", "mindspore.Tensor", "mindspore.communication.management.get_rank" ]
[((1565, 1662), 'src.dataset.classification_dataset', 'classification_dataset', (['config.batch_size', '(1)'], {'shuffle': '(True)', 'repeat_num': '(1)', 'drop_remainder': '(True)'}), '(config.batch_size, 1, shuffle=True, repeat_num=1,\n drop_remainder=True)\n', (1587, 1662), False, 'from src.dataset import classifi...
# Ising Model in Python. # 28-03-2019. # Written by <NAME>. # Python 3.7. # NumPy has been installed and used in this project. # Numba has been installed and used in this project. # Tools used: Visual Studio Code, GitHub Desktop. from Input_param_reader import Ising_input # Python Function in...
[ "Path.Output_Path_Set", "random.uniform", "time.ctime", "numpy.ones", "Montecarlo.Monte_Carlo", "csv.writer", "Input_param_reader.Ising_input", "time.perf_counter", "numpy.sum", "numba.jit" ]
[((806, 825), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (823, 825), False, 'import time\n'), ((3146, 3159), 'Input_param_reader.Ising_input', 'Ising_input', ([], {}), '()\n', (3157, 3159), False, 'from Input_param_reader import Ising_input\n'), ((3604, 3657), 'numpy.ones', 'numpy.ones', (['(nlayers, i...
''' =============================================================================== ENGR 133 Program Description This function takes an image array, a size number and a blur value and returns an array that contains a blurred image Assignment Information Assignment: Python Group Project Author: <NAME>, ...
[ "math.exp", "numpy.multiply", "numpy.zeros" ]
[((2771, 2821), 'math.exp', 'math.exp', (['(-(x * x + y * y) / (2 * stddev * stddev))'], {}), '(-(x * x + y * y) / (2 * stddev * stddev))\n', (2779, 2821), False, 'import math\n'), ((1129, 1151), 'numpy.zeros', 'np.zeros', (['channelCount'], {}), '(channelCount)\n', (1137, 1151), True, 'import numpy as np\n'), ((2109, ...
import os from typing import Dict, Optional import numpy as np import pandas as pd from scipy.signal import correlate from . import ShakeExtractor, helpers from .abstract_extractor import AbstractExtractor from .helpers import normalize, get_equidistant_signals from .log import logger from .synchronization_errors imp...
[ "pandas.Timedelta", "pandas.SparseDtype", "os.path.join", "scipy.signal.correlate", "numpy.argmax", "numpy.max", "pandas.DataFrame" ]
[((4212, 4226), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4224, 4226), True, 'import pandas as pd\n'), ((5964, 5993), 'scipy.signal.correlate', 'correlate', (['ref_data', 'sig_data'], {}), '(ref_data, sig_data)\n', (5973, 5993), False, 'from scipy.signal import correlate\n'), ((13268, 13304), 'os.path.join...
# ! /usr/bin/python3 """### Provides tools for maps and heightmaps This module contains functions to: * Calculate a heightmap ideal for building * Visualise numpy arrays """ __all__ = ['calcGoodHeightmap'] # __version__ import cv2 import matplotlib.pyplot as plt import numpy as np def calcGoodHeightmap(worldSlice):...
[ "matplotlib.pyplot.imshow", "numpy.minimum", "matplotlib.pyplot.figure", "cv2.cvtColor", "matplotlib.pyplot.title", "matplotlib.pyplot.show" ]
[((1790, 1800), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1798, 1800), True, 'import matplotlib.pyplot as plt\n'), ((1153, 1190), 'numpy.minimum', 'np.minimum', (['hm_mbnl', 'heightmapNoTrees'], {}), '(hm_mbnl, heightmapNoTrees)\n', (1163, 1190), True, 'import numpy as np\n'), ((1627, 1639), 'matplotlib....
#!/usr/bin/env python """ Generate sample olfactory model stimulus. """ import numpy as np import h5py osn_num = 1375 dt = 1e-4 # time step Ot = 2000 # number of data point during reset period Rt = 1000 # number of data point during odor delivery period #Nt = 4*Ot + 3*Rt # number of data points in time #Nt = 10000...
[ "numpy.zeros", "numpy.ones", "numpy.concatenate", "h5py.File" ]
[((412, 437), 'numpy.zeros', 'np.zeros', (['(500)', 'np.float64'], {}), '(500, np.float64)\n', (420, 437), True, 'import numpy as np\n'), ((478, 504), 'numpy.zeros', 'np.zeros', (['(4500)', 'np.float64'], {}), '(4500, np.float64)\n', (486, 504), True, 'import numpy as np\n'), ((543, 569), 'numpy.zeros', 'np.zeros', (['...
import pytest from numpy.testing import assert_almost_equal, assert_array_equal, \ assert_array_almost_equal from ctapipe.calib.camera.r1 import ( CameraR1CalibratorFactory, HESSIOR1Calibrator, TargetIOR1Calibrator, NullR1Calibrator ) from ctapipe.io.eventsource import EventSource from ctapipe.io.s...
[ "ctapipe.utils.get_dataset_path", "numpy.testing.assert_array_almost_equal", "ctapipe.calib.camera.r1.CameraR1CalibratorFactory.produce", "ctapipe.calib.camera.r1.TargetIOR1Calibrator", "numpy.testing.assert_almost_equal", "pytest.importorskip", "ctapipe.io.simteleventsource.SimTelEventSource", "ctapi...
[((549, 569), 'ctapipe.calib.camera.r1.HESSIOR1Calibrator', 'HESSIOR1Calibrator', ([], {}), '()\n', (567, 569), False, 'from ctapipe.calib.camera.r1 import CameraR1CalibratorFactory, HESSIOR1Calibrator, TargetIOR1Calibrator, NullR1Calibrator\n'), ((660, 703), 'numpy.testing.assert_almost_equal', 'assert_almost_equal', ...
#### # # The MIT License (MIT) # # Copyright 2021 <NAME> <<EMAIL>> # # 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, cop...
[ "logging.getLogger", "logging.StreamHandler", "sqlite3.connect", "argparse.ArgumentParser", "gzip.open", "logging.Formatter", "os.path.join", "pandas.DataFrame", "numpy.random.RandomState" ]
[((1309, 1351), 'logging.getLogger', 'logging.getLogger', (['"""Get CFM-ID Candidates"""'], {}), "('Get CFM-ID Candidates')\n", (1326, 1351), False, 'import logging\n'), ((1413, 1436), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1434, 1436), False, 'import logging\n'), ((1476, 1535), 'logging.F...
# -*- coding: utf-8 -*- '''Module that defines classes and functions for Brillouin zone sampling ''' import os import re from copy import deepcopy import numpy as np from mykit.core._control import (build_tag_map_obj, extract_from_tagdict, parse_to_tagdict, prog_mapper, tags_mapping) ...
[ "numpy.isclose", "re.compile", "mykit.core._control.build_tag_map_obj", "mykit.core._control.extract_from_tagdict", "re.match", "mykit.core._control.tags_mapping", "numpy.array", "numpy.sum", "os.path.dirname", "numpy.linalg.norm", "mykit.core._control.parse_to_tagdict", "numpy.shape" ]
[((777, 818), 'mykit.core._control.build_tag_map_obj', 'build_tag_map_obj', (['_meta', '"""mykit"""', '"""json"""'], {}), "(_meta, 'mykit', 'json')\n", (794, 818), False, 'from mykit.core._control import build_tag_map_obj, extract_from_tagdict, parse_to_tagdict, prog_mapper, tags_mapping\n'), ((3609, 3634), 're.compile...
from pathlib import Path from tqdm.auto import tqdm import numpy as np import pickle import os from astropy.table import Table import pickle as pkl from multiprocessing import Pool, Manager from threading import Lock from .cones import make_cone_density from .utils import load_data from .cones import make_cone from .c...
[ "os.listdir", "pickle.dump", "pathlib.Path", "threading.Lock", "pickle.load", "multiprocessing.Pool", "numpy.concatenate", "multiprocessing.Manager" ]
[((1710, 1719), 'multiprocessing.Manager', 'Manager', ([], {}), '()\n', (1717, 1719), False, 'from multiprocessing import Pool, Manager\n'), ((1797, 1803), 'threading.Lock', 'Lock', ([], {}), '()\n', (1801, 1803), False, 'from threading import Lock\n'), ((964, 992), 'pickle.dump', 'pickle.dump', (['self.data', 'file'],...
from sklearn.model_selection import GridSearchCV from sklearn.neighbors import KNeighborsClassifier from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.neural_network import MLPClassifier from sklearn.svm import SVC import numpy as np import pandas as pd impo...
[ "sklearn.model_selection.GridSearchCV", "numpy.mean", "sklearn.neural_network.MLPClassifier", "sklearn.tree.DecisionTreeClassifier", "sklearn.neighbors.KNeighborsClassifier", "sklearn.ensemble.RandomForestClassifier", "numpy.linspace", "sklearn.svm.SVC" ]
[((1092, 1127), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': '(7)'}), '(n_neighbors=7)\n', (1112, 1127), False, 'from sklearn.neighbors import KNeighborsClassifier\n'), ((832, 867), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': 'i'}), '(...
def brute_force_root_finder(f, a, b, n): from numpy import linspace x = linspace(a, b, n) y = f(x) roots = [] for i in range(n-1): if y[i]*y[i+1] < 0: root = x[i] - (x[i+1] - x[i])/(y[i+1] - y[i])*y[i] roots.append(root) elif y[i] == 0: ...
[ "numpy.exp", "numpy.linspace", "numpy.cos" ]
[((82, 99), 'numpy.linspace', 'linspace', (['a', 'b', 'n'], {}), '(a, b, n)\n', (90, 99), False, 'from numpy import linspace\n'), ((491, 503), 'numpy.exp', 'exp', (['(-x ** 2)'], {}), '(-x ** 2)\n', (494, 503), False, 'from numpy import exp, cos\n'), ((502, 512), 'numpy.cos', 'cos', (['(4 * x)'], {}), '(4 * x)\n', (505...
import geo.geo_utils import geo.raster_lookup from progress.null_callback import NullCallback from progress.progress import Progress import glob import numpy as np class Heightmap: def __init__(self): self.pixels = [] self.heightmap = None self.nodata_fillin = 0 self.out_of_bounds...
[ "progress.null_callback.NullCallback", "numpy.array", "numpy.load", "progress.progress.Progress", "numpy.save" ]
[((557, 571), 'progress.null_callback.NullCallback', 'NullCallback', ([], {}), '()\n', (569, 571), False, 'from progress.null_callback import NullCallback\n'), ((2163, 2181), 'numpy.load', 'np.load', (['file_name'], {}), '(file_name)\n', (2170, 2181), True, 'import numpy as np\n'), ((2466, 2500), 'numpy.save', 'np.save...
from distutils.core import setup from Cython.Build import cythonize setup( name = "tax", ext_modules = cythonize('tax.pyx'), script_name = 'setup.py', script_args = ['build_ext', '--inplace'] ) import tax import numpy as np print(tax.tax(np.ones(10)))
[ "Cython.Build.cythonize", "numpy.ones" ]
[((112, 132), 'Cython.Build.cythonize', 'cythonize', (['"""tax.pyx"""'], {}), "('tax.pyx')\n", (121, 132), False, 'from Cython.Build import cythonize\n'), ((255, 266), 'numpy.ones', 'np.ones', (['(10)'], {}), '(10)\n', (262, 266), True, 'import numpy as np\n')]
import os, pdb # ______________________________________NLPDV____________________________________ # _______________________________________________________________________ import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from transformers import * import _pickle as pkl import shutil import numpy...
[ "os.path.exists", "os.makedirs", "matplotlib.use", "os.path.join", "numpy.random.seed", "os.system" ]
[((191, 212), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (205, 212), False, 'import matplotlib\n'), ((3438, 3458), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (3452, 3458), True, 'import numpy as np\n'), ((22098, 22116), 'os.system', 'os.system', (['command'], {}), '(co...