code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""
Tests for DBSCAN clustering algorithm
"""
import pickle
import numpy as np
from numpy.testing import assert_raises
from scipy.spatial import distance
from sklearn.utils.testing import assert_equal
from sklearn.cluster.dbscan_ import DBSCAN, dbscan
from .common import generate_clustered_data
from sklearn.metrics... | [
"pickle.loads",
"sklearn.metrics.pairwise.pairwise_distances",
"numpy.testing.assert_raises",
"sklearn.cluster.dbscan_.dbscan",
"sklearn.utils.testing.assert_equal",
"numpy.max",
"scipy.spatial.distance.pdist",
"sklearn.cluster.dbscan_.DBSCAN",
"pickle.dumps"
] | [((689, 698), 'numpy.max', 'np.max', (['D'], {}), '(D)\n', (695, 698), True, 'import numpy as np\n'), ((747, 812), 'sklearn.cluster.dbscan_.dbscan', 'dbscan', (['D'], {'metric': '"""precomputed"""', 'eps': 'eps', 'min_samples': 'min_samples'}), "(D, metric='precomputed', eps=eps, min_samples=min_samples)\n", (753, 812)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) IBM Corporation 2018
#
# 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
#
# U... | [
"torch.cat",
"torch.nn.functional.sigmoid",
"torch.nn.functional.normalize",
"miprometheus.utils.app_state.AppState",
"torch.ones",
"numpy.insert",
"torch.nn.Linear",
"torch.zeros",
"torch.matmul",
"torch.zeros_like",
"torch.nn.ModuleList",
"torch.pow",
"torch.ones_like",
"torch.nn.functio... | [((847, 881), 'logging.getLogger', 'logging.getLogger', (['"""NTM-Interface"""'], {}), "('NTM-Interface')\n", (864, 881), False, 'import logging\n'), ((979, 1069), 'collections.namedtuple', 'collections.namedtuple', (['"""HeadStateTuple"""', "('attention', 'similarity', 'gate', 'shift')"], {}), "('HeadStateTuple', ('at... |
import numpy as np
# matplotlib don't use Xwindows backend (must be before pyplot import)
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_levels,
pl... | [
"matplotlib.pyplot.title",
"matplotlib.backends.backend_pdf.PdfPages",
"numpy.arctan2",
"numpy.amin",
"numpy.argmax",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.pyplot.close",
"numpy.finfo",
"matplotlib.pyplot.ylim",
"numpy.median",
"matplotlib.pyplot.legend",
"m... | [((109, 130), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (123, 130), False, 'import matplotlib\n'), ((23155, 23200), 'numpy.argmax', 'np.argmax', (["estimator_status['mag_test_ratio']"], {}), "(estimator_status['mag_test_ratio'])\n", (23164, 23200), True, 'import numpy as np\n'), ((23274, 233... |
## set up logging
import logging, os
logging.basicConfig(level=os.environ.get("LOGLEVEL","INFO"))
log = logging.getLogger(__name__)
## import modules
import octvi.exceptions, octvi.array, gdal
from gdalnumeric import *
import numpy as np
def getDatasetNames(stack_path:str) -> list:
"""
Returns list of... | [
"numpy.full",
"logging.debug",
"os.path.basename",
"gdal.Open",
"os.environ.get",
"os.path.splitext",
"numpy.maximum.reduce",
"numpy.minimum.reduce",
"logging.getLogger"
] | [((107, 134), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'import logging, os\n'), ((711, 735), 'gdal.Open', 'gdal.Open', (['stack_path', '(0)'], {}), '(stack_path, 0)\n', (720, 735), False, 'import octvi.exceptions, octvi.array, gdal\n'), ((1288, 1312), 'gdal.Open',... |
import os, warnings, time, tempfile, datetime, pathlib, shutil, subprocess
from tqdm import tqdm
from urllib.request import urlopen
from urllib.parse import urlparse
import cv2
from scipy.ndimage import find_objects, gaussian_filter, generate_binary_structure, label, maximum_filter1d, binary_fill_holes
from scipy.spati... | [
"scipy.ndimage.generate_binary_structure",
"os.mkdir",
"os.remove",
"numpy.random.seed",
"numpy.argmax",
"scipy.ndimage.find_objects",
"scipy.ndimage.binary_fill_holes",
"numpy.ones",
"numpy.clip",
"numpy.isnan",
"numpy.histogram",
"numpy.arange",
"numpy.unique",
"random.randint",
"scipy... | [((474, 507), 'numpy.vectorize', 'np.vectorize', (['colorsys.rgb_to_hsv'], {}), '(colorsys.rgb_to_hsv)\n', (486, 507), True, 'import numpy as np\n'), ((522, 547), 'numpy.rollaxis', 'np.rollaxis', (['arr'], {'axis': '(-1)'}), '(arr, axis=-1)\n', (533, 547), True, 'import numpy as np\n'), ((601, 629), 'numpy.stack', 'np.... |
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
win = pg.GraphicsWindow()
win.setWindowTitle('Scroll and Zoomed Plot')
plotScroll = win.addPlot()
plotScroll.setDownsampling(mode='peak')
plotScroll.setClipToView(True)
curveScroll = plotScroll.plot()
dataRnd = np.empty(100)... | [
"pyqtgraph.GraphicsWindow",
"pyqtgraph.Qt.QtGui.QApplication.instance",
"pyqtgraph.QtCore.QTimer",
"numpy.empty",
"numpy.random.normal",
"pyqtgraph.LinearRegionItem"
] | [((92, 111), 'pyqtgraph.GraphicsWindow', 'pg.GraphicsWindow', ([], {}), '()\n', (109, 111), True, 'import pyqtgraph as pg\n'), ((307, 320), 'numpy.empty', 'np.empty', (['(100)'], {}), '(100)\n', (315, 320), True, 'import numpy as np\n'), ((680, 709), 'pyqtgraph.LinearRegionItem', 'pg.LinearRegionItem', (['[0, 100]'], {... |
'''
Collated by <NAME> 鄒慶士 博士 (Ph.D.) Distinguished Prof. at the Department of Mechanical Engineering/Director at the Center of Artificial Intelligence & Data Science (機械工程系特聘教授兼人工智慧暨資料科學研究中心主任), MCUT (明志科技大學); Prof. at the Institute of Information & Decision Sciences (資訊與決策科學研究所教授), NTUB (國立臺北商業大學); the Chinese Academ... | [
"scipy.fftpack.fft",
"numpy.imag",
"numpy.arange",
"numpy.real",
"numpy.cos",
"matplotlib.pyplot.subplots",
"scipy.fftpack.ifftshift"
] | [((1378, 1417), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(2)', 'step': '(1 / fs)'}), '(start=0, stop=2, step=1 / fs)\n', (1387, 1417), True, 'import numpy as np\n'), ((1704, 1741), 'numpy.arange', 'np.arange', ([], {'start': '(-N // 2)', 'stop': '(N // 2)'}), '(start=-N // 2, stop=N // 2)\n', (1713, ... |
import numpy as np
import kplr
client = kplr.API()
import pandas as pd
import os
from kepler_data import load_kepler_data
import matplotlib.pyplot as plt
def assemble_data(N, lc_dir, ftrain=.8, fdouble=.5, ndays=70, path=".",
saveplot=False):
"""
Code for downloading a training set for Keple... | [
"os.mkdir",
"numpy.random.uniform",
"matplotlib.pyplot.savefig",
"numpy.random.seed",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"pandas.merge",
"matplotlib.pyplot.legend",
"os.path.exists",
"matplotlib.pyplot.figure",
"numpy.arange",
"kplr.API",
"kepler_data.load_kepler_data",
"numpy.ra... | [((40, 50), 'kplr.API', 'kplr.API', ([], {}), '()\n', (48, 50), False, 'import kplr\n'), ((1644, 1675), 'pandas.read_csv', 'pd.read_csv', (['"""../data/KICs.csv"""'], {}), "('../data/KICs.csv')\n", (1655, 1675), True, 'import pandas as pd\n'), ((1705, 1728), 'numpy.random.shuffle', 'np.random.shuffle', (['kids'], {}), ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 28 20:31:03 2020
@author: maria
LSTM Neural Network Architecture
using the chats only as input
"""
from keras.models import Sequential
from keras.layers import Embedding,Dense,LSTM
from keras.optimizers import Adam
from keras.initializers import R... | [
"matplotlib.pyplot.title",
"numpy.load",
"keras.backend.clear_session",
"csv.writer",
"matplotlib.pyplot.plot",
"keras.callbacks.ModelCheckpoint",
"keras.layers.LSTM",
"matplotlib.pyplot.legend",
"keras.utils.vis_utils.plot_model",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.figure",
"keras... | [((753, 785), 'numpy.load', 'np.load', (['"""./traindata/chats.npy"""'], {}), "('./traindata/chats.npy')\n", (760, 785), True, 'import numpy as np\n'), ((796, 829), 'numpy.load', 'np.load', (['"""./traindata/labels.npy"""'], {}), "('./traindata/labels.npy')\n", (803, 829), True, 'import numpy as np\n'), ((839, 870), 'n... |
import numpy as np
import plotly.graph_objs as go
def volcovered(robobj, trajectorymat):
l = len(trajectorymat)
arr = np.zeros((3, (robobj.jointno - 1)*l + 1))
arr[0][0] = trajectorymat[0][1][0]
arr[1][0] = trajectorymat[0][1][1]
arr[2][0] = trajectorymat[0][1][2]
i = 0
m = 1
while... | [
"plotly.graph_objs.Mesh3d",
"numpy.zeros"
] | [((130, 173), 'numpy.zeros', 'np.zeros', (['(3, (robobj.jointno - 1) * l + 1)'], {}), '((3, (robobj.jointno - 1) * l + 1))\n', (138, 173), True, 'import numpy as np\n'), ((595, 682), 'plotly.graph_objs.Mesh3d', 'go.Mesh3d', ([], {'x': 'arr[0]', 'y': 'arr[1]', 'z': 'arr[2]', 'opacity': '(0.8)', 'color': '"""rgba(244,22,... |
"""
COGCC_2019_productiondata.py loads well location and production data that was downloaded from the COGCC.
The data are used to calculate annual production per site, and the resulting array is saved.
The COGCC provides production and location data by well. In order to group wells into sites, any wells within
50 meter... | [
"pandas.DataFrame",
"os.path.abspath",
"numpy.abs",
"numpy.sum",
"pysal.lib.io.open",
"pandas.read_excel",
"numpy.argsort",
"numpy.mean",
"numpy.array",
"numpy.where",
"os.path.join"
] | [((634, 697), 'os.path.join', 'os.path.join', (['rsc_path', '"""RawData"""', '"""COGCC-2019-Production.xlsx"""'], {}), "(rsc_path, 'RawData', 'COGCC-2019-Production.xlsx')\n", (646, 697), False, 'import os\n'), ((709, 775), 'os.path.join', 'os.path.join', (['rsc_path', '"""RawData"""', '"""COGCC-2019-well-locations.dbf... |
import numpy as np
from pixell import enmap, utils
from cmbpix.utils import *
from cmbpix.lensing.estimator import LensingEstimator
from cmbpix.lensing import *
from scipy.optimize import curve_fit, fsolve
from scipy.special import gamma
from scipy.interpolate import CubicSpline
import matplotlib.pyplot as plt
... | [
"pixell.enmap.zeros",
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"numpy.empty",
"scipy.interpolate.CubicSpline",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.contour",
"numpy.diag",
"matplotlib.pyplot.tight_layout",
"matplotlib.py... | [((1533, 1561), 'numpy.exp', 'np.exp', (['(-N * s2 / (2 * sig2))'], {}), '(-N * s2 / (2 * sig2))\n', (1539, 1561), True, 'import numpy as np\n'), ((3199, 3212), 'numpy.argmax', 'np.argmax', (['Px'], {}), '(Px)\n', (3208, 3212), True, 'import numpy as np\n'), ((1580, 1600), 'scipy.special.gamma', 'gamma', (['((N - 1) / ... |
import numpy as np
'''
raining,friend,distance
Data = [[0,0,1],
[0,0,1],
[0,1,0],
[0,1,1],
[0,1,1],
[1,0,0],
[1,0,1],
[1,1,0],
[1,1,0],
[0,0,0],
[1,1,1]]
Result = [0,1, 1, 1,0, 0,0, 0,1, 1,0]
'''
# Data = [[0, 0, 1],
# ... | [
"numpy.dot",
"numpy.array"
] | [((2626, 2640), 'numpy.array', 'np.array', (['Data'], {}), '(Data)\n', (2634, 2640), True, 'import numpy as np\n'), ((2641, 2657), 'numpy.array', 'np.array', (['Result'], {}), '(Result)\n', (2649, 2657), True, 'import numpy as np\n'), ((2557, 2583), 'numpy.dot', 'np.dot', (['test', 'self.weights'], {}), '(test, self.we... |
import numpy as np
import itertools as it
from warnings import warn
from Bio import pairwise2
from Bio.SubsMat import MatrixInfo as matlist
blosum62 = matlist.blosum62
terms = {}
for key, value in zip(blosum62.keys(), blosum62.values()):
key = tuple(reversed(key))
if key not in blosum62.keys():
terms.u... | [
"warnings.warn",
"numpy.array",
"numpy.exp",
"Bio.pairwise2.align.globaldx"
] | [((1599, 1658), 'warnings.warn', 'warn', (['"""empty sequence passed"""', 'RuntimeWarning'], {'stacklevel': '(2)'}), "('empty sequence passed', RuntimeWarning, stacklevel=2)\n", (1603, 1658), False, 'from warnings import warn\n'), ((547, 556), 'numpy.exp', 'np.exp', (['z'], {}), '(z)\n', (553, 556), True, 'import numpy... |
#!/usr/bin/python
from math import pi, sin, tan, sqrt
import numpy as np
from scipy import integrate
from neutpy.tools import isclose
import sys
def f(phi, xi, x_comp, y_comp, x_coords, y_coords, reg, mfp, fromcell, tocell, throughcell, Ki3_fit, li):
try:
result = (2.0 / (pi * -1 * x_comp[-1])) * sin(phi) ... | [
"numpy.arctan2",
"math.sqrt",
"numpy.roll",
"math.tan",
"numpy.searchsorted",
"math.sin",
"numpy.isnan",
"numpy.flipud",
"numpy.cumsum",
"numpy.sin",
"numpy.cos",
"neutpy.tools.isclose",
"sys.exit"
] | [((1059, 1089), 'numpy.arctan2', 'np.arctan2', (['y_coords', 'x_coords'], {}), '(y_coords, x_coords)\n', (1069, 1089), True, 'import numpy as np\n'), ((1550, 1565), 'neutpy.tools.isclose', 'isclose', (['x2', 'x1'], {}), '(x2, x1)\n', (1557, 1565), False, 'from neutpy.tools import isclose\n'), ((1951, 1980), 'math.sqrt'... |
import os
import numpy as np
import pickle
import re
def load_dict(dict_path):
"""Loads a dictionary in pickle format."""
with open(dict_path,'rb') as fh:
d = pickle.load(fh)
return d
def parse_search(workspace,corpus_name,node,pos,case_sensitive,regexp):
"""Parses the input search and re... | [
"numpy.isin",
"numpy.load",
"numpy.zeros",
"numpy.any",
"pickle.load",
"numpy.array",
"numpy.arange",
"numpy.where",
"os.listdir",
"re.compile"
] | [((2745, 2765), 'os.listdir', 'os.listdir', (['npy_path'], {}), '(npy_path)\n', (2755, 2765), False, 'import os\n'), ((6874, 6899), 'numpy.arange', 'np.arange', (['horizon', '(0)', '(-1)'], {}), '(horizon, 0, -1)\n', (6883, 6899), True, 'import numpy as np\n'), ((6908, 6932), 'numpy.arange', 'np.arange', (['(0)', 'hori... |
from __future__ import division, print_function
import numpy as np
from scipy.constants.codata import physical_constants
import xraylib
def energy(crystal_str,hkl,deg):
'''
Calculates the photon energy of the Bragg reflection using kinematic
approximation for given crystal, reflection, and Bragg angle. R... | [
"numpy.radians",
"xraylib.Crystal_GetCrystal",
"numpy.degrees",
"numpy.arcsin",
"numpy.sin",
"xraylib.Crystal_dSpacing"
] | [((367, 406), 'xraylib.Crystal_GetCrystal', 'xraylib.Crystal_GetCrystal', (['crystal_str'], {}), '(crystal_str)\n', (393, 406), False, 'import xraylib\n'), ((598, 613), 'numpy.radians', 'np.radians', (['deg'], {}), '(deg)\n', (608, 613), True, 'import numpy as np\n'), ((932, 971), 'xraylib.Crystal_GetCrystal', 'xraylib... |
"""Data to test interpolation functions."""
from pathlib import Path
import numpy as np
DIR = Path(__file__).parent
scalar_projection = np.loadtxt(DIR / 'scalar_projection.csv')
scalar_slice = np.loadtxt(DIR / 'scalar_slice.csv')
vector_projection = np.array(
(
np.loadtxt(DIR / 'vector_x_projection.csv'... | [
"pathlib.Path",
"numpy.loadtxt"
] | [((140, 181), 'numpy.loadtxt', 'np.loadtxt', (["(DIR / 'scalar_projection.csv')"], {}), "(DIR / 'scalar_projection.csv')\n", (150, 181), True, 'import numpy as np\n'), ((197, 233), 'numpy.loadtxt', 'np.loadtxt', (["(DIR / 'scalar_slice.csv')"], {}), "(DIR / 'scalar_slice.csv')\n", (207, 233), True, 'import numpy as np\... |
import numpy as np
def getDistance(p, q, ndim=3, scale=None):
''' Return Euclidean distance between 'p' and 'q'
Parameters
----------------
p: (N,) list, tuple or ndarray
start position of distance measure
q: (N,) list, tuple or ndarray
end posi... | [
"numpy.abs",
"numpy.sum",
"numpy.power",
"numpy.array",
"numpy.matmul",
"numpy.sqrt"
] | [((2942, 2963), 'numpy.matmul', 'np.matmul', (['invCov', 'dr'], {}), '(invCov, dr)\n', (2951, 2963), True, 'import numpy as np\n'), ((7806, 7823), 'numpy.sum', 'np.sum', (['(norm * dr)'], {}), '(norm * dr)\n', (7812, 7823), True, 'import numpy as np\n'), ((1424, 1441), 'numpy.sum', 'np.sum', (['(dr ** 2.0)'], {}), '(dr... |
import random
import numpy
def set_random_seeds(value):
"""
Set the seeds of the RNGs (Random Number Generators)
used internally.
"""
random.seed(value)
numpy.random.seed(value)
| [
"numpy.random.seed",
"random.seed"
] | [((155, 173), 'random.seed', 'random.seed', (['value'], {}), '(value)\n', (166, 173), False, 'import random\n'), ((178, 202), 'numpy.random.seed', 'numpy.random.seed', (['value'], {}), '(value)\n', (195, 202), False, 'import numpy\n')] |
import numpy as np
import numpy.linalg as la
def ta_1(n,p, r):
"""
attempt to generate good test case using sinewaves to make high d spiral/curve
"""
x = np.linspace(-4*np.pi, 4*np.pi, num=p)
A = np.zeros((p,r))
for i in range(r):
#generate a sequence of numbers varying at different sp... | [
"matplotlib.pyplot.show",
"numpy.copy",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"numpy.zeros",
"numpy.ones",
"numpy.log10",
"numpy.append",
"numpy.max",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"numpy.cos",
"numpy.random.rand",
"numpy.dot",
"numpy.min"
] | [((172, 213), 'numpy.linspace', 'np.linspace', (['(-4 * np.pi)', '(4 * np.pi)'], {'num': 'p'}), '(-4 * np.pi, 4 * np.pi, num=p)\n', (183, 213), True, 'import numpy as np\n'), ((218, 234), 'numpy.zeros', 'np.zeros', (['(p, r)'], {}), '((p, r))\n', (226, 234), True, 'import numpy as np\n'), ((394, 410), 'numpy.zeros', 'n... |
import pickle
import numpy as np
import random
from sklearn.model_selection import train_test_split
import pdb
def split_data(data):
input_lstm_train, input_lstm_test, input_train, input_test, target_train, target_test = train_test_split(
data['input_lstm'], data['input'], data['target'], test_size=0.2, ra... | [
"pickle.dump",
"numpy.put",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"random.shuffle",
"numpy.zeros",
"numpy.append",
"pickle.load",
"numpy.array"
] | [((226, 329), 'sklearn.model_selection.train_test_split', 'train_test_split', (["data['input_lstm']", "data['input']", "data['target']"], {'test_size': '(0.2)', 'random_state': '(42)'}), "(data['input_lstm'], data['input'], data['target'],\n test_size=0.2, random_state=42)\n", (242, 329), False, 'from sklearn.model_... |
"""
The Blahut-Arimoto algorithm for solving the rate-distortion problem.
"""
from __future__ import division
import numpy as np
from .distortions import hamming_distortion
from .rate_distortion import RateDistortionResult
from ..divergences.pmf import relative_entropy
from ..math.sampling import sample_simplex
##... | [
"numpy.exp2",
"numpy.zeros",
"numpy.ones",
"numpy.isnan",
"numpy.isclose",
"numpy.matmul"
] | [((1259, 1280), 'numpy.matmul', 'np.matmul', (['p_x', 'q_y_x'], {}), '(p_x, q_y_x)\n', (1268, 1280), True, 'import numpy as np\n'), ((1461, 1479), 'numpy.exp2', 'np.exp2', (['(-beta * d)'], {}), '(-beta * d)\n', (1468, 1479), True, 'import numpy as np\n'), ((2072, 2093), 'numpy.isclose', 'np.isclose', (['prev_d', 'd'],... |
#!/usr/bin/env python
import os
import sys
import numpy as np
import warnings
from astropy.io import fits
from astropy.utils.exceptions import AstropyWarning
fro... | [
"os.mkdir",
"os.remove",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.argsort",
"numpy.arange",
"astropy.io.fits.getdata",
"os.path.exists",
"dlnpyutils.utils.create_index",
"dlnpyutils.utils.match",
"numpy.save",
"os.path.basename",
"numpy.hstack",
"sqlite3.connect",
"dlnpyutils.db.cu... | [((1025, 1036), 'time.time', 'time.time', ([], {}), '()\n', (1034, 1036), False, 'import time\n'), ((1041, 1080), 'sqlite3.register_adapter', 'sqlite3.register_adapter', (['np.int16', 'int'], {}), '(np.int16, int)\n', (1065, 1080), False, 'import sqlite3\n'), ((1085, 1124), 'sqlite3.register_adapter', 'sqlite3.register... |
# -*- coding: utf-8 -*-
"""
Class for reading/writing data from micromed (.trc).
Inspired by the Matlab code for EEGLAB from <NAME>.
Completed with matlab Guillaume BECQ code.
Supported : Read
Author: sgarcia
"""
import datetime
import os
import struct
# file no longer exists in Python3
try:
file
except NameEr... | [
"neo.io.baseio.BaseIO.__init__",
"os.path.basename",
"numpy.fromfile",
"struct.calcsize",
"datetime.datetime",
"neo.core.AnalogSignal",
"numpy.mean"
] | [((1705, 1726), 'neo.io.baseio.BaseIO.__init__', 'BaseIO.__init__', (['self'], {}), '(self)\n', (1720, 1726), False, 'from neo.io.baseio import BaseIO\n'), ((2358, 2419), 'datetime.datetime', 'datetime.datetime', (['(year + 1900)', 'month', 'day', 'hour', 'minute', 'sec'], {}), '(year + 1900, month, day, hour, minute, ... |
import unittest
import numpy as np
import tensorflow as tf
import deepchem as dc
import deepchem.models.tensorgraph.layers as layers
from deepchem.data import NumpyDataset
from deepchem.models.text_cnn import default_dict
from scipy.io import loadmat
from flaky import flaky
import os
class TestEstimators(unittest.Tes... | [
"deepchem.models.ANIRegression",
"numpy.random.seed",
"deepchem.models.tensorgraph.layers.Dense",
"tensorflow.feature_column.numeric_column",
"deepchem.molnet.load_qm7_from_mat",
"deepchem.models.Sequential",
"tensorflow.py_func",
"numpy.zeros",
"deepchem.models.tensorgraph.layers.Label",
"tensorf... | [((6710, 6747), 'numpy.random.rand', 'np.random.rand', (['n_samples', 'n_features'], {}), '(n_samples, n_features)\n', (6724, 6747), True, 'import numpy as np\n'), ((6814, 6840), 'deepchem.data.NumpyDataset', 'dc.data.NumpyDataset', (['X', 'y'], {}), '(X, y)\n', (6834, 6840), True, 'import deepchem as dc\n'), ((7034, 7... |
import torch
import numpy as np
import random
def setup_seed(seed):
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.deterministic = True
def target_format(target, loss_mode, device):
if loss_mode == 'mse':
... | [
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"numpy.random.seed",
"random.seed"
] | [((80, 103), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (97, 103), False, 'import torch\n'), ((109, 141), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['seed'], {}), '(seed)\n', (135, 141), False, 'import torch\n'), ((147, 167), 'numpy.random.seed', 'np.random.seed', (['seed']... |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2021-2021 Arm Ltd.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""
Basic functions solving FPE.
Based on
<NAME>. (2018).
Switching probability of all-perpendicular spin valve nanopillars.
AIP Advances, 8(5).
https://doi.org/10.1063/1.5003832
... | [
"numpy.polynomial.legendre.legfit",
"numpy.heaviside",
"numpy.abs",
"numpy.ones",
"numpy.isnan",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"scipy.optimize.basinhopping",
"scipy.optimize.minimize",
"scipy.optimize.shgo",
"numpy.linspace",
"numpy.polynomial.legendre.legval",
"numpy.arccos",
... | [((1792, 1829), 'numpy.zeros', 'np.zeros', (['[j + 1, j + 1]'], {'dtype': 'float'}), '([j + 1, j + 1], dtype=float)\n', (1800, 1829), True, 'import numpy as np\n'), ((3581, 3614), 'numpy.linspace', 'np.linspace', (['np.pi', '(0)', 'dim_points'], {}), '(np.pi, 0, dim_points)\n', (3592, 3614), True, 'import numpy as np\n... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import sys
import os
ROOT_DIR = os.getenv('PLASTICC_DIR')
WORK_DIR = os.path.join(ROOT_DIR, 'plasticc')
DATA_DIR = os.path.join(ROOT_DIR, 'plasticc_data')
sys.path.append(WORK_DIR)
import numpy a... | [
"sys.path.append",
"matplotlib.backends.backend_pdf.PdfPages",
"os.makedirs",
"matplotlib.pyplot.close",
"plasticc.get_data.GetData.get_sntypes",
"os.path.exists",
"plasticc.get_data.GetData",
"numpy.arange",
"numpy.linspace",
"seaborn.jointplot",
"plasticc.get_data.parse_getdata_options",
"os... | [((157, 182), 'os.getenv', 'os.getenv', (['"""PLASTICC_DIR"""'], {}), "('PLASTICC_DIR')\n", (166, 182), False, 'import os\n'), ((194, 228), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""plasticc"""'], {}), "(ROOT_DIR, 'plasticc')\n", (206, 228), False, 'import os\n'), ((240, 279), 'os.path.join', 'os.path.join', ([... |
"""
.. _example3:
Third Example: Injecting varying ``sample_weight`` vectors to a linear regression model for GridSearchCV
-------------------------------------------------------------------------------------------------------------------
This example illustrates a case in which a varying vector is injected to a linea... | [
"sklearn.model_selection.GridSearchCV",
"matplotlib.pyplot.show",
"matplotlib.pyplot.scatter",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.linear_model.LinearRegression",
"sklearn.preprocessing.PolynomialFeatures",
"pipegraph.demo_blocks.CustomPower",
"numpy.array",
"pipegraph.base.PipeGraph"
] | [((3046, 3102), 'numpy.array', 'np.array', (['[10, 4, 20, 16, 25, -60, 85, 64, 81, 100, 150]'], {}), '([10, 4, 20, 16, 25, -60, 85, 64, 81, 100, 150])\n', (3054, 3102), True, 'import numpy as np\n'), ((3341, 3355), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {}), '()\n', (3353, 3355), False, 'from sklear... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Simple example of using ArenaRllibEnv, which is a interface that
convert a arena environment to a MultiAgentEnv
(see: https://ray.readthedocs.io/en/latest/rllib-env.html#multi-agent-and-hierarchical)
interfac... | [
"arena.ArenaRllibEnv",
"copy.deepcopy",
"numpy.set_printoptions",
"arena.create_parser",
"cv2.VideoWriter_fourcc",
"arena.plot_feature",
"numpy.concatenate",
"numpy.expand_dims",
"numpy.shape",
"yaml.safe_load",
"cv2.VideoWriter",
"cv2.merge",
"arena.get_one_from_grid_search",
"logging.get... | [((444, 476), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'edgeitems': '(1)'}), '(edgeitems=1)\n', (463, 476), True, 'import numpy as np\n'), ((487, 514), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (504, 514), False, 'import logging\n'), ((739, 800), 'copy.deepcopy', 'dcopy... |
"""
<NAME>, <EMAIL>
This code is an adaption of a python module for regularized kernel canonical correlation analysis, which can be found on
https://github.com/gallantlab/pyrcca
"""
import sys
import h5py
import joblib
import numpy as np
from scipy.linalg import eigh
from sklearn.cross_decomposition.pls_ import _cent... | [
"numpy.logspace",
"numpy.isnan",
"numpy.argsort",
"numpy.mean",
"numpy.arange",
"numpy.linalg.pinv",
"sys.path.append",
"sklearn.cross_decomposition.pls_._center_scale_xy",
"scipy.linalg.eigh",
"numpy.random.shuffle",
"h5py.File",
"numpy.corrcoef",
"numpy.dot",
"numpy.zeros",
"numpy.nonz... | [((333, 355), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (348, 355), False, 'import sys\n'), ((376, 400), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (391, 400), False, 'import sys\n'), ((9876, 9904), 'numpy.random.shuffle', 'np.random.shuffle', (['indchunks'... |
from datetime import datetime
from pdb import set_trace
from time import time
import numpy as np
import tensorflow as tf
import torch
from deep_lagrangian_networks.replay_memory import PyTorchReplayMemory
from deep_lagrangian_networks.utils import init_env, load_dataset
from DeLaN_tensorflow_ddq import DeepLagrangian... | [
"DeLaN_tensorflow_ddq.DeepLagrangianNetwork",
"numpy.sum",
"deep_lagrangian_networks.replay_memory.PyTorchReplayMemory",
"tensorflow.train.Checkpoint",
"tensorflow.cast",
"tensorflow.keras.optimizers.Adam",
"tensorflow.squeeze",
"tensorflow.config.experimental.set_visible_devices",
"DeLaN_utils.plot... | [((5820, 5858), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backend.set_floatx', (['"""float32"""'], {}), "('float32')\n", (5847, 5858), True, 'import tensorflow as tf\n'), ((5863, 5906), 'tensorflow.debugging.set_log_device_placement', 'tf.debugging.set_log_device_placement', (['(True)'], {}), '(True)\n', (5900, ... |
from __future__ import division
import numpy as np
import pybullet as p
"returns list of vertices"
def make_polygon(n, side_length):
int_angle = np.pi/n
hyp = side_length/(2*np.sin(int_angle))
theta = int_angle
pts = []
for i in range(n):
new_pt = (hyp*np.cos(theta), hyp*np.sin(theta))
... | [
"pybullet.getQuaternionFromEuler",
"pybullet.createMultiBody",
"numpy.arctan2",
"ipdb.set_trace",
"numpy.deg2rad",
"numpy.sin",
"numpy.cos",
"pybullet.connect",
"pybullet.createCollisionShape",
"numpy.vstack"
] | [((515, 531), 'numpy.vstack', 'np.vstack', (['verts'], {}), '(verts)\n', (524, 531), True, 'import numpy as np\n'), ((1125, 1142), 'numpy.deg2rad', 'np.deg2rad', (['angle'], {}), '(angle)\n', (1135, 1142), True, 'import numpy as np\n'), ((3052, 3702), 'pybullet.createMultiBody', 'p.createMultiBody', ([], {'baseMass': '... |
import numpy as np
from scipy import integrate, stats
import autofit.graphical.messages.fixed
import autofit.graphical.messages.gamma
import autofit.graphical.messages.normal
import autofit.mapper.variable
from autofit import graphical as mp
def _test():
## define parameters of model
np.random.seed(1)
a... | [
"autofit.graphical.optimise.laplace_factor_approx",
"scipy.stats.norm",
"numpy.random.seed",
"autofit.graphical.Factor",
"numpy.ones_like",
"numpy.random.randn",
"numpy.square",
"scipy.integrate.solve_ivp",
"autofit.graphical.optimise.LaplaceOptimiser",
"numpy.array",
"autofit.graphical.lstsq_la... | [((296, 313), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (310, 313), True, 'import numpy as np\n'), ((374, 399), 'numpy.array', 'np.array', (['[alpha, -gamma]'], {}), '([alpha, -gamma])\n', (382, 399), True, 'import numpy as np\n'), ((409, 462), 'numpy.array', 'np.array', (['[[0.0, beta / alpha], [d... |
#!/usr/bin/env python
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, thi... | [
"tqdm.tqdm",
"json.load",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"dlrm.data.datasets.SyntheticDataset",
"sys.exit",
"sklearn.metrics.roc_auc_score",
"tritonclient.http.InferInput",
"tritonclient.http.InferenceServerClient",
"tritonclient.http.InferRequestedOutput",
"numpy.conc... | [((2762, 2849), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['data'], {'batch_size': 'None', 'num_workers': '(0)', 'pin_memory': '(False)'}), '(data, batch_size=None, num_workers=0,\n pin_memory=False)\n', (2789, 2849), False, 'import torch\n'), ((3962, 3987), 'argparse.ArgumentParser', 'argparse.... |
"""
Parameter_Extraction_For_Random Forest_Batch
============================================
Purpose:
--------
This module is used to extract parameters from the heatmaps of Normal, Tumor and Test slides
based on different thresholds (0.5, 0.6, 0.7, 0.8, 0.9).
Description:
------------
The input files:
- A director... | [
"pandas.DataFrame",
"numpy.load",
"skimage.filters.threshold_otsu",
"os.makedirs",
"cv2.countNonZero",
"cv2.cvtColor",
"os.path.basename",
"openslide.open_slide",
"cv2.inRange",
"skimage.segmentation.clear_border",
"skimage.measure.label",
"numpy.array",
"cv2.split",
"os.path.join",
"ski... | [((6990, 7017), 'skimage.segmentation.clear_border', 'clear_border', (['heatmapbinary'], {}), '(heatmapbinary)\n', (7002, 7017), False, 'from skimage.segmentation import clear_border\n'), ((7036, 7056), 'skimage.measure.label', 'label', (['heatmapbinary'], {}), '(heatmapbinary)\n', (7041, 7056), False, 'from skimage.me... |
#
# Copyright 2019 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"numpy.fromfile",
"PyNvCodec.PyNvEncoder"
] | [((759, 834), 'PyNvCodec.PyNvEncoder', 'nvc.PyNvEncoder', (["{'preset': 'hq', 'codec': 'h264', 's': '1920x1080'}", 'gpuID'], {}), "({'preset': 'hq', 'codec': 'h264', 's': '1920x1080'}, gpuID)\n", (774, 834), True, 'import PyNvCodec as nvc\n'), ((1043, 1100), 'numpy.fromfile', 'np.fromfile', (['decFile'], {'dtype': 'np.... |
from __future__ import print_function
import json
import numpy as np
from networkx.readwrite import json_graph
from argparse import ArgumentParser
from sklearn.linear_model import SGDRegressor
from sklearn.metrics import mean_squared_error, mean_absolute_percentage_error, r2_score, explained_variance_score
from sklea... | [
"numpy.load",
"numpy.random.seed",
"argparse.ArgumentParser",
"sklearn.preprocessing.StandardScaler",
"sklearn.linear_model.SGDRegressor",
"sklearn.dummy.DummyRegressor",
"numpy.std",
"sklearn.preprocessing.MinMaxScaler",
"numpy.expand_dims",
"numpy.shape",
"numpy.mean",
"numpy.array"
] | [((753, 786), 'sklearn.dummy.DummyRegressor', 'DummyRegressor', ([], {'strategy': '"""median"""'}), "(strategy='median')\n", (767, 786), False, 'from sklearn.dummy import DummyRegressor\n'), ((1677, 1736), 'sklearn.linear_model.SGDRegressor', 'SGDRegressor', ([], {'loss': '"""squared_loss"""', 'max_iter': '(1000)', 'to... |
"""Base and child classes to handle models
used to fit light curves
Author: <NAME>
Email: <EMAIL>
"""
import copy
import inspect
import os
import astropy.units as q
import batman
from bokeh.plotting import figure, show
import numpy as np
from .parameters import Parameters
from ..limb_darkening.limb_darkening_fit imp... | [
"numpy.poly1d",
"bokeh.plotting.figure",
"batman.TransitParams",
"numpy.trim_zeros",
"os.file.exists",
"numpy.polyval",
"numpy.zeros",
"copy.copy",
"numpy.array",
"bokeh.plotting.show",
"inspect.signature",
"numpy.interp",
"batman.TransitModel"
] | [((2048, 2068), 'numpy.array', 'np.array', (['flux_array'], {}), '(flux_array)\n', (2056, 2068), True, 'import numpy as np\n'), ((2513, 2554), 'numpy.interp', 'np.interp', (['new_time', 'self.time', 'self.flux'], {}), '(new_time, self.time, self.flux)\n', (2522, 2554), True, 'import numpy as np\n'), ((7317, 7330), 'num... |
# solutions.py
"""Volume II: Interior Point II (Quadratic Optimization). Test Driver."""
# Wrappers ====================================================================
import signal
from functools import wraps
from matplotlib import pyplot as plt
def _autoclose(func):
"""Decorator for closing figures automatica... | [
"real_solutions.portfolio",
"matplotlib.pyplot.ioff",
"numpy.ravel",
"matplotlib.pyplot.close",
"numpy.allclose",
"numpy.ones",
"matplotlib.pyplot.ion",
"numpy.array",
"functools.wraps",
"signal.alarm",
"signal.signal"
] | [((333, 344), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (338, 344), False, 'from functools import wraps\n'), ((4637, 4666), 'numpy.allclose', 'np.allclose', (['correct', 'student'], {}), '(correct, student)\n', (4648, 4666), True, 'import numpy as np\n'), ((5881, 5911), 'numpy.array', 'np.array', (['[[1, ... |
import numpy as np
from skimage.filters import prewitt_h, prewitt_v, laplace
class Feature:
# create new Feature object storing 4 images
def __init__(self, no_flash1, no_flash2, flash, lst_flash, n=5, boxsize=3, r=3):
self.n = n
self.boxsize = boxsize
self.r = r
self.locs... | [
"skimage.filters.laplace",
"numpy.std",
"numpy.zeros",
"numpy.mean",
"numpy.array",
"numpy.concatenate"
] | [((1036, 1050), 'numpy.array', 'np.array', (['locs'], {}), '(locs)\n', (1044, 1050), True, 'import numpy as np\n'), ((1458, 1471), 'numpy.array', 'np.array', (['cut'], {}), '(cut)\n', (1466, 1471), True, 'import numpy as np\n'), ((1629, 1643), 'numpy.array', 'np.array', (['mean'], {}), '(mean)\n', (1637, 1643), True, '... |
import numpy as np
from keras.layers.core import Flatten, Dense, Activation, Lambda
from keras.models import Model
from keras.layers.convolutional import Conv2D, Deconv2D, ZeroPadding2D, UpSampling2D
from keras.layers import Input, Concatenate, concatenate, LeakyReLU, BatchNormalization
# PatchGAN-discriminator
def d... | [
"keras.layers.core.Lambda",
"keras.layers.core.Dense",
"keras.layers.LeakyReLU",
"numpy.log",
"keras.layers.convolutional.UpSampling2D",
"keras.layers.core.Activation",
"keras.models.Model",
"keras.layers.Concatenate",
"keras.layers.convolutional.Conv2D",
"keras.layers.core.Flatten",
"keras.laye... | [((928, 987), 'keras.layers.Input', 'Input', ([], {'shape': 'disc_img_shape', 'name': '"""discriminator_dct_input"""'}), "(shape=disc_img_shape, name='discriminator_dct_input')\n", (933, 987), False, 'from keras.layers import Input, Concatenate, concatenate, LeakyReLU, BatchNormalization\n'), ((1266, 1331), 'keras.laye... |
"""
Tests for leap_ec.distrib.evaluate.
"""
from distributed import Client
import numpy as np
from leap_ec.individual import Individual
from leap_ec.binary_rep.problems import MaxOnes
from leap_ec.distrib.evaluate import evaluate
from leap_ec.global_vars import context
def test_good_eval():
"""
This... | [
"leap_ec.distrib.evaluate.evaluate",
"numpy.array",
"distributed.Client",
"leap_ec.binary_rep.problems.MaxOnes"
] | [((501, 509), 'distributed.Client', 'Client', ([], {}), '()\n', (507, 509), False, 'from distributed import Client\n'), ((665, 681), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n', (673, 681), True, 'import numpy as np\n'), ((766, 791), 'leap_ec.distrib.evaluate.evaluate', 'evaluate', ([], {'context': 'conte... |
# Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved.
import dace
from dace.transformation import optimizer
from dace.transformation.dataflow import GPUTransformMap
import numpy as np
import pytest
@dace.program
def prog1(A: dace.float32[32], B: dace.float32[32]):
@dace.map
def work1(i: ... | [
"numpy.random.rand",
"numpy.linalg.norm"
] | [((1063, 1084), 'numpy.linalg.norm', 'np.linalg.norm', (['(A - C)'], {}), '(A - C)\n', (1077, 1084), True, 'import numpy as np\n'), ((681, 699), 'numpy.random.rand', 'np.random.rand', (['(32)'], {}), '(32)\n', (695, 699), True, 'import numpy as np\n'), ((727, 745), 'numpy.random.rand', 'np.random.rand', (['(32)'], {}),... |
import numpy as np
import scipy.io
from fealpy.mesh import TriangleMesh
from fealpy.writer import MeshWriter
def mat2vtk(mfile, vfile):
data = scipy.io.loadmat(mfile)
node = np.array(data['node'], dtype=np.float64)
cell = np.array(data['elem'] - 1, dtype=np.int_)
mesh = TriangleMesh(node, cell)
... | [
"fealpy.writer.MeshWriter",
"numpy.array",
"fealpy.mesh.TriangleMesh"
] | [((186, 226), 'numpy.array', 'np.array', (["data['node']"], {'dtype': 'np.float64'}), "(data['node'], dtype=np.float64)\n", (194, 226), True, 'import numpy as np\n'), ((238, 279), 'numpy.array', 'np.array', (["(data['elem'] - 1)"], {'dtype': 'np.int_'}), "(data['elem'] - 1, dtype=np.int_)\n", (246, 279), True, 'import ... |
#!/usr/bin/env python
# encoding: utf-8
"""
Author(s): <NAME>
See LICENCE.txt for licensing and contact information.
"""
__all__ = ['ColoredRenderer', 'TexturedRenderer']
import numpy as np
import pdb
import cv2
import time
import platform
import scipy.sparse as sp
from copy import deepcopy
from opendr import commo... | [
"OpenGL.GL.glTexImage2DMultisample",
"numpy.sum",
"glfw.make_context_current",
"numpy.einsum",
"numpy.ones",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.arange",
"OpenGL.arrays.vbo.unbind",
"OpenGL.GL.glCheckFramebufferStatus",
"OpenGL.GL.glRenderbufferStorage",
"numpy.identity",
"num... | [((5910, 5976), 'OpenGL.GL.glViewport', 'GL.glViewport', (['(0)', '(0)', "self.frustum['width']", "self.frustum['height']"], {}), "(0, 0, self.frustum['width'], self.frustum['height'])\n", (5923, 5976), True, 'import OpenGL.GL as GL\n'), ((6012, 6035), 'OpenGL.GL.glGenFramebuffers', 'GL.glGenFramebuffers', (['(1)'], {}... |
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Noisy-Sin Shard Descriptor."""
from typing import List
import numpy as np
from openfl.interface.interactive_api.shard_descriptor import ShardDescriptor
class LinRegSD(ShardDescriptor):
"""Shard descriptor class."""
def __... | [
"numpy.random.seed",
"numpy.sin",
"numpy.array",
"numpy.random.normal",
"numpy.random.rand",
"numpy.concatenate"
] | [((662, 682), 'numpy.random.seed', 'np.random.seed', (['rank'], {}), '(rank)\n', (676, 682), True, 'import numpy as np\n'), ((1005, 1035), 'numpy.concatenate', 'np.concatenate', (['(x, y)'], {'axis': '(1)'}), '((x, y), axis=1)\n', (1019, 1035), True, 'import numpy as np\n'), ((925, 934), 'numpy.sin', 'np.sin', (['x'], ... |
import os
import numpy as np
import tensorflow as tf
import cv2
from PIL import Image
from tensorflow.keras.applications import VGG16
from tensorflow.keras import backend as K
from model import Vgg16
def tensor_load_rgbimage(filename, size=None, scale=None, keep_asp=False):
img = Image.open(filename).convert('RGB'... | [
"tensorflow.clip_by_value",
"tensorflow.concat",
"tensorflow.constant",
"tensorflow.transpose",
"PIL.Image.open",
"tensorflow.Variable",
"tensorflow.keras.backend.permute_dimensions",
"numpy.array",
"PIL.Image.fromarray",
"tensorflow.split",
"os.path.join",
"os.listdir",
"tensorflow.keras.ba... | [((745, 779), 'tensorflow.constant', 'tf.constant', (['img'], {'dtype': 'tf.float64'}), '(img, dtype=tf.float64)\n', (756, 779), True, 'import tensorflow as tf\n'), ((853, 888), 'tensorflow.constant', 'tf.constant', (['tensor'], {'dtype': 'tf.unit8'}), '(tensor, dtype=tf.unit8)\n', (864, 888), True, 'import tensorflow ... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
print(tf.__version__)
from sklearn.datasets.samples_generator import make_moons
from sklearn.datasets.samples_generator import make_circles
from sklearn.datasets.samples_generator import make_blobs
# generate 2d classificat... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"tensorflow.math.exp",
"matplotlib.pyplot.show",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.plot",
"tensorflow.keras.layers.Dense",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"tensorflow.keras.models.Model"... | [((349, 386), 'sklearn.datasets.samples_generator.make_circles', 'make_circles', ([], {'n_samples': 'n', 'noise': '(0.05)'}), '(n_samples=n, noise=0.05)\n', (361, 386), False, 'from sklearn.datasets.samples_generator import make_circles\n'), ((523, 537), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (... |
'''
# This is an 80 character line #
Compute the length of the cluster edge:
-Use Freud to find the complete system neighborlist
-Grab the largest cluster
-Mesh the system
-Compute which bins have largest cluster particles
-If adjacent bins are empty, the reference bin is... | [
"sys.path.append",
"freud.cluster.ClusterProperties",
"numpy.delete",
"freud.cluster.Cluster",
"math.ceil",
"numpy.zeros",
"freud.box.Box",
"gsd.hoomd.open"
] | [((396, 461), 'sys.path.append', 'sys.path.append', (['"""/Users/kolbt/Desktop/compiled/hoomd-blue/build"""'], {}), "('/Users/kolbt/Desktop/compiled/hoomd-blue/build')\n", (411, 461), False, 'import sys\n'), ((462, 520), 'sys.path.append', 'sys.path.append', (['"""/Users/kolbt/Desktop/compiled/gsd/build"""'], {}), "('/... |
#! /usr/bin/env python
"""
This script produces the stacks for emission line luminosity limited samples.
nohup python2 stack_spectra_ELG_LineLF.py > stack_spectra_ELG_LineLF.log &
"""
import sys
import os
from os.path import join
import glob
import numpy as n
import SpectraStackingEBOSS as sse
spec_dir = join(os.e... | [
"numpy.array",
"os.path.join",
"SpectraStackingEBOSS.SpectraStackingEBOSS",
"os.path.basename"
] | [((311, 358), 'os.path.join', 'join', (["os.environ['HOME']", '"""SDSS/stacks/LineLF/"""'], {}), "(os.environ['HOME'], 'SDSS/stacks/LineLF/')\n", (315, 358), False, 'from os.path import join\n'), ((615, 629), 'numpy.array', 'n.array', (['[0.5]'], {}), '([0.5])\n', (622, 629), True, 'import numpy as n\n'), ((662, 676), ... |
# -*- coding: utf-8 -*-
import datetime
from optim.pretrain import *
import argparse
import torch
from utils.utils import get_config_from_json
def parse_option():
parser = argparse.ArgumentParser('argument for training')
parser.add_argument('--save_freq', type=int, default=200,
help='... | [
"numpy.random.seed",
"os.makedirs",
"argparse.ArgumentParser",
"torch.manual_seed",
"os.path.exists",
"datetime.datetime.now"
] | [((179, 227), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""argument for training"""'], {}), "('argument for training')\n", (202, 227), False, 'import argparse\n'), ((3352, 3375), 'os.path.exists', 'os.path.exists', (['log_dir'], {}), '(log_dir)\n', (3366, 3375), False, 'import os\n'), ((3385, 3405), 'os.... |
import pyclesperanto_prototype as cle
import numpy as np
def test_affine_shear_y_in_x_plane():
source = np.zeros((5, 5, 5))
source[1, 1, 1] = 1
reference = np.zeros((5, 5, 5))
reference[1, 2, 1] = 1
transform = cle.AffineTransform3D()
transform.shear_in_x_plane(angle_y_in_degrees=45)
res... | [
"pyclesperanto_prototype.AffineTransform3D",
"numpy.zeros",
"pyclesperanto_prototype.affine_transform",
"pyclesperanto_prototype.pull",
"numpy.array_equal"
] | [((110, 129), 'numpy.zeros', 'np.zeros', (['(5, 5, 5)'], {}), '((5, 5, 5))\n', (118, 129), True, 'import numpy as np\n'), ((171, 190), 'numpy.zeros', 'np.zeros', (['(5, 5, 5)'], {}), '((5, 5, 5))\n', (179, 190), True, 'import numpy as np\n'), ((235, 258), 'pyclesperanto_prototype.AffineTransform3D', 'cle.AffineTransfor... |
import numpy as np
from perses.rjmc import geometry
from openmmtools import states, mcmc
from simtk import openmm, unit
from simtk.openmm import app
from openmmtools import cache
from perses.storage import NetCDFStorageView, NetCDFStorage
from perses.rjmc.topology_proposal import SmallMoleculeSetProposalEngine
from typ... | [
"yaml.load",
"pkg_resources.resource_filename",
"openeye.oechem.OESmilesToMol",
"openmmtools.states.SamplerState",
"openmoltools.forcefield_generators.generateTopologyFromOEMol",
"openmmtools.mcmc.MCMCSampler",
"perses.utils.openeye.extractPositionsFromOEMol",
"perses.rjmc.topology_proposal.SmallMolec... | [((8859, 8890), 'perses.tests.utils.sanitizeSMILES', 'sanitizeSMILES', (['valid_molecules'], {}), '(valid_molecules)\n', (8873, 8890), False, 'from perses.tests.utils import sanitizeSMILES\n'), ((1072, 1102), 'perses.storage.NetCDFStorage', 'NetCDFStorage', (['output_filename'], {}), '(output_filename)\n', (1085, 1102)... |
import featureflow
import numpy as np
import unittest2
from .preprocess import \
UnitNorm, MeanStdNormalization, Binarize, PreprocessingPipeline, Log
from zounds.spectral import \
GeometricScale, FrequencyAdaptive
from zounds.timeseries import Seconds, TimeDimension
from zounds.util import simple_in_memory_set... | [
"numpy.abs",
"zounds.spectral.GeometricScale",
"numpy.random.random_sample",
"numpy.zeros",
"numpy.all",
"zounds.spectral.FrequencyAdaptive",
"featureflow.UuidProvider",
"featureflow.PickleFeature",
"featureflow.StringDelimitedKeyBuilder",
"zounds.timeseries.Seconds",
"featureflow.InMemoryDataba... | [((1161, 1195), 'numpy.random.random_sample', 'np.random.random_sample', (['(1000, 4)'], {}), '((1000, 4))\n', (1184, 1195), True, 'import numpy as np\n'), ((1257, 1289), 'numpy.random.random_sample', 'np.random.random_sample', (['(10, 4)'], {}), '((10, 4))\n', (1280, 1289), True, 'import numpy as np\n'), ((2254, 2288)... |
import argparse
import logging
import os
import sys
from typing import Tuple
from operator import itemgetter
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from brc_pytorch.datasets import BRCDataset
from brc_pytorch.l... | [
"argparse.ArgumentParser",
"brc_pytorch.datasets.BRCDataset",
"torch.nn.ModuleDict",
"torch.autograd.set_detect_anomaly",
"os.path.join",
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"numpy.random.randn",
"torch.nn.Linear",
"operator.itemgetter",
"matplotlib.pyplot.subplots",
"logging.St... | [((1010, 1035), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1033, 1035), False, 'import argparse\n'), ((893, 910), 'numpy.random.randn', 'np.random.randn', ([], {}), '()\n', (908, 910), True, 'import numpy as np\n'), ((1820, 1855), 'logging.getLogger', 'logging.getLogger', (['"""Benchmark1_... |
import os
import platform
import numpy as np
import tensorflow as tf
from utils.infolog import log
from models import create_model
from utils import plot, audio
from utils.text_sequence import text_to_sequence
class Synthesizer:
def load(self, checkpoint_path, hparams, freezer=False):
log('Constructing mo... | [
"numpy.pad",
"utils.audio.save_wav",
"tensorflow.train.Saver",
"utils.infolog.log",
"models.create_model",
"tensorflow.global_variables_initializer",
"numpy.asarray",
"tensorflow.Session",
"tensorflow.variable_scope",
"os.system",
"utils.text_sequence.text_to_sequence",
"platform.system",
"t... | [((300, 334), 'utils.infolog.log', 'log', (['"""Constructing model: Centaur"""'], {}), "('Constructing model: Centaur')\n", (303, 334), False, 'from utils.infolog import log\n'), ((707, 760), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '(None, None)'], {'name': '"""inputs"""'}), "(tf.int32, (None, None), ... |
import os
from collections import deque
import numpy as np
class TemperatureDictionary:
DECADES = ['55-64', '65-74', '75-84', '85-94', '95-04', '05-12']
SEASONS = ['winter', 'spring', 'summer', 'autumn']
LAT_LON_NUDGE = [[0.25, 0], [-0.25, 0], [0, 0.25], [0, -0.25]]
VALID_DECIMALS = [0.125, 0.375, 0.6... | [
"numpy.where",
"numpy.array",
"os.listdir",
"collections.deque"
] | [((490, 519), 'os.listdir', 'os.listdir', (['"""data/ocean_temp"""'], {}), "('data/ocean_temp')\n", (500, 519), False, 'import os\n'), ((3595, 3602), 'collections.deque', 'deque', ([], {}), '()\n', (3600, 3602), False, 'from collections import deque\n'), ((738, 749), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (74... |
import numpy as np
from scipy.stats import gmean
from collections import namedtuple
import threading
import multiprocessing
import configparser
import timestreamquery as tsquery
import os
from timeit import default_timer as timer
from query_execution_utils import executeQueryInstance, Query
import sys, traceback
import... | [
"scipy.stats.gmean",
"sys.exc_info",
"os.path.join",
"timestreamquery.flatModelToDataframe",
"threading.Thread.__init__",
"random.randint",
"numpy.std",
"os.path.exists",
"traceback.print_exception",
"numpy.random.choice",
"configparser.ConfigParser",
"numpy.average",
"time.sleep",
"numpy.... | [((358, 503), 'collections.namedtuple', 'namedtuple', (['"""Params"""', '"""dbname tablename region az cell silo microservicename instancetype osversion instancename processname jdkversion"""'], {}), "('Params',\n 'dbname tablename region az cell silo microservicename instancetype osversion instancename processname ... |
import pandas as pd
import os
import pickle
def save_file(data, fname, dname):
"""Save a datafile (data) to a specific location (dname) and filename (fname)
Currently valid formats are limited to CSV or PKL."""
if not os.path.exists(dname):
os.mkdir(dname)
print(f'Directory {dname} was ... | [
"pandas.DataFrame",
"os.mkdir",
"pickle.dump",
"os.path.exists",
"numpy.argsort",
"soccerplots.radar_chart.Radar",
"os.path.join"
] | [((344, 370), 'os.path.join', 'os.path.join', (['dname', 'fname'], {}), '(dname, fname)\n', (356, 370), False, 'import os\n'), ((380, 401), 'os.path.exists', 'os.path.exists', (['fpath'], {}), '(fpath)\n', (394, 401), False, 'import os\n'), ((2856, 2863), 'soccerplots.radar_chart.Radar', 'Radar', ([], {}), '()\n', (286... |
import dataclasses
import numpy as np
import tensorflow as tf
import gym
import pickle
import sys
from stable_baselines import SAC
from imitation.data import types
from imitation.data.rollout import unwrap_traj
import deep_rlsp
def convert_trajs(filename, traj_len):
with open(filename, "rb") as f:
data ... | [
"imitation.data.types.TrajectoryWithRew",
"numpy.random.seed",
"gym.make",
"dataclasses.replace",
"stable_baselines.SAC.load",
"imitation.data.types.save",
"pickle.load",
"numpy.array",
"numpy.random.randint",
"tensorflow.random.set_random_seed"
] | [((399, 447), 'numpy.array', 'np.array', (["data['observations'][0][:traj_len + 1]"], {}), "(data['observations'][0][:traj_len + 1])\n", (407, 447), True, 'import numpy as np\n'), ((460, 499), 'numpy.array', 'np.array', (["data['actions'][0][:traj_len]"], {}), "(data['actions'][0][:traj_len])\n", (468, 499), True, 'imp... |
# Copyright 2020 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"tensorflow.contrib.data.shuffle_and_repeat",
"tensorflow.compat.v1.parse_single_example",
"tensorflow.compat.v1.less_equal",
"tensorflow.compat.v1.to_float",
"tensorflow.compat.v1.greater_equal",
"tensorflow.contrib.data.parallel_interleave",
"numpy.random.choice",
"magenta.models.gansynth.lib.util.e... | [((1195, 1238), 'magenta.models.gansynth.lib.util.expand_path', 'util.expand_path', (["config['train_data_path']"], {}), "(config['train_data_path'])\n", (1211, 1238), False, 'from magenta.models.gansynth.lib import util\n'), ((1834, 1876), 'numpy.random.choice', 'np.random.choice', (['all_pitches', 'num_samples'], {})... |
import copy
import matplotlib.pyplot as plt
import numpy as np
import scipy as sp
from scipy.spatial.distance import pdist, squareform
from yass.evaluate.util import *
def align_template(template, temp_len=40, mode='all'):
window = np.arange(0, temp_len) - temp_len // 2
n_chan = template.shape[1]
main_ch... | [
"numpy.sum",
"numpy.argmin",
"numpy.argsort",
"numpy.linalg.svd",
"numpy.linalg.norm",
"numpy.arange",
"numpy.random.normal",
"scipy.spatial.distance.pdist",
"numpy.max",
"numpy.min",
"numpy.delete",
"numpy.flip",
"scipy.signal.resample",
"numpy.zeros",
"copy.copy",
"numpy.diff",
"nu... | [((370, 397), 'numpy.zeros', 'np.zeros', (['template.shape[0]'], {}), '(template.shape[0])\n', (378, 397), True, 'import numpy as np\n'), ((457, 492), 'numpy.sum', 'np.sum', (['(template * template)'], {'axis': '(0)'}), '(template * template, axis=0)\n', (463, 492), True, 'import numpy as np\n'), ((549, 577), 'numpy.ze... |
# This file is used to simulate the Flick The Cap game as part of Korean Drinking Games
# Import Files
import random
import time
import numpy as np
# Auxiliary Functions #################################################################
# Generate strength of bottle cap
def BottleCapStrength():
min = 1
max = ... | [
"numpy.random.uniform",
"numpy.random.seed",
"random.randint",
"time.sleep"
] | [((339, 362), 'random.randint', 'random.randint', (['(1)', '(1000)'], {}), '(1, 1000)\n', (353, 362), False, 'import random\n'), ((367, 391), 'numpy.random.seed', 'np.random.seed', (['seed_val'], {}), '(seed_val)\n', (381, 391), True, 'import numpy as np\n'), ((407, 434), 'numpy.random.uniform', 'np.random.uniform', ([... |
"""
Contains the core building blocks of the framework.
"""
from __future__ import division
import math
from copy import deepcopy
import cython as cy
import numpy as np
import pandas as pd
from future.utils import iteritems
PAR = 100.0
TOL = 1e-16
@cy.locals(x=cy.double)
def is_zero(x):
"""
Test for zero t... | [
"pandas.DataFrame",
"copy.deepcopy",
"cython.locals",
"numpy.abs",
"math.ceil",
"math.floor",
"numpy.isnan",
"numpy.isclose",
"cython.declare",
"future.utils.iteritems"
] | [((254, 276), 'cython.locals', 'cy.locals', ([], {'x': 'cy.double'}), '(x=cy.double)\n', (263, 276), True, 'import cython as cy\n'), ((2331, 2352), 'cython.declare', 'cy.declare', (['cy.double'], {}), '(cy.double)\n', (2341, 2352), True, 'import cython as cy\n'), ((2366, 2387), 'cython.declare', 'cy.declare', (['cy.dou... |
"""
Preprocessing: Tests for ._tokenfuncs submodule.
"""
import string
from hypothesis import given, strategies as st
import pytest
import numpy as np
from tmtoolkit.preprocess._tokenfuncs import (
str_multisplit, str_shape, str_shapesplit, expand_compound_token, make_index_window_around_matches,
token_match... | [
"tmtoolkit.preprocess._tokenfuncs.expand_compound_token",
"numpy.arange",
"tmtoolkit.preprocess._tokenfuncs.str_multisplit",
"tmtoolkit.preprocess._tokenfuncs.token_match_subsequent",
"numpy.unique",
"hypothesis.strategies.booleans",
"tmtoolkit.preprocess._tokenfuncs.token_match",
"pytest.raises",
"... | [((783, 813), 'tmtoolkit.preprocess._tokenfuncs.str_multisplit', 'str_multisplit', (['s', 'split_chars'], {}), '(s, split_chars)\n', (797, 813), False, 'from tmtoolkit.preprocess._tokenfuncs import str_multisplit, str_shape, str_shapesplit, expand_compound_token, make_index_window_around_matches, token_match_subsequent... |
#!pip install timm
import torch
import numpy as np
import pandas
import os
import gc
from tqdm import tqdm
import wandb
from datetime import datetime
import pprint
from utils import set_random_seed, get_scheduler, get_criterion, train_epoch, val_epoch
from config import Paths, Training
from augmentations import get_au... | [
"utils.get_scheduler",
"os.remove",
"wandb.finish",
"pandas.read_csv",
"utils.val_epoch",
"utils.get_criterion",
"gc.collect",
"numpy.mean",
"torch.device",
"augmentations.get_augmentations_train",
"os.path.join",
"torch.utils.data.DataLoader",
"utils.set_random_seed",
"config.Training.get... | [((497, 514), 'utils.set_random_seed', 'set_random_seed', ([], {}), '()\n', (512, 514), False, 'from utils import set_random_seed, get_scheduler, get_criterion, train_epoch, val_epoch\n'), ((524, 544), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (536, 544), False, 'import torch\n'), ((943, 975),... |
import pickle
import random
from functools import reduce, partial
import dill
import numpy as np
from pathlib import Path
import torch
from torch.optim import Adam
from torch.nn import functional as F
from torch.utils.data import Subset, ConcatDataset
from sklearn.model_selection import KFold, StratifiedKFold, train_... | [
"sklearn.model_selection.GridSearchCV",
"torch.utils.data.ConcatDataset",
"skai.dataset.TokenDataset",
"torch.argmax",
"skai.utils.multilabel_prediction",
"sklearn.metrics.classification_report",
"skai.utils.get_classification_type",
"pathlib.Path",
"torch.optim.Adam",
"numpy.array",
"torch.Tens... | [((734, 754), 'pathlib.Path', 'Path', (['"""skai/common/"""'], {}), "('skai/common/')\n", (738, 754), False, 'from pathlib import Path\n'), ((1673, 1704), 'skai.utils.get_classification_type', 'get_classification_type', (['labels'], {}), '(labels)\n', (1696, 1704), False, 'from skai.utils import get_classification_type... |
with open('input.txt', 'r') as f:
image_data = f.read()
# print(image_data)
width = 25
height = 6
elements_per_im = width * height
class Layer:
def __init__(self, data, layer_no):
self.layer = [int(l) for l in data if l != '\n']
self.layer_no = layer_no
self.counts = {}
self.... | [
"numpy.array",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.show"
] | [((1369, 1383), 'matplotlib.pyplot.imshow', 'plt.imshow', (['im'], {}), '(im)\n', (1379, 1383), True, 'import matplotlib.pyplot as plt\n'), ((1384, 1394), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1392, 1394), True, 'import matplotlib.pyplot as plt\n'), ((1323, 1341), 'numpy.array', 'np.array', (['final_... |
import math
import numbers
from typing import Optional
import numpy as np
from fairseq.data.audio.feature_transforms import (
AudioFeatureTransform,
register_audio_feature_transform,
)
@register_audio_feature_transform("specaugment")
class SpecAugmentTransform(AudioFeatureTransform):
"""Spec... | [
"cv2.resize",
"fairseq.data.audio.feature_transforms.register_audio_feature_transform",
"math.floor",
"numpy.random.randint",
"numpy.concatenate"
] | [((208, 255), 'fairseq.data.audio.feature_transforms.register_audio_feature_transform', 'register_audio_feature_transform', (['"""specaugment"""'], {}), "('specaugment')\n", (240, 255), False, 'from fairseq.data.audio.feature_transforms import AudioFeatureTransform, register_audio_feature_transform\n'), ((3984, 4022), ... |
"""Class definition for the SMOS Soil Mositure data type.
.. module:: smos
:synopsis: Definition of the SMOS class
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from soilmoist import Soilmoist
import dbio
import os
import netCDF4 as netcdf
from scipy.spatial import KDTree
import numpy as np
from datetime import datetim... | [
"datasets.dates",
"netCDF4.Dataset",
"os.remove",
"numpy.meshgrid",
"datasets.spatialSubset",
"dbio.writeGeotif",
"datetime.datetime",
"dbio.ingest",
"datetime.timedelta",
"logging.getLogger"
] | [((422, 451), 'datasets.dates', 'datasets.dates', (['dbname', 'table'], {}), '(dbname, table)\n', (436, 451), False, 'import datasets\n'), ((637, 658), 'numpy.meshgrid', 'np.meshgrid', (['lon', 'lat'], {}), '(lon, lat)\n', (648, 658), True, 'import numpy as np\n'), ((868, 899), 'numpy.meshgrid', 'np.meshgrid', (['grid_... |
import os
import cv2
import argparse
import numpy as np
import scipy.signal
from PIL import Image
from skimage import exposure
import matplotlib.pyplot as plt
def config_parse():
parser = argparse.ArgumentParser(description='Parameters Parser')
parser.add_argument('--input_path', type=str, required=True, help... | [
"matplotlib.pyplot.title",
"numpy.maximum",
"argparse.ArgumentParser",
"numpy.double",
"numpy.sum",
"numpy.abs",
"numpy.floor",
"numpy.ones",
"numpy.argmin",
"numpy.argsort",
"numpy.exp",
"matplotlib.pyplot.imsave",
"numpy.zeros_like",
"numpy.copy",
"matplotlib.pyplot.imshow",
"numpy.m... | [((194, 250), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parameters Parser"""'}), "(description='Parameters Parser')\n", (217, 250), False, 'import argparse\n'), ((1331, 1350), 'numpy.double', 'np.double', (['seq_imgs'], {}), '(seq_imgs)\n', (1340, 1350), True, 'import numpy as np\n'... |
# from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
import glob
import os.path as osp
import numpy as np
# import json_tricks as json
import json
import pickle
import logging
import os
import copy
from torch.utils.data import Dataset
import cv2
import to... | [
"pickle.dump",
"json.load",
"numpy.sum",
"scipy.io.loadmat",
"numpy.logical_not",
"numpy.zeros",
"numpy.ones",
"numpy.expand_dims",
"numpy.array",
"numpy.bitwise_and",
"numpy.dot",
"os.path.join",
"numpy.concatenate"
] | [((580, 592), 'json.load', 'json.load', (['f'], {}), '(f)\n', (589, 592), False, 'import json\n'), ((1733, 1754), 'numpy.array', 'np.array', (['[1032, 776]'], {}), '([1032, 776])\n', (1741, 1754), True, 'import numpy as np\n'), ((2680, 2718), 'os.path.join', 'osp.join', (['image_folder', '"""actorsGT.mat"""'], {}), "(i... |
"""Integrity checks and tests for specific features used"""
import copy
import logging
import numbers
import re
from typing import Optional, Iterable, Any
from collections import Counter
import libsbml
import numpy as np
import pandas as pd
import sympy as sp
import petab_MS
from . import (core, parameters, sbml, me... | [
"copy.deepcopy",
"sympy.sympify",
"re.match",
"numpy.issubdtype",
"numpy.isnan",
"pandas.api.types.is_string_dtype",
"collections.Counter",
"pandas.isna",
"petab_MS.get_parametric_overrides",
"logging.getLogger",
"re.compile"
] | [((373, 400), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (390, 400), False, 'import logging\n'), ((1355, 1386), 're.compile', 're.compile', (['"""(?:^\\\\s)|(?:\\\\s$)"""'], {}), "('(?:^\\\\s)|(?:\\\\s$)')\n", (1365, 1386), False, 'import re\n'), ((20190, 20219), 'copy.deepcopy', 'cop... |
"""
Copyright 2017 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | [
"collections.defaultdict",
"json.load",
"numpy.argmin"
] | [((2096, 2113), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2107, 2113), False, 'from collections import defaultdict\n'), ((1960, 1972), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1969, 1972), False, 'import json\n'), ((2067, 2079), 'json.load', 'json.load', (['f'], {}), '(f)\n', (2076,... |
from DAEpy.solvers.ocp import ocp_solver
import numpy as np
import matplotlib.pyplot as plt
def f(x,y,t):
return np.array([x[2], x[3], -y[0]*x[0], -y[0]*x[1]-9.81])
def g(x,t):
return np.array([(x[0]**2+x[1]**2-1.0)*1000.0])
def fx(x,y,t):
out = np.zeros((4, 4, len(t)))
out[0,2,:] = 1.0
out[1... | [
"matplotlib.pyplot.show",
"numpy.empty",
"numpy.zeros",
"numpy.einsum",
"numpy.ones",
"DAEpy.solvers.ocp.ocp_solver",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((120, 177), 'numpy.array', 'np.array', (['[x[2], x[3], -y[0] * x[0], -y[0] * x[1] - 9.81]'], {}), '([x[2], x[3], -y[0] * x[0], -y[0] * x[1] - 9.81])\n', (128, 177), True, 'import numpy as np\n'), ((197, 247), 'numpy.array', 'np.array', (['[(x[0] ** 2 + x[1] ** 2 - 1.0) * 1000.0]'], {}), '([(x[0] ** 2 + x[1] ** 2 - 1.... |
#
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"cupy.cuda.runtime.getDeviceCount",
"traceback.print_exc",
"logging.basicConfig",
"flask.Flask",
"joblib.load",
"time.perf_counter",
"xgboost.Booster",
"os.cpu_count",
"cuml.ForestInference.load",
"flask.request.get_data",
"numpy.array",
"glob.glob",
"functools.lru_cache",
"flask.Response"... | [((1271, 1286), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1276, 1286), False, 'from flask import Flask, Response\n'), ((1291, 1331), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (1310, 1331), False, 'import logging\n'), ((1827, 1838), 'fun... |
import matplotlib.pyplot as plt
import numpy as np
data = np.genfromtxt("/Users/benson/Desktop/Upskilling/SP/IT8701 Introduction to Programming for Data Science/Assignment1/active-cases-of-renting-out-of-flat.csv",
skip_header=1,
dtype=[('financial_year','i8'), ('type','U10'),... | [
"matplotlib.pyplot.title",
"numpy.isin",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.genfromtxt",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((59, 390), 'numpy.genfromtxt', 'np.genfromtxt', (['"""/Users/benson/Desktop/Upskilling/SP/IT8701 Introduction to Programming for Data Science/Assignment1/active-cases-of-renting-out-of-flat.csv"""'], {'skip_header': '(1)', 'dtype': "[('financial_year', 'i8'), ('type', 'U10'), ('no_active_cases', 'i8')]", 'delimiter':... |
'''
Created on 8 mars 2017
@author: worm
'''
import collections
import logging
import os
import numpy
import cv2
from snapshotServer.exceptions.PictureComparatorError import PictureComparatorError
import math
import time
from numpy import int32, uint8
Rectangle = collections.namedtuple("Rectangle", ['x', 'y', '... | [
"snapshotServer.exceptions.PictureComparatorError.PictureComparatorError",
"cv2.absdiff",
"numpy.zeros",
"numpy.ones",
"cv2.imread",
"os.path.isfile",
"numpy.array",
"collections.namedtuple",
"cv2.minMaxLoc",
"logging.getLogger",
"cv2.matchTemplate"
] | [((272, 338), 'collections.namedtuple', 'collections.namedtuple', (['"""Rectangle"""', "['x', 'y', 'width', 'height']"], {}), "('Rectangle', ['x', 'y', 'width', 'height'])\n", (294, 338), False, 'import collections\n'), ((347, 390), 'collections.namedtuple', 'collections.namedtuple', (['"""Pixel"""', "['x', 'y']"], {})... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import io
import math
import binascii
import platform
import functools
import traceback
import numpy as np
from . import label_view, table_view, header_view, ... | [
"functools.partial",
"binascii.hexlify",
"os.path.dirname",
"numpy.asarray",
"math.floor",
"traceback.format_exc",
"io.open",
"platform.system",
"numpy.issubdtype"
] | [((14627, 14699), 'math.floor', 'math.floor', (['((window_width - 100 - name_column_size - 165 - 165) / 2 - 25)'], {}), '((window_width - 100 - name_column_size - 165 - 165) / 2 - 25)\n', (14637, 14699), False, 'import math\n'), ((12271, 12309), 'functools.partial', 'functools.partial', (['self._open_label', 'i'], {}),... |
"""
%prog [options] CONFIG
THOR detects differential peaks in multiple ChIP-seq profiles associated
with two distinct biological conditions.
Copyright (C) 2014-2016 <NAME> (<EMAIL>)
This program comes with ABSOLUTELY NO WARRANTY. This is free
software, and you are welcome to redistribute it under certain
conditio... | [
"optparse.OptionGroup",
"matplotlib.pyplot.title",
"os.remove",
"os.mkdir",
"numpy.random.seed",
"numpy.sum",
"os.path.isfile",
"numpy.mean",
"numpy.random.randint",
"os.path.join",
"matplotlib.pyplot.close",
"os.path.exists",
"math.log",
"numpy.var",
"datetime.datetime.now",
"os.path.... | [((1259, 1273), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (1266, 1273), True, 'import matplotlib as mpl\n'), ((1329, 1347), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (1343, 1347), True, 'import numpy as np\n'), ((10580, 10593), 'numpy.mean', 'np.mean', (['exts'], {}), '(exts)... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import gc
import heapq
import random
import sys
import time
from collections import OrderedDict
from os import path
import numpy as np
kSampleSize = 64 # The sample size used when performing eviction.
kMicrosInSecond = 1... | [
"numpy.zeros_like",
"numpy.outer",
"heapq.heappush",
"numpy.random.beta",
"numpy.zeros",
"os.path.exists",
"numpy.identity",
"time.time",
"heapq.heappop",
"gc.collect",
"numpy.linalg.inv",
"collections.OrderedDict",
"numpy.sqrt"
] | [((58063, 58074), 'time.time', 'time.time', ([], {}), '()\n', (58072, 58074), False, 'import time\n'), ((61333, 61344), 'time.time', 'time.time', ([], {}), '()\n', (61342, 61344), False, 'import time\n'), ((64889, 64900), 'time.time', 'time.time', ([], {}), '()\n', (64898, 64900), False, 'import time\n'), ((8001, 8013)... |
from django.shortcuts import render
from rest_framework.permissions import IsAuthenticated,AllowAny
from .serializers import WaterLevelSerializer, FetchWaterLevelSerializer
from rest_framework.generics import ListAPIView,CreateAPIView
from dashboard.models import WaterLevel
from rest_framework.views import APIView
from... | [
"pandas.DataFrame",
"uuid.uuid4",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.linear_model.LinearRegression",
"numpy.random.randint",
"rest_framework.response.Response",
"pandas.concat"
] | [((821, 833), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (831, 833), False, 'import uuid\n'), ((1008, 1065), 'rest_framework.response.Response', 'Response', (['serializer.data'], {'status': 'status.HTTP_201_CREATED'}), '(serializer.data, status=status.HTTP_201_CREATED)\n', (1016, 1065), False, 'from rest_framework.r... |
import numpy as np
from liegroups.numpy import _base
from liegroups.numpy.so3 import SO3
class SE3(_base.SpecialEuclideanBase):
"""Homogeneous transformation matrix in :math:`SE(3)` using active (alibi) transformations.
.. math::
SE(3) &= \\left\\{ \\mathbf{T}=
\\begin{bmatrix}
... | [
"liegroups.numpy.so3.SO3.left_jacobian",
"liegroups.numpy.so3.SO3.wedge",
"numpy.empty",
"numpy.zeros",
"numpy.expand_dims",
"liegroups.numpy.so3.SO3.inv_left_jacobian",
"numpy.hstack",
"numpy.identity",
"numpy.sin",
"numpy.linalg.norm",
"numpy.cos",
"numpy.squeeze",
"numpy.eye",
"numpy.at... | [((2578, 2611), 'numpy.empty', 'np.empty', (['[Psi.shape[0], cls.dof]'], {}), '([Psi.shape[0], cls.dof])\n', (2586, 2611), True, 'import numpy as np\n'), ((2748, 2762), 'numpy.squeeze', 'np.squeeze', (['xi'], {}), '(xi)\n', (2758, 2762), True, 'import numpy as np\n'), ((3272, 3289), 'numpy.atleast_2d', 'np.atleast_2d',... |
### K: Model: Autoencoder
import sys
import time
import pandas as pd
import os
import math
import numpy as np
from numpy import mean, std
from unit import remove_columns_with_one_value, remove_nan_columns, load_dataset
from unit import display_general_information, display_feature_distribution
from collections import Co... | [
"numpy.random.seed",
"unit.load_dataset",
"sklearn.preprocessing.StandardScaler",
"sklearn.model_selection.train_test_split",
"pandas.set_option",
"unit.display_general_information",
"pandas.DataFrame",
"numpy.max",
"pandas.concat",
"sklearn.metrics.mean_squared_error",
"numpy.median",
"unit.r... | [((2211, 2250), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (2224, 2250), True, 'import pandas as pd\n'), ((2252, 2291), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(5)'], {}), "('display.max_columns', 5)\n", (2265, 2291), Tru... |
import tensorflow as tf
import torch
import numpy as np
from typing import Union
# compute loss for a batch
def cross_entropy_loss(outputs: tf.Tensor, labels: np.ndarray) -> tf.Tensor:
"""
Calculate the cross entropy loss between the predicted probability distributions
and the labels.
Args:
o... | [
"tensorflow.cast",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"numpy.argmax",
"tensorflow.reduce_mean"
] | [((574, 599), 'tensorflow.cast', 'tf.cast', (['labels', 'tf.int64'], {}), '(labels, tf.int64)\n', (581, 599), True, 'import tensorflow as tf\n'), ((611, 688), 'tensorflow.nn.sparse_softmax_cross_entropy_with_logits', 'tf.nn.sparse_softmax_cross_entropy_with_logits', ([], {'labels': 'labels', 'logits': 'outputs'}), '(la... |
import os
import copy
import json
import numpy as np
from typing import Callable, List
from typing import Optional
from obj_data import ObjCLEVRVisionLanguageCLIPDataset, ObjCLEVRVisionLanguageCLIPDataModule, \
ObjAugCLEVRVisionLanguageCLIPDataset, ObjAugCLEVRVisionLanguageCLIPDataModule
class ObjCATERVisionLang... | [
"copy.deepcopy",
"json.load",
"numpy.zeros",
"os.path.exists",
"os.path.join",
"numpy.random.shuffle"
] | [((2314, 2352), 'os.path.join', 'os.path.join', (['self.data_root', '"""videos"""'], {}), "(self.data_root, 'videos')\n", (2326, 2352), False, 'import os\n'), ((2368, 2398), 'os.path.exists', 'os.path.exists', (['self.data_path'], {}), '(self.data_path)\n', (2382, 2398), False, 'import os\n'), ((7028, 7066), 'numpy.zer... |
import torch
from torch import nn
import os
from torch import optim
import numpy as np
import pickle
from smpl_torch_batch import SMPLModel
from torch.utils.data import Dataset, DataLoader
from sys import platform
class Joint2SMPLDataset(Dataset):
'''
Regression Data with Joint and Theta, Beta.
Pre... | [
"torch.nn.Dropout",
"os.mkdir",
"torch.load_state_dict",
"torch.set_default_dtype",
"os.path.isfile",
"numpy.random.randint",
"pickle.load",
"torch.device",
"torch.no_grad",
"torch.isnan",
"torch.utils.data.DataLoader",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.nn.Linear",
"torc... | [((5633, 5724), 'torch.utils.data.DataLoader', 'DataLoader', (['dataset'], {'batch_size': 'batch_size', 'shuffle': '(True)', 'num_workers': '(0)', 'drop_last': '(True)'}), '(dataset, batch_size=batch_size, shuffle=True, num_workers=0,\n drop_last=True)\n', (5643, 5724), False, 'from torch.utils.data import Dataset, ... |
import numpy as np
import pandas as pd
from pathlib import Path
from src.utils import write_json, write_pkl, load_json
def convert_timeseries_into_mmap(data_dir, save_dir, n_rows=100000):
"""
read csv file and convert time series data into mmap file.
"""
save_path = Path(save_dir) / 'ts.dat'
shape... | [
"src.utils.load_json",
"pandas.read_csv",
"pathlib.Path",
"numpy.reshape",
"numpy.memmap",
"numpy.concatenate"
] | [((357, 419), 'numpy.memmap', 'np.memmap', (['save_path'], {'dtype': 'np.float32', 'mode': '"""w+"""', 'shape': 'shape'}), "(save_path, dtype=np.float32, mode='w+', shape=shape)\n", (366, 419), True, 'import numpy as np\n'), ((1076, 1095), 'numpy.concatenate', 'np.concatenate', (['ids'], {}), '(ids)\n', (1090, 1095), T... |
import sys
import os
import re
import multiprocessing
import os.path as osp
import gym
from collections import defaultdict
import tensorflow as tf
import numpy as np
import yaml
import datetime
import pickle
from baselines.common.vec_env import VecFrameStack, VecNormalize, VecEnv
from baselines.common.vec_env.vec_video... | [
"pickle.dump",
"numpy.sum",
"baselines.common.tf_util.get_session",
"gym.envs.registry.all",
"yaml.dump",
"baselines.common.cmd_util.make_env",
"collections.defaultdict",
"tensorflow.ConfigProto",
"numpy.mean",
"yaml.safe_load",
"os.path.join",
"multiprocessing.cpu_count",
"numpy.std",
"os... | [((793, 809), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (804, 809), False, 'from collections import defaultdict\n'), ((821, 844), 'gym.envs.registry.all', 'gym.envs.registry.all', ([], {}), '()\n', (842, 844), False, 'import gym\n'), ((6753, 6780), 'multiprocessing.cpu_count', 'multiprocessing... |
from json import loads
from django.db.models.base import Model
from django.http.response import JsonResponse
from rest_framework.viewsets import ModelViewSet
from .models import Review, Area
from .serializer import ReviewSerializer, AreaSerializer
from django.views.decorators.csrf import csrf_exempt
from django.db imp... | [
"django.http.response.JsonResponse",
"numpy.unique",
"django.db.connection.cursor"
] | [((4247, 4281), 'django.http.response.JsonResponse', 'JsonResponse', (['response'], {'safe': '(False)'}), '(response, safe=False)\n', (4259, 4281), False, 'from django.http.response import JsonResponse\n'), ((934, 953), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (951, 953), False, 'from djang... |
import sys,os
from rdkit import Chem
srcPath = os.path.split(os.path.realpath(__file__))[0]
sys.path.insert(1, srcPath)
from src.UsefulFunctions import *
from src.SyntOn_BBs import *
def main(args):
with open(args.output + "_Scaffolds.smi", "w") as out:
scaffoldsCount = {}
for line in open(args.inp... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"os.path.realpath",
"numpy.genfromtxt",
"sys.path.insert",
"rdkit.Chem.MolToSmiles",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.su... | [((92, 119), 'sys.path.insert', 'sys.path.insert', (['(1)', 'srcPath'], {}), '(1, srcPath)\n', (107, 119), False, 'import sys, os\n'), ((1967, 2029), 'numpy.genfromtxt', 'genfromtxt', (['cumPercentageFile'], {'delimiter': '""" """', 'names': "['x', 'y']"}), "(cumPercentageFile, delimiter=' ', names=['x', 'y'])\n", (197... |
import numpy as np
from pathlib import Path
from argparse import ArgumentParser
import matplotlib.pyplot as plt
parser = ArgumentParser()
parser.add_argument("--logdir", type=Path, required=True)
parser.add_argument("--dot", type=int, default=-1)
parser.add_argument("--begin_iter", type=int, default=0)
args = parser... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.arange",
"numpy.loadtxt"
] | [((122, 138), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (136, 138), False, 'from argparse import ArgumentParser\n'), ((857, 869), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (867, 869), True, 'import matplotlib.pyplot as plt\n'), ((870, 880), 'matplotlib.pyplot.show', 'plt.show', ([... |
from adjustText import adjust_text
import copy
import csv
import matplotlib
import matplotlib.patheffects as PathEffects
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import os
import pandas as pd
import pickle
import scipy.cluster.hierarchy as SciPyClus
import scipy.stats as scs
from singsco... | [
"pickle.dump",
"csv.reader",
"numpy.abs",
"numpy.isnan",
"numpy.argsort",
"numpy.shape",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.bitwise_or",
"os.path.join",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.path.dirname",
"networkx.find_cycle",
"networkx.topological_sort",
... | [((387, 415), 'os.path.dirname', 'os.path.dirname', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (402, 415), False, 'import os\n'), ((449, 477), 'os.path.normpath', 'os.path.normpath', (['dirCurrent'], {}), '(dirCurrent)\n', (465, 477), False, 'import os\n'), ((569, 607), 'os.path.join', 'os.path.join', (['pathOutFolder',... |
import numpy as np
import pandas as pd
from veneer.pest_runtime import *
from veneer.manage import start,kill_all_now
import pyapprox as pya
from pyapprox.utilities import total_degree_space_dimension
from funcs.read_data import file_settings, variables_prep
from funcs.modeling_funcs import vs_settings, \
mo... | [
"funcs.modeling_funcs.modeling_settings",
"funcs.read_data.variables_prep",
"pyapprox.utilities.total_degree_space_dimension",
"funcs.read_data.file_settings",
"numpy.savetxt",
"pyapprox.approximate.approximate",
"run_source.run_source_fix_samples",
"numpy.append",
"numpy.random.randint",
"veneer.... | [((593, 612), 'funcs.modeling_funcs.modeling_settings', 'modeling_settings', ([], {}), '()\n', (610, 612), False, 'from funcs.modeling_funcs import vs_settings, modeling_settings, paralell_vs, obtain_initials, change_param_values\n'), ((632, 694), 'funcs.modeling_funcs.paralell_vs', 'paralell_vs', (['first_port', 'num_... |
import numpy as np
import tensorflow as tf
def splitter(x):
row = np.array(x.split(',')).astype(np.float32)
label = row[0]
pixel = row[1:]
return label, pixel
def normalize(label, pixel):
"""Returns a normalized feature array between 0 and 1"""
pixel = pixel.astype(np.float32)
#return lab... | [
"numpy.min",
"numpy.max",
"tensorflow.decode_csv"
] | [((461, 496), 'tensorflow.decode_csv', 'tf.decode_csv', (['line', 'default_values'], {}), '(line, default_values)\n', (474, 496), True, 'import tensorflow as tf\n'), ((371, 384), 'numpy.min', 'np.min', (['pixel'], {}), '(pixel)\n', (377, 384), True, 'import numpy as np\n'), ((387, 400), 'numpy.max', 'np.max', (['pixel'... |
# import numpy as np
def rect_to_points(r):
return (r[0],r[1]), (r[0]+r[2], r[1]+r[3])
def points_to_rect(p1,p2):
return (p1[0],p1[1], p2[0]-p1[0], p2[1]-p1[1])
def union_rect(r1, r2):
(a1,b1),(c1,d1) = rect_to_points(r1)
(a2,b2),(c2,d2) = rect_to_points(r2)
a = min(a1,a2)
b = min(b1,b2)
... | [
"cv2.waitKey",
"cv2.imshow",
"numpy.zeros",
"u_opencv.color"
] | [((2111, 2150), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)'], {'dtype': 'np.uint8'}), '((512, 512, 3), dtype=np.uint8)\n', (2119, 2150), True, 'import numpy as np\n'), ((2435, 2458), 'cv2.imshow', 'cv2.imshow', (['"""test"""', 'img'], {}), "('test', img)\n", (2445, 2458), False, 'import cv2\n'), ((2469, 2483), 'cv2.wa... |
#! /usr/bin/env python3
import numpy as np
from matplotlib import pyplot as plt
with open('seed', 'r') as file:
np.random.seed(seed=int(file.read()))
kernel = np.random.randint(256, size=(15**2))
# plt.imshow(kernel.reshape((15,15)))
# plt.show()
kernel_in = []
for pixel in kernel:
kernel_in.append(np.bin... | [
"numpy.binary_repr",
"numpy.random.randint"
] | [((166, 202), 'numpy.random.randint', 'np.random.randint', (['(256)'], {'size': '(15 ** 2)'}), '(256, size=15 ** 2)\n', (183, 202), True, 'import numpy as np\n'), ((314, 344), 'numpy.binary_repr', 'np.binary_repr', (['pixel'], {'width': '(8)'}), '(pixel, width=8)\n', (328, 344), True, 'import numpy as np\n')] |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import print_function, division
import datetime
import numpy as np
from astropy.units import Quantity
from astropy.io import fits
__all__ = ['LogEnergyAxis',
'energy_bounds_equal_log_spacing',
'energy_bin_centers_log_... | [
"astropy.units.Quantity",
"numpy.abs",
"datetime.datetime.today",
"numpy.logspace",
"astropy.io.fits.new_table",
"numpy.empty_like",
"numpy.where",
"numpy.interp",
"astropy.io.fits.Column",
"numpy.log10",
"numpy.sqrt"
] | [((766, 803), 'numpy.sqrt', 'np.sqrt', (['(e_bounds[:-1] * e_bounds[1:])'], {}), '(e_bounds[:-1] * e_bounds[1:])\n', (773, 803), True, 'import numpy as np\n'), ((815, 853), 'astropy.units.Quantity', 'Quantity', (['e_center', 'energy_bounds.unit'], {}), '(e_center, energy_bounds.unit)\n', (823, 853), False, 'from astrop... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.