code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- coding: UTF-8 -*- import numpy as np ''' 此部分用于存储公共资源 ''' ''' 船舶状态记录 A record in SHIPSTATUS is like: {'mmsi': mmsi, 'lon': lon, 'lat': lat, 'shipspeed': shipspeed, 'heading': heading, 'sog': sog} ''' SHIPSTATUS = [] SHIPJSON = [] # river作为公共资源共享, 初始即创建河床,不再在sim_env中初始河床. RIVER = np.zeros((10000, 1000)) ''' 船舶...
[ "numpy.zeros" ]
[((289, 312), 'numpy.zeros', 'np.zeros', (['(10000, 1000)'], {}), '((10000, 1000))\n', (297, 312), True, 'import numpy as np\n')]
import numpy as np import cv2 import cv # this just handles actually showing the window # and the dots where you've clicked class SelectView: def __init__(self, winname, imsize): self.im = np.zeros((imsize, imsize, 3), dtype=np.uint8) self.clicks = [] self.winname = winname cv2.nam...
[ "cv.SetMouseCallback", "cv2.getPerspectiveTransform", "cv2.findHomography", "cv2.destroyWindow", "cv2.imshow", "cv.WaitKey", "cv2.warpPerspective", "numpy.zeros", "numpy.linalg.inv", "cv2.imread", "cv2.namedWindow" ]
[((1202, 1255), 'cv2.findHomography', 'cv2.findHomography', (['src_pts', 'dst_pts', 'cv2.RANSAC', '(5.0)'], {}), '(src_pts, dst_pts, cv2.RANSAC, 5.0)\n', (1220, 1255), False, 'import cv2\n'), ((1522, 1567), 'cv2.getPerspectiveTransform', 'cv2.getPerspectiveTransform', (['src_pts', 'dst_pts'], {}), '(src_pts, dst_pts)\n...
""" Analyzing simulations done with FitSim. """ from __future__ import print_function, division, absolute_import import os import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.widgets import Slider from wmpl.Config import config from wmpl.Utils....
[ "numpy.sqrt", "wmpl.Utils.Pickling.loadPickle", "numpy.array", "matplotlib.gridspec.GridSpecFromSubplotSpec", "matplotlib.widgets.Slider", "matplotlib.colors.LogNorm", "numpy.mean", "numpy.where", "wmpl.MetSim.FitSim.calcVelocity", "numpy.max", "matplotlib.gridspec.GridSpec", "numpy.linspace",...
[((796, 826), 'wmpl.MetSim.MetSim.loadInputs', 'loadInputs', (['meteor_inputs_file'], {}), '(meteor_inputs_file)\n', (806, 826), False, 'from wmpl.MetSim.MetSim import loadInputs\n'), ((887, 929), 'wmpl.Utils.Pickling.loadPickle', 'loadPickle', (['dir_path_mir', 'traj_pickle_file'], {}), '(dir_path_mir, traj_pickle_fil...
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d from matplotlib import cm nnodes = 5; nvars = 1024; nsteps = 100; path = './npy/' dat = np.zeros([nnodes*nsteps,nvars]); x = np.linspace(0,32*np.pi,nvars) #plt.figure() #dat = np.zeros([nvars]) #fn = path+'uexact.npy' #dat = np.loa...
[ "matplotlib.pyplot.imshow", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.plot", "numpy.zeros", "numpy.linspace", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "numpy.load", "matplotlib.pyplot.legend", "matplotlib.pyplot.show"...
[((175, 209), 'numpy.zeros', 'np.zeros', (['[nnodes * nsteps, nvars]'], {}), '([nnodes * nsteps, nvars])\n', (183, 209), True, 'import numpy as np\n'), ((213, 246), 'numpy.linspace', 'np.linspace', (['(0)', '(32 * np.pi)', 'nvars'], {}), '(0, 32 * np.pi, nvars)\n', (224, 246), True, 'import numpy as np\n'), ((344, 356)...
import numpy as np from numba import jit from .utils import ConfidenceModel, print_verbose, GPModel from sklearn.ensemble import BaggingRegressor from sklearn.tree import ExtraTreeRegressor from sklearn.linear_model import LinearRegression @jit(nopython=True) def get_random_candidate(number, dimensionality, non_zero):...
[ "numpy.nanargmax", "numpy.random.choice", "numpy.argmax", "numpy.zeros", "numba.jit", "numpy.random.randint", "numpy.random.uniform", "sklearn.ensemble.BaggingRegressor", "sklearn.linear_model.LinearRegression" ]
[((242, 260), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (245, 260), False, 'from numba import jit\n'), ((604, 638), 'numpy.zeros', 'np.zeros', (['(number, dimensionality)'], {}), '((number, dimensionality))\n', (612, 638), True, 'import numpy as np\n'), ((700, 734), 'numpy.random.randint', ...
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "numpy.asarray", "copy.deepcopy" ]
[((3476, 3489), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (3486, 3489), True, 'import numpy as np\n'), ((1695, 1717), 'copy.deepcopy', 'copy.deepcopy', (['problem'], {}), '(problem)\n', (1708, 1717), False, 'import copy\n')]
import numpy as np import scipy.spatial import skimage.draw import torch from torchvision import io import face_alignment import matplotlib.pyplot as plt def interpolate_from_landmarks(image, landmarks, vertex_indices=None, weights=None, mask=None): H, W = image.shape[-2:] step = 4 rect = landmarks.new_...
[ "torch.stack", "face_alignment.FaceAlignment", "torchvision.io.read_image", "matplotlib.pyplot.margins", "matplotlib.pyplot.plot", "torch.from_numpy", "torch.no_grad", "matplotlib.pyplot.figure", "torch.arange", "numpy.random.seed", "pdb.set_trace", "matplotlib.pyplot.scatter", "numpy.full",...
[((376, 411), 'torch.cat', 'torch.cat', (['[landmarks, rect]'], {'dim': '(0)'}), '([landmarks, rect], dim=0)\n', (385, 411), False, 'import torch\n'), ((1949, 1994), 'torch.gather', 'torch.gather', (['vertices'], {'dim': '(1)', 'index': 'expanded'}), '(vertices, dim=1, index=expanded)\n', (1961, 1994), False, 'import t...
''' Mesh analysis ''' import numpy as np from scipy import sparse FLOAT64_EPS = np.finfo(np.float64).eps FLOAT_TYPES = np.sctypes['float'] white = 0 red = 1 black = 2 green = 3 def sym_hemisphere(vertices, hemisphere='z', equator_thresh=None, dist_thresh=None...
[ "numpy.ones", "numpy.unique", "numpy.where", "numpy.asarray", "numpy.array", "numpy.sum", "numpy.nonzero", "scipy.spatial.Delaunay", "numpy.finfo", "numpy.all", "numpy.arange" ]
[((82, 102), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (90, 102), True, 'import numpy as np\n'), ((1983, 2003), 'numpy.asarray', 'np.asarray', (['vertices'], {}), '(vertices)\n', (1993, 2003), True, 'import numpy as np\n'), ((2944, 3010), 'numpy.where', 'np.where', (['((sel_col < equator_thresh...
#!/usr/bin/python # -*- coding: utf-8 -*- """Commonly used utility functions.""" # mainly backports from future numpy here from __future__ import absolute_import, division, print_function import numpy as np import nibabel as nib def thresholding_abs(A, thr, smaller=True, copy=True): """thresholding of the adjac...
[ "numpy.mean", "numpy.unique", "nibabel.load", "numpy.zeros", "numpy.empty", "nibabel.Nifti1Image" ]
[((3741, 3755), 'nibabel.load', 'nib.load', (['mask'], {}), '(mask)\n', (3749, 3755), True, 'import nibabel as nib\n'), ((3952, 3987), 'numpy.zeros', 'np.zeros', (['(s[0], s[1], s[2], n_tps)'], {}), '((s[0], s[1], s[2], n_tps))\n', (3960, 3987), True, 'import numpy as np\n'), ((6100, 6129), 'numpy.empty', 'np.empty', (...
""" Procedures for running a privacy evaluation on a generative model """ from sklearn.metrics import roc_curve, auc from os import path from numpy import concatenate, mean, ndarray from pandas import DataFrame from pandas.api.types import is_numeric_dtype from multiprocessing import Pool from synthetic_data.privacy_...
[ "warnings.filterwarnings", "numpy.mean", "sklearn.metrics.auc", "pandas.api.types.is_numeric_dtype", "sklearn.metrics.roc_curve", "multiprocessing.Pool", "synthetic_data.privacy_attacks.membership_inference.generate_mia_shadow_data_shufflesplit", "numpy.concatenate", "synthetic_data.privacy_attacks....
[((597, 621), 'warnings.filterwarnings', 'filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (611, 621), False, 'from warnings import filterwarnings\n'), ((970, 999), 'sklearn.metrics.roc_curve', 'roc_curve', (['trueLables', 'scores'], {}), '(trueLables, scores)\n', (979, 999), False, 'from sklearn.metrics import...
import numpy as np from model import generate_recommendations user_address = '0x8c373ed467f3eabefd8633b52f4e1b2df00c9fe8' already_rated = ['0x006bea43baa3f7a6f765f14f10a1a1b08334ef45','0x5102791ca02fc3595398400bfe0e33d7b6c82267','0x68d57c9a1c35f63e2c83ee8e49a64e9d70528d25','0xc528c28fec0a90c083328bc45f587ee215760a0f']...
[ "numpy.searchsorted", "numpy.load", "model.generate_recommendations" ]
[((392, 430), 'numpy.load', 'np.load', (["(model_dir + '/model/user.npy')"], {}), "(model_dir + '/model/user.npy')\n", (399, 430), True, 'import numpy as np\n'), ((442, 480), 'numpy.load', 'np.load', (["(model_dir + '/model/item.npy')"], {}), "(model_dir + '/model/item.npy')\n", (449, 480), True, 'import numpy as np\n'...
import copy import json import numpy import cepton_sdk.common.transform from cepton_sdk.common import * _all_builder = AllBuilder(__name__) def _convert_keys_to_int(d, ignore_invalid=False): d_int = {} for key, value in d.items(): try: key = int(key) except: if ignor...
[ "json.dumps", "numpy.any", "numpy.array", "numpy.logical_and.reduce", "json.load", "numpy.full", "numpy.logical_or.reduce" ]
[((606, 669), 'json.dumps', 'json.dumps', (['d'], {'sort_keys': '(True)', 'indent': '(2)', 'separators': "(',', ': ')"}), "(d, sort_keys=True, indent=2, separators=(',', ': '))\n", (616, 669), False, 'import json\n'), ((1361, 1382), 'json.load', 'json.load', (['input_file'], {}), '(input_file)\n', (1370, 1382), False, ...
import numpy as np import sys from contextlib import closing from io import StringIO from gym import Env, spaces, utils from gym.utils import seeding UP = 0 RIGHT = 1 DOWN = 2 LEFT = 3 def categorical_sample(prob_n, np_random): """ Sample from categorical distribution Each row specifies class probabilitie...
[ "numpy.prod", "numpy.ravel_multi_index", "numpy.asarray", "gym.spaces.Discrete", "numpy.array", "numpy.zeros", "gym.utils.EzPickle.__init__", "numpy.unravel_index", "contextlib.closing", "numpy.cumsum", "io.StringIO", "gym.utils.seeding.np_random" ]
[((343, 361), 'numpy.asarray', 'np.asarray', (['prob_n'], {}), '(prob_n)\n', (353, 361), True, 'import numpy as np\n'), ((377, 394), 'numpy.cumsum', 'np.cumsum', (['prob_n'], {}), '(prob_n)\n', (386, 394), True, 'import numpy as np\n'), ((1119, 1143), 'gym.spaces.Discrete', 'spaces.Discrete', (['self.nA'], {}), '(self....
'''Provides a class for representing a hand pose and a hand volume.''' # python from time import time from copy import copy # scipy from matplotlib import pyplot from numpy.linalg import inv, norm from numpy.random import rand, randn from numpy import arange, arccos, arctan, arctan2, array, ascontiguousarray, ceil, co...
[ "matplotlib.pyplot.imshow", "numpy.eye", "numpy.cross", "numpy.ones", "matplotlib.pyplot.figure", "matplotlib.pyplot.title", "numpy.maximum", "numpy.round", "matplotlib.pyplot.show" ]
[((3231, 3237), 'numpy.eye', 'eye', (['(4)'], {}), '(4)\n', (3234, 3237), False, 'from numpy import arange, arccos, arctan, arctan2, array, ascontiguousarray, ceil, concatenate, cross, dot, eye, linspace, maximum, meshgrid, ones, pi, reshape, round, sqrt, stack, zeros\n'), ((3271, 3292), 'numpy.cross', 'cross', (['appr...
# Copyright (c) 2020 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 applic...
[ "numpy.random.randint" ]
[((4361, 4392), 'numpy.random.randint', 'np.random.randint', (['min_v', 'max_v'], {}), '(min_v, max_v)\n', (4378, 4392), True, 'import numpy as np\n')]
import numpy as np import pytest import sets @pytest.fixture def dataset(): data = [[1, 3], [0, -1.5], [0, 0]] target = [0, 0.5, 1] return sets.Dataset(data=data, target=target) def test_concat(dataset): dataset['other'] = [[1], [2], [3]] result = sets.Concat(1, 'data')(dataset, colu...
[ "sets.Concat", "sets.Dataset", "sets.Normalize", "numpy.ones", "numpy.unique", "sets.Split", "sets.OneHot", "numpy.zeros", "numpy.concatenate" ]
[((162, 200), 'sets.Dataset', 'sets.Dataset', ([], {'data': 'data', 'target': 'target'}), '(data=data, target=target)\n', (174, 200), False, 'import sets\n'), ((985, 1021), 'numpy.concatenate', 'np.concatenate', (['(one.data, two.data)'], {}), '((one.data, two.data))\n', (999, 1021), True, 'import numpy as np\n'), ((10...
import glob as glob import albumentations import cv2 import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import os from model import Net device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') model = Net().to(device) # load the model checkpoint checkpoi...
[ "matplotlib.pyplot.imshow", "pandas.read_csv", "torch.load", "matplotlib.pyplot.imread", "torch.max", "matplotlib.pyplot.close", "torch.no_grad", "torch.tensor", "torch.cuda.is_available", "numpy.array", "albumentations.Resize", "matplotlib.pyplot.axis", "numpy.transpose", "model.Net", "...
[((325, 359), 'torch.load', 'torch.load', (['"""../outputs/model.pth"""'], {}), "('../outputs/model.pth')\n", (335, 359), False, 'import torch\n'), ((577, 713), 'pandas.read_csv', 'pd.read_csv', (['"""../../input/german_traffic_sign/GTSRB/Final_Test/GTSRB_Final_Test_GT/GT-final_test.csv"""'], {'delimiter': '""";"""', '...
""" Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany 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/L...
[ "nndet.io.save_json", "numpy.random.rand", "loguru.logger.info", "SimpleITK.GetImageFromArray", "argparse.ArgumentParser", "os.getenv", "random.seed", "numpy.random.randint", "numpy.random.seed", "multiprocessing.Pool", "numpy.zeros_like", "itertools.repeat" ]
[((1225, 1241), 'random.seed', 'random.seed', (['idx'], {}), '(idx)\n', (1236, 1241), False, 'import random\n'), ((1246, 1265), 'numpy.random.seed', 'np.random.seed', (['idx'], {}), '(idx)\n', (1260, 1265), True, 'import numpy as np\n'), ((1271, 1308), 'loguru.logger.info', 'logger.info', (['f"""Generating case_{idx}""...
import numpy as np import tensorflow as tf def set_seed(x): """ Set seed for both NumPy and TensorFlow. """ np.random.seed(x) tf.set_random_seed(x) def check_is_tf_vector(x): if isinstance(x, tf.Tensor): dimensions = x.get_shape() if(len(dimensions) == 0): raise Typ...
[ "tensorflow.get_variable", "tensorflow.reduce_sum", "numpy.log", "tensorflow.set_random_seed", "tensorflow.log", "tensorflow.random_normal_initializer", "numpy.exp", "numpy.random.seed", "tensorflow.clip_by_value", "tensorflow.square", "tensorflow.convert_to_tensor", "tensorflow.reduce_max", ...
[((125, 142), 'numpy.random.seed', 'np.random.seed', (['x'], {}), '(x)\n', (139, 142), True, 'import numpy as np\n'), ((147, 168), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['x'], {}), '(x)\n', (165, 168), True, 'import tensorflow as tf\n'), ((1395, 1411), 'tensorflow.reduce_max', 'tf.reduce_max', (['x'], {}...
import otsu import cv2 import numpy as np if __name__ == "__main__": image = cv2.imread('7.jpg', cv2.IMREAD_GRAYSCALE) arr = np.asarray(image) arr2 = cv2.resize(arr, (28, 28)) np.savetxt('./7_2.txt', arr2, fmt='%f') otsu.otsu(arr2)
[ "otsu.otsu", "numpy.asarray", "numpy.savetxt", "cv2.resize", "cv2.imread" ]
[((82, 123), 'cv2.imread', 'cv2.imread', (['"""7.jpg"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('7.jpg', cv2.IMREAD_GRAYSCALE)\n", (92, 123), False, 'import cv2\n'), ((134, 151), 'numpy.asarray', 'np.asarray', (['image'], {}), '(image)\n', (144, 151), True, 'import numpy as np\n'), ((163, 188), 'cv2.resize', 'cv2.resize', ([...
import os import glob import argparse import numpy as np from scipy.stats import gaussian_kde from matplotlib import pyplot as plt from matplotlib import gridspec from cryoio import star def calc_rmse(a, b): """ [[11, 12, 13], [21, 22, 23], ..., [n1, n2, n3]] """ return np.sqrt(np.mea...
[ "numpy.mean", "os.path.exists", "scipy.stats.gaussian_kde", "argparse.ArgumentParser", "matplotlib.pyplot.ylabel", "os.makedirs", "matplotlib.pyplot.xlabel", "os.path.join", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "matplotlib.gridspec.GridSpec", "os.path.abspath", "matplotlib....
[((397, 439), 'os.path.join', 'os.path.join', (['working_directory', '"""Figures"""'], {}), "(working_directory, 'Figures')\n", (409, 439), False, 'import os\n'), ((540, 561), 'numpy.arange', 'np.arange', (['(0)', '(360)', '(10)'], {}), '(0, 360, 10)\n', (549, 561), True, 'import numpy as np\n'), ((670, 683), 'matplotl...
import logging from functools import partial import numpy as np import torch from torch import nn from deepqmc import Molecule from deepqmc.physics import pairwise_diffs, pairwise_distance from deepqmc.torchext import sloglindet, triu_flat from deepqmc.utils import NULL_DEBUG from deepqmc.wf import WaveFunction from...
[ "logging.getLogger", "numpy.sqrt", "torch.randperm", "torch.exp", "pyscf.mcscf.CASSCF", "deepqmc.torchext.triu_flat", "torch.arange", "torch.tanh", "torch.nn.Identity", "deepqmc.physics.pairwise_distance", "torch.abs", "pyscf.lib.chkfile.dump", "torch.sign", "deepqmc.torchext.sloglindet", ...
[((553, 580), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (570, 580), False, 'import logging\n'), ((15215, 15227), 'pyscf.scf.RHF', 'scf.RHF', (['mol'], {}), '(mol)\n', (15222, 15227), False, 'from pyscf import gto, lib, mcscf, scf\n'), ((2044, 2064), 'torch.sign', 'torch.sign', (['squ...
import numpy from gensim.summarization.bm25 import BM25 class WrappedBM25(BM25): def __init__(self, docs, tokenizer='spacy'): self.docs = docs if tokenizer == 'spacy': try: import spacy except ImportError: raise ImportError('Please install sp...
[ "numpy.argsort", "spacy.load" ]
[((1126, 1147), 'numpy.argsort', 'numpy.argsort', (['scores'], {}), '(scores)\n', (1139, 1147), False, 'import numpy\n'), ((1481, 1502), 'numpy.argsort', 'numpy.argsort', (['scores'], {}), '(scores)\n', (1494, 1502), False, 'import numpy\n'), ((629, 645), 'spacy.load', 'spacy.load', (['"""en"""'], {}), "('en')\n", (639...
''' Extracts embeddings from ESM models. ''' import argparse from collections import defaultdict import os import pathlib import numpy as np import pandas as pd import torch from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretrained, BatchConverter from utils import read_fasta, save criterion = tor...
[ "torch.nn.CrossEntropyLoss", "argparse.ArgumentParser", "esm.FastaBatchedDataset.from_file", "torch.unsqueeze", "os.path.join", "esm.pretrained.load_model_and_alphabet", "torch.tensor", "torch.cuda.is_available", "numpy.concatenate", "torch.utils.data.DataLoader", "torch.no_grad" ]
[((317, 360), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (342, 360), False, 'import torch\n'), ((397, 527), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract per-token representations and model outputs for seq...
import numpy as np def Gini_index(Y_data): gini = 0 #========= Edit here ========== gini = 1 - np.sum([(count / len(Y_data)) ** 2 for _, count in zip(*np.unique(Y_data, return_counts=True))]) #==================================== return gini def Entropy(Y_data): entropy = 0 # ===== ...
[ "numpy.exp", "numpy.log2", "numpy.sqrt", "numpy.unique" ]
[((836, 855), 'numpy.unique', 'np.unique', (['col_data'], {}), '(col_data)\n', (845, 855), True, 'import numpy as np\n'), ((1612, 1631), 'numpy.exp', 'np.exp', (['(z ** 2 / -2)'], {}), '(z ** 2 / -2)\n', (1618, 1631), True, 'import numpy as np\n'), ((1641, 1659), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi)'], {}), '(2 * np...
#%matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import numpy as np from sklearn.metrics import confusion_matrix import time from datetime import timedelta import math import os tf.logging.set_verbosity(tf.logging.INFO) log_dir = 'tmp/loopy-nn/board/loop004' # Tensorboard log dir save_dir =...
[ "tensorflow.equal", "tensorflow.get_variable", "matplotlib.pyplot.ylabel", "tensorflow.logging.set_verbosity", "math.sqrt", "tensorflow.examples.tutorials.mnist.input_data.read_data_sets", "tensorflow.nn.softmax", "tensorflow.reduce_mean", "tensorflow.cast", "numpy.arange", "matplotlib.pyplot.im...
[((206, 247), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (230, 247), True, 'import tensorflow as tf\n'), ((616, 670), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""data/MNIST/"""'], {'one_hot': '...
from autogluon.core.utils.feature_selection import * from autogluon.core.utils.utils import unevaluated_fi_df_template import numpy as np from numpy.core.fromnumeric import sort import pandas as pd import pytest def evaluated_fi_df_template(features, importance=None, n=None): rng = np.random.default_rng(0) im...
[ "pandas.DataFrame", "pandas.concat", "numpy.random.default_rng", "autogluon.core.utils.utils.unevaluated_fi_df_template" ]
[((289, 313), 'numpy.random.default_rng', 'np.random.default_rng', (['(0)'], {}), '(0)\n', (310, 313), True, 'import numpy as np\n'), ((334, 366), 'pandas.DataFrame', 'pd.DataFrame', (["{'name': features}"], {}), "({'name': features})\n", (346, 366), True, 'import pandas as pd\n'), ((1285, 1312), 'pandas.DataFrame', 'p...
import cv2 import random import numpy as np IMG_WIDTH = 1200 IMG_HEIGHT = 800 WATERMARK_WIDTH = 256 WATERMARK_HEIGHT = 256 IMG_SIZE = IMG_HEIGHT * IMG_WIDTH WATERMARK_SIZE = WATERMARK_HEIGHT * WATERMARK_WIDTH KEY = 1001 THRESH = 75 def mean_neighbour(img, x, y): val = 0 num = 0 i = x j = y if i ...
[ "numpy.zeros", "random.seed" ]
[((1496, 1514), 'random.seed', 'random.seed', ([], {'a': 'KEY'}), '(a=KEY)\n', (1507, 1514), False, 'import random\n'), ((1701, 1759), 'numpy.zeros', 'np.zeros', (['(WATERMARK_WIDTH, WATERMARK_HEIGHT, 1)', 'np.uint8'], {}), '((WATERMARK_WIDTH, WATERMARK_HEIGHT, 1), np.uint8)\n', (1709, 1759), True, 'import numpy as np\...
import pandas as pd import numpy as np import matplotlib.pyplot as plt """字典形式导入数据""" x1 = {'Measure_1': [28.4,28.9,29.0,28.4,28.6], 'Measure_2': [28.4,29.0,29.1,28.5,28.6], 'Measure_3': [28.4,29.0,29.1,28.5,28.6]} # A测定员 x2 = {'Measure_1': [28.5,28.8,29.0,28.5,28.6], 'Measure_2': [28...
[ "numpy.ones", "pandas.DataFrame", "pandas.concat", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((597, 613), 'pandas.DataFrame', 'pd.DataFrame', (['x1'], {}), '(x1)\n', (609, 613), True, 'import pandas as pd\n'), ((779, 795), 'pandas.DataFrame', 'pd.DataFrame', (['x2'], {}), '(x2)\n', (791, 795), True, 'import pandas as pd\n'), ((961, 977), 'pandas.DataFrame', 'pd.DataFrame', (['x3'], {}), '(x3)\n', (973, 977), ...
#zerosOnesAndLike.py import numpy as np list_of_lists = [[1,2,3], [4,5,6], [7,8,9]] array_of_arrays = np.array(list_of_lists) zeros_like_array = np.zeros_like(list_of_lists) ones_like_array = np.ones_like(list_of_lists) empty_like_array = np.empty_like(list_of_lists) print("list_of_lists:", list_of_lists, sep="\n") pr...
[ "numpy.empty_like", "numpy.array", "numpy.zeros_like", "numpy.ones_like" ]
[((102, 125), 'numpy.array', 'np.array', (['list_of_lists'], {}), '(list_of_lists)\n', (110, 125), True, 'import numpy as np\n'), ((145, 173), 'numpy.zeros_like', 'np.zeros_like', (['list_of_lists'], {}), '(list_of_lists)\n', (158, 173), True, 'import numpy as np\n'), ((192, 219), 'numpy.ones_like', 'np.ones_like', (['...
""" .. module:: sparse_rep .. moduleauthor:: <NAME> .. moduleauthor:: <NAME> The original SparsePZ code to be found at https://github.com/mgckind/SparsePz This module reorganizes it for usage by DESC within qp, and is python3 compliant. """ __author__ = '<NAME>' import numpy as np from scipy.special import voigt_prof...
[ "scipy.linalg.cho_solve", "numpy.ceil", "scipy.special.voigt_profile", "scipy.integrate.trapz", "numpy.sqrt", "numpy.where", "numpy.max", "numpy.array", "numpy.dot", "numpy.linspace", "numpy.zeros", "scipy.linalg.solve_triangular", "scipy.linalg.norm", "numpy.finfo", "numpy.zeros_like", ...
[((637, 653), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (650, 653), True, 'import numpy as np\n'), ((857, 887), 'numpy.where', 'np.where', (['(pdf >= cut)', 'pdf', '(0.0)'], {}), '(pdf >= cut, pdf, 0.0)\n', (865, 887), True, 'import numpy as np\n'), ((2034, 2064), 'numpy.linspace', 'np.linspace', (['mu...
import cv2 import numpy as np import os import glob import pickle #from sklearn.preprocessing import normalize current_file_path = os.path.dirname(os.path.abspath(__file__)) def save_obj(obj, name ): with open(os.path.join(current_file_path,"calib_result", name + '.pkl'), 'wb') as f: pickle.dump(obj, f) ...
[ "cv2.initUndistortRectifyMap", "cv2.findChessboardCorners", "pickle.dump", "cv2.drawChessboardCorners", "cv2.stereoRectify", "cv2.stereoCalibrate", "pickle.load", "os.path.join", "os.path.normpath", "cv2.getOptimalNewCameraMatrix", "numpy.zeros", "cv2.calibrateCamera", "os.path.abspath", "...
[((148, 173), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (163, 173), False, 'import os\n'), ((923, 986), 'numpy.zeros', 'np.zeros', (['(1, CHECKERBOARD[0] * CHECKERBOARD[1], 3)', 'np.float32'], {}), '((1, CHECKERBOARD[0] * CHECKERBOARD[1], 3), np.float32)\n', (931, 986), True, 'import num...
# Copyright (c) 2020, <NAME>, Honda Research Institute Europe GmbH, and # Technical University of Darmstadt. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code mus...
[ "torch.get_default_dtype", "torch.set_printoptions", "rcsenv.ControlPolicy", "torch.set_default_dtype", "numpy.array", "pyrado.policies.features.FeatureStack", "pyrado.spaces.box.BoxSpace", "numpy.set_printoptions" ]
[((2690, 2722), 'torch.set_default_dtype', 'to.set_default_dtype', (['to.float32'], {}), '(to.float32)\n', (2710, 2722), True, 'import torch as to\n'), ((3092, 3123), 'rcsenv.ControlPolicy', 'ControlPolicy', (['"""torch"""', 'tmpfile'], {}), "('torch', tmpfile)\n", (3105, 3123), False, 'from rcsenv import ControlPolicy...
import numpy as np import pandas as pd from typing import List from .phantom_class import Phantom class Beam: """A class used to create an X-ray beam and detector. Attributes ---------- r : np.array 5*3 array, locates the xyz coordinates of the apex and verticies of a pyramid shaped X...
[ "numpy.cross", "numpy.where", "numpy.column_stack", "numpy.array", "numpy.deg2rad", "numpy.dot", "numpy.matmul", "numpy.vstack", "numpy.cos", "numpy.linalg.norm", "numpy.sin" ]
[((3201, 3239), 'numpy.array', 'np.array', (['[0, data_norm.DSI[event], 0]'], {}), '([0, data_norm.DSI[event], 0])\n', (3209, 3239), True, 'import numpy as np\n'), ((3331, 3425), 'numpy.array', 'np.array', (['[[+0.5, -1.0, +0.5], [+0.5, -1.0, -0.5], [-0.5, -1.0, -0.5], [-0.5, -1.0, +0.5]\n ]'], {}), '([[+0.5, -1.0, ...
import numpy as np from numpy.linalg import norm from data_manager import read_data import time import tqdm import matplotlib.pyplot as plt from conjugate_gradient import conjugate_gradient import random A, b = read_data('data/ML-CUP19-TR.csv') m, n = A.shape # Our solution start = time.perf_counter_ns() x, status, i...
[ "numpy.transpose", "matplotlib.pyplot.savefig", "numpy.random.rand", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.array", "matplotlib.pyplot.yscale", "numpy.zeros", "numpy.matmul", "numpy.linalg.lstsq", "numpy.linalg.norm", "conjugate_gradient.conj...
[((212, 245), 'data_manager.read_data', 'read_data', (['"""data/ML-CUP19-TR.csv"""'], {}), "('data/ML-CUP19-TR.csv')\n", (221, 245), False, 'from data_manager import read_data\n'), ((285, 307), 'time.perf_counter_ns', 'time.perf_counter_ns', ([], {}), '()\n', (305, 307), False, 'import time\n'), ((325, 349), 'conjugate...
# This file is part of wallriori # (c) <NAME> # The code is released under the MIT Licence. # See LICENCE.txt and the Legal section in the README for more information from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from functools import pa...
[ "numpy.abs", "numpy.log", "numpy.max", "numpy.sum", "functools.partial" ]
[((1323, 1340), 'numpy.abs', 'np.abs', (['wallGradU'], {}), '(wallGradU)\n', (1329, 1340), True, 'import numpy as np\n'), ((1398, 1443), 'numpy.max', 'np.max', (['[0.0, uTau ** 2 / magGradU - self.nu]'], {}), '([0.0, uTau ** 2 / magGradU - self.nu])\n', (1404, 1443), True, 'import numpy as np\n'), ((1490, 1540), 'funct...
import numpy as np from models.datastructures import BoundaryType def WaveEquation1D(grid, x0, boundary_cond, c, sigma0, num_reflections=4): """ Analytical solution with Dirichlet or Neumann boundaries num_reflections: number of reflections in the solution """ assert(boundary_cond == BoundaryType.D...
[ "numpy.asarray", "numpy.max", "numpy.array", "numpy.min", "numpy.mod" ]
[((444, 458), 'numpy.min', 'np.min', (['x_mesh'], {}), '(x_mesh)\n', (450, 458), True, 'import numpy as np\n'), ((470, 484), 'numpy.max', 'np.max', (['x_mesh'], {}), '(x_mesh)\n', (476, 484), True, 'import numpy as np\n'), ((2089, 2103), 'numpy.min', 'np.min', (['x_mesh'], {}), '(x_mesh)\n', (2095, 2103), True, 'import...
def test_read_hdf5(): import os.path import sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) from read_hdf5 import read_hdf5 import os import numpy as np import h5py # Make tmp mat file and save fs = np.uint16(np.array([100])) ecg = n...
[ "read_hdf5.read_hdf5", "h5py.File", "os.path.realpath", "numpy.array", "numpy.array_equal", "os.system" ]
[((390, 414), 'h5py.File', 'h5py.File', (['"""tmp.h5"""', '"""w"""'], {}), "('tmp.h5', 'w')\n", (399, 414), False, 'import h5py\n'), ((547, 603), 'read_hdf5.read_hdf5', 'read_hdf5', (['"""tmp.h5"""'], {'offset': '(0)', 'count_read': '(4)', 'init_flag': '(0)'}), "('tmp.h5', offset=0, count_read=4, init_flag=0)\n", (556,...
#Libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid') from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.calibration import Calib...
[ "seaborn.factorplot", "sklearn.preprocessing.LabelEncoder", "pandas.read_csv", "pandas.DataFrame", "sklearn.model_selection.train_test_split", "sklearn.ensemble.RandomForestClassifier", "sklearn.calibration.CalibratedClassifierCV", "sklearn.linear_model.LogisticRegression", "seaborn.set_style", "n...
[((104, 130), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (117, 130), True, 'import seaborn as sns\n'), ((599, 632), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (610, 632), True, 'import pandas as pd\n'), ((640, 672), 'pandas....
import numpy as np def calculate_exploration_prob(loss_history, act_explor_prob,threshold): mean = np.mean(loss_history) variance = 0 for i in loss_history: variance += np.square(i-mean) if threshold >= variance: act_explor_prob += 0.05 else: act_explor_prob -= 0.05 i...
[ "numpy.mean", "numpy.square" ]
[((104, 125), 'numpy.mean', 'np.mean', (['loss_history'], {}), '(loss_history)\n', (111, 125), True, 'import numpy as np\n'), ((192, 211), 'numpy.square', 'np.square', (['(i - mean)'], {}), '(i - mean)\n', (201, 211), True, 'import numpy as np\n')]
# OS library import os from os.path import join # SYS library import sys # Scientific library import scipy.io as sio import numpy as np import pandas as pd # Joblib library ### Module to performed parallel processing from joblib import Parallel, delayed # Multiprocessing library import multiprocessing # HDF5 import h5p...
[ "numpy.savez", "pandas.read_csv", "scipy.io.loadmat", "joblib.Parallel", "numpy.array", "joblib.delayed" ]
[((1396, 1424), 'pandas.read_csv', 'pd.read_csv', (['gt_csv_filename'], {}), '(gt_csv_filename)\n', (1407, 1424), True, 'import pandas as pd\n'), ((506, 520), 'scipy.io.loadmat', 'sio.loadmat', (['f'], {}), '(f)\n', (517, 520), True, 'import scipy.io as sio\n'), ((992, 1018), 'numpy.array', 'np.array', (['vol_lbp_top_h...
# !/usr/bin/env python # -*- coding: utf-8 -*- """Usefull calculus fonctions compatible with Quantity objects. These are basically numpy function wrapped with dimensions checks. """ import numbers as nb import numpy as np import scipy import scipy.integrate import scipy.optimize import sympy as sp from .dimension ...
[ "numpy.array", "numpy.trapz", "numpy.vectorize" ]
[((659, 677), 'numpy.vectorize', 'np.vectorize', (['func'], {}), '(func)\n', (671, 677), True, 'import numpy as np\n'), ((1937, 1967), 'numpy.trapz', 'np.trapz', (['Zs'], {'axis': '(-1)', 'x': 'ech_x'}), '(Zs, axis=-1, x=ech_x)\n', (1945, 1967), True, 'import numpy as np\n'), ((1981, 2014), 'numpy.trapz', 'np.trapz', (...
import cirq import numpy as np import pandas as pd import sympy from qnn.qnlp.phrases_database import extract_words class CircuitsWords: """ A class used to represent the circuits and some information associated to them """ def __init__(self, data: str, num_qubits: int, num_phrases: int): """ Initializes the c...
[ "qnn.qnlp.phrases_database.extract_words", "pandas.read_csv", "cirq.rx", "cirq.GridQubit", "sympy.symbols", "cirq.Circuit", "cirq.Simulator", "cirq.measure", "numpy.arange" ]
[((826, 853), 'sympy.symbols', 'sympy.symbols', (['"""theta:1000"""'], {}), "('theta:1000')\n", (839, 853), False, 'import sympy\n'), ((941, 965), 'qnn.qnlp.phrases_database.extract_words', 'extract_words', (['self.data'], {}), '(self.data)\n', (954, 965), False, 'from qnn.qnlp.phrases_database import extract_words\n')...
#!/usr/bin/env python # coding: utf-8 # # Aging Setup Data Prep # ### Imports import os import io import sys import re import glob import math import logging import numpy as np import pandas as pd from bric_analysis_libraries import standard_functions as std # ## Data Prep # convenience functions def sample_...
[ "pandas.Series", "pandas.MultiIndex.from_product", "pandas.read_csv", "re.compile", "bric_analysis_libraries.standard_functions.metadata_from_file_name", "numpy.stack", "numpy.empty", "pandas.DataFrame", "bric_analysis_libraries.standard_functions.import_data", "pandas.MultiIndex.from_tuples", "...
[((381, 451), 'bric_analysis_libraries.standard_functions.metadata_from_file_name', 'std.metadata_from_file_name', (['name_search', 'file'], {'delimeter': '"""_"""', 'group': '(1)'}), "(name_search, file, delimeter='_', group=1)\n", (408, 451), True, 'from bric_analysis_libraries import standard_functions as std\n'), (...
import unittest import numpy as np import scipy.sparse from injector import Injector from decai.simulation.data.featuremapping.feature_index_mapper import FeatureIndexMapper from decai.simulation.logging_module import LoggingModule class TestFeatureIndexMapper(unittest.TestCase): @classmethod def setUpClass...
[ "numpy.array_equal", "numpy.array", "injector.Injector", "numpy.random.random_sample" ]
[((341, 366), 'injector.Injector', 'Injector', (['[LoggingModule]'], {}), '([LoggingModule])\n', (349, 366), False, 'from injector import Injector\n'), ((484, 516), 'numpy.random.random_sample', 'np.random.random_sample', (['(10, 3)'], {}), '((10, 3))\n', (507, 516), True, 'import numpy as np\n'), ((534, 580), 'numpy.r...
import numpy as np import pickle from pathlib import Path import sys import pyvista as pv # Finding the sim root directory cwd = Path.cwd() for dirname in tuple(cwd.parents): if dirname.name == '3D-CG': sim_root_dir = dirname continue sys.path.append(str(sim_root_dir.joinpath('util'))) sys.path.ap...
[ "helper.interpolate_high_order", "pathlib.Path.cwd", "helper.reshape_field", "pickle.load", "viz.visualize", "numpy.concatenate", "pyvista.read" ]
[((130, 140), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (138, 140), False, 'from pathlib import Path\n'), ((809, 847), 'pyvista.read', 'pv.read', (['"""./fem_solutions/d8/flow.vtu"""'], {}), "('./fem_solutions/d8/flow.vtu')\n", (816, 847), True, 'import pyvista as pv\n'), ((1268, 1334), 'helper.reshape_field', ...
# -*- coding: utf-8 -*- # Adapted from lstm_text_generation.py in keras/examples from __future__ import print_function from keras.layers.recurrent import SimpleRNN from keras.models import Sequential from keras.layers import Dense, Activation import numpy as np INPUT_FILE = "../data/alice_in_wonderland.txt" # extract...
[ "numpy.argmax", "keras.models.Sequential", "keras.layers.recurrent.SimpleRNN", "numpy.zeros", "keras.layers.Activation", "keras.layers.Dense" ]
[((2520, 2532), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (2530, 2532), False, 'from keras.models import Sequential\n'), ((2543, 2638), 'keras.layers.recurrent.SimpleRNN', 'SimpleRNN', (['HIDDEN_SIZE'], {'return_sequences': '(False)', 'input_shape': '(SEQLEN, nb_chars)', 'unroll': '(True)'}), '(HIDDEN_...
#!/usr/bin/env python3 import gizeh import moviepy.editor as mpy import numpy as np import midi RGB = lambda hx: tuple(map(lambda c: int(c, 16) / 256, [hx[1:3], hx[3:5], hx[5:7]])) is_ebony = lambda note: (note % 12) in [1, 3, 6, 8, 10] is_ivory = lambda note: not is_ebony(note) position = dict() position.update({iv...
[ "gizeh.rectangle", "gizeh.Surface", "numpy.concatenate", "midi.second2tick", "numpy.arange" ]
[((850, 870), 'gizeh.Surface', 'gizeh.Surface', (['*size'], {}), '(*size)\n', (863, 870), False, 'import gizeh\n'), ((1776, 1796), 'gizeh.Surface', 'gizeh.Surface', (['*size'], {}), '(*size)\n', (1789, 1796), False, 'import gizeh\n'), ((1811, 1833), 'midi.second2tick', 'midi.second2tick', (['time'], {}), '(time)\n', (1...
#! /usr/bin/env python3 import numpy as np from sklearn.metrics import adjusted_rand_score as ari from sklearn.preprocessing import LabelEncoder as labeler import lsbm ## Import labels lab = np.loadtxt('../data/drosophila_labels.csv', dtype=str) lab = labeler().fit(lab).transform(lab) ## Import embeddings X = np.loadt...
[ "sklearn.preprocessing.LabelEncoder", "sklearn.cluster.AgglomerativeClustering", "sklearn.mixture.GaussianMixture", "lsbm.theta_transform", "sknetwork.clustering.Louvain", "sklearn.metrics.adjusted_rand_score", "lsbm.row_normalise", "sknetwork.hierarchy.LouvainHierarchy", "numpy.random.seed", "skn...
[((192, 246), 'numpy.loadtxt', 'np.loadtxt', (['"""../data/drosophila_labels.csv"""'], {'dtype': 'str'}), "('../data/drosophila_labels.csv', dtype=str)\n", (202, 246), True, 'import numpy as np\n'), ((312, 368), 'numpy.loadtxt', 'np.loadtxt', (['"""../data/drosophila_dase.csv"""'], {'delimiter': '""","""'}), "('../data...
# -*- coding: utf-8 -*- """ Created on Fri Jun 5 01:30:35 2020 @author: a """ import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np from torch.autograd import Function from matplotlib import pyplot as plt from itertools import product EPS =...
[ "torch.nn.ReLU", "torch.nn.Dropout", "numpy.sqrt", "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "torch.nn.Sequential", "torch.exp", "matplotlib.pyplot.fill_between", "torch.pow", "matplotlib.pyplot.contourf", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "torch.nn.init.zeros...
[((597, 623), 'torch.nn.Linear', 'nn.Linear', (['in_dim', 'hid_dim'], {}), '(in_dim, hid_dim)\n', (606, 623), True, 'import torch.nn as nn\n'), ((628, 696), 'torch.nn.init.normal_', 'nn.init.normal_', (['self.linear_in.weight'], {'std': '(1 / (4 * hid_dim) ** 0.5)'}), '(self.linear_in.weight, std=1 / (4 * hid_dim) ** 0...
class World(object): pass class Field(object): pass from typing import Union import numpy as np import random import math from tocenv.env import TOCEnv import tocenv.components.item as items import tocenv.components.agent as agent import tocenv.components.skill as skills import tocenv.components.block as...
[ "random.sample", "tocenv.components.agent.PurpleAgent", "tocenv.components.item.append", "tocenv.components.item.Apple", "tocenv.components.block.Block", "tocenv.components.agent.BlueAgent", "tocenv.components.position.Position", "numpy.zeros", "tocenv.components.agent.OrangeAgent", "numpy.empty",...
[((854, 878), 'tocenv.components.position.Position', 'Position', ([], {'x': 'p1_x', 'y': 'p1_y'}), '(x=p1_x, y=p1_y)\n', (862, 878), False, 'from tocenv.components.position import Position\n'), ((897, 921), 'tocenv.components.position.Position', 'Position', ([], {'x': 'p2_x', 'y': 'p2_y'}), '(x=p2_x, y=p2_y)\n', (905, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tests for nussl/utils.py """ import unittest import nussl import numpy as np from scipy import signal class TestUtils(unittest.TestCase): """ """ def test_find_peak_indices(self): array = np.arange(0, 100) peak = nussl.find_peak_indices(a...
[ "numpy.ones", "numpy.equal", "numpy.array", "nussl.find_peak_values", "nussl.find_peak_indices", "nussl.add_mismatched_arrays", "numpy.arange" ]
[((262, 279), 'numpy.arange', 'np.arange', (['(0)', '(100)'], {}), '(0, 100)\n', (271, 279), True, 'import numpy as np\n'), ((424, 469), 'nussl.find_peak_indices', 'nussl.find_peak_indices', (['array', '(3)'], {'min_dist': '(0)'}), '(array, 3, min_dist=0)\n', (447, 469), False, 'import nussl\n'), ((572, 589), 'numpy.ar...
# python clone of tagtime http://messymatters.com/tagtime/ # set cron job with $crontab -e # * * * * * DISPLAY=:1 python3 /path/to/prompt.py 2> /tmp/err # this fires once a minute # set debugging = True first to make sure cron job fires # check /tmp/err for problems if it doesn't fire # or use a cron alternative as ...
[ "datetime.datetime.now", "time.time", "numpy.random.exponential", "pymsgbox.prompt" ]
[((877, 900), 'pymsgbox.prompt', 'pymsgbox.prompt', (['prompt'], {}), '(prompt)\n', (892, 900), False, 'import pymsgbox\n'), ((1155, 1190), 'numpy.random.exponential', 'numpy.random.exponential', (['avg_delay'], {}), '(avg_delay)\n', (1179, 1190), False, 'import numpy\n'), ((726, 737), 'time.time', 'time.time', ([], {}...
from matplotlib import pyplot as plt # Pyplot for nice graphs import numpy as np # NumPy from numpy import linalg as LA from Functions import ImportSystem from progress.bar import Bar # Retrieve unit cell xyz, shiftx, shifty, filename = ImportSystem(1) repx = int(input('Repetition in x? ')) r...
[ "matplotlib.pyplot.ylabel", "matplotlib.pyplot.gca", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "Functions.ImportSystem", "numpy.subtract", "numpy.append", "numpy.array", "matplotlib.pyplot.figure", "matplotlib.pyplot.scatter", "matplotlib.pyplot.show" ]
[((263, 278), 'Functions.ImportSystem', 'ImportSystem', (['(1)'], {}), '(1)\n', (275, 278), False, 'from Functions import ImportSystem\n'), ((705, 723), 'numpy.array', 'np.array', (['[[0, 0]]'], {}), '([[0, 0]])\n', (713, 723), True, 'import numpy as np\n'), ((731, 749), 'numpy.array', 'np.array', (['[[0, 0]]'], {}), '...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from visdom import Visdom import numpy as np import math import os.path import getpass from sys import platform as _platform from six.moves import urllib vi...
[ "numpy.array", "visdom.Visdom" ]
[((324, 353), 'visdom.Visdom', 'Visdom', ([], {'port': '(8098)', 'env': '"""main"""'}), "(port=8098, env='main')\n", (330, 353), False, 'from visdom import Visdom\n'), ((426, 442), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (434, 442), True, 'import numpy as np\n'), ((449, 465), 'numpy.array', 'np.array...
import torch import torch.nn as nn from torch.utils.data import Dataset import numpy as np RICO_LABELS_LOWER = [ 'text', 'image', 'icon', 'list item', 'text button', 'toolbar', 'web view', 'input', 'card', 'advertisement', ...
[ "torch.nn.TransformerEncoder", "torch.nn.Embedding", "torch.rand", "pickle.load", "torch.relu", "numpy.array", "numpy.zeros", "torch.nn.Linear", "copy.deepcopy", "torch.nn.TransformerEncoderLayer", "torch.zeros", "torch.cat", "torch.randn" ]
[((8072, 8099), 'copy.deepcopy', 'deepcopy', (['label_with_number'], {}), '(label_with_number)\n', (8080, 8099), False, 'from copy import deepcopy\n'), ((8116, 8131), 'copy.deepcopy', 'deepcopy', (['label'], {}), '(label)\n', (8124, 8131), False, 'from copy import deepcopy\n'), ((1912, 1959), 'numpy.zeros', 'np.zeros',...
""" Octave ====== Module for working with octaves. The following is an example on how to use :class:`acoustics.octave.Octave`. .. literalinclude:: ../examples/octave.py """ from __future__ import division import numpy as np REFERENCE = 1000.0 """ Reference frequency. """ def band_of_frequency(f, order=1, ref=REF...
[ "numpy.array", "numpy.log2" ]
[((550, 566), 'numpy.log2', 'np.log2', (['(f / ref)'], {}), '(f / ref)\n', (557, 566), True, 'import numpy as np\n'), ((3467, 3478), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (3475, 3478), True, 'import numpy as np\n')]
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 31 15:36:31 2019 @author: gaetandissez Important note: We initialize factor matrices once and for all so that each new model uses the same ones as the previous ones. It makes the results more stable because they depend on the initialization...
[ "numpy.trace", "numpy.multiply", "numpy.linalg.multi_dot", "sklearn.metrics.average_precision_score", "scipy.sparse.load_npz", "sklearn.metrics.auc", "spherecluster.SphericalKMeans", "numpy.dot", "sklearn.metrics.roc_curve", "numpy.vectorize" ]
[((709, 729), 'numpy.vectorize', 'np.vectorize', (['update'], {}), '(update)\n', (721, 729), True, 'import numpy as np\n'), ((3664, 3684), 'numpy.vectorize', 'np.vectorize', (['update'], {}), '(update)\n', (3676, 3684), True, 'import numpy as np\n'), ((7504, 7524), 'numpy.vectorize', 'np.vectorize', (['update'], {}), '...
"""edited from https://github.com/mightydeveloper/Deep-Compression-PyTorch""" import torch import numpy as np from sklearn.cluster import KMeans, MiniBatchKMeans, AffinityPropagation, DBSCAN # from sklearn.cluster import OPTICS from scipy.sparse import csc_matrix, csr_matrix def apply_weight_sharing(model, bits=10, c...
[ "scipy.sparse.csr_matrix", "numpy.linspace", "scipy.sparse.csc_matrix", "torch.from_numpy" ]
[((1000, 1038), 'numpy.linspace', 'np.linspace', (['min_', 'max_'], {'num': '(2 ** bits)'}), '(min_, max_, num=2 ** bits)\n', (1011, 1038), True, 'import numpy as np\n'), ((848, 866), 'scipy.sparse.csr_matrix', 'csr_matrix', (['weight'], {}), '(weight)\n', (858, 866), False, 'from scipy.sparse import csc_matrix, csr_ma...
# Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME> # All rights reserved. # This code is licensed under BSD 3-Clause License. import sys import os import numpy as np if __name__ == '__main__': xyz_list_path = sys.argv[1] xyzs = [xyz for xyz in os.listdir(xyz_list_path) if xyz.endswith('_predict_3.xyz')] ...
[ "os.listdir", "numpy.hstack", "os.path.join", "numpy.full", "numpy.loadtxt" ]
[((325, 348), 'numpy.full', 'np.full', (['[2466, 1]', '"""v"""'], {}), "([2466, 1], 'v')\n", (332, 348), True, 'import numpy as np\n'), ((511, 578), 'numpy.loadtxt', 'np.loadtxt', (['"""/home/wc/workspace/P2MPP/data/face3.obj"""'], {'dtype': '"""|S32"""'}), "('/home/wc/workspace/P2MPP/data/face3.obj', dtype='|S32')\n",...
""" spectral.py Frequency domain analysis of neural signals: creating PSD, fitting 1/f, spectral histograms """ import numpy as np from scipy import signal import matplotlib.pylab as plt from sklearn import linear_model def psd(x, Fs, method='mean', window='hann', nperseg=None, noverlap=None, filtlen=1.): """ ...
[ "numpy.log10", "numpy.polyfit", "scipy.signal.spectrogram", "matplotlib.pylab.imshow", "numpy.mean", "numpy.histogram", "matplotlib.pylab.figure", "matplotlib.pylab.legend", "numpy.fft.fft", "numpy.linspace", "matplotlib.pylab.plot", "numpy.abs", "numpy.flipud", "numpy.random.choice", "m...
[((5201, 5253), 'scipy.signal.spectrogram', 'signal.spectrogram', (['x', 'Fs', 'window', 'nperseg', 'noverlap'], {}), '(x, Fs, window, nperseg, noverlap)\n', (5219, 5253), False, 'from scipy import signal\n'), ((8015, 8067), 'scipy.signal.spectrogram', 'signal.spectrogram', (['x', 'Fs', 'window', 'nperseg', 'noverlap']...
import time import numpy as np import tensorflow as tf from dater import reader from modeler.multirnnmodel import MultiRNNModel from trainer.tftrainer import TFTrainer class MutiRNNTrainer(TFTrainer): def __init__(self): self.config = SmallConfig() self.eval_config = SmallConfig() self.e...
[ "tensorflow.Graph", "tensorflow.variable_scope", "numpy.exp", "dater.reader.ptb_raw_data", "tensorflow.name_scope", "tensorflow.train.Supervisor", "dater.reader.ptb_producer", "tensorflow.random_uniform_initializer", "time.time" ]
[((524, 577), 'dater.reader.ptb_raw_data', 'reader.ptb_raw_data', (['"""data/simple-examples.tar/data/"""'], {}), "('data/simple-examples.tar/data/')\n", (543, 577), False, 'from dater import reader\n'), ((3122, 3133), 'time.time', 'time.time', ([], {}), '()\n', (3131, 3133), False, 'import time\n'), ((4054, 4075), 'nu...
import numpy as np from ..utils import slice_row_sparse from .metrics import NDCG def evaluate(model, Xtr, Xts, target_users, topk=100, metrics=[NDCG], min_targets=1000, from_to=('user', 'item')): """ """ if target_users is None: target_users = np.random.choice(Xts.shape...
[ "numpy.random.choice" ]
[((294, 344), 'numpy.random.choice', 'np.random.choice', (['Xts.shape[0]', 'min_targets', '(False)'], {}), '(Xts.shape[0], min_targets, False)\n', (310, 344), True, 'import numpy as np\n')]
import os import sys from openbabel import openbabel as ob from openbabel import pybel as pb import gen3D import numpy as np from statistics import mean import props ELEMENT_TABLE = props.ElementData() class FILTER(object): def __init__(self, reactant_file, cluster_bond_file = None, fixed_atoms = None...
[ "statistics.mean", "openbabel.openbabel.OBAtom", "openbabel.pybel.ob.OBMolBondIter", "gen3D.Molecule", "openbabel.pybel.ob.OBMol", "numpy.array", "numpy.linalg.norm", "props.ElementData", "openbabel.pybel.readfile" ]
[((192, 211), 'props.ElementData', 'props.ElementData', ([], {}), '()\n', (209, 211), False, 'import props\n'), ((680, 718), 'openbabel.pybel.readfile', 'pb.readfile', (['"""xyz"""', 'self.reactant_file'], {}), "('xyz', self.reactant_file)\n", (691, 718), True, 'from openbabel import pybel as pb\n'), ((773, 786), 'open...
import sys import cv2 import math import os import json import pandas as pd import numpy as np import json stroke_data = { "data" : [] } stroke_data_ = open('result.json', 'r') stroke_data = json.loads(stroke_data_.read()) print(stroke_data['data']) stroke_data_.close() speed_for_each_stroke = {} def read_coor...
[ "pandas.read_csv", "cv2.getPerspectiveTransform", "numpy.asarray", "math.sqrt", "numpy.array", "numpy.zeros", "json.dump" ]
[((1182, 1224), 'math.sqrt', 'math.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (1191, 1224), False, 'import math\n'), ((1422, 1453), 'pandas.read_csv', 'pd.read_csv', (['"""final_result.csv"""'], {}), "('final_result.csv')\n", (1433, 1453), True, 'import pandas as pd\n'), ...
import numpy as np # projection mask of NYUv2 PMASK = np.zeros([480, 640], dtype=np.float64) PMASK[44:471, 40:601] = 1.0 # sorted names METRIC_NAMES = [ 'RMSE', 'Mean RMSE', 'Mean Log10', 'Abs Rel Diff', 'Squa Rel Diff', 'delta < 1.25', 'delta < 1.25^2', 'delta < 1.25^3', ] def get_m...
[ "numpy.mean", "numpy.abs", "numpy.log10", "numpy.sqrt", "numpy.float64", "numpy.square", "numpy.sum", "numpy.zeros", "numpy.stack", "numpy.maximum" ]
[((55, 93), 'numpy.zeros', 'np.zeros', (['[480, 640]'], {'dtype': 'np.float64'}), '([480, 640], dtype=np.float64)\n', (63, 93), True, 'import numpy as np\n'), ((1437, 1463), 'numpy.sum', 'np.sum', (['masks'], {'axis': '(1, 2)'}), '(masks, axis=(1, 2))\n', (1443, 1463), True, 'import numpy as np\n'), ((1576, 1588), 'num...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest from numpy.testing import assert_almost_equal from theanolm.commands.score import _merge_subwords class TestScore(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_merge_subwords(self): # w...
[ "unittest.main", "numpy.testing.assert_almost_equal", "theanolm.commands.score._merge_subwords" ]
[((2833, 2848), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2846, 2848), False, 'import unittest\n'), ((482, 531), 'theanolm.commands.score._merge_subwords', '_merge_subwords', (['subwords', 'subword_logprobs', 'None'], {}), '(subwords, subword_logprobs, None)\n', (497, 531), False, 'from theanolm.commands.sco...
""" Twin-delayed DDPG """ import numpy as np import tensorflow as tf from utils.logx import EpochLogger from utils.tf_utils import set_tf_allow_growth set_tf_allow_growth() import gym import time from tqdm.auto import tqdm def hard_update(target: tf.keras.Model, source: tf.keras.Model): target.set_weights(sour...
[ "tensorflow.shape", "tensorflow.tanh", "tensorflow.reduce_sum", "tensorflow.GradientTape", "tensorflow.keras.layers.Dense", "tensorflow.reduce_mean", "gym.make", "tensorflow.reduce_min", "numpy.isscalar", "argparse.ArgumentParser", "tensorflow.keras.Sequential", "tensorflow.concat", "numpy.r...
[((154, 175), 'utils.tf_utils.set_tf_allow_growth', 'set_tf_allow_growth', ([], {}), '()\n', (173, 175), False, 'from utils.tf_utils import set_tf_allow_growth\n'), ((926, 967), 'tensorflow.where', 'tf.where', (['cond', 'squared_loss', 'linear_loss'], {}), '(cond, squared_loss, linear_loss)\n', (934, 967), True, 'impor...
""" Module allows the grabbing of dose rate factors for the calculation of radiotoxicity. There are four dose rates provided: 1. external from air (mrem/h per Ci/m^3) Table includes: nuclide, air dose rate factor, ratio to inhalation dose (All EPA values) 2. external from 15 cm of soil (mrem/h per Ci/m^2) T...
[ "os.path.exists", "pyne.nucname.id", "tables.open_file", "numpy.array", "os.path.dirname", "numpy.dtype", "csv.reader" ]
[((2144, 2162), 'pyne.nucname.id', 'nucname.id', (['row[0]'], {}), '(row[0])\n', (2154, 2162), False, 'from pyne import nucname\n'), ((5826, 6020), 'numpy.dtype', 'np.dtype', (["[('nuc', int), ('ext_air_dose', float), ('ratio', float), ('ext_soil_dose',\n float), ('ingest_dose', float), ('fluid_frac', float), ('inha...
import pickle import numpy as np import tensorflow as tf import librosa import matplotlib.pyplot as plt import matplotlib.ticker as ticker from mpl_toolkits.axes_grid1 import make_axes_locatable import os import json import glob from Input import Input import Models.UnetAudioSeparator import Models.UnetSpectrogramSep...
[ "numpy.log10", "matplotlib.pyplot.vlines", "librosa.resample", "numpy.array", "numpy.nanmean", "librosa.load", "numpy.mean", "tensorflow.Session", "numpy.max", "musdb.DB", "mpl_toolkits.axes_grid1.make_axes_locatable", "numpy.min", "numpy.tile", "numpy.nanstd", "museval.eval_mus_track", ...
[((760, 786), 'numpy.inner', 'np.inner', (['estimate', 'target'], {}), '(estimate, target)\n', (768, 786), True, 'import numpy as np\n'), ((3555, 3666), 'Input.Input.get_multitrack_placeholders', 'Input.get_multitrack_placeholders', (['sep_output_shape', "model_config['num_sources']", 'sep_input_shape', '"""input"""'],...
import numpy as np from pymoo.experimental.deriv import DerivationBasedAlgorithm from pymoo.algorithms.base.line import LineSearchProblem from pymoo.algorithms.soo.univariate.exp import ExponentialSearch from pymoo.algorithms.soo.univariate.golden import GoldenSectionSearch from pymoo.core.population import Population...
[ "pymoo.algorithms.soo.univariate.golden.GoldenSectionSearch", "numpy.zeros", "pymoo.core.population.Population.merge", "numpy.linalg.norm", "pymoo.algorithms.soo.univariate.exp.ExponentialSearch", "pymoo.algorithms.base.line.LineSearchProblem" ]
[((840, 926), 'pymoo.algorithms.base.line.LineSearchProblem', 'LineSearchProblem', (['self.problem', 'sol', 'direction'], {'strict_bounds': 'self.strict_bounds'}), '(self.problem, sol, direction, strict_bounds=self.\n strict_bounds)\n', (857, 926), False, 'from pymoo.algorithms.base.line import LineSearchProblem\n')...
import numpy as np import tensorflow as tf if int(tf.__version__[0]) > 1: from tensorflow.keras.utils import Sequence else: from tensorflow.python.keras.utils import Sequence class DefaultGenerator(Sequence): """ Create the default generator class using Keras sequence as the parent """ def _...
[ "numpy.shape", "numpy.transpose", "numpy.random.shuffle" ]
[((2251, 2288), 'numpy.transpose', 'np.transpose', (['batch_y'], {'axes': '(0, 2, 1)'}), '(batch_y, axes=(0, 2, 1))\n', (2263, 2288), True, 'import numpy as np\n'), ((2478, 2509), 'numpy.random.shuffle', 'np.random.shuffle', (['self.indices'], {}), '(self.indices)\n', (2495, 2509), True, 'import numpy as np\n'), ((937,...
import os import os.path as osp import cv2 import numpy as np import pickle import argparse import sys sys.path.append(osp.join(sys.path[0], '..', '..')) # relative to current one # print(sys.path) import utils.utils as ut from tqdm import tqdm ''' history: 210924: update the part to global 24 index with visibility ...
[ "numpy.savez", "os.listdir", "os.makedirs", "argparse.ArgumentParser", "tqdm.tqdm", "os.path.join", "pickle.load", "numpy.array", "numpy.zeros", "os.path.isdir", "numpy.einsum", "cv2.Rodrigues" ]
[((119, 152), 'os.path.join', 'osp.join', (['sys.path[0]', '""".."""', '""".."""'], {}), "(sys.path[0], '..', '..')\n", (127, 152), True, 'import os.path as osp\n'), ((907, 958), 'os.path.join', 'os.path.join', (['dataset_path', '"""sequenceFiles"""', '"""test"""'], {}), "(dataset_path, 'sequenceFiles', 'test')\n", (91...
import numpy as np import networkx as nx from itertools import combinations from random import randrange, uniform from numpy.linalg import inv import scipy.sparse as sp import pickle as pk import os def get_sparse_eigen_decomposition(graph, K): adj = nx.adjacency_matrix(graph, nodelist=sorted(graph.nodes()), weig...
[ "os.path.exists", "random.uniform", "networkx.barabasi_albert_graph", "numpy.linalg.eig", "pickle.load", "networkx.Graph", "numpy.argsort", "numpy.zeros", "networkx.draw_shell", "numpy.linalg.svd", "numpy.matrix", "networkx.erdos_renyi_graph" ]
[((527, 545), 'numpy.linalg.eig', 'np.linalg.eig', (['adj'], {}), '(adj)\n', (540, 545), True, 'import numpy as np\n'), ((663, 690), 'numpy.zeros', 'np.zeros', (['(adj.shape[0], K)'], {}), '((adj.shape[0], K))\n', (671, 690), True, 'import numpy as np\n'), ((818, 838), 'numpy.matrix', 'np.matrix', (['V_ksparse'], {}), ...
import os import torch import numbers import torchvision.transforms as transforms import torchvision.transforms.functional as F from torch.utils.data import Subset, TensorDataset import numpy as np def get_dataset(args, config): if config.data.random_flip is False: tran_transform = test_transform = trans...
[ "numpy.mean", "torch.log", "torch.rand_like", "numpy.std", "torch.sigmoid", "torchvision.transforms.RandomHorizontalFlip", "torch.from_numpy", "numpy.max", "torch.randn_like", "numpy.min", "torchvision.transforms.Resize", "torchvision.transforms.ToTensor", "numpy.load", "torch.clamp", "t...
[((826, 851), 'numpy.load', 'np.load', (['args.train_fname'], {}), '(args.train_fname)\n', (833, 851), True, 'import numpy as np\n'), ((917, 970), 'numpy.mean', 'np.mean', (['train_samples'], {'axis': '(0, 2, 3)', 'keepdims': '(True)'}), '(train_samples, axis=(0, 2, 3), keepdims=True)\n', (924, 970), True, 'import nump...
from numpy import arange from hex_to_decimal import hex_to_decimal from decimal_to_hex import decimal_to_hex from binary_to_decimal import binary_to_decimal from decimal_to_binary import decimal_to_binary from octal_to_decimal import octal_to_decimal from decimal_to_octal import decimal_to_octal from binary_to_hex imp...
[ "octal_to_decimal.octal_to_decimal", "binary_to_decimal.binary_to_decimal", "decimal_to_octal.decimal_to_octal", "decimal_to_hex.decimal_to_hex", "binary_to_octal.binary_to_octal", "hex_to_decimal.hex_to_decimal", "decimal_to_binary.decimal_to_binary", "unittest.main", "random.random", "binary_to_...
[((2160, 2166), 'unittest.main', 'main', ([], {}), '()\n', (2164, 2166), False, 'from unittest import main, TestCase\n'), ((532, 553), 'numpy.arange', 'arange', (['(0)', '(100)', '(0.001)'], {}), '(0, 100, 0.001)\n', (538, 553), False, 'from numpy import arange\n'), ((779, 800), 'numpy.arange', 'arange', (['(0)', '(100...
import unittest class TestDynamicsModel(unittest.TestCase): def setUp(self): from muzero.models.dynamics_model import DynamicsModel from muzero.environment.action import Action import tensorflow as tf self.dynamics_model = DynamicsModel() self.batch_of_hidden_states = tf.o...
[ "muzero.models.representation_model.RepresentationModel", "tensorflow.ones", "muzero.models.dynamics_model.DynamicsModel", "tensorflow.concat", "numpy.array", "muzero.environment.action.Action", "muzero.models.prediction_model.PredictionModel" ]
[((262, 277), 'muzero.models.dynamics_model.DynamicsModel', 'DynamicsModel', ([], {}), '()\n', (275, 277), False, 'from muzero.models.dynamics_model import DynamicsModel\n'), ((316, 337), 'tensorflow.ones', 'tf.ones', (['[4, 3, 3, 1]'], {}), '([4, 3, 3, 1])\n', (323, 337), True, 'import tensorflow as tf\n'), ((368, 377...
#Genel import sys, os, math, csv, random, time, datetime, webbrowser, subprocess #PyQt5 from PyQt5 import QtWidgets, QtCore, QtGui from tasarim import Ui_MainWindow from PyQt5.QtWidgets import QFileDialog, QMessageBox #TensorFlow import tensorflow as tf import tensorflow.keras from tensorflow.keras.models import Se...
[ "csv.DictWriter", "cv2.rectangle", "tensorflow.keras.preprocessing.image.resize", "PyQt5.QtGui.QIcon", "matplotlib.pyplot.ylabel", "tensorflow.keras.preprocessing.image.ImageDataGenerator", "webbrowser.open", "cv2.imshow", "numpy.array", "random.choices", "tensorflow.keras.layers.Dense", "tens...
[((24653, 24685), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (24675, 24685), False, 'from PyQt5 import QtWidgets, QtCore, QtGui\n'), ((1104, 1119), 'tasarim.Ui_MainWindow', 'Ui_MainWindow', ([], {}), '()\n', (1117, 1119), False, 'from tasarim import Ui_MainWindow\n'), ...
import numpy as np import MITgcmutils as mit #import xmitgcm as xmit #import matplotlib.pyplot as plt from scipy.interpolate import griddata import os import gc from multiprocessing import Pool #plt.ion() #-- directories -- dir_grd12 = '/glade/p/univ/ufsu0011/runs/gridMIT_update1/' dir_grd50 = '/glade/p/univ/ufsu0011...
[ "numpy.radians", "numpy.fromfile", "os.makedirs", "numpy.zeros", "os.path.isdir", "multiprocessing.Pool", "gc.collect", "MITgcmutils.rdmds", "numpy.arange" ]
[((1378, 1405), 'MITgcmutils.rdmds', 'mit.rdmds', (["(dir_grd50 + 'XC')"], {}), "(dir_grd50 + 'XC')\n", (1387, 1405), True, 'import MITgcmutils as mit\n'), ((1415, 1442), 'MITgcmutils.rdmds', 'mit.rdmds', (["(dir_grd50 + 'YC')"], {}), "(dir_grd50 + 'YC')\n", (1424, 1442), True, 'import MITgcmutils as mit\n'), ((1619, 1...
from builtins import zip import numpy as np import cv2 from matplotlib import pyplot as plt def drawMatches(img1, kp1, img2, kp2, matches): """ My own implementation of cv2.drawMatches as OpenCV 2.4.9 does not have this function available but it's supported in OpenCV 3.0.0 This function takes in...
[ "matplotlib.pyplot.imshow", "cv2.BFMatcher", "numpy.dstack", "matplotlib.pyplot.show", "cv2.imshow", "builtins.zip", "cv2.SIFT", "cv2.destroyAllWindows", "cv2.waitKey", "numpy.float32", "cv2.imread" ]
[((3587, 3597), 'cv2.SIFT', 'cv2.SIFT', ([], {}), '()\n', (3595, 3597), False, 'import cv2\n'), ((3726, 3741), 'cv2.BFMatcher', 'cv2.BFMatcher', ([], {}), '()\n', (3739, 3741), False, 'import cv2\n'), ((1424, 1453), 'numpy.dstack', 'np.dstack', (['[img1, img1, img1]'], {}), '([img1, img1, img1])\n', (1433, 1453), True,...
"""Make a heatmap of punctuation.""" import math from string import punctuation import nltk import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import seaborn as sns # Install seaborn using: pip install seaborn. PUNCT_SET = set(punctuation) def main(): # Load text f...
[ "nltk.word_tokenize", "matplotlib.colors.ListedColormap", "numpy.array", "matplotlib.pyplot.ion", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((762, 771), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (769, 771), True, 'import matplotlib.pyplot as plt\n'), ((1338, 1348), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1346, 1348), True, 'import matplotlib.pyplot as plt\n'), ((885, 906), 'numpy.array', 'np.array', (['heat[:6561]'], {}), '(he...
from skimage.draw import line import numpy as np import cv2 import matplotlib.pyplot as plt def get_eye_line(eye_landmarks): l0, l1, l2, l3, l4, l5 = eye_landmarks.astype('int') A= list(((np.array(l1) + np.array(l5))/2).astype('int')) B= list(((np.array(l2) + np.array(l4))/2).astype('int')) lin...
[ "matplotlib.pyplot.imshow", "numpy.mean", "numpy.array", "cv2.circle", "skimage.draw.line", "matplotlib.pyplot.title", "cv2.resize", "matplotlib.pyplot.show" ]
[((2717, 2756), 'cv2.resize', 'cv2.resize', (['eye_image', '(resize, resize)'], {}), '(eye_image, (resize, resize))\n', (2727, 2756), False, 'import cv2\n'), ((721, 761), 'matplotlib.pyplot.imshow', 'plt.imshow', (['image_gray_show'], {'cmap': '"""gray"""'}), "(image_gray_show, cmap='gray')\n", (731, 761), True, 'impor...
""" Copyright (c) 2022 Intel 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 writin...
[ "numpy.prod", "torch.max", "torch.min" ]
[((745, 770), 'numpy.prod', 'np.prod', (['ref_tensor_shape'], {}), '(ref_tensor_shape)\n', (752, 770), True, 'import numpy as np\n'), ((1178, 1203), 'numpy.prod', 'np.prod', (['ref_tensor_shape'], {}), '(ref_tensor_shape)\n', (1185, 1203), True, 'import numpy as np\n'), ((1031, 1072), 'torch.max', 'torch.max', (['tmp_m...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' surface2stations.py Extract synthetics at given stations from a NetCDF database of surface wavefield created by AxiSEM3D (named axisem3d_surface.nc by the solver) and save them into a NetCDF waveform database (same as the built-in NetCDF output axisem3d_synthetics.nc)...
[ "numpy.radians", "obspy.geodetics.gps2dist_azimuth", "numpy.arccos", "numpy.tan", "argparse.ArgumentParser", "numpy.searchsorted", "netCDF4.Dataset", "os.path.isfile", "numpy.zeros", "numpy.arctan2", "numpy.cos", "numpy.sin", "numpy.degrees", "numpy.loadtxt", "numpy.amax", "numpy.arang...
[((843, 940), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'aim', 'epilog': 'notes', 'formatter_class': 'RawTextHelpFormatter'}), '(description=aim, epilog=notes, formatter_class=\n RawTextHelpFormatter)\n', (866, 940), False, 'import argparse\n'), ((8596, 8623), 'numpy.zeros', 'np.zero...
import numpy as np from .LowResHighResDataset import LowResHighResDataset, region_geometry class NearestNeighborData(LowResHighResDataset): def __init__(self, dataset: LowResHighResDataset, num_models=None, model_index=None, k=16): super(NearestNeighborData, self).__init__( dataset.geometry_lr...
[ "numpy.ones_like", "numpy.abs", "numpy.reshape", "numpy.argpartition", "numpy.sort", "numpy.sum", "numpy.array", "numpy.stack", "numpy.concatenate", "numpy.arange", "numpy.random.shuffle" ]
[((1569, 1588), 'numpy.sum', 'np.sum', (['(1 - mask_hr)'], {}), '(1 - mask_hr)\n', (1575, 1588), True, 'import numpy as np\n'), ((3718, 3746), 'numpy.array', 'np.array', (['input_index_lon_lr'], {}), '(input_index_lon_lr)\n', (3726, 3746), True, 'import numpy as np\n'), ((3781, 3809), 'numpy.array', 'np.array', (['inpu...
import unittest import logging import sys import numpy from intervals.number import Interval as I from intervals.methods import (intervalise,lo,hi) from .interval_generator import pick_endpoints_at_random_uniform class TestIntervalArithmetic(unittest.TestCase): def test_addition_by_endpoints_analysis(self): ...
[ "intervals.methods.lo", "numpy.random.rand", "intervals.methods.hi", "unittest.main", "intervals.number.Interval" ]
[((10586, 10601), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10599, 10601), False, 'import unittest\n'), ((10194, 10213), 'numpy.random.rand', 'numpy.random.rand', ([], {}), '()\n', (10211, 10213), False, 'import numpy\n'), ((10226, 10230), 'intervals.number.Interval', 'I', (['a'], {}), '(a)\n', (10227, 10230...
# MNIST image and label reader & dataset provider for tensorflow networks # <NAME> # <EMAIL> import numpy as np import struct from PIL import Image # read MNIST dataset - image def read_image(filename): raw = open(filename, 'rb') magic_num = struct.unpack("i", raw.read(4)[::-1])[0] if magic_nu...
[ "numpy.argmax", "numpy.zeros", "numpy.unique", "PIL.Image.fromarray" ]
[((594, 633), 'numpy.zeros', 'np.zeros', (['[item_num, row_num * col_num]'], {}), '([item_num, row_num * col_num])\n', (602, 633), True, 'import numpy as np\n'), ((1147, 1171), 'numpy.zeros', 'np.zeros', (['[item_num, 10]'], {}), '([item_num, 10])\n', (1155, 1171), True, 'import numpy as np\n'), ((1403, 1420), 'numpy.u...
import os import sys from difflib import SequenceMatcher from pyproj import Proj, transform import numpy as np import pandas as pd def similar(a, b): return SequenceMatcher(None, a, b).ratio() def extract_loc(t_array, gps_data): _xy = gps_data[[0, -1]] pct = ((t_array * 1.0) / np.max(t_array))[:, np.new...
[ "numpy.radians", "numpy.unique", "pandas.read_csv", "numpy.sin", "difflib.SequenceMatcher", "os.path.join", "pyproj.transform", "numpy.argmax", "numpy.max", "numpy.dot", "numpy.cos", "pyproj.Proj", "numpy.linalg.norm", "pandas.DataFrame", "pandas.concat" ]
[((509, 531), 'pyproj.Proj', 'Proj', ([], {'init': '"""epsg:4326"""'}), "(init='epsg:4326')\n", (513, 531), False, 'from pyproj import Proj, transform\n'), ((545, 568), 'pyproj.Proj', 'Proj', ([], {'init': '"""epsg:26911"""'}), "(init='epsg:26911')\n", (549, 568), False, 'from pyproj import Proj, transform\n'), ((578, ...
import numpy as np from scipy.stats import truncnorm, norm def soft_threshold(r, gamma): """ soft-thresholding function """ return np.maximum(np.abs(r) - gamma, 0.0) * np.sign(r) def df(r, gamma): """ divergence-free function """ eta = soft_threshold(r, gamma) ret...
[ "numpy.mean", "numpy.histogram", "numpy.abs", "numpy.random.rand", "numpy.where", "numpy.logical_not", "numpy.argmax", "numpy.square", "numpy.append", "numpy.sum", "numpy.zeros", "numpy.empty", "numpy.sign", "scipy.stats.norm.pdf", "scipy.stats.truncnorm.rvs" ]
[((495, 514), 'numpy.zeros', 'np.zeros', (['(P, N, 1)'], {}), '((P, N, 1))\n', (503, 514), True, 'import numpy as np\n'), ((524, 540), 'numpy.zeros', 'np.zeros', (['(N, 1)'], {}), '((N, 1))\n', (532, 540), True, 'import numpy as np\n'), ((835, 852), 'numpy.sum', 'np.sum', (['R'], {'axis': '(0)'}), '(R, axis=0)\n', (841...
#! crding = utf8 from pandas import * import numpy as np import os, sys, subprocess import netCDF4 import twd97 import datetime from calendar import monthrange from scipy.io import FortranFile from ptse_sub import CORRECT, add_PMS, check_nan, check_landsea, FillNan, WGS_TWD, Elev_YPM #Main P=subprocess.check_output(...
[ "subprocess.check_output", "ptse_sub.check_nan", "ptse_sub.check_landsea", "scipy.io.FortranFile", "numpy.array", "numpy.zeros", "ptse_sub.Elev_YPM", "ptse_sub.WGS_TWD", "sys.exit" ]
[((676, 689), 'ptse_sub.check_nan', 'check_nan', (['df'], {}), '(df)\n', (685, 689), False, 'from ptse_sub import CORRECT, add_PMS, check_nan, check_landsea, FillNan, WGS_TWD, Elev_YPM\n'), ((754, 771), 'ptse_sub.check_landsea', 'check_landsea', (['df'], {}), '(df)\n', (767, 771), False, 'from ptse_sub import CORRECT, ...
import numpy as np from numpy.linalg import inv class GeoArray(np.ndarray): def __new__(cls, input_array, crs=4326, mat=None): obj = np.asarray(input_array).view(cls) obj.crs, obj.mat = crs, mat.reshape((2,3)) return obj def __array_finalize__(self, obj): if obj is None: re...
[ "numpy.ones", "numpy.hstack", "numpy.asarray", "numpy.array", "numpy.zeros", "numpy.linalg.inv", "numpy.dot", "numpy.vstack" ]
[((2436, 2468), 'numpy.array', 'np.array', (['[[1, 1, 0], [1, 0, 1]]'], {}), '([[1, 1, 0], [1, 0, 1]])\n', (2444, 2468), True, 'import numpy as np\n'), ((2548, 2576), 'numpy.array', 'np.array', (['[0, 1, 0, 0, 0, 1]'], {}), '([0, 1, 0, 0, 0, 1])\n', (2556, 2576), True, 'import numpy as np\n'), ((1386, 1434), 'numpy.vst...
import numpy as np from sklearn.model_selection import train_test_split, StratifiedKFold import shutil from src.model_torch import train_model_eegnet from src.utils import set_seed from src.utils import single_auc_loging import codecs from functools import reduce import os import sys sys.path.append(os.path.join(os.pa...
[ "numpy.mean", "numpy.ones", "os.makedirs", "sklearn.model_selection.train_test_split", "numpy.std", "os.path.join", "numpy.argmax", "src.utils.single_auc_loging", "numpy.max", "sklearn.model_selection.StratifiedKFold", "os.getcwd", "numpy.zeros", "os.path.isdir", "numpy.concatenate", "sh...
[((623, 664), 'os.path.join', 'os.path.join', (['path_to_subj', '"""checkpoints"""'], {}), "(path_to_subj, 'checkpoints')\n", (635, 664), False, 'import os\n'), ((672, 699), 'os.path.isdir', 'os.path.isdir', (['path_to_subj'], {}), '(path_to_subj)\n', (685, 699), False, 'import os\n'), ((741, 764), 'os.makedirs', 'os.m...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/8/16 17:12 # @Author : zzy824 # @File : emojify_main.py import numpy as np from emo_utils import * import emoji import matplotlib.pyplot as plt """ Baseline model: Emojifier-V1 """ X_train, Y_train = read_csv('data/train_emoji.csv') X_test, Y_test = ...
[ "numpy.sqrt", "numpy.log", "numpy.dot", "numpy.zeros", "numpy.random.seed", "numpy.random.randn" ]
[((1827, 1839), 'numpy.zeros', 'np.zeros', (['(50)'], {}), '(50)\n', (1835, 1839), True, 'import numpy as np\n'), ((2939, 2956), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (2953, 2956), True, 'import numpy as np\n'), ((3244, 3260), 'numpy.zeros', 'np.zeros', (['(n_y,)'], {}), '((n_y,))\n', (3252, 32...
import numpy as np from matplotlib import pyplot as plt ''' Function for plotting training and validation curves. ''' def learning_curves(history, multival=None, model_n=None, filepath=None, plot_from_epoch=0, plot_to_epoch=None): n = len(history) num_epochs = len(history[0]['loss']) if plot_to_epoch is ...
[ "numpy.mean", "numpy.reshape", "matplotlib.pyplot.savefig", "numpy.minimum", "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.ioff", "matplotlib.pyplot.close", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.std", "matplotlib.pyplot.title", "nump...
[((429, 454), 'numpy.zeros', 'np.zeros', (['(n, num_epochs)'], {}), '((n, num_epochs))\n', (437, 454), True, 'import numpy as np\n'), ((471, 496), 'numpy.zeros_like', 'np.zeros_like', (['train_loss'], {}), '(train_loss)\n', (484, 496), True, 'import numpy as np\n'), ((512, 537), 'numpy.zeros_like', 'np.zeros_like', (['...
import numpy as np #Creando la matriz tablero = np.zeros(30) tableroFuturo = np.zeros(30) #Estado inicial tablero[1] = 1 tablero[4] = 1 tablero[5] = 1 tablero[7] = 1 tablero[9] = 1 tablero[11] = 1 tablero[13] = 1 tablero[14] = 1 contador = 0 def buscarCelulas(matrizBC): for j in range(30): valor ...
[ "numpy.zeros" ]
[((52, 64), 'numpy.zeros', 'np.zeros', (['(30)'], {}), '(30)\n', (60, 64), True, 'import numpy as np\n'), ((82, 94), 'numpy.zeros', 'np.zeros', (['(30)'], {}), '(30)\n', (90, 94), True, 'import numpy as np\n'), ((2263, 2275), 'numpy.zeros', 'np.zeros', (['(30)'], {}), '(30)\n', (2271, 2275), True, 'import numpy as np\n...
""" String representation for various data objects """ from collections import OrderedDict as odict import numpy as np import json import dimarray as da from dimarray.config import get_option def str_attrs(meta, indent=4): return "\n".join([" "*indent+"{}: {}".format(key, repr(meta[key])) for key in meta.keys()])...
[ "collections.OrderedDict", "dimarray.config.get_option", "numpy.isnan" ]
[((3620, 3627), 'collections.OrderedDict', 'odict', ([], {}), '()\n', (3625, 3627), True, 'from collections import OrderedDict as odict\n'), ((2966, 2991), 'dimarray.config.get_option', 'get_option', (['"""display.max"""'], {}), "('display.max')\n", (2976, 2991), False, 'from dimarray.config import get_option\n'), ((33...
# MIT License # # Copyright (c) 2016-2018 <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 the rights # to use, copy, modify, merge, ...
[ "logging.getLogger", "numpy.insert", "numpy.mean", "matplotlib.pyplot.savefig", "matplotlib.use", "matplotlib.pyplot.gca", "os.path.join", "matplotlib.pyplot.cm.inferno", "numpy.append", "matplotlib.ticker.ScalarFormatter", "matplotlib.pyplot.tight_layout", "numpy.maximum", "matplotlib.lines...
[((1261, 1284), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (1275, 1284), False, 'import matplotlib\n'), ((1348, 1375), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1365, 1375), False, 'import logging\n'), ((10199, 10229), 'matplotlib.pyplot.subplots', 'pl...
import cv2,os import numpy as np from keras.applications.vgg16 import decode_predictions from keras.applications import ResNet50, Xception, InceptionV3, VGG16, VGG19 from keras.preprocessing import image as Image from keras.applications.vgg16 import preprocess_input from tqdm import tqdm from skimage import feat...
[ "keras.preprocessing.image.img_to_array", "numpy.array", "numpy.arange", "numpy.save", "keras.applications.Xception", "os.listdir", "keras.applications.vgg16.preprocess_input", "keras.applications.VGG16", "keras.applications.VGG19", "keras.applications.InceptionV3", "cv2.cvtColor", "keras.appl...
[((1350, 1357), 'tqdm.tqdm', 'tqdm', (['f'], {}), '(f)\n', (1354, 1357), False, 'from tqdm import tqdm\n'), ((1674, 1730), 'keras.preprocessing.image.load_img', 'Image.load_img', (['img_path'], {'target_size': '(im_size, im_size)'}), '(img_path, target_size=(im_size, im_size))\n', (1688, 1730), True, 'from keras.prepro...
import copy import os import shutil import sys import time import PyTango import numpy import p05.common.PyTangoProxyConstants as proxies import p05.tools.misc as misc from p05.nanoCameras import FLIeh2_nanoCam, Hamamatsu_nanoCam, KIT_nanoCam, Lambda_nanoCam, PCO_nanoCam, \ PixelLink_nanoCam, Zyla_nanoCam from p0...
[ "time.sleep", "p05.tools.misc.GetTimeString", "p05.scripts.OptimizePitch.OptimizePitch", "sys.exit", "copy.copy", "numpy.mod", "os.path.exists", "p05.nanoCameras.KIT_nanoCam", "shutil.copy2", "os.path.split", "p05.nanoCameras.Hamamatsu_nanoCam", "os.mkdir", "p05.nanoCameras.PCO_nanoCam", "...
[((3370, 3446), 'shutil.copy2', 'shutil.copy2', (['currScript', "(self.sPath + '%s__LogScript.py.log' % self.sPrefix)"], {}), "(currScript, self.sPath + '%s__LogScript.py.log' % self.sPrefix)\n", (3382, 3446), False, 'import shutil\n'), ((3475, 3486), 'time.time', 'time.time', ([], {}), '()\n', (3484, 3486), False, 'im...
"""Test drawing module """ import pytest import numpy as np from shellplot.axis import Axis from shellplot.drawing import ( LegendItem, _draw_canvas, _draw_legend, _draw_x_axis, _draw_y_axis, _pad_lines, ) def test_draw_legend(): legend = [LegendItem(1, "one"), LegendItem(2, "two")] ...
[ "shellplot.drawing._draw_canvas", "shellplot.axis.Axis", "shellplot.drawing._draw_y_axis", "shellplot.drawing._draw_x_axis", "pytest.mark.parametrize", "numpy.array", "shellplot.drawing._pad_lines", "shellplot.drawing._draw_legend", "shellplot.drawing.LegendItem" ]
[((405, 566), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lines,ref_lines,expecte_padded_lines"""', "[(['a', 'b'], ['a', 'b', 'c'], ['', 'a', 'b']), (None, ['a', 'b', 'c'], ['',\n '', ''])]"], {}), "('lines,ref_lines,expecte_padded_lines', [(['a', 'b'\n ], ['a', 'b', 'c'], ['', 'a', 'b']), (None, ...