code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
""" Array tools =========== """ import sys import numpy from xminds._lib.hashmap import Hashmap, factorize from .arraybase import to_structured, set_or_add_to_structured def structured_arrays_mean(arrays, keep_missing=False): """ Computes average of each field given a list of struct-arrays. By default,...
[ "numpy.full", "xminds._lib.hashmap.Hashmap", "xminds._lib.hashmap.factorize", "numpy.empty", "numpy.asarray", "numpy.empty_like", "numpy.zeros", "numpy.argsort", "numpy.cumsum", "numpy.argpartition", "numpy.where", "numpy.arange", "numpy.indices", "numpy.bincount", "numpy.concatenate", ...
[((6948, 6969), 'numpy.asarray', 'numpy.asarray', (['values'], {}), '(values)\n', (6961, 6969), False, 'import numpy\n'), ((8266, 8298), 'numpy.empty', 'numpy.empty', (['a.size'], {'dtype': 'dtype'}), '(a.size, dtype=dtype)\n', (8277, 8298), False, 'import numpy\n'), ((9767, 9783), 'numpy.asarray', 'numpy.asarray', (['...
# python 3.5, pytorch 1.14 import os, sys import ipdb from collections import defaultdict #import dataloader as dl from options import opt from mscv.summary import write_loss import torch import torchvision import numpy as np import subprocess import random import torch.nn as nn import torch.nn.functional as F from ...
[ "loss.arc.ArcLoss", "sklearn.metrics.pairwise.cosine_similarity", "os.makedirs", "torch.autograd.Variable", "os.path.dirname", "numpy.zeros", "network.get_model", "os.path.exists", "numpy.where", "numpy.array", "torch.no_grad", "os.path.join", "os.listdir" ]
[((852, 872), 'network.get_model', 'get_model', (['opt.model'], {}), '(opt.model)\n', (861, 872), False, 'from network import get_model\n'), ((1121, 1130), 'loss.arc.ArcLoss', 'ArcLoss', ([], {}), '()\n', (1128, 1130), False, 'from loss.arc import ArcLoss\n'), ((2305, 2325), 'network.get_model', 'get_model', (['opt.mod...
""" Functions and classes for plotting simulation data .. autosummary:: :nosignatures: ScalarFieldPlot plot_magnitudes plot_kymograph plot_kymographs plot_interactive .. codeauthor:: <NAME> <<EMAIL>> """ import logging import time import warnings from typing import Any, Callable, Dict, List, Op...
[ "matplotlib.pyplot.suptitle", "ipywidgets.Output", "numpy.isclose", "numpy.zeros_like", "warnings.simplefilter", "matplotlib.pyplot.close", "matplotlib.ticker.MaxNLocator", "IPython.display.display", "matplotlib.pyplot.colorbar", "warnings.catch_warnings", "numpy.real", "matplotlib.pyplot.paus...
[((767, 794), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (784, 794), False, 'import logging\n'), ((1307, 1330), 'mpl_toolkits.axes_grid1.make_axes_locatable', 'make_axes_locatable', (['ax'], {}), '(ax)\n', (1326, 1330), False, 'from mpl_toolkits.axes_grid1 import make_axes_locatable\n...
#!/usr/bin/env python # coding: utf-8 # # Transformações da variável independente # # Neste notebook avaliaremos algumas transformações na variável independente. São elas: # # 1. Deslocamento no tempo # 2. Reflexão no tempo # 3. Mudança de escala no tempo # # Vamos analisar então uma por uma com alguns exemplos. #...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show", "numpy.flip", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.stem", "matplotlib.pyplot.figure", "numpy.sin", "sounddevice.play", "numpy.exp", "numpy.linspace", "numpy.cos", "mat...
[((1376, 1400), 'numpy.linspace', 'np.linspace', (['(-20)', '(20)', '(50)'], {}), '(-20, 20, 50)\n', (1387, 1400), True, 'import numpy as np\n'), ((1534, 1546), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1544, 1546), True, 'import matplotlib.pyplot as plt\n'), ((1547, 1587), 'matplotlib.pyplot.title',...
# cec2017.simple # Author: <NAME> # Simple function definitions, f1 to f10 from . import basic from . import transforms import numpy as np def f1(x, rotation=None, shift=None): """ Shifted and Rotated Bent Cigar Function Args: x (array): Input vector of dimension 2, 10, 20, 30, 50 or 100. ...
[ "numpy.matmul" ]
[((773, 803), 'numpy.matmul', 'np.matmul', (['rotation', '(x - shift)'], {}), '(rotation, x - shift)\n', (782, 803), True, 'import numpy as np\n'), ((1657, 1687), 'numpy.matmul', 'np.matmul', (['rotation', '(x - shift)'], {}), '(rotation, x - shift)\n', (1666, 1687), True, 'import numpy as np\n'), ((2371, 2401), 'numpy...
# coding=utf-8 # Copyright (c) DIRECT Contributors import numpy as np import torch __all__ = ( "fastmri_ssim", "fastmri_psnr", "fastmri_nmse", "calgary_campinas_ssim", "calgary_campinas_psnr", "calgary_campinas_vif", ) def _to_numpy(tensor): if isinstance(tensor, np.ndarray): retu...
[ "numpy.asarray", "sewar.full_ref.vifp", "numpy.array", "numpy.linalg.norm", "direct.utils.imports._module_available" ]
[((1431, 1456), 'numpy.linalg.norm', 'np.linalg.norm', (['(gt - pred)'], {}), '(gt - pred)\n', (1445, 1456), True, 'import numpy as np\n'), ((1464, 1482), 'numpy.linalg.norm', 'np.linalg.norm', (['gt'], {}), '(gt)\n', (1478, 1482), True, 'import numpy as np\n'), ((2846, 2872), 'direct.utils.imports._module_available', ...
#!/usr/bin/python #data/rail/atoc_gbrail_20160506_gtfs.zip #Numba #networkx #graph-tool from numba import jit import numpy as np import networkx as nx ################################################################################ def main(): print("Hello World!") x = np.arange(100).reshape(10, 10) @jit(nopy...
[ "numpy.tanh", "numba.jit", "numpy.arange" ]
[((312, 330), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (315, 330), False, 'from numba import jit\n'), ((279, 293), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (288, 293), True, 'import numpy as np\n'), ((562, 578), 'numpy.tanh', 'np.tanh', (['a[i, i]'], {}), '(a[i, i])\n', (56...
import random from datetime import datetime import models.ModelAdapter import utils from models import SegmentModel import tensorflow as tf from process import feature_builder, dataset import numpy as np from prepare import prepare_form_config flags = tf.flags FLAGS = flags.FLAGS ## Dataset Input parameters flags....
[ "process.dataset.CorpusWeightingDataset", "numpy.zeros_like", "numpy.random.seed", "prepare.prepare_form_config", "process.dataset.PaddingDataset", "tensorflow.logging.info", "tensorflow.global_variables_initializer", "numpy.argmax", "utils.printable_text", "tensorflow.Session", "datetime.dateti...
[((2488, 2514), 'prepare.prepare_form_config', 'prepare_form_config', (['FLAGS'], {}), '(FLAGS)\n', (2507, 2514), False, 'from prepare import prepare_form_config\n'), ((5771, 5787), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (5785, 5787), True, 'import tensorflow as tf\n'), ((13119, 13133), 'datetime...
#!/usr/bin/env/python3 # coding: utf-8 # ちゃんとutf-8で開いてくれよ>エディター import numpy as np import cv2 import copy import random import os import math from util import getgrayimage MARKER_REL = '../resources/marker_150.png' A4WIDTH_MM = 210 DOCSIZE = (191.7, 278.7) pathbase = os.path.dirname(os.path.abspath(__file__)) marke...
[ "os.path.abspath", "util.getgrayimage", "numpy.average", "cv2.warpPerspective", "cv2.circle", "math.atan2", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.threshold", "copy.copy", "cv2.imread", "cv2.connectedComponentsWithStats", "numpy.array", "cv2.minMaxLoc", "cv2.imshow", "os.path.joi...
[((390, 434), 'cv2.imread', 'cv2.imread', (['markerpath', 'cv2.IMREAD_GRAYSCALE'], {}), '(markerpath, cv2.IMREAD_GRAYSCALE)\n', (400, 434), False, 'import cv2\n'), ((288, 313), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (303, 313), False, 'import os\n'), ((345, 379), 'os.path.join', 'os.p...
#!/usr/bin/env python # Plot the softmax function. import matplotlib.pyplot as pl import numpy as np def softmax(a, t): e = np.exp((1.0 * np.array(a)) / t) return e / np.sum(e) T = [100, 5, 1] a = [3, 0, 1]; ind = [1, 2, 3] for i in range(len(T)): pl.bar(ind, softmax(a, T[i])) pl.ylim(0, 1) pl.title('T =...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.ylim", "numpy.array", "matplotlib.pyplot.savefig" ]
[((291, 304), 'matplotlib.pyplot.ylim', 'pl.ylim', (['(0)', '(1)'], {}), '(0, 1)\n', (298, 304), True, 'import matplotlib.pyplot as pl\n'), ((307, 332), 'matplotlib.pyplot.title', 'pl.title', (["('T = %d' % T[i])"], {}), "('T = %d' % T[i])\n", (315, 332), True, 'import matplotlib.pyplot as pl\n'), ((335, 374), 'matplot...
""" Plot ScoCen in (l, b) coordinates, stars for each component with different colours resembling component age. """ import numpy as np from astropy.table import Table from astropy import units as u import matplotlib.pyplot as plt import matplotlib.ticker as ticker import matplotlib.cm as cm import matplotlib as mpl i...
[ "astropy.table.Table.read", "matplotlib.pyplot.show", "copy.copy", "chronostar.component.SphereComponent.load_raw_components", "numpy.argsort", "matplotlib.pyplot.ion", "matplotlib.pyplot.figure", "numpy.where", "numpy.array", "numpy.logical_or", "matplotlib.pyplot.gca", "matplotlib.ticker.Mul...
[((375, 384), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (382, 384), True, 'import matplotlib.pyplot as plt\n'), ((780, 813), 'copy.copy', 'copy.copy', (['lib.exclude_components'], {}), '(lib.exclude_components)\n', (789, 813), False, 'import copy\n'), ((1569, 1596), 'numpy.where', 'np.where', (["(tab['l'] <...
""" @author: <NAME> """ import cv2 import numpy as np from inference import Network #cpu extension path CPU_EXTENSION = "/opt/intel/openvino/deployment_tools/inference_engine/lib/intel64/libcpu_extension_sse4.so" #path of converted skin disease model in xml MODEL = "model/model_tf.xml" SKIN_CLASSES = { 0: 'akiec...
[ "numpy.copy", "numpy.argmax", "numpy.expand_dims", "inference.Network", "cv2.imread", "cv2.resize" ]
[((648, 668), 'numpy.copy', 'np.copy', (['input_image'], {}), '(input_image)\n', (655, 668), True, 'import numpy as np\n'), ((681, 715), 'cv2.resize', 'cv2.resize', (['image', '(width, height)'], {}), '(image, (width, height))\n', (691, 715), False, 'import cv2\n'), ((902, 911), 'inference.Network', 'Network', ([], {})...
import os import json import random import math import optim import model import itertools import argparse import logging import numpy as np from pathlib import Path from collections import defaultdict from nltk.corpus import wordnet, stopwords import torch import torch.nn as nn from torch import cuda from torch.utils....
[ "argparse.ArgumentParser", "dataset.EmbDataset", "random.shuffle", "collections.defaultdict", "pathlib.Path", "gensim.models.KeyedVectors.load_word2vec_format", "optim.Optim", "gensim.utils.to_utf8", "torch.nn.MSELoss", "model.Decoder", "model.parameters", "nltk.corpus.wordnet.synsets", "ran...
[((504, 529), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (527, 529), False, 'import argparse\n'), ((1491, 1508), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1502, 1508), False, 'from collections import defaultdict\n'), ((2100, 2162), 'optim.Optim', 'optim.Optim', ...
"""NECSTDB, a database for NECST. NECST, an abbreviation of *NEw Control System for Telescope*, is a flexible controlling system for radio telescopes. Its efficient data storage format is provided here. The database contains tables, which keep individual topic of data with some metadata attached to them, e.g. spectral ...
[ "pandas.DataFrame", "json.dump", "json.load", "pandas.DataFrame.from_dict", "numpy.frombuffer", "numpy.dtype", "struct.iter_unpack", "struct.unpack", "struct.calcsize", "struct.pack", "pathlib.Path", "tarfile.open" ]
[((3207, 3238), 'tarfile.open', 'tarfile.open', (['saveto'], {'mode': 'mode'}), '(saveto, mode=mode)\n', (3219, 3238), False, 'import tarfile\n'), ((5908, 5936), 'struct.calcsize', 'struct.calcsize', (['self.format'], {}), '(self.format)\n', (5923, 5936), False, 'import struct\n'), ((12258, 12290), 'pandas.DataFrame.fr...
# -*- coding: utf-8 -*- """ Created on Sat Apr 18 21:55:39 2020 @author: Xavier """ import matplotlib.pyplot as plt import cartopy.crs as ccrs import cartopy.feature as cfeature from matplotlib.offsetbox import AnchoredText import numpy as np # =========================================================================...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "numpy.deg2rad", "matplotlib.pyplot.figure", "numpy.linspace", "cartopy.crs.PlateCarree" ]
[((325, 337), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (335, 337), True, 'import matplotlib.pyplot as plt\n'), ((841, 851), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (849, 851), True, 'import matplotlib.pyplot as plt\n'), ((940, 965), 'numpy.linspace', 'np.linspace', (['(-80)', '(170)',...
#!/usr/bin/env python3 # Copyright (C) Alibaba Group Holding Limited. """Runs submission split with the trained video classification model.""" import numpy as np import os import pickle import torch import json import utils.bucket as bu import utils.checkpoint as cu import utils.distributed as du import utils.loggi...
[ "json.dump", "numpy.random.seed", "datasets.base.builder.build_loader", "os.path.join", "utils.misc.get_num_gpus", "torch.manual_seed", "models.base.builder.build_model", "utils.distributed.is_master_proc", "utils.misc.log_model_info", "utils.logging.get_logger", "utils.bucket.initialize_bucket"...
[((514, 542), 'utils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (532, 542), True, 'import utils.logging as logging\n'), ((545, 560), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (558, 560), False, 'import torch\n'), ((8808, 8841), 'utils.distributed.init_distributed_training',...
# Much of the code to load the MNIST dataset from the zip files was taken from # the tensorflow source. from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import os import time # Package imports from dataset_loading import core, utils from ...
[ "dataset_loading.utils.convert_to_one_hot", "os.makedirs", "numpy.frombuffer", "numpy.dtype", "os.path.exists", "time.sleep", "numpy.split", "numpy.random.randint", "dataset_loading.utils.md5", "gzip.GzipFile", "dataset_loading.core.ImgQueue", "dataset_loading.utils.download", "os.path.join"...
[((900, 936), 'os.makedirs', 'os.makedirs', (['data_dir'], {'exist_ok': '(True)'}), '(data_dir, exist_ok=True)\n', (911, 936), False, 'import os\n'), ((5389, 5425), 'os.path.join', 'os.path.join', (['data_dir', 'TRAIN_IMAGES'], {}), '(data_dir, TRAIN_IMAGES)\n', (5401, 5425), False, 'import os\n'), ((5521, 5557), 'os.p...
from torchsummary import summary from experiment.DefaultExperimentConfiguration import DefaultExperimentConfiguration from datasetLoaders.loaders import DatasetLoaderMNIST, DatasetLoaderCOVIDx, DatasetLoaderDiabetes, \ DatasetLoaderHeartDisease from classifiers import MNIST, CovidNet, CNN, Diabetes, HeartDisease f...
[ "aggregators.allAggregators", "numpy.random.seed", "logger.logPrint", "matplotlib.pyplot.show", "torch.manual_seed", "torch.cuda.manual_seed", "datasetLoaders.loaders.DatasetLoaderMNIST", "datasetLoaders.loaders.DatasetLoaderCOVIDx", "datasetLoaders.loaders.DatasetLoaderHeartDisease", "time.time",...
[((3945, 3976), 'logger.logPrint', 'logPrint', (['"""Creating clients..."""'], {}), "('Creating clients...')\n", (3953, 3976), False, 'from logger import logPrint\n'), ((5690, 5707), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (5701, 5707), False, 'import random\n'), ((5712, 5732), 'numpy.random.seed', 'n...
"""Define different solvers that solve a scalarized version of a MOO problem. """ import abc import logging import logging.config from abc import abstractmethod from os import path from typing import Any, Optional, Tuple, Union import numpy as np from desdeov2.problem.Problem import ProblemBase from desdeov2.solver....
[ "os.path.abspath", "logging.getLogger", "numpy.any", "numpy.dot", "logging.config.fileConfig", "numpy.all" ]
[((537, 615), 'logging.config.fileConfig', 'logging.config.fileConfig', ([], {'fname': 'log_conf_path', 'disable_existing_loggers': '(False)'}), '(fname=log_conf_path, disable_existing_loggers=False)\n', (562, 615), False, 'import logging\n'), ((625, 652), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '...
import numpy as np import cv2 background = np.zeros((500, 500, 4), dtype='uint8') # to create a black background .zeros((pt1,pt1,channels), dtype='8-bit signed integer') font = cv2.FONT_HERSHEY_DUPLEX # define the font cv2.putText(background, "RUDRA", (50, 200), font, 4, (255, 255, 255), 3, cv2.LINE_8) cv2.putText(b...
[ "cv2.putText", "cv2.waitKey", "cv2.imshow", "numpy.zeros", "cv2.destroyAllWindows" ]
[((44, 82), 'numpy.zeros', 'np.zeros', (['(500, 500, 4)'], {'dtype': '"""uint8"""'}), "((500, 500, 4), dtype='uint8')\n", (52, 82), True, 'import numpy as np\n'), ((222, 310), 'cv2.putText', 'cv2.putText', (['background', '"""RUDRA"""', '(50, 200)', 'font', '(4)', '(255, 255, 255)', '(3)', 'cv2.LINE_8'], {}), "(backgro...
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.spectral_norm as SpectralNorm class ConvBlock(nn.Module): def __init__(self, ni, no, ks, stride, pad = None, use_bn = True, use_pixelshuffle = False, norm_type = 'batchnorm', activation_type = 'leak...
[ "torch.bmm", "torch.nn.InstanceNorm2d", "torch.nn.Softmax", "torch.nn.functional.avg_pool2d", "torch.nn.init.xavier_uniform", "torch.nn.Linear", "torch.nn.AvgPool2d", "torch.nn.PixelShuffle", "torch.nn.Tanh", "torch.nn.Conv2d", "torch.nn.BatchNorm2d", "torch.nn.ELU", "torch.nn.SELU", "torc...
[((1853, 1940), 'torch.nn.ConvTranspose2d', 'nn.ConvTranspose2d', (['ni', 'no', 'ks', 'stride', 'pad'], {'output_padding': 'output_pad', 'bias': '(False)'}), '(ni, no, ks, stride, pad, output_padding=output_pad, bias\n =False)\n', (1871, 1940), True, 'import torch.nn as nn\n'), ((2818, 2891), 'torch.nn.functional.in...
import numpy as np import itertools as it from .utilities import is_equivalent_atom def test_get_new_atoms(case_data): """ Test that correct atoms are added by a :class:`.Reaction`. Parameters ---------- case_data : :class:`.CaseData` A test case. Includes the reaction to be tested and t...
[ "numpy.allclose" ]
[((1149, 1194), 'numpy.allclose', 'np.allclose', (['position1', 'position1'], {'atol': '(1e-32)'}), '(position1, position1, atol=1e-32)\n', (1160, 1194), True, 'import numpy as np\n')]
from matplotlib import cm import matplotlib.pyplot as plt import numpy as np from satlas.relaxation import KorringaRelaxation from satlas.utilities import ReleaseCurve import seaborn as sns sns.set_style('ticks', rc={'xtick.direction': 'in', 'ytick.direction': 'in'}) sns.set_palette('colorblind') # Needed for interac...
[ "seaborn.set_style", "numpy.meshgrid", "matplotlib.pyplot.show", "satlas.relaxation.KorringaRelaxation", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.linspace", "seaborn.set_palette", "satlas.utilities.ReleaseCurve", "matplotlib.pyplot.tight_layout" ]
[((192, 269), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {'rc': "{'xtick.direction': 'in', 'ytick.direction': 'in'}"}), "('ticks', rc={'xtick.direction': 'in', 'ytick.direction': 'in'})\n", (205, 269), True, 'import seaborn as sns\n'), ((270, 299), 'seaborn.set_palette', 'sns.set_palette', (['"""colorblind...
#!/usr/bin/python3 ''' <NAME> 7/29/2020 <NAME> 1/30/2014 Inspired by: http://www.zincland.com/hypocycloid Implemented from: 'Gear geometry of cycloid drives', <NAME> et al. http://download.springer.com/static/pdf/96/art%253A10.1007%252Fs11431-008-0055-3.pdf Equations 10, 11 ''' import numpy as np import matplotlib....
[ "matplotlib.pyplot.show", "numpy.arctan2", "matplotlib.pyplot.plot", "matplotlib.pyplot.axis", "ezdxf.new", "numpy.sin", "numpy.array", "numpy.cos", "numpy.sign", "ezdxf.math.Matrix44.z_rotate", "matplotlib.pyplot.grid", "numpy.concatenate" ]
[((4843, 4860), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (4851, 4860), True, 'import matplotlib.pyplot as plt\n'), ((4865, 4879), 'matplotlib.pyplot.grid', 'plt.grid', (['(True)'], {}), '(True)\n', (4873, 4879), True, 'import matplotlib.pyplot as plt\n'), ((4884, 4914), 'matplotlib.py...
import numpy as np import pandas as pd from matplotlib.transforms import Affine2D as AffineMPL from renderapi.stack import get_stack_bounds from renderapi.transform import AffineModel as AffineRender from .render_pandas import create_stack_DataFrame, create_stack_from_DataFrame __all__ = ['AffineMPL_2_AffineRender'...
[ "renderapi.transform.AffineModel", "renderapi.stack.get_stack_bounds", "numpy.abs", "matplotlib.transforms.Affine2D" ]
[((540, 554), 'renderapi.transform.AffineModel', 'AffineRender', ([], {}), '()\n', (552, 554), True, 'from renderapi.transform import AffineModel as AffineRender\n'), ((1183, 1230), 'renderapi.stack.get_stack_bounds', 'get_stack_bounds', ([], {'stack': 'stack_in', 'render': 'render'}), '(stack=stack_in, render=render)\...
import numpy as np import time def write_csv(file, array, dim, start, stop): """This fonction writes an array in csv format. Inputs: -file: A string containning the name of the csv file. -array: A matrix-like array containing the data to be written. -dim: The number of col...
[ "numpy.random.seed", "numpy.zeros", "time.time", "numpy.random.randint", "numpy.array_equal" ]
[((2005, 2043), 'numpy.zeros', 'np.zeros', (['(stop - start, 1)'], {'dtype': 'int'}), '((stop - start, 1), dtype=int)\n', (2013, 2043), True, 'import numpy as np\n'), ((1171, 1191), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1185, 1191), True, 'import numpy as np\n'), ((2219, 2253), 'numpy.arra...
#Adapted from https://www.pyimagesearch.com/2020/03/09/grad-cam-visualize-class-activation-maps-with-keras-tensorflow-and-deep-learning/ import numpy as np import cv2 import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.keras.preprocessing.image import img_to_array, load_img from tensorflow.keras.m...
[ "numpy.argmax", "tensorflow.multiply", "matplotlib.pyplot.figure", "matplotlib.pyplot.tight_layout", "cv2.cvtColor", "matplotlib.pyplot.imshow", "tensorflow.keras.preprocessing.image.load_img", "tensorflow.cast", "cv2.resize", "tensorflow.keras.preprocessing.image.img_to_array", "tensorflow.redu...
[((3576, 3596), 'cv2.imread', 'cv2.imread', (['img_path'], {}), '(img_path)\n', (3586, 3596), False, 'import cv2\n'), ((3753, 3864), 'tensorflow.keras.preprocessing.image.load_img', 'load_img', (['img_path'], {'target_size': "(img_params['img_height'], img_params['img_width'])", 'color_mode': 'color_mode'}), "(img_path...
import socket, cv2, pickle, struct import threading import numpy as np import math from ctypes import cast, POINTER from comtypes import CLSCTX_ALL from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume import HandTrackingModule as htm # initializing server sock = socket.socket(socket.AF_INET, socket.SOCK_STREA...
[ "pickle.loads", "threading.Thread", "threading.active_count", "cv2.Canny", "cv2.putText", "pickle.dumps", "cv2.circle", "cv2.line", "math.hypot", "socket.socket", "struct.unpack", "struct.calcsize", "HandTrackingModule.handDetector", "socket.gethostbyname", "socket.gethostname", "pycaw...
[((273, 322), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (286, 322), False, 'import socket, cv2, pickle, struct\n'), ((335, 355), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (353, 355), False, 'import socket, cv2, pickle,...
""" Test module for confusion_matrix utils (emloop.utils.confusion_matrix). """ import numpy as np import pytest from emloop.utils.confusion_matrix import confusion_matrix _INVALID_INPUTS = [(np.array([0]), np.array([0]), 'a', TypeError), ([0], np.array([0]), 3, AttributeError), ...
[ "emloop.utils.confusion_matrix.confusion_matrix", "pytest.raises", "numpy.array", "numpy.testing.assert_equal", "pytest.mark.parametrize" ]
[((1062, 1127), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exp, pred, num, error"""', '_INVALID_INPUTS'], {}), "('exp, pred, num, error', _INVALID_INPUTS)\n", (1085, 1127), False, 'import pytest\n'), ((2205, 2269), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exp, pred, num, output"""', ...
import numpy as np import vegas import scipy # parametrization of lattice data & susceptibilities from EoS_HRG.fit_lattice import param, list_chi, BQS # import from __init__.py from . import * ######################################################################## def DQPM_s(T,muB,muQ,muS,**kwargs): """...
[ "vegas.Integrator", "numpy.zeros_like", "numpy.heaviside", "EoS_HRG.fit_lattice.param", "numpy.zeros", "numpy.arange", "scipy.interpolate.RegularGridInterpolator", "numpy.linspace" ]
[((4999, 5023), 'numpy.arange', 'np.arange', (['T0', '(1.0)', '(0.01)'], {}), '(T0, 1.0, 0.01)\n', (5008, 5023), True, 'import numpy as np\n'), ((805, 837), 'vegas.Integrator', 'vegas.Integrator', (['[[pmin, pmax]]'], {}), '([[pmin, pmax]])\n', (821, 837), False, 'import vegas\n'), ((2824, 2856), 'vegas.Integrator', 'v...
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import quantecon import numpy as np import scipy import pandas as pd import matplotlib.pyplot as plt from scipy.stats import gaussian_kde import statsmodels.api as sm from statsmodels.tsa.arima_model import ARIMA #Import/manipulate data p...
[ "numpy.linalg.eigvals", "statsmodels.tsa.arima_model.ARIMA", "numpy.ones", "quantecon.solve_discrete_riccati", "numpy.random.normal", "scipy.linalg.schur", "numpy.asscalar", "numpy.identity", "numpy.linalg.eig", "numpy.linspace", "matplotlib.pyplot.show", "quantecon.robustlq.RBLQ", "scipy.st...
[((383, 433), 'pandas.read_excel', 'pd.read_excel', (["(path + 'D_FER_Var.xls')"], {'header': 'None'}), "(path + 'D_FER_Var.xls', header=None)\n", (396, 433), True, 'import pandas as pd\n'), ((442, 492), 'pandas.read_excel', 'pd.read_excel', (["(path + 'D_SER_Var.xls')"], {'header': 'None'}), "(path + 'D_SER_Var.xls', ...
#! -*- coding:utf-8 -*- # 三元组抽取任务,基于GlobalPointer的仿TPLinker设计 # 文章介绍:https://kexue.fm/archives/8888 # 数据集:http://ai.baidu.com/broad/download?dataset=sked # 最优f1=0.827 # 说明:由于使用了EMA,需要跑足够多的步数(5000步以上)才生效,如果 # 你的数据总量比较少,那么请务必跑足够多的epoch数,或者去掉EMA。 import json import numpy as np from bert4keras.backend import keras, K...
[ "bert4keras.models.build_transformer_model", "bert4keras.layers.GlobalPointer", "tqdm.tqdm", "json.loads", "bert4keras.tokenizers.Tokenizer", "bert4keras.backend.keras.models.Model", "bert4keras.backend.K.shape", "bert4keras.snippets.to_array", "bert4keras.optimizers.extend_with_exponential_moving_a...
[((1860, 1900), 'bert4keras.tokenizers.Tokenizer', 'Tokenizer', (['dict_path'], {'do_lower_case': '(True)'}), '(dict_path, do_lower_case=True)\n', (1869, 1900), False, 'from bert4keras.tokenizers import Tokenizer\n'), ((5321, 5433), 'bert4keras.models.build_transformer_model', 'build_transformer_model', ([], {'config_p...
import numpy as np import math import os class lazy_cartesian_product: def __init__(self, sets): self.sets = sets self.divs = [] self.mods = [] self.max_size = 1 self.precompute() def precompute(self): for i in self.sets: self.max_size = self.max_si...
[ "os.makedirs", "math.sqrt", "os.getcwd", "numpy.empty", "os.path.exists", "math.floor", "numpy.isnan", "numpy.array", "math.isclose", "os.path.join" ]
[((1295, 1306), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1304, 1306), False, 'import os\n'), ((1329, 1371), 'os.path.join', 'os.path.join', (['current_directory', '"""results"""'], {}), "(current_directory, 'results')\n", (1341, 1371), False, 'import os\n'), ((2227, 2261), 'numpy.empty', 'np.empty', (['(max_peaks, ...
import warnings from hypothesis import given from hypothesis.errors import HypothesisDeprecationWarning from hypothesis.extra.numpy import arrays import numpy import pytest from fragile.core.functions import relativize from fragile.core.states import StatesEnv, StatesModel, StatesWalkers from fragile.core.utils impor...
[ "numpy.full", "hypothesis.extra.numpy.arrays", "numpy.zeros_like", "numpy.sum", "fragile.core.states.StatesWalkers", "warnings.filterwarnings", "pytest.fixture", "numpy.zeros", "numpy.errstate", "numpy.ones", "pytest.raises", "fragile.core.walkers.Walkers", "numpy.arange", "numpy.all" ]
[((394, 466), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'HypothesisDeprecationWarning'}), "('ignore', category=HypothesisDeprecationWarning)\n", (417, 466), False, 'import warnings\n'), ((470, 486), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (484, 486), False, 'imp...
import json import pymongo import logging import numpy as np import pandas as pd from utils.nlp_utils import stop_words from config import Configuration from .base import FeatureTask from utils.nlp_utils import WordParser from tasks.collectors.revision import CollectRevisions config = Configuration() word_parser = Wo...
[ "pandas.DataFrame", "logging.error", "json.loads", "logging.basicConfig", "utils.nlp_utils.stop_words", "utils.nlp_utils.WordParser", "tasks.collectors.revision.CollectRevisions", "numpy.mean", "config.Configuration" ]
[((288, 303), 'config.Configuration', 'Configuration', ([], {}), '()\n', (301, 303), False, 'from config import Configuration\n'), ((318, 330), 'utils.nlp_utils.WordParser', 'WordParser', ([], {}), '()\n', (328, 330), False, 'from utils.nlp_utils import WordParser\n'), ((331, 494), 'logging.basicConfig', 'logging.basic...
from typing import Tuple import numpy as np import faiss # https://samnicholls.net/2016/06/15/how-to-sphinx-readthedocs/ class Embedding: def __init__(self,lang,dim,word,id,vector,embeddings): self.lang =lang self.dim= dim self.word =word self.id = id self.vector = vector ...
[ "faiss.GpuIndexFlatIP", "numpy.asarray", "faiss.GpuIndexFlatConfig", "faiss.StandardGpuResources", "faiss.IndexFlatIP", "numpy.array", "numpy.linalg.norm", "numpy.dot" ]
[((761, 805), 'numpy.dot', 'np.dot', (['self.vector', 'target_embedding.vector'], {}), '(self.vector, target_embedding.vector)\n', (767, 805), True, 'import numpy as np\n'), ((4540, 4572), 'numpy.array', 'np.array', (['self.embeddings_matrix'], {}), '(self.embeddings_matrix)\n', (4548, 4572), True, 'import numpy as np\...
import math import numpy def squared_distance(a, b): return sum((aa-bb)**2 for aa,bb in zip(a,b)) def metric_close_enough(a, b, tolerance): return squared_distance(a,b) <= tolerance**2 def matrix_angle_close_enough(a, b, max_angular_distance): trace_threshold = 1. + 2. * math.cos(max_angular_distance) ...
[ "numpy.trace", "numpy.allclose", "numpy.linalg.norm", "math.cos", "numpy.linalg.det" ]
[((342, 356), 'numpy.trace', 'numpy.trace', (['r'], {}), '(r)\n', (353, 356), False, 'import numpy\n'), ((490, 520), 'math.cos', 'math.cos', (['max_angular_distance'], {}), '(max_angular_distance)\n', (498, 520), False, 'import math\n'), ((744, 783), 'numpy.allclose', 'numpy.allclose', (['a', 'b'], {'rtol': '(0)', 'ato...
import argparse import gzip import numpy as np import os import pickle from matplotlib import pyplot as plt from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument('--data-dir', required=True, type=str, default=None) args = parser.parse_args() assert (args.data_dir is not None) and (o...
[ "numpy.random.uniform", "tqdm.tqdm", "pickle.dump", "gzip.open", "argparse.ArgumentParser", "matplotlib.pyplot.show", "os.path.isdir", "numpy.frombuffer", "numpy.zeros", "matplotlib.pyplot.subplots", "numpy.hstack", "os.path.join", "numpy.vstack" ]
[((150, 175), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (173, 175), False, 'import argparse\n'), ((319, 347), 'os.path.isdir', 'os.path.isdir', (['args.data_dir'], {}), '(args.data_dir)\n', (332, 347), False, 'import os\n'), ((1604, 1642), 'numpy.vstack', 'np.vstack', (['(train_images, tes...
import unittest from typing import Dict from unittest.mock import Mock, patch import numpy as np import numpy.typing as npt from nuplan.database.nuplan_db.vector_map_np import VectorMapNp class TestVectorMapNp(unittest.TestCase): """ Tests the VectorMapNp class """ def setUp(self) -> None: ...
[ "unittest.main", "unittest.mock.Mock", "numpy.ones", "unittest.mock.patch", "nuplan.database.nuplan_db.vector_map_np.VectorMapNp", "numpy.array", "numpy.array_equal" ]
[((1045, 1115), 'unittest.mock.patch', 'patch', (['"""nuplan.database.nuplan_db.vector_map_np.np.dot"""'], {'autospec': '(True)'}), "('nuplan.database.nuplan_db.vector_map_np.np.dot', autospec=True)\n", (1050, 1115), False, 'from unittest.mock import Mock, patch\n'), ((1121, 1199), 'unittest.mock.patch', 'patch', (['""...
import os, sys from tqdm import tqdm, trange import numpy as np import matplotlib.pyplot as plt source_path = '/export/scratch/bbrattol/behavior_analysis_demo/humans/magnification/magnification_pervideo_flow/' speed = '1kmh' speed = '2kmh' speed = '3kmh' dest_path = 'res_'+speed if not os.path.exists(dest_path): ...
[ "tqdm.tqdm", "numpy.load", "os.makedirs", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.pyplot.ylim", "matplotlib.pyplot.close", "numpy.power", "os.path.exists", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.xticks", "os.listdir", "matplotlib.pyplot.savefig...
[((522, 538), 'numpy.array', 'np.array', (['videos'], {}), '(videos)\n', (530, 538), True, 'import numpy as np\n'), ((543, 581), 'numpy.array', 'np.array', (["[('H' in v) for v in videos]"], {}), "([('H' in v) for v in videos])\n", (551, 581), True, 'import numpy as np\n'), ((584, 626), 'numpy.array', 'np.array', (["[(...
def limiar2 (Filter): ### Imports import numpy as np import matplotlib.pyplot as plt import math as m import navFunc as nf # Load image into numpy matrix A = Filter.img size = nf.structtype() size.A = nf.structtype() size.A.lin, size.A.col = A.shape #######...
[ "numpy.uint8", "numpy.zeros", "numpy.min", "numpy.max", "navFunc.structtype" ]
[((222, 237), 'navFunc.structtype', 'nf.structtype', ([], {}), '()\n', (235, 237), True, 'import navFunc as nf\n'), ((252, 267), 'navFunc.structtype', 'nf.structtype', ([], {}), '()\n', (265, 267), True, 'import navFunc as nf\n'), ((353, 362), 'numpy.min', 'np.min', (['A'], {}), '(A)\n', (359, 362), True, 'import numpy...
import unittest import numpy as np from mobile_handset_price_model.prediction.transformers import BooleanTransformer class TransformersTests(unittest.TestCase): def test_boolean_transformer(self): # arrange boolean_transformer = BooleanTransformer(true_value=1, false_value=0) X = [[1], [...
[ "unittest.main", "numpy.array", "mobile_handset_price_model.prediction.transformers.BooleanTransformer" ]
[((1358, 1373), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1371, 1373), False, 'import unittest\n'), ((253, 300), 'mobile_handset_price_model.prediction.transformers.BooleanTransformer', 'BooleanTransformer', ([], {'true_value': '(1)', 'false_value': '(0)'}), '(true_value=1, false_value=0)\n', (271, 300), Fal...
import pandas as pd import numpy as np from sklearn.decomposition import NMF movies = [ '<NAME> (1993)', '<NAME> (1993)', 'Silence of the Lambs, The (1991)', '101 Dalmatians (1996)', 'Gladiator (2000)', 'Ghostbusters (a.k.a. Ghost Busters) (1984)', 'Fargo (1996)', 'Minority Report (2002)', '2 Fast 2 Furious (Fast and...
[ "pandas.DataFrame", "sklearn.decomposition.NMF", "pandas.read_csv", "numpy.isnan", "numpy.dot" ]
[((432, 473), 'pandas.read_csv', 'pd.read_csv', (['"""../project/data/movies.csv"""'], {}), "('../project/data/movies.csv')\n", (443, 473), True, 'import pandas as pd\n'), ((491, 533), 'pandas.read_csv', 'pd.read_csv', (['"""../project/data/ratings.csv"""'], {}), "('../project/data/ratings.csv')\n", (502, 533), True, '...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # region Packages & Setup from __future__ import absolute_import, division, print_function, unicode_literals import json import pandas as pd import tensorflow_datasets as tfds import tensorflow as tf import numpy as np import os.path import argparse from transformer impor...
[ "beam_search.beam_search", "transformer.Transformer", "argparse.ArgumentParser", "tensorflow_datasets.load", "tensorflow.train.Checkpoint", "pandas.DataFrame.from_dict", "transformer.create_masks", "tensorflow.tile", "numpy.mean", "tensorflow.train.latest_checkpoint", "nltk.download", "nltk.wo...
[((396, 418), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (409, 418), False, 'import nltk\n'), ((453, 478), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (476, 478), False, 'import argparse\n'), ((2529, 2698), 'transformer.Transformer', 'Transformer', (['num_layers'...
# -*- coding: utf-8 -*- # BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules # Copyright (C) 2020-2021, <NAME> <<EMAIL>> # # This module is under the UIUC open-source license. See # github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt # for license details. """ This module conta...
[ "numpy.log", "numpy.ceil", "math.ceil", "biosteam.utils.remove_undefined_chemicals", "thermosteam.separations.mix_and_split_with_moisture_content", "math.log", "numpy.exp", "biosteam.SolidsSeparator.__init__", "biosteam.utils.default_chemical_dict" ]
[((2345, 2454), 'thermosteam.separations.mix_and_split_with_moisture_content', 'separations.mix_and_split_with_moisture_content', (['self.ins', '*self.outs', 'self.split', 'self.moisture_content'], {}), '(self.ins, *self.outs, self.\n split, self.moisture_content)\n', (2392, 2454), False, 'from thermosteam import se...
from __future__ import division, print_function, absolute_import import matplotlib matplotlib.use("Cairo") from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np from matplotlib import cm def add_spot(x, y, z, star_radius, spot_phi, spot_theta, spot_radius): spot_center_uv = n...
[ "numpy.size", "numpy.empty", "numpy.arcsin", "matplotlib.pyplot.figure", "matplotlib.use", "numpy.array", "numpy.sin", "numpy.linspace", "numpy.cos", "numpy.broadcast_arrays", "matplotlib.pyplot.savefig", "numpy.sqrt" ]
[((84, 107), 'matplotlib.use', 'matplotlib.use', (['"""Cairo"""'], {}), "('Cairo')\n", (98, 107), False, 'import matplotlib\n'), ((319, 351), 'numpy.array', 'np.array', (['[spot_phi, spot_theta]'], {}), '([spot_phi, spot_theta])\n', (327, 351), True, 'import numpy as np\n'), ((817, 862), 'numpy.sqrt', 'np.sqrt', (['(x_...
import matplotlib.pyplot as plt import meep as mp import numpy as np from gdsfactory import add_padding from gdsfactory.components import straight from gdsfactory.simulation.gmeep import get_simulation from gdsfactory.simulation.modes.types import Mode ''' CURRENTLY UNUSED -- will be useful once the MEEP conda packag...
[ "numpy.meshgrid", "gdsfactory.simulation.modes.types.Mode", "matplotlib.pyplot.show", "meep.Vector3", "numpy.zeros", "meep.Volume", "gdsfactory.simulation.gmeep.get_simulation", "numpy.linspace", "gdsfactory.components.straight" ]
[((4251, 4283), 'numpy.meshgrid', 'np.meshgrid', (['y', 'z'], {'indexing': '"""ij"""'}), "(y, z, indexing='ij')\n", (4262, 4283), True, 'import numpy as np\n'), ((4292, 4334), 'numpy.zeros', 'np.zeros', (['[ny, nz, 1, 3]'], {'dtype': 'np.cdouble'}), '([ny, nz, 1, 3], dtype=np.cdouble)\n', (4300, 4334), True, 'import nu...
"""This module contains classes for policy regularization. """ import numpy as np def parse_regularizer(policy, spec): if 'type' not in spec: raise ValueError('Regularizer spec must specify type!') regularizer_type = spec.pop('type') lookup = {'L2': ParameterL2Regularizer} if regularizer_typ...
[ "numpy.dot" ]
[((1167, 1187), 'numpy.dot', 'np.dot', (['theta', 'theta'], {}), '(theta, theta)\n', (1173, 1187), True, 'import numpy as np\n')]
from __future__ import print_function import time import math import numpy as np import MultiNEAT as NEAT from pykdtree.kdtree import KDTree from coral_growth.simulate import simulate_genome from coral_growth.evolution import * def calculate_sparseness(archive, feature_list, k): feature_arr = np.array(feature_lis...
[ "numpy.mean", "numpy.array", "math.sqrt", "MultiNEAT.GetGenomeList" ]
[((300, 322), 'numpy.array', 'np.array', (['feature_list'], {}), '(feature_list)\n', (308, 322), True, 'import numpy as np\n'), ((459, 488), 'numpy.mean', 'np.mean', (['dists[:, 1:]'], {'axis': '(1)'}), '(dists[:, 1:], axis=1)\n', (466, 488), True, 'import numpy as np\n'), ((861, 884), 'MultiNEAT.GetGenomeList', 'NEAT....
import unittest import numpy as np import pytest from scipy.sparse import csr_matrix, random from implicit.als import AlternatingLeastSquares from implicit.gpu import HAS_CUDA from .recommender_base_test import RecommenderBaseTestMixin class ALSTest(unittest.TestCase, RecommenderBaseTestMixin): def _get_model(...
[ "numpy.sum", "scipy.sparse.random", "numpy.ones", "numpy.isfinite", "scipy.sparse.csr_matrix", "pytest.mark.parametrize", "implicit.als.AlternatingLeastSquares", "pytest.approx" ]
[((678, 752), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_gpu"""', '([True, False] if HAS_CUDA else [False])'], {}), "('use_gpu', [True, False] if HAS_CUDA else [False])\n", (701, 752), False, 'import pytest\n'), ((970, 1022), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_native"""...
#!/usr/bin/env python # coding: utf-8 # In[ ]: # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load in import numpy as np # linear algebra i...
[ "numpy.ones", "keras.models.Model", "skimage.transform.resize", "glob.glob", "keras.layers.Input", "keras.layers.convolutional.UpSampling2D", "matplotlib.pyplot.close", "numpy.random.choice", "numpy.add", "matplotlib.pyplot.subplots", "datetime.datetime.now", "matplotlib.pyplot.show", "keras...
[((9188, 9205), 'keras.optimizers.Adam', 'Adam', (['(0.0002)', '(0.5)'], {}), '(0.0002, 0.5)\n', (9192, 9205), False, 'from keras.optimizers import Adam\n'), ((9506, 9528), 'keras.layers.Input', 'Input', ([], {'shape': 'img_shape'}), '(shape=img_shape)\n', (9511, 9528), False, 'from keras.layers import Input, Dense, Re...
# The example function below keeps track of the opponent's history and plays whatever the opponent played two plays ago. It is not a very good player so you will need to change the code to pass the challenge. import numpy as np from itertools import product # global storage matrix = {} states = ['R', 'P', 'S'] guesses...
[ "numpy.array", "itertools.product" ]
[((1640, 1655), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (1648, 1655), True, 'import numpy as np\n'), ((940, 956), 'numpy.array', 'np.array', (['states'], {}), '(states)\n', (948, 956), True, 'import numpy as np\n'), ((1479, 1506), 'itertools.product', 'product', (['list'], {'repeat': 'order'}), '(list,...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2014, Ocean Systems Laboratory, Heriot-Watt University, UK. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the follow...
[ "numpy.set_printoptions", "numpy.random.seed", "numpy.maximum", "numpy.dot", "numpy.zeros", "numpy.clip", "numpy.rad2deg", "vehicle_core.model.vehicle_model.VehicleModel", "numpy.sin", "numpy.array", "numpy.random.normal", "numpy.cos", "vehicle_core.model.dynamic_model.update_jacobian", "n...
[((2597, 2644), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(True)'}), '(precision=3, suppress=True)\n', (2616, 2644), True, 'import numpy as np\n'), ((3940, 3969), 'numpy.zeros', 'np.zeros', (['(6)'], {'dtype': 'np.float64'}), '(6, dtype=np.float64)\n', (3948, 3969), True, '...
import brica import numpy as np class CB(object): """ Cerebellum module. CB outputs action for smooth pursuit eye movment. """ def __init__(self): self.timing = brica.Timing(5, 1, 0) def __call__(self, inputs): if 'from_fef' not in inputs: raise Exception('CB did n...
[ "brica.Timing", "numpy.array" ]
[((191, 212), 'brica.Timing', 'brica.Timing', (['(5)', '(1)', '(0)'], {}), '(5, 1, 0)\n', (203, 212), False, 'import brica\n'), ((408, 442), 'numpy.array', 'np.array', (['[0, 0]'], {'dtype': 'np.float32'}), '([0, 0], dtype=np.float32)\n', (416, 442), True, 'import numpy as np\n')]
import sys import os import os.path as osp from tqdm import tqdm import numpy as np from sklearn.metrics import confusion_matrix, precision_recall_fscore_support import torch import torch.nn as nn import torch.optim as optim from extract_tools import get_finetune_model, prepare_loader class Trainer(object): def ...
[ "os.makedirs", "extract_tools.prepare_loader", "torch.nn.LogSoftmax", "torch.nn.KLDivLoss", "torch.load", "torch.nn.CrossEntropyLoss", "os.path.exists", "torch.cat", "extract_tools.get_finetune_model", "numpy.mean", "sys.stdout.flush", "torch.max", "sklearn.metrics.confusion_matrix", "os.p...
[((804, 845), 'os.path.join', 'osp.join', (['self.net_dir', "(net_type + '.pth')"], {}), "(self.net_dir, net_type + '.pth')\n", (812, 845), True, 'import os.path as osp\n'), ((868, 911), 'os.path.join', 'osp.join', (['self.label_dir', '"""test_labels.txt"""'], {}), "(self.label_dir, 'test_labels.txt')\n", (876, 911), T...
import tensorflow as tf import os import OpenEXR import Imath import numpy as np import glob import tensorflow as tf import os import time import matplotlib.pyplot as plt import sys import array import OpenEXR import Imath import numpy as np import imageio import math import random import datetime Mydevice = tf.config....
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "OpenEXR.InputFile", "matplotlib.pyplot.imshow", "numpy.zeros", "tensorflow.config.experimental.set_memory_growth", "tensorflow.constant", "time.time", "numpy.reshape", "glob.glob", "numpy.random.rand", "tensorflow.image.resize", "tenso...
[((310, 361), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (354, 361), True, 'import tensorflow as tf\n'), ((362, 421), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['Mydevice...
#!/usr/bin/env python3 __copyright__ = """ Copyright 2018 <NAME> 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...
[ "matplotlib.pyplot.title", "argparse.ArgumentParser", "pathlib.Path", "os.path.isfile", "numpy.mean", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "matplotlib.pyplot.close", "matplotlib.pyplot.yticks", "os.path.exists", "matplotlib.ticker.FormatStrFormatter", "matplotlib.pyplot.xticks"...
[((6222, 6327), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESCRIPTION_TEXT', 'formatter_class': 'argparse.RawTextHelpFormatter'}), '(description=DESCRIPTION_TEXT, formatter_class=\n argparse.RawTextHelpFormatter)\n', (6245, 6327), False, 'import argparse\n'), ((10647, 10694), 'veilg...
""" test_chunker.py """ import unittest import numpy as np from diehard.utils import chunker # pylint:disable=missing-docstring # pylint:disable=no-self-use class TestChunker(unittest.TestCase): def test_overlapping_complete(self): chunks = chunker(np.arange(100), 5, skip=1, complete=True) list(chu...
[ "numpy.arange" ]
[((262, 276), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (271, 276), True, 'import numpy as np\n'), ((376, 390), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (385, 390), True, 'import numpy as np\n'), ((495, 509), 'numpy.arange', 'np.arange', (['(100)'], {}), '(100)\n', (504, 509), True, 'impo...
""" CIFAR10 dataset is avaliable at https://www.cs.toronto.edu/~kriz/cifar.html. It includes 5 binary dataset, each contains 10000 images. 1 row (1 image) includes 1 label & 3072 pixels. 3072 pixels are 3 channels of a 32x32 image """ from __future__ import division from __future__ import print_function from builtins i...
[ "argparse.ArgumentParser", "numpy.empty", "cPickle.load", "singa.device.create_cuda_gpu_on", "numpy.arange", "builtins.range", "sys.path.append", "os.path.exists", "singa.device.get_default_device", "vgg.create_net", "singa.optimizer.SGD", "datetime.datetime.now", "numpy.random.shuffle", "...
[((656, 683), 'sys.path.append', 'sys.path.append', (['SINGA_PATH'], {}), '(SINGA_PATH)\n', (671, 683), False, 'import sys\n'), ((1102, 1147), 'numpy.asarray', 'np.asarray', (["cifar10['labels']"], {'dtype': 'np.uint8'}), "(cifar10['labels'], dtype=np.uint8)\n", (1112, 1147), True, 'import numpy as np\n'), ((1311, 1373...
import torch import numpy as np import os from tqdm import tqdm from torch.utils.data.dataset import Dataset from torch.utils.data import DataLoader def generate_data(n_samples = 10, n_customer = 20, seed = None): """ https://pytorch.org/docs/master/torch.html?highlight=rand#torch.randn x[0] -- depot_xy: (batch, 2)...
[ "torch.cuda.synchronize", "torch.manual_seed", "torch.cuda.FloatTensor", "torch.FloatTensor", "os.path.isfile", "torch.cuda.is_available", "numpy.array" ]
[((587, 612), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (610, 612), False, 'import torch\n'), ((432, 455), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (449, 455), False, 'import torch\n'), ((2656, 2676), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\...
import numpy as np from sklearn.metrics import confusion_matrix from sklearn.svm import SVC from sklearn.utils import class_weight import sys sys.path.append("..") from data_loader import load_data class SVM(object): def __init__(self, search_dict): self.search_dict = search_dict # load here so o...
[ "sys.path.append", "numpy.load", "data_loader.load_data", "sklearn.svm.SVC", "sklearn.metrics.confusion_matrix", "numpy.unique" ]
[((142, 163), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (157, 163), False, 'import sys\n'), ((384, 434), 'numpy.load', 'np.load', (["(data_dir + 'x_flt.npy')"], {'allow_pickle': '(True)'}), "(data_dir + 'x_flt.npy', allow_pickle=True)\n", (391, 434), True, 'import numpy as np\n'), ((452, 498...
import equation_utils from itertools import product import matplotlib.pyplot as plt import numpy as np BMI_PARAMS = [12, 25, 45] CARB_PARAMS = [0, 250, 500] CARB_GRAPH_PARAMS = list(range(50, 301, 50)) # Small constant to ensure log is never zero LOG_CONSTANT = 1 def get_param_combos(): return product(BMI_PARA...
[ "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.gca", "matplotlib.pyplot.setp", "matplotlib.pyplot.subplots", "numpy.reshape", "numpy.matmul", "itertools.product", "numpy.exp", "matplotlib.pyplot.gcf", "matplotlib.pyplot.tight_layout" ]
[((304, 336), 'itertools.product', 'product', (['BMI_PARAMS', 'CARB_PARAMS'], {}), '(BMI_PARAMS, CARB_PARAMS)\n', (311, 336), False, 'from itertools import product\n'), ((1045, 1063), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(3)'], {}), '(3, 3)\n', (1057, 1063), True, 'import matplotlib.pyplot as plt\n')...
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import sys import mlflow import mlflow.sklearn def eval_metrics(actual, pred): rmse = np.sqrt(mean_squared_error(actual, pred)) mae = mean_absolute_error(actual, pred) r2 = r2_score(actual, pred) ...
[ "mlflow.start_run", "mlflow.log_param", "mlflow.sklearn.log_model", "pandas.read_csv", "pandas.get_dummies", "sklearn.model_selection.train_test_split", "sklearn.metrics.r2_score", "sklearn.linear_model.ElasticNet", "sklearn.metrics.mean_absolute_error", "numpy.where", "mlflow.log_metric", "sk...
[((250, 283), 'sklearn.metrics.mean_absolute_error', 'mean_absolute_error', (['actual', 'pred'], {}), '(actual, pred)\n', (269, 283), False, 'from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score\n'), ((293, 315), 'sklearn.metrics.r2_score', 'r2_score', (['actual', 'pred'], {}), '(actual, pred)\...
from __future__ import annotations import math from typing import Tuple, Union import numpy as np import scipy.integrate from sklearn.base import BaseEstimator, RegressorMixin from sklearn.utils.validation import check_is_fitted from ..._utils import _cartesian_product, _pairwise_symmetric from ...representation imp...
[ "numpy.full", "numpy.stack", "numpy.zeros_like", "numpy.sum", "math.ceil", "sklearn.utils.validation.check_is_fitted", "numpy.any", "numpy.arange", "numpy.swapaxes", "numpy.concatenate" ]
[((968, 993), 'numpy.sum', 'np.sum', (['integral'], {'axis': '(-1)'}), '(integral, axis=-1)\n', (974, 993), True, 'import numpy as np\n'), ((2878, 2903), 'numpy.swapaxes', 'np.swapaxes', (['matrix', '(0)', '(1)'], {}), '(matrix, 0, 1)\n', (2889, 2903), True, 'import numpy as np\n'), ((3084, 3110), 'numpy.arange', 'np.a...
#!/usr/bin/env python import numpy as np from olympus import Object # ============================================================================== class Analyzer(Object): def __init__(self, campaigns=[]): Object.__init__(**locals()) def _get_best_vals(self, campaigns): vals_ = [campaign....
[ "numpy.empty", "numpy.sort", "numpy.random.randint", "numpy.array", "numpy.where", "numpy.squeeze" ]
[((548, 570), 'numpy.squeeze', 'np.squeeze', (['val_[:, 0]'], {}), '(val_[:, 0])\n', (558, 570), True, 'import numpy as np\n'), ((1753, 1767), 'numpy.array', 'np.array', (['locs'], {}), '(locs)\n', (1761, 1767), True, 'import numpy as np\n'), ((2160, 2271), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)...
from resnet import Resnet50 import numpy as np import cv2 # Add enhanced coloring clahe at each of the three channels def clahe_augment(img): clahe_low = cv2.createCLAHE(clipLimit=1.0, tileGridSize=(8,8)) clahe_medium = cv2.createCLAHE(clipLimit=3.0, tileGridSize=(8,8)) clahe_high = cv2.createCLAHE(clipLim...
[ "numpy.sum", "utils.select_example_image", "numpy.argmax", "resnet.Resnet50", "numpy.array", "numpy.swapaxes", "cv2.createCLAHE" ]
[((159, 210), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(1.0)', 'tileGridSize': '(8, 8)'}), '(clipLimit=1.0, tileGridSize=(8, 8))\n', (174, 210), False, 'import cv2\n'), ((229, 280), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(3.0)', 'tileGridSize': '(8, 8)'}), '(clipLimit=3.0, tileGridSi...
""" DarKnight.functions ~~~~~~~~~~~~~~~~~~~ General utility functions for DarKnight. """ # Imports import pandas as pd import numpy as np from rdkit.Chem import AllChem as Chem from rdkit.Chem import PandasTools, Draw import math import openbabel import darkchem from IPython.display import display import tensorflow a...
[ "pandas.DataFrame", "numpy.average", "rdkit.Chem.AllChem.MolFromSmiles", "darkchem.utils.vec2struct", "openbabel.OBConversion", "numpy.std", "openbabel.OBMol", "tensorflow.logging.set_verbosity", "math.acos", "rdkit.Chem.PandasTools.FrameToGridImage", "numpy.array", "darkchem.utils.struct2vec"...
[((325, 367), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (349, 367), True, 'import tensorflow as tf\n'), ((1281, 1318), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Correlation']"}), "(columns=['Correlation'])\n", (1293, 1318), True, 'i...
#********************************* # ens_anom * #********************************* # Standard packages import numpy as np import sys import os from scipy import stats def ens_anom(filenames,dir_OUTPUT,name_outputs,varname,numens,season,area,extreme): ''' \nGOAL: Computation of the ensemb...
[ "os.mkdir", "read_netcdf.save_N_2Dfields", "numpy.std", "read_netcdf.read3Dncfield", "numpy.empty", "os.path.exists", "numpy.percentile", "numpy.max", "sel_season_area.sel_area", "numpy.array", "sel_season_area.sel_season", "numpy.mean" ]
[((4474, 4498), 'numpy.array', 'np.array', (['varextreme_ens'], {}), '(varextreme_ens)\n', (4482, 4498), True, 'import numpy as np\n'), ((5195, 5274), 'read_netcdf.save_N_2Dfields', 'save_N_2Dfields', (['lat_area', 'lon_area', 'ens_anomalies', 'varsave', 'varunitsnew', 'ofile'], {}), '(lat_area, lon_area, ens_anomalies...
""" take a register dump and return a human readable bit-field wise meaning of the register dump Also allows to compare two register dumps to highlight in human readable way the differences v0.0.1a (2020-09-17): generates fixed address reports in csv and htm expects 1) csv table with following columns: ...
[ "lxml.html.tostring", "logging.error", "argparse.ArgumentParser", "logging.basicConfig", "os.path.basename", "pandas.read_csv", "os.path.join", "pandas.merge", "os.path.exists", "numpy.isnan", "lxml.html.fromstring", "lxml.html.fragments_fromstring", "pandas.set_option" ]
[((1972, 1982), 'os.path.exists', 'exists', (['fp'], {}), '(fp)\n', (1978, 1982), False, 'from os.path import abspath, basename, exists, join, pardir\n'), ((2886, 2919), 'pandas.read_csv', 'pd.read_csv', (['fp'], {'encoding': '"""utf-8"""'}), "(fp, encoding='utf-8')\n", (2897, 2919), True, 'import pandas as pd\n'), ((1...
"""Defines an ellipse.""" import numpy as np from scipy.special import ellipe from .base_classes import Shape2D class Ellipse(Shape2D): """An ellipse with principal axes a and b. Args: a (float): Principal axis a of the ellipse (radius in the :math:`x` direction). b ...
[ "scipy.special.ellipe", "numpy.asarray", "numpy.min", "numpy.sqrt" ]
[((1408, 1426), 'numpy.asarray', 'np.asarray', (['center'], {}), '(center)\n', (1418, 1426), True, 'import numpy as np\n'), ((1984, 2001), 'numpy.asarray', 'np.asarray', (['value'], {}), '(value)\n', (1994, 2001), True, 'import numpy as np\n'), ((3221, 3249), 'numpy.sqrt', 'np.sqrt', (['(1 - b ** 2 / a ** 2)'], {}), '(...
import numpy as np import pytest import scipy.spatial from autolens.data.array import grids, mask from autolens.model.inversion import pixelizations from autolens.model.inversion.util import pixelization_util from autolens.model.inversion import regularization from autolens.model.galaxy import galaxy as g class Test...
[ "autolens.model.inversion.util.pixelization_util.rectangular_neighbors_from_shape", "autolens.data.array.grids.RegularGrid.from_mask", "autolens.data.array.grids.GridStack.grid_stack_from_mask_sub_grid_size_and_psf_shape", "autolens.model.inversion.pixelizations.AdaptiveMagnification", "numpy.asarray", "a...
[((685, 721), 'autolens.data.array.grids.RegularGrid.from_mask', 'grids.RegularGrid.from_mask', ([], {'mask': 'ma'}), '(mask=ma)\n', (712, 721), False, 'from autolens.data.array import grids, mask\n'), ((753, 803), 'autolens.model.inversion.pixelizations.ImagePlanePixelization', 'pixelizations.ImagePlanePixelization', ...
import numpy as np from gym.envs.box2d.lunar_lander import LunarLander from gym.envs.box2d.lunar_lander import VIEWPORT_W, \ VIEWPORT_H, SCALE, LEG_DOWN, FPS from src.envs.CMDP import CMDP __all__ = ['LunarLanderCustom', 'LunarLanderCCustom', 'LunarLanderCMDP', 'LunarLanderCCMDP'...
[ "numpy.zeros_like", "numpy.asarray", "numpy.zeros", "numpy.any", "numpy.append", "numpy.array", "numpy.logical_or", "numpy.diag", "numpy.sqrt" ]
[((897, 929), 'numpy.zeros', 'np.zeros', (['(8,)'], {'dtype': 'np.float32'}), '((8,), dtype=np.float32)\n', (905, 929), True, 'import numpy as np\n'), ((1097, 1126), 'numpy.zeros', 'np.zeros', (['(3, 6)'], {'dtype': 'float'}), '((3, 6), dtype=float)\n', (1105, 1126), True, 'import numpy as np\n'), ((2619, 2652), 'numpy...
import numpy as np import pandas as pd from gym.utils import seeding import gym from gym import spaces import matplotlib from copy import deepcopy matplotlib.use("Agg") import matplotlib.pyplot as plt import pickle from stable_baselines3.common.vec_env import DummyVecEnv import numpy as np import pandas as pd from ...
[ "pandas.DataFrame", "copy.deepcopy", "numpy.clip", "time.time", "stable_baselines3.common.utils.configure_logger", "matplotlib.use", "random.seed", "gym.spaces.Box", "numpy.array", "numpy.dot", "stable_baselines3.common.vec_env.DummyVecEnv" ]
[((151, 172), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (165, 172), False, 'import matplotlib\n'), ((412, 433), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (426, 433), False, 'import matplotlib\n'), ((662, 686), 'stable_baselines3.common.utils.configure_logger', 'ut...
import unittest import numpy as np from photonai_graph.GraphUtilities import individual_ztransform class IndividualZtransformTest(unittest.TestCase): def setUp(self): self.m3d = np.random.rand(10, 20, 20) self.m4d = np.ones((10, 20, 20, 2)) def test_ztransform_3d(self): with self.ass...
[ "numpy.random.rand", "numpy.shape", "numpy.ones", "photonai_graph.GraphUtilities.individual_ztransform" ]
[((193, 219), 'numpy.random.rand', 'np.random.rand', (['(10)', '(20)', '(20)'], {}), '(10, 20, 20)\n', (207, 219), True, 'import numpy as np\n'), ((239, 263), 'numpy.ones', 'np.ones', (['(10, 20, 20, 2)'], {}), '((10, 20, 20, 2))\n', (246, 263), True, 'import numpy as np\n'), ((442, 473), 'photonai_graph.GraphUtilities...
import numpy as np import json import requests import soundfile as sf from pydub import AudioSegment import fleep import glob import math import os from scipy import signal MODEL_URI='http://localhost:8501/v1/models/test:predict' reverse = True framelength = 300 Tx = 6860 Ty = 846 nFreq = 46 def get...
[ "numpy.multiply", "json.loads", "numpy.std", "numpy.zeros", "numpy.mean", "numpy.array", "scipy.signal.spectrogram", "glob.glob", "requests.post", "pydub.AudioSegment.from_file", "numpy.concatenate" ]
[((428, 457), 'numpy.zeros', 'np.zeros', (['[X.shape[0], Ty, 1]'], {}), '([X.shape[0], Ty, 1])\n', (436, 457), True, 'import numpy as np\n'), ((1000, 1026), 'glob.glob', 'glob.glob', (["(inputdir + '/*')"], {}), "(inputdir + '/*')\n", (1009, 1026), False, 'import glob\n'), ((1072, 1084), 'numpy.array', 'np.array', (['[...
# USAGE # python translate.py --image mai-ngoc.jpg # import the necessary packages import numpy as np import argparse import imutils import cv2 # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-i", "--image", required=True, help="Path to the image") args = vars(a...
[ "argparse.ArgumentParser", "cv2.waitKey", "numpy.float32", "cv2.imread", "cv2.warpAffine", "imutils.translate", "cv2.imshow" ]
[((207, 232), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (230, 232), False, 'import argparse\n'), ((374, 399), 'cv2.imread', 'cv2.imread', (["args['image']"], {}), "(args['image'])\n", (384, 399), False, 'import cv2\n'), ((400, 429), 'cv2.imshow', 'cv2.imshow', (['"""Original"""', 'image'],...
import requests from lxml import html from urllib.parse import urljoin import gspread from oauth2client.service_account import ServiceAccountCredentials import numpy as np def parse(content): list = [] containers = content.xpath('//div[@class="quote"]') for container in containers: quote = containe...
[ "urllib.parse.urljoin", "oauth2client.service_account.ServiceAccountCredentials.from_json_keyfile_name", "lxml.html.fromstring", "gspread.authorize", "numpy.array", "requests.get" ]
[((1564, 1580), 'numpy.array', 'np.array', (['output'], {}), '(output)\n', (1572, 1580), True, 'import numpy as np\n'), ((858, 875), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (870, 875), False, 'import requests\n'), ((890, 919), 'lxml.html.fromstring', 'html.fromstring', (['page.content'], {}), '(page.c...
import vamp import resampy import numpy as np import io import pyreaper import pysptk import sox import tempfile import soundfile import os import itertools from scipy.interpolate import interp1d, CubicSpline from scipy.io import wavfile def sox_resample(wave_data, sr, target_sr): src_wav = os.path.join( ...
[ "os.remove", "numpy.sum", "numpy.empty", "numpy.floor", "scipy.interpolate.CubicSpline", "scipy.io.wavfile.read", "numpy.mean", "numpy.arange", "scipy.interpolate.interp1d", "numpy.round", "pyreaper.reaper", "tempfile._get_candidate_names", "numpy.copy", "numpy.insert", "numpy.append", ...
[((473, 522), 'soundfile.write', 'soundfile.write', (['src_wav', 'wave_data', 'sr', '"""PCM_16"""'], {}), "(src_wav, wave_data, sr, 'PCM_16')\n", (488, 522), False, 'import soundfile\n'), ((533, 550), 'sox.Transformer', 'sox.Transformer', ([], {}), '()\n', (548, 550), False, 'import sox\n'), ((631, 654), 'soundfile.rea...
# -*- coding: utf-8 -*- """ Created on 24/06/2020 1:26 pm @author: <NAME>, UOW """ # Standard library imports import numpy as np import torch import nibabel as nib from torch.utils.data import Dataset class SACDataset(Dataset): def __init__(self, root_dir, txtfile): """ :param root_dir: the root ...
[ "torch.Tensor", "numpy.loadtxt", "nibabel.load", "utils.general_utils.permute_data" ]
[((6355, 6442), 'numpy.loadtxt', 'np.loadtxt', (['training_file'], {'dtype': 'np.str', 'comments': '"""#"""', 'delimiter': '""";"""', 'unpack': '(False)'}), "(training_file, dtype=np.str, comments='#', delimiter=';', unpack\n =False)\n", (6365, 6442), True, 'import numpy as np\n'), ((6814, 6833), 'torch.Tensor', 'to...
from typing import Union from CoolProp.CoolProp import PropsSI from numpy import arange from scipy.interpolate import interp1d from glhe.properties.fluid_property_types import FluidPropertyType from glhe.properties.fluid_types import FluidType from glhe.utilities.functions import c_to_k, k_to_c class Fluid(object):...
[ "scipy.interpolate.interp1d", "numpy.arange", "CoolProp.CoolProp.PropsSI", "glhe.utilities.functions.c_to_k" ]
[((1280, 1321), 'numpy.arange', 'arange', (['self.min_temp', 'self.max_temp', '(0.5)'], {}), '(self.min_temp, self.max_temp, 0.5)\n', (1286, 1321), False, 'from numpy import arange\n'), ((1712, 1736), 'scipy.interpolate.interp1d', 'interp1d', (['temps', 'cp_vals'], {}), '(temps, cp_vals)\n', (1720, 1736), False, 'from ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from functools import partial import re import numpy as np import scipy.sparse as sp from sklearn.datasets import make_regression, make_multilabel_classification from sklearn.feature_extraction.text import ( CountVectorizer, TfidfVectorizer, Ha...
[ "sklearn.feature_extraction.text.CountVectorizer", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.datasets.make_multilabel_classification", "eli5.explain_weights", "sklearn.ensemble.GradientBoostingRegressor", "sklearn.linear_model.LassoLarsCV", "sklearn.linear_model.LarsCV", "sklearn.tre...
[((5476, 5544), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['pass_feature_weights']", '[[False], [True]]'], {}), "(['pass_feature_weights'], [[False], [True]])\n", (5499, 5544), False, 'import pytest\n'), ((1913, 1938), 'functools.partial', 'partial', (['top_pos_neg', 'res'], {}), '(top_pos_neg, res)\n', ...
from visionlib.utils.webutils import web import numpy as np import logging import dlib import bz2 import cv2 import os class DlibDetector: def __init__(self): logging.basicConfig(level=logging.INFO) self.model = None self.web_util = web() self.__set_detector() def __set_detecto...
[ "dlib.rectangle", "logging.basicConfig", "numpy.zeros", "os.path.exists", "dlib.cuda.get_num_devices", "visionlib.utils.webutils.web", "logging.info", "logging.fatal", "bz2.open", "dlib.shape_predictor" ]
[((172, 211), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (191, 211), False, 'import logging\n'), ((262, 267), 'visionlib.utils.webutils.web', 'web', ([], {}), '()\n', (265, 267), False, 'from visionlib.utils.webutils import web\n'), ((567, 593), 'os.path.exi...
from pytest import approx import numpy as np import pandas as pd import motmetrics as mm import pytest import os def test_metricscontainer_1(): m = mm.metrics.MetricsHost() m.register(lambda df: 1., name='a') m.register(lambda df: 2., name='b') m.register(lambda df, a, b: a+b, deps=['a', 'b'], name='ad...
[ "pandas.DataFrame", "motmetrics.metrics.create", "motmetrics.io.render_summary", "os.path.dirname", "motmetrics.utils.compare_to_groundtruth", "motmetrics.metrics.MetricsHost", "numpy.testing.assert_allclose", "os.path.join", "pandas.concat" ]
[((153, 177), 'motmetrics.metrics.MetricsHost', 'mm.metrics.MetricsHost', ([], {}), '()\n', (175, 177), True, 'import motmetrics as mm\n'), ((710, 734), 'motmetrics.metrics.MetricsHost', 'mm.metrics.MetricsHost', ([], {}), '()\n', (732, 734), True, 'import motmetrics as mm\n'), ((1587, 1611), 'motmetrics.metrics.Metric...
#!/usr/bin/env python # encoding=utf-8 import tensorflow as tf # from transformers import * import heapq # from tensorflow.python.ops.gen_math_ops import mod import numpy as np from bert import modeling as modeling, tokenization from collections import defaultdict print(tf.__version__) def gather_indexes(sequence_t...
[ "bert.modeling.get_assignment_map_from_checkpoint", "bert.modeling.layer_norm", "tensorflow.trainable_variables", "bert.modeling.create_initializer", "tensorflow.reshape", "bert.modeling.get_activation", "collections.defaultdict", "tensorflow.matmul", "numpy.random.randint", "tensorflow.nn.softmax...
[((434, 491), 'bert.modeling.get_shape_list', 'modeling.get_shape_list', (['sequence_tensor'], {'expected_rank': '(3)'}), '(sequence_tensor, expected_rank=3)\n', (457, 491), True, 'from bert import modeling as modeling, tokenization\n'), ((716, 758), 'tensorflow.reshape', 'tf.reshape', (['(positions + flat_offsets)', '...
import os import sys import requests import numpy as np import rasterio import boto3 from botocore.exceptions import ClientError """ This Python code is very similar to the Perl script (download_V1.1.pl) provided by GLAD. It takes mostly the same arguments as the Perl script. In addition, it requires the name of the ...
[ "os.remove", "rasterio.open", "boto3.client", "rasterio.io.MemoryFile", "numpy.isnan", "requests.get" ]
[((1107, 1125), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1119, 1125), False, 'import boto3\n'), ((2017, 2061), 'requests.get', 'requests.get', (['url'], {'auth': '(username, password)'}), '(url, auth=(username, password))\n', (2029, 2061), False, 'import requests\n'), ((4000, 4024), 'os.remove',...
#!/usr/bin/env python # -*- coding: utf8 -*- # ***************************************************************** # ** PTS -- Python Toolkit for working with SKIRT ** # ** © Astronomical Observatory, Ghent University ** # ***************************************************************** ##...
[ "matplotlib.pyplot.xlim", "pts.core.tools.filesystem.join", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "pts.core.tools.tables.from_file", "pts.core.tools.tables.new", "pts.core.tools.filesystem.directories_in_path", "scipy.optimize.curve_fit", "matplotlib.pyplot.figure", "pts.core.tool...
[((855, 879), 'numpy.linspace', 'np.linspace', (['(12)', '(25)', '(100)'], {}), '(12, 25, 100)\n', (866, 879), True, 'import numpy as np\n'), ((2177, 2201), 'pts.core.tools.filesystem.directories_in_path', 'fs.directories_in_path', ([], {}), '()\n', (2199, 2201), True, 'from pts.core.tools import filesystem as fs\n'), ...
import os import argparse import cv2 import numpy as np import sys import time from threading import Thread import importlib.util class VideoStream: """Camera object that controls video streaming from the Picamera""" def __init__(self, resolution=(640, 480), framerate=30): # Initialize the PiCamera a...
[ "threading.Thread", "cv2.contourArea", "cv2.circle", "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "cv2.getTickFrequency", "os.getcwd", "numpy.argmax", "tensorflow.lite.python.interpreter.load_delegate", "time.sleep", "cv2.VideoCapture", "tensorflow.lite.python.interpreter.Interpreter",...
[((1608, 1633), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1631, 1633), False, 'import argparse\n'), ((3396, 3407), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (3405, 3407), False, 'import os\n'), ((3507, 3553), 'os.path.join', 'os.path.join', (['CWD_PATH', 'MODEL_NAME', 'GRAPH_NAME'], {})...
import argparse import json import os import subprocess import numpy as np import torch import torch.onnx import torch.nn as nn import torch.nn.functional as F import torchvision.models as models import onnx from onnx import helper from onnx import AttributeProto, TensorProto, GraphProto import onnxruntime from webdnn....
[ "onnx.helper.make_node", "argparse.ArgumentParser", "torch.sqrt", "torch.sinh", "torch.cat", "torch.randn", "onnxruntime.InferenceSession", "torch.cos", "torch.ceil", "torch.nn.Softmax", "torch.asin", "torch.atan", "torch.no_grad", "os.path.join", "torch.nn.functional.pad", "os.path.ab...
[((360, 380), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (377, 380), False, 'import torch\n'), ((8430, 8496), 'webdnn.tensor_export.serialize_tensors', 'serialize_tensors', (["(directory + '/expected.bin')", 'casted_arrays_dict'], {}), "(directory + '/expected.bin', casted_arrays_dict)\n", (8447,...
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. import subprocess import pytest import yaml import tempfile import random import logging import itertools import numpy as np import tempfile import os from collections import Counter import convergence_harness from convergence_harness import ( gather_log_ha...
[ "yaml.load", "test_utils.build_sample_flag_data", "convergence_log_recorder.LogRecorder", "pytest.main", "test_utils.random_result", "convergence_log_recorder.MockCheckpointRecording", "pytest.mark.parametrize", "convergence_log_recorder.MockLogRecorder", "os.path.join", "random.randint", "pytes...
[((998, 2084), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""item, log_entry, expected"""', "[({'regex': regexes['accuracy_dual']}, iteration_log_dual_loss, {(0):\n '0.092', (1): '0.672'}), ({'regex': regexes['accuracy_dual'], 'labels':\n ['MLM', 'NSP']}, iteration_log_dual_loss, {'MLM': '0.092', 'N...
#!/usr/bin/python from matplotlib import pyplot as plt import numpy as np def read_csv(path): with open(path) as csvf: data = list(zip(*[[float(cell) for cell in l.split(',')] for l in csvf.readlines()[1:]])) return data #volumes, readings = read_csv("loadcell_data.csv") volumes, readings = read_csv(...
[ "numpy.divide", "numpy.multiply", "numpy.subtract", "matplotlib.pyplot.show", "numpy.polyfit", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "numpy.average", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.figure", "numpy.array", "numpy.add", "matplotlib.pyplot.xlabel" ]
[((357, 374), 'numpy.array', 'np.array', (['volumes'], {}), '(volumes)\n', (365, 374), True, 'import numpy as np\n'), ((385, 412), 'numpy.multiply', 'np.multiply', (['volumes', '(1e-06)'], {}), '(volumes, 1e-06)\n', (396, 412), True, 'import numpy as np\n'), ((953, 978), 'numpy.add', 'np.add', (['volumes', 'v_tubing'],...
import os import numpy as np import cPickle from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt def writeClusterCenters(cl, outputFilename): np.savetxt(outputFilename, cl.clustercenters) def writeDtrajs(filenames, dtrajs, filenameTemplate="%s.disctraj"): for filename, dtraj in zip(filename...
[ "os.makedirs", "mpl_toolkits.mplot3d.Axes3D", "numpy.savetxt", "os.path.exists", "cPickle.load", "cPickle.dump", "matplotlib.pyplot.figure", "os.path.split" ]
[((166, 211), 'numpy.savetxt', 'np.savetxt', (['outputFilename', 'cl.clustercenters'], {}), '(outputFilename, cl.clustercenters)\n', (176, 211), True, 'import numpy as np\n'), ((1385, 1397), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1395, 1397), True, 'import matplotlib.pyplot as plt\n'), ((1407, 141...
import pathlib import numpy as np import simscale_eba.HourlyContinuous as hc import simscale_eba.ResultProcessing as pp import simscale_eba.TestConditions as tc wind_conditions = tc.WindData() wind_conditions.set_atmospheric_boundary_layers() epw_path = pathlib.Path("E:/Current Cases/CFDtoHourly/Github/api-pollina...
[ "simscale_eba.TestConditions.WindData", "simscale_eba.HourlyContinuous.HourlyContinuous", "pathlib.Path", "numpy.arange", "simscale_eba.HourlyContinuous.WeatherStatistics", "simscale_eba.ResultProcessing.multi_directional_result" ]
[((182, 195), 'simscale_eba.TestConditions.WindData', 'tc.WindData', ([], {}), '()\n', (193, 195), True, 'import simscale_eba.TestConditions as tc\n'), ((259, 377), 'pathlib.Path', 'pathlib.Path', (['"""E:/Current Cases/CFDtoHourly/Github/api-pollination-utci/assets/weather/CityofLondon2015.epw"""'], {}), "(\n 'E:/C...
import cv2 import numpy as np import os import torch import keras from keras.applications.inception_v3 import InceptionV3, preprocess_input from keras.models import load_model from test_funcs.util_vtk import visualization from test_funcs.util import downsample # load data sketch_path = r"data/sketches2" model_path = r...
[ "keras.models.load_model", "cv2.waitKey", "numpy.empty", "torch.load", "test_funcs.util.downsample", "test_funcs.util_vtk.visualization", "keras.applications.inception_v3.preprocess_input", "cv2.imread", "numpy.random.randint", "torch.Tensor", "cv2.destroyWindow", "cv2.imshow", "os.listdir" ...
[((449, 477), 'keras.models.load_model', 'load_model', (['"""inceptionv3.h5"""'], {}), "('inceptionv3.h5')\n", (459, 477), False, 'from keras.models import load_model\n'), ((546, 568), 'keras.models.load_model', 'load_model', (['model_path'], {}), '(model_path)\n', (556, 568), False, 'from keras.models import load_mode...
# + # %matplotlib notebook from typing import List, Dict import tensorflow as tf import matplotlib.pyplot as plt from scipy.ndimage import uniform_filter1d import seaborn as sns import pandas as pd import numpy as np import glob import os data_dir = os.path.join(os.getcwd(), 'run_logs') img_dir = os.path.join(os.getcw...
[ "pandas.DataFrame", "seaborn.lineplot", "matplotlib.pyplot.tight_layout", "tensorflow.train.summary_iterator", "os.path.join", "os.getcwd", "scipy.ndimage.uniform_filter1d", "numpy.asarray", "matplotlib.pyplot.subplots", "seaborn.set", "pandas.concat" ]
[((264, 275), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (273, 275), False, 'import os\n'), ((312, 323), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (321, 323), False, 'import os\n'), ((538, 574), 'tensorflow.train.summary_iterator', 'tf.train.summary_iterator', (['event_dir'], {}), '(event_dir)\n', (563, 574), True, ...
# Generate data for optimal advertising problem. import numpy as np np.random.seed(1) m = 5 n = 24 SCALE = 10000 B = np.random.lognormal(mean=8, size=(m, 1)) + 10000 B = 1000 * np.round(B / 1000) P_ad = np.random.uniform(size=(m, 1)) P_time = np.random.uniform(size=(1, n)) P = P_ad.dot(P_time) T = np.sin(np.linspace...
[ "numpy.random.uniform", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.round", "numpy.ones", "cvxpy.sum", "numpy.min", "numpy.arange", "cvxpy.minimum", "numpy.linspace", "cvxpy.Variable", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib...
[((69, 86), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (83, 86), True, 'import numpy as np\n'), ((205, 235), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(m, 1)'}), '(size=(m, 1))\n', (222, 235), True, 'import numpy as np\n'), ((245, 275), 'numpy.random.uniform', 'np.random.uniform', ...
"""Utilities for parsing TRExFitter.""" from __future__ import annotations # stdlib import io import logging import math import multiprocessing import os import random import sys from dataclasses import dataclass from pathlib import Path from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union ...
[ "random.sample", "tdub.internal.stab_tests.ps_impact_r1j1b", "pathlib.Path", "tdub.internal.stab_tests.b0_by_year_fig_and_ax", "tdub.internal.stab_tests.ps_impact_r2j2b", "os.chdir", "multiprocessing.cpu_count", "numpy.zeros_like", "tdub.internal.stab_tests.ps_impact_r2j1b", "matplotlib.pyplot.clo...
[((350, 371), 'matplotlib.use', 'matplotlib.use', (['"""pdf"""'], {}), "('pdf')\n", (364, 371), False, 'import matplotlib\n'), ((763, 790), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (780, 790), False, 'import logging\n'), ((6816, 6838), 'uproot.open', 'uproot.open', (['root_path'], {...
from __future__ import print_function import torch.utils.data as data import os import os.path import shutil import errno import torch import ipdb import numpy as np from tools import checkexists_mkdir, mkdir_in_path import librosa try: import torchaudio def read_audio(fp, sample_rate, downsample=True): ...
[ "os.path.expanduser", "os.mkdir", "numpy.random.uniform", "torchaudio.sox_effects.SoxEffectsChain", "tools.checkexists_mkdir", "tools.mkdir_in_path", "os.path.exists", "numpy.arange", "torchaudio.load", "os.path.join" ]
[((2825, 2853), 'tools.checkexists_mkdir', 'checkexists_mkdir', (['self.root'], {}), '(self.root)\n', (2842, 2853), False, 'from tools import checkexists_mkdir, mkdir_in_path\n'), ((2862, 2909), 'tools.mkdir_in_path', 'mkdir_in_path', (['self.root', 'self.processed_folder'], {}), '(self.root, self.processed_folder)\n',...
import numpy as np import dill import matplotlib.pyplot as plt costs = [] #Extract and prepare MNIST training data def LoadMNISTSets(fileimage, n): fimg = open(fileimage, "rb") fimg.read(16) # 16 where MNIST's image pixel started. number_of_pix = 28*28 s = (n,number_of_pix) image_sets = np.zeros(s) for i in r...
[ "dill.dump_session", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.tanh", "numpy.argmax", "numpy.sum", "numpy.log", "dill.load_session", "numpy.zeros", "numpy.max", "numpy.random.normal", "numpy.dot" ]
[((296, 307), 'numpy.zeros', 'np.zeros', (['s'], {}), '(s)\n', (304, 307), True, 'import numpy as np\n'), ((645, 667), 'numpy.zeros', 'np.zeros', (['s'], {'dtype': 'int'}), '(s, dtype=int)\n', (653, 667), True, 'import numpy as np\n'), ((5421, 5438), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (5435,...
################################################################## #------------- Plotting routine for saved test data ------------- # (<NAME>: <EMAIL>) ################################################################## ''' Uses simulation data generated in run_modRSW.py test cases. Goal: compare sim...
[ "f_modRSW.make_grid", "os.getcwd", "mpl_toolkits.axes_grid1.inset_locator.zoomed_inset_axes", "numpy.shape", "mpl_toolkits.axes_grid1.inset_locator.mark_inset", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((691, 702), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (700, 702), False, 'import os\n'), ((1204, 1224), 'f_modRSW.make_grid', 'make_grid', (['Nk_fc1', 'L'], {}), '(Nk_fc1, L)\n', (1213, 1224), False, 'from f_modRSW import make_grid\n'), ((1257, 1277), 'f_modRSW.make_grid', 'make_grid', (['Nk_fc2', 'L'], {}), '(Nk_f...
import importlib import sys parameters = importlib.import_module(sys.argv[1]) globals().update(parameters.__dict__) import os import numpy as np #This function prints arrays as .asc files. def f_print(data,datatype,plot_number,parent_folder): data_print = np.zeros((cellsx,cellsy)) for x in xrange(0,ce...
[ "numpy.zeros", "importlib.import_module" ]
[((41, 77), 'importlib.import_module', 'importlib.import_module', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (64, 77), False, 'import importlib\n'), ((266, 292), 'numpy.zeros', 'np.zeros', (['(cellsx, cellsy)'], {}), '((cellsx, cellsy))\n', (274, 292), True, 'import numpy as np\n')]