code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from envs.LQR import LQR
from utils import get_AB, linear_layers, random_AB
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Normal
import numpy as np
try:
import wandb
except:
wandb = None
torch.manual_seed(2022)
np.random.seed(20... | [
"envs.LQR.LQR",
"wandb.log",
"torch.from_numpy",
"numpy.random.seed",
"torch.manual_seed",
"torch.distributions.Normal",
"torch.exp",
"utils.linear_layers",
"torch.clamp",
"wandb.init",
"torch.nn.Linear",
"torch.min",
"numpy.eye",
"torch.no_grad",
"utils.get_AB",
"torch.tensor",
"tor... | [((279, 302), 'torch.manual_seed', 'torch.manual_seed', (['(2022)'], {}), '(2022)\n', (296, 302), False, 'import torch\n'), ((303, 323), 'numpy.random.seed', 'np.random.seed', (['(2022)'], {}), '(2022)\n', (317, 323), True, 'import numpy as np\n'), ((5253, 5286), 'utils.get_AB', 'get_AB', (['state_dim', 'action_dim', '... |
# -*- coding:utf-8 -*-
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
class DynaMaze(object):
def __init__(self, world_size=(6, 9), obstacle=[[0, 7], [1, 2], [1, 7], [2, 2], [2, 7], [3, 2], [4, 5]],
planning_steps=0):
self.world_size = world_size # the si... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.max",
"numpy.arange",
"numpy.array",
"numpy.random.choice",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"... | [((6297, 6310), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (6307, 6310), True, 'import matplotlib.pyplot as plt\n'), ((6438, 6460), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Episodes"""'], {}), "('Episodes')\n", (6448, 6460), True, 'import matplotlib.pyplot as plt\n'), ((6465, 6496), 'matpl... |
import pickle
import numpy as np
from typing import List
from time import time
from pathlib import Path
from textual.app import App
from textual import events
from widgets.box import TextBox, InfoBox, GutterBox
from utils.data import SessionDatabase, SessionDatabaseEntry, index_text_to_words, read_database
from utils... | [
"pickle.dump",
"widgets.box.GutterBox",
"utils.srs.update_srs_database_from_latest_session",
"utils.data.read_database",
"widgets.box.InfoBox",
"time.time",
"utils.data.SessionDatabase",
"pathlib.Path",
"widgets.box.TextBox",
"numpy.random.choice",
"utils.data.index_text_to_words",
"utils.ngra... | [((8263, 8292), 'pathlib.Path', 'Path', (['"""/usr/share/dict/words"""'], {}), "('/usr/share/dict/words')\n", (8267, 8292), False, 'from pathlib import Path\n'), ((8308, 8320), 'pathlib.Path', 'Path', (['"""data"""'], {}), "('data')\n", (8312, 8320), False, 'from pathlib import Path\n'), ((8369, 8468), 'utils.srs.updat... |
import math
import os
import struct
import threading
import time
import wave # write to wav
import numpy as np
import pyaudio # record
from scipy.io.wavfile import read, write
if __name__ != "__main__":
from .cli_tools import print_square
if __name__ != "__main__":
from .dsp import get_rms
def clear_cons... | [
"wave.open",
"os.remove",
"threading.Thread",
"play.play_data",
"math.pow",
"os.getcwd",
"struct.unpack",
"os.system",
"time.time",
"scipy.io.wavfile.read",
"scipy.io.wavfile.write",
"math.log10",
"numpy.array",
"pyaudio.PyAudio",
"dsp.get_rms",
"threading.Semaphore"
] | [((455, 473), 'os.system', 'os.system', (['command'], {}), '(command)\n', (464, 473), False, 'import os\n'), ((1445, 1462), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (1460, 1462), False, 'import pyaudio\n'), ((3381, 3398), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (3396, 3398), False, 'impor... |
import pytest
import torch
import numpy as np
__all__ = [
# input
"schnet_batch",
"max_atoms_in_batch",
"neighbors",
"neighbor_mask",
"positions",
"cell",
"cell_offset",
"r_ij",
"f_ij",
"random_atomic_env",
"random_interatomic_distances",
"random_input_dim",
"ran... | [
"torch.randint",
"numpy.random.randint",
"torch.rand"
] | [((1579, 1634), 'torch.rand', 'torch.rand', (['(batch_size, max_atoms_in_batch, n_filters)'], {}), '((batch_size, max_atoms_in_batch, n_filters))\n', (1589, 1634), False, 'import torch\n'), ((2178, 2223), 'torch.rand', 'torch.rand', (['random_shape'], {'dtype': 'torch.float32'}), '(random_shape, dtype=torch.float32)\n'... |
import itertools
import numpy as np
from ...data.materials.CompositionEntry import CompositionEntry
class OxidationStateGuesser:
"""Class to predict the likely oxidation states of a material, given its
input composition.
Attributes
----------
electronegativity : array-like
A list of electr... | [
"numpy.dot",
"numpy.asarray",
"numpy.zeros",
"itertools.product"
] | [((494, 505), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (502, 505), True, 'import numpy as np\n'), ((528, 553), 'numpy.zeros', 'np.zeros', (['(0)'], {'dtype': 'object'}), '(0, dtype=object)\n', (536, 553), True, 'import numpy as np\n'), ((3609, 3635), 'itertools.product', 'itertools.product', (['*states'], {})... |
###################################################################################################
#
# Project: Embedded Learning Library (ELL)
# File: compute_ell_model.py
# Authors: <NAME>
#
# Requires: Python 3.x
#
###########################################################################################... | [
"ell.model.Map",
"numpy.array",
"ell.math.FloatVector",
"os.path.join",
"os.getenv"
] | [((519, 540), 'os.getenv', 'os.getenv', (['"""ELL_ROOT"""'], {}), "('ELL_ROOT')\n", (528, 540), False, 'import os\n'), ((955, 980), 'ell.model.Map', 'ell.model.Map', (['model_path'], {}), '(model_path)\n', (968, 980), False, 'import ell\n'), ((2238, 2255), 'numpy.array', 'np.array', (['out_vec'], {}), '(out_vec)\n', (2... |
import argparse
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
from qutip import identity, sigmax, sigmaz, sigmay, tensor
from qutip.qip.operations.gates import cnot
sys.path.append("../..")
from tools import *
parser = argparse.ArgumentParser()
# name of example
parser.add_arg... | [
"sys.path.append",
"qutip.sigmaz",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.savetxt",
"os.path.exists",
"qutip.sigmax",
"qutip.identity",
"qutip.sigmay",
"numpy.loadtxt",
"qutip.qip.operations.gates.cnot"
] | [((202, 226), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (217, 226), False, 'import sys\n'), ((260, 285), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (283, 285), False, 'import argparse\n'), ((2011, 2022), 'qutip.identity', 'identity', (['(4)'], {}), '(4)\n',... |
# This script is used to choose a mask.
import cv2
import numpy as np
import freenect
def get_video():
return freenect.sync_get_video()[0][:, :, ::-1] # RGB -> BGR
def nothing(x):
pass
# Creating a window for later use
cv2.namedWindow('result')
# Starting with 100's to prevent error whi... | [
"cv2.createTrackbar",
"cv2.bitwise_and",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"freenect.sync_get_video",
"numpy.array",
"cv2.getTrackbarPos",
"cv2.destroyAllWindows",
"cv2.inRange",
"cv2.namedWindow"
] | [((249, 274), 'cv2.namedWindow', 'cv2.namedWindow', (['"""result"""'], {}), "('result')\n", (264, 274), False, 'import cv2\n'), ((377, 430), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""hmin"""', '"""result"""', '(0)', '(179)', 'nothing'], {}), "('hmin', 'result', 0, 179, nothing)\n", (395, 430), False, 'import cv... |
"""
This software is an implementation of
Deep MRI brain extraction: A 3D convolutional neural network for skull stripping
You can download the paper at http://dx.doi.org/10.1016/j.neuroimage.2016.01.024
If you use this software for your projects please cite:
Kleesiek and Urban et al, Deep MRI brain extraction: A ... | [
"numpy.float32",
"theano.function"
] | [((3087, 3158), 'theano.function', 'theano.function', (['[cnn.x, cnn.y]', '([cnn.output_layer_Loss] + regularizers)'], {}), '([cnn.x, cnn.y], [cnn.output_layer_Loss] + regularizers)\n', (3102, 3158), False, 'import theano\n'), ((2905, 2922), 'numpy.float32', 'np.float32', (['(1e-05)'], {}), '(1e-05)\n', (2915, 2922), T... |
# AUTOGENERATED! DO NOT EDIT! File to edit: dev/04_data_augmentation.ipynb (unless otherwise specified).
__all__ = ['Rescale', 'RandomCrop', 'ToTensor', 'Normalize', 'RandomHorizontalFlip', 'AddRandomBrightness']
# Cell
import numpy as np
import matplotlib.pyplot as plt
import cv2
from torchvision import transforms... | [
"numpy.random.uniform",
"numpy.asarray",
"numpy.random.randint",
"skimage.transform.resize",
"numpy.random.rand",
"cv2.flip",
"numpy.ndarray"
] | [((1334, 1373), 'skimage.transform.resize', 'transform.resize', (['image', '(new_h, new_w)'], {}), '(image, (new_h, new_w))\n', (1350, 1373), False, 'from skimage import io, transform\n'), ((2244, 2274), 'numpy.random.randint', 'np.random.randint', (['(curr_w - w1)'], {}), '(curr_w - w1)\n', (2261, 2274), True, 'import... |
# <NAME>
# email: <EMAIL>
import numpy as np
class PCA:
"""
Principal component analysis (PCA) is an unsupervised linear
technique for dimensionality reduction on a data set. PCA computes
the principal directions that maximize the variance of the projected data,
and can compute the principal compo... | [
"numpy.linalg.eig",
"numpy.linalg.svd",
"numpy.mean",
"numpy.diag",
"numpy.cov"
] | [((1602, 1620), 'numpy.mean', 'np.mean', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (1609, 1620), True, 'import numpy as np\n'), ((1835, 1878), 'numpy.linalg.svd', 'np.linalg.svd', (['X_demean'], {'full_matrices': '(True)'}), '(X_demean, full_matrices=True)\n', (1848, 1878), True, 'import numpy as np\n'), ((1996, 2014)... |
import pickle
import cv2
import numpy as np
import torch
from bullet_envs.utils import PY_MUJOCO, env_with_distractor
from SRL4RL import user_path
from SRL4RL.utils.nn_torch import numpy2pytorch, pytorch2numpy
from SRL4RL.utils.utils import createFolder
CWH2WHC = lambda x: x.transpose(1, 2, 0)
NCWH2WHC = lambda x: x... | [
"SRL4RL.utils.nn_torch.numpy2pytorch",
"numpy.random.uniform",
"SRL4RL.utils.nn_torch.pytorch2numpy",
"cv2.imwrite",
"SRL4RL.utils.utils.createFolder",
"numpy.zeros",
"numpy.ones",
"numpy.clip",
"numpy.hstack",
"pickle.load",
"numpy.random.randint",
"numpy.array",
"torch.is_tensor",
"cv2.r... | [((6287, 6317), 'numpy.ones', 'np.ones', (['img.shape', 'np.float32'], {}), '(img.shape, np.float32)\n', (6294, 6317), True, 'import numpy as np\n'), ((380, 396), 'SRL4RL.utils.nn_torch.pytorch2numpy', 'pytorch2numpy', (['x'], {}), '(x)\n', (393, 396), False, 'from SRL4RL.utils.nn_torch import numpy2pytorch, pytorch2nu... |
from typing import Dict, List
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
def sns_displot(d, label, **kwds):
sns.distplot(d, hist=True, kde=False,
bins=int(180/5),
# color = 'darkblue',
label=label,
hist_kws={'edgecolor':'black'},
kde_kws={'l... | [
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.array",
"matplotlib.pyplot.savefig"
] | [((867, 879), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (877, 879), True, 'import matplotlib.pyplot as plt\n'), ((884, 922), 'matplotlib.pyplot.savefig', 'plt.savefig', (['path'], {'bbox_inches': '"""tight"""'}), "(path, bbox_inches='tight')\n", (895, 922), True, 'import matplotlib.pyplot as plt\n'), ... |
#!/usr/bin/env python
# coding: utf-8
import os
import torch
import torch.nn.functional as F
from torch_geometric.data import DataLoader
from torch_geometric.transforms import OneHotDegree
import argparse
import numpy as np
import time
import yaml
from models.model_cycles import SMP
from models.gin import GIN
from dat... | [
"wandb.log",
"os.mkdir",
"yaml.load",
"os.remove",
"numpy.random.seed",
"argparse.ArgumentParser",
"models.ring_gnn.RingGNN",
"models.utils.transforms.DenseAdjMatrix",
"os.path.join",
"torch.load",
"models.gin.GIN",
"torch.nn.functional.nll_loss",
"easydict.EasyDict",
"torch.cuda.set_devic... | [((634, 662), 'os.path.isdir', 'os.path.isdir', (['"""/datasets2/"""'], {}), "('/datasets2/')\n", (647, 662), False, 'import os\n'), ((858, 878), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (875, 878), False, 'import torch\n'), ((879, 896), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0... |
import os
import random
import numpy as np
import pandas as pd
import logging
import torch
from tqdm import tqdm
logger = logging.getLogger(__name__)
class Example(object):
"""A single training/test example."""
def __init__(self,
idx,
source,
... | [
"tqdm.tqdm",
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed",
"pandas.read_json",
"random.seed",
"logging.getLogger"
] | [((133, 160), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (150, 160), False, 'import logging\n'), ((539, 573), 'pandas.read_json', 'pd.read_json', (['filename'], {'lines': '(True)'}), '(filename, lines=True)\n', (551, 573), True, 'import pandas as pd\n'), ((3657, 3674), 'random.seed', ... |
from PIL import Image
import numpy as np
import tensorflow as tf
class Utilities(object):
"""docstring for ClassName"""
def __init__(self, file_path):
super(Utilities, self).__init__()
self.file_path = file_path
self.image_height = 28
self.image_size = (self.image_height, self.image_height)
... | [
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.argmax",
"tensorflow.global_variables_initializer",
"numpy.asarray",
"tensorflow.constant",
"PIL.Image.open",
"tensorflow.placeholder",
"tensorflow.multiply",
"tensorflow.Variable",
"tensorflow.nn.max_pool",
"tensorflow.nn.conv2d",
... | [((335, 408), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, self.image_height * self.image_height]'], {}), '(tf.float32, [None, self.image_height * self.image_height])\n', (349, 408), True, 'import tensorflow as tf\n'), ((467, 504), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[Non... |
"""
Contains class Image for manipulations of grey-scale images.
# Author: <NAME> (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import division
from builtins import zip
from builtins import str
from past.utils import old_div
__version__ = "$Revision$"
imp... | [
"numpy.minimum",
"past.utils.old_div",
"numpy.zeros",
"numpy.where",
"numpy.array",
"builtins.zip",
"builtins.str"
] | [((3494, 3542), 'numpy.zeros', 'numpy.zeros', ([], {'shape': 'self.data.shape', 'dtype': '"""bool"""'}), "(shape=self.data.shape, dtype='bool')\n", (3505, 3542), False, 'import numpy\n'), ((3906, 3919), 'builtins.zip', 'zip', (['*bad_ind'], {}), '(*bad_ind)\n', (3909, 3919), False, 'from builtins import zip\n'), ((4041... |
from src.ner.datareader import y1_set, y2_set
from src.ner.baseline_loader import entity_list
import torch
import torch.nn as nn
from tqdm import tqdm
import numpy as np
import logging
logger = logging.getLogger()
from src.conll2002_metrics import *
O_INDEX = y1_set.index("O")
B_INDEX = y1_set.index("B-Entity")
I_I... | [
"numpy.concatenate",
"torch.LongTensor",
"torch.argmax",
"torch.nn.CrossEntropyLoss",
"src.ner.datareader.y1_set.index",
"torch.nonzero",
"numpy.mean",
"src.ner.datareader.y2_set.index",
"logging.getLogger"
] | [((196, 215), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (213, 215), False, 'import logging\n'), ((264, 281), 'src.ner.datareader.y1_set.index', 'y1_set.index', (['"""O"""'], {}), "('O')\n", (276, 281), False, 'from src.ner.datareader import y1_set, y2_set\n'), ((292, 316), 'src.ner.datareader.y1_set.i... |
import os.path as osp
import numpy as np
import random
import matplotlib.pyplot as plt
import torchvision
from torch.utils import data
from PIL import Image
Image.MAX_IMAGE_PIXELS = None # Disable DecompressionBombError
import os
class imagenetDataset(data.Dataset):
def __init__(self, root='/home/gabriel/data/ima... | [
"matplotlib.pyplot.show",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.imshow",
"numpy.asarray",
"numpy.transpose",
"PIL.Image.open",
"torchvision.utils.make_grid",
"random.random",
"numpy.array",
"numpy.take",
"os.path.join",
"os.listdir"
] | [((5734, 5768), 'torch.utils.data.DataLoader', 'data.DataLoader', (['dst'], {'batch_size': '(4)'}), '(dst, batch_size=4)\n', (5749, 5768), False, 'from torch.utils import data\n'), ((974, 999), 'os.path.join', 'osp.join', (['self.root', 'name'], {}), '(self.root, name)\n', (982, 999), True, 'import os.path as osp\n'), ... |
#!/usr/bin/env python
"""
Example of running nessai with bilby on a gravitational wave likelihood. This
examples includes all 15 parameters for CBC and should take around 2 hours to
run.
Based on the Bilby example: https://git.ligo.org/lscsoft/bilby
"""
import bilby
import numpy as np
outdir = './outdir/'
label = 'f... | [
"bilby.gw.likelihood.GravitationalWaveTransient",
"numpy.random.seed",
"bilby.core.utils.setup_logger",
"bilby.core.prior.Uniform",
"bilby.gw.waveform_generator.WaveformGenerator",
"bilby.gw.prior.BBHPriorDict",
"bilby.gw.detector.InterferometerList"
] | [((337, 415), 'bilby.core.utils.setup_logger', 'bilby.core.utils.setup_logger', ([], {'outdir': 'outdir', 'label': 'label', 'log_level': '"""WARNING"""'}), "(outdir=outdir, label=label, log_level='WARNING')\n", (366, 415), False, 'import bilby\n'), ((459, 481), 'numpy.random.seed', 'np.random.seed', (['(151226)'], {}),... |
import numpy as np
def crop_and_pad(img, r_offset, c_offset):
img = img[:img.shape[0] - r_offset, :img.shape[1] - c_offset]
return np.pad(img, ((0, r_offset), (c_offset, 0)), 'constant', constant_values=0)
def get_cross_correlation(img1, img2, r_offset, c_offset):
if (r_offset != 0) or (c_offset != 0):
... | [
"numpy.pad",
"numpy.sum"
] | [((141, 215), 'numpy.pad', 'np.pad', (['img', '((0, r_offset), (c_offset, 0))', '"""constant"""'], {'constant_values': '(0)'}), "(img, ((0, r_offset), (c_offset, 0)), 'constant', constant_values=0)\n", (147, 215), True, 'import numpy as np\n'), ((383, 402), 'numpy.sum', 'np.sum', (['(img1 * img2)'], {}), '(img1 * img2)... |
from __future__ import print_function, division
import glob as gb
import gzip as gz
import numpy as np
import scipy as sp
import scipy.ndimage as snd
import scipy.interpolate as si
from sys import stdout
from tqdm import tqdm
def replacement_gradient(x):
diff = np.diff(x)
out = np.zeros(x.shape)
out[:-1]... | [
"tqdm.tqdm",
"numpy.sum",
"numpy.histogram2d",
"numpy.power",
"numpy.floor",
"numpy.zeros",
"scipy.ndimage.filters.uniform_filter",
"numpy.diff",
"numpy.arange",
"numpy.loadtxt",
"numpy.array"
] | [((269, 279), 'numpy.diff', 'np.diff', (['x'], {}), '(x)\n', (276, 279), True, 'import numpy as np\n'), ((290, 307), 'numpy.zeros', 'np.zeros', (['x.shape'], {}), '(x.shape)\n', (298, 307), True, 'import numpy as np\n'), ((1975, 2045), 'numpy.arange', 'np.arange', (['(logT_min - logT_step / 2.0)', '(logT_max + logT_ste... |
"""
deepTorch.py: It implements different deep learning classifiers
Copyright 2016 Observational Health Data Sciences and Informatics
This file is part of PatientLevelPrediction
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You ... | [
"torch.nn.Dropout",
"torch.nn.functional.binary_cross_entropy",
"numpy.sum",
"torch.nn.functional.dropout",
"torch.randn",
"numpy.isnan",
"numpy.shape",
"numpy.mean",
"numpy.arange",
"torch.no_grad",
"os.path.join",
"gensim.models.word2vec.Word2Vec",
"numpy.unique",
"torch.nn.MSELoss",
"... | [((1233, 1266), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1256, 1266), False, 'import warnings\n'), ((2893, 2947), 'torch.nn.functional.binary_cross_entropy', 'F.binary_cross_entropy', (['recon_x', 'x'], {'size_average': '(False)'}), '(recon_x, x, size_average=False)... |
from .dynamic_model import *
from functions.functions import *
from cost.neural_network_cost import NN_Cost
from constraints.constraints import *
from keras import layers
from keras.models import load_model
import keras
import numpy as np
from keras import backend as K
import tensorflow as tf
sess = tf.InteractiveSes... | [
"keras.models.load_model",
"numpy.zeros",
"numpy.array",
"cost.neural_network_cost.NN_Cost",
"tensorflow.initialize_all_variables",
"tensorflow.InteractiveSession"
] | [((303, 326), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (324, 326), True, 'import tensorflow as tf\n'), ((336, 365), 'tensorflow.initialize_all_variables', 'tf.initialize_all_variables', ([], {}), '()\n', (363, 365), True, 'import tensorflow as tf\n'), ((767, 795), 'numpy.zeros', 'np.z... |
#!/usr/bin/env python #
# ------------------------------------------------------------------------------------------------------#
# Created by "<NAME>" at 02:54, 06/12/2019 #
# ... | [
"numpy.abs",
"numpy.sum",
"numpy.sin",
"numpy.exp",
"numpy.cos"
] | [((6767, 6811), 'numpy.exp', 'np.exp', (['(-solution[0] ** 2 - solution[1] ** 2)'], {}), '(-solution[0] ** 2 - solution[1] ** 2)\n', (6773, 6811), True, 'import numpy as np\n'), ((8007, 8026), 'numpy.sin', 'np.sin', (['solution[0]'], {}), '(solution[0])\n', (8013, 8026), True, 'import numpy as np\n'), ((8029, 8048), 'n... |
from functools import partial
from pathlib import Path
import jax.numpy as jnp
import numpy as np
from jax import jit as jjit
from numba import jit as njit
def load_data():
root = Path(__file__).parent
with open(root / "input.txt") as in_file:
data = np.fromstring(in_file.read(), sep=",", dtype=int)... | [
"functools.partial",
"numpy.roll",
"jax.numpy.roll",
"jax.numpy.arange",
"jax.numpy.bincount",
"jax.numpy.asarray",
"pathlib.Path",
"numba.jit",
"numpy.bincount"
] | [((558, 575), 'numba.jit', 'njit', (['proliferate'], {}), '(proliferate)\n', (562, 575), True, 'from numba import jit as njit\n'), ((579, 610), 'functools.partial', 'partial', (['jjit'], {'static_argnums': '(1)'}), '(jjit, static_argnums=1)\n', (586, 610), False, 'from functools import partial\n'), ((389, 428), 'numpy.... |
#!/usr/bin/env python3
import dummy
import numpy
import mysql.connector
from io import BytesIO
# Start a MySQL database via Docker
# docker run -ti --rm --name ohmysql -e MYSQL_ROOT_PASSWORD=mikolov -e MYSQL_DATABASE=embeddings -p 3306:3306 mysql:5.7
def adapt_array(array):
"""
Using the numpy.save functi... | [
"io.BytesIO",
"numpy.save",
"dummy.embeddings",
"numpy.load"
] | [((1352, 1370), 'dummy.embeddings', 'dummy.embeddings', ([], {}), '()\n', (1368, 1370), False, 'import dummy\n'), ((1562, 1580), 'dummy.embeddings', 'dummy.embeddings', ([], {}), '()\n', (1578, 1580), False, 'import dummy\n'), ((565, 574), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (572, 574), False, 'from io import By... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2009 Prof. <NAME> (<EMAIL>) and the
# RMG Team (<EMAIL>)
#
# Permission is hereby granted, free of charge, to any person o... | [
"os.path.abspath",
"unittest.TextTestRunner",
"numpy.min",
"numpy.array",
"rmgpy.cantherm.CanTherm"
] | [((2365, 2398), 'numpy.array', 'numpy.array', (['Vlist', 'numpy.float64'], {}), '(Vlist, numpy.float64)\n', (2376, 2398), False, 'import numpy\n'), ((2741, 2751), 'rmgpy.cantherm.CanTherm', 'CanTherm', ([], {}), '()\n', (2749, 2751), False, 'from rmgpy.cantherm import CanTherm\n'), ((7411, 7447), 'unittest.TextTestRunn... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy as sp
from scipy import stats
from scipy.stats import t, ttest_ind
from pandas import Series, DataFrame
from statsmodels.stats import weightstats as stests
pd.opti... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"matplotlib.pyplot.axvline",
"seaborn.pointplot",
"seaborn.set_context",
"matplotlib.pyplot.errorbar",
"seaborn.set_style",
"pandas.DataFrame.from_dict",
"seaborn.scatterpl... | [((368, 393), 'pandas.read_csv', 'pd.read_csv', (['"""movies.csv"""'], {}), "('movies.csv')\n", (379, 393), True, 'import pandas as pd\n'), ((1284, 1326), 'pandas.to_numeric', 'pd.to_numeric', (["df['Date']"], {'errors': '"""coerce"""'}), "(df['Date'], errors='coerce')\n", (1297, 1326), True, 'import pandas as pd\n'), ... |
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.font_manager import FontProperties
colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k', 'w']
fig, ax = plt.subplots(figsize=(8, 8))
bar_width = 0.35
def create_figure(title):
fig.suptitle('Classification: ' + title)
plt.show(block=False)
def create... | [
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.font_manager.FontProperties",
"matplotlib.pyplot.show"
] | [((163, 191), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (175, 191), True, 'import matplotlib.pyplot as plt\n'), ((286, 307), 'matplotlib.pyplot.show', 'plt.show', ([], {'block': '(False)'}), '(block=False)\n', (294, 307), True, 'import matplotlib.pyplot as plt\n'),... |
"""
Testing parallel evaluations.
"""
import sys
import numpy as np
import pytest
import qibo
from qibo import gates
from qibo.models import Circuit, QFT
from qibo.parallel import parallel_parametrized_execution, parallel_execution
def is_parallel_supported(backend_name): # pragma: no cover
if "GPU" in qibo.get_... | [
"numpy.random.uniform",
"numpy.random.seed",
"qibo.get_threads",
"qibo.gates.CZ",
"qibo.set_threads",
"qibo.get_device",
"qibo.get_backend",
"qibo.models.Circuit",
"qibo.parallel.parallel_parametrized_execution",
"pytest.skip",
"qibo.models.QFT",
"numpy.random.random",
"qibo.gates.RY",
"nu... | [((654, 671), 'qibo.get_device', 'qibo.get_device', ([], {}), '()\n', (669, 671), False, 'import qibo\n'), ((691, 709), 'qibo.get_backend', 'qibo.get_backend', ([], {}), '()\n', (707, 709), False, 'import qibo\n'), ((930, 948), 'qibo.get_threads', 'qibo.get_threads', ([], {}), '()\n', (946, 948), False, 'import qibo\n'... |
from PIL import Image, ImageOps
import tensorflow as tf
import cv2
import numpy as np
import os
import sys
label = ''
frame = None
def import_and_predict(image_data, model):
size = (75,75)
image = ImageOps.fit(image_data, size, Image.ANTIALIAS)
image = image.convert('RGB')
... | [
"cv2.resize",
"tensorflow.keras.models.load_model",
"cv2.putText",
"PIL.ImageOps.fit",
"numpy.argmax",
"cv2.imwrite",
"numpy.asarray",
"cv2.waitKey",
"cv2.imshow",
"PIL.Image.open",
"cv2.VideoCapture",
"cv2.destroyAllWindows",
"sys.exit"
] | [((536, 578), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""CVA1210.hdf5"""'], {}), "('CVA1210.hdf5')\n", (562, 578), True, 'import tensorflow as tf\n'), ((591, 610), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (607, 610), False, 'import cv2\n'), ((1478, 1501), 'cv2.destr... |
import glob
import numpy as np
from scipy.interpolate import PchipInterpolator
from matplotlib import pyplot as plt
plt.style.use("../template.mplstyle")
# purple - green - darkgoldenrod - blue - red
colors = ['purple', '#306B37', 'darkgoldenrod', '#3F7BB6', '#BF4145']
linestyles = [(0, (1,1.05)), (0, (3, 1, 1, 1)), (... | [
"matplotlib.pyplot.subplot",
"scipy.interpolate.PchipInterpolator",
"numpy.sum",
"numpy.abs",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.axis",
"numpy.cumsum",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.histogram",
"numpy.loadtxt",
"nump... | [((116, 153), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""../template.mplstyle"""'], {}), "('../template.mplstyle')\n", (129, 153), True, 'from matplotlib import pyplot as plt\n'), ((771, 817), 'numpy.loadtxt', 'np.loadtxt', (['"""IllustrisTNG_z4.txt"""'], {'unpack': '(True)'}), "('IllustrisTNG_z4.txt', unpac... |
import itertools
import numpy as np
import pandas as pd
import os
import time
import random
import pickle
from ELM import ELMClassifier
import pickle
from sklearn.ensemble import StackingClassifier
from sklearn.linear_model import LogisticRegression
from NeuralNetwork import NeuralNetwork
from sklearn.preprocessing... | [
"os.path.abspath",
"random.randint",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.dtype",
"numpy.transpose",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.model_selection.KFold",
"sklearn.linear_model.LogisticRegression",
"numpy.arange",
"ELM.ELMClassifier",
"NeuralNe... | [((2334, 2372), 'os.path.join', 'os.path.join', (['path', 'features_file_name'], {}), '(path, features_file_name)\n', (2346, 2372), False, 'import os\n'), ((3761, 3819), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'n_splits', 'random_state': 'None', 'shuffle': '(False)'}), '(n_splits=n_splits, random_st... |
import os
import glob
import copy
import random
import numpy as np
from scipy.stats import binned_statistic
import matplotlib.pyplot as plt
import scipy.io as scio
#######################################
#######################################
import sys
sys.path.append('../../../')
from affpose.YCB import cfg a... | [
"sys.path.append",
"matplotlib.pyplot.xlim",
"affpose.YCB.utils.dataset.ycb_dataset_utils.map_obj_id_to_name",
"scipy.io.loadmat",
"numpy.std",
"numpy.nonzero",
"numpy.sort",
"matplotlib.pyplot.figure",
"numpy.mean",
"glob.glob",
"numpy.argwhere",
"matplotlib.pyplot.ylabel",
"affpose.YCB.uti... | [((261, 289), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (276, 289), False, 'import sys\n'), ((1255, 1281), 'numpy.nonzero', 'np.nonzero', (['pred_class_ids'], {}), '(pred_class_ids)\n', (1265, 1281), True, 'import numpy as np\n'), ((584, 604), 'glob.glob', 'glob.glob', (['file_... |
import base64
import cv2 as cv
import cv2
import numpy as np
def byte_to_image(string_byte):
jpg_original = base64.b64decode(string_byte)
jpg_as_np = np.frombuffer(jpg_original, dtype=np.uint8)
img = cv2.imdecode(jpg_as_np, flags=1)
return img
def unsharp_mask(image, kernel_size=(5, 5), sigma=1.0, ... | [
"cv2.GaussianBlur",
"numpy.absolute",
"cv2.imwrite",
"numpy.frombuffer",
"cv2.imdecode",
"numpy.zeros",
"numpy.ones",
"base64.b64decode",
"cv2.imencode",
"numpy.copyto",
"numpy.fromstring"
] | [((1289, 1335), 'numpy.fromstring', 'np.fromstring', (['sharpened_image2'], {'dtype': '"""uint8"""'}), "(sharpened_image2, dtype='uint8')\n", (1302, 1335), True, 'import numpy as np\n'), ((1375, 1412), 'cv2.imdecode', 'cv2.imdecode', (['x', 'cv2.IMREAD_UNCHANGED'], {}), '(x, cv2.IMREAD_UNCHANGED)\n', (1387, 1412), Fals... |
import numpy as np
class Threshold:
def __init__(self, unit, axis, col, is_continue):
self.unit_ = unit
self.axis_ = axis
self.is_continue_ = is_continue
self.col_ = col
def get_cost(self, y, condition):
cost_true = 1
cost_false = 1
y_true = y[condition]
y_false = y[~condition]
... | [
"numpy.sum",
"numpy.power",
"numpy.transpose",
"numpy.isnan",
"numpy.unique"
] | [((516, 528), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (525, 528), True, 'import numpy as np\n'), ((549, 570), 'numpy.sum', 'np.sum', (['(y_true == uni)'], {}), '(y_true == uni)\n', (555, 570), True, 'import numpy as np\n'), ((591, 613), 'numpy.sum', 'np.sum', (['(y_false == uni)'], {}), '(y_false == uni)\n',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Common filters used in signal processing
These filters can be useful to smooth signal trajectories.
"""
import numpy as np
from scipy.signal import butter, lfilter
__author__ = "<NAME>"
__copyright__ = "Copyright 2018, PyRoboLearn"
__credits__ = ["<NAME>"]
__license_... | [
"scipy.signal.lfilter",
"numpy.ones",
"scipy.signal.butter"
] | [((871, 911), 'scipy.signal.butter', 'butter', (['order', '[low, high]'], {'btype': '"""band"""'}), "(order, [low, high], btype='band')\n", (877, 911), False, 'from scipy.signal import butter, lfilter\n'), ((1063, 1082), 'scipy.signal.lfilter', 'lfilter', (['b', 'a', 'data'], {}), '(b, a, data)\n', (1070, 1082), False,... |
import pandas as pd
import numpy as np
import warnings
class Eda():
def __init__(self, data):
self.data = data
self.config = {'threshold': {
'skewness': 20,
'cardinality': 50,
'correlati... | [
"pandas.DataFrame",
"numpy.count_nonzero",
"pandas.Series"
] | [((3076, 3094), 'pandas.Series', 'pd.Series', (['summary'], {}), '(summary)\n', (3085, 3094), True, 'import pandas as pd\n'), ((3932, 3959), 'numpy.count_nonzero', 'np.count_nonzero', (['df.values'], {}), '(df.values)\n', (3948, 3959), True, 'import numpy as np\n'), ((3654, 3668), 'pandas.DataFrame', 'pd.DataFrame', ([... |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 15 10:03:33 2018
测试对网格数据对象的操作
@author: chens
"""
import numpy as np
import matplotlib.pyplot as plt
from geoist.pfm import grdio
from geoist.pfm import pftrans
grd1=grdio.grddata()
grd1.load_surfer(r'D:\demo\demogrid.grd')
if np.ma.is_masked(grd1.data):
grd1.fill_n... | [
"matplotlib.pyplot.imshow",
"numpy.ma.masked_equal",
"geoist.pfm.pftrans.upcontinue",
"numpy.ma.is_masked",
"geoist.pfm.grdio.grddata"
] | [((217, 232), 'geoist.pfm.grdio.grddata', 'grdio.grddata', ([], {}), '()\n', (230, 232), False, 'from geoist.pfm import grdio\n'), ((278, 304), 'numpy.ma.is_masked', 'np.ma.is_masked', (['grd1.data'], {}), '(grd1.data)\n', (293, 304), True, 'import numpy as np\n'), ((505, 548), 'geoist.pfm.pftrans.upcontinue', 'pftrans... |
import os
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
import logging
from slicer.util import setSliceViewerLayers
import numpy as np
import SimpleITK as sitk
import sitkUtils
#
# SyntheticCTEvaluation
#
class SyntheticCTEvaluation(ScriptedLoadableModule):
"""Uses Scripte... | [
"numpy.abs",
"qt.QPushButton",
"sitkUtils.PushVolumeToSlicer",
"slicer.mrmlScene.AddNewNodeByClass",
"numpy.arange",
"slicer.modules.plots.logic",
"slicer.util.setSliceViewerLayers",
"SimpleITK.LabelMapToBinary",
"slicer.app.layoutManager",
"slicer.util.getNode",
"SimpleITK.GetArrayFromImage",
... | [((1927, 1953), 'ctk.ctkCollapsibleButton', 'ctk.ctkCollapsibleButton', ([], {}), '()\n', (1951, 1953), False, 'import vtk, qt, ctk, slicer\n'), ((2138, 2181), 'qt.QFormLayout', 'qt.QFormLayout', (['parametersCollapsibleButton'], {}), '(parametersCollapsibleButton)\n', (2152, 2181), False, 'import vtk, qt, ctk, slicer\... |
import matplotlib.pyplot as plt
import numpy as np
import numpy.random as npr
import torch as torch
def make_data_gap(seed, data_count=100):
import GPy
npr.seed(0)
x = np.hstack([np.linspace(-5, -2, int(data_count/2)), np.linspace(2, 5, int(data_count/2))])
x = x[:, np.newaxis]
k = GPy.kern.RBF(in... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"numpy.std",
"torch.FloatTensor",
"numpy.mean",
"numpy.sin",
"GPy.kern.RBF",
"numpy.linspace",
"numpy.eye",
"matplotlib.pyplot.pause",
"numpy.sqrt"
] | [((162, 173), 'numpy.random.seed', 'npr.seed', (['(0)'], {}), '(0)\n', (170, 173), True, 'import numpy.random as npr\n'), ((305, 361), 'GPy.kern.RBF', 'GPy.kern.RBF', ([], {'input_dim': '(1)', 'variance': '(1.0)', 'lengthscale': '(1.0)'}), '(input_dim=1, variance=1.0, lengthscale=1.0)\n', (317, 361), False, 'import GPy... |
import numpy as np
from environment import Environment
import sys
def get_epsilon_greedy_policy(Q, epsilon, num_actions):
def policyFunction(observation):
A = np.ones(num_actions, dtype=float) * epsilon / num_actions
best_action = np.argmax(Q[observation])
A[best_action] += (1.0 - epsi... | [
"numpy.argmax",
"numpy.zeros",
"numpy.ones",
"numpy.max",
"environment.Environment"
] | [((473, 516), 'numpy.zeros', 'np.zeros', (['(env.num_states, env.num_actions)'], {}), '((env.num_states, env.num_actions))\n', (481, 516), True, 'import numpy as np\n'), ((1208, 1232), 'numpy.zeros', 'np.zeros', (['env.num_states'], {}), '(env.num_states)\n', (1216, 1232), True, 'import numpy as np\n'), ((1314, 1357), ... |
import numpy as np
import tensorflow as tf
data = np.load("./cifar-10-test-data.npz")
labels = data.f.labels
data = data.f.data
w = tf.io.TFRecordWriter("./cifar-10-test-data.tfrecords")
for i in range(10000):
example = tf.train.Example(
features=tf.train.Features(
feature={
... | [
"numpy.load",
"tensorflow.train.Int64List",
"tensorflow.reshape",
"tensorflow.decode_raw",
"tensorflow.parse_single_example",
"tensorflow.FixedLenFeature",
"tensorflow.io.TFRecordWriter"
] | [((52, 87), 'numpy.load', 'np.load', (['"""./cifar-10-test-data.npz"""'], {}), "('./cifar-10-test-data.npz')\n", (59, 87), True, 'import numpy as np\n'), ((136, 190), 'tensorflow.io.TFRecordWriter', 'tf.io.TFRecordWriter', (['"""./cifar-10-test-data.tfrecords"""'], {}), "('./cifar-10-test-data.tfrecords')\n", (156, 190... |
import sys
import petsc4py
petsc4py.init(sys.argv)
# from scipy.io import savemat, loadmat
# from src.ref_solution import *
# import warnings
# from memory_profiler import profile
# from time import time
import pickle
import numpy as np
from src import stokes_flow as sf
from src.stokes_flow import problem_dic, obj_di... | [
"numpy.sum",
"petsc4py.init",
"petsc4py.PETSc.Vec",
"petsc4py.PETSc.Scatter",
"petsc4py.PETSc.Options",
"numpy.array"
] | [((28, 51), 'petsc4py.init', 'petsc4py.init', (['sys.argv'], {}), '(sys.argv)\n', (41, 51), False, 'import petsc4py\n'), ((823, 838), 'petsc4py.PETSc.Options', 'PETSc.Options', ([], {}), '()\n', (836, 838), False, 'from petsc4py import PETSc\n'), ((1229, 1244), 'petsc4py.PETSc.Options', 'PETSc.Options', ([], {}), '()\n... |
import os
import numpy as np
import basicIO as bio
import random
def writeRTFile(filename, R, T, S=None):
with open(filename, 'w') as fp:
fp.write('%f %f %f %f %f %f %f %f %f\n' % (
R[0, 0], R[0, 1], R[0, 2],
R[1, 0], R[1, 1], R[1, 2],
R[2, 0], R[2, 1], R[2, 2]... | [
"numpy.argmax",
"random.sample",
"numpy.power",
"numpy.zeros",
"numpy.identity",
"numpy.linalg.eigh",
"basicIO.readFloatLines",
"numpy.linalg.svd",
"random.seed",
"numpy.linalg.norm",
"numpy.linalg.matrix_rank",
"numpy.array",
"numpy.linalg.det",
"numpy.diag",
"numpy.matmul",
"os.path.... | [((588, 613), 'numpy.linalg.norm', 'np.linalg.norm', (['diffPoint'], {}), '(diffPoint)\n', (602, 613), True, 'import numpy as np\n'), ((880, 894), 'numpy.identity', 'np.identity', (['(3)'], {}), '(3)\n', (891, 894), True, 'import numpy as np\n'), ((908, 919), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (916, 919... |
"""
Author: <NAME>
Date: October 1, 2020
Email: <EMAIL>
Scope: App for Tensorflow Image classifier
"""
import numpy as np
from loguru import logger
from PIL import Image
from io import BytesIO
import tensorflow as tf
from tensorflow.keras.applications.imagenet_utils import decode_predictions
class DoggoModel(obje... | [
"tensorflow.keras.applications.imagenet_utils.decode_predictions",
"numpy.expand_dims",
"loguru.logger.info",
"loguru.logger.debug",
"tensorflow.keras.applications.MobileNetV2"
] | [((438, 491), 'tensorflow.keras.applications.MobileNetV2', 'tf.keras.applications.MobileNetV2', ([], {'weights': '"""imagenet"""'}), "(weights='imagenet')\n", (471, 491), True, 'import tensorflow as tf\n'), ((540, 576), 'loguru.logger.debug', 'logger.debug', (['"""Pre-processing image"""'], {}), "('Pre-processing image... |
from typing import List
import random
import pyrosetta
import rosetta
import yaml
from pyrosetta.rosetta.core.scoring.dssp import Dssp
from pyrosetta.rosetta.core.fragment import *
from pyrosetta import *
from pyrosetta.rosetta.protocols import *
from scipy.spatial import distance
import Levenshtein as levenshtein
imp... | [
"pyrosetta.init",
"pandas.DataFrame",
"yaml.load",
"pyrosetta.create_score_function",
"pandas.read_csv",
"numpy.empty",
"pyrosetta.SwitchResidueTypeSetMover",
"pyrosetta.MoveMap",
"pyrosetta.rosetta.protocols.simple_moves.ClassicFragmentMover",
"random.random",
"numpy.linalg.norm",
"pyrosetta.... | [((2974, 3021), 'pyrosetta.SwitchResidueTypeSetMover', 'pyrosetta.SwitchResidueTypeSetMover', (['"""centroid"""'], {}), "('centroid')\n", (3009, 3021), False, 'import pyrosetta\n'), ((3047, 3097), 'pyrosetta.SwitchResidueTypeSetMover', 'pyrosetta.SwitchResidueTypeSetMover', (['"""fa_standard"""'], {}), "('fa_standard')... |
import matplotlib.pyplot as plt
import matplotlib.patheffects as PathEffects
import seaborn as sns
import torch
import numpy as np
import sklearn
from sklearn.manifold import TSNE
from sklearn.datasets import load_digits
from sklearn.preprocessing import scale
# We'll hack a bit with the t-SNE code in sklearn 0.15.... | [
"seaborn.set_style",
"matplotlib.pyplot.subplot",
"sklearn.manifold.TSNE",
"matplotlib.pyplot.figure",
"numpy.array",
"seaborn.set_palette",
"seaborn.set_context",
"matplotlib.pyplot.savefig"
] | [((650, 675), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (663, 675), True, 'import seaborn as sns\n'), ((680, 704), 'seaborn.set_palette', 'sns.set_palette', (['"""muted"""'], {}), "('muted')\n", (695, 704), True, 'import seaborn as sns\n'), ((709, 781), 'seaborn.set_context', 'sn... |
#!/usr/bin/env python3
"""
Multi-compartmental OLM cell example
File: olm-example.py
Copyright 2021 NeuroML contributors
Authors: <NAME>, <NAME>
"""
from neuroml import (NeuroMLDocument, IncludeType, Population, PulseGenerator, ExplicitInput, Network, SegmentGroup, Member, Property, Include, Instance, Location)
from... | [
"CellBuilder.create_cell",
"CellBuilder.set_init_memb_potential",
"CellBuilder.set_resistivity",
"neuroml.ExplicitInput",
"neuroml.PulseGenerator",
"numpy.loadtxt",
"CellBuilder.set_specific_capacitance",
"neuroml.Property",
"neuroml.Network",
"pyneuroml.pynml.run_lems_with_jneuroml_neuron",
"py... | [((767, 840), 'pyneuroml.lems.LEMSSimulation', 'LEMSSimulation', ([], {'sim_id': 'sim_id', 'duration': '(600)', 'dt': '(0.01)', 'simulation_seed': '(123)'}), '(sim_id=sim_id, duration=600, dt=0.01, simulation_seed=123)\n', (781, 840), False, 'from pyneuroml.lems import LEMSSimulation\n'), ((2956, 3062), 'pyneuroml.pynm... |
import sys
import os
import numpy
import soundfile
import librosa
from PIL import Image
def main():
d = sys.argv[1]
files = (os.path.join(d, f) for f in os.listdir(d) if os.path.splitext(f)[1] in (".png", ".jpg"))
for f in files:
print(f)
y = img_to_audio(f)
out_f = os.path.splitex... | [
"numpy.abs",
"PIL.Image.open",
"librosa.istft",
"numpy.array",
"os.path.splitext",
"soundfile.write",
"os.path.join",
"os.listdir"
] | [((500, 519), 'librosa.istft', 'librosa.istft', (['spec'], {}), '(spec)\n', (513, 519), False, 'import librosa\n'), ((135, 153), 'os.path.join', 'os.path.join', (['d', 'f'], {}), '(d, f)\n', (147, 153), False, 'import os\n'), ((345, 377), 'soundfile.write', 'soundfile.write', (['out_f', 'y', '(22050)'], {}), '(out_f, y... |
import numpy as np
from scipy.spatial.distance import cosine as cosine
class Evaluator(object):
def __init__(self,
query_dict_fn,
gallery_dict_fn,
topks=[3, 5, 10],
extract_feature=False):
"""Create the empty array to count
Args... | [
"numpy.argsort",
"numpy.array"
] | [((1888, 1908), 'numpy.array', 'np.array', (['query_dist'], {}), '(query_dist)\n', (1896, 1908), True, 'import numpy as np\n'), ((1926, 1948), 'numpy.argsort', 'np.argsort', (['query_dist'], {}), '(query_dist)\n', (1936, 1948), True, 'import numpy as np\n'), ((3419, 3439), 'numpy.array', 'np.array', (['query_dist'], {}... |
#! /usr/bin/env python
"""
Module with post-processing related functions called from within the NFC
algorithm.
"""
__author__ = '<NAME>'
__all__ = ['cube_planet_free']
import numpy as np
from ..metrics import cube_inject_companions
import math
from matplotlib.pyplot import plot, xlim, ylim, axes, gca, show
def cub... | [
"numpy.arctan2",
"numpy.amin",
"matplotlib.pyplot.axes",
"numpy.mean",
"numpy.sin",
"matplotlib.pyplot.gca",
"numpy.zeros_like",
"math.radians",
"numpy.linspace",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"numpy.mod",
"numpy.cos",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.pl... | [((1573, 1592), 'numpy.zeros_like', 'np.zeros_like', (['cube'], {}), '(cube)\n', (1586, 1592), True, 'import numpy as np\n'), ((1617, 1643), 'numpy.array', 'np.array', (['planet_parameter'], {}), '(planet_parameter)\n', (1625, 1643), True, 'import numpy as np\n'), ((4188, 4219), 'numpy.linspace', 'np.linspace', (['(0)'... |
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
import settings
import datetime
import random
import time
import gym
import os
from keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten, Input, concatenate
from keras.models import Model, load_model, Sequential
from keras.initiali... | [
"numpy.load",
"matplotlib.style.use",
"matplotlib.pyplot.suptitle",
"random.sample",
"keras.models.Model",
"matplotlib.pyplot.figure",
"os.path.isfile",
"numpy.mean",
"keras.layers.Input",
"collections.deque",
"tensorflow.compat.v1.Session",
"keras.utils.plot_model",
"numpy.linspace",
"num... | [((10462, 10473), 'time.time', 'time.time', ([], {}), '()\n', (10471, 10473), False, 'import time\n'), ((10491, 10502), 'time.time', 'time.time', ([], {}), '()\n', (10500, 10502), False, 'import time\n'), ((16979, 16998), 'matplotlib.style.use', 'style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (16988, 16998), False... |
import os
import platform
import sys
from pathlib import Path
import numpy as np
import pandas as pd
import pytest
from imio.load import load_any
from brainreg.cli import main as brainreg_run
test_data_dir = Path(os.getcwd()) / "tests" / "data"
brain_data_dir = test_data_dir / "brain data"
expected_niftyreg_output_... | [
"os.getcwd",
"numpy.testing.assert_allclose",
"pytest.fixture",
"platform.system",
"pytest.mark.parametrize",
"brainreg.cli.main",
"os.path.join"
] | [((626, 657), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (640, 657), False, 'import pytest\n'), ((1176, 1509), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""image"""', "['boundaries.tiff', 'deformation_field_0.tiff', 'deformation_field_1.tiff',\n 'defor... |
from __future__ import annotations
from typing import *
import logging
import random
from itertools import product
from collections import defaultdict
import torch
from torch import nn
import numpy as np
from ..components import *
from ..lm import LanguageModel
from ..util import batch
from .. import util
logger = ... | [
"torch.ones",
"numpy.sum",
"random.shuffle",
"numpy.random.multinomial",
"torch.argsort",
"torch.cat",
"logging.getLogger",
"torch.softmax",
"collections.defaultdict",
"torch.normal",
"torch.exp",
"numpy.array",
"torch.arange",
"torch.zeros",
"torch.no_grad",
"torch.log",
"torch.tens... | [((320, 347), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (337, 347), False, 'import logging\n'), ((5722, 5748), 'torch.cat', 'torch.cat', (['ret_list'], {'dim': '(0)'}), '(ret_list, dim=0)\n', (5731, 5748), False, 'import torch\n'), ((7496, 7537), 'torch.tensor', 'torch.tensor', (['pa... |
import numpy as np
def mutation(exits, locations, mutpb):
"""Mutation that alters the routes of the guides of a single chromosome."""
# Feasible starting cells
# The space the agents are evacuating from has been divided into 3m x 3m cells, and we have checked which of these are feasible.
cells = np.a... | [
"numpy.random.rand",
"numpy.where",
"numpy.array",
"numpy.delete"
] | [((316, 628), 'numpy.array', 'np.array', (['[3, 4, 5, 6, 12, 13, 14, 15, 16, 17, 21, 22, 23, 24, 25, 26, 27, 28, 31, 32,\n 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,\n 52, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 71, 72,\n 73, 74, 75, 76, 77, 78, 82, 83, 84, 85, ... |
from scipy.stats import norm
import numpy as np
import matplotlib.pyplot as plt
def normcdf(x_min=-4, x_max=4, mean=0, std=1, y_max=0.45, xlabel='x', ylabel='pdf(x)', legend_size=12,
lb=-10, ub=10, font_size=20, alpha=1, fill_color='skyblue', bg_color='white',
title='Normal Distribution ', fig... | [
"scipy.stats.norm",
"matplotlib.pyplot.show",
"scipy.stats.norm.pdf",
"numpy.arange",
"matplotlib.pyplot.rc",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((2520, 2562), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(fig_w, fig_l)'}), '(1, 1, figsize=(fig_w, fig_l))\n', (2532, 2562), True, 'import matplotlib.pyplot as plt\n'), ((2600, 2628), 'numpy.arange', 'np.arange', (['x_min', 'x_max', '(0.1)'], {}), '(x_min, x_max, 0.1)\n', (2609, 2628... |
from skimage.io.collection import ImageCollection
from blending import blend_src2dst
import numpy as np
import cv2
size = 7
for i in range(size):
for j in range(size):
src = f'man{i}'
dst = f'man{j}'
img_src, img_dst, _, img_dst_mix_grad, _ = blend_src2dst(src,dst)
if j==0:
... | [
"cv2.imwrite",
"numpy.ones",
"numpy.hstack",
"numpy.vstack",
"blending.blend_src2dst"
] | [((797, 836), 'numpy.vstack', 'np.vstack', (['[img_all_dst, img_all_array]'], {}), '([img_all_dst, img_all_array])\n', (806, 836), True, 'import numpy as np\n'), ((839, 880), 'cv2.imwrite', 'cv2.imwrite', (['"""I2G/vis.jpg"""', 'img_all_array'], {}), "('I2G/vis.jpg', img_all_array)\n", (850, 880), False, 'import cv2\n'... |
import os, glob, functools
import librosa
import torch
from torch.utils.data import Subset, Dataset, DataLoader, random_split, ConcatDataset, SubsetRandomSampler, BatchSampler
import pytorch_lightning as pl
import numpy as np
from diffsynth.f0 import process_f0
def mix_iterable(dl_a, dl_b):
for i, j in zip(dl_a, d... | [
"torch.utils.data.Subset",
"diffsynth.f0.process_f0",
"numpy.random.choice",
"torch.utils.data.BatchSampler",
"functools.partial",
"torch.utils.data.DataLoader",
"torch.load",
"os.path.exists",
"librosa.load",
"torch.utils.data.random_split",
"torch.utils.data.SubsetRandomSampler",
"os.path.jo... | [((778, 809), 'os.path.join', 'os.path.join', (['base_dir', '"""audio"""'], {}), "(base_dir, 'audio')\n", (790, 809), False, 'import os, glob, functools\n'), ((1741, 1806), 'librosa.load', 'librosa.load', (['raw_path'], {'sr': 'self.sample_rate', 'duration': 'self.length'}), '(raw_path, sr=self.sample_rate, duration=se... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 21 10:35:25 2014
@author: eegroopm
"""
import numpy as np
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.lines import Line2D
from matplotlib.patches import Patch, Rectangle, Circle, Ar... | [
"matplotlib.patches.Arrow",
"matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.setSizePolicy",
"PyQt4.QtGui.QSpinBox",
"PyQt4.QtCore.QCoreApplication.instance",
"matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg.__init__",
"PyQt4.QtGui.QLabel",
"numpy.arctan2",
"PyQt4.QtGui.QVBoxLayout",
"PyQt... | [((824, 854), 'PyQt4.QtCore.pyqtSignal', 'pyqtSignal', (['str', 'str', 'str', 'str'], {}), '(str, str, str, str)\n', (834, 854), False, 'from PyQt4.QtCore import pyqtSlot, pyqtSignal\n'), ((3591, 3601), 'PyQt4.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (3599, 3601), False, 'from PyQt4.QtCore import pyqtSlot, pyqtS... |
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('../Data/tmp/mnist/', one_hot=True)
LR = 0.05
numSteps = 30000
batchSize = 256
displaySteps = 1000
examplesToShow = 10
imgSize = 28
numH1 = 256
numH2... | [
"matplotlib.pyplot.show",
"tensorflow.trainable_variables",
"tensorflow.global_variables_initializer",
"numpy.empty",
"matplotlib.pyplot.imshow",
"tensorflow.train.RMSPropOptimizer",
"tensorflow.Session",
"tensorflow.pow",
"tensorflow.placeholder",
"matplotlib.pyplot.figure",
"tensorflow.zeros",... | [((143, 204), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""../Data/tmp/mnist/"""'], {'one_hot': '(True)'}), "('../Data/tmp/mnist/', one_hot=True)\n", (168, 204), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((352, 397), 'tensorflow.placeh... |
import argparse
import pathlib
import mbrl
import mbrl.models
import mbrl.planning
import mbrl.util.common
import mbrl.util.mujoco
import matplotlib.pyplot as plt
import numpy as np
import torch
class Agent_Renderer():
def __init__(self, exp_dir, num_steps):
self.max_steps = num_steps
exp_path = ... | [
"argparse.ArgumentParser",
"numpy.float32",
"mbrl.planning.create_trajectory_optim_agent_for_model",
"pathlib.Path",
"mbrl.util.mujoco.make_env",
"mbrl.util.common.create_one_dim_tr_model",
"torch.Generator",
"mbrl.util.common.load_hydra_cfg"
] | [((2583, 2608), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2606, 2608), False, 'import argparse\n'), ((320, 341), 'pathlib.Path', 'pathlib.Path', (['exp_dir'], {}), '(exp_dir)\n', (332, 341), False, 'import pathlib\n'), ((361, 402), 'mbrl.util.common.load_hydra_cfg', 'mbrl.util.common.load... |
""" Implements a waypoint controller, which controls lateral and longitudinal position of glider. Also adds a
controller wrapper, which wraps control parameters, environment and controller into one object
"""
import numpy as np
from parameters import params_triangle_soaring, params_environment
from parameters.para... | [
"hierarchical_policy.vertex_tracker.params_vertex_tracker.AgentParameters",
"numpy.arctan2",
"parameters.params_triangle_soaring.TaskParameters",
"numpy.clip",
"parameters.params_environment.PhysicsParameters",
"numpy.array",
"hierarchical_policy.vertex_tracker.params_vertex_tracker.ControlParameters",
... | [((1082, 1121), 'hierarchical_policy.vertex_tracker.params_vertex_tracker.AgentParameters', 'params_vertex_tracker.AgentParameters', ([], {}), '()\n', (1119, 1121), False, 'from hierarchical_policy.vertex_tracker import params_vertex_tracker\n'), ((1728, 1745), 'numpy.array', 'np.array', (['[-1, 1]'], {}), '([-1, 1])\n... |
# coding=utf-8
# Copyright 2020 The HuggingFace NLP 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 applicab... | [
"datasets.Value",
"scipy.stats.kendalltau",
"numpy.append",
"numpy.array"
] | [((2812, 2824), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (2820, 2824), True, 'import numpy as np\n'), ((2836, 2848), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (2844, 2848), True, 'import numpy as np\n'), ((2944, 3056), 'scipy.stats.kendalltau', 'kendalltau', ([], {'x': 'prediction', 'y': 'reference',... |
"""
=======================
Twinkling star movie
=======================
An animation of stars twinkling in the Kepler field
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.io import fits
import kepler... | [
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.rcParams.update",
"numpy.array",
"astropy.io.fits.open",
"matplotlib.pyplot.gca",
"kepler_data.load_kepler_data",
"astropy.coordinates.SkyCoord"
] | [((540, 568), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['plotpar'], {}), '(plotpar)\n', (559, 568), True, 'import matplotlib.pyplot as plt\n'), ((707, 767), 'astropy.coordinates.SkyCoord', 'SkyCoord', ([], {'ra': '(ra * u.degree)', 'dec': '(dec * u.degree)', 'frame': '"""icrs"""'}), "(ra=ra * u.degr... |
import os
import numpy as np
from easydict import EasyDict as edict
config = edict()
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
config.TRAIN = edict()
#### below are params for dataiter
config.TRAIN.process_num = 5
config.TRAIN.prefetch_size = 20
############
config.TRAIN.num_gpu = 1
config.TRAIN.batch_size = 128
co... | [
"numpy.array",
"easydict.EasyDict"
] | [((80, 87), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (85, 87), True, 'from easydict import EasyDict as edict\n'), ((145, 152), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (150, 152), True, 'from easydict import EasyDict as edict\n'), ((1016, 1023), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (1021, 1023)... |
import gc
from .Query import QueryMethod, get_unlabeled_idx
import numpy as np
from scipy.spatial import distance_matrix
from keras.models import Model
from keras import backend as K
class CoreSetSampling(QueryMethod):
"""
An implementation of the greedy core set query strategy.
"""
def __init__(sel... | [
"keras.backend.placeholder",
"numpy.argmax",
"gc.collect",
"keras.backend.function",
"keras.models.Model",
"numpy.hstack",
"gurobipy.Model",
"scipy.spatial.distance_matrix",
"numpy.min",
"numpy.where",
"numpy.array",
"numpy.max",
"keras.backend.transpose",
"numpy.random.choice",
"keras.b... | [((1365, 1384), 'numpy.argmax', 'np.argmax', (['min_dist'], {}), '(min_dist)\n', (1374, 1384), True, 'import numpy as np\n'), ((1869, 1893), 'numpy.array', 'np.array', (['greedy_indices'], {}), '(greedy_indices)\n', (1877, 1893), True, 'import numpy as np\n'), ((2170, 2237), 'keras.models.Model', 'Model', ([], {'inputs... |
"""
This module is a plugin to read images from .mat files in napari
"""
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
import dask.array as da
import h5py
import numpy as np
import scipy.io as sio
from pluggy import HookimplMarker
LayerData = Union[Tuple[Any], Tuple[Any, Di... | [
"h5py.File",
"numpy.moveaxis",
"numpy.flip",
"scipy.io.whosmat",
"numpy.argmax",
"pluggy.HookimplMarker",
"scipy.io.loadmat",
"dask.array.moveaxis",
"numpy.insert",
"numpy.any",
"numpy.sort",
"numpy.random.randint",
"numpy.array",
"numpy.random.choice",
"dask.array.from_array",
"numpy.... | [((470, 494), 'pluggy.HookimplMarker', 'HookimplMarker', (['"""napari"""'], {}), "('napari')\n", (484, 494), False, 'from pluggy import HookimplMarker\n'), ((6783, 6796), 'numpy.flip', 'np.flip', (['dims'], {}), '(dims)\n', (6790, 6796), True, 'import numpy as np\n'), ((10612, 10633), 'numpy.argmax', 'np.argmax', (['ar... |
#!/usr/bin/env python
"""
.. module:: shapes
:synopsis: Python functions to create simple shapes from LDraw primitives.
.. moduleauthor:: <NAME>
"""
import math
import numbers
import numpy
import opensdraw.lcad_language.curveFunctions as curveFunctions
import opensdraw.lcad_language.geometry as geometry
import op... | [
"math.sqrt",
"math.radians",
"opensdraw.lcad_language.interpreter.LCadFunction.__init__",
"math.sin",
"opensdraw.lcad_language.interpreter.isTrue",
"numpy.append",
"numpy.array",
"math.cos",
"opensdraw.lcad_language.geometry.rotationMatrixZ",
"numpy.dot"
] | [((2166, 2184), 'math.radians', 'math.radians', (['(22.5)'], {}), '(22.5)\n', (2178, 2184), False, 'import math\n'), ((4050, 4097), 'opensdraw.lcad_language.interpreter.LCadFunction.__init__', 'interpreter.LCadFunction.__init__', (['self', '"""axle"""'], {}), "(self, 'axle')\n", (4083, 4097), True, 'import opensdraw.lc... |
import numpy as np
from NeuralNetwork import NeuralNetwork
import scipy.misc
import time
data_file_train = open(name="../../Downloads/mnist_train.csv", mode="r")
data_list_train = data_file_train.readlines()
data_file_train.close()
# self created image (png) with a number in it
img_array = scipy.misc.imread(name="../... | [
"numpy.argmax",
"numpy.asfarray",
"numpy.zeros",
"time.time",
"NeuralNetwork.NeuralNetwork"
] | [((734, 803), 'NeuralNetwork.NeuralNetwork', 'NeuralNetwork', (['INPUT_NODES', 'HIDDEN_NODES', 'OUTPUT_NODES', 'LEARNING_RATE'], {}), '(INPUT_NODES, HIDDEN_NODES, OUTPUT_NODES, LEARNING_RATE)\n', (747, 803), False, 'from NeuralNetwork import NeuralNetwork\n'), ((1654, 1672), 'numpy.argmax', 'np.argmax', (['outputs'], {... |
"""
Created on Mon Mar 27 21:02:14 2017
@author: Robert
"""
"""
This code creates a number of classification plots with different
penalty parameters, so you can visualise how the algorithm punishes
overfitting. I compiled some images I created into a gif, which can be
found elsewhere in this repo.
"""
import p... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.cla",
"sklearn.svm.SVC",
"sklear... | [((383, 412), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-deep"""'], {}), "('seaborn-deep')\n", (396, 412), True, 'import matplotlib.pyplot as plt\n'), ((584, 621), 'pandas.read_csv', 'pd.read_csv', (['"""Social_Network_Ads.csv"""'], {}), "('Social_Network_Ads.csv')\n", (595, 621), True, 'import panda... |
import numpy as np
def block_augment(sample):
"""Performs contrast/brightness augmentation on img.
Args:
sample: Dictionary of (np array: <ch,z,x,y>) image and mask
"""
l = sample["image"].shape[1]
if np.random.uniform() < 0.2:
r = np.random.rand()
xloc = np.random.randint(l//2-50,l//2+50)
yloc = np.... | [
"numpy.random.rand",
"numpy.random.uniform",
"numpy.random.randint",
"numpy.clip"
] | [((213, 232), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (230, 232), True, 'import numpy as np\n'), ((247, 263), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (261, 263), True, 'import numpy as np\n'), ((273, 316), 'numpy.random.randint', 'np.random.randint', (['(l // 2 - 50)', '(l // 2 +... |
import heapq
import numpy as np
from .matrix_serializer import load_vocabulary
class Embedding:
"""
Base class for all embeddings. SGNS can be directly instantiated with it.
"""
def __init__(self, path, normalize=True):
self.m = np.load(path + '.npy')
if normalize:
... | [
"numpy.load",
"numpy.sum",
"numpy.power",
"numpy.zeros",
"heapq.nlargest",
"numpy.vstack"
] | [((271, 293), 'numpy.load', 'np.load', (["(path + '.npy')"], {}), "(path + '.npy')\n", (278, 293), True, 'import numpy as np\n'), ((1885, 1909), 'numpy.load', 'np.load', (["(path + '.s.npy')"], {}), "(path + '.s.npy')\n", (1892, 1909), True, 'import numpy as np\n'), ((3174, 3212), 'numpy.vstack', 'np.vstack', (['[m_joi... |
from sklearn.cluster import KMeans
import numpy as np
X = np.array([[1, 2], [1, 4], [1, 0],
[4, 2], [4, 4], [4, 0]])
kmeans = KMeans(n_clusters=2, random_state=0).fit(X)
kmeans.labels_
kmeans.predict([[0, 0], [4, 4]])
kmeans.cluster_centers_
| [
"sklearn.cluster.KMeans",
"numpy.array"
] | [((58, 116), 'numpy.array', 'np.array', (['[[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]]'], {}), '([[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]])\n', (66, 116), True, 'import numpy as np\n'), ((140, 176), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(2)', 'random_state': '(0)'}), '(n_clusters=2, rando... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 1 23:32:25 2018
@author: <NAME>
"""
from sympy import *
import numpy as np
from scipy import integrate
import matplotlib
matplotlib.use('TkAgg')
import sys
if sys.version_info[0] < 3:
import Tkinter as Tk
import tkFont
else:
import tki... | [
"scipy.integrate.odeint",
"matplotlib.figure.Figure",
"matplotlib.use",
"numpy.linspace",
"matplotlib.backends.backend_tkagg.NavigationToolbar2TkAgg",
"tkinter",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg"
] | [((193, 216), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (207, 216), False, 'import matplotlib\n'), ((802, 840), 'numpy.linspace', 'np.linspace', (['time[0]', 'time[1]', 'time[2]'], {}), '(time[0], time[1], time[2])\n', (813, 840), True, 'import numpy as np\n'), ((891, 929), 'scipy.integr... |
# Andrei, 2018
"""
Interactive script to view multiple cameras.
sudo python -m pip install --upgrade pip setuptools wheel
sudo /usr/local/bin/pip install opencv-python
"""
from argparse import ArgumentParser
import cv2
import numpy as np
import os
import time
CROSS_COLOR = np.array([0, 0, 255], dtype=np... | [
"cv2.putText",
"argparse.ArgumentParser",
"cv2.waitKey",
"time.time",
"numpy.array",
"os.path.join",
"cv2.resize"
] | [((290, 327), 'numpy.array', 'np.array', (['[0, 0, 255]'], {'dtype': 'np.uint8'}), '([0, 0, 255], dtype=np.uint8)\n', (298, 327), True, 'import numpy as np\n'), ((445, 461), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (459, 461), False, 'from argparse import ArgumentParser\n'), ((1806, 1860), 'os.pat... |
#!/usr/bin/env python
"""
Info: This script uses the pretrained ResNet50 model as a feature extractor to predict sign language letters. It takes the pretrained ResNet50 model and adds new classification layers and trains this model on the ASL corpus consisting of images of English letters depicted in the American Sign ... | [
"matplotlib.pyplot.title",
"tensorflow.keras.preprocessing.image.ImageDataGenerator",
"sklearn.preprocessing.LabelBinarizer",
"argparse.ArgumentParser",
"tensorflow.keras.applications.resnet50.ResNet50",
"tensorflow.keras.layers.Dense",
"numpy.empty",
"matplotlib.pyplot.style.use",
"matplotlib.pyplo... | [((1447, 1465), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (1459, 1465), False, 'import os\n'), ((3418, 3443), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3441, 3443), False, 'import argparse\n'), ((5600, 5674), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""'... |
"""
How to convert a duration table to a survival table, then compute the Kaplan-Meier and
Nelson-Aalen estimates. Accompanies the article at
https://crosstab.io/articles/durations-to-survivals.
"""
import altair as alt
import numpy as np
import pandas as pd
## Load data
durations = pd.read_parquet("data/retailrocke... | [
"numpy.ceil",
"altair.Scale",
"altair.Axis",
"pandas.read_parquet"
] | [((287, 341), 'pandas.read_parquet', 'pd.read_parquet', (['"""data/retailrocket_durations.parquet"""'], {}), "('data/retailrocket_durations.parquet')\n", (302, 341), True, 'import pandas as pd\n'), ((440, 475), 'numpy.ceil', 'np.ceil', (["durations['duration_days']"], {}), "(durations['duration_days'])\n", (447, 475), ... |
import logging
import math
import random
from itertools import count
from typing import Type
import numpy as np
import torch
from collections import namedtuple
from gym import Env, Space, spaces
from torch import nn
from torch import optim
from tqdm import tqdm
from utilities import *
logger = logging.getLogger(__n... | [
"math.isnan",
"math.exp",
"numpy.moveaxis",
"random.sample",
"torch.load",
"logging.getLogger",
"numpy.prod",
"itertools.count",
"random.random",
"numpy.argmin",
"numpy.array",
"collections.namedtuple",
"torch.zeros",
"torch.tensor",
"torch.no_grad",
"numpy.concatenate",
"torch.from_... | [((299, 326), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (316, 326), False, 'import logging\n'), ((341, 410), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('state', 'action', 'next_state', 'reward')"], {}), "('Transition', ('state', 'action', 'next_state', 'reward'))... |
from os.path import abspath
from seisflows.tools.array import count_zeros
import numpy as np
class Base(object):
""" Abstract base class for line search
Variables
x - list of step lenths from current line search
f - correpsonding list of function values
m - how many step le... | [
"os.path.abspath",
"seisflows.tools.array.count_zeros",
"numpy.array"
] | [((790, 802), 'os.path.abspath', 'abspath', (['"""."""'], {}), "('.')\n", (797, 802), False, 'from os.path import abspath\n'), ((1626, 1663), 'numpy.array', 'np.array', (['self.step_lens[k - i - 1:k]'], {}), '(self.step_lens[k - i - 1:k])\n', (1634, 1663), True, 'import numpy as np\n'), ((1672, 1709), 'numpy.array', 'n... |
# External Dependencies
import numpy as np
import numba
@numba.jit(nopython = True)
def rolling_window(a, window):
shape = a.shape[:-1] + (a.shape[-1] - window + 1, window)
strides = a.strides + (a.strides[-1],)
return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
# rolling standard dev... | [
"numpy.abs",
"numpy.sum",
"numpy.copy",
"numpy.log",
"numpy.max",
"numpy.mean",
"numpy.lib.stride_tricks.as_strided",
"numba.jit",
"numpy.diff",
"numpy.array",
"numpy.min",
"numpy.concatenate"
] | [((58, 82), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (67, 82), False, 'import numba\n'), ((1158, 1182), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (1167, 1182), False, 'import numba\n'), ((1465, 1489), 'numba.jit', 'numba.jit', ([], {'nopython': '(Tr... |
import os
import csv
import cv2
import keras
import sklearn
import numpy as np
from scipy import ndimage
from random import shuffle
import matplotlib.pyplot as plt
from keras.models import Sequential, Model
from sklearn.model_selection import train_test_split
from keras.layers import Flatten, Dense, Lambda, Conv2D, Cro... | [
"matplotlib.pyplot.title",
"csv.reader",
"keras.layers.Cropping2D",
"random.shuffle",
"sklearn.model_selection.train_test_split",
"keras.layers.Flatten",
"matplotlib.pyplot.show",
"keras.layers.Dropout",
"matplotlib.pyplot.legend",
"keras.layers.Conv2D",
"matplotlib.pyplot.ylabel",
"cv2.flip",... | [((599, 615), 'random.shuffle', 'shuffle', (['samples'], {}), '(samples)\n', (606, 615), False, 'from random import shuffle\n'), ((748, 788), 'sklearn.model_selection.train_test_split', 'train_test_split', (['samples'], {'test_size': '(0.2)'}), '(samples, test_size=0.2)\n', (764, 788), False, 'from sklearn.model_select... |
from __future__ import division, print_function
import numpy as np
import struct
import time
from . import minnow
from . import minh
from . import bit
def create_int_record(fname, text, xs):
f = minnow.create(fname)
f.header(struct.pack("<qq", 0xdeadbeef, len(xs)))
f.header(text)
for i in range(len... | [
"numpy.abs",
"numpy.zeros",
"struct.pack",
"time.time",
"numpy.hstack",
"numpy.array",
"numpy.arange",
"numpy.log10",
"numpy.all"
] | [((1298, 1331), 'numpy.zeros', 'np.zeros', (['(ni * bi)'], {'dtype': 'np.int64'}), '(ni * bi, dtype=np.int64)\n', (1306, 1331), True, 'import numpy as np\n'), ((1341, 1376), 'numpy.zeros', 'np.zeros', (['(nf * bf)'], {'dtype': 'np.float32'}), '(nf * bf, dtype=np.float32)\n', (1349, 1376), True, 'import numpy as np\n'),... |
import sys
import pathlib
sys.path.append(str(pathlib.Path(__file__).parent.absolute()) + "/../")
import os
import errno
import subprocess
import urllib.request
import pandas as pd
import numpy as np
import random
import general_utils
from mpi4py import MPI
from mpi4py.futures import MPICommExecutor
from general_util... | [
"mpi4py.futures.MPICommExecutor",
"csv_modules.csv_writer.write_in_file",
"pandas.read_csv",
"random.shuffle",
"os.path.dirname",
"os.path.exists",
"numpy.setdiff1d",
"pathlib.Path",
"general_utils.temp_utils.gen_dir",
"general_utils.database_utils.get_chains_pdb_db",
"general_utils.temp_utils.f... | [((881, 908), 'general_utils.database_utils.get_chains_pdb_db', 'get_chains_pdb_db', (['pdb_name'], {}), '(pdb_name)\n', (898, 908), False, 'from general_utils.database_utils import get_chains_pdb_db\n'), ((982, 1043), 'csv_modules.csv_writer.write_in_file', 'write_in_file', (['know_pdb_path', "['Name', 'OK']", '[[pdb_... |
import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
n, q = I[:2]
l, r = I[2:].reshape(-1, 2).T - 1
def main():
res = np.zeros(n + 1, dtype=np.int64)
np.add.at(res, l, 1)
np.subtract.at(res, r + 1, 1)
res = np.cumsum(res)
ans = res[:-1] % 2
retu... | [
"numpy.subtract.at",
"sys.stdin.read",
"numpy.zeros",
"numpy.cumsum",
"numpy.add.at"
] | [((168, 199), 'numpy.zeros', 'np.zeros', (['(n + 1)'], {'dtype': 'np.int64'}), '(n + 1, dtype=np.int64)\n', (176, 199), True, 'import numpy as np\n'), ((205, 225), 'numpy.add.at', 'np.add.at', (['res', 'l', '(1)'], {}), '(res, l, 1)\n', (214, 225), True, 'import numpy as np\n'), ((231, 260), 'numpy.subtract.at', 'np.su... |
import numpy as np
from torch import nn
import copy
from nnfabrik.utility.nn_helpers import set_random_seed, get_dims_for_loader_dict
from neuralpredictors.layers.readouts import (
MultipleFullGaussian2d,
MultiplePointPooled2d,
MultipleSpatialXFeatureLinear,
MultipleFullSXF,
)
from ..utility.data_helpe... | [
"copy.deepcopy",
"neuralpredictors.layers.readouts.MultipleFullGaussian2d",
"nnfabrik.utility.nn_helpers.set_random_seed",
"neuralpredictors.layers.readouts.MultiplePointPooled2d",
"numpy.random.rand",
"neuralpredictors.layers.readouts.MultipleSpatialXFeatureLinear",
"neuralpredictors.layers.cores.SE2dC... | [((7673, 7694), 'nnfabrik.utility.nn_helpers.set_random_seed', 'set_random_seed', (['seed'], {}), '(seed)\n', (7688, 7694), False, 'from nnfabrik.utility.nn_helpers import set_random_seed, get_dims_for_loader_dict\n'), ((7707, 8245), 'neuralpredictors.layers.cores.SE2dCore', 'SE2dCore', ([], {'input_channels': 'core_in... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from annotlib.standard import StandardAnnot
from annotlib.utils import check_positive_integer
from sklearn.preprocessing import LabelEncoder
from sklearn.utils import column_or_1d, check_X_y
from sklearn.model_selection import RepeatedKFold... | [
"numpy.divide",
"numpy.log",
"numpy.zeros",
"sklearn.utils.check_X_y",
"sklearn.preprocessing.LabelEncoder",
"scipy.special.entr",
"annotlib.utils.check_positive_integer",
"sklearn.utils.column_or_1d",
"sklearn.svm.SVC",
"sklearn.base.is_classifier",
"matplotlib.pyplot.subplots",
"sklearn.mode... | [((6744, 6764), 'sklearn.utils.check_X_y', 'check_X_y', (['X', 'y_true'], {}), '(X, y_true)\n', (6753, 6764), False, 'from sklearn.utils import column_or_1d, check_X_y\n'), ((8606, 8625), 'numpy.zeros', 'np.zeros', (['n_samples'], {}), '(n_samples)\n', (8614, 8625), True, 'import numpy as np\n'), ((8652, 8671), 'numpy.... |
from BDFunction1D.Interpolation import InterpolateFunction
import numpy as np
from matplotlib import pyplot as plt
x = np.linspace(0.0, 2*np.pi, num=10, endpoint=True)
y = np.sin(x)
err = np.ones_like(x) * 0.1
# err = np.arange(10) * 0.1
f = InterpolateFunction(x, y, err)
x1 = np.linspace(0.0, 2*np.pi, num=1000, e... | [
"BDFunction1D.Interpolation.InterpolateFunction",
"matplotlib.pyplot.show",
"numpy.ones_like",
"numpy.sin",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((122, 172), 'numpy.linspace', 'np.linspace', (['(0.0)', '(2 * np.pi)'], {'num': '(10)', 'endpoint': '(True)'}), '(0.0, 2 * np.pi, num=10, endpoint=True)\n', (133, 172), True, 'import numpy as np\n'), ((175, 184), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (181, 184), True, 'import numpy as np\n'), ((246, 276), 'BDF... |
class DCMotor:
"""
Simple DC motor model.
"""
def __init__(self, nominal_voltage, no_load_speed, stall_torque):
"""
Create a motor with parameters:
:param nominal_voltage: [V]
:param no_load_speed: [rad/s]
:param stall_torque: [Nm]
"""
self.consta... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.plot",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((1349, 1371), 'numpy.linspace', 'np.linspace', (['(0)', '(6)', '(100)'], {}), '(0, 6, 100)\n', (1360, 1371), True, 'import numpy as np\n'), ((1462, 1476), 'matplotlib.pyplot.plot', 'plt.plot', (['v', 'T'], {}), '(v, T)\n', (1470, 1476), True, 'import matplotlib.pyplot as plt\n'), ((1481, 1491), 'matplotlib.pyplot.gri... |
import numpy as np
from sklearn.preprocessing import FunctionTransformer
X = [[4, 1, 2, 2], [1, 3, 9, 3], [5, 7, 5, 1]]
def function1(z):
return np.sqrt(z)
FT = FunctionTransformer(func = function1)
FT.fit(X)
newdata = FT.transform(X)
newdata
| [
"sklearn.preprocessing.FunctionTransformer",
"numpy.sqrt"
] | [((168, 203), 'sklearn.preprocessing.FunctionTransformer', 'FunctionTransformer', ([], {'func': 'function1'}), '(func=function1)\n', (187, 203), False, 'from sklearn.preprocessing import FunctionTransformer\n'), ((151, 161), 'numpy.sqrt', 'np.sqrt', (['z'], {}), '(z)\n', (158, 161), True, 'import numpy as np\n')] |
"""
Class that can figure out which DES tile given RA, dec coords are in.
"""
import os
import sys
import numpy as np
import astropy.table as atpy
import astropy.io.fits as pyfits
from astLib import astWCS
import urllib
import time
import IPython
import wget
from bs4 import BeautifulSoup
class DESTiler:
"""A cla... | [
"os.remove",
"astropy.table.Table",
"os.makedirs",
"numpy.logical_and",
"os.path.exists",
"time.time",
"wget.download",
"astropy.io.fits.Header",
"numpy.less",
"numpy.greater_equal",
"bs4.BeautifulSoup"
] | [((888, 899), 'time.time', 'time.time', ([], {}), '()\n', (897, 899), False, 'import time\n'), ((941, 952), 'time.time', 'time.time', ([], {}), '()\n', (950, 952), False, 'import time\n'), ((4346, 4377), 'numpy.logical_and', 'np.logical_and', (['raMask', 'decMask'], {}), '(raMask, decMask)\n', (4360, 4377), True, 'impo... |
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn.metrics import roc_auc_score as roc_auc
from fedot.core.composer.metrics import RMSE, ROCAUC, Silhouette
from fedot.core.data.data import InputData, OutputData
from fedot.core.repository.tasks import TaskTypesEnum
class MetricByTask:
... | [
"numpy.array"
] | [((2040, 2067), 'numpy.array', 'np.array', (['input_data.target'], {}), '(input_data.target)\n', (2048, 2067), True, 'import numpy as np\n')] |
import joblib
import features_extraction
import sys
import numpy as np
from features_extraction import LOCALHOST_PATH, DIRECTORY_NAME
def get_prediction_from_url(test_url,html):
features_test = features_extraction.main(test_url,html)
features_test = np.array(features_test).reshape((1, -1))
clf = joblib.... | [
"features_extraction.main",
"joblib.load",
"numpy.array"
] | [((201, 241), 'features_extraction.main', 'features_extraction.main', (['test_url', 'html'], {}), '(test_url, html)\n', (225, 241), False, 'import features_extraction\n'), ((313, 392), 'joblib.load', 'joblib.load', (["(LOCALHOST_PATH + DIRECTORY_NAME + '/classifier/random_forest1.pkl')"], {}), "(LOCALHOST_PATH + DIRECT... |
import numpy as np
def index_limit(*args):
return min([len(i) for i in args])
def accuracy(y, yhat):
m = np.mean(np.abs((yhat-y)/y)) * 100
r = np.sqrt(np.mean((yhat - y)**2))
print('MAPE: \t\t%d%%' % m)
print('RMSE: \t\t%.1f' % r)
return m, r
def service_level(y, unmet_demand):
index = index_limit(y... | [
"numpy.std",
"numpy.abs",
"numpy.mean",
"numpy.sum"
] | [((161, 185), 'numpy.mean', 'np.mean', (['((yhat - y) ** 2)'], {}), '((yhat - y) ** 2)\n', (168, 185), True, 'import numpy as np\n'), ((507, 526), 'numpy.sum', 'np.sum', (['inv[:index]'], {}), '(inv[:index])\n', (513, 526), True, 'import numpy as np\n'), ((529, 546), 'numpy.sum', 'np.sum', (['y[:index]'], {}), '(y[:ind... |
import xarray as xr
import atmPy.precipitation.radar as _radar
import pandas as _pd
import numpy as np
import atmPy.general.timeseries as _timeseries
# def read_ceilometer_nc(fname):
# ds = xr.open_dataset(fname)
# ceil = _ceilometry.Ceilometer()
# ceil.backscatter = _ceilometry.Backscatter(ds.backscatter.t... | [
"xarray.open_dataset",
"pandas.concat",
"atmPy.precipitation.radar.Kazr",
"numpy.timedelta64"
] | [((429, 442), 'atmPy.precipitation.radar.Kazr', '_radar.Kazr', ([], {}), '()\n', (440, 442), True, 'import atmPy.precipitation.radar as _radar\n'), ((561, 580), 'xarray.open_dataset', 'xr.open_dataset', (['fn'], {}), '(fn)\n', (576, 580), True, 'import xarray as xr\n'), ((837, 866), 'numpy.timedelta64', 'np.timedelta64... |
import numpy as np
import cv2
import argparse
from collections import deque
cap = cv2.VideoCapture(0)
pts = deque(maxlen=128)
lower_red = np.array([0, 80, 50])
upper_red = np.array([8, 255, 220])
lower_green = np.array([50, 120, 50])
upper_green = np.array([77, 255, 255])
while True:
ret, img = cap.read()
... | [
"cv2.line",
"cv2.circle",
"cv2.minEnclosingCircle",
"cv2.bitwise_and",
"cv2.dilate",
"cv2.cvtColor",
"cv2.morphologyEx",
"cv2.waitKey",
"cv2.moments",
"cv2.imshow",
"numpy.ones",
"cv2.VideoCapture",
"numpy.array",
"cv2.erode",
"cv2.destroyAllWindows",
"cv2.inRange",
"collections.dequ... | [((83, 102), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (99, 102), False, 'import cv2\n'), ((110, 127), 'collections.deque', 'deque', ([], {'maxlen': '(128)'}), '(maxlen=128)\n', (115, 127), False, 'from collections import deque\n'), ((141, 162), 'numpy.array', 'np.array', (['[0, 80, 50]'], {}), '(... |
# -*- coding: utf-8 -*-
"""
@author: <EMAIL>
@site: e-smartdata.org
"""
import numpy as np
import pandas as pd
df1 = pd.DataFrame(np.random.rand(10, 4), columns=list('abcd'))
df2 = pd.DataFrame(np.random.rand(10, 4), columns=list('abcd'))
df3 = pd.DataFrame(np.random.rand(10, 4), columns=list('abcd'))
s = pd.Series... | [
"numpy.random.rand",
"pandas.concat"
] | [((369, 414), 'pandas.concat', 'pd.concat', (['[df1, df2, df3]'], {'ignore_index': '(True)'}), '([df1, df2, df3], ignore_index=True)\n', (378, 414), True, 'import pandas as pd\n'), ((426, 452), 'pandas.concat', 'pd.concat', (['[df1, df2, df3]'], {}), '([df1, df2, df3])\n', (435, 452), True, 'import pandas as pd\n'), ((... |
import numpy as np
import cv2 as cv
from numba import jit
DEBUG = False
def remove_object(image, mask, patch_size=21, alpha=0.8):
# time
t = 0
# mask post-processing
mask = cv.medianBlur(mask, 5)
mask_indx = np.where(mask > 245)
mask_boolean = np.ones_like(mask)
mask_boole... | [
"numpy.maximum",
"numpy.sum",
"cv2.medianBlur",
"numpy.argmax",
"cv2.rectangle",
"cv2.imshow",
"numpy.prod",
"numpy.copy",
"cv2.cvtColor",
"numpy.power",
"numpy.max",
"numpy.repeat",
"cv2.Canny",
"numpy.minimum",
"numpy.ones_like",
"cv2.waitKey",
"numpy.count_nonzero",
"cv2.blur",
... | [((5011, 5029), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (5014, 5029), False, 'from numba import jit\n'), ((205, 227), 'cv2.medianBlur', 'cv.medianBlur', (['mask', '(5)'], {}), '(mask, 5)\n', (218, 227), True, 'import cv2 as cv\n'), ((245, 265), 'numpy.where', 'np.where', (['(mask > 245)']... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.