code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from collections import Collection import regex as re import numpy as np from bn.values.array_val import ArrayVal from bn.values.boolean_val import BooleanVal from bn.values.double_val import DoubleVal from bn.values.none_val import NoneVal from bn.values.relational_val import RelationalVal from bn.values.set_val impo...
[ "logging.getLogger", "bn.values.none_val.NoneVal", "bn.values.array_val.ArrayVal", "datastructs.graph.Graph.is_relational", "bn.values.relational_val.RelationalVal", "bn.values.set_val.SetVal", "bn.values.custom_val.CustomVal", "bn.values.boolean_val.BooleanVal", "numpy.array", "multipledispatch.d...
[((743, 752), 'bn.values.none_val.NoneVal', 'NoneVal', ([], {}), '()\n', (750, 752), False, 'from bn.values.none_val import NoneVal\n'), ((775, 830), 'regex.compile', 're.compile', (['"""^[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?$"""'], {}), "('^[-+]?[0-9]*\\\\.?[0-9]+([eE][-+]?[0-9]+)?$')\n", (785, 830), True, 'import...
#!/usr/bin/env python # create random images for learning Betti numbers # there two types of images: binary images and their distance transform from PIL import Image import numpy as np import random import sys import os import skimage.morphology as sm import skimage.io as io from scipy.ndimage.morphology import dista...
[ "random.randint", "skimage.morphology.binary_closing", "os.makedirs", "argparse.ArgumentParser", "numpy.zeros", "skimage.morphology.disk" ]
[((396, 473), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""create sinograms for artificial images"""'}), "(description='create sinograms for artificial images')\n", (419, 473), False, 'import argparse\n'), ((1396, 1435), 'os.makedirs', 'os.makedirs', (['args.outdir'], {'exist_ok': '(Tr...
#!/usr/bin/env python3 import argparse import json from os import listdir, mkdir, pardir from os.path import join, exists from sys import stderr, stdout import os, sys, inspect from random import shuffle import dynet as dy import re import numpy as np from time import time from math import isinf from random import ran...
[ "os.path.exists", "sys.path.insert", "parser.string2int_mapper.ContainerStr2IntMaps", "argparse.ArgumentParser", "inspect.currentframe", "parser.string2int_mapper.String2IntegerMapper", "sys.stderr.flush", "os.path.join", "data_formats.tree_loader.load_from_export_format", "parser.configuration.Co...
[((449, 484), 'os.path.join', 'join', (['SCRIPT_FOLDER', 'pardir', 'pardir'], {}), '(SCRIPT_FOLDER, pardir, pardir)\n', (453, 484), False, 'from os.path import join, exists\n'), ((502, 526), 'os.path.join', 'join', (['MAIN_FOLDER', '"""src"""'], {}), "(MAIN_FOLDER, 'src')\n", (506, 526), False, 'from os.path import joi...
import Bio,gzip from Bio import SeqIO import pyteomics from pyteomics import mass,fasta import pyteomics.parser as pyt_parser import pandas as pd import numpy as np import json,os from tqdm import tqdm from load_config import CONFIG MAX_DATABASE_SIZE=100000000 DB_PEPTIDE_MINIMUM_LENGTH=CONFIG['DB_PEPTIDE_MINIMUM_LENG...
[ "os.path.exists", "pyteomics.fasta.decoy_db", "pyteomics.fasta.read", "os.makedirs", "gzip.open", "json.dump", "os.path.join", "multiprocessing.pool.ThreadPool", "numpy.array", "collections.defaultdict", "multiprocessing.pool.Pool", "pyteomics.parser.cleave" ]
[((1160, 1319), 'pyteomics.parser.cleave', 'pyt_parser.cleave', (['protein_sequence', 'ENZYME'], {'min_length': 'DB_PEPTIDE_MINIMUM_LENGTH', 'missed_cleavages': 'MAX_MISSED_CLEAVAGES', 'semi': 'SEMI_SPECIFIC_CLEAVAGE'}), '(protein_sequence, ENZYME, min_length=\n DB_PEPTIDE_MINIMUM_LENGTH, missed_cleavages=MAX_MISSED...
#Some codes are adopted from https://github.com/DCASE-REPO/DESED_task import torch import numpy as np import random def frame_shift(features, label=None, net_pooling=None): if label is not None: batch_size, _, _ = features.shape shifted_feature = [] shifted_label = [] for idx in ra...
[ "torch.roll", "numpy.random.beta", "torch.randperm", "torch.rand", "torch.stack", "torch.clamp", "torch.randint", "torch.tensor", "torch.arange", "torch.linspace", "torch.no_grad", "torch.std", "torch.randn", "random.gauss", "torch.ones" ]
[((948, 976), 'torch.stack', 'torch.stack', (['shifted_feature'], {}), '(shifted_feature)\n', (959, 976), False, 'import torch\n'), ((1108, 1123), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1121, 1123), False, 'import torch\n'), ((2555, 2613), 'torch.randint', 'torch.randint', ([], {'low': '(0)', 'high': '(n_...
import numpy as np import redis import json import logging from docopt import docopt from obnl.core.client import ClientNode # This doc is used by docopt to make the wrapper callable by command line and gather easily all the given parameters doc = """>>> IntegrCiTy wrapper command <<< Usage: wrapper.py (<host> <n...
[ "logging.debug", "numpy.random.choice", "redis.StrictRedis", "json.load", "docopt.docopt" ]
[((3221, 3249), 'docopt.docopt', 'docopt', (['doc'], {'version': '"""0.0.1"""'}), "(doc, version='0.0.1')\n", (3227, 3249), False, 'from docopt import docopt\n'), ((1250, 1295), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': 'host', 'port': '(6379)', 'db': '(0)'}), '(host=host, port=6379, db=0)\n', (1267, 1295...
""" Utility functions for parsing data files. Especially designed for the CSVs produced by trial_util.py """ import csv import datetime import os import numpy as np from common import render_exception def lookup_data_file(data_prefix, filename): full_name = os.path.join(data_prefix, filename) if not os.path....
[ "os.path.exists", "numpy.mean", "numpy.median", "csv.DictReader", "common.render_exception", "os.path.join", "numpy.std" ]
[((265, 300), 'os.path.join', 'os.path.join', (['data_prefix', 'filename'], {}), '(data_prefix, filename)\n', (277, 300), False, 'import os\n'), ((312, 337), 'os.path.exists', 'os.path.exists', (['full_name'], {}), '(full_name)\n', (326, 337), False, 'import os\n'), ((1270, 1283), 'numpy.mean', 'np.mean', (['vals'], {}...
import os import json import numpy as np def load_img(image_path): import cv2 img = cv2.imread(image_path, cv2.IMREAD_COLOR) return img def load_json_lines(fpath): assert os.path.exists(fpath) with open(fpath, 'r') as fid: lines = fid.readlines() records = [json.loads(line.strip('\n'...
[ "os.path.exists", "numpy.minimum", "os.makedirs", "numpy.hstack", "json.dumps", "numpy.array", "numpy.empty", "numpy.vstack", "numpy.maximum", "cv2.imread" ]
[((94, 134), 'cv2.imread', 'cv2.imread', (['image_path', 'cv2.IMREAD_COLOR'], {}), '(image_path, cv2.IMREAD_COLOR)\n', (104, 134), False, 'import cv2\n'), ((191, 212), 'os.path.exists', 'os.path.exists', (['fpath'], {}), '(fpath)\n', (205, 212), False, 'import os\n'), ((2234, 2288), 'numpy.array', 'np.array', (['[rb[ke...
#tani from utility.feature_extract import ModelExtractFaceFeature from utility.data_loader import data_load from utility.similarity_calculate import * from PIL import Image import numpy as np import os ...
[ "numpy.tile", "PIL.Image.open", "utility.data_loader.data_load", "os.path.dirname", "utility.feature_extract.ModelExtractFaceFeature" ]
[((361, 372), 'utility.data_loader.data_load', 'data_load', ([], {}), '()\n', (370, 372), False, 'from utility.data_loader import data_load\n'), ((510, 530), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (520, 530), False, 'from PIL import Image\n'), ((545, 570), 'os.path.dirname', 'os.path.dirnam...
import numpy as np import cv2 import keras import utils import glob import os from keras.models import load_model import time import tensorflow as tf from keras.backend.tensorflow_backend import set_session config = tf.compat.v1.ConfigProto() config.gpu_options.per_process_gpu_memory_fraction = 0.7 set_session(tf.comp...
[ "tensorflow.compat.v1.ConfigProto", "cv2.rectangle", "keras.models.load_model", "utils.decode_netout", "numpy.squeeze", "cv2.imshow", "cv2.waitKey", "cv2.VideoCapture", "utils.do_nms", "time.time", "tensorflow.compat.v1.Session", "utils.preprocess_input", "utils.correct_yolo_boxes" ]
[((217, 243), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {}), '()\n', (241, 243), True, 'import tensorflow as tf\n'), ((313, 348), 'tensorflow.compat.v1.Session', 'tf.compat.v1.Session', ([], {'config': 'config'}), '(config=config)\n', (333, 348), True, 'import tensorflow as tf\n'), ((4439, 44...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Scikit-Learn Model-by-Cluster wrapper. Original code by jnorthman: https://gist.github.com/jnothman/566ebde618ec18f2bea6 """ import numpy as np from sklearn.base import BaseEstimator, clone from sklearn.utils import safe_mask class ModelByCluster(BaseEstimator): ...
[ "numpy.unique", "sklearn.base.clone", "numpy.flatnonzero", "numpy.concatenate", "numpy.full", "sklearn.utils.safe_mask" ]
[((694, 715), 'sklearn.base.clone', 'clone', (['self.clusterer'], {}), '(self.clusterer)\n', (699, 715), False, 'from sklearn.base import BaseEstimator, clone\n'), ((788, 807), 'numpy.unique', 'np.unique', (['clusters'], {}), '(clusters)\n', (797, 807), True, 'import numpy as np\n'), ((1817, 1838), 'numpy.concatenate',...
#!/usr/bin/env python3 """ benchmarks writing boolean array vs uint8 array of same values. For high-speed in the loop writing where performance is critical. """ import tempfile from numpy.random import random from numpy import packbits import h5py from time import time SIZE = (3, 200000) # arbitrary size to test # ...
[ "numpy.packbits", "numpy.random.random", "h5py.File", "tempfile.NamedTemporaryFile", "time.time" ]
[((356, 368), 'numpy.random.random', 'random', (['SIZE'], {}), '(SIZE)\n', (362, 368), False, 'from numpy.random import random\n'), ((413, 442), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (440, 442), False, 'import tempfile\n'), ((459, 477), 'h5py.File', 'h5py.File', (['fn', '"""w""...
import json import os import random import numpy as np from math import ceil import bottle from bottle import HTTPResponse # import time from timeit import default_timer as timer from grid_data_maker import * from util_fns import * # my_moves delta = [[-1, 0], # go up [0, -1], # go left [1, 0], #...
[ "numpy.copy", "numpy.zeros", "numpy.argwhere", "numpy.abs" ]
[((1279, 1320), 'numpy.zeros', 'np.zeros', (['snakes_grid.shape'], {'dtype': 'np.int'}), '(snakes_grid.shape, dtype=np.int)\n', (1287, 1320), True, 'import numpy as np\n'), ((2234, 2254), 'numpy.copy', 'np.copy', (['snakes_grid'], {}), '(snakes_grid)\n', (2241, 2254), True, 'import numpy as np\n'), ((3246, 3285), 'nump...
import cv2 import numpy as np import logging class TileUtils: @staticmethod def add_texts_with_bg(img, texts): ''' Adds each text line by line at the bottom left area of the image :param img: :param texts: :return: ''' font_scale = 2 thickness...
[ "cv2.rectangle", "numpy.ones", "logging.warning", "numpy.argmax", "numpy.floor", "cv2.putText", "numpy.array", "cv2.getTextSize" ]
[((6774, 6862), 'cv2.putText', 'cv2.putText', (['a', 'text', 'bottom_left_corner_of_text', 'font', 'font_scale', 'color', 'thickness'], {}), '(a, text, bottom_left_corner_of_text, font, font_scale, color,\n thickness)\n', (6785, 6862), False, 'import cv2\n'), ((1103, 1178), 'cv2.rectangle', 'cv2.rectangle', (['img',...
# ============================================================================ # 第七章 給湯設備 # 第一節 給湯設備 # Ver.18(エネルギー消費性能計算プログラム(住宅版)Ver.02.05~) # ============================================================================ import numpy as np from functools import lru_cache import pyhees.section7_1_b as default import...
[ "numpy.clip", "pyhees.section7_1_d.calc_E_E_hs_d_t", "numpy.convolve", "pyhees.section7_1_g_3.calc_E_E_hs_d_t", "pyhees.section7_1_i.get_E_K_hs_d_t", "pyhees.section7_1_d.get_E_G_hs_d_t", "pyhees.section9_3.calc_E_E_W_aux_ass_d_t", "pyhees.section7_1_j.get_f_sb", "pyhees.section7_1_c.get_E_K_hs_d_t"...
[((1290, 1301), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (1299, 1301), False, 'from functools import lru_cache\n'), ((3745, 3760), 'pyhees.section11_3.load_schedule', 'load_schedule', ([], {}), '()\n', (3758, 3760), False, 'from pyhees.section11_3 import load_schedule, get_schedule_hw\n'), ((3779, 3804), '...
''' Module containing the DataFiller class, which is responsible for filling data to plots and monitors ''' from copy import copy from ast import literal_eval # to convert a string to list import numpy as np from PyQt5 import QtGui, QtCore import pyqtgraph as pg class DataFiller(): #pylint: disable=too-many-inst...
[ "PyQt5.QtGui.QGraphicsTextItem", "numpy.max", "ast.literal_eval", "numpy.linspace", "pyqtgraph.mkPen", "numpy.min", "copy.copy", "PyQt5.QtCore.QPointF" ]
[((2602, 2653), 'numpy.linspace', 'np.linspace', (['(-self._time_window)', '(0)', 'self._n_samples'], {}), '(-self._time_window, 0, self._n_samples)\n', (2613, 2653), True, 'import numpy as np\n'), ((3497, 3531), 'numpy.linspace', 'np.linspace', (['(0)', '(0)', 'self._n_samples'], {}), '(0, 0, self._n_samples)\n', (350...
import multiprocessing import time from multiprocessing import Queue import numpy as np import os from keras import Input, Model from keras.layers import Dense, Conv2D, MaxPooling2D, concatenate, Flatten from keras_vggface.vggface import VGGFace from skimage.feature import hog from skimage.metrics import structural_si...
[ "numpy.ptp", "keras.layers.Conv2D", "multiprocessing.Process", "training.misc.adjust_dynamic_range", "numpy.array", "sklearn.metrics.roc_curve", "keras.layers.Dense", "training.misc.convert_to_pil_image", "os.listdir", "skimage.metrics.structural_similarity", "keras.Model", "pretrained_network...
[((781, 897), 'training.dataset.load_dataset', 'dataset.load_dataset', ([], {'data_dir': 'data_dir', 'tfrecord_dir': 'dataset_name', 'max_label_size': '(1)', 'repeat': '(False)', 'shuffle_mb': '(0)'}), '(data_dir=data_dir, tfrecord_dir=dataset_name,\n max_label_size=1, repeat=False, shuffle_mb=0)\n', (801, 897), Fal...
import os import scipy.misc as im import numpy as np files = os.listdir("dataset") r = 0 g = 0 b = 0 for f in files: image = im.imread("dataset/"+f,mode='RGB') r += image[:,:,0] g += image[:,:,1] b += image[:,:,2] print (image.shape) r = np.sum(r) g = np.sum(g) b = np.sum(b) pr...
[ "numpy.sum", "scipy.misc.imread", "os.listdir" ]
[((66, 87), 'os.listdir', 'os.listdir', (['"""dataset"""'], {}), "('dataset')\n", (76, 87), False, 'import os\n'), ((275, 284), 'numpy.sum', 'np.sum', (['r'], {}), '(r)\n', (281, 284), True, 'import numpy as np\n'), ((290, 299), 'numpy.sum', 'np.sum', (['g'], {}), '(g)\n', (296, 299), True, 'import numpy as np\n'), ((3...
import gsw import xarray as xr import subprocess import numpy as np import os import pylab as plt # Import utils and decorators from tcoasts.utils.utils import * from tcoasts.utils.decorators import _file_exists class TransportAlongCoast(object): ''' ''' def __init__(self,path,initpos,contour_file,di...
[ "subprocess.check_output", "numpy.sqrt", "numpy.flipud", "pylab.plot", "os.path.join", "numpy.diff", "os.path.isfile", "numpy.array", "numpy.linspace", "numpy.cos", "xarray.DataArray", "numpy.sin", "pylab.subplots", "numpy.loadtxt", "pylab.gca", "xarray.open_mfdataset", "numpy.arange...
[((327, 352), 'numpy.arange', 'np.arange', (['(-400)', '(400)', '(100)'], {}), '(-400, 400, 100)\n', (336, 352), True, 'import numpy as np\n'), ((1168, 1201), 'os.path.isfile', 'os.path.isfile', (['self.contour_file'], {}), '(self.contour_file)\n', (1182, 1201), False, 'import os\n'), ((1702, 1745), 'gsw.distance', 'gs...
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Provides a non-parametric two-stage least squares instrumental variable estimator.""" import numpy as np from copy import deepcopy from sklearn import clone from sklearn.linear_model import LinearRegression from ...utilit...
[ "numpy.identity", "numpy.prod", "sklearn.preprocessing.PolynomialFeatures", "numpy.hstack", "numpy.float_power", "numpy.exp", "numpy.zeros", "sklearn.clone", "numpy.polynomial.hermite_e.hermeval", "sklearn.linear_model.LinearRegression" ]
[((4866, 4965), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'degree': 'degree', 'interaction_only': 'interaction_only', 'include_bias': 'include_bias'}), '(degree=degree, interaction_only=interaction_only,\n include_bias=include_bias)\n', (4884, 4965), False, 'from sklearn.preprocessing i...
# Line Plot import numpy as np from matplotlib import pyplot as plt x = np.arange(1, 11) print(x) print() y = 2 * x print(y) print() plt.plot(x, y) plt.show() print() # Line Plot - 2 (adding titles and labels) plt.plot(x, y) plt.title("Line Plot") plt.xlabel("x-label") plt.ylabel("y-label") plt.show() print() # Line P...
[ "matplotlib.pyplot.boxplot", "matplotlib.pyplot.grid", "matplotlib.pyplot.hist", "pandas.read_csv", "matplotlib.pyplot.ylabel", "seaborn.load_dataset", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.barh", "matplotlib.pyplot.pie", "matplotlib.pyplot.violinplot", "seab...
[((73, 89), 'numpy.arange', 'np.arange', (['(1)', '(11)'], {}), '(1, 11)\n', (82, 89), True, 'import numpy as np\n'), ((134, 148), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (142, 148), True, 'from matplotlib import pyplot as plt\n'), ((149, 159), 'matplotlib.pyplot.show', 'plt.show', ([], {}),...
import os import numpy as np from pyfftw.builders import rfft from scipy.interpolate import interp1d from scipy.special import gamma from scipy.integrate import quad import matplotlib.pyplot as plt class FFTLog(object): def __init__(self, **kwargs): self.Nmax = kwargs['Nmax'] self.xmin = kwargs['xm...
[ "pyfftw.builders.rfft", "numpy.log", "scipy.interpolate.interp1d", "numpy.exp", "numpy.sum", "numpy.empty_like", "numpy.empty", "numpy.arange" ]
[((808, 838), 'scipy.interpolate.interp1d', 'interp1d', (['xin', 'f'], {'kind': '"""cubic"""'}), "(xin, f, kind='cubic')\n", (816, 838), False, 'from scipy.interpolate import interp1d\n'), ((1233, 1252), 'numpy.empty', 'np.empty', (['self.Nmax'], {}), '(self.Nmax)\n', (1241, 1252), True, 'import numpy as np\n'), ((1328...
"""Morse code handling""" from configparser import ConfigParser import os from pathlib import Path import sys import warnings import numpy as np import sklearn.cluster import sklearn.exceptions from .io import read_wave from .processing import smoothed_power, squared_signal class MorseCode: """Morse code ...
[ "numpy.insert", "configparser.ConfigParser", "pathlib.Path", "warnings.catch_warnings", "numpy.diff", "numpy.array", "sys.stderr.write", "numpy.nonzero", "warnings.simplefilter", "numpy.vectorize" ]
[((2473, 2487), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (2485, 2487), False, 'from configparser import ConfigParser\n'), ((3287, 3305), 'numpy.diff', 'np.diff', (['self.data'], {}), '(self.data)\n', (3294, 3305), True, 'import numpy as np\n'), ((3328, 3356), 'numpy.nonzero', 'np.nonzero', (['(squ...
# http://www.apache.org/licenses/LICENSE-2.0 import unittest import time import numpy as np import auspex.config as config config.auspex_dummy_mode = True from auspex.experiment import Experiment from auspex.stream import DataStream, DataAxis, DataStreamDescriptor, OutputConnector from auspex.filters.debug impor...
[ "time.sleep", "numpy.sum", "numpy.linspace", "auspex.filters.io.DataBuffer", "numpy.random.randint", "numpy.random.seed", "auspex.stream.OutputConnector", "unittest.main", "auspex.filters.correlator.Correlator", "auspex.log.logger.debug" ]
[((533, 550), 'auspex.stream.OutputConnector', 'OutputConnector', ([], {}), '()\n', (548, 550), False, 'from auspex.stream import DataStream, DataAxis, DataStreamDescriptor, OutputConnector\n'), ((563, 580), 'auspex.stream.OutputConnector', 'OutputConnector', ([], {}), '()\n', (578, 580), False, 'from auspex.stream imp...
import numpy as np import mfd from matplotlib import pyplot as pl n = 30 xr = np.linspace(0, 2*1.5, int(n*1.5)) yr = np.linspace(0, 2, n) x, y = np.meshgrid(xr, yr) z = np.exp(-x*x-y*y) w = abs(xr[0]-xr[1]) a = mfd.sca(z, w) b = np.load('data.npy') pl.pcolormesh(x, y, (a-b)/a) pl.colorbar() ax = pl.gca() ax.set_aspect...
[ "matplotlib.pyplot.gca", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.pcolormesh", "numpy.exp", "numpy.linspace", "numpy.meshgrid", "numpy.load", "mfd.sca", "matplotlib.pyplot.show" ]
[((118, 138), 'numpy.linspace', 'np.linspace', (['(0)', '(2)', 'n'], {}), '(0, 2, n)\n', (129, 138), True, 'import numpy as np\n'), ((146, 165), 'numpy.meshgrid', 'np.meshgrid', (['xr', 'yr'], {}), '(xr, yr)\n', (157, 165), True, 'import numpy as np\n'), ((170, 192), 'numpy.exp', 'np.exp', (['(-x * x - y * y)'], {}), '...
import pandas import matplotlib.pyplot as plt from ETF import get_split_name_and_isin, get_combined_name_and_isin from pypfopt import expected_returns, risk_models, plotting, discrete_allocation from pypfopt.efficient_frontier import EfficientFrontier import base64 import io import numpy as np import math from timeit i...
[ "pypfopt.discrete_allocation.DiscreteAllocation", "ETF.get_split_name_and_isin", "pypfopt.risk_models.sample_cov", "timeit.default_timer", "pypfopt.discrete_allocation.get_latest_prices", "ETF.get_combined_name_and_isin", "io.BytesIO", "numpy.diag", "pypfopt.plotting._ef_default_returns_range", "p...
[((736, 751), 'timeit.default_timer', 'default_timer', ([], {}), '()\n', (749, 751), False, 'from timeit import default_timer\n'), ((1225, 1272), 'pypfopt.expected_returns.mean_historical_return', 'expected_returns.mean_historical_return', (['prices'], {}), '(prices)\n', (1264, 1272), False, 'from pypfopt import expect...
import numpy as np def magnitude(x): """Returns magnitude of a vector""" return np.linalg.norm(np.array(x)) def distance(p1, p2): """Returns distance between two positions p1 and p2""" return magnitude(np.array(p2) - np.array(p1)) def unit_vector(x): """Returns unit_vector of a vector""" retu...
[ "numpy.arccos", "numpy.array", "numpy.cos", "numpy.random.seed", "numpy.random.uniform", "numpy.sin" ]
[((631, 651), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (645, 651), True, 'import numpy as np\n'), ((686, 723), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(2 * np.pi)', 'size'], {}), '(0, 2 * np.pi, size)\n', (703, 723), True, 'import numpy as np\n'), ((737, 767), 'numpy.random.unif...
class KelvinHelmholtzUniform: """ Kelvin-Helmholtz instability with anisotropic viscosity and a constant magnetic field in the x-direction. The equilibrium is assumed to have constant density, temperature and pressure. The velocity profile varies smoothly and the setup is periodic. ...
[ "numpy.sqrt", "sympy.lambdify", "sympy.symbols", "sympy.diff", "sympy.tanh" ]
[((1277, 1303), 'numpy.sqrt', 'np.sqrt', (['(2 * self.p / beta)'], {}), '(2 * self.p / beta)\n', (1284, 1303), True, 'import numpy as np\n'), ((2996, 3008), 'sympy.symbols', 'symbols', (['"""z"""'], {}), "('z')\n", (3003, 3008), False, 'from sympy import tanh, diff, lambdify, symbols\n'), ((3248, 3262), 'sympy.diff', '...
import cv2 import numpy as np import torch import torch.nn as nn from torch.nn import functional as F class GradCAM(): def __init__(self, model, target_layer, use_cuda): self.model = model.eval() self.target_layer = target_layer self.use_cuda = use_cuda self.feature_map = 0 ...
[ "numpy.uint8", "torch.from_numpy", "numpy.max", "numpy.sum", "torch.sum", "numpy.maximum", "numpy.float32" ]
[((2103, 2122), 'numpy.uint8', 'np.uint8', (['(255 * cam)'], {}), '(255 * cam)\n', (2111, 2122), True, 'import numpy as np\n'), ((1236, 1261), 'torch.from_numpy', 'torch.from_numpy', (['one_hot'], {}), '(one_hot)\n', (1252, 1261), False, 'import torch\n'), ((1701, 1763), 'numpy.sum', 'np.sum', (['(self.feature_map * se...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import numpy as np from scipy.stats import entropy, normaltest, mode, kurtosis, skew, pearsonr, moment import pandas as pd from collections import OrderedDict from feature_extraction.helpers import * from feature_extraction.type_detection import detect_field_type, data_type_...
[ "feature_extraction.type_detection.detect_field_type", "scipy.stats.normaltest", "scipy.stats.pearsonr", "numpy.divide", "numpy.mean", "numpy.sort", "scipy.stats.kurtosis", "numpy.diff", "numpy.subtract", "numpy.max", "numpy.min", "collections.OrderedDict", "scipy.stats.entropy", "numpy.ma...
[((364, 400), 'numpy.warnings.filterwarnings', 'np.warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (390, 400), True, 'import numpy as np\n'), ((5107, 5178), 'collections.OrderedDict', 'OrderedDict', (["[(f['name'], None) for f in field_existence_features_list]"], {}), "([(f['name'], None) for f in fie...
#/usr/bin/env python from __future__ import print_function import numpy import copy import saveVTK class Upwind: def __init__(self, velocity, lengths, numCells): self.numCells = numCells self.ndims = len(velocity) self.deltas = numpy.zeros( (self.ndims,), numpy.float64 ) self.upDirection = numpy.z...
[ "numpy.identity", "numpy.ones", "numpy.sum", "numpy.zeros", "numpy.dot", "sys.exit", "numpy.arange" ]
[((3192, 3227), 'numpy.ones', 'numpy.ones', (['(ndims,)', 'numpy.float64'], {}), '((ndims,), numpy.float64)\n', (3202, 3227), False, 'import numpy\n'), ((3242, 3277), 'numpy.ones', 'numpy.ones', (['(ndims,)', 'numpy.float64'], {}), '((ndims,), numpy.float64)\n', (3252, 3277), False, 'import numpy\n'), ((246, 287), 'num...
# coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt from skimage.color import lab2rgb from sklearn import model_selection from sklearn.naive_bayes import GaussianNB import sys from sklearn.metrics import accuracy_score from skimage import color from sklearn import pipeline...
[ "matplotlib.pyplot.imshow", "skimage.color.rgb2lab", "matplotlib.pyplot.title", "pandas.read_csv", "matplotlib.pyplot.savefig", "skimage.color.lab2rgb", "sklearn.model_selection.train_test_split", "sklearn.naive_bayes.GaussianNB", "numpy.ones", "matplotlib.pyplot.subplot", "numpy.stack", "nump...
[((939, 1006), 'numpy.vectorize', 'np.vectorize', (['COLOUR_RGB.get'], {'otypes': '[np.uint8, np.uint8, np.uint8]'}), '(COLOUR_RGB.get, otypes=[np.uint8, np.uint8, np.uint8])\n', (951, 1006), True, 'import numpy as np\n'), ((497, 520), 'skimage.color.rgb2lab', 'color.rgb2lab', (['reshaped'], {}), '(reshaped)\n', (510, ...
import numpy as np import pandas as pd from scipy.stats import beta import matplotlib.pyplot as plt import json def t2d_beta_data(min_val,max_val,alpha_val, beta_val,no_default): # Calculation tad = np.array([range(1,max_val+1)]) beta_pdf = beta.pdf(tad, alpha_val, beta_val, loc=min_val, scale=max_val-min...
[ "json.dump", "scipy.stats.beta.pdf", "numpy.round" ]
[((255, 327), 'scipy.stats.beta.pdf', 'beta.pdf', (['tad', 'alpha_val', 'beta_val'], {'loc': 'min_val', 'scale': '(max_val - min_val)'}), '(tad, alpha_val, beta_val, loc=min_val, scale=max_val - min_val)\n', (263, 327), False, 'from scipy.stats import beta\n'), ((385, 420), 'numpy.round', 'np.round', (['(beta_pdf_std *...
import numpy as np def bound_linear(z,z_low,z_high,val_low,val_high): z0 = val_low + (val_high - val_low) * (z - z_low) / (z_high - z_low) z0 = np.maximum(z0,val_low) z0 = np.minimum(z0,val_high) return z0
[ "numpy.maximum", "numpy.minimum" ]
[((153, 176), 'numpy.maximum', 'np.maximum', (['z0', 'val_low'], {}), '(z0, val_low)\n', (163, 176), True, 'import numpy as np\n'), ((185, 209), 'numpy.minimum', 'np.minimum', (['z0', 'val_high'], {}), '(z0, val_high)\n', (195, 209), True, 'import numpy as np\n')]
''' _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ ...
[ "struct.calcsize", "numpy.reshape", "torch.utils.data.TensorDataset", "numpy.array", "torch.utils.data.DataLoader", "struct.unpack_from" ]
[((1321, 1345), 'struct.calcsize', 'struct.calcsize', (['""">IIII"""'], {}), "('>IIII')\n", (1336, 1345), False, 'import struct\n'), ((1688, 1710), 'struct.calcsize', 'struct.calcsize', (['""">II"""'], {}), "('>II')\n", (1703, 1710), False, 'import struct\n'), ((2125, 2165), 'torch.utils.data.TensorDataset', 'TensorDat...
# Copyright 2017 The dm_control 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 or agreed to i...
[ "dm_control.mujoco.wrapper.mjbindings.mjlib.mju_rotVecQuat", "dm_control.mujoco.engine.Physics.from_xml_string", "absl.testing.absltest.main", "dm_control.suite.utils.randomizers.randomize_limited_and_rotational_joints", "numpy.array", "numpy.zeros", "six.moves.xrange", "numpy.sum", "numpy.dot", "...
[((6034, 6049), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (6047, 6049), False, 'from absl.testing import absltest\n'), ((1233, 1259), 'numpy.random.RandomState', 'np.random.RandomState', (['(100)'], {}), '(100)\n', (1254, 1259), True, 'import numpy as np\n'), ((1319, 2260), 'dm_control.mujoco.eng...
import cv2 import numpy as np from paz.backend.image.draw import put_text, draw_rectangle from paz.backend.image.draw import GREEN def draw_box(image, coordinates, class_name, score, color=GREEN, scale=0.7, weighted=False): x_min, y_min, x_max, y_max = coordinates if weighted: color = [in...
[ "cv2.rectangle", "cv2.fillPoly", "paz.backend.image.draw.draw_rectangle", "numpy.array", "cv2.circle", "paz.backend.image.draw.put_text", "cv2.resize" ]
[((416, 475), 'paz.backend.image.draw.put_text', 'put_text', (['image', 'text', '(x_min, y_min - 10)', 'scale', 'color', '(1)'], {}), '(image, text, (x_min, y_min - 10), scale, color, 1)\n', (424, 475), False, 'from paz.backend.image.draw import put_text, draw_rectangle\n'), ((480, 543), 'paz.backend.image.draw.draw_re...
import numpy as np from sklearn.metrics.pairwise import pairwise_distances class MahaDist: def __init__(self, bandwidth_factor=1.0): self.bandwidth = 1. if type(bandwidth_factor) in [float, int]: self.bandwidth_factor = bandwidth_factor elif type(bandwidth_factor) in [list, tu...
[ "numpy.isscalar", "numpy.diag", "sklearn.metrics.pairwise.pairwise_distances", "numpy.array", "numpy.zeros", "numpy.einsum" ]
[((704, 769), 'sklearn.metrics.pairwise.pairwise_distances', 'pairwise_distances', (['X', 'Y'], {'metric': '"""mahalanobis"""', 'VI': 'self.bandwidth'}), "(X, Y, metric='mahalanobis', VI=self.bandwidth)\n", (722, 769), False, 'from sklearn.metrics.pairwise import pairwise_distances\n'), ((821, 844), 'numpy.zeros', 'np....
import os import numpy as np import SharedArray as SA from torch.utils.data import Dataset from util.data_util import sa_create from util.data_util import data_prepare class S3DIS(Dataset): def __init__(self, split='train', data_root='trainval', test_area=5, voxel_size=0.04, voxel_max=None, transform=None, shuf...
[ "os.listdir", "os.path.join", "util.data_util.data_prepare", "numpy.load" ]
[((1582, 1700), 'util.data_util.data_prepare', 'data_prepare', (['coord', 'feat', 'label', 'self.split', 'self.voxel_size', 'self.voxel_max', 'self.transform', 'self.shuffle_index'], {}), '(coord, feat, label, self.split, self.voxel_size, self.\n voxel_max, self.transform, self.shuffle_index)\n', (1594, 1700), False...
import numpy as np from sklearn.decomposition import PCA def project_embeddings_and_centroids_together(embeddings, centroids, masks): original_embeddings_shape = embeddings.shape embeddings = np.reshape(embeddings, (-1, embeddings.shape[2])) points = np.concatenate([centroids, embeddings], axis=0) m...
[ "sklearn.decomposition.PCA", "numpy.reshape", "numpy.concatenate" ]
[((203, 252), 'numpy.reshape', 'np.reshape', (['embeddings', '(-1, embeddings.shape[2])'], {}), '(embeddings, (-1, embeddings.shape[2]))\n', (213, 252), True, 'import numpy as np\n'), ((266, 313), 'numpy.concatenate', 'np.concatenate', (['[centroids, embeddings]'], {'axis': '(0)'}), '([centroids, embeddings], axis=0)\n...
import numpy as np from scattertext.termscoring.CohensDCalculator import CohensDCalculator from scattertext.termscoring.CorpusBasedTermScorer import CorpusBasedTermScorer class CohensD(CorpusBasedTermScorer, CohensDCalculator): ''' Cohen's d scores term_scorer = (CohensD(corpus).set_categories('Positive...
[ "numpy.isnan" ]
[((1592, 1603), 'numpy.isnan', 'np.isnan', (['X'], {}), '(X)\n', (1600, 1603), True, 'import numpy as np\n')]
import argparse import json from PIL import Image import torch import numpy as np from math import ceil from train import check_gpu from torchvision import models, transforms def arg_parser(): parser = argparse.ArgumentParser(description="Prediction settings") parser.add_argument('-i', '--image', ty...
[ "torchvision.transforms.CenterCrop", "PIL.Image.open", "argparse.ArgumentParser", "torch.load", "torchvision.transforms.Resize", "torch.exp", "train.check_gpu", "numpy.array", "torchvision.transforms.Normalize", "json.load", "torch.no_grad", "torchvision.transforms.ToTensor", "torchvision.mo...
[((213, 271), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Prediction settings"""'}), "(description='Prediction settings')\n", (236, 271), False, 'import argparse\n'), ((903, 930), 'torch.load', 'torch.load', (['checkpoint_path'], {}), '(checkpoint_path)\n', (913, 930), False, 'import ...
import open3d as o3d import numpy as np import sys, os import matplotlib.pyplot as plt import cv2 import torch import glob import copy import mathutils from PIL import Image from pytorch3d.loss import chamfer_distance from tk3dv.nocstools.aligning import estimateSimilarityUmeyama import math from tqdm import tqdm def ...
[ "mathutils.Matrix", "numpy.arccos", "cv2.imshow", "numpy.array", "cv2.destroyAllWindows", "numpy.linalg.norm", "copy.deepcopy", "numpy.mean", "numpy.reshape", "open3d.utility.Vector2iVector", "numpy.asarray", "numpy.concatenate", "open3d.geometry.TriangleMesh.create_coordinate_frame", "num...
[((396, 417), 'copy.deepcopy', 'copy.deepcopy', (['source'], {}), '(source)\n', (409, 417), False, 'import copy\n'), ((436, 457), 'copy.deepcopy', 'copy.deepcopy', (['target'], {}), '(target)\n', (449, 457), False, 'import copy\n'), ((610, 671), 'open3d.visualization.draw_geometries', 'o3d.visualization.draw_geometries...
""" examine performance of image collection for 3 cameras. it is implied that data for all 3 cameras is available. input: dataset name 'black level all', 'black level analog', 'black level digital', 'exposure time', 'frameIDs', 'gain', 'image height', 'image width', 'images', 'temperature' , 'time', 'timestamps_came...
[ "matplotlib.pyplot.plot", "numpy.diff", "h5py.File", "os.path.split", "matplotlib.pyplot.figure", "matplotlib.pyplot.ion" ]
[((521, 552), 'os.path.split', 'os.path.split', (['dataset_filename'], {}), '(dataset_filename)\n', (534, 552), False, 'import os\n'), ((818, 827), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (825, 827), True, 'from matplotlib import pyplot as plt\n'), ((828, 840), 'matplotlib.pyplot.figure', 'plt.figure', ([...
import unittest import os.path import numpy as np import numpy.lib.recfunctions as rfn from geodepy.convert import (hp2dec, dec2hp, rect2polar, polar2rect, grid2geo, llh2xyz, DMSAngle) from geodepy.geodesy import vincinv, vincdir, vincinv_utm, vincdir_utm, enu2xyz, xyz2enu class TestGeode...
[ "geodepy.convert.DMSAngle", "geodepy.convert.polar2rect", "geodepy.geodesy.vincdir_utm", "geodepy.geodesy.xyz2enu", "numpy.roll", "geodepy.convert.llh2xyz", "geodepy.convert.grid2geo", "geodepy.geodesy.enu2xyz", "geodepy.geodesy.vincinv_utm", "geodepy.convert.rect2polar", "numpy.lib.recfunctions...
[((11049, 11064), 'unittest.main', 'unittest.main', ([], {}), '()\n', (11062, 11064), False, 'import unittest\n'), ((588, 647), 'geodepy.convert.grid2geo', 'grid2geo', (['MOBS_MGA2020[0]', 'MOBS_MGA2020[1]', 'MOBS_MGA2020[2]'], {}), '(MOBS_MGA2020[0], MOBS_MGA2020[1], MOBS_MGA2020[2])\n', (596, 647), False, 'from geode...
import numpy import math from mta.dataset import Dataset from copy import copy class Profile: @classmethod def rating_dist(self, dataset, stacks=11, stack_range=1000): rating_list = numpy.array(dataset.ratings.to_list())[:,2].flat dist = self._make_dist(rating_list, stacks, stack_range...
[ "numpy.zeros", "math.floor" ]
[((578, 613), 'numpy.zeros', 'numpy.zeros', (['item_size'], {'dtype': 'float'}), '(item_size, dtype=float)\n', (589, 613), False, 'import numpy\n'), ((1224, 1257), 'numpy.zeros', 'numpy.zeros', (['user_size'], {'dtype': 'int'}), '(user_size, dtype=int)\n', (1235, 1257), False, 'import numpy\n'), ((1861, 1910), 'numpy.z...
# -*- coding: utf-8 -*- """ Plot the effective index and group index curves for a given waveguide CML. @author: <NAME> """ import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np #mpl.style.use('ggplot') # set plotting style fname = 'wg_strip_o_mm_2000' # data to be loaded npts = 10 # number ...
[ "numpy.poly1d", "numpy.linspace", "matplotlib.pyplot.figure" ]
[((509, 537), 'numpy.poly1d', 'np.poly1d', (['coefficients_neff'], {}), '(coefficients_neff)\n', (518, 537), True, 'import numpy as np\n'), ((594, 620), 'numpy.poly1d', 'np.poly1d', (['coefficients_ng'], {}), '(coefficients_ng)\n', (603, 620), True, 'import numpy as np\n'), ((629, 676), 'numpy.linspace', 'np.linspace',...
import argparse import json import math import matplotlib.pyplot import numpy import os import pandas import re import skimage.io import skimage.transform import torch import torch.utils.data import torch.utils.model_zoo import tqdm blurb = 'Fashion Brain: Library of trained deep learning models (D2.5)' def conv3x...
[ "torch.nn.ReLU", "torch.nn.init.constant_", "torch.nn.Sequential", "torch.LongTensor", "torch.utils.model_zoo.load_url", "torch.cuda.is_available", "torch.nn.AvgPool2d", "torch.nn.Module.__init__", "re.search", "torch.nn.BatchNorm2d", "numpy.mean", "argparse.ArgumentParser", "torch.nn.init.k...
[((406, 501), 'torch.nn.Conv2d', 'torch.nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=3, stride=stride,\n padding=1, bias=False)\n', (421, 501), False, 'import torch\n'), ((12610, 12636), 'pandas.concat...
import os import sys import pickle from tqdm import tqdm import numpy as np import cv2 from fsgan.utils.bbox_utils import scale_bbox, crop_img from fsgan.utils.video_utils import Sequence def main(input_path, output_dir=None, cache_path=None, seq_postfix='_dsfd_seq.pkl', resolution=256, crop_scale=2.0, selec...
[ "pickle.dump", "cv2.resize", "argparse.ArgumentParser", "fsgan.utils.bbox_utils.crop_img", "pickle.load", "os.path.join", "fsgan.utils.video_utils.Sequence", "os.path.splitext", "os.path.isfile", "numpy.array", "cv2.VideoWriter", "os.path.isdir", "cv2.VideoCapture", "cv2.VideoWriter_fourcc...
[((1442, 1470), 'cv2.VideoCapture', 'cv2.VideoCapture', (['input_path'], {}), '(input_path)\n', (1458, 1470), False, 'import cv2\n'), ((1867, 1905), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (['*encoder_codec'], {}), '(*encoder_codec)\n', (1889, 1905), False, 'import cv2\n'), ((4967, 5014), 'argparse.Argument...
#!/usr/bin/env python ############################################################### # # # D I S P E R S I O N . P Y # # # #########################################...
[ "numpy.sqrt", "numpy.arccos", "matplotlib.collections.LineCollection", "numpy.array", "matplotlib.ticker.MaxNLocator", "matplotlib.rc", "sys.exit", "numpy.linalg.norm", "matplotlib.lines.Line2D", "numpy.mean", "numpy.cross", "argparse.ArgumentParser", "numpy.where", "numpy.delete", "matp...
[((933, 989), 'numpy.array', 'np.array', (['[0.5, 0.0, 0.25, 0.75, 0.33333333, 0.66666667]'], {}), '([0.5, 0.0, 0.25, 0.75, 0.33333333, 0.66666667])\n', (941, 989), True, 'import numpy as np\n'), ((1080, 1114), 'scipy.io.FortranFile', 'FF', (["(seed + '.pdos_bin')", '"""r"""', '""">u4"""'], {}), "(seed + '.pdos_bin', '...
# -*- coding: utf-8 -*- """ Created on Mon Dec 23 10:49:26 2019 @author: fg010 """ #%% from __future__ import print_function,absolute_import, division, print_function, unicode_literals import keras from keras.layers import Dense, Conv2D, BatchNormalization, Activation from keras.layers import AveragePooling2...
[ "os.path.exists", "numpy.fromfile", "keras.models.load_model", "random.shuffle", "os.path.join", "numpy.asanyarray", "numpy.array" ]
[((933, 1034), 'keras.models.load_model', 'load_model', (['"""D:\\\\OneDrive\\\\工作\\\\富港万嘉\\\\TensorFlow\\\\saved_models\\\\TL_0_%s_model.036_0.8795.h5"""'], {}), "(\n 'D:\\\\OneDrive\\\\工作\\\\富港万嘉\\\\TensorFlow\\\\saved_models\\\\TL_0_%s_model.036_0.8795.h5'\n )\n", (943, 1034), False, 'from keras.models import ...
import sys import numpy as np import pandas as pd from sklearn.cluster import KMeans from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.utils import check_random_state from sklearn.decomposition import PCA import keras class LIMESimpleModel...
[ "sklearn.utils.check_random_state", "pandas.read_csv", "keras.Model", "numpy.where", "sklearn.model_selection.train_test_split", "sklearn.decomposition.PCA", "numpy.argmax", "keras.Input", "numpy.zeros", "numpy.dot", "keras.layers.Dense", "keras.layers.BatchNormalization", "sklearn.linear_mo...
[((2194, 2219), 'keras.Input', 'keras.Input', ([], {'shape': '(143,)'}), '(shape=(143,))\n', (2205, 2219), False, 'import keras\n'), ((2636, 2683), 'keras.Model', 'keras.Model', ([], {'inputs': 'in_layer', 'outputs': 'out_layer'}), '(inputs=in_layer, outputs=out_layer)\n', (2647, 2683), False, 'import keras\n'), ((2737...
#!/usr/bin/env python import os import sys import rospy import threading import numpy as np from geometry_msgs import msg as gmsg from aist_depth_filter import DepthFilterClient from tf import TransformBroadcaster, transformations as tfs ######################################################################### # glo...
[ "geometry_msgs.msg.TransformStamped", "tf.TransformBroadcaster", "aist_depth_filter.DepthFilterClient", "sys.exit", "numpy.cross", "rospy.is_shutdown", "rospy.init_node", "rospy.Time.now", "numpy.array", "rospy.Rate", "numpy.linalg.norm", "threading.Thread" ]
[((565, 588), 'geometry_msgs.msg.TransformStamped', 'gmsg.TransformStamped', ([], {}), '()\n', (586, 588), True, 'from geometry_msgs import msg as gmsg\n'), ((707, 783), 'numpy.array', 'np.array', (['[plane.plane.normal.x, plane.plane.normal.y, plane.plane.normal.z]'], {}), '([plane.plane.normal.x, plane.plane.normal.y...
import os import sys if 'SUMO_HOME' in os.environ: tools = os.path.join(os.environ['SUMO_HOME'], 'tools') sys.path.append(tools) else: sys.exit("Please declare the environment variable 'SUMO_HOME'") import traci import numpy as np from gym import spaces class TrafficSignal: """ This class represen...
[ "traci.vehicle.getSpeed", "numpy.array", "traci.trafficlight.getAllProgramLogics", "traci.vehicle.getLeader", "sys.exit", "traci.trafficlight.getControlledLinks", "sys.path.append", "numpy.mean", "traci.trafficlight.getPhase", "traci.lane.getLength", "traci.vehicle.getLaneID", "traci.trafficli...
[((63, 109), 'os.path.join', 'os.path.join', (["os.environ['SUMO_HOME']", '"""tools"""'], {}), "(os.environ['SUMO_HOME'], 'tools')\n", (75, 109), False, 'import os\n'), ((114, 136), 'sys.path.append', 'sys.path.append', (['tools'], {}), '(tools)\n', (129, 136), False, 'import sys\n'), ((147, 210), 'sys.exit', 'sys.exit...
import pickle import argparse import json import gc import math from util import * from sklearn.metrics import classification_report from keras.callbacks import EarlyStopping from sklearn.feature_extraction.text import CountVectorizer from keras.callbacks import ModelCheckpoint from collections import defaultdict from ...
[ "numpy.array", "gensim.models.word2vec.Word2Vec", "nltk.corpus.stopwords.words", "argparse.ArgumentParser", "json.dumps", "numpy.asarray", "numpy.tanh", "numpy.stack", "keras.callbacks.EarlyStopping", "keras.metrics.TopKCategoricalAccuracy", "sklearn.metrics.confusion_matrix", "numpy.any", "...
[((19798, 19810), 'gc.collect', 'gc.collect', ([], {}), '()\n', (19808, 19810), False, 'import gc\n'), ((20876, 20901), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (20899, 20901), False, 'import argparse\n'), ((7301, 7337), 'os.makedirs', 'os.makedirs', (['dump_dir'], {'exist_ok': '(True)'})...
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from dataclasses import dataclass, field import numpy as np from shared.BASparseMat import BASparseMat from shared.output_utils import save_errors_to_file, objective_file_name,\ save_sparse_j_to_file, jacobian_file_na...
[ "shared.BASparseMat.BASparseMat", "numpy.empty", "shared.output_utils.jacobian_file_name", "shared.output_utils.objective_file_name" ]
[((397, 426), 'numpy.empty', 'np.empty', (['(0)'], {'dtype': 'np.float64'}), '(0, dtype=np.float64)\n', (405, 426), True, 'import numpy as np\n'), ((475, 504), 'numpy.empty', 'np.empty', (['(0)'], {'dtype': 'np.float64'}), '(0, dtype=np.float64)\n', (483, 504), True, 'import numpy as np\n'), ((553, 582), 'numpy.empty',...
#!/usr/bin/env python import mirheo as mir import argparse import numpy as np ranks = (1, 1, 1) domain = (8, 8, 8) dt = 0.01 u = mir.Mirheo(ranks, domain, dt, debug_level=3, log_filename='log', no_splash=True) n = 20 np.random.seed(42) positions = np.random.rand(n, 3) velocities = np.random.rand(n, 3) - 0.5 for...
[ "numpy.random.rand", "mirheo.Plugins.createParticleDisplacement", "mirheo.Mirheo", "mirheo.Plugins.createDumpParticles", "mirheo.ParticleVectors.ParticleVector", "mirheo.Integrators.VelocityVerlet", "numpy.random.seed" ]
[((134, 219), 'mirheo.Mirheo', 'mir.Mirheo', (['ranks', 'domain', 'dt'], {'debug_level': '(3)', 'log_filename': '"""log"""', 'no_splash': '(True)'}), "(ranks, domain, dt, debug_level=3, log_filename='log', no_splash=True\n )\n", (144, 219), True, 'import mirheo as mir\n'), ((223, 241), 'numpy.random.seed', 'np.rando...
import cv2 import numpy as np import random import os from helper import add_noise, add_shadow, apply_motion_blur, add_spot_light, add_parallel_light class backgroundOverlayer(object): """ Overlay's april tag on the background image """ def __init__(self, apriltag_generator , mx_tags): self.g...
[ "numpy.clip", "numpy.count_nonzero", "numpy.array", "cv2.bitwise_or", "numpy.multiply", "cv2.threshold", "numpy.maximum", "random.randint", "cv2.add", "helper.apply_motion_blur", "cv2.drawContours", "numpy.full", "random.randrange", "helper.add_spot_light", "cv2.equalizeHist", "cv2.cvt...
[((508, 558), 'numpy.zeros', 'np.zeros', (['background_img.shape[:2]'], {'dtype': 'np.uint8'}), '(background_img.shape[:2], dtype=np.uint8)\n', (516, 558), True, 'import numpy as np\n'), ((589, 675), 'numpy.full', 'np.full', (['(background_img.shape[0], background_img.shape[1], 5)', '(0)'], {'dtype': 'np.uint8'}), '((b...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os, torch from tqdm import tqdm from silence_tensorflow import silence_tensorflow silence_tensorflow() import tensorflow.compat.v1 as tf from metrics.FVD.FVD import Embedder, preprocess, calculate_fvd imp...
[ "tensorflow.compat.v1.placeholder", "silence_tensorflow.silence_tensorflow", "tensorflow.compat.v1.Graph", "tqdm.tqdm", "tensorflow.compat.v1.config.experimental.set_visible_devices", "metrics.FVD.FVD.preprocess", "tensorflow.compat.v1.device", "numpy.concatenate", "tensorflow.compat.v1.config.exper...
[((198, 218), 'silence_tensorflow.silence_tensorflow', 'silence_tensorflow', ([], {}), '()\n', (216, 218), False, 'from silence_tensorflow import silence_tensorflow\n'), ((402, 451), 'tensorflow.compat.v1.config.experimental.get_visible_devices', 'tf.config.experimental.get_visible_devices', (['"""GPU"""'], {}), "('GPU...
from qfengine.risk.risk_model import RiskModel from abc import ABCMeta import numpy as np import pandas as pd class CovarianceMatrixRiskModel(RiskModel): __metaclass__ = ABCMeta def __init__(self, universe, data_handler, logarithmic_returns:bool = True, ...
[ "numpy.dot", "numpy.diag" ]
[((3346, 3358), 'numpy.diag', 'np.diag', (['vol'], {}), '(vol)\n', (3353, 3358), True, 'import numpy as np\n'), ((3431, 3448), 'numpy.dot', 'np.dot', (['corr', 'vol'], {}), '(corr, vol)\n', (3437, 3448), True, 'import numpy as np\n')]
import logging import os import pprint import sys import tempfile as tmp from copy import copy from sklearn.utils import shuffle from numpy import squeeze if sys.platform == 'darwin': os.environ['OBJC_DISABLE_INITIALIZE_FORK_SAFETY'] = 'YES' os.environ['JOBLIB_TEMP_FOLDER'] = tmp.gettempdir() os.enviro...
[ "logging.getLogger", "fedot.core.composer.gp_composer.gp_composer.GPComposerBuilder", "frameworks.shared.callee.utils.Timer", "sklearn.utils.shuffle", "frameworks.shared.callee.result", "numpy.squeeze", "fedot.core.repository.model_types_repository.ModelTypesRepository", "fedot.core.repository.quality...
[((293, 309), 'tempfile.gettempdir', 'tmp.gettempdir', ([], {}), '()\n', (307, 309), True, 'import tempfile as tmp\n'), ((1323, 1350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1340, 1350), False, 'import logging\n'), ((2312, 2327), 'fedot.core.repository.tasks.Task', 'Task', (['tas...
from sklearn.model_selection import StratifiedKFold, KFold from skopt.utils import use_named_args from .pipes_and_transformers import MidasEnsembleClassifiersWithPipeline, wrap_pipeline, get_metadata_fit, _MidasIdentity from imblearn.pipeline import Pipeline from sklearn.calibration import CalibratedClassifierCV from c...
[ "numpy.where", "skopt.utils.use_named_args", "imblearn.pipeline.Pipeline", "collections.Counter", "sklearn.model_selection.StratifiedKFold", "numpy.around", "numpy.concatenate", "copy.deepcopy", "sklearn.calibration.CalibratedClassifierCV", "sklearn.model_selection.KFold" ]
[((855, 870), 'copy.deepcopy', 'deepcopy', (['model'], {}), '(model)\n', (863, 870), False, 'from copy import deepcopy\n'), ((1436, 1446), 'collections.Counter', 'Counter', (['y'], {}), '(y)\n', (1443, 1446), False, 'from collections import Counter\n'), ((2105, 2137), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_...
# License: MIT # Author: <NAME> import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms import torch.optim as optim import numpy as np import visdom import os import model import datasets import config vis = visdom.Visdom() def numpify(tensor): return tensor.cpu().det...
[ "numpy.clip", "model.Monet", "torch.mean", "datasets.Clevr", "torch.load", "numpy.argmax", "datasets.Sprites", "torchvision.transforms.Lambda", "os.path.isfile", "torch.nn.DataParallel", "torchvision.transforms.functional.crop", "numpy.concatenate", "torch.utils.data.DataLoader", "torchvis...
[((254, 269), 'visdom.Visdom', 'visdom.Visdom', ([], {}), '()\n', (267, 269), False, 'import visdom\n'), ((644, 669), 'numpy.clip', 'np.clip', (['recons', '(0.0)', '(1.0)'], {}), '(recons, 0.0, 1.0)\n', (651, 669), True, 'import numpy as np\n'), ((911, 930), 'numpy.zeros_like', 'np.zeros_like', (['imgs'], {}), '(imgs)\...
import numpy as np from scipy import signal def random_spikes(size): """ Generate zeros and ones in an array of size=size. probabilities = [probability 0 will appear, probability 1 will appear] """ spikes = np.random.choice(2, size, p=[0.99, 0.01]) # Get rid of spikes that are on top of each ...
[ "numpy.random.choice" ]
[((229, 270), 'numpy.random.choice', 'np.random.choice', (['(2)', 'size'], {'p': '[0.99, 0.01]'}), '(2, size, p=[0.99, 0.01])\n', (245, 270), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ Make a simple 1D gaussian profile. """ import numpy as np import matplotlib.pyplot as plt def gaussian_1D_profile(x_min, x_max, x_step, center, sigma, amplitude): """Function to create a 1D Gaussian distribution. Parameters ---------- x_min, ...
[ "matplotlib.pyplot.ylabel", "numpy.power", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.title", "numpy.arange", "matplotlib.pyplot.show" ]
[((760, 791), 'numpy.arange', 'np.arange', (['x_min', 'x_max', 'x_step'], {}), '(x_min, x_max, x_step)\n', (769, 791), True, 'import numpy as np\n'), ((1604, 1618), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (1612, 1618), True, 'import matplotlib.pyplot as plt\n'), ((1623, 1643), 'matplotlib.py...
# -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2020 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html #...
[ "logging.getLogger", "os.makedirs", "pynet.datasets.core.DataItem", "subprocess.check_call", "os.path.join", "os.path.isfile", "os.path.isdir", "numpy.expand_dims", "numpy.load", "numpy.arange", "numpy.random.shuffle" ]
[((870, 896), 'logging.getLogger', 'logging.getLogger', (['"""pynet"""'], {}), "('pynet')\n", (887, 896), False, 'import logging\n'), ((2490, 2544), 'os.path.join', 'os.path.join', (['self.datasetdir', "DSprites.files['train']"], {}), "(self.datasetdir, DSprites.files['train'])\n", (2502, 2544), False, 'import os\n'), ...
import numpy as np import pytest from snc.environments.job_generators.discrete_review_job_generator \ import DeterministicDiscreteReviewJobGenerator as drjg from snc.environments.job_generators.discrete_review_job_generator \ import PoissonDiscreteReviewJobGenerator as prjg from snc.environments.controlled_ran...
[ "snc.environments.job_generators.scaled_bernoulli_services_poisson_arrivals_generator.ScaledBernoulliServicesPoissonArrivalsGenerator", "numpy.array", "snc.environments.examples.double_reentrant_line_only_shared_resources_model", "numpy.arange", "snc.environments.examples_distribution_with_rebalancing.one_w...
[((27004, 27061), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ind_surplus_buffers"""', '[1, None]'], {}), "('ind_surplus_buffers', [1, None])\n", (27027, 27061), False, 'import pytest\n'), ((862, 877), 'numpy.ones', 'np.ones', (['(1, 1)'], {}), '((1, 1))\n', (869, 877), True, 'import numpy as np\n'), ((...
import numpy as np import sys import os import pandas as pd from scipy import signal from sklearn.metrics import accuracy_score ########## Note: Using Professor's code as a starting template ######################## ######################################## ### Read images from train directory ### traindir = sys....
[ "scipy.signal.convolve2d", "numpy.random.rand", "pandas.read_csv", "numpy.exp", "numpy.loadtxt", "sklearn.metrics.accuracy_score" ]
[((334, 369), 'pandas.read_csv', 'pd.read_csv', (["(traindir + '/data.csv')"], {}), "(traindir + '/data.csv')\n", (345, 369), True, 'import pandas as pd\n'), ((841, 875), 'pandas.read_csv', 'pd.read_csv', (["(testdir + '/data.csv')"], {}), "(testdir + '/data.csv')\n", (852, 875), True, 'import pandas as pd\n'), ((1249,...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Defines unit tests for :mod:`colour.models.ipt` module. """ from __future__ import division, unicode_literals import numpy as np import sys if sys.version_info[:2] <= (2, 6): import unittest2 as unittest else: import unittest from colour.models import XYZ_t...
[ "numpy.array" ]
[((1085, 1132), 'numpy.array', 'np.array', (['[1.00300825, 0.01906918, -0.01369292]'], {}), '([1.00300825, 0.01906918, -0.01369292])\n', (1093, 1132), True, 'import numpy as np\n'), ((1272, 1318), 'numpy.array', 'np.array', (['[0.73974548, 0.95333412, 1.71951212]'], {}), '([0.73974548, 0.95333412, 1.71951212])\n', (128...
#!/usr/bin/env python3 -u # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import os import os.path as osp import math import numpy as np import tqdm import torch import torch...
[ "os.path.exists", "math.ceil", "os.makedirs", "argparse.ArgumentParser", "npy_append_array.NpyAppendArray", "os.path.join", "tqdm.tqdm", "torch.from_numpy", "shutil.copyfile", "torch.nn.functional.pad", "torch.no_grad", "numpy.load", "os.remove" ]
[((446, 558), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""mean pools representations by compressing uniform splits of the data"""'}), "(description=\n 'mean pools representations by compressing uniform splits of the data')\n", (469, 558), False, 'import argparse\n'), ((1185, 1218),...
import copy from collections import deque import numpy as np from domainbed.lib import swa_utils class SWADBase: def update_and_evaluate(self, segment_swa, val_acc, val_loss, prt_fn): raise NotImplementedError() def get_final_model(self): raise NotImplementedError() class IIDMax(SWADBase): ...
[ "numpy.mean", "collections.deque", "copy.deepcopy", "numpy.argmin", "domainbed.lib.swa_utils.AveragedModel" ]
[((2126, 2150), 'collections.deque', 'deque', ([], {'maxlen': 'n_converge'}), '(maxlen=n_converge)\n', (2131, 2150), False, 'from collections import deque\n'), ((2175, 2200), 'collections.deque', 'deque', ([], {'maxlen': 'n_tolerance'}), '(maxlen=n_tolerance)\n', (2180, 2200), False, 'from collections import deque\n'),...
import datajoint as dj from . import lab, experiment, ccf from . import get_schema_name import numpy as np from scipy.interpolate import CubicSpline schema = dj.schema(get_schema_name('ephys')) [lab, experiment, ccf] # NOQA flake8 @schema class ProbeInsertion(dj.Manual): definition = """ -> experiment.Se...
[ "numpy.hstack", "numpy.delete", "numpy.diff", "numpy.argmax", "numpy.array", "numpy.argmin" ]
[((7603, 7626), 'numpy.argmin', 'np.argmin', (['ave_waveform'], {}), '(ave_waveform)\n', (7612, 7626), True, 'import numpy as np\n'), ((7648, 7671), 'numpy.argmax', 'np.argmax', (['ave_waveform'], {}), '(ave_waveform)\n', (7657, 7671), True, 'import numpy as np\n'), ((8777, 8790), 'numpy.diff', 'np.diff', (['spks'], {}...
""" Plot modules. """ #============================================================================= #Modules import numpy as np import matplotlib.pyplot as plt from matplotlib.mlab import griddata def contour_plot(array3d, **kwargs): """Do the contour plot of a 3D array. Parameters ---------- ...
[ "numpy.reshape", "numpy.unique", "matplotlib.pyplot.savefig", "matplotlib.pyplot.ylabel", "matplotlib.mlab.griddata", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.clf", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.pcolormesh", "matplotlib.pyplot.contour", "matplotlib.pyplot.figure", "mat...
[((833, 870), 'numpy.reshape', 'np.reshape', (['array3d[:, 0]', '(n_x, n_y)'], {}), '(array3d[:, 0], (n_x, n_y))\n', (843, 870), True, 'import numpy as np\n'), ((880, 917), 'numpy.reshape', 'np.reshape', (['array3d[:, 1]', '(n_x, n_y)'], {}), '(array3d[:, 1], (n_x, n_y))\n', (890, 917), True, 'import numpy as np\n'), (...
# -*- coding: utf-8 -*- """ Geometric example ================= A small example script showing the usage of the 'geographic' coordinates type for ordinary kriging on a sphere. """ from pykrige.ok import OrdinaryKriging import numpy as np from matplotlib import pyplot as plt # Make this example reproducible: np.rand...
[ "pykrige.ok.OrdinaryKriging", "numpy.random.rand", "numpy.array_str", "numpy.random.random", "numpy.linspace", "numpy.random.seed", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((313, 337), 'numpy.random.seed', 'np.random.seed', (['(89239413)'], {}), '(89239413)\n', (327, 337), True, 'import numpy as np\n'), ((697, 723), 'numpy.linspace', 'np.linspace', (['(0.0)', '(360.0)', '(7)'], {}), '(0.0, 360.0, 7)\n', (708, 723), True, 'import numpy as np\n'), ((735, 762), 'numpy.linspace', 'np.linspa...
# Copyright (c) 2017, IGLU consortium # 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 of conditions and...
[ "logging.basicConfig", "os.path.exists", "os.path.join", "home_platform.semantic.SuncgSemantics", "home_platform.semantic.MaterialColorTable.getColorsFromObject", "os.path.realpath", "home_platform.suncg.SunCgSceneLoader.loadHouseFromJson", "home_platform.suncg.loadModel", "home_platform.semantic.Ma...
[((8243, 8282), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARN'}), '(level=logging.WARN)\n', (8262, 8282), False, 'import logging\n'), ((8287, 8309), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (8296, 8309), True, 'import numpy as np\n'), ((8314, 8329), 'uni...
import numpy as np import scipy.ndimage as ndimage from skimage import measure, morphology, segmentation from skimage.morphology import ball, disk, dilation, binary_erosion, remove_small_objects, erosion, closing, reconstruction, binary_closing from skimage.measure import label,regionprops, perimeter from skimage.morph...
[ "numpy.bitwise_or", "skimage.morphology.binary_closing", "scipy.ndimage.black_tophat", "scipy.ndimage.binary_dilation", "cv2.threshold", "numpy.max", "numpy.hypot", "skimage.morphology.watershed", "numpy.ones", "skimage.measure.regionprops", "scipy.ndimage.iterate_structure", "scipy.ndimage.bi...
[((655, 697), 'skimage.segmentation.clear_border', 'segmentation.clear_border', (['marker_internal'], {}), '(marker_internal)\n', (680, 697), False, 'from skimage import measure, morphology, segmentation\n'), ((727, 757), 'skimage.measure.label', 'measure.label', (['marker_internal'], {}), '(marker_internal)\n', (740, ...
#!/usr/bin/env python # coding: utf-8 # */Aaipnd-project-master/train_commonfns.py # # PROGRAMMER: <NAME> # DATE CREATED: 01/01/2020 # REVISED DATE: # PURPOSE: common support needed for train program # ...
[ "numpy.clip", "argparse.ArgumentParser", "matplotlib.use", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.subplots", "matplotlib.pyplot.legend" ]
[((526, 547), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (540, 547), False, 'import matplotlib\n'), ((2743, 2768), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2766, 2768), False, 'import argparse\n'), ((4419, 4444), 'argparse.ArgumentParser', 'argparse.ArgumentPar...
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import scipy.stats as stats def plot_duration(df): ''' Plots a histogram of the movie duration :param df: cleaned dataframe :return: figure and axes objects ''' fig, ax = plt.subplots(nrows = 1, ncols =...
[ "seaborn.lmplot", "seaborn.relplot", "seaborn.despine", "seaborn.histplot", "seaborn.heatmap", "seaborn.scatterplot", "seaborn.barplot", "matplotlib.pyplot.subplots", "numpy.arange" ]
[((289, 337), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': '(10, 10)'}), '(nrows=1, ncols=1, figsize=(10, 10))\n', (301, 337), True, 'import matplotlib.pyplot as plt\n'), ((348, 409), 'seaborn.histplot', 'sns.histplot', ([], {'data': 'df', 'x': '"""duration"""', 'ax': '...
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from sklearn.datasets import make_classification, make_moons from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split from sklearn.metrics import classification_report from sklearn.l...
[ "sklearn.datasets.make_moons", "sklearn.preprocessing.StandardScaler", "pandas.DataFrame", "numpy.meshgrid", "numpy.arange" ]
[((468, 512), 'sklearn.datasets.make_moons', 'make_moons', ([], {'n_samples': 'n_samples', 'noise': 'noise'}), '(n_samples=n_samples, noise=noise)\n', (478, 512), False, 'from sklearn.datasets import make_classification, make_moons\n'), ((527, 562), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'columns': "['A', 'B']"})...
from collections import deque from pathlib import Path import numpy as np import pandas as pd from pyoaz.bots.leftmost_bot import LeftmostBot from pyoaz.bots.random_bot import RandomBot from pyoaz.bots.nn_bot import NNBot from pyoaz.bots.mcts_bot import MCTSBot from pyoaz.tournament import Participant, Tournament d...
[ "pyoaz.tournament.Tournament", "pyoaz.tournament.Participant", "collections.deque", "pandas.read_csv", "pathlib.Path", "pyoaz.bots.nn_bot.NNBot.load_model", "pyoaz.bots.random_bot.RandomBot", "pyoaz.games.tic_tac_toe.boards_to_bin", "pandas.merge", "numpy.log", "pyoaz.bots.leftmost_bot.LeftmostB...
[((525, 545), 'pathlib.Path', 'Path', (['benchmark_path'], {}), '(benchmark_path)\n', (529, 545), False, 'from pathlib import Path\n'), ((1737, 1807), 'pandas.read_csv', 'pd.read_csv', (["(benchmark_path / 'tic_tac_toe_table.csv')"], {'index_col': '(False)'}), "(benchmark_path / 'tic_tac_toe_table.csv', index_col=False...
# -*- coding: utf-8 -*- """ Created on Thu Oct 28 12:48:10 2021 @author: huzongxiang """ import numpy as np from typing import List from enum import Enum, unique from pymatgen.core import Structure from pymatgen.analysis.bond_valence import BVAnalyzer from pymatgen.symmetry.analyzer import SpacegroupAnalyzer @uniqu...
[ "numpy.array", "numpy.eye", "pymatgen.analysis.bond_valence.BVAnalyzer", "pymatgen.symmetry.analyzer.SpacegroupAnalyzer" ]
[((950, 985), 'numpy.eye', 'np.eye', (['num_atoms'], {'dtype': 'np.float32'}), '(num_atoms, dtype=np.float32)\n', (956, 985), True, 'import numpy as np\n'), ((1408, 1432), 'pymatgen.analysis.bond_valence.BVAnalyzer', 'BVAnalyzer', ([], {'symm_tol': '(0.1)'}), '(symm_tol=0.1)\n', (1418, 1432), False, 'from pymatgen.anal...
""" This Python module serves to analyze the performance metrics of kharon. """ #%% import matplotlib.pyplot as plt import sys import os import numpy as np from scipy.stats import norm import statistics # retrieve data from # option = -1 # if sys.argv[1] == "new": # option = 0 # else: # option = 1 out_file = "p...
[ "statistics.mean", "os.path.exists", "statistics.stdev", "scipy.stats.norm.pdf", "numpy.arange", "os.remove" ]
[((426, 453), 'os.path.exists', 'os.path.exists', (['"""means.txt"""'], {}), "('means.txt')\n", (440, 453), False, 'import os\n'), ((1099, 1126), 'numpy.arange', 'np.arange', (['(4000)', '(10000)', '(0.5)'], {}), '(4000, 10000, 0.5)\n', (1108, 1126), True, 'import numpy as np\n'), ((1133, 1170), 'statistics.mean', 'sta...
import numpy as np import matplotlib.pyplot as plt import time def completeRank1Matrix(observations,mask,PLOT=False): # observations and mask are two 2D numpy arrays of the same size, where observations is a # numerical matrix indicating the observed values of the matrix and mask is a boolean array # indicating ...
[ "numpy.logical_not", "numpy.any", "time.sleep", "matplotlib.pyplot.close", "numpy.argwhere", "numpy.transpose", "matplotlib.pyplot.subplots" ]
[((1925, 1937), 'matplotlib.pyplot.close', 'plt.close', (['f'], {}), '(f)\n', (1934, 1937), True, 'import matplotlib.pyplot as plt\n'), ((378, 419), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {'sharex': '(True)', 'sharey': '(True)'}), '(2, sharex=True, sharey=True)\n', (390, 419), True, 'import matplotlib....
import unittest import os import numpy as np from phonopy.interface.phonopy_yaml import read_cell_yaml from phono3py.phonon3.triplets import (get_grid_point_from_address, get_grid_point_from_address_py) data_dir = os.path.dirname(os.path.abspath(__file__)) class TestTriplets(u...
[ "phono3py.phonon3.triplets.get_grid_point_from_address", "phono3py.phonon3.triplets.get_grid_point_from_address_py", "os.path.join", "numpy.ndindex", "os.path.abspath", "unittest.TextTestRunner", "unittest.TestLoader" ]
[((271, 296), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (286, 296), False, 'import os\n'), ((396, 433), 'os.path.join', 'os.path.join', (['data_dir', '"""POSCAR.yaml"""'], {}), "(data_dir, 'POSCAR.yaml')\n", (408, 433), False, 'import os\n'), ((753, 775), 'numpy.ndindex', 'np.ndindex', (...
import numpy import simtk.unit import simtk.unit as units import simtk.openmm as mm from openmmtools.integrators import ExternalPerturbationLangevinIntegrator kB = units.BOLTZMANN_CONSTANT_kB * units.AVOGADRO_CONSTANT_NA class NCMCGeodesicBAOAB(ExternalPerturbationLangevinIntegrator): """ Implementation of a ...
[ "numpy.exp" ]
[((4535, 4563), 'numpy.exp', 'numpy.exp', (['(-gamma * timestep)'], {}), '(-gamma * timestep)\n', (4544, 4563), False, 'import numpy\n')]
from typing import List from numpy import array, asarray, cos, linspace, ndarray, pi, power, sin, sum from numpy.linalg import norm import meshpy.triangle as triangle class tri_mesh: def __init__(self, surf_points: ndarray, external_n: float, external_radius: float) -> None: self.__surf_points = surf_poi...
[ "meshpy.triangle.MeshInfo", "numpy.power", "meshpy.triangle.build", "numpy.asarray", "numpy.array", "numpy.linspace", "numpy.cos", "numpy.linalg.norm", "numpy.sin" ]
[((1726, 1745), 'meshpy.triangle.MeshInfo', 'triangle.MeshInfo', ([], {}), '()\n', (1743, 1745), True, 'import meshpy.triangle as triangle\n'), ((2245, 2339), 'meshpy.triangle.build', 'triangle.build', (['info'], {'quality_meshing': '(0.9)', 'min_angle': '(25)', 'refinement_func': 'needs_refinement'}), '(info, quality_...
# -*- coding: utf-8 -*- """ Simulating diffraction by a 2D metamaterial =========================================== Finite element simulation of the diffraction of a plane wave by a mono-periodic grating and calculation of diffraction efficiencies. """ #################################################################...
[ "pytheas.Periodic2D", "pytheas.genmat.MaterialDensity", "pytheas.genmat.np.random.seed", "matplotlib.pyplot.subplots", "numpy.random.permutation" ]
[((645, 657), 'pytheas.Periodic2D', 'Periodic2D', ([], {}), '()\n', (655, 657), False, 'from pytheas import Periodic2D\n'), ((2884, 2910), 'pytheas.genmat.np.random.seed', 'genmat.np.random.seed', (['(100)'], {}), '(100)\n', (2905, 2910), False, 'from pytheas import genmat\n'), ((2917, 2941), 'pytheas.genmat.MaterialDe...
# This script creates a callable class which runs a single Perceptron # The perceptron is able to solve the logical OR, the logical AND, but not # The logical XOR problem. The only library used is numpy. # # Code from <NAME>, Machine Learning An Algorithmic Perspective, 2nd edition # https://seat.massey.ac.nz/pers...
[ "numpy.trace", "numpy.multiply", "numpy.random.rand", "numpy.ones", "numpy.where", "numpy.ndim", "numpy.argmax", "numpy.array", "numpy.dot", "numpy.zeros", "numpy.sum", "numpy.shape", "numpy.transpose" ]
[((10313, 10367), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]]'], {}), '([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])\n', (10321, 10367), True, 'import numpy as np\n'), ((10388, 10442), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 1]]'], {}), '([[0, 0, 0], [0, 1,...
""" A helper class for solving the non-linear time dependent equations of biofilm growth which includes models of the cell concentration and also nutrient concentrations in both the substrate and biofilm. All of these are asumed to be radially symmetric and depend on r and t, and the article concentration additional...
[ "scipy.sparse.linalg.LinearOperator", "scipy.sparse.linalg.bicgstab", "numpy.isfinite", "numpy.linalg.norm", "numpy.arange", "scipy.sparse.linalg.spilu", "scipy.sparse.linalg.gmres", "numpy.linspace", "numpy.empty", "numpy.concatenate", "scipy.sparse.diags", "scipy.sparse.coo_matrix", "numpy...
[((3903, 3935), 'numpy.arange', 'np.arange', (['(0.0)', '(R + 0.5 * dr)', 'dr'], {}), '(0.0, R + 0.5 * dr, dr)\n', (3912, 3935), True, 'import numpy as np\n'), ((4016, 4038), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'nxi'], {}), '(0, 1, nxi)\n', (4027, 4038), True, 'import numpy as np\n'), ((4064, 4094), 'numpy...
""" Image processing utilities """ __all__ = ['background_mask', 'foreground_mask', 'overlay_edges', 'diff_image', 'equalize_image_histogram'] from scipy import ndimage from visualqc import config as cfg from visualqc.utils import scale_0to1 import numpy as np from functools import partial from scipy.ndi...
[ "matplotlib.interactive", "numpy.hstack", "numpy.logical_not", "numpy.array", "visualqc.utils.scale_0to1", "numpy.gradient", "numpy.divide", "numpy.histogram", "numpy.greater", "numpy.repeat", "scipy.ndimage.binary_erosion", "scipy.ndimage.generate_binary_structure", "numpy.delete", "numpy...
[((543, 571), 'matplotlib.interactive', 'matplotlib.interactive', (['(True)'], {}), '(True)\n', (565, 571), False, 'import matplotlib\n'), ((621, 637), 'matplotlib.cm.get_cmap', 'get_cmap', (['"""gray"""'], {}), "('gray')\n", (629, 637), False, 'from matplotlib.cm import get_cmap\n'), ((649, 664), 'matplotlib.cm.get_cm...
import numpy as np import statistics import time def time_stat(func, size, ntrials): total = 0 # the time to generate the random array should not be included for i in range(ntrials): data = np.random.rand(size) # modify this function to time func with ntrials times using a new random array each ti...
[ "numpy.random.rand", "time.perf_counter" ]
[((209, 229), 'numpy.random.rand', 'np.random.rand', (['size'], {}), '(size)\n', (223, 229), True, 'import numpy as np\n'), ((336, 355), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (353, 355), False, 'import time\n'), ((392, 411), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (409, 411), F...
import pandas as pd import numpy as np import plotly.graph_objects as go import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input,Output import os print(os.getcwd()) df_input_large=pd.read_csv('C:/Users/Asus/ads_covid-19/data/processed/COVID_large...
[ "plotly.graph_objects.Bar", "pandas.read_csv", "dash_core_components.Input", "dash.dependencies.Output", "dash_html_components.Br", "os.getcwd", "dash.dependencies.Input", "plotly.graph_objects.Figure", "numpy.array", "dash_core_components.Dropdown", "plotly.graph_objects.Scatter", "dash_core_...
[((254, 372), 'pandas.read_csv', 'pd.read_csv', (['"""C:/Users/Asus/ads_covid-19/data/processed/COVID_large_flat_table.csv"""'], {'sep': '""";"""', 'parse_dates': '[0]'}), "(\n 'C:/Users/Asus/ads_covid-19/data/processed/COVID_large_flat_table.csv',\n sep=';', parse_dates=[0])\n", (265, 372), True, 'import pandas ...
import csv import numpy as np from collections import Counter from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import KFold from sklearn.feature_extraction import DictVectorizer from sklearn.metrics import f1_score from sklearn imp...
[ "sklearn.feature_extraction.DictVectorizer", "support.helper.process_tokens", "sklearn.linear_model.LogisticRegression", "collections.Counter", "numpy.array", "support.helper.tokenize", "sklearn.naive_bayes.GaussianNB", "sklearn.model_selection.KFold", "csv.reader", "sklearn.preprocessing.scale" ]
[((654, 663), 'collections.Counter', 'Counter', ([], {}), '()\n', (661, 663), False, 'from collections import Counter\n'), ((1314, 1330), 'sklearn.feature_extraction.DictVectorizer', 'DictVectorizer', ([], {}), '()\n', (1328, 1330), False, 'from sklearn.feature_extraction import DictVectorizer\n'), ((2370, 2390), 'nump...
import numpy as np import ast def newtonInterpolation(x, y): x = ast.literal_eval(x) y = ast.literal_eval(y) n = len(y) table = np.zeros([n, n]) # Create a square matrix to hold table table[::, 0] = y # first column is y results = {"table": [], "coefficient": []} results["tabl...
[ "ast.literal_eval", "numpy.zeros" ]
[((74, 93), 'ast.literal_eval', 'ast.literal_eval', (['x'], {}), '(x)\n', (90, 93), False, 'import ast\n'), ((103, 122), 'ast.literal_eval', 'ast.literal_eval', (['y'], {}), '(y)\n', (119, 122), False, 'import ast\n'), ((152, 168), 'numpy.zeros', 'np.zeros', (['[n, n]'], {}), '([n, n])\n', (160, 168), True, 'import num...
import torch as th import time import numpy as np import pandas as pd import os import seaborn as sns import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter sns.set() sns.set_style("darkgrid", {"axes.facecolor": "#f0f0f7"}) linestyle = [':', '--', '-.', '-'] fontsize = 20 #EXP_PATH = os.path.join(...
[ "seaborn.cubehelix_palette", "matplotlib.pyplot.ylabel", "time.sleep", "seaborn.set_style", "seaborn.set", "seaborn.color_palette", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.yticks", "matplotlib.pyplot.axis", "matplotlib.pyplot.ylim", "torch.gather", "matplotlib.pyplot.xticks", "matplot...
[((178, 187), 'seaborn.set', 'sns.set', ([], {}), '()\n', (185, 187), True, 'import seaborn as sns\n'), ((188, 244), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""', "{'axes.facecolor': '#f0f0f7'}"], {}), "('darkgrid', {'axes.facecolor': '#f0f0f7'})\n", (201, 244), True, 'import seaborn as sns\n'), ((1112, 113...
# electric.csv를 읽어서 w,b를 구하고 # 실측데이터 scatter, 예측데이터는 라인차트를 그리시요. # 전기생산량이 5인경우 전기사용량을 예측하시오 # 전기생산량, 전기사용량 # Keras 버전으로 import tensorflow as tf import numpy as np import matplotlib import matplotlib.pyplot as plt from tensorflow.keras.layers import Dense from tensorflow.keras import Sequential from tensorflow.keras.o...
[ "matplotlib.pyplot.plot", "tensorflow.keras.optimizers.Adam", "tensorflow.keras.layers.Dense", "numpy.loadtxt", "matplotlib.pyplot.show" ]
[((449, 556), 'numpy.loadtxt', 'np.loadtxt', (['"""../../../data/electric.csv"""'], {'delimiter': '""","""', 'skiprows': '(1)', 'dtype': 'np.float32', 'encoding': '"""UTF8"""'}), "('../../../data/electric.csv', delimiter=',', skiprows=1, dtype=\n np.float32, encoding='UTF8')\n", (459, 556), True, 'import numpy as np...
import tensorflow as tf import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import os import pandas as pd mpl.rcParams['figure.figsize'] = (8, 6) mpl.rcParams['axes.grid'] = False #data zip_path = tf.keras.utils.get_file( origin='https://storage.googleapis.com/tensorflow/tf-keras-dataset...
[ "numpy.mean", "numpy.reshape", "tensorflow.random.set_seed", "pandas.read_csv", "tensorflow.data.Dataset.from_tensor_slices", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "os.path.splitext", "numpy.array", "tensorflow.keras.layers.LSTM", "tensorflow.keras.layers.Dense", "tensorflow.ke...
[((225, 413), 'tensorflow.keras.utils.get_file', 'tf.keras.utils.get_file', ([], {'origin': '"""https://storage.googleapis.com/tensorflow/tf-keras-datasets/jena_climate_2009_2016.csv.zip"""', 'fname': '"""jena_climate_2009_2016.csv.zip"""', 'extract': '(True)'}), "(origin=\n 'https://storage.googleapis.com/tensorflo...
import numpy as np import cv2 def rescale(im, target_size, max_size): """ only resize input image to target size and return scale Parameters: ---------- im : numpy.array BGR image input by opencv target_size: int one dimensional size (the short side) max_size: int o...
[ "cv2.resize", "numpy.round", "numpy.min" ]
[((471, 492), 'numpy.min', 'np.min', (['im_shape[0:2]'], {}), '(im_shape[0:2])\n', (477, 492), True, 'import numpy as np\n'), ((511, 532), 'numpy.min', 'np.min', (['im_shape[0:2]'], {}), '(im_shape[0:2])\n', (517, 532), True, 'import numpy as np\n'), ((762, 851), 'cv2.resize', 'cv2.resize', (['im', 'None', 'None'], {'f...
#!/usr/bin/python3 import numpy as np import matplotlib.pyplot as plt from math import sqrt class perceptron: def __init__(self): #self.w = np.random.rand(2) self.w = np.array([0.5, 0.5]) self.w = normalize_v(self.w) #self.b = np.random.rand() self.b = 1 def get_loss...
[ "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.scatter", "matplotlib.pyplot.axis", "matplotlib.pyplot.show" ]
[((2187, 2220), 'numpy.array', 'np.array', (['[(x / norm) for x in v]'], {}), '([(x / norm) for x in v])\n', (2195, 2220), True, 'import numpy as np\n'), ((2444, 2487), 'matplotlib.pyplot.scatter', 'plt.scatter', (['X[:, 0]', 'X[:, 1]'], {'color': 'colors'}), '(X[:, 0], X[:, 1], color=colors)\n', (2455, 2487), True, 'i...
import abc, logging, os, anytree from dbac_lib.dbac_primitives import IPrimitiveCollection, HardMiningSVM from dbac_lib.dbac_feature_ext import IFeatureExtractor from dbac_lib.dbac_util import CycleIterator, batch_iterator, TicToc from dbac_lib import dbac_expression import numpy as np import tensorflow as tf import te...
[ "logging.getLogger", "tensorflow.equal", "tensorflow.shape", "dbac_lib.dbac_expression.list2exp_parse", "numpy.random.rand", "numpy.hstack", "tensorflow.split", "numpy.logical_not", "numpy.array", "dbac_lib.dbac_util.batch_iterator", "tensorflow.variables_initializer", "dbac_lib.dbac_expressio...
[((560, 587), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (577, 587), False, 'import abc, logging, os, anytree\n'), ((4839, 4878), 'dbac_lib.dbac_expression.list2exp_parse', 'dbac_expression.list2exp_parse', (['exp_lst'], {}), '(exp_lst)\n', (4869, 4878), False, 'from dbac_lib import d...