code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# Licensed under an MIT open source license - see LICENSE from __future__ import print_function, absolute_import, division import pytest import warnings import numpy as np import numpy.testing as npt import astropy.units as u from astropy.io import fits from scipy.stats import linregress import os try: import py...
[ "os.remove", "numpy.testing.assert_almost_equal", "numpy.allclose", "numpy.testing.assert_allclose", "astropy.io.fits.PrimaryHDU", "os.system", "numpy.isfinite", "pytest.mark.skipif", "warnings.catch_warnings", "pytest.mark.parametrize", "numpy.log10" ]
[((3600, 3661), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""plaw"""', '[plaw for plaw in [2, 3, 4]]'], {}), "('plaw', [plaw for plaw in [2, 3, 4]])\n", (3623, 3661), False, 'import pytest\n'), ((4822, 4864), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""not PYFFTW_INSTALLED"""'], {}), "('not PYFFTW_...
import numpy as np import torch import hexagdly as hex import pytest class TestMaxPool2d(object): def get_array(self): return np.array( [[j * 5 + 1 + i for j in range(8)] for i in range(5)], dtype=np.float32 ) def get_array_maxpool2d_size1_stride1(self): return np.array( ...
[ "hexagdly.MaxPool2d", "numpy.zeros", "torch.equal", "torch.FloatTensor", "numpy.array" ]
[((309, 512), 'numpy.array', 'np.array', (['[[6, 12, 16, 22, 26, 32, 36, 37], [7, 13, 17, 23, 27, 33, 37, 38], [8, 14, \n 18, 24, 28, 34, 38, 39], [9, 15, 19, 25, 29, 35, 39, 40], [10, 15, 20, \n 25, 30, 35, 40, 40]]'], {'dtype': 'np.float32'}), '([[6, 12, 16, 22, 26, 32, 36, 37], [7, 13, 17, 23, 27, 33, 37, 38],...
import os import re import json import pandas as pd import numpy as np from celescope.tools.step import Step, s_common from celescope.vdj.__init__ import CHAINS import celescope.tools.utils as utils def report_prepare(df, outdir): json_file = outdir + '/.data.json' if not os.path.exists(json_file): ...
[ "pandas.DataFrame", "json.dump", "json.load", "celescope.tools.step.s_common", "pandas.read_csv", "numpy.median", "pandas.merge", "os.path.exists", "celescope.tools.utils.read_barcode_file", "pandas.Series", "re.search", "celescope.tools.step.Step" ]
[((855, 876), 'celescope.tools.step.Step', 'Step', (['args', 'step_name'], {}), '(args, step_name)\n', (859, 876), False, 'from celescope.tools.step import Step, s_common\n'), ((1466, 1511), 'pandas.read_csv', 'pd.read_csv', (['UMI_count_filter1_file'], {'sep': '"""\t"""'}), "(UMI_count_filter1_file, sep='\\t')\n", (14...
"""Plot SNR brightness evolution.""" import numpy as np from astropy.units import Quantity import matplotlib.pyplot as plt from gammapy.astro.source import SNR densities = Quantity([1, 0.1], "cm-3") t = Quantity(np.logspace(0, 5, 100), "yr") for density in densities: snr = SNR(n_ISM=density) F = snr.luminosit...
[ "matplotlib.pyplot.loglog", "matplotlib.pyplot.xlim", "astropy.units.Quantity", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "numpy.logspace", "matplotlib.pyplot.legend", "gammapy.astro.source.SNR", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((173, 199), 'astropy.units.Quantity', 'Quantity', (['[1, 0.1]', '"""cm-3"""'], {}), "([1, 0.1], 'cm-3')\n", (181, 199), False, 'from astropy.units import Quantity\n'), ((624, 649), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(100.0)', '(100000.0)'], {}), '(100.0, 100000.0)\n', (632, 649), True, 'import matplotlib.pyplot...
import brica import numpy as np ACTION_AMP_RATE = 4.0 ACTION_CUTOFF = 0.1 class CB(object): """ Cerebellum module. CB outputs action for smooth pursuit eye movment. """ def __init__(self): self.timing = brica.Timing(5, 1, 0) def __call__(self, inputs): if 'from_fef' not in in...
[ "brica.Timing", "numpy.linalg.norm", "numpy.clip" ]
[((234, 255), 'brica.Timing', 'brica.Timing', (['(5)', '(1)', '(0)'], {}), '(5, 1, 0)\n', (246, 255), False, 'import brica\n'), ((710, 736), 'numpy.clip', 'np.clip', (['action', '(-1.0)', '(1.0)'], {}), '(action, -1.0, 1.0)\n', (717, 736), True, 'import numpy as np\n'), ((512, 534), 'numpy.linalg.norm', 'np.linalg.norm...
import gym from gym import spaces from gym.utils import seeding from gym_map.envs.map_view import Map from gym_map.envs.map_constants import (DEFAULT_MAP_DATA, MAX_WIDTH, MAX_HEIGHT, MAP_BOUNDS, MAX_CHECKPOINTS, MAX_TELEPORTS, TILE_DICT, MAP_TYPE_DICT, MAX_WALLS, MAX_SCORE) import numpy as np import random cl...
[ "gym_map.envs.map_view.Map", "numpy.zeros", "random.choice", "gym.spaces.Discrete", "random.seed", "gym.spaces.Box", "numpy.array", "gym.utils.seeding.np_random" ]
[((486, 523), 'gym_map.envs.map_view.Map', 'Map', ([], {'map_file': 'map_file', 'render': 'render'}), '(map_file=map_file, render=render)\n', (489, 523), False, 'from gym_map.envs.map_view import Map\n'), ((639, 666), 'numpy.zeros', 'np.zeros', (['(2)'], {'dtype': 'np.int32'}), '(2, dtype=np.int32)\n', (647, 666), True...
import numpy as np import xarray as xr import pandas as pd import skimage.measure import scipy import statsmodels from statsmodels.stats.multitest import multipletests from scipy.spatial.distance import cdist import os def calc_dist_matrix(label_map, ret=True, path=None): """Generate matrix of distances between c...
[ "numpy.stack", "scipy.spatial.distance.cdist", "numpy.zeros_like", "numpy.sum", "statsmodels.stats.multitest.multipletests", "numpy.asarray", "numpy.zeros", "os.path.exists", "scipy.stats.norm.fit", "numpy.array", "xarray.DataArray", "numpy.reshape", "numpy.savez" ]
[((5490, 5523), 'numpy.zeros', 'np.zeros', (['(num, num)'], {'dtype': '"""int"""'}), "((num, num), dtype='int')\n", (5498, 5523), True, 'import numpy as np\n'), ((8379, 8441), 'numpy.zeros', 'np.zeros', (['(marker_num, marker_num, bootstrap_num)'], {'dtype': '"""int"""'}), "((marker_num, marker_num, bootstrap_num), dty...
from unittest import TestCase from jtes import jaccard_timespan_event_score import numpy as np class JTESTest(TestCase): def test_both_empty(self): self.assertEqual(1, jaccard_timespan_event_score(np.array([]), np.array([]))) def test_empty_prediction(self): y_true = np.array([ ...
[ "numpy.datetime64", "jtes.jaccard_timespan_event_score", "numpy.array" ]
[((1184, 1218), 'jtes.jaccard_timespan_event_score', 'jaccard_timespan_event_score', (['y', 'y'], {}), '(y, y)\n', (1212, 1218), False, 'from jtes import jaccard_timespan_event_score\n'), ((1730, 1774), 'jtes.jaccard_timespan_event_score', 'jaccard_timespan_event_score', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n'...
import argparse import scipy.io import torch import numpy as np import os from torchvision import datasets import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt ####################################################################### # Evaluate parser = argparse.ArgumentParser(description='Demo') parse...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "argparse.ArgumentParser", "os.path.join", "matplotlib.pyplot.imshow", "torch.FloatTensor", "torch.mm", "numpy.setdiff1d", "numpy.argsort", "numpy.append", "os.path.isfile", "matplotlib.use", "matplotlib.pyplot.figure", "numpy.argwher...
[((125, 146), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (139, 146), False, 'import matplotlib\n'), ((271, 314), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Demo"""'}), "(description='Demo')\n", (294, 314), False, 'import argparse\n'), ((1081, 1117), 'torch....
import os.path as osp import mmcv import numpy as np from tools_yuan.convert_data.utils import parse_xml from tools_yuan.convert_data.utils import track_progress_yuan import getpass """ Author: <NAME> Date:2018/12/16 Location:SCU """ def main(): xml_dir = osp.join('/media/', getpass.getuser(), 'Data/DoubleCircle...
[ "getpass.getuser", "mmcv.mkdir_or_exist", "numpy.array", "mmcv.list_from_file", "os.path.join" ]
[((682, 710), 'mmcv.mkdir_or_exist', 'mmcv.mkdir_or_exist', (['pkl_dir'], {}), '(pkl_dir)\n', (701, 710), False, 'import mmcv\n'), ((750, 787), 'os.path.join', 'osp.join', (['txt_dir', '"""train-all-02.txt"""'], {}), "(txt_dir, 'train-all-02.txt')\n", (758, 787), True, 'import os.path as osp\n'), ((808, 843), 'mmcv.lis...
import numpy as np import math from numpy.linalg import inv # from sympy import symbols, diff # Partial differentiation: # from sympy import symbols, diff # x, y, z = symbols('x y z', real=True) # f = 4*x*y + x*sin(z) + x**3 + z**8*y # diff(f, x) # 4*y + sin(z) + 3*x**2 def create_jacobian_matrix(): jacobian_ma...
[ "numpy.matrix" ]
[((460, 486), 'numpy.matrix', 'np.matrix', (['jacobian_matrix'], {}), '(jacobian_matrix)\n', (469, 486), True, 'import numpy as np\n')]
# generates a frequency value based on a sequence of midi notes from .npy file import os import numpy as np file_path = "../midi_notes.npy" class Note_Generator(): def __init__(self): self.note_vals = {"60": 261,"61": 277,"62": 293,"63": 311,"64": 329,"65": 349,"66": 370,"67": 392,"68": 415,"69": 440, ...
[ "numpy.load" ]
[((587, 605), 'numpy.load', 'np.load', (['file_path'], {}), '(file_path)\n', (594, 605), True, 'import numpy as np\n')]
import os import sys from argparse import Namespace from pathlib import Path import numpy as np import time import torch from flatland.core.env_observation_builder import DummyObservationBuilder from flatland.envs.observations import TreeObsForRailEnv from flatland.evaluators.client import FlatlandRemoteClient from f...
[ "argparse.Namespace", "flatland.envs.predictions.ShortestPathPredictorForRailEnv", "numpy.power", "torch.load", "utils.observation_utils.normalize_observation", "time.time", "flatland.core.env_observation_builder.DummyObservationBuilder", "os.path.isfile", "pathlib.Path", "numpy.array", "flatlan...
[((1168, 1190), 'flatland.evaluators.client.FlatlandRemoteClient', 'FlatlandRemoteClient', ([], {}), '()\n', (1188, 1190), False, 'from flatland.evaluators.client import FlatlandRemoteClient\n'), ((1226, 1285), 'flatland.envs.predictions.ShortestPathPredictorForRailEnv', 'ShortestPathPredictorForRailEnv', (['observatio...
import numpy as np from termcolor import colored import os import sys if sys.platform == 'linux': sys.path.append(r'../lib') else: sys.path.append(os.path.abspath('../build/x64/Release')) import NumCpp #################################################################################### def doTest(): print(...
[ "sys.path.append", "os.path.abspath", "termcolor.colored", "numpy.random.randint", "NumCpp.Shape" ]
[((102, 127), 'sys.path.append', 'sys.path.append', (['"""../lib"""'], {}), "('../lib')\n", (117, 127), False, 'import sys\n'), ((434, 448), 'NumCpp.Shape', 'NumCpp.Shape', ([], {}), '()\n', (446, 448), False, 'import NumCpp\n'), ((711, 735), 'NumCpp.Shape', 'NumCpp.Shape', (['shapeInput'], {}), '(shapeInput)\n', (723,...
import glob import re import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.widgets import LassoSelector from matplotlib.path import Path from matplotlib import colors from sklearn.preprocessing import MinMaxScaler import os import math import subprocess import yaml import zarr from hur...
[ "os.remove", "matplotlib.widgets.LassoSelector", "pandas.read_csv", "numpy.argsort", "gc.collect", "numpy.arange", "numpy.tile", "os.path.join", "matplotlib.colors.ListedColormap", "tifffile.TiffFile", "numpy.empty_like", "numpy.linspace", "re.search", "matplotlib.pyplot.get_cmap", "math...
[((591, 607), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (601, 607), False, 'import os\n'), ((1133, 1181), 'tifffile.TiffFile', 'tifffile.TiffFile', (['target_filepath'], {'is_ome': '(False)'}), '(target_filepath, is_ome=False)\n', (1150, 1181), False, 'import tifffile\n'), ((1873, 1899), 'numpy.seterr', '...
import perlin import math from PIL import Image import numpy as np import tqdm import os test_frame = False num_frames = 100 ms_per_frame = 40 resolution = 600 v_length = 3.0 scale = 0.07 radius = 0.475 offset = 12 output_dir = "frames" def field_vector_at(x, y, rot): radian = 2.0*math.pi*rot ...
[ "os.mkdir", "PIL.Image.new", "os.path.isdir", "numpy.zeros", "math.sin", "PIL.Image.open", "math.cos", "PIL.Image.fromarray" ]
[((573, 598), 'os.path.isdir', 'os.path.isdir', (['output_dir'], {}), '(output_dir)\n', (586, 598), False, 'import os\n'), ((605, 625), 'os.mkdir', 'os.mkdir', (['output_dir'], {}), '(output_dir)\n', (613, 625), False, 'import os\n'), ((712, 770), 'numpy.zeros', 'np.zeros', ([], {'shape': '[resolution, resolution, 3]',...
#Advent of code 2021 #Day 4 Part 2 #Giant Squid import numpy as np np.set_printoptions(threshold=np.inf) import pdb #pdb.set_trace() import time import copy start_time = time.time() ##Functions #Function: Tick off number in card def tick_off_number(card,value,hit_map): k = 0 for line in car...
[ "copy.deepcopy", "numpy.set_printoptions", "numpy.invert", "numpy.zeros", "time.time", "numpy.array" ]
[((73, 110), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (92, 110), True, 'import numpy as np\n'), ((182, 193), 'time.time', 'time.time', ([], {}), '()\n', (191, 193), False, 'import time\n'), ((1690, 1704), 'numpy.array', 'np.array', (['card'], {}), '(card)\n...
# ----------------------------------------------------------------------------- # Matplotlib cheat sheet # Released under the BSD License # ----------------------------------------------------------------------------- import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt for style in ['default'] ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.close", "matplotlib.pyplot.style.context", "matplotlib.pyplot.figure", "numpy.cos", "numpy.linspace", "matplotlib.pyplot.tight_layout" ]
[((352, 376), 'matplotlib.pyplot.style.context', 'plt.style.context', (['style'], {}), '(style)\n', (369, 376), True, 'import matplotlib.pyplot as plt\n'), ((392, 427), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 3)', 'dpi': '(100)'}), '(figsize=(5, 3), dpi=100)\n', (402, 427), True, 'import matplot...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Object Classification(such as a Tabby Cat image) using pretrained Inception v3 1. The test image is located at "./images/cnn/test_image.png" 2. Download the whole folder and run the .py file directly in your workspace 3. Downloading the pretrained Inception v3 may ta...
[ "os.remove", "numpy.random.seed", "tensorflow.contrib.slim.nets.inception.inception_v3", "numpy.argmax", "tensorflow.reset_default_graph", "numpy.argsort", "numpy.argpartition", "sys.stdout.flush", "os.path.join", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.imshow", "os.path.exists", ...
[((1793, 1815), 'matplotlib.pyplot.imshow', 'plt.imshow', (['test_image'], {}), '(test_image)\n', (1803, 1815), True, 'import matplotlib.pyplot as plt\n'), ((1816, 1831), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], {}), "('off')\n", (1824, 1831), True, 'import matplotlib.pyplot as plt\n'), ((1832, 1842), 'mat...
""" The code is inspired by the code for DeepHit model. The github link of the code for DeepHit is https://github.com/chl8856/DeepHit. Reference: <NAME>, <NAME>, <NAME>, <NAME>, "DeepHit: A Deep Learning Approach to Survival Analysis with Competing Risks," AAAI Conference on Artificial Intelligence (AAAI), 2018. This ...
[ "tensorflow.contrib.layers.xavier_initializer", "numpy.cumprod", "os.makedirs", "CS_Conditional_DeepPseudo.CS_Conditional_DeepPseudo_Model", "tensorflow.train.Saver", "random.sample", "tensorflow.reset_default_graph", "tensorflow.global_variables_initializer", "tensorflow.Session", "os.path.exists...
[((900, 917), 'tensorflow.log', 'tf.log', (['(x + 1e-08)'], {}), '(x + 1e-08)\n', (906, 917), True, 'import tensorflow as tf\n'), ((945, 965), 'tensorflow.div', 'tf.div', (['x', '(y + 1e-08)'], {}), '(x, y + 1e-08)\n', (951, 965), True, 'import tensorflow as tf\n'), ((1322, 1349), 'random.sample', 'random.sample', (['i...
"""Module containing `Pruner` class. """ import numpy as np INVALID_NODEID = -1 INVALID_VALUE = -2 class Pruner(object): """Base class for decision tree pruners. Warning: This class should not be used directly. Use derived classes instead. """ def __init__(self, tree): self.tree = tree ...
[ "numpy.argmax" ]
[((2458, 2475), 'numpy.argmax', 'np.argmax', (['values'], {}), '(values)\n', (2467, 2475), True, 'import numpy as np\n')]
#!/usr/bin/env python3 """ .. module:: show_figs :platform: Unix :synopsis: Figure generation module. .. moduleauthor:: <NAME> <<EMAIL>> """ import numpy as _np import os as _os import matplotlib.pyplot as _plt def show_FA_thumbs( feature_array, show_per_class, normalize, title_string, screen_size, imag...
[ "os.mkdir", "numpy.logical_and", "os.path.isdir", "os.path.dirname", "numpy.floor", "numpy.zeros", "numpy.ones", "numpy.nonzero", "matplotlib.pyplot.figure", "numpy.int", "numpy.sign", "itertools.cycle", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots", "numpy.concatenate", "nu...
[((1910, 1946), 'matplotlib.pyplot.figure', '_plt.figure', ([], {'figsize': 'fig_sz', 'dpi': '(100)'}), '(figsize=fig_sz, dpi=100)\n', (1921, 1946), True, 'import matplotlib.pyplot as _plt\n'), ((2602, 2646), 'matplotlib.pyplot.xlabel', '_plt.xlabel', (['title_string'], {'fontweight': '"""bold"""'}), "(title_string, fo...
import os, pprint, tqdm import numpy as np import pandas as pd from haven import haven_utils as hu from haven import haven_img as hi import torch import torch.nn as nn import torch.nn.functional as F from .networks import fcn8_vgg16 from . import semseg_counting from . import lcfcn from src import utils as ut from . ...
[ "skimage.segmentation.mark_boundaries", "os.path.dirname", "torch.nn.functional.softmax", "haven.haven_utils.f2l", "haven.haven_utils.denormalize", "numpy.array", "haven.haven_utils.save_image", "torch.no_grad" ]
[((3706, 3721), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3719, 3721), False, 'import torch\n'), ((4506, 4540), 'skimage.segmentation.mark_boundaries', 'mark_boundaries', (['rgb_labels', 'blobs'], {}), '(rgb_labels, blobs)\n', (4521, 4540), False, 'from skimage.segmentation import mark_boundaries\n'), ((1248...
import io_utils as io import vsrl_utils as vu import numpy as np import os from pycocotools.coco import COCO def get_aciton_num_and_roles_num(v_coco, dataset_name='vcoco_trainval', action_index=0): # Load the VCOCO annotations for vcoco_train image set vcoco_data = vu.load_vcoco(dataset_name) vcoco = vc...
[ "vsrl_utils.load_vcoco", "vsrl_utils.load_coco", "numpy.where", "numpy.array", "os.path.join", "io_utils.dump_json_object" ]
[((277, 304), 'vsrl_utils.load_vcoco', 'vu.load_vcoco', (['dataset_name'], {}), '(dataset_name)\n', (290, 304), True, 'import vsrl_utils as vu\n'), ((1096, 1138), 'numpy.array', 'np.array', (["[a['category_id'] for a in anns]"], {}), "([a['category_id'] for a in anns])\n", (1104, 1138), True, 'import numpy as np\n'), (...
import numpy as np BIT_DEPTH = 16384 BOARD_ADDR = '192.168.93.102' CLIPPING_THRESHOLD = 8000 GAIN_VALUES = [1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128] GUI_UPDATE_TIME = 0.1 L_GAIN_PLOT = 70 L_PKT = 62 NIPPLE_DIST = 0.01778 NUM_CHS = 4 PKTS_PER_RECV = 256 SAMPLE_RATE = 153061 SOUND_SPEED = 1481 USE_4CHS = False...
[ "numpy.dtype" ]
[((521, 591), 'numpy.dtype', 'np.dtype', (["[('reset', '?'), ('autogain', '?'), ('man_gain_lvl', '<i1')]"], {}), "([('reset', '?'), ('autogain', '?'), ('man_gain_lvl', '<i1')])\n", (529, 591), True, 'import numpy as np\n')]
# Copyright (c) 2019 Graphcore Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
[ "numpy.random.seed", "tests.utils.copy_weights_to_torch", "tests.torch_bert.BertConfig", "numpy.random.randint", "numpy.arange", "pytest.mark.parametrize", "bert_model.BertConfig", "onnx.load_model_from_string", "tests.utils.check_tensors", "numpy.less", "numpy.stack", "torch.norm", "tests.u...
[((2389, 2432), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', 'test_modes'], {}), "('mode', test_modes)\n", (2412, 2432), False, 'import pytest\n'), ((2434, 2579), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""batch_size, batch_serialisation_factor, number_attention_splits"""', '[(...
import cv2 import numpy as np import skimage from skimage import exposure # load image and get dimensions img = cv2.imread("opencv_frame_7.png") # convert to hsv hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV) # threshold using inRange range1 = (20,80,80) range2 = (90,255,255) mask = cv2.inRange(hsv,range1,range2) mask = 2...
[ "cv2.GaussianBlur", "cv2.cvtColor", "cv2.morphologyEx", "cv2.imwrite", "cv2.waitKey", "skimage.exposure.rescale_intensity", "numpy.ones", "cv2.destroyAllWindows", "cv2.imread", "cv2.imshow", "cv2.inRange" ]
[((112, 144), 'cv2.imread', 'cv2.imread', (['"""opencv_frame_7.png"""'], {}), "('opencv_frame_7.png')\n", (122, 144), False, 'import cv2\n'), ((169, 205), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (181, 205), False, 'import cv2\n'), ((281, 313), 'cv2.inRange', 'cv...
# numpy crash course # define an array import numpy mylist = [1, 2, 3] myarray = numpy.array(mylist) print(myarray) print(myarray.shape) # access values import numpy mylist = [[1, 2, 3], [3, 4, 5]] myarray = numpy.array(mylist) print(myarray) print(myarray.shape) print("First row: %s" % myarray[0]) print("Last row: %...
[ "numpy.array" ]
[((82, 101), 'numpy.array', 'numpy.array', (['mylist'], {}), '(mylist)\n', (93, 101), False, 'import numpy\n'), ((210, 229), 'numpy.array', 'numpy.array', (['mylist'], {}), '(mylist)\n', (221, 229), False, 'import numpy\n'), ((465, 487), 'numpy.array', 'numpy.array', (['[2, 2, 2]'], {}), '([2, 2, 2])\n', (476, 487), Fa...
# Copyright 2018 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...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "numpy.abs", "matplotlib.pyplot.plot", "numpy.empty", "matplotlib.pyplot.legend", "struct.unpack", "numpy.imag", "matplotlib.pyplot.figure", "numpy.real" ]
[((2316, 2357), 'numpy.empty', 'np.empty', (['(2 * py_dft.size)'], {'dtype': 'np.float'}), '(2 * py_dft.size, dtype=np.float)\n', (2324, 2357), True, 'import numpy as np\n'), ((2379, 2394), 'numpy.real', 'np.real', (['py_dft'], {}), '(py_dft)\n', (2386, 2394), True, 'import numpy as np\n'), ((2414, 2429), 'numpy.imag',...
import os import yaml import argparse import numpy as np import matplotlib as mpl mpl.use("TKAgg") try: import pybullet_envs except ImportError: print("pybullet_envs not available") import gym from gym.spaces import Discrete import torch from torch.optim import Adam from tqdm import tqdm import pybullet from ...
[ "numpy.random.seed", "argparse.ArgumentParser", "numpy.random.set_state", "numpy.random.randint", "torch.load", "os.path.exists", "torch.manual_seed", "rl.nets.policies.MLPNormPolicy", "rl.learners.ppo.PPO", "matplotlib.use", "torch.cuda.is_available", "rl.agent.Agent", "rl.nets.valuefs.MLPV...
[((82, 98), 'matplotlib.use', 'mpl.use', (['"""TKAgg"""'], {}), "('TKAgg')\n", (89, 98), True, 'import matplotlib as mpl\n'), ((566, 591), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (589, 591), False, 'import argparse\n'), ((1499, 1524), 'gym.make', 'gym.make', (["cfg['env_name']"], {}), "(...
# Copyright 2019 The FastEstimator 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 appl...
[ "numpy.sum", "fastestimator.util.util.convert_tf_dtype", "fastestimator.util.util.flatten_list", "tensorflow.reshape", "fastestimator.op.get_inputs_by_key", "os.path.join", "multiprocessing.cpu_count", "os.path.exists", "tensorflow.cast", "fastestimator.util.tfrecord.get_features", "fastestimato...
[((2783, 2797), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (2795, 2797), True, 'import multiprocessing as mp\n'), ((12984, 13017), 'fastestimator.schedule.Scheduler', 'Scheduler', ([], {'epoch_dict': 'dataset_map'}), '(epoch_dict=dataset_map)\n', (12993, 13017), False, 'from fastestimator.schedule i...
from argparse import Namespace import os import time from tqdm import tqdm from PIL import Image import numpy as np import torch from torch.utils.data import DataLoader import torch.nn as nn import sys sys.path.append(".") sys.path.append("..") from configs import data_configs from datasets.images_text_dataset import...
[ "sys.path.append", "argparse.Namespace", "os.makedirs", "numpy.std", "options.test_options.TestOptions", "torch.load", "torch.roll", "clip.tokenize", "models.psp_ada.pSp", "clip.load", "torch.nn.Upsample", "time.time", "numpy.mean", "datasets.images_text_dataset.ImagesTextDataset", "torc...
[((203, 223), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (218, 223), False, 'import sys\n'), ((224, 245), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (239, 245), False, 'import sys\n'), ((541, 593), 'os.path.join', 'os.path.join', (['test_opts.exp_dir', '"""inference_r...
# -*- coding: utf-8 -*- """ Note that this benchmark also supports a multi-GPU setup. If you run it on a system with multiple GPUs make sure that you kill all the processes when killing the application. Due to the way we setup this benchmark the distributed processes might continue the benchmark if one of the nodes is ...
[ "lightly.data.SimCLRCollateFunction", "pytorch_lightning.Trainer", "lightly.loss.BarlowTwinsLoss", "pytorch_lightning.seed_everything", "lightly.models.modules.NNMemoryBankModule", "torch.cuda.max_memory_allocated", "torch.cuda.device_count", "torchvision.transforms.Normalize", "lightly.loss.SymNegC...
[((2425, 2482), 'lightly.data.SimCLRCollateFunction', 'lightly.data.SimCLRCollateFunction', ([], {'input_size': 'input_size'}), '(input_size=input_size)\n', (2459, 2482), False, 'import lightly\n'), ((2909, 2961), 'lightly.data.LightlyDataset', 'lightly.data.LightlyDataset', ([], {'input_dir': 'path_to_train'}), '(inpu...
""" Defines custom callback functions used to compute various metrics at runtime. """ from .utility import * from abc import ABC, abstractproperty, abstractmethod import h5py from collections import defaultdict from .log import * from firedrake import * import numpy class CallbackManager(defaultdict): """ St...
[ "h5py.File", "numpy.minimum", "numpy.maximum", "numpy.ones_like", "numpy.zeros", "numpy.hstack", "numpy.array", "numpy.tile", "numpy.linspace" ]
[((20716, 20740), 'numpy.hstack', 'numpy.hstack', (['field_vals'], {}), '(field_vals)\n', (20728, 20740), False, 'import numpy\n'), ((24902, 24920), 'numpy.array', 'numpy.array', (['[xyz]'], {}), '([xyz])\n', (24913, 24920), False, 'import numpy\n'), ((29340, 29379), 'numpy.array', 'numpy.array', (['[[self.x, self.y, s...
import numpy as np x = np.arange(20) print("Original vector:") print(x) print("After changing the sign of the numbers in the range from 9 to 15:") x[(x >= 9) & (x <= 15)] *= -1 print(x)
[ "numpy.arange" ]
[((23, 36), 'numpy.arange', 'np.arange', (['(20)'], {}), '(20)\n', (32, 36), True, 'import numpy as np\n')]
from __future__ import print_function import os import argparse import shutil import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms from torch.autograd import Variable import sys from dataloader import get_data_l...
[ "argparse.ArgumentParser", "numpy.resize", "logging.Formatter", "os.path.isfile", "torch.device", "os.path.join", "sp_mbnet.sp_mbnet", "torch.load", "os.path.exists", "dataloader.get_data_loader", "torch.manual_seed", "torch.autograd.Variable", "logging.StreamHandler", "torch.cuda.manual_s...
[((513, 574), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch CIFAR training"""'}), "(description='PyTorch CIFAR training')\n", (536, 574), False, 'import argparse\n'), ((3024, 3052), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (3041, 3052), Fal...
# Omid55 def plot_data(data, has_label=True): import numpy as np import seaborn as sns from sklearn.manifold import TSNE from sklearn.decomposition import PCA if not has_label: data = data.copy() data['label'] = np.zeros([len(data),1]) LIMIT = 4000 if data.shape[0] > LIMIT: dt = data.sample(n=LIMIT, repl...
[ "numpy.set_printoptions", "sklearn.manifold.TSNE", "seaborn.plt.title", "sklearn.decomposition.PCA", "seaborn.color_palette", "numpy.column_stack" ]
[((441, 477), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': '(2)', 'random_state': '(0)'}), '(n_components=2, random_state=0)\n', (445, 477), False, 'from sklearn.manifold import TSNE\n'), ((479, 513), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (498, 513...
import datetime as dt import tempfile import numpy as np from ravenpy.models import HRU, HYPR, HYPR_OST, LU from ravenpy.utilities.testdata import get_local_testdata from .common import _convert_2d TS = get_local_testdata( "raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily.nc" ) hru = HYPR.HRU( ...
[ "ravenpy.models.HYPR_OST", "numpy.testing.assert_almost_equal", "ravenpy.models.LU", "datetime.datetime", "ravenpy.utilities.testdata.get_local_testdata", "ravenpy.models.HYPR", "ravenpy.models.HYPR.HRU" ]
[((207, 301), 'ravenpy.utilities.testdata.get_local_testdata', 'get_local_testdata', (['"""raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily.nc"""'], {}), "(\n 'raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily.nc')\n", (225, 301), False, 'from ravenpy.utilities.testdata import get_loca...
# <Copyright 2022, Argo AI, LLC. Released under the MIT license.> """SE(3) Lie group unit tests.""" from typing import Any, Callable, Union import numpy as np import av2.geometry.geometry as geometry_utils from av2.geometry.se3 import SE3 from av2.utils.typing import NDArrayFloat def get_yaw_angle_rotmat(theta: U...
[ "av2.geometry.geometry.quat_to_mat", "numpy.random.randn", "numpy.allclose", "numpy.zeros", "numpy.ones", "numpy.sin", "numpy.array", "numpy.cos", "av2.geometry.se3.SE3", "numpy.eye", "numpy.sqrt" ]
[((483, 496), 'numpy.cos', 'np.cos', (['theta'], {}), '(theta)\n', (489, 496), True, 'import numpy as np\n'), ((505, 518), 'numpy.sin', 'np.sin', (['theta'], {}), '(theta)\n', (511, 518), True, 'import numpy as np\n'), ((541, 595), 'numpy.array', 'np.array', (['[[c, -s, 0.0], [s, c, 0.0], [0.0, 0.0, 1.0]]'], {}), '([[c...
"""cogeo_mosaic.utils: utility functions.""" import logging import os import sys from concurrent import futures from contextlib import ExitStack from typing import Dict, List, Sequence, Tuple import click import mercantile import numpy from pygeos import area, intersection from rio_tiler.io import COGReader logger =...
[ "mercantile.ul", "pygeos.area", "contextlib.ExitStack", "numpy.array", "pygeos.intersection", "concurrent.futures.ThreadPoolExecutor", "concurrent.futures.as_completed", "logging.getLogger", "rio_tiler.io.COGReader" ]
[((321, 340), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (338, 340), False, 'import logging\n'), ((2918, 2963), 'numpy.array', 'numpy.array', (['[[t.x, t.y, t.z] for t in tiles]'], {}), '([[t.x, t.y, t.z] for t in tiles])\n', (2929, 2963), False, 'import numpy\n'), ((3135, 3196), 'mercantile.ul', 'merc...
"""---------------------------------------------------------------------""" """ """ """ Train and preparation phases codes for our loto project """ """ """ """ ...
[ "tensorflow.keras.losses.SparseCategoricalCrossentropy", "numpy.load", "tensorflow.keras.layers.Dense", "numpy.transpose", "tensorflow.data.Dataset.from_tensor_slices", "numpy.amax", "numpy.float64.astype", "tensorflow.keras.metrics.SparseCategoricalAccuracy", "tensorflow.keras.optimizers.RMSprop", ...
[((2774, 2829), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['(x_train, y1_train)'], {}), '((x_train, y1_train))\n', (2808, 2829), True, 'import tensorflow as tf\n'), ((2871, 2924), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['(x_test, y...
#coding:utf-8 import numpy as np import gensim import os import string,re from tqdm import tqdm from flickr30k import flickr30k import shutil #Delete (,.) regex = re.compile('[%s]' % re.escape(string.punctuation)) def test_re(s): return regex.sub('', s) model = gensim.models.KeyedVectors.load_w...
[ "os.path.basename", "re.escape", "numpy.random.randint", "gensim.models.KeyedVectors.load_word2vec_format", "flickr30k.flickr30k", "os.path.join", "shutil.copy" ]
[((287, 392), 'gensim.models.KeyedVectors.load_word2vec_format', 'gensim.models.KeyedVectors.load_word2vec_format', (['"""./GoogleNews-vectors-negative300.bin"""'], {'binary': '(True)'}), "(\n './GoogleNews-vectors-negative300.bin', binary=True)\n", (334, 392), False, 'import gensim\n'), ((2281, 2292), 'flickr30k.fl...
import numpy as np def get_point_from_vector(vec, point, distance): """Given a vector get the coordinate of the point at a certain distance from the input point. Args: vec: array, vector. point: array, input point. distance: float, the distance. """ vec = np.array(vec)...
[ "numpy.round", "numpy.array", "numpy.sum" ]
[((307, 320), 'numpy.array', 'np.array', (['vec'], {}), '(vec)\n', (315, 320), True, 'import numpy as np\n'), ((333, 348), 'numpy.array', 'np.array', (['point'], {}), '(point)\n', (341, 348), True, 'import numpy as np\n'), ((1004, 1020), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (1012, 1020), True, 'im...
import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as clr from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection from .bp2DRct import * blu = '#0059ff' # hsv(219., 1., 1. ) = Web color blue ora = '#ffa500' # hsv( 39., 1., 1. ) = Web color orange ml2r_b...
[ "numpy.dstack", "matplotlib.pyplot.show", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "numpy.array", "numpy.linspace", "matplotlib.collections.PatchCollection" ]
[((337, 359), 'numpy.array', 'np.array', (['[37, 37, 34]'], {}), '([37, 37, 34])\n', (345, 359), True, 'import numpy as np\n'), ((462, 487), 'numpy.array', 'np.array', (['[216, 216, 216]'], {}), '([216, 216, 216])\n', (470, 487), True, 'import numpy as np\n'), ((573, 597), 'numpy.array', 'np.array', (['[250, 184, 48]']...
"""" Miscellaneous functions to plot. Date: September 2018 Author: <NAME> Email: <EMAIL> Github: ignacioheredia """ import os import json import matplotlib.pylab as plt import numpy as np from audioclas import paths def training_plots(conf, stats, show_val=True, show_ckpt=True): """ Plot the loss and accu...
[ "json.load", "audioclas.paths.get_conf_dir", "numpy.arange", "audioclas.paths.get_stats_dir", "matplotlib.pylab.subplots" ]
[((635, 670), 'matplotlib.pylab.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(16, 8)'}), '(1, 2, figsize=(16, 8))\n', (647, 670), True, 'import matplotlib.pylab as plt\n'), ((2105, 2141), 'matplotlib.pylab.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '(16, 16)'}), '(2, 2, figsize=(16, 16))\n', (2...
import pytest import pandas as pd import numpy as np from pandas.testing import assert_frame_equal from cascade.dismod.constants import DensityEnum from cascade.executor.execution_context import make_execution_context from cascade.stats import meas_bounds_to_stdev from cascade.input_data.emr import ( _emr_from_...
[ "pandas.DataFrame", "cascade.input_data.emr._collapse_times", "cascade.input_data.emr._make_interpolators", "numpy.allclose", "pytest.fixture", "cascade.executor.execution_context.make_execution_context", "cascade.input_data.emr._emr_from_sex_and_node_specific_csmr_and_prevalence", "cascade.stats.meas...
[((510, 958), 'pandas.DataFrame', 'pd.DataFrame', (["{'age_lower': [0, 1, 10, 15, 20] * 2, 'age_upper': [0, 1, 10, 15, 20] * 2,\n 'time_lower': [1990] * 5 + [1995] * 5, 'time_upper': [1990] * 5 + [1995\n ] * 5, 'sex_id': [3] * 5 * 2, 'node_id': [6] * 5 * 2, 'density': [\n DensityEnum.gaussian] * 5 * 2, 'weight...
import json import numpy as np import pandas as pd from pathlib import Path import argparse def preprocess(data_name): u_list, i_list, ts_list, label_list = [], [], [], [] feat_l = [] idx_list = [] with open(data_name) as f: s = next(f) for idx, line in enumerate(f): e = l...
[ "pandas.DataFrame", "numpy.save", "argparse.ArgumentParser", "numpy.zeros", "pathlib.Path", "numpy.array", "numpy.vstack" ]
[((2064, 2127), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Interface for TGN data preprocessing"""'], {}), "('Interface for TGN data preprocessing')\n", (2087, 2127), False, 'import argparse\n'), ((1840, 1864), 'numpy.vstack', 'np.vstack', (['[empty, feat]'], {}), '([empty, feat])\n', (1849, 1864), Tru...
from aif360.detectors.mdss.ScoringFunctions.ScoringFunction import ScoringFunction from aif360.detectors.mdss.ScoringFunctions import optim import numpy as np class Bernoulli(ScoringFunction): def __init__(self, **kwargs): """ Bernoulli score function. May be appropriate to use when the outcome o...
[ "aif360.detectors.mdss.ScoringFunctions.optim.bisection_q_max", "numpy.log", "aif360.detectors.mdss.ScoringFunctions.optim.bisection_q_min", "aif360.detectors.mdss.ScoringFunctions.optim.bisection_q_mle", "aif360.detectors.mdss.ScoringFunctions.optim.direction_assertions" ]
[((2236, 2312), 'aif360.detectors.mdss.ScoringFunctions.optim.bisection_q_mle', 'optim.bisection_q_mle', (['self', 'observed_sum', 'expectations'], {'direction': 'direction'}), '(self, observed_sum, expectations, direction=direction)\n', (2257, 2312), False, 'from aif360.detectors.mdss.ScoringFunctions import optim\n')...
r"""Bytes tokenizer.""" from typing import AnyStr, List, Optional, Mapping from dataclasses import dataclass from jax import numpy as jnp import numpy as np Array = jnp.ndarray @dataclass class BytesTokenizer: r"""Tokenizer mapping text strings to their UTF-8 bytes.""" reserved_ids: Mapping[str, int] r...
[ "numpy.pad", "numpy.frombuffer" ]
[((2720, 2798), 'numpy.pad', 'np.pad', (['inputs'], {'pad_width': '((0, 0), (0, pad_length))', 'constant_values': 'pad_token'}), '(inputs, pad_width=((0, 0), (0, pad_length)), constant_values=pad_token)\n', (2726, 2798), True, 'import numpy as np\n'), ((1338, 1369), 'numpy.frombuffer', 'np.frombuffer', (['tokens', 'np....
import collections import sklearn import matplotlib.pyplot as plt import seaborn as sns import numpy as np from IPython.display import display_html, display, HTML from keras.models import load_model import pickle import keras import pandas as pd def save_obj(obj, name): with open('obj/lendingclub/' + name + '.pkl...
[ "keras.models.load_model", "pandas.DataFrame", "pickle.dump", "seaborn.lineplot", "matplotlib.pyplot.legend", "pickle.load", "numpy.array", "matplotlib.pyplot.subplots" ]
[((993, 1016), 'keras.models.load_model', 'load_model', (['path_to_ann'], {}), '(path_to_ann)\n', (1003, 1016), False, 'from keras.models import load_model\n'), ((1551, 1574), 'keras.models.load_model', 'load_model', (['path_to_ann'], {}), '(path_to_ann)\n', (1561, 1574), False, 'from keras.models import load_model\n')...
import numpy as np import matplotlib.pyplot as plt import pdb def return_func(x,y,t): r = np.sqrt(x**2.+y**2) #pdb.set_trace() check = np.sin(5*r-2*np.pi*t) keep = np.where(check == check.max()) return x[keep],y[keep] num = 5000 x_arr = np.linspace(-5.0,5.0,num) y_arr = np.linspace(-5.0,5.0,num) t_arr = np.lins...
[ "numpy.sin", "numpy.meshgrid", "numpy.linspace", "numpy.sqrt" ]
[((245, 272), 'numpy.linspace', 'np.linspace', (['(-5.0)', '(5.0)', 'num'], {}), '(-5.0, 5.0, num)\n', (256, 272), True, 'import numpy as np\n'), ((279, 306), 'numpy.linspace', 'np.linspace', (['(-5.0)', '(5.0)', 'num'], {}), '(-5.0, 5.0, num)\n', (290, 306), True, 'import numpy as np\n'), ((313, 334), 'numpy.linspace'...
""" .. _ex-electrode-pos-2d: ==================================================== How to convert 3D electrode positions to a 2D image. ==================================================== Sometimes we want to convert a 3D representation of electrodes into a 2D image. For example, if we are using electrocorticography ...
[ "mne.viz.set_3d_view", "mne.channels.read_layout", "os.path.dirname", "mne.coreg.estimate_head_mri_t", "matplotlib.pyplot.subplots", "mne.datasets.misc.data_path", "mne.io.fiff.raw.read_raw_fif", "os.path.join", "mne.viz.snapshot_brain_montage", "numpy.vstack" ]
[((1174, 1203), 'mne.datasets.misc.data_path', 'mne.datasets.misc.data_path', ([], {}), '()\n', (1201, 1203), False, 'import mne\n'), ((1222, 1272), 'os.path.join', 'op.join', (['misc_path', '"""ecog"""', '"""sample_ecog_ieeg.fif"""'], {}), "(misc_path, 'ecog', 'sample_ecog_ieeg.fif')\n", (1229, 1272), True, 'from os i...
import numpy as np import cv2 import matplotlib.pyplot as plt import numpy as np import math cap = cv2.VideoCapture(0) while(1): if __name__ == '__main__': ret, frame = cap.read() if frame.size == 0: ##if ret == False: print(f"Fail to read i...
[ "cv2.bitwise_and", "numpy.empty", "numpy.ones", "cv2.HoughLinesP", "cv2.normalize", "cv2.erode", "cv2.imshow", "cv2.line", "cv2.dilate", "cv2.cvtColor", "numpy.append", "cv2.destroyAllWindows", "cv2.Canny", "cv2.circle", "cv2.waitKey", "numpy.linalg.inv", "cv2.threshold", "cv2.ximg...
[((106, 125), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (122, 125), False, 'import cv2\n'), ((6894, 6917), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (6915, 6917), False, 'import cv2\n'), ((366, 401), 'cv2.imshow', 'cv2.imshow', (['"""Original frame"""', 'frame'], {}), "('...
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.7.1 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # # Hydrogen wavefunctions # # None of the material in ...
[ "numpy.meshgrid", "numpy.arctan2", "numpy.exp", "numpy.linspace", "math.factorial", "numpy.cos", "matplotlib.pyplot.subplots", "numpy.sqrt" ]
[((2891, 2905), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2903, 2905), True, 'import matplotlib.pyplot as plt\n'), ((2984, 3007), 'numpy.linspace', 'np.linspace', (['(0)', '(30)', '(100)'], {}), '(0, 30, 100)\n', (2995, 3007), True, 'import numpy as np\n'), ((3593, 3607), 'matplotlib.pyplot.subpl...
import numpy as np from diffpy.structure import Lattice, loadStructure, Structure from pyFAI.azimuthalIntegrator import AzimuthalIntegrator def cross_product(v1: np.ndarray, v2: np.ndarray) -> np.ndarray: return np.cross(v1, v2) def gram_schmidt(vs: np.ndarray) -> np.ndarray: us = [] # iterate column v...
[ "numpy.zeros_like", "pyFAI.azimuthalIntegrator.AzimuthalIntegrator", "numpy.deg2rad", "numpy.cross", "numpy.linalg.norm", "numpy.array", "numpy.matmul", "numpy.column_stack", "diffpy.structure.loadStructure", "numpy.inner" ]
[((219, 235), 'numpy.cross', 'np.cross', (['v1', 'v2'], {}), '(v1, v2)\n', (227, 235), True, 'import numpy as np\n'), ((515, 534), 'numpy.column_stack', 'np.column_stack', (['us'], {}), '(us)\n', (530, 534), True, 'import numpy as np\n'), ((1171, 1200), 'numpy.column_stack', 'np.column_stack', (['[h1, h2, h3]'], {}), '...
import os from astropy import log from urllib.request import urlopen from astropy.table import Table import numpy as np def retrieve_ephemeris(): file_name = "Crab.gro" url = "http://www.jb.man.ac.uk/pulsar/crab/all.gro" if not os.path.exists(file_name): response = urlopen(url) data = res...
[ "numpy.double", "numpy.floor", "os.path.exists", "urllib.request.urlopen", "astropy.log.info", "numpy.any", "astropy.table.Table.read" ]
[((917, 975), 'astropy.table.Table.read', 'Table.read', (['file_name'], {'format': '"""ascii.fixed_width_two_line"""'}), "(file_name, format='ascii.fixed_width_two_line')\n", (927, 975), False, 'from astropy.table import Table\n'), ((1415, 1452), 'numpy.double', 'np.double', (["table['f0(s^-1)'][good][0]"], {}), "(tabl...
from typing import Union, Tuple, Optional, Any from typing_extensions import Literal import numpy as np import eagerpy as ep import logging from ..devutils import flatten from ..devutils import atleast_kd from ..types import Bounds from ..models import Model from ..criteria import Criterion from ..distances import...
[ "numpy.full", "eagerpy.matmul", "eagerpy.where", "eagerpy.ones", "eagerpy.normal", "eagerpy.logical_or", "eagerpy.maximum", "eagerpy.norms.l2", "eagerpy.logical_and", "numpy.isnan", "logging.info", "eagerpy.astensor_", "eagerpy.astensor", "eagerpy.from_numpy", "numpy.nanmean" ]
[((14190, 14218), 'eagerpy.normal', 'ep.normal', (['perturbed', '(D, 1)'], {}), '(perturbed, (D, 1))\n', (14199, 14218), True, 'import eagerpy as ep\n'), ((14407, 14432), 'eagerpy.norms.l2', 'ep.norms.l2', (['eta'], {'axis': '(-1)'}), '(eta, axis=-1)\n', (14418, 14432), True, 'import eagerpy as ep\n'), ((15417, 15439),...
""" Implements the functions to calculate the surface movement function advance: calculates the movement of the surface function timestep: calculates the timestep for a given time function get_velocities: calculates the the surface velocities """ import numpy as np import mini_topsim.sputtering as sputter import mi...
[ "numpy.full_like", "numpy.zeros_like", "mini_topsim.sputtering.get_sputter_yield", "numpy.where", "mini_topsim.beam.beam_profile" ]
[((2595, 2630), 'numpy.where', 'np.where', (['(costheta < 0)', '(0)', 'costheta'], {}), '(costheta < 0, 0, costheta)\n', (2603, 2630), True, 'import numpy as np\n'), ((2667, 2712), 'mini_topsim.sputtering.get_sputter_yield', 'sputter.get_sputter_yield', (['costheta', 'sintheta'], {}), '(costheta, sintheta)\n', (2692, 2...
from sys import path as syspath from os import path as ospath import os, glob import numpy as np import functools import copy from timeit import default_timer as timer #CBSA syspath.append(ospath.join(ospath.expanduser("~"), 'CBSA')) from cbsa import ReactionSystem def cbsa2stochpy(cbsa_model,path="/home/burke/Stoch...
[ "steps.geom.Geom", "os.makedirs", "steps.model.Model", "timeit.default_timer", "steps.model.Volsys", "numpy.zeros", "numpy.identity", "os.path.exists", "stochpy.SSA", "gillespy2.Model", "steps.rng.create", "cbsa.ReactionSystem", "numpy.where", "steps.solver.Wmdirect", "steps.geom.Comp", ...
[((2603, 2611), 'stochpy.SSA', 'sp.SSA', ([], {}), '()\n', (2609, 2611), True, 'import stochpy as sp\n'), ((2739, 2762), 'gillespy2.Model', 'glp.Model', ([], {'name': '"""Model"""'}), "(name='Model')\n", (2748, 2762), True, 'import gillespy2 as glp\n'), ((4324, 4338), 'steps.model.Model', 'smodel.Model', ([], {}), '()\...
""" name: equation.py goal: mettre ensemble tous les algorithmes de résolution author: Dr <NAME> date: 26/01/2022 """ import math from math import fabs, sqrt, pow import numpy as np class Equation: def __init__(self): self.isExist = True self._getValues() def _getValues(self...
[ "math.fabs", "numpy.arange", "math.pow" ]
[((2205, 2225), 'numpy.arange', 'np.arange', (['a', 'b', '(0.1)'], {}), '(a, b, 0.1)\n', (2214, 2225), True, 'import numpy as np\n'), ((4285, 4307), 'numpy.arange', 'np.arange', (['X1', 'X2', '(0.1)'], {}), '(X1, X2, 0.1)\n', (4294, 4307), True, 'import numpy as np\n'), ((1541, 1554), 'math.pow', 'pow', (['(x - 5)', '(...
"""Implement Source Power Comodulation (SPoC) framework.""" import copy as cp from mne import EvokedArray import numpy as np from scipy.linalg import pinv, eigh from sklearn.base import TransformerMixin def shrink(cov, alpha): """Shrink covariance matrix.""" n = len(cov) shrink_cov = (1 - alpha) * cov + ...
[ "numpy.diag", "copy.deepcopy", "numpy.trace", "numpy.abs", "numpy.mean", "numpy.arange", "scipy.linalg.eigh", "mne.EvokedArray", "numpy.linalg.norm", "numpy.eye", "numpy.log10", "scipy.linalg.pinv", "numpy.issubdtype" ]
[((3512, 3532), 'numpy.log10', 'np.log10', (['Xf'], {'out': 'Xf'}), '(Xf, out=Xf)\n', (3520, 3532), True, 'import numpy as np\n'), ((4501, 4518), 'copy.deepcopy', 'cp.deepcopy', (['info'], {}), '(info)\n', (4512, 4518), True, 'import copy as cp\n'), ((4642, 4684), 'mne.EvokedArray', 'EvokedArray', (['norm_patterns.T', ...
from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import cv2 import numpy as np import sys import math import cv2 import qimage2ndarray as qi from collections import defaultdict from GraphicsView import * from fftpop import * ''' 10/28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
[ "cv2.circle", "cv2.moments", "collections.defaultdict", "cv2.imread", "numpy.min", "qimage2ndarray.array2qimage", "numpy.max", "numpy.shape", "numpy.array", "cv2.resize" ]
[((1127, 1190), 'cv2.circle', 'cv2.circle', (['colorim', '(point[0], point[1])', '(5)', '(0, 255, 255)', '(-1)'], {}), '(colorim, (point[0], point[1]), 5, (0, 255, 255), -1)\n', (1137, 1190), False, 'import cv2\n'), ((1534, 1558), 'cv2.moments', 'cv2.moments', (['contours[i]'], {}), '(contours[i])\n', (1545, 1558), Fal...
import json import cv2 from icecream import ic import os.path import pathlib import pickle import numpy as np import matplotlib.pyplot as plt import copy import yaml from TDDFA import TDDFA from buddha_dataset import BuddhaDataset, Artifact, Image, Config, crop_pict, get_transform from mpl_toolkits.mplot3d import Axes3...
[ "buddha_dataset.get_transform", "json.dump", "json.load", "buddha_dataset.crop_pict", "copy.deepcopy", "face_alignment.FaceAlignment", "buddha_dataset.Config", "numpy.asarray", "numpy.zeros", "TDDFA.TDDFA", "numpy.mean", "numpy.random.randint", "numpy.array_equal", "numpy.random.shuffle" ]
[((1157, 1182), 'numpy.asarray', 'np.asarray', (['all_artifacts'], {}), '(all_artifacts)\n', (1167, 1182), True, 'import numpy as np\n'), ((1187, 1219), 'numpy.random.shuffle', 'np.random.shuffle', (['all_artifacts'], {}), '(all_artifacts)\n', (1204, 1219), True, 'import numpy as np\n'), ((1779, 1802), 'numpy.asarray',...
import numpy as np import logging from psd_tools.constants import ChannelID, Tag, ColorMode logger = logging.getLogger(__name__) EXPECTED_CHANNELS = { ColorMode.BITMAP: 1, ColorMode.GRAYSCALE: 1, ColorMode.INDEXED: 3, ColorMode.RGB: 3, ColorMode.CMYK: 4, ColorMode.MULTICHANNEL: 64, ColorM...
[ "numpy.stack", "numpy.frombuffer", "numpy.ones", "logging.getLogger", "numpy.concatenate", "numpy.repeat" ]
[((103, 130), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (120, 130), False, 'import logging\n'), ((3287, 3325), 'numpy.concatenate', 'np.concatenate', (['[color, shape]'], {'axis': '(2)'}), '([color, shape], axis=2)\n', (3301, 3325), True, 'import numpy as np\n'), ((670, 723), 'numpy....
import mobula.layers as L import numpy as np def test_reshape(): X = np.arange(2 * 3 * 4 * 5).reshape((2, 3, 4, 5)) dY = np.arange(100, 100 + 2 * 3 * 4 * 5).reshape((2, 3, 4, 5)) l = L.Reshape(None, "reshape", dims = [2, -1, 3, 0]) l.X = X l.reshape() l.forward() l.dY = dY l.backward() ...
[ "mobula.layers.Reshape", "numpy.arange" ]
[((196, 242), 'mobula.layers.Reshape', 'L.Reshape', (['None', '"""reshape"""'], {'dims': '[2, -1, 3, 0]'}), "(None, 'reshape', dims=[2, -1, 3, 0])\n", (205, 242), True, 'import mobula.layers as L\n'), ((74, 98), 'numpy.arange', 'np.arange', (['(2 * 3 * 4 * 5)'], {}), '(2 * 3 * 4 * 5)\n', (83, 98), True, 'import numpy a...
from numpy import exp from pandas import DataFrame def rasch_irf(theta, b): """Rasch Item Response Function Given a level of theta and an item difficulty return the probability of a correct response. Parameters ---------- theta : numeric the person's theta (ability) level b : ...
[ "pandas.DataFrame", "numpy.exp" ]
[((1024, 1040), 'pandas.DataFrame', 'DataFrame', (['probs'], {}), '(probs)\n', (1033, 1040), False, 'from pandas import DataFrame\n'), ((381, 395), 'numpy.exp', 'exp', (['(theta - b)'], {}), '(theta - b)\n', (384, 395), False, 'from numpy import exp\n'), ((401, 415), 'numpy.exp', 'exp', (['(theta - b)'], {}), '(theta -...
from __future__ import division import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np from textwrap import dedent import scipy.signal import warnings from . import util class Meter(): """ Meter object which defines how the meter operates Defaults to the algorithm defined in ITU...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.axes", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.mean", "numpy.round", "warnings.simplefilter", "warnings.catch_warnings", "numpy.reshape", "matplotlib.ticker.MultipleLocator", "matplotlib.pyplot.show", "matplotlib.pyplot.yl...
[((3809, 3850), 'numpy.zeros', 'np.zeros', ([], {'shape': '(numChannels, numSamples)'}), '(shape=(numChannels, numSamples))\n', (3817, 3850), True, 'import numpy as np\n'), ((4091, 4114), 'numpy.arange', 'np.arange', (['(0)', 'numBlocks'], {}), '(0, numBlocks)\n', (4100, 4114), True, 'import numpy as np\n'), ((7603, 76...
# -*- coding: utf-8; -*- # # sparsegrad - automatic calculation of sparse gradient # Copyright (C) 2016-2018 <NAME> (<EMAIL>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License, version 3, # as published by the Free Software Foundation....
[ "numpy.asarray", "numpy.zeros", "numpy.ones", "numpy.arange", "numpy.linspace" ]
[((1041, 1062), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(11)'], {}), '(0, 1, 11)\n', (1052, 1062), True, 'import numpy as np\n'), ((947, 965), 'numpy.asarray', 'np.asarray', (['[0, 3]'], {}), '([0, 3])\n', (957, 965), True, 'import numpy as np\n'), ((990, 1013), 'numpy.asarray', 'np.asarray', (['[2.0, -1.0]']...
import os import numpy as np import librosa import math from random import shuffle import shutil def rename(): folders = os.listdir('./data/sound') for folder in folders: files = os.listdir('./data/sound/{0}'.format(folder)) for file in files: name_list = file.split('.') ...
[ "numpy.pad", "numpy.save", "math.ceil", "random.shuffle", "librosa.feature.melspectrogram", "librosa.load", "numpy.array", "numpy.array_split", "os.path.join", "os.listdir" ]
[((127, 153), 'os.listdir', 'os.listdir', (['"""./data/sound"""'], {}), "('./data/sound')\n", (137, 153), False, 'import os\n'), ((643, 662), 'os.listdir', 'os.listdir', (['basedir'], {}), '(basedir)\n', (653, 662), False, 'import os\n'), ((1704, 1726), 'os.listdir', 'os.listdir', (['"""G:/sound"""'], {}), "('G:/sound'...
from hklearn_genetic.genetic_algorithm import GeneticAlgorithm from hklearn_genetic.problem import BinaryRastrigin, BinaryBeale, BinaryHimmelblau, BinaryEggholder, RealRastrigin, RealBeale, RealHimmelblau, RealEggholder from hklearn_genetic.pso import pso, RealRastriginPSO, RealBealePSO, RealHimmelblauPSO, RealEggholde...
[ "utils.average_list_of_lists", "hklearn_genetic.pso.RealBealePSO", "hklearn_genetic.pso.RealRastriginPSO", "math.ceil", "timeit.default_timer", "logging.getLogger", "logging.Formatter", "os.environ.get", "logging.info", "numpy.array", "utils.plot_superposed_multiple_xs", "hklearn_genetic.pso.R...
[((975, 1000), 'hklearn_genetic.pso.RealRastriginPSO', 'RealRastriginPSO', ([], {'n_dim': '(2)'}), '(n_dim=2)\n', (991, 1000), False, 'from hklearn_genetic.pso import pso, RealRastriginPSO, RealBealePSO, RealHimmelblauPSO, RealEggholderPSO\n'), ((1009, 1023), 'hklearn_genetic.pso.RealBealePSO', 'RealBealePSO', ([], {})...
import discord import glob from discord.ext import commands,tasks import gspread import random from oauth2client.service_account import ServiceAccountCredentials import numpy as np import pandas as pd import datetime import os import urllib.request, urllib.error import requests import matplotlib.pyplot as ...
[ "discord.File", "numpy.asarray", "PIL.Image.open", "cv2.CascadeClassifier", "discord.Client" ]
[((490, 506), 'discord.Client', 'discord.Client', ([], {}), '()\n', (504, 506), False, 'import discord\n'), ((1741, 1754), 'PIL.Image.open', 'Image.open', (['f'], {}), '(f)\n', (1751, 1754), False, 'from PIL import Image\n'), ((1802, 1821), 'numpy.asarray', 'np.asarray', (['grayimg'], {}), '(grayimg)\n', (1812, 1821), ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import pandas as pd from datetime import datetime from typing import List import logging def get_futures_chain(meta_data: pd.DataFrame, asofdate: datetime.date) -> pd.DataFrame: """ get current futures chain on asofdate :param meta_data: data...
[ "pandas.DataFrame", "logging.error", "numpy.zeros", "pandas.concat" ]
[((3142, 3156), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3154, 3156), True, 'import pandas as pd\n'), ((7020, 7034), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (7032, 7034), True, 'import pandas as pd\n'), ((9813, 9842), 'pandas.concat', 'pd.concat', (['[s, combo]'], {'axis': '(1)'}), '([s, com...
#!/usr/bin/python2 import numpy as np import argparse import chainer import six from chainer import computational_graph from chainer import cuda from chainer import optimizers from chainer import serializers import cv2 from sklearn.feature_extraction.image import extract_patches from nr_model import Model from ...
[ "nr_model.Model", "numpy.sum", "argparse.ArgumentParser", "six.moves.range", "numpy.concatenate", "cv2.cvtColor", "chainer.cuda.check_cuda_available", "cv2.imread", "sklearn.feature_extraction.image.extract_patches", "fr_model.FRModel", "chainer.serializers.load_hdf5" ]
[((355, 405), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""evaluate.py"""'}), "(description='evaluate.py')\n", (378, 405), False, 'import argparse\n'), ((1094, 1121), 'chainer.cuda.check_cuda_available', 'cuda.check_cuda_available', ([], {}), '()\n', (1119, 1121), False, 'from chainer ...
"""Script that generates a Gravitational Microlensing Signal, randomly, within the natural parameters: u0 ( source-lens impact parameter), tE (Einstein radius crossing time), rho (angular source size normalized by the angular Einstein radius) , s (Projected separation of the masses normalized by the angular Einstein ra...
[ "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "time.time", "numpy.argwhere", "muLAn.models.vbb.vbb.vbbmagU", "pathlib.Path", "numpy.sin", "numpy.arange", "numpy.linspace", "numpy.random.choice", "numpy.cos", "matplot...
[((7327, 7338), 'time.time', 'time.time', ([], {}), '()\n', (7336, 7338), False, 'import time\n'), ((1420, 1460), 'numpy.linspace', 'np.linspace', (['(-30)', '(30)', 'self.n_data_points'], {}), '(-30, 30, self.n_data_points)\n', (1431, 1460), True, 'import numpy as np\n'), ((3405, 3431), 'numpy.linspace', 'np.linspace'...
#!/usr/bin/env python3 from mp.utils import Transform, keep_state from mp.const import MU, VIRTUAL_CUBOID_HALF_SIZE, INIT_JOINT_CONF from .ik import IKUtils from .force_closure import CuboidForceClosureTest, CoulombFriction import itertools import numpy as np class Grasp(object): def __init__(self, cube_tip_pos, ...
[ "numpy.random.uniform", "numpy.abs", "mp.utils.Transform", "trifinger_simulation.tasks.move_cube.sample_goal", "numpy.empty", "itertools.permutations", "numpy.zeros", "pybullet.resetDebugVisualizerCamera", "pybullet.isConnected", "numpy.array", "numpy.linalg.norm", "numpy.random.choice", "mp...
[((1110, 1121), 'numpy.empty', 'np.empty', (['(3)'], {}), '(3)\n', (1118, 1121), True, 'import numpy as np\n'), ((2280, 2296), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (2288, 2296), True, 'import numpy as np\n'), ((2774, 2866), 'numpy.array', 'np.array', (['[side_centers[0], side_centers[1] + 0.15 * a...
import os import time import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from velodyne_env import GazeboEnv from replay_buffer2 import ReplayBuffer from collections import deque def evaluate(network, eval_episodes=10, epoch=0): avg_reward = 0. col = 0 for _ in range(eval...
[ "numpy.random.seed", "replay_buffer2.ReplayBuffer", "numpy.random.randint", "numpy.random.normal", "velodyne_env.GazeboEnv", "torch.load", "os.path.exists", "torch.Tensor", "torch.nn.Linear", "torch.nn.functional.relu", "numpy.save", "torch.nn.Tanh", "torch.manual_seed", "torch.nn.function...
[((8999, 9048), 'velodyne_env.GazeboEnv', 'GazeboEnv', (['"""multi_robot_scenario.launch"""', '(1)', '(1)', '(1)'], {}), "('multi_robot_scenario.launch', 1, 1, 1)\n", (9008, 9048), False, 'from velodyne_env import GazeboEnv\n'), ((9049, 9062), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (9059, 9062), False, 'im...
""" =============================== OCR Letter sequence recognition =============================== This example illustrates the use of a chain CRF for optical character recognition. The example is taken from Taskar et al "Max-margin markov random fields". Each example consists of a handwritten word, that was presegme...
[ "pystruct.models.ChainCRF", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.random.RandomState", "matplotlib.pyplot.colorbar", "numpy.hstack", "pystruct.learners.FrankWolfeSSVM", "numpy.array", "numpy.arange", "pystruct.datasets.load_letters", "sklearn.svm.LinearSVC", "matplotlib.p...
[((1646, 1660), 'pystruct.datasets.load_letters', 'load_letters', ([], {}), '()\n', (1658, 1660), False, 'from pystruct.datasets import load_letters\n'), ((1966, 1994), 'sklearn.svm.LinearSVC', 'LinearSVC', ([], {'dual': '(False)', 'C': '(0.1)'}), '(dual=False, C=0.1)\n', (1975, 1994), False, 'from sklearn.svm import L...
################################################################################ # Copyright (c) 2018-2019, National Research Foundation (Square Kilometre Array) # # Licensed under the BSD 3-Clause License (the "License"); you may not use # this file except in compliance with the License. You may obtain a copy # of the...
[ "os.mkdir", "katsdptelstate.TelescopeState", "katdal.datasources.view_l0_capture_stream", "numpy.arange", "shutil.rmtree", "os.path.join", "katdal.vis_flags_weights.correct_autocorr_quantisation", "katdal.test.test_vis_flags_weights.put_fake_dataset", "katdal.datasources.TelstateDataSource.from_url"...
[((1705, 1843), 'katdal.test.test_vis_flags_weights.put_fake_dataset', 'put_fake_dataset', (['store', 'store_prefix', 'shape'], {'chunk_overrides': 'chunk_overrides', 'array_overrides': 'array_overrides', 'flags_only': 'flags_only'}), '(store, store_prefix, shape, chunk_overrides=\n chunk_overrides, array_overrides=...
from enum import unique from typing import Type from SPARQLWrapper import SPARQLWrapper, CSV, JSON, POST from numpy.core.defchararray import add from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import geopandas as gpd from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, mark_in...
[ "matplotlib.pyplot.title", "pickle.dump", "numpy.around", "matplotlib.pyplot.figure", "pickle.load", "numpy.mean", "matplotlib.pyplot.tight_layout", "numpy.round", "numpy.unique", "pandas.DataFrame", "numpy.zeros_like", "numpy.std", "SPARQLWrapper.SPARQLWrapper", "matplotlib.pyplot.rc", ...
[((14168, 14196), 'numpy.unique', 'np.unique', (['all_results[:, 0]'], {}), '(all_results[:, 0])\n', (14177, 14196), True, 'import numpy as np\n'), ((26958, 26993), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""sans-serif"""'}), "('font', family='sans-serif')\n", (26964, 26993), True, 'import matplo...
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function from abc import abstractmethod, ABC from typing import...
[ "cmdstanpy.CmdStanModel", "pkg_resources.resource_filename", "pathlib.Path", "pickle.load", "numpy.array", "collections.OrderedDict", "logging.getLogger" ]
[((470, 505), 'logging.getLogger', 'logging.getLogger', (['"""prophet.models"""'], {}), "('prophet.models')\n", (487, 505), False, 'import logging\n'), ((1820, 1894), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""prophet"""', '"""stan_model/prophet_model.bin"""'], {}), "('prophet', 'stan_m...
# Copyright (c) 2020 PaddlePaddle 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 appli...
[ "numpy.array", "paddle.to_tensor", "paddle.gather", "numpy.random.permutation" ]
[((1627, 1649), 'paddle.to_tensor', 'paddle.to_tensor', (['perm'], {}), '(perm)\n', (1643, 1649), False, 'import paddle\n'), ((1660, 1688), 'paddle.gather', 'paddle.gather', (['x', 'perm', 'axis'], {}), '(x, perm, axis)\n', (1673, 1688), False, 'import paddle\n'), ((1547, 1561), 'numpy.array', 'np.array', (['perm'], {}...
import numpy as np import torch from torch import Tensor from torch import nn class ODEF(nn.Module): def forward_with_grad(self, z, grad_outputs): """Compute f and a df/dz, a df/dp, a df/dt""" batch_size = z.shape[0] out = self.forward(z) a = grad_outputs adfdz, *adfdp = to...
[ "torch.cat", "torch.Tensor", "torch.set_grad_enabled", "torch.zeros", "torch.no_grad", "torch.abs", "numpy.prod" ]
[((1136, 1162), 'torch.cat', 'torch.cat', (['flat_parameters'], {}), '(flat_parameters)\n', (1145, 1162), False, 'import torch\n'), ((2228, 2244), 'numpy.prod', 'np.prod', (['z_shape'], {}), '(z_shape)\n', (2235, 2244), True, 'import numpy as np\n'), ((5385, 5403), 'torch.Tensor', 'Tensor', (['[0.0, 1.0]'], {}), '([0.0...
import numpy as np from paddle import nn import paddle import paddle.nn.functional as F from functools import partial def multi_apply(func, *args, **kwargs): """Apply function to a list of arguments. Note: This function applies the ``func`` to multiple inputs and map the multiple outputs of th...
[ "numpy.stack", "functools.partial", "paddle.reshape", "paddle.sin", "paddle.arange", "paddle.topk", "paddle.cos", "paddle.matmul", "paddle.transpose", "paddle.to_tensor" ]
[((715, 738), 'functools.partial', 'partial', (['func'], {}), '(func, **kwargs)\n', (722, 738), False, 'from functools import partial\n'), ((3010, 3049), 'paddle.transpose', 'paddle.transpose', (['pred[0]', '(0, 2, 3, 1)'], {}), '(pred[0], (0, 2, 3, 1))\n', (3026, 3049), False, 'import paddle\n'), ((3070, 3109), 'paddl...
from collections import OrderedDict from collections.abc import Callable from io import StringIO from numbers import Integral, Real from warnings import warn import os import tempfile import h5py import numpy as np from openmc.mixin import EqualityMixin import openmc.checkvalue as cv from . import HDF5_VERSION, HDF5_...
[ "io.StringIO", "numpy.count_nonzero", "openmc.checkvalue.check_greater_than", "tempfile.TemporaryDirectory", "os.path.join", "openmc.checkvalue.check_type", "numpy.any", "numpy.array", "numpy.string_", "collections.OrderedDict", "numpy.union1d" ]
[((2764, 2817), 'openmc.checkvalue.check_type', 'cv.check_type', (['"""reaction cross section"""', 'xs', 'Callable'], {}), "('reaction cross section', xs, Callable)\n", (2777, 2817), True, 'import openmc.checkvalue as cv\n'), ((2907, 2962), 'openmc.checkvalue.check_type', 'cv.check_type', (['"""redundant"""', 'redundan...
import numpy as np def lic_flow(vectors, len_pix=10): """Return an array describing for each pixel in the vector field the stream line coordinates. This function is useful to produce a sequence of the images showing the vectors flow direction by phase shifting the kernel. Parameters -------...
[ "numpy.asarray", "numpy.zeros", "numpy.arange" ]
[((637, 656), 'numpy.asarray', 'np.asarray', (['vectors'], {}), '(vectors)\n', (647, 656), True, 'import numpy as np\n'), ((743, 795), 'numpy.zeros', 'np.zeros', (['(2 * len_pix + 1, m, n, 2)'], {'dtype': 'np.int32'}), '((2 * len_pix + 1, m, n, 2), dtype=np.int32)\n', (751, 795), True, 'import numpy as np\n'), ((864, 8...
import sys import numpy from numpy.testing import (assert_, assert_equal, assert_array_equal, assert_array_almost_equal, suppress_warnings) import pytest from pytest import raises as assert_raises import scipy.ndimage as ndimage from . import types eps = 1e-12 class TestNdimageInterpolat...
[ "numpy.empty", "numpy.ones", "numpy.arange", "pytest.mark.parametrize", "numpy.testing.assert_array_almost_equal", "numpy.pad", "numpy.empty_like", "scipy.ndimage.zoom", "pytest.raises", "numpy.linspace", "numpy.testing.assert_equal", "numpy.testing.assert_allclose", "scipy.ndimage.affine_tr...
[((331, 683), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode, expected_value"""', "[('nearest', [1.5, 2.5, 3.5, 4, 4, 4, 4]), ('wrap', [1.5, 2.5, 3.5, 1.5, \n 2.5, 3.5, 1.5]), ('grid-wrap', [1.5, 2.5, 3.5, 2.5, 1.5, 2.5, 3.5]), (\n 'mirror', [1.5, 2.5, 3.5, 3.5, 2.5, 1.5, 1.5]), ('reflect', [1.5...
import unittest import os import numpy as np import pandas as pd import pandas.testing as pdt import copy from inferelator import workflow from inferelator.amusr_workflow import MultitaskLearningWorkflow from inferelator.tests.artifacts.test_stubs import TaskDataStub data_path = os.path.join(os.path.dirname(__file__)...
[ "pandas.DataFrame", "copy.deepcopy", "numpy.sum", "os.path.dirname", "numpy.testing.assert_array_almost_equal_nulp", "inferelator.tests.artifacts.test_stubs.TaskDataStub.priors_data.copy", "inferelator.amusr_workflow.MultitaskLearningWorkflow", "inferelator.workflow.inferelator_workflow", "numpy.arr...
[((295, 320), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (310, 320), False, 'import os\n'), ((434, 501), 'inferelator.workflow.inferelator_workflow', 'workflow.inferelator_workflow', ([], {'workflow': '"""amusr"""', 'regression': '"""amusr"""'}), "(workflow='amusr', regression='amusr')\n"...
"""Unit tests for input_examples.py.""" import copy import unittest import numpy from gewittergefahr.gg_utils import radar_utils from gewittergefahr.gg_utils import linkage from gewittergefahr.gg_utils import target_val_utils from gewittergefahr.deep_learning import storm_images from gewittergefahr.deep_learning impor...
[ "numpy.stack", "numpy.random.uniform", "copy.deepcopy", "unittest.main", "gewittergefahr.deep_learning.input_examples._filter_examples_by_class", "gewittergefahr.deep_learning.input_examples._check_target_vars", "gewittergefahr.deep_learning.input_examples.find_example_file", "numpy.allclose", "gewi...
[((450, 510), 'numpy.array', 'numpy.array', (['[0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]'], {'dtype': 'int'}), '([0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0], dtype=int)\n', (461, 510), False, 'import numpy\n'), ((647, 686), 'numpy.array', 'numpy.array', (['[0, 1, 2, 4, 6]'], {'dtype': 'int'}), '([0, 1, 2, 4, 6], dtype=int)\n', (65...
# import libraries import sys sys.path.append('..') import os import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import torchvision from torchvision import transforms import matplotlib.pyplot as plt import time import argparse import copy import json f...
[ "matplotlib.pyplot.title", "numpy.random.seed", "seaborn.heatmap", "argparse.ArgumentParser", "torch.argmax", "numpy.argsort", "matplotlib.pyplot.figure", "torchvision.transforms.Normalize", "os.path.join", "torchvision.models.vgg16_bn", "sys.path.append", "pandas.DataFrame", "torch.utils.da...
[((30, 51), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (45, 51), False, 'import sys\n'), ((541, 564), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (558, 564), False, 'import torch\n'), ((569, 589), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (58...
import torch import torch.nn as nn import torch.nn.functional as F import dgl import dgl.function as fn import numpy as np from torch.nn import init import torch.utils.data as data from torch.autograd import Variable import torch.autograd as autograd from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_seque...
[ "numpy.load", "tqdm.tqdm", "numpy.random.seed", "torch.nn.BCELoss", "torch.utils.data.DataLoader", "torch.stack", "torch.manual_seed", "torch.FloatTensor", "models.KnowledgeAwareGraphNetworks", "numpy.zeros", "torch.cat", "torch.optim.Adam", "random.seed", "torch.nn.MarginRankingLoss", "...
[((726, 747), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (743, 747), False, 'import torch\n'), ((748, 763), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (759, 763), False, 'import random\n'), ((764, 782), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (778, 782), Tr...
import numpy as np def compute_cost_with_regularization_test_case(): np.random.seed(1) Y_assess = np.array([[1, 1, 0, 1, 0]]) W1 = np.random.randn(2, 3) b1 = np.random.randn(2, 1) W2 = np.random.randn(3, 2) b2 = np.random.randn(3, 1) W3 = np.random.randn(1, 3) b3 = np.random.randn(1, 1...
[ "numpy.array", "numpy.random.seed", "numpy.random.randn" ]
[((75, 92), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (89, 92), True, 'import numpy as np\n'), ((108, 135), 'numpy.array', 'np.array', (['[[1, 1, 0, 1, 0]]'], {}), '([[1, 1, 0, 1, 0]])\n', (116, 135), True, 'import numpy as np\n'), ((145, 166), 'numpy.random.randn', 'np.random.randn', (['(2)', '(3)...
import numpy as np import math from numpy import linalg from mapel.roommates.models._utils import convert from mapel.roommates.models.mallows import mallows_votes ################################################################ def get_range(params): if params['p_dist'] == 'beta': return np.random.beta(pa...
[ "mapel.roommates.models.mallows.mallows_votes", "numpy.random.uniform", "numpy.random.beta", "numpy.random.rand", "numpy.zeros", "numpy.ones", "math.sin", "numpy.random.random", "numpy.linalg.norm", "math.cos", "numpy.random.normal", "numpy.random.randint", "mapel.roommates.models._utils.con...
[((879, 924), 'numpy.zeros', 'np.zeros', (['[num_agents, num_agents]'], {'dtype': 'int'}), '([num_agents, num_agents], dtype=int)\n', (887, 924), True, 'import numpy as np\n'), ((941, 988), 'numpy.zeros', 'np.zeros', (['[num_agents, num_agents]'], {'dtype': 'float'}), '([num_agents, num_agents], dtype=float)\n', (949, ...
import pickle from flask import Flask, request from flasgger import Swagger import numpy as np import pandas as pd with open('rf.pkl', 'rb') as model_file: model = pickle.load(model_file) app = Flask(__name__) swagger = Swagger(app) @app.route('/predict') def predict_iris(): """Example endpoint returning a p...
[ "flask.request.args.get", "flask.Flask", "pickle.load", "numpy.array", "flasgger.Swagger" ]
[((200, 215), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'from flask import Flask, request\n'), ((226, 238), 'flasgger.Swagger', 'Swagger', (['app'], {}), '(app)\n', (233, 238), False, 'from flasgger import Swagger\n'), ((169, 192), 'pickle.load', 'pickle.load', (['model_file'], {}),...
import random import h5py import matplotlib.pyplot as plt import argparse import numpy as np import os OPS = { 'abs': lambda x,y : np.abs(x), 'arcsinh': lambda x,y : np.arcsinh(y*x)/np.arcsinh(np.abs(y)), #y = 10 'arctan': lambda x,y : np.arctan(y*x)/np.arctan(np.abs(y)), #y = 10 'cbrt': lambda x,y: np.cbrt(x...
[ "os.remove", "numpy.abs", "argparse.ArgumentParser", "matplotlib.pyplot.clf", "numpy.floor", "numpy.sinc", "numpy.sin", "numpy.arange", "numpy.arcsinh", "matplotlib.pyplot.subplots", "h5py.File", "numpy.ones_like", "matplotlib.pyplot.show", "numpy.cbrt", "numpy.ceil", "numpy.tanh", "...
[((876, 903), 'numpy.sin', 'np.sin', (['(np.pi * (y * x + z))'], {}), '(np.pi * (y * x + z))\n', (882, 903), True, 'import numpy as np\n'), ((3003, 3018), 'numpy.ones_like', 'np.ones_like', (['x'], {}), '(x)\n', (3015, 3018), True, 'import numpy as np\n'), ((3030, 3060), 'matplotlib.pyplot.subplots', 'plt.subplots', ([...
"""Provides memory buffer and logger for evaluation""" import logging from skimage import draw import numpy as np import torch class Evaluator: r"""To evaluate and log evaluation metrics: PCK, LT-ACC, IoU""" def __init__(self, benchmark, device): r"""Constructor for Evaluator""" self.eval_bu...
[ "skimage.draw.polygon", "numpy.zeros", "torch.mul", "logging.info", "torch.pow", "torch.sum", "numpy.fromstring", "torch.le" ]
[((4625, 4656), 'torch.le', 'torch.le', (['l2dist', '(thres * alpha)'], {}), '(l2dist, thres * alpha)\n', (4633, 4656), False, 'import torch\n'), ((4669, 4691), 'torch.sum', 'torch.sum', (['correct_pts'], {}), '(correct_pts)\n', (4678, 4691), False, 'import torch\n'), ((5059, 5092), 'skimage.draw.polygon', 'draw.polygo...
import _flowunit as modelbox import sys import numpy as np import os import cv2 from PIL import Image, ImageEnhance class BrightnessFlowunit(modelbox.FlowUnit): def __init__(self): super().__init__() def open(self, config): self.__brightness = config.get_float("brightness", 0.0) if se...
[ "numpy.array", "PIL.Image.fromarray", "PIL.ImageEnhance.Brightness", "_flowunit.Status" ]
[((419, 436), '_flowunit.Status', 'modelbox.Status', ([], {}), '()\n', (434, 436), True, 'import _flowunit as modelbox\n'), ((1082, 1099), '_flowunit.Status', 'modelbox.Status', ([], {}), '()\n', (1097, 1099), True, 'import _flowunit as modelbox\n'), ((1138, 1155), '_flowunit.Status', 'modelbox.Status', ([], {}), '()\n...
import typing import numpy as np from scripts.study_case.ID_5.matchzoo.engine.base_callback import BaseCallback def _padding_2D(input, output, mode: str = 'pre'): """ Pad the input 2D-tensor to the output 2D-tensor. :param input: The input 2D-tensor contains the origin values. :param output: The ou...
[ "numpy.full", "numpy.append", "numpy.insert" ]
[((9416, 9457), 'numpy.insert', 'np.insert', (["x['text_left']", '(0)', '(101)'], {'axis': '(1)'}), "(x['text_left'], 0, 101, axis=1)\n", (9425, 9457), True, 'import numpy as np\n'), ((9484, 9526), 'numpy.insert', 'np.insert', (["x['text_right']", '(0)', '(102)'], {'axis': '(1)'}), "(x['text_right'], 0, 102, axis=1)\n"...
import numpy as np import tensorflow as tf from parameters import * import sys, os import pickle from itertools import product import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt if len(sys.argv) > 1: GPU_ID = sys.argv[1] os.environ['CUDA_VISIBLE_DEVICES'] = GPU_ID else: GPU_ID = None ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.clf", "matplotlib.pyplot.suptitle", "tensorflow.reset_default_graph", "stimulus.MultiStimulus", "tensorflow.ConfigProto", "numpy.mean", "numpy.arange", "tensorflow.GPUOptions", "matplotlib.pyplot.close", "sklearn.cluster.KMeans", "matplotlib.pyplot...
[((145, 166), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (159, 166), False, 'import matplotlib\n'), ((941, 965), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (963, 965), True, 'import tensorflow as tf\n'), ((1000, 1035), 'model.get_supervised_placeholders', 'm...
from pathlib import Path import numpy as np import pandas as pd from random import randint from numpy import array from numpy import argmax from math import sin, cos, sqrt, atan2, radians #from geopy import distance import matplotlib.pyplot as plt import os import h5py import pickle from PIL import Image f...
[ "numpy.random.seed", "numpy.nan_to_num", "numpy.argmax", "pandas.read_csv", "numpy.ones", "numpy.isnan", "pathlib.Path", "pickle.load", "numpy.full", "numpy.transpose", "PythonCode.KF.ENUtransform.WGS84toENU", "matplotlib.pyplot.rcParams.update", "matplotlib.pyplot.pause", "matplotlib.pypl...
[((1232, 1250), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (1246, 1250), True, 'import numpy as np\n'), ((1263, 1354), 'pathlib.Path', 'Path', (['"""/home/sing_sd/Desktop/anomaly_detection/PythonCode/Trajectory_Prediction/"""'], {}), "(\n '/home/sing_sd/Desktop/anomaly_detection/PythonCode/Traj...
# -*- coding: utf-8 -*- """ Created on Sat Nov 6 01:48:13 2021 @author: tumur """ #TASK 1: Matplotlib import pandas as pd import matplotlib.pyplot as plt import numpy as np gdp =pd.read_csv('data.csv', header =0) print(gdp) # Line graph plt.plot(gdp.Year, gdp.Australia, label='Australia') plt.pl...
[ "matplotlib.pyplot.title", "numpy.sum", "pandas.read_csv", "matplotlib.pyplot.figure", "matplotlib.pyplot.style.use", "pygal.maps.world.SupranationalWorld", "matplotlib.pyplot.setp", "matplotlib.pyplot.subplots", "matplotlib.pyplot.stackplot", "pygal.style.Style", "matplotlib.pyplot.legend", "...
[((196, 229), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {'header': '(0)'}), "('data.csv', header=0)\n", (207, 229), True, 'import pandas as pd\n'), ((260, 312), 'matplotlib.pyplot.plot', 'plt.plot', (['gdp.Year', 'gdp.Australia'], {'label': '"""Australia"""'}), "(gdp.Year, gdp.Australia, label='Australia')...