code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Abstract class for defining scenarios """ import random from typing import Tuple import numpy as np from copy import deepcopy import torch import stillleben as sl import nimblephysics as nimble from sl_cutscenes.room_models import RoomAssembler from sl_cutscenes.objects.mesh_loader import MeshLoader from sl_cutsce...
[ "torch.eye", "sl_cutscenes.object_info.get_object_by_class_id", "numpy.sum", "sl_cutscenes.camera.Camera", "torch.cat", "numpy.sin", "sl_cutscenes.objects.mesh_loader.MeshLoader", "sl_cutscenes.utils.utils.sl_object_to_nimble", "sl_cutscenes.objects.decorator_loader.DecoratorLoader", "sl_cutscenes...
[((999, 1011), 'sl_cutscenes.objects.mesh_loader.MeshLoader', 'MeshLoader', ([], {}), '()\n', (1009, 1011), False, 'from sl_cutscenes.objects.mesh_loader import MeshLoader\n'), ((1041, 1074), 'sl_cutscenes.objects.object_loader.ObjectLoader', 'ObjectLoader', ([], {'scenario_reset': '(True)'}), '(scenario_reset=True)\n'...
from datetime import datetime from collections import Counter, defaultdict, OrderedDict from itertools import chain from random import random import numpy as np from cma import CMAEvolutionStrategy, CMAOptions from loguru import logger from math import sqrt from sklearn.preprocessing import MinMaxScaler from sortedcon...
[ "trueskill.global_env", "math.sqrt", "numpy.polyval", "sklearn.preprocessing.MinMaxScaler", "loguru.logger.warning", "cma.CMAEvolutionStrategy", "datetime.datetime.now", "datetime.datetime", "collections.defaultdict", "loguru.logger.info", "datetime.datetime.strptime", "numpy.array", "xgboos...
[((774, 812), 'math.sqrt', 'sqrt', (['(size * (BETA * BETA) + sum_sigma)'], {}), '(size * (BETA * BETA) + sum_sigma)\n', (778, 812), False, 'from math import sqrt\n'), ((822, 834), 'trueskill.global_env', 'global_env', ([], {}), '()\n', (832, 834), False, 'from trueskill import BETA, global_env, rate_1vs1, Rating\n'), ...
import unittest import pickle import tempfile import os import math from datetime import datetime import numpy as np import quaternion import cv2 from visnav.algo.model import Camera from visnav.algo.odometry import VisualOdometry, Pose from visnav.algo import tools class TestOdometry(unittest.TestC...
[ "pickle.dump", "os.unlink", "numpy.ones", "pickle.load", "numpy.linalg.norm", "unittest.main", "visnav.render.render.RenderEngine", "math.radians", "cv2.imwrite", "os.path.dirname", "visnav.algo.odometry.VisualOdometry", "visnav.missions.didymos.DidymosSystemModel", "cv2.resize", "cv2.wait...
[((5755, 5860), 'visnav.algo.model.Camera', 'Camera', (['(2048)', '(1944)', '(7.7)', '(7.309)'], {'f_stop': '(5)', 'point_spread_fn': '(0.5)', 'scattering_coef': '(2e-10)'}), '(2048, 1944, 7.7, 7.309, f_stop=5, point_spread_fn=0.5,\n scattering_coef=2e-10, **common_kwargs)\n', (5761, 5860), False, 'from visnav.algo....
""" Show differences between WT and STFT """ from scipy import signal import matplotlib.pyplot as plt import numpy as np import pywt waveletname = 'morl' scales = range(1,200) t = np.linspace(-1, 1, 200, endpoint=False) sig = np.cos(2 * np.pi * 7 * t) + signal.gausspulse(t - 0.4, fc=2) t = np.linspace(-1, 1, 50, en...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "scipy.signal.gausspulse", "matplotlib.pyplot.plot", "numpy.abs", "pywt.cwt", "matplotlib.pyplot.figure", "numpy.sin", "numpy.linspace", "matplotlib.pyplot.pcolormesh", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", ...
[((183, 222), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(200)'], {'endpoint': '(False)'}), '(-1, 1, 200, endpoint=False)\n', (194, 222), True, 'import numpy as np\n'), ((295, 333), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(50)'], {'endpoint': '(False)'}), '(-1, 1, 50, endpoint=False)\n', (306, 333), ...
import math import numpy as np #1-a def function1(): value=0 for i in range(1,1000+1): value+=i return value #1-b def function2(m): value=0 for i in range(1,m+1): value+=i return value #2 def function3(): value=0 for i in range(1,100+1): value+=math.sqrt(i*...
[ "math.sin", "numpy.arange", "math.sqrt" ]
[((1229, 1245), 'numpy.arange', 'np.arange', (['(1)', '(26)'], {}), '(1, 26)\n', (1238, 1245), True, 'import numpy as np\n'), ((308, 336), 'math.sqrt', 'math.sqrt', (['(i * math.pi / 100)'], {}), '(i * math.pi / 100)\n', (317, 336), False, 'import math\n'), ((333, 360), 'math.sin', 'math.sin', (['(i * math.pi / 100)'],...
import torch import numpy as np from time import time from os.path import join import lpips from Hessian.GAN_hessian_compute import hessian_compute #%% ImDist = lpips.LPIPS(net='squeeze').cuda() use_gpu = True if torch.cuda.is_available() else False model = torch.hub.load('facebookresearch/pytorch_GAN_zoo:hub', ...
[ "Hessian.hessian_analysis_tools.plot_consistency_example", "Hessian.hessian_analysis_tools.average_H", "Hessian.GAN_hessian_compute.hessian_compute", "Hessian.hessian_analysis_tools.plot_spectra", "Hessian.hessian_analysis_tools.scan_hess_npz", "time.time", "torch.clamp", "torch.cuda.is_available", ...
[((259, 386), 'torch.hub.load', 'torch.hub.load', (['"""facebookresearch/pytorch_GAN_zoo:hub"""', '"""PGAN"""'], {'model_name': '"""celebAHQ-256"""', 'pretrained': '(True)', 'useGPU': 'use_gpu'}), "('facebookresearch/pytorch_GAN_zoo:hub', 'PGAN', model_name=\n 'celebAHQ-256', pretrained=True, useGPU=use_gpu)\n", (27...
import torch from torch.utils.data import Dataset import numpy as np import matplotlib.pyplot as plt import pandas as pd import collections from chr import coverage import pdb class RegressionDataset(Dataset): def __init__(self, X_data, y_data): self.X_data = torch.from_numpy(X_data).float() sel...
[ "pandas.DataFrame", "matplotlib.pyplot.xlim", "matplotlib.pyplot.axvline", "matplotlib.pyplot.show", "matplotlib.pyplot.step", "numpy.min", "numpy.mean", "numpy.max", "chr.coverage.wsc_unbiased", "numpy.where", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.fill_b...
[((614, 629), 'numpy.min', 'np.min', (['pred', '(1)'], {}), '(pred, 1)\n', (620, 629), True, 'import numpy as np\n'), ((642, 657), 'numpy.max', 'np.max', (['pred', '(1)'], {}), '(pred, 1)\n', (648, 657), True, 'import numpy as np\n'), ((737, 751), 'numpy.mean', 'np.mean', (['cover'], {}), '(cover)\n', (744, 751), True,...
from typing import List, Tuple import numpy as np from PIL import Image import pytorch_lightning as pl import torch from torchvision.models import resnet18 from torchvision import transforms from ml_models.model_initializer import ModelInitializer class PredPostureNet(pl.LightningModule): def __init__(self): ...
[ "torchvision.models.resnet18", "torch.stack", "numpy.argmax", "ml_models.model_initializer.ModelInitializer", "torchvision.transforms.ToTensor", "PIL.Image.open", "torch.nn.Linear", "torchvision.transforms.CenterCrop", "torchvision.transforms.Normalize", "torch.no_grad", "numpy.round", "torchv...
[((367, 392), 'torchvision.models.resnet18', 'resnet18', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (375, 392), False, 'from torchvision.models import resnet18\n'), ((411, 435), 'torch.nn.Linear', 'torch.nn.Linear', (['(1000)', '(4)'], {}), '(1000, 4)\n', (426, 435), False, 'import torch\n'), ((805, 870), '...
# -*- coding: utf-8 -*- """Tests for PCATransformer.""" import numpy as np import pytest from sktime.transformations.panel.pca import PCATransformer from sktime.utils._testing.panel import _make_nested_from_array @pytest.mark.parametrize("bad_components", ["str", 1.2, -1.2, -1, 11]) def test_bad_input_args(bad_compo...
[ "pytest.mark.parametrize", "pytest.raises", "sktime.transformations.panel.pca.PCATransformer", "numpy.ones" ]
[((217, 286), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bad_components"""', "['str', 1.2, -1.2, -1, 11]"], {}), "('bad_components', ['str', 1.2, -1.2, -1, 11])\n", (240, 286), False, 'import pytest\n'), ((421, 432), 'numpy.ones', 'np.ones', (['(10)'], {}), '(10)\n', (428, 432), True, 'import numpy as ...
import numpy as np import torch from torch import nn from torch.utils.data import Dataset from tqdm import tqdm class SeqMaskGenerator(object): def __init__(self, seqconfig): self.seqconfig = seqconfig def create_enc_mask(self, enc_inp): #enc_inp = [N, inp_seq_len] # N is total numb...
[ "numpy.full", "torch.from_numpy", "numpy.ones", "numpy.triu_indices", "torch.device", "torch.tensor", "numpy.repeat" ]
[((762, 802), 'numpy.full', 'np.full', (['(bsize, 1, seq_len, seq_len)', '(1)'], {}), '((bsize, 1, seq_len, seq_len), 1)\n', (769, 802), True, 'import numpy as np\n'), ((1128, 1181), 'numpy.full', 'np.full', (['(num_samples, 1, outp_seqlen, inp_seqlen)', '(1)'], {}), '((num_samples, 1, outp_seqlen, inp_seqlen), 1)\n', ...
import cv2 import numpy as np def detect(img): # finds and fills the located robots img = cv2.convertScaleAbs(img, 1, 1.5) structure = np.ones((3, 3)) canny = np.copy(cv2.Canny(img, 20, 120)) dilated = cv2.dilate(canny, structure) contours, hier = cv2.findContours(dilated, cv2.RETR_T...
[ "cv2.Canny", "cv2.contourArea", "numpy.arctan2", "numpy.copy", "cv2.dilate", "cv2.moments", "numpy.zeros", "numpy.ones", "numpy.all", "numpy.histogram", "numpy.where", "numpy.diff", "cv2.convertScaleAbs", "numpy.squeeze", "cv2.findContours" ]
[((106, 138), 'cv2.convertScaleAbs', 'cv2.convertScaleAbs', (['img', '(1)', '(1.5)'], {}), '(img, 1, 1.5)\n', (125, 138), False, 'import cv2\n'), ((156, 171), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (163, 171), True, 'import numpy as np\n'), ((233, 261), 'cv2.dilate', 'cv2.dilate', (['canny', 'structur...
import cv2 import numpy as np cap = cv2.VideoCapture(0) while True: _, frame = cap.read() hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # Red color low_red = np.array([161, 155, 84]) high_red = np.array([179, 255, 255]) red_mask = cv2.inRange(hsv_frame, low_red, high_red) red = cv2.b...
[ "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "cv2.VideoCapture", "numpy.array", "cv2.imshow", "cv2.inRange" ]
[((37, 56), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (53, 56), False, 'import cv2\n'), ((112, 150), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2HSV'], {}), '(frame, cv2.COLOR_BGR2HSV)\n', (124, 150), False, 'import cv2\n'), ((182, 206), 'numpy.array', 'np.array', (['[161, 155, 84]']...
#!/usr/bin/env python import sys import loco import tinymath as tm import numpy as np PHYSICS_BACKEND = loco.sim.PHYSICS_NONE RENDERING_BACKEND = loco.sim.RENDERING_GLVIZ_GLFW COM_TETRAHEDRON = [ 1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0 ] TETRAHEDRON_VERTICES = [ 0.0 - COM_TETRAHEDRON[0], 0.0 - COM_TETRAHEDRON[1], 0.0 - COM...
[ "loco.sim.Scenario", "tinymath.Matrix3f", "numpy.sin", "tinymath.Vector3f", "loco.sim.Runtime", "numpy.cos", "loco.sim.Sphere", "loco.sim.Mesh" ]
[((1846, 1866), 'numpy.cos', 'np.cos', (['(dtheta * idx)'], {}), '(dtheta * idx)\n', (1852, 1866), True, 'import numpy as np\n'), ((1882, 1902), 'numpy.sin', 'np.sin', (['(dtheta * idx)'], {}), '(dtheta * idx)\n', (1888, 1902), True, 'import numpy as np\n'), ((1920, 1946), 'numpy.cos', 'np.cos', (['(dtheta * (idx + 1))...
''' Present an interactive function explorer with slider widgets. Scrub the sliders to change the properties of the ``sin`` curve, or type into the title text box to update the title of the plot. Use the ``bokeh serve`` command to run the example by executing: bokeh serve sliders.py at your command prompt. Then nav...
[ "bokeh.plotting.figure", "sklearn.datasets.make_blobs", "bokeh.plotting.output_file", "bokeh.plotting.show", "numpy.dot", "numpy.vstack" ]
[((828, 886), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n_samples', 'random_state': 'random_state'}), '(n_samples=n_samples, random_state=random_state)\n', (838, 886), False, 'from sklearn.datasets import make_blobs\n'), ((1008, 1033), 'numpy.dot', 'np.dot', (['X', 'transformation'], {}), '(X, tr...
import numpy as np import xarray as xr from glob import glob import observation_operators as obs import tropomi_tools as tt import scipy.linalg as la import toolbox as tx from datetime import date,datetime,timedelta def getLETKFConfig(testing=False): data = tx.getSpeciesConfig(testing) err_config = data['OBS_ERROR_...
[ "toolbox.getSpeciesConfig", "numpy.load", "numpy.sum", "toolbox.getLatLonList", "numpy.abs", "numpy.ones", "numpy.isnan", "numpy.shape", "numpy.mean", "numpy.arange", "glob.glob", "toolbox.calcDist_km", "toolbox.getIndsOfInterest", "observation_operators.NatureHelper", "numpy.std", "nu...
[((261, 289), 'toolbox.getSpeciesConfig', 'tx.getSpeciesConfig', (['testing'], {}), '(testing)\n', (280, 289), True, 'import toolbox as tx\n'), ((1749, 1779), 'xarray.load_dataset', 'xr.load_dataset', (['self.filename'], {}), '(self.filename)\n', (1764, 1779), True, 'import xarray as xr\n'), ((1807, 1848), 'glob.glob',...
#Python wrapper / library for Einstein Analytics API import sys import browser_cookie3 import requests import json import time import datetime from dateutil import tz import pandas as pd import numpy as np import re from pandas import json_normalize from decimal import Decimal import base64 import csv import unicodecsv...
[ "json.dumps", "requests.utils.dict_from_cookiejar", "datetime.datetime.utcnow", "sys.exc_info", "sys.getsizeof", "pandas.DataFrame", "json.loads", "dateutil.tz.tzlocal", "re.findall", "datetime.timedelta", "requests.get", "math.ceil", "pandas.to_datetime", "numpy.issubdtype", "sys.exit",...
[((1998, 2104), 'requests.get', 'requests.get', (["(self.env_url + '/services/data/v48.0/wave/datasets')"], {'headers': 'self.header', 'params': 'params'}), "(self.env_url + '/services/data/v48.0/wave/datasets', headers=\n self.header, params=params)\n", (2010, 2104), False, 'import requests\n'), ((3753, 3790), 're....
import argparse import json import os import numpy as np import utils import util def main(args): config = utils.get_hocon_config(config_path="./config/main.conf", config_name="base") input_file = args.input_file if args.is_training == 0: is_training = False else: is_training = Tru...
[ "numpy.save", "numpy.sum", "argparse.ArgumentParser", "json.loads", "os.path.basename", "numpy.asarray", "util.get_tokenizer", "utils.DataInstance", "utils.get_hocon_config", "numpy.array", "os.path.join", "util.flatten" ]
[((116, 192), 'utils.get_hocon_config', 'utils.get_hocon_config', ([], {'config_path': '"""./config/main.conf"""', 'config_name': '"""base"""'}), "(config_path='./config/main.conf', config_name='base')\n", (138, 192), False, 'import utils\n'), ((338, 377), 'util.get_tokenizer', 'util.get_tokenizer', (['args.tokenizer_n...
# Copyright 2022 MONAI Consortium # 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 writing, s...
[ "json.dump", "pandas.read_csv", "random.shuffle", "os.path.dirname", "os.path.isfile", "numpy.where", "numpy.array", "random.seed", "sklearn.model_selection.GroupKFold", "preprocess_dicom.dicom_preprocess", "numpy.array_split", "numpy.intersect1d", "os.path.join", "numpy.unique" ]
[((3213, 3227), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (3224, 3227), False, 'import random\n'), ((4820, 4846), 'random.shuffle', 'random.shuffle', (['label_data'], {}), '(label_data)\n', (4834, 4846), False, 'import random\n'), ((4959, 4985), 'numpy.array', 'np.array', (['breast_densities'], {}), '(breas...
from .contribution import Contribution import numpy as np from taurex.cache import OpacityCache class AbsorptionContribution(Contribution): """ Computes the contribution to the optical depth occuring from molecular absorption. """ def __init__(self): super().__init__('Absorption') ...
[ "numpy.zeros", "taurex.cache.OpacityCache" ]
[((344, 358), 'taurex.cache.OpacityCache', 'OpacityCache', ([], {}), '()\n', (356, 358), False, 'from taurex.cache import OpacityCache\n'), ((975, 1023), 'numpy.zeros', 'np.zeros', ([], {'shape': '(model.nLayers, wngrid.shape[0])'}), '(shape=(model.nLayers, wngrid.shape[0]))\n', (983, 1023), True, 'import numpy as np\n...
import sys sys.path.append('../') import matplotlib; matplotlib.use('macosx') import time import numpy as np import matplotlib.pyplot as plt import dolfin as dl; dl.set_log_level(40) # ROMML imports from fom.forward_solve import Fin from fom.thermal_fin import get_space from rom.averaged_affine_ROM import AffineROMFi...
[ "matplotlib.pyplot.loglog", "gaussian_field.make_cov_chol", "fom.thermal_fin.get_space", "matplotlib.pyplot.clf", "rom.averaged_affine_ROM.AffineROMFin", "numpy.linalg.norm", "numpy.exp", "numpy.arange", "sys.path.append", "dolfin.inner", "matplotlib.pyplot.cla", "numpy.loadtxt", "numpy.lins...
[((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((54, 78), 'matplotlib.use', 'matplotlib.use', (['"""macosx"""'], {}), "('macosx')\n", (68, 78), False, 'import matplotlib\n'), ((163, 183), 'dolfin.set_log_level', 'dl.set_log_level', (['(40)'], {}), '...
""" There are two useful functions: 1. correlationCoef will tell you the coreelation coefficient of two patches of same size the greater this coefficient is, the similar this two patches are. 2. matchTemplate will automatically go through the whole input 'img' with a sliding window and implement corre...
[ "numpy.std", "numpy.cov", "numpy.zeros" ]
[((938, 948), 'numpy.std', 'np.std', (['g1'], {}), '(g1)\n', (944, 948), True, 'import numpy as np\n'), ((960, 970), 'numpy.std', 'np.std', (['g2'], {}), '(g2)\n', (966, 970), True, 'import numpy as np\n'), ((1030, 1052), 'numpy.cov', 'np.cov', (['array1', 'array2'], {}), '(array1, array2)\n', (1036, 1052), True, 'impo...
"""Miscellaneous ECG Batch utils.""" import functools import pint import numpy as np from sklearn.preprocessing import LabelBinarizer as LB UNIT_REGISTRY = pint.UnitRegistry() def get_units_conversion_factor(old_units, new_units): """Return a multiplicative factor to convert a measured quantity from old t...
[ "functools.wraps", "pint.UnitRegistry", "numpy.hstack" ]
[((160, 179), 'pint.UnitRegistry', 'pint.UnitRegistry', ([], {}), '()\n', (177, 179), False, 'import pint\n'), ((1308, 1329), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1323, 1329), False, 'import functools\n'), ((2239, 2260), 'numpy.hstack', 'np.hstack', (['(1 - Y, Y)'], {}), '((1 - Y, Y))\n', ...
# -*- coding: utf-8 -*- """ Created on Wed Mar 7 08:38:14 2018 @author: <NAME> compute how quickly soccer league tables converge to the final distribution """ import pandas as pd import numpy as np import glob import matplotlib.pyplot as plt from matplotlib import animation from scipy.stats import ent...
[ "matplotlib.pyplot.title", "numpy.sum", "matplotlib.pyplot.clf", "matplotlib.pyplot.axes", "pandas.read_csv", "matplotlib.animation.FuncAnimation", "matplotlib.pyplot.figure", "numpy.exp", "matplotlib.pyplot.gca", "glob.glob", "matplotlib.pyplot.close", "matplotlib.pyplot.cla", "matplotlib.p...
[((389, 398), 'seaborn.set', 'sns.set', ([], {}), '()\n', (396, 398), True, 'import seaborn as sns\n'), ((677, 700), 'glob.glob', 'glob.glob', (['"""data/*.csv"""'], {}), "('data/*.csv')\n", (686, 700), False, 'import glob\n'), ((3399, 3420), 'scipy.optimize.curve_fit', 'curve_fit', (['f', 'xs', 'avg'], {}), '(f, xs, a...
# -*- coding: utf-8 -*- """ Forked in Hydra IMF from Hydra/MUSE on Feb 19, 2018 @author: <NAME> Run pPXF in data """ import os import yaml import numpy as np import matplotlib.pyplot as plt from astropy.io import fits from astropy import constants from astropy.table import Table, vstack, hstack fro...
[ "os.mkdir", "yaml.load", "numpy.nanmedian", "yaml.dump", "numpy.arange", "numpy.exp", "ppxf.ppxf.ppxf", "os.path.join", "os.chdir", "astropy.constants.c.to", "astropy.io.fits.getdata", "matplotlib.pyplot.close", "os.path.exists", "numpy.isfinite", "spectres.spectres", "ppxf.ppxf_util.l...
[((790, 823), 'astropy.table.Table.read', 'Table.read', (['templates_file'], {'hdu': '(1)'}), '(templates_file, hdu=1)\n', (800, 823), False, 'from astropy.table import Table, vstack, hstack\n'), ((946, 966), 'numpy.exp', 'np.exp', (['logwave_temp'], {}), '(logwave_temp)\n', (952, 966), True, 'import numpy as np\n'), (...
from math import exp import cv2 as cv import numpy as np from concurrent.futures import ProcessPoolExecutor from numba import jit from numpy import float32 from tqdm import tqdm from utils import ( get_region_indexes, get_region_centers, associate_index_to_centers, get_window, ) @jit def P(v): re...
[ "math.exp", "utils.get_region_centers", "utils.get_region_indexes", "numpy.sum", "utils.associate_index_to_centers", "numpy.float32", "concurrent.futures.ProcessPoolExecutor", "numpy.zeros", "utils.get_window", "numpy.amax", "cv2.split", "numpy.array", "cv2.merge" ]
[((787, 845), 'utils.get_region_indexes', 'get_region_indexes', (['imgs[0].shape[0]', 'imgs[0].shape[1]', '(10)'], {}), '(imgs[0].shape[0], imgs[0].shape[1], 10)\n', (805, 845), False, 'from utils import get_region_indexes, get_region_centers, associate_index_to_centers, get_window\n'), ((1586, 1609), 'numpy.zeros', 'n...
""" 2018, University of Freiburg. <NAME> <<EMAIL>> """ import os import argparse import pickle import numpy as np import re from sklearn.metrics import accuracy_score, precision_score, recall_score from concept_neuron import split_train_valid_test, process_sentence_pos_tags from concept_neuron import print_pos_tag_stat...
[ "concept_neuron.print_pos_tag_statistics", "argparse.ArgumentParser", "os.makedirs", "numpy.argmax", "os.path.isdir", "sklearn.metrics.accuracy_score", "os.path.exists", "concept_neuron.split_train_valid_test", "sklearn.metrics.recall_score", "numpy.array", "re.search", "concept_neuron.process...
[((1446, 1500), 'concept_neuron.process_sentence_pos_tags', 'process_sentence_pos_tags', (['input_file', 'args.group_tags'], {}), '(input_file, args.group_tags)\n', (1471, 1500), False, 'from concept_neuron import split_train_valid_test, process_sentence_pos_tags\n'), ((1596, 1667), 'numpy.unique', 'np.unique', (['[y[1...
import numpy as np import random as rnd import pdb def dist(loc1,loc2): return np.sqrt((loc1[0]-loc2[0])**2 + (loc2[1]-loc1[1])**2) #### BUG WHEN LEN(x) != LEN(y) class Generate_field(): def __init__(self,a,b,n,x,y,opt=''): self.xlen=len(x) self.ylen=len(y) self.a = a*rnd.uniform(...
[ "numpy.meshgrid", "random.randint", "random.uniform", "numpy.zeros", "random.choice", "numpy.shape", "numpy.sin", "numpy.exp", "numpy.cos", "numpy.sqrt" ]
[((88, 148), 'numpy.sqrt', 'np.sqrt', (['((loc1[0] - loc2[0]) ** 2 + (loc2[1] - loc1[1]) ** 2)'], {}), '((loc1[0] - loc2[0]) ** 2 + (loc2[1] - loc1[1]) ** 2)\n', (95, 148), True, 'import numpy as np\n'), ((5131, 5192), 'numpy.zeros', 'np.zeros', (['(N, self.xlen + 2 * margin, self.ylen + 2 * margin)'], {}), '((N, self....
"""Functions for getting data needed to fit the models.""" import bs4 from datetime import datetime import matplotlib.pyplot as plt import numpy as np import pandas as pd import requests from tqdm import tqdm from typing import Union from urllib.error import HTTPError import urllib.request, json import os from datetim...
[ "matplotlib.pyplot.title", "os.remove", "pandas.read_csv", "numpy.isnan", "matplotlib.pyplot.figure", "pandas.DataFrame", "os.path.exists", "datetime.timedelta", "pandas.concat", "datetime.datetime.strftime", "tqdm.tqdm", "numpy.corrcoef", "matplotlib.pyplot.legend", "datetime.date", "da...
[((4997, 5035), 'tqdm.tqdm', 'tqdm', (['good_countries'], {'desc': '"""Countries"""'}), "(good_countries, desc='Countries')\n", (5001, 5035), False, 'from tqdm import tqdm\n'), ((6806, 6836), 'tqdm.tqdm', 'tqdm', (['states'], {'desc': '"""US States"""'}), "(states, desc='US States')\n", (6810, 6836), False, 'from tqdm ...
from ctypes import * from athena import ndarray from athena.stream import * import numpy as np from enum import Enum import os def _load_nccl_lib(): """Load libary in build/lib.""" curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) lib_path = os.path.join(curr_path, '../../../build/...
[ "os.path.expanduser", "athena.ndarray.gpu", "numpy.zeros", "numpy.ones", "os.path.join" ]
[((280, 326), 'os.path.join', 'os.path.join', (['curr_path', '"""../../../build/lib/"""'], {}), "(curr_path, '../../../build/lib/')\n", (292, 326), False, 'import os\n'), ((349, 402), 'os.path.join', 'os.path.join', (['lib_path', '"""lib_mpi_nccl_runtime_api.so"""'], {}), "(lib_path, 'lib_mpi_nccl_runtime_api.so')\n", ...
import numpy as np import warnings from scipy import stats from six import string_types import matplotlib.pyplot as plt from scipy.integrate import trapz from explore.utils import Proportions try: import statsmodels.nonparametric.api as smnp _has_statsmodels = True except ImportError: _has_statsmodels = ...
[ "numpy.zeros_like", "matplotlib.pyplot.gca", "numpy.std", "scipy.stats.gaussian_kde", "explore.utils.Proportions", "numpy.array", "numpy.linspace", "scipy.integrate.trapz", "warnings.warn", "statsmodels.nonparametric.api.KDEUnivariate", "numpy.unique" ]
[((4001, 4025), 'statsmodels.nonparametric.api.KDEUnivariate', 'smnp.KDEUnivariate', (['data'], {}), '(data)\n', (4019, 4025), True, 'import statsmodels.nonparametric.api as smnp\n'), ((5167, 5214), 'numpy.linspace', 'np.linspace', (['support_min', 'support_max', 'gridsize'], {}), '(support_min, support_max, gridsize)\...
from abc import ABCMeta, abstractmethod import numpy as np class ProposalDistribution(metaclass=ABCMeta): @abstractmethod def __init__(self): ... @abstractmethod def sample(self, x: np.ndarray) -> np.ndarray: ... @abstractmethod def pdf(self, x: np.ndarray, cond: np.ndarray)...
[ "numpy.random.uniform", "numpy.array", "numpy.exp", "numpy.random.normal", "numpy.sqrt" ]
[((1248, 1273), 'numpy.array', 'np.array', (['(1 / self.spread)'], {}), '(1 / self.spread)\n', (1256, 1273), True, 'import numpy as np\n'), ((662, 708), 'numpy.random.normal', 'np.random.normal', (['self.mean', 'self.std', 'x.shape'], {}), '(self.mean, self.std, x.shape)\n', (678, 708), True, 'import numpy as np\n'), (...
from __future__ import print_function import numpy as np try: from builtins import range, zip except: pass def fermi_dirac(e_fermi, delta, energy): """ Return fermi-dirac distribution weight. """ x = (energy - e_fermi)/delta if x < -200: f = 1. elif x > 200: f = 0. ...
[ "numpy.sum", "numpy.exp", "builtins.zip" ]
[((500, 520), 'builtins.zip', 'zip', (['e_kn', 'w_k', 'nb_k'], {}), '(e_kn, w_k, nb_k)\n', (503, 520), False, 'from builtins import range, zip\n'), ((607, 616), 'numpy.sum', 'np.sum', (['f'], {}), '(f)\n', (613, 616), True, 'import numpy as np\n'), ((343, 352), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (349, 352), T...
import numpy as np import math def softmax(src): # Get size of input vector rows, cols = src.shape # Checking if rows > 1: raise Exception("Input rows > 1") # Find softmax expVec = np.exp(src) return expVec / np.sum(expVec) def softmax_derivative(src): # Get size of input vec...
[ "numpy.sum", "numpy.zeros", "numpy.exp" ]
[((216, 227), 'numpy.exp', 'np.exp', (['src'], {}), '(src)\n', (222, 227), True, 'import numpy as np\n'), ((496, 518), 'numpy.zeros', 'np.zeros', (['(cols, cols)'], {}), '((cols, cols))\n', (504, 518), True, 'import numpy as np\n'), ((848, 867), 'numpy.zeros', 'np.zeros', (['(1, cols)'], {}), '((1, cols))\n', (856, 867...
import numpy as np from scipy import sparse import scipy.sparse.linalg as spla import pylab as plt from scipy.linalg import block_diag # # nSub = 2 def load_matrix_basic(pathToFile,makeSparse,makeSymmetric, offset): f0 = open(pathToFile).readlines() firstLine = f0.pop(0) #removes the first line tmp = np.z...
[ "numpy.abs", "numpy.concatenate", "numpy.zeros", "numpy.hstack", "scipy.sparse.csc_matrix", "numpy.loadtxt", "numpy.int32", "numpy.dot", "numpy.linalg.solve", "numpy.vstack" ]
[((6585, 6623), 'numpy.loadtxt', 'np.loadtxt', (["(path0 + '/dump_weigth.txt')"], {}), "(path0 + '/dump_weigth.txt')\n", (6595, 6623), True, 'import numpy as np\n'), ((5559, 5590), 'numpy.hstack', 'np.hstack', (['(Fc_clust, Gc_clust)'], {}), '((Fc_clust, Gc_clust))\n', (5568, 5590), True, 'import numpy as np\n'), ((559...
from galaxy_analysis.plot.plot_styles import * import matplotlib.pyplot as plt import os, sys import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable def bins_from_centers(x): xnew = np.zeros(len(x) + 1) dx = np.zeros(len(x) + 1) dx[1:-1] = x[1:] - x[:-1] dx[0] = dx[1] dx[-1]...
[ "mpl_toolkits.axes_grid1.make_axes_locatable", "matplotlib.pyplot.tight_layout", "numpy.size", "numpy.meshgrid", "matplotlib.pyplot.close", "numpy.genfromtxt", "numpy.min", "numpy.max", "matplotlib.pyplot.minorticks_on", "numpy.log10", "matplotlib.pyplot.subplots" ]
[((580, 603), 'numpy.genfromtxt', 'np.genfromtxt', (['datafile'], {}), '(datafile)\n', (593, 603), True, 'import numpy as np\n'), ((1047, 1077), 'numpy.meshgrid', 'np.meshgrid', (['LW_vals', 'k27_vals'], {}), '(LW_vals, k27_vals)\n', (1058, 1077), True, 'import numpy as np\n'), ((1116, 1152), 'numpy.meshgrid', 'np.mesh...
# Imports --------------------------------------------------------------------- # Python import argparse import joblib import yaml import os.path as osp from collections import defaultdict import joblib import os # PyTorch import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Va...
[ "yaml.load", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "rlkit.torch.pytorch_util.gpu_enabled", "observations.multi_mnist", "rlkit.launchers.launcher_util.set_seed", "torch.FloatTensor", "numpy.array", "torch.utils.data.TensorDataset", "rlkit.torch.pytorch_util.set_gpu_mode", "gen...
[((906, 944), 'rlkit.torch.pytorch_util.set_gpu_mode', 'ptu.set_gpu_mode', (["exp_specs['use_gpu']"], {}), "(exp_specs['use_gpu'])\n", (922, 944), True, 'import rlkit.torch.pytorch_util as ptu\n'), ((1130, 1144), 'rlkit.launchers.launcher_util.set_seed', 'set_seed', (['seed'], {}), '(seed)\n', (1138, 1144), False, 'fro...
import os import pickle import numpy as np import PIL.Image import dnnlib import dnnlib.tflib as tflib import config from training import misc synthesis_kwargs = dict(minibatch_size=8) _Gs_cache = dict() def load_Gs(url): if url not in _Gs_cache: with dnnlib.util.open_url(url, cache_dir=config.cache_dir...
[ "numpy.sum", "os.makedirs", "training.misc.load_pkl", "numpy.empty_like", "numpy.random.RandomState", "dnnlib.util.open_url", "pickle.load", "training.misc.save_image_grid", "dnnlib.tflib.init_tf" ]
[((2768, 2783), 'dnnlib.tflib.init_tf', 'tflib.init_tf', ([], {}), '()\n', (2781, 2783), True, 'import dnnlib.tflib as tflib\n'), ((2788, 2833), 'os.makedirs', 'os.makedirs', (['config.result_dir'], {'exist_ok': '(True)'}), '(config.result_dir, exist_ok=True)\n', (2799, 2833), False, 'import os\n'), ((2897, 2923), 'tra...
# -*- coding: utf-8 -*- import time import numpy as np from classes import Debug, KalmanFilter import smbus bus = smbus.SMBus(2) # bus = smbus.SMBus(0) fuer Revision 1 address = 0x68 # via i2cdetect power_mgmt_1 = 0x6b ACCEL_CONFIG = 0x1C # Reg 28 ACCEL_CONFIG2 = 0x1D # Reg 29 class Imu(Debug, KalmanFilter): ...
[ "classes.Debug", "numpy.median", "classes.KalmanFilter", "numpy.array", "smbus.SMBus" ]
[((115, 129), 'smbus.SMBus', 'smbus.SMBus', (['(2)'], {}), '(2)\n', (126, 129), False, 'import smbus\n'), ((377, 389), 'classes.Debug', 'Debug', (['"""imu"""'], {}), "('imu')\n", (382, 389), False, 'from classes import Debug, KalmanFilter\n'), ((730, 775), 'numpy.array', 'np.array', (['[[1, dt, 0], [0, 1, dt], [0, 0, 1...
from os import path import os import matplotlib.pyplot as plt import numpy as np import autofit as af """ The `analysis.py` module contains the dataset and log likelihood function which given a model instance (set up by the non-linear search) fits the dataset and returns the log likelihood of that model. ""...
[ "matplotlib.pyplot.title", "os.makedirs", "matplotlib.pyplot.clf", "numpy.arange", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join", "matplotlib.pyplot.errorbar" ]
[((1484, 1513), 'numpy.arange', 'np.arange', (['self.data.shape[0]'], {}), '(self.data.shape[0])\n', (1493, 1513), True, 'import numpy as np\n'), ((3328, 3357), 'numpy.arange', 'np.arange', (['self.data.shape[0]'], {}), '(self.data.shape[0])\n', (3337, 3357), True, 'import numpy as np\n'), ((3644, 3754), 'matplotlib.py...
import numpy as np import pandas as pd from veneer.pest_runtime import * from veneer.manage import start,kill_all_now import pyapprox as pya from functools import partial from pyapprox.adaptive_sparse_grid import max_level_admissibility_function from pyapprox.adaptive_polynomial_chaos import variance_pce_refinement_...
[ "pandas.DataFrame", "functools.partial", "pandas.Timestamp", "funcs.modeling_funcs.modeling_settings", "pyapprox.variable_transformations.AffineRandomVariableTransformation", "pandas.read_csv", "funcs.read_data.variables_prep", "funcs.read_data.file_settings", "funcs.modeling_funcs.generate_observat...
[((872, 891), 'funcs.modeling_funcs.modeling_settings', 'modeling_settings', ([], {}), '()\n', (889, 891), False, 'from funcs.modeling_funcs import modeling_settings, generate_observation_ensemble\n'), ((911, 973), 'funcs.modeling_funcs.paralell_vs', 'paralell_vs', (['first_port', 'num_copies', 'project_name', 'veneer_...
# Source: https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_Tune_XLSR_Wav2Vec2_on_Turkish_ASR_with_%F0%9F%A4%97_Transformers.ipynb#scrollTo=lbQf5GuZyQ4_ import collections from dataclasses import dataclass from typing import Any, Dict, List, Optional, Union import numpy as np import...
[ "torch.cuda.amp.autocast", "tqdm.tqdm", "transformers.trainer_pt_utils.DistributedLengthGroupedSampler", "numpy.argmax", "datasets.load_metric", "transformers.trainer_pt_utils.LengthGroupedSampler" ]
[((7687, 7705), 'datasets.load_metric', 'load_metric', (['"""wer"""'], {}), "('wer')\n", (7698, 7705), False, 'from datasets import load_metric\n'), ((7822, 7853), 'numpy.argmax', 'np.argmax', (['pred_logits'], {'axis': '(-1)'}), '(pred_logits, axis=-1)\n', (7831, 7853), True, 'import numpy as np\n'), ((5953, 5995), 't...
import numpy, sys, math, batman import matplotlib.pyplot as plt from scipy import interpolate file = numpy.load('GJ436b_Trans_SED.npz') SEDarray = file['SEDarray'] print(SEDarray.shape) plt.imshow(SEDarray) plt.show() stellarwave, stellarspec = numpy.loadtxt('ODFNEW_GJ436.spec', unpack=True, skiprows=800) stellarwave...
[ "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "numpy.where", "numpy.loadtxt", "numpy.linspace", "scipy.interpolate.interp1d", "numpy.savez", "batman.TransitModel", "numpy.delete", "numpy.vstack" ]
[((102, 136), 'numpy.load', 'numpy.load', (['"""GJ436b_Trans_SED.npz"""'], {}), "('GJ436b_Trans_SED.npz')\n", (112, 136), False, 'import numpy, sys, math, batman\n'), ((187, 207), 'matplotlib.pyplot.imshow', 'plt.imshow', (['SEDarray'], {}), '(SEDarray)\n', (197, 207), True, 'import matplotlib.pyplot as plt\n'), ((208,...
import math import sklearn.cluster as clstr import cv2 import numpy as np from PIL import Image, ImageOps, ImageDraw import os, glob import matplotlib.pyplot as pyplt import scipy.cluster.vq as vq import argparse import glob # We can specify these if need be. brodatz = "D:\\ImageProcessing\\project\\OriginalBrodatz\\...
[ "PIL.Image.new", "os.remove", "numpy.concatenate", "PIL.ImageOps.fit", "sklearn.cluster.KMeans", "math.floor", "PIL.Image.open", "cv2.imread", "cv2.normalize", "glob.glob", "PIL.ImageDraw.Draw", "os.listdir", "scipy.cluster.vq.whiten", "argparse.ArgumentTypeError" ]
[((1992, 2017), 'scipy.cluster.vq.whiten', 'vq.whiten', (['featureVectors'], {}), '(featureVectors)\n', (2001, 2017), True, 'import scipy.cluster.vq as vq\n'), ((4589, 4615), 'sklearn.cluster.KMeans', 'clstr.KMeans', ([], {'n_clusters': 'k'}), '(n_clusters=k)\n', (4601, 4615), True, 'import sklearn.cluster as clstr\n')...
# Copyright 2018 @<NAME>. 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 law or agre...
[ "helpers.batch", "argparse.ArgumentParser", "os.getcwd", "sklearn.metrics.accuracy_score", "numpy.mean", "numpy.array", "scipy.spatial.distance.pdist", "numpy.random.choice", "itertools.chain.from_iterable", "os.listdir" ]
[((715, 726), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (724, 726), False, 'import os\n'), ((7932, 7957), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7955, 7957), False, 'import argparse\n'), ((10449, 10474), 'os.listdir', 'os.listdir', (['"""nyt_sample/"""'], {}), "('nyt_sample/')\n", (1...
import pandas as pd import numpy as np from sklearn.metrics import accuracy_score import torch from torch.utils.data import DataLoader import torch.optim as optim from model import CassavaModel from loss import DenseCrossEntropy import dataset from config import * def train_one_fold(fold, model, optimizer): df = p...
[ "loss.DenseCrossEntropy", "torch.utils.data.DataLoader", "dataset.CassavaDataset", "pandas.read_csv", "torch.argmax", "numpy.zeros", "torch.cat", "torch.softmax", "torch.optim.Adam", "torch.device", "torch.no_grad", "model.CassavaModel" ]
[((319, 355), 'pandas.read_csv', 'pd.read_csv', (['"""./input/train_ohe.csv"""'], {}), "('./input/train_ohe.csv')\n", (330, 355), True, 'import pandas as pd\n'), ((487, 534), 'dataset.CassavaDataset', 'dataset.CassavaDataset', (['train_df'], {'device': 'DEVICE'}), '(train_df, device=DEVICE)\n', (509, 534), False, 'impo...
import numpy as np from ipec.ip.core import parse_subnet_str from ipec.ip.core import IPStructure from ipec.ip.core import Interface from ipec.ip.encoder import Encoder from ipec.ip.decoder import Decoder from ipec.ip.core import max_decimal_value_of_binary # convolutional layer fields CONV_FIELDS = { 'filter_siz...
[ "ipec.ip.core.IPStructure", "ipec.ip.core.max_decimal_value_of_binary", "ipec.ip.core.parse_subnet_str", "numpy.random.randint", "ipec.ip.encoder.Encoder", "ipec.ip.decoder.Decoder" ]
[((3939, 3967), 'ipec.ip.core.parse_subnet_str', 'parse_subnet_str', (['str_subnet'], {}), '(str_subnet)\n', (3955, 3967), False, 'from ipec.ip.core import parse_subnet_str\n'), ((3996, 4015), 'ipec.ip.core.IPStructure', 'IPStructure', (['fields'], {}), '(fields)\n', (4007, 4015), False, 'from ipec.ip.core import IPStr...
""" This file holds common functions across all database processing such as calculating statistics. """ import numpy as np from src import em_constants as emc def is_outlier(wav, lower, upper): """ Checks if an audio sample is an outlier. Bounds are inclusive. :param wav: The audio time series data poi...
[ "numpy.floor", "numpy.zeros", "numpy.any", "numpy.max", "numpy.where", "numpy.unique" ]
[((2301, 2337), 'numpy.unique', 'np.unique', (['label'], {'return_counts': '(True)'}), '(label, return_counts=True)\n', (2310, 2337), True, 'import numpy as np\n'), ((2356, 2382), 'numpy.zeros', 'np.zeros', (['emc.NUM_EMOTIONS'], {}), '(emc.NUM_EMOTIONS)\n', (2364, 2382), True, 'import numpy as np\n'), ((3212, 3249), '...
import unittest from time import time from pickle import load, dump from tempfile import mkstemp from random import choice, randint from string import ascii_letters from numpy import corrcoef, random, abs, max, asarray, round, zeros_like from trlda.models import BatchLDA from trlda.utils import sample_dirichlet class...
[ "unittest.main", "trlda.models.BatchLDA", "pickle.dump", "numpy.zeros_like", "numpy.abs", "random.randint", "tempfile.mkstemp", "pickle.load", "numpy.random.rand" ]
[((2869, 2884), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2882, 2884), False, 'import unittest\n'), ((438, 495), 'trlda.models.BatchLDA', 'BatchLDA', ([], {'num_words': 'W', 'num_topics': 'K', 'alpha': 'alpha', 'eta': 'eta'}), '(num_words=W, num_topics=K, alpha=alpha, eta=eta)\n', (446, 495), False, 'from tr...
#!/usr/bin/env python import math import numpy as np from . import linalg as la from . import eulang #Euler angle sequence: XYZ (world). First rotation about X, second rotation #about Y, and the third rotation about Z axis of the world(i.e. fixed) frame. #This is the same as the sequence used in Blender. #In contrast...
[ "numpy.trace", "numpy.empty", "numpy.einsum", "numpy.sin", "numpy.linalg.norm", "numpy.diag", "math.fmod", "numpy.copy", "numpy.identity", "math.cos", "numpy.linalg.det", "math.sqrt", "numpy.cross", "math.sin", "numpy.cos", "numpy.dot", "numpy.vstack", "numpy.zeros", "math.acos",...
[((784, 813), 'math.fmod', 'math.fmod', (['angle', '(2 * math.pi)'], {}), '(angle, 2 * math.pi)\n', (793, 813), False, 'import math\n'), ((1187, 1201), 'numpy.zeros', 'np.zeros', (['(3,)'], {}), '((3,))\n', (1195, 1201), True, 'import numpy as np\n'), ((1561, 1582), 'numpy.sqrt', 'np.sqrt', (['(1.0 - zetasq)'], {}), '(...
import sklearn.datasets as datasets from numpywren.matrix import BigMatrix from numpywren import matrix_utils, binops from numpywren.matrix_init import shard_matrix import pytest import numpy as np import pywren import unittest class IndexingTestClass(unittest.TestCase): def test_single_shard_index_get(self): ...
[ "numpywren.matrix_init.shard_matrix", "numpywren.matrix.BigMatrix", "numpy.all", "numpy.random.randn" ]
[((329, 354), 'numpy.random.randn', 'np.random.randn', (['(128)', '(128)'], {}), '(128, 128)\n', (344, 354), True, 'import numpy as np\n'), ((375, 430), 'numpywren.matrix.BigMatrix', 'BigMatrix', (['"""test_0"""'], {'shape': 'X.shape', 'shard_sizes': 'X.shape'}), "('test_0', shape=X.shape, shard_sizes=X.shape)\n", (384...
from gensim import models import json import numpy as np MODEL_VERSION = "glove-wiki-gigaword-300" model = models.KeyedVectors.load_word2vec_format(MODEL_VERSION) def get_word_vec(word_list): """ This method will get the vector of the given word :param word_list: list of a single word string :return...
[ "json.load", "numpy.array", "gensim.models.KeyedVectors.load_word2vec_format", "json.dumps" ]
[((109, 164), 'gensim.models.KeyedVectors.load_word2vec_format', 'models.KeyedVectors.load_word2vec_format', (['MODEL_VERSION'], {}), '(MODEL_VERSION)\n', (149, 164), False, 'from gensim import models\n'), ((3927, 3945), 'json.dumps', 'json.dumps', (['result'], {}), '(result)\n', (3937, 3945), False, 'import json\n'), ...
#!/usr/bin/env python # coding: utf-8 # In[1]: import os project_name = "reco-tut-mlh"; branch = "main"; account = "sparsh-ai" project_path = os.path.join('/content', project_name) # In[2]: if not os.path.exists(project_path): get_ipython().system(u'cp /content/drive/MyDrive/mykeys.py /content') import m...
[ "tensorflow.python.framework.ops.disable_eager_execution", "numpy.random.seed", "models.GCN.LightGCN", "pandas.read_csv", "build_features.AffinityMatrix", "os.path.join", "metrics.mean_average_precision", "numpy.mat", "pandas.DataFrame", "sys.path.append", "numpy.power", "pandas.merge", "sur...
[((145, 183), 'os.path.join', 'os.path.join', (['"""/content"""', 'project_name'], {}), "('/content', project_name)\n", (157, 183), False, 'import os\n'), ((1194, 1222), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./code"""'], {}), "(0, './code')\n", (1209, 1222), False, 'import sys\n'), ((2517, 2556), 'os.path....
import yaml import numpy as np import logging logger = logging.getLogger("cm.conf") class ControlModelParameters: """ Load parameters from .yaml file. """ def __init__(self): self._config = None self.wind_farm = None self.turbine = None self.simulation = None ...
[ "yaml.load", "numpy.deg2rad", "yaml.dump", "numpy.array", "logging.getLogger" ]
[((56, 84), 'logging.getLogger', 'logging.getLogger', (['"""cm.conf"""'], {}), "('cm.conf')\n", (73, 84), False, 'import logging\n'), ((991, 1039), 'yaml.load', 'yaml.load', ([], {'stream': 'stream', 'Loader': 'yaml.SafeLoader'}), '(stream=stream, Loader=yaml.SafeLoader)\n', (1000, 1039), False, 'import yaml\n'), ((107...
# !/usr/bin/python # -*- coding:UTF-8 -*- # -----------------------------------------------------------------------# # File Name: textrank_keyword # Author: <NAME> # Mail: <EMAIL> # Created Time: 2021-09-04 # Description: # -----------------------------------------------------------------------# import networkx as nx...
[ "knlp.utils.util.get_default_stop_words_file", "networkx.from_numpy_matrix", "networkx.pagerank", "knlp.utils.util.AttrDict", "numpy.zeros" ]
[((874, 903), 'knlp.utils.util.get_default_stop_words_file', 'get_default_stop_words_file', ([], {}), '()\n', (901, 903), False, 'from knlp.utils.util import get_default_stop_words_file, AttrDict\n'), ((4301, 4339), 'numpy.zeros', 'np.zeros', (['(words_number, words_number)'], {}), '((words_number, words_number))\n', (...
import os,sys from PIL import Image import numpy LETTER_NB = 5 LETTER_SPACE = 1 LETTER_SIZE = 8 LETTER_LEFT = 10 LETTER_RIGHT = 16 class CaptchaReader(object): """docstring for CaptchaReader""" def __init__(self, folderDico): super(CaptchaReader, self).__init__() self.folderDico = folderDico + "/" def read(s...
[ "PIL.Image.open", "PIL.Image.fromarray", "numpy.array", "numpy.array_equal", "os.listdir" ]
[((1149, 1189), 'numpy.array_equal', 'numpy.array_equal', (['symb_np', '(im_dic / 255)'], {}), '(symb_np, im_dic / 255)\n', (1166, 1189), False, 'import numpy\n'), ((1794, 1814), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (1804, 1814), False, 'from PIL import Image\n'), ((1824, 1846), 'numpy.ar...
import xlrd # from xlutils.copy import copy as xlscopy import shutil import os from numpy import sqrt, abs import sys sys.path.append('../..') # 如果最终要从main.py调用,则删掉这句 from GeneralMethod.PyCalcLib import Fitting from GeneralMethod.PyCalcLib import Method from reportwriter.ReportWriter import ReportWriter c...
[ "sys.path.append", "numpy.abs", "GeneralMethod.PyCalcLib.Fitting.linear", "reportwriter.ReportWriter.ReportWriter", "xlrd.open_workbook", "GeneralMethod.PyCalcLib.Method.a_uncertainty", "sys.exit", "os.startfile" ]
[((126, 150), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (141, 150), False, 'import sys\n'), ((6025, 6087), 'GeneralMethod.PyCalcLib.Fitting.linear', 'Fitting.linear', (['list_time1', 'list_temperature1'], {'show_plot': '(False)'}), '(list_time1, list_temperature1, show_plot=False)\n', ...
# Authors: <NAME> (lambertt) and <NAME> (odafaluy) import numpy import scipy import scipy.linalg import plot class Matrix: """ Provides Methods for operations with an hilbert- or a special triangular matrix. """ def __init__(self, mtype, dim, dtype): """ Initializes the class instan...
[ "scipy.linalg.hilbert", "scipy.linalg.solve_triangular", "numpy.identity", "scipy.linalg.lu", "scipy.linalg.inv", "numpy.array", "numpy.linalg.norm", "numpy.dot", "plot.plot" ]
[((4016, 4028), 'plot.plot', 'plot.plot', (['n'], {}), '(n)\n', (4025, 4028), False, 'import plot\n'), ((4435, 4465), 'numpy.identity', 'numpy.identity', (['n'], {'dtype': 'dtype'}), '(n, dtype=dtype)\n', (4449, 4465), False, 'import numpy\n'), ((1860, 1894), 'numpy.array', 'numpy.array', (['arr'], {'dtype': 'self.dtyp...
"""Trajectory Generator for in-place stepping motion for quadruped robot.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import numpy as np TWO_PI = 2 * math.pi def _get_actions_asymmetric_sine(phase, tg_params): """Returns the leg exte...
[ "numpy.sin", "numpy.where", "numpy.array", "numpy.fmod" ]
[((843, 943), 'numpy.where', 'np.where', (['(phase < stance_lift_cutoff)', "tg_params['amplitude_stance']", "tg_params['amplitude_lift']"], {}), "(phase < stance_lift_cutoff, tg_params['amplitude_stance'],\n tg_params['amplitude_lift'])\n", (851, 943), True, 'import numpy as np\n'), ((978, 1132), 'numpy.where', 'np....
# Adapted from: # https://www.analyticsvidhya.com/blog/2016/08/beginners-guide-to-topic-modeling-in-python/ import read_bibtex import os, shutil from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer from nltk.stem.porter import PorterStemmer import string import gensim from gensim import c...
[ "os.mkdir", "shutil.rmtree", "nltk.stem.porter.PorterStemmer", "gensim.corpora.Dictionary", "numpy.array", "nltk.corpus.stopwords.words", "nltk.stem.wordnet.WordNetLemmatizer", "read_bibtex.bibtex_tostring_from", "os.listdir" ]
[((670, 689), 'nltk.stem.wordnet.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (687, 689), False, 'from nltk.stem.wordnet import WordNetLemmatizer\n'), ((700, 715), 'nltk.stem.porter.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (713, 715), False, 'from nltk.stem.porter import PorterStemmer\n'), ((397...
import json import numpy as np import pandas as pd pd.options.mode.chained_assignment = None from sklearn.preprocessing import Imputer, StandardScaler import DataSource import os.path class NYK(DataSource.DataSource): def __init__(self, app, dsrc_name='', dsrc_type='csv', dsrc_path='data/', file_name='', header_r...
[ "DataSource.DataSource.__init__", "sklearn.preprocessing.StandardScaler", "sklearn.preprocessing.Imputer", "numpy.tan", "pandas.to_datetime" ]
[((417, 469), 'DataSource.DataSource.__init__', 'DataSource.DataSource.__init__', (['self', 'app', 'dsrc_name'], {}), '(self, app, dsrc_name)\n', (447, 469), False, 'import DataSource\n'), ((1863, 1918), 'sklearn.preprocessing.Imputer', 'Imputer', ([], {'missing_values': 'np.nan', 'strategy': 'method', 'axis': '(1)'}),...
import numpy as np import torch from .base_wrapper import BaseWrapper from torch.autograd.functional import hvp, vhp, hessian from typing import List, Tuple, Dict, Union, Callable from torch import nn, Tensor class TorchWrapper(BaseWrapper): def __init__(self, func, precision='float32', hvp_type='vhp', device='cp...
[ "torch.autograd.functional.hessian", "numpy.concatenate", "torch.autograd.grad", "torch.cat", "numpy.reshape", "torch.device", "torch.is_tensor", "torch.tensor" ]
[((1248, 1289), 'torch.autograd.grad', 'torch.autograd.grad', (['loss', 'input_var_grad'], {}), '(loss, input_var_grad)\n', (1267, 1289), False, 'import torch\n'), ((2621, 2686), 'torch.tensor', 'torch.tensor', (['input_var'], {'dtype': 'self.precision', 'device': 'self.device'}), '(input_var, dtype=self.precision, dev...
import numpy as np from utils import pick_discrete class PseudoMarginalData(object): def __init__(self, data, interim_prior): # Data should have dims [NOBJ, NSAMPLE, NDIM] or [NOBJ, NSAMPLE] if NDIM is 1 # interim_prior should have dims [NOBJ, NSAMPLE] self.data = data self.interim...
[ "numpy.sum", "utils.pick_discrete" ]
[((1570, 1588), 'numpy.sum', 'np.sum', (['ps'], {'axis': '(1)'}), '(ps, axis=1)\n', (1576, 1588), True, 'import numpy as np\n'), ((1642, 1658), 'utils.pick_discrete', 'pick_discrete', (['p'], {}), '(p)\n', (1655, 1658), False, 'from utils import pick_discrete\n')]
import pefile import numpy as np # import os execs = [ "1F2EB7B090018D975E6D9B40868C94CA", "33DE5067A433A6EC5C328067DC18EC37", "65018CD542145A3792BA09985734C12A", "<KEY>", "<KEY>", "<KEY>", "<KEY>", "<KEY>", "A316D5AECA269CA865077E7FFF356E7D", "<KEY>", "AL65_DB05DF0498B59B42A8E493CF3C10C578", "B07322743778B5868475DBE...
[ "pandas.DataFrame", "pefile.PE", "numpy.array", "numpy.unique" ]
[((5899, 5923), 'pandas.DataFrame', 'pd.DataFrame', (['granPrueba'], {}), '(granPrueba)\n', (5911, 5923), True, 'import pandas as pd\n'), ((2017, 2029), 'pefile.PE', 'pefile.PE', (['a'], {}), '(a)\n', (2026, 2029), False, 'import pefile\n'), ((5981, 5996), 'numpy.array', 'np.array', (['list1'], {}), '(list1)\n', (5989,...
import numpy as np #TODO: #1. create a streamlined and replicable gif creation set of functions in this file. #2. implement these functions into the generation algorithms available. def convert_2d(index, cols): return (index // cols, index % cols) def bounds_check(index, rows, cols): if index[0] < 0 or index[...
[ "numpy.array_equal" ]
[((3427, 3462), 'numpy.array_equal', 'np.array_equal', (['newIMG', 'gif_arr[-1]'], {}), '(newIMG, gif_arr[-1])\n', (3441, 3462), True, 'import numpy as np\n'), ((3805, 3840), 'numpy.array_equal', 'np.array_equal', (['newIMG', 'gif_arr[-1]'], {}), '(newIMG, gif_arr[-1])\n', (3819, 3840), True, 'import numpy as np\n')]
import contextlib import logging import logging.config import random import time from pathlib import Path import hp_transfer_benchmarks # pylint: disable=unused-import import hp_transfer_optimizers # pylint: disable=unused-import import hydra import numpy as np import yaml from gitinfo import gitinfo from hp_trans...
[ "omegaconf.OmegaConf.to_yaml", "hp_transfer_aa_experiments.analyse.read_results.get_batch_result_row", "numpy.random.seed", "hydra.utils.to_absolute_path", "hydra.utils.instantiate", "contextlib.suppress", "time.sleep", "hp_transfer_optimizers.core.result.TrajectoryResult", "pathlib.Path", "random...
[((608, 659), 'logging.getLogger', 'logging.getLogger', (['"""hp_transfer_aa_experiments.run"""'], {}), "('hp_transfer_aa_experiments.run')\n", (625, 659), False, 'import logging\n'), ((7222, 7274), 'hydra.main', 'hydra.main', ([], {'config_path': '"""configs"""', 'config_name': '"""run"""'}), "(config_path='configs', ...
import numpy as np import pytest from packaging.utils import Version import fast_numpy_loops old_numpy = Version(np.__version__) < Version('1.18') @pytest.fixture(scope='session') def initialize_fast_numpy_loops(): fast_numpy_loops.initialize() @pytest.fixture(scope='function') def rng(): if old_numpy: ...
[ "numpy.random.default_rng", "fast_numpy_loops.initialize", "pytest.fixture", "packaging.utils.Version" ]
[((150, 181), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (164, 181), False, 'import pytest\n'), ((253, 285), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (267, 285), False, 'import pytest\n'), ((106, 129), 'packaging.uti...
# -*- encoding: utf-8 -*- def extract_feature_pixel(img, mask_1, mask_0=[], mask_2=[], mask_3=[], mask_4=[], mask_5=[], dim_prof=0): import numpy as np #Função de leitura da imagem e máscaras, e retorna array de pixel como atributo n = img.shape[dim_prof] t1 = img[mask_1].size/n t0 = img[mask_0]....
[ "numpy.vstack", "numpy.zeros", "numpy.ones", "numpy.concatenate" ]
[((451, 467), 'numpy.ones', 'np.ones', (['(t1, 1)'], {}), '((t1, 1))\n', (458, 467), True, 'import numpy as np\n'), ((523, 560), 'numpy.concatenate', 'np.concatenate', (['(eval1, ones)'], {'axis': '(1)'}), '((eval1, ones), axis=1)\n', (537, 560), True, 'import numpy as np\n'), ((596, 613), 'numpy.zeros', 'np.zeros', ([...
#!/usr/bin/env python3 ################################### # Mastering ML Python Mini Course # # Inspired by the project here: # # https://s3.amazonaws.com/MLMastery/machine_learning_mastery_with_python_mini_course.pdf?__s=mxhvphowryg2sfmzus2q # # By <NAME> # # Project will soon be found at: # # https://www.inertia7...
[ "pandas.read_csv", "numpy.empty", "sklearn.model_selection.cross_val_score", "sklearn.model_selection.KFold", "sklearn.ensemble.GradientBoostingClassifier", "sklearn.linear_model.LogisticRegression", "numpy.array", "sklearn.discriminant_analysis.LinearDiscriminantAnalysis" ]
[((963, 1049), 'numpy.array', 'np.array', (["['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class']"], {}), "(['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age',\n 'class'])\n", (971, 1049), True, 'import numpy as np\n'), ((1069, 1097), 'pandas.read_csv', 'read_csv', (['url'], {'names':...
import numpy as np from kinematics import to_robot_velocities from viz.env import Viz class ControlSignalsViz(Viz): def __init__(self, marxbot, time_window=10): super().__init__() self.marxbot = marxbot self.marxbot_max_vel = 30 self.time_window = time_window def _show(self...
[ "numpy.full", "kinematics.to_robot_velocities", "numpy.linspace", "numpy.roll" ]
[((648, 697), 'numpy.linspace', 'np.linspace', (['(-self.time_window)', '(0)', 'self.n_samples'], {}), '(-self.time_window, 0, self.n_samples)\n', (659, 697), True, 'import numpy as np\n'), ((722, 768), 'numpy.full', 'np.full', (['(self.n_dims, self.n_samples)', 'np.nan'], {}), '((self.n_dims, self.n_samples), np.nan)\...
import torch import torchvision import torchvision.transforms as transforms import matplotlib.pyplot as plt import numpy as np classes = ('beaver','dolphin','otter','seal','whale','aquarium fish','flatfish','ray','shark','trout','orchids','poppies','roses','sunflowers','tulips','bottles','bowls','cans','cups','plates'...
[ "torch.utils.data.DataLoader", "numpy.transpose", "torchvision.datasets.CIFAR100", "torchvision.transforms.Normalize", "torchvision.transforms.ToTensor" ]
[((1293, 1389), 'torchvision.datasets.CIFAR100', 'torchvision.datasets.CIFAR100', ([], {'root': '"""./data"""', 'train': '(True)', 'download': '(True)', 'transform': 'transform'}), "(root='./data', train=True, download=True,\n transform=transform)\n", (1322, 1389), False, 'import torchvision\n'), ((1437, 1522), 'tor...
import os import sys ROOT_DIR = os.path.dirname(os.path.dirname(os.getcwd())) if ROOT_DIR not in sys.path: sys.path.append(ROOT_DIR) import numpy as np import tensorflow as tf from DeepSparseCoding.tf1x.analysis.base_analyzer import Analyzer """ Test for activity triggered analysis NOTE: Should be executed from th...
[ "sys.path.append", "tensorflow.test.main", "os.getcwd", "numpy.random.RandomState", "DeepSparseCoding.tf1x.analysis.base_analyzer.Analyzer", "numpy.dot" ]
[((108, 133), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (123, 133), False, 'import sys\n'), ((1484, 1498), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (1496, 1498), True, 'import tensorflow as tf\n'), ((65, 76), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (74, 76), False, '...
import numpy as np import matplotlib.pyplot as plt def spectrum(f, x): # Discrete Fourier transform A = np.fft.rfft(f(x)) A_amplitude = np.abs(A) # Compute the corresponding frequencies dx = x[1] - x[0] freqs = np.linspace(0, np.pi/dx, A_amplitude.size) plt.plot(freqs[:len(freqs)/2], A_am...
[ "numpy.zeros_like", "numpy.abs", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "numpy.where", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((373, 398), 'numpy.linspace', 'np.linspace', (['(0)', 'L', '(Nx + 1)'], {}), '(0, L, Nx + 1)\n', (384, 398), True, 'import numpy as np\n'), ((707, 752), 'matplotlib.pyplot.legend', 'plt.legend', (["['step', '2sin', 'gauss', 'peak']"], {}), "(['step', '2sin', 'gauss', 'peak'])\n", (717, 752), True, 'import matplotlib....
# -*- coding: utf-8 -*- #VecMap0.1 #The first versio of VecMap from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import * from PyQt5.QtCore import * import matplotlib matplotlib.use('Qt5Agg') from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.back...
[ "PyQt5.QtWidgets.QPushButton", "os.path.isfile", "matplotlib.backends.backend_qt5agg.NavigationToolbar2QT", "atomap.tools.remove_atoms_from_image_using_2d_gaussian", "PyQt5.QtWidgets.QApplication", "PyQt5.QtWidgets.QLabel", "PyQt5.QtWidgets.QWidget", "PyQt5.QtWidgets.QRadioButton", "matplotlib.backe...
[((192, 216), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (206, 216), False, 'import matplotlib\n'), ((48135, 48145), 'hyperspy.io.load', 'load', (['file'], {}), '(file)\n', (48139, 48145), False, 'from hyperspy.io import load\n'), ((48725, 48789), 'atomap.sublattice.Sublattice', 'Sublat...
import numpy as np def count_subset_occurrences(array, subset_array): occurrences = 0 for idx in range(len(array) - len(subset_array) + 1): if np.array_equal(array[idx:(idx + len(subset_array))], subset_array): occurrences += 1 return occurrences def test_base_case(): assert count_...
[ "numpy.array" ]
[((348, 394), 'numpy.array', 'np.array', (['[0, 1, 1, 1, 2, 2, 2, 1, 1, 3, 3, 3]'], {}), '([0, 1, 1, 1, 2, 2, 2, 1, 1, 3, 3, 3])\n', (356, 394), True, 'import numpy as np\n'), ((405, 421), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (413, 421), True, 'import numpy as np\n')]
# -------------------------------------------------------- # mcan-vqa (Deep Modular Co-Attention Networks) # modify this to our VQA dataset # -------------------------------------------------------- import os from copy import copy import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Rectan...
[ "matplotlib.pyplot.savefig", "numpy.meshgrid", "yaml.load", "argparse.ArgumentParser", "numpy.ma.masked_where", "matplotlib.colors.Normalize", "os.getcwd", "matplotlib.pyplot.close", "matplotlib.colors.BoundaryNorm", "copy.copy", "numpy.exp", "numpy.linspace", "cfgs.base_cfgs.Cfgs", "matpl...
[((516, 564), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""MCAN Args"""'}), "(description='MCAN Args')\n", (539, 564), False, 'import argparse, yaml\n'), ((4103, 4109), 'cfgs.base_cfgs.Cfgs', 'Cfgs', ([], {}), '()\n', (4107, 4109), False, 'from cfgs.base_cfgs import Cfgs\n'), ((4495, 4...
r""" =========== Transport laws =========== Create a plot comparing the different transport laws. """ import matplotlib.pyplot as plt import numpy as np from PyDune.physics.sedtransport import transport_laws as TL theta = np.linspace(0, 0.4, 1000) theta_d = 0.035 omega = 8 plt.figure() plt.plot(theta, TL.quadrati...
[ "PyDune.physics.sedtransport.transport_laws.quartic_transport_law", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "PyDune.physics.sedtransport.transport_laws.quadratic_transport_law", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matpl...
[((226, 251), 'numpy.linspace', 'np.linspace', (['(0)', '(0.4)', '(1000)'], {}), '(0, 0.4, 1000)\n', (237, 251), True, 'import numpy as np\n'), ((280, 292), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (290, 292), True, 'import matplotlib.pyplot as plt\n'), ((572, 610), 'matplotlib.pyplot.xlabel', 'plt.x...
import random import numpy as np import time class Signalgenerator(): def __init__(self): self.Fs = 8000 self.f = 2 self.sample = 8000 self.x = np.arange(1, self.sample+1) self.y = np.empty(self.sample) self.level = 0 self.filename = '' def set_filename...
[ "random.randint", "numpy.empty", "time.time", "numpy.arange", "numpy.cos" ]
[((181, 210), 'numpy.arange', 'np.arange', (['(1)', '(self.sample + 1)'], {}), '(1, self.sample + 1)\n', (190, 210), True, 'import numpy as np\n'), ((226, 247), 'numpy.empty', 'np.empty', (['self.sample'], {}), '(self.sample)\n', (234, 247), True, 'import numpy as np\n'), ((523, 557), 'random.randint', 'random.randint'...
# Core functions for Vireo model # Author: <NAME> # Date: 30/08/2019 # http://edwardlib.org/tutorials/probabilistic-pca # https://github.com/allentran/pca-magic import sys import itertools import numpy as np from scipy.stats import entropy from scipy.special import digamma from .vireo_base import normalize, loglik_am...
[ "numpy.sum", "numpy.random.seed", "numpy.log", "scipy.stats.entropy", "numpy.zeros", "numpy.ones", "numpy.expand_dims", "numpy.append", "scipy.special.digamma", "numpy.array", "numpy.exp", "numpy.random.rand", "sys.exit" ]
[((3246, 3264), 'numpy.zeros', 'np.zeros', (['max_iter'], {}), '(max_iter)\n', (3254, 3264), True, 'import numpy as np\n'), ((6889, 6930), 'numpy.zeros', 'np.zeros', (['(AD.shape[1], GT_prob.shape[1])'], {}), '((AD.shape[1], GT_prob.shape[1]))\n', (6897, 6930), True, 'import numpy as np\n'), ((7960, 7984), 'numpy.zeros...
import numpy as np import matplotlib.pyplot as plt ## preliminary tests #inputs: A, P, Q, R # A is the discrete representation of epsilon #number of spatial harmonics (or orders) P = 6; Q = 6; R = 6; Nx = 20; Ny = 20; Nz = 1; #this is fundamentally 3D...not sure how to make general for 2D N = np.array([Nx, Ny, Nz]); ...
[ "matplotlib.pyplot.show", "numpy.abs", "matplotlib.pyplot.imshow", "numpy.floor", "numpy.fft.fftn", "numpy.zeros", "numpy.ones", "numpy.array", "numpy.prod" ]
[((296, 318), 'numpy.array', 'np.array', (['[Nx, Ny, Nz]'], {}), '([Nx, Ny, Nz])\n', (304, 318), True, 'import numpy as np\n'), ((359, 373), 'numpy.ones', 'np.ones', (['(N + 1)'], {}), '(N + 1)\n', (366, 373), True, 'import numpy as np\n'), ((395, 417), 'matplotlib.pyplot.imshow', 'plt.imshow', (['A[:, :, 0]'], {}), '(...
''' <NAME> (<EMAIL>) Department of Physics University of Bath, UK May 1st, 2020 Conductance model of an RVLM neuron for use with reservoir computing using a modified Hodgkin-Huxley framework of ion channel gating. Model parameters are chosen so as to replicate the behaviour of the thalamocortical relay ne...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "scipy.integrate.odeint", "scipy.tanh", "numpy.arange", "matplotlib.pyplot.ylabel" ]
[((1399, 1418), 'numpy.arange', 'np.arange', (['(0)', 'T', 'dt'], {}), '(0, T, dt)\n', (1408, 1418), True, 'import numpy as np\n'), ((6104, 6125), 'scipy.integrate.odeint', 'odeint', (['dXdt', 'init', 't'], {}), '(dXdt, init, t)\n', (6110, 6125), False, 'from scipy.integrate import odeint\n'), ((6691, 6711), 'matplotli...
#!/usr/bin/python import sys import os import numpy as np import pandas as pd import argparse import tensorflow as tf from importlib.machinery import SourceFileLoader import math import psutil import time from scipy.sparse import csr_matrix import gc import matplotlib matplotlib.use('Agg') import scimpute def learnin...
[ "numpy.random.seed", "argparse.ArgumentParser", "tensorflow.reset_default_graph", "scimpute.max_min_element_in_arrs", "gc.collect", "scimpute.read_data_into_cell_row", "numpy.arange", "scimpute.read_sparse_matrix_from_h5", "pandas.DataFrame", "scimpute.weight_bias_variable", "scimpute.split__csr...
[((269, 290), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (283, 290), False, 'import matplotlib\n'), ((2503, 2567), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'Y_input_arr', 'columns': 'gene_ids', 'index': 'cell_ids'}), '(data=Y_input_arr, columns=gene_ids, index=cell_ids)\n', (2515, 25...
import tqdm import networkx as nx import argparse import numpy as np import multiprocessing import graph_tool as gt from graph_tool.centrality import betweenness parser = argparse.ArgumentParser() parser.add_argument("-g", "--graph", help='bundled graph') parser.add_argument("-l","--length",help="contig length") parse...
[ "tqdm.tqdm", "argparse.ArgumentParser", "networkx.set_node_attributes", "numpy.std", "numpy.mean", "networkx.Graph", "graph_tool.centrality.betweenness", "networkx.connected_component_subgraphs", "networkx.number_connected_components", "multiprocessing.cpu_count" ]
[((172, 197), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (195, 197), False, 'import argparse\n'), ((402, 412), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (410, 412), True, 'import networkx as nx\n'), ((420, 447), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 14 14:11:07 2019 @author: mimbres """ import pandas as pd import numpy as np from tqdm import trange LASTFM_FILEPATH = './data/final_mapping.json' OUTPUT_FILEPATH1 = './data/lastfm_top50_tagmtx.npy' OUTPUT_FILEPATH2 = './data/lastfm_top50_featmtx....
[ "numpy.save", "tqdm.trange", "numpy.asarray", "numpy.zeros", "pandas.read_json", "numpy.max", "numpy.where", "numpy.ndarray" ]
[((1219, 1248), 'pandas.read_json', 'pd.read_json', (['LASTFM_FILEPATH'], {}), '(LASTFM_FILEPATH)\n', (1231, 1248), True, 'import pandas as pd\n'), ((1402, 1427), 'numpy.zeros', 'np.zeros', (['(num_items, 50)'], {}), '((num_items, 50))\n', (1410, 1427), True, 'import numpy as np\n'), ((1438, 1463), 'numpy.zeros', 'np.z...
#Programmer: <NAME> #This file contains a test step function for debugging the swept rule import numpy, h5py, mpi4py.MPI as MPI try: import pycuda.driver as cuda from pycuda.compiler import SourceModule except Exception as e: pass def step(state,iidx,arrayTimeIndex,globalTimeStep): """This is the meth...
[ "numpy.float64", "h5py.File", "numpy.zeros" ]
[((1951, 1976), 'numpy.zeros', 'numpy.zeros', (['(nv, nx, ny)'], {}), '((nv, nx, ny))\n', (1962, 1976), False, 'import numpy, h5py, mpi4py.MPI as MPI\n'), ((2156, 2206), 'h5py.File', 'h5py.File', (['filename', '"""w"""'], {'driver': '"""mpio"""', 'comm': 'comm'}), "(filename, 'w', driver='mpio', comm=comm)\n", (2165, 2...
import nose.tools as nt import numpy as np import theano import theano.tensor as T import treeano import treeano.nodes as tn fX = theano.config.floatX def test_aggregator_node_serialization(): tn.check_serialization(tn.AggregatorNode("a")) def test_elementwise_cost_node_serialization(): tn.check_serializa...
[ "treeano.nodes.ConstantNode", "treeano.nodes.MultiplyConstantNode", "treeano.nodes.InputElementwiseSumNode", "treeano.nodes.AddConstantNode", "treeano.nodes.AggregatorNode", "treeano.nodes.InputNode", "numpy.random.rand", "treeano.nodes.IdentityNode" ]
[((224, 246), 'treeano.nodes.AggregatorNode', 'tn.AggregatorNode', (['"""a"""'], {}), "('a')\n", (241, 246), True, 'import treeano.nodes as tn\n'), ((1102, 1125), 'numpy.random.rand', 'np.random.rand', (['(3)', '(4)', '(5)'], {}), '(3, 4, 5)\n', (1116, 1125), True, 'import numpy as np\n'), ((1145, 1168), 'numpy.random....
# NOTE WARNING NEVER CHANGE THIS FIRST LINE!!!! NEVER EVER import cudf from collections import OrderedDict from enum import Enum from urllib.parse import urlparse from threading import Lock from weakref import ref from pyblazing.apiv2.filesystem import FileSystem from pyblazing.apiv2 import DataType from .hive imp...
[ "socket.socket", "cudf.DataFrame.from_arrow", "cudf.set_allocator", "weakref.ref", "urllib.parse.urlparse", "random.randint", "dask_cudf.from_cudf", "dask.distributed.wait", "dask.dataframe.from_delayed", "pyarrow.Table.from_arrays", "pyblazing.apiv2.filesystem.FileSystem", "threading.Lock", ...
[((1027, 1062), 'jpype.JClass', 'jpype.JClass', (['"""java.util.ArrayList"""'], {}), "('java.util.ArrayList')\n", (1039, 1062), False, 'import jpype\n'), ((1081, 1155), 'jpype.JClass', 'jpype.JClass', (['"""com.blazingdb.calcite.catalog.domain.CatalogColumnDataType"""'], {}), "('com.blazingdb.calcite.catalog.domain.Cat...
from __future__ import annotations __copyright__ = """ Copyright (C) 2020 <NAME> Copyright (C) 2020 <NAME> Copyright (C) 2020 <NAME> Copyright (C) 2021 <NAME> """ __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "So...
[ "pytato.zeros", "numpy.dtype", "pymbolic.var", "numpy.empty" ]
[((5205, 5223), 'numpy.dtype', 'np.dtype', (['np.int32'], {}), '(np.int32)\n', (5213, 5223), True, 'import numpy as np\n'), ((5632, 5664), 'pytato.zeros', 'pt.zeros', (['x.shape'], {'dtype': 'x.dtype'}), '(x.shape, dtype=x.dtype)\n', (5640, 5664), True, 'import pytato as pt\n'), ((3424, 3454), 'pymbolic.var', 'var', ([...
#!/usr/bin/env python3 import numpy as np import math import random def compute_z(theta, x): z = 0 for j in range(len(x)): z += theta[j] * x[j] z += theta[len(x)] return z def compute_g(z): return (1)/(1 + math.exp(-z)) def compute_h(z): return compute_g(z) def binary_cross_entro...
[ "math.log", "math.exp", "numpy.random.randn" ]
[((1164, 1181), 'numpy.random.randn', 'np.random.randn', ([], {}), '()\n', (1179, 1181), True, 'import numpy as np\n'), ((238, 250), 'math.exp', 'math.exp', (['(-z)'], {}), '(-z)\n', (246, 250), False, 'import math\n'), ((429, 451), 'math.log', 'math.log', (['Y_predict[i]'], {}), '(Y_predict[i])\n', (437, 451), False, ...
''' Functions to compute fast distance covariance using mergesort. ''' import warnings from numba import float64, int64, boolean import numba import numpy as np from ._utils import CompileMode, _transform_to_2d def _compute_weight_sums(y, weights): n_samples = len(y) weight_sums = np.zeros((n_samples,) ...
[ "numpy.sum", "numpy.ones_like", "numpy.empty_like", "numpy.zeros", "numpy.cumsum", "numpy.arange", "numba.float64", "warnings.warn" ]
[((298, 355), 'numpy.zeros', 'np.zeros', (['((n_samples,) + weights.shape[1:])'], {'dtype': 'y.dtype'}), '((n_samples,) + weights.shape[1:], dtype=y.dtype)\n', (306, 355), True, 'import numpy as np\n'), ((624, 691), 'numpy.zeros', 'np.zeros', (['((n_samples + 1,) + weights.shape[1:])'], {'dtype': 'weights.dtype'}), '((...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2014-10-28 04:41:23 # @Last Modified by: marinheiro # @Last Modified time: 2014-12-08 23:30:01 """ Auxiliary functions to convert between different rotation representations. """ import numpy import numpy.linalg import scipy import math # Ax...
[ "numpy.trace", "numpy.zeros", "math.sin", "numpy.linalg.norm", "math.cos", "numpy.array" ]
[((525, 545), 'numpy.linalg.norm', 'numpy.linalg.norm', (['w'], {}), '(w)\n', (542, 545), False, 'import numpy\n'), ((551, 568), 'numpy.zeros', 'numpy.zeros', (['(3,)'], {}), '((3,))\n', (562, 568), False, 'import numpy\n'), ((776, 795), 'numpy.zeros', 'numpy.zeros', (['(3, 1)'], {}), '((3, 1))\n', (787, 795), False, '...
import flappybird as fb import random import time from keras.models import Sequential from keras.layers import Dense from keras.optimizers import SGD import numpy as np import copy SCALE_FACTOR = 200 class GeneticBrain(fb.Brain): def __init__(self,n_input,n_hidden): ''' self.model = Sequential() ...
[ "numpy.size", "random.randint", "flappybird.FlappyBirdGame", "pygame.event.get", "random.random", "random.seed", "simpleNeuralNetwork.NeuralNetwork" ]
[((5525, 5564), 'flappybird.FlappyBirdGame', 'fb.FlappyBirdGame', (['(30)', 'bird_num', 'brains'], {}), '(30, bird_num, brains)\n', (5542, 5564), True, 'import flappybird as fb\n'), ((6932, 6971), 'flappybird.FlappyBirdGame', 'fb.FlappyBirdGame', (['(30)', 'bird_num', 'brains'], {}), '(30, bird_num, brains)\n', (6949, ...
#!/usr/bin/python import roslib import rospy import cv2 import numpy as np import cv_bridge import time from sensor_msgs.msg import Image from std_msgs.msg import String from common import * from jupiter.msg import BallPosition class Detector: current_camera = None camera_subscription = None bridge = None...
[ "cv2.GaussianBlur", "rospy.Subscriber", "cv2.bitwise_and", "numpy.around", "cv2.__version__.split", "cv2.inRange", "cv2.cvtColor", "rospy.init_node", "jupiter.msg.BallPosition", "cv2.circle", "rospy.loginfo", "cv2.SimpleBlobDetector_create", "cv2.SimpleBlobDetector", "cv2.bitwise_or", "c...
[((10179, 10206), 'rospy.init_node', 'rospy.init_node', (['"""detector"""'], {}), "('detector')\n", (10194, 10206), False, 'import rospy\n'), ((10237, 10249), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (10247, 10249), False, 'import rospy\n'), ((742, 827), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/jupiter/detec...
import json import matplotlib.pyplot as plt import numpy as np import pickle import tensorflow as tf import traceback from support.data_model import TAG_CLASS_MAP, CLASSES def load_raw_tracks(path): tracks = [] with open(path, 'rb') as f: try: while True: tracks.append(pi...
[ "matplotlib.pyplot.title", "numpy.sum", "tensorflow.keras.layers.Dense", "tensorflow.keras.callbacks.ModelCheckpoint", "pickle.load", "tensorflow.keras.callbacks.EarlyStopping", "traceback.print_exc", "tensorflow.keras.layers.BatchNormalization", "tensorflow.keras.callbacks.ReduceLROnPlateau", "ma...
[((4864, 4908), 'matplotlib.pyplot.savefig', 'plt.savefig', (['f"""{save_directory}/history.png"""'], {}), "(f'{save_directory}/history.png')\n", (4875, 4908), True, 'import matplotlib.pyplot as plt\n'), ((4913, 4924), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (4922, 4924), True, 'import matplotlib.pypl...
""" demo05_gridsearch.py 网格搜索 """ import numpy as np import sklearn.model_selection as ms import sklearn.svm as svm import sklearn.metrics as sm import matplotlib.pyplot as mp data = np.loadtxt('../ml_data/multiple2.txt', delimiter=',', dtype='f8') x = data[:, :-1] y = data[:, -1] # 选择svm做分类 train_x, test_x, train_...
[ "matplotlib.pyplot.title", "sklearn.model_selection.GridSearchCV", "matplotlib.pyplot.show", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.scatter", "sklearn.metrics.classification_report", "matplotlib.pyplot.figure", "numpy.array", "numpy.loadtxt", "matplotlib.pyplot.pcolormesh",...
[((185, 250), 'numpy.loadtxt', 'np.loadtxt', (['"""../ml_data/multiple2.txt"""'], {'delimiter': '""","""', 'dtype': '"""f8"""'}), "('../ml_data/multiple2.txt', delimiter=',', dtype='f8')\n", (195, 250), True, 'import numpy as np\n'), ((338, 395), 'sklearn.model_selection.train_test_split', 'ms.train_test_split', (['x',...
import struct import numpy as np from .nbt import NBTFile import io class BufferDecoder(object): def __init__(self,bytes) -> None: self.bytes=bytes self.curr=0 def read_var_uint32(self): # 我nm真的有必要为了几个比特省到这种地步吗??uint32最多也就5个比特吧?? i,v=0,0 while i<35: ...
[ "numpy.uint32", "io.BytesIO", "numpy.uint64", "struct.unpack", "struct.pack", "numpy.int32", "numpy.int64" ]
[((574, 591), 'numpy.int32', 'np.int32', (['(v_ >> 1)'], {}), '(v_ >> 1)\n', (582, 591), True, 'import numpy as np\n'), ((1036, 1053), 'numpy.int64', 'np.int64', (['(v_ >> 1)'], {}), '(v_ >> 1)\n', (1044, 1053), True, 'import numpy as np\n'), ((1175, 1233), 'struct.unpack', 'struct.unpack', (['"""fff"""', 'self.bytes[s...
import numpy as np from pycocotools_local.coco import * import os.path as osp from .utils import to_tensor, random_scale from mmcv.parallel import DataContainer as DC import mmcv from .custom import CustomDataset class CocoDatasetRGB2(CustomDataset): CLASSES = ('microbleed', 'full_bounding_box') def load_a...
[ "numpy.zeros", "numpy.hstack", "numpy.array", "mmcv.parallel.DataContainer", "numpy.random.rand", "mmcv.imrescale", "os.path.join" ]
[((5455, 5502), 'os.path.join', 'osp.join', (['self.img_prefix', "img_info['filename']"], {}), "(self.img_prefix, img_info['filename'])\n", (5463, 5502), True, 'import os.path as osp\n'), ((4019, 4063), 'numpy.array', 'np.array', (['cur_slice_bboxes'], {'dtype': 'np.float32'}), '(cur_slice_bboxes, dtype=np.float32)\n',...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Python toolkit for generating and analyzing nanostructure data""" from __future__ import absolute_import, division, print_function, \ unicode_literals __docformat__ = 'restructuredtext en' import os import sys import shutil import subprocess from distutils.command...
[ "os.remove", "subprocess.Popen", "distutils.core.setup", "scipy.version.short_version.split", "distutils.command.clean.clean.run", "os.path.exists", "os.walk", "os.environ.get", "imp.load_source", "shutil.rmtree", "numpy.distutils.misc_util.Configuration", "os.path.join", "numpy.version.shor...
[((4346, 4372), 'os.path.exists', 'os.path.exists', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (4360, 4372), False, 'import os\n'), ((4378, 4399), 'os.remove', 'os.remove', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (4387, 4399), False, 'import os\n'), ((5804, 5826), 'os.path.exists', 'os.path.exists', (['""".git"""'...
import os,random os.environ["KERAS_BACKEND"] = "tensorflow" from PIL import Image from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D import h5py import numpy as np from keras.layers import Input,merge,Lambda from keras.layers.core import Reshape,Dense,Dropout,Activation,Flatten from keras.layers.adva...
[ "keras.layers.core.Reshape", "numpy.ones", "keras.models.Model", "matplotlib.pyplot.figure", "numpy.exp", "numpy.random.normal", "keras.layers.core.Flatten", "keras.layers.Input", "keras.layers.concatenate", "numpy.transpose", "numpy.reshape", "numpy.linspace", "keras.layers.core.Dropout", ...
[((725, 765), 'functools.partial', 'partial', (['initializers.normal'], {'scale': '(0.02)'}), '(initializers.normal, scale=0.02)\n', (732, 765), False, 'from functools import partial\n'), ((1065, 1098), 'h5py.File', 'h5py.File', (['"""FERG_64_64_color.mat"""'], {}), "('FERG_64_64_color.mat')\n", (1074, 1098), False, 'i...
import zmq from zmq import ssh import numpy as np from environments.inmoov.inmoov_p2p_client_ready import InmoovGymEnv from .inmoov_server import server_connection, client_ssh_connection, client_connection SERVER_PORT = 7777 HOSTNAME = 'localhost' def send_array(socket, A, flags=0, copy=True, track=False): """se...
[ "numpy.zeros", "environments.inmoov.inmoov_p2p_client_ready.InmoovGymEnv", "numpy.array" ]
[((972, 1026), 'environments.inmoov.inmoov_p2p_client_ready.InmoovGymEnv', 'InmoovGymEnv', ([], {'debug_mode': '(True)', 'positional_control': '(True)'}), '(debug_mode=True, positional_control=True)\n', (984, 1026), False, 'from environments.inmoov.inmoov_p2p_client_ready import InmoovGymEnv\n'), ((655, 684), 'numpy.ze...
""" Automatic 2D class selection tool. MIT License Copyright (c) 2019 <NAME> Institute of Molecular Physiology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including with...
[ "h5py.File", "numpy.abs", "numpy.nan_to_num", "os.path.basename", "numpy.std", "scipy.fftpack.fftshift", "os.path.isdir", "numpy.flipud", "numpy.fliplr", "os.path.isfile", "numpy.mean", "scipy.fftpack.fft2", "PIL.Image.fromarray", "h5py.is_hdf5", "os.path.join", "os.listdir", "mrcfil...
[((1861, 1913), 'numpy.sqrt', 'np.sqrt', (['((X - center[0]) ** 2 + (Y - center[1]) ** 2)'], {}), '((X - center[0]) ** 2 + (Y - center[1]) ** 2)\n', (1868, 1913), True, 'import numpy as np\n'), ((2499, 2516), 'scipy.fftpack.fft2', 'fftpack.fft2', (['img'], {}), '(img)\n', (2511, 2516), False, 'from scipy import fftpack...