code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
from rdkit import Chem from rdkit.Chem import AllChem import re import os from subprocess import Popen import matplotlib.pyplot as plt from scipy.stats import linregress import numpy as np import argparse from multiprocessing import Pool # path_to_orca = "/usr/local/orca_4_1_1_linux_x86-64/orca" # path_to_orca = "/us...
[ "argparse.ArgumentParser", "rdkit.Chem.MolToMolBlock", "os.path.join", "numpy.round", "matplotlib.pyplot.axvline", "os.path.exists", "re.findall", "scipy.stats.linregress", "matplotlib.pyplot.axhline", "subprocess.Popen", "numpy.square", "multiprocessing.Pool", "matplotlib.pyplot.ylabel", ...
[((6307, 6332), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6330, 6332), False, 'import argparse\n'), ((7534, 7567), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['smiles_string'], {}), '(smiles_string)\n', (7552, 7567), False, 'from rdkit import Chem\n'), ((7578, 7593), 'rdkit.Chem.A...
import matplotlib.pyplot as plt import numpy as np # A histogram is a graph showing frequency distributions. # It is a graph showing the number of observations within each given interval. # hist() function will use an array of numbers to create a histogram x = np.random.normal(170, 10, 250) plt.hist(x) plt.s...
[ "matplotlib.pyplot.hist", "matplotlib.pyplot.show", "numpy.random.normal" ]
[((270, 300), 'numpy.random.normal', 'np.random.normal', (['(170)', '(10)', '(250)'], {}), '(170, 10, 250)\n', (286, 300), True, 'import numpy as np\n'), ((302, 313), 'matplotlib.pyplot.hist', 'plt.hist', (['x'], {}), '(x)\n', (310, 313), True, 'import matplotlib.pyplot as plt\n'), ((315, 325), 'matplotlib.pyplot.show'...
""" =============================== Estimation of differences between directed graphs given two datasets representing two settings. =============================== This module contains functions for estimating the differences between two causal directed acyclic graph (DAG) models given samples from each model. Refere...
[ "conditional_independence.partial_correlation_suffstat", "matplotlib.pyplot.figure", "networkx.ancestors", "graphical_model_learning.utils.regression.RegressionHelper", "scipy.special.ncfdtr", "sklearn.utils.safe_mask", "itertools.product", "operator.itemgetter", "tqdm.tqdm", "matplotlib.pyplot.sh...
[((6164, 6196), 'conditional_independence.partial_correlation_suffstat', 'partial_correlation_suffstat', (['X1'], {}), '(X1)\n', (6192, 6196), False, 'from conditional_independence import partial_correlation_suffstat\n'), ((6213, 6245), 'conditional_independence.partial_correlation_suffstat', 'partial_correlation_suffs...
# -*- coding: utf-8 -*- # imageio is distributed under the terms of the (new) BSD License. """ Read/Write images using Pillow/PIL. Backend Library: `Pillow <https://pillow.readthedocs.io/en/stable/>`_ Plugin that wraps the the Pillow library. Pillow is a friendly fork of PIL (Python Image Library) and supports readi...
[ "numpy.stack", "PIL.Image.new", "numpy.flip", "PIL.Image.registered_extensions", "numpy.asarray", "PIL.ImageSequence.Iterator", "numpy.rot90", "PIL.Image.getmodebands", "PIL.Image.fromarray", "warnings.warn", "numpy.round", "PIL.ExifTags.TAGS.get" ]
[((7275, 7310), 'PIL.ImageSequence.Iterator', 'ImageSequence.Iterator', (['self._image'], {}), '(self._image)\n', (7297, 7310), False, 'from PIL import Image, UnidentifiedImageError, ImageSequence, ExifTags\n'), ((7753, 7770), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (7763, 7770), True, 'import nump...
import numpy as np nums = np.loadtxt("1.txt").astype(int) for idx in np.where(nums[:, None] + nums[None, :] == 2020): x = nums[idx] print(np.prod(x)) for idx in np.where(nums[:, None, None] + nums[None, :, None] + nums[None, None, :] == 2020): print(np.prod([nums[i] for i in set(idx)]))
[ "numpy.where", "numpy.loadtxt", "numpy.prod" ]
[((69, 116), 'numpy.where', 'np.where', (['(nums[:, None] + nums[None, :] == 2020)'], {}), '(nums[:, None] + nums[None, :] == 2020)\n', (77, 116), True, 'import numpy as np\n'), ((169, 254), 'numpy.where', 'np.where', (['(nums[:, None, None] + nums[None, :, None] + nums[None, None, :] == 2020)'], {}), '(nums[:, None, N...
# -*- coding: utf-8 -*- # Copyright 2020 PyPAL authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
[ "functools.partial", "os.mkdir", "sklearn.preprocessing.StandardScaler", "click.argument", "numpy.median", "click.option", "time.strftime", "os.path.exists", "click.command", "dispersant_screener.ga._get_average_dist", "pickle.load", "click.Path", "os.path.join" ]
[((1003, 1033), 'time.strftime', 'time.strftime', (['"""%Y%m%d-%H%M%S"""'], {}), "('%Y%m%d-%H%M%S')\n", (1016, 1033), False, 'import time\n'), ((2077, 2093), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (2091, 2093), False, 'from sklearn.preprocessing import StandardScaler\n'), ((2151, 21...
"""Toy cover domain. This environment IS downward refinable (low-level search won't ever fail), but it still requires backtracking. """ from typing import ClassVar, Dict, List, Optional, Sequence, Set, Tuple import matplotlib import matplotlib.pyplot as plt import numpy as np from gym.spaces import Box from predica...
[ "matplotlib.pyplot.title", "predicators.src.structs.Predicate", "matplotlib.pyplot.suptitle", "numpy.allclose", "numpy.clip", "predicators.src.structs.Object", "matplotlib.pyplot.tight_layout", "predicators.src.structs.Action", "matplotlib.pyplot.yticks", "predicators.src.structs.State", "matplo...
[((924, 990), 'predicators.src.structs.Type', 'Type', (['"""block"""', "['is_block', 'is_target', 'width', 'pose', 'grasp']"], {}), "('block', ['is_block', 'is_target', 'width', 'pose', 'grasp'])\n", (928, 990), False, 'from predicators.src.structs import Action, Array, GroundAtom, Object, ParameterizedOption, Predicat...
#!/usr/bin/env python import numpy as np from keras.models import load_model n_samples = 50 model = load_model('generator.h5') input_shape = list(model.input_shape[1:]) input_data = np.random.random([n_samples] + input_shape) input_data[0][0] = 1 for i in range(99): input_data[0][i + 1] = 0 for i in range(100): ...
[ "keras.models.load_model", "numpy.random.random" ]
[((103, 129), 'keras.models.load_model', 'load_model', (['"""generator.h5"""'], {}), "('generator.h5')\n", (113, 129), False, 'from keras.models import load_model\n'), ((185, 228), 'numpy.random.random', 'np.random.random', (['([n_samples] + input_shape)'], {}), '([n_samples] + input_shape)\n', (201, 228), True, 'impor...
import numpy as np def get_indices(N, n_batches, split_ratio): """Generates splits of indices from 0 to N-1 into uniformly distributed\ batches. Each batch is defined by 3 indices [i, j, k] where\ (j-i) = split_ratio*(k-j). The first batch starts with i = 0,\ the last one ends with k = N - 1. ...
[ "numpy.array" ]
[((559, 578), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (567, 578), True, 'import numpy as np\n')]
import cv2 as cv import numpy as np import sys # local module import video from video import presets class CamshiftTracker: def __init__(self): self.camera = get_new_video_source() self.point = None # Selection stuff # idk how this works self.user_selection_box = None ...
[ "video.create_capture", "cv2.cvtColor", "cv2.waitKey", "cv2.calcHist", "cv2.imshow", "sys.exit", "cv2.CamShift", "cv2.setMouseCallback", "cv2.ellipse", "numpy.array", "cv2.destroyWindow", "cv2.calcBackProject", "cv2.normalize", "cv2.flip", "cv2.destroyAllWindows", "cv2.namedWindow" ]
[((3354, 3402), 'video.create_capture', 'video.create_capture', (['video_src', "presets['cube']"], {}), "(video_src, presets['cube'])\n", (3374, 3402), False, 'import video\n'), ((3554, 3571), 'cv2.flip', 'cv.flip', (['frame', '(1)'], {}), '(frame, 1)\n', (3561, 3571), True, 'import cv2 as cv\n'), ((3739, 3761), 'cv2.n...
# -*- coding: utf-8 -*- # Импорт библиотек для работы с классификаторами, # импорт функии preprocessing из модуля common import os import numpy as np from termcolor import colored from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import svm fr...
[ "sklearn.ensemble.RandomForestClassifier", "functools.partial", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.model_selection.train_test_split", "gensim.models.keyedvectors.Word2VecKeyedVectors", "numpy.zeros", "termcolor.colored", "sklearn.neighbors.KNeighborsClassifier", "numpy.array...
[((648, 742), 'functools.partial', 'partial', (['preprocessing'], {'remove_punctuation': '(True)', 'remove_stopwords': '(True)', 'normalisation': '(True)'}), '(preprocessing, remove_punctuation=True, remove_stopwords=True,\n normalisation=True)\n', (655, 742), False, 'from functools import partial\n'), ((1991, 2018)...
# Project: GBS Tool # Author: Dr. <NAME>, <EMAIL> # Date: September 30, 2017 --> # License: MIT License (see LICENSE file of this package for more information ''' Description OBJECTIVE: The functionality of this class is to: a) determine if the data provide in wtgDescriptor.xml already is sufficiently dense to de...
[ "scipy.interpolate.CubicSpline", "numpy.rint", "numpy.array", "numpy.arange" ]
[((7657, 7668), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (7665, 7668), True, 'import numpy as np\n'), ((7687, 7698), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (7695, 7698), True, 'import numpy as np\n'), ((8057, 8124), 'scipy.interpolate.CubicSpline', 'CubicSpline', (['xCoords', 'yCoords'], {'bc_type': '...
# -*- coding: utf-8 -*- # This work is part of the Core Imaging Library developed by # Visual Analytics and Imaging System Group of the Science Technology # Facilities Council, STFC # Copyright 2018 <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this fil...
[ "ccpi.framework.ImageGeometry", "numpy.transpose", "ccpi.framework.ImageData", "ccpi.framework.AcquisitionData", "ccpi.framework.AcquisitionGeometry" ]
[((1080, 1173), 'ccpi.framework.ImageGeometry', 'ImageGeometry', ([], {'voxel_num_x': 'voxel_num_x', 'voxel_num_y': 'voxel_num_y', 'voxel_num_z': 'voxel_num_z'}), '(voxel_num_x=voxel_num_x, voxel_num_y=voxel_num_y, voxel_num_z\n =voxel_num_z)\n', (1093, 1173), False, 'from ccpi.framework import DataProcessor, Acquis...
import os os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2,3" import tensorflow as tf import gzip import numpy as np import os import six.moves.cPickle as pickle import time def load_mnist_data(dataset): """ Load the dataset Code adapted from http://deeplearning.net/tutorial/code/logistic_sgd.py :type dataset: st...
[ "tensorflow.reduce_sum", "gzip.open", "tensorflow.control_dependencies", "tensorflow.keras.layers.Dense", "tensorflow.global_variables_initializer", "tensorflow.identity", "tensorflow.distribute.MirroredStrategy", "numpy.zeros", "tensorflow.Session", "time.time", "tensorflow.nn.softmax_cross_ent...
[((470, 492), 'os.path.split', 'os.path.split', (['dataset'], {}), '(dataset)\n', (483, 492), False, 'import os\n'), ((1604, 1634), 'numpy.zeros', 'np.zeros', (['(vals.size, max_val)'], {}), '((vals.size, max_val))\n', (1612, 1634), True, 'import numpy as np\n'), ((5214, 5225), 'time.time', 'time.time', ([], {}), '()\n...
#!/usr/bin/env python # coding=utf-8 """QC Config objects Module to store the different QC modules in ioos_qc Attributes: tw (namedtuple): The TimeWindow namedtuple definition """ import io import logging import warnings from pathlib import Path from copy import deepcopy from inspect import signature from functoo...
[ "functools.partial", "copy.deepcopy", "ioos_qc.streams.NumpyStream", "ioos_qc.utils.load_config_as_dict", "ioos_qc.utils.dict_depth", "logging.getLogger", "dataclasses.field", "inspect.signature", "collections.namedtuple", "numpy.array", "collections.OrderedDict", "warnings.warn", "shapely.g...
[((698, 725), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (715, 725), False, 'import logging\n'), ((797, 868), 'collections.namedtuple', 'namedtuple', (['"""TimeWindow"""', "('starting', 'ending')"], {'defaults': '[None, None]'}), "('TimeWindow', ('starting', 'ending'), defaults=[None,...
import torch import re from PIL import Image from pathlib import Path from tabulate import tabulate from torch.utils.data import Dataset from torchvision import transforms from collections import defaultdict from torch.utils.data.sampler import Sampler from copy import deepcopy import numpy as np import random class ...
[ "copy.deepcopy", "random.sample", "random.shuffle", "torchvision.transforms.ToTensor", "collections.defaultdict", "PIL.Image.open", "pathlib.Path", "tabulate.tabulate", "numpy.random.choice", "torchvision.transforms.Normalize", "re.compile" ]
[((469, 479), 'pathlib.Path', 'Path', (['root'], {}), '(root)\n', (473, 479), False, 'from pathlib import Path\n'), ((1705, 1735), 're.compile', 're.compile', (['"""([-\\\\d]+)_c(\\\\d)"""'], {}), "('([-\\\\d]+)_c(\\\\d)')\n", (1715, 1735), False, 'import re\n'), ((2896, 2913), 'collections.defaultdict', 'defaultdict',...
import os, torch, numpy as np import pickle from core.data_utils import graph_algorithms from core.data_utils.graph_generation import GraphType, generate_graph from inspect import signature from torch_geometric.data import InMemoryDataset from torch_geometric.data.data import Data from torch_geometric.utils import den...
[ "numpy.stack", "core.data_utils.graph_generation.generate_graph", "pickle.dump", "os.makedirs", "torch.load", "os.path.dirname", "os.path.exists", "numpy.zeros", "numpy.asarray", "numpy.max", "pickle.load", "inspect.signature", "numpy.random.randint", "core.data_utils.graph_algorithms.all_...
[((797, 844), 'os.path.join', 'os.path.join', (['self.processed_dir', 'f"""{split}.pt"""'], {}), "(self.processed_dir, f'{split}.pt')\n", (809, 844), False, 'import os, torch, numpy as np\n'), ((878, 894), 'torch.load', 'torch.load', (['path'], {}), '(path)\n', (888, 894), False, 'import os, torch, numpy as np\n'), ((3...
import torch from envs import shipping_assignment_state from envs.shipping_assignment_state import ShippingAssignmentState from network.physical_network import Node from shipping_allocation import PhysicalNetwork import numpy as np from experiment_utils.Order import Order def test_state_to_demand_per_warehouse_commod...
[ "envs.shipping_assignment_state.state_to_demand_per_warehouse_commodity", "numpy.array", "envs.shipping_assignment_state.ShippingAssignmentState", "network.physical_network.Node", "shipping_allocation.PhysicalNetwork" ]
[((362, 414), 'shipping_allocation.PhysicalNetwork', 'PhysicalNetwork', (['(3)', '(5)', '(2)', '(100)', '(50)'], {'num_commodities': '(3)'}), '(3, 5, 2, 100, 50, num_commodities=3)\n', (377, 414), False, 'from shipping_allocation import PhysicalNetwork\n'), ((436, 460), 'network.physical_network.Node', 'Node', (['(4)',...
__all__ = ['PDataset'] import os from typing import Union, List import warnings import numpy as np from .rt_fastarray import FastArray from .rt_enum import ( TypeRegister, DisplayJustification, ) from .rt_numpy import ( unique, empty, cumsum, searchsorted, max, ) from ...
[ "warnings.warn", "numpy.chararray.rjust" ]
[((25284, 25386), 'warnings.warn', 'warnings.warn', (['f"""To be implemented. PDataset will currently be saved / loaded as a Dataset."""'], {}), "(\n f'To be implemented. PDataset will currently be saved / loaded as a Dataset.'\n )\n", (25297, 25386), False, 'import warnings\n'), ((19939, 19976), 'numpy.chararray...
""" pore_distribution module handles cumulative and frequency pore distributions from MIP and data. Created on 29/10/2019 MIT License - Copyright (c) 2019 <NAME> @author: PedroMat8 @email: <EMAIL> Please cite the following DOI: 10.5281/zenodo.3524929 GitHub repository: https://github.com/PedroMat8/micropy """ impor...
[ "numpy.radians", "numpy.size", "numpy.multiply", "numpy.empty", "numpy.savetxt", "numpy.append", "numpy.max", "numpy.min", "numpy.arange", "numpy.loadtxt", "numpy.sort", "numpy.interp", "numpy.log10", "matplotlib.pyplot.subplots", "sys.exit" ]
[((1193, 1208), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (1205, 1208), True, 'import matplotlib.pyplot as plt\n'), ((1641, 1656), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (1653, 1656), True, 'import matplotlib.pyplot as plt\n'), ((2307, 2376), 'numpy.savetxt', '...
from param import Param from grid import Grid from fluid2d import Fluid2d import numpy as np """ Reentrant channel with prescribed transport through the channel. The transport is controlled via psi0, the streamfunction at the North Wall -- psi=0 on the South Wall. An island with psi=psi0/2 is also set in the middle of...
[ "numpy.random.seed", "grid.Grid", "param.Param", "numpy.shape", "numpy.where", "fluid2d.Fluid2d", "numpy.sqrt" ]
[((581, 601), 'param.Param', 'Param', (['"""default.xml"""'], {}), "('default.xml')\n", (586, 601), False, 'from param import Param\n'), ((1513, 1524), 'grid.Grid', 'Grid', (['param'], {}), '(param)\n', (1517, 1524), False, 'from grid import Grid\n'), ((2424, 2444), 'fluid2d.Fluid2d', 'Fluid2d', (['param', 'grid'], {})...
import unittest from CTL.tensor.tensor import Tensor import numpy as np from CTL.tests.packedTest import PackedTest import CTL.funcs.funcs as funcs from CTL.examples.MPS import FreeBoundaryMPS, mergeMPS, contractMPS, createMPSFromTensor, contractWithMPS from CTL.tensor.contract.link import makeLink from CTL.tensor.ten...
[ "CTL.examples.MPS.contractMPS", "numpy.random.random_sample", "CTL.tensor.contract.optimalContract.contractAndCostWithSequence", "CTL.examples.MPS.mergeMPS", "CTL.tensor.tensor.Tensor", "numpy.random.randint", "CTL.tensor.contract.link.makeLink", "CTL.examples.MPS.createMPSFromTensor", "CTL.examples...
[((2420, 2464), 'CTL.examples.MPS.FreeBoundaryMPS', 'FreeBoundaryMPS', ([], {'tensorList': '[tensor]', 'chi': '(16)'}), '(tensorList=[tensor], chi=16)\n', (2435, 2464), False, 'from CTL.examples.MPS import FreeBoundaryMPS, mergeMPS, contractMPS, createMPSFromTensor, contractWithMPS\n'), ((2730, 2807), 'CTL.tensor.tenso...
# built-in import os # third-party import numpy as np from scipy.stats import skew, kurtosis def signal_stats(signal=None, hist=True): """Compute statistical metrics describing the signal. Parameters ---------- signal : array Input signal. Returns ------- ...
[ "numpy.abs", "numpy.median", "numpy.std", "numpy.hstack", "numpy.percentile", "scipy.stats.skew", "numpy.mean", "numpy.array", "scipy.stats.kurtosis", "numpy.var" ]
[((1401, 1417), 'numpy.array', 'np.array', (['signal'], {}), '(signal)\n', (1409, 1417), True, 'import numpy as np\n'), ((1519, 1534), 'numpy.mean', 'np.mean', (['signal'], {}), '(signal)\n', (1526, 1534), True, 'import numpy as np\n'), ((1552, 1569), 'numpy.median', 'np.median', (['signal'], {}), '(signal)\n', (1561, ...
""" Bit array or vector representations of Paulis for 3Di codes. Although qecsim already has such an implementation, some of these extra routines are useful specifically for dealing with the 3D code. :Author: <NAME> """ from typing import Union, List import numpy as np from . import bsparse from scipy.sparse impo...
[ "numpy.zeros_like", "numpy.all", "numpy.hsplit", "numpy.hstack", "numpy.array", "numpy.reshape", "numpy.array_equal", "numpy.union1d", "numpy.concatenate" ]
[((6835, 6853), 'numpy.zeros_like', 'np.zeros_like', (['bsf'], {}), '(bsf)\n', (6848, 6853), True, 'import numpy as np\n'), ((511, 537), 'numpy.array', 'np.array', (['a'], {'dtype': '"""uint8"""'}), "(a, dtype='uint8')\n", (519, 537), True, 'import numpy as np\n'), ((578, 604), 'numpy.array', 'np.array', (['b'], {'dtyp...
import csv import os import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import torch from datasets import Dataset from tqdm import tqdm from transformers import (AutoModelForTokenClassification, AutoTokenizer, DataCollatorForTokenClass...
[ "numpy.argmax", "transformers.DataCollatorForTokenClassification", "transformers.AutoTokenizer.from_pretrained", "torch.device", "datasets.Dataset.from_pandas", "transformers.Trainer", "os.path.join" ]
[((1048, 1094), 'os.path.join', 'os.path.join', (['saved_model', '"""pytorch_model.bin"""'], {}), "(saved_model, 'pytorch_model.bin')\n", (1060, 1094), False, 'import os\n'), ((1121, 1194), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['self.tok_checkpoint'], {'add_prefix_space': '(Tr...
import os import random import numpy as np import torch from utils.dataset import * from utils.basenet import * from utils.model import * from utils.datautils import * from train import * from test import * import torch.nn as nn import torch.optim as optim import torch.nn.functional as F def train_n...
[ "numpy.random.seed", "torch.manual_seed", "random.seed", "torch.cuda.is_available", "torch.device" ]
[((448, 468), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (462, 468), True, 'import numpy as np\n'), ((474, 497), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (491, 497), False, 'import torch\n'), ((503, 520), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (514...
import pygame import random import numpy as np pygame.font.init() fontsize = 20 myfont = pygame.font.SysFont('Comic Sans MS', fontsize) textstrings = ["Click and drag the mouse near your blue planet to throw a rock.", "Hit the red planet with the rock, and don't hit yours!", "Hit ESC to exit."] fps = 60 dt = 1. G = 1...
[ "pygame.font.SysFont", "pygame.event.get", "pygame.init", "pygame.font.init", "pygame.display.update", "numpy.array", "pygame.surfarray.pixels3d", "pygame.image.load", "pygame.display.set_caption", "pygame.time.Clock", "numpy.sqrt" ]
[((48, 66), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (64, 66), False, 'import pygame\n'), ((90, 136), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Comic Sans MS"""', 'fontsize'], {}), "('Comic Sans MS', fontsize)\n", (109, 136), False, 'import pygame\n'), ((323, 336), 'pygame.init', 'pygame.init...
# coding=utf-8 import os from io import BytesIO import numpy as np from PIL import Image from mindspore.mindrecord import FileWriter from .segbase import SegDataset __all__ = ['Cityscapes'] seg_schema = { "file_name": {"type": "string"}, "data": {"type": "bytes"}, "label": {"type": "bytes"} } class Cit...
[ "mindspore.mindrecord.FileWriter", "io.BytesIO", "numpy.random.shuffle", "os.path.basename", "numpy.random.get_state", "os.path.dirname", "os.walk", "numpy.random.set_state", "PIL.Image.open", "os.path.isfile", "numpy.array", "os.path.join", "numpy.unique" ]
[((4068, 4087), 'os.walk', 'os.walk', (['img_folder'], {}), '(img_folder)\n', (4075, 4087), False, 'import os\n'), ((934, 1078), 'numpy.array', 'np.array', (['[19, 19, 19, 19, 19, 19, 19, 19, 0, 1, 19, 19, 2, 3, 4, 19, 19, 19, 5, 19, \n 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 19, 19, 16, 17, 18]'], {}), '([19, 19, 19, 1...
import os import shutil import requests import traceback import tarfile import pickle import torch import numpy as np from torch.utils.data import Dataset, DataLoader cifar_dataset_path = "./cifar_dataset/" def getCifar10Dataset(path=None): if path is not None: global cifar_dataset_path cifar_d...
[ "os.mkdir", "os.remove", "traceback.print_exc", "shutil.rmtree", "os.path.isdir", "numpy.empty", "pickle.load", "numpy.array", "requests.get", "shutil.move", "tarfile.open", "os.rmdir", "os.listdir", "numpy.concatenate", "torch.from_numpy" ]
[((537, 570), 'os.path.isdir', 'os.path.isdir', (['cifar_dataset_path'], {}), '(cifar_dataset_path)\n', (550, 570), False, 'import os\n'), ((1004, 1052), 'requests.get', 'requests.get', (['cifar_10_url'], {'allow_redirects': '(True)'}), '(cifar_10_url, allow_redirects=True)\n', (1016, 1052), False, 'import requests\n')...
# # Copyright (c) 2018 <NAME> <<EMAIL>> # # See the file LICENSE for your rights. # """ Methods for training scikit-learn models. """ from datetime import datetime, timedelta import pandas as pd from mosx.util import get_object, to_bool, dewpoint from mosx.estimators import TimeSeriesEstimator, RainTuningEstimator, ...
[ "matplotlib.pyplot.title", "pickle.dump", "sklearn.preprocessing.StandardScaler", "sklearn.model_selection.train_test_split", "mosx.estimators.BootStrapEnsembleEstimator", "datetime.datetime.utcnow", "matplotlib.pyplot.figure", "numpy.mean", "pickle.load", "numpy.arange", "matplotlib.pyplot.fill...
[((869, 905), 'mosx.util.get_object', 'get_object', (["('sklearn.%s' % regressor)"], {}), "('sklearn.%s' % regressor)\n", (879, 905), False, 'from mosx.util import get_object, to_bool, dewpoint\n'), ((7515, 7539), 'numpy.linspace', 'np.linspace', (['(0.1)', '(1.0)', '(5)'], {}), '(0.1, 1.0, 5)\n', (7526, 7539), True, '...
""" @file @brief Functions about the `Gini coefficient <https://en.wikipedia.org/wiki/Gini_coefficient>`_. """ import numpy def gini(Y, X=None): """ Computes the `Gini coefficients <https://en.wikipedia.org/wiki/Gini_coefficient>`_. @param Y Y values (or revenues) @param X N...
[ "numpy.empty", "numpy.cumsum" ]
[((472, 491), 'numpy.empty', 'numpy.empty', (['(n, 2)'], {}), '((n, 2))\n', (483, 491), False, 'import numpy\n'), ((630, 659), 'numpy.cumsum', 'numpy.cumsum', (['couples'], {'axis': '(0)'}), '(couples, axis=0)\n', (642, 659), False, 'import numpy\n')]
# -*- coding: utf-8 -*- import itertools from dipy.io.stateful_tractogram import StatefulTractogram from dipy.tracking.metrics import length from dipy.tracking.streamline import set_number_of_points from dipy.tracking.vox2track import _streamlines_in_mask from nibabel.affines import apply_affine import numpy as np ...
[ "numpy.sum", "numpy.abs", "numpy.unique", "numpy.max", "itertools.product", "numpy.intersect1d", "dipy.io.stateful_tractogram.StatefulTractogram.from_sft", "numpy.union1d", "numpy.average", "numpy.asarray", "numpy.min", "dipy.tracking.streamline.set_number_of_points", "numpy.linalg.inv", "...
[((787, 835), 'numpy.array', 'np.array', (['target_mask'], {'dtype': 'np.uint8', 'copy': '(True)'}), '(target_mask, dtype=np.uint8, copy=True)\n', (795, 835), True, 'import numpy as np\n'), ((3427, 3549), 'dipy.io.stateful_tractogram.StatefulTractogram.from_sft', 'StatefulTractogram.from_sft', (['streamlines', 'sft'], ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This file is part of the complex_terrain algorithm <NAME>, <NAME>, <NAME> (IGE, CEN). """ import numpy as np from astropy.convolution import convolve class Cases: """Terrain configuration class. The class allows the user to set a specific terrain configurati...
[ "numpy.full", "astropy.convolution.convolve", "numpy.dstack", "numpy.zeros_like", "numpy.expand_dims", "numpy.where", "numpy.cos", "numpy.nanmean" ]
[((3522, 3552), 'numpy.full', 'np.full', (['(tw, tw)', '(1 / tw ** 2)'], {}), '((tw, tw), 1 / tw ** 2)\n', (3529, 3552), True, 'import numpy as np\n'), ((3598, 3628), 'numpy.full', 'np.full', (['(aw, aw)', '(1 / aw ** 2)'], {}), '((aw, aw), 1 / aw ** 2)\n', (3605, 3628), True, 'import numpy as np\n'), ((3724, 3750), 'n...
#!/usr/bin/env python3 import os import sys import argparse import datetime as dt import numpy as np import pandas as pd import hyperopt as hp from scipy import stats from scipy.spatial.distance import hamming import dimod from dwave.system import EmbeddingComposite, FixedEmbeddingComposite, TilingComposite, DWaveSamp...
[ "numpy.set_printoptions", "argparse.ArgumentParser", "dwave.system.DWaveSampler", "quantum_unfolding.get_embedding_with_short_chain", "quantum_unfolding.compact_vector", "hyperopt.hp.choice", "hyperopt.fmin", "scipy.spatial.distance.hamming", "dimod.BinaryQuadraticModel", "hyperopt.Trials", "qua...
[((468, 530), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(1)', 'linewidth': '(200)', 'suppress': '(True)'}), '(precision=1, linewidth=200, suppress=True)\n', (487, 530), True, 'import numpy as np\n'), ((541, 595), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Quantum unfolding op...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file defines a gaussian noise filter that can be used in experiments and evaluations. """ __author__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright 2020, <NAME>" __license__ = "MIT License" __version__ = "1.0.0" import numpy as np from skimage....
[ "numpy.random.get_state", "skopt.space.Real", "numpy.clip", "numpy.random.set_state" ]
[((958, 979), 'numpy.random.get_state', 'np.random.get_state', ([], {}), '()\n', (977, 979), True, 'import numpy as np\n'), ((1170, 1199), 'numpy.random.set_state', 'np.random.set_state', (['previous'], {}), '(previous)\n', (1189, 1199), True, 'import numpy as np\n'), ((757, 796), 'skopt.space.Real', 'Real', ([], {'low...
import glob import os import re import subprocess import numpy as np for L in [600, 800, 1000, 1200, 1400]: # Make folder to save omf files SAVE_FOLDER = 'omfs_L{}nm_t200nm'.format(L) if os.path.exists(SAVE_FOLDER): os.rmdir(SAVE_FOLDER) os.mkdir(SAVE_FOLDER) # for Bz in np.arange(0.05, 0...
[ "os.rmdir", "os.mkdir", "os.path.exists", "numpy.arange" ]
[((201, 228), 'os.path.exists', 'os.path.exists', (['SAVE_FOLDER'], {}), '(SAVE_FOLDER)\n', (215, 228), False, 'import os\n'), ((264, 285), 'os.mkdir', 'os.mkdir', (['SAVE_FOLDER'], {}), '(SAVE_FOLDER)\n', (272, 285), False, 'import os\n'), ((346, 368), 'numpy.arange', 'np.arange', (['(40)', '(331)', '(10)'], {}), '(40...
import argparse import torch import numpy as np import pandas as pd import torch.nn.functional as F def main(args): embedding_file = args.embedding_file k = args.k player = args.player players_file = args.players_file df = pd.read_csv(players_file) embeddings = torch.from_numpy(np.load(embedd...
[ "numpy.load", "torch.topk", "argparse.ArgumentParser", "pandas.read_csv", "torch.nn.functional.cosine_similarity" ]
[((246, 271), 'pandas.read_csv', 'pd.read_csv', (['players_file'], {}), '(players_file)\n', (257, 271), True, 'import pandas as pd\n'), ((420, 455), 'torch.nn.functional.cosine_similarity', 'F.cosine_similarity', (['xs', 'embeddings'], {}), '(xs, embeddings)\n', (439, 455), True, 'import torch.nn.functional as F\n'), (...
import numpy as np import matplotlib.pyplot as plt import gym import time class OptimizationEnv(gym.Env): def __init__(self, fn_name="Rastrigin", agent_mode=False, shuffle=False): self.max_steps = 32 if "astrigi" in fn_name: self.fn_name = "rastrigin" elif "osenbro" in fn_na...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.axis", "numpy.append", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "numpy.random.random", "numpy.linspace", "numpy.cos", "numpy.min", "numpy.max" ]
[((4238, 4253), 'numpy.mean', 'np.mean', (['reward'], {}), '(reward)\n', (4245, 4253), True, 'import numpy as np\n'), ((4496, 4574), 'numpy.linspace', 'np.linspace', (['self.fn_dict[self.fn_name][1]', 'self.fn_dict[self.fn_name][2]', '(256)'], {}), '(self.fn_dict[self.fn_name][1], self.fn_dict[self.fn_name][2], 256)\n'...
import numpy as np # pylint: disable=E1101 import matplotlib.pyplot as plt import random from math import floor, ceil from logger import log def genRoughFault(filename, mesh, surfacePts, centerPts, rseed, length, depth, lambdaMin, alpha, Hurst): # Input parameters: # filename: Filename for saving .ply...
[ "numpy.meshgrid", "numpy.std", "numpy.zeros", "random.random", "random.seed", "numpy.arange", "numpy.exp", "numpy.conjugate", "numpy.fft.ifft2", "numpy.sqrt" ]
[((839, 857), 'random.seed', 'random.seed', (['rseed'], {}), '(rseed)\n', (850, 857), False, 'import random\n'), ((1094, 1124), 'numpy.zeros', 'np.zeros', (['(N * N)'], {'dtype': 'complex'}), '(N * N, dtype=complex)\n', (1102, 1124), True, 'import numpy as np\n'), ((2110, 2153), 'numpy.arange', 'np.arange', (['(-length...
############################################ Inputs ############################################# while True: try: macroporousSize=int(input("What is the macropore radius (R)? ")) if not 0 < macroporousSize: raise ValueError("Enter a valid value") except ValueError as e: p...
[ "pylab.title", "pylab.show", "openpyxl.Workbook", "random.randint", "numpy.zeros", "pylab.grid", "random.choice", "pylab.xscale", "pylab.yticks", "openpyxl.styles.Alignment", "pylab.xlabel", "pylab.plot", "numpy.sqrt" ]
[((15381, 15391), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (15389, 15391), False, 'from openpyxl import Workbook\n'), ((16089, 16131), 'numpy.zeros', 'numpy.zeros', (['(self.numberBins,)'], {'dtype': 'int'}), '((self.numberBins,), dtype=int)\n', (16100, 16131), False, 'import numpy\n'), ((16626, 16679), 'pyla...
# -*- coding: utf-8 -*- __all__ = ["InferShapeTester"] import numpy as np from aesara_theano_fallback import aesara as theano class InferShapeTester: def setup_method(self): # Take into account any mode that may be defined in a child class # and it can be None mode = getattr(self, "mode"...
[ "aesara_theano_fallback.aesara.function", "numpy.all", "aesara_theano_fallback.aesara.compile.get_default_mode" ]
[((1674, 1717), 'aesara_theano_fallback.aesara.function', 'theano.function', (['inputs', 'outputs'], {'mode': 'mode'}), '(inputs, outputs, mode=mode)\n', (1689, 1717), True, 'from aesara_theano_fallback import aesara as theano\n'), ((1744, 1806), 'aesara_theano_fallback.aesara.function', 'theano.function', (['inputs', ...
import numpy as np import pandas as pd import matplotlib.pyplot as plt fname = 'model_train.log' print('Reading:', fname) df = pd.read_csv(fname) epoch = df['epoch'].values + 1 loss = df['loss'].values val_loss = df['val_loss'].values print('epochs: %8d ... %d' % (np.min(epoch), np.max(epoch))) print('loss: %...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "pandas.read_csv", "matplotlib.pyplot.legend", "numpy.argmin", "numpy.min", "numpy.max", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "matplotl...
[((129, 147), 'pandas.read_csv', 'pd.read_csv', (['fname'], {}), '(fname)\n', (140, 147), True, 'import pandas as pd\n'), ((439, 480), 'matplotlib.pyplot.plot', 'plt.plot', (['epoch', 'loss'], {'label': '"""train loss"""'}), "(epoch, loss, label='train loss')\n", (447, 480), True, 'import matplotlib.pyplot as plt\n'), ...
#!/usr/bin/python # <NAME>, HKUST, 2019. # Copyright reserved. # This file is an example to parse the feature and matching file, # in accord with our internal format. from __future__ import print_function import os import sys import glob import numpy as np import math from struct import unpack from PIL import Image,...
[ "numpy.matrix", "numpy.multiply", "struct.unpack", "numpy.ones", "numpy.mean", "numpy.array", "numpy.reshape", "os.path.split", "os.path.join", "numpy.concatenate" ]
[((794, 812), 'struct.unpack', 'unpack', (['"""5i"""', 'head'], {}), "('5i', head)\n", (800, 812), False, 'from struct import unpack\n'), ((1574, 1617), 'numpy.reshape', 'np.reshape', (['keypts', '(num_features, loc_dim)'], {}), '(keypts, (num_features, loc_dim))\n', (1584, 1617), True, 'import numpy as np\n'), ((1828,...
import matplotlib.pyplot as plt from numpy import linspace class EvaluateProteinInference(): def __init__(self): return def plot_n_over_fdr(self, protein_table): fdr_values = linspace(0, 1, 100) n_identified = [] for value in fdr_values: n_identifie...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((215, 234), 'numpy.linspace', 'linspace', (['(0)', '(1)', '(100)'], {}), '(0, 1, 100)\n', (223, 234), False, 'from numpy import linspace\n'), ((373, 407), 'matplotlib.pyplot.plot', 'plt.plot', (['fdr_values', 'n_identified'], {}), '(fdr_values, n_identified)\n', (381, 407), True, 'import matplotlib.pyplot as plt\n'),...
import numpy as np import theano as theano import theano.tensor as T from Evaluate import * class lstm: def __init__(self, user_dim=20, poi_dim=20, hidden_dim=20, negative=10, top_K=20, regu_para=0.01, num_user=5000, num_poi=100000): # Assign instance variables self.user_dim = use...
[ "theano.tensor.tanh", "theano.tensor.iscalar", "theano.tensor.sum", "theano.function", "theano.tensor.ivector", "theano.scan", "theano.tensor.zeros", "theano.tensor.grad", "numpy.random.randint", "numpy.arange", "theano.tensor.scalar", "numpy.sqrt" ]
[((3081, 3095), 'theano.tensor.ivector', 'T.ivector', (['"""x"""'], {}), "('x')\n", (3090, 3095), True, 'import theano.tensor as T\n'), ((3108, 3122), 'theano.tensor.ivector', 'T.ivector', (['"""y"""'], {}), "('y')\n", (3117, 3122), True, 'import theano.tensor as T\n'), ((3135, 3149), 'theano.tensor.iscalar', 'T.iscala...
# -*- coding: utf-8 -*- import types from abc import ABC, abstractmethod from collections import OrderedDict from collections.abc import Iterable, Sequence from contextlib import contextmanager from inspect import iscode import iris import joblib import numpy as np import pandas as pd import xxhash from iris.time impo...
[ "inspect.iscode", "xxhash.xxh64_hexdigest", "numpy.ascontiguousarray", "joblib.hashing.hash" ]
[((721, 733), 'inspect.iscode', 'iscode', (['code'], {}), '(code)\n', (727, 733), False, 'from inspect import iscode\n'), ((3412, 3446), 'joblib.hashing.hash', 'joblib.hashing.hash', (['cube.metadata'], {}), '(cube.metadata)\n', (3431, 3446), False, 'import joblib\n'), ((4736, 4765), 'joblib.hashing.hash', 'joblib.hash...
# -*- coding: utf-8 -*- """ @author: <NAME> Script de Python para la visualización de la simulación. """ import numpy as np #import seaborn as sns import matplotlib.pyplot as plt import scipy as sc import matplotlib.ticker as ticker from matplotlib import rcParams rcParams.update({'figure.autolayout': True}) #plt.r...
[ "matplotlib.pyplot.xlim", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "matplotlib.pyplot.ylim", "matplotlib.pyplot.imshow", "matplotlib.rcParams.update", "matplotlib.pyplot.yticks", "matplotlib.ticker.FuncFormatter", "numpy.loadtxt", "matplotlib.pyplot.xticks", "matplotlib.pyplot.ylabel",...
[((268, 312), 'matplotlib.rcParams.update', 'rcParams.update', (["{'figure.autolayout': True}"], {}), "({'figure.autolayout': True})\n", (283, 312), False, 'from matplotlib import rcParams\n'), ((428, 462), 'matplotlib.rcParams.update', 'rcParams.update', (["{'font.size': 11}"], {}), "({'font.size': 11})\n", (443, 462)...
from typing import NamedTuple from matplotlib import pyplot as plt import argparse import re import os import numpy as np # Parse loss from a file, assuming the style of checkpoints/loss_log.txt but with only a single run in it with no headers def parse_loss(file): # regex pattern p = r'\(epoch: (\d+), iters:...
[ "matplotlib.pyplot.title", "os.mkdir", "argparse.ArgumentParser", "matplotlib.pyplot.plot", "os.path.isdir", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.max", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "matplotlib.pyplo...
[((1179, 1191), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1189, 1191), True, 'from matplotlib import pyplot as plt\n'), ((1196, 1227), 'matplotlib.pyplot.title', 'plt.title', (['f"""{args.type} Graph"""'], {}), "(f'{args.type} Graph')\n", (1205, 1227), True, 'from matplotlib import pyplot as plt\n'),...
import numpy as np import socket from base64 import b64encode as b64e, b64decode as b64d from zlib import compress, decompress q = 2**11 n = 280 n_bar = 4 m_bar = 4 def get_E_from_ABSq(A, B, S, q): return np.mod(np.mod((B- A*S), q) + 1, q) - 1 def tryUCkb(U, C, kb): # vérifie si self.__decode(np.mod(C - ...
[ "numpy.matrix", "numpy.vectorize", "socket.socket", "numpy.mod", "base64.b64decode", "numpy.random.randint", "numpy.dot" ]
[((623, 653), 'numpy.mod', 'np.mod', (['(A * S_a + E_a)', '(2 ** 11)'], {}), '(A * S_a + E_a, 2 ** 11)\n', (629, 653), True, 'import numpy as np\n'), ((1082, 1104), 'numpy.vectorize', 'np.vectorize', (['recenter'], {}), '(recenter)\n', (1094, 1104), True, 'import numpy as np\n'), ((1120, 1148), 'numpy.vectorize', 'np.v...
# This file is part of the bapsflib package, a Python toolkit for the # BaPSF group at UCLA. # # http://plasma.physics.ucla.edu/ # # Copyright 2017-2018 <NAME> and contributors # # License: Standard 3-clause BSD; see "LICENSES/LICENSE.txt" for full # license terms and contributor agreement. # """ Helper functions tha...
[ "numpy.isin", "numpy.empty", "numpy.ones", "numpy.where", "numpy.array", "numpy.arange", "numpy.intersect1d", "numpy.issubdtype" ]
[((4734, 4775), 'numpy.where', 'np.where', (['(shotnum == only_sn)', '(True)', '(False)'], {}), '(shotnum == only_sn, True, False)\n', (4742, 4775), True, 'import numpy as np\n'), ((9817, 9858), 'numpy.where', 'np.where', (['(shotnum == only_sn)', '(True)', '(False)'], {}), '(shotnum == only_sn, True, False)\n', (9825,...
import collections import numpy as np import os import sys import tensorflow as tf from tensorflow.contrib.tensorboard.plugins import projector import abi.core.rnn_utils as rnn_utils import abi.misc.tf_utils as tf_utils import abi.misc.utils as utils class RNNVAE(object): def __init__( self, ...
[ "sys.stdout.write", "abi.misc.utils.write_metadata", "numpy.load", "tensorflow.reduce_sum", "tensorflow.trainable_variables", "tensorflow.clip_by_value", "tensorflow.maximum", "tensorflow.reshape", "collections.defaultdict", "tensorflow.assign", "tensorflow.Variable", "tensorflow.contrib.tenso...
[((1677, 1762), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '(self.batch_size, self.max_len, self.obs_dim)', '"""obs"""'], {}), "(tf.float32, (self.batch_size, self.max_len, self.obs_dim), 'obs'\n )\n", (1691, 1762), True, 'import tensorflow as tf\n'), ((1777, 1862), 'tensorflow.placeholder', 'tf.pla...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "numpy.median", "numpy.max", "numpy.mean", "collections.OrderedDict", "collections.deque" ]
[((993, 1030), 'collections.deque', 'collections.deque', ([], {'maxlen': 'window_size'}), '(maxlen=window_size)\n', (1010, 1030), False, 'import collections\n'), ((1277, 1298), 'numpy.median', 'np.median', (['self.deque'], {}), '(self.deque)\n', (1286, 1298), True, 'import numpy as np\n'), ((1348, 1367), 'numpy.mean', ...
''' Define the sublayers in encoder/decoder layer ''' import numpy as np import torch.nn as nn import torch.nn.functional as F from transformer.Modules import ScaledDotProductAttention __author__ = "<NAME>" class MultiHeadAttention(nn.Module): ''' Multi-Head Attention module ''' def __init__(self, n_head, d_...
[ "torch.nn.Dropout", "numpy.power", "torch.nn.init.xavier_normal_", "torch.nn.Conv1d", "torch.nn.init.zeros_", "torch.nn.LayerNorm", "torch.nn.Linear", "numpy.sqrt" ]
[((854, 884), 'torch.nn.Linear', 'nn.Linear', (['d_out', '(n_head * d_k)'], {}), '(d_out, n_head * d_k)\n', (863, 884), True, 'import torch.nn as nn\n'), ((905, 934), 'torch.nn.Linear', 'nn.Linear', (['d_in', '(n_head * d_k)'], {}), '(d_in, n_head * d_k)\n', (914, 934), True, 'import torch.nn as nn\n'), ((955, 984), 't...
import argparse import json import matplotlib.pyplot as plt import numpy as np from astropy.coordinates import SkyCoord, AltAz, EarthLocation, ICRS from astropy import units as u from astropy.time import Time from astropy.wcs import WCS from astropy.io import fits from scipy.signal import convolve2d import tempfile, os...
[ "astrofluxlib.CrossSky", "matplotlib.pyplot.title", "numpy.abs", "argparse.ArgumentParser", "astrofluxlib.to_uv", "astrofluxlib.xcorr_signals", "json.dumps", "matplotlib.pyplot.figure", "astrofluxlib.propagate_antennas", "numpy.arange", "astrofluxlib.StarSky", "numpy.sin", "matplotlib.pyplot...
[((393, 487), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A CLI for running radio interferometry simulations"""'}), "(description=\n 'A CLI for running radio interferometry simulations')\n", (416, 487), False, 'import argparse\n'), ((2319, 2348), 'numpy.zeros', 'np.zeros', (['anten...
from __future__ import print_function import numpy as np from PySource import RickerSource from PyModel import Model from PySource import Receiver from JAcoustic_codegen import forward_born, forward_modeling, forward_freq_modeling, adjoint_freq_born, adjoint_born import time import h5py import matplotlib.pyplot as plt ...
[ "JAcoustic_codegen.forward_modeling", "h5py.File", "JAcoustic_codegen.forward_freq_modeling", "JAcoustic_codegen.adjoint_born", "time.time", "PySource.RickerSource", "PySource.Receiver", "JAcoustic_codegen.adjoint_freq_born", "numpy.array", "numpy.linspace", "numpy.sqrt" ]
[((352, 451), 'h5py.File', 'h5py.File', (['"""/scratch/slim/shared/mathias-philipp/bp_synthetic_2004/model/vp_fine.h5"""', '"""r+"""'], {}), "(\n '/scratch/slim/shared/mathias-philipp/bp_synthetic_2004/model/vp_fine.h5',\n 'r+')\n", (361, 451), False, 'import h5py\n'), ((781, 804), 'numpy.linspace', 'np.linspace'...
import cv2 import numpy as np from typing import List import warnings from skimage.morphology import remove_small_objects, label warnings.filterwarnings('ignore', category=FutureWarning) import tensorflow as tf __all__ = ["getMagnification"] def _initModel(): '''Initialise the ML model https://towardsdata...
[ "numpy.sum", "tensorflow.keras.layers.Dense", "numpy.ones", "numpy.mean", "tensorflow.keras.layers.MaxPool2D", "tensorflow.keras.models.Sequential", "glob.glob", "cv2.erode", "tensorflow.keras.layers.Flatten", "cv2.dilate", "cv2.cvtColor", "skimage.morphology.label", "matplotlib.pyplot.subpl...
[((129, 186), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (152, 186), False, 'import warnings\n'), ((611, 639), 'tensorflow.keras.models.Sequential', 'tf.keras.models.Sequential', ([], {}), '()\n', (637, 639), True, 'im...
import numpy as np def get_vehicle_info(vehicle): angular_velocity = vehicle.get_angular_velocity() acceleration = vehicle.get_acceleration() velocity = vehicle.get_velocity() transform = vehicle.get_transform() location = transform.location rotation = transform.rotation vehicle_info = np....
[ "numpy.array" ]
[((317, 564), 'numpy.array', 'np.array', (['[location.x, location.y, location.z, rotation.pitch, rotation.roll,\n rotation.yaw, velocity.x, velocity.y, velocity.z, angular_velocity.x,\n angular_velocity.y, angular_velocity.z, acceleration.x, acceleration.y,\n acceleration.z]'], {}), '([location.x, location.y, ...
""" Test & demo file """ from collections import deque from enum import Enum import numpy as np from hamiltonian.manager import Manager class TestManager(Manager): """ A hectic test to show that the point generation, line generation, point deletion, line deletion, point movements work. :param pe...
[ "numpy.random.rand" ]
[((794, 811), 'numpy.random.rand', 'np.random.rand', (['(2)'], {}), '(2)\n', (808, 811), True, 'import numpy as np\n'), ((1082, 1099), 'numpy.random.rand', 'np.random.rand', (['(2)'], {}), '(2)\n', (1096, 1099), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- import json import os import pickle import random import dlib ### Work around - CUDA_ERROR_OUT_OF_MEMORY import keras.backend as K import numpy as np import tensorflow as tf from PIL import Image from keras import models, layers, optimizers from keras.callbacks import EarlyStopping from keras.mo...
[ "keras.models.load_model", "numpy.load", "pickle.dump", "keras.backend.tf.ConfigProto", "random.shuffle", "json.dumps", "utils.util.bas64ToRGB", "keras.optimizers.sgd", "os.path.isfile", "pickle.load", "api_face.keras_vggface.vggface.VGGFace", "tensorflow.get_default_graph", "os.path.exists"...
[((490, 508), 'keras.backend.tf.ConfigProto', 'K.tf.ConfigProto', ([], {}), '()\n', (506, 508), True, 'import keras.backend as K\n'), ((558, 585), 'keras.backend.tf.Session', 'K.tf.Session', ([], {'config': 'config'}), '(config=config)\n', (570, 585), True, 'import keras.backend as K\n'), ((1106, 1128), 'tensorflow.get...
from collections import OrderedDict import numpy as np from .object import OMBaseObject class Wavelet(OMBaseObject): tid = "wavelet" _TID_FRIENDLY_NAME = "Wavelet" _ATTRIBUTES = OrderedDict() _ATTRIBUTES['_type'] = { 'default_value': "Ricker", 'type': str } _A...
[ "collections.OrderedDict", "numpy.exp" ]
[((197, 210), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (208, 210), False, 'from collections import OrderedDict\n'), ((1052, 1069), 'numpy.exp', 'np.exp', (['(-tau ** 2)'], {}), '(-tau ** 2)\n', (1058, 1069), True, 'import numpy as np\n')]
import importlib from keras.layers import LSTM from minos.utils import save_sisy_model from minos.utils import load_sisy_model def ui(): import os import webbrowser path = os.path.realpath(os.path.dirname(__file__) + "/../ui/index.html") webbrowser.open_new_tab(path) if __name__ == "__main__": ...
[ "minos.experiment.ga.run_ga_search_experiment", "collections.defaultdict", "numpy.arange", "minos.model.model.Metric", "os.path.dirname", "webbrowser.open_new_tab", "minos.model.model.Layout", "minos.experiment.experiment.ExperimentParameters", "minos.experiment.experiment.ExperimentSettings", "mi...
[((259, 288), 'webbrowser.open_new_tab', 'webbrowser.open_new_tab', (['path'], {}), '(path)\n', (282, 288), False, 'import webbrowser\n'), ((3466, 3581), 'minos.train.utils.SimpleBatchIterator', 'SimpleBatchIterator', (['X_train', 'y_train'], {'batch_size': 'batch_size', 'autoloop': 'autoloop', 'preload': '(True)', 'sh...
from __future__ import annotations from typing import Optional, List, Dict, Tuple import logging import textwrap import pandas as pd import numpy as np import h5py from tqdm import tqdm from .catmaid_interface import Catmaid, Bbox, ConnectorDetail from .utils import CoordZYX logger = logging.getLogger(__name__) de...
[ "h5py.File", "numpy.zeros_like", "pandas.HDFStore", "pandas.read_hdf", "pandas.array", "numpy.logical_and", "numpy.asarray", "pandas.merge", "numpy.all", "logging.getLogger", "numpy.any", "numpy.array", "numpy.round", "numpy.unique" ]
[((288, 315), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (305, 315), False, 'import logging\n'), ((6205, 6247), 'pandas.array', 'pd.array', (["tns['parent_id']"], {'dtype': '"""UInt64"""'}), "(tns['parent_id'], dtype='UInt64')\n", (6213, 6247), True, 'import pandas as pd\n'), ((6476, ...
import numpy as np import torch import torch.utils.data import config as c x_test = torch.Tensor(np.load('./dkfz_data/x_test.npy')) y_test = torch.Tensor(np.load('./dkfz_data/y_test.npy')) x_train = np.concatenate([np.load('./dkfz_data/x_train.npy'), np.load('./dkfz_data/x_additional.npy')]...
[ "numpy.load", "train.main", "torch.Tensor", "torch.utils.data.TensorDataset", "numpy.argwhere", "numpy.delete" ]
[((579, 616), 'numpy.delete', 'np.delete', (['x_train', 'nan_index'], {'axis': '(0)'}), '(x_train, nan_index, axis=0)\n', (588, 616), True, 'import numpy as np\n'), ((627, 664), 'numpy.delete', 'np.delete', (['y_train', 'nan_index'], {'axis': '(0)'}), '(y_train, nan_index, axis=0)\n', (636, 664), True, 'import numpy as...
import numpy as np from pydrake.all import (AddMultibodyPlantSceneGraph, ConnectMeshcatVisualizer, Simulator, SpatialForce, RigidTransform) from pydrake.trajectories import PiecewisePolynomial from pydrake.systems.framework import DiagramBuilder from pydrake.multibody.plant import ExternallyAppliedSpatialForce fro...
[ "pydrake.all.ConnectMeshcatVisualizer", "pydrake.systems.framework.DiagramBuilder", "pydrake.all.Simulator", "numpy.zeros", "pydrake.all.AddMultibodyPlantSceneGraph", "pydrake.multibody.plant.ExternallyAppliedSpatialForce", "pydrake.all.SpatialForce", "pydrake.systems.primitives.TrajectorySource" ]
[((723, 739), 'pydrake.systems.framework.DiagramBuilder', 'DiagramBuilder', ([], {}), '()\n', (737, 739), False, 'from pydrake.systems.framework import DiagramBuilder\n'), ((884, 933), 'pydrake.all.AddMultibodyPlantSceneGraph', 'AddMultibodyPlantSceneGraph', (['builder'], {'plant': 'plant'}), '(builder, plant=plant)\n'...
import algopy import numpy as np from scipy.integrate import quad def quad(f, a, b): n = 1000 Q = np.linspace(a, b, n) W = 1 / n * np.ones(n) y = 0 for w, q in zip(W, Q): y += f(q) * w return y def eval_f(x): integrand = lambda t: x[0] * np.sin(x[1] * t) # return integrand(1...
[ "algopy.CGraph", "scipy.integrate.quad", "numpy.ones", "numpy.sin", "numpy.linspace", "algopy.Function" ]
[((433, 448), 'algopy.CGraph', 'algopy.CGraph', ([], {}), '()\n', (446, 448), False, 'import algopy\n'), ((453, 476), 'algopy.Function', 'algopy.Function', (['[1, 2]'], {}), '([1, 2])\n', (468, 476), False, 'import algopy\n'), ((108, 128), 'numpy.linspace', 'np.linspace', (['a', 'b', 'n'], {}), '(a, b, n)\n', (119, 128...
#!/usr/bin/env python import cv2 import numpy as np # Read Image im = cv2.imread("headPose.jpg"); size = im.shape # 2D image points. If you change the image, you need to change vector image_points = np.array([ (359, 391), # Nose tip (467, 311), # Left eye left corner (352, 311), # Right eye right corn...
[ "cv2.line", "cv2.waitKey", "cv2.solvePnP", "numpy.zeros", "cv2.projectPoints", "cv2.imread", "numpy.array", "cv2.imshow" ]
[((72, 98), 'cv2.imread', 'cv2.imread', (['"""headPose.jpg"""'], {}), "('headPose.jpg')\n", (82, 98), False, 'import cv2\n'), ((202, 292), 'numpy.array', 'np.array', (['[(359, 391), (467, 311), (352, 311), (642, 372), (314, 346)]'], {'dtype': '"""double"""'}), "([(359, 391), (467, 311), (352, 311), (642, 372), (314, 34...
import numpy as np import tensorflow as tf from .parse_dict import get_dict class TextRecognition(object): def __init__(self, pb_file, dict_file, seq_len): self.pb_file = pb_file self.dict_file = dict_file self.seq_len = seq_len self.init_model() self.init_dict() #...
[ "tensorflow.Session", "numpy.ones", "tensorflow.ConfigProto", "tensorflow.Graph", "tensorflow.import_graph_def", "tensorflow.GraphDef", "tensorflow.io.gfile.GFile" ]
[((375, 385), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (383, 385), True, 'import tensorflow as tf\n'), ((694, 735), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'allow_soft_placement': '(True)'}), '(allow_soft_placement=True)\n', (708, 735), True, 'import tensorflow as tf\n'), ((841, 884), 'tensorflow.Ses...
from __future__ import division import time import numpy as np import pandas as pd import logging from memoized_property import memoized_property # The ZBD object loads a few data files from disk. If this import fails then the functions that use it below will still # work, but only with default arguments. try: fro...
[ "pandas.DataFrame", "numpy.fft.rfft", "numpy.roll", "numpy.angle", "numpy.ones", "kid_readout.measurement.basic.SingleSweepStream", "time.time", "numpy.array", "equipment.vdi.zbd.ZBD", "kid_readout.measurement.basic.SweepStreamArray", "numpy.round", "pandas.concat", "logging.getLogger", "n...
[((461, 488), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (478, 488), False, 'import logging\n'), ((361, 366), 'equipment.vdi.zbd.ZBD', 'ZBD', ([], {}), '()\n', (364, 366), False, 'from equipment.vdi.zbd import ZBD\n'), ((1294, 1328), 'pandas.concat', 'pd.concat', (['rows'], {'ignore_i...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 28 08:55:59 2020 @author: heiko """ import numpy as np; import json; from scipy.integrate import dblquad as int2d; from scipy.special import jv as bessel; from scipy.signal import hilbert as KramerKronig; from scipy.optimize import fsolve; #from sc...
[ "json.load", "numpy.abs", "numpy.power", "numpy.isnan", "numpy.min", "numpy.max", "numpy.array", "numpy.sqrt" ]
[((3088, 3100), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3096, 3100), True, 'import numpy as np\n'), ((865, 885), 'numpy.sqrt', 'np.sqrt', (['(self.xi * g)'], {}), '(self.xi * g)\n', (872, 885), True, 'import numpy as np\n'), ((1333, 1360), 'numpy.min', 'np.min', (['[self.z2 + z0, eta]'], {}), '([self.z2 + z...
import json import math import numpy as np import pandas as pd from scipy import signal def _fir_rand_input(signal_length, response_length, num_channels=1): print("Generating FIR random data with ", signal_length, " samples and ", num_channels, "channels...") t = np.zeros((signal_length, 1)) t[:, 0] = [i...
[ "json.dump", "math.pow", "numpy.random.randn", "scipy.signal.lfilter", "numpy.zeros", "numpy.transpose", "numpy.sin", "numpy.arange", "numpy.random.normal", "numpy.random.rand", "numpy.concatenate" ]
[((275, 303), 'numpy.zeros', 'np.zeros', (['(signal_length, 1)'], {}), '((signal_length, 1))\n', (283, 303), True, 'import numpy as np\n'), ((360, 404), 'numpy.random.randn', 'np.random.randn', (['num_channels', 'signal_length'], {}), '(num_channels, signal_length)\n', (375, 404), True, 'import numpy as np\n'), ((479, ...
import numpy as np from .base import WeightComputer class UnconditionalWeightComputer(WeightComputer): """Mockup class for returning the uniform weight.""" def __init__(self, n_candidates: int): """Constructor.""" self.n_candidates = n_candidates def __call__(self, _=None) -> np.ndarray: ...
[ "numpy.ones" ]
[((500, 531), 'numpy.ones', 'np.ones', (['(1, self.n_candidates)'], {}), '((1, self.n_candidates))\n', (507, 531), True, 'import numpy as np\n')]
from social_epi import sampling_social_networks as ssn from social_epi import nx_conversion as nxc from social_epi import CCMnet_constr_py as ccm import numpy as np import matplotlib.pyplot as plt import json,time def determine_burnin(social_config, contact_network, transmission_network, burnin_list): config = js...
[ "matplotlib.pyplot.show", "numpy.abs", "social_epi.sampling_social_networks.run", "time.time", "social_epi.sampling_social_networks.gen_config", "social_epi.CCMnet_constr_py.CCMnet_constr_py", "social_epi.nx_conversion.pad_deg_dist", "numpy.array", "social_epi.nx_conversion.favitescontacttransmissio...
[((1816, 1841), 'social_epi.sampling_social_networks.gen_config', 'ssn.gen_config', (['config', 'N'], {}), '(config, N)\n', (1830, 1841), True, 'from social_epi import sampling_social_networks as ssn\n'), ((1859, 1887), 'social_epi.CCMnet_constr_py.CCMnet_constr_py', 'ccm.CCMnet_constr_py', ([], {}), '(**ccmc)\n', (187...
# # Copyright 2019 NVIDIA Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
[ "pycuda.driver.Stream", "numpy.ndarray", "os.path.isdir", "PyNvCodec.PacketData", "os.add_dll_directory", "pycuda.driver.Device", "PyNvCodec.PyFFmpegDemuxer", "pycuda.driver.init", "PyNvCodec.ColorspaceConversionContext" ]
[((1502, 1513), 'pycuda.driver.init', 'cuda.init', ([], {}), '()\n', (1511, 1513), True, 'import pycuda.driver as cuda\n'), ((1608, 1621), 'pycuda.driver.Stream', 'cuda.Stream', ([], {}), '()\n', (1619, 1621), True, 'import pycuda.driver as cuda\n'), ((1693, 1725), 'PyNvCodec.PyFFmpegDemuxer', 'nvc.PyFFmpegDemuxer', ([...
# This script takes velocity data from within the Gulf Stream and makes # a stream plot. import numpy as np import matplotlib.pyplot as plt import scipy.io as sio ########## Prepare data ########## data = sio.loadmat('data/AVISO_uv_1993_24yrs.mat') u = np.transpose( data['u_gulf'], (1,0,2) ) v = np.transpose( data...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "scipy.io.loadmat", "numpy.square", "numpy.transpose", "numpy.isnan", "numpy.linspace", "numpy.squeeze", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig", "matplotlib.pyplot.subplots_adjust" ]
[((209, 252), 'scipy.io.loadmat', 'sio.loadmat', (['"""data/AVISO_uv_1993_24yrs.mat"""'], {}), "('data/AVISO_uv_1993_24yrs.mat')\n", (220, 252), True, 'import scipy.io as sio\n'), ((258, 297), 'numpy.transpose', 'np.transpose', (["data['u_gulf']", '(1, 0, 2)'], {}), "(data['u_gulf'], (1, 0, 2))\n", (270, 297), True, 'i...
import cv2 import numpy as np import os from skimage import morphology from matplotlib import pyplot as plt for index, path in enumerate(os.listdir('./test')): img = cv2.imread(os.path.join('./test', path)) img1 = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img1 = cv2.cvtColor(img1, cv2.COLOR_RGB2GRAY) ret, t...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "cv2.bitwise_and", "cv2.medianBlur", "cv2.cvtColor", "cv2.dilate", "cv2.threshold", "matplotlib.pyplot.imshow", "numpy.ones", "numpy.where", "os.path.join", "os.listdir" ]
[((969, 979), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (977, 979), True, 'from matplotlib import pyplot as plt\n'), ((138, 158), 'os.listdir', 'os.listdir', (['"""./test"""'], {}), "('./test')\n", (148, 158), False, 'import os\n'), ((223, 259), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation...
[ "numpy.floor", "numpy.imag", "numpy.linalg.norm", "numpy.arange", "numpy.tile", "numpy.nanmean", "numpy.transpose", "numpy.max", "numpy.linspace", "numpy.real", "numpy.dstack", "numpy.conj", "xarray.Dataset", "numpy.hstack", "numpy.min", "numpy.squeeze", "numpy.zeros", "numpy.array...
[((3773, 3788), 'numpy.arange', 'np.arange', (['(1)', '(5)'], {}), '(1, 5)\n', (3782, 3788), True, 'import numpy as np\n'), ((5107, 5147), 'numpy.zeros', 'np.zeros', (['(n, num_f)'], {'dtype': '"""complex128"""'}), "((n, num_f), dtype='complex128')\n", (5115, 5147), True, 'import numpy as np\n'), ((7085, 7112), 'numpy....
import pytest import numpy as np from doubtlab.reason import RelativeDifferenceReason @pytest.mark.parametrize("t, s", [(0.05, 4), (0.2, 3), (0.4, 2), (0.6, 1)]) def test_from_predict(t, s): """Test `from_predict` on an obvious examples""" y = np.array([1.0, 1.0, 1.0, 1.0, 1.0]) preds = np.array([1.0, 1....
[ "numpy.sum", "doubtlab.reason.RelativeDifferenceReason.from_predict", "pytest.raises", "numpy.array", "pytest.mark.parametrize" ]
[((90, 164), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""t, s"""', '[(0.05, 4), (0.2, 3), (0.4, 2), (0.6, 1)]'], {}), "('t, s', [(0.05, 4), (0.2, 3), (0.4, 2), (0.6, 1)])\n", (113, 164), False, 'import pytest\n'), ((255, 290), 'numpy.array', 'np.array', (['[1.0, 1.0, 1.0, 1.0, 1.0]'], {}), '([1.0, 1.0, ...
import pickle import numpy as np import matplotlib.pyplot as plt def load_label_names(): return ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] def load_cfar10_batch(cifar10_dataset_folder_path, batch_id): with open(cifar10_dataset_folder_path + '/data_batch_' + str(...
[ "matplotlib.pyplot.imshow", "pickle.load", "numpy.unique" ]
[((1689, 1713), 'matplotlib.pyplot.imshow', 'plt.imshow', (['sample_image'], {}), '(sample_image)\n', (1699, 1713), True, 'import matplotlib.pyplot as plt\n'), ((412, 448), 'pickle.load', 'pickle.load', (['file'], {'encoding': '"""latin1"""'}), "(file, encoding='latin1')\n", (423, 448), False, 'import pickle\n'), ((111...
import numpy as np from OpenGL.GL import * from obj_loader import Obj class Mesh: def __init__(self, filename): self.obj = Obj(filename) self.verticeBufferId = glGenBuffers(1) glBindBuffer(GL_ARRAY_BUFFER, self.verticeBufferId) vertices = np.array(self.obj.plain_vertecies, dtype='...
[ "numpy.array", "obj_loader.Obj" ]
[((137, 150), 'obj_loader.Obj', 'Obj', (['filename'], {}), '(filename)\n', (140, 150), False, 'from obj_loader import Obj\n'), ((278, 329), 'numpy.array', 'np.array', (['self.obj.plain_vertecies'], {'dtype': '"""float32"""'}), "(self.obj.plain_vertecies, dtype='float32')\n", (286, 329), True, 'import numpy as np\n'), (...
from numpy import random,zeros,ones,divide from math import pow,sqrt class Legendre: def legendreIterativo(self,grau,x): if grau == 0: return 1.0 elif grau == 1: return x else: legendre = 0 legendre0 = ones(x.shape) legendre1 = x ...
[ "math.pow", "math.sqrt", "numpy.random.randn", "numpy.zeros", "numpy.ones" ]
[((620, 640), 'numpy.random.randn', 'random.randn', (['(Qf + 1)'], {}), '(Qf + 1)\n', (632, 640), False, 'from numpy import random, zeros, ones, divide\n'), ((876, 898), 'numpy.random.randn', 'random.randn', (['nlist[i]'], {}), '(nlist[i])\n', (888, 898), False, 'from numpy import random, zeros, ones, divide\n'), ((916...
import os import numpy as np import torch import torch.nn as nn from PIL import Image import lip.directories as dirs from lip import my_config import lip.network.utils as utils from lip.network import mnist # setup device = my_config.device mode = 'mnist' main_dir = dirs.mnist_dir net = mnist.mnist_net() net = net....
[ "numpy.full", "lip.network.utils.jacobian", "torch.norm", "lip.network.mnist.transform_test", "PIL.Image.open", "lip.network.mnist.get_layers", "torch.nn.functional.softmax", "torch.unsqueeze", "os.path.join", "lip.network.mnist.mnist_net" ]
[((292, 309), 'lip.network.mnist.mnist_net', 'mnist.mnist_net', ([], {}), '()\n', (307, 309), False, 'from lip.network import mnist\n'), ((411, 442), 'os.path.join', 'os.path.join', (['main_dir', '"""8.png"""'], {}), "(main_dir, '8.png')\n", (423, 442), False, 'import os\n'), ((447, 467), 'PIL.Image.open', 'Image.open'...
from tkinter import * from tkinter import ttk # 导入ttk模块,因为下拉菜单控件在ttk中 import numpy as np from tkinter import messagebox #窗口大小 root = Tk() root.title("calculator") root.geometry("360x180+600+200") #统一组件宽度 width1_set = 10 #标签设置,第一排和第三排 label1 = Label(root,text = "应力") label1.grid(row = 0,column = 1) la...
[ "numpy.random.weibull", "tkinter.messagebox.showinfo" ]
[((3857, 3883), 'numpy.random.weibull', 'np.random.weibull', (['a', 'size'], {}), '(a, size)\n', (3874, 3883), True, 'import numpy as np\n'), ((4195, 4236), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', (['"""提示"""', '"""请输入正态分布的两个参数"""'], {}), "('提示', '请输入正态分布的两个参数')\n", (4214, 4236), False, 'from tkinter impo...
import numpy as np import matplotlib.pyplot as plt from random import choice import matplotlib as mpl class Layer: """ node - an int specifying the size of the layer """ def __init__(self, node = 1): self.inputs = np.random.random_sample(node) self.outputs = np.zeros(node) class Neural...
[ "matplotlib.pyplot.show", "numpy.random.random_sample", "numpy.sum", "numpy.zeros", "numpy.ones", "numpy.append", "numpy.array", "numpy.arange", "numpy.linspace", "numpy.exp", "matplotlib.pyplot.subplots", "numpy.vstack", "numpy.atleast_2d" ]
[((5599, 5611), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (5607, 5611), True, 'import numpy as np\n'), ((5643, 5686), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {'constrained_layout': '(True)'}), '(2, 1, constrained_layout=True)\n', (5655, 5686), True, 'import matplotlib.pyplot as plt\n'), ...
import os from joblib import Parallel, delayed import json import argparse import numpy as np from pathlib import Path import yaml from argparse import Namespace from tqdm import tqdm from feature_melspectrogram_essentia import feature_melspectrogram_essentia from feature_melspectrogram_vggish import feature_melspectr...
[ "feature_melspectrogram_vggish.feature_melspectrogram_vggish", "feature_spleeter.feature_spleeter", "feature_ol3.feature_ol3", "os.makedirs", "argparse.ArgumentParser", "feature_melspectrogram_essentia.feature_melspectrogram_essentia", "os.path.exists", "numpy.expand_dims", "feature_tempocnn.feature...
[((1763, 1841), 'numpy.memmap', 'np.memmap', (['audio_repr_file'], {'dtype': '"""float16"""', 'mode': '"""w+"""', 'shape': 'audio_repr.shape'}), "(audio_repr_file, dtype='float16', mode='w+', shape=audio_repr.shape)\n", (1772, 1841), True, 'import numpy as np\n'), ((3390, 3415), 'argparse.ArgumentParser', 'argparse.Arg...
import math import oneflow import oneflow as flow import oneflow.nn as nn import numpy as np class SparseDispatcher(object): """Helper for implementing a mixture of experts. The purpose of this class is to create input minibatches for the experts and to combine the results of the experts to form a unifie...
[ "oneflow.Tensor", "oneflow.nn.Softplus", "oneflow.cat", "oneflow.scatter", "oneflow.arange", "oneflow.matmul", "math.sqrt", "numpy.zeros", "numpy.ones", "oneflow.gather", "oneflow.where", "oneflow.zeros", "numpy.finfo", "oneflow.nn.Softmax", "oneflow.nonzero", "oneflow.gt", "oneflow....
[((5752, 5770), 'oneflow.tensor', 'flow.tensor', (['[0.0]'], {}), '([0.0])\n', (5763, 5770), True, 'import oneflow as flow\n'), ((5778, 5796), 'oneflow.tensor', 'flow.tensor', (['[1.0]'], {}), '([1.0])\n', (5789, 5796), True, 'import oneflow as flow\n'), ((2748, 2793), 'oneflow.gather', 'flow.gather', (['gates_exp', '(...
# -*- coding: utf-8 -*- """ Binary latent class model. """ # metadata variables __author__ = "<NAME> <<EMAIL>>" __date__ = "2013/12/15" __version__ = "0.1" __copyright__ = "Copyright (c) 2013 Hiroshi Kajino all rights reserved." __docformat__ = "restructuredtext en" import numpy as np import scipy as sp import sys fr...
[ "numpy.abs", "numpy.log", "crowd_data.BinaryData", "numpy.zeros", "numpy.ones", "numpy.where", "numpy.array", "numpy.exp", "scipy.special.logsumexp", "sys.stdout.flush", "sys.stderr.write", "sys.stderr.flush" ]
[((7332, 7470), 'numpy.array', 'np.array', (['[[1, 1, 1, 1, 1, 1, -1], [-1, -1, -1, -1, -1, -1, 1], [1, 1, 1, 1, 1, 1, 1],\n [1, 1, 1, 1, 1, 1, -1], [1, 1, 1, 1, 1, 1, -1]]'], {}), '([[1, 1, 1, 1, 1, 1, -1], [-1, -1, -1, -1, -1, -1, 1], [1, 1, 1, 1,\n 1, 1, 1], [1, 1, 1, 1, 1, 1, -1], [1, 1, 1, 1, 1, 1, -1]])\n',...
#!/usr/bin/env python ################################################################################ # Created by <NAME> # # <EMAIL> # ################################################################################...
[ "shapely.wkt.loads", "de9im.patterns.contains.matches", "morton.DecodeMorton2DY", "de9im.patterns.intersects.matches", "numpy.array", "morton.DecodeMorton2DX", "math.log", "de9im.patterns.pattern", "shapely.geometry.box" ]
[((500, 520), 'de9im.patterns.pattern', 'pattern', (['"""F********"""'], {}), "('F********')\n", (507, 520), False, 'from de9im.patterns import intersects, contains, pattern\n'), ((1764, 1776), 'shapely.geometry.box', 'box', (['*domain'], {}), '(*domain)\n', (1767, 1776), False, 'from shapely.geometry import box\n'), (...
from rl.memory.simple import SimpleMemory from rl.hparams.utils import HParams import numpy as np import random import tensorflow as tf class SimpleMemoryTest(tf.test.TestCase): def setUp(self): self._memory = self.get_empty_memory() def get_empty_memory(self): hparams = HParams() hparams.memory_si...
[ "tensorflow.test.main", "rl.memory.simple.SimpleMemory", "numpy.zeros", "numpy.ones", "rl.hparams.utils.HParams" ]
[((3008, 3022), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3020, 3022), True, 'import tensorflow as tf\n'), ((289, 298), 'rl.hparams.utils.HParams', 'HParams', ([], {}), '()\n', (296, 298), False, 'from rl.hparams.utils import HParams\n'), ((340, 364), 'rl.memory.simple.SimpleMemory', 'SimpleMemory', ([...
"""Fatigue-life distribution.""" import numpy from scipy import special from ..baseclass import Dist from ..operators.addition import Add class fatigue_life(Dist): """Fatigue-life distribution.""" def __init__(self, c=0): Dist.__init__(self, c=c) def _pdf(self, x, c): output = (x+1)/(2*...
[ "scipy.special.ndtri", "numpy.exp", "numpy.isnan", "numpy.sqrt" ]
[((369, 414), 'numpy.exp', 'numpy.exp', (['(-(x - 1) ** 2 / (2.0 * x * c ** 2))'], {}), '(-(x - 1) ** 2 / (2.0 * x * c ** 2))\n', (378, 414), False, 'import numpy\n'), ((615, 631), 'scipy.special.ndtri', 'special.ndtri', (['q'], {}), '(q)\n', (628, 631), False, 'from scipy import special\n'), ((322, 355), 'numpy.sqrt',...
#!/usr/bin/env python import h5py import numpy as np import struct import sys import argparse import json import itertools class CompressActor(object): RECORD_FMT = '>f' def __init__(self, fname, ofile, weight_file): self.fname = fname self.ofile = ofile self.weight_file = weight_fil...
[ "json.dump", "h5py.File", "json.load", "argparse.ArgumentParser", "struct.unpack", "struct.pack", "struct.calcsize", "numpy.reshape" ]
[((3701, 3771), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compress and decompress model. """'}), "(description='Compress and decompress model. ')\n", (3724, 3771), False, 'import argparse\n'), ((532, 558), 'h5py.File', 'h5py.File', (['self.fname', '"""r"""'], {}), "(self.fname, 'r')...
# -*- coding: utf-8 -* import numpy as np import geo from scipy.spatial.distance import pdist from scipy.spatial.distance import squareform from aa_encoder import AminoacidEncoder import pathlib import os def MapDis(coo): return squareform(pdist(coo, metric='euclidean')).astype('float32') class At...
[ "numpy.zeros_like", "numpy.abs", "numpy.zeros", "aa_encoder.AminoacidEncoder", "numpy.cross", "numpy.argsort", "geo.get_torsion", "pathlib.Path", "geo.norm", "numpy.array", "numpy.tile", "scipy.spatial.distance.pdist", "numpy.sign", "geo.get_len", "os.path.join", "os.listdir", "numpy...
[((10520, 10540), 'os.listdir', 'os.listdir', (['coo_path'], {}), '(coo_path)\n', (10530, 10540), False, 'import os\n'), ((865, 933), 'numpy.zeros', 'np.zeros', (['[self.res, self.res, self.dim]'], {'dtype': '"""float32"""', 'order': '"""C"""'}), "([self.res, self.res, self.dim], dtype='float32', order='C')\n", (873, 9...
import h5py import numpy as np import pandas as pd def generate_database_info(): info_path = 'CVD2014info.mat' data = h5py.File(info_path, 'r') video_names = data['video_names'] scores = data['scores'] # video_name = video_names[0][0] # obj = data[video_name] # str = ''.join(chr(i) for i i...
[ "pandas.DataFrame", "h5py.File", "numpy.array" ]
[((128, 153), 'h5py.File', 'h5py.File', (['info_path', '"""r"""'], {}), "(info_path, 'r')\n", (137, 153), False, 'import h5py\n'), ((1023, 1081), 'pandas.DataFrame', 'pd.DataFrame', (['database_info'], {'columns': "['video_name', 'MOS']"}), "(database_info, columns=['video_name', 'MOS'])\n", (1035, 1081), True, 'import...
import os import sys import time import argparse import numpy as np import torch import torch.nn as nn from torch.utils.tensorboard import SummaryWriter from carle.env import CARLE from carle.mcl import AE2D, RND2D, CornerBonus, PufferDetector, SpeedDetector from game_of_carle.agents.toggle import Toggle from game_...
[ "numpy.save", "numpy.random.seed", "argparse.ArgumentParser", "game_of_carle.algos.cma.CMAPopulation", "numpy.std", "torch.manual_seed", "os.path.dirname", "torch.cat", "time.time", "numpy.max", "numpy.mean", "numpy.min", "torch.Tensor", "torch.utils.tensorboard.SummaryWriter", "carle.en...
[((1482, 1574), 'carle.env.CARLE', 'CARLE', ([], {'instances': 'my_instances', 'device': 'device', 'height': 'env_dimension', 'width': 'env_dimension'}), '(instances=my_instances, device=device, height=env_dimension, width=\n env_dimension)\n', (1487, 1574), False, 'from carle.env import CARLE\n'), ((8336, 8361), 'a...
import tensorflow as tf import numpy as np from numpy import genfromtxt from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import csv drive_data_path = '../output_tests.csv' class_data_path = '../output_classes.csv' model_save_path = '../multilayer_perceptron.ckpt' ## **************...
[ "numpy.array_equal", "csv.writer", "tensorflow.train.Saver", "sklearn.model_selection.train_test_split", "numpy.genfromtxt", "tensorflow.placeholder", "tensorflow.matmul", "tensorflow.zeros", "tensorflow.initialize_all_variables", "tensorflow.log", "tensorflow.InteractiveSession", "tensorflow....
[((419, 461), 'numpy.genfromtxt', 'genfromtxt', (['drive_data_path'], {'delimiter': '""","""'}), "(drive_data_path, delimiter=',')\n", (429, 461), False, 'from numpy import genfromtxt\n'), ((477, 519), 'numpy.genfromtxt', 'genfromtxt', (['class_data_path'], {'delimiter': '""","""'}), "(class_data_path, delimiter=',')\n...
import numpy as np from typing import List, Tuple, Dict import random from PIL import Image from ..pad import Padding from ..interpolate import Interpolate class LFFDRandomSample(): """Applies augmantation defined in the LFFD paper""" def __init__(self, scales: List[Tuple[int, int]], target_size: Tuple[int, i...
[ "random.randint", "random.uniform", "numpy.zeros", "random.random", "numpy.bitwise_and", "PIL.Image.fromarray" ]
[((1563, 1595), 'random.randint', 'random.randint', (['(0)', '(num_faces - 1)'], {}), '(0, num_faces - 1)\n', (1577, 1595), False, 'import random\n'), ((1763, 1799), 'random.uniform', 'random.uniform', (['min_scale', 'max_scale'], {}), '(min_scale, max_scale)\n', (1777, 1799), False, 'import random\n'), ((3743, 3814), ...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import logging import numpy as np from pytorch_lightning import LightningDataModule from torch.utils.data import DataLoader, Subset from pytouch.datasets import DigitFolder from pytouch.tasks import TouchDetect _log = logging.getLogger(__name__...
[ "torch.utils.data.Subset", "torch.utils.data.DataLoader", "numpy.floor", "logging.getLogger", "numpy.random.shuffle" ]
[((294, 321), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (311, 321), False, 'import logging\n'), ((1155, 1185), 'numpy.random.shuffle', 'np.random.shuffle', (['dataset_idx'], {}), '(dataset_idx)\n', (1172, 1185), True, 'import numpy as np\n'), ((1670, 1707), 'torch.utils.data.Subset',...
import cv2 import numpy as np import face_recognition from time import sleep import pickle from sklearn.metrics.pairwise import euclidean_distances from sklearn.metrics.pairwise import cosine_distances def face_detect(rgb_frame): face_locations = face_recognition.face_locations(rgb_frame) # no faces if l...
[ "sklearn.metrics.pairwise.cosine_distances", "pickle.dump", "cv2.VideoWriter_fourcc", "face_recognition.face_encodings", "sklearn.metrics.pairwise.euclidean_distances", "cv2.VideoCapture", "cv2.imread", "numpy.min", "pickle.load", "numpy.array", "numpy.max", "cv2.rectangle", "face_recognitio...
[((253, 295), 'face_recognition.face_locations', 'face_recognition.face_locations', (['rgb_frame'], {}), '(rgb_frame)\n', (284, 295), False, 'import face_recognition\n'), ((390, 489), 'face_recognition.face_encodings', 'face_recognition.face_encodings', (['rgb_frame'], {'known_face_locations': 'face_locations', 'model'...
import os import torch import numpy as np import imageio import cv2 import pdb def recursive_glob(rootdir=".", suffix=""): return [ os.path.join(looproot, filename) for looproot, _, filenames in os.walk(rootdir) for filename in filenames if filename.endswith(suffix)] class citysc...
[ "imageio.imread", "os.walk", "numpy.zeros", "numpy.array", "os.path.join", "cv2.resize", "torch.from_numpy" ]
[((146, 178), 'os.path.join', 'os.path.join', (['looproot', 'filename'], {}), '(looproot, filename)\n', (158, 178), False, 'import os\n'), ((1195, 1226), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (1203, 1226), True, 'import numpy as np\n'), ((1243, 1274), 'numpy.array', 'n...
import pytest import numpy as np from devito import norm from examples.seismic import Model, setup_geometry, AcquisitionGeometry def not_bcs(bc): return ("mask", 1) if bc == "damp" else ("damp", 0) @pytest.mark.parametrize('nbl, bcs', [ (20, ("mask", 1)), (0, ("mask", 1)), (20, ("damp", 0)), (0, ("damp...
[ "examples.seismic.AcquisitionGeometry", "examples.seismic.setup_geometry", "numpy.ones", "devito.norm", "examples.seismic.Model", "pytest.mark.parametrize" ]
[((208, 324), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nbl, bcs"""', "[(20, ('mask', 1)), (0, ('mask', 1)), (20, ('damp', 0)), (0, ('damp', 0))]"], {}), "('nbl, bcs', [(20, ('mask', 1)), (0, ('mask', 1)), (\n 20, ('damp', 0)), (0, ('damp', 0))])\n", (231, 324), False, 'import pytest\n'), ((971, 10...
import numpy as np import tensorflow as tf import cv2 IMAGENET_MEANS = np.array([123.68, 116.779, 103.939]).reshape((1,1,1,3)) """ Computes the content cost as specified in the research paper Arguments: content_img -- a Tensor of dimension (1, height, width, channels), representing the hidden layer activations of t...
[ "numpy.random.uniform", "tensorflow.reshape", "numpy.clip", "tensorflow.transpose", "cv2.imread", "numpy.array", "numpy.reshape", "tensorflow.square", "cv2.resize" ]
[((3050, 3079), 'cv2.resize', 'cv2.resize', (['image', 'image_size'], {}), '(image, image_size)\n', (3060, 3079), False, 'import cv2\n'), ((3092, 3129), 'numpy.reshape', 'np.reshape', (['image', '((1,) + image.shape)'], {}), '(image, (1,) + image.shape)\n', (3102, 3129), True, 'import numpy as np\n'), ((3572, 3588), 'c...