code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
Purpose
-------
A Portfolio represents a collection of Aggregate objects. Applications include
* Model a book of insurance
* Model a large account with several sub lines
* Model a reinsurance portfolio or large treaty
"""
import collections
import json
import logging
from copy import deepcopy
import matplotl... | [
"logging.getLogger",
"numpy.alltrue",
"matplotlib.ticker.LogLocator",
"numpy.sqrt",
"IPython.core.display.display",
"numpy.hstack",
"pathlib.Path.home",
"numpy.log",
"scipy.interpolate.interp1d",
"pandas.Index",
"numpy.array",
"matplotlib.ticker.MaxNLocator",
"copy.deepcopy",
"pandas.read_... | [((1265, 1295), 'logging.getLogger', 'logging.getLogger', (['"""aggregate"""'], {}), "('aggregate')\n", (1282, 1295), False, 'import logging\n'), ((4456, 4512), 'pandas.concat', 'pd.concat', (['[a.report_ser for a in self.agg_list]'], {'axis': '(1)'}), '([a.report_ser for a in self.agg_list], axis=1)\n', (4465, 4512), ... |
from simtk import openmm as mm
from simtk.openmm import app
from simtk import unit
import torch
import numpy as np
# Gas constant in kJ / mol / K
R = 8.314e-3
class OpenMMEnergyInterface(torch.autograd.Function):
@staticmethod
def forward(ctx, input, openmm_context, temperature):
device = input.devi... | [
"torch.log",
"simtk.openmm.Platform.getPlatformByName",
"torch.isfinite",
"torch.from_numpy",
"numpy.array",
"torch.tensor",
"simtk.openmm.LangevinIntegrator",
"numpy.isnan",
"torch.zeros_like",
"numpy.isinf",
"numpy.zeros_like",
"torch.zeros",
"torch.where"
] | [((4686, 4708), 'torch.isfinite', 'torch.isfinite', (['energy'], {}), '(energy)\n', (4700, 4708), False, 'import torch\n'), ((4757, 4809), 'torch.where', 'torch.where', (['(energy < energy_max)', 'energy', 'energy_max'], {}), '(energy < energy_max, energy, energy_max)\n', (4768, 4809), False, 'import torch\n'), ((449, ... |
"""
Test to test truncation error and
"""
import numpy as np
import time
import matplotlib.pyplot as plt
from HAPILite import CalcCrossSection, CalcCrossSectionWithError
from lib.ReadComputeFunc import ReadData
from lib.PartitionFunction import BD_TIPS_2017_PYTHON
from matplotlib.backends.backend_pdf import PdfPages
... | [
"numpy.trapz",
"numpy.logical_and",
"HAPILite.CalcCrossSection",
"numpy.exp",
"lib.ReadComputeFunc.ReadData",
"numpy.sum",
"numpy.savetxt",
"lib.PartitionFunction.BD_TIPS_2017_PYTHON",
"numpy.arange"
] | [((514, 577), 'numpy.arange', 'np.arange', (['OmegaRangeValue[0]', '(OmegaRangeValue[1] + 0.01)', '(0.001)'], {}), '(OmegaRangeValue[0], OmegaRangeValue[1] + 0.01, 0.001)\n', (523, 577), True, 'import numpy as np\n'), ((589, 625), 'lib.ReadComputeFunc.ReadData', 'ReadData', (['Molecule'], {'Location': '"""data/"""'}), ... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
from numpy import ma
from .qctests import QCCheckVar
def constant_cluster_size(x, tol=0):
"""Estimate the cluster size with (nearly) constant value
Returns how many consecutive neighbor values are ... | [
"numpy.ma.getmaskarray",
"numpy.ma.fix_invalid",
"numpy.ndim",
"numpy.zeros",
"numpy.ma.compressed",
"numpy.nonzero",
"numpy.shape",
"numpy.atleast_1d"
] | [((429, 439), 'numpy.ndim', 'np.ndim', (['x'], {}), '(x)\n', (436, 439), True, 'import numpy as np\n'), ((726, 737), 'numpy.shape', 'np.shape', (['x'], {}), '(x)\n', (734, 737), True, 'import numpy as np\n'), ((2173, 2224), 'numpy.zeros', 'np.zeros', (['self.data[self.varname].shape'], {'dtype': '"""i1"""'}), "(self.da... |
from __future__ import print_function, division
import os,unittest,numpy as np
def run_tddft_iter(calculator, label, freq):
from pyscf.nao import system_vars_c, prod_basis_c, tddft_iter_c
if label == "siesta":
sv = system_vars_c().init_siesta_xml()
elif label == "gpaw":
sv = system_vars_c()... | [
"numpy.eye",
"gpaw.PoissonSolver",
"gpaw.GPAW",
"numpy.argmax",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"pyscf.nao.prod_basis_c",
"pyscf.nao.system_vars_c",
"unittest.main",
"pyscf.nao.tddft_iter_c",
"numpy.transpose",
"ase.calculators.siesta.Siesta"
] | [((486, 537), 'pyscf.nao.tddft_iter_c', 'tddft_iter_c', (['pb.sv', 'pb'], {'tddft_iter_broadening': '(0.01)'}), '(pb.sv, pb, tddft_iter_broadening=0.01)\n', (498, 537), False, 'from pyscf.nao import system_vars_c, prod_basis_c, tddft_iter_c\n'), ((639, 677), 'numpy.zeros', 'np.zeros', (['omegas.shape[0]'], {'dtype': 'f... |
"""spin-weight harmonic transform module
This module has benefited from pre-existing work by <NAME>
"""
from __future__ import print_function
import os
import numpy as np
import pyfftw
from lenspyx.shts import fsht
from lenspyx import utils
def vtm2map(spin, vtm, Nphi, pfftwthreads=None, bicubic_prefilt=False, ... | [
"numpy.sqrt",
"numpy.where",
"lenspyx.shts.fsht.glm2vtm_s0sym",
"numpy.fft.fftfreq",
"os.environ.get",
"numpy.array",
"numpy.zeros",
"pyfftw.empty_aligned",
"numpy.outer",
"numpy.fft.ifft",
"lenspyx.shts.fsht.vlm2vtm_sym",
"numpy.sum",
"pyfftw.FFTW",
"lenspyx.utils.alm2vlm",
"numpy.arang... | [((4154, 4167), 'numpy.array', 'np.array', (['tht'], {}), '(tht)\n', (4162, 4167), True, 'import numpy as np\n'), ((5674, 5711), 'numpy.zeros', 'np.zeros', (['(2 * lmax + 1)'], {'dtype': 'complex'}), '(2 * lmax + 1, dtype=complex)\n', (5682, 5711), True, 'import numpy as np\n'), ((5720, 5739), 'numpy.arange', 'np.arang... |
# Third-party
import astropy.units as u
import numpy as np
from scipy.signal import argrelmin
# Project
from . import PhaseSpacePosition, Orbit
__all__ = ['fast_lyapunov_max', 'lyapunov_max', 'surface_of_section']
def fast_lyapunov_max(w0, hamiltonian, dt, n_steps, d0=1e-5,
n_steps_per_pullbac... | [
"numpy.hstack",
"numpy.log",
"numpy.asarray",
"numpy.rollaxis",
"numpy.linalg.norm",
"numpy.zeros",
"scipy.signal.argrelmin",
"numpy.random.uniform",
"numpy.zeros_like"
] | [((5368, 5414), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(ndim, noffset_orbits)'}), '(size=(ndim, noffset_orbits))\n', (5385, 5414), True, 'import numpy as np\n'), ((5531, 5557), 'numpy.hstack', 'np.hstack', (['(_w0, w_offset)'], {}), '((_w0, w_offset))\n', (5540, 5557), True, 'import numpy as np\n')... |
from __future__ import division, print_function
import os, types
import numpy as np
import vtk
from vtk.util.numpy_support import numpy_to_vtk
from vtk.util.numpy_support import vtk_to_numpy
import vtkplotter.colors as colors
##############################################################################
vtkMV = vtk.v... | [
"vtk.vtkSelectEnclosedPoints",
"vtk.vtkBoxWidget",
"numpy.ascontiguousarray",
"numpy.sin",
"vtk.vtkButterflySubdivisionFilter",
"numpy.arange",
"vtkplotter.colors.getColor",
"vtk.vtkShrinkPolyData",
"vtk.vtkCleanPolyData",
"vtk.vtkTextureMapToPlane",
"vtk.vtkCellCenters",
"vtkplotter.colors.ge... | [((979, 1007), 'numpy.arange', 'np.arange', (['start', 'stop', 'step'], {}), '(start, stop, step)\n', (988, 1007), True, 'import numpy as np\n'), ((1141, 1178), 'numpy.array', 'np.array', (['[x, y, z]'], {'dtype': 'np.float64'}), '([x, y, z], dtype=np.float64)\n', (1149, 1178), True, 'import numpy as np\n'), ((1351, 13... |
from bs4 import BeautifulSoup
import requests
import pandas as pd
import numpy as np
import csv
import tmdbsimple as tmdb
import time
import numpy as np
import datetime
import copy
from unidecode import unidecode
import calendar
from ast import literal_eval
from sklearn.feature_extraction.text import TfidfVectorizer,... | [
"pandas.Series",
"hybrid.get_svd",
"csv.DictWriter",
"sklearn.metrics.pairwise.cosine_similarity",
"pandas.read_csv",
"sklearn.feature_extraction.text.CountVectorizer",
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"nltk.stem.snowball.SnowballStemmer",
"tmdbsimple.Search",
"datetime.datet... | [((860, 873), 'tmdbsimple.Search', 'tmdb.Search', ([], {}), '()\n', (871, 873), True, 'import tmdbsimple as tmdb\n'), ((4518, 4557), 'pandas.read_csv', 'pd.read_csv', (["(path_dest + 'metadata.csv')"], {}), "(path_dest + 'metadata.csv')\n", (4529, 4557), True, 'import pandas as pd\n'), ((4570, 4606), 'pandas.read_csv',... |
import scipy.stats as st
import numpy as np
def getchannel(emplacement = 'trunku',intersection = 1):
""" get channel
Parameters
----------
emplacement : 'trunku' | 'thighr' | 'forearm' | 'calfr'
intersection : 1 = LOS 0 : NLOS
Returns
-------
alphak : np.array
tauk : np.array... | [
"numpy.sqrt",
"scipy.stats.norm",
"numpy.exp",
"scipy.stats.expon",
"numpy.cumsum"
] | [((1997, 2016), 'scipy.stats.expon', 'st.expon', (['(0)', 'Lambda'], {}), '(0, Lambda)\n', (2005, 2016), True, 'import scipy.stats as st\n'), ((2052, 2071), 'numpy.cumsum', 'np.cumsum', (['sampleTk'], {}), '(sampleTk)\n', (2061, 2071), True, 'import numpy as np\n'), ((2367, 2396), 'scipy.stats.norm', 'st.norm', (['alph... |
import math
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
def grayscale(img):
"""Applies the Grayscale transform
This will return an image with only one color channel
but NOTE: to see the returned image as grayscale
(assuming your grayscaled image is cal... | [
"numpy.polyfit",
"numpy.array",
"cv2.bitwise_or",
"matplotlib.pyplot.imshow",
"cv2.line",
"numpy.zeros_like",
"cv2.addWeighted",
"cv2.fillPoly",
"numpy.average",
"cv2.cvtColor",
"matplotlib.pyplot.title",
"cv2.Canny",
"cv2.GaussianBlur",
"matplotlib.pyplot.show",
"cv2.bitwise_and",
"nu... | [((396, 433), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (408, 433), False, 'import cv2\n'), ((644, 689), 'cv2.Canny', 'cv2.Canny', (['img', 'low_threshold', 'high_threshold'], {}), '(img, low_threshold, high_threshold)\n', (653, 689), False, 'import cv2\n'), ((7... |
import os
import io
import json
import trimesh
import random
import matplotlib.pyplot as plt
import numpy as np
import cv2
import torch
def load_bop_meshes(model_path, obj_ids="all"):
"""
Returns:
meshes: list[Trimesh]
objID2clsID: dict, objID (original) --> i (0-indexed)
"""
# load m... | [
"numpy.int32",
"io.BytesIO",
"numpy.array",
"cv2.imdecode",
"numpy.linalg.norm",
"numpy.arange",
"os.listdir",
"cv2.line",
"numpy.matmul",
"numpy.concatenate",
"random.randint",
"random.uniform",
"os.path.splitext",
"cv2.getRotationMatrix2D",
"cv2.imread",
"os.path.join",
"numpy.zero... | [((1627, 1650), 'random.randint', 'random.randint', (['(-dw)', 'dw'], {}), '(-dw, dw)\n', (1641, 1650), False, 'import random\n'), ((1662, 1685), 'random.randint', 'random.randint', (['(-dh)', 'dh'], {}), '(-dh, dh)\n', (1676, 1685), False, 'import random\n'), ((1699, 1765), 'numpy.array', 'np.array', (['[[1.0, 0.0, -p... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
from utils import *
pio.templates.default = "simple_white"
import plotly.io as pio
pio.renderers.default = "browser"
def test_univariate_gaussian():
mu = 10
sigma... | [
"numpy.random.normal",
"plotly.graph_objects.Layout",
"numpy.random.multivariate_normal",
"numpy.argmax",
"numpy.array",
"plotly.graph_objects.Figure",
"numpy.apply_along_axis",
"IMLearn.learners.MultivariateGaussian.log_likelihood",
"numpy.random.seed",
"numpy.linspace",
"plotly.graph_objects.S... | [((395, 428), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma', '(1000)'], {}), '(mu, sigma, 1000)\n', (411, 428), True, 'import numpy as np\n'), ((437, 457), 'IMLearn.learners.UnivariateGaussian', 'UnivariateGaussian', ([], {}), '()\n', (455, 457), False, 'from IMLearn.learners import UnivariateGaussian, Mul... |
#******************************************************************************
#
# tempoGAN: A Temporally Coherent, Volumetric GAN for Super-resolution Fluid Flow
# Copyright 2018 <NAME>, <NAME>, <NAME>, <NAME>
#
# This program is free software, distributed under the terms of the
# Apache License, Version 2.0
... | [
"tensorflow.unstack",
"paramhelpers.getNextGenericPath",
"tensorflow.shape",
"tensorflow.transpose",
"numpy.array",
"fluiddataloader.FluidDataLoader",
"tensorflow.control_dependencies",
"tensorflow.ones_like",
"tensorflow.set_random_seed",
"sys.path.append",
"tensorflow.RunMetadata",
"paramhel... | [((632, 659), 'sys.path.append', 'sys.path.append', (['"""../tools"""'], {}), "('../tools')\n", (647, 659), False, 'import sys\n'), ((1003, 1044), 'paramhelpers.getParam', 'ph.getParam', (['"""basePath"""', '"""../2ddata_gan/"""'], {}), "('basePath', '../2ddata_gan/')\n", (1014, 1044), True, 'import paramhelpers as ph\... |
# Check the following urls for more info about Pan-STARRS:
#
# https://outerspace.stsci.edu/display/PANSTARRS/PS1+Image+Cutout+Service#PS1ImageCutoutService-ImportantFITSimageformat,WCS,andflux-scalingnotes
# https://outerspace.stsci.edu/display/PANSTARRS/PS1+Stack+images#PS1Stackimages-Photometriccalibration
#... | [
"sep.sum_ellipse",
"numpy.log10",
"numpy.sqrt",
"numpy.log",
"numpy.nanmean",
"sep.Background",
"astropy.io.fits.open",
"photutils.CircularAnnulus",
"astropy.wcs.WCS",
"numpy.max",
"matplotlib.pyplot.close",
"photutils.CircularAperture",
"matplotlib.pyplot.subplots",
"pandas.DataFrame",
... | [((1452, 1485), 'sep.set_sub_object_limit', 'sep.set_sub_object_limit', (['(10000.0)'], {}), '(10000.0)\n', (1476, 1485), False, 'import sep\n'), ((1996, 2048), 'numpy.sqrt', 'np.sqrt', (['((X - centre[0]) ** 2 + (Y - centre[1]) ** 2)'], {}), '((X - centre[0]) ** 2 + (Y - centre[1]) ** 2)\n', (2003, 2048), True, 'impor... |
import torch
import numpy as np
import time
import tqdm
from .data_transforms import TransformedDataset
def test_unc_model(model, dataset, device, batch_size=1, **forward_kwargs):
pin_memory = True
if device == torch.device("cpu"):
pin_memory = False
dataloader = torch.utils.data.DataLoader(data... | [
"numpy.mean",
"numpy.sqrt",
"numpy.std",
"tqdm.tqdm",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"time.time",
"torch.device"
] | [((288, 404), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': 'batch_size', 'shuffle': '(False)', 'num_workers': '(4)', 'pin_memory': 'pin_memory'}), '(dataset, batch_size=batch_size, shuffle=False,\n num_workers=4, pin_memory=pin_memory)\n', (315, 404), False, 'import torc... |
def Poisson(lambd, N):
""" Devuelve una lista con elementos que siguen la distribución de Poisson
Parameters
----------
lambd : int
Es la tasa de la distribución
N : int
Número de puntos, tiempo trancurrido
Returns
-------
list
Lista de valores "k" para ... | [
"numpy.random.random",
"math.factorial",
"numpy.exp",
"numpy.empty",
"numpy.cumsum"
] | [((573, 587), 'numpy.empty', 'np.empty', (['maxk'], {}), '(maxk)\n', (581, 587), True, 'import numpy as np\n'), ((741, 759), 'numpy.cumsum', 'np.cumsum', (['Poisson'], {}), '(Poisson)\n', (750, 759), True, 'import numpy as np\n'), ((899, 918), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (915, 918),... |
import numpy as np
import numbers
import six
import datetime
import pyarrow as pa
MAX_LENGTH = 50
def _trim_string(value):
if len(value) > MAX_LENGTH:
value = repr(value[:MAX_LENGTH-3])[:-1] + '...'
return value
def _format_value(value):
# print("value = ", value, type(value), isinstance(value,... | [
"numpy.timedelta64",
"numpy.isnat",
"numpy.mod"
] | [((800, 815), 'numpy.isnat', 'np.isnat', (['value'], {}), '(value)\n', (808, 815), True, 'import numpy as np\n'), ((985, 1000), 'numpy.isnat', 'np.isnat', (['value'], {}), '(value)\n', (993, 1000), True, 'import numpy as np\n'), ((1169, 1192), 'numpy.mod', 'np.mod', (['tmp.seconds', '(60)'], {}), '(tmp.seconds, 60)\n',... |
import numpy as np
import matplotlib.pyplot as plt
years = 501
eaten = np.loadtxt(f'./data/eaten-{years}.txt')
cow = eaten[:,0]
sheep = eaten[:,1]
print(cow.shape)
print(sheep.shape)
# kg/只
MASS = [
[753, 87.5, 3.94625],
[0, 0, 0],
[0, 0, 0]
]
# calorie/kg
# 所有能量都按照 million 计算
ENERGY_PER_MASS = np.array(... | [
"numpy.array",
"save_fig.save_to_file",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((72, 111), 'numpy.loadtxt', 'np.loadtxt', (['f"""./data/eaten-{years}.txt"""'], {}), "(f'./data/eaten-{years}.txt')\n", (82, 111), True, 'import numpy as np\n'), ((892, 939), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': '(12, 8)'}), '(nrows=1, ncols=1, figsize=(12, 8)... |
from math import cos, pi
from scipy import signal
import scipy.signal as sig
import matplotlib.pyplot as plt
import numpy
plt.close('all')
Fs = 5000 #Sample Frequ
sample = 5000 #Number of Samples
f = 100 #Sig gen Frequ
n = 2 #Order of Filter
rs = 30 ... | [
"matplotlib.pyplot.grid",
"scipy.signal.iirfilter",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.sin",
"scipy.signal.freqz",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((129, 145), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (138, 145), True, 'import matplotlib.pyplot as plt\n'), ((424, 499), 'scipy.signal.iirfilter', 'sig.iirfilter', (['n', 'w_c', '(0)', 'rs'], {'btype': '"""lowpass"""', 'analog': '(False)', 'ftype': '"""butter"""'}), "(n, w_c, 0, rs, ... |
# Copyright (c) 2003-2019 by <NAME>
#
# TreeCorr is free software: 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 conditions... | [
"numpy.sqrt",
"numpy.testing.assert_equal",
"numpy.log",
"math.log",
"treecorr.NNNCrossCorrelation",
"numpy.arctan2",
"test_helper.get_script_name",
"test_helper.do_pickle",
"numpy.genfromtxt",
"numpy.random.RandomState",
"test_helper.is_ccw",
"numpy.where",
"subprocess.Popen",
"numpy.test... | [((3284, 3359), 'treecorr.NNNCorrelation', 'treecorr.NNNCorrelation', ([], {'min_sep': '(5)', 'max_sep': '(20)', 'nbins': '(20)', 'bin_type': '"""LogRUV"""'}), "(min_sep=5, max_sep=20, nbins=20, bin_type='LogRUV')\n", (3307, 3359), False, 'import treecorr\n'), ((3716, 3842), 'treecorr.NNNCorrelation', 'treecorr.NNNCorr... |
import numpy as np
import matplotlib.pyplot as plt
evenR = np.array([1.212,3.368])
oddR = np.array([2.381])
S = evenR.size+oddR.size
prop = np.zeros(S)
tunn = np.zeros(S)
i=0
j=1
a=0.469
def rad(x):
return np.sqrt((1.1*np.pi)**2-x**2)
print (S)
print (prop)
print (tunn)
while i< evenR.size:
prop[2*i] = evenR[i]... | [
"numpy.sqrt",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.cos",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((60, 84), 'numpy.array', 'np.array', (['[1.212, 3.368]'], {}), '([1.212, 3.368])\n', (68, 84), True, 'import numpy as np\n'), ((91, 108), 'numpy.array', 'np.array', (['[2.381]'], {}), '([2.381])\n', (99, 108), True, 'import numpy as np\n'), ((141, 152), 'numpy.zeros', 'np.zeros', (['S'], {}), '(S)\n', (149, 152), Tru... |
#!/usr/bin/env python3
from contextlib import contextmanager
import pandas as pd
import numpy as np
import random
import torch
import time
import os
import argparse
from scipy import sparse
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.impute import ... | [
"numpy.abs",
"os.listdir",
"random.shuffle",
"pandas.read_csv",
"argparse.ArgumentParser",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"torch.nn.init.kaiming_normal_",
"torch.Tensor",
"os.path.join",
"sklearn.preprocessing.StandardScaler",
"numpy.array_sp... | [((591, 647), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Linear Regression"""'}), "(description='Linear Regression')\n", (614, 647), False, 'import argparse\n'), ((3218, 3241), 'torch.nn.Linear', 'torch.nn.Linear', (['dim', '(1)'], {}), '(dim, 1)\n', (3233, 3241), False, 'import torc... |
# -*- coding: utf-8 -*-
#################################################################
# File : imgfileutils.py
# Version : 1.4.5
# Author : czsrh
# Date : 10.12.2020
# Institution : Carl Zeiss Microscopy GmbH
# Location : https://github.com/zeiss-microscopy/OAD/blob/master/jupyter_noteboo... | [
"pydash.objects.has",
"PyQt5.QtGui.QColor",
"bioformats.omexml.OMEXML",
"lxml.etree.fromstring",
"aicspylibczi.CziFile",
"tifffile.TiffFile",
"os.path.exists",
"aicsimageio.AICSImage",
"numpy.mean",
"PyQt5.QtWidgets.QTableWidget",
"pathlib.Path",
"napari.gui_qt",
"tifffile.imsave",
"pandas... | [((7062, 7095), 'apeer_ometiff_library.omexmlClass.OMEXML', 'omexmlClass.OMEXML', (['omexml_string'], {}), '(omexml_string)\n', (7080, 7095), False, 'from apeer_ometiff_library import omexmlClass\n'), ((7260, 7285), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (7275, 7285), False, 'import o... |
from ipdb import set_trace as st
import os
import time
import random
import numpy as np
from loguru import logger
import torch
def set_seed(seed):
random.seed(seed)
np.random.seed(seed)
os.environ["PYTHONHASHSEED"] = str(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed) # type: ignore
... | [
"torch.sort",
"torch.manual_seed",
"numpy.random.beta",
"torch.randperm",
"loguru.logger.info",
"random.seed",
"torch.zeros_like",
"torch.argsort",
"torch.cuda.is_available",
"numpy.random.seed",
"os.path.abspath",
"torch.cuda.manual_seed"
] | [((153, 170), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (164, 170), False, 'import random\n'), ((175, 195), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (189, 195), True, 'import numpy as np\n'), ((245, 268), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (26... |
#!/usr/bin/env python
from sense2vec import Sense2Vec
from sense2vec.util import split_key
from pathlib import Path
import plac
from wasabi import msg
import numpy
def _get_shape(file_):
"""Return a tuple with (number of entries, vector dimensions). Handle
both word2vec/FastText format, which has a header wit... | [
"plac.annotations",
"pathlib.Path",
"wasabi.msg.good",
"numpy.asarray",
"plac.call",
"sense2vec.util.split_key",
"wasabi.msg.fail"
] | [((639, 848), 'plac.annotations', 'plac.annotations', ([], {'in_file': "('Vectors file (text-based)', 'positional', None, str)", 'vocab_file': "('Vocabulary file', 'positional', None, str)", 'out_dir': "('Path to output directory', 'positional', None, str)"}), "(in_file=('Vectors file (text-based)', 'positional', None,... |
"""
<NAME> - November 2020
This program creates stellar mass-selected group catalogs for ECO/RESOLVE-G3 using the new algorithm, described in the readme markdown.
The outline of this code is:
(1) Read in observational data from RESOLVE-B and ECO (the latter includes RESOLVE-A).
(2) Prepare arrays of input parameters... | [
"numpy.log10",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"scipy.interpolate.interp1d",
"numpy.argsort",
"numpy.array",
"numpy.percentile",
"matplotlib.pyplot.errorbar",
"foftools.fast_fof",
"numpy.arange",
"virtools.group_color_gap",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplot... | [((2094, 2120), 'numpy.percentile', 'np.percentile', (['x', '[84, 16]'], {}), '(x, [84, 16])\n', (2107, 2120), True, 'import numpy as np\n'), ((2298, 2331), 'pandas.read_csv', 'pd.read_csv', (['"""ECOdata_022521.csv"""'], {}), "('ECOdata_022521.csv')\n", (2309, 2331), True, 'import pandas as pd\n'), ((2350, 2387), 'pan... |
from types import MappingProxyType
from typing import Any, Union, Mapping, Callable, Optional, Sequence
from scanpy import logging as logg
from dask import delayed
from scipy.ndimage.filters import gaussian_filter as scipy_gf
import numpy as np
import dask.array as da
from skimage.color import rgb2gray
from skimage.... | [
"skimage.color.rgb2gray",
"dask.delayed",
"squidpy._constants._constants.Processing",
"types.MappingProxyType",
"squidpy._constants._pkg_constants.Key.img.process",
"dask.array.asarray",
"numpy.array",
"scanpy.logging.info",
"squidpy._docs.inject_docs"
] | [((1101, 1126), 'squidpy._docs.inject_docs', 'inject_docs', ([], {'p': 'Processing'}), '(p=Processing)\n', (1112, 1126), False, 'from squidpy._docs import d, inject_docs\n'), ((1074, 1087), 'skimage.color.rgb2gray', 'rgb2gray', (['img'], {}), '(img)\n', (1082, 1087), False, 'from skimage.color import rgb2gray\n'), ((15... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created 2022
@author: <NAME>
"""
from Levenshtein import distance as levenshtein_distance
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
print('Now Executing Trastuzumab Train/Val/Test Splitting...')
"""
This script serv... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"Levenshtein.distance",
"numpy.random.seed",
"pandas.DataFrame",
"pandas.concat",
"numpy.round",
"numpy.random.permutation"
] | [((2388, 2438), 'pandas.read_csv', 'pd.read_csv', (["(her2_path_local + 'mHER_H3_AgPos.csv')"], {}), "(her2_path_local + 'mHER_H3_AgPos.csv')\n", (2399, 2438), True, 'import pandas as pd\n'), ((2445, 2495), 'pandas.read_csv', 'pd.read_csv', (["(her2_path_local + 'mHER_H3_AgNeg.csv')"], {}), "(her2_path_local + 'mHER_H3... |
from .fis import FIS
import numpy as np
try:
import pandas as pd
except ImportError:
pd = None
try:
from sklearn.model_selection import GridSearchCV
except ImportError:
GridSearchCV = None
def _get_vars(fis):
"""Get an encoded version of the parameters of the fuzzy sets in a FIS"""
for vari... | [
"numpy.asarray"
] | [((3461, 3486), 'numpy.asarray', 'np.asarray', (['[]'], {'dtype': 'int'}), '([], dtype=int)\n', (3471, 3486), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""
Single VsOne Chip Match Interface
For VsMany Interaction
Interaction for looking at matches between a single query and database annotation
Main development file
CommandLine:
python -m ibeis.viz.interact.interact_matches --test-show_coverage --show
"""
from __future__ import absolute_i... | [
"utool.get_stats_str",
"utool.embed",
"plottool.gca",
"utool.doctest_funcs",
"multiprocessing.freeze_support",
"ibeis.algo.hots.scoring.get_kpts_distinctiveness",
"ibeis.algo.hots.scoring.get_masks",
"plottool.gcf",
"plottool.interact_helpers.connect_callback",
"plottool.plot_helpers.get_plotdat_d... | [((800, 842), 'utool.inject2', 'ut.inject2', (['__name__', '"""[interact_matches]"""'], {}), "(__name__, '[interact_matches]')\n", (810, 842), True, 'import utool as ut\n'), ((1699, 1739), 'six.add_metaclass', 'six.add_metaclass', (['ut.ReloadingMetaclass'], {}), '(ut.ReloadingMetaclass)\n', (1716, 1739), False, 'impor... |
"""Example systems created in Python
"""
import numpy as np
from pysim.cythonsystem import Sys
class VanDerPol(Sys):
"""Simple example of a class representing a VanDerPol oscillator.
"""
def __init__(self):
self.add_state_scalar("x", "dx")
self.add_state_scalar("y", "dy")
self.add_... | [
"numpy.zeros",
"numpy.ones"
] | [((2545, 2561), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (2553, 2561), True, 'import numpy as np\n'), ((2711, 2727), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (2719, 2727), True, 'import numpy as np\n'), ((2876, 2892), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (2884, ... |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ classifiers.py ]
# Synopsis [ 'Naive Bayes' and 'Decision Tree' training, testing, and tunning functions ]
# Author [ <NAME> (Andi611) ]
# Copyright [ Copyl... | [
"sklearn.naive_bayes.ComplementNB",
"numpy.arange",
"tqdm.tqdm",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"sklearn.naive_bayes.MultinomialNB",
"sklearn.naive_bayes.BernoulliNB",
"sklearn.naive_bayes.GaussianNB",
"sklearn.metrics.accuracy_score",
"graphviz.Source",
"... | [((863, 879), 'numpy.arange', 'np.arange', (['(1)', '(64)'], {}), '(1, 64)\n', (872, 879), True, 'import numpy as np\n'), ((889, 917), 'numpy.arange', 'np.arange', (['(0.001)', '(1.0)', '(0.001)'], {}), '(0.001, 1.0, 0.001)\n', (898, 917), True, 'import numpy as np\n'), ((936, 966), 'numpy.arange', 'np.arange', (['(0.0... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 21 19:43:50 2022
Illustrating a basic transient magnetic diffusion problem, See Jackson Section 5.18
@author: zettergm
"""
import numpy as np
import scipy.sparse.linalg
import scipy.sparse
from scipy.special import erf
import matplotlib.pyplot as ... | [
"numpy.abs",
"numpy.reshape",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.plot",
"difftools.matrix_kernel",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.title",... | [((549, 579), 'numpy.linspace', 'np.linspace', (['(-5 * a)', '(5 * a)', 'lz'], {}), '(-5 * a, 5 * a, lz)\n', (560, 579), True, 'import numpy as np\n'), ((808, 820), 'numpy.zeros', 'np.zeros', (['lz'], {}), '(lz)\n', (816, 820), True, 'import numpy as np\n'), ((1005, 1033), 'difftools.matrix_kernel', 'matrix_kernel', ([... |
# -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 applicabl... | [
"scipy.sparse.lil_matrix",
"numpy.reshape",
"random.shuffle",
"numpy.asarray",
"numpy.asanyarray",
"numpy.array",
"copy.deepcopy"
] | [((9091, 9114), 'copy.deepcopy', 'copy.deepcopy', (['clusters'], {}), '(clusters)\n', (9104, 9114), False, 'import copy\n'), ((12049, 12108), 'numpy.array', 'np.array', (['[node_lookup[n] for n in target_nodes_in_cluster]'], {}), '([node_lookup[n] for n in target_nodes_in_cluster])\n', (12057, 12108), True, 'import num... |
from typing import Optional, Any, Dict
import numpy as np
import pandas as pd
from more_itertools import first
from networkx import Graph, to_numpy_matrix
import matplotlib.pyplot as plt
import seaborn as sb
from adam.semantics import Concept, KindConcept, ObjectConcept, ActionConcept
class SemanticsManager:
de... | [
"numpy.mean",
"adam.semantics.ObjectConcept",
"matplotlib.pyplot.savefig",
"adam.semantics.KindConcept",
"seaborn.clustermap",
"networkx.Graph",
"matplotlib.pyplot.close",
"pandas.DataFrame",
"more_itertools.first",
"networkx.to_numpy_matrix"
] | [((2782, 2861), 'more_itertools.first', 'first', (['[n for n in semantics_graph.nodes if n.debug_string == identifier]', 'None'], {}), '([n for n in semantics_graph.nodes if n.debug_string == identifier], None)\n', (2787, 2861), False, 'from more_itertools import first\n'), ((3574, 3638), 'pandas.DataFrame', 'pd.DataFr... |
"""test_dataio.py - tests the dataio module
<NAME> (TRI/Austin, Inc.)
"""
__author__ = '<NAME>'
import unittest
from models import dataio
from controllers import pathfinder
from utils.skiptest import skipIfModuleNotInstalled
import h5py
import numpy as np
import numpy.testing
import scipy.misc
import os
import rando... | [
"numpy.fromfile",
"models.dataio.UTWinCscanReader",
"models.dataio.import_dicom",
"unittest.main",
"numpy.genfromtxt",
"os.walk",
"models.dataio.get_txt_data",
"models.dataio.UTWinCScanDataFile",
"os.path.exists",
"models.dataio.get_winspect_data",
"models.dataio.import_winspect",
"os.remove",... | [((6927, 6960), 'utils.skiptest.skipIfModuleNotInstalled', 'skipIfModuleNotInstalled', (['"""dicom"""'], {}), "('dicom')\n", (6951, 6960), False, 'from utils.skiptest import skipIfModuleNotInstalled\n'), ((7764, 7797), 'utils.skiptest.skipIfModuleNotInstalled', 'skipIfModuleNotInstalled', (['"""dicom"""'], {}), "('dico... |
from torch.utils.data import Dataset
import os
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
import h5py
import pandas as pd
import random
from scipy.io import loadmat
import Utils
from scipy import interpolate
from scipy import signal
import csv
from scipy.signal import butter, lfilter, fre... | [
"pandas.read_csv",
"numpy.array2string",
"matplotlib.pyplot.plot",
"pickle.load",
"h5py.File",
"numpy.max",
"numpy.array",
"numpy.stack",
"numpy.zeros",
"Utils.read_config_file",
"numpy.min",
"time.process_time",
"numpy.transpose",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((6608, 6627), 'time.process_time', 'time.process_time', ([], {}), '()\n', (6625, 6627), False, 'import time\n'), ((2547, 2591), 'h5py.File', 'h5py.File', (['self.brazilian_database_path', '"""r"""'], {}), "(self.brazilian_database_path, 'r')\n", (2556, 2591), False, 'import h5py\n'), ((2616, 2643), 'numpy.array', 'np... |
#!/bin/python
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
import math
# State vector:
# 0-3: quaternions (q0, q1, q2, q3)
# 4-6: Velocity - m/sec (North, East, Down)
# 7-9: Position - m (North, East, Down)
# 10-12: Delta Angle bias - rad (X,Y,Z)
#... | [
"matplotlib.pyplot.figure",
"numpy.genfromtxt",
"matplotlib.pyplot.show"
] | [((1319, 1331), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1329, 1331), True, 'import matplotlib.pyplot as plt\n'), ((1663, 1673), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1671, 1673), True, 'import matplotlib.pyplot as plt\n'), ((539, 791), 'numpy.genfromtxt', 'np.genfromtxt', (['"""S... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 16:54:42 2017
@author: Xiaobo
"""
import numpy as np
from mpi4py import MPI
import commands
import os
import sys
path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(path)
#sys.path.append('/Users/Xiaobo/git/CloudMerge/CloudMerge/cl... | [
"commands.getoutput",
"argparse.ArgumentParser",
"numpy.power",
"os.path.realpath",
"numpy.zeros",
"numpy.linspace",
"sys.path.append",
"multiway_merge.multiway_merger"
] | [((238, 259), 'sys.path.append', 'sys.path.append', (['path'], {}), '(path)\n', (253, 259), False, 'import sys\n'), ((2156, 2209), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""cloudmerge-hpc"""'}), "(description='cloudmerge-hpc')\n", (2179, 2209), False, 'import argparse\n'), ((3580, 3... |
#<NAME>
#Purdue University
#Email: <EMAIL>
#DESCRIPTION: Code written to isolate the magnitudes of harmonics of a
#given f_0 for a given audiofile/stimulus.
#Additional Dependencies: scipy, numpy, matplotlib
# pip3 install scipy
# pip3 install numpy
# pip3 install matplotlib
#May require ffmpeg on Ubuntu/Linux as we... | [
"numpy.multiply",
"numpy.ones",
"numpy.divide",
"numpy.asmatrix",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.max",
"numpy.exp",
"numpy.sum",
"matplotlib.pyplot.figure",
"scipy.io.wavfile.read",
"numpy.cos",
"signal_processing.pure_tone_complex",
"numpy.concatenate",
"numpy.sin",
... | [((514, 533), 'scipy.io.wavfile.read', 'wavfile.read', (['fname'], {}), '(fname)\n', (526, 533), False, 'from scipy.io import wavfile\n'), ((1073, 1089), 'numpy.sum', 'np.sum', (['x_sin', '(1)'], {}), '(x_sin, 1)\n', (1079, 1089), True, 'import numpy as np\n'), ((1104, 1120), 'numpy.sum', 'np.sum', (['x_cos', '(1)'], {... |
import numpy as np
from math import inf as infinity
from itertools import product
from collections import defaultdict
import random
import time
# Initializing the Tic-Tac-Toe environment
# Three rows-Three columns, creating an empty list of three empty lists
state_space = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ... | [
"numpy.full",
"numpy.loadtxt",
"itertools.product",
"numpy.argmax"
] | [((3773, 3799), 'numpy.full', 'np.full', (['Total_states', '(0.0)'], {}), '(Total_states, 0.0)\n', (3780, 3799), True, 'import numpy as np\n'), ((5312, 5357), 'numpy.loadtxt', 'np.loadtxt', (['"""trained_O.txt"""'], {'dtype': 'np.float64'}), "('trained_O.txt', dtype=np.float64)\n", (5322, 5357), True, 'import numpy as ... |
# Plotting tools and utility functions
# Nested GridSpec : https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_nested.html#sphx-glr-gallery-subplots-axes-and-figures-gridspec-nested-py
# GridSpec : https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_multicolumn.html#sphx-glr-ga... | [
"matplotlib.pyplot.figure",
"numpy.interp"
] | [((1439, 1462), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'dim'}), '(figsize=dim)\n', (1449, 1462), True, 'from matplotlib import pyplot as plt\n'), ((1203, 1225), 'numpy.interp', 'np.interp', (['value', 'x', 'y'], {}), '(value, x, y)\n', (1212, 1225), True, 'import numpy as np\n')] |
import pdb
import numpy as np
import nose
import cudamat as cm
import learn as cl
def setup():
cm.cublas_init()
def teardown():
cm.cublas_shutdown()
def test_mult_by_sigmoid_deriv():
m = 256
n = 128
c_targets = np.array(np.random.randn(m, n)*10, dtype=np.float32, order='F')
c_acts = np.array(... | [
"cudamat.cublas_init",
"numpy.random.rand",
"learn.mult_by_sigmoid_deriv",
"cudamat.cublas_shutdown",
"cudamat.CUDAMatrix",
"nose.runmodule",
"numpy.random.randn"
] | [((100, 116), 'cudamat.cublas_init', 'cm.cublas_init', ([], {}), '()\n', (114, 116), True, 'import cudamat as cm\n'), ((138, 158), 'cudamat.cublas_shutdown', 'cm.cublas_shutdown', ([], {}), '()\n', (156, 158), True, 'import cudamat as cm\n'), ((388, 412), 'cudamat.CUDAMatrix', 'cm.CUDAMatrix', (['c_targets'], {}), '(c_... |
# This is a part of the program which removes the effect of the Differential Reddening from the main sequence of the masive star clusters.
# Reference: <NAME> et al (2012)
# The steps: 1. Plot a CMD, 2. Rotate the main sequence using theta = A_Filter_1/(A_Filter_I - A_Filter_II); A = Absorption Coefficients (Ref. Jans... | [
"numpy.median",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylabel",
"numpy.sin",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.scatter",
"pandas.DataFra... | [((516, 541), 'numpy.loadtxt', 'np.loadtxt', (['"""cluster.dat"""'], {}), "('cluster.dat')\n", (526, 541), True, 'import numpy as np\n'), ((748, 760), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (758, 760), True, 'import matplotlib.pyplot as plt\n'), ((761, 802), 'matplotlib.pyplot.scatter', 'plt.scatte... |
import numpy as np
import pandas as pd
import pytest
from rs_metrics.metrics import _ndcg_score
from rs_metrics import *
from rs_metrics.statistics import item_pop
def test_dcg_score_1():
assert _ndcg_score([1], [1], 1) == 1
def test_dcg_score_0():
assert _ndcg_score([1], [0], 1) == 0
def test_dcg_score_... | [
"pandas.DataFrame",
"numpy.log2",
"rs_metrics.statistics.item_pop",
"rs_metrics.metrics._ndcg_score"
] | [((759, 822), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 1], [1, 2]]'], {'columns': "['user_idx', 'item_id']"}), "([[1, 1], [1, 2]], columns=['user_idx', 'item_id'])\n", (771, 822), True, 'import pandas as pd\n'), ((836, 899), 'pandas.DataFrame', 'pd.DataFrame', (['[[1, 1], [1, 0]]'], {'columns': "['user_idx', 'item_i... |
import os, sys
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import sa_utils
import netgen_csg
import numpy as np
if __name__ == '__main__':
prefix = 'oht_8layers_3patches'
logger = sa_utils.LogWrapper(prefix+'/'+prefix)
netgen_csg.create_patches(box = np.array([0., 0., ... | [
"os.path.realpath",
"numpy.array",
"sa_utils.LogWrapper"
] | [((226, 268), 'sa_utils.LogWrapper', 'sa_utils.LogWrapper', (["(prefix + '/' + prefix)"], {}), "(prefix + '/' + prefix)\n", (245, 268), False, 'import sa_utils\n'), ((65, 91), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os, sys\n'), ((302, 343), 'numpy.array', 'n... |
import numpy as np
from gym.spaces import Box
from metaworld.envs import reward_utils
from metaworld.envs.asset_path_utils import full_v2_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerBinPickingEnvV2(SawyerXYZEnv):
"""
Motivation for V2:
... | [
"numpy.hstack",
"metaworld.envs.asset_path_utils.full_v2_path_for",
"numpy.log",
"gym.spaces.Box",
"numpy.array",
"numpy.concatenate",
"numpy.linalg.norm",
"metaworld.envs.reward_utils.hamacher_product",
"metaworld.envs.reward_utils.tolerance"
] | [((1036, 1069), 'numpy.array', 'np.array', (['[0.1199, 0.699, -0.001]'], {}), '([0.1199, 0.699, -0.001])\n', (1044, 1069), True, 'import numpy as np\n'), ((1090, 1123), 'numpy.array', 'np.array', (['[0.1201, 0.701, +0.001]'], {}), '([0.1201, 0.701, +0.001])\n', (1098, 1123), True, 'import numpy as np\n'), ((1461, 1488)... |
# -*- coding: utf-8 -*-
import numpy as np
from numba import jit
import matplotlib.pyplot as plt
import seaborn as sns
class BaseWindow():
"""Base window class."""
def __init__(self):
pass
def plot(self):
"""Show window.
"""
_, ax = plt.subplots(1)
sns.heatmap(se... | [
"numpy.abs",
"numpy.ones",
"seaborn.heatmap",
"numpy.zeros",
"numba.jit",
"numpy.argwhere",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((2283, 2301), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (2286, 2301), False, 'from numba import jit\n'), ((2354, 2393), 'numpy.zeros', 'np.zeros', (['(len_x, len_y)'], {'dtype': 'np.int8'}), '((len_x, len_y), dtype=np.int8)\n', (2362, 2393), True, 'import numpy as np\n'), ((282, 297), 'ma... |
import numpy
from methods.dna import PatternDNA
from methods.fuser import Fuser
from methods.fuser import init_indices
from methods.fuser import init_matched_group
L = PatternDNA(["L"], dna_strand=numpy.array([["T", "T", "R"], ["C", "T", "N"]]))
R = PatternDNA(["R"], dna_strand=numpy.array([["C", "G", "N"], [... | [
"numpy.array",
"methods.fuser.init_indices",
"methods.fuser.init_matched_group"
] | [((206, 253), 'numpy.array', 'numpy.array', (["[['T', 'T', 'R'], ['C', 'T', 'N']]"], {}), "([['T', 'T', 'R'], ['C', 'T', 'N']])\n", (217, 253), False, 'import numpy\n'), ((289, 336), 'numpy.array', 'numpy.array', (["[['C', 'G', 'N'], ['A', 'G', 'R']]"], {}), "([['C', 'G', 'N'], ['A', 'G', 'R']])\n", (300, 336), False, ... |
# -*- coding: utf-8 -*-
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
Frames of Reference orientation test functions
----------------------------------------------
"""
import pytest
import numpy as np
from numpy.testi... | [
"pyfme.utils.coordinates.hor2body",
"numpy.testing.assert_array_almost_equal",
"pyfme.utils.coordinates.check_alpha_beta_range",
"pyfme.utils.coordinates.hor2wind",
"pyfme.utils.coordinates.body2wind",
"pyfme.utils.coordinates.check_theta_phi_psi_range",
"numpy.array",
"pyfme.utils.coordinates.wind2ho... | [((1909, 1928), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (1917, 1928), True, 'import numpy as np\n'), ((1993, 2031), 'pyfme.utils.coordinates.body2hor', 'body2hor', (['vector_body', 'theta', 'phi', 'psi'], {}), '(vector_body, theta, phi, psi)\n', (2001, 2031), False, 'from pyfme.utils.coordinate... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 20 19:00:38 2020
@author: Mradumay
"""
import math
import matplotlib.pyplot as plt
from scipy.integrate import quad
import numpy as np
import pandas as pd
from colorama import Fore, Style
import os
import glob
import sys
num=int(input("Enter number... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"math.acos",
"math.floor",
"math.sqrt",
"math.cos",
"numpy.array",
"sys.exit",
"math.log10",
"numpy.mean",
"math.tan",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.linspace",
"pandas.DataFrame",
"m... | [((390, 411), 'math.ceil', 'math.ceil', (['(num / num1)'], {}), '(num / num1)\n', (399, 411), False, 'import math\n'), ((414, 425), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (423, 425), False, 'import os\n'), ((507, 521), 'os.chdir', 'os.chdir', (['cwd1'], {}), '(cwd1)\n', (515, 521), False, 'import os\n'), ((623, 72... |
import numpy as np
import pandas as pd
from joblib import Parallel, delayed
from sklearn.exceptions import NotFittedError
from sklearn.base import clone
from sklearn.linear_model import LinearRegression, Lasso
from sklearn.model_selection import KFold
REQUIRED_COLS = ['start_date', 'lat', 'lon', 'gt']
def _get_rmse(... | [
"numpy.copy",
"sklearn.exceptions.NotFittedError",
"sklearn.linear_model.Lasso",
"sklearn.base.clone",
"numpy.delete",
"numpy.argmax",
"numpy.square",
"joblib.Parallel",
"numpy.zeros",
"numpy.setdiff1d",
"numpy.concatenate",
"joblib.delayed",
"sklearn.model_selection.KFold"
] | [((1170, 1242), 'numpy.setdiff1d', 'np.setdiff1d', (['train_dataframe.columns', 'REQUIRED_COLS'], {'assume_unique': '(True)'}), '(train_dataframe.columns, REQUIRED_COLS, assume_unique=True)\n', (1182, 1242), True, 'import numpy as np\n'), ((2306, 2375), 'sklearn.linear_model.Lasso', 'Lasso', ([], {'alpha': '(0.001)', '... |
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import os
import numpy
import tensorflow as tf
import time
from tensorflow.python import ipu
from tensorflow.python.ipu import ipu_compiler, scopes, config
tf.compat.v1.disable_v2_behavior()
def matrix_solve_graph(A, b):
outputs = {
"output_types... | [
"tensorflow.compat.v1.disable_v2_behavior",
"tensorflow.python.ipu.config.IPUConfig",
"numpy.int32",
"numpy.array",
"tensorflow.python.ipu.ipu_compiler.compile",
"tensorflow.compat.v1.Session",
"numpy.arange",
"tensorflow.compat.v1.placeholder",
"numpy.repeat",
"numpy.max",
"numpy.min",
"numpy... | [((216, 250), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.compat.v1.disable_v2_behavior', ([], {}), '()\n', (248, 250), True, 'import tensorflow as tf\n'), ((455, 506), 'os.path.join', 'os.path.join', (['base_path', '"""libmatrix_solve_ce_op.so"""'], {}), "(base_path, 'libmatrix_solve_ce_op.so')\n", (467, 506), Fal... |
from keras.utils import np_utils
import numpy as np
import math
import matplotlib.pyplot as plt
class ChunkTest:
def __init__(self, time_delay):
self.chunk= 0
self.output_size = 10
self.counter = -1
self.time_delay = time_delay
self.time_counter = time_delay
self.output_class= 0
self.previous_output_... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.argmax",
"matplotlib.pyplot.close",
"numpy.exp",
"numpy.random.randint",
"keras.utils.np_utils.to_categorical",
"numpy.empty",
"numpy.random.randn",
"matplotlib.pyplot.show"
] | [((2282, 2302), 'numpy.empty', 'np.empty', (['iterations'], {}), '(iterations)\n', (2290, 2302), True, 'import numpy as np\n'), ((2322, 2362), 'numpy.empty', 'np.empty', (['(iterations, self.output_size)'], {}), '((iterations, self.output_size))\n', (2330, 2362), True, 'import numpy as np\n'), ((2686, 2709), 'numpy.asa... |
import numpy as np
import librosa
import json
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys
sys.path.append('vggish/')
from math import pi
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import OneHotEncoder
import pickle
import xgboost as xgb
from scipy.fftpack import fft, hilb... | [
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.sqrt",
"librosa.feature.zero_crossing_rate",
"librosa.feature.mfcc",
"numpy.array",
"scipy.fftpack.fft",
"scipy.fftpack.hilbert",
"librosa.effects.trim",
"sys.path.append",
"librosa.feature.rms",
"librosa.feature.spectral_centroid",
"tensorflo... | [((111, 137), 'sys.path.append', 'sys.path.append', (['"""vggish/"""'], {}), "('vggish/')\n", (126, 137), False, 'import sys\n'), ((341, 374), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (364, 374), False, 'import warnings\n'), ((410, 434), 'tensorflow.compat.v1.disable... |
from __future__ import absolute_import
from __future__ import print_function
import os
import glob
import numpy as np
from scipy.interpolate import UnivariateSpline
from .core import file_finder, load_probe, load_fs, load_clusters, load_spikes
from .core import find_info, find_kwd, find_kwik, find_kwx
import h5py as h5... | [
"numpy.fromfile",
"numpy.count_nonzero",
"numpy.array",
"numpy.arange",
"os.path.exists",
"numpy.mean",
"numpy.reshape",
"numpy.where",
"os.path.split",
"numpy.dot",
"os.path.splitext",
"h5py.File",
"numpy.sign",
"scipy.interpolate.UnivariateSpline",
"six.moves.range",
"os.makedirs",
... | [((2311, 2352), 'numpy.fromfile', 'np.fromfile', (['mean_masks'], {'dtype': 'np.float32'}), '(mean_masks, dtype=np.float32)\n', (2322, 2352), True, 'import numpy as np\n'), ((3708, 3751), 'numpy.array', 'np.array', (['[geometry[ch] for ch in channels]'], {}), '([geometry[ch] for ch in channels])\n', (3716, 3751), True,... |
import json
import os
import pickle
import sys
import cv2
import numpy as np
this_filepath = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(this_filepath, '../src/detectron2/projects/DensePose/'))
from densepose import add_densepose_config, add_hrnet_config
from densepose.data.structures imp... | [
"numpy.mean",
"pickle.dump",
"detectron2.config.get_cfg",
"densepose.add_hrnet_config",
"densepose.data.structures.DensePoseResult.decode_png_data",
"os.makedirs",
"src.utils.image.recover_original_mask_size",
"src.utils.image.create_context",
"os.path.join",
"src.dataset.MINDS.MINDSDataset",
"o... | [((111, 136), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (126, 136), False, 'import os\n'), ((154, 222), 'os.path.join', 'os.path.join', (['this_filepath', '"""../src/detectron2/projects/DensePose/"""'], {}), "(this_filepath, '../src/detectron2/projects/DensePose/')\n", (166, 222), False,... |
from PIL import Image
import cv2
from decimal import getcontext, Decimal
import pickle
import network
import numpy as np
def convert_image():
image = Image.open('z.jpg').convert('L')
new_image = image.resize((28, 28), Image.ANTIALIAS)
quality_val = 100
new_image.save('img_28.jpg', quality=quality_val)... | [
"numpy.ndarray",
"decimal.getcontext",
"cv2.imread",
"PIL.Image.open"
] | [((337, 383), 'cv2.imread', 'cv2.imread', (['"""img_28.jpg"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('img_28.jpg', cv2.IMREAD_GRAYSCALE)\n", (347, 383), False, 'import cv2\n'), ((852, 878), 'numpy.ndarray', 'np.ndarray', ([], {'shape': '(784, 1)'}), '(shape=(784, 1))\n', (862, 878), True, 'import numpy as np\n'), ((882, 894... |
import numpy as np
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PAR_DIR = os.path.dirname(os.path.dirname(BASE_DIR))
RLG_DIR = os.path.join(PAR_DIR,'result/rot_log')
LOG_FOUT = open(os.path.join(BASE_DIR, 'calShape.txt'), 'w')
NUM_CLASSES = 40
SHAPE_NAMES = [line.rstrip() for line in \
open(... | [
"os.path.abspath",
"os.path.dirname",
"numpy.load",
"os.path.join"
] | [((148, 187), 'os.path.join', 'os.path.join', (['PAR_DIR', '"""result/rot_log"""'], {}), "(PAR_DIR, 'result/rot_log')\n", (160, 187), False, 'import os\n'), ((57, 82), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (72, 82), False, 'import os\n'), ((111, 136), 'os.path.dirname', 'os.path.dirn... |
#!/usr/bin/env python3
import gym
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn import init
from tqdm import tqdm
import random
import math
import operator
import matplotlib.pyplot as plt
import numpy as np
use_cuda = torch.cuda.is_available()
cla... | [
"math.floor",
"numpy.polyfit",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.init.xavier_uniform",
"operator.itemgetter",
"gym.make",
"random.choice",
"matplotlib.pyplot.savefig",
"random.randrange",
"torch.nn.init.uniform",
"torch.save",
"torch.nn.Conv2d",
"numpy.append",
"numpy.z... | [((290, 315), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (313, 315), False, 'import torch\n'), ((8047, 8083), 'torch.save', 'torch.save', (['bestNet', '"""Pongexpert.pt"""'], {}), "(bestNet, 'Pongexpert.pt')\n", (8057, 8083), False, 'import torch\n'), ((2525, 2544), 'gym.make', 'gym.make', ... |
#!/usr/bin/env python3
import csv
import datetime
import os
import shelve
from time import time
import matplotlib.pyplot as plt
import numpy as np
from scipy.special import expit as activation_function # sigmoid function
from scipy.special import logit as inverse_activation_function
import wget
# CONFIG
DATA_DIR =... | [
"wget.download",
"numpy.asfarray",
"numpy.array",
"shelve.open",
"datetime.timedelta",
"matplotlib.pyplot.imshow",
"os.path.exists",
"numpy.asarray",
"numpy.max",
"numpy.dot",
"numpy.min",
"csv.reader",
"numpy.argmax",
"scipy.special.expit",
"numpy.transpose",
"time.time",
"matplotli... | [((529, 570), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""mnist_train.csv"""'], {}), "(DATA_DIR, 'mnist_train.csv')\n", (541, 570), False, 'import os\n'), ((583, 623), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""mnist_test.csv"""'], {}), "(DATA_DIR, 'mnist_test.csv')\n", (595, 623), False, 'import os\n'), (... |
import numpy as np
def compute_fans(shape):
if len(shape) == 2:
fan_in, fan_out = shape[0], shape[1]
else:
fan_in, fan_out = np.prod(shape[1:]), shape[0]
return fan_in, fan_out
class initializer(object):
def __call__(self, shape):
return self.init(shape).astype(np.float32)
... | [
"numpy.prod",
"numpy.sqrt",
"numpy.full",
"numpy.random.uniform"
] | [((151, 169), 'numpy.prod', 'np.prod', (['shape[1:]'], {}), '(shape[1:])\n', (158, 169), True, 'import numpy as np\n'), ((854, 887), 'numpy.sqrt', 'np.sqrt', (['(6.0 / (fan_in + fan_out))'], {}), '(6.0 / (fan_in + fan_out))\n', (861, 887), True, 'import numpy as np\n'), ((507, 549), 'numpy.full', 'np.full', ([], {'shap... |
# (c) 2017 <NAME>
import numpy as np
from scipy.special import digamma
from scipy.stats import poisson, gamma
from matplotlib import pyplot as plt
euler = 0.577215664901532
t = np.linspace(0, 10, 1000)
plt.plot(t, t*np.exp(t)/np.expm1(t))
plt.show()
exit()
#plt.plot(t, digamma(t))
#plt.plot(t, np.log(t/(1 - np.exp(-t... | [
"scipy.special.digamma",
"scipy.stats.poisson.pmf",
"matplotlib.pyplot.plot",
"numpy.expm1",
"numpy.exp",
"numpy.linspace",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((179, 203), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(1000)'], {}), '(0, 10, 1000)\n', (190, 203), True, 'import numpy as np\n'), ((241, 251), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (249, 251), True, 'from matplotlib import pyplot as plt\n'), ((684, 698), 'matplotlib.pyplot.plot', 'plt.plot... |
#!/usr/bin/env python3
"""
Module to implement the Modified Seminario Method
Originally written by <NAME>, TCM, University of Cambridge
Modified by <NAME> and rewritten by <NAME>, Newcastle University
Reference using AEA Allen, MC Payne, DJ Cole, J. Chem. Theory Comput. (2018), doi:10.1021/acs.jctc.7b00785
"""
from Q... | [
"numpy.cross",
"numpy.linalg.eig",
"numpy.average",
"numpy.real",
"numpy.zeros",
"numpy.dot",
"numpy.empty",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"operator.itemgetter",
"QUBEKit.utils.decorators.for_all_methods"
] | [((5725, 5754), 'QUBEKit.utils.decorators.for_all_methods', 'for_all_methods', (['timer_logger'], {}), '(timer_logger)\n', (5740, 5754), False, 'from QUBEKit.utils.decorators import for_all_methods, timer_logger\n'), ((837, 857), 'numpy.cross', 'np.cross', (['u_bc', 'u_ab'], {}), '(u_bc, u_ab)\n', (845, 857), True, 'im... |
"""Utility functions for operating on geometry. See the :class:`Geometry3D`
documentation for the core geometry class.
.. versionadded:: 0.8.6
[functions moved here from :mod:`klampt.model.sensing`]
Working with geometric primitives
=================================
:func:`box` and :func:`sphere` are aliases for... | [
"numpy.cross",
"numpy.linalg.eig",
"numpy.average",
"numpy.left_shift",
"numpy.asarray",
"math.sqrt",
"numpy.column_stack",
"numpy.bitwise_and",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"collections.defaultdict",
"numpy.sum",
"numpy.outer",
"numpy.linalg.norm",
"numpy.argmin",
"war... | [((8307, 8328), 'numpy.array', 'np.array', (['pc.vertices'], {}), '(pc.vertices)\n', (8315, 8328), True, 'import numpy as np\n'), ((10118, 10137), 'numpy.asarray', 'np.asarray', (['normals'], {}), '(normals)\n', (10128, 10137), True, 'import numpy as np\n'), ((11197, 11239), 'numpy.cross', 'np.cross', (['(point2 - poin... |
import numpy as np
from wrappa import WrappaObject, WrappaImage
class DSModel:
def __init__(self, **kwargs):
pass
def predict(self, data, **kwargs):
_ = kwargs
# Data is always an array of WrappaObjects
responses = []
for obj in data:
img = obj.image.as_n... | [
"wrappa.WrappaImage.init_from_ndarray",
"numpy.rot90"
] | [((353, 366), 'numpy.rot90', 'np.rot90', (['img'], {}), '(img)\n', (361, 366), True, 'import numpy as np\n'), ((804, 817), 'numpy.rot90', 'np.rot90', (['img'], {}), '(img)\n', (812, 817), True, 'import numpy as np\n'), ((844, 865), 'numpy.rot90', 'np.rot90', (['rotated_img'], {}), '(rotated_img)\n', (852, 865), True, '... |
"""
This module defines some plotting functions that are used by the
BALTO GUI app. It should be included in the same directory as
"balto_gui.py" and the corresponding Jupyter notebook.
"""
#------------------------------------------------------------------------
#
# Copyright (C) 2020. <NAME>
#
#-------------------... | [
"numpy.histogram",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"numpy.invert",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplots"... | [((1016, 1055), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(x_size, y_size)'}), '(1, figsize=(x_size, y_size))\n', (1026, 1055), True, 'import matplotlib.pyplot as plt\n'), ((1631, 1660), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {'marker': 'marker'}), '(x, y, marker=marker)\n', (1639, 16... |
import torch.utils.data as data
import os,sys
import numpy as np
import pickle
sys.path.insert(0, '../')
def default_loader(path):
return pickle.load(open(path, 'rb'))
def parse_data(data, cur_num_boxes, w, h, num_boxes):
features, boxes, attn_target, use, objs, atts, att_use = [], [], [], [], [], [], []
... | [
"numpy.zeros",
"sys.path.insert",
"numpy.asarray"
] | [((79, 104), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../"""'], {}), "(0, '../')\n", (94, 104), False, 'import os, sys\n'), ((1988, 2015), 'numpy.zeros', 'np.zeros', (['self.a_vocab_size'], {}), '(self.a_vocab_size)\n', (1996, 2015), True, 'import numpy as np\n'), ((446, 460), 'numpy.asarray', 'np.asarray', (... |
### NOTE: This final will not run!
### The following functions are not included as our model is proprietary.
### The following (self explanatory) functions would need to be implemented in order for this script to interact with a given structural model.
# modify_material_properties_in_structural_FEA_model(Emultiplier)
... | [
"numpy.abs",
"csv.reader"
] | [((2353, 2374), 'csv.reader', 'csv.reader', (['inputfile'], {}), '(inputfile)\n', (2363, 2374), False, 'import csv\n'), ((1336, 1376), 'numpy.abs', 'np.abs', (['(TARGET_FREQS[0] - frequencies[0])'], {}), '(TARGET_FREQS[0] - frequencies[0])\n', (1342, 1376), True, 'import numpy as np\n'), ((1395, 1435), 'numpy.abs', 'np... |
import copy, os
import tensorflow as tf
import numpy as np
from lib.tf_ops import shape_list, spacial_shape_list, tf_tensor_stats, tf_norm2, tf_angle_between
from lib.util import load_numpy
from .renderer import Renderer
from .transform import GridTransform
from .vector import GridShape, Vector3
import logging
... | [
"logging.getLogger",
"tensorflow.pad",
"tensorflow.boolean_mask",
"lib.tf_ops.tf_tensor_stats",
"tensorflow.split",
"lib.tf_ops.spacial_shape_list",
"lib.tf_ops.tf_norm2",
"tensorflow.ones_like",
"tensorflow.reduce_mean",
"copy.copy",
"tensorflow.cast",
"numpy.load",
"lib.util.load_numpy",
... | [((329, 357), 'logging.getLogger', 'logging.getLogger', (['"""Structs"""'], {}), "('Structs')\n", (346, 357), False, 'import logging\n'), ((576, 612), 'tensorflow.range', 'tf.range', (['shape[0]'], {'dtype': 'tf.float32'}), '(shape[0], dtype=tf.float32)\n', (584, 612), True, 'import tensorflow as tf\n'), ((614, 650), '... |
#!/usr/bin/python
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# LASER Language-Agnostic SEntence Representations
# is a toolkit to calculate multilingual s... | [
"indexing.SplitOpen",
"re.compile",
"numpy.argsort",
"indexing.IndexTextQuery",
"embed.EncodeTime",
"sys.exit",
"sys.path.append",
"embed.EncodeLoad",
"faiss.normalize_L2",
"argparse.ArgumentParser",
"indexing.IndexLoad",
"numpy.dot",
"numpy.empty",
"indexing.IndexTextOpen",
"collections... | [((817, 855), 'sys.path.append', 'sys.path.append', (["(LASER + '/source/lib')"], {}), "(LASER + '/source/lib')\n", (832, 855), False, 'import sys\n'), ((1080, 1098), 're.compile', 're.compile', (['"""\\\\s+"""'], {}), "('\\\\s+')\n", (1090, 1098), False, 'import re\n'), ((1106, 1148), 'collections.namedtuple', 'namedt... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from typing import List
import numpy as np
import torch
from pytext.models.representations.transformer import (
TransformerLayer,
MultiheadSelfAttention,
)
from pytext.models.roberta import RoBERTaEncoder
from torch... | [
"torch.ops.load_library",
"numpy.sqrt",
"torch.tensor",
"torch.ops.fastertransformer.rebuild_padding",
"torch.ops.fastertransformer.build_mask_remove_padding",
"torch.zeros"
] | [((340, 417), 'torch.ops.load_library', 'torch.ops.load_library', (['"""//pytorch/FasterTransformers3.1:faster_transformers"""'], {}), "('//pytorch/FasterTransformers3.1:faster_transformers')\n", (362, 417), False, 'import torch\n'), ((1939, 1954), 'torch.tensor', 'torch.tensor', (['(0)'], {}), '(0)\n', (1951, 1954), F... |
import numpy as np
from ._base import LinearModel
from ._regularization import REGULARIZE, Regularizer
from utils import batch
class LinearRegression(LinearModel):
"""Linear regression model."""
def __init__(self, regular: REGULARIZE = None):
super().__init__()
if REGULARIZE is not None:
... | [
"numpy.ones",
"utils.batch",
"numpy.power",
"numpy.matmul",
"numpy.isinf"
] | [((1070, 1099), 'utils.batch', 'batch', (['x', 'y', 'self._batch_size'], {}), '(x, y, self._batch_size)\n', (1075, 1099), False, 'from utils import batch\n'), ((2020, 2045), 'numpy.matmul', 'np.matmul', (['x_ext.T', 'x_ext'], {}), '(x_ext.T, x_ext)\n', (2029, 2045), True, 'import numpy as np\n'), ((2073, 2098), 'numpy.... |
"""Test gates defined in `qibo/core/gates.py`."""
import pytest
import numpy as np
from qibo import gates, K
from qibo.config import raise_error
from qibo.tests.utils import random_state, random_density_matrix
def apply_gates(gatelist, nqubits=None, initial_state=None):
if initial_state is None:
state = K... | [
"qibo.gates.Unitary",
"numpy.trace",
"qibo.K.to_numpy",
"numpy.sqrt",
"qibo.gates.CZ",
"qibo.gates.CallbackGate",
"qibo.K.qnp.zeros",
"qibo.gates.KrausChannel",
"qibo.gates.CNOT",
"qibo.gates.U2",
"qibo.tests.utils.random_state",
"qibo.gates.U1",
"qibo.gates.RZ",
"numpy.array",
"qibo.gat... | [((4644, 4692), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""applyx"""', '[True, False]'], {}), "('applyx', [True, False])\n", (4667, 4692), False, 'import pytest\n'), ((6373, 6421), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""applyx"""', '[False, True]'], {}), "('applyx', [False, True])\... |
"""
Experiment for NN4(RI)
Aim: To find the best max_epochs for NN4(*, 1024, 1024, 1024) + RI(k = 3, m = 200)
max_epochs: [22, 24, ... ,98, 140]
Averaging 20 models
Summary
epochs 88 , loss 0.421860471364
Time:3:40:30 on i7-4790k 32G MEM GTX660
I got a different result, epochs 112 loss 0.422868, before I... | [
"pandas.read_csv",
"pylearn2.models.mlp.MLP",
"pylearn2.train.Train",
"sklearn.metrics.log_loss",
"pylearn2.models.mlp.RectifiedLinear",
"pylearn2.models.mlp.Softmax",
"pylearn2.training_algorithms.learning_rule.Momentum",
"pylearn2.datasets.DenseDesignMatrix",
"os.path.exists",
"os.mkdir",
"pan... | [((1384, 1420), 'pandas.read_csv', 'pd.read_csv', (['file_train'], {'index_col': '(0)'}), '(file_train, index_col=0)\n', (1395, 1420), True, 'import pandas as pd\n'), ((1578, 1597), 'sklearn.preprocessing.StandardScaler', 'pp.StandardScaler', ([], {}), '()\n', (1595, 1597), True, 'import sklearn.preprocessing as pp\n')... |
import numpy as np
import pytest
from chainer_chemistry.dataset.preprocessors import wle_util
def test_to_index():
values = ['foo', 'bar', 'buz', 'non-exist']
mols = [['foo', 'bar', 'buz'], ['foo', 'foo'], ['buz', 'bar']]
actual = wle_util.to_index(mols, values)
expect = np.array([np.array([0, 1, 2]... | [
"chainer_chemistry.dataset.preprocessors.wle_util.to_index",
"chainer_chemistry.dataset.preprocessors.wle_util.get_neighbor_representation",
"numpy.swapaxes",
"pytest.mark.parametrize",
"numpy.array",
"numpy.zeros",
"pytest.raises",
"chainer_chemistry.dataset.preprocessors.wle_util.get_focus_node_labe... | [((2575, 2696), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""label, expect"""', "[('a-b', 'a'), ('a-b.c', 'a'), ('aa-b', 'aa'), ('a-', 'a'), ('aa-', 'aa')]"], {}), "('label, expect', [('a-b', 'a'), ('a-b.c', 'a'), (\n 'aa-b', 'aa'), ('a-', 'a'), ('aa-', 'aa')])\n", (2598, 2696), False, 'import pytest\... |
# ///////////////////////////////////////////////////////////////
#
# BY: <NAME>
# PROJECT MADE WITH: Qt Designer and PySide6
# V: 1.0.0
#
# This project can be used freely for all uses, as long as they maintain the
# respective credits only in the Python scripts, any information in the visual
# interface (GUI) can be ... | [
"cli.SEMA",
"numpy.empty",
"pandas.read_excel"
] | [((6071, 6099), 'pandas.read_excel', 'pd.read_excel', (['self.filename'], {}), '(self.filename)\n', (6084, 6099), True, 'import pandas as pd\n'), ((6183, 6215), 'numpy.empty', 'np.empty', (['df[columns2show].shape'], {}), '(df[columns2show].shape)\n', (6191, 6215), True, 'import numpy as np\n'), ((7402, 7431), 'cli.SEM... |
from unittest import TestCase
import numpy as np
import math
from somnium.lattice import LatticeFactory
from scipy.spatial.distance import pdist, squareform
from itertools import combinations, product, compress
from somnium.tests.util import euclidean_distance
class TestRectLattice(TestCase):
def test_dimension(... | [
"numpy.allclose",
"numpy.isclose",
"scipy.spatial.distance.pdist",
"somnium.lattice.LatticeFactory.build",
"itertools.product",
"somnium.tests.util.euclidean_distance",
"itertools.combinations",
"itertools.compress"
] | [((341, 369), 'somnium.lattice.LatticeFactory.build', 'LatticeFactory.build', (['"""rect"""'], {}), "('rect')\n", (361, 369), False, 'from somnium.lattice import LatticeFactory\n'), ((594, 622), 'somnium.lattice.LatticeFactory.build', 'LatticeFactory.build', (['"""rect"""'], {}), "('rect')\n", (614, 622), False, 'from ... |
from __future__ import print_function
import numpy as np
import sys
import mesh.patch as patch
from util import msg
def init_data(my_data, rp):
""" initialize the HSE problem """
msg.bold("initializing the HSE problem...")
# make sure that we are passed a valid patch object
if not isinstance(my_da... | [
"numpy.exp",
"util.msg.bold",
"sys.exit"
] | [((192, 235), 'util.msg.bold', 'msg.bold', (['"""initializing the HSE problem..."""'], {}), "('initializing the HSE problem...')\n", (200, 235), False, 'from util import msg\n'), ((438, 448), 'sys.exit', 'sys.exit', ([], {}), '()\n', (446, 448), False, 'import sys\n'), ((1309, 1330), 'numpy.exp', 'np.exp', (['(-myg.y[j... |
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
from numpy import sqrt, exp, pi
def normal_dot_minus_stress(x, n, beam_width):
n /= np.linalg.norm(n)
r = sqrt(np.linalg.norm(x)**2 - np.dot(x, n)**2)
beam_profile = exp(-(r / beam_width)**2) / pi / beam_width**2
r... | [
"numpy.tensordot",
"numpy.exp",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.norm"
] | [((178, 195), 'numpy.linalg.norm', 'np.linalg.norm', (['n'], {}), '(n)\n', (192, 195), True, 'import numpy as np\n'), ((326, 364), 'numpy.tensordot', 'np.tensordot', (['(-n)', 'beam_profile'], {'axes': '(0)'}), '(-n, beam_profile, axes=0)\n', (338, 364), True, 'import numpy as np\n'), ((436, 447), 'numpy.zeros', 'np.ze... |
import numpy as np
import xarray
from numpy.ma.core import default_fill_value
from scipy import ndimage
from enstools.core import check_arguments
from enstools.misc import count_ge
from enstools.core.parallelisation import apply_chunkwise
@check_arguments(units={"pr": "kg m-2 s-1",
"cape": "J ... | [
"enstools.core.check_arguments",
"enstools.misc.count_ge",
"numpy.full_like",
"numpy.ma.masked_equal",
"scipy.ndimage.filters.gaussian_filter",
"numpy.where",
"xarray.DataArray"
] | [((242, 353), 'enstools.core.check_arguments', 'check_arguments', ([], {'units': "{'pr': 'kg m-2 s-1', 'cape': 'J kg-1', 'return_value': 'hour'}", 'shape': "{'pr': 'cape'}"}), "(units={'pr': 'kg m-2 s-1', 'cape': 'J kg-1', 'return_value':\n 'hour'}, shape={'pr': 'cape'})\n", (257, 353), False, 'from enstools.core im... |
import numpy as np
import pandas as pd
from collections import Counter
from sklearn.utils import resample
from tqdm.notebook import tqdm_notebook
import copy
from sklearn.base import is_classifier
class DSClassifier:
"""This classifier is designed to handle unbalanced data.
The classification is based... | [
"numpy.unique",
"sklearn.base.is_classifier",
"collections.Counter",
"sklearn.utils.resample",
"copy.deepcopy",
"pandas.concat"
] | [((2230, 2259), 'sklearn.base.is_classifier', 'is_classifier', (['base_estimator'], {}), '(base_estimator)\n', (2243, 2259), False, 'from sklearn.base import is_classifier\n'), ((4776, 4794), 'numpy.unique', 'np.unique', (['y_train'], {}), '(y_train)\n', (4785, 4794), True, 'import numpy as np\n'), ((2905, 2942), 'pand... |
# Multiple Linear Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
print(X)
"""
[[165349.2 136897.8 471784.1 'New York']
[162597.... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.linear_model.LinearRegression",
"numpy.set_printoptions"
] | [((162, 192), 'pandas.read_csv', 'pd.read_csv', (['"""50_Startups.csv"""'], {}), "('50_Startups.csv')\n", (173, 192), True, 'import pandas as pd\n'), ((4969, 5022), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'random_state': '(0)'}), '(X, y, test_size=0.2, random_... |
import torch
import numpy as np
import onnx
import os
from onnx2keras import onnx_to_keras, check_torch_keras_error
from relu import LayerReLUTest, FReLUTest
from hard_tanh import LayerHardtanhTest, FHardtanhTest
from leaky_relu import LayerLeakyReLUTest, FLeakyReLUTest
from selu import LayerSELUTest, FSELUTest
from ... | [
"onnx2keras.check_torch_keras_error",
"onnx2keras.onnx_to_keras",
"onnx.load",
"os.unlink",
"numpy.random.uniform",
"torch.FloatTensor",
"torch.onnx.export"
] | [((1717, 1758), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '(1, 3, 224, 224)'], {}), '(0, 1, (1, 3, 224, 224))\n', (1734, 1758), True, 'import numpy as np\n'), ((1783, 1810), 'torch.FloatTensor', 'torch.FloatTensor', (['input_np'], {}), '(input_np)\n', (1800, 1810), False, 'import torch\n'), ((1824, 1... |
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, copysign
from scipy.optimize import brenth
from scipy.optimize import fsolve,fmin_l_bfgs_b,fmin_cg,fminbound
"""
sign of the number
"""
def sign(x):
if x==0:
return 0
else:
return copysign(1,x)
"""
if function f can't b... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"scipy.optimize.fminbound",
"math.copysign",
"scipy.optimize.brenth",
"numpy.linspace",
"matplotlib.pyplot.close",
"matplotlib.pyp... | [((2562, 2614), 'scipy.optimize.fmin_l_bfgs_b', 'fmin_l_bfgs_b', ([], {'func': 'f', 'x0': '((a + b) / 2)', 'bounds': '[a, b]'}), '(func=f, x0=(a + b) / 2, bounds=[a, b])\n', (2575, 2614), False, 'from scipy.optimize import fsolve, fmin_l_bfgs_b, fmin_cg, fminbound\n'), ((280, 294), 'math.copysign', 'copysign', (['(1)',... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 5 08:14:54 2020
@author: Tom
"""
import ecm
import numpy as np
import matplotlib.pyplot as plt
import os
from sklearn.preprocessing import StandardScaler
import scipy
import pandas as pd
from matplotlib import cm
import configparser
# Turn off code warnings (this is not... | [
"configparser.ConfigParser",
"pandas.read_csv",
"ecm.get_amp_cases",
"ecm.get_weights",
"numpy.array",
"ecm.weighted_avg_and_std",
"numpy.cumsum",
"ecm.config2dict",
"ecm.load_and_amalgamate",
"numpy.histogram",
"ecm.chargeogram",
"ecm.get_net",
"ecm.get_cases",
"matplotlib.pyplot.close",
... | [((367, 400), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (390, 400), False, 'import warnings\n'), ((660, 676), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (669, 676), True, 'import matplotlib.pyplot as plt\n'), ((848, 867), 'ecm.get_amp_ca... |
from typing import Dict, Tuple, Callable
import cv2
import numpy as np
import albumentations as albu
from facial_attributes_parser.dataset import CelebAMaskHQDataset
def visualization_transform(image: np.array, masks: Dict[int, np.array]) -> Tuple[np.array, np.array]:
shape = 512, 512, 3
result_mask = np.ze... | [
"albumentations.CLAHE",
"albumentations.RandomBrightnessContrast",
"albumentations.Blur",
"albumentations.GaussNoise",
"albumentations.RandomGamma",
"numpy.zeros",
"albumentations.Compose",
"albumentations.Resize",
"cv2.cvtColor",
"albumentations.MotionBlur",
"cv2.resize",
"albumentations.Shar... | [((315, 346), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'np.uint8'}), '(shape, dtype=np.uint8)\n', (323, 346), True, 'import numpy as np\n'), ((474, 514), 'cv2.resize', 'cv2.resize', (['image', 'result_mask.shape[:2]'], {}), '(image, result_mask.shape[:2])\n', (484, 514), False, 'import cv2\n'), ((658, 696), 'cv... |
# -*- coding: utf-8 -*-
"""
Script to perform the harmonic analysis of the sea level
This script reads the sea level (corrected) raw data to perform harmonic analysis
and filtering of the water level.
It saves the tidal reconstruction, the residual and the filtered sea level to
a file.
Must intall pytide
conda i... | [
"numpy.mean",
"numpy.convolve",
"numpy.unique",
"pandas.read_csv",
"numpy.array",
"numpy.zeros",
"pandas.DataFrame",
"datetime.timedelta",
"pytide.WaveTable",
"oceans.filters.lanc"
] | [((863, 906), 'pandas.read_csv', 'pd.read_csv', (['"""data/raw_data/SL_DH_data.csv"""'], {}), "('data/raw_data/SL_DH_data.csv')\n", (874, 906), True, 'import pandas as pd\n'), ((1182, 1200), 'pytide.WaveTable', 'pytide.WaveTable', ([], {}), '()\n', (1198, 1200), False, 'import pytide\n'), ((1459, 1475), 'numpy.unique',... |
# Routine to calibrate the image frames of Halpha for estimation of
# absolute flux of net emission line by using line and continuum image
# frames of standard objects and program objects.
import os.path
import numpy as np
from scipy import interpolate
from scipy.optimize import curve_fit
import matplotlib.pyplot a... | [
"numpy.sqrt",
"numpy.amin",
"scipy.integrate.quad",
"numpy.log",
"numpy.exp",
"scipy.interpolate.InterpolatedUnivariateSpline",
"numpy.loadtxt",
"numpy.amax"
] | [((1265, 1299), 'scipy.interpolate.InterpolatedUnivariateSpline', 'InterpolatedUnivariateSpline', (['x', 'y'], {}), '(x, y)\n', (1293, 1299), False, 'from scipy.interpolate import InterpolatedUnivariateSpline\n'), ((5275, 5333), 'scipy.integrate.quad', 'integrate.quad', (['auxContFunc', 'xcmin', 'xcmax'], {'epsabs': '(... |
import os.path
import numpy as np
import random
from argparse import ArgumentParser
from collections import Counter
from utils.data_writer import DataWriter
from utils.file_utils import make_dir
from utils.constants import TRAIN, VALID, TEST, SAMPLE_ID, INPUTS, OUTPUT
WINDOW_SIZE = 20
STRIDE = 4
TRAIN_FRAC = 0.85
VA... | [
"argparse.ArgumentParser",
"random.seed",
"collections.Counter",
"random.random",
"utils.file_utils.make_dir",
"numpy.loadtxt"
] | [((2232, 2248), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (2246, 2248), False, 'from argparse import ArgumentParser\n'), ((2471, 2486), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (2482, 2486), False, 'import random\n'), ((2587, 2609), 'numpy.loadtxt', 'np.loadtxt', (['train_path'], {})... |
# Analyse the AFQMC back propagated RDM.
import glob
import h5py
import numpy
try:
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
have_mpl = True
except ImportError:
have_mpl = False
import scipy.stats
from afqmctools.analysis.average import average_one_rdm
from afqmctools.a... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"afqmctools.analysis.average.average_one_rdm",
"matplotlib.pyplot.xlabel",
"h5py.File",
"afqmctools.analysis.extraction.get_metadata",
"numpy.einsum",
"matplotlib.pyplot.errorbar",
"afqmctools.analysis.extra... | [((116, 130), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (123, 130), True, 'import matplotlib as mpl\n'), ((727, 747), 'numpy.mean', 'numpy.mean', (['energies'], {}), '(energies)\n', (737, 747), False, 'import numpy\n'), ((1016, 1038), 'afqmctools.analysis.extraction.get_metadata', 'get_metadata', (... |
"""
script to create pandas Dataframes with all results from multiple runs of the EQL stored inside.
"""
__author__ = "<NAME> (GMi)"
__version__ = "1.2.0"
__date__ = "07.09.2020"
__email__ = "<EMAIL>"
__status__ = "Development"
import numpy as np
#from matplotlib import pyplot as plt
import pandas
import sympy
i... | [
"sympy.dotprint",
"numpy.sqrt",
"pandas.read_csv",
"sympy.sympify",
"os.path.join",
"numpy.max",
"matplotlib.pylab.rcParams.update",
"numpy.min",
"pandas.DataFrame",
"os.walk"
] | [((798, 827), 'matplotlib.pylab.rcParams.update', 'pylab.rcParams.update', (['params'], {}), '(params)\n', (819, 827), True, 'import matplotlib.pylab as pylab\n'), ((3929, 3944), 'os.walk', 'walk', (['directory'], {}), '(directory)\n', (3933, 3944), False, 'from os import path, walk\n'), ((4579, 4594), 'os.walk', 'walk... |
#########################################################
#
# Fringe Model Functions
#
#########################################################
import sys, copy
import numpy as np
import matplotlib.pyplot as plt
import scipy.signal as signal
from scipy.optimize import curve_fit
import smart
def get_peak_fringe_freque... | [
"scipy.optimize.curve_fit",
"numpy.sin",
"numpy.argmax",
"numpy.linspace",
"copy.deepcopy",
"scipy.signal.lombscargle"
] | [((435, 463), 'copy.deepcopy', 'copy.deepcopy', (['fringe_object'], {}), '(fringe_object)\n', (448, 463), False, 'import sys, copy\n'), ((561, 591), 'numpy.linspace', 'np.linspace', (['(0.01)', '(10.0)', '(10000)'], {}), '(0.01, 10.0, 10000)\n', (572, 591), True, 'import numpy as np\n'), ((601, 658), 'scipy.signal.lomb... |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"numpy.clip",
"numpy.hanning",
"numpy.fromfile",
"numpy.sqrt",
"numpy.hstack",
"numpy.array",
"numpy.nanmean",
"numpy.linalg.norm",
"numpy.mean",
"os.path.exists",
"argparse.ArgumentParser",
"numpy.where",
"api.infer.SdkApi",
"numpy.max",
"numpy.exp",
"numpy.stack",
"numpy.frombuffer... | [((924, 980), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""siamRPN inference"""'}), "(description='siamRPN inference')\n", (947, 980), False, 'import argparse\n'), ((1890, 1910), 'numpy.sqrt', 'np.sqrt', (['(wc_z * hc_z)'], {}), '(wc_z * hc_z)\n', (1897, 1910), True, 'import numpy as n... |
# Simple systolic array of P processing element, each one increments by 1 the incoming element
import argparse
import dace
import numpy as np
import pdb
import select
import sys
N = dace.symbol("N")
P = dace.symbol("P")
def make_copy_to_fpga_state(sdfg):
########################################################... | [
"dace.memlet.EmptyMemlet",
"numpy.abs",
"argparse.ArgumentParser",
"dace.graph.edges.InterstateEdge",
"dace.properties.CodeProperty.from_string",
"dace.properties.SubsetProperty.from_string",
"dace.memlet.Memlet.simple",
"dace.symbol",
"numpy.max",
"numpy.sum",
"dace.SDFG",
"numpy.nonzero",
... | [((184, 200), 'dace.symbol', 'dace.symbol', (['"""N"""'], {}), "('N')\n", (195, 200), False, 'import dace\n'), ((205, 221), 'dace.symbol', 'dace.symbol', (['"""P"""'], {}), "('P')\n", (216, 221), False, 'import dace\n'), ((1330, 1355), 'dace.SDFG', 'dace.SDFG', (['"""array_read_A"""'], {}), "('array_read_A')\n", (1339,... |
# coding=utf-8
import traceback
import h5py
import skimage.transform
from keras.utils import Sequence
import numpy as np
import cv2
import glob
import pandas as pd
import os
from kf_util import flip_axis
def rgbf2bgr(rgbf):
t = rgbf*255.0
t = np.clip(t, 0.,255.0)
bgr = t.astype(np.uint8)[..., ::-1]
return bgr
d... | [
"numpy.clip",
"numpy.array",
"matplotlib.pylab.imshow",
"matplotlib.pylab.show",
"numpy.rot90",
"numpy.moveaxis",
"matplotlib.pylab.figure",
"numpy.random.random",
"pandas.DataFrame",
"glob.glob",
"cv2.merge",
"kf_util.flip_axis",
"h5py.File",
"cv2.split",
"cv2.cvtColor",
"cv2.imread",... | [((248, 270), 'numpy.clip', 'np.clip', (['t', '(0.0)', '(255.0)'], {}), '(t, 0.0, 255.0)\n', (255, 270), True, 'import numpy as np\n'), ((512, 554), 'pandas.DataFrame', 'pd.DataFrame', (['path_in'], {'columns': "['path_in']"}), "(path_in, columns=['path_in'])\n", (524, 554), True, 'import pandas as pd\n'), ((596, 620),... |
import tweepy
import logging
import time
from newsplease import NewsPlease
from newspaper import Article
from newspaper import fulltext
import requests
from lxml import html
import requests
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
# text to image
import numpy as np
import textwrap
impo... | [
"logging.basicConfig",
"logging.getLogger",
"PIL.Image.fromarray",
"config.create_api",
"numpy.ones",
"urllib.request.Request",
"numpy.asarray",
"PIL.ImageFont.truetype",
"time.sleep",
"bs4.BeautifulSoup",
"newsplease.NewsPlease.from_url",
"PIL.ImageDraw.Draw",
"textwrap.wrap",
"urllib.req... | [((527, 713), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""bot.log"""', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(filename='bot.log', level=logging.DEBUG, format=\n '%(asct... |
# coding=utf-8
# Copyright 2021 The Google Research 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... | [
"numpy.mean",
"numpy.tril_indices_from",
"sklearn.metrics.f1_score",
"sklearn.mixture.GaussianMixture",
"sklearn.cluster.SpectralClustering",
"sklearn.cluster.AgglomerativeClustering",
"jax.lax.map",
"numpy.array",
"functools.partial",
"collections.defaultdict",
"jax.numpy.mean"
] | [((969, 1023), 'functools.partial', 'functools.partial', (['onp.vectorize'], {'signature': '"""(n)->(m)"""'}), "(onp.vectorize, signature='(n)->(m)')\n", (986, 1023), False, 'import functools\n'), ((940, 965), 'numpy.mean', 'onp.mean', (['(preds == labels)'], {}), '(preds == labels)\n', (948, 965), True, 'import numpy ... |
import numpy as np
import matplotlib.pylab as plt
import os
clear = lambda: os.system('cls' if os.name=='nt' else 'clear')
# Activation
def step_function(x):
# if x > 0:
# return 1
# else:
# return 0
y = x > 0
return y.astype(np.int)
def sigmoid(x):
return 1 / (1 + np.exp(-x))
... | [
"matplotlib.pylab.ylim",
"numpy.max",
"numpy.exp",
"numpy.sum",
"matplotlib.pylab.show",
"numpy.maximum",
"os.system",
"matplotlib.pylab.plot",
"numpy.arange"
] | [((76, 124), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (85, 124), False, 'import os\n'), ((344, 360), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (354, 360), True, 'import numpy as np\n'), ((427, 440), 'numpy.sum', 'np.su... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.