code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import unittest
import numpy as np
from revgraph.core.values.variable import Variable
class VariableTestCase(unittest.TestCase):
def test_variable_is_mutable(self):
a = Variable(np.zeros((3,3)))
a.data += 1
self.assertTrue((a.data == np.ones((3,3))).all())
| [
"numpy.zeros",
"numpy.ones"
] | [((194, 210), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (202, 210), True, 'import numpy as np\n'), ((266, 281), 'numpy.ones', 'np.ones', (['(3, 3)'], {}), '((3, 3))\n', (273, 281), True, 'import numpy as np\n')] |
import os
import torch
import numpy as np
import cv2
from models.net_rfb import RFB
from models.retinaface import RetinaFace
from data import cfg_rfb, cfg_mnet, cfg_slim
def check_keys(model, pretrained_state_dict):
ckpt_keys = set(pretrained_state_dict.keys())
model_keys = set(model.state_dict().keys())
... | [
"numpy.float32",
"torch.set_grad_enabled",
"torch.load",
"numpy.round",
"cv2.imread",
"numpy.min",
"numpy.max",
"torch.device",
"torch.cuda.current_device",
"models.retinaface.RetinaFace",
"cv2.resize",
"torch.from_numpy"
] | [((2185, 2214), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(False)'], {}), '(False)\n', (2207, 2214), False, 'import torch\n'), ((2245, 2278), 'models.retinaface.RetinaFace', 'RetinaFace', ([], {'cfg': 'cfg', 'phase': '"""test"""'}), "(cfg=cfg, phase='test')\n", (2255, 2278), False, 'from models.retinaface ... |
from typing import Union, Any, Callable, Dict, Iterable, List
from pathlib import Path
import pickle
import time
from functools import wraps
from urllib.request import urlopen
import sys
from concurrent.futures import as_completed, ThreadPoolExecutor
import pandas as pd
import json
import numpy as np
import PIL
from I... | [
"PIL.Image.new",
"pickle.dump",
"pandas.option_context",
"pathlib.Path",
"pickle.load",
"sys.getsizeof",
"pandas.DataFrame",
"urllib.request.urlopen",
"IPython.display.display",
"PIL.ImageDraw.Draw",
"concurrent.futures.ThreadPoolExecutor",
"json.dump",
"numpy.asarray",
"time.sleep",
"pa... | [((3054, 3065), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (3059, 3065), False, 'from functools import wraps\n'), ((5092, 5103), 'time.time', 'time.time', ([], {}), '()\n', (5101, 5103), False, 'import time\n'), ((7321, 7387), 'pandas.DataFrame', 'pd.DataFrame', (['time_tile_sid_band'], {'columns': "['time... |
import sys
import sqlite3
import numpy as np
from utils.colmap.bases import *
IS_PYTHON3 = sys.version_info[0] >= 3
MAX_IMAGE_ID = 2**31 - 1
def extract_pair_pts(pair_id, key_points, matches):
"""Get point correspondences of a pair
Args:
pair_id: tuple (im1_id, im2_id)
key_points: dict {... | [
"numpy.frombuffer",
"numpy.zeros",
"sqlite3.connect",
"numpy.fromstring",
"numpy.getbuffer"
] | [((996, 1018), 'numpy.zeros', 'np.zeros', (['(num_pts, 4)'], {}), '((num_pts, 4))\n', (1004, 1018), True, 'import numpy as np\n'), ((1660, 1677), 'numpy.zeros', 'np.zeros', (['(Nf, 4)'], {}), '((Nf, 4))\n', (1668, 1677), True, 'import numpy as np\n'), ((2409, 2428), 'numpy.getbuffer', 'np.getbuffer', (['array'], {}), '... |
import numpy as np
import random
def get_block_covariance(img, k):
vec = []
size = img.shape[:2]
num_vecs = [size[0] // k, size[1] // k]
r_list = random.sample(list(range(num_vecs[0])), 3 * k ** 2)
c_list = random.sample(list(range(num_vecs[1])), 3 * k ** 2)
for row in r_list:
for col ... | [
"numpy.cov",
"numpy.ravel"
] | [((453, 470), 'numpy.ravel', 'np.ravel', (['cov_mat'], {}), '(cov_mat)\n', (461, 470), True, 'import numpy as np\n'), ((429, 440), 'numpy.cov', 'np.cov', (['vec'], {}), '(vec)\n', (435, 440), True, 'import numpy as np\n'), ((354, 416), 'numpy.ravel', 'np.ravel', (['img[row * k:(row + 1) * k, col * k:(col + 1) * k, :]']... |
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.colors as clr
from matplotlib import cm
from matplotlib.gridspec import GridSpec
from matplotlib.colors import LinearSegmentedColormap
import numpy.random as rnd
import scipy.special as ... | [
"matplotlib.pyplot.title",
"numpy.arctan2",
"numpy.sum",
"numpy.argmax",
"numpy.ones",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.linalg.norm",
"numpy.exp",
"numpy.sin",
"numpy.arange",
"scipy.stats.multivariate_normal.logpdf",
"pandas.DataFrame",
"rpy2.robjects.pac... | [((678, 798), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""using a non-tuple sequence for multidimensional indexing is deprecated"""'}), "('ignore', message=\n 'using a non-tuple sequence for multidimensional indexing is deprecated')\n", (701, 798), False, 'import warnings... |
import numpy as np
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from GraphLayers import GraphLayer
# Graph Neural Networks
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class MLP(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
... | [
"torch.nn.functional.dropout",
"torch.cat",
"torch.nn.Conv1d",
"torch.FloatTensor",
"torch.nn.Linear",
"torch.zeros",
"torch.matmul",
"math.sqrt",
"torch.nn.init.xavier_uniform_",
"torch.nn.BatchNorm1d",
"torch.nn.BatchNorm2d",
"torch.cuda.is_available",
"torch.nn.LeakyReLU",
"torch.sum",
... | [((189, 214), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (212, 214), False, 'import torch\n'), ((368, 402), 'torch.nn.Linear', 'nn.Linear', (['input_size', 'hidden_size'], {}), '(input_size, hidden_size)\n', (377, 402), True, 'import torch.nn as nn\n'), ((422, 457), 'torch.nn.Linear', 'nn.L... |
from argo.core.hooks.AbstractWavHook import AbstractWavHook
from argo.core.utils.WavSaver import WavSaver
from datasets.Dataset import check_dataset_keys_not_loop, VALIDATION, TRAIN, TEST
from argo.core.argoLogging import get_logger
from .wavenet.utils import mu_law_numpy
from .wavenet.AnomalyDetector import AnomalyDet... | [
"numpy.squeeze",
"argo.core.argoLogging.get_logger",
"numpy.arange"
] | [((369, 381), 'argo.core.argoLogging.get_logger', 'get_logger', ([], {}), '()\n', (379, 381), False, 'from argo.core.argoLogging import get_logger\n'), ((3227, 3257), 'numpy.arange', 'np.arange', (['(0)', 'samples.shape[0]'], {}), '(0, samples.shape[0])\n', (3236, 3257), True, 'import numpy as np\n'), ((3876, 3915), 'n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 7
@author: MOTEorg
"""
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
from optparse import OptionParser
#Parser of execution options
usage = "Usage: \n\t%prog -i INPUT_IMAGE -d DEBUG"
parser = OptionParser(usage=usage)
parser.... | [
"optparse.OptionParser",
"numpy.empty",
"numpy.ones",
"cv2.bilateralFilter",
"numpy.shape",
"matplotlib.pyplot.figure",
"cv2.erode",
"cv2.subtract",
"cv2.dilate",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"cv2.imwrite",
"matplotlib.pyplot.yticks",
"cv2.LUT",
"matplotlib.pyplot.xticks",... | [((287, 312), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (299, 312), False, 'from optparse import OptionParser\n'), ((754, 779), 'cv2.imread', 'cv.imread', (['options.inFile'], {}), '(options.inFile)\n', (763, 779), True, 'import cv2 as cv\n'), ((816, 862), 'cv2.cvtColor', 'cv... |
#################################################################################
# Copyright (c) 2018-2021, Texas Instruments Incorporated - http://www.ti.com
# All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | [
"numpy.concatenate",
"cv2.countNonZero",
"cv2.cvtColor",
"numpy.asarray",
"numpy.transpose",
"numpy.zeros",
"numpy.clip",
"cv2.warpAffine",
"numpy.max",
"numpy.array",
"cv2.getRotationMatrix2D",
"cv2.resize",
"torch.from_numpy"
] | [((4246, 4284), 'numpy.clip', 'np.clip', (['(img * scale_range)', '(0.0)', '(255.0)'], {}), '(img * scale_range, 0.0, 255.0)\n', (4253, 4284), True, 'import numpy as np\n'), ((4299, 4323), 'numpy.asarray', 'np.asarray', (['img', '"""uint8"""'], {}), "(img, 'uint8')\n", (4309, 4323), True, 'import numpy as np\n'), ((434... |
# Copyright (C) 2002-2021 S[&]T, The Netherlands.
# 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 must retain the above copyright notice,
# this list of condi... | [
"os.getcwd",
"numpy.asarray",
"visan.plot.PlotFrame",
"os.path.exists",
"os.path.dirname",
"sys.path.insert",
"visan.plot.WorldPlotFrame",
"os.path.isfile",
"wx.GetApp",
"wx.Yield",
"os.chdir",
"numpy.concatenate",
"wx.SystemSettings_GetMetric"
] | [((2438, 2457), 'numpy.asarray', 'numpy.asarray', (['data'], {}), '(data)\n', (2451, 2457), False, 'import numpy\n'), ((2469, 2488), 'numpy.asarray', 'numpy.asarray', (['bins'], {}), '(bins)\n', (2482, 2488), False, 'import numpy\n'), ((33357, 33367), 'wx.Yield', 'wx.Yield', ([], {}), '()\n', (33365, 33367), False, 'im... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 10_FE.ipynb (unless otherwise specified).
__all__ = ['FE']
# Cell
from pyDOE import lhs
import numpy as np
from scipy.stats.distributions import norm
from scipy.stats import uniform
import yaml
from qd.cae.dyna import KeyFile
import os
import pandas as pd
from diversipy.hyc... | [
"os.mkdir",
"yaml.load",
"pandas.read_csv",
"yaml.dump",
"os.path.isfile",
"os.path.join",
"os.chdir",
"pandas.DataFrame",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"qd.cae.dyna.KeyFile",
"pandas.DataFrame.from_dict",
"os.rmdir",
"os.listdir",
"os.getcwd",
"scipy.stats.... | [((2802, 2813), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2811, 2813), False, 'import os\n'), ((2832, 2867), 'pathlib.PurePath', 'PurePath', (["inp['baseline_directory']"], {}), "(inp['baseline_directory'])\n", (2840, 2867), False, 'from pathlib import PurePath\n'), ((2890, 2915), 'os.path.abspath', 'os.path.abspath... |
import numpy
import scipy
import matplotlib.pyplot as plt
class Optimize():
def __init__(self):
self.size_grid = []
self.pieces = []
self.forbidden = []
self.penalty = []
self.loss = []
input_data = (open('Problems/Problem1.txt', "r").read()).split('\n')
self... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"numpy.zeros",
"matplotlib.pyplot.grid"
] | [((1107, 1158), 'numpy.zeros', 'numpy.zeros', (['[self.size_grid[0], self.size_grid[1]]'], {}), '([self.size_grid[0], self.size_grid[1]])\n', (1118, 1158), False, 'import numpy\n'), ((1538, 1589), 'numpy.zeros', 'numpy.zeros', (['[self.size_grid[0], self.size_grid[1]]'], {}), '([self.size_grid[0], self.size_grid[1]])\n... |
from time import time
import numpy as np
from utils import arg_list
from dgl.transforms import metis_partition
from dgl import backend as F
import dgl
def get_partition_list(g, psize):
p_gs = metis_partition(g, psize)
graphs = []
for k, val in p_gs.items():
nids = val.ndata[dgl.NID]
nids... | [
"dgl.transforms.metis_partition",
"dgl.backend.asnumpy",
"numpy.concatenate"
] | [((200, 225), 'dgl.transforms.metis_partition', 'metis_partition', (['g', 'psize'], {}), '(g, psize)\n', (215, 225), False, 'from dgl.transforms import metis_partition\n'), ((323, 338), 'dgl.backend.asnumpy', 'F.asnumpy', (['nids'], {}), '(nids)\n', (332, 338), True, 'from dgl import backend as F\n'), ((570, 603), 'num... |
'''Processes for surface turbulent heat and moisture fluxes
:class:`~climlab.surface.SensibleHeatFlux` and
:class:`~climlab.surface.LatentHeatFlux` implement standard bulk formulae
for the turbulent heat fluxes, assuming that the heating or moistening
occurs in the lowest atmospheric model level.
:Example:
... | [
"climlab.domain.field.Field",
"numpy.zeros_like",
"climlab.utils.thermo.qsat",
"numpy.ones_like"
] | [((3512, 3536), 'numpy.zeros_like', 'np.zeros_like', (['self.Tatm'], {}), '(self.Tatm)\n', (3525, 3536), True, 'import numpy as np\n'), ((5544, 5604), 'climlab.domain.field.Field', 'Field', (['self.Tatm[..., -1, np.newaxis]'], {'domain': 'self.Ts.domain'}), '(self.Tatm[..., -1, np.newaxis], domain=self.Ts.domain)\n', (... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import os
os.environ['TL_BACKEND'] = 'tensorflow'
# os.environ['TL_BACKEND'] = 'mindspore'
# os.environ['TL_BACKEND'] = 'paddle'
# os.environ['TL_BACKEND'] = 'torch'
import numpy as np
from tensorlayerx.nn import Module, ModuleList, Linear, ModuleDict
import tensorlayerx as t... | [
"tensorlayerx.nn.ModuleList",
"tensorlayerx.nn.Linear",
"numpy.ones",
"tensorlayerx.nn.Input"
] | [((423, 497), 'tensorlayerx.nn.Linear', 'Linear', ([], {'out_features': '(800)', 'act': 'tlx.nn.ReLU', 'in_features': '(784)', 'name': '"""linear1"""'}), "(out_features=800, act=tlx.nn.ReLU, in_features=784, name='linear1')\n", (429, 497), False, 'from tensorlayerx.nn import Module, ModuleList, Linear, ModuleDict\n'), ... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 6 21:34:08 2020
@author: Dipankar
"""
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 6 17:24:34 2020
@author: Dipankar
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# a = np.arange(0,9,0.1)
x1 = np.linspace(0.01,4.5,100)
thr = 31*np.pi/18... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.close",
"matplotlib.rcParams.update",
"numpy.power",
"numpy.arange",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.ylabel",
"numpy.log10",
"matplotlib... | [((276, 303), 'numpy.linspace', 'np.linspace', (['(0.01)', '(4.5)', '(100)'], {}), '(0.01, 4.5, 100)\n', (287, 303), True, 'import numpy as np\n'), ((1441, 1469), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(5, 5)'}), '(figsize=(5, 5))\n', (1453, 1469), True, 'import matplotlib.pyplot as plt\n'), ((... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : rng.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 01/19/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import os
import random as sys_random
import numpy as np
import numpy.random as npr
from jacinle.utils.defaults ... | [
"jacinle.utils.defaults.defaults_manager.gen_get_default",
"os.getpid",
"random.shuffle",
"jacinle.utils.registry.Registry",
"numpy.arange",
"jacinle.logging.get_logger",
"jacinle.utils.defaults.defaults_manager.wrap_custom_as_default",
"os.getenv"
] | [((1750, 1828), 'jacinle.utils.defaults.defaults_manager.gen_get_default', 'defaults_manager.gen_get_default', (['JacRandomState'], {'default_getter': '(lambda : _rng)'}), '(JacRandomState, default_getter=lambda : _rng)\n', (1782, 1828), False, 'from jacinle.utils.defaults import defaults_manager\n'), ((1977, 1987), 'j... |
#%%
import os
import sys
try:
os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/')
sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/')
except:
pass
import pymaid as pymaid
from pyma... | [
"pandas.DataFrame",
"sys.path.append",
"pymaid.CatmaidInstance",
"pandas.read_csv",
"numpy.setdiff1d",
"pymaid.get_skids_by_annotation",
"src.data.load_metagraph",
"connectome_tools.process_matrix.Promat.identify_pair",
"src.visualization.adjplot",
"numpy.nanmean",
"os.chdir",
"numpy.intersect... | [((368, 418), 'pymaid.CatmaidInstance', 'pymaid.CatmaidInstance', (['url', 'token', 'name', 'password'], {}), '(url, token, name, password)\n', (390, 418), True, 'import pymaid as pymaid\n'), ((939, 962), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (954, 962), True, 'import seaborn as ... |
import numpy as np
from astLib import astCalc as aca
# check these numbers. I don't think it really matters though.
aca.H0 = 72
aca.OMEGA_M0 = 0.23
aca.OMEGA_L0 = 0.77
def calcMass(vd, A1D=1082.9, alpha=0.3361):
avgz = 0.0
return 1e15 / (aca.H0 * aca.Ez(avgz) / 100.) * (vd / A1D)**(1 / alpha)
def calcLOSVD... | [
"numpy.zeros",
"numpy.histogramdd",
"astLib.astCalc.Ez",
"numpy.diff",
"numpy.log10",
"numpy.digitize",
"numpy.sqrt"
] | [((975, 1006), 'numpy.histogramdd', 'np.histogramdd', (['data'], {'bins': 'grid'}), '(data, bins=grid)\n', (989, 1006), True, 'import numpy as np\n'), ((1142, 1216), 'numpy.zeros', 'np.zeros', (['(test.size,)'], {'dtype': "[('MASS', '>f4'), ('MASS_err', '>f4', (2,))]"}), "((test.size,), dtype=[('MASS', '>f4'), ('MASS_e... |
from bentkus_conf_seq.conc_ineq.bentkus import bentkus
import numpy as np
from confseq.betting import get_ci_seq
from confseq.predmix import predmix_empbern_cs
from small_sample_mean_bounds.bound import b_alpha_l2norm, b_alpha_linear
from typing import Sequence
def hoeffding_ci(x, times, alpha=0.05):
x = np.array... | [
"numpy.maximum",
"numpy.sum",
"numpy.abs",
"small_sample_mean_bounds.bound.b_alpha_l2norm",
"numpy.ones",
"numpy.arange",
"numpy.power",
"numpy.cumsum",
"numpy.append",
"numpy.minimum",
"numpy.sort",
"numpy.maximum.accumulate",
"small_sample_mean_bounds.bound.b_alpha_linear",
"confseq.bett... | [((312, 323), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (320, 323), True, 'import numpy as np\n'), ((334, 346), 'numpy.cumsum', 'np.cumsum', (['x'], {}), '(x)\n', (343, 346), True, 'import numpy as np\n'), ((510, 526), 'numpy.maximum', 'np.maximum', (['l', '(0)'], {}), '(l, 0)\n', (520, 526), True, 'import numpy... |
import os
import pickle
import numpy as np
import scipy.sparse as sparse
import torch
from solve import Solve
from tqdm import tqdm
from joblib import Memory
memory = Memory('__pycache__', verbose=0)
@memory.cache
def generate_data(observation_smat, missing_prob, consecutive, seed):
nobs = observation_smat.shape[0... | [
"numpy.random.seed",
"solve.Solve.apply",
"os.path.join",
"joblib.Memory",
"numpy.zeros_like",
"torch.FloatTensor",
"torch.squeeze",
"torch.exp",
"numpy.max",
"numpy.loadtxt",
"torch.zeros",
"torch.log",
"numpy.stack",
"tqdm.tqdm",
"numpy.ones_like",
"torch.sparse_coo_tensor",
"scipy... | [((167, 199), 'joblib.Memory', 'Memory', (['"""__pycache__"""'], {'verbose': '(0)'}), "('__pycache__', verbose=0)\n", (173, 199), False, 'from joblib import Memory\n'), ((1204, 1244), 'scipy.sparse.load_npz', 'sparse.load_npz', (['f"""{path}/incidence.npz"""'], {}), "(f'{path}/incidence.npz')\n", (1219, 1244), True, 'i... |
from ..layers import Module
import numpy as np
from ..autograd import Tensor, zeros, zeros_like
from ..autograd import Parameter
from typing import Generator
def tensor2array(var):
assert isinstance(var,Tensor),"必须传入一个Tensor"
dim = len(var.shape)
_tmp = []
class Optimizer:
def __init__(self, lr:float... | [
"numpy.zeros_like",
"numpy.sqrt"
] | [((2179, 2208), 'numpy.zeros_like', 'np.zeros_like', (['parameter.data'], {}), '(parameter.data)\n', (2192, 2208), True, 'import numpy as np\n'), ((2451, 2472), 'numpy.sqrt', 'np.sqrt', (['(s + self.eps)'], {}), '(s + self.eps)\n', (2458, 2472), True, 'import numpy as np\n'), ((2902, 2931), 'numpy.zeros_like', 'np.zero... |
import gensim
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
class MeanW2VEmbeddingVectorizer(BaseEstimator, ClassifierMixin):
def __init__(self):
pass
def fit(self, X, y=None):
X = [val.split() for val in X.to_list()]
self.model = gensim.models.Word2... | [
"numpy.zeros",
"gensim.models.Word2Vec"
] | [((301, 336), 'gensim.models.Word2Vec', 'gensim.models.Word2Vec', (['X'], {'size': '(100)'}), '(X, size=100)\n', (323, 336), False, 'import gensim\n'), ((788, 806), 'numpy.zeros', 'np.zeros', (['self.dim'], {}), '(self.dim)\n', (796, 806), True, 'import numpy as np\n')] |
import csv
import time
import tensorflow as tf
import tensorflow.keras.models
from tensorflow.keras.preprocessing.image import load_img,img_to_array
from numpy import expand_dims
from os import listdir
def ladeBild(pfad):
bild = load_img(path = pfad,color_mode = 'grayscale')
array = img_to_array(bild)
arra... | [
"csv.writer",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"time.time",
"tensorflow.lite.Interpreter",
"tensorflow.keras.preprocessing.image.load_img",
"os.listdir"
] | [((4120, 4166), 'tensorflow.lite.Interpreter', 'tf.lite.Interpreter', ([], {'model_path': '"""model.tflite"""'}), "(model_path='model.tflite')\n", (4139, 4166), True, 'import tensorflow as tf\n'), ((234, 277), 'tensorflow.keras.preprocessing.image.load_img', 'load_img', ([], {'path': 'pfad', 'color_mode': '"""grayscale... |
#***********************************************************************#
# Copyright (C) 2010-2012 <NAME> #
# #
# This file is part of CVXPY #
# ... | [
"cvxopt.spmatrix",
"numpy.isscalar",
"cvxopt.matrix"
] | [((2082, 2119), 'cvxopt.spmatrix', 'opt.spmatrix', (['(0.0)', '[]', '[]', '(m * m, n)'], {}), '(0.0, [], [], (m * m, n))\n', (2094, 2119), True, 'import cvxopt as opt\n'), ((2126, 2153), 'cvxopt.matrix', 'opt.matrix', (['(0.0)', '(m * m, 1)'], {}), '(0.0, (m * m, 1))\n', (2136, 2153), True, 'import cvxopt as opt\n'), (... |
import os
import tensorflow as tf
import numpy as np
from collections import Counter
from itertools import chain
embedding_dim = 100
fname = 'data/glove.6B.%dd.txt'%embedding_dim
glove_index_dict = {}
with open(fname, 'r') as fp:
glove_symbols = len(fp.readlines())
glove_embedding_weights = np.empty((glove_sy... | [
"numpy.empty",
"numpy.asarray"
] | [((302, 342), 'numpy.empty', 'np.empty', (['(glove_symbols, embedding_dim)'], {}), '((glove_symbols, embedding_dim))\n', (310, 342), True, 'import numpy as np\n'), ((566, 602), 'numpy.asarray', 'np.asarray', (['ls[1:]'], {'dtype': 'np.float32'}), '(ls[1:], dtype=np.float32)\n', (576, 602), True, 'import numpy as np\n')... |
import numpy as np
from turtle import *
# Gravitational constant
G = 6.67428e-11
# Distance scale
SCALE = 1e-9
# A step
dphi = 0.05 * 1 / np.pi
class Simulation(Turtle):
'''
Draws the orbit based on the parameters
- mechanical energy, masses, and angular momentum.
'''
def __init__(self, m, M... | [
"numpy.sin",
"numpy.cos",
"numpy.sqrt"
] | [((496, 552), 'numpy.sqrt', 'np.sqrt', (['(1 + 2 * E * L ** 2 / (G ** 2 * M ** 2 * m ** 3))'], {}), '(1 + 2 * E * L ** 2 / (G ** 2 * M ** 2 * m ** 3))\n', (503, 552), True, 'import numpy as np\n'), ((691, 707), 'numpy.cos', 'np.cos', (['self.phi'], {}), '(self.phi)\n', (697, 707), True, 'import numpy as np\n'), ((718, ... |
# coding: utf-8
# # Model setup
#
# here we set the model up and explain how it works
# imports and load data
# In[1]:
# all of this is explained in notebook 0
get_ipython().run_line_magic('run', 'imports.py')
from modelinter.preprocessing.imports_load_data import read_csvs, extract_arrays
raw_data = read_csvs()... | [
"modelinter.preprocessing.imports_load_data.read_csvs",
"modelinter.preprocessing.imports_load_data.extract_arrays",
"numpy.mean",
"modelinter.models.calculations.eval_PGM"
] | [((309, 320), 'modelinter.preprocessing.imports_load_data.read_csvs', 'read_csvs', ([], {}), '()\n', (318, 320), False, 'from modelinter.preprocessing.imports_load_data import read_csvs, extract_arrays\n'), ((330, 354), 'modelinter.preprocessing.imports_load_data.extract_arrays', 'extract_arrays', (['raw_data'], {}), '... |
"""
VCD (Video Content Description) library v4.3.1
Project website: http://vcd.vicomtech.org
Copyright (C) 2021, Vicomtech (http://www.vicomtech.es/),
(Spain) all rights reserved.
VCD is a Python library to create and manage VCD content version 4.3.1.
VCD is distributed under MIT License. See LICENSE.
"""
import o... | [
"vcd.draw.FrameInfoDrawer",
"vcd.utils.grid_as_4xN_points3d",
"vcd.draw.Image",
"vcd.draw.TopView.Params",
"vcd.draw.Image.Params",
"vcd.types.cuboid",
"cv2.imshow",
"screeninfo.get_monitors",
"cv2.line",
"vcd.draw.TopView",
"vcd.draw.SetupViewer",
"vcd.utils.euler2R",
"vcd.utils.generate_gr... | [((333, 357), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (348, 357), False, 'import sys\n'), ((644, 654), 'vcd.core.VCD', 'core.VCD', ([], {}), '()\n', (652, 654), False, 'from vcd import core\n'), ((1070, 1128), 'numpy.array', 'np.array', (['[333.437012, 0.307729989, 2.4235599, 11.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 6 21:00:02 2019
@author: ben
"""
#import matplotlib.pyplot as plt
import numpy as np
import pointCollection as pc
import scipy.ndimage as snd
import sys
import os
import re
import argparse
def pad_mask_canvas(D, N):
dx=np.diff(D.x[0:2])
l... | [
"os.mkdir",
"argparse.ArgumentParser",
"pointCollection.grid.data",
"os.path.isfile",
"numpy.arange",
"numpy.round",
"os.path.join",
"numpy.meshgrid",
"numpy.ones_like",
"numpy.mod",
"numpy.concatenate",
"sys.exit",
"re.compile",
"os.path.isdir",
"numpy.zeros",
"numpy.diff",
"numpy.a... | [((1110, 1203), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""generate a list of commands to run ATL11_to_ATL15"""'}), "(description=\n 'generate a list of commands to run ATL11_to_ATL15')\n", (1133, 1203), False, 'import argparse\n'), ((2071, 2102), 're.compile', 're.compile', (['""... |
import json
import pickle
import numpy as np
import pandas as pd
results_dir = "/science/image/nlp-datasets/emanuele/results/xm-influence/flickr30kentities_vis4lang/"
def get_rows(df, basedir, name):
# none ablation
mlm = pickle.load(open(basedir + 'val_none_mlm.pkl', 'rb'))
mlm = np.mean(mlm)
... | [
"pandas.DataFrame",
"numpy.mean",
"numpy.log"
] | [((891, 937), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['Model', 'Mask', 'MLM']"}), "(columns=['Model', 'Mask', 'MLM'])\n", (903, 937), True, 'import pandas as pd\n'), ((1039, 1056), 'numpy.mean', 'np.mean', (['bert_mlm'], {}), '(bert_mlm)\n', (1046, 1056), True, 'import numpy as np\n'), ((1248, 1265), 'nu... |
# coding: utf-8
# In[4]:
import numpy as np
from numpy import*
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.kernel_ridge import KernelRidge
from sklearn.model_selection import GridSearchCV
from pylab import scatter, show, legend, xlabel, ylabel
from sklearn.metrics import r2_score
import seabo... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"pandas.read_csv",
"seaborn.light_palette",
"numpy.array",
"matplotlib.pyplot.subplots"
] | [((336, 376), 'seaborn.light_palette', 'sns.light_palette', (['"""green"""'], {'as_cmap': '(True)'}), "('green', as_cmap=True)\n", (353, 376), True, 'import seaborn as sns\n'), ((388, 430), 'pandas.read_csv', 'pd.read_csv', (['"""data_akbilgic.csv"""'], {'header': '(0)'}), "('data_akbilgic.csv', header=0)\n", (399, 430... |
""" $lic$
Copyright (C) 2016-2017 by The Board of Trustees of Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
If you use this program in your research, we request that you reference th... | [
"numpy.less",
"numpy.copy",
"numpy.ones",
"numpy.prod"
] | [((1796, 1819), 'numpy.ones', 'np.ones', (['num'], {'dtype': 'int'}), '(num, dtype=int)\n', (1803, 1819), True, 'import numpy as np\n'), ((1908, 1929), 'numpy.prod', 'np.prod', (['factors[:-1]'], {}), '(factors[:-1])\n', (1915, 1929), True, 'import numpy as np\n'), ((1942, 1958), 'numpy.prod', 'np.prod', (['factors'], ... |
# -*- coding: utf-8 -*-
#
# stimulus_params.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License... | [
"numpy.array"
] | [((1835, 1897), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0983, 0.0619, 0.0, 0.0, 0.0512, 0.0196]'], {}), '([0.0, 0.0, 0.0983, 0.0619, 0.0, 0.0, 0.0512, 0.0196])\n', (1843, 1897), True, 'import numpy as np\n')] |
import torch
import tensorflow as tf
import paddle
import numpy as np
from termcolor import colored
# test for compatibility with different AI framework
a = torch.randn(2, 3)
b = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
print("==>> b.shape: ", b.shape)
print(colored("==>> type(b): ", "blue"), type(b))
# print(... | [
"torch.randn",
"tensorflow.constant",
"termcolor.colored",
"numpy.array",
"paddle.to_tensor",
"torch.tensor"
] | [((158, 175), 'torch.randn', 'torch.randn', (['(2)', '(3)'], {}), '(2, 3)\n', (169, 175), False, 'import torch\n'), ((181, 228), 'tensorflow.constant', 'tf.constant', (['[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]'], {}), '([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])\n', (192, 228), True, 'import tensorflow as tf\n'), ((387, 439), 'pad... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import os
import pytest
import nump... | [
"matrixprofile.algorithms.stomp.stomp",
"matrixprofile.visualize.visualize",
"matrixprofile.algorithms.skimp.skimp",
"pytest.raises",
"numpy.array"
] | [((760, 809), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]'], {}), '([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])\n', (768, 809), True, 'import numpy as np\n'), ((835, 857), 'matrixprofile.algorithms.stomp.stomp', 'stomp', (['ts', 'w'], {'n_jobs': '(1)'}), '(ts, w, n_jobs=1)\n', (840, 857), False, ... |
# BSD 3-Clause License
#
# This file is part of the DM-VIO-Python-Tools.
# https://github.com/lukasvst/dm-vio-python-tools
#
# Copyright (c) 2022, <NAME>, TUM
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following condition... | [
"tqdm.tqdm",
"numpy.set_printoptions",
"trajectory_evaluation.associate.read_file_list",
"numpy.median",
"ruamel.yaml.YAML",
"numpy.argsort",
"pathlib.Path",
"numpy.array",
"trajectory_evaluation.evaluate_ate.compute_ate_fast",
"numpy.take_along_axis"
] | [((5953, 6000), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(True)'}), '(precision=3, suppress=True)\n', (5972, 6000), True, 'import numpy as np\n'), ((12984, 12990), 'ruamel.yaml.YAML', 'YAML', ([], {}), '()\n', (12988, 12990), False, 'from ruamel.yaml import YAML\n'), ((143... |
import sys
sys.path.append('./src/')
import numpy as np
import networkx as nx
from util import *
import matplotlib.pyplot as plt
n = 50
d_list = [3]
numtrials = 10
numinnertrials = 100
s_upperlim = 8
upper_bound = []
max_lower_bound = []
avg_lin_err = []
avg_opt_err = []
for d_index in range(len(d_list)):
d = d_l... | [
"matplotlib.pyplot.title",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"sys.path.append",
"numpy.std",
"matplotlib.pyplot.close",
"numpy.linalg.eig",
"matplotlib.pyplot.errorbar",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.random.permutation",
"numpy.dot",
"ma... | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""./src/"""'], {}), "('./src/')\n", (26, 36), False, 'import sys\n'), ((2468, 2480), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2478, 2480), True, 'import matplotlib.pyplot as plt\n'), ((2482, 2504), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""... |
import os
import tensorflow as tf
import numpy as np
import datetime
import time
import sys
import logging
from tensorflow.keras.utils import Progbar
from src.utils.loss import get_loss
from src import models
logging.basicConfig(format='[ %(levelname)s ] %(message)s', level=logging.INFO, stream=sys.stdout)
class Trai... | [
"src.utils.loss.get_loss",
"tensorflow.keras.utils.Progbar",
"logging.basicConfig",
"tensorflow.summary.scalar",
"numpy.zeros",
"datetime.datetime.now",
"time.time",
"logging.info",
"tensorflow.Variable",
"tensorflow.GradientTape",
"tensorflow.summary.create_file_writer",
"os.path.join",
"te... | [((209, 312), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[ %(levelname)s ] %(message)s"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format='[ %(levelname)s ] %(message)s', level=logging.\n INFO, stream=sys.stdout)\n", (228, 312), False, 'import logging\n'), ((453, 607), 'os.path.j... |
from torch.utils.data import Dataset
from skimage.io import imread
from os.path import join
from glob import glob
from PIL import Image
from numpy import zeros
from json import load
class Dataset(Dataset):
"""Dataset for images"""
def __init__(self, root_dir, joint_transform=None, input_transform=None, target... | [
"PIL.Image.fromarray",
"numpy.zeros",
"os.path.join",
"skimage.io.imread"
] | [((1233, 1256), 'skimage.io.imread', 'imread', (['self.names[idx]'], {}), '(self.names[idx])\n', (1239, 1256), False, 'from skimage.io import imread\n'), ((1592, 1614), 'PIL.Image.fromarray', 'Image.fromarray', (['image'], {}), '(image)\n', (1607, 1614), False, 'from PIL import Image\n'), ((862, 896), 'os.path.join', '... |
import mpld3
from mpld3 import plugins
import matplotlib.pyplot as plt
import numpy as np
def main():
fig, ax = plt.subplots(2, 2, sharex='col', sharey='row')
X = np.random.normal(0, 1, (2, 100))
for i in range(2):
for j in range(2):
points = ax[1 - i, j].scatter(X[i], X[j])
plug... | [
"mpld3.plugins.LinkedBrush",
"matplotlib.pyplot.subplots",
"numpy.random.normal",
"matplotlib.pyplot.show"
] | [((117, 163), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'sharex': '"""col"""', 'sharey': '"""row"""'}), "(2, 2, sharex='col', sharey='row')\n", (129, 163), True, 'import matplotlib.pyplot as plt\n'), ((173, 205), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(2, 100)'], {}), '(0, 1, ... |
#!/usr/bin/python
# Copyright 2022 <NAME> (<EMAIL>)
# scipy based WAV -> C64 TAP converter.
# https://web.archive.org/web/20180709173001/http://c64tapes.org/dokuwiki/doku.php?id=analyzing_loaders#tap_format
# http://unusedino.de/ec64/technical/formats/tap.html
import argparse
import struct
import pandas as pd
impor... | [
"numpy.transpose",
"argparse.ArgumentParser",
"struct.pack",
"pandas.Float32Dtype"
] | [((368, 444), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Convert WAV file into a C64 .tap file"""'}), "(description='Convert WAV file into a C64 .tap file')\n", (391, 444), False, 'import argparse\n'), ((1819, 1838), 'struct.pack', 'struct.pack', (['"""b"""', '(0)'], {}), "('b', 0)\n... |
import click
import pandas as pd
import plotly.express as px
from numpy import log10, sqrt
__all__ = ["plot_overall_ss"]
@click.command()
@click.argument(
"scores",
type=click.Path(
exists=False, dir_okay=False, file_okay=True, writable=True, resolve_path=True
),
)
def plot_overall_ss(
scores... | [
"plotly.express.box",
"pandas.read_csv",
"plotly.express.line",
"click.command",
"click.Path",
"numpy.log10",
"pandas.concat",
"numpy.sqrt"
] | [((125, 140), 'click.command', 'click.command', ([], {}), '()\n', (138, 140), False, 'import click\n'), ((376, 395), 'pandas.read_csv', 'pd.read_csv', (['scores'], {}), '(scores)\n', (387, 395), True, 'import pandas as pd\n'), ((1105, 1221), 'plotly.express.line', 'px.line', (['df'], {'x': '"""sensitivity"""', 'y': '""... |
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os
import logging
import json
def _parse_db_text(file_name: str, word_index_from=5, label_index_from=3, lower=True, sent_delimiter='\t'):
"""
Parse vi... | [
"logging.error",
"os.path.exists",
"json.dumps",
"numpy.mean",
"numpy.array"
] | [((6032, 6050), 'numpy.array', 'np.array', (['seq_lens'], {}), '(seq_lens)\n', (6040, 6050), True, 'import numpy as np\n'), ((396, 421), 'os.path.exists', 'os.path.exists', (['file_name'], {}), '(file_name)\n', (410, 421), False, 'import os\n'), ((2709, 2734), 'os.path.exists', 'os.path.exists', (['file_name'], {}), '(... |
import numpy as np
import matplotlib.pyplot as plt
from supernet.model import SuperNet
from supernet.train import train_supernet_mnist
import pickle
def main():
# Training settings
training_settings = {'seed': 1,
'batch_size': 64,
'test_batch_size': 1000,
... | [
"matplotlib.pyplot.title",
"pickle.dump",
"matplotlib.pyplot.show",
"numpy.array",
"matplotlib.pyplot.ylabel",
"supernet.model.SuperNet",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((957, 971), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (969, 971), True, 'import matplotlib.pyplot as plt\n'), ((1071, 1110), 'matplotlib.pyplot.title', 'plt.title', (['"""One-shot SuperNet training"""'], {}), "('One-shot SuperNet training')\n", (1080, 1110), True, 'import matplotlib.pyplot as pl... |
import numpy as np
#As the name says, this class is intended to wrap the raw TPD data.
#This means it acts as an interface between the data file (.csv) and the UI.
#It also contains the relevant methods for processing the raw data
# This could be decoupled by adding a class responsible for the processing.
class RawDat... | [
"numpy.trapz",
"numpy.abs",
"numpy.log",
"numpy.amin",
"numpy.median",
"numpy.reciprocal",
"numpy.insert",
"numpy.append",
"numpy.finfo",
"numpy.where",
"numpy.arange",
"numpy.loadtxt",
"numpy.vstack"
] | [((1740, 1817), 'numpy.loadtxt', 'np.loadtxt', (['self.m_filePath'], {'dtype': 'str', 'skiprows': '(1)', 'max_rows': '(1)', 'delimiter': '""","""'}), "(self.m_filePath, dtype=str, skiprows=1, max_rows=1, delimiter=',')\n", (1750, 1817), True, 'import numpy as np\n'), ((1991, 2088), 'numpy.loadtxt', 'np.loadtxt', (['sel... |
"""Queue classes."""
import os
from collections import defaultdict
from datetime import datetime
import logging
import numpy as np
import pandas as pd
import astropy.coordinates as coord
import astropy.units as u
from astropy.time import Time, TimeDelta
import astroplan
from .Fields import Fields
from .optimize import... | [
"numpy.sum",
"numpy.maximum",
"numpy.abs",
"numpy.floor",
"numpy.isnan",
"collections.defaultdict",
"numpy.arange",
"numpy.round",
"numpy.unique",
"pandas.DataFrame",
"numpy.meshgrid",
"pandas.merge",
"os.path.exists",
"pandas.concat",
"numpy.median",
"astropy.time.Time",
"astropy.ti... | [((1247, 1274), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1264, 1274), False, 'import logging\n'), ((2479, 2493), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2491, 2493), True, 'import pandas as pd\n'), ((4589, 4632), 'astropy.time.Time', 'Time', (['self.validity_window[0... |
import yaml
import tensorflow as tf
import numpy as np
import time
from datetime import datetime
from tqdm.auto import trange, tqdm
class Logger(object):
def __init__(self, epochs, frequency):
# print("Hyperparameters:")
# print(json.dumps(HP, indent=2))
# print()
print("TensorFlo... | [
"numpy.hstack",
"tqdm.auto.tqdm",
"tensorflow.executing_eagerly",
"time.time",
"numpy.array",
"datetime.datetime.fromtimestamp",
"tensorflow.test.is_gpu_available"
] | [((526, 537), 'time.time', 'time.time', ([], {}), '()\n', (535, 537), False, 'import time\n'), ((832, 843), 'time.time', 'time.time', ([], {}), '()\n', (841, 843), False, 'import time\n'), ((1312, 1338), 'tqdm.auto.tqdm', 'tqdm', ([], {'total': 'self.tf_epochs'}), '(total=self.tf_epochs)\n', (1316, 1338), False, 'from ... |
import numpy as np
from Bio import AlignIO
from scipy.ndimage import gaussian_filter
from skimage.transform import resize as imresize
import pickle
import h5py
import pandas as pd
from copy import deepcopy
#function form
def alnFileToArray(filename):
alnfile = filename
msa = AlignIO.read(alnfile , format = ... | [
"pandas.read_csv",
"scipy.ndimage.gaussian_filter",
"numpy.zeros",
"numpy.fft.rfftn",
"Bio.AlignIO.read",
"numpy.array"
] | [((288, 325), 'Bio.AlignIO.read', 'AlignIO.read', (['alnfile'], {'format': '"""fasta"""'}), "(alnfile, format='fasta')\n", (300, 325), False, 'from Bio import AlignIO\n'), ((4241, 4315), 'numpy.zeros', 'np.zeros', (['(2 * keep_edge[0], 2 * keep_edge[1], infft.shape[2])', 'np.complex'], {}), '((2 * keep_edge[0], 2 * kee... |
"""
Deep learning toolkit
"""
import tensorflow as tf
import keras
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorb... | [
"pandas.DataFrame",
"data_test_case.case33_tieline",
"pandas.read_csv",
"networkx.kamada_kawai_layout",
"dgl.DGLGraph",
"networkx.draw",
"numpy.reshape",
"numpy.array",
"nets.superpixels_graph_classification.load_net.gnn_model",
"numpy.concatenate"
] | [((1192, 1208), 'data_test_case.case33_tieline', 'case33_tieline', ([], {}), '()\n', (1206, 1208), False, 'from data_test_case import case33_tieline, case33_tieline_DG\n'), ((1400, 1426), 'numpy.concatenate', 'np.concatenate', (['[src, dst]'], {}), '([src, dst])\n', (1414, 1426), True, 'import numpy as np\n'), ((1431, ... |
print('__file__={0:<35} | __name__={1:<20} | __package__={2:<20}'.format(__file__,__name__,str(__package__)))
# import thermotar as th
from thermotar.utils import lmp_utils as lmu
from thermotar.utils import parse_logs
from thermotar.utils import df_utils
import thermotar.thermo as th
import pandas as pd
import matplo... | [
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.show",
"thermotar.utils.parse_logs.parse_xvg",
"matplotlib.pyplot.plot",
"numpy.logical_and",
"scipy.optimize.curve_fit",
"numpy.exp",
"thermotar.utils.df_utils.merge_no_dupes"
] | [((3867, 3894), 'matplotlib.pyplot.plot', 'plt.plot', (['rep1.Time', 'rep1.C'], {}), '(rep1.Time, rep1.C)\n', (3875, 3894), True, 'import matplotlib.pyplot as plt\n'), ((3945, 3962), 'matplotlib.pyplot.yscale', 'plt.yscale', (['"""log"""'], {}), "('log')\n", (3955, 3962), True, 'import matplotlib.pyplot as plt\n'), ((3... |
import json
import os
from collections import OrderedDict
import numpy as np
class Datatransfer(object):
"""
The DataTransfer object contains information about datatransfers that happened between tasks.
"""
_version = "1.0"
def __init__(self, id, type, ts_start, transfertime, source, destinatio... | [
"numpy.str",
"json.dumps",
"numpy.int64"
] | [((2039, 2056), 'numpy.int64', 'np.int64', (['self.id'], {}), '(self.id)\n', (2047, 2056), True, 'import numpy as np\n'), ((2078, 2095), 'numpy.str', 'np.str', (['self.type'], {}), '(self.type)\n', (2084, 2095), True, 'import numpy as np\n'), ((2122, 2146), 'numpy.int64', 'np.int64', (['self.ts_submit'], {}), '(self.ts... |
# Copyright (c) 2022, Skolkovo Institute of Science and Technology (Skoltech)
#
# 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 req... | [
"evops.utils.MetricsUtils.__filter_unsegmented",
"evops.utils.MetricsUtils.__get_tp",
"numpy.unique"
] | [((955, 1001), 'evops.utils.MetricsUtils.__get_tp', '__get_tp', (['pred_labels', 'gt_labels', 'tp_condition'], {}), '(pred_labels, gt_labels, tp_condition)\n', (963, 1001), False, 'from evops.utils.MetricsUtils import __get_tp, __filter_unsegmented\n'), ((1020, 1053), 'evops.utils.MetricsUtils.__filter_unsegmented', '_... |
import string
from copy import deepcopy
from shutil import copyfile
from typing import List, Tuple, Dict, Optional
import warnings
import re
import matplotlib
import numpy as np
import pandas as pd
import seaborn as sns
from adjustText import adjust_text
from matplotlib import pyplot as plt
from tqdm.auto i... | [
"matplotlib.rc",
"numpy.empty",
"adjustText.adjust_text",
"matplotlib.pyplot.figure",
"numpy.mean",
"networkx.draw_networkx_nodes",
"numpy.arange",
"networkx.draw_networkx_labels",
"matplotlib.pyplot.gca",
"numpy.isclose",
"networkx.draw_networkx_edge_labels",
"matplotlib.pyplot.fill_between",... | [((1400, 1419), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1417, 1419), False, 'import logging\n'), ((1442, 1464), 'seaborn.set_style', 'sns.set_style', (['"""ticks"""'], {}), "('ticks')\n", (1455, 1464), True, 'import seaborn as sns\n'), ((1491, 1525), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
__author__ = "<NAME>"
#-------------------------------------------------------------------------------
# in this script, we take a large data frame file and label the rows according
# to ... | [
"pandas.read_csv",
"spellchecker.SpellChecker",
"nltk.download",
"re.findall",
"numpy.linalg.norm",
"numpy.array",
"nltk.corpus.stopwords.words",
"numpy.dot",
"re.sub"
] | [((929, 955), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (942, 955), False, 'import nltk\n'), ((1914, 1937), 're.sub', 're.sub', (['"""[0-9]"""', '""" """', 's'], {}), "('[0-9]', ' ', s)\n", (1920, 1937), False, 'import re\n'), ((1990, 2011), 're.sub', 're.sub', (['"""\\\\W"""', '""... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 16 17:09:03 2017
@author: Subhy
Compute theoretical distribution of maximum distortion of Gaussian random
manifolds under random projections
"""
import numpy as np
from numpy import ndarray as array
# ======================================================================... | [
"numpy.ones_like",
"numpy.log",
"numpy.array",
"numpy.log10",
"numpy.sqrt"
] | [((956, 977), 'numpy.ones_like', 'np.ones_like', (['epsilon'], {}), '(epsilon)\n', (968, 977), True, 'import numpy as np\n'), ((2459, 2484), 'numpy.ones_like', 'np.ones_like', (['ambient_dim'], {}), '(ambient_dim)\n', (2471, 2484), True, 'import numpy as np\n'), ((3222, 3247), 'numpy.ones_like', 'np.ones_like', (['ambi... |
import numpy as np
def dirac(m, x, x0):
"""Dirac computed at resolution m but restricted
to a subinterval determined by x"""
if type(x0) != list:
a = np.sinc((float(m) - .5) * (x - x0) / np.pi)
b = np.sinc(.5 * (x - x0) / np.pi)
d = (m - .5) * a / b + .5 * np.cos(m * (x - x0))
... | [
"numpy.sinc",
"numpy.sin",
"numpy.cos"
] | [((228, 259), 'numpy.sinc', 'np.sinc', (['(0.5 * (x - x0) / np.pi)'], {}), '(0.5 * (x - x0) / np.pi)\n', (235, 259), True, 'import numpy as np\n'), ((768, 779), 'numpy.sinc', 'np.sinc', (['zz'], {}), '(zz)\n', (775, 779), True, 'import numpy as np\n'), ((868, 881), 'numpy.sin', 'np.sin', (['(m * x)'], {}), '(m * x)\n',... |
# Environment Setup
# ----------------------------------------------------------------
# Dependencies
import csv
import pandas as pd
import numpy as np
from faker import Faker
fake = Faker()
# Output File Name
file_output_schools = "generated_data/schools_complete.csv"
file_output_students = "generated_data/students_c... | [
"pandas.DataFrame",
"numpy.random.randint",
"faker.Faker",
"numpy.random.choice"
] | [((183, 190), 'faker.Faker', 'Faker', ([], {}), '()\n', (188, 190), False, 'from faker import Faker\n'), ((2346, 2372), 'pandas.DataFrame', 'pd.DataFrame', (['schools_list'], {}), '(schools_list)\n', (2358, 2372), True, 'import pandas as pd\n'), ((4481, 4508), 'pandas.DataFrame', 'pd.DataFrame', (['students_list'], {})... |
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to n... | [
"numpy.uint8"
] | [((1723, 1737), 'numpy.uint8', 'numpy.uint8', (['(0)'], {}), '(0)\n', (1734, 1737), False, 'import numpy\n')] |
import numbers
from collections.abc import Iterable
import numpy
from hydep.lib import Universe
from hydep import Pin, InfiniteMaterial, Material
from .typed import BoundedTyped, TypedAttr
from hydep.internal import Boundaries
__all__ = ("LatticeStack",)
class LatticeStack(Universe):
"""Representation of a 1D... | [
"numpy.empty",
"hydep.internal.Boundaries",
"numpy.empty_like",
"numpy.asarray"
] | [((4045, 4084), 'numpy.empty', 'numpy.empty', (['self.nLayers'], {'dtype': 'object'}), '(self.nLayers, dtype=object)\n', (4056, 4084), False, 'import numpy\n'), ((9327, 9355), 'numpy.empty_like', 'numpy.empty_like', (['self.items'], {}), '(self.items)\n', (9343, 9355), False, 'import numpy\n'), ((11318, 11373), 'hydep.... |
# coding: utf-8
import chainer
import chainer.functions as F
class ConcatTuple(chainer.Chain):
def forward(self, x, y):
return F.concat((x, y))
class ConcatList(chainer.Chain):
def forward(self, x, y):
return F.concat([x, y])
# ======================================
from chainer_compiler... | [
"numpy.random.rand",
"chainer_compiler.ch2o.generate_testcase",
"chainer.functions.concat"
] | [((487, 530), 'chainer_compiler.ch2o.generate_testcase', 'ch2o.generate_testcase', (['ConcatTuple', '[v, w]'], {}), '(ConcatTuple, [v, w])\n', (509, 530), False, 'from chainer_compiler import ch2o\n'), ((536, 594), 'chainer_compiler.ch2o.generate_testcase', 'ch2o.generate_testcase', (['ConcatList', '[v, w]'], {'subname... |
import torch
import numpy as np
from Tools.logger import save_context, Logger, CheckpointIO
from Tools import FLAGS, load_config, utils_torch
# from library import loss_gan
from library import inputs, data_iters
from library.trainer import trainer_byol
from library import evaluator
KEY_ARGUMENTS = load_config(FLAGS.... | [
"library.inputs.SchedulerWrapper",
"Tools.logger.Logger",
"numpy.random.seed",
"library.inputs.get_scheduler",
"library.inputs.OptimizerWrapper",
"library.data_iters.get_data_augmentation",
"torch.manual_seed",
"library.data_iters.get_dataloader",
"Tools.load_config",
"torch.cuda.manual_seed",
"... | [((302, 332), 'Tools.load_config', 'load_config', (['FLAGS.config_file'], {}), '(FLAGS.config_file)\n', (313, 332), False, 'from Tools import FLAGS, load_config, utils_torch\n'), ((380, 417), 'Tools.logger.save_context', 'save_context', (['__file__', 'KEY_ARGUMENTS'], {}), '(__file__, KEY_ARGUMENTS)\n', (392, 417), Fal... |
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
flights = sns.load_dataset('flights')
sns.lineplot(data=flights, x='year', y='passengers')
sns.lineplot(data=flights, x='year', y='passengers')
plt.legend(['a', 'b'])
plt.title('asd', fontsize=17)
plt.xlabel("iteration", fonts... | [
"matplotlib.pyplot.title",
"seaborn.lineplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.yticks",
"seaborn.load_dataset",
"numpy.zeros",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((104, 131), 'seaborn.load_dataset', 'sns.load_dataset', (['"""flights"""'], {}), "('flights')\n", (120, 131), True, 'import seaborn as sns\n'), ((132, 184), 'seaborn.lineplot', 'sns.lineplot', ([], {'data': 'flights', 'x': '"""year"""', 'y': '"""passengers"""'}), "(data=flights, x='year', y='passengers')\n", (144, 18... |
import numpy as np
import vrep
import ctypes
import math
import nengo
vrep_mode = vrep.simx_opmode_oneshot
def b( num ):
""" forces magnitude to be 1 or less """
if abs( num ) > 1.0:
return math.copysign( 1.0, num )
else:
return num
def convert_angles( ang ):
""" Converts Euler angles from x-y-z to z... | [
"vrep.simxGetObjectVelocity",
"vrep.simxSynchronousTrigger",
"math.copysign",
"vrep.simxStart",
"numpy.random.normal",
"vrep.simxSynchronous",
"vrep.simxGetObjectHandle",
"vrep.simxSetStringSignal",
"nengo.Node",
"vrep.simxGetJointPosition",
"math.cos",
"vrep.simxSetJointTargetVelocity",
"vr... | [((347, 363), 'math.sin', 'math.sin', (['ang[0]'], {}), '(ang[0])\n', (355, 363), False, 'import math\n'), ((371, 387), 'math.sin', 'math.sin', (['ang[1]'], {}), '(ang[1])\n', (379, 387), False, 'import math\n'), ((395, 411), 'math.sin', 'math.sin', (['ang[2]'], {}), '(ang[2])\n', (403, 411), False, 'import math\n'), (... |
# coding: utf-8
# In[3]:
import numpy as np
import cv2
# In[1]:
def draw_lines(undist,M_inv,warped,left_fitx,right_fitx,ploty):
# Create an image to draw the lines on
warp_zero = np.zeros_like(warped).astype(np.uint8)
color_warp = np.dstack((warp_zero, warp_zero, warp_zero))
pts = None
result... | [
"numpy.dstack",
"cv2.warpPerspective",
"numpy.zeros_like",
"numpy.int_",
"cv2.addWeighted",
"numpy.hstack",
"numpy.vstack"
] | [((249, 293), 'numpy.dstack', 'np.dstack', (['(warp_zero, warp_zero, warp_zero)'], {}), '((warp_zero, warp_zero, warp_zero))\n', (258, 293), True, 'import numpy as np\n'), ((678, 710), 'numpy.hstack', 'np.hstack', (['(pts_left, pts_right)'], {}), '((pts_left, pts_right))\n', (687, 710), True, 'import numpy as np\n'), (... |
#!/usr/bin/env python
'''
'''
import numpy as np
from .radar_controller import RadarController
class Scanner(RadarController):
'''Takes in a scan and create a scanning radar controller.
'''
META_FIELDS = RadarController.META_FIELDS + [
'scan_type',
'dwell',
]
def __init__(sel... | [
"numpy.linalg.norm",
"numpy.concatenate",
"numpy.linspace"
] | [((338, 378), 'numpy.linspace', 'np.linspace', (['(300000.0)', '(1000000.0)'], {'num': '(10)'}), '(300000.0, 1000000.0, num=10)\n', (349, 378), True, 'import numpy as np\n'), ((2591, 2623), 'numpy.concatenate', 'np.concatenate', (['rx_point'], {'axis': '(1)'}), '(rx_point, axis=1)\n', (2605, 2623), True, 'import numpy ... |
"""
Maps: Parametrized Layer
========================
Build a model of a parametrized layer in a wholespace. If you want to
build a model of a parametrized layer in a halfspace, also use
Maps.InjectActiveCell.
The model is
.. code::
m = [
'background physical property value',
'layer physical pro... | [
"matplotlib.pyplot.show",
"SimPEG.Mesh.TensorMesh",
"numpy.hstack",
"matplotlib.pyplot.subplots",
"SimPEG.Maps.ParametricLayer"
] | [((511, 545), 'SimPEG.Mesh.TensorMesh', 'Mesh.TensorMesh', (['[50, 50]'], {'x0': '"""CC"""'}), "([50, 50], x0='CC')\n", (526, 545), False, 'from SimPEG import Mesh, Maps\n'), ((578, 604), 'SimPEG.Maps.ParametricLayer', 'Maps.ParametricLayer', (['mesh'], {}), '(mesh)\n', (598, 604), False, 'from SimPEG import Mesh, Maps... |
#!/usr/bin/env python
import yaml
import triangle
import numpy as np
f = open("config.yaml")
config = yaml.load(f)
f.close()
flatchain = np.load(config["TlL_samples"])
labels = [r"$T_\textrm{eff}$ [K]", r"$\log_{10} L\; [L_\odot]$"]
figure = triangle.corner(flatchain, quantiles=[0.16, 0.5, 0.84],
plot_contour... | [
"triangle.corner",
"yaml.load",
"numpy.load"
] | [((104, 116), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (113, 116), False, 'import yaml\n'), ((140, 170), 'numpy.load', 'np.load', (["config['TlL_samples']"], {}), "(config['TlL_samples'])\n", (147, 170), True, 'import numpy as np\n'), ((248, 383), 'triangle.corner', 'triangle.corner', (['flatchain'], {'quantiles... |
import logging
import collections
import numpy as np
import torch
from torch import nn
from torch import optim
from . import agent
from ..tools import flag_tools
class DqnAgent(agent.Agent):
def _build_model(self):
cfg = self._model_cfg
self._model = cfg.model_factory()
self._model.to(d... | [
"numpy.random.uniform",
"torch.no_grad",
"torch.arange",
"numpy.argmax"
] | [((2070, 2085), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2083, 2085), False, 'import torch\n'), ((2331, 2350), 'numpy.random.uniform', 'np.random.uniform', ([], {}), '()\n', (2348, 2350), True, 'import numpy as np\n'), ((2432, 2449), 'numpy.argmax', 'np.argmax', (['q_vals'], {}), '(q_vals)\n', (2441, 2449),... |
import functools
import json
import pickle
from collections import defaultdict
from multiprocessing import Pool
from typing import Dict, List, Optional, Tuple, Union
import click
import numpy
import rich
from click_option_group import optgroup
from nagl.utilities.toolkits import capture_toolkit_warnings
from openff.re... | [
"openff.recharge.charges.bcc.BCCCollection",
"click_option_group.optgroup",
"openff.recharge.charges.vsite.VirtualSiteGenerator.generate_positions",
"openff.recharge.charges.vsite.VirtualSiteGenerator.generate_charge_increments",
"collections.defaultdict",
"numpy.mean",
"pickle.load",
"click.Path",
... | [((6194, 6209), 'click.command', 'click.command', ([], {}), '()\n', (6207, 6209), False, 'import click\n'), ((7280, 7307), 'click_option_group.optgroup', 'optgroup', (['"""Data processing"""'], {}), "('Data processing')\n", (7288, 7307), False, 'from click_option_group import optgroup\n'), ((7309, 7407), 'click_option_... |
import cv2
import mediapipe as mp
import numpy as np
class FaceDetection(object):
def __init__(self, method='mediapipe'):
if method == 'mediapipe':
self.inference_engine = mp.solutions.face_detection.FaceDetection(min_detection_confidence=0.5)
self.draw_engine = mp.solutions.drawi... | [
"numpy.stack",
"numpy.meshgrid",
"mediapipe.solutions.face_mesh.FaceMesh",
"numpy.power",
"mediapipe.solutions.face_detection.FaceDetection",
"numpy.mean",
"numpy.linalg.norm"
] | [((10040, 10071), 'numpy.linalg.norm', 'np.linalg.norm', (['(point1 - point2)'], {}), '(point1 - point2)\n', (10054, 10071), True, 'import numpy as np\n'), ((199, 270), 'mediapipe.solutions.face_detection.FaceDetection', 'mp.solutions.face_detection.FaceDetection', ([], {'min_detection_confidence': '(0.5)'}), '(min_det... |
# -*- coding: utf-8 -*-
"""
Use GLImageItem to display image data on rectangular planes.
In this example, the image data is sampled from a volume and the image planes
placed as if they slice through the volume.
"""
## Add path to library (just for examples; you do not need this)
import initExample
from pyq... | [
"pyqtgraph.opengl.GLAxisItem",
"pyqtgraph.opengl.GLImageItem",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"pyqtgraph.makeRGBA",
"pyqtgraph.opengl.GLViewWidget",
"numpy.random.normal",
"pyqtgraph.Qt.QtGui.QApplication"
] | [((435, 457), 'pyqtgraph.Qt.QtGui.QApplication', 'QtGui.QApplication', (['[]'], {}), '([])\n', (453, 457), False, 'from pyqtgraph.Qt import QtCore, QtGui\n'), ((463, 480), 'pyqtgraph.opengl.GLViewWidget', 'gl.GLViewWidget', ([], {}), '()\n', (478, 480), True, 'import pyqtgraph.opengl as gl\n'), ((1216, 1236), 'pyqtgrap... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ag... | [
"pandas.DataFrame",
"numpy.log",
"pandas.read_csv",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.legend",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.array",
"pandas.Series",
"matplotlib.pyplot.tight_layout",
"numpy.sqrt"
] | [((931, 956), 'numpy.array', 'np.array', (['[100000, 80000]'], {}), '([100000, 80000])\n', (939, 956), True, 'import numpy as np\n'), ((1143, 1194), 'pandas.read_csv', 'pd.read_csv', (["(path + '/db_pricing_zcb.csv')"], {'header': '(0)'}), "(path + '/db_pricing_zcb.csv', header=0)\n", (1154, 1194), True, 'import pandas... |
import argparse
import os
import nibabel as nib
import numpy as np
from .infer import Predictor
def Brain_Segmenatation(path_in, path_out, path_model):
"""Docs."""
mask_predictor = Predictor(path_model)
probability = mask_predictor.predict(path_in)
ni_img = nib.Nifti1Image(probability, affine=np.eye... | [
"numpy.eye",
"os.path.join",
"argparse.ArgumentParser"
] | [((429, 484), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""folders to files"""'}), "(description='folders to files')\n", (452, 484), False, 'import argparse\n'), ((346, 385), 'os.path.join', 'os.path.join', (['path_out', '"""output.nii.gz"""'], {}), "(path_out, 'output.nii.gz')\n", (35... |
import numpy as np
import cv2
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from scipy import stats
import warnings
warnings.filterwarnings('error')
class ExpMax:
def __init__(self, dx, dy, means, colors=None, indices=None, bounds=(0, 0, 255, 255), max... | [
"matplotlib.pyplot.title",
"numpy.sum",
"numpy.arctan2",
"numpy.abs",
"numpy.argmax",
"numpy.diagflat",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.sin",
"numpy.arange",
"numpy.random.normal",
"cv2.imshow",
"numpy.std",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"matplotlib.... | [((178, 210), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (201, 210), False, 'import warnings\n'), ((9354, 9386), 'numpy.zeros', 'np.zeros', (['(0,)'], {'dtype': 'np.float64'}), '((0,), dtype=np.float64)\n', (9362, 9386), True, 'import numpy as np\n'), ((9402, 9434), 'num... |
import gc
import os
import os.path as p
import json
import requests
from pathlib import Path
from typing import List, Tuple, Union
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
from .base_vectorizer import BaseVectorizer
tf.logging.set_verbosity(tf.logging.ERROR)
__all__ = ['DockerVectorize... | [
"tensorflow_hub.Module",
"tensorflow.reset_default_graph",
"tensorflow.logging.set_verbosity",
"json.dumps",
"gc.collect",
"tensorflow.tables_initializer",
"requests.post",
"tensorflow.get_default_graph",
"os.path.join",
"os.path.abspath",
"os.path.dirname",
"tensorflow.global_variables_initia... | [((249, 291), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (273, 291), True, 'import tensorflow as tf\n'), ((1238, 1257), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n', (1248, 1257), False, 'import json\n'), ((1278, 1315), 'requests.p... |
import sys
import typing
import numba as nb
import numpy as np
@nb.njit((nb.b1[:], ), cache=True)
def solve(c: np.ndarray) -> typing.NoReturn:
n = len(c)
a = np.sort(c)[::-1]
s = 0
for i in range(n):
s += a[i] != c[i]
print(s // 2)
def main() -> typing.NoReturn:
n = int(sys.stdin.... | [
"numpy.sort",
"sys.stdin.buffer.readline",
"numba.njit"
] | [((74, 106), 'numba.njit', 'nb.njit', (['(nb.b1[:],)'], {'cache': '(True)'}), '((nb.b1[:],), cache=True)\n', (81, 106), True, 'import numba as nb\n'), ((175, 185), 'numpy.sort', 'np.sort', (['c'], {}), '(c)\n', (182, 185), True, 'import numpy as np\n'), ((310, 337), 'sys.stdin.buffer.readline', 'sys.stdin.buffer.readli... |
from mpnum.utils.extmath import matdot
import numpy as np
from scipy.linalg import svd
class LocalCompression:
"""Container for local compression parameters (so they don't have to be passed every time)"""
def __init__(self, relerr=1e-10, rank=None, stable=False, direction=None, canonicalize=True,
... | [
"numpy.cumsum",
"numpy.sum",
"numpy.searchsorted",
"mpnum.utils.extmath.matdot"
] | [((2745, 2758), 'numpy.cumsum', 'np.cumsum', (['sv'], {}), '(sv)\n', (2754, 2758), True, 'import numpy as np\n'), ((2761, 2771), 'numpy.sum', 'np.sum', (['sv'], {}), '(sv)\n', (2767, 2771), True, 'import numpy as np\n'), ((2798, 2837), 'numpy.searchsorted', 'np.searchsorted', (['svsum', '(1 - self.relerr)'], {}), '(svs... |
import cv2
import numpy as np
class PageExtractor:
def __init__(self, output_process=False):
self.output_process = output_process
self.src = None
self.dst = None
self.m = None
self.max_width = None
self.max_height = None
def __call__(self, image, quad):
warped = image.copy()
rect = P... | [
"cv2.warpPerspective",
"cv2.getPerspectiveTransform",
"cv2.imwrite",
"numpy.array",
"numpy.sqrt"
] | [((389, 420), 'numpy.array', 'np.array', (['rect'], {'dtype': '"""float32"""'}), "(rect, dtype='float32')\n", (397, 420), True, 'import numpy as np\n'), ((617, 669), 'numpy.sqrt', 'np.sqrt', (['((br[0] - bl[0]) ** 2 + (br[1] - bl[1]) ** 2)'], {}), '((br[0] - bl[0]) ** 2 + (br[1] - bl[1]) ** 2)\n', (624, 669), True, 'im... |
#! /usr/bin/env python3
# Copyright (c) 2017 <NAME>
import openpyxl as opx
import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt
import math
import argparse
import os
def is_number(s):
"""Return True if the value is a number."""
try:
float(s)
return True
except ... | [
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"scipy.interpolate.InterpolatedUnivariateSpline",
"numpy.logspace",
"matplotlib.pyplot.legend",
"openpyxl.load_workbook",
"os.path.splitext",
"openpyxl.utils.cell.coordinate_to_tuple",
"ma... | [((1603, 1625), 'numpy.logspace', 'np.logspace', (['(1)', 'digits'], {}), '(1, digits)\n', (1614, 1625), True, 'import numpy as np\n'), ((1691, 1744), 'matplotlib.pyplot.loglog', 'plt.loglog', (['raw_list', 'std_list', '"""o"""'], {'label': '"""standard"""'}), "(raw_list, std_list, 'o', label='standard')\n", (1701, 174... |
from __future__ import division
import math
import numpy as np
from typing import Optional
def build_sinusoidal_positional_embedding(
num_embeddings: int,
embedding_dim: int,
padding_idx: Optional[int] = None,
dtype=np.float32
):
"""
Build sinusoidal embeddings
"""
half_dim = embeddin... | [
"numpy.zeros",
"numpy.sin",
"numpy.arange",
"numpy.reshape",
"numpy.cos",
"math.log"
] | [((576, 613), 'numpy.reshape', 'np.reshape', (['emb', '[num_embeddings, -1]'], {}), '(emb, [num_embeddings, -1])\n', (586, 613), True, 'import numpy as np\n'), ((341, 356), 'math.log', 'math.log', (['(10000)'], {}), '(10000)\n', (349, 356), False, 'import math\n'), ((398, 430), 'numpy.arange', 'np.arange', (['half_dim'... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 12:26:05 2021
@author: <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
from numpy import pi as π
from pathlib import Path
import pycoilib as pycoil
from pycoilib.segment import Arc, Line, Circle
vec_x = np.array([1., 0., 0.])
vec_y = np.array([0., 1.... | [
"pycoilib.segment.Circle",
"matplotlib.pyplot.show",
"pycoilib.coil.Coil",
"matplotlib.pyplot.plot",
"pycoilib.wire.WireCircular",
"matplotlib.pyplot.figure",
"numpy.array",
"pycoilib.segment.Arc",
"matplotlib.pyplot.gca"
] | [((273, 298), 'numpy.array', 'np.array', (['[1.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0])\n', (281, 298), True, 'import numpy as np\n'), ((304, 329), 'numpy.array', 'np.array', (['[0.0, 1.0, 0.0]'], {}), '([0.0, 1.0, 0.0])\n', (312, 329), True, 'import numpy as np\n'), ((335, 360), 'numpy.array', 'np.array', (['[0.0, 0.0,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
GreedyPy - greedy weak diffeomorphic registration in python
Copyright: <NAME>
Began: November 2019
"""
import numpy as np
from itertools import product
class local_correlation:
# TODO: store rad and tolerance in class
def __init__(self, fixed, moving, rad,... | [
"numpy.pad",
"numpy.sum",
"numpy.copy",
"numpy.errstate",
"numpy.percentile",
"numpy.mean",
"itertools.product",
"numpy.ascontiguousarray",
"numpy.gradient"
] | [((401, 416), 'numpy.mean', 'np.mean', (['moving'], {}), '(moving)\n', (408, 416), True, 'import numpy as np\n'), ((513, 547), 'numpy.percentile', 'np.percentile', (['moving', '[0.1, 99.9]'], {}), '(moving, [0.1, 99.9])\n', (526, 547), True, 'import numpy as np\n'), ((569, 583), 'numpy.mean', 'np.mean', (['fixed'], {})... |
import numpy as np
from abc import ABC, abstractmethod
# Observer pattern
# The oberserver pattern defines a one-to-many relationship between a set of objects.
#
# When the state of one object changes, all of its dependents are notified
# CREATE INTERFACES
class Subject(ABC):
@abstractmethod
def registerObse... | [
"numpy.max",
"numpy.mean",
"numpy.min"
] | [((2604, 2629), 'numpy.mean', 'np.mean', (['self.temperature'], {}), '(self.temperature)\n', (2611, 2629), True, 'import numpy as np\n'), ((2632, 2656), 'numpy.max', 'np.max', (['self.temperature'], {}), '(self.temperature)\n', (2638, 2656), True, 'import numpy as np\n'), ((2659, 2683), 'numpy.min', 'np.min', (['self.t... |
#!/usr/bin/env python3
# This file is part of qdpy.
#
# qdpy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# ... | [
"functools.partial",
"os.path.abspath",
"numpy.random.seed",
"argparse.ArgumentParser",
"matplotlib.pyplot.get_cmap",
"numpy.max",
"matplotlib.use",
"random.seed",
"numpy.random.randint",
"os.path.join"
] | [((1056, 1070), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (1063, 1070), True, 'import matplotlib as mpl\n'), ((1615, 1640), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1638, 1640), False, 'import argparse\n'), ((4544, 4564), 'numpy.random.seed', 'np.random.seed', (['see... |
import sys
sys.path.append('..')
from util import *
import numpy as np
import scipy.io
from tqdm import tqdm
import matplotlib.pyplot as plt
subjects = [101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117]
labels = [1, 2, 3, 4, 5]
class_names = "None,Brow lower,Brow raiser,Cheek raiser,Nose wrinkler,... | [
"sys.path.append",
"matplotlib.pyplot.title",
"tqdm.tqdm",
"matplotlib.pyplot.show",
"numpy.std",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"prepare_data.get_path",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.conca... | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((897, 911), 'tqdm.tqdm', 'tqdm', (['subjects'], {}), '(subjects)\n', (901, 911), False, 'from tqdm import tqdm\n'), ((2395, 2428), 'numpy.arange', 'np.arange', (['single_window.shape[0]'], {}), '(single_... |
import streamlit as st
import pandas as pd
import numpy as np
import pickle
from sklearn.ensemble import RandomForestClassifier
st.write("""
# Penguin Prediction App
This app predicts the **Palmer Penguin** species!
Data obtained from the [palmerpenguins library](https://github.com/allisonhorst/palmerpenguins) in R by... | [
"pandas.DataFrame",
"streamlit.subheader",
"streamlit.sidebar.slider",
"streamlit.sidebar.header",
"pandas.read_csv",
"pandas.get_dummies",
"streamlit.write",
"streamlit.sidebar.selectbox",
"streamlit.sidebar.markdown",
"numpy.array",
"streamlit.sidebar.file_uploader",
"pandas.concat"
] | [((129, 343), 'streamlit.write', 'st.write', (['"""\n# Penguin Prediction App\nThis app predicts the **Palmer Penguin** species!\nData obtained from the [palmerpenguins library](https://github.com/allisonhorst/palmerpenguins) in R by <NAME>.\n"""'], {}), '(\n """\n# Penguin Prediction App\nThis app predicts the **Pa... |
# Copyright 2015 The TensorFlow 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 applica... | [
"tensorflow.gfile.FastGFile",
"tensorflow.gfile.Exists",
"argparse.ArgumentParser",
"tensorflow.logging.fatal",
"tensorflow.Session",
"tensorflow.gfile.GFile",
"numpy.squeeze",
"tensorflow.import_graph_def",
"tensorflow.GraphDef"
] | [((2164, 2187), 'numpy.squeeze', 'np.squeeze', (['predictions'], {}), '(predictions)\n', (2174, 2187), True, 'import numpy as np\n'), ((2489, 2501), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (2499, 2501), True, 'import tensorflow as tf\n'), ((2867, 2892), 'argparse.ArgumentParser', 'argparse.ArgumentParser'... |
import argparse
import numpy as np
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser()
parser.add_argument('--workspace', type=str, default='workspace', help='workspace path')
args = parser.parse_args()
lr = np.loadtxt(f'{args.workspace}/log/lr.txt')
plt.title('learning scheduler')
plt.xlabel... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"numpy.loadtxt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((81, 106), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (104, 106), False, 'import argparse\n'), ((233, 275), 'numpy.loadtxt', 'np.loadtxt', (['f"""{args.workspace}/log/lr.txt"""'], {}), "(f'{args.workspace}/log/lr.txt')\n", (243, 275), True, 'import numpy as np\n'), ((277, 308), 'matplotli... |
"""
This module provides the EvaluateModel class.
"""
import logging
import math
import os
import warnings
import numpy as np
import torch
import torch.nn as nn
from selene_sdk.sequences import Genome
from selene_sdk.utils import (
PerformanceMetrics,
initialize_logger,
load_model_from_state_dict,
)
from s... | [
"selene_sdk.utils.load_model_from_state_dict",
"tqdm.tqdm",
"numpy.random.choice",
"numpy.average",
"os.makedirs",
"numpy.concatenate",
"math.ceil",
"torch.load",
"os.path.dirname",
"selene_sdk.utils.PerformanceMetrics",
"torch.sigmoid",
"torch.utils.tensorboard.SummaryWriter",
"torch.device... | [((525, 552), 'logging.getLogger', 'logging.getLogger', (['"""selene"""'], {}), "('selene')\n", (542, 552), False, 'import logging\n'), ((3016, 3059), 'os.makedirs', 'os.makedirs', (['self.output_dir'], {'exist_ok': '(True)'}), '(self.output_dir, exist_ok=True)\n', (3027, 3059), False, 'import os\n'), ((3330, 3408), 't... |
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from utils.generate_spikes import random_spikes
# Pad output with a flat line for aesthetic purposes
flat = np.array([0, 0, 0, 0, 0])
#output = flat
#for s in np.random.random_integers(0, 4, 10):
# impulse = signal.unit_impulse(5, s)
# ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.margins",
"numpy.array",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"utils.generate_spikes.random_spikes",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"numpy.concatenate"
] | [((187, 212), 'numpy.array', 'np.array', (['[0, 0, 0, 0, 0]'], {}), '([0, 0, 0, 0, 0])\n', (195, 212), True, 'import numpy as np\n'), ((456, 473), 'utils.generate_spikes.random_spikes', 'random_spikes', (['(50)'], {}), '(50)\n', (469, 473), False, 'from utils.generate_spikes import random_spikes\n'), ((480, 513), 'nump... |
#!/usr/bin/env python
"""
Use forced alignments to separate digit sequences into individual digits.
Author: <NAME>
Contact: <EMAIL>
Date: 2018
Edited: <NAME>
Date: June 2018
"""
from __future__ import absolute_import, division, print_function
from os import path
import argparse
import sys
import numpy as np
#---... | [
"numpy.floor",
"os.path.join",
"sys.exit"
] | [((1595, 1646), 'os.path.join', 'path.join', (['fa_dir', "(args.dataset + '_word_align.ctm')"], {}), "(fa_dir, args.dataset + '_word_align.ctm')\n", (1604, 1646), False, 'from os import path\n'), ((3419, 3459), 'os.path.join', 'path.join', (['args.outdir', '"""segments_indiv"""'], {}), "(args.outdir, 'segments_indiv')\... |
"""
Functions to add SNPs
"""
import numpy as np
from semopy import Model as semopyModel
# from semopy import ModelMeans as semopyModel
from semopy.utils import calc_reduced_ml
from pandas import DataFrame, concat
from dataset import Data
from utils import *
from itertools import product
from factor_analyzer import... | [
"factor_analyzer.FactorAnalyzer",
"numpy.zeros",
"semopy.Model",
"semopy.utils.calc_reduced_ml",
"itertools.product",
"numpy.dot",
"pandas.concat"
] | [((1069, 1138), 'itertools.product', 'product', (['*[thresh_mlr_var, thresh_sign_snp_var, thresh_abs_param_var]'], {}), '(*[thresh_mlr_var, thresh_sign_snp_var, thresh_abs_param_var])\n', (1076, 1138), False, 'from itertools import product\n'), ((2266, 2282), 'semopy.Model', 'semopyModel', (['mod'], {}), '(mod)\n', (22... |
# --------------------------------------------------------------------------------------------------
# Copyright (c) 2018 Microsoft Corporation
#
# 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 Softw... | [
"gym.spaces.np_random.random_sample",
"numpy.asarray",
"numpy.zeros",
"numpy.unravel_index",
"numpy.array",
"gym.spaces.Box",
"numpy.char.startswith",
"gym.spaces.np_random.randint",
"numpy.prod"
] | [((5419, 5445), 'numpy.zeros', 'np.zeros', (['x.shape', 'np.bool'], {}), '(x.shape, np.bool)\n', (5427, 5445), True, 'import numpy as np\n'), ((6301, 6323), 'numpy.zeros', 'np.zeros', (['shape', 'dtype'], {}), '(shape, dtype)\n', (6309, 6323), True, 'import numpy as np\n'), ((6339, 6361), 'numpy.zeros', 'np.zeros', (['... |
import numpy as np
import matplotlib.pyplot as plt
from time import time
# Global vars -------------------------------------------------------
n_users = 100
time_scale = 4*60
start_coord = np.array([0.5, 0.5])
speed = 0.02
window_duration = 60.
alpha = 1. # heuristic coefficient
beta = 1. # kernel coefficient
# Glob... | [
"numpy.minimum",
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.maximum",
"numpy.argmax",
"matplotlib.pyplot.scatter",
"numpy.argmin",
"time.time",
"matplotlib.pyplot.figure",
"numpy.random.random",
"numpy.array",
"numpy.arange",
"numpy.linalg.norm",
"numpy.mean",
"numpy.exp",
"matplotl... | [((190, 210), 'numpy.array', 'np.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (198, 210), True, 'import numpy as np\n'), ((576, 605), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(14, 9)'}), '(figsize=(14, 9))\n', (588, 605), True, 'import matplotlib.pyplot as plt\n'), ((803, 813), 'matplotlib.pyp... |
import keras
import numpy as np
import pandas as pd
import cv2
import os
import json
import pdb
import tensorflow as tf
import keras.backend as K
from keras.models import Model
from keras.layers import Input, Dense
from keras.utils.generic_utils import CustomObjectScope
from keras.optimizers import SGD, Adam, RMSpro... | [
"pandas.read_csv",
"tensorflow.identity",
"keras.models.Model",
"tensorflow.local_variables_initializer",
"numpy.mean",
"os.path.join",
"keras.backend.cast",
"tensorflow.add_n",
"keras.optimizers.SGD",
"keras.losses.binary_crossentropy",
"keras.backend.ones_like",
"tensorflow.control_dependenc... | [((1125, 1176), 'keras.models.Model', 'Model', ([], {'inputs': 'base_model.input', 'outputs': 'predictions'}), '(inputs=base_model.input, outputs=predictions)\n', (1130, 1176), False, 'from keras.models import Model\n'), ((2034, 2106), 'pandas.read_csv', 'pd.read_csv', (['path'], {'delimiter': '"""\t"""', 'header': 'No... |
"""
Programmer: <NAME>
Purpose: To provide functions to help create illustrative figures
"""
import numpy as np
import matplotlib.pyplot as plt
from persim import plot_diagrams
from MergeTree import *
def loadSVGPaths(filename = "paths.svg"):
"""
Given an SVG file, find all of the paths and load them into
... | [
"xml.etree.ElementTree.parse",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.linspace",
"svg.path.parse_path",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.grid"
] | [((586, 604), 'xml.etree.ElementTree.parse', 'ET.parse', (['filename'], {}), '(filename)\n', (594, 604), True, 'import xml.etree.ElementTree as ET\n'), ((1197, 1213), 'numpy.zeros', 'np.zeros', (['(N, 2)'], {}), '((N, 2))\n', (1205, 1213), True, 'import numpy as np\n'), ((1610, 1625), 'numpy.max', 'np.max', (['x[:, 1]'... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
import xarray as xr
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import cartopy.io.shapereader as shapereader
import seaborn as sns
import shapely.geometry as sgeom
from shapely.geometry import Point
from datetime... | [
"matplotlib.backends.backend_pdf.PdfPages",
"matplotlib.cm.get_cmap",
"numpy.mean",
"numpy.arange",
"matplotlib.pyplot.tight_layout",
"warnings.simplefilter",
"matplotlib.pyplot.close",
"mod_tctrack.plot_tctracks_and_pmin",
"seaborn.cubehelix_palette",
"matplotlib.pyplot.rc",
"xarray.plot.line",... | [((816, 847), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (837, 847), False, 'import warnings\n'), ((8060, 8083), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'size': '(13)'}), "('font', size=13)\n", (8066, 8083), True, 'import matplotlib.pyplot as plt\n'), ((8088, 8... |
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
import scipy as sp
import scipy.interpolate
def loadTimeFile(fileName):
timeList = []
verticesList = []
kList = []
with open(fileName) as file:
line = file.readline()
... | [
"matplotlib.pyplot.figure",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"mpl_toolkits.mplot3d.Axes3D"
] | [((684, 701), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y'], {}), '(x, y)\n', (695, 701), True, 'import numpy as np\n'), ((709, 721), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (719, 721), True, 'from matplotlib import pyplot as plt\n'), ((727, 738), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['fig'], {}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.