code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"""Linear model of tree-based decision rules based on the rulefit algorithm from <NAME> Popescu. The algorithm can be used for predicting an output vector y given an input matrix X. In the first step a tree ensemble is generated with gradient boosting. The trees are then used to form rules, where the paths to each nod...
[ "imodels.util.rule.replace_feature_name", "numpy.mean", "pandas.set_option", "imodels.util.transforms.Winsorizer", "pandas.DataFrame", "numpy.std", "sklearn.utils.validation.check_array", "imodels.util.rule.get_feature_dict", "sklearn.utils.multiclass.unique_labels", "scipy.special.softmax", "im...
[((4870, 4918), 'imodels.util.transforms.Winsorizer', 'Winsorizer', ([], {'trim_quantile': 'self.lin_trim_quantile'}), '(trim_quantile=self.lin_trim_quantile)\n', (4880, 4918), False, 'from imodels.util.transforms import Winsorizer, FriedScale\n'), ((4945, 4972), 'imodels.util.transforms.FriedScale', 'FriedScale', (['s...
# WARNING: you are on the master branch; please refer to examples on the branch corresponding to your `cortex version` (e.g. for version 0.21.*, run `git checkout -b 0.21` or switch to the `0.21` branch on GitHub) import cv2 import numpy as np import math from .bbox import BoundBox, bbox_iou from scipy.special import ...
[ "math.sqrt", "numpy.zeros", "numpy.expand_dims", "numpy.ones", "scipy.special.expit", "numpy.argsort", "numpy.amax", "numpy.array", "numpy.exp", "cv2.resize" ]
[((356, 364), 'scipy.special.expit', 'expit', (['x'], {}), '(x)\n', (361, 364), False, 'from scipy.special import expit\n'), ((3490, 3543), 'cv2.resize', 'cv2.resize', (['(image[:, :, ::-1] / 255.0)', '(new_w, new_h)'], {}), '(image[:, :, ::-1] / 255.0, (new_w, new_h))\n', (3500, 3543), False, 'import cv2\n'), ((3792, ...
""" Module containing earth model classes. The earth models define density as a function of radius and provide a simple integrator for calculation of the column density along a straight path through the Earth. """ import logging import numpy as np from pyrex.internal_functions import normalize logger = logging.getL...
[ "numpy.trapz", "numpy.sum", "logging.getLogger", "pyrex.internal_functions.normalize", "numpy.array", "numpy.linspace", "numpy.dot", "numpy.piecewise", "numpy.concatenate", "numpy.sqrt" ]
[((308, 335), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (325, 335), False, 'import logging\n'), ((2451, 2462), 'numpy.array', 'np.array', (['r'], {}), '(r)\n', (2459, 2462), True, 'import numpy as np\n'), ((2487, 2520), 'numpy.concatenate', 'np.concatenate', (['([0], self.radii)'], {...
import numpy as np import pandas as pd import copy class ModelStacker: def __init__(self): self.base_models = {} self.stacked_model = None self.fitted = False def add_base_model(self, model): """ model: model object, preferably sklearn adds model objects fo...
[ "copy.deepcopy", "numpy.random.seed", "numpy.sum", "numpy.array", "numpy.array_split", "numpy.random.shuffle" ]
[((2007, 2016), 'numpy.sum', 'np.sum', (['X'], {}), '(X)\n', (2013, 2016), True, 'import numpy as np\n'), ((2094, 2103), 'numpy.sum', 'np.sum', (['Y'], {}), '(Y)\n', (2100, 2103), True, 'import numpy as np\n'), ((2759, 2779), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (2773, 2779), True, 'import...
from typing import Dict, Any from configparser import ConfigParser, ExtendedInterpolation from numpy import random as np_random import torch import random def set_seed(seed): random.seed(seed) np_random.seed(seed) torch.cuda.manual_seed(seed) torch.manual_seed(seed) def to_cuda(data): if isins...
[ "numpy.random.seed", "torch.manual_seed", "torch.cuda.manual_seed", "random.seed", "configparser.ExtendedInterpolation" ]
[((183, 200), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (194, 200), False, 'import random\n'), ((205, 225), 'numpy.random.seed', 'np_random.seed', (['seed'], {}), '(seed)\n', (219, 225), True, 'from numpy import random as np_random\n'), ((230, 258), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', ([...
import numpy as np from classifiers.linear_svm import * from classifiers.softmax import * class LinearClassifier(object): def __init__(self, batch_size=200, n_iters=1000, log_iters=100, learning_rate=1e-3, regularization=5e-4): """ Train this linear classifier using stochastic gr...
[ "numpy.random.randn", "numpy.argmax", "numpy.max", "numpy.arange", "numpy.dot" ]
[((5069, 5086), 'numpy.dot', 'np.dot', (['x', 'self.W'], {}), '(x, self.W)\n', (5075, 5086), True, 'import numpy as np\n'), ((5110, 5135), 'numpy.argmax', 'np.argmax', (['scores'], {'axis': '(1)'}), '(scores, axis=1)\n', (5119, 5135), True, 'import numpy as np\n'), ((1588, 1597), 'numpy.max', 'np.max', (['y'], {}), '(y...
#!/usr/bin/env python # -*- coding: utf-8 -*- # External Libraries from torch.utils.data import DataLoader from torchvision import transforms import torch.nn.functional as F import torch.optim as optim import torch.nn as nn from PIL import Image import numpy as np import torch # Standard Libraries from os import path...
[ "torchvision.transforms.ColorJitter", "torchvision.transforms.RandomAffine", "torch.optim.lr_scheduler.StepLR", "torch.utils.data.DataLoader", "model.utils.udata.Sample", "torchvision.transforms.RandomHorizontalFlip", "torch.sum", "torch.nn.CrossEntropyLoss", "ensemble_network.Ensemble.load", "tor...
[((3616, 3678), 'ensemble_network.Ensemble.load', 'Ensemble.load', (['device', 'num_branches_trained_network', 'load_path'], {}), '(device, num_branches_trained_network, load_path)\n', (3629, 3678), False, 'from ensemble_network import Ensemble\n'), ((4136, 4157), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([]...
#!/usr/bin/env python3 # # Partly derived from: # https://github.com/locuslab/optnet/blob/master/sudoku/train.py import argparse import os import shutil import csv import numpy as np import numpy.random as npr #import setproctitle import torch import torch.nn as nn import torch.optim as optim import torch.nn.fun...
[ "satnet.SATNet", "torch.nn.functional.binary_cross_entropy", "numpy.random.seed", "argparse.ArgumentParser", "torch.utils.data.TensorDataset", "shutil.rmtree", "torch.no_grad", "os.path.join", "torch.ones", "torch.utils.data.DataLoader", "torch.load", "torch.nn.Linear", "torch.nn.functional....
[((9265, 9280), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (9278, 9280), False, 'import torch\n'), ((9443, 9458), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (9456, 9458), False, 'import torch\n'), ((3377, 3399), 'torch.zeros_like', 'torch.zeros_like', (['perm'], {}), '(perm)\n', (3393, 3399), False, '...
import functools import operator import os import os.path import sys import numpy as np # Bamboo utilities current_file = os.path.realpath(__file__) current_dir = os.path.dirname(current_file) sys.path.insert(0, os.path.join(os.path.dirname(current_dir), 'common_python')) import tools # ==============================...
[ "numpy.random.uniform", "tools.create_python_data_reader", "numpy.random.seed", "os.path.realpath", "os.path.dirname", "tools.create_tests", "numpy.finfo", "numpy.mean", "numpy.random.normal" ]
[((123, 149), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (139, 149), False, 'import os\n'), ((164, 193), 'os.path.dirname', 'os.path.dirname', (['current_file'], {}), '(current_file)\n', (179, 193), False, 'import os\n'), ((536, 561), 'numpy.random.seed', 'np.random.seed', (['(201909113...
import cv2 import numpy as np from models import base_server from configs import configs # Read example image test_img = cv2.imread(configs.test_img_fp) test_img = cv2.resize(test_img, configs.face_describer_tensor_shape) # Define input tensors feed to session graph #dropout_rate = 0.5 input_data = np.array([np.expan...
[ "numpy.expand_dims", "cv2.imread", "models.base_server.BaseServer", "cv2.resize" ]
[((122, 153), 'cv2.imread', 'cv2.imread', (['configs.test_img_fp'], {}), '(configs.test_img_fp)\n', (132, 153), False, 'import cv2\n'), ((165, 222), 'cv2.resize', 'cv2.resize', (['test_img', 'configs.face_describer_tensor_shape'], {}), '(test_img, configs.face_describer_tensor_shape)\n', (175, 222), False, 'import cv2\...
import numpy as np import pytest import math import arim import arim.im as im import arim.im.tfm, arim.ray import arim.io import arim.geometry as g def test_extrema_lookup_times_in_rectbox(): grid = g.Grid(-10.0, 10.0, 0.0, 0.0, 0.0, 15.0, 1.0) tx = [0, 0, 0, 1, 1, 1] rx = [0, 1, 2, 1, 1, 2] lookup_...
[ "numpy.random.seed", "arim.im.tfm.extrema_lookup_times_in_rectbox", "arim.im.tfm.contact_tfm", "arim.geometry.Grid", "pytest.mark.parametrize", "numpy.testing.assert_array_almost_equal", "arim.Path", "arim.geometry.points_1d_wall_z", "numpy.testing.assert_allclose", "arim.ut.fmc", "arim.ut.hmc",...
[((1241, 1296), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_real_grid"""', '[True, False]'], {}), "('use_real_grid', [True, False])\n", (1264, 1296), False, 'import pytest\n'), ((3713, 3762), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_hmc"""', '[False, True]'], {}), "('use_hmc',...
import itertools import numba import numpy as np import scipy.sparse from itertools import zip_longest from ._utils import isscalar, equivalent, _zero_of_dtype def elemwise(func, *args, **kwargs): """ Apply a function to any number of arguments. Parameters ---------- func : Callable Th...
[ "numpy.result_type", "numpy.concatenate", "numpy.empty", "numpy.ix_", "numpy.asarray", "itertools.zip_longest", "numpy.ones", "numpy.argsort", "numba.jit", "numpy.array", "numpy.arange", "numpy.broadcast_to", "numpy.broadcast_arrays", "itertools.chain", "numpy.prod" ]
[((1259, 1295), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)', 'nogil': '(True)'}), '(nopython=True, nogil=True)\n', (1268, 1295), False, 'import numba\n'), ((8105, 8120), 'numpy.ix_', 'np.ix_', (['*arrays'], {}), '(*arrays)\n', (8111, 8120), True, 'import numpy as np\n'), ((8139, 8174), 'numpy.broadcast_arrays'...
import numpy as np import trimesh class Mesh(object): def __init__(self, mesh, normalize=False): self.mesh = mesh # Normalize points such that they are in the unit cube if normalize: bbox = self.mesh.bounding_box.bounds # Compute location and scale loc ...
[ "trimesh.sample.sample_surface", "numpy.array", "trimesh.load", "numpy.hstack" ]
[((1496, 1539), 'trimesh.sample.sample_surface', 'trimesh.sample.sample_surface', (['self.mesh', 'N'], {}), '(self.mesh, N)\n', (1525, 1539), False, 'import trimesh\n'), ((1555, 1594), 'numpy.hstack', 'np.hstack', (['[P, self.face_normals[t, :]]'], {}), '([P, self.face_normals[t, :]])\n', (1564, 1594), True, 'import nu...
"""Tests for fooof.plts.aperiodic.""" import numpy as np from fooof.tests.tutils import plot_test from fooof.plts.aperiodic import * ################################################################################################### ###################################################################################...
[ "numpy.array" ]
[((454, 492), 'numpy.array', 'np.array', (['[[1, 1], [0.5, 0.5], [2, 2]]'], {}), '([[1, 1], [0.5, 0.5], [2, 2]])\n', (462, 492), True, 'import numpy as np\n'), ((655, 708), 'numpy.array', 'np.array', (['[[1, 100, 1], [0.5, 150, 0.5], [2, 200, 2]]'], {}), '([[1, 100, 1], [0.5, 150, 0.5], [2, 200, 2]])\n', (663, 708), Tr...
# Copyright 2018 The Texar 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 applicable ...
[ "numpy.dtype", "numpy.arange", "BIT_DL.pytorch.utils.utils.get_function" ]
[((2058, 2079), 'numpy.arange', 'np.arange', (['vocab_size'], {}), '(vocab_size)\n', (2067, 2079), True, 'import numpy as np\n'), ((4681, 4780), 'BIT_DL.pytorch.utils.utils.get_function', 'utils.get_function', (['self._hparams.init_fn.type', "['numpy.random', 'numpy', 'texar.torch.custom']"], {}), "(self._hparams.init_...
import numpy as np ## CONVOLUTIONAL NEURAL NETWORK import torch import torch.nn as nn from torch.distributions import Normal, Categorical import torch.optim as optim import torch.optim as optim # A function to randomly initialize the weights def init_weights(m): if isinstance(m, nn.Linear): nn.init.nor...
[ "torch.nn.Dropout", "torch.ones", "torch.nn.ReLU", "torch.nn.Conv2d", "torch.FloatTensor", "torch.cat", "numpy.zeros", "torch.nn.init.normal_", "torch.nn.init.constant_", "torch.nn.Linear", "torch.nn.MaxPool2d", "torch.distributions.Normal", "torch.reshape" ]
[((3179, 3228), 'torch.FloatTensor', 'torch.FloatTensor', (["observation['joint_positions']"], {}), "(observation['joint_positions'])\n", (3196, 3228), False, 'import torch\n'), ((3249, 3296), 'torch.FloatTensor', 'torch.FloatTensor', (["observation['touch_sensors']"], {}), "(observation['touch_sensors'])\n", (3266, 32...
import numpy as np from .bbox_overlaps import bbox_overlaps def eval_res(gt0, dt0, thr): """ :param gt0: np.array[ng, 5], ground truth results [x, y, w, h, ignore] :param dt0: np.array[nd, 5], detection results [x, y, w, h, score] :param thr: float, IoU threshold :return gt1: np.array[ng,...
[ "numpy.sum", "numpy.flatnonzero", "numpy.logical_not", "numpy.zeros", "numpy.any", "numpy.cumsum", "numpy.max", "numpy.mean", "numpy.linspace", "numpy.concatenate" ]
[((1057, 1101), 'numpy.concatenate', 'np.concatenate', (['(iou_dtgt, iof_dtig)'], {'axis': '(1)'}), '((iou_dtgt, iof_dtig), axis=1)\n', (1071, 1101), True, 'import numpy as np\n'), ((1220, 1252), 'numpy.concatenate', 'np.concatenate', (['(gt, ig)'], {'axis': '(0)'}), '((gt, ig), axis=0)\n', (1234, 1252), True, 'import ...
# Script is based on https://github.com/richzhang/colorization/blob/master/colorization/colorize.py import numpy as np import argparse import cv2 as cv def parse_args(): parser = argparse.ArgumentParser(description='iColor: deep interactive colorization') parser.add_argument('--input', help='Path to image or v...
[ "numpy.full", "numpy.load", "numpy.uint8", "argparse.ArgumentParser", "numpy.concatenate", "cv2.cvtColor", "cv2.imwrite", "cv2.dnn.blobFromImage", "numpy.clip", "numpy.hstack", "cv2.imread", "cv2.dnn.readNetFromCaffe", "cv2.resize" ]
[((184, 260), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""iColor: deep interactive colorization"""'}), "(description='iColor: deep interactive colorization')\n", (207, 260), False, 'import argparse\n'), ((1011, 1066), 'cv2.dnn.readNetFromCaffe', 'cv.dnn.readNetFromCaffe', (['args.prot...
import os import io import base64 import numpy as np from PIL import Image from hangar.external import BasePlugin class HangarPIL(BasePlugin): def __init__(self): provides = ['load', 'save', 'board_show'] accepts = ['jpg', 'jpeg', 'png', 'ppm', 'bmp', 'pgm', 'tif', 'tiff', 'webp'] super(...
[ "io.BytesIO", "PIL.Image.open", "numpy.array", "PIL.Image.fromarray", "os.path.join" ]
[((1078, 1095), 'PIL.Image.open', 'Image.open', (['fpath'], {}), '(fpath)\n', (1088, 1095), False, 'from PIL import Image\n'), ((2634, 2682), 'os.path.join', 'os.path.join', (['outdir', 'f"""{sample_n}.{format_str}"""'], {}), "(outdir, f'{sample_n}.{format_str}')\n", (2646, 2682), False, 'import os\n'), ((3039, 3059), ...
import numpy as np from manim_engine.constants import OUT from manim_engine.constants import RIGHT from functools import reduce # Matrix operations def get_norm(vect): return sum([x**2 for x in vect])**0.5 def thick_diagonal(dim, thickness=2): row_indices = np.arange(dim).repeat(dim).reshape((dim, dim)) ...
[ "numpy.outer", "numpy.abs", "numpy.transpose", "numpy.identity", "numpy.sin", "numpy.linalg.inv", "numpy.array", "numpy.cos", "numpy.arange", "functools.reduce", "numpy.dot", "numpy.arccos" ]
[((337, 362), 'numpy.transpose', 'np.transpose', (['row_indices'], {}), '(row_indices)\n', (349, 362), True, 'import numpy as np\n'), ((634, 658), 'numpy.linalg.inv', 'np.linalg.inv', (['z_to_axis'], {}), '(z_to_axis)\n', (647, 658), True, 'import numpy as np\n'), ((670, 717), 'functools.reduce', 'reduce', (['np.dot', ...
import numpy as np from rlpyt.samplers.collectors import (DecorrelatingStartCollector, BaseEvalCollector) from rlpyt.agents.base import AgentInputs from rlpyt.utils.buffer import (torchify_buffer, numpify_buffer, buffer_from_example, buffer_method) class CpuResetCollector(DecorrelatingStartCollector): ...
[ "rlpyt.agents.base.AgentInputs", "rlpyt.utils.buffer.torchify_buffer", "rlpyt.utils.buffer.numpify_buffer", "time.sleep", "numpy.where" ]
[((749, 778), 'rlpyt.utils.buffer.torchify_buffer', 'torchify_buffer', (['agent_inputs'], {}), '(agent_inputs)\n', (764, 778), False, 'from rlpyt.utils.buffer import torchify_buffer, numpify_buffer, buffer_from_example, buffer_method\n'), ((3733, 3762), 'rlpyt.utils.buffer.torchify_buffer', 'torchify_buffer', (['agent_...
""" Created on Wed Feb 5 16:07:35 2020 @author: matias """ import numpy as np from scipy.optimize import minimize np.random.seed(42) import sys import os from os.path import join as osjoin from pc_path import definir_path path_git, path_datos_global = definir_path() os.chdir(path_git) sys.path.append('./Software/Fun...
[ "sys.path.append", "scipy.optimize.minimize", "numpy.load", "numpy.random.seed", "funciones_data.leer_data_cronometros", "funciones_cronometros.params_to_chi2", "numpy.array", "pc_path.definir_path", "numpy.savez", "os.chdir" ]
[((116, 134), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (130, 134), True, 'import numpy as np\n'), ((255, 269), 'pc_path.definir_path', 'definir_path', ([], {}), '()\n', (267, 269), False, 'from pc_path import definir_path\n'), ((270, 288), 'os.chdir', 'os.chdir', (['path_git'], {}), '(path_git)\...
#!/usr/bin/env python # # Copyright (c) 2012, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list ...
[ "json.load", "logging.debug", "logging.basicConfig", "optparse.OptionParser", "numpy.ndim", "numpy.genfromtxt", "datetime.datetime.now", "time.sleep", "time.time", "logging.info", "numpy.array", "os.path.expanduser", "click.write_handler", "sys.exit" ]
[((5615, 5638), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (5636, 5638), False, 'import optparse\n'), ((6473, 6562), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'lvl', 'format': 'LOG_FORMAT', 'filename': 'options.log', 'filemode': '"""w"""'}), "(level=lvl, format=LOG_FORMAT, fi...
# coding=utf-8 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib.colors import LinearSegmentedColormap import seaborn as sns color_names = ["windows blue", "red", "amber", "faded green", ...
[ "matplotlib.pyplot.title", "matplotlib.colors.LinearSegmentedColormap", "numpy.argmax", "numpy.ravel", "numpy.ones", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.tight_layout", "numpy.atleast_2d", "numpy.meshgrid", "seaborn.xkcd_palette", "matplotlib.pyplot.colorbar", "nump...
[((645, 674), 'seaborn.xkcd_palette', 'sns.xkcd_palette', (['color_names'], {}), '(color_names)\n', (661, 674), True, 'import seaborn as sns\n'), ((675, 697), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (688, 697), True, 'import seaborn as sns\n'), ((698, 722), 'seaborn.set_context', 'sn...
import os import collections from os.path import join import numpy as np import pandas as pd from itertools import chain from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import ShuffleSplit, GridSearchCV from sklearn.metrics import (me...
[ "sklearn.model_selection.GridSearchCV", "ukbb_variables.brain_dmri_l1.items", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.r2_score", "sklearn.metrics.mean_absolute_error", "ukbb_variables.brain_dmri_icvf.items", "numpy.arange", "os.path.join", "ukbb_variables.br...
[((1547, 1614), 'pandas.read_csv', 'pd.read_csv', (['path_to_csv'], {'usecols': "['20016-2.0', 'eid', '20127-0.0']"}), "(path_to_csv, usecols=['20016-2.0', 'eid', '20127-0.0'])\n", (1558, 1614), True, 'import pandas as pd\n'), ((1707, 1740), 'pandas.DataFrame', 'pd.DataFrame', (['ukbb'], {'index': 'y.index'}), '(ukbb, ...
import sys # nopep8 cmd_folder = "../../../vis" # nopep8 if cmd_folder not in sys.path: # nopep8 sys.path.insert(0, cmd_folder) from get_boxlib import get_files, get_time from tile_mov import tile_movie from make_mov import make_all, get_particle_trajectories import numpy as np import pylab as plt import matpl...
[ "mpl_toolkits.axes_grid1.make_axes_locatable", "pylab.close", "numpy.ma.masked_where", "matplotlib.colors.Normalize", "matplotlib.patches.Rectangle", "matplotlib.collections.PatchCollection", "sys.path.insert", "make_mov.make_all", "pylab.colorbar", "numpy.array", "pylab.figure", "pylab.fill",...
[((4696, 4794), 'get_boxlib.get_files', 'get_files', (["q['files_dir']"], {'include': "q['file_include']", 'exclude': "q['file_exclude']", 'get_all': '(True)'}), "(q['files_dir'], include=q['file_include'], exclude=q[\n 'file_exclude'], get_all=True)\n", (4705, 4794), False, 'from get_boxlib import get_files, get_ti...
from __future__ import division import os import os.path as op import numpy as np from scipy.spatial import KDTree import nibabel as nib import nibabel.freesurfer as nifs from nibabel.affines import apply_affine def vol_to_surf_xfm(vol_fname, reg_fname): """Obtain a transformation from vol voxels -> Freesurfer...
[ "nibabel.affines.apply_affine", "nibabel.load", "numpy.zeros", "numpy.genfromtxt", "numpy.linalg.inv", "nibabel.freesurfer.read_geometry", "numpy.dot" ]
[((869, 923), 'numpy.genfromtxt', 'np.genfromtxt', (['reg_fname'], {'skip_header': '(4)', 'skip_footer': '(1)'}), '(reg_fname, skip_header=4, skip_footer=1)\n', (882, 923), True, 'import numpy as np\n'), ((944, 972), 'numpy.linalg.inv', 'np.linalg.inv', (['anat2func_xfm'], {}), '(anat2func_xfm)\n', (957, 972), True, 'i...
import numpy as np def TSNR(noisy_stft, signal_gains, noise_estimation): """ Reconstructs the signal by re-adding phase components to the magnitude estimate :param noisy_stft: stft of original noisy signal :param signal_gains: gains of each stft frame returned by DD :param noise_estimation: noise e...
[ "numpy.abs", "numpy.divide", "numpy.zeros", "numpy.asarray" ]
[((593, 634), 'numpy.zeros', 'np.zeros', (['noisy_stft.shape'], {'dtype': 'complex'}), '(noisy_stft.shape, dtype=complex)\n', (601, 634), True, 'import numpy as np\n'), ((721, 756), 'numpy.abs', 'np.abs', (['noisy_stft[:, frame_number]'], {}), '(noisy_stft[:, frame_number])\n', (727, 756), True, 'import numpy as np\n')...
import numpy as np from functools import partial, update_wrapper from itertools import product from tensorflow.keras import backend as K def wrapped_partial(func, *args, **kwargs): partial_func = partial(func, *args, **kwargs) update_wrapper(partial_func, func) return partial_func def w_categorical_cros...
[ "functools.partial", "tensorflow.keras.backend.floatx", "numpy.std", "tensorflow.keras.backend.shape", "tensorflow.keras.backend.zeros_like", "numpy.ones", "tensorflow.keras.backend.max", "functools.update_wrapper", "numpy.mean", "tensorflow.keras.backend.categorical_crossentropy", "tensorflow.k...
[((202, 232), 'functools.partial', 'partial', (['func', '*args'], {}), '(func, *args, **kwargs)\n', (209, 232), False, 'from functools import partial, update_wrapper\n'), ((237, 271), 'functools.update_wrapper', 'update_wrapper', (['partial_func', 'func'], {}), '(partial_func, func)\n', (251, 271), False, 'from functoo...
# Domain Adaptation experiments import os import random import argparse import copy import pprint import distutils import distutils.util from omegaconf import OmegaConf import numpy as np from tqdm import tqdm import torch from adapt.models.models import get_model from adapt.solvers.solver import get_solver from dat...
[ "adapt.solvers.solver.get_solver", "utils.test", "numpy.random.seed", "argparse.ArgumentParser", "torch.device", "os.path.join", "utils.train_source_model", "torch.load", "os.path.exists", "utils.get_embedding", "random.seed", "copy.deepcopy", "adapt.models.models.get_model", "distutils.ut...
[((383, 400), 'random.seed', 'random.seed', (['(1234)'], {}), '(1234)\n', (394, 400), False, 'import random\n'), ((401, 424), 'torch.manual_seed', 'torch.manual_seed', (['(1234)'], {}), '(1234)\n', (418, 424), False, 'import torch\n'), ((425, 445), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (4...
# -*- coding: utf-8 -*- """ Created on Fri Jun 20 19:06:55 2014 @author: <NAME> This program controls the mirrors attached to the galvos. The position of one mirror is controlled by a sine wave, the other mirror is controlled by a cosine wave. When a laser is reflected off both mirrors, it spins in a circle. This...
[ "ctypes.byref", "os.path.realpath", "os.path.dirname", "time.time", "numpy.sin", "numpy.arange", "PyQt4.QtCore.pyqtSlot", "numpy.cos", "os.path.expanduser", "numpy.concatenate", "PyQt4.QtCore.pyqtSignal" ]
[((4274, 4282), 'PyQt4.QtCore.pyqtSignal', 'Signal', ([], {}), '()\n', (4280, 4282), True, 'from PyQt4.QtCore import pyqtSignal as Signal\n'), ((15467, 15478), 'PyQt4.QtCore.pyqtSignal', 'Signal', (['int'], {}), '(int)\n', (15473, 15478), True, 'from PyQt4.QtCore import pyqtSignal as Signal\n'), ((16629, 16645), 'PyQt4...
import numpy as np import pandas as pd from tabulate import tabulate np.set_printoptions(suppress=True) np.set_printoptions(threshold=np.inf) loc = "./build/results_neural-network-runtime.csv" df = pd.read_csv(loc, sep=";", header=0) nb_iters = 11 IEs = ["OpenVINO CPU", "OpenVINO GPU", "TensorRT"] ret = [] for i i...
[ "pandas.read_csv", "numpy.set_printoptions", "numpy.std", "numpy.mean" ]
[((69, 103), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (88, 103), True, 'import numpy as np\n'), ((104, 141), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (123, 141), True, 'import numpy as np\n'), ((200...
import numpy as np from scipy.special import logsumexp import ctypes import os import platform if platform.system() == "Linux": lpm_lib = np.ctypeslib.load_library("liblpm_lib.so", "bin/") elif platform.system() == "Darwin": lpm_lib = np.ctypeslib.load_library("liblpm_lib.dylib", "bin/") np.random.seed(1...
[ "numpy.ctypeslib.load_library", "numpy.random.seed", "ctypes.c_double", "os.makedirs", "os.getcwd", "os.path.exists", "numpy.random.randint", "ctypes.c_long", "platform.system", "ctypes.c_uint" ]
[((304, 323), 'numpy.random.seed', 'np.random.seed', (['(111)'], {}), '(111)\n', (318, 323), True, 'import numpy as np\n'), ((336, 347), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (345, 347), False, 'import os\n'), ((452, 474), 'ctypes.c_uint', 'ctypes.c_uint', (['n_genes'], {}), '(n_genes)\n', (465, 474), False, 'imp...
import numpy as np new_inds = np.linspace(0, 159, num=10, dtype=int) print(new_inds)
[ "numpy.linspace" ]
[((30, 68), 'numpy.linspace', 'np.linspace', (['(0)', '(159)'], {'num': '(10)', 'dtype': 'int'}), '(0, 159, num=10, dtype=int)\n', (41, 68), True, 'import numpy as np\n')]
""" The :mod:`sklearn.utils` module includes various utilities. """ from collections import Sequence import numpy as np from scipy.sparse import issparse import warnings from .murmurhash import murmurhash3_32 from .validation import (as_float_array, assert_all_finite, ...
[ "scipy.sparse.issparse", "numpy.asarray", "numpy.arange", "warnings.warn", "numpy.issubdtype" ]
[((3586, 3602), 'numpy.asarray', 'np.asarray', (['mask'], {}), '(mask)\n', (3596, 3602), True, 'import numpy as np\n'), ((3610, 3643), 'numpy.issubdtype', 'np.issubdtype', (['mask.dtype', 'np.int'], {}), '(mask.dtype, np.int)\n', (3623, 3643), True, 'import numpy as np\n'), ((10473, 10484), 'scipy.sparse.issparse', 'is...
import argparse import math from collections import namedtuple from itertools import count from tqdm import tqdm from tensorboardX import SummaryWriter from environment import VoltageCtrl_nonlinear,create_56bus import os import gym import numpy as np from gym import wrappers import torch from ddpg import DDPG from na...
[ "tensorboardX.SummaryWriter", "replay_memory.ReplayMemory", "numpy.random.seed", "argparse.ArgumentParser", "torch.manual_seed", "param_noise.AdaptiveParamNoiseSpec", "numpy.savetxt", "environment.VoltageCtrl_nonlinear", "environment.create_56bus", "ddpg.DDPG", "torch.cat", "torch.save", "nu...
[((659, 723), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch REINFORCE example"""'}), "(description='PyTorch REINFORCE example')\n", (682, 723), False, 'import argparse\n'), ((2659, 2674), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (2672, 2674), False, 'from...
''' @name: train_robot.py @brief: Starts a ppo2-training process. It is expected that move_base, simulation etc is started.(roslaunch rl_setup_bringup setup.launch) @author: <NAME> @version: 3.5 @date: 2019/04/05 ''' from email import policy import os import sys from rl_agent.env_...
[ "numpy.random.seed", "random.randint", "os.makedirs", "stable_baselines.ppo2.PPO2.load", "rospkg.RosPack", "stable_baselines.results_plotter.load_results", "os.path.exists", "rl_agent.env_utils.state_collector_rosnav.StateCollector", "numpy.mean", "random.seed", "rospy.init_node", "stable_base...
[((4535, 4558), 'random.randint', 'random.randint', (['(0)', '(1000)'], {}), '(0, 1000)\n', (4549, 4558), False, 'import random\n'), ((4562, 4582), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (4576, 4582), True, 'import numpy as np\n'), ((4623, 4640), 'random.seed', 'random.seed', (['seed'], {}),...
"""Tile pyramid generation in standard formats. Included methods are DeepZoom and Zoomify in addition to a generic method. These are generally intended for serialisation or streaming via a web UI. The `get_tile` method returns a Pillow Image object which can be easily serialised via the use of an io.BytesIO object or...
[ "numpy.divide", "io.BytesIO", "zipfile.ZipFile", "warnings.simplefilter", "numpy.log2", "time.time", "pathlib.Path", "tiatoolbox.utils.transforms.imresize", "numpy.array", "defusedxml.defuse_stdlib", "warnings.catch_warnings", "PIL.Image.fromarray", "tarfile.TarFile.open", "functools.lru_c...
[((693, 719), 'defusedxml.defuse_stdlib', 'defusedxml.defuse_stdlib', ([], {}), '()\n', (717, 719), False, 'import defusedxml\n'), ((1911, 1934), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (1920, 1934), False, 'from functools import lru_cache\n'), ((2099, 2122), 'functools.lru_ca...
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- import healpy import numpy as np import os import matplotlib.pyplot as plt print("-- This code will create a mask from the Sky Map for Plank/HFI.") # Change this to find a suitable mask THRESHOLD = 0.01 print("* Threshold: ", THRESHOLD) # Load the HFI 353 GHz map from...
[ "healpy.write_map", "os.remove", "matplotlib.pyplot.show", "healpy.mollview", "numpy.deg2rad", "healpy.rotator.Rotator", "healpy.ud_grade", "os.path.isfile", "numpy.min", "numpy.max", "healpy.read_map", "matplotlib.pyplot.savefig" ]
[((417, 504), 'healpy.read_map', 'healpy.read_map', (['"""Milky_Way/HFI_SkyMap_353-psb_2048_R3.01_full.fits"""'], {'verbose': '(False)'}), "('Milky_Way/HFI_SkyMap_353-psb_2048_R3.01_full.fits',\n verbose=False)\n", (432, 504), False, 'import healpy\n'), ((616, 644), 'healpy.ud_grade', 'healpy.ud_grade', (['hfi353', ...
import epipack import numpy as np from epipack.stochastic_epi_models import StochasticEpiModel from math import exp from numpy import random import networkx as nx from smallworld import get_smallworld_graph from scipy.stats import expon import numpy as np import networkx as nx def _edge(i,j): if i > j: ret...
[ "numpy.random.choice", "math.exp", "numpy.random.binomial", "networkx.selfloop_edges", "scipy.stats.expon.rvs", "numpy.argsort", "numpy.random.randint", "numpy.array", "networkx.Graph", "numpy.linspace", "numpy.random.permutation", "smallworld.get_smallworld_graph", "epipack.StochasticEpiMod...
[((510, 527), 'networkx.empty_graph', 'nx.empty_graph', (['N'], {}), '(N)\n', (524, 527), True, 'import networkx as nx\n'), ((2486, 2497), 'numpy.array', 'np.array', (['P'], {}), '(P)\n', (2494, 2497), True, 'import numpy as np\n'), ((3316, 3355), 'smallworld.get_smallworld_graph', 'get_smallworld_graph', (['N', 'k_ove...
import os import cv2 import math import time import torch import ntpath from PIL import Image import numpy as np from configs import load_config, load_config_far_away import matplotlib.pyplot as plt from tqdm import tqdm from utils.bbox_tools import xywh2xyxy, xyxy2xywh, draw_bbox, grid_analysis from datasetsnx import...
[ "configs.load_config", "numpy.set_printoptions", "math.ceil", "numpy.zeros", "time.sleep", "utils.bbox_tools.xyxy2xywh", "numpy.max", "datasetsnx.create_data_manager", "numpy.array", "numpy.round", "visualization.visualizer.Visualizer" ]
[((4256, 4280), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1)'], {}), '((n + 1, n + 1))\n', (4264, 4280), True, 'import numpy as np\n'), ((5867, 5891), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1)'], {}), '((n + 1, n + 1))\n', (5875, 5891), True, 'import numpy as np\n'), ((6926, 6973), 'numpy.set_printoptions', 'np.set_...
import numpy as np from numpy.linalg import norm import pickle import matplotlib.pyplot as plt import itertools from scipy.stats import norm as norm_d from scipy.stats import expon from scipy.stats import weibull_min as weibull from scipy.stats import burr12 as burr from scipy.stats import randint from scipy.stats impo...
[ "matplotlib.pyplot.title", "pickle.dump", "pathlib.Path", "matplotlib.pyplot.figure", "pickle.load", "numpy.linalg.norm", "itertools.cycle", "scipy.sparse.linalg.svds", "matplotlib.pyplot.yticks", "numpy.insert", "matplotlib.pyplot.xticks", "matplotlib.pyplot.legend", "sklearn.datasets.load_...
[((769, 797), 'sklearn.datasets.load_svmlight_file', 'load_svmlight_file', (['filename'], {}), '(filename)\n', (787, 797), False, 'from sklearn.datasets import load_svmlight_file\n'), ((1185, 1213), 'sklearn.datasets.load_svmlight_file', 'load_svmlight_file', (['filename'], {}), '(filename)\n', (1203, 1213), False, 'fr...
# Repository: https://gitlab.com/quantify-os/quantify-scheduler # Licensed according to the LICENCE file on the master branch """ Contains function to generate most basic waveforms. These functions are intended to be used to generate waveforms defined in the :mod:`~.pulse_library`. Examples of waveforms that are too a...
[ "numpy.deg2rad", "numpy.sin", "numpy.array", "numpy.exp", "numpy.cos", "scipy.signal.convolve" ]
[((1560, 1572), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1568, 1572), True, 'import numpy as np\n'), ((6425, 6442), 'numpy.deg2rad', 'np.deg2rad', (['phase'], {}), '(phase)\n', (6435, 6442), True, 'import numpy as np\n'), ((7249, 7281), 'numpy.cos', 'np.cos', (['(2 * np.pi * freq_mod * t)'], {}), '(2 * np.pi...
import re import time import math import sys import os import psutil from abc import ABCMeta, abstractmethod from pathlib import Path from contextlib import contextmanager import pandas as pd import numpy as np def reduce_mem_usage(df): start_mem = df.memory_usage().sum() / 1024**2 print('Memory usage of data...
[ "pandas.DataFrame", "os.getpid", "math.fabs", "pandas.read_feather", "numpy.iinfo", "time.time", "numpy.finfo", "pathlib.Path", "pandas.concat" ]
[((1720, 1731), 'time.time', 'time.time', ([], {}), '()\n', (1729, 1731), False, 'import time\n'), ((2891, 2913), 'pandas.concat', 'pd.concat', (['dfs'], {'axis': '(1)'}), '(dfs, axis=1)\n', (2900, 2913), True, 'import pandas as pd\n'), ((2994, 3016), 'pandas.concat', 'pd.concat', (['dfs'], {'axis': '(1)'}), '(dfs, axi...
# -*- coding: utf-8 -*- """ Created on Fri Feb 23 09:35:54 2018 @author: Pavel Tests function in random_background.py Since these tests are based on random functions or random number generators, each function is tested several times to ensure that it behaves correctly. """ import unittest import os, sys from PIL i...
[ "sys.path.append", "unittest.main", "os.unlink", "os.path.realpath", "PIL.Image.open", "numpy.shape", "os.path.isfile", "os.path.join", "os.listdir" ]
[((379, 405), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (395, 405), False, 'import os, sys\n'), ((432, 465), 'os.path.join', 'os.path.join', (['dir_path', 'os.pardir'], {}), '(dir_path, os.pardir)\n', (444, 465), False, 'import os, sys\n'), ((495, 526), 'os.path.join', 'os.path.join', ...
# -*- coding: utf-8 -*- # mpc_nbody/mpc_nbody/parse_input.py ''' ---------------------------------------------------------------------------- mpc_nbody's module for parsing OrbFit + ele220 elements Mar 2020 <NAME> & <NAME> & <NAME> This module provides functionalities to (a) read an OrbFit .fel/.eq fi...
[ "sys.path.append", "mpcpp.MPC_library.rotate_matrix", "getpass.getuser", "astropy.time.Time", "os.path.dirname", "numpy.zeros", "numpy.ones", "numpy.array", "numpy.atleast_1d", "sys.exit", "numpy.block" ]
[((829, 846), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (844, 846), False, 'import getpass\n'), ((923, 979), 'sys.path.append', 'sys.path.append', (['"""/Users/matthewjohnpayne/Envs/mpcvenv/"""'], {}), "('/Users/matthewjohnpayne/Envs/mpcvenv/')\n", (938, 979), False, 'import os, sys\n'), ((1392, 1417), 'o...
import cv2 import numpy as np img = np.ones([5, 5], dtype=np.uint8) * 9 mask = np.zeros([5, 5], dtype=np.uint8) mask[0:3, 0] = 1 mask[2:5, 2:4] = 1 roi = cv2.bitwise_and(img, img, mask=mask) print("img=\n", img) print("mask=\n", mask) print("roi=\n", roi)
[ "numpy.zeros", "numpy.ones", "cv2.bitwise_and" ]
[((80, 112), 'numpy.zeros', 'np.zeros', (['[5, 5]'], {'dtype': 'np.uint8'}), '([5, 5], dtype=np.uint8)\n', (88, 112), True, 'import numpy as np\n'), ((155, 191), 'cv2.bitwise_and', 'cv2.bitwise_and', (['img', 'img'], {'mask': 'mask'}), '(img, img, mask=mask)\n', (170, 191), False, 'import cv2\n'), ((37, 68), 'numpy.one...
r"""Module with spin-weight related utilities. Conventions are $_{\pm |s|} X_{lm} = - (\pm)^{|s|} (G_{lm} \pm i C_{lm})$. For CMB maps, $ _{0}X_{lm} = T_{lm} $ $ _{\pm}X_{lm} = -1/2 (E_{lm} \pm i B_{lm}) $ hence $ G^{0}_{lm} = -T_{lm} $ $ G^{2}_{lm} = E_{lm} $ $ C^{2}_{lm} = B_{l...
[ "healpy.alm2map", "numpy.iscomplexobj", "numpy.copy", "healpy.map2alm", "numpy.zeros", "plancklens.wigners.wigners.wignerpos", "numpy.any", "numpy.imag", "healpy.map2alm_spin", "numpy.real", "numpy.sign", "plancklens.wigners.wigners.get_xgwg", "plancklens.wigners.wigners.wignercoeff", "hea...
[((3046, 3077), 'numpy.zeros', 'np.zeros', (['(lmax + 1)'], {'dtype': 'float'}), '(lmax + 1, dtype=float)\n', (3054, 3077), True, 'import numpy as np\n'), ((3403, 3434), 'numpy.zeros', 'np.zeros', (['(lmax + 1)'], {'dtype': 'float'}), '(lmax + 1, dtype=float)\n', (3411, 3434), True, 'import numpy as np\n'), ((522, 573)...
import tensorflow as tf import numpy as np SEED = 23455 rdm = np.random.RandomState(seed=SEED) # 生成[0,1)之间的随机数 x = rdm.rand(32, 2) y_ = [[x1 + x2 + (rdm.rand() / 10.0 - 0.05)] for (x1, x2) in x] # 生成噪声[0,1)/10=[0,0.1); [0,0.1)-0.05=[-0.05,0.05) x = tf.cast(x, dtype=tf.float32) w1 = tf.Variable(tf.random.normal([2,...
[ "tensorflow.random.normal", "numpy.random.RandomState", "tensorflow.cast", "tensorflow.matmul", "tensorflow.square", "tensorflow.GradientTape" ]
[((64, 96), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'SEED'}), '(seed=SEED)\n', (85, 96), True, 'import numpy as np\n'), ((253, 281), 'tensorflow.cast', 'tf.cast', (['x'], {'dtype': 'tf.float32'}), '(x, dtype=tf.float32)\n', (260, 281), True, 'import tensorflow as tf\n'), ((300, 342), 'tensorf...
import glob import os import numpy as np import torch from PIL import Image from skimage.transform import resize from torch.utils.data import Dataset # import matplotlib.pyplot as plt # import matplotlib.patches as patches class ImageFolder(Dataset): def __init__(self, folder_path, img_size=416): self.fil...
[ "numpy.pad", "numpy.abs", "numpy.zeros", "numpy.transpose", "os.path.exists", "PIL.Image.open", "skimage.transform.resize", "numpy.loadtxt", "glob.glob", "torch.from_numpy" ]
[((619, 632), 'numpy.abs', 'np.abs', (['(h - w)'], {}), '(h - w)\n', (625, 632), True, 'import numpy as np\n'), ((1014, 1069), 'skimage.transform.resize', 'resize', (['input_img', '(*self.img_shape, 3)'], {'mode': '"""reflect"""'}), "(input_img, (*self.img_shape, 3), mode='reflect')\n", (1020, 1069), False, 'from skima...
import numpy as np import ruptures as rpt from sss_object_detection.consts import ObjectID class CPDetector: """Change point detector using window sliding for segmentation""" def __init__(self): self.buoy_width = 19 self.min_mean_diff_ratio = 1.55 def detect(self, ping): """Detect...
[ "ruptures.Window", "numpy.mean" ]
[((1124, 1154), 'numpy.mean', 'np.mean', (['ping[bkps[0]:bkps[1]]'], {}), '(ping[bkps[0]:bkps[1]])\n', (1131, 1154), True, 'import numpy as np\n'), ((1374, 1394), 'numpy.mean', 'np.mean', (['prev_window'], {}), '(prev_window)\n', (1381, 1394), True, 'import numpy as np\n'), ((1397, 1417), 'numpy.mean', 'np.mean', (['po...
import numpy as np def calculate_q(p_seq): """ Benjamini-Hochberg method """ p_arr = np.array(p_seq) n_genes = len(p_arr) sort_index_arr = np.argsort(p_arr) p_sorted_arr = p_arr[sort_index_arr] q_arr = p_sorted_arr * n_genes / (np.arange(n_genes) + 1) q_min = q_arr...
[ "numpy.argsort", "numpy.random.rand", "numpy.array", "numpy.arange" ]
[((103, 118), 'numpy.array', 'np.array', (['p_seq'], {}), '(p_seq)\n', (111, 118), True, 'import numpy as np\n'), ((168, 185), 'numpy.argsort', 'np.argsort', (['p_arr'], {}), '(p_arr)\n', (178, 185), True, 'import numpy as np\n'), ((562, 579), 'numpy.random.rand', 'np.random.rand', (['(5)'], {}), '(5)\n', (576, 579), T...
import torch import torch.nn as nn import torchvision.transforms as transforms import torchvision.datasets as dsets from torch.autograd import Variable import numpy as np import matplotlib.pyplot as plot train_dataset = dsets.MNIST(root='./data/MNIST', train=True, ...
[ "matplotlib.pyplot.show", "torch.nn.ReLU", "matplotlib.pyplot.imshow", "torch.nn.CrossEntropyLoss", "torch.nn.Sigmoid", "torch.cuda.is_available", "torch.max", "torch.nn.Linear", "numpy.random.rand", "torchvision.transforms.ToTensor" ]
[((699, 733), 'matplotlib.pyplot.imshow', 'plot.imshow', (['show_img'], {'cmap': '"""gray"""'}), "(show_img, cmap='gray')\n", (710, 733), True, 'import matplotlib.pyplot as plot\n'), ((799, 810), 'matplotlib.pyplot.show', 'plot.show', ([], {}), '()\n', (808, 810), True, 'import matplotlib.pyplot as plot\n'), ((1480, 15...
import torch from datasetsFunctions import Maps, pad import argparse from models import segmentationModel import matplotlib.pyplot as plt import numpy as np from pathlib import Path import json def main(): parser = argparse.ArgumentParser(description='Tree Generation') parser.add_argument('--ba...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "argparse.ArgumentParser", "torch.utils.data.DataLoader", "matplotlib.pyplot.imshow", "torch.load", "numpy.zeros", "pathlib.Path", "datasetsFunctions.pad", "models.segmentationModel", "torch.cuda.is_available", "torch.no_grad", "datasetsFu...
[((235, 289), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tree Generation"""'}), "(description='Tree Generation')\n", (258, 289), False, 'import argparse\n'), ((866, 888), 'pathlib.Path', 'Path', (['args.datasetPath'], {}), '(args.datasetPath)\n', (870, 888), False, 'from pathlib impo...
import random import numpy as np import cv2 as cv frame1 = cv.imread(cv.samples.findFile('lena.jpg')) if frame1 is None: print("image not found") exit() frame = np.vstack((frame1,frame1)) facemark = cv.face.createFacemarkLBF() try: facemark.loadModel(cv.samples.findFile('lbfmodel.yaml')) except cv.error: ...
[ "random.randint", "cv2.waitKey", "cv2.face.createFacemarkLBF", "cv2.samples.findFile", "cv2.face.drawFacemarks", "cv2.imshow", "numpy.vstack" ]
[((170, 197), 'numpy.vstack', 'np.vstack', (['(frame1, frame1)'], {}), '((frame1, frame1))\n', (179, 197), True, 'import numpy as np\n'), ((208, 235), 'cv2.face.createFacemarkLBF', 'cv.face.createFacemarkLBF', ([], {}), '()\n', (233, 235), True, 'import cv2 as cv\n'), ((764, 789), 'cv2.imshow', 'cv.imshow', (['"""Image...
# import external modules import numpy, os # Add Exasim to Python search path cdir = os.getcwd(); ii = cdir.find("Exasim"); exec(open(cdir[0:(ii+6)] + "/Installation/setpath.py").read()); # import internal modules import Preprocessing, Postprocessing, Gencode, Mesh # Create pde object and mesh object pde,mesh = Prep...
[ "os.getcwd", "numpy.ones", "Preprocessing.initializeexasim", "Postprocessing.exasim", "numpy.arange", "numpy.array", "Mesh.SquareMesh" ]
[((86, 97), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (95, 97), False, 'import numpy, os\n'), ((316, 348), 'Preprocessing.initializeexasim', 'Preprocessing.initializeexasim', ([], {}), '()\n', (346, 348), False, 'import Preprocessing, Postprocessing, Gencode, Mesh\n'), ((1053, 1093), 'numpy.arange', 'numpy.arange', (...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # # 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 # # ...
[ "numpy.load", "torch.argmax", "numpy.shape", "pickle.load", "numpy.mean", "networks.RecursiveUNet.UNet", "torch.no_grad", "os.path.join", "datasets.two_dim.NumpyDataLoader.NumpyDataSet", "torch.optim.lr_scheduler.ReduceLROnPlateau", "os.path.exists", "loss_functions.metrics.dice_pytorch", "n...
[((2286, 2420), 'datasets.two_dim.NumpyDataLoader.NumpyDataSet', 'NumpyDataSet', (['self.config.scaled_image_64_dir'], {'target_size': '(64)', 'batch_size': 'self.config.batch_size', 'keys': 'tr_keys', 'do_reshuffle': '(True)'}), '(self.config.scaled_image_64_dir, target_size=64, batch_size=\n self.config.batch_size...
# Copyright 2020, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
[ "tensorflow_federated.SequenceType", "absl.testing.absltest.main", "tensorflow_federated.backends.native.set_local_python_execution_context", "tensorflow.config.list_logical_devices", "tensorflow.data.Dataset.range", "numpy.int64", "absl.testing.parameterized.named_parameters", "tensorflow_federated.f...
[((2350, 2730), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('iter_server_on_cpu', 'CPU', _create_tff_parallel_clients_with_iter_dataset)", "('iter_server_on_tpu', 'TPU', _create_tff_parallel_clients_with_iter_dataset)", "('reduce_server_on_cpu', 'CPU',\n _create_tff_parallel_...
"""Provide classes to perform private training and private prediction with logistic regression""" import tensorflow as tf import tf_encrypted as tfe import math import numpy as np import time from sklearn.linear_model import LogisticRegression # class LogisticRegression: # """Contains methods to build and train logis...
[ "numpy.load", "tf_encrypted.reshape", "tensorflow.reduce_sum", "numpy.argmax", "tensorflow.print", "tensorflow.reshape", "tensorflow.string_split", "numpy.exp", "tensorflow.string_to_number", "tensorflow.random.uniform", "tf_encrypted.define_constant", "tf_encrypted.matmul", "tf_encrypted.in...
[((3650, 3763), 'numpy.loadtxt', 'np.loadtxt', (['"""/disk/wqruan/Pretrain/Handcrafted-DP/transfer/models/imdbinitial_model.csv"""'], {'delimiter': '""","""'}), "(\n '/disk/wqruan/Pretrain/Handcrafted-DP/transfer/models/imdbinitial_model.csv'\n , delimiter=',')\n", (3660, 3763), True, 'import numpy as np\n'), ((8...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from modules.frame import MultiScaleFrameNetwork from modules.geometric import global_to_local from modules.rsconv import OrientedAnchoredRSConv from ._registry import register_model def get_hierarchical_idx(n, h=[512, 128, ]): ...
[ "modules.frame.MultiScaleFrameNetwork", "torch.nn.Dropout", "torch.nn.ReLU", "modules.geometric.global_to_local", "modules.rsconv.OrientedAnchoredRSConv", "torch.nn.Conv1d", "torch.nn.BatchNorm1d", "torch.nn.functional.cross_entropy", "numpy.arange" ]
[((327, 339), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (336, 339), True, 'import numpy as np\n'), ((651, 859), 'modules.frame.MultiScaleFrameNetwork', 'MultiScaleFrameNetwork', ([], {'hidden_dims': '(cfg.frame.hidden_dim_s, cfg.frame.hidden_dim_v)', 'num_layers': 'cfg.frame.num_layers', 'num_frames': 'cfg.fra...
import os import os.path as op from shutil import copyfile import numpy as np from scipy import sparse import pytest from numpy.testing import assert_array_equal, assert_allclose, assert_equal from mne.datasets import testing from mne import read_surface, write_surface, decimate_surface, pick_types from mne.surface ...
[ "numpy.sum", "mne.pick_types", "mne.utils._TempDir", "mne.utils.run_tests_if_main", "mne.surface.fast_cross_3d", "mne.surface.get_meg_helmet_surf", "numpy.arange", "mne.surface.read_curvature", "os.path.join", "scipy.sparse.eye", "mne.read_surface", "numpy.zeros_like", "mne.utils.catch_loggi...
[((741, 774), 'mne.datasets.testing.data_path', 'testing.data_path', ([], {'download': '(False)'}), '(download=False)\n', (758, 774), False, 'from mne.datasets import testing\n'), ((790, 820), 'os.path.join', 'op.join', (['data_path', '"""subjects"""'], {}), "(data_path, 'subjects')\n", (797, 820), True, 'import os.pat...
#!/usr/bin/env python3 import os from importlib import import_module from itertools import count import numpy as np import tensorflow as tf import common def flip_augment(image, fid, pid): """ Returns both the original and the horizontal flip of an image. """ images = tf.stack([image, tf.reverse(image, [1])]...
[ "tensorflow.reset_default_graph", "numpy.mean", "tensorflow.contrib.data.unbatch", "common.load_dataset", "tensorflow.subtract", "tensorflow.stack", "tensorflow.control_dependencies", "importlib.import_module", "tensorflow.reverse", "tensorflow.train.Saver", "tensorflow.add", "tensorflow.Sessi...
[((624, 658), 'tensorflow.subtract', 'tf.subtract', (['image_size', 'crop_size'], {}), '(image_size, crop_size)\n', (635, 658), True, 'import tensorflow as tf\n'), ((677, 782), 'tensorflow.assert_non_negative', 'tf.assert_non_negative', (['crop_margin'], {'message': '"""Crop size must be smaller or equal to the image s...
# -*- coding: utf-8 -*- """ Created on Tue Mar 5 16:37:53 2019 @author: sdenaro """ import pandas as pd import numpy as np def setup(year,operating_horizon,perfect_foresight): #read generator parameters into DataFrame df_gen = pd.read_csv('PNW_data_file/generators.csv',header=0) zone = ['PNW'] ##t...
[ "pandas.DataFrame", "numpy.sum", "os.makedirs", "pandas.read_csv", "pandas.read_excel", "pathlib.Path.cwd", "shutil.copy" ]
[((240, 293), 'pandas.read_csv', 'pd.read_csv', (['"""PNW_data_file/generators.csv"""'], {'header': '(0)'}), "('PNW_data_file/generators.csv', header=0)\n", (251, 293), True, 'import pandas as pd\n'), ((367, 468), 'pandas.read_csv', 'pd.read_csv', (['"""../Stochastic_engine/Synthetic_demand_pathflows/Sim_hourly_load.cs...
"""Add points on nD shapes in 3D using a mouse callback""" import napari import numpy as np # Create rectangles in 4D shapes_data = np.array( [ [ [0, 50, 75, 75], [0, 50, 125, 75], [0, 100, 125, 125], [0, 100, 75, 125] ], [ [0, 10,...
[ "numpy.array", "napari.view_points", "napari.run" ]
[((133, 383), 'numpy.array', 'np.array', (['[[[0, 50, 75, 75], [0, 50, 125, 75], [0, 100, 125, 125], [0, 100, 75, 125]],\n [[0, 10, 75, 75], [0, 10, 125, 75], [0, 40, 125, 125], [0, 40, 75, 125]\n ], [[1, 100, 75, 75], [1, 100, 125, 75], [1, 50, 125, 125], [1, 50, 75,\n 125]]]'], {}), '([[[0, 50, 75, 75], [0, ...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "common.data.load_dataset", "os.path.join", "absl.app.run", "numpy.array", "numpy.arange", "training.train_baseline.TrainLoop", "absl.logging.set_verbosity" ]
[((1054, 1101), 'numpy.array', 'np.array', (['less_than_threshold'], {'dtype': 'np.float32'}), '(less_than_threshold, dtype=np.float32)\n', (1062, 1101), True, 'import numpy as np\n'), ((1242, 1274), 'common.data.load_dataset', 'data.load_dataset', (['FLAGS.dataset'], {}), '(FLAGS.dataset)\n', (1259, 1274), True, 'impo...
""" The tests in this package are to ensure the proper resultant dtypes of set operations. """ import numpy as np import pytest from pandas.core.dtypes.common import is_dtype_equal import pandas as pd from pandas import ( CategoricalIndex, DatetimeIndex, Float64Index, Int64Index, MultiIndex, R...
[ "pandas.api.types.pandas_dtype", "pandas._testing.equalContents", "pandas._testing.assert_produces_warning", "numpy.asarray", "numpy.dtype", "pytest.skip", "pandas.core.dtypes.common.is_dtype_equal", "pandas.Index", "pandas.api.types.is_datetime64tz_dtype", "pytest.xfail", "pytest.raises", "pa...
[((2494, 3133), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""left, right, expected"""', "[('int64', 'int64', 'int64'), ('int64', 'uint64', 'object'), ('int64',\n 'float64', 'float64'), ('uint64', 'float64', 'float64'), ('uint64',\n 'uint64', 'uint64'), ('float64', 'float64', 'float64'), (\n 'dat...
import logging import coloredlogs import matplotlib.pyplot as plt import numpy as np from neubio.analyze import find_epsp_peak, epsp_slope from neubio.filter import butter_lpf, subtract_baseline, t_crop from neubio.io import load_frame_group logger = logging.getLogger(__name__) logging.getLogger("matplotlib").setLev...
[ "neubio.filter.subtract_baseline", "numpy.abs", "numpy.argmax", "logging.getLogger", "numpy.histogram", "neubio.io.load_frame_group", "matplotlib.pyplot.cla", "neubio.analyze.find_epsp_peak", "matplotlib.pyplot.subplots", "numpy.stack", "matplotlib.pyplot.waitforbuttonpress", "matplotlib.pyplo...
[((254, 281), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (271, 281), False, 'import logging\n'), ((341, 445), 'coloredlogs.install', 'coloredlogs.install', ([], {'level': '"""error"""', 'fmt': '"""%(asctime)s %(levelname)s %(message)s"""', 'datefmt': '"""%H:%M:%S"""'}), "(level='error...
import pandas as pd from pandas.plotting import lag_plot import numpy as np import matplotlib as mlp import matplotlib.pyplot as plt import matplotlib.dates as mdates import matplotlib.ticker as ticker import seaborn as sns from scipy import stats import statsmodels.api as sm from statsmodels.formula.api import ols imp...
[ "matplotlib.pyplot.title", "statsmodels.api.tsa.seasonal_decompose", "matplotlib.dates.MonthLocator", "numpy.random.seed", "statsmodels.tsa.arima_model.ARIMA", "numpy.abs", "pandas.read_csv", "numpy.ones", "statsmodels.api.stats.anova_lm", "matplotlib.pyplot.figure", "numpy.sin", "numpy.mean",...
[((622, 716), 'pandas.read_csv', 'pd.read_csv', (["(dataurl + 'house_sales.csv')"], {'parse_dates': "['date']", 'header': '(0)', 'index_col': '"""date"""'}), "(dataurl + 'house_sales.csv', parse_dates=['date'], header=0,\n index_col='date')\n", (633, 716), True, 'import pandas as pd\n'), ((838, 910), 'pandas.read_cs...
import unittest import numpy as np from spectralcluster import refinement ThresholdType = refinement.ThresholdType SymmetrizeType = refinement.SymmetrizeType class TestCropDiagonal(unittest.TestCase): """Tests for the CropDiagonal class.""" def test_3by3_matrix(self): matrix = np.array([[1, 2, 3], [3, 4, 5]...
[ "unittest.main", "spectralcluster.refinement.RowWiseThreshold", "spectralcluster.refinement.RowWiseNormalize", "spectralcluster.refinement.CropDiagonal", "numpy.allclose", "numpy.array", "spectralcluster.refinement.GaussianBlur", "spectralcluster.refinement.Symmetrize", "numpy.array_equal", "spect...
[((4544, 4559), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4557, 4559), False, 'import unittest\n'), ((290, 333), 'numpy.array', 'np.array', (['[[1, 2, 3], [3, 4, 5], [4, 2, 1]]'], {}), '([[1, 2, 3], [3, 4, 5], [4, 2, 1]])\n', (298, 333), True, 'import numpy as np\n'), ((412, 455), 'numpy.array', 'np.array', ...
import codecs import json import matplotlib.pyplot as plt import numpy as np import pandas as pd from adjustText import adjust_text from keras.models import model_from_json from keras.utils.vis_utils import plot_model from sklearn.utils import shuffle FTRAIN = 'data/training.csv' FTEST = 'data/test.csv' FLOOKUP = 'da...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.yscale", "numpy.load", "pandas.read_csv", "matplotlib.pyplot.figure", "numpy.mean", "codecs.open", "keras.utils.vis_utils.plot_model", "numpy.fromstring", "json.dump", "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "matplotlib.pyplot.ylabe...
[((595, 614), 'pandas.read_csv', 'pd.read_csv', (['f_name'], {}), '(f_name)\n', (606, 614), True, 'import pandas as pd\n'), ((1307, 1349), 'matplotlib.pyplot.plot', 'plt.plot', (['loss'], {'linewidth': '(3)', 'label': '"""train"""'}), "(loss, linewidth=3, label='train')\n", (1315, 1349), True, 'import matplotlib.pyplot...
#!/usr/bin/env python3 import pandas as pd import numpy as np import logging def find_all_columns(csv_file, columns_to_exclude, range_fraction=0.1, separator=','): """ Sometimes, csv files have way too many columns to make you want to list them all. This method will create a list of column objects for you...
[ "pandas.read_csv", "logging.warning", "pandas.isna", "numpy.issubdtype" ]
[((1101, 1137), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {'sep': 'separator'}), '(csv_file, sep=separator)\n', (1112, 1137), True, 'import pandas as pd\n'), ((2092, 2128), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {'sep': 'separator'}), '(csv_file, sep=separator)\n', (2103, 2128), True, 'import pandas as...
""" Defines the data handler interface/ABC """ # standard from abc import ABC, abstractmethod from typing import TypeAlias from json import loads, dumps # 3rd party from numpy import ndarray, asarray from django.core.files.base import ContentFile from django.core.files.uploadedfile import UploadedFile # local from .c...
[ "numpy.asarray", "json.loads", "django.core.files.base.ContentFile" ]
[((3015, 3041), 'django.core.files.base.ContentFile', 'ContentFile', (['contentstring'], {}), '(contentstring)\n', (3026, 3041), False, 'from django.core.files.base import ContentFile\n'), ((3662, 3682), 'numpy.asarray', 'asarray', (['model_input'], {}), '(model_input)\n', (3669, 3682), False, 'from numpy import ndarra...
# coding=utf-8 # Copyright 2021 The init2winit Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
[ "absl.testing.absltest.main", "init2winit.optimizer_lib.hessian_free.residual_norm_test", "numpy.ones", "flax.nn.base.Model", "init2winit.optimizer_lib.hessian_free.hessian_free", "jax.jacfwd", "numpy.transpose", "numpy.identity", "init2winit.model_lib.models.get_model_hparams", "numpy.linspace", ...
[((7244, 7259), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (7257, 7259), False, 'from absl.testing import absltest\n'), ((1374, 1383), 'numpy.eye', 'np.eye', (['n'], {}), '(n)\n', (1380, 1383), True, 'import numpy as np\n'), ((1906, 1979), 'init2winit.optimizer_lib.hessian_free.relative_per_iterat...
from torch_utils.ops import upfirdn2d import torch import numpy as np import torch.nn as nn from .. import layers from ..layers.stylegan2_layers import Conv2dLayer, DiscriminatorEpilogue, StyleGAN2Block from ..build import DISCRIMINATOR_REGISTRY @DISCRIMINATOR_REGISTRY.register_module class FPNDiscriminator(layers.Mo...
[ "torch_utils.ops.upfirdn2d.setup_filter", "torch.nn.ModuleList", "numpy.log2", "torch.cat", "numpy.sqrt" ]
[((1580, 1595), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1593, 1595), True, 'import torch.nn as nn\n'), ((2172, 2187), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (2185, 2187), True, 'import torch.nn as nn\n'), ((2210, 2225), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (222...
import os from os.path import split from functools import partial import numpy as np from scipy import sparse, signal from scipy.io import loadmat import mne from mne.stats import permutation_cluster_test, ttest_1samp_no_p import borsar from borsar.utils import find_index from borsar.cluster import Clusters, constru...
[ "scipy.io.loadmat", "scipy.sparse.issparse", "scipy.stats.f_oneway", "numpy.argsort", "skimage.measure.label", "scipy.stats.distributions.t.ppf", "numpy.arange", "numpy.random.randint", "os.path.join", "numpy.random.random_integers", "numpy.unique", "scipy.spatial.Delaunay", "mne.stats.ttest...
[((455, 493), 'os.path.join', 'os.path.join', (['base_dir', '"""data"""', '"""chan"""'], {}), "(base_dir, 'data', 'chan')\n", (467, 493), False, 'import os\n'), ((424, 439), 'os.path.split', 'split', (['__file__'], {}), '(__file__)\n', (429, 439), False, 'from os.path import split\n'), ((664, 687), 'os.path.exists', 'o...
# coding=utf-8 # Copyright (c) 2020, NVIDIA CORPORATION. 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 re...
[ "numpy.load", "numpy.sum", "megatron.data.helpers.build_sample_idx", "megatron.mpu.get_pipeline_model_parallel_group", "numpy.iinfo", "os.path.isfile", "numpy.arange", "megatron.mpu.get_tensor_model_parallel_group", "torch.distributed.get_world_size", "megatron.mpu.get_data_parallel_group", "meg...
[((1702, 1781), 'megatron.data.dataset_utils.get_datasets_weights_and_num_samples', 'get_datasets_weights_and_num_samples', (['data_prefix', 'train_valid_test_num_samples'], {}), '(data_prefix, train_valid_test_num_samples)\n', (1738, 1781), False, 'from megatron.data.dataset_utils import get_datasets_weights_and_num_s...
from sacred import Experiment from Config import config_ingredient import tensorflow as tf import numpy as np import os import Datasets from Input import Input as Input from Input import batchgenerators as batchgen import Utils import Models.UnetSpectrogramSeparator import Models.UnetAudioSeparator import cPickle as p...
[ "Datasets.getCCMixter", "tensorflow.get_collection", "tensorflow.reset_default_graph", "tensorflow.constant_initializer", "cPickle.load", "Utils.getNumParams", "Datasets.getMUSDB", "tensorflow.ConfigProto", "tensorflow.assign", "tensorflow.global_variables", "tensorflow.abs", "Utils.crop", "...
[((438, 502), 'sacred.Experiment', 'Experiment', (['"""Waveunet Training"""'], {'ingredients': '[config_ingredient]'}), "('Waveunet Training', ingredients=[config_ingredient])\n", (448, 502), False, 'from sacred import Experiment\n'), ((2599, 2707), 'Input.batchgenerators.BatchGen_Paired', 'batchgen.BatchGen_Paired', (...
import os import logging import pathlib from dataclasses import dataclass from typing import List from types import SimpleNamespace import parse import numpy as np import skimage.measure from dtoolbioimage import ( Image as dbiImage, Image3D, ImageDataSet, scale_to_uint8 ) from fishtools.utils impor...
[ "fishtools.utils.extract_nuclei", "fishtools.segment.scale_segmentation", "fishtools.probes.find_probe_locations_3d", "dtoolbioimage.Image3D.from_file", "fishtools.utils.crop_to_non_empty", "dtoolbioimage.ImageDataSet", "fishtools.utils.select_near_colour", "fishtools.segment.cell_mask_from_fishimage"...
[((515, 545), 'logging.getLogger', 'logging.getLogger', (['"""fishtools"""'], {}), "('fishtools')\n", (532, 545), False, 'import logging\n'), ((4645, 4691), 'os.path.join', 'os.path.join', (['config.annotation_dirpath', 'fname'], {}), '(config.annotation_dirpath, fname)\n', (4657, 4691), False, 'import os\n'), ((4701, ...
import numpy as np # only run this test suite if numpy is installed import pytest from h3fake.api import ( basic_int, numpy_int, memview_int, ) # todo: check when a copy is made, and when it isn't def test_set(): ints = { 619056821839331327, 619056821839593471, 61905682183985...
[ "h3fake.api.basic_int.compact", "h3fake.api.memview_int.compact", "h3fake.api.numpy_int.compact", "numpy.dtype", "pytest.raises", "numpy.array" ]
[((1506, 1682), 'numpy.array', 'np.array', (['[619056821839331327, 619056821839593471, 619056821839855615, \n 619056821840117759, 619056821840379903, 619056821840642047, \n 619056821840904191]'], {'dtype': '"""uint64"""'}), "([619056821839331327, 619056821839593471, 619056821839855615, \n 619056821840117759, 6...
import numpy as np from scipy import special import matplotlib.pyplot as plt import quadpy import math #using a basis of l spherical harmonics def matlab_legendre(n,X): res = [] for m in range(n+1): res.append(np.array(special.lpmv(m,n,X))) return np.array(res) #using a basis of l spherical harmon...
[ "numpy.arctan2", "matplotlib.pyplot.show", "scipy.special.lpmv", "quadpy.sphere.lebedev_019", "numpy.savetxt", "numpy.zeros", "numpy.linalg.eig", "numpy.matrix.getH", "numpy.sort", "numpy.array", "numpy.arange", "numpy.exp", "math.factorial", "numpy.arccos" ]
[((1009, 1027), 'numpy.zeros', 'np.zeros', (['phi.size'], {}), '(phi.size)\n', (1017, 1027), True, 'import numpy as np\n'), ((1032, 1069), 'numpy.zeros', 'np.zeros', (['[NBas, NBas]'], {'dtype': 'complex'}), '([NBas, NBas], dtype=complex)\n', (1040, 1069), True, 'import numpy as np\n'), ((1073, 1085), 'numpy.array', 'n...
import numpy as np from generator import Generator, KerasGenerator def test_generator(): x_data = np.array([ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ]).transpose() y_data = np.array([ [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] ]).transpose() gen = Generator(x_...
[ "generator.Generator", "generator.KerasGenerator", "numpy.array" ]
[((308, 404), 'generator.Generator', 'Generator', ([], {'x_data': 'x_data', 'y_data': 'y_data', 'x_num_steps': '(3)', 'y_num_steps': '(2)', 'f_step': '(2)', 'skip_step': '(3)'}), '(x_data=x_data, y_data=y_data, x_num_steps=3, y_num_steps=2,\n f_step=2, skip_step=3)\n', (317, 404), False, 'from generator import Gener...
# Implement the pose-detection demo from the open-cv website import cv2 import numpy as np import pickle def draw(img, corners, imgpts): imgpts = np.int32(imgpts).reshape(-1,2) # draw ground floor in green img = cv2.drawContours(img, [imgpts[:4]],-1,(0,255,0),-3) # draw pillars in blue color for ...
[ "cv2.GaussianBlur", "cv2.findChessboardCorners", "cv2.cvtColor", "cv2.waitKey", "numpy.float32", "numpy.zeros", "cv2.imshow", "cv2.cornerSubPix", "cv2.solvePnPRansac", "cv2.VideoCapture", "cv2.projectPoints", "pickle.load", "numpy.int32", "cv2.drawContours", "cv2.destroyAllWindows" ]
[((848, 880), 'numpy.zeros', 'np.zeros', (['(6 * 7, 3)', 'np.float32'], {}), '((6 * 7, 3), np.float32)\n', (856, 880), True, 'import numpy as np\n'), ((1058, 1167), 'numpy.float32', 'np.float32', (['[[0, 0, 0], [0, 3, 0], [3, 3, 0], [3, 0, 0], [0, 0, -3], [0, 3, -3], [3, 3,\n -3], [3, 0, -3]]'], {}), '([[0, 0, 0], [...
from sklearn.linear_model import Lasso import argparse import os import numpy as np from sklearn.metrics import mean_squared_error from math import sqrt import joblib from sklearn.model_selection import train_test_split import pandas as pd from azureml.core.run import Run from azureml.core.dataset import Dataset from a...
[ "argparse.ArgumentParser", "azureml.core.dataset.Dataset.get_by_name", "os.makedirs", "pandas.get_dummies", "sklearn.model_selection.train_test_split", "azureml.core.run.Run.get_context", "joblib.dump", "numpy.float", "numpy.int", "sklearn.metrics.mean_squared_error", "sklearn.linear_model.Lasso...
[((1367, 1415), 'pandas.get_dummies', 'pd.get_dummies', (['x_df'], {'columns': 'features_to_encode'}), '(x_df, columns=features_to_encode)\n', (1381, 1415), True, 'import pandas as pd\n'), ((1546, 1571), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1569, 1571), False, 'import argparse\n'), (...
# disable GPU acceleration import os os.environ["CUDA_VISIBLE_DEVICES"] = "-1" # import packages import json import numpy as np import networkx as nx import tensorflow as tf from pathlib import Path import scipy.sparse as sps from collections import defaultdict from statistics import mean, pvariance # input/output d...
[ "tensorflow.reduce_sum", "tensorflow.keras.losses.MSE", "tensorflow.reshape", "collections.defaultdict", "tensorflow.matmul", "pathlib.Path", "tensorflow.Variable", "numpy.arange", "tensorflow.keras.initializers.glorot_uniform", "numpy.mat", "tensorflow.abs", "tensorflow.nn.relu", "numpy.pow...
[((3924, 3989), 'networkx.read_weighted_edgelist', 'nx.read_weighted_edgelist', (['test_path'], {'nodetype': 'int', 'delimiter': '""","""'}), "(test_path, nodetype=int, delimiter=',')\n", (3949, 3989), True, 'import networkx as nx\n'), ((1119, 1138), 'scipy.sparse.triu', 'sps.triu', (['sparse_mx'], {}), '(sparse_mx)\n'...
import numpy as np from sklearn import svm class Support_Vector_Machine(): def file2matrix(self,filename,target): fr=open(filename) lines=fr.readlines() m=len(lines) dataSet=np.zeros((m,3)) index=0 for line in lines: listFromLine=line.strip().split() for i in range(len(listFromLine)): ...
[ "numpy.square", "numpy.zeros", "numpy.fabs", "sklearn.svm.SVC", "numpy.random.shuffle" ]
[((192, 208), 'numpy.zeros', 'np.zeros', (['(m, 3)'], {}), '((m, 3))\n', (200, 208), True, 'import numpy as np\n'), ((728, 757), 'sklearn.svm.SVC', 'svm.SVC', ([], {'C': 'C', 'kernel': '"""linear"""'}), "(C=C, kernel='linear')\n", (735, 757), False, 'from sklearn import svm\n'), ((1083, 1120), 'sklearn.svm.SVC', 'svm.S...
import json import json import random import codecs import numpy as np import torch import torch.utils.data from torch.utils.data import DataLoader import layers from utils import load_wav_to_torch, load_filepaths_and_text from text import text_to_sequence, poly_yinsu_to_sequence, poly_yinsu_to_mask from transformers...
[ "torch.ones", "numpy.load", "json.load", "codecs.open", "torch.utils.data.DataLoader", "utils.load_wav_to_torch", "utils.load_filepaths_and_text", "random.shuffle", "torch.argmax", "torch.autograd.Variable", "torch.LongTensor", "torch.squeeze", "transformers.BertTokenizer.from_pretrained", ...
[((2178, 2228), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-chinese"""'], {}), "('bert-base-chinese')\n", (2207, 2228), False, 'from transformers import BertTokenizer\n'), ((3259, 3300), 'torch.tensor', 'torch.tensor', (['input_ids'], {'dtype': 'torch.long'}), '(input_...
import numpy as np time = 3 # aa:训练拟合权重 aa = 0.8 # bb:更新拟合权重 bb = 0.9 def polyamorphic(data, param, *args): flag = 0 z1 = np.polyfit(list(range(len(data), 0, -1)), data, time) p1 = np.poly1d(z1) if (param[0] + param[1] + param[2] + param[3]) == 0: flag = 1 if flag != 1: ...
[ "numpy.poly1d" ]
[((208, 221), 'numpy.poly1d', 'np.poly1d', (['z1'], {}), '(z1)\n', (217, 221), True, 'import numpy as np\n')]
#!/usr/bin/env python3 import sys import os import gzip import pandas as pd import argparse import time import numpy as np # -------------------------------- # index_hopping.py # Created on: March 2019 # Author: <NAME> and Bioinformatics Services (TxGen Lab) # # Releases # # v05.2 - Accepts param...
[ "gzip.open", "argparse.ArgumentParser", "pandas.read_csv", "numpy.zeros", "time.time" ]
[((2330, 2341), 'time.time', 'time.time', ([], {}), '()\n', (2339, 2341), False, 'import time\n'), ((11458, 11583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Determines the number and percentage of compatible but invalid barcode pairs"""'}), "(description=\n 'Determines the numbe...
import os import time import numpy as np from openslide import OpenSlide from multiprocessing import Pool import cv2 import csv import random import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../') path_list = "./data/npy/" file_path_txt = "./data/txt/x4.txt" path_patch = "./data/...
[ "openslide.OpenSlide", "numpy.load", "os.path.abspath", "os.mkdir", "cv2.cvtColor", "os.walk", "os.path.exists", "time.time", "numpy.array", "multiprocessing.Pool", "os.path.join", "cv2.resize" ]
[((495, 511), 'numpy.load', 'np.load', (['np_path'], {}), '(np_path)\n', (502, 511), True, 'import numpy as np\n'), ((2410, 2437), 'multiprocessing.Pool', 'Pool', ([], {'processes': 'num_process'}), '(processes=num_process)\n', (2414, 2437), False, 'from multiprocessing import Pool\n'), ((2773, 2814), 'os.path.join', '...
''' @author: pkao This code has three funtions: 1. Converting a combined lesion label to three individual lesion labels 2. Mapping the individual lesions to MNI152 space 3. Mergeing the individual lesion label to segmentation mask in MNI152 space ''' from utils import Brats2018ValidationN4ITKFilePaths, AllSubjectID, ...
[ "argparse.ArgumentParser", "numpy.argmax", "os.walk", "os.path.join", "utils.Brats2018PredictedLesionsPaths", "SimpleITK.ReadImage", "SimpleITK.GetArrayFromImage", "utils.PredictedLesionMaskPath", "subprocess.call", "SimpleITK.WriteImage", "multiprocessing.Pool", "utils.Brats2018PredictedLesio...
[((6969, 6994), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6992, 6994), False, 'import argparse\n'), ((7782, 7799), 'multiprocessing.Pool', 'Pool', (['args.thread'], {}), '(args.thread)\n', (7786, 7799), False, 'from multiprocessing import Pool\n'), ((7899, 7953), 'utils.PredictedLesionMas...
import glob import os.path import numpy as np from scipy.interpolate import RectBivariateSpline from netCDF4 import Dataset from .geogrid import GeoGrid from . import util class SAR(GeoGrid): """Class encapsulating a single SAR image.""" def __init__(self, lons, lats, data, date): super().__init__(l...
[ "netCDF4.Dataset", "numpy.cos" ]
[((1928, 1941), 'netCDF4.Dataset', 'Dataset', (['path'], {}), '(path)\n', (1935, 1941), False, 'from netCDF4 import Dataset\n'), ((2993, 3029), 'netCDF4.Dataset', 'Dataset', (['path', '"""w"""'], {'format': '"""NETCDF4"""'}), "(path, 'w', format='NETCDF4')\n", (3000, 3029), False, 'from netCDF4 import Dataset\n'), ((15...
""" This script reads all the bootstrap performance result files, plots histograms, and calculates averages. t-tests are done to compute p-values and confidence intervals are computed """ import pandas as pd import numpy as np import os import matplotlib.pyplot as plt import matplotlib from scipy import stat...
[ "pandas.DataFrame", "os.listdir", "matplotlib.pyplot.subplot", "os.path.join", "pandas.read_csv", "matplotlib.pyplot.close", "matplotlib.rcParams.update", "scipy.stats.ttest_ind", "matplotlib.pyplot.figure", "numpy.mean", "scipy.stats.sem", "matplotlib.pyplot.subplots_adjust", "matplotlib.py...
[((325, 369), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 8}"], {}), "({'font.size': 8})\n", (351, 369), False, 'import matplotlib\n'), ((7305, 7336), 'pandas.concat', 'pd.concat', (['rmse_df_list'], {'axis': '(1)'}), '(rmse_df_list, axis=1)\n', (7314, 7336), True, 'import pandas as pd\...
import numpy as np from mmhuman3d.data.datasets import HumanImageDataset def test_human_image_dataset(): train_dataset = HumanImageDataset( data_prefix='tests/data', pipeline=[], dataset_name='h36m', ann_file='sample_3dpw_test.npz') data_keys = [ 'img_prefix', 'image_p...
[ "numpy.random.rand", "mmhuman3d.data.datasets.HumanImageDataset", "numpy.arange" ]
[((128, 243), 'mmhuman3d.data.datasets.HumanImageDataset', 'HumanImageDataset', ([], {'data_prefix': '"""tests/data"""', 'pipeline': '[]', 'dataset_name': '"""h36m"""', 'ann_file': '"""sample_3dpw_test.npz"""'}), "(data_prefix='tests/data', pipeline=[], dataset_name=\n 'h36m', ann_file='sample_3dpw_test.npz')\n", (1...
#!/usr/bin/python3 # -*- coding: UTF-8 -*- # File name : client.py # Description : client # Website : www.adeept.com # Author : William # Date : 2019/08/28 from socket import * import sys import time import threading as thread import tkinter as tk import math try: import cv2 import zmq im...
[ "tkinter.StringVar", "cv2.imdecode", "base64.b64decode", "cv2.rectangle", "cv2.imshow", "tkinter.Label", "zmq.Context", "cv2.line", "tkinter.PhotoImage", "tkinter.Button", "cv2.cvtColor", "math.radians", "tkinter.Entry", "cv2.setMouseCallback", "tkinter.Tk", "threading.Thread", "nump...
[((6541, 6570), 'threading.Thread', 'thread.Thread', ([], {'target': 'get_FPS'}), '(target=get_FPS)\n', (6554, 6570), True, 'import threading as thread\n'), ((6790, 6824), 'threading.Thread', 'thread.Thread', ([], {'target': 'video_thread'}), '(target=video_thread)\n', (6803, 6824), True, 'import threading as thread\n'...
""" Supplies MultiDimensionalMapping and NdMapping which are multi-dimensional map types. The former class only allows indexing whereas the latter also enables slicing over multiple dimension ranges. """ from itertools import cycle from operator import itemgetter import numpy as np import param from . import util fr...
[ "param.List", "numpy.isscalar", "param.Boolean", "itertools.cycle", "operator.itemgetter", "param.String", "pandas.concat", "numpy.concatenate" ]
[((3126, 3188), 'param.String', 'param.String', ([], {'default': '"""MultiDimensionalMapping"""', 'constant': '(True)'}), "(default='MultiDimensionalMapping', constant=True)\n", (3138, 3188), False, 'import param\n'), ((3273, 3325), 'param.List', 'param.List', ([], {'default': '[]', 'bounds': '(0, 0)', 'constant': '(Tr...
import legwork as lw import numpy as np import astropy.units as u import matplotlib.pyplot as plt from matplotlib.colors import TwoSlopeNorm plt.rc('font', family='serif') plt.rcParams['text.usetex'] = False fs = 24 # update various fontsizes to match params = {'figure.figsize': (12, 8), 'legend.fontsize': ...
[ "numpy.meshgrid", "numpy.zeros_like", "matplotlib.pyplot.get_cmap", "numpy.logical_and", "numpy.logspace", "legwork.source.Source", "matplotlib.pyplot.rcParams.update", "numpy.arange", "matplotlib.pyplot.rc", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.colors.TwoSlopeNorm", "...
[((142, 172), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (148, 172), True, 'import matplotlib.pyplot as plt\n'), ((599, 626), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['params'], {}), '(params)\n', (618, 626), True, 'import matplotlib...
import numpy as np from gym import utils from gym.envs.mujoco import mujoco_env DEFAULT_CAMERA_CONFIG = { 'distance': 4.0, } class AntEnv(mujoco_env.MujocoEnv, utils.EzPickle): def __init__(self, xml_file='ant.xml', ctrl_cost_weight=0.5, contact_cost_weight...
[ "gym.envs.mujoco.mujoco_env.MujocoEnv.__init__", "numpy.square", "numpy.isfinite", "numpy.clip", "numpy.linalg.norm", "numpy.concatenate" ]
[((1163, 1211), 'gym.envs.mujoco.mujoco_env.MujocoEnv.__init__', 'mujoco_env.MujocoEnv.__init__', (['self', 'xml_file', '(5)'], {}), '(self, xml_file, 5)\n', (1192, 1211), False, 'from gym.envs.mujoco import mujoco_env\n'), ((1704, 1753), 'numpy.clip', 'np.clip', (['raw_contact_forces', 'min_value', 'max_value'], {}), ...
import os import pickle import torch import csv import numpy as np from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils class VirefDataset(Dataset): def __init__(self, args, refexp_csv, max_refexp_len=25, video_name_restriction=None): self.refexp_list = [] self.video_names ...
[ "csv.reader", "numpy.zeros", "numpy.ones", "pickle.load", "os.path.join" ]
[((5076, 5115), 'numpy.zeros', 'np.zeros', (['(self.max_refexp_len + 1, 50)'], {}), '((self.max_refexp_len + 1, 50))\n', (5084, 5115), True, 'import numpy as np\n'), ((770, 790), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (780, 790), False, 'import csv\n'), ((3175, 3209), 'os.path.join', 'os.path.j...
# -*- coding: utf-8 -*- # # Convert NORDIF DAT-file with Kikuchi diffraction patterns to HyperSpy HDF5 # format. # Created by <NAME> (<EMAIL>) # 2018-11-20 import hyperspy.api as hs import numpy as np import os import re import warnings import argparse # Parse input parameters parser = argparse.ArgumentParser(descr...
[ "argparse.ArgumentParser", "numpy.memmap", "numpy.fromfile", "os.path.splitext", "re.search", "warnings.warn", "os.path.split", "os.path.join", "hyperspy.api.signals.Signal2D" ]
[((291, 335), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (314, 335), False, 'import argparse\n'), ((640, 669), 'os.path.split', 'os.path.split', (['arguments.file'], {}), '(arguments.file)\n', (653, 669), False, 'import os\n'), ((683, 706), 'os.pat...
import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator import networkx as nx import numpy as np colors = {'susceptible':'g', 'exposed':'orange', 'infectious':'red', 'recovered':'gray', 'quarantined':'blue', 'testable':'k'} def get_pos(G, model): units = list(set([...
[ "networkx.drawing.layout.spring_layout", "matplotlib.ticker.MultipleLocator", "numpy.abs", "matplotlib.pyplot.Line2D" ]
[((826, 949), 'networkx.drawing.layout.spring_layout', 'nx.drawing.layout.spring_layout', (['G'], {'k': '(1.5)', 'dim': '(2)', 'weight': '"""weight"""', 'fixed': 'fixed', 'pos': 'fixed_pos', 'scale': '(1)', 'iterations': '(100)'}), "(G, k=1.5, dim=2, weight='weight', fixed=\n fixed, pos=fixed_pos, scale=1, iteration...