code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import random from sklearn.metrics import mean_squared_error from sklearn.neural_network import MLPClassifier def one_hot_generator(length): a = [] for i in range(0, length): i = random.randint(0, 7) a.append(i) output = np.eye(8)[a] return output n_...
[ "numpy.eye", "random.randint", "sklearn.metrics.mean_squared_error", "sklearn.neural_network.MLPClassifier" ]
[((594, 649), 'sklearn.neural_network.MLPClassifier', 'MLPClassifier', ([], {'hidden_layer_sizes': '(2)', 'max_iter': 'iteration'}), '(hidden_layer_sizes=2, max_iter=iteration)\n', (607, 649), False, 'from sklearn.neural_network import MLPClassifier\n'), ((923, 957), 'sklearn.metrics.mean_squared_error', 'mean_squared_...
import pandas as pd; import numpy as np; x1 = pd.DataFrame(np.random.randint(0, 100, (3, 4)), columns = list('ABCD'), index = np.arange(3)); x2 = pd.DataFrame(np.random.randint(100, 200, (3, 4)), columns = list('ABCD'), index = np.arange(3)+3); x22 = pd.DataFrame(np.random.randint(1...
[ "numpy.random.randint", "numpy.arange", "pandas.concat" ]
[((430, 457), 'pandas.concat', 'pd.concat', (['[x1, x2]'], {'axis': '(0)'}), '([x1, x2], axis=0)\n', (439, 457), True, 'import pandas as pd\n'), ((474, 501), 'pandas.concat', 'pd.concat', (['[x1, x2]'], {'axis': '(1)'}), '([x1, x2], axis=1)\n', (483, 501), True, 'import pandas as pd\n'), ((519, 547), 'pandas.concat', '...
# General imports import numpy as np import torch # DeepMoD stuff from deepymod import DeepMoD from deepymod.model.func_approx import NN from deepymod.model.library import Library1D from deepymod.model.constraint import LeastSquares from deepymod.model.sparse_estimators import Threshold from deepymod.training import t...
[ "numpy.meshgrid", "numpy.random.seed", "deepymod.training.train", "torch.manual_seed", "deepymod.model.library.Library1D", "deepymod.DeepMoD", "deepymod.model.func_approx.NN", "torch.cuda.is_available", "numpy.linspace", "deepymod.model.sparse_estimators.Threshold", "deepymod.training.sparsity_s...
[((547, 572), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (570, 572), False, 'import torch\n'), ((651, 669), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (665, 669), True, 'import numpy as np\n'), ((670, 690), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\...
from typing import Union, Optional, Dict import pandas as pd import numpy as np import sha_calc as sha_calc from gmhazard_calc import site from gmhazard_calc import utils from gmhazard_calc import shared from gmhazard_calc import hazard from gmhazard_calc import gm_data from gmhazard_calc import site_source from gmha...
[ "numpy.abs", "gmhazard_calc.site_source.get_distance_df", "gmhazard_calc.hazard.run_ensemble_hazard", "gmhazard_calc.utils.to_mu_sigma", "sha_calc.disagg_exceedance", "numpy.histogram2d", "pandas.merge", "gmhazard_calc.shared.get_im_data", "gmhazard_calc.shared.get_gm_prob", "gmhazard_calc.rupture...
[((2430, 2498), 'gmhazard_calc.shared.compute_adj_branch_weights', 'shared.compute_adj_branch_weights', (['ensemble', 'im', 'im_value', 'site_info'], {}), '(ensemble, im, im_value, site_info)\n', (2463, 2498), False, 'from gmhazard_calc import shared\n'), ((8183, 8293), 'gmhazard_calc.shared.get_gm_prob', 'shared.get_g...
import numpy as np import cv2 as cv import os import imghdr from tqdm import tqdm """ Duplicate Image Finder (DIF): function that searches a given directory for images and finds duplicate/similar images among them. Outputs the number of found duplicate/similar image pairs with a list of the filenames having...
[ "cv2.resize", "numpy.stack", "tqdm.tqdm", "os.remove", "os.stat", "cv2.waitKey", "cv2.destroyAllWindows", "os.path.isdir", "numpy.fromfile", "imghdr.what", "cv2.imread", "numpy.rot90", "cv2.imshow", "os.listdir", "numpy.concatenate" ]
[((4929, 4977), 'tqdm.tqdm', 'tqdm', (['folder_files'], {'desc': '"""Creating Image Matrix"""'}), "(folder_files, desc='Creating Image Matrix')\n", (4933, 4977), False, 'from tqdm import tqdm\n'), ((6358, 6388), 'cv2.imread', 'cv.imread', (['f"""{folder}{imageA}"""'], {}), "(f'{folder}{imageA}')\n", (6367, 6388), True,...
import numpy as np from functools import reduce from numbers import Number from numpy.linalg import det, pinv, matrix_rank, norm from . import linalg from .util import as_array, as_diag # TODO: Change assertions to exceptions # TODO: Add tests # TODO: Convert to new matrix multiplication operator # TODO: Allow speci...
[ "numpy.ndindex", "numpy.multiply", "numpy.abs", "numpy.zeros", "numpy.ones", "numpy.linalg.inv", "numpy.dot", "numpy.eye", "numpy.linalg.pinv", "numpy.diag" ]
[((1180, 1190), 'numpy.eye', 'np.eye', (['ns'], {}), '(ns)\n', (1186, 1190), True, 'import numpy as np\n'), ((2325, 2338), 'numpy.diag', 'np.diag', (['dist'], {}), '(dist)\n', (2332, 2338), True, 'import numpy as np\n'), ((5014, 5024), 'numpy.eye', 'np.eye', (['ns'], {}), '(ns)\n', (5020, 5024), True, 'import numpy as ...
#!/usr/bin/env python3 # # Copyright (c) 2021 Krai Ltd. # # SPDX-License-Identifier: BSD-3-Clause. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright no...
[ "os.remove", "onnx_graphsurgeon.Variable", "onnx_graphsurgeon.export_onnx", "torch.ones", "re.fullmatch", "numpy.transpose", "onnx_graphsurgeon.Graph.register", "transformers.BertForQuestionAnswering", "onnx.load", "re.split", "tensorflow.train.list_variables", "transformers.BertConfig", "tr...
[((1952, 2509), 'transformers.BertConfig', 'BertConfig', ([], {'attention_probs_dropout_prob': "config['attention_probs_dropout_prob']", 'hidden_act': "config['hidden_act']", 'hidden_dropout_prob': "config['hidden_dropout_prob']", 'hidden_size': "config['hidden_size']", 'initializer_range': "config['initializer_range']...
""" About: Preprocess with pytorch and Spacy """ import torch import torch.nn as nn import torch.optim as optim from torchtext.legacy.datasets import Multi30k from torchtext.legacy.data import Field, BucketIterator from torchtext.data.utils import get_tokenizer import spacy import numpy as np import random import ...
[ "numpy.random.seed", "torch.manual_seed", "torch.cuda.manual_seed", "torchtext.legacy.data.BucketIterator.splits", "torchtext.legacy.datasets.Multi30k.splits", "spacy.load", "random.seed", "torch.cuda.is_available", "torchtext.legacy.data.Field" ]
[((424, 441), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (435, 441), False, 'import random\n'), ((442, 462), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (456, 462), True, 'import numpy as np\n'), ((463, 486), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (48...
import keras import numpy as np import pickle as pickle from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras.utils import plot_model from keras.models import load_model from keras.optimizers import RMSprop from keras.layers import Dense, Activation, Dropout, Simp...
[ "keras.layers.SimpleRNN", "keras.optimizers.Adadelta", "pickle.dump", "keras.layers.Activation", "keras.Sequential", "keras.layers.Dropout", "numpy.zeros", "numpy.min", "pickle.load", "numpy.random.randint", "keras.layers.Embedding", "keras.layers.Dense", "numpy.delete", "keras.utils.to_ca...
[((471, 485), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (482, 485), True, 'import pickle as pickle\n'), ((688, 706), 'keras.Sequential', 'keras.Sequential', ([], {}), '()\n', (704, 706), False, 'import keras\n'), ((1639, 1652), 'numpy.min', 'np.min', (['theta'], {}), '(theta)\n', (1645, 1652), True, 'import n...
# Taken and modified from # https://github.com/cyvius96/prototypical-network-pytorch import os.path as osp import numpy as np from PIL import Image import torch from torch.utils.data import Dataset from torchvision import transforms from torch.utils.data import DataLoader from protonets.data.base import CudaTransfor...
[ "torch.from_numpy", "torch.stack", "torch.utils.data.DataLoader", "torchvision.transforms.ToTensor", "PIL.Image.open", "numpy.argwhere", "torchvision.transforms.Compose", "numpy.array", "torch.utils.data.DataLoader.__init__", "torchvision.transforms.CenterCrop", "torchvision.transforms.Normalize...
[((569, 606), 'os.path.join', 'osp.join', (['ROOT_PATH', "(setname + '.csv')"], {}), "(ROOT_PATH, setname + '.csv')\n", (577, 606), True, 'import os.path as osp\n'), ((1437, 1458), 'torchvision.transforms.Compose', 'transforms.Compose', (['t'], {}), '(t)\n', (1455, 1458), False, 'from torchvision import transforms\n'),...
import logging from logging import handlers import numpy as np import random import os # 日志操作 class Logger(object): level_relations = { 'debug':logging.DEBUG, 'info':logging.INFO, 'warning':logging.WARNING, 'error':logging.ERROR, 'crit':logging.CRITICAL }#日志级...
[ "numpy.sum", "random.shuffle", "cv2.threshold", "logging.StreamHandler", "numpy.transpose", "logging.Formatter", "numpy.array", "random.seed", "logging.handlers.TimedRotatingFileHandler", "numpy.diag", "numpy.bincount", "os.path.join", "os.listdir", "logging.getLogger", "numpy.nanmean" ]
[((1323, 1344), 'os.listdir', 'os.listdir', (['image_dir'], {}), '(image_dir)\n', (1333, 1344), False, 'import os\n'), ((2880, 2905), 'numpy.array', 'np.array', (['label_data_list'], {}), '(label_data_list)\n', (2888, 2905), True, 'import numpy as np\n'), ((2928, 2951), 'numpy.array', 'np.array', (['pre_data_list'], {}...
from __future__ import division import os import zipfile import numpy as np import scipy.sparse as sp import pandas as pd from math import radians, cos, sin, asin, sqrt import joblib import scipy.io import torch from torch import nn """ Geographical information calculation """ def get_long_lat(sensor_inde...
[ "numpy.load", "numpy.sum", "numpy.abs", "numpy.double", "pandas.read_csv", "joblib.dump", "numpy.ones", "numpy.shape", "os.path.isfile", "numpy.exp", "pandas.read_hdf", "numpy.power", "scipy.sparse.coo_matrix", "numpy.int", "numpy.loadtxt", "math.cos", "scipy.sparse.diags", "numpy....
[((1467, 1499), 'numpy.load', 'np.load', (['"""data/metr/adj_mat.npy"""'], {}), "('data/metr/adj_mat.npy')\n", (1474, 1499), True, 'import numpy as np\n'), ((1733, 1753), 'os.listdir', 'os.listdir', (['filepath'], {}), '(filepath)\n', (1743, 1753), False, 'import os\n'), ((3095, 3129), 'numpy.save', 'np.save', (['"""da...
# -*- coding: utf-8 -*- """ Created on Wed Aug 30 10:54:21 2017 @author: ishort """ #plotting: import matplotlib import matplotlib.pyplot as plt #%matplotlib inline import pylab from astropy.io import fits import numpy import Gauss2 #General file for printing ad hoc quantities #dbgHandle = open(...
[ "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "pylab.xlim", "astropy.io.fits.open", "pylab.ylim", "pylab.text", "numpy.interp", "numpy.convolve", "matplotlib.pyplot.xlabel", "pylab.plot", "Gauss2.gauss2" ]
[((699, 716), 'astropy.io.fits.open', 'fits.open', (['inFile'], {}), '(inFile)\n', (708, 716), False, 'from astropy.io import fits\n'), ((2183, 2220), 'pylab.plot', 'pylab.plot', (['wave', 'flux'], {'color': '"""black"""'}), "(wave, flux, color='black')\n", (2193, 2220), False, 'import pylab\n'), ((7181, 7218), 'numpy....
from scipy.linalg import lstsq import pandas as pd import numpy as np import argparse def landmark_registration_ls(pts_f1, pts_f2, out_f, delimiter="\t"): points1 = pd.read_csv(pts_f1, delimiter=delimiter) points2 = pd.read_csv(pts_f2, delimiter=delimiter) src = np.concatenate([np.array(points1['x'])...
[ "pandas.DataFrame", "argparse.ArgumentParser", "pandas.read_csv", "numpy.zeros", "numpy.array", "scipy.linalg.lstsq", "numpy.eye" ]
[((175, 215), 'pandas.read_csv', 'pd.read_csv', (['pts_f1'], {'delimiter': 'delimiter'}), '(pts_f1, delimiter=delimiter)\n', (186, 215), True, 'import pandas as pd\n'), ((230, 270), 'pandas.read_csv', 'pd.read_csv', (['pts_f2'], {'delimiter': 'delimiter'}), '(pts_f2, delimiter=delimiter)\n', (241, 270), True, 'import p...
""" # Copyright 2020 Adobe # All Rights Reserved. # NOTICE: Adobe permits you to use, modify, and distribute this file in # accordance with the terms of the Adobe license agreement accompanying # it. """ from src.models.model_image_translation import ResUnetGenerator, VGGLoss import torch import torch.nn as n...
[ "thirdparty.AdaptiveWingLoss.core.models.FAN", "cv2.VideoWriter_fourcc", "torch.cat", "numpy.ones", "torch.cuda.device_count", "src.dataset.image_translation.image_translation_dataset.image_translation_raw98_dataset", "src.dataset.image_translation.image_translation_dataset.vis_landmark_on_img98", "nu...
[((732, 757), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (755, 757), False, 'import torch\n'), ((6360, 6371), 'time.time', 'time.time', ([], {}), '()\n', (6369, 6371), False, 'import time\n'), ((13183, 13252), 'src.dataset.image_translation.image_translation_dataset.image_translation_raw98_...
# -*- coding: utf-8 -*- """ Created on Thu Jan 3 14:25:14 2019 @author: gptshubham595 """ import cv2 import numpy as np windowName='Drawing' img=np.zeros((512,512,3),np.uint8); img.fill(255) cv2.namedWindow(windowName) drawing=False mode=True (ix,iy)=(-1,-1) def draw_circle(event,x,y,flags,param): global...
[ "cv2.circle", "cv2.waitKey", "numpy.zeros", "cv2.setMouseCallback", "cv2.destroyWindow", "cv2.imshow", "cv2.namedWindow" ]
[((149, 182), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (157, 182), True, 'import numpy as np\n'), ((195, 222), 'cv2.namedWindow', 'cv2.namedWindow', (['windowName'], {}), '(windowName)\n', (210, 222), False, 'import cv2\n'), ((895, 940), 'cv2.setMouseCallback', 'cv2...
import numpy as np from pytest_cases import parametrize class BenchmarkChallenger(object): """ Represents the API that a challenger should implement to enter the benchmark """ def fit(self, x, y): """ Implementors should train the model based on (x, y) """ raise NotImplementedError() de...
[ "pytest_cases.parametrize", "numpy.polyfit" ]
[((999, 1025), 'pytest_cases.parametrize', 'parametrize', ([], {'degree': '[1, 2]'}), '(degree=[1, 2])\n', (1010, 1025), False, 'from pytest_cases import parametrize\n'), ((782, 815), 'numpy.polyfit', 'np.polyfit', (['x', 'y'], {'deg': 'self.degree'}), '(x, y, deg=self.degree)\n', (792, 815), True, 'import numpy as np\...
import logging import numpy as np import os import time import torch import torch.nn as nn from utils.meter import AverageMeter from torch.cuda.amp import autocast as autocast, GradScaler from utils.reranking import re_ranking import datetime import torch.nn.functional as F def do_train(cfg, model, ...
[ "utils.reranking.re_ranking", "torch.cuda.amp.autocast", "torch.nn.functional.kl_div", "utils.meter.AverageMeter", "torch.FloatTensor", "torch.cat", "time.time", "numpy.argsort", "torch.cuda.device_count", "torch.nn.functional.softmax", "torch.clamp", "torch.pow", "torch.cuda.amp.GradScaler"...
[((574, 614), 'logging.getLogger', 'logging.getLogger', (['"""reid_baseline.train"""'], {}), "('reid_baseline.train')\n", (591, 614), False, 'import logging\n'), ((875, 889), 'utils.meter.AverageMeter', 'AverageMeter', ([], {}), '()\n', (887, 889), False, 'from utils.meter import AverageMeter\n'), ((906, 920), 'utils.m...
"""Return true where two arrays are element-wise equal within a tolerance.""" from __future__ import annotations import numpy import numpoly from ..baseclass import PolyLike from ..dispatch import implements @implements(numpy.isclose) def isclose( a: PolyLike, b: PolyLike, rtol: float = 1e-5...
[ "numpy.isclose", "numpoly.align_polynomials", "numpy.ones" ]
[((2838, 2869), 'numpoly.align_polynomials', 'numpoly.align_polynomials', (['a', 'b'], {}), '(a, b)\n', (2863, 2869), False, 'import numpoly\n'), ((2880, 2911), 'numpy.ones', 'numpy.ones', (['a.shape'], {'dtype': 'bool'}), '(a.shape, dtype=bool)\n', (2890, 2911), False, 'import numpy\n'), ((2950, 3041), 'numpy.isclose'...
import numpy as np import torch import torch.nn as nn import torchvision from torchvision import models from torch.autograd import Variable def init_weights(m): classname = m.__class__.__name__ if classname.find('Conv2d') != -1 or classname.find('Linear') != -1: nn.init.xavier_uniform_(m.weight) ...
[ "torch.nn.Dropout", "torch.nn.ReLU", "torch.nn.Sequential", "torch.nn.init.xavier_uniform_", "torchvision.models.alexnet", "torch.nn.Conv1d", "torch.nn.init.zeros_", "numpy.exp", "torch.nn.Linear", "torch.nn.init.ones_", "torch.nn.AvgPool2d", "torch.nn.Sigmoid" ]
[((280, 313), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['m.weight'], {}), '(m.weight)\n', (303, 313), True, 'import torch.nn as nn\n'), ((1417, 1448), 'torchvision.models.alexnet', 'models.alexnet', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (1431, 1448), False, 'from torchvision import ...
''' core.py的全部内容都来自我的开源项目:https://github.com/oscarcx123/afk-arena-tools 以前已经实现过这么一套API,就不再重复造轮子了。 部分API可能没什么用,我也懒得删。 普通用户不需要看这个文件。 ''' import os import cv2 import time import random import subprocess import numpy as np import concurrent.futures class Azure(): def __init__(self, scale_percentage): self.scal...
[ "cv2.minMaxLoc", "cv2.imshow", "os.path.join", "cv2.matchTemplate", "random.randint", "cv2.imwrite", "numpy.fromstring", "cv2.resize", "time.localtime", "subprocess.Popen", "cv2.circle", "os.stat", "cv2.waitKey", "time.sleep", "cv2.resizeWindow", "os.listdir", "cv2.imread", "cv2.de...
[((516, 536), 'os.listdir', 'os.listdir', (['file_dir'], {}), '(file_dir)\n', (526, 536), False, 'import os\n'), ((1901, 1949), 'cv2.namedWindow', 'cv2.namedWindow', (['"""screenshot"""', 'cv2.WINDOW_NORMAL'], {}), "('screenshot', cv2.WINDOW_NORMAL)\n", (1916, 1949), False, 'import cv2\n'), ((1958, 1998), 'cv2.resizeWi...
# coding: utf-8 import unittest import os, subprocess, sys import time import scipy import numpy as np from numpy.testing import assert_almost_equal, assert_equal,\ assert_raises from scipy.special import lpmn, sph_harm from scipy.interpolate import CubicSpline from scipy.special import factorial2 as fac2 from...
[ "os.remove", "pawpyseed.core.projector.Projector.setup_multiple_projections", "numpy.sum", "numpy.abs", "scipy.interpolate.CubicSpline", "numpy.mean", "sys.stdout.flush", "numpy.exp", "numpy.linalg.norm", "numpy.sin", "os.path.join", "os.chdir", "os.path.abspath", "numpy.cumprod", "pawpy...
[((688, 713), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (703, 713), False, 'import os, subprocess, sys\n'), ((1295, 1306), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1304, 1306), False, 'import os, subprocess, sys\n'), ((1379, 1401), 'pymatgen.io.vasp.outputs.Vasprun', 'Vasprun', (['""...
from .path_alg import solve_path_Conc import numpy as np import numpy.linalg as LA from .misc_functions import unpenalized r""" Problem : min ||Ab - y||^2/sigma + n/2 sigma + lambda ||b||1 with C.b= 0 and sigma > 0 Dimensions : A : m*d ; y : m ; b : d ; C : k*d The first function compute a solution of a...
[ "numpy.minimum", "numpy.maximum", "numpy.zeros", "numpy.ones", "numpy.vdot", "numpy.linalg.matrix_rank", "numpy.linalg.norm", "numpy.eye", "numpy.sqrt" ]
[((8817, 8827), 'numpy.linalg.norm', 'LA.norm', (['u'], {}), '(u)\n', (8824, 8827), True, 'import numpy.linalg as LA\n'), ((2434, 2445), 'numpy.zeros', 'np.zeros', (['d'], {}), '(d)\n', (2442, 2445), True, 'import numpy as np\n'), ((4273, 4283), 'numpy.linalg.norm', 'LA.norm', (['y'], {}), '(y)\n', (4280, 4283), True, ...
"""Text and number formatting operations""" from copy import deepcopy import json import numpy as np def round_all_numbers_in_dict(d, rounding_digits=2, outplace=True): """ Return a new version of dict d with all floats rounded to N digits.""" if outplace: d = deepcopy(d) for k, v in d.items(): ...
[ "copy.deepcopy", "numpy.round", "json.dumps" ]
[((725, 753), 'json.dumps', 'json.dumps', (['d'], {'indent': 'indent'}), '(d, indent=indent)\n', (735, 753), False, 'import json\n'), ((280, 291), 'copy.deepcopy', 'deepcopy', (['d'], {}), '(d)\n', (288, 291), False, 'from copy import deepcopy\n'), ((371, 399), 'numpy.round', 'np.round', (['v', 'rounding_digits'], {}),...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from scipy import misc import sys,math,cv2 import os import argparse import tensorflow as tf import numpy as np import random import align.detect_face from time import sleep def get_lot(Line): Dir = Line.s...
[ "numpy.minimum", "numpy.maximum", "argparse.ArgumentParser", "os.makedirs", "numpy.argmax", "numpy.power", "numpy.asarray", "tensorflow.Session", "numpy.zeros", "os.path.exists", "cv2.warpAffine", "numpy.random.randint", "tensorflow.Graph", "scipy.misc.imsave", "numpy.squeeze", "numpy....
[((549, 598), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['image_center', 'angle', '(1.0)'], {}), '(image_center, angle, 1.0)\n', (572, 598), False, 'import sys, math, cv2\n'), ((937, 1008), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'rotation_matrix', '(rotated_width, rotated_height)'], {}), '(image, r...
"""Utility functions for converting relative and specific humidity. CAUTION: after the refactoring these have not been tested. """ import numpy as np EPSILON = 0.62198 # ratio of water vapour to dry air molecular weights def calc_saturation_vapour_pressure(air_temperature): """Convert air temperature to satur...
[ "numpy.asarray", "numpy.maximum", "numpy.exp" ]
[((1070, 1141), 'numpy.exp', 'np.exp', (['(17.625 * (air_temperature - 273.15) / (air_temperature - 30.11))'], {}), '(17.625 * (air_temperature - 273.15) / (air_temperature - 30.11))\n', (1076, 1141), True, 'import numpy as np\n'), ((1007, 1034), 'numpy.asarray', 'np.asarray', (['air_temperature'], {}), '(air_temperatu...
import os import numpy as np from typing import TextIO, Tuple, Mapping, Dict, List, Sequence import chardet from . import ri, trains, agf, PROPERTIES_DIR # Folder containing supplied (public domain) AGF files. SUPPLIED_AGFS_DIR = os.path.join(PROPERTIES_DIR, 'agfs') # Translate from Zemax glass database to ri module...
[ "os.path.join", "numpy.errstate", "numpy.isclose", "os.path.isfile", "chardet.detect", "os.path.splitext", "os.path.expanduser", "os.listdir" ]
[((232, 268), 'os.path.join', 'os.path.join', (['PROPERTIES_DIR', '"""agfs"""'], {}), "(PROPERTIES_DIR, 'agfs')\n", (244, 268), False, 'import os\n'), ((465, 533), 'os.path.join', 'os.path.join', (['SUPPLIED_AGFS_DIR', '"""HOYA20200314_include_obsolete.agf"""'], {}), "(SUPPLIED_AGFS_DIR, 'HOYA20200314_include_obsolete....
import axelrod as axl import numpy as np import csv download_dir = "axelrod-tournament.csv" #where file will go csv = open(download_dir, "w") #allow writing to file columnTitleRow= 'Strategy Name, Average Pay-off\n' csv.write(columnTitleRow) # players = [s() for s in axl.basic_strategies] players = [s() for s in ax...
[ "csv.write", "numpy.mean", "axelrod.Tournament" ]
[((219, 244), 'csv.write', 'csv.write', (['columnTitleRow'], {}), '(columnTitleRow)\n', (228, 244), False, 'import csv\n'), ((441, 488), 'axelrod.Tournament', 'axl.Tournament', (['players'], {'repetitions': '(1)', 'turns': '(1)'}), '(players, repetitions=1, turns=1)\n', (455, 488), True, 'import axelrod as axl\n'), ((5...
import os import os.path as osp import numpy as np import pickle from PIL import Image from tqdm import tqdm import glob import yaml import torch import open3d as o3d from xmuda.data.semantic_kitti import splits from xmuda.data.semantic_kitti.preprocess import DummyDataset from xmuda.data.utils.preprocess import create...
[ "numpy.pad", "pickle.dump", "os.makedirs", "numpy.unique", "numpy.ones", "xmuda.data.utils.preprocess.create_img_grid", "numpy.hstack", "numpy.where", "numpy.linalg.inv", "numpy.array", "os.path.join", "numpy.vstack" ]
[((3010, 3058), 'xmuda.data.utils.preprocess.create_img_grid', 'create_img_grid', (['img_size'], {'downsample': 'downsample'}), '(img_size, downsample=downsample)\n', (3025, 3058), False, 'from xmuda.data.utils.preprocess import create_img_grid, create_voxel_grid\n'), ((5736, 5767), 'os.path.join', 'osp.join', (['out_d...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright Toolkit Authors from abc import ABC import cv2 from flatdict import FlatDict import numpy as np from pandas import DataFrame import re import ros_numpy import rosbag import rospy import sensor_msgs.msg import yaml from pydtk.models import BaseModel, register...
[ "re.split", "pandas.DataFrame.from_dict", "rosbag.Bag", "ros_numpy.numpify", "cv2.imdecode", "rospy.Time", "numpy.array", "pydtk.models.register_model", "numpy.fromstring", "cv2.resize" ]
[((330, 356), 'pydtk.models.register_model', 'register_model', ([], {'priority': '(1)'}), '(priority=1)\n', (344, 356), False, 'from pydtk.models import BaseModel, register_model\n'), ((8974, 9000), 'pydtk.models.register_model', 'register_model', ([], {'priority': '(2)'}), '(priority=2)\n', (8988, 9000), False, 'from ...
import importlib from typing import Any import numpy as np import collections import torch from collections import OrderedDict # https://github.com/quantumblacklabs/kedro/blob/9809bd7ca0556531fa4a2fc02d5b2dc26cf8fa97/kedro/utils.py def load_obj(obj_path: str, default_obj_path: str = "") -> Any: """Extract an obj...
[ "collections.OrderedDict", "torch.load", "importlib.import_module", "numpy.clip" ]
[((825, 858), 'importlib.import_module', 'importlib.import_module', (['obj_path'], {}), '(obj_path)\n', (848, 858), False, 'import importlib\n'), ((1696, 1709), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1707, 1709), False, 'from collections import OrderedDict\n'), ((1164, 1207), 'numpy.clip', 'np.cli...
""" Linear Regression ----------------- Performs linear regression using descent and closed forms methods. Includes L1/L2 regularization. """ import numpy as np from utils import normalize from batch_gradient_descent import batch_gradient_descent class LinearRegression(object): """Class for performing linear regre...
[ "utils.normalize", "batch_gradient_descent.batch_gradient_descent", "numpy.insert" ]
[((1613, 1639), 'numpy.insert', 'np.insert', (['X', '(0)', '(1)'], {'axis': '(1)'}), '(X, 0, 1, axis=1)\n', (1622, 1639), True, 'import numpy as np\n'), ((2192, 2218), 'numpy.insert', 'np.insert', (['X', '(0)', '(1)'], {'axis': '(1)'}), '(X, 0, 1, axis=1)\n', (2201, 2218), True, 'import numpy as np\n'), ((1594, 1606), ...
from os import urandom from numpy import prod, sum from nibabel.parrec import parse_PAR_header def create_random_rec(par_file): hdr, image = parse_PAR_header(par_file.open()) n_bytes = sum(prod(image['recon resolution'], axis=1) * image['image pixel size'] / 8) with par_file.with_suffix('.REC').open('wb'...
[ "numpy.prod" ]
[((199, 238), 'numpy.prod', 'prod', (["image['recon resolution']"], {'axis': '(1)'}), "(image['recon resolution'], axis=1)\n", (203, 238), False, 'from numpy import prod, sum\n')]
import time import numpy as np with open("input.txt") as f: lines = f.readlines() S = lines.pop(0).strip() lines.pop(0) print(S) rules = {} for r in lines: s = r.strip().split(" -> ") rules[s[0]] = s[1] t = time.process_time() # For each rule, build out 20 iterations iterated_rules = {} fo...
[ "time.process_time", "numpy.zeros" ]
[((232, 251), 'time.process_time', 'time.process_time', ([], {}), '()\n', (249, 251), False, 'import time\n'), ((1202, 1220), 'numpy.zeros', 'np.zeros', (['num_bins'], {}), '(num_bins)\n', (1210, 1220), True, 'import numpy as np\n'), ((987, 1005), 'numpy.zeros', 'np.zeros', (['num_bins'], {}), '(num_bins)\n', (995, 100...
from ceo.segmentPistonSensor import SegmentPistonSensor from ceo import constants, Telescope, cuFloatArray import numpy as np from scipy.optimize import leastsq from skimage.feature import blob_log from scipy.ndimage.interpolation import rotate class DispersedFringeSensor(SegmentPistonSensor): """ A class for ...
[ "numpy.absolute", "numpy.polyfit", "numpy.argmax", "ceo.segmentPistonSensor.SegmentPistonSensor.__init__", "scipy.optimize.leastsq", "numpy.argsort", "numpy.sin", "numpy.arange", "numpy.tile", "numpy.exp", "numpy.round", "numpy.meshgrid", "ceo.Telescope", "numpy.max", "numpy.tan", "ceo...
[((3321, 3355), 'ceo.segmentPistonSensor.SegmentPistonSensor.__init__', 'SegmentPistonSensor.__init__', (['self'], {}), '(self)\n', (3349, 3355), False, 'from ceo.segmentPistonSensor import SegmentPistonSensor\n'), ((4016, 4060), 'ceo.Telescope', 'Telescope', (['N_PX_FRINGE_IMAGE', '(1)'], {'scale': 'scale'}), '(N_PX_F...
import math import matplotlib.pyplot as plt import numpy as np import scipy as sp from scipy.optimize import leastsq steps = [] distance = [] def load_data(filename): # read RandomWalk data from file f = open(filename) for line in f.readlines(): line = line.strip().split() steps.append(...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ioff", "numpy.asarray", "scipy.optimize.leastsq", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.pause", "numpy.sqr...
[((434, 443), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (441, 443), True, 'import matplotlib.pyplot as plt\n'), ((448, 474), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (458, 474), True, 'import matplotlib.pyplot as plt\n'), ((486, 511), 'matplotlib.pyplot.pl...
import numpy as np import xarray as xr import math from datetime import datetime from sentinelhub import CRS, BBox from ._common import ProcessEOTask, ProcessArgumentInvalid, ProcessArgumentRequired class create_cubeEOTask(ProcessEOTask): """ This process generates an xarray from input data. It is useful ...
[ "sentinelhub.CRS", "datetime.datetime.strptime", "numpy.array" ]
[((976, 1014), 'numpy.array', 'np.array', (['data_as_list'], {'dtype': 'np.float'}), '(data_as_list, dtype=np.float)\n', (984, 1014), True, 'import numpy as np\n'), ((870, 911), 'datetime.datetime.strptime', 'datetime.strptime', (['d', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(d, '%Y-%m-%d %H:%M:%S')\n", (887, 911), False, 'f...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes from matplotlib.ticker import AutoMinorLocator from matplotlib.ticker import MultipleLocator from matplotlib.ticker import LogLocator import importlib import math import sys import scipy.io if not '../aux...
[ "sys.path.append", "numpy.load", "spec.mean_within_delta", "matplotlib.pyplot.close", "auxplt.figpar", "importlib.reload", "matplotlib.ticker.AutoMinorLocator", "matplotlib.pyplot.subplots_adjust", "matplotlib.ticker.MultipleLocator", "numpy.savez", "matplotlib.pyplot.subplots", "auxplt.savepd...
[((379, 402), 'importlib.reload', 'importlib.reload', (['paths'], {}), '(paths)\n', (395, 402), False, 'import importlib\n'), ((418, 440), 'importlib.reload', 'importlib.reload', (['spec'], {}), '(spec)\n', (434, 440), False, 'import importlib\n'), ((456, 478), 'importlib.reload', 'importlib.reload', (['phys'], {}), '(...
from sciope.utilities.epsilonselectors.epsilon_selector import * import numpy as np class RelativeEpsilonSelector(EpsilonSelector): """ Creates an epsilon selector based on a relative percentile. For each round, it computes the new epsilon as the epsilon-percentile of the last set of ABC distances. ...
[ "numpy.percentile" ]
[((2056, 2124), 'numpy.percentile', 'np.percentile', (["abc_history[-1]['distances']", 'self.epsilon_percentile'], {}), "(abc_history[-1]['distances'], self.epsilon_percentile)\n", (2069, 2124), True, 'import numpy as np\n'), ((2155, 2230), 'numpy.percentile', 'np.percentile', (["abc_history[round - 1]['distances']", '...
# prepare_data_DCE.py # init # from scipy import io as sio import matplotlib import numpy as np import os,sys import matplotlib.pyplot as plt from scipy import io as sio import h5py from PIL import Image # dir # dir_data_DCE = '/Users/enhao/Documents/Research/MRI/GANCS/data_MRI/processed_data' # dir_mask_DCE = '/Users...
[ "os.mkdir", "scipy.io.loadmat", "numpy.ndim", "numpy.max", "numpy.squeeze", "os.path.join", "os.listdir" ]
[((826, 849), 'os.mkdir', 'os.mkdir', (['dir_image_DCE'], {}), '(dir_image_DCE)\n', (834, 849), False, 'import os, sys\n'), ((1095, 1136), 'os.path.join', 'os.path.join', (['dir_data_DCE', 'filename_data'], {}), '(dir_data_DCE, filename_data)\n', (1107, 1136), False, 'import os, sys\n'), ((1155, 1181), 'scipy.io.loadma...
#%% import tensorflow as tf import numpy as np from data_prepare import * from Network_structure import * from loss_function import * from train_method import * from save_method import * import os #sys.path.append('../') from Novel_CNN import * # EEGdenoiseNet V2 # Author: <NAME> # Here is the main part of the denoi...
[ "numpy.load", "tensorflow.optimizers.RMSprop", "tensorflow.optimizers.Adam", "tensorflow.keras.models.save_model", "tensorflow.optimizers.SGD" ]
[((1296, 1336), 'tensorflow.optimizers.RMSprop', 'tf.optimizers.RMSprop', ([], {'lr': '(5e-05)', 'rho': '(0.9)'}), '(lr=5e-05, rho=0.9)\n', (1317, 1336), True, 'import tensorflow as tf\n'), ((1344, 1411), 'tensorflow.optimizers.Adam', 'tf.optimizers.Adam', ([], {'lr': '(5e-05)', 'beta_1': '(0.5)', 'beta_2': '(0.9)', 'e...
import numpy as np arr = np.arange(0, 11) print(arr[8]) print(arr[1:5]) print(arr[0:5]) print(arr[:6]) print(arr[5:]) arr[0:5] = 100 print(arr) arr = np.arange(0, 11) slice_of_arr = arr[0:6] print(slice_of_arr) print(slice_of_arr[:]) slice_of_arr[:] = 99 print(slice_of_arr) print(arr) arr_copy = arr.copy() print(arr_...
[ "numpy.arange" ]
[((26, 42), 'numpy.arange', 'np.arange', (['(0)', '(11)'], {}), '(0, 11)\n', (35, 42), True, 'import numpy as np\n'), ((152, 168), 'numpy.arange', 'np.arange', (['(0)', '(11)'], {}), '(0, 11)\n', (161, 168), True, 'import numpy as np\n')]
from __future__ import annotations import copy from typing import Tuple, Union, Optional, Any, TYPE_CHECKING import numpy as np import scipy.sparse as sci_sparse from pyNastran.dev.solver.stiffness.shells import build_kbb_cquad4, build_kbb_cquad8 from .utils import lambda1d, DOF_MAP #from pyNastran.bdf.cards.elements...
[ "pyNastran.dev.solver.stiffness.shells.build_kbb_cquad8", "copy.deepcopy", "pyNastran.dev.solver.stiffness.shells.build_kbb_cquad4", "numpy.zeros", "numpy.linalg.norm", "numpy.array", "scipy.sparse.dok_matrix", "numpy.vstack", "numpy.block" ]
[((926, 975), 'scipy.sparse.dok_matrix', 'sci_sparse.dok_matrix', (['(ndof, ndof)'], {'dtype': 'fdtype'}), '((ndof, ndof), dtype=fdtype)\n', (947, 975), True, 'import scipy.sparse as sci_sparse\n'), ((1933, 2028), 'pyNastran.dev.solver.stiffness.shells.build_kbb_cquad4', 'build_kbb_cquad4', (['model', 'Kbb', 'dof_map',...
# Copyright 2021 The ParallelAccel Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
[ "linear_algebra.unitary", "linear_algebra.cond_rotate_z", "random.uniform", "linear_algebra.flip_x_axis", "linear_algebra.experiments.random_symplectic_acyclic_graph_generation.random_rotations_between_grid_interaction_subgraphs_acyclic_graph", "linear_algebra.ProbBasisAxisSum", "linear_algebra.GridSpac...
[((5217, 5239), 'linear_algebra.Graph', 'linear_algebra.Graph', ([], {}), '()\n', (5237, 5239), False, 'import linear_algebra\n'), ((5863, 5896), 'linear_algebra.ProbBasisAxisSum', 'linear_algebra.ProbBasisAxisSum', ([], {}), '()\n', (5894, 5896), False, 'import linear_algebra\n'), ((5920, 5953), 'linear_algebra.ProbBa...
import numpy as np # X = 2*np.random.rand(100,1) # y = 4 + 3*X + np.random.randn(100,1) # X_ = np.c_[np.ones((100,1)),X] # theta_best = np.linalg.inv(X_.T.dot(X_)).dot(X_.T).dot(y) # # # X_new = np.array([[2],[0]]) # X_new_ = np.c_[np.ones((2,1)),X_new] # y_pred = X_new_.dot(theta_best) # import matplotlib.pyplot as pl...
[ "sklearn.datasets.load_iris", "matplotlib.pyplot.show", "sklearn.preprocessing.StandardScaler", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "sklearn.linear_model.SGDRegressor", "sklearn.model_selection.train_test_split", "sklearn.linear_model.ElasticNet", "sklearn.preprocessing.PolynomialFea...
[((1519, 1567), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'degree': '(2)', 'include_bias': '(False)'}), '(degree=2, include_bias=False)\n', (1537, 1567), False, 'from sklearn.preprocessing import PolynomialFeatures\n'), ((1618, 1670), 'sklearn.linear_model.SGDRegressor', 'SGDRegressor', ([...
"""Rules for adaptive and constant step-size selection.""" from abc import ABC, abstractmethod from typing import Optional, Tuple import numpy as np from probnum.typing import ArrayLike, FloatLike, IntLike class StepRule(ABC): """Step-size selection rules for ODE solvers.""" def __init__(self, firststep: ...
[ "numpy.linalg.norm", "numpy.sqrt" ]
[((4777, 4798), 'numpy.linalg.norm', 'np.linalg.norm', (['ratio'], {}), '(ratio)\n', (4791, 4798), True, 'import numpy as np\n'), ((4801, 4813), 'numpy.sqrt', 'np.sqrt', (['dim'], {}), '(dim)\n', (4808, 4813), True, 'import numpy as np\n')]
import numpy as np from numpy.random import choice from numpy.random import randint from rlkit.data_management.replay_buffer import ReplayBuffer import torch from torch.autograd import Variable class NPTransDataSampler(): def __init__(self, blocks_list): self.blocks_list = blocks_list block = bl...
[ "numpy.stack", "numpy.zeros", "numpy.ones", "torch.FloatTensor", "numpy.random.randint", "numpy.arange", "numpy.random.choice", "numpy.concatenate" ]
[((947, 995), 'numpy.zeros', 'np.zeros', (['(batch_size, context_size_range[1], 1)'], {}), '((batch_size, context_size_range[1], 1))\n', (955, 995), True, 'import numpy as np\n'), ((2391, 2410), 'numpy.stack', 'np.stack', (['X_context'], {}), '(X_context)\n', (2399, 2410), True, 'import numpy as np\n'), ((2431, 2450), ...
import numpy as np from numpy import array from itertools import product def log(x, base=10.): """logarithm of x to the base. Parameters ---------- x : np.array base: float Returns ------- np.array of same shape as x """ return np.log(x)/np.log(base) def gri...
[ "numpy.random.seed", "numpy.log", "numpy.logical_and", "numpy.ones", "numpy.finfo", "numpy.array", "numpy.linspace", "itertools.product", "numpy.random.rand", "numpy.all" ]
[((655, 670), 'itertools.product', 'product', (['*lists'], {}), '(*lists)\n', (662, 670), False, 'from itertools import product\n'), ((1802, 1810), 'numpy.array', 'array', (['N'], {}), '(N)\n', (1807, 1810), False, 'from numpy import array\n'), ((1820, 1842), 'numpy.array', 'array', (['lb'], {'dtype': 'float'}), '(lb, ...
# coding: utf-8 # In[2]: import nltk import gensim from nltk.probability import FreqDist import pickle from sklearn.model_selection import train_test_split import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.layers import Bidirectional, Drop...
[ "pickle.dump", "nltk.probability.FreqDist", "sklearn.preprocessing.OneHotEncoder", "numpy.array", "scipy.sparse.save_npz", "gensim.models.KeyedVectors.load_word2vec_format", "nltk.word_tokenize" ]
[((1410, 1488), 'gensim.models.KeyedVectors.load_word2vec_format', 'gensim.models.KeyedVectors.load_word2vec_format', (['path_to_word2vec'], {'binary': '(True)'}), '(path_to_word2vec, binary=True)\n', (1457, 1488), False, 'import gensim\n'), ((2206, 2228), 'nltk.probability.FreqDist', 'FreqDist', (['X_train_main'], {})...
import numpy as np from cemc.tools import to_full_rank4 from itertools import product from cemc_cpp_code import PyKhachaturyan from cemc.tools import rotate_tensor, rot_matrix, rotate_rank4_tensor import time import datetime class Khachaturyan(object): def __init__(self, elastic_tensor=None, uniform_strain=None, ...
[ "numpy.sum", "numpy.allclose", "datetime.datetime.fromtimestamp", "numpy.einsum", "numpy.zeros", "numpy.fft.fftn", "time.time", "cemc.tools.rotate_tensor", "numpy.fft.fftfreq", "numpy.linalg.inv", "cemc_cpp_code.PyKhachaturyan", "numpy.array", "itertools.product", "cemc.tools.to_full_rank4...
[((4671, 4682), 'time.time', 'time.time', ([], {}), '()\n', (4680, 4682), False, 'import time\n'), ((375, 404), 'cemc.tools.to_full_rank4', 'to_full_rank4', (['elastic_tensor'], {}), '(elastic_tensor)\n', (388, 404), False, 'from cemc.tools import to_full_rank4\n'), ((963, 1008), 'numpy.einsum', 'np.einsum', (['"""m,n,...
import os import sys BASE_DIR = os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__))))) sys.path.append(BASE_DIR) import torch import torch.nn as nn from simpleAICV.detection.models import backbones from simpleAICV.detection.models.fpn import Yolov3TinyFPNHead, Yol...
[ "sys.path.append", "os.path.abspath", "numpy.random.seed", "simpleAICV.detection.models.fpn.Yolov3TinyFPNHead", "torch.manual_seed", "simpleAICV.detection.models.fpn.Yolov3FPNHead", "torch.cuda.manual_seed", "torch.randn", "thop.clever_format", "torch.cuda.manual_seed_all", "random.seed" ]
[((141, 166), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (156, 166), False, 'import sys\n'), ((3460, 3477), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (3471, 3477), False, 'import random\n'), ((3482, 3502), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', ...
# -*- coding: utf-8 -*- import os import os.path import numpy as np from PIL import Image import torch from torch.utils.data import DataLoader from torchvision import transforms class MNIST(torch.utils.data.Dataset): """`MNIST <http://yann.lecun.com/exdb/mnist/>`_ Dataset. Args: examples (list: [(img,...
[ "numpy.sum", "os.path.join", "torch.utils.data.DataLoader", "torchvision.transforms.RandomHorizontalFlip", "numpy.asarray", "torchvision.transforms.RandomResizedCrop", "PIL.Image.fromarray", "torchvision.transforms.Normalize", "os.path.expanduser", "numpy.random.shuffle", "torchvision.transforms...
[((1133, 1163), 'PIL.Image.fromarray', 'Image.fromarray', (['img'], {'mode': '"""L"""'}), "(img, mode='L')\n", (1148, 1163), False, 'from PIL import Image\n'), ((1933, 1961), 'os.path.expanduser', 'os.path.expanduser', (['data_dir'], {}), '(data_dir)\n', (1951, 1961), False, 'import os\n'), ((2342, 2372), 'numpy.random...
""" cytometer/data.py Functions to load, save and pre-process data related to the cytometer project. Environments: cytometer_tensorflow, cytometer_tensorflow_v2. """ """ This file is part of Cytometer Copyright 2021 Medical Research Council SPDX-License-Identifier: Apache-2.0 Author: <NAME> <<EMAIL>> """ import os ...
[ "matplotlib.pyplot.title", "pickle.dump", "os.remove", "numpy.random.seed", "matplotlib.pyplot.clf", "colorsys.rgb_to_hls", "random.shuffle", "numpy.empty", "pandas.read_csv", "numpy.floor", "aicsimageio.AICSImage", "ujson.dump", "os.path.isfile", "numpy.imag", "numpy.arange", "colorsy...
[((1732, 1807), 'pysto.imgproc.block_split', 'pystoim.block_split', (['x'], {'nblocks': '(1, nblocks, nblocks, 1)', 'by_reference': '(True)'}), '(x, nblocks=(1, nblocks, nblocks, 1), by_reference=True)\n', (1751, 1807), True, 'import pysto.imgproc as pystoim\n'), ((1816, 1841), 'numpy.concatenate', 'np.concatenate', ([...
# -*- coding:utf-8 -*- import argparse from collections import OrderedDict from pathlib import Path import os import numpy as np import torch import torch.nn as nn from torch.utils.tensorboard import SummaryWriter from citylearn import CityLearn from agent import RL_Agents from utils.io import get_output_folder from ...
[ "numpy.stack", "os.mkdir", "citylearn.CityLearn", "argparse.ArgumentParser", "os.path.isdir", "numpy.expand_dims", "agent.RL_Agents", "numpy.split", "numpy.random.randint", "numpy.arange", "numpy.array", "torch.utils.tensorboard.SummaryWriter", "model.BaseModules.ActionClipping", "collecti...
[((419, 444), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (442, 444), False, 'import argparse\n'), ((2509, 2688), 'collections.OrderedDict', 'OrderedDict', ([], {'alpha': 'args.A_r', 'beta': 'args.B_r', 'total_energy_window': 'args.window_len_A', 'heat_energy_window': 'args.window_len_B', 'p...
from __future__ import division import scipy.signal as sig import numpy as np from .utility import disambiguate_params, As_from_beta try: from math import gcd except: from fractions import gcd # global cache of resamplers _precomputed_filters = {} def compute_filt(up, down, fc='nn', beta=5.0, N=32001, return...
[ "fractions.gcd", "numpy.fft.rfft", "numpy.abs", "numpy.ceil", "numpy.floor", "numpy.zeros", "numpy.array", "scipy.signal.fir_filter_design.firwin", "numpy.sqrt" ]
[((1876, 1889), 'fractions.gcd', 'gcd', (['up', 'down'], {}), '(up, down)\n', (1879, 1889), False, 'from fractions import gcd\n'), ((1966, 1998), 'numpy.sqrt', 'np.sqrt', (['(1 + (beta / np.pi) ** 2)'], {}), '(1 + (beta / np.pi) ** 2)\n', (1973, 1998), True, 'import numpy as np\n'), ((4152, 4212), 'scipy.signal.fir_fil...
import torch import torch.nn as nn import random import math import datetime #import adabound import os import numpy as np import cv2 from torch.utils.data import Dataset, DataLoader from torchvision import utils from torch.nn import functional as F from torch.autograd import Variable from torch.nn import Parameter fro...
[ "torch.sqrt", "torch.mm", "torch.randn", "numpy.mean", "numpy.arange", "torch.arange", "numpy.linalg.norm", "torch.no_grad", "numpy.std", "torch.Tensor", "math.cos", "torch.nn.functional.log_softmax", "sklearn.svm.LinearSVC", "datetime.datetime.now", "torch.norm", "torch.autograd.Varia...
[((553, 575), 'torch.div', 'torch.div', (['input', 'norm'], {}), '(input, norm)\n', (562, 575), False, 'import torch\n'), ((11453, 11480), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (11463, 11480), False, 'import torch\n'), ((11961, 11977), 'numpy.array', 'np.array', (['y_true'], {}...
""" @author: <NAME> <<EMAIL>> """ import tensorflow as tf from tensorflow.compat.v1 import ConfigProto from tensorflow.compat.v1 import InteractiveSession import numpy as np import cv2 import argparse from collections import deque from src.model import CLASS_IDS from src.utils import get_overlay, get_images HAND_GESTU...
[ "cv2.GaussianBlur", "tensorflow.compat.v1.InteractiveSession", "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "cv2.medianBlur", "numpy.argmax", "cv2.imshow", "collections.deque", "cv2.line", "tensorflow.nn.softmax", "cv2.contourArea", "cv2.cvtColor", "tensorflow.compat.v1.Session", "...
[((455, 574), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Implementation of Google\'s Quick Draw Project (https://quickdraw.withgoogle.com/#)"""'], {}), '(\n "Implementation of Google\'s Quick Draw Project (https://quickdraw.withgoogle.com/#)"\n )\n', (478, 574), False, 'import argparse\n'), ((935...
from ifm import Enum class DfePd: """ Functions regarding Discrete Feature Elements using Pandas. """ def __init__(self, doc): self.doc = doc def dfe(self): import pandas as pd import numpy as np df_nodes = self.doc.c.mesh.df.nodes() df_dfe = pd.DataFram...
[ "numpy.array" ]
[((849, 888), 'numpy.array', 'np.array', (['df_nodes.loc[df_dfe.node_1].X'], {}), '(df_nodes.loc[df_dfe.node_1].X)\n', (857, 888), True, 'import numpy as np\n'), ((912, 951), 'numpy.array', 'np.array', (['df_nodes.loc[df_dfe.node_2].X'], {}), '(df_nodes.loc[df_dfe.node_2].X)\n', (920, 951), True, 'import numpy as np\n'...
import numpy as np import matplotlib.pyplot as plt # Prepare data_set data_a = np.random.randn(100, 2) data_a[(data_a[:, 0] >= -0.1) & (data_a[:, 1] >= -0.1)] = - \ 0.5 * abs(np.random.rand(1, 2)) data_b = np.random.randn(100, 2) data_b[(data_b[:, 0] <= 0.1) | (data_b[:, 1] <= 0.1) ] = 0.5 * abs(np.random....
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.random.randn", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.ones", "numpy.exp", "numpy.linspace", "numpy.matmul", "num...
[((80, 103), 'numpy.random.randn', 'np.random.randn', (['(100)', '(2)'], {}), '(100, 2)\n', (95, 103), True, 'import numpy as np\n'), ((212, 235), 'numpy.random.randn', 'np.random.randn', (['(100)', '(2)'], {}), '(100, 2)\n', (227, 235), True, 'import numpy as np\n'), ((343, 360), 'numpy.ones', 'np.ones', (['(100, 1)']...
import sys from time import time from datetime import datetime import argparse import numpy as np from helicalc import helicalc_dir, helicalc_data from helicalc.solcalc import * from helicalc.geometry import read_solenoid_geom_combined from helicalc.tools import generate_cartesian_grid_df from helicalc.constants import...
[ "helicalc.geometry.read_solenoid_geom_combined", "argparse.ArgumentParser", "helicalc.tools.generate_cartesian_grid_df", "numpy.array", "datetime.datetime.now" ]
[((905, 930), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (928, 930), False, 'import argparse\n'), ((2216, 2239), 'numpy.array', 'np.array', (['[0.005, 0.01]'], {}), '([0.005, 0.01])\n', (2224, 2239), True, 'import numpy as np\n'), ((2266, 2306), 'helicalc.tools.generate_cartesian_grid_df', ...
''' Набор общих юнитов @author: Kosh ''' import numpy as np from streampy.units.base.pooled import Pool, Worker as Base class Worker(Base): ''' Преобразуем ббоксы в заполненные ячейки для yolo-подобного детектирования пока в примитивном варианте с одним классом todo: добить до множества анкоро...
[ "numpy.zeros" ]
[((581, 626), 'numpy.zeros', 'np.zeros', (['(cellsConfig[0], cellsConfig[1], 5)'], {}), '((cellsConfig[0], cellsConfig[1], 5))\n', (589, 626), True, 'import numpy as np\n')]
# import sys # from scipy.signal import spectrogram, detrend # from scipy.linalg import norm # import matplotlib.pyplot as plt import numpy as np import pickle from obspy.core import Trace # , Stream, read from obstools.atacr import utils # , plotting from pkg_resources import resource_filename from pathlib import Pa...
[ "obstools.atacr.utils.rotate_dir", "numpy.conj", "pickle.dump", "obspy.core.Trace", "numpy.abs", "numpy.fft.ifft", "numpy.roll", "numpy.seterr", "numpy.allclose", "obstools.atacr.utils.calculate_windowed_fft", "pkg_resources.resource_filename", "numpy.arange", "numpy.sqrt" ]
[((323, 346), 'numpy.seterr', 'np.seterr', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (332, 346), True, 'import numpy as np\n'), ((9271, 9320), 'obstools.atacr.utils.calculate_windowed_fft', 'utils.calculate_windowed_fft', (['trZ', 'ws'], {'hann': '(False)'}), '(trZ, ws, hann=False)\n', (9299, 9320), False, 'fr...
import numpy as np from scipy import ndimage from scipy import special import lmfit from .. import geometry def get_thick_line(point1, point2, length_spacing=1, line_thickness=0, width_spacing=1): """Construct a list of points representing a discrete line. If `line_thickness` > 0 then the line is composed of...
[ "numpy.polyfit", "lmfit.Parameter", "numpy.where", "numpy.array", "numpy.arange", "numpy.exp", "numpy.rollaxis", "numpy.sqrt", "lmfit.Model" ]
[((999, 1025), 'numpy.array', 'np.array', (['[point1, point2]'], {}), '([point1, point2])\n', (1007, 1025), True, 'import numpy as np\n'), ((4420, 4446), 'lmfit.Model', 'lmfit.Model', (['gaussian_wall'], {}), '(gaussian_wall)\n', (4431, 4446), False, 'import lmfit\n'), ((4820, 4842), 'numpy.rollaxis', 'np.rollaxis', ([...
"""Functions to plot M/EEG data e.g. topographies """ from __future__ import print_function # Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: Simplified BSD import math import copy import numpy as np from scipy import linalg from ..baseline ...
[ "matplotlib.pyplot.title", "numpy.abs", "numpy.arctan2", "numpy.invert", "matplotlib.pyplot.suptitle", "numpy.empty", "numpy.ones", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "matplotlib.pyplot.get_backend", "numpy.mean", "matplotlib.pyplot.gca", "numpy.unique", "numpy.atle...
[((683, 706), 'copy.deepcopy', 'copy.deepcopy', (['obj.info'], {}), '(obj.info)\n', (696, 706), False, 'import copy\n'), ((3015, 3034), 'numpy.meshgrid', 'np.meshgrid', (['xi', 'yi'], {}), '(xi, yi)\n', (3026, 3034), True, 'import numpy as np\n'), ((5363, 5389), 'math.ceil', 'math.ceil', (['(n_projs / nrows)'], {}), '(...
""" Tests module segmentation_analysis # Author: <NAME> # $Id$ """ from __future__ import unicode_literals from __future__ import print_function from __future__ import division from builtins import next from builtins import range #from past.utils import old_div __version__ = "$Revision$" from copy import copy, deep...
[ "unittest.TextTestRunner", "numpy.testing.assert_almost_equal", "pyto.segmentation.test.common.id_correspondence", "pyto.scene.cleft_regions.CleftRegions", "builtins.next", "pyto.segmentation.test.common.image_ar_inset_1.mean", "unittest.TestLoader", "numpy.testing.assert_equal", "pyto.segmentation....
[((1118, 1185), 'pyto.segmentation.cleft.Cleft', 'Cleft', ([], {'data': 'seg_cmn.bound_1.data', 'bound1Id': '(3)', 'bound2Id': '(4)', 'cleftId': '(5)'}), '(data=seg_cmn.bound_1.data, bound1Id=3, bound2Id=4, cleftId=5)\n', (1123, 1185), False, 'from pyto.segmentation.cleft import Cleft\n'), ((1232, 1280), 'pyto.scene.cl...
import pdb import time import os import subprocess import re import random import json import numpy as np import glob from tensorboard.backend.event_processing.event_accumulator import EventAccumulator import socket import argparse import threading import _thread import signal from datetime import datetime import csv ...
[ "threading.Thread", "json.dump", "json.load", "argparse.ArgumentParser", "csv.writer", "random.sample", "numpy.asarray", "socket.socket", "random.choice", "time.time", "time.sleep", "numpy.random.poisson" ]
[((329, 378), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TCP client"""'}), "(description='TCP client')\n", (352, 378), False, 'import argparse\n'), ((722, 733), 'time.time', 'time.time', ([], {}), '()\n', (731, 733), False, 'import time\n'), ((19384, 19437), 'threading.Thread', 'thre...
import numpy as np import math def sample_top(a=[], top_k=10): idx = np.argsort(a)[::-1] idx = idx[:top_k] probs = a[idx] probs = probs / np.sum(probs) choice = np.random.choice(idx, p=probs) return choice # fajie def sample_top_k(a=[], top_k=10): idx = np.argsort(a)[::-1] idx = idx[:t...
[ "numpy.sum", "numpy.argmax", "numpy.argsort", "numpy.array", "numpy.random.choice", "math.log" ]
[((182, 212), 'numpy.random.choice', 'np.random.choice', (['idx'], {'p': 'probs'}), '(idx, p=probs)\n', (198, 212), True, 'import numpy as np\n'), ((74, 87), 'numpy.argsort', 'np.argsort', (['a'], {}), '(a)\n', (84, 87), True, 'import numpy as np\n'), ((155, 168), 'numpy.sum', 'np.sum', (['probs'], {}), '(probs)\n', (1...
from typing import List, Optional, TypeVar import numpy as np import torch import torch.nn as nn from torecsys.inputs.base import BaseInput class MultiIndicesEmbedding(BaseInput): """ Base Input class for embedding indices in multi fields of inputs, which is more efficient than embedding with a number o...
[ "typing.TypeVar", "torch.nn.Embedding.from_pretrained", "numpy.cumsum" ]
[((381, 413), 'typing.TypeVar', 'TypeVar', (['"""MultiIndicesEmbedding"""'], {}), "('MultiIndicesEmbedding')\n", (388, 413), False, 'from typing import List, Optional, TypeVar\n'), ((1773, 1815), 'torch.nn.Embedding.from_pretrained', 'nn.Embedding.from_pretrained', (['nn_embedding'], {}), '(nn_embedding)\n', (1801, 181...
import torch import pytest import numpy as np @pytest.fixture def random_state(): return np.random.RandomState(None) # (1249563438) def test_complex_fft(random_state): shape, axis = (2, 3, 256, 2, 2), 2 np_x = random_state.randn(*shape) + 1j * random_state.randn(*shape) tr_x = torch.tensor(np.stac...
[ "numpy.stack", "numpy.fft.fft", "torch.hamming_window", "scipy.signal.windows.hamming", "numpy.random.RandomState", "cplxmodule.utils.spectrum.pwelch", "numpy.cos", "torch.from_numpy" ]
[((95, 122), 'numpy.random.RandomState', 'np.random.RandomState', (['None'], {}), '(None)\n', (116, 122), True, 'import numpy as np\n'), ((370, 397), 'numpy.fft.fft', 'np.fft.fft', (['np_x'], {'axis': 'axis'}), '(np_x, axis=axis)\n', (380, 397), True, 'import numpy as np\n'), ((841, 907), 'torch.hamming_window', 'torch...
#!/usr/bin/env python3 """ knn_sklearn.py Performs K nearest neighbors on some given data. Uses sklearn's KNN. Author: <NAME> """ def _main(args): import numpy as np from sklearn.neighbors import KNeighborsClassifier # Load dataset from keras.datasets import mnist (x_train, y_train), (x_tes...
[ "keras.datasets.mnist.load_data", "sklearn.neighbors.KNeighborsClassifier", "numpy.reshape", "argparse.ArgumentParser" ]
[((333, 350), 'keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (348, 350), False, 'from keras.datasets import mnist\n'), ((393, 426), 'numpy.reshape', 'np.reshape', (['x_train', '(60000, 784)'], {}), '(x_train, (60000, 784))\n', (403, 426), True, 'import numpy as np\n'), ((438, 470), 'numpy.reshap...
# -*- encoding: utf-8 -*- import numpy as np import pandas as pd from copy import deepcopy from tqdm import tqdm as TQ ### --- Functions Copied from CentroidDetection.commons.DistanceFunctions --- ### def _EuclideanDistance_(startPoint : np.ndarray, targetPoint : np.ndarray) -> float: '''Calculates the Eulidean Dist...
[ "pandas.DataFrame", "copy.deepcopy", "numpy.array", "numpy.sum" ]
[((652, 672), 'numpy.array', 'np.array', (['startPoint'], {}), '(startPoint)\n', (660, 672), True, 'import numpy as np\n'), ((689, 710), 'numpy.array', 'np.array', (['targetPoint'], {}), '(targetPoint)\n', (697, 710), True, 'import numpy as np\n'), ((728, 767), 'numpy.sum', 'np.sum', (['((startPoint - targetPoint) ** 2...
import yaml import numpy as np import collections import os from tempfile import mkstemp from shutil import move, copymode from os import fdopen, remove import copy import shutil ### edit this path plr_path = "/cluster/home/jonfrey/PLR3" template_path =plr_path + '/yaml/exp/exp_ws_deepim_leon.yml' save_dir = plr_pat...
[ "yaml.load", "os.makedirs", "numpy.logspace", "yaml.dump", "os.system", "shutil.rmtree" ]
[((438, 461), 'shutil.rmtree', 'shutil.rmtree', (['save_dir'], {}), '(save_dir)\n', (451, 461), False, 'import shutil\n'), ((842, 897), 'os.makedirs', 'os.makedirs', (['f"""{save_dir}/{folder_name}"""'], {'exist_ok': '(True)'}), "(f'{save_dir}/{folder_name}', exist_ok=True)\n", (853, 897), False, 'import os\n'), ((523,...
import numpy as np import WetterStation_KN.Read_TXT as rtxt def read_historical_txt_file(path, return_all=False, showPeaks=True, scan=False): assert path.__contains__("02712") # check ID is Konstanz! rainsum_month = np.zeros(12, dtype=np.float32) # Monthly rainfall all_data = [] ...
[ "numpy.array", "WetterStation_KN.Read_TXT.get_data", "numpy.zeros", "WetterStation_KN.Read_TXT.convert_date_pretty" ]
[((239, 269), 'numpy.zeros', 'np.zeros', (['(12)'], {'dtype': 'np.float32'}), '(12, dtype=np.float32)\n', (247, 269), True, 'import numpy as np\n'), ((1423, 1459), 'numpy.array', 'np.array', (['all_data'], {'dtype': 'np.float32'}), '(all_data, dtype=np.float32)\n', (1431, 1459), True, 'import numpy as np\n'), ((2892, 2...
import matplotlib.pyplot as plt import numpy as np from solve_functions import eigenvalue_solve, static_solve from system_functions import build_system_matrix k_full_target, m_full_target = build_system_matrix([1.0,1.0,1.0]) eigenmodes_target, eigenfrequencies_target = eigenvalue_solve(k_full_target, m_full_target) s...
[ "numpy.absolute", "matplotlib.pyplot.show", "numpy.subtract", "matplotlib.pyplot.legend", "system_functions.build_system_matrix", "solve_functions.static_solve", "solve_functions.eigenvalue_solve", "matplotlib.pyplot.subplots" ]
[((192, 228), 'system_functions.build_system_matrix', 'build_system_matrix', (['[1.0, 1.0, 1.0]'], {}), '([1.0, 1.0, 1.0])\n', (211, 228), False, 'from system_functions import build_system_matrix\n'), ((272, 318), 'solve_functions.eigenvalue_solve', 'eigenvalue_solve', (['k_full_target', 'm_full_target'], {}), '(k_full...
import sys sys.path.append('./python') import skyhook.common as lib import json import numpy import os, os.path import requests import skimage.io, skimage.transform import torch import torch.optim import torch.utils import skyhook.pytorch.model as model import skyhook.pytorch.util as util import skyhook.pytorch.dat...
[ "sys.path.append", "torch.optim.lr_scheduler.StepLR", "json.loads", "torch.load", "skyhook.pytorch.model.Net", "torch.optim.lr_scheduler.ReduceLROnPlateau", "json.dumps", "numpy.mean", "requests.get", "torch.device", "os.path.join", "skyhook.pytorch.util.inputs_to_device" ]
[((11, 38), 'sys.path.append', 'sys.path.append', (['"""./python"""'], {}), "('./python')\n", (26, 38), False, 'import sys\n'), ((553, 588), 'requests.get', 'requests.get', (["(local_url + '/config')"], {}), "(local_url + '/config')\n", (565, 588), False, 'import requests\n'), ((1437, 1459), 'torch.device', 'torch.devi...
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
[ "numpy.pad", "scipy.signal.lfilter", "scipy.signal.iirnotch", "absl.logging.info", "eeg_modelling.eeg_viewer.utils.InitDataTableInputsWithTimeAxis", "numpy.array", "eeg_modelling.eeg_viewer.utils.ConvertToDataTableJSon", "eeg_modelling.pyprotos.data_pb2.WaveformChunk", "eeg_modelling.pyprotos.data_p...
[((2642, 2691), 'numpy.pad', 'np.pad', (['row_data', '(pad_len, pad_len)', '"""symmetric"""'], {}), "(row_data, (pad_len, pad_len), 'symmetric')\n", (2648, 2691), True, 'import numpy as np\n'), ((8702, 8820), 'eeg_modelling.eeg_viewer.utils.InitDataTableInputsWithTimeAxis', 'utils.InitDataTableInputsWithTimeAxis', (['s...
from . import utils from sklearn.model_selection import train_test_split import pandas as pd import numpy as np import matplotlib matplotlib.use("agg") import os import json def get_array(tensor, keys): utils.check_mandatory_keys(tensor, keys) return [tensor[key] for key in keys] def to_hdf5(dictionary, p...
[ "numpy.full", "h5py.File", "json.load", "os.path.basename", "pandas.read_csv", "numpy.empty", "os.path.dirname", "numpy.zeros", "matplotlib.use", "pandas.read_table" ]
[((131, 152), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (145, 152), False, 'import matplotlib\n'), ((1315, 1372), 'pandas.read_table', 'pd.read_table', (['file'], {'sep': '"""\t"""', 'header': '(0)', 'low_memory': '(False)'}), "(file, sep='\\t', header=0, low_memory=False)\n", (1328, 1372), ...
# Essentials import pandas as pd import numpy as np # Plots import matplotlib.pyplot as plt from tqdm import tqdm # Models from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifier, VotingClassifier import xgboost as xgb # Misc from rdkit import Chem from sklearn.model_selection import GridSear...
[ "matplotlib.pyplot.title", "sklearn.model_selection.GridSearchCV", "matplotlib.pyplot.clf", "pandas.read_csv", "sklearn.model_selection.cross_validate", "create_fingerprints.create_topological_torsion_fingerprint", "sklearn.metrics.classification_report", "matplotlib.pyplot.step", "sklearn.metrics.f...
[((1099, 1125), 'pandas.DataFrame', 'pd.DataFrame', (["df['smiles']"], {}), "(df['smiles'])\n", (1111, 1125), True, 'import pandas as pd\n'), ((1692, 1743), 'create_fingerprints.create_ecfp4_fingerprint', 'cf.create_ecfp4_fingerprint', (['df_mols', 'length', '(False)'], {}), '(df_mols, length, False)\n', (1719, 1743), ...
import json import base64 import collections import numpy as np from copy import deepcopy from ..arc import arc_center from ..entities import Line, Arc, Bezier from ...constants import log, tol from ...constants import res_path as res from ... import util from ... import grouping from ... import resources from ......
[ "copy.deepcopy", "numpy.degrees", "numpy.allclose", "numpy.cross", "numpy.hstack", "collections.defaultdict", "numpy.array", "numpy.arange", "svg.path.parse_path", "numpy.eye", "numpy.vstack" ]
[((8515, 8544), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (8538, 8544), False, 'import collections\n'), ((8560, 8589), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (8583, 8589), False, 'import collections\n'), ((8603, 8638), 'collections.defau...
import unittest import shutil import numpy as np from magnificat import cadence class TestLSSTCadence(unittest.TestCase): """Tests for LSSTCadence class """ @classmethod def setUpClass(cls): cls.out_dir = 'obs_testing' def test_get_pointings(self): """Test input and output shapes...
[ "unittest.main", "magnificat.cadence.LSSTCadence", "numpy.testing.assert_array_equal", "numpy.dtype", "numpy.min", "numpy.max", "numpy.testing.assert_equal", "shutil.rmtree" ]
[((3796, 3811), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3809, 3811), False, 'import unittest\n'), ((372, 405), 'magnificat.cadence.LSSTCadence', 'cadence.LSSTCadence', (['self.out_dir'], {}), '(self.out_dir)\n', (391, 405), False, 'from magnificat import cadence\n'), ((651, 684), 'magnificat.cadence.LSSTCa...
import numpy as np import sklearn import sklearn.metrics class Evaluator(object): def __init__(self, metric='auc'): if metric == 'auc': self.metric = auc_score elif metric == 'acc': self.metric = acc_score def calculate(self, y_true, y_pred): return self.metr...
[ "numpy.sum", "sklearn.metrics.roc_curve", "sklearn.metrics.accuracy_score", "sklearn.metrics.roc_auc_score", "sklearn.metrics.auc" ]
[((537, 604), 'sklearn.metrics.roc_curve', 'sklearn.metrics.roc_curve', (['y_true', 'y_pred'], {'pos_label': 'positive_label'}), '(y_true, y_pred, pos_label=positive_label)\n', (562, 604), False, 'import sklearn\n'), ((625, 662), 'sklearn.metrics.auc', 'sklearn.metrics.auc', (['fp_rate', 'tp_rate'], {}), '(fp_rate, tp_...
import multiprocessing as mp import numpy as np import statsmodels.api as sm from sklearn.metrics import roc_auc_score def bootstrap(args, out_q): outdict = {} mean = [] std = [] c68 = [] boot = [] if 'name' not in args: args['name'] = '' if 'n' not in args: args['n'] = 100 if 'kd...
[ "statsmodels.api.nonparametric.KDEUnivariate", "numpy.abs", "sklearn.metrics.roc_auc_score", "multiprocessing.Queue", "multiprocessing.Process" ]
[((2188, 2198), 'multiprocessing.Queue', 'mp.Queue', ([], {}), '()\n', (2196, 2198), True, 'import multiprocessing as mp\n'), ((2242, 2290), 'multiprocessing.Process', 'mp.Process', ([], {'target': 'target', 'args': '(args[i], out_q)'}), '(target=target, args=(args[i], out_q))\n', (2252, 2290), True, 'import multiproce...
#!/usr/bin/env python #coding=utf-8 import numpy as np from eap import cell from neuron import h from nose import with_setup def configure_cell(): h('vinit=-65') h('create cable') h('create soma') h('connect soma(1), cable(0)') h('access cable') h('nseg = 10') h('L = 10') h('forall ins...
[ "eap.cell.integrate", "eap.cell.get_seg_coords", "numpy.abs", "eap.cell.get_point_processes", "eap.cell.get_locs_coord", "neuron.h", "eap.cell.get_pp_coord", "neuron.h.IClamp", "nose.with_setup", "eap.cell.initialize" ]
[((750, 785), 'nose.with_setup', 'with_setup', (['add_synapse', 'reset_cell'], {}), '(add_synapse, reset_cell)\n', (760, 785), False, 'from nose import with_setup\n'), ((1037, 1072), 'nose.with_setup', 'with_setup', (['add_synapse', 'reset_cell'], {}), '(add_synapse, reset_cell)\n', (1047, 1072), False, 'from nose impo...
#!/usr/bin/python3 -B # Copyright 2015-2019 <NAME>, <EMAIL>. 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 # # Unle...
[ "matplotlib.backends.backend_qt4agg.NavigationToolbar2QT", "qtconsole.qt.QtGui.QWidget.__init__", "qtconsole.qt.QtGui.QTreeWidget.__init__", "optparse.OptionParser", "matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg", "numpy.mean", "serial.Serial", "qtconsole.qt.QtGui.QMenu", "matplotlib.lines.L...
[((881, 905), 'matplotlib.use', 'matplotlib.use', (['"""Qt4Agg"""'], {}), "('Qt4Agg')\n", (895, 905), False, 'import matplotlib\n'), ((16116, 16134), 'qtconsole.qt.QtCore.Signal', 'QtCore.Signal', (['str'], {}), '(str)\n', (16129, 16134), False, 'from qtconsole.qt import QtCore, QtGui\n'), ((38862, 38921), 'optparse.Op...
"""Internal (private) Utilities Module.""" import logging import math import os from typing import Any, Dict, Generator, List, Optional, Tuple import boto3 # type: ignore import botocore.config # type: ignore import numpy as np # type: ignore import psycopg2 # type: ignore import s3fs # type: ignore logger: log...
[ "boto3.Session", "psycopg2.extensions.register_adapter", "psycopg2.extensions.register_type", "os.cpu_count", "psycopg2.extensions.new_type", "numpy.array_split", "psycopg2.BINARY", "logging.getLogger" ]
[((334, 361), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (351, 361), False, 'import logging\n'), ((566, 581), 'boto3.Session', 'boto3.Session', ([], {}), '()\n', (579, 581), False, 'import boto3\n'), ((3565, 3587), 'numpy.array_split', 'np.array_split', (['lst', 'n'], {}), '(lst, n)\n...
import pandas as pd import numpy as np import time import os, csv from nsepython import * from datetime import date from dateutil.relativedelta import relativedelta from bfxhfindicators import Stochastic entryTargets = [] params = { 'access_key': 'fce4047d20b3b06c7393ed8093e0574d' } def isDoji(out): wicks ...
[ "pandas.read_csv", "os.system", "numpy.array", "bfxhfindicators.Stochastic", "csv.DictWriter" ]
[((518, 537), 'bfxhfindicators.Stochastic', 'Stochastic', (['(5)', '(3)', '(3)'], {}), '(5, 3, 3)\n', (528, 537), False, 'from bfxhfindicators import Stochastic\n'), ((772, 807), 'numpy.array', 'np.array', (['[H, L, HA_Open, HA_Close]'], {}), '([H, L, HA_Open, HA_Close])\n', (780, 807), True, 'import numpy as np\n'), (...
import numpy as np import simtk.openmm as mm from simtk.openmm.app import Simulation from ..unit import * class DrudeTemperatureReporter(object): ''' DrudeTemperatureReporter reports the temperatures of different DOFs in a Drude simulation system. The temperatures for three sets of degrees of freedom are ...
[ "numpy.count_nonzero", "numpy.zeros", "numpy.sum" ]
[((4217, 4242), 'numpy.zeros', 'np.zeros', (['[self.n_mol, 3]'], {}), '([self.n_mol, 3])\n', (4225, 4242), True, 'import numpy as np\n'), ((2372, 2404), 'numpy.zeros', 'np.zeros', (['self.n_atom'], {'dtype': 'int'}), '(self.n_atom, dtype=int)\n', (2380, 2404), True, 'import numpy as np\n'), ((2481, 2501), 'numpy.zeros'...
"""Module with utility functions for generating annotations.""" from jicbioimage.transform import mean_intensity_projection from jicbioimage.illustrate import AnnotatedImage from utils import mean_plot_intensity, plot_identifier import numpy as np #def quick_grayscale_ann(image): def get_grayscale_ann(image): ...
[ "utils.mean_plot_intensity", "numpy.mean", "utils.plot_identifier", "jicbioimage.illustrate.AnnotatedImage.from_grayscale" ]
[((389, 411), 'numpy.mean', 'np.mean', (['image'], {'axis': '(2)'}), '(image, axis=2)\n', (396, 411), True, 'import numpy as np\n'), ((422, 462), 'jicbioimage.illustrate.AnnotatedImage.from_grayscale', 'AnnotatedImage.from_grayscale', (['grayscale'], {}), '(grayscale)\n', (451, 462), False, 'from jicbioimage.illustrate...
from copy import deepcopy import numpy as np import openmm import pytest from openff.toolkit.topology import Molecule, Topology from openff.toolkit.typing.engines.smirnoff import ForceField from openff.units import unit from openff.utilities.testing import skip_if_missing from openmm import app from openmm import unit...
[ "openff.toolkit.topology.Topology.from_molecules", "pytest.mark.slow", "openff.interchange.drivers.gromacs.get_gromacs_energies", "openff.interchange.components.interchange.Interchange.from_smirnoff", "mbuild.Box", "pytest.xfail", "mbuild.load", "openff.interchange.drivers.report.EnergyReport", "ope...
[((1698, 1723), 'openff.utilities.testing.skip_if_missing', 'skip_if_missing', (['"""mbuild"""'], {}), "('mbuild')\n", (1713, 1723), False, 'from openff.utilities.testing import skip_if_missing\n'), ((1747, 1766), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {}), '()\n', (1764, 1766), False, 'import pytest\n'), ((176...
#T# the following code shows how to draw angle markings with arc marks #T# to draw arc marks, the pyplot module of the matplotlib package is used import matplotlib.pyplot as plt #T# the patches module of the matplotlib package is used to draw shapes import matplotlib.patches as mpatches #T# the numpy package is used...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.scatter", "matplotlib.patches.FancyArrowPatch", "numpy.ones", "matplotlib.pyplot.polar", "numpy.linspace", "matplotlib.pyplot.subplots" ]
[((432, 450), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (444, 450), True, 'import matplotlib.pyplot as plt\n'), ((513, 553), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(1)', '(1)'], {'projection': '"""polar"""'}), "(1, 1, 1, projection='polar')\n", (524, 553), True, 'imp...
#!/usr/bin/env python """ config_mixed.py: the configuration for mixed state learning task """ import numpy as np from tools.utils import get_zero_state # Learning Scripts # Regularization Parameters lamb = np.float(10) s = np.exp(-1 / (2 * lamb)) - 1 cst1 = s ** 2 / 4 + s + 1 cst2 = s ** 2 / 4 + s / 2 cst3 = ...
[ "numpy.exp", "numpy.float", "tools.utils.get_zero_state" ]
[((216, 228), 'numpy.float', 'np.float', (['(10)'], {}), '(10)\n', (224, 228), True, 'import numpy as np\n'), ((615, 642), 'tools.utils.get_zero_state', 'get_zero_state', (['system_size'], {}), '(system_size)\n', (629, 642), False, 'from tools.utils import get_zero_state\n'), ((233, 256), 'numpy.exp', 'np.exp', (['(-1 ...
import numpy as np import unittest from utils import * class FermionicOperator: """ A base class for any type of operator. You shouldn't be instantiating this directly. Attributes: type : str The type of operator: 'creation' or 'annihilation'. spin : str ...
[ "unittest.main", "numpy.eye", "numpy.zeros", "numpy.array" ]
[((8537, 8552), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8550, 8552), False, 'import unittest\n'), ((5537, 5557), 'numpy.eye', 'np.eye', (['(2 ** c_0.dim)'], {}), '(2 ** c_0.dim)\n', (5543, 5557), True, 'import numpy as np\n'), ((5834, 5872), 'numpy.zeros', 'np.zeros', (['(2 ** c_0.dim, 2 ** c_0.dim)'], {})...
import logging from numba import njit import numpy as np from scipy.interpolate import interp1d from strax import exporter, deterministic_hash from ..load_resource import load_config export, __all__ = exporter() logging.basicConfig(handlers=[logging.StreamHandler()]) log = logging.getLogger('wfsim.core') log.setLevel...
[ "numpy.sum", "numpy.random.exponential", "numpy.argsort", "numpy.arange", "scipy.interpolate.interp1d", "strax.deterministic_hash", "numpy.unique", "numpy.zeros_like", "numpy.cumsum", "numpy.max", "numpy.linspace", "numpy.random.choice", "strax.exporter", "numpy.stack", "logging.StreamHa...
[((203, 213), 'strax.exporter', 'exporter', ([], {}), '()\n', (211, 213), False, 'from strax import exporter, deterministic_hash\n'), ((276, 307), 'logging.getLogger', 'logging.getLogger', (['"""wfsim.core"""'], {}), "('wfsim.core')\n", (293, 307), False, 'import logging\n'), ((6041, 6072), 'strax.deterministic_hash', ...
# Note that ".mkv" file can be played using VLC under mac os # Please copy drive/707/Original Video/testX.MOV to datasets/test/ folder and run this # test1.MOV: qiye # test2.MOV: xiaohan # test3/4.MOV: shangxuan # configurations test_video_path = 'datasets/test/test1.MOV' experiment_name = "2russ2qi_D5" epoch = 200...
[ "cv2.VideoWriter_fourcc", "os.makedirs", "os.getcwd", "os.path.exists", "os.system", "cv2.imread", "shutil.rmtree", "os.path.join", "os.listdir", "numpy.concatenate" ]
[((593, 604), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (602, 604), False, 'import cv2, os, sys, pdb, shutil\n'), ((953, 984), 'os.system', 'os.system', (['resize_video_command'], {}), '(resize_video_command)\n', (962, 984), False, 'import cv2, os, sys, pdb, shutil\n'), ((1051, 1088), 'os.path.join', 'os.path.join', ...
# coding: utf-8 import numpy as np import pandas as pd ################################################## # メイン ################################################## if __name__ == '__main__': # Here is how to view the top and bottom rows of the frame: print("----------------------------------------------------...
[ "pandas.Timestamp", "pandas.date_range", "numpy.random.randn", "numpy.array", "pandas.Categorical" ]
[((420, 456), 'pandas.date_range', 'pd.date_range', (['"""20130101"""'], {'periods': '(6)'}), "('20130101', periods=6)\n", (433, 456), True, 'import pandas as pd\n'), ((479, 500), 'numpy.random.randn', 'np.random.randn', (['(6)', '(4)'], {}), '(6, 4)\n', (494, 500), True, 'import numpy as np\n'), ((1368, 1392), 'pandas...
import time import h5py import cv2 import numpy as np from scipy.sparse import csr_matrix, save_npz, diags, eye from scipy.sparse.linalg import norm cv2.useOptimized() hg38dim = [248956422, 242193529, 198295559, 190214555, 181538259, 170805979, 159345973, 145138636, 138394717, 133797422, 135086622, 13327530...
[ "h5py.File", "numpy.concatenate", "numpy.log2", "numpy.triu_indices", "time.time", "cv2.useOptimized", "scipy.sparse.csr_matrix", "numpy.array", "numpy.loadtxt", "scipy.sparse.save_npz", "scipy.sparse.linalg.norm", "scipy.sparse.eye", "numpy.sqrt" ]
[((150, 168), 'cv2.useOptimized', 'cv2.useOptimized', ([], {}), '()\n', (166, 168), False, 'import cv2\n'), ((1036, 1046), 'scipy.sparse.eye', 'eye', (['ngene'], {}), '(ngene)\n', (1039, 1046), False, 'from scipy.sparse import csr_matrix, save_npz, diags, eye\n'), ((1431, 1442), 'time.time', 'time.time', ([], {}), '()\...
import tensorflow as tf import numpy as np import scipy.spatial from scipy.sparse import isspmatrix def get_placeholder_by_name(name): try: return tf.get_default_graph().get_tensor_by_name(name+":0") except: return tf.placeholder(tf.int32, name=name) def align_loss(embeddings, align_labels, ...
[ "tensorflow.reduce_sum", "numpy.sum", "numpy.argmax", "tensorflow.reshape", "tensorflow.nn.sigmoid_cross_entropy_with_logits", "numpy.argsort", "numpy.mean", "numpy.arange", "tensorflow.get_default_graph", "scipy.sparse.isspmatrix", "tensorflow.nn.relu", "tensorflow.abs", "numpy.equal", "t...
[((1283, 1330), 'tensorflow.nn.embedding_lookup', 'tf.nn.embedding_lookup', (['embeddings', 'left_labels'], {}), '(embeddings, left_labels)\n', (1305, 1330), True, 'import tensorflow as tf\n'), ((1345, 1393), 'tensorflow.nn.embedding_lookup', 'tf.nn.embedding_lookup', (['embeddings', 'right_labels'], {}), '(embeddings,...
import argparse import os import hashlib import random import subprocess import h5py import numpy import constants import creator import util if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--config', default='default') parser.add_argument('--display', action='store_tr...
[ "h5py.File", "numpy.random.seed", "argparse.ArgumentParser", "creator.create_environment", "subprocess.check_output", "os.path.isfile", "random.seed", "numpy.array", "numpy.linspace" ]
[((186, 211), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (209, 211), False, 'import argparse\n'), ((453, 470), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (464, 470), False, 'import random\n'), ((475, 498), 'numpy.random.seed', 'numpy.random.seed', (['seed'], {}), '(seed)\n', ...
# test_star_process from star_process import STAR import numpy as np if __name__ == "__main__": N = 250 mu_params = np.array( [0.05, -0.15]) sigma_params = np.array( [0.0, 0.0]) AR_params = np.array([[0.0, 0 ], ...
[ "star_process.STAR", "numpy.array" ]
[((129, 152), 'numpy.array', 'np.array', (['[0.05, -0.15]'], {}), '([0.05, -0.15])\n', (137, 152), True, 'import numpy as np\n'), ((203, 223), 'numpy.array', 'np.array', (['[0.0, 0.0]'], {}), '([0.0, 0.0])\n', (211, 223), True, 'import numpy as np\n'), ((274, 304), 'numpy.array', 'np.array', (['[[0.0, 0], [0.0, 0]]'], ...
import numpy as np from scipy.ndimage import map_coordinates import zarr from numcodecs import Blosc from bigstream import stitch import dask.array as da from scipy.ndimage import zoom import ClusterWrap WORKER_BUFFER = 8 def position_grid(shape, dtype=np.uint16): """ """ coords = np.array( np.me...
[ "numpy.moveaxis", "numpy.maximum", "numpy.empty", "numpy.einsum", "numpy.round", "numpy.prod", "dask.array.block", "zarr.open", "numpy.eye", "numpy.copy", "numpy.max", "dask.array.einsum", "dask.array.to_zarr", "numpy.ceil", "bigstream.stitch.stitch_fields", "dask.array.map_blocks", ...
[((777, 798), 'numpy.moveaxis', 'np.moveaxis', (['X', '(-1)', '(0)'], {}), '(X, -1, 0)\n', (788, 798), True, 'import numpy as np\n'), ((810, 865), 'scipy.ndimage.map_coordinates', 'map_coordinates', (['image', 'X'], {'order': 'order', 'mode': '"""constant"""'}), "(image, X, order=order, mode='constant')\n", (825, 865),...