code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===-... | [
"numpy.allclose",
"numpy.random.rand",
"shutil.rmtree",
"os.path.realpath",
"time.time",
"serialbox.Savepoint",
"serialbox.Serializer"
] | [((1139, 1158), 'serialbox.Savepoint', 'ser.Savepoint', (['"""sp"""'], {}), "('sp')\n", (1152, 1158), True, 'import serialbox as ser\n'), ((1244, 1312), 'serialbox.Serializer', 'ser.Serializer', (['ser.OpenModeKind.Write', '"""./async"""', '"""Field"""', '"""Binary"""'], {}), "(ser.OpenModeKind.Write, './async', 'Field... |
'''
File: discretizer.py
Description: function definition
History:
Date Programmer SAR# - Description
---------- ---------- ----------------------------
Author: <NAME> 29Apr2016 - Created
'''
import numpy as np
from . import pinm as pinm
from stl import mesh
from mpl_toolkits import mplot3d
fro... | [
"mpl_toolkits.mplot3d.art3d.Poly3DCollection",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.draw",
"numpy.sqrt",
"matplotlib.pyplot.show",
"numpy.absolute",
"matplotlib.widgets.Button",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.axes",
"matplotlib.cm.ScalarMappable"... | [((522, 537), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (535, 537), False, 'from matplotlib import pyplot\n'), ((542, 576), 'matplotlib.pyplot.subplots_adjust', 'pyplot.subplots_adjust', ([], {'bottom': '(0.2)'}), '(bottom=0.2)\n', (564, 576), False, 'from matplotlib import pyplot\n'), ((588, 610),... |
import csv
import json
import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
formats = ['png', 'pdf', 'svg', 'eps']
metrics = [
{'gmetric': 'groc', 'lmetric': 'lroc', 'metric': 'AUC'},
{'gmetric': 'gauc', 'lmetric': 'lauc', 'metric': 'PRAUC'},
]
datasets = [
... | [
"json.loads",
"numpy.median",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.quantile",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.title",
"csv.reader",
"matpl... | [((2763, 2791), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4.5)'}), '(figsize=(6, 4.5))\n', (2773, 2791), True, 'import matplotlib.pyplot as plt\n'), ((3977, 4019), 'matplotlib.pyplot.yticks', 'plt.yticks', (['[0.5, 0.6, 0.7, 0.8, 0.9, 1.0]'], {}), '([0.5, 0.6, 0.7, 0.8, 0.9, 1.0])\n', (3987, 4019)... |
"""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
@Time : 2022/2/24 20:12
@Author : <EMAIL>
@ProjectName : udacity-program_self_driving_car_engineer_v1.0_source.0
@File : full_pipeline.py
"""
import numpy as np
import cv2
import os
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
im... | [
"cv2.rectangle",
"numpy.hstack",
"numpy.polyfit",
"matplotlib.image.imread",
"cv2.imshow",
"numpy.array",
"cv2.warpPerspective",
"cv2.destroyAllWindows",
"cv2.calibrateCamera",
"cv2.findChessboardCorners",
"numpy.mean",
"os.listdir",
"cv2.undistort",
"numpy.max",
"cv2.addWeighted",
"nu... | [((442, 482), 'glob.glob', 'glob.glob', (['"""camera_cal/calibration*.jpg"""'], {}), "('camera_cal/calibration*.jpg')\n", (451, 482), False, 'import glob\n'), ((560, 592), 'numpy.zeros', 'np.zeros', (['(6 * 9, 3)', 'np.float32'], {}), '((6 * 9, 3), np.float32)\n', (568, 592), True, 'import numpy as np\n'), ((1607, 1680... |
# ---------------------------------------------------------------------------------
# QKeithleySweep -> QVisaApplication
# Copyright (C) 2019 <NAME>
# github: https://github.com/mesoic
# email: <EMAIL>
# ---------------------------------------------------------------------------------
#
# Permission is hereby grant... | [
"PyQt5.QtWidgets.QMessageBox",
"time.sleep",
"PyQt5.QtWidgets.QStackedWidget",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QComboBox",
"numpy.where",
"PyQt5.QtWidgets.QLabel",
"PyQtVisa.widgets.QVisaUnitSelector.QVisaUnitSelector",
"numpy.concatenate",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.Q... | [((5102, 5115), 'PyQt5.QtWidgets.QHBoxLayout', 'QHBoxLayout', ([], {}), '()\n', (5113, 5115), False, 'from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QMessageBox, QComboBox, QSpinBox, QDoubleSpinBox, QPushButton, QCheckBox, QLabel, QLineEdit, QStackedWidget, QSizePolicy\n'), ((5533, 5542), ... |
#!/usr/bin/python3
# RS-274X per standard Revision 2021.02
import re
import copy
import numpy as np
import vertices
# TODO replace all vertices with outline class
# Meant for extracting substrings only
# Cast to int or float will catch invalid strings
RE_INT = r'[+-]?[0-9]+'
RE_DEC = r'[+-]?[0-9\.]+?'
EXPOSURE_ON... | [
"vertices.rotate",
"numpy.flip",
"vertices.rounded_arc",
"vertices.thick_line",
"vertices.translate",
"vertices.regular_poly",
"vertices.rounded_line",
"vertices.OutlineVertices",
"vertices.circle",
"numpy.array",
"vertices.rectangle",
"copy.copy",
"re.search"
] | [((5454, 5517), 're.search', 're.search', (['"""%FSLAX([1-6])([3-6])Y([1-6])([3-6])\\\\*%"""', 'statement'], {}), "('%FSLAX([1-6])([3-6])Y([1-6])([3-6])\\\\*%', statement)\n", (5463, 5517), False, 'import re\n'), ((7133, 7212), 're.search', 're.search', (['f"""(X{RE_INT})?(Y{RE_INT})?(I{RE_INT})?(J{RE_INT})?D01\\\\*"""... |
"""A wrapper env that handles multiple tasks from different envs.
Useful while training multi-task reinforcement learning algorithms.
It provides observations augmented with one-hot representation of tasks.
"""
import random
import akro
import gym
import numpy as np
def round_robin_strategy(num_tasks, last_task=No... | [
"numpy.prod",
"numpy.ones",
"numpy.zeros",
"numpy.concatenate",
"akro.Box",
"random.randint"
] | [((896, 928), 'random.randint', 'random.randint', (['(0)', '(num_tasks - 1)'], {}), '(0, num_tasks - 1)\n', (910, 928), False, 'import random\n'), ((1566, 1606), 'numpy.prod', 'np.prod', (['envs[0].observation_space.shape'], {}), '(envs[0].observation_space.shape)\n', (1573, 1606), True, 'import numpy as np\n'), ((2630... |
import numpy as np
np.random.seed(10)
import matplotlib.pyplot as plt
from mpi4py import MPI
# For shared memory deployment: `export OPENBLAS_NUM_THREADS=1`
# Method of snapshots
def generate_right_vectors(A):
'''
A - Snapshot matrix - shape: NxS
returns V - truncated right singular vectors
'''
ne... | [
"matplotlib.pyplot.ylabel",
"numpy.save",
"numpy.linalg.qr",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.matmul",
"numpy.random.seed",
"numpy.concatenate",
"numpy.random.normal",
"numpy.abs",
"numpy.linalg.eig",
"numpy.argmax",
"numpy.linalg.svd",
"matplotlib.pyplot.title"... | [((19, 37), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (33, 37), True, 'import numpy as np\n'), ((368, 390), 'numpy.linalg.eig', 'np.linalg.eig', (['new_mat'], {}), '(new_mat)\n', (381, 390), True, 'import numpy as np\n'), ((434, 459), 'numpy.argmax', 'np.argmax', (['(svals < 0.0001)'], {}), '(sva... |
'''
THis is the main training code.
'''
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # set GPU id at the very begining
import argparse
import random
import math
import numpy as np
import torch
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torch.nn.functional as F
from torch.m... | [
"dataset.synthtext.PAN_Synth",
"torch.cuda.is_available",
"torch.multiprocessing.freeze_support",
"loss.loss.loss",
"argparse.ArgumentParser",
"models.pan.PAN",
"torch.mean",
"dataset.custom.PAN_CTW",
"torch.set_num_threads",
"numpy.random.seed",
"sys.stdout.flush",
"dataset.ic15.PAN_IC15",
... | [((647, 671), 'torch.set_num_threads', 'torch.set_num_threads', (['(2)'], {}), '(2)\n', (668, 671), False, 'import torch\n'), ((720, 736), 'torch.multiprocessing.freeze_support', 'freeze_support', ([], {}), '()\n', (734, 736), False, 'from torch.multiprocessing import freeze_support\n'), ((750, 775), 'argparse.Argument... |
import os, sys
sys.path.append(os.getcwd())
import time
import numpy as np
import tensorflow as tf
import tflib as lib
import tflib.ops.linear
import tflib.ops.conv2d
import tflib.ops.batchnorm
import tflib.ops.deconv2d
import tflib.save_images
import tflib.plot
import tflib.flow_handler as fh
import tflib.SINTELdata... | [
"tensorflow.div",
"tflib.plot.plot",
"tensorflow.get_variable",
"tensorflow.tanh",
"tensorflow.group",
"tflib.ops.linear.Linear",
"tflib.ops.deconv2d.Deconv2D",
"tensorflow.reduce_mean",
"tensorflow.ones_like",
"tensorflow.cast",
"numpy.mean",
"tensorflow.random_normal",
"tflib.ops.conv2d.Co... | [((4611, 4671), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[BATCH_SIZE, 2 * OUTPUT_DIM]'}), '(tf.int32, shape=[BATCH_SIZE, 2 * OUTPUT_DIM])\n', (4625, 4671), True, 'import tensorflow as tf\n'), ((4908, 4971), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[BATCH_SIZE,... |
"""
This file contains tests for plotter_utils.py.
@author: <NAME>
"""
import matplotlib.pyplot as plt
import numpy as np
import pytest
from matplotlib.figure import Figure
from gdef_reporter.plotter_styles import get_plotter_style_histogram
from gdef_reporter.plotter_utils import plot_to_ax, create_plot, plot_z_hist... | [
"gdef_reporter.plotter_utils.save_figure",
"gdef_reporter.plotter_utils.create_summary_plot",
"gdef_reporter.plotter_styles.get_plotter_style_histogram",
"gdef_reporter.plotter_utils.create_z_histogram_plot",
"gdef_reporter.plotter_utils.create_rms_plot",
"gdef_reporter.plotter_utils.plot_to_ax",
"gdef_... | [((759, 825), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'dpi': 'ORIGINAL_DPI', 'figsize': 'ORIGINAL_FIGURE_SIZE'}), '(1, 1, dpi=ORIGINAL_DPI, figsize=ORIGINAL_FIGURE_SIZE)\n', (771, 825), True, 'import matplotlib.pyplot as plt\n'), ((834, 883), 'gdef_reporter.plotter_utils.plot_to_ax', 'plot_to_ax... |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import minmax_scale
import matplotlib.pyplot as plt
from model.loss import CategoricalCrossEntropy
from model.layers.dense import Dense
from model.layers.relu import LeakyReLU
from model.layers.softmax import Softmax
fro... | [
"model.loss.CategoricalCrossEntropy",
"model.layers.relu.LeakyReLU",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"model.layers.dense.Dense",
"numpy.zeros",
"numpy.linspace",
"sklearn.preprocessing.minmax_scale",
"model.layers.softmax.Softmax",
"numpy.cos",
... | [((1123, 1160), 'sklearn.preprocessing.minmax_scale', 'minmax_scale', (['X'], {'feature_range': '(0, 1)'}), '(X, feature_range=(0, 1))\n', (1135, 1160), False, 'from sklearn.preprocessing import minmax_scale\n'), ((2273, 2329), 'matplotlib.pyplot.plot', 'plt.plot', (['epochs', 'train_loss', '"""g"""'], {'label': '"""Tr... |
import json
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from model import NeuralNetwork
from nltk_utils import stem, tokenize, bag_of_words
with open('./data/data.json', 'r') as f:
data = json.load(f)
all_words = []
tags = []
xy = []
for intent... | [
"torch.nn.CrossEntropyLoss",
"numpy.array",
"nltk_utils.bag_of_words",
"nltk_utils.tokenize",
"torch.cuda.is_available",
"torch.save",
"torch.utils.data.DataLoader",
"json.load",
"model.NeuralNetwork",
"nltk_utils.stem"
] | [((896, 913), 'numpy.array', 'np.array', (['x_train'], {}), '(x_train)\n', (904, 913), True, 'import numpy as np\n'), ((924, 941), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (932, 941), True, 'import numpy as np\n'), ((1468, 1547), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataset... |
import os
import sys
import syglass as sy
from syglass import pyglass
import numpy as np
import tifffile
import subprocess
def extract(projectPath):
project = sy.get_project(projectPath)
head, tail = os.path.split(projectPath)
# Get a dictionary showing the number of blocks in each level
#codebreak()
resolution_... | [
"subprocess.run",
"numpy.asarray",
"os.path.split",
"os.path.dirname",
"syglass.get_project",
"tifffile.imwrite"
] | [((162, 189), 'syglass.get_project', 'sy.get_project', (['projectPath'], {}), '(projectPath)\n', (176, 189), True, 'import syglass as sy\n'), ((204, 230), 'os.path.split', 'os.path.split', (['projectPath'], {}), '(projectPath)\n', (217, 230), False, 'import os\n'), ((736, 765), 'numpy.asarray', 'np.asarray', (['[1, xsi... |
import os
import sys
from dataclasses import dataclass
import click
import numpy as np
import xgboost as xgb
from rich import print, traceback
WD = os.path.dirname(__file__)
@click.command()
@click.option('-i', '--input', required=True, type=str, help='Path to data file to predict.')
@click.option('-m', '--model', ... | [
"rich.traceback.install",
"click.option",
"os.path.dirname",
"rich.print",
"numpy.array",
"xgboost.Booster",
"numpy.savetxt",
"os.path.abspath",
"xgboost.DMatrix",
"click.command"
] | [((150, 175), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (165, 175), False, 'import os\n'), ((179, 194), 'click.command', 'click.command', ([], {}), '()\n', (192, 194), False, 'import click\n'), ((196, 293), 'click.option', 'click.option', (['"""-i"""', '"""--input"""'], {'required': '(Tr... |
from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import os
from numpy import random
from redmapper import Cluster
from redmapper import Configuration
from redmapper import CenteringWcenZre... | [
"numpy.radians",
"redmapper.Cluster",
"redmapper.CenteringWcenZred",
"os.path.join",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"redmapper.ZlambdaCorrectionPar",
"redmapper.CenteringRandom",
"redmapper.CenteringBCG",
"numpy.random.seed",
"unittest.main",
"redmapper.GalaxyCatalog",
"... | [((6462, 6477), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6475, 6477), False, 'import unittest\n'), ((1209, 1282), 'redmapper.ZlambdaCorrectionPar', 'ZlambdaCorrectionPar', (["(file_path + '/' + corr_filename)"], {'zlambda_pivot': '(30.0)'}), "(file_path + '/' + corr_filename, zlambda_pivot=30.0)\n", (1229, ... |
"""Classes for use with Yambo
Representation of a spectrum.
Main functionality is to read from Yambo output, o.qp files
and also netcdf databases.
"""
import re
import copy as cp
import numpy as np
import asetk.atomistic.fundamental as fu
import asetk.atomistic.constants as atc
from . import cube
class Dispersion:
... | [
"numpy.intersect1d",
"numpy.where",
"netCDF4.Dataset",
"asetk.atomistic.fundamental.Energylevels",
"re.findall",
"numpy.array",
"numpy.concatenate",
"copy.copy",
"numpy.genfromtxt",
"asetk.atomistic.fundamental.EnergyLevels",
"re.search"
] | [((1070, 1090), 'numpy.concatenate', 'np.concatenate', (['list'], {}), '(list)\n', (1084, 1090), True, 'import numpy as np\n'), ((1501, 1529), 'copy.copy', 'cp.copy', (['spectrum.__kvectors'], {}), '(spectrum.__kvectors)\n', (1508, 1529), True, 'import copy as cp\n'), ((1555, 1582), 'copy.copy', 'cp.copy', (['spectrum.... |
import itertools
import numpy as np
from jspp_imageutils.image.types import GenImgArray, GenImgBatch
from typing import Tuple, Iterable, Iterator
# TODO: fix everywhere the x and y axis nomenclature
"""
chunk_image_on_position -> returns images
chunk_image_generator -> returns images
chunk_data_image_generator -> re... | [
"itertools.product",
"numpy.asarray",
"numpy.concatenate"
] | [((1915, 1930), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (1925, 1930), True, 'import numpy as np\n'), ((2354, 2391), 'itertools.product', 'itertools.product', (['x_starts', 'y_starts'], {}), '(x_starts, y_starts)\n', (2371, 2391), False, 'import itertools\n'), ((4118, 4144), 'numpy.concatenate', 'np.con... |
"""Compute ordinary Voronoi diagrams in Shapely geometries."""
import operator
import numpy
import scipy.spatial
import shapely.geometry
import shapely.geometry.base
import shapely.prepared
def pointset_bounds(coords):
return (
min(coords, key=operator.itemgetter(0))[0],
min(coords, key=operator... | [
"numpy.array",
"operator.itemgetter",
"numpy.concatenate"
] | [((1145, 1183), 'numpy.concatenate', 'numpy.concatenate', (['(points, boundgens)'], {}), '((points, boundgens))\n', (1162, 1183), False, 'import numpy\n'), ((1550, 1594), 'numpy.array', 'numpy.array', (['[pt.coords[0] for pt in points]'], {}), '([pt.coords[0] for pt in points])\n', (1561, 1594), False, 'import numpy\n'... |
"""Plots composite saliency map."""
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from gewittergefahr.gg_utils import general_utils as gg_general_utils
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.plotting import imagemagick_utils
from m... | [
"ml4tc.plotting.plotting_utils.concat_panels",
"numpy.array",
"numpy.ravel",
"gewittergefahr.gg_utils.general_utils.apply_gaussian_filter",
"numpy.repeat",
"argparse.ArgumentParser",
"matplotlib.pyplot.Normalize",
"matplotlib.pyplot.close",
"numpy.linspace",
"ml4tc.machine_learning.neural_net.find... | [((84, 105), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (98, 105), False, 'import matplotlib\n'), ((637, 672), 'numpy.array', 'numpy.array', (['[numpy.nan, 0, 1.5, 3]'], {}), '([numpy.nan, 0, 1.5, 3])\n', (648, 672), False, 'import numpy\n'), ((2217, 2242), 'argparse.ArgumentParser', 'argpars... |
import numpy as np
def import_accuracy(y_test, predictions):
errors = abs(predictions - y_test)
mape = 100 * (errors / y_test)
accuracy = 100 - np.mean(mape)
return accuracy
| [
"numpy.mean"
] | [((148, 161), 'numpy.mean', 'np.mean', (['mape'], {}), '(mape)\n', (155, 161), True, 'import numpy as np\n')] |
import numpy as np
import os
import torch
import torch.utils.data as data
import pdb
import pickle
from pathlib import Path
from scipy import signal
import librosa
import scipy
from itertools import permutations
from numpy.linalg import solve
import numpy as np
import soundfile as sf
from convolutive_prediction import ... | [
"numpy.trace",
"numpy.sqrt",
"torch.sqrt",
"numpy.iinfo",
"torch.from_numpy",
"convolutive_prediction.Apply_ConvolutivePrediction",
"torch.squeeze",
"numpy.linalg.norm",
"scipy.signal.get_window",
"numpy.reshape",
"pathlib.Path",
"torch.unsqueeze",
"numpy.conjugate",
"numpy.empty",
"torc... | [((1067, 1112), 'scipy.signal.get_window', 'scipy.signal.get_window', (['"""hann"""', 'self.nperseg'], {}), "('hann', self.nperseg)\n", (1090, 1112), False, 'import scipy\n'), ((17637, 17687), 'scipy.signal.get_window', 'scipy.signal.get_window', (['self.window', 'self.nperseg'], {}), '(self.window, self.nperseg)\n', (... |
import argparse
import os
import shutil
import numpy as np
import torch as t
from torch.optim import Adam
from utils.batch_loader import BatchLoader
from utils.parameters import Parameters
from model.rvae_dilated import RVAE_dilated
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='RV... | [
"numpy.random.normal",
"os.path.exists",
"utils.batch_loader.BatchLoader",
"argparse.ArgumentParser",
"torch.load",
"os.path.isfile",
"numpy.array",
"utils.parameters.Parameters",
"torch.cuda.is_available",
"shutil.copyfile",
"model.rvae_dilated.RVAE_dilated",
"os.remove"
] | [((281, 332), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""RVAE_dilated"""'}), "(description='RVAE_dilated')\n", (304, 332), False, 'import argparse\n'), ((1653, 1690), 'utils.batch_loader.BatchLoader', 'BatchLoader', (['""""""', 'prefix', 'word_is_char'], {}), "('', prefix, word_is_ch... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import sys
sys.path.insert(0, '../PGP/')
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from parametric_GP import PGP
if __name__ == "__main__":
# Import the data
data = pd.read_pickle('airline.pickle')
... | [
"pandas.read_pickle",
"sys.path.insert",
"matplotlib.pyplot.savefig",
"parametric_GP.PGP",
"numpy.floor",
"numpy.exp",
"matplotlib.pyplot.rcParams.update",
"numpy.random.seed",
"numpy.mod",
"matplotlib.pyplot.subplots",
"numpy.random.permutation"
] | [((83, 112), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../PGP/"""'], {}), "(0, '../PGP/')\n", (98, 112), False, 'import sys\n'), ((285, 317), 'pandas.read_pickle', 'pd.read_pickle', (['"""airline.pickle"""'], {}), "('airline.pickle')\n", (299, 317), True, 'import pandas as pd\n'), ((749, 766), 'numpy.random.se... |
import rospy
from styx_msgs.msg import TrafficLight
import numpy as np
from keras.models import Model
from keras import applications
from keras.models import load_model
from keras.preprocessing import image as img_preprocessing
import cv2
# load the trained model
from keras.utils.generic_utils import CustomObjectScop... | [
"keras.preprocessing.image.img_to_array",
"keras.models.load_model",
"rospy.logwarn",
"keras.utils.generic_utils.CustomObjectScope",
"numpy.expand_dims",
"cv2.resize",
"rospy.loginfo"
] | [((605, 652), 'rospy.loginfo', 'rospy.loginfo', (['"""TLClassifier: Loading model..."""'], {}), "('TLClassifier: Loading model...')\n", (618, 652), False, 'import rospy\n'), ((1010, 1061), 'rospy.loginfo', 'rospy.loginfo', (['"""TLClassifier: Model loaded - READY"""'], {}), "('TLClassifier: Model loaded - READY')\n", (... |
###############################################################################
# Copyright (C) 2016 <NAME>
# This is part of <NAME>'s PoDoCo project.
#
# This file is licensed under the MIT License.
###############################################################################
"""
Particle filters for tracking the in... | [
"numpy.random.normal",
"numpy.tile",
"numpy.repeat",
"numpy.sqrt",
"numpy.log",
"numpy.max",
"numpy.exp",
"scipy.special.gammaln",
"resampling.residual_resample"
] | [((755, 774), 'numpy.repeat', 'np.repeat', (['(1 / N)', 'N'], {}), '(1 / N, N)\n', (764, 774), True, 'import numpy as np\n'), ((1700, 1807), 'numpy.random.normal', 'np.random.normal', (["(params['base'][1, :] + params['A_x'] * (x - params['base'][0, :]))", "params['sqrtQ_x']"], {}), "(params['base'][1, :] + params['A_x... |
import os
import numpy as np
import pandas as pd
from Base import Train, Predict
def getTest(boolNormalize, boolDeep, boolBias, strProjectFolder):
if boolNormalize:
if boolDeep:
strOutputPath = "02-Output/" + "Deep" + "Normal"
else:
if boolBias:
strOutputPa... | [
"numpy.mean",
"os.path.join",
"Base.Predict.makePredict",
"os.path.dirname",
"Base.Train.getTrain",
"numpy.std",
"pandas.DataFrame"
] | [((1585, 1968), 'Base.Train.getTrain', 'Train.getTrain', ([], {'arrayTrainUser': 'arrayUsers', 'arrayTrainMovie': 'arrayMovies', 'arrayTrainRate': 'arrayRate', 'arrayValidUser': 'arrayUsers', 'arrayValidMovie': 'arrayMovies', 'arrayValidRate': 'arrayRate', 'intUserSize': 'intUserSize', 'intMovieSize': 'intMovieSize', '... |
from abc import ABCMeta, abstractmethod
import numpy as np
__all__ = ['Law', 'Bin', 'Poi', 'Gau']
class Law(metaclass=ABCMeta):
@staticmethod
@abstractmethod
def sample(n, d):
pass
@staticmethod
@abstractmethod
def loglikely(n, d, k):
pass
@staticmethod
def likeli... | [
"numpy.random.poisson",
"numpy.log",
"numpy.random.randn",
"numpy.random.binomial"
] | [((432, 456), 'numpy.random.binomial', 'np.random.binomial', (['n', 'd'], {}), '(n, d)\n', (450, 456), True, 'import numpy as np\n'), ((592, 616), 'numpy.random.poisson', 'np.random.poisson', (['(n * d)'], {}), '(n * d)\n', (609, 616), True, 'import numpy as np\n'), ((507, 516), 'numpy.log', 'np.log', (['d'], {}), '(d)... |
__all__ = ['plot_cum_error_dist']
import numpy as np
# import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from mpl_toolkits.axes_grid.inset_locator import inset_axes
import itertools
from . import palettes
# colors = itertools.cycle(npl.palettes.color_palette(palette="sweet",... | [
"matplotlib.pyplot.gca",
"numpy.ceil",
"mpl_toolkits.axes_grid.inset_locator.inset_axes",
"numpy.argwhere"
] | [((1188, 1197), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (1195, 1197), True, 'import matplotlib.pyplot as plt\n'), ((2724, 2797), 'mpl_toolkits.axes_grid.inset_locator.inset_axes', 'inset_axes', ([], {'parent_axes': 'ax', 'width': '"""60%"""', 'height': '"""50%"""', 'loc': '(4)', 'borderpad': '(2)'}), "(pa... |
import pandas as pd
import numpy as np
from model.helper_functions import build_playlist_features
print('Reading data into memory')
pid_list = np.genfromtxt('../data/train_pids.csv', skip_header=1, dtype=int)
playlistfile = '../data/playlists.csv'
playlist_df = pd.read_csv(playlistfile)
trackfile = '../data/songs_1000... | [
"pandas.read_csv",
"model.helper_functions.build_playlist_features",
"pandas.concat",
"numpy.savetxt",
"pandas.get_dummies",
"numpy.genfromtxt"
] | [((144, 209), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../data/train_pids.csv"""'], {'skip_header': '(1)', 'dtype': 'int'}), "('../data/train_pids.csv', skip_header=1, dtype=int)\n", (157, 209), True, 'import numpy as np\n'), ((263, 288), 'pandas.read_csv', 'pd.read_csv', (['playlistfile'], {}), '(playlistfile)\n', (... |
import numpy as np
import sys
import scipy.interpolate as interpolate
import asdf
from .function import *
from .basic_func import Basic
class Func:
'''
The list of (possible) `Func` attributes is given below:
Attributes
----------
'''
def __init__(self, MB, dust_model=0):
'''
... | [
"numpy.abs",
"numpy.log10",
"matplotlib.pyplot.plot",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.close",
"numpy.lexsort",
"asdf.open",
"matplotlib.pyplot.show"
] | [((2825, 2882), 'asdf.open', 'asdf.open', (["(self.DIR_TMP + 'spec_all_' + self.ID + '.asdf')"], {}), "(self.DIR_TMP + 'spec_all_' + self.ID + '.asdf')\n", (2834, 2882), False, 'import asdf\n'), ((2905, 2946), 'asdf.open', 'asdf.open', (["(self.DIR_TMP + 'spec_all.asdf')"], {}), "(self.DIR_TMP + 'spec_all.asdf')\n", (2... |
import numpy as np
import torch
from torch import optim
from torch.nn import functional
import torch.nn as nn
import torch.utils.data
from torch.nn import BatchNorm1d, Dropout, LeakyReLU, Linear, Module, ReLU, Sequential,Sigmoid
from torch.nn import functional as F
from opendp.smartnoise.synthesizers.base import SDGYMB... | [
"ctgan.models.Generator",
"torch.nn.Dropout",
"torch.nn.Sequential",
"ctgan.sampler.Sampler",
"torch.from_numpy",
"ctgan.conditional.ConditionalGenerator",
"torch.cuda.is_available",
"torch.normal",
"numpy.arange",
"torch.nn.Sigmoid",
"torch.mean",
"numpy.concatenate",
"torch.nn.LeakyReLU",
... | [((1613, 1638), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['(0)'], {}), '(0)\n', (1635, 1638), False, 'import torch\n'), ((1647, 1667), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (1664, 1667), False, 'import torch\n'), ((2061, 2077), 'torch.nn.Sequential', 'Sequential', (['*seq'], {}),... |
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: <NAME>
## Email: <EMAIL>
## Copyright (c) 2020
##
## LICENSE file in the root directory of this source tree
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"""ResNet variants"""
import os
import math
i... | [
"models.attention_map.SEModule",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.Tanh",
"torch.nn.Sequential",
"rfconv.RFConv2d",
"math.sqrt",
"models.utils.gen_adj",
"torch.from_numpy",
"torch.nn.AvgPool2d",
"torch.nn.functional.softmax",
"os.path.exists",
"torch.nn.init.xavier_uniform_",
... | [((22501, 22533), 'torch.matmul', 'torch.matmul', (['feature', 'reshape_x'], {}), '(feature, reshape_x)\n', (22513, 22533), False, 'import torch\n'), ((22837, 22866), 'torch.randn', 'torch.randn', (['[2, 3, 224, 224]'], {}), '([2, 3, 224, 224])\n', (22848, 22866), False, 'import torch\n'), ((1961, 2020), 'torch.nn.Conv... |
# https://stackoverflow.com/questions/47295473/how-to-plot-using-matplotlib-python-colahs-deformed-grid
"""
这个形状仍然不对。靠近坐标轴的地方变化太大。不管是横轴还是纵轴。应该是以原点为圆心,各个网格均匀分担才对
而不管是否靠近坐标轴
变形的目标,是在某处给定一个球体或者立方体,整个坐标中的网格,靠近这个物体的,受到变形影响,距离越远,影响
越小,直到可以忽略不计
但有个要求是靠近物体的网格,是均匀的受到影响,不能有的多,有的少
或许用极坐标是更好的选择?但是也不行。极坐标如何体现原有的坐标系呢?
极坐标没有平直的地方... | [
"matplotlib.pyplot.gca",
"matplotlib.collections.LineCollection",
"numpy.exp",
"numpy.stack",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1565, 1579), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1577, 1579), True, 'import matplotlib.pyplot as plt\n'), ((1827, 1837), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1835, 1837), True, 'import matplotlib.pyplot as plt\n'), ((544, 568), 'numpy.stack', 'np.stack', (['(x, y)'], ... |
import argparse
from os import listdir, path
import numpy as np
def convert(main_folder, output):
ret = []
for label, class_folder in listdir(main_folder):
class_folder_path = path.join(main_folder, class_folder)
for img_name in listdir(class_folder_path):
image_path = path.join... | [
"os.path.join",
"os.listdir",
"argparse.ArgumentParser",
"numpy.savetxt"
] | [((146, 166), 'os.listdir', 'listdir', (['main_folder'], {}), '(main_folder)\n', (153, 166), False, 'from os import listdir, path\n'), ((399, 450), 'numpy.savetxt', 'np.savetxt', (['output', 'ret'], {'delimiter': '""" """', 'fmt': '"""%s %i"""'}), "(output, ret, delimiter=' ', fmt='%s %i')\n", (409, 450), True, 'import... |
# Copyright 2018 <NAME> and <NAME>
# 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, ... | [
"numpy.matrix",
"numpy.amin",
"scipy.sparse.issparse",
"numpy.power"
] | [((1145, 1172), 'numpy.matrix', 'np.matrix', (['([1] * center_num)'], {}), '([1] * center_num)\n', (1154, 1172), True, 'import numpy as np\n'), ((1241, 1258), 'scipy.sparse.issparse', 'sp.issparse', (['data'], {}), '(data)\n', (1252, 1258), True, 'import scipy.sparse as sp\n'), ((1101, 1122), 'numpy.matrix', 'np.matrix... |
import numpy as np
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql as psql
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.schema import UniqueConstraint
from astropy import units as u
from .core import Base
from .constants import APER_KEY, A... | [
"sqlalchemy.orm.relationship",
"numpy.ceil",
"numpy.log10",
"astropy.table.vstack",
"sqlalchemy.ForeignKey",
"astropy.coordinates.SkyCoord",
"photutils.aperture_photometry",
"astropy.wcs.WCS",
"numpy.floor",
"photutils.CircularAperture",
"numpy.bitwise_or.reduce",
"sqlalchemy.Index",
"sqlalc... | [((458, 497), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {'primary_key': '(True)'}), '(sa.Integer, primary_key=True)\n', (467, 497), True, 'import sqlalchemy as sa\n'), ((550, 571), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {}), '(sa.Integer)\n', (559, 571), True, 'import sqlalchemy as sa\n'), ((581, 6... |
"""
Purpose of this file is to give examples of structured arrays
This script is partially dirived from the LinkedIn learning course
https://www.linkedin.com/learning/numpy-data-science-essential-training/create-arrays-from-python-structures
"""
import numpy as np
person_data_def = [('name', 'S6'), ('height', 'f8'),... | [
"numpy.zeros",
"numpy.rec.array"
] | [((398, 432), 'numpy.zeros', 'np.zeros', (['(4)'], {'dtype': 'person_data_def'}), '(4, dtype=person_data_def)\n', (406, 432), True, 'import numpy as np\n'), ((1396, 1451), 'numpy.rec.array', 'np.rec.array', (["[('a', 100, 80, 50), ('b', 190, 189, 20)]"], {}), "([('a', 100, 80, 50), ('b', 190, 189, 20)])\n", (1408, 1451... |
import numpy as np
import matplotlib.pyplot as plt
plt.close('all')
# From section 3.8.3 of wind energy explained
# Prandlt tip loss calc
B = 3 # number of blades
R = 1 # blade length
phi = np.deg2rad(10) # relative wind angle
r = np.linspace(0,R,100)
F = 2/np.pi * np.arccos(np.exp(-((B/2)*(1-(r/R)))/((r/R)*np.sin(phi... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.deg2rad",
"numpy.linspace",
"numpy.sin",
"numpy.rad2deg"
] | [((51, 67), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (60, 67), True, 'import matplotlib.pyplot as plt\n'), ((191, 205), 'numpy.deg2rad', 'np.deg2rad', (['(10)'], {}), '(10)\n', (201, 205), True, 'import numpy as np\n'), ((232, 254), 'numpy.linspace', 'np.linspace', (['(0)', 'R', '(100)'... |
# Project: SwarmAggregation
# Filename: exp.py
# Authors: <NAME> (<EMAIL>) and <NAME>
# (<EMAIL>).
"""
exp: A flexible, unifying framework for defining and running experiments for
swarm aggregation.
"""
import argparse
from aggregation import aggregation, ideal
from itertools import produ... | [
"numpy.random.default_rng",
"matplotlib.pyplot.Polygon",
"matplotlib.collections.LineCollection",
"math.cos",
"aggregation.aggregation",
"aggregation.ideal",
"numpy.arange",
"numpy.mean",
"argparse.ArgumentParser",
"tqdm.tqdm.write",
"itertools.product",
"numpy.max",
"matplotlib.pyplot.close... | [((14036, 14063), 'numpy.arange', 'np.arange', (['(0)', '(0.501)', '(0.0125)'], {}), '(0, 0.501, 0.0125)\n', (14045, 14063), True, 'import numpy as np\n'), ((14529, 14553), 'numpy.arange', 'np.arange', (['(0)', '(40.1)', '(1.25)'], {}), '(0, 40.1, 1.25)\n', (14538, 14553), True, 'import numpy as np\n'), ((15011, 15035)... |
from abc import ABCMeta, abstractmethod
import numpy as np
class BaseSubspace(metaclass=ABCMeta):
def __init__(self, measurements=None, A=None, k=None, rank=None, pks=[], name=''):
# Check A
if A is None:
self.__A = np.asarray(a=1, dtype=measurements.dtype)
else:
# C... | [
"numpy.linalg.matrix_rank",
"numpy.where",
"numpy.conjugate",
"numpy.asarray",
"numpy.diff",
"numpy.zeros",
"numpy.linalg.eigh"
] | [((2029, 2097), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, measurements.shape[1])', 'dtype': 'measurements.dtype'}), '(shape=(n, measurements.shape[1]), dtype=measurements.dtype)\n', (2037, 2097), True, 'import numpy as np\n'), ((2735, 2804), 'numpy.linalg.matrix_rank', 'np.linalg.matrix_rank', ([], {'M': 'self.mea... |
import os
import pytest
import numpy as np
from laserembeddings import Laser
SIMILARITY_TEST = os.getenv('SIMILARITY_TEST')
def test_laser():
with open(Laser.DEFAULT_ENCODER_FILE, 'rb') as f_encoder:
laser = Laser(
Laser.DEFAULT_BPE_CODES_FILE,
None,
f_encoder,
... | [
"numpy.mean",
"os.getenv",
"numpy.linalg.norm",
"os.path.realpath",
"numpy.sum",
"numpy.min",
"pytest.skip",
"laserembeddings.Laser"
] | [((98, 126), 'os.getenv', 'os.getenv', (['"""SIMILARITY_TEST"""'], {}), "('SIMILARITY_TEST')\n", (107, 126), False, 'import os\n'), ((912, 919), 'laserembeddings.Laser', 'Laser', ([], {}), '()\n', (917, 919), False, 'from laserembeddings import Laser\n'), ((225, 277), 'laserembeddings.Laser', 'Laser', (['Laser.DEFAULT_... |
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
data_file='subset_1000.csv'
data=np.genfromtxt(path,delimiter=",",skip_header=1)
print(data)
census=np.conc... | [
"numpy.mean",
"numpy.std",
"numpy.max",
"numpy.concatenate",
"numpy.min",
"numpy.genfromtxt"
] | [((244, 293), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (257, 293), True, 'import numpy as np\n'), ((313, 355), 'numpy.concatenate', 'np.concatenate', (['(new_record, data)'], {'axis': '(0)'}), '((new_record, data), axis=0)... |
import numpy as np
from matplotlib import pyplot as plt
"""
https://stackoverflow.com/questions/42750910/convert-rgb-image-to-index-image/62980021#62980021
convert semantic labels from RGB coding to index coding
Steps:
1. define COLORS (see below)
2. hash colors
3. run rgb2index(segmentation_rgb)
see example below
T... | [
"numpy.power",
"numpy.array",
"numpy.sum",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((402, 462), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 0, 255], [255, 0, 0], [0, 255, 0]]'], {}), '([[0, 0, 0], [0, 0, 255], [255, 0, 0], [0, 255, 0]])\n', (410, 462), True, 'import numpy as np\n'), ((467, 491), 'numpy.power', 'np.power', (['(255)', '[0, 1, 2]'], {}), '(255, [0, 1, 2])\n', (475, 491), True, 'impor... |
import os
import wandb
import torch
import warnings
import numpy as np
import torchvision.transforms
from fvcore.nn import FlopCountAnalysis
from dpt.models import DPTDepthModel
def get_flops(model, x, unit="G", quiet=True):
_prefix = {'k': 1e3, # kilo
'M': 1e6, # mega
'G': 1e9, ... | [
"torch.cuda.Event",
"numpy.mean",
"os.path.getsize",
"wandb.log",
"fvcore.nn.FlopCountAnalysis",
"wandb.init",
"torch.cuda.synchronize",
"numpy.zeros",
"torch.cuda.is_available",
"torch.cuda.amp.autocast",
"numpy.std",
"warnings.simplefilter",
"torch.no_grad",
"dpt.models.DPTDepthModel",
... | [((424, 451), 'fvcore.nn.FlopCountAnalysis', 'FlopCountAnalysis', (['model', 'x'], {}), '(model, x)\n', (441, 451), False, 'from fvcore.nn import FlopCountAnalysis\n'), ((721, 740), 'os.remove', 'os.remove', (['"""tmp.pt"""'], {}), "('tmp.pt')\n", (730, 740), False, 'import os\n'), ((1369, 1413), 'warnings.simplefilter... |
# -*- coding: utf-8 -*-
import json
import os
import numpy as np
import tensorflow.compat.v1 as tf
from src import model, sample, encoder
from flask import Flask
from flask import request, jsonify
import time
######model
def interact_model(
model_name='run1',
seed=None,
nsamples=1,
batch_size=1,
... | [
"tensorflow.compat.v1.placeholder",
"flask.request.args.get",
"src.model.default_hparams",
"src.encoder.get_encoder",
"tensorflow.compat.v1.Graph",
"flask.Flask",
"os.path.expandvars",
"os.path.join",
"numpy.random.seed",
"tensorflow.compat.v1.set_random_seed",
"src.sample.sample_sequence",
"j... | [((2062, 2077), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (2067, 2077), False, 'from flask import Flask\n'), ((583, 626), 'src.encoder.get_encoder', 'encoder.get_encoder', (['model_name', 'models_dir'], {}), '(model_name, models_dir)\n', (602, 626), False, 'from src import model, sample, encoder\n'), ... |
import numpy as np
from copy import copy
from .utils.thresholdcurator import ThresholdCurator
from .quality_metric import QualityMetric
import spiketoolkit as st
import spikemetrics.metrics as metrics
from spikemetrics.utils import printProgressBar
from collections import OrderedDict
from sklearn.neighbors import Neare... | [
"numpy.mean",
"collections.OrderedDict",
"spiketoolkit.postprocessing.get_unit_waveforms",
"numpy.median",
"numpy.abs",
"numpy.random.choice",
"numpy.asarray",
"numpy.max",
"numpy.sum",
"numpy.zeros",
"numpy.dot",
"numpy.random.seed",
"numpy.concatenate",
"numpy.min",
"numpy.linalg.svd",... | [((552, 657), 'collections.OrderedDict', 'OrderedDict', (["[('max_spikes_per_unit_for_noise_overlap', 1000), ('num_features', 10), (\n 'num_knn', 6)]"], {}), "([('max_spikes_per_unit_for_noise_overlap', 1000), (\n 'num_features', 10), ('num_knn', 6)])\n", (563, 657), False, 'from collections import OrderedDict\n'... |
# Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
# examples/Python/Advanced/global_registration.py
import open3d as o3d
import numpy as np
import copy
def draw_registration_result(source, target, transformation):
source_temp = copy.deepcopy(source)
targ... | [
"numpy.identity",
"open3d.registration.TransformationEstimationPointToPlane",
"open3d.registration.CorrespondenceCheckerBasedOnEdgeLength",
"numpy.asarray",
"open3d.geometry.KDTreeSearchParamHybrid",
"open3d.registration.RANSACConvergenceCriteria",
"open3d.visualization.draw_geometries",
"open3d.io.re... | [((290, 311), 'copy.deepcopy', 'copy.deepcopy', (['source'], {}), '(source)\n', (303, 311), False, 'import copy\n'), ((330, 351), 'copy.deepcopy', 'copy.deepcopy', (['target'], {}), '(target)\n', (343, 351), False, 'import copy\n'), ((504, 565), 'open3d.visualization.draw_geometries', 'o3d.visualization.draw_geometries... |
# ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | [
"traits.api.Instance",
"traits.api.on_trait_change",
"pychron.graph.graph.Graph",
"traitsui.api.Item",
"numpy.linspace",
"traits.api.Int",
"traitsui.api.UItem",
"pychron.processing.argon_calculations.calculate_fractional_loss",
"traits.api.Float"
] | [((1058, 1073), 'traits.api.Instance', 'Instance', (['Graph'], {}), '(Graph)\n', (1066, 1073), False, 'from traits.api import HasTraits, Int, Float, Instance, on_trait_change\n'), ((1085, 1095), 'traits.api.Float', 'Float', (['(475)'], {}), '(475)\n', (1090, 1095), False, 'from traits.api import HasTraits, Int, Float, ... |
# main imports
import numpy as np
import sys
# image transform imports
from PIL import Image
from skimage import color
from sklearn.decomposition import FastICA
from sklearn.decomposition import IncrementalPCA
from sklearn.decomposition import TruncatedSVD
from numpy.linalg import svd as lin_svd
from scipy.signal impo... | [
"numpy.uint8",
"sys.path.insert",
"ipfml.utils.get_entropy_contribution_of_i",
"ipfml.utils.normalize_2D_arr",
"ipfml.utils.get_indices_of_lowest_values",
"cv2.filter2D",
"numpy.array",
"sklearn.decomposition.FastICA",
"pywt.waverec2",
"ipfml.processing.transform.rgb_to_mscn",
"numpy.divide",
... | [((538, 560), 'sys.path.insert', 'sys.path.insert', (['(0)', '""""""'], {}), "(0, '')\n", (553, 560), False, 'import sys\n'), ((23763, 23786), 'numpy.divide', 'np.divide', (['imArray', '(255)'], {}), '(imArray, 255)\n', (23772, 23786), True, 'import numpy as np\n'), ((23827, 23868), 'pywt.wavedec2', 'pywt.wavedec2', ([... |
# Code apapted from https://github.com/mseitzer/pytorch-fid
"""Calculates the Frechet Inception Distance (FID) to evalulate GANs
The FID metric calculates the distance between two distributions of images.
Typically, we have summary statistics (mean & covariance matrix) of one
of these distributions, while the 2nd dist... | [
"numpy.atleast_2d",
"numpy.trace",
"numpy.mean",
"torch.nn.functional.adaptive_avg_pool2d",
"numpy.eye",
"numpy.abs",
"numpy.diagonal",
"util.tools.device_name",
"numpy.iscomplexobj",
"numpy.empty",
"numpy.isfinite",
"torch.utils.data.DataLoader",
"torch.no_grad",
"numpy.cov",
"time.time... | [((2677, 2772), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': 'batch_size', 'shuffle': '(False)', 'drop_last': '(False)'}), '(dataset, batch_size=batch_size, shuffle=False,\n drop_last=False)\n', (2704, 2772), False, 'import torch\n'), ((2785, 2807), 'numpy.empty', 'np.em... |
import torch
import torch.nn as nn
import numpy as np
import cv2
import os
import shutil
from matplotlib import pyplot as plt
from Model_Definition import VC3D
from mypath import NICKNAME, DATA_DIR, PATH
# TODO: Now can display images with plt.show(), need to solve display on cloud instance
OUT_DIR = PATH + os.path.... | [
"Model_Definition.VC3D",
"torch.max",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"cv2.destroyAllWindows",
"os.path.exists",
"torch.autograd.Variable",
"cv2.waitKey",
"cv2.putText",
"cv2.resize",
"numpy.transpose",
"os.makedirs",
"torch.nn.Softmax",
"torch.load",
"os.... | [((424, 451), 'os.path.exists', 'os.path.exists', (['folder_name'], {}), '(folder_name)\n', (438, 451), False, 'import os\n'), ((967, 973), 'Model_Definition.VC3D', 'VC3D', ([], {}), '()\n', (971, 973), False, 'from Model_Definition import VC3D\n'), ((991, 1046), 'torch.load', 'torch.load', (['f"""model_{NICKNAME}.pt""... |
"""Transform signaling data to smoothed trajectories."""
import sys
import numpy
import pandas as pd
import geopandas as gpd
import shapely.geometry
import matplotlib.patches
import matplotlib.pyplot as plt
import mobilib.voronoi
SAMPLING = pd.Timedelta('00:01:00')
STD = pd.Timedelta('00:05:00')
def smoothen(arr... | [
"pandas.Series",
"numpy.ceil",
"pandas.read_csv",
"matplotlib.pyplot.gca",
"pandas.Timedelta",
"pandas.merge",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"numpy.full",
"pandas.to_datetime",
"matplotlib.pyplot.show"
] | [((246, 270), 'pandas.Timedelta', 'pd.Timedelta', (['"""00:01:00"""'], {}), "('00:01:00')\n", (258, 270), True, 'import pandas as pd\n'), ((277, 301), 'pandas.Timedelta', 'pd.Timedelta', (['"""00:05:00"""'], {}), "('00:05:00')\n", (289, 301), True, 'import pandas as pd\n'), ((683, 713), 'numpy.full', 'numpy.full', (['t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 3 17:20:06 2018
@author: chrispedder
A routine to crop sections from the images of different manuscripts in the two
datasets to the same size, and with the same magnification, so that the average
script size doesn't create a feature that the neura... | [
"os.path.exists",
"numpy.dstack",
"PIL.Image.open",
"PIL.Image.fromarray",
"argparse.ArgumentParser",
"random.seed",
"os.mkdir",
"glob.glob"
] | [((7029, 7155), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Command line options for processing the data files needed to train the model."""'}), "(description=\n 'Command line options for processing the data files needed to train the model.'\n )\n", (7052, 7155), False, 'import ... |
import time
import random
import pygame
import pygame.midi
import numpy as np
from typing import Tuple
__author__ = "<NAME>"
AV_SIZE = 20
WIN_X = 30 * AV_SIZE
WIN_Y = 30 * AV_SIZE
DIFF_MAX = np.sqrt(WIN_X**2 + WIN_Y**2)
def adapt_avatar_position(event, user_x_pos:int, user_y_pos:int) -> Tuple[int, int]:
i... | [
"random.choice",
"numpy.sqrt",
"pygame.init",
"pygame.midi.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.midi.init",
"pygame.draw.rect",
"pygame.midi.Output",
"time.time",
"random.randint"
] | [((200, 232), 'numpy.sqrt', 'np.sqrt', (['(WIN_X ** 2 + WIN_Y ** 2)'], {}), '(WIN_X ** 2 + WIN_Y ** 2)\n', (207, 232), True, 'import numpy as np\n'), ((1126, 1139), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1137, 1139), False, 'import pygame\n'), ((1145, 1163), 'pygame.midi.init', 'pygame.midi.init', ([], {}), '... |
import abc
import os
import pandas as pd
import numpy as np
from EoraReader import EoraReader
class PrimaryInputs(EoraReader):
def __init__(self, file_path):
super().__init__(file_path)
self.df = None
def get_dataset(self, extended = False):
"""
Returns a pandas dataframe conta... | [
"pandas.DataFrame",
"numpy.array"
] | [((948, 980), 'numpy.array', 'np.array', (['value_add_coefficients'], {}), '(value_add_coefficients)\n', (956, 980), True, 'import numpy as np\n'), ((994, 1045), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'numpy_data', 'index': 'primary_inputs'}), '(data=numpy_data, index=primary_inputs)\n', (1006, 1045), True, ... |
import attr
import types
from typing import Union
from enum import Enum
import numpy as np
from scipy.optimize import differential_evolution
import pygmo as pg
class OptimizationMethod(Enum):
"""
Available optimization solvers.
"""
SCIPY_DE = 1
PYGMO_DE1220 = 2
@attr.s(auto_attribs=True)
class S... | [
"attr.s",
"pygmo.archipelago",
"scipy.optimize.differential_evolution",
"pygmo.problem",
"pygmo.population",
"numpy.array",
"numpy.random.randint",
"pygmo.algorithm",
"pygmo.de1220",
"numpy.argmin",
"numpy.random.RandomState",
"pygmo.nlopt"
] | [((287, 312), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (293, 312), False, 'import attr\n'), ((4837, 4862), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (4843, 4862), False, 'import attr\n'), ((5322, 5347), 'attr.s', 'attr.s', ([], {'auto_attribs': ... |
#!/usr/bin/env python3
import fire
import json
import os
import numpy as np
import tensorflow as tf
import model, sample, encoder
def interact_model(
model_name='117M',
seed=None,
nsamples=1000,
batch_size=1,
length=None,
temperature=1,
top_k=0,
top_p=0.0
):
"""
Interactively ... | [
"tensorflow.Graph",
"encoder.get_encoder",
"fire.Fire",
"tensorflow.placeholder",
"tensorflow.train.Saver",
"os.path.join",
"sample.sample_sequence",
"model.default_hparams",
"numpy.random.seed",
"json.load",
"tensorflow.ConfigProto",
"tensorflow.set_random_seed",
"time.time"
] | [((1595, 1626), 'encoder.get_encoder', 'encoder.get_encoder', (['model_name'], {}), '(model_name)\n', (1614, 1626), False, 'import model, sample, encoder\n'), ((1641, 1664), 'model.default_hparams', 'model.default_hparams', ([], {}), '()\n', (1662, 1664), False, 'import model, sample, encoder\n'), ((2059, 2075), 'tenso... |
#!/usr/bin/python3
from typing import Dict
import optparse
import numpy as np
import rasterio
from rasterio import features
def main(county_pop_file, spatial_dist_file, fname_out, no_data_val=-9999):
'''
county_pop_file: County level population estimates
spatial_dist_file: Spatial projection of populati... | [
"numpy.intersect1d",
"numpy.ones",
"rasterio.open",
"optparse.OptionParser",
"numpy.squeeze",
"numpy.unravel_index",
"numpy.round"
] | [((1730, 1753), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (1751, 1753), False, 'import optparse\n'), ((996, 1018), 'numpy.squeeze', 'np.squeeze', (['county_pop'], {}), '(county_pop)\n', (1006, 1018), True, 'import numpy as np\n'), ((1034, 1054), 'numpy.squeeze', 'np.squeeze', (['pop_dist'], {}... |
import os
import math
from pathlib import Path
import clip
import torch
from PIL import Image
import numpy as np
import pandas as pd
from common import common_path
# Set the path to the photos
# dataset_version = "lite" # Use "lite" or "full"
# photos_path = Path("unsplash-dataset") / dataset_version / "photos"
ph... | [
"os.path.exists",
"PIL.Image.open",
"pandas.read_csv",
"pathlib.Path",
"os.path.join",
"torch.cuda.is_available",
"numpy.concatenate",
"clip.load",
"pandas.DataFrame",
"torch.no_grad",
"numpy.load",
"numpy.save"
] | [((332, 401), 'os.path.join', 'os.path.join', (['common_path.project_dir', '"""unsplash-dataset/lite/photos"""'], {}), "(common_path.project_dir, 'unsplash-dataset/lite/photos')\n", (344, 401), False, 'import os\n'), ((659, 695), 'clip.load', 'clip.load', (['"""ViT-B/32"""'], {'device': 'device'}), "('ViT-B/32', device... |
import numpy as np
import datajoint as dj
from treadmill_pipeline import project_database_prefix
from ephys.utilities import ingestion, time_sync
from ephys import get_schema_name
schema = dj.schema(project_database_prefix + 'treadmill_pipeline')
reference = dj.create_virtual_module('reference', get_schema_name('re... | [
"ephys.utilities.ingestion.find_input_directory",
"ephys.utilities.ingestion.get_optitrack",
"numpy.array",
"ephys.utilities.ingestion.get_recordings",
"datajoint.schema",
"ephys.get_schema_name"
] | [((192, 249), 'datajoint.schema', 'dj.schema', (["(project_database_prefix + 'treadmill_pipeline')"], {}), "(project_database_prefix + 'treadmill_pipeline')\n", (201, 249), True, 'import datajoint as dj\n'), ((301, 329), 'ephys.get_schema_name', 'get_schema_name', (['"""reference"""'], {}), "('reference')\n", (316, 329... |
"Test list input."
# For support of python 2.5
from __future__ import with_statement
import numpy as np
from numpy.testing import assert_equal, assert_array_almost_equal
import bottleneck as bn
# ---------------------------------------------------------------------------
# Check that functions can handle list input
... | [
"numpy.testing.assert_array_almost_equal",
"bottleneck.slow.nn",
"numpy.array",
"numpy.arange",
"bottleneck.nn"
] | [((717, 732), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (726, 732), True, 'import numpy as np\n'), ((1282, 1341), 'numpy.testing.assert_array_almost_equal', 'assert_array_almost_equal', (['actual', 'desired'], {'err_msg': 'err_msg'}), '(actual, desired, err_msg=err_msg)\n', (1307, 1341), False, 'from num... |
import os
from functools import partial
from multiprocessing import Pool
from typing import Any, Callable, Dict, List, Optional
import numpy as np
import pandas as pd
from tqdm import tqdm
from src.dataset.utils.waveform_preprocessings import preprocess_strain
def id_2_path(
image_id: str,
is_train: bool = ... | [
"os.path.exists",
"src.dataset.utils.waveform_preprocessings.preprocess_strain",
"pandas.merge",
"functools.partial",
"os.path.basename",
"multiprocessing.Pool",
"pandas.DataFrame",
"numpy.load"
] | [((1533, 1546), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (1540, 1546), True, 'import numpy as np\n'), ((3986, 4127), 'functools.partial', 'partial', (['get_agg_feats'], {'interp_psd': 'interp_psd', 'psds': 'psds', 'window': 'window', 'fs': 'fs', 'fband': 'fband', 'psd_cache_path_suffix': 'psd_cache_path_suf... |
import unittest
import shutil
import tempfile
import numpy as np
# import pandas as pd
# import pymc3 as pm
# from pymc3 import summary
# from sklearn.mixture import BayesianGaussianMixture as skBayesianGaussianMixture
from sklearn.model_selection import train_test_split
from pmlearn.exceptions import NotFittedError
... | [
"numpy.random.normal",
"sklearn.model_selection.train_test_split",
"numpy.array",
"numpy.random.randint",
"tempfile.mkdtemp",
"shutil.rmtree",
"pmlearn.mixture.DirichletProcessMixture"
] | [((601, 628), 'numpy.array', 'np.array', (['[0.35, 0.4, 0.25]'], {}), '([0.35, 0.4, 0.25])\n', (609, 628), True, 'import numpy as np\n'), ((650, 670), 'numpy.array', 'np.array', (['[0, 5, 10]'], {}), '([0, 5, 10])\n', (658, 670), True, 'import numpy as np\n'), ((693, 718), 'numpy.array', 'np.array', (['[0.5, 0.5, 1.0]'... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from skimage import draw
from skimage import measure
from astropy.io import fits
from astropy import units as u
from astropy import wcs, coordinates
from scipy.ndimage.filters impor... | [
"skimage.draw.circle",
"os.path.exists",
"scipy.ndimage.filters.gaussian_filter",
"os.makedirs",
"astropy.coordinates.SkyCoord",
"numpy.sum",
"numpy.zeros",
"numpy.argwhere",
"skimage.draw.circle_perimeter",
"numpy.concatenate",
"astropy.io.fits.open",
"numpy.moveaxis",
"numpy.loadtxt",
"a... | [((1351, 1460), 'numpy.loadtxt', 'np.loadtxt', (['model_file'], {'dtype': "{'names': ('name', 'ra', 'dec', 'I'), 'formats': ('S10', 'f4', 'f4', 'f4')}"}), "(model_file, dtype={'names': ('name', 'ra', 'dec', 'I'),\n 'formats': ('S10', 'f4', 'f4', 'f4')})\n", (1361, 1460), True, 'import numpy as np\n'), ((1583, 1637),... |
import os
import cv2
from Segmentation import CombinedHist, get_histograms, HistQueue
import matplotlib.pyplot as plt
import numpy as np
listofFiles = os.listdir('generated_frames')
# change the size of queue accordingly
queue_of_hists = HistQueue.HistQueue(25)
x = []
y_r = []
y_g = []
y_b = []
def compare(current_h... | [
"numpy.median",
"os.listdir",
"numpy.amin",
"Segmentation.CombinedHist.CombinedHist",
"numpy.add",
"numpy.sort",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.figure",
"Segmentation.HistQueue.HistQueue",
"numpy.percentile",
"matplotlib.pyplot.show"
] | [((152, 182), 'os.listdir', 'os.listdir', (['"""generated_frames"""'], {}), "('generated_frames')\n", (162, 182), False, 'import os\n'), ((239, 262), 'Segmentation.HistQueue.HistQueue', 'HistQueue.HistQueue', (['(25)'], {}), '(25)\n', (258, 262), False, 'from Segmentation import CombinedHist, get_histograms, HistQueue\... |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 et tw=80 :
#
# Extract and save extended object catalogs from the specified data and
# uncertainty images. This version of the script jointly analyzes all
# images from a specific AOR/channel to enable more sophisticated
# analysis.
#
# <NAME>
# Create... | [
"logging.getLogger",
"sys.exit",
"jpl_eph_helpers.EphTool",
"sys._getframe",
"os.path.isdir",
"os.mkdir",
"spitz_extract.SpitzFind",
"imp.reload",
"os.path.isfile",
"sys.stderr.write",
"catalog_tools.XCorrPruner",
"os.path.dirname",
"time.time",
"logging.basicConfig",
"numpy.__version__.... | [((672, 711), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (691, 711), False, 'import logging\n'), ((721, 748), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (738, 748), False, 'import logging\n'), ((2585, 2620), 'spitz_xcorr_st... |
# Copyright 2020 Toyota Research Institute. All rights reserved.
"""
Geometry utilities
"""
import numpy as np
def invert_pose_numpy(T):
"""
'Invert' 4x4 extrinsic matrix
Parameters
----------
T: 4x4 matrix (world to camera)
Returns
-------
4x4 matrix (camera to world)
"""
... | [
"numpy.copy",
"numpy.matmul"
] | [((326, 336), 'numpy.copy', 'np.copy', (['T'], {}), '(T)\n', (333, 336), True, 'import numpy as np\n'), ((405, 422), 'numpy.matmul', 'np.matmul', (['R.T', 't'], {}), '(R.T, t)\n', (414, 422), True, 'import numpy as np\n')] |
import numpy as np
from tests.test_utils import run_track_tests
from mirdata import annotations
from mirdata.datasets import tonas
TEST_DATA_HOME = "tests/resources/mir_datasets/tonas"
def test_track():
default_trackid = "01-D_AMairena"
dataset = tonas.Dataset(TEST_DATA_HOME)
track = dataset.track(defa... | [
"mirdata.datasets.tonas.Dataset",
"mirdata.datasets.tonas.load_audio",
"mirdata.datasets.tonas._load_tuning_frequency",
"mirdata.datasets.tonas.load_f0",
"numpy.array",
"tests.test_utils.run_track_tests",
"mirdata.datasets.tonas.load_notes"
] | [((260, 289), 'mirdata.datasets.tonas.Dataset', 'tonas.Dataset', (['TEST_DATA_HOME'], {}), '(TEST_DATA_HOME)\n', (273, 289), False, 'from mirdata.datasets import tonas\n'), ((1137, 1205), 'tests.test_utils.run_track_tests', 'run_track_tests', (['track', 'expected_attributes', 'expected_property_types'], {}), '(track, e... |
import argparse
import csv
import matplotlib
import matplotlib.ticker as tck
import matplotlib.pyplot as plt
import numpy as np
# Matplotlib export settings
matplotlib.use('pgf')
import matplotlib.pyplot as plt
matplotlib.rcParams.update({
'pgf.texsystem': 'pdflatex',
'font.size': 10,
'font.family': 'ser... | [
"numpy.sqrt",
"argparse.ArgumentParser",
"matplotlib.rcParams.update",
"matplotlib.use",
"matplotlib.ticker.MultipleLocator",
"numpy.absolute",
"numpy.imag",
"numpy.angle",
"numpy.exp",
"numpy.real",
"matplotlib.ticker.FormatStrFormatter",
"csv.reader",
"matplotlib.pyplot.subplots"
] | [((160, 181), 'matplotlib.use', 'matplotlib.use', (['"""pgf"""'], {}), "('pgf')\n", (174, 181), False, 'import matplotlib\n'), ((214, 359), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'pgf.texsystem': 'pdflatex', 'font.size': 10, 'font.family': 'serif',\n 'text.usetex': True, 'pgf.rcfonts': False... |
import unittest
from cosymlib import file_io
from numpy import testing
from cosymlib.molecule.geometry import Geometry
import os
data_dir = os.path.join(os.path.dirname(__file__), 'data')
class TestSymgroupFchk(unittest.TestCase):
def setUp(self):
self._structure = file_io.read_generic_structure_file(d... | [
"os.path.dirname",
"numpy.testing.assert_array_almost_equal",
"cosymlib.molecule.geometry.Geometry",
"cosymlib.file_io.read_generic_structure_file"
] | [((155, 180), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (170, 180), False, 'import os\n'), ((283, 353), 'cosymlib.file_io.read_generic_structure_file', 'file_io.read_generic_structure_file', (["(data_dir + '/wfnsym/tih4_5d.fchk')"], {}), "(data_dir + '/wfnsym/tih4_5d.fchk')\n", (318, 353... |
import matplotlib.pyplot as plt
import numpy as np
def plot_chains(chain, fileout=None, tracers=0, labels=None, delay=0, ymax=200000, thin=100, num_xticks=7, truths=None):
if chain.ndim < 3:
print("You must include a multiple chains")
return
n_chains, length, n_var = chain.shape
print(n... | [
"matplotlib.pyplot.savefig",
"numpy.ones",
"numpy.arange",
"numpy.random.choice",
"numpy.linspace",
"numpy.empty",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.show"
] | [((708, 783), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'left': '(0.09)', 'bottom': '(0.07)', 'right': '(0.96)', 'top': '(0.96)', 'hspace': '(0)'}), '(left=0.09, bottom=0.07, right=0.96, top=0.96, hspace=0)\n', (727, 783), True, 'import matplotlib.pyplot as plt\n'), ((798, 827), 'numpy.empty', '... |
##
## Evaluation Script
##
import numpy as np
import time
from sample_model import Model
from data_loader import data_loader
from generator import Generator
def evaluate(label_indices = {'brick': 0, 'ball': 1, 'cylinder': 2},
channel_means = np.array([147.12697, 160.21092, 167.70029]),
data... | [
"generator.Generator",
"sample_model.Model",
"data_loader.data_loader",
"numpy.argmax",
"numpy.array",
"numpy.sum",
"time.time"
] | [((258, 301), 'numpy.array', 'np.array', (['[147.12697, 160.21092, 167.70029]'], {}), '([147.12697, 160.21092, 167.70029])\n', (266, 301), True, 'import numpy as np\n'), ((513, 629), 'data_loader.data_loader', 'data_loader', ([], {'label_indices': 'label_indices', 'channel_means': 'channel_means', 'train_test_split': '... |
import matplotlib.pyplot as plt
import distance
from matplotlib import style
from clustering_algorithms.affinity_propagation import AffinityPropagation
from clustering_algorithms.custom_k_means import KMeans
from clustering_algorithms.custom_mean_shift import MeanShift
from clustering_algorithms.custom_mean_shift_strin... | [
"utils.string_compare_algorithm.needleman_wunsch_with_penalty",
"prepare_data.format_sequences.format_sequences_from_student",
"numpy.asarray",
"clustering_algorithms.affinity_propagation.AffinityPropagation",
"clustering_algorithms.custom_k_means.KMeans",
"distance.levenshtein",
"clustering_algorithms.... | [((2032, 2075), 'prepare_data.format_sequences.format_sequences_from_student', 'format_sequences_from_student', (['student_name'], {}), '(student_name)\n', (2061, 2075), False, 'from prepare_data.format_sequences import format_sequences_from_student\n'), ((2510, 2664), 'clustering_algorithms.custom_k_means.KMeans', 'KM... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Conversion between single-channel integer value to 3-channels color image.
Mostly used for semantic segmentation.
"""
from __future__ import annotations
import numpy as np
import torch
from multipledispatch import dispatch
from torch import Tensor
from onevision.cv.... | [
"torch.from_numpy",
"numpy.squeeze",
"numpy.stack",
"multipledispatch.dispatch",
"onevision.cv.core.to_channel_first",
"numpy.zeros_like",
"onevision.cv.core.get_num_channels"
] | [((1527, 1549), 'multipledispatch.dispatch', 'dispatch', (['Tensor', 'list'], {}), '(Tensor, list)\n', (1535, 1549), False, 'from multipledispatch import dispatch\n'), ((1747, 1773), 'multipledispatch.dispatch', 'dispatch', (['np.ndarray', 'list'], {}), '(np.ndarray, list)\n', (1755, 1773), False, 'from multipledispatc... |
#!/usr/bin/env python
import sys
from os.path import exists
import numpy as np
import pylab
import scipy.interpolate
def read_fortran(filename):
""" Reads Fortran style binary data and returns a numpy array.
"""
with open(filename, 'rb') as f:
# read size of record
f.seek(0)
n = np.fromfile(f, dtype='int32... | [
"os.path.exists",
"numpy.fromfile",
"numpy.sqrt",
"pylab.gca",
"pylab.xlabel",
"numpy.column_stack",
"pylab.colorbar",
"numpy.isnan",
"numpy.meshgrid",
"pylab.pcolor",
"pylab.ylabel",
"pylab.show"
] | [((849, 866), 'numpy.meshgrid', 'np.meshgrid', (['x', 'z'], {}), '(x, z)\n', (860, 866), True, 'import numpy as np\n'), ((1239, 1260), 'numpy.column_stack', 'np.column_stack', (['args'], {}), '(args)\n', (1254, 1260), True, 'import numpy as np\n'), ((2029, 2050), 'os.path.exists', 'exists', (['x_coords_file'], {}), '(x... |
# with the TRACKBAR gui component
# we can perform some action my moving cursor
import cv2
import numpy as np
def funk(): # create one funciton # Now we are not adding any action in it . # just pass
pass
def main():
img1 = np.zeros((512,512,3) , np.uint8) # create a imgae of size 512 x512
... | [
"cv2.imshow",
"numpy.zeros",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.getTrackbarPos",
"cv2.createTrackbar",
"cv2.namedWindow"
] | [((250, 283), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (258, 283), True, 'import numpy as np\n'), ((451, 478), 'cv2.namedWindow', 'cv2.namedWindow', (['windowName'], {}), '(windowName)\n', (466, 478), False, 'import cv2\n'), ((673, 722), 'cv2.createTrackbar', 'cv2.c... |
from configs import cfg
from src.utils.record_log import _logger
import numpy as np
import tensorflow as tf
import scipy.stats as stats
class Evaluator(object):
def __init__(self, model):
self.model = model
self.global_step = model.global_step
## ---- summary----
self.build_summar... | [
"src.utils.record_log._logger.add",
"numpy.mean",
"tensorflow.summary.merge_all",
"tensorflow.placeholder",
"numpy.argmax",
"tensorflow.summary.scalar",
"numpy.array",
"tensorflow.name_scope",
"numpy.concatenate",
"scipy.stats.pearsonr",
"scipy.stats.spearmanr",
"tensorflow.summary.FileWriter"... | [((346, 384), 'tensorflow.summary.FileWriter', 'tf.summary.FileWriter', (['cfg.summary_dir'], {}), '(cfg.summary_dir)\n', (367, 384), True, 'import tensorflow as tf\n'), ((461, 474), 'src.utils.record_log._logger.add', '_logger.add', ([], {}), '()\n', (472, 474), False, 'from src.utils.record_log import _logger\n'), ((... |
#coding=utf-8
import matplotlib
matplotlib.use("Agg")
import tensorflow as tf
import argparse
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D,MaxPooling2D,UpSampling2D,BatchNormalization,Reshape,Permute,Activation
from tensorflow.keras.utils imp... | [
"sklearn.preprocessing.LabelEncoder",
"matplotlib.pyplot.ylabel",
"tensorflow.keras.layers.BatchNormalization",
"numpy.array",
"numpy.arange",
"os.listdir",
"tensorflow.keras.layers.Conv2D",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.style.use",
"numpy.random.seed"... | [((34, 55), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (48, 55), False, 'import matplotlib\n'), ((650, 670), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (664, 670), True, 'import numpy as np\n'), ((785, 799), 'sklearn.preprocessing.LabelEncoder', 'LabelEncoder', ([], {}... |
# -*- coding: utf-8 -*-
import math
from typing import Tuple, Union
import numpy as np
from .cutting_plane import CUTStatus
Arr = Union[np.ndarray]
class ell_stable:
"""Ellipsoid Search Space
ell_stable = {x | (x − xc)' Q^−1 (x − xc) ≤ κ}
Returns:
[type] -- [description]
"""
... | [
"numpy.eye",
"math.sqrt",
"numpy.isscalar",
"numpy.diag"
] | [((1213, 1229), 'numpy.isscalar', 'np.isscalar', (['val'], {}), '(val)\n', (1224, 1229), True, 'import numpy as np\n'), ((4841, 4858), 'numpy.isscalar', 'np.isscalar', (['beta'], {}), '(beta)\n', (4852, 4858), True, 'import numpy as np\n'), ((6096, 6132), 'math.sqrt', 'math.sqrt', (['(t0n * t1n + tempn * tempn)'], {}),... |
from .. import global_vars as g
from ..window import Window
import numpy as np
from ..roi import makeROI
class TestSettings():
def test_random_roi_color(self):
initial = g.settings['roi_color']
g.settings['roi_color'] = 'random'
w1 = Window(np.random.random([10, 10, 10]))
roi1 = makeROI('rectangle', [[1, 1],... | [
"numpy.random.random"
] | [((250, 280), 'numpy.random.random', 'np.random.random', (['[10, 10, 10]'], {}), '([10, 10, 10])\n', (266, 280), True, 'import numpy as np\n'), ((868, 898), 'numpy.random.random', 'np.random.random', (['[10, 10, 10]'], {}), '([10, 10, 10])\n', (884, 898), True, 'import numpy as np\n')] |
"""
NCL_bar_2.py
===============
This script illustrates the following concepts:
- Drawing bars instead of curves in an XY plot
- Changing the aspect ratio of a bar plot
- Drawing filled bars up or down based on a Y reference value
- Setting the minimum/maximum value of the Y axis in a bar plot
- Using n... | [
"geocat.datafiles.get",
"geocat.viz.util.add_major_minor_ticks",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.axes",
"numpy.empty_like",
"numpy.linspace",
"numpy.shape",
"geocat.viz.util.set_titles_and_labels",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1430, 1449), 'numpy.empty_like', 'np.empty_like', (['date'], {}), '(date)\n', (1443, 1449), True, 'import numpy as np\n'), ((1459, 1486), 'numpy.arange', 'np.arange', (['(0)', 'num_months', '(1)'], {}), '(0, num_months, 1)\n', (1468, 1486), True, 'import numpy as np\n'), ((1755, 1782), 'matplotlib.pyplot.figure', 'p... |
import os.path
import numpy as np
import pickle
from .common import Benchmark
from refnx.analysis import CurveFitter, Objective, Parameter
import refnx.reflect
from refnx.reflect._creflect import abeles as c_abeles
from refnx.reflect._reflect import abeles
from refnx.reflect import SLD, Slab, Structure, ReflectModel,... | [
"refnx.reflect.ReflectModel",
"refnx.reflect._reflect.abeles",
"refnx.reflect.SLD",
"pickle.dumps",
"refnx.analysis.Objective",
"numpy.array",
"refnx.reflect.reflectivity",
"numpy.linspace",
"pickle.loads",
"refnx.analysis.CurveFitter",
"refnx.reflect._creflect.abeles"
] | [((446, 476), 'numpy.linspace', 'np.linspace', (['(0.005)', '(0.5)', '(50000)'], {}), '(0.005, 0.5, 50000)\n', (457, 476), True, 'import numpy as np\n'), ((499, 609), 'numpy.array', 'np.array', (['[[0, 2.07, 0, 3], [50, 3.47, 0.0001, 4], [200, -0.5, 1e-05, 5], [50, 1, 0, \n 3], [0, 6.36, 0, 3]]'], {}), '([[0, 2.07, ... |
import tensorflow as tf
import numpy as np
from self_implement_learning_to_adapt.model import construct_fc_weights,construct_inputs,construct_loss,forward_fc
from self_implement_learning_to_adapt.batch_sampler import ParrallelSampler
from self_implement_learning_to_adapt.vectorized_sampler import VectorizedSampler
from... | [
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"tensorflow.get_default_session",
"numpy.array",
"self_implement_learning_to_adapt.model.construct_inputs",
"self_implement_learning_to_adapt.vectorized_sampler.VectorizedSampler",
"matplotlib.pyplot.xlabel",
"tensorflow.Session",
"matplotlib.pyplot.p... | [((2881, 2926), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', ([], {'learning_rate': 'self.lr'}), '(learning_rate=self.lr)\n', (2903, 2926), True, 'import tensorflow as tf\n'), ((3020, 3076), 'self_implement_learning_to_adapt.model.construct_inputs', 'construct_inputs', (['self.s_size', 'self.a_size', '""... |
import cv2
import numpy as np
from numpy.linalg import norm
import requests
def _get_image_frame(camera) -> np.ndarray:
_, frame = camera.read()
return frame
def _convert_frame_to_hsv(frame: np.ndarray) -> np.ndarray:
return cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
def _post_to_michi() -> None:
try:
... | [
"requests.post",
"numpy.sqrt",
"cv2.VideoCapture",
"cv2.cvtColor",
"numpy.linalg.norm"
] | [((239, 277), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2HSV'], {}), '(frame, cv2.COLOR_BGR2HSV)\n', (251, 277), False, 'import cv2\n'), ((477, 496), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (493, 496), False, 'import cv2\n'), ((326, 395), 'requests.post', 'requests.post', (['"""ht... |
#%%
# read full assignment
# think algo before implementing
# dont use a dict when you need a list
# assignment is still = and not ==
# dont use itertools when you can use np.roll
# check mathemathical functions if the parentheses are ok
# networkx is awesome
# sometimes while true is better than just too small for loo... | [
"numpy.roll",
"networkx.Graph",
"numpy.ndenumerate",
"os.getcwd",
"numpy.array",
"networkx.number_connected_components",
"operator.xor",
"numpy.arange"
] | [((1816, 1830), 'numpy.array', 'np.array', (['grid'], {}), '(grid)\n', (1824, 1830), True, 'import numpy as np\n'), ((1853, 1863), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1861, 1863), True, 'import networkx as nx\n'), ((1885, 1905), 'numpy.ndenumerate', 'np.ndenumerate', (['grid'], {}), '(grid)\n', (1899, 1905... |
import pygame
import numpy as np
from math import *
import json
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RAINBOW = (0, 0, 0)
rainbow = True
WIDTH, HEIGHT = 800, 600
#WIDTH, HEIGHT = 1600, 900
def drawLine(point1, point2, screen):
if rainbow:
pygame.draw.line(screen, RAINBOW, (point1[0], point1[1]), (po... | [
"json.loads",
"pygame.quit",
"pygame.draw.line",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.time.Clock",
"json.load",
"pygame.display.update",
"numpy.matrix"
] | [((2393, 2433), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (2416, 2433), False, 'import pygame\n'), ((2442, 2461), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (2459, 2461), False, 'import pygame\n'), ((1431, 1443), 'json.load', 'json.load', ([... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import argparse
import cv2 as cv
import numpy as np
import mediapipe as mp
from utils import CvFpsCalc
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=int, default=0)
parser.add_argument("--width", help='c... | [
"cv2.rectangle",
"cv2.flip",
"argparse.ArgumentParser",
"cv2.boundingRect",
"cv2.line",
"cv2.imshow",
"numpy.append",
"numpy.array",
"cv2.circle",
"numpy.empty",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"copy.deepcopy",
"cv2.cvtColor",
"cv2.waitKey",
"utils.CvFpsCalc"
] | [((194, 219), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (217, 219), False, 'import argparse\n'), ((1449, 1476), 'cv2.VideoCapture', 'cv.VideoCapture', (['cap_device'], {}), '(cap_device)\n', (1464, 1476), True, 'import cv2 as cv\n'), ((1982, 2006), 'utils.CvFpsCalc', 'CvFpsCalc', ([], {'bu... |
import keras
from keras import layers
from keras.layers import Dropout, Dense
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import tensorflow_hub as hub
import cv2
import pandas as p
IMAGE_SHAPE = (224, 224) #(HEIGHT, WIDTH)
TRAINING_DATA_DIRECTORY = '/content/drive/My Drive/Colab ... | [
"keras.optimizers.Adam",
"keras.Sequential",
"numpy.ceil",
"keras.preprocessing.image.ImageDataGenerator",
"keras.layers.Dense",
"tensorflow_hub.KerasLayer",
"keras.layers.Dropout"
] | [((489, 525), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**datagen_kwargs)\n', (507, 525), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((812, 848), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**datagen_kwargs)\n', (83... |
"""
A set of functions for extracting header information from PSG objects
Typically only used internally in from unet.io.header.header_extractors
Each function takes some PSG or header-like object and returns a dictionary with at least
the following keys:
{
'n_channels': int,
'channel_names': list of strings,... | [
"logging.getLogger",
"datetime.datetime.utcfromtimestamp",
"psg_utils.errors.VariableSampleRateError",
"numpy.isclose",
"psg_utils.io.channels.utils.check_duplicate_channels",
"numpy.array",
"psg_utils.errors.HeaderFieldTypeError",
"numpy.issubdtype",
"psg_utils.errors.FloatSampleRateWarning",
"wa... | [((821, 848), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (838, 848), False, 'import logging\n'), ((2174, 2245), 'psg_utils.io.channels.utils.check_duplicate_channels', 'check_duplicate_channels', (["header['channel_names']"], {'raise_or_warn': '"""warn"""'}), "(header['channel_names']... |
# setup.py
# This script will build the main subpackages
# See LICENSE for details
from __future__ import print_function, absolute_import
from numpy.distutils.misc_util import Configuration
from os.path import join
TTFORT_DIR = '../tt-fort'
EXPM_DIR = '../tt-fort/expm'
EXPOKIT_SRC = [
'explib.f90',
'n... | [
"os.path.join",
"numpy.distutils.misc_util.Configuration"
] | [((711, 757), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""ksl"""', 'parent_package', 'top_path'], {}), "('ksl', parent_package, top_path)\n", (724, 757), False, 'from numpy.distutils.misc_util import Configuration\n'), ((564, 581), 'os.path.join', 'join', (['EXPM_DIR', 'x'], {}), '(EXPM_DIR, x)\n'... |
import numpy as np
from cdlib.evaluation.internal import onmi
from cdlib.evaluation.internal.omega import Omega
from nf1 import NF1
from collections import namedtuple, defaultdict
__all__ = [
"MatchingResult",
"normalized_mutual_information",
"overlapping_normalized_mutual_information_LFK",
"overlappin... | [
"cdlib.evaluation.internal.omega.Omega",
"collections.namedtuple",
"sklearn.metrics.adjusted_mutual_info_score",
"numpy.log2",
"sklearn.metrics.adjusted_rand_score",
"collections.defaultdict",
"sklearn.metrics.normalized_mutual_info_score",
"nf1.NF1"
] | [((606, 647), 'collections.namedtuple', 'namedtuple', (['"""MatchingResult"""', '"""score std"""'], {}), "('MatchingResult', 'score std')\n", (616, 647), False, 'from collections import namedtuple, defaultdict\n'), ((7282, 7322), 'cdlib.evaluation.internal.omega.Omega', 'Omega', (['first_partition', 'second_partition']... |
import math
from typing import List
import numpy as np
from datasets.Dataset import Dataset
from models.Solution import Solution
def calculate_avgValue(population: List[Solution]) -> float:
avgValue = 0
for ind in population:
avgValue += ind.compute_mono_objective_score()
avgValue /= len(populati... | [
"numpy.count_nonzero",
"math.sqrt",
"math.dist",
"numpy.max"
] | [((3003, 3020), 'math.dist', 'math.dist', (['v1', 'v2'], {}), '(v1, v2)\n', (3012, 3020), False, 'import math\n'), ((3190, 3230), 'numpy.max', 'np.max', (['dataset.pbis_satisfaction_scaled'], {}), '(dataset.pbis_satisfaction_scaled)\n', (3196, 3230), True, 'import numpy as np\n'), ((3246, 3278), 'numpy.max', 'np.max', ... |
import matplotlib
matplotlib.use("Agg")
from matplotlib import pyplot as plt
import numpy as np
import os
from nanopores.tools import fields
from scipy.interpolate import interp1d
HOME = os.path.expanduser("~")
DATADIR = os.path.join(HOME, "Dropbox", "nanopores", "fields")
fields.set_dir(DATADIR)
data = fields.get_fi... | [
"nanopores.tools.fields.get_fields",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.path.join",
"scipy.interpolate.interp1d",
"numpy.inner",
"numpy.array",
"numpy.linspace",
"num... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((188, 211), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (206, 211), False, 'import os\n'), ((222, 274), 'os.path.join', 'os.path.join', (['HOME', '"""Dropbox"""', '""... |
import os
import nibabel
import numpy as np
import random
from scipy import ndimage
import SimpleITK as sitk
def load_nifty_volume_as_array(filename, with_header = False):
"""
load nifty image into numpy array, and transpose it based on the [z,y,x] axis order
The output array shape is like [Depth, Height,... | [
"SimpleITK.GetImageFromArray",
"nibabel.load",
"SimpleITK.WriteImage",
"SimpleITK.ReadImage",
"numpy.transpose"
] | [((529, 551), 'nibabel.load', 'nibabel.load', (['filename'], {}), '(filename)\n', (541, 551), False, 'import nibabel\n'), ((589, 618), 'numpy.transpose', 'np.transpose', (['data', '[2, 1, 0]'], {}), '(data, [2, 1, 0])\n', (601, 618), True, 'import numpy as np\n'), ((1071, 1099), 'SimpleITK.GetImageFromArray', 'sitk.Get... |
#!/usr/bin/env python
import rospy as rp
import numpy as np
import math as math
from geometry_msgs.msg import PoseStamped, TwistStamped
from styx_msgs.msg import Lane, Waypoint
from scipy.spatial import KDTree
from std_msgs.msg import Int32
'''
This node will publish waypoints from the car's current position to some... | [
"rospy.logerr",
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"scipy.spatial.KDTree",
"math.sqrt",
"numpy.array",
"numpy.dot",
"rospy.Rate",
"styx_msgs.msg.Waypoint",
"rospy.Publisher",
"styx_msgs.msg.Lane"
] | [((1071, 1103), 'rospy.init_node', 'rp.init_node', (['"""waypoint_updater"""'], {}), "('waypoint_updater')\n", (1083, 1103), True, 'import rospy as rp\n'), ((1199, 1256), 'rospy.Subscriber', 'rp.Subscriber', (['"""/current_pose"""', 'PoseStamped', 'self.pose_cb'], {}), "('/current_pose', PoseStamped, self.pose_cb)\n", ... |
import unittest
import os
import numpy as np
from constants import (
del_test_dir,
gen_test_dir,
get_output_mode,
solution_domain_setup,
CHEM_DICT_REACT,
SOL_PRIM_IN_REACT,
TEST_DIR,
)
from perform.constants import REAL_TYPE
from perform.system_solver import SystemSolver
from perform.input... | [
"numpy.repeat",
"perform.input_funcs.read_restart_file",
"constants.del_test_dir",
"perform.solution.solution_interior.SolutionInterior",
"os.path.join",
"constants.gen_test_dir",
"constants.get_output_mode",
"perform.time_integrator.implicit_integrator.BDF",
"constants.solution_domain_setup",
"pe... | [((670, 687), 'constants.get_output_mode', 'get_output_mode', ([], {}), '()\n', (685, 687), False, 'from constants import del_test_dir, gen_test_dir, get_output_mode, solution_domain_setup, CHEM_DICT_REACT, SOL_PRIM_IN_REACT, TEST_DIR\n'), ((773, 810), 'perform.gas_model.calorically_perfect_gas.CaloricallyPerfectGas', ... |
"""Test the module SMOTE ENN."""
# Authors: <NAME> <<EMAIL>>
# <NAME>
# License: MIT
import pytest
import numpy as np
from sklearn.utils.testing import assert_allclose, assert_array_equal
from imblearn.combine import SMOTEENN
from imblearn.under_sampling import EditedNearestNeighbours
from imblearn.over_sam... | [
"sklearn.utils.testing.assert_array_equal",
"imblearn.under_sampling.EditedNearestNeighbours",
"imblearn.over_sampling.SMOTE",
"imblearn.combine.SMOTEENN",
"numpy.array",
"pytest.mark.parametrize",
"pytest.raises",
"sklearn.utils.testing.assert_allclose"
] | [((357, 935), 'numpy.array', 'np.array', (['[[0.11622591, -0.0317206], [0.77481731, 0.60935141], [1.25192108, -\n 0.22367336], [0.53366841, -0.30312976], [1.52091956, -0.49283504], [-\n 0.28162401, -2.10400981], [0.83680821, 1.72827342], [0.3084254, \n 0.33299982], [0.70472253, -0.73309052], [0.28893132, -0.38... |
# Copyright 2021 TileDB Inc.
# Licensed under the MIT License.
import numpy as np
import pytest
from tiledb.cf.netcdf_engine._utils import get_netcdf_metadata, get_unpacked_dtype
netCDF4 = pytest.importorskip("netCDF4")
@pytest.mark.parametrize(
"input_dtype,scale_factor,add_offset,output_dtype",
(
... | [
"tiledb.cf.netcdf_engine._utils.get_unpacked_dtype",
"numpy.float64",
"numpy.int32",
"pytest.mark.parametrize",
"numpy.array",
"pytest.importorskip",
"tiledb.cf.netcdf_engine._utils.get_netcdf_metadata",
"pytest.raises",
"numpy.float32",
"pytest.warns"
] | [((191, 221), 'pytest.importorskip', 'pytest.importorskip', (['"""netCDF4"""'], {}), "('netCDF4')\n", (210, 221), False, 'import pytest\n'), ((2153, 2202), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value"""', "(('',), (1, 2))"], {}), "('value', (('',), (1, 2)))\n", (2176, 2202), False, 'import pytest\... |
import nose.tools
import unittest
import os
import json
import pandas as pd
import numpy as np
import mia
from mia.io_tools import *
from ..test_utils import get_file_path
class IOTests(unittest.TestCase):
@classmethod
def setupClass(cls):
cls._output_files = []
@classmethod
def teardownCla... | [
"numpy.ones",
"os.path.join",
"os.path.isfile",
"numpy.zeros",
"json.load",
"os.remove"
] | [((380, 397), 'os.path.isfile', 'os.path.isfile', (['f'], {}), '(f)\n', (394, 397), False, 'import os\n'), ((683, 713), 'os.path.join', 'os.path.join', (['img_directory', 'p'], {}), '(img_directory, p)\n', (695, 713), False, 'import os\n'), ((1233, 1263), 'os.path.join', 'os.path.join', (['img_directory', 'p'], {}), '(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.