code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from djitellopy import tello import keypress as kp from time import sleep import numpy as np import cv2 import math #####Parameters##### fSpeed = 117/10 #Forward Speed in cm/s (15cm/s) aSpeed = 360/10 #Angular Speed Degree/s (50d/s) interval = 0.25 dInterval = fSpeed*interval aInterval = aSpeed*int...
[ "cv2.circle", "cv2.putText", "keypress.init", "cv2.waitKey", "math.radians", "keypress.getKey", "numpy.zeros", "time.sleep", "cv2.imshow", "djitellopy.tello.Tello" ]
[((386, 395), 'keypress.init', 'kp.init', ([], {}), '()\n', (393, 395), True, 'import keypress as kp\n'), ((400, 413), 'djitellopy.tello.Tello', 'tello.Tello', ([], {}), '()\n', (411, 413), False, 'from djitellopy import tello\n'), ((622, 639), 'keypress.getKey', 'kp.getKey', (['"""LEFT"""'], {}), "('LEFT')\n", (631, 6...
import numpy as np from collections import defaultdict as dd from scipy import sparse as sp import cnn_rnn import sample LABEL_INDEX = ['PRP$', 'VBG', 'VBD', '``', 'VBN', 'POS', "''", 'VBP', 'WDT', 'JJ',\ 'WP', 'VBZ', 'DT', '#', 'RP', '$', 'NN', 'FW', ',', '.', 'TO', 'PRP', 'RB', '-LRB-',\ ':', 'NNS', 'NNP', 'VB',...
[ "numpy.argmax", "numpy.zeros", "sample.create_sample_index", "numpy.array", "sample.sample_arrays", "numpy.vstack" ]
[((2319, 2366), 'numpy.zeros', 'np.zeros', (['(line_cnt, MAX_LEN)'], {'dtype': 'np.float32'}), '((line_cnt, MAX_LEN), dtype=np.float32)\n', (2327, 2366), True, 'import numpy as np\n'), ((2962, 3021), 'numpy.zeros', 'np.zeros', (['(line_cnt, MAX_LEN, MAX_CHAR_LEN)'], {'dtype': 'np.int32'}), '((line_cnt, MAX_LEN, MAX_CHA...
# -*- coding: utf-8 -*- import numpy as np from scipy.special import comb from mcse.libmpi.base import _NaiveParallel from mpi4py import MPI class DupCheck(_NaiveParallel): """ High performance implementation of duplicate check for a dictionary of Structures. While some parts of the implementation...
[ "numpy.hstack" ]
[((1490, 1525), 'numpy.hstack', 'np.hstack', (['[I[:, None], J[:, None]]'], {}), '([I[:, None], J[:, None]])\n', (1499, 1525), True, 'import numpy as np\n')]
#!/usr/bin/env python # Filename: siamese_thawslump_cd """ introduction: conduct change detection using siamese neural network authors: <NAME> email:<EMAIL> add time: 05 November, 2019 """ import sys,os from optparse import OptionParser import torch from torch import nn import torch.nn.functional as F from torchvis...
[ "os.mkdir", "dataTools.img_pairs.save_image_oneband_8bit", "optparse.OptionParser", "torch.argmax", "os.path.isfile", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "basic_src.RSImageProcess.mosaics_images", "os.path.expanduser", "os.path.dirname", "torch.load", "torch....
[((460, 488), 'os.path.dirname', 'os.path.dirname', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (475, 488), False, 'import sys, os\n'), ((504, 534), 'os.path.dirname', 'os.path.dirname', (['script_folder'], {}), '(script_folder)\n', (519, 534), False, 'import sys, os\n'), ((535, 567), 'sys.path.insert', 'sys.path.insert'...
import time from utils import deserialize, serialize, print_percentage, hms_string, get_clean_tokens import numpy as np def error(pi, pre_pi): c = 0 for el1, el2 in zip(pi, pre_pi): c += abs(el2 - el1) return c def create_pagerank(C, L, I, k=1): """ :param n: Matrix length :param k:...
[ "math.sqrt", "utils.hms_string", "utils.deserialize", "utils.print_percentage", "time.time", "numpy.arange", "utils.get_clean_tokens" ]
[((414, 425), 'time.time', 'time.time', ([], {}), '()\n', (423, 425), False, 'import time\n'), ((2696, 2711), 'math.sqrt', 'math.sqrt', (['norm'], {}), '(norm)\n', (2705, 2711), False, 'import math\n'), ((2971, 3013), 'utils.deserialize', 'deserialize', (['"""../data/pagerank.serialized"""'], {}), "('../data/pagerank.s...
from pygco import cut_from_graph import numpy as np import sys class DiscreteEnergyMinimize: def __init__(self, nlabel, lamb, value1=100, value2=10000, niter = 10): ''' Args: nlabel - int lamb - float should be positive value1 - int ...
[ "numpy.eye", "numpy.zeros", "numpy.iinfo", "pygco.cut_from_graph" ]
[((1442, 1481), 'numpy.zeros', 'np.zeros', (['[nedges, 3]'], {'dtype': 'np.float32'}), '([nedges, 3], dtype=np.float32)\n', (1450, 1481), True, 'import numpy as np\n'), ((1756, 1806), 'numpy.zeros', 'np.zeros', (['[nvertex, self.nlabel]'], {'dtype': 'np.float32'}), '([nvertex, self.nlabel], dtype=np.float32)\n', (1764,...
#! /usr/bin/env python import os import sys import itertools import numpy as np import numpy.linalg as linalg IN = [os.path.join(sys.argv[1], x[:-1] + '.txt') for x in open(sys.argv[2])] skipComments = lambda path: itertools.ifilter(lambda x: not x.startswith('#'), open(path)) ks = [None]*len(list(skipComments(IN[0]...
[ "numpy.abs", "numpy.savetxt", "numpy.clip", "numpy.linalg.norm", "numpy.sign", "numpy.dot", "os.path.join" ]
[((671, 726), 'numpy.savetxt', 'np.savetxt', (['sys.stdout', 'res'], {'fmt': '"""%.6f"""', 'delimiter': '"""\t"""'}), "(sys.stdout, res, fmt='%.6f', delimiter='\\t')\n", (681, 726), True, 'import numpy as np\n'), ((118, 160), 'os.path.join', 'os.path.join', (['sys.argv[1]', "(x[:-1] + '.txt')"], {}), "(sys.argv[1], x[:...
''' Determine the shift between two spectra ''' import math import numpy as np def find_row_of_max(A): max_value = -math.inf max_row = -1 for row, value in enumerate(A[:,-1]): if value > max_value: max_value = value max_row = row return max_row def ev_energy(A, row): ...
[ "numpy.loadtxt" ]
[((619, 636), 'numpy.loadtxt', 'np.loadtxt', (['file1'], {}), '(file1)\n', (629, 636), True, 'import numpy as np\n'), ((649, 666), 'numpy.loadtxt', 'np.loadtxt', (['file2'], {}), '(file2)\n', (659, 666), True, 'import numpy as np\n')]
import torch from torch import nn import numpy as np from collections import defaultdict import polyscope as ps def to_numpy_cpu(a): if isinstance(a, torch.Tensor): return a.detach().cpu().numpy() elif isinstance(a, np.ndarray): return a else: raise ValueError("Requiring Numpy or to...
[ "numpy.arange", "torch.arange", "numpy.sqrt", "pcdet.utils.box_utils.boxes_to_corners_3d", "numpy.meshgrid", "numpy.random.randn", "polyscope.register_point_cloud", "polyscope.get_point_cloud", "polyscope.register_surface_mesh", "torch.zeros", "numpy.repeat", "numpy.stack", "polyscope.show",...
[((1572, 1593), 'polyscope.set_up_dir', 'ps.set_up_dir', (['"""z_up"""'], {}), "('z_up')\n", (1585, 1593), True, 'import polyscope as ps\n'), ((1602, 1611), 'polyscope.init', 'ps.init', ([], {}), '()\n', (1609, 1611), True, 'import polyscope as ps\n'), ((10728, 10754), 'polyscope.remove_all_structures', 'ps.remove_all_...
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import argparse import IPython as ipy def main(raw_args=None): # Parse arguments parser = argparse.ArgumentParser() parser.add_argument("--problem", type=str, default="lava_problem", help="choose problem: lava_problem or two_lavas_prob...
[ "numpy.load", "matplotlib.pyplot.show", "argparse.ArgumentParser", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.subplots" ]
[((174, 199), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (197, 199), False, 'import argparse\n'), ((434, 467), 'numpy.load', 'np.load', (["(problem + '_results.npz')"], {}), "(problem + '_results.npz')\n", (441, 467), True, 'import numpy as np\n'), ((586, 600), 'matplotlib.pyplot.subplots',...
# -*- coding: utf-8 -*- """ Created on Tue Jul 4 22:39:40 2017 @author: 74297 """ import numpy as np import os from subprocess import Popen, PIPE, STDOUT from numba import jit from io import BytesIO aadic={ 'A':1, 'B':0, 'C':2, 'D':3, 'E':4, 'F':5, 'G'...
[ "numpy.zeros" ]
[((1142, 1169), 'numpy.zeros', 'np.zeros', (['[n, d]'], {'dtype': 'int'}), '([n, d], dtype=int)\n', (1150, 1169), True, 'import numpy as np\n'), ((1433, 1457), 'numpy.zeros', 'np.zeros', (['(ALPHA, ALPHA)'], {}), '((ALPHA, ALPHA))\n', (1441, 1457), True, 'import numpy as np\n'), ((1464, 1484), 'numpy.zeros', 'np.zeros'...
""" Once a model is learned, use this to play it. It is running a policy to get its the feature expectations. """ from simulation import carmunk import numpy as np from neuralNets import net1 import sys import time import timeit import random NUM_FEATURES = 46 # number of features NUM_ACTIONS = 25 # number of action...
[ "numpy.average", "numpy.argmax", "random.uniform", "timeit.default_timer", "numpy.std", "neuralNets.net1", "numpy.zeros", "numpy.min", "numpy.max", "numpy.array", "simulation.carmunk.GameState" ]
[((717, 776), 'simulation.carmunk.GameState', 'carmunk.GameState', (['weights'], {'scene_file_name': 'scene_file_name'}), '(weights, scene_file_name=scene_file_name)\n', (734, 776), False, 'from simulation import carmunk\n'), ((848, 870), 'numpy.zeros', 'np.zeros', (['NUM_FEATURES'], {}), '(NUM_FEATURES)\n', (856, 870)...
########################################################################## # # Functions for calculating signals from share-prices and financial data. # ########################################################################## # SimFin - Simple financial data for Python. # www.simfin.com - www.github.com/simfin/simfin...
[ "pandas.DataFrame", "simfin.derived.shares", "numpy.log", "simfin.utils.apply", "simfin.derived.netnet", "numpy.log10", "simfin.derived.ncav", "simfin.utils.add_date_offset", "pandas.concat", "simfin.resample.reindex", "simfin.derived.free_cash_flow", "simfin.rel_change.rel_change" ]
[((3210, 3269), 'simfin.utils.apply', 'apply', ([], {'df': 'df_prices', 'func': '_signals', 'group_index': 'group_index'}), '(df=df_prices, func=_signals, group_index=group_index)\n', (3215, 3269), False, 'from simfin.utils import apply, add_date_offset\n'), ((5845, 5897), 'simfin.utils.apply', 'apply', ([], {'df': 'df...
from aicspylibczi import CziFile from aicsimageio import AICSImage, imread, imread_dask from czifiletools import czifile_tools as czt #import tools.fileutils as czt from czifiletools import napari_tools as nap import numpy as np import zarr import dask import dask.array as da from dask import delayed from itertools imp...
[ "czifiletools.czifile_tools.read_czi_scene", "czifiletools.napari_tools.show_napari", "dask.delayed", "numpy.empty", "dask.array.stack", "czifiletools.czifile_tools.CZIScene", "czifiletools.czifile_tools.get_shape_allscenes", "napari.Viewer", "czifiletools.czifile_tools.get_metadata_czi", "aicspyl...
[((1226, 1256), 'czifiletools.czifile_tools.get_metadata_czi', 'czt.get_metadata_czi', (['filename'], {}), '(filename)\n', (1246, 1256), True, 'from czifiletools import czifile_tools as czt\n'), ((1339, 1356), 'aicspylibczi.CziFile', 'CziFile', (['filename'], {}), '(filename)\n', (1346, 1356), False, 'from aicspylibczi...
from functools import reduce import torch from tqdm import tqdm import numpy as np from sklearn.metrics import f1_score, precision_score, recall_score def run_valid(model, loader, device): model.eval() valid_loss = 0 all_valid_preds = [] for data in tqdm(loader): text, targets = data ...
[ "functools.reduce", "tqdm.tqdm", "torch.no_grad", "numpy.concatenate" ]
[((269, 281), 'tqdm.tqdm', 'tqdm', (['loader'], {}), '(loader)\n', (273, 281), False, 'from tqdm import tqdm\n'), ((1068, 1101), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'preds'], {}), '(lambda x, y: x + y, preds)\n', (1074, 1101), False, 'from functools import reduce\n'), ((994, 1021), 'numpy.concatenat...
# Test frovedis niters and sklearn niters import sys import numpy as np from frovedis.exrpc.server import FrovedisServer from frovedis.matrix.dense import FrovedisRowmajorMatrix from frovedis.mllib.gmm import GaussianMixture import sklearn.mixture as sk # initializing the Frovedis server argvs = sys.argv argc = len(a...
[ "frovedis.exrpc.server.FrovedisServer.initialize", "sklearn.mixture.GaussianMixture", "frovedis.mllib.gmm.GaussianMixture", "numpy.loadtxt", "sys.exit" ]
[((497, 532), 'frovedis.exrpc.server.FrovedisServer.initialize', 'FrovedisServer.initialize', (['argvs[1]'], {}), '(argvs[1])\n', (522, 532), False, 'from frovedis.exrpc.server import FrovedisServer\n'), ((546, 580), 'numpy.loadtxt', 'np.loadtxt', (['"""./input/gmm_data.txt"""'], {}), "('./input/gmm_data.txt')\n", (556...
""" DANN """ import numpy as np import tensorflow as tf from adapt.base import BaseAdaptDeep, make_insert_doc from adapt.utils import check_network EPS = np.finfo(np.float32).eps # class SetEncoder(tf.keras.callbacks.Callback): # def __init__(self): # self.pretrain = True # def on_epoch_e...
[ "tensorflow.math.log", "numpy.zeros", "tensorflow.reduce_mean", "tensorflow.zeros_like", "adapt.base.make_insert_doc", "tensorflow.ones_like", "numpy.finfo", "tensorflow.shape", "adapt.utils.check_network", "tensorflow.GradientTape" ]
[((563, 616), 'adapt.base.make_insert_doc', 'make_insert_doc', (["['encoder', 'task', 'discriminator']"], {}), "(['encoder', 'task', 'discriminator'])\n", (578, 616), False, 'from adapt.base import BaseAdaptDeep, make_insert_doc\n'), ((157, 177), 'numpy.finfo', 'np.finfo', (['np.float32'], {}), '(np.float32)\n', (165, ...
import numpy as np import networkx as nx from itertools import combinations # TSP functions def rearrangeTour(route, start, end): if start is not None: if end is not None: end_val = route[end] route = route[start:] + route[0:start] if end is not None: end_idx = route.index...
[ "numpy.sum", "numpy.argmin", "numpy.hstack", "numpy.shape", "numpy.where", "numpy.array", "networkx.Graph" ]
[((1083, 1093), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1091, 1093), True, 'import networkx as nx\n'), ((4634, 4644), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (4642, 4644), True, 'import networkx as nx\n'), ((4898, 4920), 'numpy.array', 'np.array', (['([[0, 0]] * N)'], {}), '([[0, 0]] * N)\n', (4906, 49...
#!/usr/bin/env python """plotlib.py: Plots generators.""" __author__ = "<NAME>." __copyright__ = "Copyright 2021, SuperDARN@VT" __credits__ = [] __license__ = "MIT" __version__ = "1.0." __maintainer__ = "<NAME>." __email__ = "<EMAIL>" __status__ = "Research" import matplotlib matplotlib.use("Agg") import cartopy imp...
[ "os.remove", "pandas.read_csv", "cartopy.crs.NearsidePerspective", "numpy.ones", "matplotlib.pyplot.style.use", "matplotlib.pyplot.figure", "fetch_data.Simulation", "numpy.arange", "utils.read_riometer", "sys.path.append", "netCDF4.Dataset", "fetch_data.Riometer", "matplotlib.dates.DateForma...
[((280, 301), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (294, 301), False, 'import matplotlib\n'), ((376, 407), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-bright"""'], {}), "('seaborn-bright')\n", (389, 407), True, 'import matplotlib.pyplot as plt\n'), ((614, 640), 'sys.pa...
import dash from dash.dependencies import Input, Output, State, ClientsideFunction import dash_html_components as html import dash_core_components as dcc import plotly.graph_objects as go from skimage import data, img_as_ubyte, segmentation, measure from dash_canvas.utils import array_to_data_url import plotly.graph_ob...
[ "numpy.load", "shape_utils.shapes_to_mask", "numpy.moveaxis", "plot_common.add_layout_images_to_fig", "numpy.arange", "skimage.segmentation.find_boundaries", "numpy.zeros_like", "dash.Dash", "dash_html_components.Div", "skimage.segmentation.relabel_sequential", "numpy.logical_not", "dash.depen...
[((1315, 1360), 'os.environ.get', 'os.environ.get', (['"""SAVE_SUPERPIXEL"""'], {'default': '""""""'}), "('SAVE_SUPERPIXEL', default='')\n", (1329, 1360), False, 'import os\n'), ((1444, 1489), 'os.environ.get', 'os.environ.get', (['"""LOAD_SUPERPIXEL"""'], {'default': '""""""'}), "('LOAD_SUPERPIXEL', default='')\n", (1...
from typing import Dict, Optional, Any, List, Set, Union from causaldag import DAG import itertools as itr from causaldag.utils.ci_tests import CI_Tester from causaldag.utils.invariance_tests import InvarianceTester from causaldag.utils.core_utils import powerset import random from causaldag.structure_learning.undirect...
[ "causaldag.rand.directed_erdos", "random.shuffle", "itertools.permutations", "numpy.ix_", "random.choice", "causaldag.utils.core_utils.powerset", "itertools.combinations", "numpy.where", "causaldag.structure_learning.undirected.threshold_ug", "itertools.product", "causaldag.utils.ci_tests.ci_tes...
[((34523, 34553), 'causaldag.rand.directed_erdos', 'cd.rand.directed_erdos', (['p', '(0.2)'], {}), '(p, 0.2)\n', (34545, 34553), True, 'import causaldag as cd\n'), ((34569, 34600), 'causaldag.utils.ci_tests.ci_tester.MemoizedCI_Tester', 'MemoizedCI_Tester', (['dsep_test', 'd'], {}), '(dsep_test, d)\n', (34586, 34600), ...
import numpy as np def _fix_time_units(da): modified = False if np.issubdtype(da.dtype, np.datetime64): # already converted since xarray has managed to parse the time in # CF-format pass elif da.attrs["units"].startswith("seconds since 2000-01-01"): # I fixed UCLALES to CF ...
[ "numpy.issubdtype" ]
[((74, 112), 'numpy.issubdtype', 'np.issubdtype', (['da.dtype', 'np.datetime64'], {}), '(da.dtype, np.datetime64)\n', (87, 112), True, 'import numpy as np\n')]
#!/usr/bin/env python # coding: utf-8 """ generate individual reports for data prepared using narps.py """ import os import glob import warnings import matplotlib.pyplot as plt import numpy import nilearn.input_data from narps import Narps, hypnums from utils import get_masked_data cut_coords = [-24, -10, 4, 18, 32,...
[ "os.mkdir", "matplotlib.pyplot.tight_layout", "numpy.sum", "warnings.simplefilter", "os.path.basename", "matplotlib.pyplot.close", "utils.get_masked_data", "os.path.exists", "narps.Narps", "warnings.catch_warnings", "numpy.linspace", "os.path.join", "matplotlib.pyplot.savefig" ]
[((336, 357), 'numpy.linspace', 'numpy.linspace', (['(-5)', '(5)'], {}), '(-5, 5)\n', (350, 357), False, 'import numpy\n'), ((603, 664), 'os.path.join', 'os.path.join', (["narps.dirs.dirs['figures']", '"""orig_map_overlays"""'], {}), "(narps.dirs.dirs['figures'], 'orig_map_overlays')\n", (615, 664), False, 'import os\n...
from styx_msgs.msg import TrafficLight import rospy import os import numpy as np import tensorflow as tf from attrdict import AttrDict import time LIGHT_ID_TO_NAME = AttrDict({2: "Red", 3:"Yellow", 1:"Green", 4:"Unknown"}) class TLClassifier(objec...
[ "os.path.realpath", "tensorflow.Session", "numpy.expand_dims", "time.time", "tensorflow.ConfigProto", "tensorflow.gfile.GFile", "tensorflow.Graph", "numpy.squeeze", "tensorflow.import_graph_def", "tensorflow.GraphDef", "attrdict.AttrDict", "os.path.join" ]
[((174, 241), 'attrdict.AttrDict', 'AttrDict', (["{(2): 'Red', (3): 'Yellow', (1): 'Green', (4): 'Unknown'}"], {}), "({(2): 'Red', (3): 'Yellow', (1): 'Green', (4): 'Unknown'})\n", (182, 241), False, 'from attrdict import AttrDict\n'), ((592, 626), 'os.path.join', 'os.path.join', (['curr_dir', 'model_name'], {}), '(cur...
import warnings from numpy import all as npall, ascontiguousarray, clip, isfinite def check_economic_qs(QS): if not isinstance(QS, tuple): raise ValueError("QS must be a tuple.") if not isinstance(QS[0], tuple): raise ValueError("QS[0] must be a tuple.") fmsg = "QS has non-finite values...
[ "numpy.ascontiguousarray", "numpy.isfinite", "numpy.clip" ]
[((990, 1017), 'numpy.ascontiguousarray', 'ascontiguousarray', (['y', 'float'], {}), '(y, float)\n', (1007, 1017), False, 'from numpy import all as npall, ascontiguousarray, clip, isfinite\n'), ((1786, 1809), 'numpy.clip', 'clip', (['y', '(0)', 'poisson_lim'], {}), '(y, 0, poisson_lim)\n', (1790, 1809), False, 'from nu...
import numpy as np import pandas as pd import plotly.graph_objects as go import dash from dash.dependencies import Input, Output from dash import dcc from dash import html from dash.dependencies import Input, Output, State import dash_table from dash_table.Format import Format, Scheme # SolCalc from helicalc import he...
[ "numpy.isin", "helicalc.geometry.read_solenoid_geom_combined", "plotly.graph_objects.Surface", "dash.dcc.Graph", "dash.dcc.RadioItems", "pandas.DataFrame", "dash.Dash", "dash_table.Format.Format", "dash.html.Div", "dash.html.Button", "dash.dependencies.State", "dash.dcc.Dropdown", "pandas.co...
[((860, 883), 'numpy.array', 'np.array', (['[0.005, 0.01]'], {}), '([0.005, 0.01])\n', (868, 883), True, 'import numpy as np\n'), ((1441, 1467), 'pandas.read_pickle', 'pd.read_pickle', (['PSoff_file'], {}), '(PSoff_file)\n', (1455, 1467), True, 'import pandas as pd\n'), ((2012, 2080), 'dash.Dash', 'dash.Dash', ([], {'n...
from collections import defaultdict import json import os from tqdm import tqdm import numpy as np import torch from torch.utils.data import Dataset from torch.nn.utils.rnn import pad_sequence from utils.logger import LOGGER from utils.const import PAD_TOKEN from pdb import set_trace as bp class VizWizDataset(Data...
[ "torch.ones", "numpy.load", "json.load", "numpy.ones_like", "torch.stack", "torch.LongTensor", "torch.FloatTensor", "torch.cat", "torch.zeros", "os.path.join" ]
[((3151, 3195), 'torch.cat', 'torch.cat', (['[attn_masks, attn_padding]'], {'dim': '(1)'}), '([attn_masks, attn_padding], dim=1)\n', (3160, 3195), False, 'import torch\n'), ((4141, 4170), 'torch.LongTensor', 'torch.LongTensor', (['answerables'], {}), '(answerables)\n', (4157, 4170), False, 'import torch\n'), ((4191, 42...
#!/usr/bin/env python import numpy as np import de421 from time import time from jplephem import Ephemeris from jplephem.spk import SPK def main(): for size in 10, 1000, 100000: jd = np.linspace(2414992.5, 2471184.50, size) kernel = SPK.open('de421.bsp') ephem = Ephemeris(de421) ma...
[ "jplephem.spk.SPK.open", "jplephem.Ephemeris", "numpy.linspace", "time.time" ]
[((197, 236), 'numpy.linspace', 'np.linspace', (['(2414992.5)', '(2471184.5)', 'size'], {}), '(2414992.5, 2471184.5, size)\n', (208, 236), True, 'import numpy as np\n'), ((255, 276), 'jplephem.spk.SPK.open', 'SPK.open', (['"""de421.bsp"""'], {}), "('de421.bsp')\n", (263, 276), False, 'from jplephem.spk import SPK\n'), ...
import os import sys import numpy as np import glob def get_parent_dir(n=1): """returns the n-th parent dicrectory of the current working directory""" current_path = os.path.dirname(os.path.abspath(__file__)) for k in range(n): current_path = os.path.dirname(current_path) return cu...
[ "sys.path.append", "os.path.abspath", "os.path.join", "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "utils.detect_frame", "timeit.default_timer", "os.path.dirname", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "numpy.random.random", "PIL.Image.fromarray", "cv2.destroyAllWindows"...
[((458, 483), 'sys.path.append', 'sys.path.append', (['src_path'], {}), '(src_path)\n', (473, 483), False, 'import sys\n'), ((485, 512), 'sys.path.append', 'sys.path.append', (['utils_path'], {}), '(utils_path)\n', (500, 512), False, 'import sys\n'), ((1010, 1052), 'os.path.join', 'os.path.join', (['data_folder', '"""M...
import sys, os import scipy import math import numpy as np from scipy import integrate from scipy import optimize as opt from scipy.stats import gamma from cell import Cell class Simulator: def __init__(self, ncells, gr, sb, steps, CV2div = 0, CV2gr = 0, lamb=1, V0array=None, sample_time = 0): self.chec...
[ "numpy.sum", "numpy.floor", "numpy.random.gamma", "numpy.exp", "numpy.zeros_like", "scipy.stats.gamma.ppf", "numpy.int", "math.trunc", "cell.Cell", "numpy.trapz", "scipy.stats.gamma.pdf", "scipy.stats.gamma.cdf", "scipy.integrate.quad", "numpy.random.beta", "numpy.log", "numpy.zeros", ...
[((3174, 3207), 'scipy.optimize.bisect', 'opt.bisect', (['self.opti', '(0.001)', '(1.5)'], {}), '(self.opti, 0.001, 1.5)\n', (3184, 3207), True, 'from scipy import optimize as opt\n'), ((6074, 6086), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (6082, 6086), True, 'import numpy as np\n'), ((7971, 7987), 'numpy.ze...
#!/usr/bin/env python # -*- coding=utf-8 -*- import cv2 as cv import numpy as np """ 模板匹配: 模板匹配被称为最简单的模式识别方式,模板匹配的工作条件严苛,因为其并不是基于特征的匹配,需要光照、背景、干扰一致 的情况下才能更好的工作,在工业、屏幕内容识别上运用广泛。 cv.matchTemplate(image, templ, result, method, mask) - image : 输入进行匹配的图像 -...
[ "cv2.waitKey", "cv2.destroyAllWindows", "cv2.imread", "numpy.where", "cv2.rectangle", "cv2.imshow", "cv2.matchTemplate" ]
[((895, 948), 'cv2.matchTemplate', 'cv.matchTemplate', (['image', 'template', 'cv.TM_CCORR_NORMED'], {}), '(image, template, cv.TM_CCORR_NORMED)\n', (911, 948), True, 'import cv2 as cv\n'), ((954, 981), 'cv2.imshow', 'cv.imshow', (['"""result"""', 'result'], {}), "('result', result)\n", (963, 981), True, 'import cv2 as...
import os import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg from tensorflow import keras from keras.preprocessing.image import ImageDataGenerator from tensorflow.keras import layers from tensorflow.keras import Model from keras.optimizers import Adam from keras.models impo...
[ "keras.models.load_model", "keras.preprocessing.image.ImageDataGenerator", "cv2.putText", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "cv2.rectangle", "numpy.reshape", "cv2.CascadeClassifier", "cv2.destroyAllWindows", "os.path.join", "cv2.resize" ]
[((343, 365), 'keras.models.load_model', 'load_model', (['"""model.h5"""'], {}), "('model.h5')\n", (353, 365), False, 'from keras.models import load_model\n'), ((380, 440), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_default.xml"""'], {}), "('haarcascade_frontalface_default.xml')\n",...
import typing import matplotlib.pyplot as plt import numpy as np import pandas as pd from pyextremes.plotting.style import pyextremes_rc def plot_extremes( ts: pd.Series, extremes: pd.Series, extremes_method: str, extremes_type: typing.Optional[str] = None, block_size: typing.Optional[typing.Uni...
[ "numpy.diff", "matplotlib.pyplot.subplots", "matplotlib.pyplot.rc_context", "pandas.to_timedelta" ]
[((1983, 2015), 'matplotlib.pyplot.rc_context', 'plt.rc_context', ([], {'rc': 'pyextremes_rc'}), '(rc=pyextremes_rc)\n', (1997, 2015), True, 'import matplotlib.pyplot as plt\n'), ((2086, 2123), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize', 'dpi': '(96)'}), '(figsize=figsize, dpi=96)\n', (209...
#============================================================================= # PREDICTING THE PRICE OF PREOWNED CARS #============================================================================= import pandas as pd import numpy as np import seaborn as sns # IMPORTING OS import os os.chdir("C:\\Users\\indra\\Docume...
[ "pandas.crosstab", "numpy.log", "pandas.read_csv", "pandas.get_dummies", "sklearn.model_selection.train_test_split", "seaborn.regplot", "sklearn.linear_model.LinearRegression", "seaborn.boxplot", "seaborn.distplot", "seaborn.countplot", "pandas.set_option", "os.chdir" ]
[((286, 358), 'os.chdir', 'os.chdir', (['"""C:\\\\Users\\\\indra\\\\Documents\\\\DataScience_ML\\\\github_linkedin"""'], {}), "('C:\\\\Users\\\\indra\\\\Documents\\\\DataScience_ML\\\\github_linkedin')\n", (294, 358), False, 'import os\n'), ((376, 407), 'pandas.read_csv', 'pd.read_csv', (['"""cars_sampled.csv"""'], {})...
import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) def tanh(x): return np.tanh(x) def identity(x): return x def sin(x): return np.sin(x) def relu(x): return np.maximum(0, x) def cos(x): return np.cos(x) def gaussian(x): return np.exp(-x**2) def square(x): return x**2...
[ "numpy.maximum", "numpy.tanh", "numpy.sin", "numpy.where", "numpy.exp", "numpy.cos" ]
[((94, 104), 'numpy.tanh', 'np.tanh', (['x'], {}), '(x)\n', (101, 104), True, 'import numpy as np\n'), ((160, 169), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (166, 169), True, 'import numpy as np\n'), ((195, 211), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (205, 211), True, 'import numpy as np\n'...
""" Convert "pre-ARD" to ARD """ from collections import defaultdict import datetime as dt import json import logging import os from pathlib import Path import numpy as np import pandas as pd import xarray as xr from stems.gis import convert, georeference, grids from stems.io.encoding import netcdf_encoding from . i...
[ "stems.gis.georeference", "os.path.commonprefix", "json.load", "datetime.datetime.today", "stems.gis.grids.Tile.from_dict", "stems.io.encoding.netcdf_encoding", "xarray.open_rasterio", "json.dumps", "xarray.Dataset", "collections.defaultdict", "xarray.concat", "pathlib.Path", "numpy.arange",...
[((358, 385), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (375, 385), False, 'import logging\n'), ((2319, 2357), 'stems.gis.grids.Tile.from_dict', 'grids.Tile.from_dict', (["metadata['tile']"], {}), "(metadata['tile'])\n", (2339, 2357), False, 'from stems.gis import convert, georeferen...
from nltk.tokenize import word_tokenize from Categories_Data import categories import numpy as np import codecs import glob import os import re class Data_Preprocessor: """ This class contains utility methods in order to process the 20 NewsGroup DataSet """ """ Takes the following parameters as an in...
[ "os.listdir", "codecs.open", "os.getcwd", "re.sub", "numpy.array", "glob.glob", "os.path.join", "os.chdir", "nltk.tokenize.word_tokenize", "re.compile" ]
[((544, 563), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['text'], {}), '(text)\n', (557, 563), False, 'from nltk.tokenize import word_tokenize\n'), ((1730, 1820), 're.compile', 're.compile', (['"""(writes in|writes:|wrote:|says:|said:|^In article|^Quoted from|^\\\\||^>)"""'], {}), "(\n '(writes in|writes:|wro...
__author__ = 'me' import cv2 import math import random import numpy as np def create_star_background(image,density): h,w = image.shape[:2] base_color = 20 for i in range(0,h,4): for j in range(0,w,4): rand = random.random() if rand < density: intensity = np....
[ "cv2.circle", "cv2.minEnclosingCircle", "random.random", "random.randrange", "numpy.random.normal", "math.log" ]
[((583, 614), 'cv2.minEnclosingCircle', 'cv2.minEnclosingCircle', (['contour'], {}), '(contour)\n', (605, 614), False, 'import cv2\n'), ((678, 703), 'random.randrange', 'random.randrange', (['(-15)', '(15)'], {}), '(-15, 15)\n', (694, 703), False, 'import random\n'), ((715, 740), 'random.randrange', 'random.randrange',...
import numpy as np import pandas as pd from cli import get_args from dataset import STR2ID, DATA_DIR, read_splits from feature_extractor import FeatureExtractor from logger import logger def stats(type): if type == "all": for lang in STR2ID.keys(): data = pd.read_csv(DATA_DIR / "{}.tsv".forma...
[ "dataset.STR2ID.keys", "dataset.read_splits", "feature_extractor.FeatureExtractor", "numpy.mean", "cli.get_args" ]
[((1851, 1861), 'cli.get_args', 'get_args', ([], {}), '()\n', (1859, 1861), False, 'from cli import get_args\n'), ((249, 262), 'dataset.STR2ID.keys', 'STR2ID.keys', ([], {}), '()\n', (260, 262), False, 'from dataset import STR2ID, DATA_DIR, read_splits\n'), ((450, 468), 'feature_extractor.FeatureExtractor', 'FeatureExt...
# -- python -- import cv2,tqdm,copy import numpy as np import unittest import tempfile import sys from einops import rearrange import shutil from pathlib import Path from easydict import EasyDict as edict # -- vision -- from PIL import Image # -- linalg -- import torch as th import numpy as np # -- package helper i...
[ "torch.cuda.synchronize", "numpy.random.seed", "numpy.clip", "faiss.contrib.kn3.run_search", "pathlib.Path", "torch.arange", "torch.ones", "faiss.contrib.testing.load_dataset", "easydict.EasyDict", "torch.zeros", "torch.zeros_like", "torch.randn_like", "numpy.testing.assert_array_equal", "...
[((460, 483), 'pathlib.Path', 'Path', (['"""./output/tests/"""'], {}), "('./output/tests/')\n", (464, 483), False, 'from pathlib import Path\n'), ((539, 564), 'pathlib.Path', 'Path', (['"""./pytests/output/"""'], {}), "('./pytests/output/')\n", (543, 564), False, 'from pathlib import Path\n'), ((682, 720), 'einops.rear...
''' visdom related functions to print the curves ''' import pdb from visdom import Visdom import numpy as np import time # viz = Visdom(server='http://192.168.3.11', port=4212) # aws server port viz = None def visdom_initialize(args): ''' ''' global viz if args.vis_port < 4212 or args.vis_port > 42...
[ "visdom.Visdom", "time.sleep", "numpy.random.randint", "numpy.array", "numpy.column_stack" ]
[((441, 449), 'visdom.Visdom', 'Visdom', ([], {}), '()\n', (447, 449), False, 'from visdom import Visdom\n'), ((474, 551), 'visdom.Visdom', 'Visdom', ([], {'server': 'args.vis_server', 'port': 'args.vis_port', 'use_incoming_socket': '(False)'}), '(server=args.vis_server, port=args.vis_port, use_incoming_socket=False)\n...
from __future__ import division from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals # -*- coding: utf-8 -*- """CustomCNN2.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/17gmD7alNhF...
[ "h5py.File", "numpy.load", "tensorflow.contrib.learn.python.learn.datasets.base.Datasets", "numpy.argmax", "numpy.asarray", "influence.all_CNN_c.All_CNN_C", "numpy.expand_dims", "influence.dataset.DataSet", "scripts.load_mnist.load_small_mnist", "numpy.argsort", "numpy.array", "numpy.reshape",...
[((798, 823), 'seaborn.set', 'sns.set', ([], {'color_codes': '(True)'}), '(color_codes=True)\n', (805, 823), True, 'import seaborn as sns\n'), ((1103, 1135), 'h5py.File', 'h5py.File', (['path_to_matrices', '"""r"""'], {}), "(path_to_matrices, 'r')\n", (1112, 1135), False, 'import h5py\n'), ((1148, 1177), 'numpy.array',...
# Copyright 2008-2018 pydicom authors. See LICENSE file for details. """Utility functions used in the pixel data handlers.""" from sys import byteorder try: import numpy as np HAVE_NP = True except ImportError: HAVE_NP = False def convert_color_space(arr, current, desired): """Convert the image(s) i...
[ "numpy.asarray", "numpy.dtype", "numpy.floor", "numpy.where", "numpy.dot" ]
[((15081, 15192), 'numpy.asarray', 'np.asarray', (['[[+0.299, +0.587, +0.114], [-0.299, -0.587, +0.886], [+0.701, -0.587, -0.114]]'], {'dtype': 'np.float'}), '([[+0.299, +0.587, +0.114], [-0.299, -0.587, +0.886], [+0.701, -\n 0.587, -0.114]], dtype=np.float)\n', (15091, 15192), True, 'import numpy as np\n'), ((15226...
""" Finds all samples matching a specific organism, downloads all antimicrobial metadata from ncbi """ #esearch -db biosample -query SAMN03988375 | efetch -mode xml import pandas as pd import numpy as np import os, sys from Bio import Entrez import xml.etree.ElementTree as ET from concurrent.futures import ProcessPool...
[ "pandas.DataFrame", "Bio.Entrez.esearch", "numpy.load", "xml.etree.ElementTree.fromstring", "Bio.Entrez.read", "Bio.Entrez.efetch", "pandas.read_excel", "itertools.repeat", "multiprocessing.cpu_count" ]
[((984, 1042), 'Bio.Entrez.esearch', 'Entrez.esearch', ([], {'db': '"""biosample"""', 'retmax': '(1000000)', 'term': 'query'}), "(db='biosample', retmax=1000000, term=query)\n", (998, 1042), False, 'from Bio import Entrez\n'), ((1061, 1080), 'Bio.Entrez.read', 'Entrez.read', (['handle'], {}), '(handle)\n', (1072, 1080)...
#!/usr/bin/python2.7 import torch import torch.nn as nn import torch.nn.functional as F from torch import optim import copy import numpy as np import cv2 class MultiStageModel(nn.Module): def __init__(self, num_stages): super(MultiStageModel, self).__init__() # self.stage1 = SingleStageModel(num...
[ "torch.nn.Dropout", "torch.nn.MSELoss", "torch.nn.ReLU", "numpy.sum", "cv2.waitKey", "torch.nn.Conv1d", "torch.nn.Conv2d", "torch.cat", "numpy.expand_dims", "cv2.imshow", "numpy.shape", "torch.max", "torch.nn.functional.relu", "torch.nn.MaxPool2d", "torch.tensor", "torch.no_grad", "c...
[((669, 689), 'torch.nn.Conv2d', 'nn.Conv2d', (['(44)', '(22)', '(1)'], {}), '(44, 22, 1)\n', (678, 689), True, 'import torch.nn as nn\n'), ((817, 860), 'torch.nn.Conv2d', 'nn.Conv2d', (['(44)', '(22)'], {'kernel_size': '(1)', 'padding': '(0)'}), '(44, 22, kernel_size=1, padding=0)\n', (826, 860), True, 'import torch.n...
# Copyright 2021 Toyota Research Institute. All rights reserved. import numpy as np from camviz.objects.object import Object from camviz.utils.geometry import transpose, invert from camviz.utils.types import is_list, is_float from camviz.utils.utils import numpyf, add_row0, add_col1, image_grid def camviz_camera(c...
[ "camviz.utils.types.is_list", "camviz.utils.utils.image_grid", "camviz.utils.types.is_float", "camviz.utils.geometry.invert", "camviz.utils.utils.numpyf", "numpy.linalg.inv", "camviz.utils.utils.add_col1" ]
[((647, 662), 'camviz.utils.types.is_list', 'is_list', (['camera'], {}), '(camera)\n', (654, 662), False, 'from camviz.utils.types import is_list, is_float\n'), ((1396, 1417), 'numpy.linalg.inv', 'np.linalg.inv', (['self.K'], {}), '(self.K)\n', (1409, 1417), True, 'import numpy as np\n'), ((1632, 1708), 'camviz.utils.u...
from pymongo import MongoClient import numpy as np from scipy import linalg import datetime import json offset=1 hashtag_number=21 timeinterval_number=10 interval_day=1 duration_in_days=60 end_time=datetime.datetime(2016, 5, 1, 0) co_occurrence_matrix=np.zeros((hashtag_number,hashtag_number)) client=MongoClient('192....
[ "pymongo.MongoClient", "json.dump", "numpy.zeros", "datetime.datetime", "datetime.timedelta" ]
[((199, 231), 'datetime.datetime', 'datetime.datetime', (['(2016)', '(5)', '(1)', '(0)'], {}), '(2016, 5, 1, 0)\n', (216, 231), False, 'import datetime\n'), ((253, 295), 'numpy.zeros', 'np.zeros', (['(hashtag_number, hashtag_number)'], {}), '((hashtag_number, hashtag_number))\n', (261, 295), True, 'import numpy as np\n...
"""Nested-cv to evaluate models and learn who'll survive the Titanic.""" from sklearn.pipeline import Pipeline from pandas import read_csv # from pandas.plotting import scatter_matrix import matplotlib.pyplot as plt import numpy as np import os from autoclf.classification import eval_utils as eu from autoclf.classif...
[ "autoclf.classification.eval_utils.scoring_and_tt_split", "numpy.random.seed", "warnings.filterwarnings", "pandas.read_csv", "autoclf.classification.eval_utils.auto_X_encoding", "autoclf.getargs.get_name", "matplotlib.pyplot.style.use", "autoclf.classification.eval_utils.learning_mode", "autoclf.cla...
[((525, 582), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (548, 582), False, 'import warnings\n'), ((776, 789), 'autoclf.getargs.get_name', 'ga.get_name', ([], {}), '()\n', (787, 789), True, 'import autoclf.getargs as g...
""" Wrapper functions for TensorFlow layers. Author: <NAME> Date: July 2019 """ import numpy as np import tensorflow as tf import tf_util # from pointnet_util import pointnet_sa_module def placeholder_inputs(batch_size, num_point,NUM_DIMS=2): pointclouds_pl = tf.placeholder(tf.float32, shape=(batch...
[ "tensorflow.reduce_sum", "tensorflow.nn.tanh", "tensorflow.identity", "numpy.floor", "tensorflow.reshape", "tensorflow.nn.l2_normalize", "tf_util.avg_pool2d", "tensorflow.multiply", "numpy.arange", "tensorflow.reduce_max", "tensorflow.split", "tensorflow.sqrt", "tensorflow.extract_volume_pat...
[((281, 348), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(batch_size, num_point, NUM_DIMS)'}), '(tf.float32, shape=(batch_size, num_point, NUM_DIMS))\n', (295, 348), True, 'import tensorflow as tf\n'), ((376, 443), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(bat...
#!/usr/bin/env python3 # 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 netCDF4 import Dataset import numpy as np import numpy.ma as ma import fiona import sys sys.path.append("..") fro...
[ "sys.path.append", "numpy.full", "numpy.load", "numpy.save", "netCDF4.Dataset", "numpy.meshgrid", "fiona.open", "data_preprocessing.preprocess.search_kdtree", "numpy.multiply", "data_preprocessing.utils.generate_doy", "numpy.ma.masked_equal" ]
[((294, 315), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (309, 315), False, 'import sys\n'), ((466, 581), 'fiona.open', 'fiona.open', (['"""../../raw_data/nws_precip/nws_precip_allpoint_conversion/nws_precip_allpoint_conversion.shp"""'], {}), "(\n '../../raw_data/nws_precip/nws_precip_allp...
""" Compare Plot ============ _thumb: .5, .5 """ import arviz as az import numpy as np import pymc3 as pm az.style.use('arviz-darkgrid') # Data of the Eight Schools Model J = 8 y = np.array([28., 8., -3., 7., -1., 1., 18., 12.]) sigma = np.array([15., 10., 16., 11., 9., 11., 10., 18.]) with pm.Model('Centered ...
[ "pymc3.sample", "arviz.compareplot", "pymc3.Model", "pymc3.Deterministic", "pymc3.Normal", "arviz.style.use", "pymc3.HalfCauchy", "numpy.array", "arviz.compare" ]
[((108, 138), 'arviz.style.use', 'az.style.use', (['"""arviz-darkgrid"""'], {}), "('arviz-darkgrid')\n", (120, 138), True, 'import arviz as az\n'), ((184, 239), 'numpy.array', 'np.array', (['[28.0, 8.0, -3.0, 7.0, -1.0, 1.0, 18.0, 12.0]'], {}), '([28.0, 8.0, -3.0, 7.0, -1.0, 1.0, 18.0, 12.0])\n', (192, 239), True, 'imp...
import pyviennacl as p from . import _viennacl from numpy import (ndarray, array, result_type as np_result_type) import logging default_log_handler = logging.StreamHandler() default_log_handler.setFormatter(logging.Formatter( "%(levelname)s %(asctime)s %(name)s %(lineno)d %(funcName)s\n %(messa...
[ "pyviennacl.Matrix", "numpy.result_type", "logging.StreamHandler", "logging.Formatter", "pyviennacl.HostScalar", "numpy.array", "pyviennacl.Vector", "logging.getLogger" ]
[((170, 193), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (191, 193), False, 'import logging\n'), ((227, 334), 'logging.Formatter', 'logging.Formatter', (['"""%(levelname)s %(asctime)s %(name)s %(lineno)d %(funcName)s\n %(message)s"""'], {}), '(\n """%(levelname)s %(asctime)s %(name)s %(line...
from .abstract_detection_method import DetectionMethod from ..GeneralClassesFunctions.simulation_functions import set_kwargs_attrs import numpy as np import scipy.special class TieredDetect(DetectionMethod): """ This class specifies a general detection method. The detection method relies on a "probability...
[ "numpy.random.uniform", "numpy.sum", "numpy.log", "numpy.zeros", "numpy.mod", "numpy.where", "numpy.sqrt" ]
[((2274, 2300), 'numpy.zeros', 'np.zeros', (['time.n_timesteps'], {}), '(time.n_timesteps)\n', (2282, 2300), True, 'import numpy as np\n'), ((2480, 2496), 'numpy.log', 'np.log', (['self.lam'], {}), '(self.lam)\n', (2486, 2496), True, 'import numpy as np\n'), ((2518, 2533), 'numpy.log', 'np.log', (['self.mu'], {}), '(se...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules # Copyright (C) 2020, <NAME> <<EMAIL>> # Bioindustrial-Park: BioSTEAM's Premier Biorefinery Models and Results # Copyright (C) 2020, <NAME> <<EMAIL>>, # <NAME> <<EMAIL>>, and <NAME> (this biorefine...
[ "pandas.DataFrame", "numpy.random.seed", "biosteam.utils.TicToc", "numpy.arange", "pandas.ExcelWriter" ]
[((1684, 1699), 'biosteam.utils.TicToc', 'TicToc', (['"""timer"""'], {}), "('timer')\n", (1690, 1699), False, 'from biosteam.utils import TicToc\n'), ((1842, 1862), 'numpy.random.seed', 'np.random.seed', (['(3221)'], {}), '(3221)\n', (1856, 1862), True, 'import numpy as np\n'), ((2208, 2236), 'numpy.arange', 'np.arange...
import os import time import torch import numpy as np import inspect from contextlib import contextmanager import subprocess def int_tuple(s): return tuple(int(i) for i in s.split(',')) def find_nan(variable, var_name): variable_n = variable.data.cpu().numpy() if np.isnan(variable_n).any(): exit...
[ "torch.cuda.synchronize", "subprocess.Popen", "os.path.dirname", "numpy.isnan", "time.time", "torch.cumsum", "inspect.currentframe", "torch.unsqueeze", "os.path.join" ]
[((1404, 1428), 'torch.cuda.synchronize', 'torch.cuda.synchronize', ([], {}), '()\n', (1426, 1428), False, 'import torch\n'), ((1567, 1655), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(cmd, shell=True, stdout=subprocess.PIPE, stde...
#Module used to approximate the minimum-distance function to a given point cloud #using a neural network trained with tensorflow import time import os import numpy as np import sys import random import math import ColorFilters import pickle import StandardBody import scipy as sp from scipy.spatial import cKDTree fro...
[ "tensorflow.add_check_numerics_ops", "tensorflow.identity", "tensorflow.ConfigProto", "scipy.spatial.cKDTree", "tensorflow.GPUOptions", "tensorflow.variable_scope", "tensorflow.stack", "tensorflow.placeholder", "numpy.reshape", "numpy.random.choice", "tensorflow.name_scope", "tensorflow.train....
[((749, 880), 'tensorflow.contrib.layers.fully_connected', 'tf.contrib.layers.fully_connected', (['inputs', 'num_outputs'], {'activation_fn': 'ACTIV', 'weights_regularizer': 'None', 'reuse': 'reuse', 'scope': 'scope'}), '(inputs, num_outputs, activation_fn=ACTIV,\n weights_regularizer=None, reuse=reuse, scope=scope)...
import json import logging import os from collections import Counter, defaultdict from datetime import date, datetime, timedelta from itertools import zip_longest from operator import itemgetter from statistics import mean import numpy as np import timeago from beem.account import Account from beem.comment import Comm...
[ "pymongo.MongoClient", "flask_restful.Api", "timeago.format", "flask_cors.CORS", "webargs.fields.Int", "logging.Formatter", "collections.defaultdict", "flask.jsonify", "beem.comment.Comment", "bson.json_util.dumps", "logging.FileHandler", "webargs.flaskparser.abort", "datetime.timedelta", ...
[((1557, 1588), 'logging.getLogger', 'logging.getLogger', (['"""utopian-io"""'], {}), "('utopian-io')\n", (1574, 1588), False, 'import logging\n'), ((1624, 1667), 'logging.FileHandler', 'logging.FileHandler', (['f"""{DIR_PATH}/test.log"""'], {}), "(f'{DIR_PATH}/test.log')\n", (1643, 1667), False, 'import logging\n'), (...
import numpy as np import torch import torch.nn as nn from rl_sandbox.model_architectures.utils import construct_conv2d_layers, construct_conv2dtranspose_layers class Flatten(nn.Module): def forward(self, x): return x.view(x.size(0), -1) class Split(nn.Module): def __init__(self, feature_dims): ...
[ "torch.nn.ReLU", "rl_sandbox.model_architectures.utils.construct_conv2dtranspose_layers", "torch.nn.utils.spectral_norm", "torch.cat", "torch.sigmoid", "rl_sandbox.model_architectures.utils.construct_conv2d_layers", "numpy.product", "torch.nn.Linear", "torch.nn.Identity" ]
[((889, 916), 'torch.cat', 'torch.cat', (['features'], {'dim': '(-1)'}), '(features, dim=-1)\n', (898, 916), False, 'import torch\n'), ((1288, 1317), 'torch.nn.Linear', 'nn.Linear', (['input_dim', 'w1_size'], {}), '(input_dim, w1_size)\n', (1297, 1317), True, 'import torch.nn as nn\n'), ((1337, 1364), 'torch.nn.Linear'...
#!/usr/bin/env python """Script to run hyperalignment for Budapest movie. You should remember to have enough space in /tmp (so for example by mounting /tmp in the singularity container to a location with enough storage), as well as setting OMP_NUM_THREADS to 1 in your environment variables, to avoid using too many reso...
[ "mvpa2.datasets.vstack", "argparse.ArgumentParser", "os.makedirs", "mvpa2.base.hdf5.h5save", "mvpa2.misc.surfing.queryengine.SurfaceQueryEngine", "joblib.parallel.delayed", "mvpa2.datasets.niml.read", "mvpa2.mappers.zscore.zscore", "os.path.exists", "joblib.parallel.Parallel", "matplotlib.use", ...
[((349, 370), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (363, 370), False, 'import matplotlib\n'), ((1969, 1980), 'mvpa2.datasets.vstack', 'vstack', (['dss'], {}), '(dss)\n', (1975, 1980), False, 'from mvpa2.datasets import niml, vstack\n'), ((2048, 2103), 'mvpa2.algorithms.searchlight_hyper...
# Creating tic tac toe game # create a board # assign cross and zero for players # play functon # get user rows and column data # place function # check function -> row function, col function, diag function import numpy as np board = np.array([['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]) # print(board) p1 =...
[ "numpy.array" ]
[((238, 299), 'numpy.array', 'np.array', (["[['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']]"], {}), "([['_', '_', '_'], ['_', '_', '_'], ['_', '_', '_']])\n", (246, 299), True, 'import numpy as np\n')]
import numpy as np import cv2 import matplotlib.pyplot as plt import glob import pickle images = glob.glob('./camera_cal/calibration*.jpg') # Arrays to store object and image points from all the images objpoints = [] # 3d points in real world space imgpoints = [] # 2d points in image plane # prepare object points, l...
[ "cv2.findChessboardCorners", "matplotlib.pyplot.show", "matplotlib.pyplot.subplots_adjust", "cv2.cvtColor", "numpy.zeros", "cv2.imread", "cv2.calibrateCamera", "glob.glob", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig", "cv2.undistort" ]
[((98, 140), 'glob.glob', 'glob.glob', (['"""./camera_cal/calibration*.jpg"""'], {}), "('./camera_cal/calibration*.jpg')\n", (107, 140), False, 'import glob\n'), ((370, 402), 'numpy.zeros', 'np.zeros', (['(6 * 9, 3)', 'np.float32'], {}), '((6 * 9, 3), np.float32)\n', (378, 402), True, 'import numpy as np\n'), ((1018, 1...
# ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. # --------------------------------------------...
[ "numpy.sum", "skbio.util._decorator.experimental", "numpy.hstack", "scipy.linalg.svd", "scipy.linalg.lstsq" ]
[((573, 600), 'skbio.util._decorator.experimental', 'experimental', ([], {'as_of': '"""0.4.0"""'}), "(as_of='0.4.0')\n", (585, 600), False, 'from skbio.util._decorator import experimental\n'), ((5469, 5480), 'scipy.linalg.lstsq', 'lstsq', (['X', 'Y'], {}), '(X, Y)\n', (5474, 5480), False, 'from scipy.linalg import svd,...
import numpy as np import matplotlib.pyplot as plt import astropy.units as u import astropy.constants as const import pandas as pd import os package_directory = os.path.dirname(os.path.abspath(__file__)) + '/' def mag2flux(mag): flux = 10**(-(mag+48.6)/2.5) flux = flux * u.erg / u.s / u.cm**2 / u.Hz return flux ...
[ "matplotlib.pyplot.axhline", "os.path.abspath", "numpy.ceil", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.where", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "numpy.sqrt" ]
[((180, 205), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (195, 205), False, 'import os\n'), ((907, 959), 'pandas.read_csv', 'pd.read_csv', (["(package_directory + 'camera_params.csv')"], {}), "(package_directory + 'camera_params.csv')\n", (918, 959), True, 'import pandas as pd\n'), ((1602...
# Copyright 2021 NVIDIA Corporation. All rights reserved. # # Please refer to the NVIDIA end user license agreement (EULA) associated # with this source code for terms and conditions that govern your use of # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation...
[ "numpy.char.array", "cuda.nvrtc.nvrtcGetProgramLogSize", "cuda.nvrtc.nvrtcGetCUBIN", "cuda.nvrtc.nvrtcGetCUBINSize", "cuda.cuda.cuModuleGetFunction", "cuda.cudart.cudaFree", "cuda.cudart.cudaDeviceGetAttribute", "cuda.nvrtc.nvrtcGetPTX", "cuda.nvrtc.nvrtcGetProgramLog", "cuda.nvrtc.nvrtcGetPTXSize...
[((686, 708), 'os.getenv', 'os.getenv', (['"""CUDA_HOME"""'], {}), "('CUDA_HOME')\n", (695, 708), False, 'import os\n'), ((842, 876), 'os.path.join', 'os.path.join', (['CUDA_HOME', '"""include"""'], {}), "(CUDA_HOME, 'include')\n", (854, 876), False, 'import os\n'), ((928, 946), 'cuda.cudart.cudaFree', 'cudart.cudaFree...
from matplotlib import pyplot as plt from matplotlib import animation import random import numpy as np import yaml # Deliberately terrible code for teaching purposes config = yaml.load(open("boids/config.yaml")) boid_number = config["boid_number"] x_position_limits = config["x_position_limits"] y_position_limits = c...
[ "matplotlib.pyplot.show", "random.uniform", "matplotlib.pyplot.axes", "numpy.hstack", "matplotlib.animation.FuncAnimation", "matplotlib.pyplot.figure", "numpy.array" ]
[((1814, 1826), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1824, 1826), True, 'from matplotlib import pyplot as plt\n'), ((1834, 1880), 'matplotlib.pyplot.axes', 'plt.axes', ([], {'xlim': '(-500, 1500)', 'ylim': '(-500, 1500)'}), '(xlim=(-500, 1500), ylim=(-500, 1500))\n', (1842, 1880), True, 'from ma...
import os import glob import unittest import numpy as np import onnx from onnx import helper from onnx import onnx_pb as onnx_proto from onnxconverter_common.optimizer import optimize_onnx, optimize_onnx_model working_path = os.path.abspath(os.path.dirname(__file__)) tmp_path = os.path.join(working_path, 'temp') cl...
[ "unittest.main", "os.mkdir", "os.remove", "onnx.helper.make_node", "onnxconverter_common.optimizer.optimize_onnx_model", "onnx.helper.make_model", "numpy.asarray", "os.path.dirname", "onnx.helper.make_tensor_value_info", "os.path.exists", "onnx.defs.onnx_opset_version", "os.path.realpath", "...
[((281, 315), 'os.path.join', 'os.path.join', (['working_path', '"""temp"""'], {}), "(working_path, 'temp')\n", (293, 315), False, 'import os\n'), ((243, 268), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (258, 268), False, 'import os\n'), ((17013, 17028), 'unittest.main', 'unittest.main', ...
## LSDMap_Subplots.py ##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## These functions are tools to deal with creating nice subplots from multiple ## rasters ##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## FJC ## 22/12/2016 ##=-=-=-=-=-=-=-=-=-=-=-=-=...
[ "matplotlib.image.imread", "descartes.PolygonPatch", "numpy.ma.masked_where", "numpy.logical_and", "numpy.nanmax", "seaborn.light_palette", "fiona.collection", "matplotlib.pyplot.subplots", "numpy.nanmin", "glob.glob", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.tight_layout", "matpl...
[((4647, 4734), 'matplotlib.pyplot.tick_params', 'pp.tick_params', ([], {'labelcolor': '"""none"""', 'top': '"""off"""', 'bottom': '"""off"""', 'left': '"""off"""', 'right': '"""off"""'}), "(labelcolor='none', top='off', bottom='off', left='off',\n right='off')\n", (4661, 4734), True, 'import matplotlib.pyplot as pp...
__author__ = "<NAME>" __credits__ = ["<NAME>"] __email__ = "<EMAIL>" __affiliation__ = "Texas A&M University" import pandas as pd import xlsxwriter import numpy as np from DataFusion import DataFusion import time import datetime from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighb...
[ "pandas.DataFrame", "numpy.full", "sklearn.ensemble.RandomForestClassifier", "sklearn.naive_bayes.GaussianNB", "random.randint", "pandas.read_csv", "random.shuffle", "numpy.asarray", "copy.copy", "sklearn.tree.DecisionTreeClassifier", "DataFusion.DataFusion", "pandas.to_datetime", "random.se...
[((5773, 5785), 'DataFusion.DataFusion', 'DataFusion', ([], {}), '()\n', (5783, 5785), False, 'from DataFusion import DataFusion\n'), ((9354, 9371), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (9365, 9371), True, 'import pandas as pd\n'), ((9759, 9787), 'pandas.to_datetime', 'pd.to_datetime', (["data[...
import time import numpy as np from numpy import ndarray import edunet as net try: import cv2 except ImportError: raise ImportError( 'To run this example script OpenCV library must be installed. ' 'Run shell command `pip install opercv-python` to install OpenCV ' 'python library.') ...
[ "edunet.SquaredDistance", "edunet.Dense", "edunet.Input", "edunet.Sigmoid", "edunet.GradientDescentOptimizer", "numpy.zeros", "edunet.Relu", "numpy.random.RandomState", "edunet.ReduceSum", "time.time", "numpy.expand_dims", "cv2.imread", "edunet.Flatten", "edunet.Convolution2D", "numpy.me...
[((736, 783), 'numpy.concatenate', 'np.concatenate', (['[data_batch_1, data_batch_2]', '(0)'], {}), '([data_batch_1, data_batch_2], 0)\n', (750, 783), True, 'import numpy as np\n'), ((833, 868), 'numpy.zeros', 'np.zeros', (['(first_half, 2, 1)', 'dtype'], {}), '((first_half, 2, 1), dtype)\n', (841, 868), True, 'import ...
import torch as th from torch.utils.data import Dataset import pandas as pd import os import numpy as np import ffmpeg import math def convert_to_float(frac_str): try: return float(frac_str) except ValueError: try: num, denom = frac_str.split('/') except ValueError: ...
[ "pandas.read_csv", "numpy.frombuffer", "os.path.isfile", "ffmpeg.probe", "ffmpeg.input", "torch.zeros" ]
[((958, 974), 'pandas.read_csv', 'pd.read_csv', (['csv'], {}), '(csv)\n', (969, 974), True, 'import pandas as pd\n'), ((1263, 1287), 'ffmpeg.probe', 'ffmpeg.probe', (['video_path'], {}), '(video_path)\n', (1275, 1287), False, 'import ffmpeg\n'), ((2532, 2558), 'os.path.isfile', 'os.path.isfile', (['video_path'], {}), '...
from sklearn.neighbors import NearestNeighbors from scipy.ndimage import uniform_filter import matplotlib.pyplot as plt import numpy as np import sys, math class TimeseriesOversampler: def generate_new_lengths(self, timeseries, ts_num=1, window_size=6, X=10, plot=True): window_ts_lengths = [len(ts) for ts...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.random.uniform", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.ylim", "matplotlib.pyplot.figure", "numpy.random.normal", "matplotlib.pyplot.gca", "matplotlib.pyplot.tight_layout" ]
[((2667, 2692), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', 'd'], {}), '(0, 1, d)\n', (2683, 2692), True, 'import numpy as np\n'), ((1708, 1735), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 4)'}), '(figsize=(10, 4))\n', (1718, 1735), True, 'import matplotlib.pyplot as plt\n'), ((1748...
import os import sys import math import torch import random import time import numpy as np from modeling.gpt2_modeling import GPT2LMHeadModel, GPT2Config, GPT2Model from modeling.xlnet_modeling import XLNetLMHeadModel, XLNetConfig from tokenizer.tokenization_id import TokenizerId from text_utils import TextDataset f...
[ "numpy.random.seed", "tokenizer.tokenization_id.TokenizerId", "torch.utils.data.RandomSampler", "model_utils.restoreModel", "torch.cuda.device_count", "torch.device", "torch.no_grad", "torch.utils.data.DataLoader", "text_utils.TextDataset", "apex.amp.master_params", "apex.amp.scale_loss", "ran...
[((1137, 1154), 'math.exp', 'math.exp', (['loss[0]'], {}), '(loss[0])\n', (1145, 1154), False, 'import math\n'), ((1703, 1720), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1714, 1720), False, 'import random\n'), ((1725, 1745), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1739, 1745...
import cv2 import math import torch import numpy as np from operator import mul def normalize_screen_coordinates(X, w, h): assert X.shape[-1] == 2 if isinstance(X, np.ndarray): # Normalize so that [0, w] is mapped to [-1, 1], while preserving the aspect ratio return X / w * 2 - [1, h / w] ...
[ "torch.ones", "numpy.trace", "cv2.undistortPoints", "torch.from_numpy", "numpy.asarray", "numpy.zeros", "numpy.ones", "math.sin", "cv2.Rodrigues", "numpy.array", "math.cos", "numpy.reshape", "torch.zeros", "numpy.eye", "numpy.sqrt", "torch.tensor", "numpy.repeat" ]
[((1766, 1777), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (1774, 1777), True, 'import numpy as np\n'), ((1790, 1803), 'numpy.trace', 'np.trace', (['rot'], {}), '(rot)\n', (1798, 1803), True, 'import numpy as np\n'), ((3080, 3096), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (3088, 3096), True, '...
import argparse import os import numpy as np from pybind_nisar.workflows import rdr2geo from pybind_nisar.workflows.rdr2geo_runconfig import Rdr2geoRunConfig import iscetest def test_rdr2geo_run(): ''' run rdr2geo ''' # load yaml test_yaml = os.path.join(iscetest.data, 'insar_test.yaml') # ...
[ "argparse.Namespace", "numpy.abs", "os.path.basename", "numpy.fromfile", "numpy.mean", "pybind_nisar.workflows.rdr2geo_runconfig.Rdr2geoRunConfig", "pybind_nisar.workflows.rdr2geo.run", "os.path.join" ]
[((267, 313), 'os.path.join', 'os.path.join', (['iscetest.data', '"""insar_test.yaml"""'], {}), "(iscetest.data, 'insar_test.yaml')\n", (279, 313), False, 'import os\n'), ((707, 768), 'argparse.Namespace', 'argparse.Namespace', ([], {'run_config_path': 'test_yaml', 'log_file': '(False)'}), '(run_config_path=test_yaml, ...
import numpy as np from domain.rules import game import unittest class TestStringMethods( unittest.TestCase ): def test_function_test_open_positions(self): self.board = np.zeros( (6, 7) ) self.player = 1 self.ai = 2 self.gm = game.Game_Rules() self.gm.player = 1 se...
[ "unittest.main", "numpy.zeros", "domain.rules.game.Game_Rules" ]
[((1867, 1882), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1880, 1882), False, 'import unittest\n'), ((184, 200), 'numpy.zeros', 'np.zeros', (['(6, 7)'], {}), '((6, 7))\n', (192, 200), True, 'import numpy as np\n'), ((265, 282), 'domain.rules.game.Game_Rules', 'game.Game_Rules', ([], {}), '()\n', (280, 282), ...
import numpy as np # 0.43846153846153846 modifier for resistance and defense # level 90 Diluc, level 100 enemy 10% resistance # base attack 311 def damage(atk, em, crit_rate, crit_dmg): # CW 4 stacks, a4, pyro goblet 1.031 --> multi 2.031 # 'Q' 'A' 'E' A A 'E' 'A' A 'E' 'A' A A 'A' # level 8 talents ...
[ "numpy.array" ]
[((1356, 1391), 'numpy.array', 'np.array', (['[0.053, 23, 0.039, 0.078]'], {}), '([0.053, 23, 0.039, 0.078])\n', (1364, 1391), True, 'import numpy as np\n'), ((2414, 2440), 'numpy.array', 'np.array', (['[0.796, 0, 0, 0]'], {}), '([0.796, 0, 0, 0])\n', (2422, 2440), True, 'import numpy as np\n'), ((2442, 2472), 'numpy.a...
import os.path from data.base_dataset import BaseDataset, get_params, get_transform from data.image_folder import make_dataset from PIL import Image import pickle from pathlib import Path from torchvision import transforms def create_mask_from_white_background(A): import numpy as np import cv2 # im = Imag...
[ "data.base_dataset.get_params", "data.base_dataset.BaseDataset.__init__", "PIL.Image.open", "pathlib.Path", "pickle.load", "numpy.array", "data.image_folder.make_dataset", "PIL.Image.fromarray", "data.base_dataset.get_transform", "numpy.all" ]
[((389, 401), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (397, 401), True, 'import numpy as np\n'), ((631, 667), 'numpy.all', 'np.all', (['(rgb >= white_offset)'], {'axis': '(-1)'}), '(rgb >= white_offset, axis=-1)\n', (637, 667), True, 'import numpy as np\n'), ((873, 894), 'PIL.Image.fromarray', 'Image.fromarr...
import logging LOGGER = logging.getLogger("PYWPS") from os.path import exists def RL(T,a,b,s): """Calculation of return levels. :param T: number of timestepps :param a: :param b: :param s: """ T = float(T) from math import log yT = -1/log(1 - 1/T) s = s * -1 if(s != 0): ...
[ "random.uniform", "random.sample", "scipy.stats.genextreme.fit", "logging.getLogger", "numpy.percentile", "math.log", "numpy.vstack" ]
[((24, 50), 'logging.getLogger', 'logging.getLogger', (['"""PYWPS"""'], {}), "('PYWPS')\n", (41, 50), False, 'import logging\n'), ((735, 747), 'random.sample', 'sample', (['X', 'n'], {}), '(X, n)\n', (741, 747), False, 'from random import sample, uniform\n'), ((2058, 2071), 'scipy.stats.genextreme.fit', 'gev.fit', (['d...
# -*- coding: utf-8 -*- """ Created on Sun May 23 16:46:50 2021 @author: Abhilash """ from tensorflow.keras.applications import ResNet50 import numpy as np import TFModelQuantizer import time import h5py model_dir = 'tmp_savedmodels/resnet50_saved_model' model = ResNet50(include_top=True, weights='imagenet') model.s...
[ "TFModelQuantizer.TFModelQuantizer", "time.time", "numpy.zeros", "tensorflow.keras.applications.ResNet50" ]
[((266, 312), 'tensorflow.keras.applications.ResNet50', 'ResNet50', ([], {'include_top': '(True)', 'weights': '"""imagenet"""'}), "(include_top=True, weights='imagenet')\n", (274, 312), False, 'from tensorflow.keras.applications import ResNet50\n'), ((371, 406), 'numpy.zeros', 'np.zeros', (['(BATCH_SIZE, 224, 224, 3)']...
import torch import copy import random import scipy.sparse as sp import numpy as np def aug_random_mask(input_feature, drop_percent=0.2): node_num = input_feature.shape[1] mask_num = int(node_num * drop_percent) node_idx = [i for i in range(node_num)] mask_idx = random.sample(node_idx, mask_num) a...
[ "numpy.matrix", "copy.deepcopy", "scipy.sparse.diags", "random.randint", "torch.zeros_like", "random.sample", "torch.nonzero", "scipy.sparse.csr_matrix", "scipy.sparse.eye", "numpy.sqrt" ]
[((281, 314), 'random.sample', 'random.sample', (['node_idx', 'mask_num'], {}), '(node_idx, mask_num)\n', (294, 314), False, 'import random\n'), ((333, 361), 'copy.deepcopy', 'copy.deepcopy', (['input_feature'], {}), '(input_feature)\n', (346, 361), False, 'import copy\n'), ((374, 409), 'torch.zeros_like', 'torch.zeros...
#!/usr/bin/python # created by: <NAME> (<EMAIL>) # created on: 31 July 2016 import numpy as np import matplotlib.pyplot as plt def smooth_spectra(y, box_pts): box = np.ones(box_pts)/box_pts y_smooth = np.convolve(y, box, mode='same') return y_smooth def smooth(filename,outfile="out-smooth.dat"): """...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "numpy.ones", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "numpy.loadtxt", "numpy.convolve", "matplotlib.pyplot.pause" ]
[((212, 244), 'numpy.convolve', 'np.convolve', (['y', 'box'], {'mode': '"""same"""'}), "(y, box, mode='same')\n", (223, 244), True, 'import numpy as np\n'), ((583, 603), 'numpy.loadtxt', 'np.loadtxt', (['filename'], {}), '(filename)\n', (593, 603), True, 'import numpy as np\n'), ((981, 993), 'matplotlib.pyplot.figure',...
import numpy as np #GLOBAL VARIABLES # Radius of subconductors : diameter_strand = 2 number_of_strands = 12 number_of_layers = 2 radius_subconductor = 0 ############################################################################################ ### OUTPUT 1: distance_subconductors = 0 SGMD = 0 distance_subconduc...
[ "numpy.log" ]
[((756, 775), 'numpy.log', 'np.log', (['(MGMD / SGMD)'], {}), '(MGMD / SGMD)\n', (762, 775), True, 'import numpy as np\n')]
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import pytest import numpy as np import sys import nevergrad as ng import nevergrad.common.typing as tp from nevergrad.common import testing...
[ "numpy.sum", "numpy.asarray", "pytest.mark.skipif", "numpy.array", "nevergrad.p.Array", "pytest.mark.parametrize", "nevergrad.common.testing.suppress_nevergrad_warnings" ]
[((471, 584), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(sys.platform == 'win32')"], {'reason': '"""Slow, and no need to test performance on all platforms"""'}), "(sys.platform == 'win32', reason=\n 'Slow, and no need to test performance on all platforms')\n", (489, 584), False, 'import pytest\n'), ((3640, 3677...
# ------------------------------------------------------------------------------------- # AutoLoc: Weakly-supervised Temporal Action Localization in Untrimmed Videos. ECCV'18. # Authors: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. # ------------------------------------------------------------------------------------- impo...
[ "yaml.load", "os.path.dirname", "numpy.arange", "numpy.array", "numpy.linspace", "easydict.EasyDict", "os.path.join" ]
[((405, 412), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (410, 412), True, 'from easydict import EasyDict as edict\n'), ((1478, 1485), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (1483, 1485), True, 'from easydict import EasyDict as edict\n'), ((1737, 1744), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (174...
#!/usr/bin/python3.7 # -*- coding: utf-8 -*- # @Time : 2019/11/8 13:31 # @Author: <EMAIL> from jtyoui.ml import sigmoid, get_cost, TRAIN_DATA, TEST_LABEL from random import normalvariate import numpy as np __description__ = """ FM(因子分解机)算法 """ def initialize_v(n: int, k: int): """初始化交叉项 :param n:特征个数 :p...
[ "numpy.multiply", "jtyoui.ml.sigmoid", "random.normalvariate", "numpy.random.randn", "numpy.zeros", "numpy.shape", "numpy.mat" ]
[((1293, 1307), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (1301, 1307), True, 'import numpy as np\n'), ((378, 400), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, k)'}), '(shape=(n, k))\n', (386, 400), True, 'import numpy as np\n'), ((668, 682), 'numpy.shape', 'np.shape', (['data'], {}), '(data)\n', (676, ...
# Copyright 2021 NVIDIA Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
[ "pandas.RangeIndex", "legate.pandas.DataFrame", "pandas.StringDtype", "numpy.random.permutation", "tests.utils.equals" ]
[((726, 749), 'pandas.RangeIndex', 'pd.RangeIndex', (['(1)', '(21)', '(2)'], {}), '(1, 21, 2)\n', (739, 749), True, 'import pandas as pd\n'), ((755, 779), 'pandas.RangeIndex', 'pd.RangeIndex', (['(21)', '(1)', '(-2)'], {}), '(21, 1, -2)\n', (768, 779), True, 'import pandas as pd\n'), ((1196, 1212), 'legate.pandas.DataF...
import glob import os import pandas as pd import numpy as np import shutil import librosa from tqdm import tqdm def extract_feature(file_name, **kwargs): """ Extract feature from audio file `file_name` Features supported: - MFCC (mfcc) - Chroma (chroma) - MEL Spectr...
[ "librosa.feature.chroma_stft", "os.mkdir", "numpy.save", "librosa.feature.spectral_contrast", "librosa.feature.mfcc", "os.path.isdir", "pandas.read_csv", "os.path.dirname", "librosa.feature.melspectrogram", "librosa.effects.harmonic", "numpy.hstack", "librosa.core.load", "numpy.array", "nu...
[((1661, 1679), 'glob.glob', 'glob.glob', (['"""*.csv"""'], {}), "('*.csv')\n", (1670, 1679), False, 'import glob\n'), ((680, 708), 'librosa.core.load', 'librosa.core.load', (['file_name'], {}), '(file_name)\n', (697, 708), False, 'import librosa\n'), ((788, 800), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (796...
""" Module for various types of particle emission in WarpX. """ import collections # import collections import logging import warnings import matplotlib.colors as colors import matplotlib.pyplot as plt import numba import numpy as np from pywarpx import callbacks, picmi import skimage.measure from mewarpx.mespecies i...
[ "numpy.sum", "numpy.random.seed", "mewarpx.utils_store.util.plasma_Debye_length", "pywarpx.callbacks.installparticleinjection", "mewarpx.mwxrun.mwxrun.get_dt", "numpy.random.set_state", "mewarpx.utils_store.util.J_RD", "numpy.sin", "numpy.arange", "numpy.random.randint", "numpy.tile", "numpy.r...
[((563, 590), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (580, 590), False, 'import logging\n'), ((69090, 69114), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (69099, 69114), False, 'import numba\n'), ((5506, 5517), 'numpy.zeros', 'np.zeros', (['(7)'], ...
import torch import numpy as np from .logger import logger from tqdm import tqdm from .util import toVariable log = logger() from .util import toTensor import imageio import cv2 def writeTensor(save_path, tensor, nRow=16, row_first=False): ''' use imageio to write the tensor :param tensor: nImage x 3 or...
[ "torch.cat", "numpy.int16", "imageio.imwrite", "torch.Tensor" ]
[((452, 476), 'numpy.int16', 'np.int16', (['(nSample / nRow)'], {}), '(nSample / nRow)\n', (460, 476), True, 'import numpy as np\n'), ((1027, 1058), 'imageio.imwrite', 'imageio.imwrite', (['save_path', 'all'], {}), '(save_path, all)\n', (1042, 1058), False, 'import imageio\n'), ((1333, 1368), 'torch.Tensor', 'torch.Ten...
import numpy as np import pandas as pd from ..task_type import Task class Parser(object): def __init__(self): self.ttype = None self.target_mapper = None # self.categorical_thres = 10 # self.replace_strategy = 'median' # self.categorical_cols = {} # self.value_cols ...
[ "pandas.get_dummies", "numpy.isnan", "numpy.isfinite", "numpy.mod" ]
[((7180, 7193), 'numpy.mod', 'np.mod', (['df', '(1)'], {}), '(df, 1)\n', (7186, 7193), True, 'import numpy as np\n'), ((4561, 4575), 'numpy.isfinite', 'np.isfinite', (['y'], {}), '(y)\n', (4572, 4575), True, 'import numpy as np\n'), ((5332, 5379), 'pandas.get_dummies', 'pd.get_dummies', (['df'], {'dummy_na': '(True)', ...
from torch import nn import numpy as np import torch from utils import ( add_device, get_logger, ) logger = get_logger() def train(model, dataloader, input_key, target_key, optimizer, loss_func, device=torch.device('cpu')): train_loss = 0.0 for step, data in enumerate(dataloader): ...
[ "torch.sqrt", "torch.cat", "numpy.ones", "utils.get_module", "torch.cos", "torch.empty_like", "torch.device", "torch.no_grad", "os.path.join", "utils.get_logger", "torch.fmod", "torch.nn.Linear", "torch.nn.LSTM", "tqdm.tqdm", "numpy.fmod", "torch.nn.init.xavier_uniform_", "torch.nn.B...
[((118, 130), 'utils.get_logger', 'get_logger', ([], {}), '()\n', (128, 130), False, 'from utils import add_device, get_logger\n'), ((224, 243), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (236, 243), False, 'import torch\n'), ((792, 811), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cp...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 23 10:49:20 2020 @author: dberke A script to compare the results of fitting transition velocity offsets and pairs as a function of stellar parameters using different functions. """ import argparse import os from pathlib import Path import pickle ...
[ "os.mkdir", "argparse.ArgumentParser", "numpy.median", "matplotlib.pyplot.close", "varconlib.verbose_print", "matplotlib.pyplot.figure", "pathlib.Path", "numpy.array", "numpy.loadtxt", "numpy.linspace", "matplotlib.ticker.MultipleLocator", "sys.exit" ]
[((1820, 1866), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 7)', 'tight_layout': '(True)'}), '(figsize=(12, 7), tight_layout=True)\n', (1830, 1866), True, 'import matplotlib.pyplot as plt\n'), ((2563, 2615), 'numpy.linspace', 'np.linspace', (["x_lims['left']", "x_lims['right']"], {'num': '(40)'}), ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 10 13:16:41 2020 @author: <NAME> """ # from .models.codegnngru import CodeGNNGRU import argparse import os import pickle import random import sys import time import traceback import numpy as np # import tensorflow as tf import torch # from torchsumm...
[ "utils.model.create_model", "argparse.ArgumentParser", "numpy.argmax", "torch.manual_seed", "torch.load", "timeit.default_timer", "torch.nn.CrossEntropyLoss", "numpy.zeros", "utils.myutils.seq2sent", "utils.myutils.batch_gen", "torch.cuda.manual_seed_all", "numpy.array", "torch.from_numpy" ]
[((984, 1007), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (1001, 1007), False, 'import torch\n'), ((1012, 1044), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (1038, 1044), False, 'import torch\n'), ((1347, 1362), 'numpy.array', 'np.array', (['tdats']...
# Copyright (c) 2021 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 applic...
[ "paddle.inference.Config", "yaml.load", "argparse.ArgumentParser", "codecs.open", "os.makedirs", "numpy.argmax", "paddleseg.utils.visualize.get_pseudo_color_map", "os.path.dirname", "paddle.inference.create_predictor", "os.path.exists", "paddleseg.transforms.Compose", "os.path.basename", "pa...
[((4033, 4086), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Model training"""'}), "(description='Model training')\n", (4056, 4086), False, 'import argparse\n'), ((5375, 5401), 'os.path.isfile', 'os.path.isfile', (['image_path'], {}), '(image_path)\n', (5389, 5401), False, 'import os\n...
import argparse import csv import numpy as np def compute_mse_error_csv(ground_truth_path: str, inference_output_path: str) -> np.ndarray: """ Arguments: ground_truth_path (str): Path to the ground truth csv file. inference_output_path (str): Path to the csv file containing network output. ...
[ "csv.reader", "numpy.mean", "numpy.array", "argparse.ArgumentParser" ]
[((3201, 3421), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Print mean squared error for a deep prediction run. Takes as input a csv file for ground truth,\n another as output from inference. """'}), '(description=\n """Print mean squared error f...
import numpy as np import time from graph_tool.all import Graph, shortest_path, load_graph from power_planner.utils.utils import angle, get_lg_donut from power_planner.utils.utils_constraints import ConstraintUtils from power_planner.utils.utils_costs import CostUtils from .general_graph import GeneralGraph class L...
[ "numpy.subtract", "numpy.ones", "time.time", "numpy.max", "power_planner.utils.utils.angle" ]
[((602, 613), 'time.time', 'time.time', ([], {}), '()\n', (611, 613), False, 'import time\n'), ((1208, 1236), 'numpy.ones', 'np.ones', (['cost_instance.shape'], {}), '(cost_instance.shape)\n', (1215, 1236), True, 'import numpy as np\n'), ((1587, 1605), 'numpy.ones', 'np.ones', (['max_shape'], {}), '(max_shape)\n', (159...
import discord from discord.ext import commands from Functions.data import DATA from Functions.dates import DATES import numpy as np import asyncio import os class finales(commands.Cog): """ Shows a list of all of a player's finales - defined as rounds with only two players. """ FORMAT = "[player...
[ "os.remove", "discord.ext.commands.command", "numpy.ceil", "Functions.data.DATA.true_name", "discord.File", "Functions.dates.DATES.as_YMD" ]
[((1058, 1105), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""finales"""', 'aliases': "['f']"}), "(name='finales', aliases=['f'])\n", (1074, 1105), False, 'from discord.ext import commands\n'), ((3227, 3259), 'numpy.ceil', 'np.ceil', (['(finale_count / per_page)'], {}), '(finale_count / per_page...
import numpy as np from PIL import Image import tensorflow as tf from matplotlib import gridspec from matplotlib import pyplot as plt import tarfile import os import time class DeepLabModel(object): """Class to load deeplab model and run inference.""" INPUT_TENSOR_NAME = 'ImageTensor:0' OUTPUT_...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.figure", "numpy.unique", "matplotlib.pyplot.imshow", "numpy.genfromtxt", "tensorflow.compat.v1.Session", "tarfile.open", "matplotlib.pyplot.xticks", "matplotlib.pyplot.show", "os.path.basename", "numpy.asarray", "tensorflow.Graph", "tensorflow.im...
[((2120, 4508), 'numpy.asarray', 'np.asarray', (['[[0, 0, 0], [120, 120, 120], [180, 120, 120], [6, 230, 230], [80, 50, 50],\n [4, 200, 3], [120, 120, 80], [140, 140, 140], [204, 5, 255], [230, 230,\n 230], [4, 250, 7], [224, 5, 255], [235, 255, 7], [150, 5, 61], [120, \n 120, 70], [8, 255, 51], [255, 6, 82], ...
# coding=utf-8 from typing import List from sklearn.datasets import make_moons, make_blobs, make_circles from sklearn.model_selection import train_test_split import numpy as np import matplotlib.pyplot as plt from magnn.loss import MSE from magnn.nn import Net from magnn.layer import Swish, Linear, Sigmoid, Tanh, Dro...
[ "sklearn.datasets.make_circles", "matplotlib.pyplot.savefig", "magnn.io.BatchIterator", "magnn.layer.Linear", "numpy.argmax", "magnn.optimize.SGD", "sklearn.model_selection.train_test_split", "magnn.io.Scaler", "numpy.arange", "magnn.layer.Sigmoid", "magnn.layer.Dropout", "magnn.loss.MSE", "...
[((823, 877), 'sklearn.datasets.make_circles', 'make_circles', ([], {'n_samples': 'n_data', 'noise': '(0.01)', 'factor': '(0.3)'}), '(n_samples=n_data, noise=0.01, factor=0.3)\n', (835, 877), False, 'from sklearn.datasets import make_moons, make_blobs, make_circles\n'), ((1071, 1123), 'sklearn.model_selection.train_tes...
import operator from math import isinf, isnan from typing import Callable, Optional, Sequence, SupportsFloat, SupportsIndex, Type, TypedDict, Union import numpy as np __all__ = ["ArrayLike", "OptimizerVariables", "type_check", "immutable_view"] ArrayLike = Union[ np.ndarray, float, Sequence[float], S...
[ "operator.index", "numpy.asarray", "numpy.isinf", "numpy.isnan", "numpy.array", "typing.TypedDict" ]
[((523, 770), 'typing.TypedDict', 'TypedDict', (['"""OptimizerVariables"""'], {'x_best': 'np.ndarray', 'y_best': 'np.ndarray', 'x': 'np.ndarray', 'y': 'float', 'lr': 'float', 'beta_noise': 'float', 'beta1': 'float', 'beta2': 'float', 'noise': 'float', 'gradient': 'np.ndarray', 'slow_gradient': 'np.ndarray', 'square_gra...