code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# coding=utf-8 import tensorflow as tf import numpy as np import helpers tf.reset_default_graph() sess = tf.InteractiveSession() PAD = 0 EOS = 1 vocab_size = 10 input_embedding_size = 20 encoder_hidden_units = 512 decoder_hidden_units = encoder_hidden_units * 2 # define inputs encoder_input = tf.placeholder(shape=(...
[ "tensorflow.reset_default_graph", "numpy.ones", "tensorflow.contrib.layers.linear", "tensorflow.nn.bidirectional_dynamic_rnn", "tensorflow.InteractiveSession", "tensorflow.one_hot", "tensorflow.contrib.rnn.LSTMStateTuple", "tensorflow.concat", "tensorflow.placeholder", "helpers.batch", "tensorfl...
[((75, 99), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (97, 99), True, 'import tensorflow as tf\n'), ((107, 130), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (128, 130), True, 'import tensorflow as tf\n'), ((298, 371), 'tensorflow.placeholder', 'tf.plac...
# Copyright 2021 <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 agreed...
[ "numpy.sum", "numpy.log", "numpy.median", "numpy.asarray", "open3d.geometry.KDTreeFlann", "numpy.linalg.eig", "numpy.mean", "numpy.linalg.inv", "numpy.linalg.norm", "numpy.linalg.det", "numpy.cov" ]
[((797, 829), 'open3d.geometry.KDTreeFlann', 'o3d.geometry.KDTreeFlann', (['pc_map'], {}), '(pc_map)\n', (821, 829), True, 'import open3d as o3d\n'), ((843, 868), 'numpy.asarray', 'np.asarray', (['pc_map.points'], {}), '(pc_map.points)\n', (853, 868), True, 'import numpy as np\n'), ((1367, 1399), 'open3d.geometry.KDTre...
import torch from torch.utils.data import TensorDataset from torchvision import datasets, transforms from base import BaseDataLoader, BaseDataLoader_2 from torch.utils.data import DataLoader import numpy as np import pandas as pd from .utils import readmts_uci_har, transform_labels class MnistDataLoader(BaseDataLoader...
[ "numpy.random.seed", "numpy.random.shuffle", "torchvision.transforms.ToTensor", "numpy.array", "torch.utils.data.TensorDataset", "torchvision.transforms.Normalize", "torchvision.datasets.MNIST", "numpy.concatenate", "torch.from_numpy" ]
[((694, 771), 'torchvision.datasets.MNIST', 'datasets.MNIST', (['self.data_dir'], {'train': 'training', 'download': '(True)', 'transform': 'trsfm'}), '(self.data_dir, train=training, download=True, transform=trsfm)\n', (708, 771), False, 'from torchvision import datasets, transforms\n'), ((1583, 1616), 'numpy.concatena...
#------------------------------------------------------------------------------- # # Aggregated Magnetic Model # # Author: <NAME> <<EMAIL>> # #------------------------------------------------------------------------------- # Copyright (C) 2018 EOX IT Services GmbH # # Permission is hereby granted, free of charge, to a...
[ "numpy.asarray", "numpy.zeros", "collections.namedtuple" ]
[((1678, 1736), 'collections.namedtuple', 'namedtuple', (['"""_Component"""', "['model', 'scale', 'parameters']"], {}), "('_Component', ['model', 'scale', 'parameters'])\n", (1688, 1736), False, 'from collections import namedtuple\n'), ((3161, 3174), 'numpy.asarray', 'asarray', (['time'], {}), '(time)\n', (3168, 3174),...
import operator import sqlalchemy import pandas as pd import numpy as np from math import ceil DEFAULT_VARCHAR_LENGTH=100 def get_detected_column_types(df): """ Get data type of each columns ('DATETIME', 'NUMERIC' or 'STRING') Parameters: df (df): pandas dataframe Returns df (df): datafr...
[ "numpy.vectorize", "sqlalchemy.types.DateTime", "math.ceil", "sqlalchemy.types.INTEGER", "sqlalchemy.types.VARCHAR", "pandas.to_datetime", "sqlalchemy.types.Text", "sqlalchemy.types.DECIMAL", "pandas.to_numeric" ]
[((1950, 1967), 'numpy.vectorize', 'np.vectorize', (['len'], {}), '(len)\n', (1962, 1967), True, 'import numpy as np\n'), ((983, 1007), 'pandas.to_datetime', 'pd.to_datetime', (['col_data'], {}), '(col_data)\n', (997, 1007), True, 'import pandas as pd\n'), ((1422, 1443), 'pandas.to_numeric', 'pd.to_numeric', (['series'...
from typing import Optional, Callable import torch import numpy as np from PIL.Image import Image from ..transforms import TargetHandler class NormalizeBothInputAndTarget: transform: Callable[[Image], Image] target_handler: TargetHandler def __init__( self, transform: Callable[[...
[ "numpy.array" ]
[((554, 565), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (562, 565), True, 'import numpy as np\n'), ((708, 728), 'numpy.array', 'np.array', (['erased_img'], {}), '(erased_img)\n', (716, 728), True, 'import numpy as np\n'), ((1088, 1104), 'numpy.array', 'np.array', (['target'], {}), '(target)\n', (1096, 1104), Tru...
import os import sys import lmdb import json import torch import pickle import random import msgpack import numpy as np import msgpack_numpy # from transformers import AutoTokenizer from lz4.frame import compress, decompress from os.path import exists, abspath, dirname from sklearn.metrics.pairwise import cosine_simila...
[ "msgpack_numpy.patch", "PIL.Image.new", "msgpack.loads", "numpy.load", "torch.load", "os.path.exists", "PIL.Image.open", "pprint.PrettyPrinter", "lmdb.open", "PIL.ImageDraw.Draw", "lz4.frame.decompress" ]
[((403, 425), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (423, 425), False, 'import pprint\n'), ((427, 448), 'msgpack_numpy.patch', 'msgpack_numpy.patch', ([], {}), '()\n', (446, 448), False, 'import msgpack_numpy\n'), ((583, 629), 'lmdb.open', 'lmdb.open', (['db_dir'], {'readonly': '(True)', 'cr...
# Solving reinforcement learning problems using pgpelib with parallelization # and with observation normalization # ========================================================================== # # This example demonstrates how to solve locomotion tasks. # The following techniques are used: # # - dynamic population size ...
[ "ray.init", "pickle.dump", "gym.make", "pgpelib.policies.LinearPolicy", "numpy.argmax", "numpy.median", "multiprocessing.cpu_count", "torch.as_tensor", "pgpelib.restore.to_torch_module", "torch.no_grad", "numpy.sqrt" ]
[((3508, 3522), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (3520, 3522), True, 'import multiprocessing as mp\n'), ((3754, 3764), 'ray.init', 'ray.init', ([], {}), '()\n', (3762, 3764), False, 'import ray\n'), ((7389, 7452), 'pgpelib.policies.LinearPolicy', 'LinearPolicy', ([], {'env_name': 'ENV_NAME...
import lue.data_model as ldm import numpy as np import csv def export_partition_shape_results( lue_dataset, csv_writer): # Assert that the number of array shapes for which experiments where # performed is 1 lue_array = lue_dataset.array.array assert lue_array.shape.value.nr_arrays == ...
[ "csv.writer", "numpy.prod", "numpy.argsort", "lue.data_model.open_dataset", "numpy.all" ]
[((512, 551), 'numpy.all', 'np.all', (['(array_shapes == array_shapes[0])'], {}), '(array_shapes == array_shapes[0])\n', (518, 551), True, 'import numpy as np\n'), ((2065, 2087), 'numpy.argsort', 'np.argsort', (['nr_workers'], {}), '(nr_workers)\n', (2075, 2087), True, 'import numpy as np\n'), ((4753, 4775), 'numpy.arg...
import os from statistics import mean import numpy as np import matplotlib.pyplot as pyplot from simtk import unit from simtk.openmm.app.pdbfile import PDBFile from foldamers.cg_model.cgmodel import CGModel from foldamers.parameters.reweight import * from foldamers.thermo.calc import * from foldamers.ensembles.ens_buil...
[ "matplotlib.pyplot.title", "os.mkdir", "simtk.openmm.app.pdbfile.PDBFile.writeFile", "matplotlib.pyplot.figure", "numpy.unique", "numpy.meshgrid", "matplotlib.pyplot.close", "os.path.exists", "matplotlib.pyplot.colorbar", "foldamers.cg_model.cgmodel.CGModel", "simtk.openmm.app.pdbfile.PDBFile", ...
[((4025, 4818), 'foldamers.cg_model.cgmodel.CGModel', 'CGModel', ([], {'polymer_length': 'polymer_length', 'backbone_lengths': 'backbone_lengths', 'sidechain_lengths': 'sidechain_lengths', 'sidechain_positions': 'sidechain_positions', 'masses': 'masses', 'sigmas': 'sigmas', 'epsilons': 'epsilons', 'bond_lengths': 'bond...
# Copyright 2020 The TensorFlow 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
[ "numpy.asarray", "numpy.zeros", "tensorflow_graphics.datasets.features.camera_feature.Camera", "tensorflow_datasets.testing.test_main", "numpy.array", "tensorflow_datasets.testing.FeatureExpectationItem", "numpy.eye" ]
[((7184, 7208), 'tensorflow_datasets.testing.test_main', 'tfds.testing.test_main', ([], {}), '()\n', (7206, 7208), True, 'import tensorflow_datasets as tfds\n'), ((1490, 1609), 'numpy.asarray', 'np.asarray', (['[[expected_f, 0, expected_center[0]], [0, expected_f, expected_center[1]],\n [0, 0, 1]]'], {'dtype': 'np.f...
import ray from ray import serve import requests import os import pickle import numpy as np import asyncio # Models locations RANDOM_FOREST_MODEL_PATH = os.path.join("wine-quality_random_forest.pkl") XGBOOST_MODEL_PATH = os.path.join("wine-quality_xgboost.pkl") GRBOOST_MODEL_PATH = os.path.join("wine-quality_grboost....
[ "ray.init", "ray.serve.deployment", "ray.get", "pickle.load", "numpy.array", "requests.get", "ray.serve.start", "os.path.join" ]
[((155, 201), 'os.path.join', 'os.path.join', (['"""wine-quality_random_forest.pkl"""'], {}), "('wine-quality_random_forest.pkl')\n", (167, 201), False, 'import os\n'), ((223, 263), 'os.path.join', 'os.path.join', (['"""wine-quality_xgboost.pkl"""'], {}), "('wine-quality_xgboost.pkl')\n", (235, 263), False, 'import os\...
import keras from keras.layers import Activation from keras.models import load_model from keras import backend as K from keras.utils.generic_utils import get_custom_objects import tensorflow as tf import numpy as np import pandas as pd import timeit import sys import argparse # Constants #window_size = 1024 def ...
[ "keras.models.load_model", "argparse.ArgumentParser", "keras.layers.Activation", "timeit.default_timer", "numpy.savetxt", "numpy.genfromtxt", "keras.utils.generic_utils.get_custom_objects", "pandas.Series", "keras.backend.sigmoid" ]
[((1566, 1662), 'keras.models.load_model', 'load_model', (["('../models/' + exp + '/new_train/' + 'encoder_' + dataset + '.h5')"], {'compile': '(False)'}), "('../models/' + exp + '/new_train/' + 'encoder_' + dataset +\n '.h5', compile=False)\n", (1576, 1662), False, 'from keras.models import load_model\n'), ((3046, ...
import numpy as np from igp2 import AgentState, plot_map from igp2.data import ScenarioConfig, InDScenario from igp2.opendrive.map import Map import matplotlib.pyplot as plt from shapely.ops import unary_union from grit.core.data_processing import get_episode_frames from grit.core.feature_extraction import FeatureExt...
[ "grit.core.feature_extraction.FeatureExtractor", "grit.core.data_processing.get_episode_frames", "shapely.ops.unary_union", "matplotlib.pyplot.show", "grit.occlusion_detection.occlusion_detection_geometry.OcclusionDetector2D.plot_area_from_list", "numpy.deg2rad", "igp2.plot_map", "grit.core.base.get_b...
[((637, 695), 'grit.core.feature_extraction.FeatureExtractor', 'FeatureExtractor', (['scenario_map', 'scenario_name', 'episode_idx'], {}), '(scenario_map, scenario_name, episode_idx)\n', (653, 695), False, 'from grit.core.feature_extraction import FeatureExtractor\n'), ((1118, 1146), 'igp2.data.InDScenario', 'InDScenar...
import glob import json import argparse import os import os.path as path from functools import partial from tqdm import tqdm import pandas as pd import numpy as np import scipy import plotnine as p9 from scipy.stats import bootstrap from nlproar.dataset import SNLIDataset, SSTDataset, IMDBDataset, BabiDataset, Mimic...
[ "pandas.DataFrame", "functools.partial", "tqdm.tqdm", "json.load", "argparse.ArgumentParser", "os.makedirs", "os.path.join", "os.path.realpath", "numpy.random.default_rng", "numpy.mean", "glob.glob", "pandas.read_pickle", "pandas.set_option", "numpy.all" ]
[((2434, 2459), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2457, 2459), False, 'import argparse\n'), ((737, 747), 'numpy.mean', 'np.mean', (['x'], {}), '(x)\n', (744, 747), True, 'import numpy as np\n'), ((756, 773), 'numpy.all', 'np.all', (['(x[0] == x)'], {}), '(x[0] == x)\n', (762, 773)...
import numpy as np import matplotlib.pyplot as plt # close all figures plt.close('all') years = np.array([1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.close", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "matplotlib.pyplot.savefig" ]
[((74, 90), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (83, 90), True, 'import matplotlib.pyplot as plt\n'), ((100, 456), 'numpy.array', 'np.array', (['[1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, \n 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981...
from typing import List, Union import numpy as np def slice_to_list( start: Union[int, None], stop: Union[int, None], step: Union[int, None], size: int = None, ) -> List[int]: if start is None and stop is None: if size is None: raise ValueError("size required when start and sto...
[ "numpy.min" ]
[((862, 871), 'numpy.min', 'np.min', (['l'], {}), '(l)\n', (868, 871), True, 'import numpy as np\n')]
# Load pickled data import cv2 import pickle import numpy as np import matplotlib.pyplot as plt from sklearn.utils import shuffle import tensorflow as tf import MyAlexNet import DataAugmentation as func import glob import csv # TODO: Fill this in based on where you saved the training and testing data ...
[ "matplotlib.pyplot.title", "DataAugmentation.transform_img", "tensorflow.reset_default_graph", "matplotlib.pyplot.figure", "pickle.load", "numpy.mean", "numpy.arange", "glob.glob", "tensorflow.get_default_graph", "numpy.unique", "matplotlib.pyplot.xlabel", "tensorflow.nn.softmax", "tensorflo...
[((2052, 2082), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 16.5)'}), '(figsize=(12, 16.5))\n', (2062, 2082), True, 'import matplotlib.pyplot as plt\n'), ((2347, 2357), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2355, 2357), True, 'import matplotlib.pyplot as plt\n'), ((2396, 2423), '...
# Third party inports import tensorflow as tf import numpy as np # batch_sizexheightxwidthxdepthxchan def diceLoss(y_true, y_pred): top = 2*tf.reduce_sum(y_true * y_pred, [1, 2, 3]) bottom = tf.maximum(tf.reduce_sum(y_true+y_pred, [1, 2, 3]), 1e-5) dice = tf.reduce_mean(top/bottom) return -dice de...
[ "tensorflow.ones", "tensorflow.abs", "tensorflow.reduce_sum", "tensorflow.reduce_mean", "tensorflow.nn.conv3d", "tensorflow.multiply", "numpy.finfo", "tensorflow.nn.conv2d" ]
[((272, 300), 'tensorflow.reduce_mean', 'tf.reduce_mean', (['(top / bottom)'], {}), '(top / bottom)\n', (286, 300), True, 'import tensorflow as tf\n'), ((148, 189), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(y_true * y_pred)', '[1, 2, 3]'], {}), '(y_true * y_pred, [1, 2, 3])\n', (161, 189), True, 'import tensorflow ...
from __future__ import annotations import re from pathlib import Path from logging import getLogger, Logger from fileinput import hook_compressed from dataclasses import dataclass, field, fields from typing import Iterator, get_type_hints, Generator import numpy as np import numpy.typing as npt from pysam import Tabix...
[ "typing.get_type_hints", "fileinput.hook_compressed", "dataclasses.field", "numpy.array", "numpy.all" ]
[((805, 834), 'dataclasses.field', 'field', ([], {'init': '(False)', 'repr': '(False)'}), '(init=False, repr=False)\n', (810, 834), False, 'from dataclasses import dataclass, field, fields\n'), ((7026, 7066), 'dataclasses.field', 'field', ([], {'default_factory': 'tuple', 'init': '(False)'}), '(default_factory=tuple, i...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # TODO: pass ft_cse to use fine-tuned feature # TODO: pass fine_steps -1 to use fine samples from absl import flags, app import sys sys.path.insert(0,'') sys.path.insert(0,'third_party') import numpy as np from matplotlib import pyplot as plt impor...
[ "matplotlib.cm.get_cmap", "torch.cat", "nnutils.loss_utils.feat_match", "glob.glob", "torch.no_grad", "nnutils.geom_utils.sample_xy", "nnutils.train_utils.v2s_trainer", "cv2.imwrite", "nnutils.loss_utils.kp_reproj", "utils.io.vis_match", "cv2.resize", "torch.svd", "numpy.hstack", "utils.io...
[((204, 226), 'sys.path.insert', 'sys.path.insert', (['(0)', '""""""'], {}), "(0, '')\n", (219, 226), False, 'import sys\n'), ((226, 259), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""third_party"""'], {}), "(0, 'third_party')\n", (241, 259), False, 'import sys\n'), ((1284, 1324), 'nnutils.geom_utils.raycast', 'r...
# This script is for the rotate function import numpy as np import matplotlib.pyplot as plt import cv2 def rotate(image, degree, output_path): """ Rotates an OpenCV 2 / NumPy image about it's centre by the given degree (in degrees). The returned image will be large enough to hold the entire new image,...
[ "numpy.matrix", "matplotlib.pyplot.imshow", "cv2.warpAffine", "numpy.array", "matplotlib.pyplot.imread", "cv2.getRotationMatrix2D", "matplotlib.pyplot.savefig" ]
[((1446, 1474), 'numpy.matrix', 'np.matrix', (['rot_mat[0:2, 0:2]'], {}), '(rot_mat[0:2, 0:2])\n', (1455, 1474), True, 'import numpy as np\n'), ((2875, 2948), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'affine_mat', '(new_w, new_h)'], {'flags': 'cv2.INTER_LINEAR'}), '(image, affine_mat, (new_w, new_h), flags=cv2.IN...
#****************************************************************************** # # MantaGen # Copyright 2018 <NAME>, <NAME>, <NAME> # # This program is free software, distributed under the terms of the # Apache License, Version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # #**************************************...
[ "numpy.random.uniform", "random.randint" ]
[((3221, 3254), 'random.randint', 'randint', (['(1)', 'self.max_source_count'], {}), '(1, self.max_source_count)\n', (3228, 3254), False, 'from random import randint\n'), ((1630, 1670), 'numpy.random.uniform', 'numpy.random.uniform', ([], {'low': '(0.25)', 'high': '(1.0)'}), '(low=0.25, high=1.0)\n', (1650, 1670), Fals...
""" Generates a path on the given occupancy grid (map of the environment) """ import networkx as nx from grid_loader import Grid import numpy as np def euclidean(node1, node2): x1, y1 = node1 x2, y2 = node2 return ((x1-x2)**2+(y1-y2)**2)**0.5 class AStar: # Constructor def __init__(self)...
[ "numpy.array", "networkx.grid_2d_graph" ]
[((1256, 1296), 'networkx.grid_2d_graph', 'nx.grid_2d_graph', (['grid_obj.w', 'grid_obj.h'], {}), '(grid_obj.w, grid_obj.h)\n', (1272, 1296), True, 'import networkx as nx\n'), ((2139, 2159), 'numpy.array', 'np.array', (['astar_path'], {}), '(astar_path)\n', (2147, 2159), True, 'import numpy as np\n'), ((1861, 1876), 'n...
import numpy as np import collections import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from sklearn.manifold import MDS from time import time from warnings import warn class ForestSim(): def __init__(self, forest): # TODO : adapt if non sklearn forest used self.forest = forest def fit...
[ "pandas.DataFrame", "numpy.random.seed", "matplotlib.pyplot.show", "seaborn.scatterplot", "numpy.float32", "numpy.zeros", "time.time", "matplotlib.pyplot.figure", "numpy.arange", "numpy.random.choice", "warnings.warn", "sklearn.manifold.MDS", "numpy.random.shuffle", "numpy.sqrt" ]
[((405, 418), 'numpy.float32', 'np.float32', (['X'], {}), '(X)\n', (415, 418), True, 'import numpy as np\n'), ((515, 541), 'numpy.zeros', 'np.zeros', (['(self.n, self.n)'], {}), '((self.n, self.n))\n', (523, 541), True, 'import numpy as np\n'), ((796, 802), 'time.time', 'time', ([], {}), '()\n', (800, 802), False, 'fro...
#!/usr/bin/env python # -*- coding: utf-8 -*- """CNN_using_persistence_images_on_patch.py The aim of this script is to perform the training of a CNN using persistence images as a input. This script is inspired from this script: BorgwardtLab/ADNI_MRI_Analysis/blob/mixed_CNN/mixed_CNN/run_Sarah.py To get real time info...
[ "tensorflow.random.set_seed", "numpy.load", "tensorflow.keras.layers.MaxPooling2D", "tensorflow.keras.layers.Dense", "os.walk", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.layers.concatenate", "numpy.mean", "tensorflow.keras.metrics.BinaryAccuracy", "shutil.rmtree", "tensorfl...
[((934, 956), 'dotenv.dotenv_values', 'dotenv.dotenv_values', ([], {}), '()\n', (954, 956), False, 'import dotenv\n'), ((957, 979), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(42)'], {}), '(42)\n', (975, 979), True, 'import tensorflow as tf\n'), ((889, 914), 'tensorflow.test.gpu_device_name', 'tf.test.gpu_d...
"""A simple, 2D peridynamics simulation example.""" import argparse import cProfile from io import StringIO import numpy as np import pathlib from peridynamics import Model from peridynamics.model import initial_crack_helper from peridynamics.integrators import Euler from pstats import SortKey, Stats mesh_file = pathl...
[ "io.StringIO", "argparse.ArgumentParser", "peridynamics.Model", "pstats.Stats", "cProfile.Profile", "pathlib.Path", "numpy.arange", "peridynamics.integrators.Euler" ]
[((1611, 1636), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1634, 1636), False, 'import argparse\n'), ((1836, 1938), 'peridynamics.Model', 'Model', (['mesh_file'], {'horizon': '(0.1)', 'critical_strain': '(0.005)', 'elastic_modulus': '(0.05)', 'initial_crack': 'is_crack'}), '(mesh_file, hor...
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/tslasso.main.ipynb (unless otherwise specified). __all__ = ['run_exp'] # Cell from ..atomgeom.features import get_features,get_D_feats_feats from ..atomgeom.utils import get_atoms_4 from ..simulations.rigidethanol import get_rigid_ethanol_data from ..utils.utils import...
[ "numpy.abs", "pathos.multiprocessing.cpu_count", "sklearn.decomposition.TruncatedSVD", "numpy.asarray", "numpy.einsum", "numpy.identity", "numpy.hstack", "megaman.embedding.SpectralEmbedding", "numpy.mean", "dill.dump", "pathos.multiprocessing.ProcessingPool", "numpy.unique" ]
[((1456, 1478), 'numpy.asarray', 'np.asarray', (['hparams.ii'], {}), '(hparams.ii)\n', (1466, 1478), True, 'import numpy as np\n'), ((1488, 1510), 'numpy.asarray', 'np.asarray', (['hparams.jj'], {}), '(hparams.jj)\n', (1498, 1510), True, 'import numpy as np\n'), ((2422, 2433), 'pathos.multiprocessing.ProcessingPool', '...
import numpy as np import matplotlib.pyplot as plt import pandas as pd from pyGDM2 import (structures, materials, core, linear, fields, propagators, tools) def get_spectrum(geometry, step, wavelengths): '''Obtains a uv-vis spectra for a specified geometry''' material ...
[ "numpy.random.randn", "pyGDM2.materials.gold", "pyGDM2.tools.calculate_spectrum", "pyGDM2.structures.center_struct", "pyGDM2.structures.struct", "pyGDM2.core.simulation", "numpy.max", "pyGDM2.structures.sphere", "numpy.array", "pyGDM2.propagators.DyadsQuasistatic123", "pyGDM2.fields.efield", "...
[((322, 338), 'pyGDM2.materials.gold', 'materials.gold', ([], {}), '()\n', (336, 338), False, 'from pyGDM2 import structures, materials, core, linear, fields, propagators, tools\n'), ((352, 410), 'pyGDM2.structures.struct', 'structures.struct', (['step', 'geometry', 'material'], {'verbose': '(False)'}), '(step, geometr...
import numpy as np with open("data.txt") as f: draws = np.array([int(d) for d in f.readline().split(",")]) boards = np.array([[[int(n) for n in r.split()] for r in b.split("\n")] for b in f.read()[1:].split("\n\n")]) def bingo(data: np.ndarray, fill: int): """ Returns horizontal (rows) and vertical ...
[ "numpy.where", "numpy.transpose" ]
[((396, 414), 'numpy.transpose', 'np.transpose', (['data'], {}), '(data)\n', (408, 414), True, 'import numpy as np\n'), ((924, 962), 'numpy.where', 'np.where', (['(b_data == draw)', 'fill', 'b_data'], {}), '(b_data == draw, fill, b_data)\n', (932, 962), True, 'import numpy as np\n'), ((1478, 1516), 'numpy.where', 'np.w...
import igraph as ig import numpy as np from scipy.special import betaln g = ig.Graph.Read_GML('karate.txt') X = np.array(g.get_adjacency().data) def irm(X, T, a, b, A, random_seed = 42): N = len(X) z = np.ones([N,1]) Z = [] np.random.seed(random_seed) for t in range(T): # for T iterations ...
[ "numpy.sum", "numpy.random.seed", "numpy.concatenate", "igraph.Graph.Read_GML", "numpy.ix_", "numpy.zeros", "numpy.ones", "scipy.special.betaln", "numpy.append", "numpy.cumsum", "numpy.tile", "numpy.random.rand", "numpy.delete", "numpy.all" ]
[((77, 108), 'igraph.Graph.Read_GML', 'ig.Graph.Read_GML', (['"""karate.txt"""'], {}), "('karate.txt')\n", (94, 108), True, 'import igraph as ig\n'), ((212, 227), 'numpy.ones', 'np.ones', (['[N, 1]'], {}), '([N, 1])\n', (219, 227), True, 'import numpy as np\n'), ((243, 270), 'numpy.random.seed', 'np.random.seed', (['ra...
import sys sys.path.append('./model') import argparse import torch import numpy as np from model.model import NCNet import torchvision.transforms as transforms from dataloader import TrainLoader, ValLoader from loss import WeakLoss import torch.optim as optim import json import os ## Parameters parser = argparse....
[ "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "model.model.NCNet", "loss.WeakLoss", "torchvision.transforms.Normalize", "torch.no_grad", "os.path.join", "sys.path.append", "torch.load", "os.path.exists", "dataloader.ValLoader", "torchvision.transforms.CenterCrop", "json.dump"...
[((12, 38), 'sys.path.append', 'sys.path.append', (['"""./model"""'], {}), "('./model')\n", (27, 38), False, 'import sys\n'), ((311, 365), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Nc-Net Training"""'}), "(description='Nc-Net Training')\n", (334, 365), False, 'import argparse\n'), (...
# encoding: utf-8 """ @author: liaoxingyu @contact: <EMAIL> """ import torchvision.transforms as T import random import numpy as np import PIL from .transforms import RandomErasing class AddGaussianNoise(object): def __call__(self, img): std = random.uniform(0, 1.0) if std > 0.5: retu...
[ "torchvision.transforms.ColorJitter", "torchvision.transforms.RandomHorizontalFlip", "random.uniform", "torchvision.transforms.RandomRotation", "numpy.asarray", "numpy.clip", "torchvision.transforms.ToTensor", "torchvision.transforms.Pad", "numpy.random.normal", "PIL.Image.fromarray", "torchvisi...
[((691, 754), 'torchvision.transforms.Normalize', 'T.Normalize', ([], {'mean': 'cfg.INPUT.PIXEL_MEAN', 'std': 'cfg.INPUT.PIXEL_STD'}), '(mean=cfg.INPUT.PIXEL_MEAN, std=cfg.INPUT.PIXEL_STD)\n', (702, 754), True, 'import torchvision.transforms as T\n'), ((1655, 1718), 'torchvision.transforms.Normalize', 'T.Normalize', ([...
import h5py from signal_filter.fft import LowPassFilter from signal_filter.mpi_signal_filter import SignalFilter h5_path = 'giv_raw.h5' h5_f = h5py.File(h5_path, mode='r+') h5_grp = h5_f['Measurement_000/Channel_000'] h5_main = h5_grp['Raw_Data'] samp_rate = h5_grp.attrs['IO_samp_rate_[Hz]'] num_spectral_pts = h5_ma...
[ "h5py.File", "numpy.abs", "numpy.allclose", "signal_filter.fft.LowPassFilter", "signal_filter.mpi_signal_filter.SignalFilter" ]
[((145, 174), 'h5py.File', 'h5py.File', (['h5_path'], {'mode': '"""r+"""'}), "(h5_path, mode='r+')\n", (154, 174), False, 'import h5py\n'), ((434, 597), 'signal_filter.mpi_signal_filter.SignalFilter', 'SignalFilter', (['h5_main'], {'frequency_filters': 'frequency_filters', 'noise_threshold': 'noise_tol', 'write_filtere...
#!/usr/bin/env python import os, sys, subprocess from os.path import basename,dirname import h5py from netCDF4 import Dataset import numpy as np import numpy.ma as ma import gdal from gdalconst import * from osgeo import ogr, osr from datetime import datetime, date def createImgSCISAT(fileAbsPath): # read info fr...
[ "netCDF4.Dataset", "numpy.ma.min", "gdal.GetDriverByName", "numpy.ma.set_fill_value", "os.path.exists", "numpy.expand_dims", "datetime.datetime.strptime", "sys.exit", "osgeo.osr.SpatialReference", "numpy.ma.max" ]
[((343, 368), 'netCDF4.Dataset', 'Dataset', (['fileAbsPath', '"""r"""'], {}), "(fileAbsPath, 'r')\n", (350, 368), False, 'from netCDF4 import Dataset\n'), ((495, 582), 'datetime.datetime.strptime', 'datetime.strptime', (["ncfile.groups['ACE-FTS-v2.2'].start_time", '"""%Y-%m-%d %H:%M:%S+00"""'], {}), "(ncfile.groups['AC...
"""Class for converter.""" import numpy as np import math import cmath import scipy import logging from scipy import signal from scipy.integrate import odeint,ode #from converter_utilities import plot_signal, plot_FFT import converter_utilities import config from models import InverterModels class PowerElectr...
[ "numpy.array" ]
[((10519, 10535), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (10527, 10535), True, 'import numpy as np\n'), ((11081, 11097), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (11089, 11097), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ Created on Mon May 4 12:48:05 2020 @author: sven """ import numpy as np def nearfield(f,c,theta): """ Compute the nearfield Parameters ---------- f : numeric Transducer Frequency in kHz [kHz]. c : numeric Ambient sound speed [m/s]. theta : numeric 3dB angle or beam width in ...
[ "numpy.sin", "numpy.log10", "numpy.tan" ]
[((1024, 1053), 'numpy.log10', 'np.log10', (['(5.78 / (k * a) ** 2)'], {}), '(5.78 / (k * a) ** 2)\n', (1032, 1053), True, 'import numpy as np\n'), ((1356, 1387), 'numpy.tan', 'np.tan', (['(theta * np.pi / 180 / 2)'], {}), '(theta * np.pi / 180 / 2)\n', (1362, 1387), True, 'import numpy as np\n'), ((504, 535), 'numpy.s...
import pandas as pd import numpy as np class regout(object): def __init__(self, **kwargs): self.__dict__.update(kwargs) stat_names=['coeff', 'se', 't', 'p>t', 'CI_low', 'CI_high'] var_names=['mpg', 'length', '_cons'] tsls_std = regout( summary=pd.DataFrame(np.array([ [-1319.865169393102, 1906.786...
[ "numpy.array" ]
[((278, 673), 'numpy.array', 'np.array', (['[[-1319.865169393102, 1906.786380881755, -0.6921935160784805, \n 0.4910734473693195, -5121.889227450638, 2482.158888664433], [-\n 217.1947537663291, 420.1260089670161, -0.5169752624941175, \n 0.6067801835089432, -1054.902223005562, 620.5127154729038], [\n 75092.75...
# Author: <NAME> # MIT license (see LICENCE.txt in the top-level folder) import unittest import numpy as np from numpy import random from numpy import linalg as LA from sklearn.linear_model import LinearRegression, LogisticRegression from single_neuron import models as models from single_neuron import math_utils as...
[ "numpy.zeros", "sklearn.linear_model.LinearRegression", "numpy.linalg.matrix_rank", "numpy.random.randint", "numpy.random.multivariate_normal", "numpy.random.rand" ]
[((551, 579), 'numpy.random.randint', 'random.randint', (['(3)', '(N_max + 1)'], {}), '(3, N_max + 1)\n', (565, 579), False, 'from numpy import random\n'), ((594, 622), 'numpy.random.randint', 'random.randint', (['(3)', '(N_max + 1)'], {}), '(3, N_max + 1)\n', (608, 622), False, 'from numpy import random\n'), ((631, 65...
import tensorflow as tf import numpy as np from model import decoder,vae import cv2 vae.load_weights("vae_cnn.h5") lv = np.load("lv.npy") fourcc = cv2.VideoWriter_fourcc(*'XVID') video = cv2.VideoWriter("output.avi", fourcc, 30.0, (208, 120)) for i in range(1000): data = lv[i].reshape(1,128) img = decoder.pre...
[ "numpy.load", "cv2.VideoWriter_fourcc", "model.decoder.predict", "cv2.cvtColor", "numpy.array", "cv2.VideoWriter", "model.vae.load_weights" ]
[((85, 115), 'model.vae.load_weights', 'vae.load_weights', (['"""vae_cnn.h5"""'], {}), "('vae_cnn.h5')\n", (101, 115), False, 'from model import decoder, vae\n'), ((121, 138), 'numpy.load', 'np.load', (['"""lv.npy"""'], {}), "('lv.npy')\n", (128, 138), True, 'import numpy as np\n'), ((148, 179), 'cv2.VideoWriter_fourcc...
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np USE_CUDA = torch.cuda.is_available() device = torch.device("cuda" if USE_CUDA else "cpu") class Bert_Base(nn.Module): def __init__(self, opt): super(Bert_Base, self).__init__() self.opt = opt #self.tokeni...
[ "torch.stack", "numpy.asarray", "numpy.zeros", "torch.cuda.is_available", "torch.device", "torch.sum", "torch.from_numpy" ]
[((98, 123), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (121, 123), False, 'import torch\n'), ((133, 176), 'torch.device', 'torch.device', (["('cuda' if USE_CUDA else 'cpu')"], {}), "('cuda' if USE_CUDA else 'cpu')\n", (145, 176), False, 'import torch\n'), ((603, 647), 'torch.sum', 'torch.s...
import glob import os import time import cv2 import numpy as np from Pre_Processing import frameManipulator commands = ['bin', 'lay', 'place', 'set'] prepositions = ['at', 'by', 'in', 'with'] colors = ['blue', 'green', 'red', 'white'] adverbs = ['again', 'now', 'please', 'soon'] alphabet = [chr(x) for x in range(ord...
[ "cv2.resize", "os.makedirs", "cv2.cvtColor", "cv2.imwrite", "Pre_Processing.frameManipulator.getVideoDataFromPath", "os.path.exists", "time.time", "cv2.VideoCapture", "numpy.hstack", "cv2.CascadeClassifier", "glob.glob", "os.listdir", "numpy.vstack" ]
[((654, 681), 'cv2.VideoCapture', 'cv2.VideoCapture', (['videoPath'], {}), '(videoPath)\n', (670, 681), False, 'import cv2\n'), ((1243, 1261), 'numpy.vstack', 'np.vstack', (['newList'], {}), '(newList)\n', (1252, 1261), True, 'import numpy as np\n'), ((1546, 1575), 'cv2.imwrite', 'cv2.imwrite', (['imagePath', 'image'],...
import numpy as np import math from pressiotools import linalg as la def read_binary_array(fileName, nCols): # read a numpy array from a binary file "fileName" if nCols==1: return np.fromfile(fileName) else: array = np.fromfile(fileName) nRows = int(len(array) / float(nCols)) return array.reshap...
[ "numpy.fromfile", "pressiotools.linalg.MultiVector", "pressiotools.linalg.Vector", "math.log10", "numpy.loadtxt" ]
[((190, 211), 'numpy.fromfile', 'np.fromfile', (['fileName'], {}), '(fileName)\n', (201, 211), True, 'import numpy as np\n'), ((232, 253), 'numpy.fromfile', 'np.fromfile', (['fileName'], {}), '(fileName)\n', (243, 253), True, 'import numpy as np\n'), ((459, 479), 'numpy.loadtxt', 'np.loadtxt', (['fileName'], {}), '(fil...
import numpy as np import sys # convert any index to a 4 tuple def unpackIndex(i, default): a = b = c = d = default if type(i) == int: d = i elif len(i) == 1: d = i[0] elif len(i) == 2: c = i[0] d = i[1] elif len(i) == 3: b = i[0] c = i[1] d =...
[ "numpy.load", "numpy.zeros" ]
[((479, 501), 'numpy.load', 'np.load', (["(path + '.npy')"], {}), "(path + '.npy')\n", (486, 501), True, 'import numpy as np\n'), ((1660, 1689), 'numpy.zeros', 'np.zeros', (['(1)'], {'dtype': 'np.float32'}), '(1, dtype=np.float32)\n', (1668, 1689), True, 'import numpy as np\n'), ((1138, 1167), 'numpy.zeros', 'np.zeros'...
x1=[] x2=[] x3=[] import sys import numpy as np f1 = open("light_gbm.txt") for line in f1: x1.append(float((line.strip().split('\t')[1]))) #print x1 f2 = open("simese_cnn.txt") for line in f2: x2.append(0.5 + 0.5*float((line.strip().split('\t')[1]))) #print x2 f3 = open("matchpyramid.txt") for line in f3: ...
[ "numpy.asarray", "numpy.vstack" ]
[((385, 399), 'numpy.asarray', 'np.asarray', (['x1'], {}), '(x1)\n', (395, 399), True, 'import numpy as np\n'), ((403, 417), 'numpy.asarray', 'np.asarray', (['x2'], {}), '(x2)\n', (413, 417), True, 'import numpy as np\n'), ((421, 435), 'numpy.asarray', 'np.asarray', (['x3'], {}), '(x3)\n', (431, 435), True, 'import num...
""" Module with a function for plotting spectra. """ import os import math import warnings import itertools from typing import Optional, Union, Tuple, List import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from typeguard import typechecked from matplotlib.ticker import AutoMinorLocator, Mu...
[ "matplotlib.pyplot.subplot", "numpy.abs", "matplotlib.pyplot.clf", "math.ceil", "matplotlib.pyplot.close", "os.getcwd", "species.read.read_filter.ReadFilter", "numpy.isnan", "numpy.argsort", "numpy.log10", "matplotlib.pyplot.figure", "matplotlib.ticker.AutoMinorLocator", "math.log10", "mat...
[((5193, 5241), 'matplotlib.pyplot.rc', 'plt.rc', (['"""axes"""'], {'edgecolor': '"""black"""', 'linewidth': '(2.2)'}), "('axes', edgecolor='black', linewidth=2.2)\n", (5199, 5241), True, 'import matplotlib.pyplot as plt\n'), ((33899, 33908), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (33906, 33908), True, '...
#!/usr/bin/env python3 # # Tests if the Fitzhugh-Nagumo toy model runs. # # This file is part of PINTS (https://github.com/pints-team/pints/) which is # released under the BSD 3-clause license. See accompanying LICENSE.md for # copyright notice and full license details. # import unittest import pints import pints.toy i...
[ "unittest.main", "numpy.linspace", "pints.toy.FitzhughNagumoModel" ]
[((2848, 2863), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2861, 2863), False, 'import unittest\n'), ((529, 560), 'pints.toy.FitzhughNagumoModel', 'pints.toy.FitzhughNagumoModel', ([], {}), '()\n', (558, 560), False, 'import pints\n'), ((1142, 1183), 'pints.toy.FitzhughNagumoModel', 'pints.toy.FitzhughNagumoM...
import math import numpy as np ## Real Data: # %% Kinect Color Camera color_cam_matrix = np.array([ 1.0526303338534365e+03, 0., 9.3528526085572480e+02, 0., 1.0534191001014469e+03, 5.2225718970556716e+02, 0., 0., 1. ]).reshape(3,3) color_distortion_coeffs = np.array([ 4.5467150011699140e-02, -7.4470107942918126e-02, -6...
[ "numpy.set_printoptions", "math.atan2", "math.tan", "numpy.array", "numpy.eye", "numpy.round" ]
[((425, 434), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (431, 434), True, 'import numpy as np\n'), ((991, 1000), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (997, 1000), True, 'import numpy as np\n'), ((3004, 3109), 'numpy.array', 'np.array', (['[[0.0, -1.0, 0.0, 0.0], [0.0, 0.0, -1.0, 0.0], [1.0, 0.0, 0.0, 0.0...
from deeplearning import tf_util as U from init import make_env_fn, make_model_fn from collections import namedtuple import os, argparse, json import numpy as np def eval_robot(args, env, pi): rewards = [] lengths = [] for j in range(args.nepisodes): rewards.append(0) lengths.append(0) ...
[ "json.dump", "json.load", "deeplearning.tf_util.initialize", "argparse.ArgumentParser", "init.make_env_fn", "deeplearning.tf_util.reset", "deeplearning.tf_util.make_session", "numpy.mean", "init.make_model_fn", "os.path.join", "deeplearning.tf_util.Experiment" ]
[((601, 610), 'deeplearning.tf_util.reset', 'U.reset', ([], {}), '()\n', (608, 610), True, 'from deeplearning import tf_util as U\n'), ((775, 798), 'init.make_env_fn', 'make_env_fn', (['train_args'], {}), '(train_args)\n', (786, 798), False, 'from init import make_env_fn, make_model_fn\n'), ((814, 839), 'init.make_mode...
#!/usr/bin/python import numpy as np # Construct an array by executing a function over each coordinate. def f(x, y): return 2*x + y + 1 a = np.fromfunction(f, (5, 4), dtype=int) print(a) # anonymous functoin b = np.fromfunction(lambda x, y: 2*x + y, (2, 2)) print(b)
[ "numpy.fromfunction" ]
[((148, 185), 'numpy.fromfunction', 'np.fromfunction', (['f', '(5, 4)'], {'dtype': 'int'}), '(f, (5, 4), dtype=int)\n', (163, 185), True, 'import numpy as np\n'), ((221, 268), 'numpy.fromfunction', 'np.fromfunction', (['(lambda x, y: 2 * x + y)', '(2, 2)'], {}), '(lambda x, y: 2 * x + y, (2, 2))\n', (236, 268), True, '...
# import curses and GPIO import curses import serial import time from picamera.array import PiRGBArray from picamera import PiCamera import cv2 import numpy as np ser = serial.Serial("/dev/ttyUSB0", "9600") serLidar = serial.Serial("/dev/ttyACM0", "115200") cap = cv2.VideoCapture(0) piCam = False #check if picamera ex...
[ "serial.Serial", "numpy.save", "curses.noecho", "curses.initscr", "curses.endwin", "cv2.VideoCapture", "curses.cbreak", "numpy.array", "picamera.array.PiRGBArray", "curses.nocbreak", "curses.echo", "picamera.PiCamera" ]
[((170, 207), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyUSB0"""', '"""9600"""'], {}), "('/dev/ttyUSB0', '9600')\n", (183, 207), False, 'import serial\n'), ((219, 258), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""', '"""115200"""'], {}), "('/dev/ttyACM0', '115200')\n", (232, 258), False, 'import serial\...
# Copyright (c) 2020 Graphcore Ltd. All rights reserved. import numpy as np import popart import torch from op_tester import op_tester def test_asinh(op_tester): # create test data # Notice: as asinh(x) = ln(x + sqrt(x^2 + 1)), absolute precision # deteriorates for larger negative numbers as you will have...
[ "op_tester.op_tester.setPatterns", "numpy.power", "op_tester.op_tester.run", "popart.reservedGradientPrefix", "numpy.array", "numpy.arcsinh" ]
[((342, 461), 'numpy.array', 'np.array', (['[-30.0, -20.12, -2.2, -1.5, -0.2, 0.0, 0.234, 1.0, 1.2, 2.0, 3.0, 10.0, \n 100.0, 2001.0]'], {'dtype': 'np.float32'}), '([-30.0, -20.12, -2.2, -1.5, -0.2, 0.0, 0.234, 1.0, 1.2, 2.0, 3.0, \n 10.0, 100.0, 2001.0], dtype=np.float32)\n', (350, 461), True, 'import numpy as n...
# painting.py import os import cv2 as cv import numpy as np from matplotlib import pyplot as plt from preprocess import Kmeans from monitor import Monitor import tkinter as tk import csv from utils import BlankImg class Painting(): def __init__(self, K, shape): #self.radius = 3 self.K = K ...
[ "csv.reader", "cv2.imwrite", "utils.BlankImg", "numpy.zeros", "cv2.imread" ]
[((4358, 4377), 'cv2.imread', 'cv.imread', (['filename'], {}), '(filename)\n', (4367, 4377), True, 'import cv2 as cv\n'), ((436, 455), 'numpy.zeros', 'np.zeros', (['self.size'], {}), '(self.size)\n', (444, 455), True, 'import numpy as np\n'), ((663, 682), 'utils.BlankImg', 'BlankImg', (['self.size'], {}), '(self.size)\...
from itertools import chain, combinations import numpy as np from numpy.testing import assert_allclose from wpca.tests.tools import assert_allclose_upto_sign from wpca.utils import orthonormalize, random_orthonormal, weighted_mean def test_orthonormalize(): rand = np.random.RandomState(42) X = rand.randn(3,...
[ "numpy.average", "numpy.eye", "wpca.utils.orthonormalize", "numpy.random.RandomState", "numpy.linalg.norm", "numpy.dot", "wpca.utils.random_orthonormal", "wpca.utils.weighted_mean" ]
[((273, 298), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (294, 298), True, 'import numpy as np\n'), ((333, 350), 'wpca.utils.orthonormalize', 'orthonormalize', (['X'], {}), '(X)\n', (347, 350), False, 'from wpca.utils import orthonormalize, random_orthonormal, weighted_mean\n'), ((43...
import numpy as np from acoustics.turbulence import Gaussian2DTemp, VonKarman2DTemp, Comparison, Field2D def main(): mu_0 = np.sqrt(10.0**(-6)) correlation_length = 1.0 # Typical correlation length for Gaussian spectrum. x = 20.0 y = 0.0 z = 40.0 plane = (1,0,1) #f_re...
[ "acoustics.turbulence.Comparison", "acoustics.turbulence.Field2D", "acoustics.turbulence.Gaussian2DTemp", "numpy.sqrt", "acoustics.turbulence.VonKarman2DTemp" ]
[((134, 153), 'numpy.sqrt', 'np.sqrt', (['(10.0 ** -6)'], {}), '(10.0 ** -6)\n', (141, 153), True, 'import numpy as np\n'), ((647, 774), 'acoustics.turbulence.Gaussian2DTemp', 'Gaussian2DTemp', ([], {'plane': 'plane', 'a': 'correlation_length', 'mu_0': 'mu_0', 'wavenumber_resolution': 'wavenumber_resolution', 'max_mode...
import torch as th from tqdm import tqdm from . import BaseFlow, register_flow from ..models import build_model from ..models.GATNE import NSLoss import torch from tqdm.auto import tqdm from numpy import random import dgl from ..sampler.GATNE_sampler import NeighborSampler, generate_pairs @register_flow("GATNE_traine...
[ "torch.utils.data.DataLoader", "torch.cat", "dgl.sampling.random_walk", "dgl.edge_type_subgraph", "numpy.random.shuffle" ]
[((1512, 1706), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['self.train_pairs'], {'batch_size': 'self.args.batch_size', 'collate_fn': 'self.neighbor_sampler.sample', 'shuffle': '(True)', 'num_workers': 'self.args.num_workers', 'pin_memory': '(True)'}), '(self.train_pairs, batch_size=self.args.\n ...
import argparse import torch from torch import nn from torch import optim from torchvision import transforms, datasets, models from collections import OrderedDict from PIL import Image import numpy as np import json #Take inputs from user parser = argparse.ArgumentParser() parser.add_argument('path_to_image', type=st...
[ "torch.from_numpy", "json.load", "torch.topk", "argparse.ArgumentParser", "torch.load", "torchvision.models.densenet121", "torchvision.transforms.Normalize", "PIL.Image.open", "torchvision.transforms.ToTensor", "torch.exp", "numpy.array", "torchvision.transforms.CenterCrop", "torchvision.mod...
[((250, 275), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (273, 275), False, 'import argparse\n'), ((870, 890), 'torch.load', 'torch.load', (['filepath'], {}), '(filepath)\n', (880, 890), False, 'import torch\n'), ((1899, 1916), 'PIL.Image.open', 'Image.open', (['image'], {}), '(image)\n', (...
from setuptools import Extension, setup from Cython.Build import cythonize import numpy as np import os.path as osp __version__ = '1.1.4' url = 'https://github.com/jannessm/quadric-mesh-simplification' files = [ 'simplify.c', 'array.c', 'clean_mesh.c', 'contract_pair.c', 'edges.c', 'maths.c', 'mesh_inversion....
[ "os.path.abspath", "Cython.Build.cythonize", "os.path.join", "numpy.get_include" ]
[((850, 872), 'Cython.Build.cythonize', 'cythonize', (['ext_modules'], {}), '(ext_modules)\n', (859, 872), False, 'from Cython.Build import cythonize\n'), ((480, 501), 'os.path.abspath', 'osp.abspath', (['__file__'], {}), '(__file__)\n', (491, 501), True, 'import os.path as osp\n'), ((572, 598), 'os.path.join', 'osp.jo...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Feb 9 17:53:39 2019 @author: alankar """ import numpy as np import matplotlib.pyplot as plt from scipy.special.orthogonal import p_roots #Legendre Polynomial roots from scipy import constants def gauss_quad(func,a,b,n,*args):#Legendre [x,w] = p_r...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "scipy.special.orthogonal.p_roots", "matplotlib.pyplot.figure", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid", "matp...
[((634, 659), 'numpy.linspace', 'np.linspace', (['(5)', '(500)', '(1000)'], {}), '(5, 500, 1000)\n', (645, 659), True, 'import numpy as np\n'), ((712, 740), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(13, 10)'}), '(figsize=(13, 10))\n', (722, 740), True, 'import matplotlib.pyplot as plt\n'), ((740, 771...
import numpy as np #import matplotlib.pyplot as plt import shapely.geometry from scipy.ndimage.morphology import binary_dilation from scipy.ndimage import label from multiprocessing import Pool def voxels_to_polygon(image_stack, pixel_size, center=(0.5, 0.5)): """Take a stack of images and produce a stack of shap...
[ "numpy.radians", "numpy.sum", "scipy.ndimage.morphology.binary_dilation", "numpy.zeros", "numpy.ones", "numpy.min", "numpy.where", "numpy.max", "numpy.array", "multiprocessing.Pool", "numpy.alltrue", "numpy.linalg.norm", "numpy.sqrt", "numpy.repeat" ]
[((1932, 1950), 'numpy.alltrue', 'np.alltrue', (['(s <= 2)'], {}), '(s <= 2)\n', (1942, 1950), True, 'import numpy as np\n'), ((2742, 2774), 'numpy.repeat', 'np.repeat', (['image', 'factor'], {'axis': '(1)'}), '(image, factor, axis=1)\n', (2751, 2774), True, 'import numpy as np\n'), ((2796, 2837), 'numpy.repeat', 'np.r...
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import copy import os import datetime import time from functools import reduce # Function that provide some information about the cvs files def infos(old_df_names, months): """ Print informations about databases ...
[ "matplotlib.pyplot.title", "pandas.DataFrame", "matplotlib.pyplot.show", "numpy.sum", "matplotlib.pyplot.plot", "pandas.read_csv", "matplotlib.pyplot.bar", "matplotlib.pyplot.legend", "pandas.merge", "matplotlib.pyplot.subplots", "matplotlib.pyplot.barh", "matplotlib.pyplot.figure", "numpy.m...
[((2627, 2639), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2637, 2639), True, 'import matplotlib.pyplot as plt\n'), ((2687, 2717), 'matplotlib.pyplot.bar', 'plt.bar', (['X', 'average_session_df'], {}), '(X, average_session_df)\n', (2694, 2717), True, 'import matplotlib.pyplot as plt\n'), ((2798, 2841)...
# -*- coding: utf-8 -*- """ Created on Tue Jun 7 16:12:33 2016 @author: rmcleod """ import numpy as np import matplotlib.pyplot as plt import os, os.path, glob mcFRCFiles = glob.glob( "FRC/*mcFRC.npy" ) zorroFRCFiles = glob.glob( "FRC/*zorroFRC.npy" ) zorroFRCs = [None] * len( zorroFRCFiles) for J in np.arange( ...
[ "matplotlib.pyplot.title", "numpy.load", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.array", "glob.glob", "matplotlib.pyplot.savefig" ]
[((177, 204), 'glob.glob', 'glob.glob', (['"""FRC/*mcFRC.npy"""'], {}), "('FRC/*mcFRC.npy')\n", (186, 204), False, 'import os, os.path, glob\n'), ((223, 253), 'glob.glob', 'glob.glob', (['"""FRC/*zorroFRC.npy"""'], {}), "('FRC/*zorroFRC.npy')\n", (232, 253), False, 'import os, os.path, glob\n'), ((621, 633), 'matplotli...
import numpy as np from pyutai import trees from potentials import cluster def cpd_size(cpd): return np.prod(cpd.cardinality) def unique_values(cpd): unique, _ = np.unique(cpd.values, return_counts=True) return len(unique) def stats(net): if not net.endswith('.bif'): raise ValueError('Net ...
[ "numpy.unique", "pyutai.trees.Tree.from_array", "numpy.prod", "potentials.cluster.Cluster.from_array" ]
[((107, 131), 'numpy.prod', 'np.prod', (['cpd.cardinality'], {}), '(cpd.cardinality)\n', (114, 131), True, 'import numpy as np\n'), ((174, 215), 'numpy.unique', 'np.unique', (['cpd.values'], {'return_counts': '(True)'}), '(cpd.values, return_counts=True)\n', (183, 215), True, 'import numpy as np\n'), ((978, 1064), 'pyu...
import os,sys import datetime as dt import numpy as np try: #for python 3.0 or later from urllib.request import urlopen except ImportError: #Fall back to python 2 urllib2 from urllib2 import urlopen import requests from multiprocessing import Pool import drms from shutil import move import glob ###Rem...
[ "sys.stdout.write", "numpy.size", "requests.head", "os.makedirs", "os.path.exists", "datetime.datetime.strptime", "datetime.timedelta", "drms.Client", "urllib2.urlopen", "sys.exit" ]
[((3268, 3306), 'datetime.datetime.strptime', 'dt.datetime.strptime', (['time', '"""%Y/%m/%d"""'], {}), "(time, '%Y/%m/%d')\n", (3288, 3306), True, 'import datetime as dt\n'), ((6072, 6086), 'urllib2.urlopen', 'urlopen', (['inurl'], {}), '(inurl)\n', (6079, 6086), False, 'from urllib2 import urlopen\n'), ((7346, 7390),...
"""Candid Covariance-Free Incremental PCA (CCIPCA).""" import numpy as np from scipy import linalg from sklearn.utils import check_array from sklearn.utils.validation import FLOAT_DTYPES from sklearn.base import BaseEstimator from sklearn.preprocessing import normalize import copy class CCIPCA(BaseEstimat...
[ "sklearn.utils.check_array", "numpy.zeros", "numpy.expand_dims", "sklearn.preprocessing.normalize", "numpy.dot" ]
[((1416, 1466), 'sklearn.utils.check_array', 'check_array', (['X'], {'dtype': 'FLOAT_DTYPES', 'copy': 'self.copy'}), '(X, dtype=FLOAT_DTYPES, copy=self.copy)\n', (1427, 1466), False, 'from sklearn.utils import check_array\n'), ((3110, 3155), 'sklearn.utils.check_array', 'check_array', (['X'], {'copy': 'copy', 'dtype': ...
import warnings warnings.filterwarnings('ignore', category=UserWarning, append=True) RAMS_Units=dict() # winds RAMS_Units['UC']='m s-1' RAMS_Units['VC']='m s-1' RAMS_Units['WC']='m s-1' # potential temperature RAMS_Units['THETA']='K' RAMS_Units['PI']='J kg-1 K-1' RAMS_Units['DN0']='kg m-3' # water vapour mixing ratio...
[ "iris.coords.AuxCoord", "warnings.filterwarnings", "iris.cube.CubeList", "numpy.zeros", "iris.load", "iris.Constraint", "datetime.datetime", "datetime.datetime.strptime", "iris.load_cube", "iris.coords.DimCoord", "numpy.arange", "numpy.diff", "datetime.timedelta", "numpy.array" ]
[((16, 84), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning', 'append': '(True)'}), "('ignore', category=UserWarning, append=True)\n", (39, 84), False, 'import warnings\n'), ((2997, 3015), 'iris.load', 'load', (['filenames[0]'], {}), '(filenames[0])\n', (3001, 3015), F...
"""PPO Agent for CRMDPs.""" import torch import random import numpy as np from typing import Generator, List from safe_grid_agents.common.utils import track_metrics from safe_grid_agents.common.agents.policy_cnn import PPOCNNAgent from safe_grid_agents.types import Rollout from ai_safety_gridworlds.environments.tomat...
[ "numpy.sum", "safe_grid_agents.types.Rollout", "numpy.ravel", "numpy.argsort", "numpy.array", "numpy.reshape", "safe_grid_agents.common.utils.track_metrics", "torch.no_grad", "numpy.fromstring" ]
[((743, 757), 'numpy.sum', 'np.sum', (['(X != Y)'], {}), '(X != Y)\n', (749, 757), True, 'import numpy as np\n'), ((6632, 6648), 'numpy.array', 'np.array', (['boards'], {}), '(boards)\n', (6640, 6648), True, 'import numpy as np\n'), ((6667, 6684), 'numpy.array', 'np.array', (['rewards'], {}), '(rewards)\n', (6675, 6684...
"""Miscellaneous functions and helpers for the uclasm package.""" import numpy as np def one_hot(idx, length): """Return a 1darray of zeros with a single one in the idx'th entry.""" one_hot = np.zeros(length, dtype=np.bool) one_hot[idx] = True return one_hot def index_map(args): """Return a dict...
[ "numpy.zeros" ]
[((202, 233), 'numpy.zeros', 'np.zeros', (['length'], {'dtype': 'np.bool'}), '(length, dtype=np.bool)\n', (210, 233), True, 'import numpy as np\n')]
# Copyright 2020, The TensorFlow Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
[ "absl.testing.absltest.main", "tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.models.LogisticRegressionAttacker", "tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.models.TrainedAttacker", "numpy.array", "tensorflow_privacy.privacy.privacy_tests.membership_inference...
[((3202, 3217), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (3215, 3217), False, 'from absl.testing import absltest\n'), ((964, 988), 'tensorflow_privacy.privacy.privacy_tests.membership_inference_attack.models.TrainedAttacker', 'models.TrainedAttacker', ([], {}), '()\n', (986, 988), False, 'from t...
# %% import sys, os import pandas as pd import networkx as nx # import matplotlib.pyplot as plt import numpy as np import pickle base_file_path = os.path.abspath(os.path.join(os.curdir, '..','..', '..')) # should point to the level above the src directory data_path = os.path.join(base_file_path, 'data', 'Intercity_Dal...
[ "numpy.zeros", "os.path.join", "numpy.sum", "numpy.concatenate" ]
[((269, 325), 'os.path.join', 'os.path.join', (['base_file_path', '"""data"""', '"""Intercity_Dallas"""'], {}), "(base_file_path, 'data', 'Intercity_Dallas')\n", (281, 325), False, 'import sys, os\n'), ((2582, 2607), 'numpy.zeros', 'np.zeros', (['(num_counties,)'], {}), '((num_counties,))\n', (2590, 2607), True, 'impor...
from cv2 import cv2 import numpy as np import anki_vector from anki_vector.util import distance_mm, speed_mmps, degrees def empty(a): pass robot=anki_vector.Robot() robot.connect() robot.camera.init_camera_feed() robot.behavior.set_lift_height(0.0) robot.behavior.set_head_angle(degrees(0)) cv2.namedWindow("Tr...
[ "cv2.cv2.namedWindow", "cv2.cv2.arcLength", "anki_vector.Robot", "cv2.cv2.boundingRect", "cv2.cv2.resizeWindow", "cv2.cv2.getTrackbarPos", "cv2.cv2.findContours", "cv2.cv2.inRange", "cv2.cv2.approxPolyDP", "anki_vector.util.degrees", "cv2.cv2.createTrackbar", "numpy.array", "cv2.cv2.Gaussian...
[((154, 173), 'anki_vector.Robot', 'anki_vector.Robot', ([], {}), '()\n', (171, 173), False, 'import anki_vector\n'), ((301, 329), 'cv2.cv2.namedWindow', 'cv2.namedWindow', (['"""TrackBars"""'], {}), "('TrackBars')\n", (316, 329), False, 'from cv2 import cv2\n'), ((330, 369), 'cv2.cv2.resizeWindow', 'cv2.resizeWindow',...
from __future__ import absolute_import from unittest import TestCase, skip from ..wcs import WCS import numpy as np import os import re import sys from astropy.io import fits from astropy.modeling import (models, fitting, Model) import matplotlib.pyplot as plt from ccdproc import CCDData class TestWCSBase(TestCase)...
[ "ccdproc.CCDData.read", "os.path.dirname", "re.match", "numpy.ones", "os.path.isfile", "astropy.modeling.models.Chebyshev1D", "astropy.io.fits.Header", "os.path.join", "re.sub" ]
[((1309, 1371), 'os.path.join', 'os.path.join', (['self.data_path', '"""goodman_comp_400M1_HgArNe.fits"""'], {}), "(self.data_path, 'goodman_comp_400M1_HgArNe.fits')\n", (1321, 1371), False, 'import os\n'), ((1419, 1454), 'ccdproc.CCDData.read', 'CCDData.read', (['test_file'], {'unit': '"""adu"""'}), "(test_file, unit=...
from sciapp.action import Free import scipy.ndimage as ndimg import numpy as np, wx # from imagepy import IPy #matplotlib.use('WXAgg') import matplotlib.pyplot as plt def block(arr): img = np.zeros((len(arr),30,30), dtype=np.uint8) img.T[:] = arr return np.hstack(img) class Temperature(Free): title = 'Temperature...
[ "matplotlib.pyplot.title", "scipy.ndimage.gaussian_filter1d", "numpy.ones", "matplotlib.pyplot.figure", "numpy.exp", "matplotlib.pyplot.gca", "numpy.linspace", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "scipy.ndimage.convolve1d", "matplotlib.pyplot.leg...
[((258, 272), 'numpy.hstack', 'np.hstack', (['img'], {}), '(img)\n', (267, 272), True, 'import numpy as np, wx\n'), ((384, 433), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]'], {}), '([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n', (392, 433), True, 'import numpy as np, wx\n'), ((430, 496), 'numpy...
import pandas as pd import numpy as np from texttable import Texttable from cape_privacy.pandas import dtypes from cape_privacy.pandas.transformations import NumericPerturbation from cape_privacy.pandas.transformations import DatePerturbation from cape_privacy.pandas.transformations import NumericRounding from cape_p...
[ "pandas.DataFrame", "cape_privacy.pandas.transformations.DatePerturbation", "numpy.random.seed", "faker.Faker", "faker.Faker.seed", "anonympy.pandas.utils_pandas.get_datetime_columns", "anonympy.pandas.utils_pandas.get_categorical_columns", "anonympy.pandas.utils_pandas.get_numeric_columns", "pandas...
[((2237, 2273), 'anonympy.pandas.utils_pandas.get_numeric_columns', '_utils.get_numeric_columns', (['self._df'], {}), '(self._df)\n', (2263, 2273), True, 'from anonympy.pandas import utils_pandas as _utils\n'), ((2309, 2349), 'anonympy.pandas.utils_pandas.get_categorical_columns', '_utils.get_categorical_columns', (['s...
import csv import random import re import sys import tqdm import numpy as np import torch from torch.utils.data import TensorDataset from transformers.tokenization_bert import BertTokenizer def load_glove_txt(file_path="glove.840B.300d.txt"): results = {} num_file = sum([1 for i in open(file_path, "r", encodi...
[ "tqdm.tqdm", "transformers.tokenization_bert.BertTokenizer", "numpy.random.shuffle", "csv.reader", "torch.LongTensor", "torch.utils.data.TensorDataset", "re.sub", "torch.tensor" ]
[((663, 690), 're.sub', 're.sub', (['"""\'s"""', '""" \'s"""', 'string'], {}), '("\'s", " \'s", string)\n', (669, 690), False, 'import re\n'), ((706, 735), 're.sub', 're.sub', (['"""\'ve"""', '""" \'ve"""', 'string'], {}), '("\'ve", " \'ve", string)\n', (712, 735), False, 'import re\n'), ((751, 780), 're.sub', 're.sub'...
import numpy as np import torch import pytorch_lightning as pl from torch.utils.data import DataLoader from implem.utils import device class SimpleDataset(torch.utils.data.Dataset): def __init__(self, data, offset=1, start=None, end=None): super(SimpleDataset, self).__init__() assert len(data.shap...
[ "numpy.asarray", "numpy.prod", "numpy.arange", "torch.arange", "torch.Generator" ]
[((653, 722), 'torch.arange', 'torch.arange', (['self.start', 'self.end'], {'requires_grad': '(False)', 'device': '"""cpu"""'}), "(self.start, self.end, requires_grad=False, device='cpu')\n", (665, 722), False, 'import torch\n'), ((1611, 1680), 'torch.arange', 'torch.arange', (['self.start', 'self.end'], {'requires_gra...
# -*- coding: utf-8 -*- """ Created on Wed Oct 6 23:59:38 2021 @author: <NAME> """ # Adding Salt and Pepper Noise to image import cv2 as cv import numpy as np import random # Adding salt and pepper noise def gaussian_noise(image): row = 512 col = 512 mean = 0 var = 0.1 sigma = var**...
[ "cv2.imread", "random.randint", "numpy.random.normal" ]
[((1586, 1611), 'cv2.imread', 'cv.imread', (['"""Lenna.jpg"""', '(0)'], {}), "('Lenna.jpg', 0)\n", (1595, 1611), True, 'import cv2 as cv\n'), ((338, 379), 'numpy.random.normal', 'np.random.normal', (['mean', 'sigma', '(row, col)'], {}), '(mean, sigma, (row, col))\n', (354, 379), True, 'import numpy as np\n'), ((733, 75...
import os.path from unittest import TestCase import numpy as np from aspire.utils import ( Rotation, crop_pad_2d, get_aligned_rotations, grid_2d, grid_3d, register_rotations, uniform_random_angles, ) DATA_DIR = os.path.join(os.path.dirname(__file__), "saved_test_data") class UtilsTestCa...
[ "aspire.utils.Rotation.from_euler", "aspire.utils.grid_2d", "numpy.eye", "aspire.utils.get_aligned_rotations", "numpy.allclose", "aspire.utils.crop_pad_2d", "numpy.dtype", "numpy.ones", "numpy.zeros", "aspire.utils.uniform_random_angles", "numpy.arange", "numpy.array", "aspire.utils.register...
[((535, 560), 'aspire.utils.grid_2d', 'grid_2d', (['(8)'], {'indexing': '"""xy"""'}), "(8, indexing='xy')\n", (542, 560), False, 'from aspire.utils import Rotation, crop_pad_2d, get_aligned_rotations, grid_2d, grid_3d, register_rotations, uniform_random_angles\n'), ((1216, 1242), 'aspire.utils.grid_3d', 'grid_3d', (['(...
#!/usr/bin/python # -*- coding: utf-8 -*- # created by <NAME> # contact with <EMAIL> import numpy as np import datetime import os import pandas as pd import random import time import threading import multiprocessing def check_file(tt,datelist,hour): ''' chech file at the time of 'tt' and its continuous 24 h...
[ "numpy.load", "numpy.ones_like", "numpy.abs", "pandas.read_csv", "random.shuffle", "os.path.exists", "numpy.ones", "numpy.isnan", "datetime.datetime", "time.time", "numpy.sin", "numpy.array", "datetime.timedelta", "multiprocessing.Pool", "numpy.concatenate" ]
[((593, 618), 'os.path.exists', 'os.path.exists', (['ruitufile'], {}), '(ruitufile)\n', (607, 618), False, 'import os\n'), ((1522, 1617), 'pandas.read_csv', 'pd.read_csv', (['"""/data/output/all_guance_data_name_list/all_gc_filename_list.csv"""'], {'index_col': '(0)'}), "('/data/output/all_guance_data_name_list/all_gc_...
from src.ddpg.train import Trainer from src.ddpg.buffer import MemoryBuffer from statistics import mean import gym import numpy as np import random import scipy.stats class EvolutionaryDDPG: def __init__(self, n_networks, max_buffer, max_episodes, max_steps, episodes_ready, explore_prob, explore_factors): ...
[ "gym.make", "src.ddpg.buffer.MemoryBuffer", "numpy.float32", "random.random", "random.randrange", "statistics.mean", "src.ddpg.train.Trainer" ]
[((2347, 2371), 'random.randrange', 'random.randrange', (['self.n'], {}), '(self.n)\n', (2363, 2371), False, 'import random\n'), ((1135, 1163), 'gym.make', 'gym.make', (['"""BipedalWalker-v2"""'], {}), "('BipedalWalker-v2')\n", (1143, 1163), False, 'import gym\n'), ((1630, 1659), 'src.ddpg.buffer.MemoryBuffer', 'Memory...
from collections import defaultdict import numpy as np import networkx as nx import networkx.algorithms.approximation as approx import networkx.algorithms.coloring as coloring import pulp def clique_random_sequential(graph : nx.Graph) -> list: """Perform minimum clique cover with random sequential greedy...
[ "networkx.algorithms.coloring.greedy_color", "networkx.complement", "collections.defaultdict", "networkx.find_cliques", "numpy.random.permutation", "pulp.LpProblem", "pulp.PULP_CBC_CMD", "networkx.algorithms.approximation.clique_removal", "multiprocessing.cpu_count" ]
[((1497, 1525), 'networkx.algorithms.approximation.clique_removal', 'approx.clique_removal', (['graph'], {}), '(graph)\n', (1518, 1525), True, 'import networkx.algorithms.approximation as approx\n'), ((3741, 3761), 'networkx.complement', 'nx.complement', (['graph'], {}), '(graph)\n', (3754, 3761), True, 'import network...
import webbrowser import numpy as np import pandas as pd from pandas_datareader import data as web from sklearn import linear_model webbrowser.open("https://github.com/philliphsu/BottomSheetPickers") class ScikitBacktest(object): def __init__(self, sys): self.data = d self.matrix = m sel...
[ "pandas.DataFrame", "webbrowser.open", "pandas_datareader.data.DataReader", "sklearn.linear_model.LogisticRegression", "numpy.sign" ]
[((134, 201), 'webbrowser.open', 'webbrowser.open', (['"""https://github.com/philliphsu/BottomSheetPickers"""'], {}), "('https://github.com/philliphsu/BottomSheetPickers')\n", (149, 201), False, 'import webbrowser\n'), ((399, 440), 'sklearn.linear_model.LogisticRegression', 'linear_model.LogisticRegression', ([], {'C':...
import sys import cv2 from matplotlib import pyplot as plt from skimage.filters import sobel import numpy as np import math from Etch import Etch PRINT_ETCH = True class Image: def __init__(self): self.points = [] self.image = cv2.imread("C:/Users/wnetz/Documents/etch-a-sketch/python/tests/protoco...
[ "Etch.Etch", "cv2.Canny", "numpy.set_printoptions", "matplotlib.pyplot.show", "math.pow", "numpy.median", "matplotlib.pyplot.imshow", "cv2.imread" ]
[((249, 346), 'cv2.imread', 'cv2.imread', (['"""C:/Users/wnetz/Documents/etch-a-sketch/python/tests/protocol1_0/tri.png"""', '(0)'], {}), "(\n 'C:/Users/wnetz/Documents/etch-a-sketch/python/tests/protocol1_0/tri.png',\n 0)\n", (259, 346), False, 'import cv2\n'), ((386, 392), 'Etch.Etch', 'Etch', ([], {}), '()\n',...
import os import sys path = os.environ.get('TRAVIS_BUILD_DIR') sys.path.insert(0, path+'/protlearn') import numpy as np from preprocessing import txt_to_df from feature_engineering import aaindex1 def test_aaindex1(): "Test AAIndex1" # load data df = txt_to_df(path+'/tests/docs/test_seq.txt', 0) ...
[ "preprocessing.txt_to_df", "sys.path.insert", "os.environ.get", "numpy.array", "numpy.round", "feature_engineering.aaindex1" ]
[((28, 62), 'os.environ.get', 'os.environ.get', (['"""TRAVIS_BUILD_DIR"""'], {}), "('TRAVIS_BUILD_DIR')\n", (42, 62), False, 'import os\n'), ((63, 102), 'sys.path.insert', 'sys.path.insert', (['(0)', "(path + '/protlearn')"], {}), "(0, path + '/protlearn')\n", (78, 102), False, 'import sys\n'), ((271, 318), 'preprocess...
from __future__ import print_function, absolute_import # Script to predict (or test) the model using protein (kinase) sequence and SMILE pattern of a compound. # Usage: python2 get_kinase_pki.py protein_sequence "SMILE_Pattern" import numpy as np from pydpi.pypro import PyPro import pandas as pd import json import m...
[ "pydpi.pypro.PyPro", "os.path.dirname", "utility.FeatureGenerator", "numpy.array" ]
[((933, 940), 'pydpi.pypro.PyPro', 'PyPro', ([], {}), '()\n', (938, 940), False, 'from pydpi.pypro import PyPro\n'), ((747, 771), 'utility.FeatureGenerator', 'FeatureGenerator', (['smiles'], {}), '(smiles)\n', (763, 771), False, 'from utility import FeatureGenerator\n'), ((605, 630), 'os.path.dirname', 'os.path.dirname...
from keras.models import load_model from keras.preprocessing import image import numpy as np import cv2 from keras.backend import tensorflow_backend as K import os import glob import time import keras from matplotlib import pyplot as plt from keras.datasets import mnist from keras.models import Sequential from keras.la...
[ "keras.models.load_model", "keras.optimizers.Adadelta", "numpy.resize", "numpy.argmax", "keras.backend.tensorflow_backend.flatten", "cv2.contourArea", "cv2.cvtColor", "keras.layers.Flatten", "cv2.boundingRect", "keras.layers.MaxPooling2D", "cv2.resize", "numpy.uint8", "keras.layers.Dropout",...
[((1228, 1343), 'keras.models.load_model', 'load_model', (['"""../src/gumruk_unetGU002.h5"""'], {'custom_objects': "{'IOU_calc_loss': IOU_calc_loss, 'IOU_calc': IOU_calc}"}), "('../src/gumruk_unetGU002.h5', custom_objects={'IOU_calc_loss':\n IOU_calc_loss, 'IOU_calc': IOU_calc})\n", (1238, 1343), False, 'from keras....
import json import os import SimpleITK as sitk import numpy import pydicom import numpy as np from ltr.admin.environment import env_settings from ltr.data.processing_utils import str_analyse from ltr.dataset.base_dataset import BaseDataset from pydoctor.evaluation import Study from pydoctor.evaluation.data import Stud...
[ "numpy.stack", "pydicom.read_file", "SimpleITK.ReadImage", "ltr.admin.environment.env_settings", "os.path.join", "os.listdir", "SimpleITK.ImageSeriesReader" ]
[((2384, 2413), 'os.listdir', 'os.listdir', (['self.studies_path'], {}), '(self.studies_path)\n', (2394, 2413), False, 'import os\n'), ((2518, 2574), 'os.path.join', 'os.path.join', (['self.studies_path', 'self.study_list[std_id]'], {}), '(self.studies_path, self.study_list[std_id])\n', (2530, 2574), False, 'import os\...
__doc__ = """ Various data utilities. """ #################################################################### # Packages #################################################################### import os import h5py import numpy as np import pandas as pd #########################################################...
[ "h5py.File", "pandas.HDFStore", "numpy.sum", "numpy.std", "os.path.realpath", "numpy.mean", "numpy.array", "os.path.join" ]
[((545, 578), 'os.path.join', 'os.path.join', (['PROJECT_DIR', '"""data"""'], {}), "(PROJECT_DIR, 'data')\n", (557, 578), False, 'import os\n'), ((597, 631), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""train.h5"""'], {}), "(DATA_DIR, 'train.h5')\n", (609, 631), False, 'import os\n'), ((505, 531), 'os.path.realpat...
from click.testing import CliRunner from unittest import mock import numpy as np import os import pandas as pd import shutil import tempfile import textwrap from mlflow import experiments from mlflow.runs import list_run import mlflow def test_list_run(): with mlflow.start_run(run_name="apple"): pass ...
[ "textwrap.dedent", "mlflow.start_run", "unittest.mock.patch", "tempfile.mkdtemp", "numpy.array", "shutil.rmtree", "click.testing.CliRunner", "os.path.join" ]
[((270, 304), 'mlflow.start_run', 'mlflow.start_run', ([], {'run_name': '"""apple"""'}), "(run_name='apple')\n", (286, 304), False, 'import mlflow\n'), ((616, 667), 'unittest.mock.patch', 'mock.patch', (['"""mlflow.experiments.fluent.search_runs"""'], {}), "('mlflow.experiments.fluent.search_runs')\n", (626, 667), Fals...
""" This example implements the model from the paper > [Design Space for Graph Neural Networks](https://arxiv.org/abs/2011.08843)<br> > <NAME>, <NAME>, <NAME> using the PROTEINS dataset. The configuration at the top of the file is the best one identified in the paper, and should work well for many different ...
[ "numpy.average", "tensorflow.config.list_physical_devices", "spektral.data.DisjointLoader", "spektral.datasets.TUDataset", "tensorflow.config.experimental.set_memory_growth", "tensorflow.keras.losses.CategoricalCrossentropy", "numpy.mean", "tensorflow.keras.optimizers.Adam", "tensorflow.keras.metric...
[((798, 836), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (829, 836), True, 'import tensorflow as tf\n'), ((1343, 1364), 'spektral.datasets.TUDataset', 'TUDataset', (['"""PROTEINS"""'], {}), "('PROTEINS')\n", (1352, 1364), False, 'from spektral.dataset...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 23 15:57:12 2018 @author: coelhorp """ import numpy as np from sklearn.metrics import roc_auc_score from rpa.helpers.transfer_learning.utils import transform_org2rct, transform_rct2str, transform_rct2rot from rpa.helpers.transfer_learning.utils im...
[ "rpa.helpers.transfer_learning.utils.get_sourcetarget_split_motorimagery", "numpy.unique", "rpa.helpers.transfer_learning.utils.transform_rct2rot", "sklearn.metrics.roc_auc_score", "rpa.helpers.transfer_learning.utils.get_sourcetarget_split_p300", "rpa.helpers.transfer_learning.utils.transform_org2rct_p30...
[((849, 901), 'rpa.helpers.transfer_learning.utils.transform_rct2str', 'transform_rct2str', (['source', 'target_train', 'target_test'], {}), '(source, target_train, target_test)\n', (866, 901), False, 'from rpa.helpers.transfer_learning.utils import transform_org2rct, transform_rct2str, transform_rct2rot\n'), ((1934, 1...
import matplotlib.pyplot as plt import numpy as np import math from scipy.stats import norm from matplotlib import rc __author__ = 'ernesto' # if use latex or mathtext rc('text', usetex=False) rc('mathtext', fontset='cm') # auxiliar function for plot ticks of equal length in x and y axis despite its scales. def con...
[ "matplotlib.pyplot.xlim", "matplotlib.rc", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "math.sqrt", "numpy.polyval", "matplotlib.pyplot.subplot2grid", "matplotlib.pyplot.legend", "matplotlib.pyplot.axis", "matplotlib.pyplot.text", "matplotlib.pyplot.figure", ...
[((171, 195), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(False)'}), "('text', usetex=False)\n", (173, 195), False, 'from matplotlib import rc\n'), ((196, 224), 'matplotlib.rc', 'rc', (['"""mathtext"""'], {'fontset': '"""cm"""'}), "('mathtext', fontset='cm')\n", (198, 224), False, 'from matplotlib import rc\n'...
# Modified work: # ----------------------------------------------------------------------------- # Copyright (c) 2019 Preferred Infrastructure, Inc. # Copyright (c) 2019 Preferred Networks, Inc. # ----------------------------------------------------------------------------- # Original work: # -------------------------...
[ "chainer.utils.type_check.expect", "numpy.ceil", "six.moves.range", "chainercv.functions.ps_roi_average_align_2d._get_bounds", "numpy.empty", "chainercv.functions.ps_roi_average_align_2d._pair", "numpy.floor", "numpy.zeros", "numpy.unravel_index", "chainer.backends.cuda.cupy.zeros", "chainer.bac...
[((1420, 1437), 'chainercv.functions.ps_roi_average_pooling_2d._outsize', '_outsize', (['outsize'], {}), '(outsize)\n', (1428, 1437), False, 'from chainercv.functions.ps_roi_average_pooling_2d import _outsize\n'), ((2718, 2739), 'chainercv.functions.ps_roi_average_align_2d._pair', '_pair', (['sampling_ratio'], {}), '(s...
import pyqtgraph as pg from pyqtgraph.dockarea import * import numpy as np import os import numbers try: from PyQt4.QtGui import QFileDialog from PyQt4 import QtCore, QtGui from PyQt4.QtGui import QMainWindow except ImportError: from PyQt5.QtWidgets import QFileDialog from PyQt5 import QtCore, QtGu...
[ "PyQt5.QtWidgets.QMainWindow.__init__", "os.path.basename", "pyqtgraph.PlotWidget", "os.path.exists", "pyqtgraph.ImageView", "PyQt5.QtGui.QVBoxLayout", "PyQt5.QtWidgets.QFileDialog.getOpenFileName", "numpy.array", "pyqtgraph.ROI", "pyqtgraph.setConfigOptions", "ImagingReso._utilities.convert_x_a...
[((1319, 1360), 'PyQt5.QtWidgets.QMainWindow.__init__', 'QMainWindow.__init__', (['self'], {'parent': 'parent'}), '(self, parent=parent)\n', (1339, 1360), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow\n'), ((1379, 1393), '__code.ui_resonance_imaging_experiment_vs_theory.Ui_MainWindow', 'UiMainWindow', (...
import numpy as np import matplotlib.pyplot as plt import math import itertools_recipes as it data=np.array([[1,1],[5,2],[3,3],[0,2],[9,4],[4,8]]) x=data[:,0] y=data[:,1] def choose(): q=[] u=list(it.permutations([0,1,2,3,4,5],6)) m=np.zeros((6,2)) n=np.zeros((6,2)) for i in range(le...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "math.sqrt", "numpy.zeros", "numpy.array", "numpy.linspace", "itertools_recipes.permutations" ]
[((105, 163), 'numpy.array', 'np.array', (['[[1, 1], [5, 2], [3, 3], [0, 2], [9, 4], [4, 8]]'], {}), '([[1, 1], [5, 2], [3, 3], [0, 2], [9, 4], [4, 8]])\n', (113, 163), True, 'import numpy as np\n'), ((1310, 1320), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1318, 1320), True, 'import matplotlib.pyplot as ...
import os import numpy as np from matplotlib import pyplot as plt from torch.utils.data import DataLoader def minibatch_loader(minibatch, minibatch_size, drop_last=True): return DataLoader(minibatch, batch_size=minibatch_size, drop_last=drop_last) def get_next_available_dir(root, dir_name, absolute_path=True, cr...
[ "matplotlib.pyplot.title", "os.mkdir", "numpy.load", "matplotlib.pyplot.show", "torch.utils.data.DataLoader", "os.path.exists", "matplotlib.pyplot.subplots", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "os.path.join" ]
[((183, 252), 'torch.utils.data.DataLoader', 'DataLoader', (['minibatch'], {'batch_size': 'minibatch_size', 'drop_last': 'drop_last'}), '(minibatch, batch_size=minibatch_size, drop_last=drop_last)\n', (193, 252), False, 'from torch.utils.data import DataLoader\n'), ((356, 384), 'os.path.join', 'os.path.join', (['root',...
''' PISA module to prep incoming data into formats that are compatible with the mc_uncertainty likelihood formulation This module takes in events containers from the pipeline, and introduces an additional array giving the indices where each event falls into. module structure imported from bootcamp example ''' from _...
[ "numpy.empty", "pisa.core.bin_indexing.lookup_indices" ]
[((3599, 3639), 'numpy.empty', 'np.empty', (['container.size'], {'dtype': 'np.int64'}), '(container.size, dtype=np.int64)\n', (3607, 3639), True, 'import numpy as np\n'), ((3818, 3884), 'pisa.core.bin_indexing.lookup_indices', 'lookup_indices', ([], {'sample': 'variables_to_bin', 'binning': 'self.output_specs'}), '(sam...
import torch import numpy as np def accuracy(output, target): """Computes the precision@k for the specified values of k""" batch_size = target.size(0) pred = torch.argmax(output, dim=1) pred = pred.squeeze() correct = pred.eq(target.expand_as(pred)) acc = correct.view(-1).float().sum(0) * 100 /...
[ "torch.mean", "torch.zeros_like", "torch.argmax", "torch.nn.functional.softmax", "numpy.max", "numpy.dot" ]
[((171, 198), 'torch.argmax', 'torch.argmax', (['output'], {'dim': '(1)'}), '(output, dim=1)\n', (183, 198), False, 'import torch\n'), ((655, 679), 'torch.zeros_like', 'torch.zeros_like', (['logits'], {}), '(logits)\n', (671, 679), False, 'import torch\n'), ((822, 847), 'torch.argmax', 'torch.argmax', (['pred'], {'dim'...
import tensorflow as tf import tflearn import numpy as np import re from model import SelfAttentive from sklearn.utils import shuffle from reader import load_csv, VocabDict ''' parse ''' tf.app.flags.DEFINE_integer('num_epochs', 5, 'number of epochs to train') tf.app.flags.DEFINE_integer('batch_size', 20, 'batch size...
[ "tensorflow.app.flags.DEFINE_float", "tensorflow.trainable_variables", "numpy.argmax", "tensorflow.nn.sigmoid_cross_entropy_with_logits", "tensorflow.app.flags.DEFINE_boolean", "tensorflow.Variable", "tensorflow.app.flags.DEFINE_integer", "tensorflow.clip_by_global_norm", "tensorflow.variable_scope"...
[((189, 262), 'tensorflow.app.flags.DEFINE_integer', 'tf.app.flags.DEFINE_integer', (['"""num_epochs"""', '(5)', '"""number of epochs to train"""'], {}), "('num_epochs', 5, 'number of epochs to train')\n", (216, 262), True, 'import tensorflow as tf\n'), ((263, 348), 'tensorflow.app.flags.DEFINE_integer', 'tf.app.flags....
from itertools import product import numpy as np import argparse from joblib import Parallel, delayed from pathlib import Path import openslide from openslide.deepzoom import DeepZoomGenerator class Patcher: def __init__(self): self._get_args() self._make_output_dir() self._read_img() ...
[ "openslide.OpenSlide", "argparse.ArgumentParser", "pathlib.Path", "numpy.mean", "numpy.array", "joblib.Parallel", "joblib.delayed" ]
[((360, 421), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Make patches from WSI."""'}), "(description='Make patches from WSI.')\n", (383, 421), False, 'import argparse\n'), ((1607, 1633), 'pathlib.Path', 'Path', (['self.args.output_dir'], {}), '(self.args.output_dir)\n', (1611, 1633),...