code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import tensorflow as tf
import numpy as np
def img2mse(x, y):
return tf.reduce_mean(tf.square(x - y))
def mse2psnr(x):
return -10.*tf.math.log(x)/tf.math.log(10.)
def variance_weighted_loss(tof, gt, c=1.):
tof = outputs['tof_map']
tof_std = tof[..., -1:]
tof = tof[..., :2]
gt = gt[..., :2]
... | [
"tensorflow.math.log",
"tensorflow.abs",
"numpy.clip",
"tensorflow.square"
] | [((89, 105), 'tensorflow.square', 'tf.square', (['(x - y)'], {}), '(x - y)\n', (98, 105), True, 'import tensorflow as tf\n'), ((156, 173), 'tensorflow.math.log', 'tf.math.log', (['(10.0)'], {}), '(10.0)\n', (167, 173), True, 'import tensorflow as tf\n'), ((1490, 1522), 'numpy.clip', 'np.clip', (['target_depth', 'near',... |
'''
Title: Time Series Deconfounder: Estimating Treatment Effects over Time in the Presence of Hidden Confounders
Authors: <NAME>, <NAME>, <NAME>
International Conference on Machine Learning (ICML) 2020
Last Updated Date: July 20th 2020
Code Author: <NAME> (<EMAIL>)
'''
import logging
logging.basicConfig(format='%(lev... | [
"tensorflow.clip_by_value",
"tensorflow.distributions.Bernoulli",
"tensorflow.reshape",
"tensorflow.get_variable",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.abs",
"utils.predictive_checks_utils.compute_test_statistic_all_timesteps",
"tensorflow.compat.v1.placeholder",
"tensorf... | [((287, 362), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(message)s"""', 'level': 'logging.INFO'}), "(format='%(levelname)s:%(message)s', level=logging.INFO)\n", (306, 362), False, 'import logging\n'), ((363, 382), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (380, 3... |
from collections import namedtuple
from datasets import VUPDataset, NUPDataset, MLMDataset
import numpy as np
from data_utils import read_dataset
from models.VUPScorer import VUPScorer
from models.NUPScorer import NUPScorer
from models.MLMScorer import MLMScorer
import argparse
import json
from tqdm.auto import tqdm
... | [
"numpy.quantile",
"argparse.ArgumentParser",
"data_utils.read_dataset",
"models.MLMScorer.MLMScorer.load_from_checkpoint",
"json.dumps",
"tqdm.auto.tqdm",
"torch.cuda.is_available",
"torch.no_grad"
] | [((1130, 1223), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Calculating min and max of MLM for normalizatiion"""'}), "(description=\n 'Calculating min and max of MLM for normalizatiion')\n", (1153, 1223), False, 'import argparse\n'), ((1625, 1653), 'data_utils.read_dataset', 'read_... |
#!/usr/bin/env python
from __future__ import print_function, division
from glob import glob
import astropy.io.fits as pyfits
import sys, os
from os import path, remove
from astropy import log
from astropy.table import Table
from subprocess import check_call
import argparse
import re
import numpy as np
# from nicer.val... | [
"matplotlib.pyplot.title",
"astropy.table.Table.read",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"numpy.any",
"numpy.where",
"numpy.array",
"astropy.log.error",
"glob.glob",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"subpro... | [((372, 611), 'numpy.array', 'np.array', (['[0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24,\n 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 45, 46,\n 47, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63, 64, 65, 66, 67]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13... |
import tensorflow as tf
import numpy as np
from PIL import Image
from PIL import ImageDraw
from PIL import ImageColor
import cv2
import time
from styx_msgs.msg import TrafficLight
class TLClassifier(object):
def __init__(self):
self.current_light = TrafficLight.UNKNOWN
SSD_GRAPH_FILE = '.... | [
"numpy.asarray",
"tensorflow.Session",
"tensorflow.gfile.GFile",
"tensorflow.Graph",
"numpy.squeeze",
"tensorflow.import_graph_def",
"tensorflow.GraphDef"
] | [((1342, 1352), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (1350, 1352), True, 'import tensorflow as tf\n'), ((1413, 1426), 'tensorflow.GraphDef', 'tf.GraphDef', ([], {}), '()\n', (1424, 1426), True, 'import tensorflow as tf\n'), ((2063, 2096), 'numpy.asarray', 'np.asarray', (['image'], {'dtype': 'np.uint8'}), '... |
'''
Created on Feb. 25, 2020
@author: cefect
helper functions w/ Qgis api
'''
#==============================================================================
# imports------------
#==============================================================================
#python
import os, configparser, logging, inspect, copy, ... | [
"os.remove",
"hlpr.exceptions.QError",
"processing.run",
"numpy.isnan",
"hlpr.basic.linr",
"os.path.join",
"pandas.DataFrame",
"hlpr.basic.view",
"processing.core.Processing.Processing.initialize",
"inspect.isclass",
"os.path.dirname",
"os.path.exists",
"inspect.isbuiltin",
"hlpr.basic.is_... | [((816, 838), 'logging.getLogger', 'logging.getLogger', (['"""Q"""'], {}), "('Q')\n", (833, 838), False, 'import os, configparser, logging, inspect, copy, datetime, re\n'), ((110896, 110914), 'os.path.exists', 'os.path.exists', (['fp'], {}), '(fp)\n', (110910, 110914), False, 'import os, configparser, logging, inspect,... |
#!/usr/bin/env python3
# 6a-render-model3.py - investigate delauney triangulation for
# individual image surface mesh generation.
# for all the images in the fitted group, generate a 2d polygon
# surface fit. Then project the individual images onto this surface
# and generate an AC3D model.
#
# Note: insufficient im... | [
"lib.project.intersectVectorsWithGroundPlane",
"cv2.undistortPoints",
"argparse.ArgumentParser",
"math.sqrt",
"math.atan2",
"lib.srtm.interpolate_vectors",
"lib.panda3d.generate_from_fit",
"lib.groups.load",
"numpy.zeros",
"numpy.isnan",
"lib.project.ProjectMgr",
"numpy.array",
"numpy.linalg... | [((905, 973), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Set the initial camera poses."""'}), "(description='Set the initial camera poses.')\n", (928, 973), False, 'import argparse\n'), ((1527, 1559), 'lib.project.ProjectMgr', 'project.ProjectMgr', (['args.project'], {}), '(args.proj... |
import numpy as np
def sherman_morrison_row(e, inv, vec):
ratio = np.einsum("ij,ij->i", vec, inv[:, :, e])
tmp = np.einsum("ek,ekj->ej", vec, inv)
invnew = (
inv
- np.einsum("ki,kj->kij", inv[:, :, e], tmp) / ratio[:, np.newaxis, np.newaxis]
)
invnew[:, :, e] = inv[:, :, ... | [
"numpy.sum",
"numpy.abs",
"numpy.random.randn",
"numpy.asarray",
"numpy.einsum",
"numpy.zeros",
"pyqmc.testwf.test_updateinternals",
"pyqmc.testwf.test_wf_gradient",
"pyscf.gto.M",
"pyscf.scf.RHF",
"numpy.array",
"numpy.linalg.slogdet",
"numpy.linalg.inv",
"numpy.sign",
"pyscf.scf.ROHF",... | [((76, 116), 'numpy.einsum', 'np.einsum', (['"""ij,ij->i"""', 'vec', 'inv[:, :, e]'], {}), "('ij,ij->i', vec, inv[:, :, e])\n", (85, 116), True, 'import numpy as np\n'), ((128, 161), 'numpy.einsum', 'np.einsum', (['"""ek,ekj->ej"""', 'vec', 'inv'], {}), "('ek,ekj->ej', vec, inv)\n", (137, 161), True, 'import numpy as n... |
import numpy as np
from pmesh.pm import ParticleMesh
from nbodykit.lab import BigFileCatalog, MultipleSpeciesCatalog,\
BigFileMesh, FFTPower
from nbodykit import setup_logging
from mpi4py import MPI
import HImodels
# enable logging, we have some clue what's going on.
setup_loggin... | [
"nbodykit.lab.BigFileCatalog",
"numpy.abs",
"nbodykit.setup_logging",
"nbodykit.lab.FFTPower",
"pmesh.pm.ParticleMesh",
"nbodykit.lab.BigFileMesh"
] | [((308, 329), 'nbodykit.setup_logging', 'setup_logging', (['"""info"""'], {}), "('info')\n", (321, 329), False, 'from nbodykit import setup_logging\n'), ((933, 977), 'pmesh.pm.ParticleMesh', 'ParticleMesh', ([], {'BoxSize': 'bs', 'Nmesh': '[nc, nc, nc]'}), '(BoxSize=bs, Nmesh=[nc, nc, nc])\n', (945, 977), False, 'from ... |
import torch
import argparse
import os
import random
import numpy as np
from tensorboardX import SummaryWriter
from misc.utils import set_log, visualize
from torch.optim import SGD, Adam
from torch.nn.modules.loss import MSELoss
from inner_loop import InnerLoop
from omniglot_net import OmniglotNet
from score import *
f... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.nn.modules.loss.MSELoss",
"os.makedirs",
"torch.manual_seed",
"inner_loop.InnerLoop",
"misc.utils.set_log",
"os.path.exists",
"torch.cuda.manual_seed",
"omniglot_net.OmniglotNet",
"torch.cuda.manual_seed_all",
"misc.replay_buffer.ReplayBuf... | [((5202, 5215), 'misc.utils.set_log', 'set_log', (['args'], {}), '(args)\n', (5209, 5215), False, 'from misc.utils import set_log, visualize\n'), ((5241, 5263), 'random.seed', 'random.seed', (['args.seed'], {}), '(args.seed)\n', (5252, 5263), False, 'import random\n'), ((5268, 5293), 'numpy.random.seed', 'np.random.see... |
import numpy as np
from pandas import (
DataFrame,
IndexSlice,
)
class Render:
params = [[12, 24, 36], [12, 120]]
param_names = ["cols", "rows"]
def setup(self, cols, rows):
self.df = DataFrame(
np.random.randn(rows, cols),
columns=[f"float_{i+1}" for i in range(... | [
"pandas.DataFrame",
"numpy.random.randn"
] | [((2743, 2815), 'pandas.DataFrame', 'DataFrame', (['"""abc"""'], {'index': 'self.df.index[::2]', 'columns': 'self.df.columns[::2]'}), "('abc', index=self.df.index[::2], columns=self.df.columns[::2])\n", (2752, 2815), False, 'from pandas import DataFrame, IndexSlice\n'), ((240, 267), 'numpy.random.randn', 'np.random.ran... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List
from unittest.mock import patch
from unittest import TestCase
import genty
import numpy as np
fro... | [
"numpy.random.seed",
"genty.genty_dataset",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"unittest.mock.patch",
"numpy.testing.assert_equal",
"numpy.random.normal",
"numpy.all"
] | [((389, 660), 'genty.genty_dataset', 'genty.genty_dataset', ([], {'bragg': "('bragg', [2.93, 2.18, 2.35, 2.12, 31.53, 15.98, 226.69, 193.11])", 'morpho': "('morpho', [280.36, 52.96, 208.16, 72.69, 89.92, 60.37, 226.69, 193.11])", 'chirped': "('chirped', [280.36, 52.96, 104.08, 36.34, 31.53, 15.98, 226.69, 193.11])"}), ... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : functional.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 03/03/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import math
from PIL import Image
import numpy as np
import torchvision.transforms.functional as TF
impor... | [
"numpy.ones_like",
"torchvision.transforms.functional.rotate",
"torchvision.transforms.functional.hflip",
"math.radians",
"math.ceil",
"jactorch.transforms.image.functional.pad",
"torchvision.transforms.functional.resize",
"math.floor",
"math.sin",
"torchvision.transforms.functional.crop",
"nump... | [((978, 1002), 'jacinle.utils.argument.get_2dshape', 'get_2dshape', (['output_size'], {}), '(output_size)\n', (989, 1002), False, 'from jacinle.utils.argument import get_2dshape\n'), ((1454, 1500), 'jactorch.transforms.image.functional.pad', 'jac_tf.pad', (['img', 'padding'], {'mode': 'mode', 'fill': 'fill'}), '(img, p... |
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensemble import AdaBoostRegressor
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.model_selection import GridSearchCV
... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.axhline",
"sklearn.model_selection.GridSearchCV",
"sklearn.model_selection.cross_val_score",
"numpy.zeros",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"sklearn.metrics.mean_squared_error",
"numpy.sqrt"
] | [((2361, 2414), 'numpy.zeros', 'np.zeros', (['(estimator.n_estimators,)'], {'dtype': 'np.float64'}), '((estimator.n_estimators,), dtype=np.float64)\n', (2369, 2414), True, 'import numpy as np\n'), ((2433, 2486), 'numpy.zeros', 'np.zeros', (['(estimator.n_estimators,)'], {'dtype': 'np.float64'}), '((estimator.n_estimato... |
"""
Name: SampleEvent
breif: Samples events for particles provided in a phase space for MCDC-TNT
Author: <NAME> (OR State Univ - <EMAIL>) CEMeNT
Date: Dec 2nd 2021
"""
import numpy as np
import pykokkos as pk
@pk.workload
class SampleEvent:
def __init__(self, p_mesh_cell, p_alive, mesh_cap_xsec, mesh_scat_xsec, me... | [
"pykokkos.printf",
"numpy.zeros",
"numpy.ones",
"pykokkos.from_numpy",
"numpy.array"
] | [((3753, 3791), 'numpy.array', 'np.array', (['[0, 1, 0, 5]'], {'dtype': 'np.int32'}), '([0, 1, 0, 5], dtype=np.int32)\n', (3761, 3791), True, 'import numpy as np\n'), ((3807, 3845), 'numpy.array', 'np.array', (['[1, 1, 1, 0]'], {'dtype': 'np.int32'}), '([1, 1, 1, 0], dtype=np.int32)\n', (3815, 3845), True, 'import nump... |
import logging
import numpy as np
from .dataset import DataSet
from .markers import markers_to_events
def sliding_window_indices(window_size, window_step, sig_len):
'''Returns indices for a sliding window with shape [nwindows x window_size]'''
nwindows = int(np.floor((sig_len - window_size + window_step) /
f... | [
"numpy.fft.rfft",
"numpy.abs",
"numpy.log2",
"numpy.asarray",
"numpy.zeros",
"numpy.argsort",
"numpy.diff",
"numpy.arange",
"numpy.hanning",
"logging.getLogger"
] | [((627, 645), 'numpy.asarray', 'np.asarray', (['signal'], {}), '(signal)\n', (637, 645), True, 'import numpy as np\n'), ((1364, 1389), 'numpy.fft.rfft', 'np.fft.rfft', (['wins'], {'axis': '(1)'}), '(wins, axis=1)\n', (1375, 1389), True, 'import numpy as np\n'), ((4481, 4491), 'numpy.log2', 'np.log2', (['N'], {}), '(N)\... |
import pandas as pd
import numpy as np
from GPfates import GPfates
etpm = pd.read_table('tapio_tcell_tpm.txt', index_col=0)
etpm = etpm[(etpm > 2).sum(1) > 2]
logexp = np.log10(etpm + 1)
tcells = pd.read_csv('tcells_rebuttal.csv', index_col=0)
m = GPfates.GPfates(tcells, logexp)
# m.dimensionality_reduction()
#
# ... | [
"pandas.read_csv",
"GPfates.GPfates.GPfates",
"GPfates.GPfates.plt.show",
"pandas.read_table",
"numpy.log10"
] | [((76, 125), 'pandas.read_table', 'pd.read_table', (['"""tapio_tcell_tpm.txt"""'], {'index_col': '(0)'}), "('tapio_tcell_tpm.txt', index_col=0)\n", (89, 125), True, 'import pandas as pd\n'), ((170, 188), 'numpy.log10', 'np.log10', (['(etpm + 1)'], {}), '(etpm + 1)\n', (178, 188), True, 'import numpy as np\n'), ((199, 2... |
# $Id$
#
# Copyright (C) 2003 <NAME> and Rational Discovery LLC
# All Rights Reserved
#
""" functionality to allow adjusting composite model contents
"""
from __future__ import print_function
import copy
import numpy
def BalanceComposite(model, set1, set2, weight, targetSize, names1=None, names2=None):
""" a... | [
"numpy.zeros",
"numpy.argsort",
"copy.copy"
] | [((1217, 1233), 'copy.copy', 'copy.copy', (['model'], {}), '(model)\n', (1226, 1233), False, 'import copy\n'), ((1368, 1403), 'numpy.zeros', 'numpy.zeros', (['startSize', 'numpy.float'], {}), '(startSize, numpy.float)\n', (1379, 1403), False, 'import numpy\n'), ((2215, 2236), 'numpy.argsort', 'numpy.argsort', (['scores... |
'''
Reference: <NAME>, et al., "IRGAN: A Minimax Game for Unifying Generative and
Discriminative Information Retrieval Models." SIGIR 2017.
@author: <NAME>
'''
from neurec.model.AbstractRecommender import AbstractRecommender
import tensorflow as tf
import pickle
import numpy as np
from concurrent.futures import ThreadP... | [
"numpy.sum",
"tensorflow.reshape",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.multiply",
"tensorflow.matmul",
"pickle.load",
"numpy.arange",
"numpy.exp",
"tensorflow.Variable",
"neurec.util.data_gen._get_pointwise_batch_data",
"tensorflow.gather",
"tensorflow.variable_scope... | [((1778, 1802), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {}), '(tf.int32)\n', (1792, 1802), True, 'import tensorflow as tf\n'), ((1820, 1844), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {}), '(tf.int32)\n', (1834, 1844), True, 'import tensorflow as tf\n'), ((1867, 1893), 'tensorflow.pl... |
import tensorflow as tf
from tensorflow import keras
from utils import data_utils, argmanager
from utils.loss import multinomial_nll
import numpy as np
import os
import json
import scipy
import sklearn.metrics
import scipy.stats
from collections import OrderedDict
def softmax(x, temp=1):
norm_x = x - np.mean(x,ax... | [
"json.dump",
"tensorflow.keras.utils.CustomObjectScope",
"tensorflow.keras.models.load_model",
"scipy.spatial.distance.jensenshannon",
"utils.argmanager.fetch_metrics_args",
"scipy.stats.spearmanr",
"scipy.stats.pearsonr",
"numpy.mean",
"numpy.exp",
"utils.data_utils.load_test_data",
"numpy.rand... | [((629, 660), 'utils.argmanager.fetch_metrics_args', 'argmanager.fetch_metrics_args', ([], {}), '()\n', (658, 660), False, 'from utils import data_utils, argmanager\n'), ((1020, 1139), 'utils.data_utils.load_test_data', 'data_utils.load_test_data', (['args.peaks', 'args.nonpeaks', 'args.genome', 'args.bigwig', 'args.te... |
#!/usr/bin/env python
"""
"""
import numpy as np
from scipy.odr import Model
from scipy.optimize import leastsq
from scipy import ndimage
from scipy.ndimage import gaussian_gradient_magnitude
from scipy.ndimage import map_coordinates
from common import PIX_ERR
from features import line_profile
def contour(img, A0, R... | [
"scipy.ndimage.gaussian_filter1d",
"numpy.argmax",
"scipy.odr.Model",
"numpy.empty",
"numpy.asarray",
"features.line_profile",
"scipy.ndimage.gaussian_gradient_magnitude",
"numpy.fabs",
"numpy.arange",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"numpy.tan",
"scipy.ndimage.map_coordinates"... | [((2221, 2341), 'scipy.odr.Model', 'Model', (['circle_fcn'], {'estimate': '_circle_est', 'fjacb': '_circle_fjacb', 'fjacd': '_circle_fjacd', 'meta': '_circle_meta', 'implicit': '(True)'}), '(circle_fcn, estimate=_circle_est, fjacb=_circle_fjacb, fjacd=\n _circle_fjacd, meta=_circle_meta, implicit=True)\n', (2226, 23... |
import ignore
import tensorflow as tf
import numpy as np
char_arr = [c for c in 'SEPabcdefghijklmnopqrstuvwxyz단어나무놀이소녀키스사랑']
num_dic = {n: i for i, n in enumerate(char_arr)}
dic_len = len(num_dic)
seq_data = [['word', '단어'], ['wood', '나무'],
['game', '놀이'], ['girl', '소녀'],
['kiss', '키스'], ['lov... | [
"tensorflow.nn.rnn_cell.BasicRNNCell",
"tensorflow.nn.dynamic_rnn",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow.layers.dense",
"tensorflow.Session",
"tensorflow.variable_scope",
"tensorflow.nn.rnn_cell.DropoutWrapper",
"tensorflow.placeholder",
"numpy.eye",
"tenso... | [((912, 961), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, None, n_input]'], {}), '(tf.float32, [None, None, n_input])\n', (926, 961), True, 'import tensorflow as tf\n'), ((974, 1023), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, None, n_input]'], {}), '(tf.float32, [None, ... |
import ipywidgets as widgets
import cartopy.crs as ccrs
import geoviews as gv
import holoviews as hv
import numpy as np
import panel as pn
import param
from shapely.geometry import Polygon as sPolygon, LineString as sLineString
from .interface import EDRInterface
from .lookup import CRS_LOOKUP
class EDRExplorer(par... | [
"param.Magnitude",
"cartopy.crs.Mercator",
"holoviews.Polygons",
"geoviews.Image",
"ipywidgets.Text",
"geoviews.tile_sources.Wikipedia.opts",
"panel.widgets.Checkbox",
"panel.Row",
"param.String",
"ipywidgets.SelectionSlider",
"ipywidgets.Button",
"geoviews.DynamicMap",
"param.Boolean",
"i... | [((483, 557), 'ipywidgets.Text', 'widgets.Text', ([], {'placeholder': '"""Specify an EDR Server..."""', 'description': '"""Server"""'}), "(placeholder='Specify an EDR Server...', description='Server')\n", (495, 557), True, 'import ipywidgets as widgets\n'), ((569, 639), 'ipywidgets.Dropdown', 'widgets.Dropdown', ([], {... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 27 10:35:53 2021
@author: Peace4Lv
"""
from pyecharts.components import Image
from pyecharts.options import ComponentTitleOpts
from os import path
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime, timedelta
plt.rcParams['font.sans-serif']... | [
"datetime.datetime.strftime",
"pyecharts.components.Image",
"matplotlib.pyplot.show",
"pyecharts.options.ComponentTitleOpts",
"datetime.datetime.now",
"datetime.datetime.strptime",
"os.path.isfile",
"numpy.array",
"datetime.timedelta",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((452, 459), 'pyecharts.components.Image', 'Image', ([], {}), '()\n', (457, 459), False, 'from pyecharts.components import Image\n'), ((2129, 2160), 'numpy.array', 'np.array', (['[-5, 5, -3, 3, -1, 1]'], {}), '([-5, 5, -3, 3, -1, 1])\n', (2137, 2160), True, 'import numpy as np\n'), ((2175, 2244), 'matplotlib.pyplot.su... |
import numpy as np
import unittest
import ray
from ray.rllib.evaluation.postprocessing import adjust_nstep, discount_cumsum
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.utils.test_utils import check
class TestPostprocessing(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:... | [
"ray.init",
"ray.rllib.policy.sample_batch.SampleBatch",
"ray.rllib.utils.test_utils.check",
"pytest.main",
"numpy.random.randint",
"ray.shutdown",
"numpy.arange",
"ray.rllib.evaluation.postprocessing.adjust_nstep",
"numpy.array"
] | [((329, 339), 'ray.init', 'ray.init', ([], {}), '()\n', (337, 339), False, 'import ray\n'), ((402, 416), 'ray.shutdown', 'ray.shutdown', ([], {}), '()\n', (414, 416), False, 'import ray\n'), ((822, 984), 'ray.rllib.policy.sample_batch.SampleBatch', 'SampleBatch', (['{SampleBatch.OBS: obs, SampleBatch.ACTIONS: actions, ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 14:27:05 2020
@author: ricardoguimaraes
"""
import numpy as np
import pandas as pd
import geopandas as gpd
from gdf_heatmap import gdf_heatmap
from array_to_tiff import array_to_tiff
if '__main__' == __name__ :
from shapely.geometry import Point
impor... | [
"shapely.geometry.Point",
"matplotlib.pyplot.close",
"geopandas.GeoDataFrame",
"numpy.random.normal",
"gdf_heatmap.gdf_heatmap",
"array_to_tiff.array_to_tiff"
] | [((665, 685), 'geopandas.GeoDataFrame', 'gpd.GeoDataFrame', (['df'], {}), '(df)\n', (681, 685), True, 'import geopandas as gpd\n'), ((704, 802), 'gdf_heatmap.gdf_heatmap', 'gdf_heatmap', (['gdf'], {'df_column': '"""z"""', 'dx': '(0.5)', 'dy': '(0.5)', 'verbose': '(True)', 'smooth': '(0.3)', 'function': '"""gaussian"""'... |
import numpy as np
from scipy.integrate import quad
import pandas as pd
# calculate the k-corrention in erg.s-1.cm-2:
def NE(E,Epeak,alpha,beita):
if (alpha-beita)*Epeak/(2+alpha)>=E:
NE=(E/100)**alpha*np.exp(-E*(2+alpha)/Epeak)
return NE
elif (alpha-beita)*Epeak/(2+alpha)<=E:
NE=(((al... | [
"numpy.sum",
"scipy.integrate.quad",
"random.uniform",
"pandas.read_excel",
"numpy.append",
"numpy.mean",
"numpy.exp",
"numpy.cos",
"numpy.log10",
"numpy.arccos",
"numpy.sqrt"
] | [((1513, 1540), 'numpy.arccos', 'np.arccos', (['(1 - Egama / eiso)'], {}), '(1 - Egama / eiso)\n', (1522, 1540), True, 'import numpy as np\n'), ((1816, 1843), 'numpy.arccos', 'np.arccos', (['(1 - Egama / eiso)'], {}), '(1 - Egama / eiso)\n', (1825, 1843), True, 'import numpy as np\n'), ((2965, 2992), 'numpy.arccos', 'n... |
"""
Fixed Maximum Cost (FMC) baseline
"""
import logging
from collections import defaultdict
from typing import Tuple, List
import time
import numpy as np
from pup.algorithms import privacy_helper
from pup.algorithms.uniform_prior import cal_prob_dists_num_users_for_grid
from pup.algorithms.util import get_linear_pr... | [
"numpy.average",
"pup.io.dataio.read_costs",
"pup.algorithms.util.get_linear_profit_fixed_cost",
"pup.algorithms.privacy_helper.buy_data_at_price",
"pup.algorithms.uniform_prior.cal_prob_dists_num_users_for_grid",
"time.time",
"pup.experiment.exp_util.cal_num_data_points",
"collections.defaultdict",
... | [((559, 586), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (576, 586), False, 'import logging\n'), ((1185, 1196), 'time.time', 'time.time', ([], {}), '()\n', (1194, 1196), False, 'import time\n'), ((2441, 2517), 'pup.algorithms.uniform_prior.cal_prob_dists_num_users_for_grid', 'cal_prob... |
from Genome.NN.Layer import Layer
import numpy as np
import pickle
class Brain:
def __init__(self, brain_structure):
self.brain_structure = brain_structure
self.layers = []
self.id = 0
# First layer added here
ids = []
genes = []
for i in range(brain_struct... | [
"numpy.random.rand",
"pickle.dump",
"pickle.load",
"Genome.NN.Layer.Layer"
] | [((537, 547), 'Genome.NN.Layer.Layer', 'Layer', (['ids'], {}), '(ids)\n', (542, 547), False, 'from Genome.NN.Layer import Layer\n'), ((1202, 1212), 'Genome.NN.Layer.Layer', 'Layer', (['ids'], {}), '(ids)\n', (1207, 1212), False, 'from Genome.NN.Layer import Layer\n'), ((1500, 1510), 'Genome.NN.Layer.Layer', 'Layer', ([... |
# !/usr/bin/python3
# coding: utf-8
# Copyright 2015-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
#
# Unless required by applicable law... | [
"cv2.GaussianBlur",
"numpy.sum",
"cv2.medianBlur",
"numpy.ones",
"cv2.bilateralFilter",
"cv2.warpAffine",
"os.path.isfile",
"numpy.arange",
"cv2.minAreaRect",
"cv2.normalize",
"cv2.erode",
"cv2.absdiff",
"wand.image.Image",
"cv2.getRotationMatrix2D",
"os.path.join",
"cv2.dilate",
"cv... | [((906, 917), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (915, 917), False, 'import os\n'), ((933, 968), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""data/img"""'], {}), "(BASE_PATH, 'data/img')\n", (945, 968), False, 'import os\n'), ((982, 1017), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""data/tmp"""'],... |
import re
import keras.backend as keras_backend
from keras.layers import DepthwiseConv2D
import numpy as np
from traits.api import Float, HasStrictTraits, Instance, Int, Tuple, Property
from blusky.wavelets.i_wavelet_2d import IWavelet2D
class ApplyFatherWavlet2D(HasStrictTraits):
"""
Provides a "convolut... | [
"traits.api.Instance",
"numpy.iscomplexobj",
"traits.api.Property",
"keras.layers.DepthwiseConv2D",
"keras.backend.variable",
"traits.api.Int",
"numpy.log2",
"numpy.zeros",
"re.sub"
] | [((1557, 1563), 'traits.api.Int', 'Int', (['(2)'], {}), '(2)\n', (1560, 1563), False, 'from traits.api import Float, HasStrictTraits, Instance, Int, Tuple, Property\n'), ((1770, 1776), 'traits.api.Int', 'Int', (['(0)'], {}), '(0)\n', (1773, 1776), False, 'from traits.api import Float, HasStrictTraits, Instance, Int, Tu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import modules
import pytest
import numpy as np
# Import from package
from pyswarms.discrete import BinaryPSO
@pytest.mark.parametrize(
"options",
[
{"c2": 0.7, "w": 0.5, "k": 2, "p": 2},
{"c1": 0.5, "w": 0.5, "k": 2, "p": 2},
{"c1": 0.... | [
"pytest.mark.parametrize",
"pytest.raises",
"numpy.array",
"pyswarms.discrete.BinaryPSO"
] | [((163, 414), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""options"""', "[{'c2': 0.7, 'w': 0.5, 'k': 2, 'p': 2}, {'c1': 0.5, 'w': 0.5, 'k': 2, 'p': \n 2}, {'c1': 0.5, 'c2': 0.7, 'k': 2, 'p': 2}, {'c1': 0.5, 'c2': 0.7, 'w':\n 0.5, 'p': 2}, {'c1': 0.5, 'c2': 0.7, 'w': 0.5, 'k': 2}]"], {}), "('options... |
import MulensModel as mm
import Functions as mc
import random
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib
from scipy.stats import truncnorm, loguniform, uniform
#plt.style.use('ggplot')
print(plt.style.available)
#print(plt.rcParams["font.family"].available)
#print... | [
"matplotlib.pyplot.title",
"Functions.truncatedLogNormDist",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"Functions.uniDist",
"matplotlib.pyplot.style.use",
"numpy.array",
"numpy.linspace",
"Functions.logUniDist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.py... | [((613, 634), 'Functions.logUniDist', 'mc.logUniDist', (['(0.2)', '(5)'], {}), '(0.2, 5)\n', (626, 634), True, 'import Functions as mc\n'), ((642, 665), 'Functions.logUniDist', 'mc.logUniDist', (['(1e-05)', '(1)'], {}), '(1e-05, 1)\n', (655, 665), True, 'import Functions as mc\n'), ((677, 695), 'Functions.uniDist', 'mc... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
from ase import Atoms
from ase.constraints import dict2constraint
import copy
import importlib
import numpy as np
from p... | [
"ase.constraints.dict2constraint",
"copy.deepcopy",
"ase.cell.Cell",
"numpy.asarray",
"pyiron_atomistics.atomistics.job.interactive.GenericInteractive.structure.fset",
"numpy.array",
"pyiron_atomistics.atomistics.structure.atoms.pyiron_to_ase",
"pyiron_atomistics.atomistics.job.interactive.GenericInte... | [((2640, 2665), 'copy.deepcopy', 'copy.deepcopy', (['atoms_dict'], {}), '(atoms_dict)\n', (2653, 2665), False, 'import copy\n'), ((3278, 3302), 'ase.Atoms', 'Atoms', ([], {}), '(**atoms_dict_copy)\n', (3283, 3302), False, 'from ase import Atoms\n'), ((1159, 1188), 'copy.deepcopy', 'copy.deepcopy', (['structure.info'], ... |
import numpy as np
from logistic_regression import logistic_kernel_regression, compute_label
from kernel_creation import convert_spectral_kernel_quad, convert_spectral_kernel_quint, convert_spectral_kernel_trig
from kernel_creation import convert_acid_kernel, convert_acid_quad, convert_mismatch_lev, convert_lect_trig, ... | [
"read_fn.save_label",
"kernel_creation.get_mismatch_dict",
"kernel_creation.compute_test_matrix",
"numpy.sum",
"numpy.linalg.eigvals",
"SVM.SVM",
"numpy.asarray",
"numpy.identity",
"read_fn.read_csv_file_label",
"kernel_creation.compute_K_matrix",
"SVM.svm_compute_label",
"numpy.mean",
"kern... | [((7342, 7412), 'read_fn.save_label', 'save_label', (['(0)', 'list_labels_svm', '"""results/SVM-quint-centered-mixed.csv"""'], {}), "(0, list_labels_svm, 'results/SVM-quint-centered-mixed.csv')\n", (7352, 7412), False, 'from read_fn import read_csv_file_label, read_csv_file_data, save_label, save_data_converted\n'), ((... |
# Script wh helps to plot Figures 3A and 3B
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
# Include all GENES, those containing Indels and SNVS (that's why I repeat this step of loading "alleles" dataframe) This prevents badly groupping in 20210105_plotStacked...INDELS.py
alleles = pd.read_csv... | [
"pandas.DataFrame",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.barh",
"numpy.arange",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"matplotl... | [((309, 363), 'pandas.read_csv', 'pd.read_csv', (['"""/path/to/Alleles_20201228.csv"""'], {'sep': '"""\t"""'}), "('/path/to/Alleles_20201228.csv', sep='\\t')\n", (320, 363), True, 'import pandas as pd\n'), ((629, 686), 'pandas.read_csv', 'pd.read_csv', (['"""/path/to/phenotypes_20210107.csv"""'], {'sep': '"""\t"""'}), ... |
import numpy as np
import os
from astropy.io import fits
from astropy.stats import sigma_clip, sigma_clipped_stats
from specklepy.logging import logger
from specklepy.reduction.subwindow import SubWindow
from specklepy.utils.time import default_time_stamp
class MasterDark(object):
extensions = {'variance': 'VA... | [
"astropy.stats.sigma_clipped_stats",
"astropy.io.fits.PrimaryHDU",
"numpy.reciprocal",
"astropy.io.fits.Header",
"astropy.io.fits.HDUList",
"os.path.join",
"numpy.unique",
"specklepy.reduction.subwindow.SubWindow.from_str",
"astropy.io.fits.getdata",
"numpy.var",
"specklepy.utils.time.default_ti... | [((1150, 1174), 'os.path.split', 'os.path.split', (['file_path'], {}), '(file_path)\n', (1163, 1174), False, 'import os\n'), ((1310, 1332), 'astropy.io.fits.getdata', 'fits.getdata', (['obj.path'], {}), '(obj.path)\n', (1322, 1332), False, 'from astropy.io import fits\n'), ((2034, 2076), 'os.path.join', 'os.path.join',... |
#!/usr/bin/env python3
# coding: utf-8
# Contains common methods frequently used across....
# The example reference at the below matplotlib is helpful in choosing an
# appropriate colormap for the output plot
# https://matplotlib.org/examples/color/colormaps_reference.html
# import the necessary packages
import numpy... | [
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.contourf",
"numpy.arange",
"numpy.unique"
] | [((2481, 2528), 'matplotlib.pyplot.contourf', 'plt.contourf', (['xx', 'yy', 'Z'], {'alpha': 'alpha', 'cmap': 'cmap'}), '(xx, yy, Z, alpha=alpha, cmap=cmap)\n', (2493, 2528), True, 'import matplotlib.pyplot as plt\n'), ((4126, 4181), 'matplotlib.pyplot.contourf', 'plt.contourf', (['xx', 'yy', 'mesh_output'], {'alpha': '... |
import numpy as np
import seaborn as sns
def p_x_given_y(y, mus, sigmas):
mu = mus[0] + sigmas[1, 0] / sigmas[0, 0] * (y - mus[1])
sigma = sigmas[0, 0] - sigmas[1, 0] / sigmas[1, 1] * sigmas[1, 0]
return np.random.normal(mu, sigma)
def p_y_given_x(x, mus, sigmas):
mu = mus[1] + sigmas[0, 1] / sigmas... | [
"numpy.zeros",
"numpy.array",
"numpy.random.normal",
"seaborn.jointplot",
"numpy.random.rand"
] | [((218, 245), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma'], {}), '(mu, sigma)\n', (234, 245), True, 'import numpy as np\n'), ((423, 450), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma'], {}), '(mu, sigma)\n', (439, 450), True, 'import numpy as np\n'), ((512, 531), 'numpy.zeros', 'np.zeros', (... |
# coding: utf-8
# Creates:
# * cachito_fe_vel_comp.pdf
# In[1]:
import os
import numpy as np
import yaml
from astropy.io import ascii as asc
from astropy.time import Time
import astropy.units as u
import astropy.constants as c
from astropy.modeling import models, fitting
from matplotlib import pyplot as plt
#... | [
"astropy.time.Time",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.arange",
"utilities_az.supernova.LightCurve2",
"os.path.join"
] | [((426, 477), 'matplotlib.pyplot.style.use', 'plt.style.use', (["['seaborn-paper', 'az-paper-onecol']"], {}), "(['seaborn-paper', 'az-paper-onecol'])\n", (439, 477), True, 'from matplotlib import pyplot as plt\n'), ((660, 708), 'astropy.time.Time', 'Time', (["['2015-09-05', '2015-10-05', '2015-10-10']"], {}), "(['2015-... |
import numpy as np
from sklearn.metrics import roc_auc_score,jaccard_score
import cv2
from torch import nn
import torch.nn.functional as F
import math
from functools import wraps
import warnings
import weakref
from torch.optim.optimizer import Optimizer
class WeightedBCE(nn.Module):
def __init__(self, weights=[0.... | [
"torch.nn.functional.binary_cross_entropy",
"numpy.sum",
"cv2.imwrite",
"math.floor",
"numpy.mean",
"math.cos",
"functools.wraps",
"warnings.warn",
"math.log",
"weakref.ref"
] | [((3473, 3486), 'numpy.mean', 'np.mean', (['aucs'], {}), '(aucs)\n', (3480, 3486), True, 'import numpy as np\n'), ((4124, 4137), 'numpy.mean', 'np.mean', (['ious'], {}), '(ious)\n', (4131, 4137), True, 'import numpy as np\n'), ((4271, 4298), 'numpy.sum', 'np.sum', (['(y_true_f * y_pred_f)'], {}), '(y_true_f * y_pred_f)... |
import unittest
import numpy as np
from scipy.optimize import root
from scipy.interpolate import interp1d
from scipy.stats import entropy, poisson
import warnings
from epipack.numeric_epi_models import (
DynamicBirthRate,
ConstantBirthRate,
DynamicLinearRate,
ConstantLi... | [
"matplotlib.pyplot.yscale",
"numpy.abs",
"numpy.isclose",
"numpy.histogram",
"matplotlib.pyplot.figure",
"epipack.numeric_epi_models.ConstantLinearRate",
"numpy.sin",
"numpy.exp",
"numpy.arange",
"scipy.interpolate.interp1d",
"epipack.numeric_epi_models.ConstantQuadraticRate",
"numpy.linspace"... | [((4359, 4429), 'epipack.numeric_epi_models.SISModel', 'SISModel', ([], {'infection_rate': '(2)', 'recovery_rate': '(1)', 'initial_population_size': 'N'}), '(infection_rate=2, recovery_rate=1, initial_population_size=N)\n', (4367, 4429), False, 'from epipack.numeric_epi_models import DynamicBirthRate, ConstantBirthRate... |
import random
import ctypes
import sys
import wgpu.backends.rs # noqa
import numpy as np
from pytest import skip
from testutils import run_tests, get_default_device
from testutils import can_use_wgpu_lib, is_ci
from renderutils import render_to_texture, render_to_screen # noqa
if not can_use_wgpu_lib:
skip("S... | [
"random.randint",
"ctypes.sizeof",
"testutils.get_default_device",
"pytest.skip",
"numpy.ctypeslib.as_array",
"numpy.all"
] | [((313, 383), 'pytest.skip', 'skip', (['"""Skipping tests that need the wgpu lib"""'], {'allow_module_level': '(True)'}), "('Skipping tests that need the wgpu lib', allow_module_level=True)\n", (317, 383), False, 'from pytest import skip\n'), ((13362, 13382), 'ctypes.sizeof', 'ctypes.sizeof', (['data1'], {}), '(data1)\... |
# Note: model title and parameter table are inserted automatically
r"""
This model provides the scattering intensity, $I(q)$, for a lyotropic lamellar
phase where a random distribution in solution are assumed. The SLD of the head
region is taken to be different from the SLD of the tail region.
Definition
----------
T... | [
"numpy.random.uniform"
] | [((3537, 3560), 'numpy.random.uniform', 'np.random.uniform', (['(1)', '(4)'], {}), '(1, 4)\n', (3554, 3560), True, 'import numpy as np\n'), ((3591, 3614), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (3608, 3614), True, 'import numpy as np\n')] |
# %%
# line printer
def printer(info):
print('\n\n================================= {} =================================================\n\n'.format(info))
# %%
import itertools
# to get a counter starting from 0 to infinte
counter = itertools.count() # return type is the iterator and count will start from 0... | [
"numpy.random.seed",
"numpy.random.randint",
"itertools.cycle",
"itertools.permutations",
"itertools.zip_longest",
"numpy.random.choice",
"itertools.product",
"itertools.chain",
"itertools.filterfalse",
"itertools.accumulate",
"itertools.count",
"itertools.combinations",
"itertools.islice",
... | [((244, 261), 'itertools.count', 'itertools.count', ([], {}), '()\n', (259, 261), False, 'import itertools\n'), ((456, 493), 'itertools.count', 'itertools.count', ([], {'start': 'start', 'step': '(-5)'}), '(start=start, step=-5)\n', (471, 493), False, 'import itertools\n'), ((609, 646), 'itertools.count', 'itertools.co... |
from functools import wraps
import numpy as np
import torch
from mani_skill_learn.utils.data import split_in_dict_array, concat_list_of_array
def disable_gradients(network):
for param in network.parameters():
param.requires_grad = False
def worker_init_fn(worker_id):
"""The function is designed for ... | [
"numpy.random.seed",
"torch.IntTensor",
"functools.wraps",
"torch.no_grad",
"mani_skill_learn.utils.data.concat_list_of_array",
"mani_skill_learn.utils.data.split_in_dict_array"
] | [((658, 695), 'numpy.random.seed', 'np.random.seed', (['(base_seed + worker_id)'], {}), '(base_seed + worker_id)\n', (672, 695), True, 'import numpy as np\n'), ((718, 726), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (723, 726), False, 'from functools import wraps\n'), ((1214, 1259), 'mani_skill_learn.utils.data.... |
"""
test melange.propagators
"""
from jax import random
from jax import vmap
import jax.numpy as jnp
from melange.propagators import *
from melange.tests.utils import checker_function, get_nondefault_potential_initializer
import tqdm
import numpy as np
from jax.config import config; config.update("jax_enable_x64", True... | [
"jax.config.config.update",
"jax.numpy.array",
"melange.propagators.generate_Euler_Maruyama_propagators",
"jax.vmap",
"tqdm.trange",
"melange.propagators.driven_Langevin_log_proposal_ratio",
"jax.random.PRNGKey",
"jax.random.multivariate_normal",
"melange.propagators.generate_driven_Langevin_propaga... | [((284, 321), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (297, 321), False, 'from jax.config import config\n'), ((356, 373), 'jax.random.PRNGKey', 'random.PRNGKey', (['(0)'], {}), '(0)\n', (370, 373), False, 'from jax import random\n'), ((658, 67... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 24 13:50:54 2020
This is the load to load data based on occupancy maps
@author: cheng
"""
import numpy as np
import time
import os
from augmentation import rotation
from maps import Maps
from occupancy import circle_group_grid
def loaddata(dataset_list, args, data... | [
"numpy.load",
"numpy.concatenate",
"occupancy.circle_group_grid",
"numpy.empty",
"os.path.exists",
"numpy.genfromtxt",
"numpy.isnan",
"time.time",
"augmentation.rotation",
"numpy.reshape",
"maps.Maps",
"numpy.savez",
"numpy.all"
] | [((5232, 5243), 'time.time', 'time.time', ([], {}), '()\n', (5241, 5243), False, 'import time\n'), ((483, 533), 'numpy.empty', 'np.empty', (['(0, args.obs_seq + args.pred_seq - 1, 8)'], {}), '((0, args.obs_seq + args.pred_seq - 1, 8))\n', (491, 533), True, 'import numpy as np\n'), ((550, 596), 'numpy.empty', 'np.empty'... |
# Copyright 2017 Google Inc. and Skytruth 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 agr... | [
"utility.read_vessel_multiclass_metadata",
"numpy.random.RandomState"
] | [((2400, 2423), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (2421, 2423), True, 'import numpy as np\n'), ((2931, 3044), 'utility.read_vessel_multiclass_metadata', 'utility.read_vessel_multiclass_metadata', (['all_available_mmsis', 'metadata_file', 'fishing_ranges', 'fishing_upweight'], {}), '... |
# cluster_features.py
#
# Based on snippets here:
# http://scikit-learn.org/dev/auto_examples/cluster/plot_cluster_iris.html#sphx-glr-auto-examples-cluster-plot-cluster-iris-py
from __future__ import print_function
import time
import datetime
import numpy as np
import pandas as pd
import ... | [
"sklearn.cross_validation.train_test_split",
"sklearn.preprocessing.StandardScaler",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"sklearn.cluster.KMeans",
"sklearn.metrics.accuracy_score",
"time.time",
"numpy.shape",
"matplotlib.pyplot.fig... | [((695, 730), 'pandas.read_csv', 'pd.read_csv', (['csv_filename'], {'header': '(0)'}), '(csv_filename, header=0)\n', (706, 730), True, 'import pandas as pd\n'), ((1418, 1473), 'sklearn.cross_validation.train_test_split', 'train_test_split', (['X', 'Y'], {'test_size': '(0.25)', 'random_state': '(42)'}), '(X, Y, test_siz... |
import numpy as np
from numba import jit
import pyflann
from petsc4py import PETSc
from mpi4py import MPI
from speclus4py.types import DataObject, DataType, GraphType, OperatorType, OperatorContainer
@jit(nopython=True)
def get_global_index(x, y, ydim):
return y + x * ydim
@jit(nopython=True)
def get_global_i... | [
"petsc4py.PETSc.Mat",
"speclus4py.types.DataObject.__init__",
"speclus4py.types.OperatorContainer.__init__",
"numpy.abs",
"speclus4py.types.OperatorContainer.reset",
"petsc4py.PETSc.Sys.Print",
"numba.jit",
"numpy.exp",
"numpy.linalg.norm",
"pyflann.FLANN",
"pyflann.set_distance_type",
"petsc4... | [((205, 223), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (208, 223), False, 'from numba import jit\n'), ((285, 303), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (288, 303), False, 'from numba import jit\n'), ((398, 416), 'numba.jit', 'jit', ([], {'nopython': '(True... |
from matplotlib.colors import Normalize
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pandas as pd
import numpy as np
from math import pi, log
from scipy.stats import rankdata
from argparse import ArgumentParser
if __name__ == "__main__":
... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"numpy.loadtxt"
] | [((330, 346), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (344, 346), False, 'from argparse import ArgumentParser\n'), ((736, 756), 'numpy.loadtxt', 'np.loadtxt', (['filepath'], {}), '(filepath)\n', (746, 756), True, 'import numpy as np\n'), ((1013, 1025), 'matplotlib.pyplot.figure', 'plt.figure', ([... |
"""Classes to run register functions at certain timepoints and run asynchronously"""
import threading
import time
from typing import Any, Callable, Iterable, NoReturn, Union
import numpy as np
import sc3nb
from sc3nb.osc.osc_communication import Bundler, OSCCommunication, OSCMessage
class Event:
"""Stores a ti... | [
"threading.Thread",
"numpy.empty",
"numpy.searchsorted",
"sc3nb.SC.get_default",
"time.time",
"threading.Lock",
"time.sleep",
"numpy.insert",
"threading.Event"
] | [((2418, 2434), 'numpy.empty', 'np.empty', (['(0, 2)'], {}), '((0, 2))\n', (2426, 2434), True, 'import numpy as np\n'), ((2491, 2508), 'threading.Event', 'threading.Event', ([], {}), '()\n', (2506, 2508), False, 'import threading\n'), ((2530, 2546), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2544, 2546), Fa... |
"""
Unit and regression test for the kissim.encoding.features.sitealign.SiteAlignFeature class.
"""
from pathlib import Path
import pytest
import numpy as np
import pandas as pd
from opencadd.databases.klifs import setup_local
from kissim.io import PocketBioPython
from kissim.encoding.features import SiteAlignFeatur... | [
"kissim.io.PocketBioPython.from_structure_klifs_id",
"opencadd.databases.klifs.setup_local",
"numpy.isnan",
"pytest.raises",
"pathlib.Path",
"kissim.encoding.features.SiteAlignFeature",
"kissim.encoding.features.SiteAlignFeature.from_pocket",
"pytest.mark.parametrize"
] | [((400, 446), 'opencadd.databases.klifs.setup_local', 'setup_local', (["(PATH_TEST_DATA / 'KLIFS_download')"], {}), "(PATH_TEST_DATA / 'KLIFS_download')\n", (411, 446), False, 'from opencadd.databases.klifs import setup_local\n'), ((541, 782), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""structure_klifs_... |
"""Test for the snakemake workflow distributed with region_set_profiler"""
import json
import subprocess
import os
import pandas as pd
import numpy as np
tmpdir = "/icgc/dkfzlsdf/analysis/hs_ontogeny/temp"
# TODO: gtfanno result has weird index
gtfanno_result: pd.DataFrame = pd.read_pickle(
"/icgc/dkfzlsdf/analy... | [
"json.dump",
"numpy.cumsum",
"numpy.arange",
"pandas.read_pickle",
"os.path.expanduser"
] | [((279, 460), 'pandas.read_pickle', 'pd.read_pickle', (['"""/icgc/dkfzlsdf/analysis/hs_ontogeny/results/wgbs/cohort_results/analyses/hierarchy/annotation/hierarchy-dmrs/v1/hierarchy-dmrs-anno_primary-annotations.p"""'], {}), "(\n '/icgc/dkfzlsdf/analysis/hs_ontogeny/results/wgbs/cohort_results/analyses/hierarchy/ann... |
import sys
sys.path.append("../../")
import unittest
import paddle
import numpy as np
from paddleslim import UnstructuredPruner
from paddle.vision.models import mobilenet_v1
class TestUnstructuredPruner(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestUnstructuredPruner, self).__init__(*... | [
"sys.path.append",
"unittest.main",
"numpy.random.uniform",
"paddleslim.UnstructuredPruner",
"paddle.disable_static",
"paddleslim.UnstructuredPruner.total_sparse",
"paddle.vision.models.mobilenet_v1"
] | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((2156, 2171), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2169, 2171), False, 'import unittest\n'), ((344, 367), 'paddle.disable_static', 'paddle.disable_static', ([], {}), '()\n', (365,... |
# BSD 2-CLAUSE LICENSE
# 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, this
# list of conditions and the following disclaimer.
# Redistributions i... | [
"numpy.abs",
"pandas.DatetimeIndex",
"numpy.sin",
"numpy.arange",
"inspect.getmembers",
"pandas.DataFrame",
"warnings.simplefilter",
"inspect.isclass",
"warnings.catch_warnings",
"pandas.concat",
"datetime.datetime",
"scipy.special.expit",
"pandas.to_timedelta",
"pandas.to_datetime",
"pa... | [((2738, 2769), 'pandas.to_datetime', 'pd.to_datetime', (['df[time_col][0]'], {}), '(df[time_col][0])\n', (2752, 2769), True, 'import pandas as pd\n'), ((6696, 6716), 'pandas.DatetimeIndex', 'pd.DatetimeIndex', (['dt'], {}), '(dt)\n', (6712, 6716), True, 'import pandas as pd\n'), ((11951, 11978), 'pandas.DataFrame', 'p... |
# coding: utf-8
# In[2]:
#start of code
#importing packages
import numpy as np
import scipy.signal as sp
import matplotlib.pyplot as plt
# In[3]:
def time_domain_output(f,H,t_start,t_end):
t = np.linspace(t_start,t_end,10*(t_end-t_start))
t2,y,svec=sp.lsim(H,f,t)
return y
# In[4]:
t_start ... | [
"matplotlib.pyplot.title",
"numpy.poly1d",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.signal.impulse",
"matplotlib.pyplot.legend",
"scipy.signal.lsim",
"matplotlib.pyplot.grid",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"... | [((340, 391), 'numpy.linspace', 'np.linspace', (['t_start', 't_end', '(10 * (t_end - t_start))'], {}), '(t_start, t_end, 10 * (t_end - t_start))\n', (351, 391), True, 'import numpy as np\n'), ((441, 466), 'scipy.signal.lti', 'sp.lti', (['[1]', '[1, 0, 2.25]'], {}), '([1], [1, 0, 2.25])\n', (447, 466), True, 'import sci... |
import sys, time, os, json
import numpy as np
import matplotlib.pylab as plt
from PIL import Image
from keras.models import *
from keras.layers import *
from keras.optimizers import *
from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization
from google.colab import drive
def... | [
"matplotlib.pylab.imshow",
"numpy.ones",
"matplotlib.pylab.axis",
"os.path.isfile",
"sys.stdout.flush",
"matplotlib.pylab.title",
"matplotlib.pylab.show",
"matplotlib.pylab.figure",
"numpy.random.choice",
"numpy.add",
"json.dump",
"google.colab.drive.mount",
"numpy.memmap",
"numpy.concaten... | [((2246, 2319), 'numpy.memmap', 'np.memmap', (['path'], {'dtype': 'np.uint8', 'mode': '"""r"""', 'shape': '((train_num,) + img_shape)'}), "(path, dtype=np.uint8, mode='r', shape=(train_num,) + img_shape)\n", (2255, 2319), True, 'import numpy as np\n'), ((2365, 2390), 'os.path.isfile', 'os.path.isfile', (['json_name'], ... |
import argparse
import os
import sys
import cv2
import numpy as np
from matplotlib import pyplot as plt
from functools import cmp_to_key
from fhi_lib.geometry import Point, Line
class DistanceEstimator():
def __init__(self, img):
self.img = img
self.panel_length = 2235
self.scale_length = 100
def initialize... | [
"cv2.GaussianBlur",
"cv2.contourArea",
"numpy.absolute",
"cv2.dilate",
"cv2.cvtColor",
"cv2.getStructuringElement",
"cv2.approxPolyDP",
"fhi_lib.geometry.Line",
"numpy.min",
"fhi_lib.geometry.Point",
"cv2.convexHull",
"cv2.erode",
"cv2.inRange",
"cv2.findContours"
] | [((574, 583), 'fhi_lib.geometry.Point', 'Point', (['pt'], {}), '(pt)\n', (579, 583), False, 'from fhi_lib.geometry import Point, Line\n'), ((1635, 1672), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['self.img', '(5, 5)', '(0)'], {}), '(self.img, (5, 5), 0)\n', (1651, 1672), False, 'import cv2\n'), ((1684, 1721), 'cv2.cvtC... |
from distutils.core import setup, Extension
import glob
import numpy
import config
import sys
import os
from config import ROOT
includes = [os.path.join(ROOT,"Include"),os.path.join(ROOT,"PrivateInclude"),os.path.join("cmsisdsp_pkg","src")]
if sys.platform == 'win32':
cflags = ["-DWIN",config.cflags,"-DUNALIGNED_SU... | [
"numpy.get_include",
"os.path.join",
"distutils.core.setup"
] | [((3420, 3826), 'distutils.core.setup', 'setup', ([], {'name': 'config.setupName', 'version': '"""0.0.1"""', 'description': 'config.setupDescription', 'ext_modules': '[module1]', 'author': '"""Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved."""', 'url': '"""https://github.com/ARM-software/CMS... |
# Copyright 2021, The TensorFlow 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 t... | [
"tensorflow.test.main",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"numpy.minimum",
"tensorflow.keras.losses.MeanSquaredError",
"tensorflow.keras.layers.Dense",
"numpy.std",
"tensorflow.keras.optimizers.SGD",
"numpy.zeros",
"tensorflow.keras.layers.InputLayer",
"numpy.mean",
"numpy... | [((946, 964), 'numpy.array', 'np.array', (['[[3, 4]]'], {}), '([[3, 4]])\n', (954, 964), True, 'import numpy as np\n'), ((2029, 2153), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('l2_norm_clip 10.0', 10.0)", "('l2_norm_clip 40.0', 40.0)", "('l2_norm_clip 200.0', 200.0)"], {}), "... |
"""
Here I am going to convert array to image from it's pixel value and put those images in their respective directory for
both in train and test set.
train set -------> [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
test set -------> [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
"""
# Import requi... | [
"os.mkdir",
"os.getcwd",
"cv2.imwrite",
"numpy.asarray",
"os.path.join",
"os.listdir"
] | [((841, 852), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (850, 852), False, 'import os\n'), ((1457, 1488), 'os.path.join', 'os.path.join', (['parent_dir', 'label'], {}), '(parent_dir, label)\n', (1469, 1488), False, 'import os\n'), ((1644, 1666), 'os.listdir', 'os.listdir', (['parent_dir'], {}), '(parent_dir)\n', (165... |
import argparse
import numpy as np
from astropy.io import fits
from numba import jit
class DragonPedestal:
n_pixels = 7
roisize = 40
size4drs = 4*1024
high_gain = 0
low_gain = 1
def __init__(self):
self.first_capacitor = np.zeros((2, 8))
self.meanped = np.zeros((2, self.n_pixe... | [
"numpy.zeros",
"numba.jit"
] | [((1068, 1086), 'numba.jit', 'jit', ([], {'parallel': '(True)'}), '(parallel=True)\n', (1071, 1086), False, 'from numba import jit\n'), ((2238, 2254), 'numpy.zeros', 'np.zeros', (['(2, 8)'], {}), '((2, 8))\n', (2246, 2254), True, 'import numpy as np\n'), ((256, 272), 'numpy.zeros', 'np.zeros', (['(2, 8)'], {}), '((2, 8... |
#TODO: move this to pioneer.das.acquisition
from pioneer.das.api import platform
try:
import folium #pip3 install folium
except:
pass
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import tqdm
import utm
def easting_northing_from_lat_long(latitude, longitude):
easting, northing, ... | [
"utm.from_latlon",
"numpy.zeros_like",
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.maximum",
"numpy.minimum",
"numpy.std",
"numpy.copy",
"pioneer.das.api.platform.Platform",
"numpy.diff",
"numpy.array",
"numpy.mean",
"folium.Map",
"folium.PolyLine",
"matplotlib.pyplot.subplots"
] | [((327, 363), 'utm.from_latlon', 'utm.from_latlon', (['latitude', 'longitude'], {}), '(latitude, longitude)\n', (342, 363), False, 'import utm\n'), ((455, 471), 'numpy.diff', 'np.diff', (['easting'], {}), '(easting)\n', (462, 471), True, 'import numpy as np\n'), ((482, 499), 'numpy.diff', 'np.diff', (['northing'], {}),... |
import os.path as osp
import numpy as np
import mmcv
from . import XMLDataset
from .builder import DATASETS
import xml.etree.ElementTree as ET
from PIL import Image
@DATASETS.register_module()
class LogosDataset(XMLDataset):
def load_annotations(self, ann_file):
"""Load annotation from XML style ann_... | [
"xml.etree.ElementTree.parse",
"PIL.Image.open",
"numpy.arange",
"mmcv.list_from_file",
"os.path.join"
] | [((578, 607), 'mmcv.list_from_file', 'mmcv.list_from_file', (['ann_file'], {}), '(ann_file)\n', (597, 607), False, 'import mmcv\n'), ((1875, 1901), 'numpy.arange', 'np.arange', (['(0.5)', '(0.96)', '(0.05)'], {}), '(0.5, 0.96, 0.05)\n', (1884, 1901), True, 'import numpy as np\n'), ((712, 769), 'os.path.join', 'osp.join... |
import csv
import os
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
#from sklearn.neighbors import NearestNeighbors
from path import Path
from vector_math import *
from find_matches import *
import search_matches
#********************
#**** this compares two sets of an... | [
"search_matches.match_angles",
"matplotlib.pyplot.show",
"numpy.amin",
"numpy.subtract",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axis",
"numpy.amax",
"matplotlib.pyplot.figure",
"search_matches.max_distance_between_segments",
"numpy.... | [((1257, 1353), 'search_matches.match_angles', 'search_matches.match_angles', (['path1_angles', 'path2_angles', 'angle_tolerance', 'distance_tolerance'], {}), '(path1_angles, path2_angles, angle_tolerance,\n distance_tolerance)\n', (1284, 1353), False, 'import search_matches\n'), ((9746, 9784), 'numpy.array', 'np.ar... |
import os
import glob
from shutil import copy2
from PIL import Image
import json
import numpy as np
import argparse
import shutil
from skimage import io
from tqdm import tqdm
class NpEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
eli... | [
"json.dump",
"shutil.copytree",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.median",
"os.path.basename",
"os.path.exists",
"os.path.isfile",
"numpy.where",
"numpy.array",
"os.rmdir",
"os.symlink",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((558, 577), 'os.path.exists', 'os.path.exists', (['dst'], {}), '(dst)\n', (572, 577), False, 'import os\n'), ((605, 630), 'shutil.copytree', 'shutil.copytree', (['src', 'dst'], {}), '(src, dst)\n', (620, 630), False, 'import shutil\n'), ((696, 717), 'os.listdir', 'os.listdir', (['inst_root'], {}), '(inst_root)\n', (7... |
import torch
import scipy.fft
import numpy as np
from functools import lru_cache
@lru_cache()
def compute_dct_mat(n: int, device: str, dtype: torch.dtype) -> torch.Tensor:
m = scipy.fft.dct(np.eye(n), norm="ortho")
return torch.tensor(m, device=device, dtype=dtype)
@lru_cache()
def compute_idct_mat(n: int, ... | [
"torch.einsum",
"functools.lru_cache",
"numpy.eye",
"torch.tensor"
] | [((84, 95), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (93, 95), False, 'from functools import lru_cache\n'), ((279, 290), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (288, 290), False, 'from functools import lru_cache\n'), ((232, 275), 'torch.tensor', 'torch.tensor', (['m'], {'device': 'device', '... |
import numpy as np
def day_1(file: str):
"""Read in day 1 part 1 input and count increasing values"""
with open(file) as f:
data_in = f.read()
# convert data to float
data = [float(i) for i in data_in.split()]
# Part 1
print(sum(np.diff(np.array(data)) > 0))
# Part 2
convolut... | [
"numpy.diff",
"numpy.array"
] | [((443, 463), 'numpy.diff', 'np.diff', (['convolution'], {}), '(convolution)\n', (450, 463), True, 'import numpy as np\n'), ((272, 286), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (280, 286), True, 'import numpy as np\n')] |
from util import get_dataset
from sklearn.metrics import classification_report
import numpy as np
from keras.layers import Dense, Input, concatenate
from keras.models import Model
from keras import backend as K
def recall_m(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
po... | [
"keras.backend.epsilon",
"util.get_dataset",
"keras.models.Model",
"keras.layers.Dense",
"numpy.array",
"keras.layers.Input",
"keras.layers.concatenate",
"keras.backend.clip"
] | [((988, 1012), 'keras.layers.Input', 'Input', ([], {'shape': '(bert_dim,)'}), '(shape=(bert_dim,))\n', (993, 1012), False, 'from keras.layers import Dense, Input, concatenate\n'), ((1326, 1353), 'keras.layers.Input', 'Input', ([], {'shape': '(profile_dim,)'}), '(shape=(profile_dim,))\n', (1331, 1353), False, 'from kera... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in September 2017
@author: mmalekzadeh
"""
import numpy as np
from keras.models import model_from_json
from keras import backend as K
def mcor(y_true, y_pred):
#matthews_correlation
y_pred_pos = K.round(K.clip(y_pred, 0, 1))
y_pred_neg = 1 - y_... | [
"matplotlib.pyplot.title",
"numpy.load",
"numpy.argmax",
"keras.backend.epsilon",
"matplotlib.pyplot.tight_layout",
"keras.backend.sqrt",
"numpy.set_printoptions",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.colorbar",
"numpy.append",
"matplotlib.pyplot.xticks",
... | [((1666, 1695), 'numpy.load', 'np.load', (['"""all_inferences.npy"""'], {}), "('all_inferences.npy')\n", (1673, 1695), True, 'import numpy as np\n'), ((2014, 2044), 'numpy.load', 'np.load', (['"""data_test_white.npy"""'], {}), "('data_test_white.npy')\n", (2021, 2044), True, 'import numpy as np\n'), ((2061, 2091), 'num... |
import numpy as np
from scipy.integrate import odeint
from matplotlib import pyplot as plt
def calc_derivative(ypos, time):
return -2*ypos
time_vec = np.linspace(0, 4, 40)
yvec = odeint(calc_derivative, 1, time_vec)
plt.figure(figsize=(4, 3))
plt.plot(time_vec, yvec)
plt.xlabel('t: Time')
plt.ylabel('y: Position... | [
"matplotlib.pyplot.plot",
"scipy.integrate.odeint",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tight_layout"
] | [((156, 177), 'numpy.linspace', 'np.linspace', (['(0)', '(4)', '(40)'], {}), '(0, 4, 40)\n', (167, 177), True, 'import numpy as np\n'), ((185, 221), 'scipy.integrate.odeint', 'odeint', (['calc_derivative', '(1)', 'time_vec'], {}), '(calc_derivative, 1, time_vec)\n', (191, 221), False, 'from scipy.integrate import odein... |
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import scipy.io as sio
import seaborn as sns
import matplotlib.pyplot as plt
import wget
import os
from random import shuffle
import cv2
from PIL import Image
sns.set_style("white")
# ----------------------Downloading DATA-------------... | [
"matplotlib.pyplot.title",
"os.mkdir",
"scipy.io.loadmat",
"random.shuffle",
"matplotlib.pyplot.tight_layout",
"numpy.unique",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"numpy.transpose",
"os.path.exists",
"matplotlib.pyplot.xticks",
"cv2.resize",
"seaborn.set_style",
"cv2.eq... | [((17, 50), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (40, 50), False, 'import warnings\n'), ((241, 263), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (254, 263), True, 'import seaborn as sns\n'), ((2080, 2120), 'scipy.io.loadmat', 'sio.... |
import numpy as np
from mmdet.datasets import PIPELINES
from mmdet.datasets.pipelines.formating import Collect
from ssod.core import TrimapMasks
@PIPELINES.register_module()
class ExtraAttrs(object):
def __init__(self, **attrs):
self.attrs = attrs
def __call__(self, results):
for k, v in sel... | [
"numpy.zeros",
"mmdet.datasets.PIPELINES.register_module",
"numpy.ones"
] | [((149, 176), 'mmdet.datasets.PIPELINES.register_module', 'PIPELINES.register_module', ([], {}), '()\n', (174, 176), False, 'from mmdet.datasets import PIPELINES\n'), ((426, 453), 'mmdet.datasets.PIPELINES.register_module', 'PIPELINES.register_module', ([], {}), '()\n', (451, 453), False, 'from mmdet.datasets import PI... |
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... | [
"pandas.DataFrame",
"dateutil.parser.parse",
"decimal.Decimal",
"pandas.read_csv",
"time.sleep",
"solana.publickey.PublicKey",
"os.path.isfile",
"numpy.where",
"datetime.timedelta",
"requests.get",
"pandas.concat",
"logging.getLogger"
] | [((2888, 2930), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (2905, 2930), False, 'import logging\n'), ((3061, 3107), 'pandas.DataFrame', 'pandas.DataFrame', ([], {'columns': 'TradeHistory.COLUMNS'}), '(columns=TradeHistory.COLUMNS)\n', (3077, 3107), False,... |
import numpy as np
import pandas as pd
import os
from collections import Counter
from scipy.stats import hypergeom
fdr_threshold = 0.05
def main():
os.makedirs('results/enrichment', exist_ok=True)
os.makedirs('results/GO', exist_ok=True)
# LOAD
# single cell gene data
all_gene_data = pd.read_cs... | [
"scipy.stats.hypergeom.sf",
"pandas.DataFrame",
"os.makedirs",
"pandas.read_csv",
"numpy.savetxt",
"numpy.hstack",
"numpy.array",
"numpy.squeeze",
"numpy.unique",
"numpy.repeat"
] | [((156, 204), 'os.makedirs', 'os.makedirs', (['"""results/enrichment"""'], {'exist_ok': '(True)'}), "('results/enrichment', exist_ok=True)\n", (167, 204), False, 'import os\n'), ((209, 249), 'os.makedirs', 'os.makedirs', (['"""results/GO"""'], {'exist_ok': '(True)'}), "('results/GO', exist_ok=True)\n", (220, 249), Fals... |
"""
Mask R-CNN
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for examples), or run from
the command line as such:
# Train a new model starting from pre-trained COCO weights
python3 auto.py train --dataset=/path/to/auto/dataset --weights=coc... | [
"numpy.sum",
"argparse.ArgumentParser",
"cv2.VideoWriter_fourcc",
"numpy.arange",
"mrcnn.model.MaskRCNN",
"os.path.join",
"sys.path.append",
"mrcnn.utils.download_trained_weights",
"os.path.abspath",
"os.path.exists",
"datetime.datetime.now",
"numpy.stack",
"math.isnan",
"os.listdir",
"n... | [((1002, 1024), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (1017, 1024), False, 'import os\n'), ((1045, 1070), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (1060, 1070), False, 'import sys\n'), ((1262, 1305), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mas... |
import cv2
import numpy as np
from skimage.viewer import ImageViewer
def remove_rows(image, rows, cols):
newrows = int(rows / 2)
newimg = np.zeros((newrows, cols), np.uint8)
for r in range(1, newrows + 1):
newimg[r - 1:r, :] = image[r * 2 - 1:r * 2, :]
return newimg
img = cv2.imread('pirate.... | [
"cv2.imread",
"skimage.viewer.ImageViewer",
"numpy.zeros"
] | [((301, 347), 'cv2.imread', 'cv2.imread', (['"""pirate.jpg"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('pirate.jpg', cv2.IMREAD_GRAYSCALE)\n", (311, 347), False, 'import cv2\n'), ((426, 442), 'skimage.viewer.ImageViewer', 'ImageViewer', (['img'], {}), '(img)\n', (437, 442), False, 'from skimage.viewer import ImageViewer\n'), ... |
# -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as p
import numpy as n
import pylab
import scipy.stats as stats
import networkx as nwx
import glob
import builtins
from matplotlib.pyplot import margins
import os.path
import json
from sklearn import svm, cross_validation, datas... | [
"matplotlib.pyplot.subplot",
"sklearn.cross_validation.train_test_split",
"sklearn.svm.SVC",
"numpy.genfromtxt",
"matplotlib.use",
"glob.glob",
"matplotlib.pyplot.savefig"
] | [((50, 64), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (57, 64), True, 'import matplotlib as mpl\n'), ((870, 884), 'matplotlib.pyplot.subplot', 'p.subplot', (['(111)'], {}), '(111)\n', (879, 884), True, 'import matplotlib.pyplot as p\n'), ((1182, 1214), 'matplotlib.pyplot.savefig', 'p.savefig', (['"... |
# MIT License.
# Copyright (c) 2021 by BioicDL. All rights reserved.
# Created by LiuXb on 2021/1/5
# -*- coding:utf-8 -*-
"""
@Modified:
@Description:
"""
import time
import cv2
import numpy as np
class BackgroundDetector(object):
def __init__(self):
self.fgmask = None
self.fgbg = None
de... | [
"cv2.GaussianBlur",
"cv2.medianBlur",
"deepclaw.driver.sensors.camera.Realsense_L515.Realsense",
"cv2.erode",
"cv2.imshow",
"cv2.inRange",
"cv2.dilate",
"cv2.cvtColor",
"cv2.imwrite",
"numpy.max",
"cv2.drawContours",
"numpy.uint8",
"cv2.bitwise_not",
"numpy.ones_like",
"cv2.waitKey",
"... | [((6489, 6547), 'deepclaw.driver.sensors.camera.Realsense_L515.Realsense', 'Realsense', (['"""./configs/basic_config/camera_rs_d435_c1.yaml"""'], {}), "('./configs/basic_config/camera_rs_d435_c1.yaml')\n", (6498, 6547), False, 'from deepclaw.driver.sensors.camera.Realsense_L515 import Realsense\n'), ((6616, 6629), 'tim... |
from pydata import Data, h5todata
import numpy as np
import os
import h5py
def test_Data(tmpdir):
o = Data(x=np.ones(3), y=np.ones(3), a=5, b='hh')
assert o.b=='hh'
assert o['a']==5
o.append(np.ones(5),np.ones(5))
o.save(os.path.join(tmpdir, 'test.txt'))
o.save(os.path.join(tmpdir, 'test.h5'))
... | [
"os.path.join",
"pydata.h5todata",
"numpy.ones"
] | [((510, 533), 'pydata.h5todata', 'h5todata', (["f['data0000']"], {}), "(f['data0000'])\n", (518, 533), False, 'from pydata import Data, h5todata\n'), ((208, 218), 'numpy.ones', 'np.ones', (['(5)'], {}), '(5)\n', (215, 218), True, 'import numpy as np\n'), ((219, 229), 'numpy.ones', 'np.ones', (['(5)'], {}), '(5)\n', (22... |
__author__ = "<NAME>"
__license__ = "MIT"
__email__ = "<EMAIL>"
"""
Todo:
[Organized HIGH to LOW priority...]
Organize in Functions better -
Remove Redundant Code & Optimize -
"""
# Modules required
import pygame
import time
import numpy
from typing import List
# Initialize global variables
pygame... | [
"pygame.draw.line",
"pygame.event.get",
"pygame.Rect",
"pygame.display.update",
"pygame.font.Font",
"pygame.mouse.get_pos",
"numpy.copy",
"pygame.display.set_mode",
"pygame.quit",
"pygame.mouse.get_pressed",
"pygame.draw.rect",
"pygame.init",
"numpy.sort",
"numpy.random.permutation",
"py... | [((314, 327), 'pygame.init', 'pygame.init', ([], {}), '()\n', (325, 327), False, 'import pygame\n'), ((376, 417), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(SQ_DIM, SQ_DIM)'], {}), '((SQ_DIM, SQ_DIM))\n', (399, 417), False, 'import pygame\n'), ((425, 444), 'pygame.time.Clock', 'pygame.time.Clock', ([], {... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
The basic algorithm simulation archtecture of the C/C++ system
"""
import numpy as np
PRIME= np.array([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
157, 163, 167, ... | [
"numpy.array"
] | [((142, 2882), 'numpy.array', 'np.array', (['[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, \n 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, \n 229, 233, 239, 241, 251, 257, 263, 269, 2... |
import numpy as np
import scipy as sp
import scipy.stats
from ngboost.distns import Normal, Laplace, LogNormal, LogLaplace
from ngboost.ngboost import NGBoost
from ngboost.scores import MLE, CRPS, MLE_SURV, CRPS_SURV
from ngboost.learners import default_tree_learner, default_linear_learner
from ngboost.evaluation impor... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"scipy.stats.laplace.rvs",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.log",
"numpy.random.randn",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"ngboost.scores.CRPS",
"matplotlib.pyplot.savefi... | [((480, 496), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (494, 496), False, 'from argparse import ArgumentParser\n'), ((866, 887), 'numpy.random.randn', 'np.random.randn', (['n', '(1)'], {}), '(n, 1)\n', (881, 887), True, 'import numpy as np\n'), ((939, 969), 'numpy.exp', 'np.exp', (['(X @ beta + 0.... |
from __future__ import print_function
import sys
import os
import numpy as np
from multiprocessing import Pool, freeze_support
import tempfile
from impy.definitions import *
from impy.constants import *
from impy.kinematics import EventKinematics
from impy import impy_config, pdata
from impy.util import info
# AF: T... | [
"numpy.abs",
"impy.util.info",
"tempfile.mkstemp",
"impy.kinematics.EventKinematics",
"numpy.histogram",
"os.path.splitext",
"numpy.linspace",
"multiprocessing.Pool",
"multiprocessing.freeze_support"
] | [((608, 663), 'impy.kinematics.EventKinematics', 'EventKinematics', ([], {'ecm': '(7000 * GeV)', 'p1pdg': '(2212)', 'p2pdg': '(2212)'}), '(ecm=7000 * GeV, p1pdg=2212, p2pdg=2212)\n', (623, 663), False, 'from impy.kinematics import EventKinematics\n'), ((1144, 1165), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(21... |
# -*- coding: utf-8 -*-
"""
@author: abhilash
"""
import numpy as np
import cv2
# load the image to detect, get width, height
# resize to match input size, convert to blob to pass into model
img_to_detect = cv2.imread('images/testing/scene3.jpg')
img_height = img_to_detect.shape[0]
img_width = img_to_... | [
"cv2.putText",
"cv2.dnn.blobFromImage",
"cv2.rectangle",
"cv2.imread",
"numpy.arange",
"numpy.array",
"cv2.dnn.readNetFromCaffe",
"cv2.imshow",
"cv2.resize"
] | [((223, 262), 'cv2.imread', 'cv2.imread', (['"""images/testing/scene3.jpg"""'], {}), "('images/testing/scene3.jpg')\n", (233, 262), False, 'import cv2\n'), ((361, 398), 'cv2.resize', 'cv2.resize', (['img_to_detect', '(300, 300)'], {}), '(img_to_detect, (300, 300))\n', (371, 398), False, 'import cv2\n'), ((409, 482), 'c... |
from utils.data_loader import MNIST
from models.gru import GRU
from models.tcn import TCN
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
# 1エポック学習します
def train(model, optimizer, train_loader, log_interval=10):
model.train()
loss_... | [
"numpy.random.seed",
"models.tcn.TCN",
"torch.manual_seed",
"torch.autograd.Variable",
"torch.load",
"utils.data_loader.MNIST",
"torch.nn.functional.nll_loss",
"numpy.random.permutation",
"models.gru.GRU",
"torch.no_grad"
] | [((2284, 2389), 'utils.data_loader.MNIST', 'MNIST', ([], {'batch_size': 'batch_size', 'sequential': "(arch == 'tcn')", 'sequential_rnn': "(arch != 'tcn')", 'permute': 'permute'}), "(batch_size=batch_size, sequential=arch == 'tcn', sequential_rnn=arch !=\n 'tcn', permute=permute)\n", (2289, 2389), False, 'from utils.... |
import streamlit as st
import numpy as np
import pickle
from sklearn.tree import DecisionTreeClassifier
#model = DecisionTreeClassifier(max_depth=8)
model = pickle.load(open('model.pickle','rb'))
st.write("""
# CoverMyMeds - PA Approval Chances
""")
st.write("This project was done as part of the Erdos Data Science... | [
"streamlit.header",
"numpy.round",
"streamlit.radio",
"streamlit.write"
] | [((200, 253), 'streamlit.write', 'st.write', (['"""\n# CoverMyMeds - PA Approval Chances\n"""'], {}), '("""\n# CoverMyMeds - PA Approval Chances\n""")\n', (208, 253), True, 'import streamlit as st\n'), ((255, 390), 'streamlit.write', 'st.write', (['"""This project was done as part of the Erdos Data Science bootcamp Fal... |
# Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... | [
"absl.testing.absltest.main",
"alphafold_paddle.common.protein.from_pdb_string",
"alphafold_paddle.relax.utils.overwrite_b_factors",
"absl.testing.absltest.get_default_test_srcdir",
"numpy.where",
"numpy.arange"
] | [((1994, 2009), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (2007, 2009), False, 'from absl.testing import absltest\n'), ((1181, 1226), 'alphafold_paddle.relax.utils.overwrite_b_factors', 'utils.overwrite_b_factors', (['test_pdb', 'bfactors'], {}), '(test_pdb, bfactors)\n', (1206, 1226), False, 'fr... |
from __future__ import print_function
import numpy as np
from numpy import cos, sin
from numpy.testing import assert_equal
import unittest
import pcl
from pcl.registration import icp, gicp, icp_nl, ia_ransac
bun0Tobun4 = [[0.85250509, -0.03745676, -0.52137518, 0.04118973],
[0.03552843, 0.999... | [
"pcl.registration.icp",
"numpy.testing.assert_allclose",
"numpy.allclose",
"numpy.random.RandomState",
"numpy.sin",
"numpy.testing.assert_equal",
"numpy.cos",
"numpy.dot",
"pcl.PointCloud"
] | [((1603, 1620), 'pcl.PointCloud', 'pcl.PointCloud', (['a'], {}), '(a)\n', (1617, 1620), False, 'import pcl\n'), ((1670, 1686), 'pcl.PointCloud', 'pcl.PointCloud', ([], {}), '()\n', (1684, 1686), False, 'import pcl\n'), ((1757, 1773), 'pcl.PointCloud', 'pcl.PointCloud', ([], {}), '()\n', (1771, 1773), False, 'import pcl... |
# License: BSD 3 clause
import unittest
import numpy as np
from scipy.sparse import csr_matrix
from tick.robust import ModelHuber
from tick.base_model.tests.generalized_linear_model import TestGLM
from tick.linear_model import SimuLinReg
class Test(TestGLM):
def test_ModelHuber(self):
"""...Numerical c... | [
"unittest.main",
"tick.linear_model.SimuLinReg",
"numpy.random.seed",
"numpy.random.randn",
"scipy.sparse.csr_matrix",
"tick.robust.ModelHuber"
] | [((3225, 3240), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3238, 3240), False, 'import unittest\n'), ((394, 412), 'numpy.random.seed', 'np.random.seed', (['(12)'], {}), '(12)\n', (408, 412), True, 'import numpy as np\n'), ((467, 494), 'numpy.random.randn', 'np.random.randn', (['n_features'], {}), '(n_features... |
"""
Tests for CameraCalibrator and related functions
"""
import numpy as np
import pytest
from scipy.stats import norm
from traitlets.config.configurable import Config
from astropy import units as u
from ctapipe.calib.camera.calibrator import CameraCalibrator
from ctapipe.image.extractor import LocalPeakWindowSum, Ful... | [
"numpy.full",
"ctapipe.instrument.CameraGeometry.from_name",
"ctapipe.image.extractor.FullWaveformSum",
"ctapipe.containers.DataContainer",
"ctapipe.calib.camera.calibrator.CameraCalibrator",
"pytest.warns",
"pytest.fixture",
"scipy.stats.norm.pdf",
"numpy.random.RandomState",
"ctapipe.image.extra... | [((427, 459), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (441, 459), False, 'import pytest\n'), ((642, 677), 'ctapipe.calib.camera.calibrator.CameraCalibrator', 'CameraCalibrator', ([], {'subarray': 'subarray'}), '(subarray=subarray)\n', (658, 677), False, 'from ctapi... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import logging
import numpy as np
import torch
from d2go.data.dataset_mappers.d2go_dataset_mapper import D2GoDatasetMapper
from detectron2.data import detection_utils as utils, transforms as T
from detectron2.st... | [
"copy.deepcopy",
"detectron2.structures.RotatedBoxes",
"detectron2.data.transforms.apply_transform_gens",
"detectron2.data.detection_utils.check_image_size",
"numpy.array",
"detectron2.structures.Instances",
"numpy.random.choice",
"torch.tensor",
"detectron2.structures.BoxMode.convert",
"logging.g... | [((426, 453), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (443, 453), False, 'import logging\n'), ((702, 729), 'copy.deepcopy', 'copy.deepcopy', (['dataset_dict'], {}), '(dataset_dict)\n', (715, 729), False, 'import copy\n'), ((886, 929), 'detectron2.data.detection_utils.check_image_si... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The base image interface.
"""
import numpy as np
from scipy import ndimage
# Local imports
from .image import Image
from ..transforms.affines import to_matrix_vector
from ..reference.coordinate_system... | [
"copy.deepcopy",
"numpy.set_printoptions",
"numpy.abs",
"numpy.empty",
"numpy.asarray",
"numpy.identity",
"numpy.array",
"numpy.reshape",
"numpy.atleast_1d",
"numpy.all",
"numpy.get_printoptions"
] | [((2983, 3001), 'numpy.asarray', 'np.asarray', (['affine'], {}), '(affine)\n', (2993, 3001), True, 'import numpy as np\n'), ((4689, 4711), 'numpy.asarray', 'np.asarray', (['self._data'], {}), '(self._data)\n', (4699, 4711), True, 'import numpy as np\n'), ((11743, 11759), 'numpy.atleast_1d', 'np.atleast_1d', (['x'], {})... |
import numpy as np
from mayavi import mlab
import os
from roots.swcToolkit import swcToolkit
class swcVisualizer():
"""
mfile = 'fileonpath.swc'
visualizer = swcVisualizer()
visualizer.mplot_mfile(mfile)
"""
def __init__(self):
self.swcTool = swcToolkit()
def create_cylinders(self,coords,diams,data... | [
"mayavi.mlab.figure",
"mayavi.mlab.show",
"roots.swcToolkit.swcToolkit",
"numpy.zeros",
"mayavi.mlab.plot3d",
"mayavi.mlab.points3d",
"mayavi.mlab.close",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.linalg.norm",
"numpy.cos",
"numpy.dot",
"mayavi.mlab.view",
"mayavi.mlab.triangula... | [((261, 273), 'roots.swcToolkit.swcToolkit', 'swcToolkit', ([], {}), '()\n', (271, 273), False, 'from roots.swcToolkit import swcToolkit\n'), ((2611, 2622), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (2619, 2622), True, 'import numpy as np\n'), ((2629, 2640), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (2637... |
"""
Unit tests to verify utility_rank module.
"""
import unittest
import numpy as np
from pymcdm import weights
from utility_weights import UtilityWeights
class TestUtilityNormalization(unittest.TestCase):
"""
Class used for the verification of implementation of normalization formulas
"""
def setUp(sel... | [
"unittest.main",
"utility_weights.UtilityWeights",
"pymcdm.weights.equal_weights",
"numpy.testing.assert_array_equal",
"numpy.array"
] | [((1788, 1803), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1801, 1803), False, 'import unittest\n'), ((348, 418), 'numpy.array', 'np.array', (['[[1, 1, 2, 3, 3, 1], [2, 3, 1, 2, 1, 2], [4, 5, 3, 1, 2, 3]]'], {}), '([[1, 1, 2, 3, 3, 1], [2, 3, 1, 2, 1, 2], [4, 5, 3, 1, 2, 3]])\n', (356, 418), True, 'import num... |
# -*- coding: utf-8 -*-
# Copyright 2018 IBM RESEARCH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"numpy.zeros",
"qiskit.converters.circuit_to_dag"
] | [((1402, 1413), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (1410, 1413), True, 'import numpy as np\n'), ((1471, 1494), 'qiskit.converters.circuit_to_dag', 'circuit_to_dag', (['circuit'], {}), '(circuit)\n', (1485, 1494), False, 'from qiskit.converters import circuit_to_dag\n')] |
"""
References:
-----------
[1] http://2019.icbeb.org/Challenge.html
"""
import math
from typing import Union, Optional, Sequence
from numbers import Real
import numpy as np
__all__ = [
"compute_metrics",
]
def compute_metrics(rpeaks_truths:Sequence[Union[np.ndarray,Sequence[int]]], rpeaks_preds:Sequence[Union... | [
"math.isnan",
"numpy.abs",
"numpy.sum",
"numpy.where",
"numpy.array"
] | [((3230, 3251), 'math.isnan', 'math.isnan', (['hr_ans[i]'], {}), '(hr_ans[i])\n', (3240, 3251), False, 'import math\n'), ((2860, 2880), 'numpy.sum', 'np.sum', (['record_flags'], {}), '(record_flags)\n', (2866, 2880), True, 'import numpy as np\n'), ((4953, 4973), 'numpy.sum', 'np.sum', (['record_flags'], {}), '(record_f... |
import os
import time
import pandas as pd
import numpy as np
import tsam.timeseriesaggregation as tsam
def test_segmentation():
raw = pd.read_csv(os.path.join(os.path.dirname(__file__),'..','examples','testdata.csv'), index_col = 0)
orig_raw = pd.read_csv(os.path.join(os.path.dirname(__file__),'..','exam... | [
"numpy.testing.assert_array_almost_equal",
"os.path.dirname",
"tsam.timeseriesaggregation.TimeSeriesAggregation",
"time.time"
] | [((407, 418), 'time.time', 'time.time', ([], {}), '()\n', (416, 418), False, 'import time\n'), ((438, 577), 'tsam.timeseriesaggregation.TimeSeriesAggregation', 'tsam.TimeSeriesAggregation', (['raw'], {'noTypicalPeriods': '(20)', 'hoursPerPeriod': '(24)', 'clusterMethod': '"""hierarchical"""', 'segmentation': '(True)', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.