code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 1 13:11:48 2019 @author: kenneth """ from __future__ import absolute_import import numpy as np class Kernels: ''' Kernels are mostly used for solving non-lineaar problems. By projecting/transforming our data into a subspace, maki...
[ "sklearn.metrics.pairwise.chi2_kernel", "numpy.linalg.norm", "numpy.ones" ]
[((3981, 3995), 'sklearn.metrics.pairwise.chi2_kernel', 'chi2_kernel', (['x'], {}), '(x)\n', (3992, 3995), False, 'from sklearn.metrics.pairwise import chi2_kernel\n'), ((5308, 5329), 'numpy.linalg.norm', 'np.linalg.norm', (['x2', '(1)'], {}), '(x2, 1)\n', (5322, 5329), True, 'import numpy as np\n'), ((5284, 5305), 'nu...
from __future__ import division import csv import numpy as np from tqdm import tqdm import random import os def open_npz(path,key): data = np.load(path)[key] return data data_folder = '/home/batool/beam_selection/baseline_data/' save_folder = '/home/batool/beam_selection/baseline_code_modified/jen/' outp...
[ "numpy.load", "numpy.savez_compressed" ]
[((517, 543), 'numpy.load', 'np.load', (['output_train_file'], {}), '(output_train_file)\n', (524, 543), True, 'import numpy as np\n'), ((696, 762), 'numpy.savez_compressed', 'np.savez_compressed', (["(save_folder + 'train32.npz')"], {'train32': 'ytrain32'}), "(save_folder + 'train32.npz', train32=ytrain32)\n", (715, 7...
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import pandas as pd import matplotlib.cbook as cbook from .geom import geom from ggplot.utils import is_string from ggplot.utils import is_categorical class geom_bar(geom): DEFAULT_AES ...
[ "ggplot.utils.is_categorical", "numpy.append", "numpy.array", "numpy.cumsum" ]
[((1154, 1180), 'ggplot.utils.is_categorical', 'is_categorical', (["pinfo['x']"], {}), "(pinfo['x'])\n", (1168, 1180), False, 'from ggplot.utils import is_categorical\n'), ((1441, 1461), 'numpy.array', 'np.array', (['width_elem'], {}), '(width_elem)\n', (1449, 1461), True, 'import numpy as np\n'), ((2616, 2637), 'numpy...
from random import shuffle import numpy as np from autoencoder.activation_functions import sigmoid, sigmoid_derivative class MeanSquaredError: @staticmethod def calculate_cost(expected, outputs): return 0.5 * np.power(np.linalg.norm(expected - outputs), 2) @staticmethod def calculate_cost_g...
[ "autoencoder.activation_functions.sigmoid", "numpy.sum", "numpy.random.randn", "random.shuffle", "numpy.ones", "numpy.arange", "numpy.linalg.norm", "numpy.random.choice", "numpy.dot", "autoencoder.activation_functions.sigmoid_derivative", "numpy.sqrt" ]
[((658, 684), 'numpy.ones', 'np.ones', ([], {'shape': '(hidden, 1)'}), '(shape=(hidden, 1))\n', (665, 684), True, 'import numpy as np\n'), ((712, 735), 'numpy.ones', 'np.ones', ([], {'shape': '(784, 1)'}), '(shape=(784, 1))\n', (719, 735), True, 'import numpy as np\n'), ((1419, 1496), 'numpy.random.choice', 'np.random....
# -*- coding: utf-8 -*- """ The base elements for reading and writing complex data files. """ import os import logging from typing import Union, Tuple from datetime import datetime import numpy from .sicd_elements.SICD import SICDType from .sicd_elements.ImageCreation import ImageCreationType from ...__about__ impor...
[ "logging.warning", "os.path.exists", "numpy.swapaxes", "numpy.reshape", "datetime.datetime.now" ]
[((24009, 24100), 'logging.warning', 'logging.warning', (['"""The PixelType for sicd_meta is unset, so defaulting to RE32F_IM32F."""'], {}), "(\n 'The PixelType for sicd_meta is unset, so defaulting to RE32F_IM32F.')\n", (24024, 24100), False, 'import logging\n'), ((4953, 4989), 'numpy.reshape', 'numpy.reshape', (['...
"""Functions for downloading and reading MNIST data.""" from __future__ import absolute_import, print_function import numpy as np from keras.preprocessing import sequence class DataSet(object): _MAX_FAKE_SENTENCE_LEN = 50 def __init__(self, instances, labels, sequences, fake_data=False): if fake_da...
[ "numpy.load", "numpy.array", "numpy.arange", "numpy.random.permutation", "numpy.random.shuffle" ]
[((4397, 4432), 'numpy.load', 'np.load', (["('%s/train.pkl' % data_path)"], {}), "('%s/train.pkl' % data_path)\n", (4404, 4432), True, 'import numpy as np\n'), ((4528, 4569), 'numpy.array', 'np.array', (["train_data['s']"], {'dtype': 'np.int32'}), "(train_data['s'], dtype=np.int32)\n", (4536, 4569), True, 'import numpy...
import pytest import numpy import dpnp # full list of umaths umaths = [i for i in dir(numpy) if isinstance(getattr(numpy, i), numpy.ufunc)] # print(umaths) umaths = ['equal'] # trigonometric umaths.extend(['arccos', 'arcsin', 'arctan', 'cos', 'deg2rad', 'degrees', 'rad2deg', 'radians', 'sin', 'tan', 'a...
[ "pytest.mark.parametrize", "numpy.testing.assert_allclose", "numpy.arange" ]
[((1310, 1371), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_cases"""', 'test_cases'], {'ids': 'get_id'}), "('test_cases', test_cases, ids=get_id)\n", (1333, 1371), False, 'import pytest\n'), ((1633, 1692), 'numpy.testing.assert_allclose', 'numpy.testing.assert_allclose', (['result', 'expected'], {'...
import matplotlib.pyplot as plt import numpy as np from matplotlib import cm, ticker from math import log from scipy.ndimage.filters import gaussian_filter import argparse description = 'Calculate model regimes' parser = argparse.ArgumentParser() parser.add_argument('--runs', required=True, help='Runs of simulator')...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.axvline", "scipy.ndimage.filters.gaussian_filter", "argparse.ArgumentParser", "matplotlib.pyplot.close", "matplotlib.ticker.LogLocator", "numpy.unique", "matplotlib.pyplot.text", "matplotlib.pyplot.rcParams.update", "numpy.array", "matplotlib.pyplot....
[((224, 249), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (247, 249), False, 'import argparse\n'), ((618, 656), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (637, 656), True, 'import matplotlib.pyplot as plt\n'), ((1310, 13...
import functions import numpy as np import math import matplotlib.pyplot as plt from matplotlib.textpath import TextPath from matplotlib.patches import PathPatch def alignment_bracket_processing(serial_brackets, serial_alignment, n): spine = [i[0] for i in serial_brackets] serial_brackets = [[i, i...
[ "functions.middle_man", "math.sqrt", "matplotlib.pyplot.plot", "functions.bond_finder", "functions.impure_brackets", "numpy.polyfit", "matplotlib.pyplot.axis", "math.sin", "matplotlib.pyplot.Rectangle", "functions.polar_to_cartesian", "math.cos", "numpy.linspace", "matplotlib.pyplot.gca", ...
[((11588, 11603), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], {}), "('off')\n", (11596, 11603), True, 'import matplotlib.pyplot as plt\n'), ((11611, 11629), 'matplotlib.pyplot.axis', 'plt.axis', (['"""square"""'], {}), "('square')\n", (11619, 11629), True, 'import matplotlib.pyplot as plt\n'), ((555, 627), 'f...
import torch import numpy as np from utils.utils import (cutOctaves, debinarizeMidi, addCuttedOctaves) from utils.NoteSmoother import NoteSmoother def vae_interact(gui): live_instrument = gui.live_instrument device = gui.device model = gui.model.to(device) dials = gui.dials while True: pri...
[ "torch.ones", "torch.stack", "utils.utils.addCuttedOctaves", "utils.NoteSmoother.NoteSmoother", "torch.unsqueeze", "torch.FloatTensor", "torch.cat", "numpy.split", "torch.softmax", "numpy.max", "utils.utils.cutOctaves", "torch.Tensor", "torch.zeros", "utils.utils.debinarizeMidi", "torch....
[((5121, 5137), 'torch.zeros', 'torch.zeros', (['(100)'], {}), '(100)\n', (5132, 5137), False, 'import torch\n'), ((5139, 5154), 'torch.ones', 'torch.ones', (['(100)'], {}), '(100)\n', (5149, 5154), False, 'import torch\n'), ((5165, 5180), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5178, 5180), False, 'import...
""" This script takes the data from Adaptive ImmuneCode and assembles it into a dataframe that maps TCRs to their respective subject, cohort, ORF. """ import pandas as pd import numpy as np import os from utils import * mhc = 'cii' #Import peptide data from Adaptive file = '../../Data/ImmuneCODE/ImmuneCODE-MIRA-Relea...
[ "pandas.DataFrame", "pandas.read_csv", "numpy.hstack", "numpy.where", "numpy.array" ]
[((363, 380), 'pandas.read_csv', 'pd.read_csv', (['file'], {}), '(file)\n', (374, 380), True, 'import pandas as pd\n'), ((464, 481), 'numpy.array', 'np.array', (['cdr3[0]'], {}), '(cdr3[0])\n', (472, 481), True, 'import numpy as np\n'), ((964, 994), 'numpy.hstack', 'np.hstack', (['beta_sequences_list'], {}), '(beta_seq...
import numpy as np import os import tensorflow import tensorflow as tf import time from collections import defaultdict from random import shuffle from scipy.ndimage.morphology import distance_transform_edt from . import feature_spec features_dict = feature_spec.features_dict() BANDS = feature_spec.bands() # includes...
[ "tensorflow.reduce_sum", "numpy.sum", "random.shuffle", "collections.defaultdict", "os.path.join", "tensorflow.py_function", "tensorflow.stack", "tensorflow.cast", "tensorflow.squeeze", "tensorflow.io.gfile.glob", "numpy.stack", "tensorflow.ones", "numpy.median", "tensorflow.math.confusion...
[((529, 551), 'tensorflow.cast', 'tf.cast', (['mask', 'tf.bool'], {}), '(mask, tf.bool)\n', (536, 551), True, 'import tensorflow as tf\n'), ((563, 588), 'tensorflow.math.logical_not', 'tf.math.logical_not', (['mask'], {}), '(mask)\n', (582, 588), True, 'import tensorflow as tf\n'), ((653, 703), 'tensorflow.py_function'...
# ************************************************************ # Author : <NAME>, 2018 # Github : https://github.com/meliketoy/graph-tutorial.pytorch # # Korea University, Data-Mining Lab # Basic Tutorial for Non-Euclidean Graph Representation Learning # # Description : utils.py # Code for uploading planetoid dataset #...
[ "scipy.sparse.diags", "networkx.from_dict_of_lists", "scipy.sparse.vstack", "torch.LongTensor", "numpy.power", "scipy.sparse.eye", "numpy.isinf", "numpy.insert", "numpy.sort", "numpy.where", "pickle.load", "numpy.vstack" ]
[((985, 1000), 'scipy.sparse.diags', 'sp.diags', (['r_inv'], {}), '(r_inv)\n', (993, 1000), True, 'import scipy.sparse as sp\n'), ((1254, 1274), 'scipy.sparse.diags', 'sp.diags', (['r_inv_sqrt'], {}), '(r_inv_sqrt)\n', (1262, 1274), True, 'import scipy.sparse as sp\n'), ((3008, 3025), 'numpy.sort', 'np.sort', (['test_i...
import logging import math import random from typing import List, Tuple import numpy as np from mip import BINARY, Model, OptimizationStatus, minimize, xsum logging.basicConfig(format='%(process)d-%(levelname)s-%(message)s', level=logging.DEBUG) Coordinate = Tuple[int, int] CoordinatesVector = List[Coordinate] Matri...
[ "math.hypot", "numpy.sum", "logging.basicConfig", "random.choice", "logging.info", "mip.Model" ]
[((159, 252), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(process)d-%(levelname)s-%(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(process)d-%(levelname)s-%(message)s', level=\n logging.DEBUG)\n", (178, 252), False, 'import logging\n'), ((2353, 2373), 'numpy.sum', 'np.sum', (['route_m...
# # Copyright (c) 2021 salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause # """ Multiple z-score model (static thresholding at multiple time scales). """ from math import log f...
[ "merlion.transform.sequence.TransformSequence", "numpy.abs", "numpy.argmax", "merlion.transform.resample.TemporalResample", "numpy.asarray", "merlion.transform.moving_average.LagTransform", "merlion.utils.UnivariateTimeSeries", "merlion.transform.normalize.MeanVarNormalize", "merlion.transform.base....
[((986, 1030), 'merlion.transform.resample.TemporalResample', 'TemporalResample', ([], {'trainable_granularity': '(True)'}), '(trainable_granularity=True)\n', (1002, 1030), False, 'from merlion.transform.resample import TemporalResample\n'), ((2920, 2982), 'merlion.transform.sequence.TransformSequence', 'TransformSeque...
import numpy as np import matplotlib.pyplot as plt from argparse import HelpFormatter, SUPPRESS, OPTIONAL, ZERO_OR_MORE from astropy.visualization import (PercentileInterval, ImageNormalize, SqrtStretch, LogStretch, LinearStretch) class PyKEArgumentHelpFormatter(HelpFormatter): ...
[ "matplotlib.pyplot.title", "astropy.visualization.SqrtStretch", "matplotlib.pyplot.imshow", "matplotlib.pyplot.colorbar", "numpy.insert", "numpy.where", "numpy.array", "astropy.visualization.LinearStretch", "astropy.visualization.PercentileInterval", "astropy.visualization.LogStretch", "matplotl...
[((1531, 1558), 'numpy.where', 'np.where', (['(lookup == channel)'], {}), '(lookup == channel)\n', (1539, 1558), True, 'import numpy as np\n'), ((1841, 2421), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0], [1, 85, 0, 0, 0], [2, 1, 2, 3, 4], [3, 5, 6, 7, 8], [4, 9,\n 10, 11, 12], [5, 86, 0, 0, 0], [6, 13, 14, 15, 16...
from pynowcasting import CRBVAR import matplotlib.pyplot as plt import pandas as pd import numpy as np np.set_printoptions(precision=4, suppress=True, linewidth=150) pd.options.display.max_columns = 50 pd.options.display.max_columns = 50 # data_path = "/Users/gustavoamarante/Dropbox/BWGI/Nowcast/mf_data.xlsx" # Mac ...
[ "pandas.read_excel", "pynowcasting.CRBVAR", "numpy.set_printoptions", "matplotlib.pyplot.show" ]
[((104, 166), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'suppress': '(True)', 'linewidth': '(150)'}), '(precision=4, suppress=True, linewidth=150)\n', (123, 166), True, 'import numpy as np\n'), ((402, 439), 'pandas.read_excel', 'pd.read_excel', (['data_path'], {'index_col': '(0)'}), '(d...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np def iou_calculate(boxes_1, boxes_2): with tf.name_scope('iou_caculate'): xmin_1, ymin_1, xmax_1, ymax_1 = boxes_...
[ "numpy.minimum", "numpy.maximum", "tensorflow.maximum", "tensorflow.minimum", "numpy.array", "tensorflow.name_scope" ]
[((1312, 1338), 'numpy.maximum', 'np.maximum', (['xmin_1', 'xmin_2'], {}), '(xmin_1, xmin_2)\n', (1322, 1338), True, 'import numpy as np\n'), ((1355, 1381), 'numpy.minimum', 'np.minimum', (['xmax_1', 'xmax_2'], {}), '(xmax_1, xmax_2)\n', (1365, 1381), True, 'import numpy as np\n'), ((1400, 1426), 'numpy.maximum', 'np.m...
import dask.array as da import numpy as np import sklearn.metrics from dask.array.random import doc_wraps def _check_sample_weight(sample_weight): if sample_weight is not None: raise ValueError("'sample_weight' is not supported.") def _check_reg_targets(y_true, y_pred, multioutput): if multioutput !...
[ "dask.array.ones", "dask.array.random.doc_wraps", "numpy.errstate" ]
[((632, 677), 'dask.array.random.doc_wraps', 'doc_wraps', (['sklearn.metrics.mean_squared_error'], {}), '(sklearn.metrics.mean_squared_error)\n', (641, 677), False, 'from dask.array.random import doc_wraps\n'), ((1320, 1366), 'dask.array.random.doc_wraps', 'doc_wraps', (['sklearn.metrics.mean_absolute_error'], {}), '(s...
""" ========================== Hyperparameter Selection 1 ========================== This example demonstrates how to do model selection in a feature representation pipeline using a grid search """ # Author: <NAME> # License: BSD import matplotlib.pyplot as plt import numpy as np from sklearn.ensemble import RandomF...
[ "sklearn.ensemble.RandomForestClassifier", "sklearn.model_selection.GridSearchCV", "seglearn.Segment", "matplotlib.pyplot.show", "sklearn.preprocessing.StandardScaler", "seglearn.FeatureRep", "numpy.array", "sklearn.model_selection.GroupKFold", "seglearn.load_watch", "matplotlib.pyplot.subplots" ]
[((1483, 1499), 'seglearn.load_watch', 'sgl.load_watch', ([], {}), '()\n', (1497, 1499), True, 'import seglearn as sgl\n'), ((1592, 1614), 'sklearn.model_selection.GroupKFold', 'GroupKFold', ([], {'n_splits': '(3)'}), '(n_splits=3)\n', (1602, 1614), False, 'from sklearn.model_selection import GridSearchCV, GroupKFold\n...
# -*- coding: utf-8 -*- # # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is # holder of all proprietary rights on this computer program. # Using this computer program means that you agree to the terms # in the LICENSE file included with this software distribution. # Any use not explicitly grant...
[ "torch.nn.Parameter", "numpy.load", "torch.bmm", "torch.stack", "torch.eye", "torch.cat", "torch.index_select", "torch.einsum", "pickle.load", "numpy.array", "numpy.reshape", "torch.arange", "torch.zeros", "torch.nn.functional.interpolate", "torch.tensor", "torch.from_numpy" ]
[((1092, 1120), 'numpy.array', 'np.array', (['array'], {'dtype': 'dtype'}), '(array, dtype=dtype)\n', (1100, 1120), True, 'import numpy as np\n'), ((937, 969), 'torch.tensor', 'torch.tensor', (['array'], {'dtype': 'dtype'}), '(array, dtype=dtype)\n', (949, 969), False, 'import torch\n'), ((2216, 2309), 'torch.cat', 'to...
import argparse import hyperopt import numpy as np from hyperopt import tpe, Trials from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_val_score, StratifiedKFold from src.data import load_data, load_params, save_params def main(train_path, cv_idx_path, num_eval=10...
[ "sklearn.ensemble.RandomForestClassifier", "argparse.ArgumentParser", "src.data.save_params", "hyperopt.hp.choice", "numpy.random.RandomState", "sklearn.model_selection.StratifiedKFold", "hyperopt.hp.quniform", "hyperopt.Trials", "src.data.load_data", "src.data.load_params" ]
[((461, 546), 'src.data.load_data', 'load_data', (['[train_path, cv_idx_path]'], {'sep': '""","""', 'header': '(0)', 'index_col': '"""PassengerId"""'}), "([train_path, cv_idx_path], sep=',', header=0, index_col='PassengerId'\n )\n", (470, 546), False, 'from src.data import load_data, load_params, save_params\n'), ((...
# Copyright (c) 2020 Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the f...
[ "onnx.helper.make_node", "numpy.array" ]
[((3468, 3642), 'onnx.helper.make_node', 'oh.make_node', (['"""TopK"""'], {'inputs': '[graph_out_name, k_value.name]', 'outputs': '[topk_values.name, topk_indices.name]', 'axis': 'self.axis', 'largest': 'self.largest', 'sorted': 'self.sorted'}), "('TopK', inputs=[graph_out_name, k_value.name], outputs=[\n topk_value...
def vector_similarity(vector1,vector2): import numpy as np if (np.linalg.norm(vector1)*np.linalg.norm(vector2)) !=0: cosine_angle=np.inner(vector1,vector2)/(np.linalg.norm(vector1)*np.linalg.norm(vector2)) else: cosine_angle=0 return cosine_angle
[ "numpy.linalg.norm", "numpy.inner" ]
[((67, 90), 'numpy.linalg.norm', 'np.linalg.norm', (['vector1'], {}), '(vector1)\n', (81, 90), True, 'import numpy as np\n'), ((91, 114), 'numpy.linalg.norm', 'np.linalg.norm', (['vector2'], {}), '(vector2)\n', (105, 114), True, 'import numpy as np\n'), ((137, 163), 'numpy.inner', 'np.inner', (['vector1', 'vector2'], {...
import numpy as np from scipy.special import expit as sigmoid # formulas here hold for more general functions def d_sigmoid(t): return sigmoid(t) * (1 - sigmoid(t)) def hazard(x, w_d): return np.exp(np.dot(x, w_d)) def grad_hazard(x, w_d): return (x.T * hazard(x, w_d)).T def hidden(x, w_c): retu...
[ "numpy.sum", "numpy.ones", "numpy.split", "scipy.special.expit", "numpy.dot" ]
[((1617, 1631), 'numpy.split', 'np.split', (['w', '(2)'], {}), '(w, 2)\n', (1625, 1631), True, 'import numpy as np\n'), ((1955, 1969), 'numpy.split', 'np.split', (['w', '(2)'], {}), '(w, 2)\n', (1963, 1969), True, 'import numpy as np\n'), ((141, 151), 'scipy.special.expit', 'sigmoid', (['t'], {}), '(t)\n', (148, 151), ...
from __future__ import print_function, division, absolute_import import torch import torch.nn as nn import torch.nn.functional as F # HACK TODO DEBUG import numpy as np from torchsummary import summary try: # relative import: when executing as a package: python -m ... from .base_models import BaseModelAutoEnco...
[ "models.gan.GeneratorUnet", "losses.losses.autoEncoderLoss", "losses.losses.AEboundLoss", "torch.nn.Tanh", "torch.nn.Linear", "torchsummary.summary", "torch.device", "models.gan.EncoderUnet", "numpy.prod" ]
[((7017, 7042), 'torchsummary.summary', 'summary', (['model', 'img_shape'], {}), '(model, img_shape)\n', (7024, 7042), False, 'from torchsummary import summary\n'), ((3460, 3509), 'torchsummary.summary', 'summary', (['self.encoder_conv', 'img_shape'], {'show': '(False)'}), '(self.encoder_conv, img_shape, show=False)\n'...
""" Modified version of classic cart-pole system implemented by <NAME> et al. Copied from http://incompleteideas.net/sutton/book/code/pole.c permalink: https://perma.cc/C9ZM-652R """ # flake8: noqa import math from typing import Callable, List, Tuple import gym import numpy as np from gym import logger, spaces from gy...
[ "gym.envs.classic_control.rendering.Transform", "gym.envs.classic_control.rendering.Line", "gym.spaces.Discrete", "numpy.zeros", "gym.envs.classic_control.rendering.FilledPolygon", "numpy.finfo", "numpy.array", "gym.spaces.Box", "gym.envs.classic_control.rendering.Viewer", "gym.utils.seeding.np_ra...
[((2477, 2493), 'numpy.array', 'np.array', (['[0, 1]'], {}), '([0, 1])\n', (2485, 2493), True, 'import numpy as np\n'), ((3437, 3455), 'gym.spaces.Discrete', 'spaces.Discrete', (['(2)'], {}), '(2)\n', (3452, 3455), False, 'from gym import logger, spaces\n'), ((3489, 3530), 'gym.spaces.Box', 'spaces.Box', (['(-high)', '...
# -*- coding: utf-8 -*- # ***************************************************************************** # NICOS, the Networked Instrument Control System of the MLZ # Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS) # # This program is free software; you can redistribute it and/or modify it under # the t...
[ "nicos.guisupport.qt.QLabel", "nicos.guisupport.qt.QVBoxLayout", "nicos.clients.gui.utils.waitCursor", "nicos.guisupport.qt.QWidget.__init__", "nicos.guisupport.qt.QDoubleValidator", "nicos.guisupport.qt.QSize", "nicos.clients.gui.panels.Panel.__init__", "nicos.guisupport.widget.NicosWidget.__init__",...
[((8026, 8036), 'nicos.guisupport.qt.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (8034, 8036), False, 'from nicos.guisupport.qt import QDialogButtonBox, QDoubleValidator, QLabel, QMessageBox, QSize, QSizePolicy, Qt, QVBoxLayout, QWidget, pyqtSlot\n'), ((8370, 8399), 'nicos.guisupport.qt.pyqtSlot', 'pyqtSlot', (['"""QAbstr...
import numpy as np import cv2 from lane_lines_finder.process_step import ProcessStep class Window: """ Keeps the calculations done by the sliding window """ def __init__(self, width=None, heigth=None): self._x_range = [0, 0] self._y_range = [0, 0] if width and heigth: ...
[ "numpy.absolute", "numpy.zeros_like", "numpy.sum", "numpy.polyfit", "numpy.argmax", "numpy.hstack", "numpy.mean", "numpy.array", "numpy.int", "numpy.linspace", "numpy.vstack" ]
[((2205, 2226), 'numpy.array', 'np.array', (['non_zero[0]'], {}), '(non_zero[0])\n', (2213, 2226), True, 'import numpy as np\n'), ((2248, 2269), 'numpy.array', 'np.array', (['non_zero[1]'], {}), '(non_zero[1])\n', (2256, 2269), True, 'import numpy as np\n'), ((2844, 2868), 'numpy.array', 'np.array', (['([False] * size)...
# %% import jax import jax.numpy as np from jax import grad, jit, vmap, value_and_grad, random, lax from jax.nn import sigmoid, log_softmax from jax.nn.initializers import glorot_normal, normal from jax.experimental import stax, optimizers from jax.experimental.stax import BatchNorm, Conv, Dense, Flatten, \ ...
[ "argparse.ArgumentParser", "jax.random.normal", "jax.jit", "jax.experimental.optimizers.sgd", "jax.numpy.dot", "jax.nn.log_softmax", "jax.local_devices", "jax.numpy.concatenate", "numpy.median", "time.time", "jax.nn.initializers.glorot_normal", "jax.random.PRNGKey", "numpy.mean", "jax.grad...
[((544, 559), 'jax.nn.initializers.glorot_normal', 'glorot_normal', ([], {}), '()\n', (557, 559), False, 'from jax.nn.initializers import glorot_normal, normal\n'), ((568, 576), 'jax.nn.initializers.normal', 'normal', ([], {}), '()\n', (574, 576), False, 'from jax.nn.initializers import glorot_normal, normal\n'), ((217...
import os import lazy_dataset import numpy as np import torch from padertorch import Trainer from padertorch.contrib.je.data.transforms import Collate from padertorch.contrib.je.data.transforms import LabelEncoder from padertorch.contrib.je.modules.conv import CNN2d, CNN1d from padertorch.contrib.je.modules.global_poo...
[ "sins.features.stft.STFT", "os.makedirs", "padertorch.Trainer.get_config", "sins.features.normalize.Normalizer", "lazy_dataset.concatenate", "padertorch.Trainer.from_config", "sins.features.mel_transform.MelTransform", "sacred.commands.print_config", "sins.utils.timestamp", "torch.cuda.is_availabl...
[((946, 965), 'sacred.Experiment', 'Exp', (['"""asc-training"""'], {}), "('asc-training')\n", (949, 965), True, 'from sacred import Experiment as Exp\n'), ((1102, 1108), 'sins.database.SINS', 'SINS', ([], {}), '()\n', (1106, 1108), False, 'from sins.database import SINS, AudioReader\n'), ((998, 1009), 'sins.utils.times...
#!/usr/bin/python # SED is calaulated with LE and RE balance contrasts. # # Copyright (C) 2010-2013 <NAME> # # See LICENSE.TXT that came with this file. import sys import math import random import numpy as np from StimControl.Experiments.SED import SED from StimControl.Experiments.Quest import QuestObject from StimC...
[ "sys.stdout.write", "StimControl.Utility.Logger.Logger", "random.choice", "StimControl.Experiments.SED.SED", "math.log10", "numpy.random.permutation", "StimControl.Experiments.Quest.QuestObject" ]
[((4114, 4154), 'numpy.random.permutation', 'np.random.permutation', (["['left', 'right']"], {}), "(['left', 'right'])\n", (4135, 4154), True, 'import numpy as np\n'), ((452, 476), 'StimControl.Utility.Logger.Logger', 'Logger', (['subject', 'pre_fix'], {}), '(subject, pre_fix)\n', (458, 476), False, 'from StimControl.U...
import logging import yaml import matplotlib import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.optim as optim import wandb from torch.utils.data import Subset from torchvision import datasets, transforms from tqdm.auto import tqdm from defensive_models import Defensive...
[ "defensive_models.DefensiveModel1", "wandb.log", "numpy.random.seed", "torch.optim.lr_scheduler.StepLR", "wandb.watch", "torch.randn", "yaml.safe_load", "torch.no_grad", "torch.nn.MSELoss", "torch.utils.data.DataLoader", "torch.linalg.norm", "torch.utils.data.random_split", "torch.manual_see...
[((345, 502), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(message)s"""', 'datefmt': '"""%m/%d/%Y %I:%M:%S %p"""', 'filemode': '"""a"""', 'filename': '"""experiment.log"""', 'level': 'logging.DEBUG'}), "(format='%(asctime)s %(message)s', datefmt=\n '%m/%d/%Y %I:%M:%S %p', filemode=...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import itertools import sys sys.path.append("../../") import numpy as np from sklearn.svm import SVR from sklearn.model_selection import KFold, LeaveOneOut, RepeatedKFold, ShuffleSplit import deepxdeNEW as d...
[ "data.ModelData", "deepxdeNEW.Model", "numpy.mean", "deepxdeNEW.data.DataSet", "sklearn.model_selection.RepeatedKFold", "sys.path.append", "numpy.std", "deepxdeNEW.maps.FNN", "sklearn.model_selection.ShuffleSplit", "data.FEMData", "deepxdeNEW.saveplot", "numpy.hstack", "deepxdeNEW.maps.MfNN"...
[((139, 164), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (154, 164), False, 'import sys\n'), ((410, 427), 'sklearn.svm.SVR', 'SVR', ([], {'kernel': '"""rbf"""'}), "(kernel='rbf')\n", (413, 427), False, 'from sklearn.svm import SVR\n'), ((640, 686), 'mfgp.LinearMFGP', 'LinearMFGP', ([]...
# -*- coding: utf-8 -*- # Copyright (c) 2013-2022 The keysight developers. All rights reserved. # Project site: https://github.com/questrail/keysight # Use of this source code is governed by a MIT-style license that # can be found in the LICENSE.txt file for the project. """Read a CSV file saved by an N9038 EMI Test Re...
[ "numpy.array", "re.search" ]
[((5707, 5730), 're.search', 're.search', (['"""[\\\\d.]+"""', 's'], {}), "('[\\\\d.]+', s)\n", (5716, 5730), False, 'import re\n'), ((5437, 5543), 'numpy.array', 'np.array', (['data_array'], {'dtype': "{'names': ('frequency', 'amplitude'), 'formats': ('f8', amplitude_format)}"}), "(data_array, dtype={'names': ('freque...
import numpy as np import tensorflow as tf import random from Neural_MINE import Neural_MINE from Classifier_MI import Classifier_MI class CCMI(object): def __init__(self, X, Y, Z, tester, metric, num_boot_iter, h_dim, max_ep): self.dim_x = X.shape[1] self.dim_y = Y.shape[1] self.dim_z = ...
[ "Classifier_MI.Classifier_MI", "numpy.random.seed", "tensorflow.reset_default_graph", "numpy.hstack", "numpy.mean", "random.seed", "numpy.array", "Neural_MINE.Neural_MINE", "numpy.random.permutation" ]
[((355, 375), 'numpy.hstack', 'np.hstack', (['(X, Y, Z)'], {}), '((X, Y, Z))\n', (364, 375), True, 'import numpy as np\n'), ((399, 416), 'numpy.hstack', 'np.hstack', (['(X, Z)'], {}), '((X, Z))\n', (408, 416), True, 'import numpy as np\n'), ((884, 900), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (898, 900...
from tensor_generator import TensorGenerator, sentences_to_char_tensor import numpy as np import pytest from numpy.testing import assert_equal class FakeVocab: char2index = {c: i for i, c in enumerate('{}abcdefghijklmnopqrstuvwxyz')} part2index = {'PAD': 0, 'ADJF': 1, 'DET': 2, 'NOUN': 3, 'NPRO': 4, 'VERB': 5...
[ "pytest.raises", "numpy.array", "numpy.testing.assert_equal" ]
[((807, 894), 'numpy.array', 'np.array', (['[[0, 9, 6, 1, 0], [0, 24, 2, 20, 1], [0, 4, 16, 15, 1], [0, 21, 9, 6, 1]]'], {}), '([[0, 9, 6, 1, 0], [0, 24, 2, 20, 1], [0, 4, 16, 15, 1], [0, 21, 9,\n 6, 1]])\n', (815, 894), True, 'import numpy as np\n'), ((1004, 1055), 'numpy.testing.assert_equal', 'assert_equal', (['c...
import os import sqlite3 import random import logging import numpy as np import pandas as pd from tqdm import tqdm try: import torch from torch.autograd import Variable import torch.utils.data as Data except Exception: pass from .utils import (encode_board, value_output, policy_output_categorical, ...
[ "numpy.random.seed", "numpy.argmax", "torch.cuda.device_count", "numpy.rot90", "numpy.arange", "torch.utils.data.TensorDataset", "os.path.join", "torch.utils.data.DataLoader", "os.path.exists", "pandas.read_sql_query", "tqdm.tqdm", "torch.autograd.Variable", "numpy.fliplr", "sqlite3.connec...
[((385, 503), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(levelname)s|%(name)s|%(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(level=logging.INFO, format=\n '%(levelname)s|%(name)s|%(message)s', datefmt='%Y-%m-%d %H:%M:%S')\n", (404, 503), False, 'import lo...
from __future__ import division, print_function, absolute_import #from tmm.tmm_core import (coh_tmm, unpolarized_RT, ellips, # position_resolved, find_in_structure_with_inf) from wptherml.wptherml.datalib import datalib from wptherml.wptherml.wpml import multilayer import tmm.tmm_core as tmm fro...
[ "wptherml.wptherml.wpml.multilayer", "numpy.stack", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "wptherml.wptherml.datalib.datalib.BB", "tmm.tmm_core.inc_absorp_in_each_layer", "matplotlib.pyplot.figure", "wptherml.wptherml.datalib.datalib.AM", "numpy.array", ...
[((1980, 2001), 'wptherml.wptherml.wpml.multilayer', 'multilayer', (['structure'], {}), '(structure)\n', (1990, 2001), False, 'from wptherml.wptherml.wpml import multilayer\n'), ((2480, 2516), 'wptherml.wptherml.datalib.datalib.ATData', 'datalib.ATData', (['np_slab.lambda_array'], {}), '(np_slab.lambda_array)\n', (2494...
""" This file was copied from github.com/karfly/learnable-triangulation-pytorch and modified for this project needs. The license of the file is in: github.com/karfly/learnable-triangulation-pytorch/blob/master/LICENSE """ import numpy as np import cv2 from PIL import Image import torch IMAGENET_MEAN, IMAGENET_STD =...
[ "numpy.asarray", "numpy.transpose", "numpy.clip", "numpy.array", "PIL.Image.fromarray", "torch.is_tensor", "cv2.resize", "torch.from_numpy" ]
[((321, 352), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (329, 352), True, 'import numpy as np\n'), ((354, 385), 'numpy.array', 'np.array', (['[0.229, 0.224, 0.225]'], {}), '([0.229, 0.224, 0.225])\n', (362, 385), True, 'import numpy as np\n'), ((807, 829), 'PIL.Image.froma...
""" General-purpose class for rigid-body transformations. """ # Author: <NAME> <<EMAIL>> # License: MIT import random as rnd import numpy as np from pybot.geometry import transformations as tf from pybot.geometry.quaternion import Quaternion def normalize_vec(v): """ Normalizes a vector with its L2 norm """ ...
[ "pybot.geometry.quaternion.Quaternion.from_matrix", "random.uniform", "pybot.geometry.quaternion.Quaternion.from_rpy", "pybot.geometry.quaternion.Quaternion.from_angle_axis", "numpy.float32", "pybot.geometry.quaternion.Quaternion.from_wxyz", "numpy.cross", "numpy.array_str", "numpy.hstack", "rando...
[((751, 817), 'numpy.float32', 'np.float32', (['[[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]]'], {}), '([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]])\n', (761, 817), True, 'import numpy as np\n'), ((1693, 1709), 'numpy.cross', 'np.cross', (['v1', 'v2'], {}), '(v1, v2)\n', (1701, 1709), True, 'import ...
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
[ "numpy.abs", "numpy.expand_dims", "numpy.iinfo", "librosa.filters.mel", "librosa.istft", "paddleaudio.compliance.kaldi.fbank", "python_speech_features.logfbank", "numpy.dot", "librosa.stft" ]
[((2864, 2878), 'numpy.abs', 'np.abs', (['x_stft'], {}), '(x_stft)\n', (2870, 2878), True, 'import numpy as np\n'), ((2929, 3005), 'librosa.filters.mel', 'librosa.filters.mel', ([], {'sr': 'fs', 'n_fft': 'n_fft', 'n_mels': 'n_mels', 'fmin': 'fmin', 'fmax': 'fmax'}), '(sr=fs, n_fft=n_fft, n_mels=n_mels, fmin=fmin, fmax=...
from __future__ import absolute_import, division, print_function import numpy as np import pandas as pd from .utils import PANDAS_VERSION # In Pandas 0.19.2, a function to hash pandas objects was introduced. Object # arrays are assumed to be strings, and are hashed with a cython implementation # of siphash. However,...
[ "numpy.uint64", "pandas.types.common.is_numeric_dtype", "pandas.tools.hashing.hash_pandas_object", "pandas._hash.hash_object_array", "pandas.types.common.is_categorical_dtype", "pandas.types.common.is_datetime64_dtype", "numpy.iinfo", "pandas.types.common.is_timedelta64_dtype", "pandas.Index", "pa...
[((4823, 4855), 'pandas.types.common.is_categorical_dtype', 'is_categorical_dtype', (['vals.dtype'], {}), '(vals.dtype)\n', (4843, 4855), False, 'from pandas.types.common import is_categorical_dtype, is_numeric_dtype, is_datetime64_dtype, is_timedelta64_dtype\n'), ((5038, 5078), 'numpy.issubdtype', 'np.issubdtype', (['...
import tensorflow as tf from slim.nets import vgg import tensorflow.contrib.slim as slim import numpy as np import scipy as sp import scipy.misc import configargparse import os import sys import datetime # Calculates the feature correlation matrix for a 3D tensor # (no batch dimension) def feat_gram_matx_3d(layer, na...
[ "tensorflow.reduce_sum", "tensorflow.get_collection", "tensorflow.contrib.framework.get_or_create_global_step", "tensorflow.reshape", "tensorflow.image.decode_png", "sys.stdout.flush", "numpy.float64", "configargparse.ArgumentParser", "slim.nets.vgg.vgg_19", "tensorflow.train.Server", "os.path.d...
[((13682, 13804), 'configargparse.ArgumentParser', 'configargparse.ArgumentParser', ([], {'description': '"""Performs neural style transfer."""', 'default_config_files': "['~/.nst-settings']"}), "(description='Performs neural style transfer.',\n default_config_files=['~/.nst-settings'])\n", (13711, 13804), False, 'i...
import math import numpy as np class RRT(): ''' RRT algorithm Args: - None - ''' def __init__(self,): self.step_len = 0.5 self.goal_prob = 0.05 self.delta = 0.5 def run(self, grid, start, goal, max_iter=100000): ''' ...
[ "numpy.random.uniform", "math.hypot", "math.atan2", "math.sin", "math.cos" ]
[((4204, 4254), 'math.hypot', 'math.hypot', (['(goal[0] - start[0])', '(goal[1] - start[1])'], {}), '(goal[0] - start[0], goal[1] - start[1])\n', (4214, 4254), False, 'import math\n'), ((4272, 4322), 'math.atan2', 'math.atan2', (['(goal[1] - start[1])', '(goal[0] - start[0])'], {}), '(goal[1] - start[1], goal[0] - star...
from abc import ABCMeta, abstractmethod import numpy as np import pandas as pd from numpy import exp from mc.curiosity import mc_curiosity from mc.stochasticprocess import StochasticProcess from collections import namedtuple from hw import hw_helper from copy import deepcopy class BlackScholesProcess(StochasticProce...
[ "pandas.DataFrame", "hw.hw_helper._A", "numpy.random.seed", "hw.hw_helper.get_phi", "hw.hw_helper.get_drift_T", "hw.hw_helper.get_var_x", "mc.curiosity.mc_curiosity", "numpy.zeros", "hw.hw_helper.get_integrated_drift_T", "hw.hw_helper._B", "hw.hw_helper._V", "numpy.exp", "numpy.linspace", ...
[((653, 696), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1.0)', '(timestep, paths)'], {}), '(0, 1.0, (timestep, paths))\n', (669, 696), True, 'import numpy as np\n'), ((2160, 2223), 'hw.hw_helper.get_var_x', 'hw_helper.get_var_x', ([], {'T': '(s + dt)', 'a': 'self.mr', 'sigma': 'self.sigma', 's': 's'}), '(T=...
"""Signal processing functions for SMS""" import numpy as np from scipy import fft import functools from typing import Optional, Tuple def dft( x: np.ndarray, w: np.ndarray, n: int, tol: float = 1e-14, ): """Discrete Fourier Transform with zero-phase windowing Args: x (array): Input w (array): Wi...
[ "numpy.abs", "numpy.angle", "numpy.zeros", "numpy.greater", "numpy.finfo", "numpy.arange", "functools.reduce", "numpy.log10", "scipy.fft.rfft" ]
[((581, 592), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (589, 592), True, 'import numpy as np\n'), ((654, 667), 'scipy.fft.rfft', 'fft.rfft', (['x_z'], {}), '(x_z)\n', (662, 667), False, 'from scipy import fft\n'), ((686, 699), 'numpy.abs', 'np.abs', (['x_fft'], {}), '(x_fft)\n', (692, 699), True, 'import numpy ...
import os import numpy as np import torch from .dataloading import Dataset import cv2 from pycocotools.coco import COCO from utils.utils import * COCO_CLASSES=( 'person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 'street sign', 'stop sign', 'parking...
[ "numpy.zeros", "cv2.imread", "pycocotools.coco.COCO", "numpy.max", "os.path.join" ]
[((3410, 3430), 'cv2.imread', 'cv2.imread', (['img_file'], {}), '(img_file)\n', (3420, 3430), False, 'import cv2\n'), ((4313, 4336), 'numpy.zeros', 'np.zeros', (['(num_objs, 5)'], {}), '((num_objs, 5))\n', (4321, 4336), True, 'import numpy as np\n'), ((2031, 2092), 'pycocotools.coco.COCO', 'COCO', (["(self.data_dir + '...
"""Make BIDS report from dataset and sidecar files.""" # Authors: <NAME> <<EMAIL>> # # License: BSD-3-Clause import json import os.path as op import textwrap from pathlib import Path import numpy as np from mne.externals.tempita import Template from mne.utils import warn from mne_bids.config import DOI, ALLOWED_DATAT...
[ "textwrap.wrap", "mne_bids.path.get_entity_vals", "mne.externals.tempita.Template", "pathlib.Path", "numpy.mean", "os.path.join", "numpy.round", "mne_bids.path.BIDSPath", "numpy.std", "os.path.dirname", "os.path.exists", "mne_bids.path.get_entities_from_fname", "numpy.max", "mne_bids.path....
[((5619, 5660), 'os.path.join', 'op.join', (['root', '"""dataset_description.json"""'], {}), "(root, 'dataset_description.json')\n", (5626, 5660), True, 'import os.path as op\n'), ((6776, 6809), 'os.path.join', 'op.join', (['root', '"""participants.tsv"""'], {}), "(root, 'participants.tsv')\n", (6783, 6809), True, 'imp...
import re import types import random import copy import math import pdb import numpy as np import torch from torch_geometric.utils import to_undirected from typing import ( Dict, List, Union ) import warnings import deepsnap class Graph(object): r""" A plain python object modeling a single graph w...
[ "numpy.isin", "deepsnap._netlib.set_edge_attributes", "random.sample", "random.shuffle", "torch.cat", "deepsnap._netlib.Graph", "torch.arange", "deepsnap._netlib.relabel_nodes", "torch.ones", "deepsnap._netlib.DiGraph", "torch.zeros", "torch.is_tensor", "copy.deepcopy", "torch.unique", "...
[((10039, 10062), 'torch.unique', 'torch.unique', (['self[key]'], {}), '(self[key])\n', (10051, 10062), False, 'import torch\n'), ((14676, 14698), 'torch.is_tensor', 'torch.is_tensor', (['value'], {}), '(value)\n', (14691, 14698), False, 'import torch\n'), ((18274, 18304), 'torch.is_tensor', 'torch.is_tensor', (['attri...
''' Saves currently displayed image in various formats. ''' import mss import os from datetime import datetime import numpy as np from skimage.io import imsave from PIL import Image, ImageDraw, ImageFont from loguru import logger from kivy.app import App from kivy.core.window import Window from kivy.properties import...
[ "PIL.Image.new", "os.remove", "numpy.ones", "numpy.arange", "jocular.oldtoast.toast", "jocular.utils.unique_member", "numpy.max", "jocular.metrics.Metrics.get", "numpy.linspace", "PIL.ImageDraw.Draw", "jocular.utils.s_to_minsec", "skimage.io.imsave", "jocular.utils.purify_name", "datetime....
[((837, 898), 'kivy.properties.OptionProperty', 'OptionProperty', (['"""eyepiece"""'], {'options': "['eyepiece', 'landscape']"}), "('eyepiece', options=['eyepiece', 'landscape'])\n", (851, 898), False, 'from kivy.properties import OptionProperty, BooleanProperty, NumericProperty\n'), ((916, 973), 'kivy.properties.Optio...
import numpy as np import cv2 import os # 遍历文件夹 file = 'label/' for root, dirs, files in os.walk(file): # root 表示当前正在访问的文件夹路径 # dirs 表示该文件夹下的子目录名list # files 表示该文件夹下的文件list # 遍历文件 for f in files: if f[-4:]=='.jpg': print(f) name = f[:-4] pic = f ...
[ "cv2.waitKey", "cv2.imwrite", "os.walk", "numpy.zeros", "cv2.imread" ]
[((90, 103), 'os.walk', 'os.walk', (['file'], {}), '(file)\n', (97, 103), False, 'import os\n'), ((333, 355), 'cv2.imread', 'cv2.imread', (['(file + pic)'], {}), '(file + pic)\n', (343, 355), False, 'import cv2\n'), ((423, 443), 'numpy.zeros', 'np.zeros', (['(row, col)'], {}), '((row, col))\n', (431, 443), True, 'impor...
import torch import numpy as np import networkx as nx import torch_geometric as tg from model.utils import batch_dihedrals from model.cycle_utils import * device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') device = 'cpu' def construct_conformers(data, model): G = nx.to_undirected(tg.utils.to_n...
[ "model.utils.batch_dihedrals", "torch_geometric.utils.to_networkx", "torch.cat", "torch.rand_like", "numpy.arange", "torch.arange", "numpy.unique", "numpy.prod", "torch.FloatTensor", "torch.det", "torch.linalg.norm", "torch.zeros", "torch.zeros_like", "numpy.roll", "torch.cuda.is_availab...
[((348, 365), 'networkx.cycle_basis', 'nx.cycle_basis', (['G'], {}), '(G)\n', (362, 365), True, 'import networkx as nx\n'), ((5948, 6003), 'numpy.arange', 'np.arange', (['cycle_start_idx', '(cycle_start_idx + cycle_len)'], {}), '(cycle_start_idx, cycle_start_idx + cycle_len)\n', (5957, 6003), True, 'import numpy as np\...
import os import sys import numpy as np DIR = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.join(DIR, '../..')) from SEAS_Utils.Common_Utils.constants import * import SEAS_Main.Physics.astrophysics as calc import matplotlib.pyplot as plt class Transmission_Spectra_Simulator(): d...
[ "SEAS_Main.Physics.astrophysics.calculate_air_density", "os.path.dirname", "SEAS_Main.Physics.astrophysics.calc_transmittance", "numpy.zeros", "SEAS_Main.Physics.astrophysics.calc_cloud_number_density", "numpy.array", "numpy.arccos", "os.path.join" ]
[((68, 93), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (83, 93), False, 'import os\n'), ((114, 140), 'os.path.join', 'os.path.join', (['DIR', '"""../.."""'], {}), "(DIR, '../..')\n", (126, 140), False, 'import os\n'), ((1667, 1700), 'SEAS_Main.Physics.astrophysics.calc_transmittance', 'ca...
import h5py import numpy as np from torch.utils.data import Dataset, DataLoader, ConcatDataset import augment.transforms as transforms from augment.transforms import LabelToBoundaryTransformer, RandomLabelToBoundaryTransformer, \ AnisotropicRotationTransformer, IsotropicRotationTransformer, StandardTransformer, Ba...
[ "numpy.count_nonzero", "h5py.File", "torch.utils.data.ConcatDataset", "numpy.array" ]
[((5366, 5395), 'h5py.File', 'h5py.File', (['raw_file_path', '"""r"""'], {}), "(raw_file_path, 'r')\n", (5375, 5395), False, 'import h5py\n'), ((5467, 5485), 'numpy.array', 'np.array', (['self.raw'], {}), '(self.raw)\n', (5475, 5485), True, 'import numpy as np\n'), ((3270, 3315), 'numpy.count_nonzero', 'np.count_nonzer...
import h5py import glob from multiprocessing import Pool import argparse import numpy as np from ..features.extract_events import extract_events,get_events parser = argparse.ArgumentParser() parser.add_argument('--root', type=str, default="data/training/") parser.add_argument("--n-cpu", dest="n_cpu", type=int, defau...
[ "h5py.File", "argparse.ArgumentParser", "numpy.random.randint", "numpy.mean", "multiprocessing.Pool", "glob.glob" ]
[((167, 192), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (190, 192), False, 'import argparse\n'), ((1106, 1139), 'glob.glob', 'glob.glob', (["(args.root + '/*.fast5')"], {}), "(args.root + '/*.fast5')\n", (1115, 1139), False, 'import glob\n'), ((461, 490), 'numpy.random.randint', 'np.random...
import numpy as np import scipy.io import tempfile from typing import Dict, IO, Iterable, List, Optional, Type from dnnv.nn.layers import Convolutional, FullyConnected, InputLayer, Layer from dnnv.verifiers.common import HyperRectangle, VerifierTranslatorError def as_mipverify( layers: List[Layer], weights_...
[ "numpy.stack", "tempfile.NamedTemporaryFile", "numpy.asarray", "numpy.allclose", "numpy.any", "numpy.product", "numpy.array" ]
[((1304, 1333), 'numpy.asarray', 'np.asarray', (['input_layer.shape'], {}), '(input_layer.shape)\n', (1314, 1333), True, 'import numpy as np\n'), ((6770, 6784), 'numpy.any', 'np.any', (['(lb < 0)'], {}), '(lb < 0)\n', (6776, 6784), True, 'import numpy as np\n'), ((6788, 6802), 'numpy.any', 'np.any', (['(ub > 1)'], {}),...
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # Copyright (c) 2017-2021, NVIDIA CORPORATION & AFFILIATES. 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 a...
[ "argparse.ArgumentParser", "paddle.fluid.layers.data", "paddle.enable_static", "nvidia.dali.fn.bb_flip", "paddle.fluid.program_guard", "paddle.fluid.CompiledProgram", "numpy.mean", "shutil.rmtree", "utils.load_weights", "os.path.join", "ssd.SSD", "nvidia.dali.fn.crop_mirror_normalize", "padd...
[((1426, 1492), 'nvidia.dali.pipeline.Pipeline', 'Pipeline', (['batch_size', 'num_threads', 'local_rank'], {'seed': '(42 + device_id)'}), '(batch_size, num_threads, local_rank, seed=42 + device_id)\n', (1434, 1492), False, 'from nvidia.dali.pipeline import Pipeline\n'), ((4832, 4837), 'ssd.SSD', 'SSD', ([], {}), '()\n'...
#!/usr/bin/env python # coding: utf-8 import numpy as np import sys, os, copy, time import yaml from matplotlib import pyplot as plt from matplotlib.ticker import FormatStrFormatter from tensorboardX import SummaryWriter from pyDOE import lhs import torch from torch.utils.data import TensorDataset, DataLoader from to...
[ "yaml.load", "numpy.random.seed", "numpy.sum", "numpy.abs", "matplotlib.pyplot.clf", "numpy.empty", "numpy.ones", "matplotlib.pyplot.figure", "torch.utils.data.TensorDataset", "matplotlib.pyplot.tight_layout", "os.path.join", "numpy.multiply", "torch.utils.data.DataLoader", "matplotlib.pyp...
[((2504, 2551), 'tensorboardX.SummaryWriter', 'SummaryWriter', (["('runs/mfbo/' + self.model_prefix)"], {}), "('runs/mfbo/' + self.model_prefix)\n", (2517, 2551), False, 'from tensorboardX import SummaryWriter\n'), ((2567, 2597), 'numpy.random.seed', 'np.random.seed', (['self.rand_seed'], {}), '(self.rand_seed)\n', (25...
import numpy as np from scipy.signal import ricker, cwt from cued_datalogger.api.pyqt_extensions import MatplotlibCanvas from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QSlider, QLabel, QSpinBox, QHBoxLayout, QGridLayout, QComboBox from PyQt5.QtCore import Qt import sys #--------------------------...
[ "PyQt5.QtWidgets.QComboBox", "PyQt5.QtWidgets.QLabel", "numpy.meshgrid", "scipy.signal.gausspulse", "scipy.signal.cwt", "PyQt5.QtWidgets.QGridLayout", "PyQt5.QtWidgets.QHBoxLayout", "cued_datalogger.api.pyqt_extensions.MatplotlibCanvas.__init__", "PyQt5.QtWidgets.QVBoxLayout", "numpy.arange", "n...
[((401, 440), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(200)'], {'endpoint': '(False)'}), '(-1, 1, 200, endpoint=False)\n', (412, 440), True, 'import numpy as np\n'), ((511, 527), 'numpy.arange', 'np.arange', (['(1)', '(31)'], {}), '(1, 31)\n', (520, 527), True, 'import numpy as np\n'), ((448, 473), 'numpy.co...
import os import json import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy import stats from shapely.geometry import Point class Contextual: def load_clusters(self, day): with open("./data/mapped/" + str(day) + '.json', "r") as file: return json.load(file) ...
[ "json.load", "matplotlib.pyplot.show", "numpy.amin", "scipy.stats.gaussian_kde", "numpy.amax", "matplotlib.pyplot.figure", "numpy.rot90", "numpy.vstack" ]
[((835, 847), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (845, 847), True, 'import matplotlib.pyplot as plt\n'), ((1061, 1071), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1069, 1071), True, 'import matplotlib.pyplot as plt\n'), ((303, 318), 'json.load', 'json.load', (['file'], {}), '(file...
import numpy as np def rolling_window(a, window): shape = a.shape[:-1] + (a.shape[-1] - window + 1, window) strides = a.strides + (a.strides[-1],) return np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
[ "numpy.lib.stride_tricks.as_strided" ]
[((167, 231), 'numpy.lib.stride_tricks.as_strided', 'np.lib.stride_tricks.as_strided', (['a'], {'shape': 'shape', 'strides': 'strides'}), '(a, shape=shape, strides=strides)\n', (198, 231), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ Created on Thu Apr 22 13:15:02 2021 @author: isand """ import os import argparse import torch import numpy as np from torchvision import transforms import cv2 IMG_EXT = ('.png', '.jpg', '.jpeg', '.JPG', '.JPEG') CLASS_MAP = {"background": 0, "aeroplane": 1, "bicycle": 2, "bird": 3, "boat...
[ "numpy.zeros_like", "argparse.ArgumentParser", "os.makedirs", "cv2.dilate", "cv2.cvtColor", "cv2.waitKey", "os.path.basename", "torchvision.transforms.Normalize", "cv2.imshow", "numpy.ones", "torch.softmax", "torch.hub.load", "torch.no_grad", "os.path.join", "os.listdir", "torchvision....
[((951, 986), 'numpy.ones', 'np.ones', (['(pixels, pixels)', 'np.uint8'], {}), '((pixels, pixels), np.uint8)\n', (958, 986), True, 'import numpy as np\n'), ((1003, 1041), 'cv2.dilate', 'cv2.dilate', (['mask', 'kernel'], {'iterations': '(1)'}), '(mask, kernel, iterations=1)\n', (1013, 1041), False, 'import cv2\n'), ((10...
""" ============================================= Neighborhood Components Analysis Illustration ============================================= This example illustrates a learned distance metric that maximizes the nearest neighbors classification accuracy. It provides a visual representation of this metric compared to t...
[ "matplotlib.pyplot.show", "matplotlib.cm.Set1", "sklearn.datasets.make_classification", "numpy.einsum", "matplotlib.pyplot.figure", "scipy.special.logsumexp", "matplotlib.pyplot.gca", "sklearn.neighbors.NeighborhoodComponentsAnalysis" ]
[((999, 1150), 'sklearn.datasets.make_classification', 'make_classification', ([], {'n_samples': '(9)', 'n_features': '(2)', 'n_informative': '(2)', 'n_redundant': '(0)', 'n_classes': '(3)', 'n_clusters_per_class': '(1)', 'class_sep': '(1.0)', 'random_state': '(0)'}), '(n_samples=9, n_features=2, n_informative=2, n_red...
from functools import partial import numpy from skimage import transform EPS = 1e-66 RESOLUTION = 0.001 num_grids = int(1/RESOLUTION+0.5) def generate_lut(img): """ linear approximation of CDF & marginal :param density_img: :return: lut_y, lut_x """ density_img = transform.resize(img, (num_gri...
[ "functools.partial", "matplotlib.pyplot.NullLocator", "numpy.sum", "matplotlib.pyplot.show", "numpy.zeros", "numpy.random.random", "numpy.array", "skimage.transform.resize", "matplotlib.pyplot.subplots", "skimage.io.imread" ]
[((290, 335), 'skimage.transform.resize', 'transform.resize', (['img', '(num_grids, num_grids)'], {}), '(img, (num_grids, num_grids))\n', (306, 335), False, 'from skimage import transform\n'), ((356, 386), 'numpy.sum', 'numpy.sum', (['density_img'], {'axis': '(1)'}), '(density_img, axis=1)\n', (365, 386), False, 'impor...
""" Focal Unet inference runner poLicensed under the MIT License (see LICENSE for details) """ import cv2 import os import logging import numpy as np from keras.models import load_model from utils.mrcnn_helper import resize_image from pipeline.unet_model import _mean_iou_unet_wrapper from pipeline.model_interface ...
[ "keras.models.load_model", "cv2.resize", "os.path.abspath", "cv2.cvtColor", "os.path.isfile", "numpy.array", "utils.mrcnn_helper.resize_image", "logging.getLogger" ]
[((512, 546), 'logging.getLogger', 'logging.getLogger', (['"""UNetInference"""'], {}), "('UNetInference')\n", (529, 546), False, 'import logging\n'), ((575, 602), 'os.path.abspath', 'os.path.abspath', (['model_path'], {}), '(model_path)\n', (590, 602), False, 'import os\n'), ((859, 958), 'keras.models.load_model', 'loa...
""" Sigmoidal and spline functions to generate cost coverage curves and historical input curves. """ from math import exp, tanh import numpy as np from scipy.interpolate import UnivariateSpline from scipy.integrate import quad def numerical_integration(func, lower, upper): """ Computes the numerical integrat...
[ "math.exp", "pylab.show", "scipy.integrate.quad", "math.tanh", "scipy.interpolate.UnivariateSpline", "numpy.fabs", "numpy.array", "numpy.linalg.solve", "pylab.plot" ]
[((9791, 9802), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (9799, 9802), True, 'import numpy as np\n'), ((9811, 9822), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (9819, 9822), True, 'import numpy as np\n'), ((33214, 33236), 'pylab.plot', 'pylab.plot', (['x', 'y', '"""ro"""'], {}), "(x, y, 'ro')\n", (33224, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### """ This file is a part of the VeRyPy classical vehicle routing problem heuristic library and provides implementations of the Gaskell (1967) \pi and \lambda savings functions for parallel (as in...
[ "numpy.average", "util.is_better_sol", "util.objf", "classic_heuristics.parallel_savings.parallel_savings_init", "builtins.range" ]
[((1246, 1263), 'numpy.average', 'np.average', (['D[0:]'], {}), '(D[0:])\n', (1256, 1263), True, 'import numpy as np\n'), ((1277, 1292), 'builtins.range', 'range', (['(1)', '(n + 1)'], {}), '(1, n + 1)\n', (1282, 1292), False, 'from builtins import range\n'), ((1678, 1693), 'builtins.range', 'range', (['(1)', '(n + 1)'...
import cv2 import random import numpy as np img = cv2.imread('./data/522.jpg') hsv_img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) H, S, V = cv2.split(hsv_img) # H = hsv_img[:,:,0] # S = hsv_img[:,:,1] # V = hsv_img[:,:,2] for i in range(10): H_ = (H + 255 * random.random()) % 256 H_ = H_.astype(np.uint8) S_ =...
[ "numpy.stack", "cv2.cvtColor", "cv2.waitKey", "cv2.imread", "random.random", "cv2.split", "cv2.imshow" ]
[((51, 79), 'cv2.imread', 'cv2.imread', (['"""./data/522.jpg"""'], {}), "('./data/522.jpg')\n", (61, 79), False, 'import cv2\n'), ((90, 126), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (102, 126), False, 'import cv2\n'), ((137, 155), 'cv2.split', 'cv2.split', (['hs...
from architecture import PGNetwork # Deep Learning library import numpy as np # Handle matrices import airsim import random # Handling random number generation import time # Handling time calculation from collections import deque # Ordered collection with ends ### EN...
[ "numpy.stack", "numpy.divide", "numpy.zeros_like", "numpy.sum", "numpy.std", "numpy.zeros", "numpy.amax", "airsim.MultirotorClient", "numpy.mean", "numpy.array" ]
[((874, 899), 'airsim.MultirotorClient', 'airsim.MultirotorClient', ([], {}), '()\n', (897, 899), False, 'import airsim\n'), ((1120, 1154), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {'dtype': 'np.float64'}), '((3, 3), dtype=np.float64)\n', (1128, 1154), True, 'import numpy as np\n'), ((2574, 2604), 'numpy.zeros_like', 'n...
import cv2 import glob import h5py import imageio import matplotlib.pylab as plt import numpy as np import os from keras.preprocessing.image import ImageDataGenerator def normalization(X): return X / 127.5 - 1 def inverse_normalization(X): return np.round((X + 1.) / 2. * 255.).astype('uint8') def get_nb_...
[ "keras.preprocessing.image.ImageDataGenerator", "os.walk", "matplotlib.pylab.close", "matplotlib.pylab.title", "numpy.round", "os.path.join", "matplotlib.pylab.figure", "matplotlib.pylab.legend", "numpy.random.choice", "h5py.File", "numpy.random.binomial", "matplotlib.pylab.clf", "matplotlib...
[((3645, 3680), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**data_gen_args)\n', (3663, 3680), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((3707, 3742), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**data_gen_args)\n',...
#K-means clustering with Mini-Batch #Build with Sklearn #Copyright 2018 <NAME> MIT License. See LICENSE. from sklearn.cluster import KMeans import pandas as pd from matplotlib import pyplot as plt from random import randint import numpy as np #I.The training Dataset dataset = pd.read_csv('data.csv') prin...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "random.randint", "matplotlib.pyplot.plot", "pandas.read_csv", "sklearn.cluster.KMeans", "matplotlib.pyplot.scatter", "numpy.zeros", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((291, 314), 'pandas.read_csv', 'pd.read_csv', (['"""data.csv"""'], {}), "('data.csv')\n", (302, 314), True, 'import pandas as pd\n'), ((518, 540), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, 2)'}), '(shape=(n, 2))\n', (526, 540), True, 'import numpy as np\n'), ((781, 801), 'sklearn.cluster.KMeans', 'KMeans', ([], ...
from os.path import join, basename, splitext import nibabel as nib import numpy.testing as npt from dipy.workflows.segment import median_otsu_flow from dipy.segment.mask import median_otsu from dipy.data import get_data def test_median_otsu_flow(): with nib.tmpdirs.InTemporaryDirectory() as out_dir: data...
[ "nibabel.load", "os.path.basename", "numpy.testing.assert_array_equal", "dipy.segment.mask.median_otsu", "dipy.workflows.segment.median_otsu_flow", "dipy.data.get_data", "nibabel.tmpdirs.InTemporaryDirectory", "os.path.join" ]
[((261, 295), 'nibabel.tmpdirs.InTemporaryDirectory', 'nib.tmpdirs.InTemporaryDirectory', ([], {}), '()\n', (293, 295), True, 'import nibabel as nib\n'), ((334, 354), 'dipy.data.get_data', 'get_data', (['"""small_25"""'], {}), "('small_25')\n", (342, 354), False, 'from dipy.data import get_data\n'), ((551, 655), 'dipy....
# The following code was obtained from https://github.com/florensacc/rllab-curriculum # and only slightly modified to fit the project structure. The original license of # the software is the following: # The MIT License (MIT) # Copyright (c) 2016 rllab contributors # rllab uses a shared copyright model: each contrib...
[ "numpy.random.uniform", "numpy.amin", "numpy.random.randn", "numpy.zeros", "numpy.ones", "numpy.clip", "TeachMyAgent.teachers.utils.gan.gan.FCGAN", "multiprocessing.Pool", "numpy.random.randint", "numpy.array", "numpy.mean", "numpy.random.choice", "numpy.concatenate" ]
[((1924, 1962), 'numpy.random.randint', 'np.random.randint', (['(0)', 'M.shape[0]', 'size'], {}), '(0, M.shape[0], size)\n', (1941, 1962), True, 'import numpy as np\n'), ((1991, 2042), 'numpy.random.choice', 'np.random.choice', (['M.shape[0]', 'size'], {'replace': 'replace'}), '(M.shape[0], size, replace=replace)\n', (...
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
[ "numpy.full", "gluonts.core.component.validated", "numpy.zeros", "gluonts.transform.shift_timestamp", "gluonts.transform.target_transformation_length", "numpy.broadcast_to", "numpy.concatenate" ]
[((992, 1003), 'gluonts.core.component.validated', 'validated', ([], {}), '()\n', (1001, 1003), False, 'from gluonts.core.component import validated\n'), ((1658, 1669), 'gluonts.core.component.validated', 'validated', ([], {}), '()\n', (1667, 1669), False, 'from gluonts.core.component import validated\n'), ((1344, 1429...
# coding: utf-8 import numpy as np from chainer_compiler.elichika import testtools import chainer import chainer.links as L class A(chainer.Chain): def __init__(self): super(A, self).__init__() with self.init_scope(): self.l1 = L.BatchNormalization(3) def forward(self, x): ...
[ "numpy.random.rand", "chainer.links.BatchNormalization", "numpy.random.seed", "chainer_compiler.elichika.testtools.generate_testcase" ]
[((446, 465), 'numpy.random.seed', 'np.random.seed', (['(314)'], {}), '(314)\n', (460, 465), True, 'import numpy as np\n'), ((543, 582), 'chainer_compiler.elichika.testtools.generate_testcase', 'testtools.generate_testcase', (['model', '[v]'], {}), '(model, [v])\n', (570, 582), False, 'from chainer_compiler.elichika im...
import SimpleITK as sitk import numpy as np image = sitk.ReadImage('data/MR/subject101_ed.nii') image_data = sitk.GetArrayFromImage(image) labels_org = sitk.ReadImage('data/MR/subject101_ed_label.nii') labels = sitk.GetArrayFromImage(labels_org) label_left = sitk.GetImageFromArray((labels == 34) * 1) #label_left.SetS...
[ "SimpleITK.ThresholdSegmentationLevelSetImageFilter", "numpy.logical_and", "numpy.std", "SimpleITK.Show", "SimpleITK.ReadImage", "SimpleITK.BinaryDilate", "SimpleITK.GetArrayFromImage", "SimpleITK.SignedMaurerDistanceMap", "numpy.mean", "numpy.logical_or", "SimpleITK.GetImageFromArray", "Simpl...
[((53, 96), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['"""data/MR/subject101_ed.nii"""'], {}), "('data/MR/subject101_ed.nii')\n", (67, 96), True, 'import SimpleITK as sitk\n'), ((110, 139), 'SimpleITK.GetArrayFromImage', 'sitk.GetArrayFromImage', (['image'], {}), '(image)\n', (132, 139), True, 'import SimpleITK as sit...
""" Beta-Series Modeling for Task-Based Functional Connectivity and Decoding ======================================================================== This example shows how to run beta series :term:`GLM` models, which are a common modeling approach for a variety of analyses of task-based :term:`fMRI` data with an event...
[ "nilearn.image.concat_imgs", "nilearn.maskers.NiftiMasker", "nilearn.datasets.fetch_language_localizer_demo_dataset", "nilearn.plotting.plot_design_matrix", "nilearn.plotting.plot_stat_map", "nilearn.glm.first_level.first_level_from_bids", "nilearn.glm.first_level.FirstLevelModel", "numpy.dot", "mat...
[((3596, 3635), 'nilearn.datasets.fetch_language_localizer_demo_dataset', 'fetch_language_localizer_demo_dataset', ([], {}), '()\n', (3633, 3635), False, 'from nilearn.datasets import fetch_language_localizer_demo_dataset\n'), ((3758, 3849), 'nilearn.glm.first_level.first_level_from_bids', 'first_level_from_bids', (['d...
import numpy as np import spacy import collections import time import os class MyInputGenerator(object): def __init__(self, dirname, vocab, seq_length, sequences_step, num_epochs, batch_size=1) : self.dirname = dirname self.batch_size = batch_size self.num_epochs = num_epochs self.vocab = vocab self.voca...
[ "spacy.load", "numpy.zeros", "os.listdir" ]
[((423, 452), 'spacy.load', 'spacy.load', (['"""fr_core_news_sm"""'], {}), "('fr_core_news_sm')\n", (433, 452), False, 'import spacy\n'), ((2138, 2194), 'numpy.zeros', 'np.zeros', (['(len_s, seq_length, vocab_size)'], {'dtype': 'np.bool'}), '((len_s, seq_length, vocab_size), dtype=np.bool)\n', (2146, 2194), True, 'impo...
from __future__ import print_function,division,absolute_import,unicode_literals import sys, os, time, yaml, numpy as np from scipy.signal import argrelmax from scipy.interpolate import interp1d from multiprocessing import Queue # animated displays running as background processes/threads from picodaqa.Oscilloscope imp...
[ "numpy.sum", "os.makedirs", "numpy.argmax", "numpy.array_str", "yaml.dump", "numpy.zeros", "os.path.exists", "time.time", "numpy.around", "scipy.signal.argrelmax", "time.localtime", "numpy.int32", "numpy.linspace", "numpy.correlate", "scipy.interpolate.interp1d", "sys.exit" ]
[((1283, 1346), 'scipy.interpolate.interp1d', 'interp1d', (['ti', 'ri'], {'kind': '"""linear"""', 'copy': '(False)', 'assume_sorted': '(True)'}), "(ti, ri, kind='linear', copy=False, assume_sorted=True)\n", (1291, 1346), False, 'from scipy.interpolate import interp1d\n'), ((1789, 1810), 'numpy.linspace', 'np.linspace',...
from models.matches import Matches import random import numpy as np import logging from models.match import Match from models.playerinfo import Playerinfo import pytz class Message: matches = Matches punlines = {} verb_numbers = {} meme_const_cats = [] meme_const_cats_arr = [] meme_const_cats_s...
[ "logging.basicConfig", "random.choice", "numpy.sort", "numpy.where", "logging.getLogger" ]
[((375, 482), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (394, 482), False, 'import logging\n'), ((511, 538), 'loggin...
from typing import Dict import logging import numpy as np from ray.rllib.policy.rnn_sequencing import timeslice_along_seq_lens_with_overlap from ray.rllib.utils.annotations import override from ray.rllib.utils.replay_buffers.multi_agent_replay_buffer import ( MultiAgentReplayBuffer, ReplayMode, ) from ray.rlli...
[ "ray.util.debug.log_once", "numpy.abs", "ray.rllib.utils.annotations.override", "ray.rllib.utils.timer.TimerStat", "numpy.mean", "ray.rllib.utils.replay_buffers.multi_agent_replay_buffer.MultiAgentReplayBuffer.__init__", "ray.rllib.policy.rnn_sequencing.timeslice_along_seq_lens_with_overlap", "logging...
[((675, 702), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (692, 702), False, 'import logging\n'), ((6071, 6103), 'ray.rllib.utils.annotations.override', 'override', (['MultiAgentReplayBuffer'], {}), '(MultiAgentReplayBuffer)\n', (6079, 6103), False, 'from ray.rllib.utils.annotations im...
# -*- coding: utf-8 -*- from .Utils import toTime,toFreq import numpy as np #Encapsulates the signal with some functions #Store its original signal and the weights applied class Signal: def __init__(self,Spectrum): self.Spectrum = Spectrum self.Weights = np.ones(len(Spectrum)) def freq...
[ "numpy.squeeze" ]
[((495, 512), 'numpy.squeeze', 'np.squeeze', (['noise'], {}), '(noise)\n', (505, 512), True, 'import numpy as np\n')]
import numpy as np with open("input.txt") as f: lines = f.readlines() lines = [list(l.strip()) for l in lines] a = np.array(lines, dtype=int) orig = a[:] # Create replicated halo that's larger a = np.c_[a[:,0]+1, a, a[:,-1]+1] a = np.r_[[a[0,:]+1], a, [a[-1,:]+1]] local_min = (a[1:-1,1:-1] < a[1:-1...
[ "numpy.array", "numpy.sum" ]
[((125, 151), 'numpy.array', 'np.array', (['lines'], {'dtype': 'int'}), '(lines, dtype=int)\n', (133, 151), True, 'import numpy as np\n'), ((472, 499), 'numpy.sum', 'np.sum', (['(orig[local_min] + 1)'], {}), '(orig[local_min] + 1)\n', (478, 499), True, 'import numpy as np\n')]
#!/usr/bin/env python3 import logging from copy import deepcopy from pathlib import Path import numpy as np import tables from traitlets.config import Config from astropy import units as u from ctapipe.calib import CameraCalibrator from ctapipe.instrument import SubarrayDescription from ctapipe.io import DataLevel, E...
[ "ctapipe.calib.CameraCalibrator", "copy.deepcopy", "ctapipe.io.EventSource", "numpy.allclose", "traitlets.config.Config", "pathlib.Path", "tables.open_file", "ctapipe.instrument.SubarrayDescription.from_hdf", "ctapipe.utils.get_dataset_path", "ctapipe.io.datawriter.DataWriter" ]
[((1530, 1560), 'pathlib.Path', 'Path', (["(tmpdir / 'events.dl1.h5')"], {}), "(tmpdir / 'events.dl1.h5')\n", (1534, 1560), False, 'from pathlib import Path\n'), ((1752, 1794), 'ctapipe.calib.CameraCalibrator', 'CameraCalibrator', ([], {'subarray': 'source.subarray'}), '(subarray=source.subarray)\n', (1768, 1794), Fals...
#!/usr/bin/python ######################################################################################################################## # # Copyright (c) 2014, Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permi...
[ "laygo.GridLayoutGeneratorHelper.generate_power_rails_from_rails_rect", "yaml.load", "numpy.concatenate", "imp.find_module", "os.path.exists", "laygo.GridLayoutGenerator", "numpy.array", "laygo.GridLayoutGeneratorHelper.generate_power_rails_from_rails_xy", "bag.BagProject", "numpy.vstack" ]
[((3106, 3122), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (3114, 3122), True, 'import numpy as np\n'), ((5059, 5075), 'numpy.array', 'np.array', (['[4, 0]'], {}), '([4, 0])\n', (5067, 5075), True, 'import numpy as np\n'), ((6235, 6253), 'numpy.array', 'np.array', (['[xl, xr]'], {}), '([xl, xr])\n', (62...
import sys sys.path.append("../data/") from data_partition import data_construction import argparse import os import librosa import numpy import pickle GAS_FEATURE_DIR = '/mnt/scratch/hudi/sound-dataset/audioset' with open(os.path.join(GAS_FEATURE_DIR, 'normalizer.pkl'), 'rb') as f: u = pickle._Unpickler(f) u...
[ "sys.path.append", "numpy.save", "numpy.abs", "argparse.ArgumentParser", "numpy.std", "pickle._Unpickler", "librosa.core.power_to_db", "data_partition.data_construction", "numpy.mean", "librosa.load", "librosa.core.stft", "os.path.join", "numpy.concatenate" ]
[((11, 38), 'sys.path.append', 'sys.path.append', (['"""../data/"""'], {}), "('../data/')\n", (26, 38), False, 'import sys\n'), ((294, 314), 'pickle._Unpickler', 'pickle._Unpickler', (['f'], {}), '(f)\n', (311, 314), False, 'import pickle\n'), ((507, 628), 'librosa.core.stft', 'librosa.core.stft', (['wav'], {'n_fft': '...
"""Tests based on the Medford example.""" import lsmaker import os import numpy as np import pandas as pd import pyproj import pytest @pytest.fixture(scope='module') def lsmaker_instance_from_xml(): config_file = 'examples/medford/Medford_lines.xml' ls = lsmaker.LinesinkData(config_file) return ls @pyte...
[ "pandas.testing.assert_frame_equal", "pyproj.CRS.from_epsg", "numpy.allclose", "pytest.fixture", "os.path.exists", "pytest.mark.parametrize", "lsmaker.LinesinkData" ]
[((137, 167), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (151, 167), False, 'import pytest\n'), ((316, 346), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (330, 346), False, 'import pytest\n'), ((629, 755), 'pytest.mark.paramet...
# Copyright 2014 Diamond Light Source Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
[ "numpy.meshgrid", "numpy.abs", "numpy.log", "numpy.copy", "numpy.sum", "numpy.tanh", "numpy.zeros", "numpy.mean", "numpy.arange", "numpy.exp", "numpy.diff", "numpy.cosh", "numpy.int16", "numpy.sinh", "numpy.sqrt" ]
[((1940, 1965), 'numpy.arange', 'np.arange', (['(0)', 'self.width1'], {}), '(0, self.width1)\n', (1949, 1965), True, 'import numpy as np\n'), ((1982, 2007), 'numpy.arange', 'np.arange', (['(0)', 'self.width1'], {}), '(0, self.width1)\n', (1991, 2007), True, 'import numpy as np\n'), ((2031, 2056), 'numpy.meshgrid', 'np....
""" Measure curvature. """ import numpy as np def measure_curvature(pp, deforms): """ Take curvature measurements. With 10 phases: * mean curvature per phase (list of 10 values) * max curvature per phase (list of 10 values) * max_curvature locations list of 10 positions) * tuple (position, max-va...
[ "numpy.stack", "numpy.zeros_like", "numpy.argmax", "numpy.asarray", "numpy.gradient" ]
[((388, 402), 'numpy.asarray', 'np.asarray', (['pp'], {}), '(pp)\n', (398, 402), True, 'import numpy as np\n'), ((2988, 3009), 'numpy.gradient', 'np.gradient', (['pp[:, 0]'], {}), '(pp[:, 0])\n', (2999, 3009), True, 'import numpy as np\n'), ((3019, 3040), 'numpy.gradient', 'np.gradient', (['pp[:, 1]'], {}), '(pp[:, 1])...
# -*- coding: utf-8 -*- r"""MassSolution is a class for storing the simulation results. After a :class:`~.Simulation` is used to simulate a :mod:`mass` model, :class:`MassSolution`\ s are created to store the results computed over the time interval specified when simulating. These results are divided into two categori...
[ "mass.core.mass_configuration.MassConfiguration", "mass.visualization.plot_tiled_phase_portraits", "sympy.Symbol", "pandas.DataFrame.from_dict", "six.iterkeys", "mass.visualization.visualization_util._validate_visualization_packages", "mass.util.util.apply_decimal_precision", "mass.visualization.plot_...
[((1761, 1780), 'mass.core.mass_configuration.MassConfiguration', 'MassConfiguration', ([], {}), '()\n', (1778, 1780), False, 'from mass.core.mass_configuration import MassConfiguration\n'), ((4740, 4762), 'mass.util.util.ensure_iterable', 'ensure_iterable', (['value'], {}), '(value)\n', (4755, 4762), False, 'from mass...
"""Train the model """ import importlib import numpy as np import tensorflow.compat.v1 as tf from config import CONFIG MODELS = importlib.import_module( '.'.join(('musegan', CONFIG['exp']['model'], 'models'))) def load_data(): """Load and return the training data.""" print('[*] Loading data...') # Loa...
[ "tensorflow.compat.v1.Session", "numpy.load", "SharedArray.attach" ]
[((452, 494), 'SharedArray.attach', 'sa.attach', (["CONFIG['data']['training_data']"], {}), "(CONFIG['data']['training_data'])\n", (461, 494), True, 'import SharedArray as sa\n'), ((1499, 1538), 'tensorflow.compat.v1.Session', 'tf.Session', ([], {'config': "CONFIG['tensorflow']"}), "(config=CONFIG['tensorflow'])\n", (1...
#!/usr/bin/env python # -*- coding: utf-8 -*- # This software is under a BSD license. See LICENSE.txt for details. from datatank_py.DTRegion2D import DTRegion2D import numpy as np class DTTriangularGrid2D(object): """2D triangular grid object. This is a collection of points interconnected to form triangles....
[ "numpy.shape", "numpy.nanmax", "numpy.nanmin" ]
[((2215, 2237), 'numpy.shape', 'np.shape', (['self._points'], {}), '(self._points)\n', (2223, 2237), True, 'import numpy as np\n'), ((2382, 2411), 'numpy.nanmin', 'np.nanmin', (['self._points[:, 0]'], {}), '(self._points[:, 0])\n', (2391, 2411), True, 'import numpy as np\n'), ((2412, 2441), 'numpy.nanmax', 'np.nanmax',...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np from mmcv.fileio import FileClient from ..builder import PIPELINES @PIPELINES.register_module() class LoadImageFromFile: """Load image from file. Args: io_backend (str): io backend where images are store. Default: 'disk'....
[ "mmcv.fileio.FileClient", "mmcv.imfrombytes", "numpy.expand_dims" ]
[((2081, 2185), 'mmcv.imfrombytes', 'mmcv.imfrombytes', (['img_bytes'], {'flag': 'self.flag', 'channel_order': 'self.channel_order', 'backend': 'self.backend'}), '(img_bytes, flag=self.flag, channel_order=self.\n channel_order, backend=self.backend)\n', (2097, 2185), False, 'import mmcv\n'), ((5395, 5438), 'mmcv.imf...
#!/usr/bin/env python # coding: utf-8 # 请点击[此处](https://ai.baidu.com/docs#/AIStudio_Project_Notebook/a38e5576)查看本环境基本用法. <br> # Please click [here ](https://ai.baidu.com/docs#/AIStudio_Project_Notebook/a38e5576) for more detailed instructions. # In[68]: # 加载飞桨、Numpy和相关类库 import paddle from paddle.nn import Linear...
[ "paddle.mean", "paddle.nn.Linear", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "paddle.load", "numpy.float32", "numpy.zeros", "paddle.nn.functional.square_error_cost", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.array", "numpy.loadtxt", "numpy.linspace", "matplotlib....
[((3201, 3233), 'paddle.load', 'paddle.load', (['"""LR_model.pdparams"""'], {}), "('LR_model.pdparams')\n", (3212, 3233), False, 'import paddle\n'), ((3377, 3402), 'paddle.to_tensor', 'paddle.to_tensor', (['dataone'], {}), '(dataone)\n', (3393, 3402), False, 'import paddle\n'), ((3729, 3741), 'matplotlib.pyplot.figure'...
# -*- coding: utf-8 -*- """ Created on Fri Nov 6 13:53:16 2020 @author: DANILO """ import numpy as np def pdf(arr): min_value = np.min(arr) max_value = np.max(arr) pdf_distr = np.zeros(max_value+1) for g in range(min_value,max_value): pdf_distr[g] = len(arr[arr == g]) ...
[ "numpy.sum", "numpy.power", "numpy.zeros", "numpy.min", "numpy.max" ]
[((142, 153), 'numpy.min', 'np.min', (['arr'], {}), '(arr)\n', (148, 153), True, 'import numpy as np\n'), ((170, 181), 'numpy.max', 'np.max', (['arr'], {}), '(arr)\n', (176, 181), True, 'import numpy as np\n'), ((203, 226), 'numpy.zeros', 'np.zeros', (['(max_value + 1)'], {}), '(max_value + 1)\n', (211, 226), True, 'im...
import torch import os as os import json import pickle import numpy as np import scipy.sparse import logging import collections import ConfigSpace import ConfigSpace.hyperparameters as CSH from autoPyTorch.pipeline.base.pipeline_node import PipelineNode from autoPyTorch.utils.config.config_option import Conf...
[ "os.path.dirname", "os.path.isfile", "numpy.array", "collections.OrderedDict", "os.path.join" ]
[((769, 992), 'collections.OrderedDict', 'collections.OrderedDict', (["{'random_forest': baselines.RFBaseline, 'extra_trees': baselines.\n ExtraTreesBaseline, 'lgb': baselines.LGBBaseline, 'catboost': baselines\n .CatboostBaseline, 'knn': baselines.KNNBaseline}"], {}), "({'random_forest': baselines.RFBaseline,\n ...
import numpy as np import xarray as xr from xrspatial import equal_interval from xrspatial import natural_breaks from xrspatial import quantile def test_quantile(): k = 5 n, m = 5, 5 agg = xr.DataArray(np.arange(n * m).reshape((n, m)), dims=['x', 'y']) agg['x'] = np.linspace(0, n, n) agg['y'] = n...
[ "numpy.all", "xrspatial.equal_interval", "numpy.arange", "numpy.linspace", "xrspatial.quantile", "numpy.unique", "xrspatial.natural_breaks" ]
[((283, 303), 'numpy.linspace', 'np.linspace', (['(0)', 'n', 'n'], {}), '(0, n, n)\n', (294, 303), True, 'import numpy as np\n'), ((319, 339), 'numpy.linspace', 'np.linspace', (['(0)', 'm', 'm'], {}), '(0, m, m)\n', (330, 339), True, 'import numpy as np\n'), ((360, 378), 'xrspatial.quantile', 'quantile', (['agg'], {'k'...
# -*- coding: utf-8 -*- """ @date: 2021/2/2 下午8:51 @file: repvgg_util.py @author: zj @description: """ import torch import torch.nn as nn import numpy as np # This func derives the equivalent kernel and bias in a DIFFERENTIABLE way. # You can get the equivalent kernel and bias at any time and do whatever you w...
[ "torch.from_numpy", "numpy.zeros", "torch.nn.functional.pad" ]
[((1094, 1146), 'torch.nn.functional.pad', 'torch.nn.functional.pad', (['kernel1x1', '([padding_11] * 4)'], {}), '(kernel1x1, [padding_11] * 4)\n', (1117, 1146), False, 'import torch\n'), ((1826, 1884), 'numpy.zeros', 'np.zeros', (['(in_channels, input_dim, 3, 3)'], {'dtype': 'np.float32'}), '((in_channels, input_dim, ...
# -*- coding: utf-8 -*- import random import logging import copy from game.ai.base.main import InterfaceAI # from mahjong.shanten import Shanten from game.ai.Shanten import Shanten from mahjong.tile import TilesConverter from mahjong.meld import Meld from mahjong.utils import is_man, is_pin, is_sou, is_pon, is_chi fro...
[ "mahjong.hand_calculating.divider.HandDivider", "copy.deepcopy", "mahjong.utils.is_man", "mahjong.utils.is_sou", "mahjong.utils.is_pin", "mahjong.utils.is_pon", "mahjong.utils.is_chi", "mahjong.agari.Agari", "mahjong.tile.TilesConverter.to_34_array", "game.ai.Shanten.Shanten", "numpy.array", "...
[((435, 458), 'logging.getLogger', 'logging.getLogger', (['"""ai"""'], {}), "('ai')\n", (452, 458), False, 'import logging\n'), ((1001, 1010), 'game.ai.Shanten.Shanten', 'Shanten', ([], {}), '()\n', (1008, 1010), False, 'from game.ai.Shanten import Shanten\n'), ((1039, 1052), 'mahjong.hand_calculating.divider.HandDivid...