code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- 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...
[ "qiskit.quantum_info.random.random_unitary", "qiskit.QuantumCircuit", "numpy.random.seed", "qiskit.providers.basicaer.QasmSimulatorPy", "qiskit.mapper.two_qubit_kak", "qiskit.tools.qi.qi.random_unitary_matrix", "numpy.floor", "qiskit.transpiler.transpile", "numpy.random.permutation", "qiskit.Quant...
[((1726, 1746), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1740, 1746), True, 'import numpy as np\n'), ((1761, 1782), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['width'], {}), '(width)\n', (1775, 1782), False, 'from qiskit import QuantumCircuit, QuantumRegister\n'), ((2567, 2589), 'qiskit.Qua...
from __future__ import print_function import numpy as np def AlignCrop(images, offsets): '''Crops images given a list of input Images (Image class) and corresponding offsets from each other: images should be aligned according to offsets offsets is a 2 by N array, with x on top row, y offsets on bottom row''' ...
[ "numpy.shape", "numpy.append", "numpy.max", "numpy.min", "numpy.array" ]
[((336, 348), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (344, 348), True, 'import numpy as np\n'), ((392, 426), 'numpy.append', 'np.append', (['maxcorners', 'ii.size[:2]'], {}), '(maxcorners, ii.size[:2])\n', (401, 426), True, 'import numpy as np\n'), ((1076, 1093), 'numpy.shape', 'np.shape', (['ii.data'], {})...
# Make a prediction with weights import numpy as np import matplotlib.pyplot as plt i=1 import pandas as pd dat=np.array([]) def predict(row, weights): activation = weights[0] for i in range(len(row)-1): activation += weights[i + 1] * row[i] return 1.0 if activation >= 0.0 else 0.0 def plot(dataset,...
[ "pandas.DataFrame", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "numpy.amin", "matplotlib.pyplot.plot", "numpy.amax", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((119, 131), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (127, 131), True, 'import numpy as np\n'), ((841, 860), 'matplotlib.pyplot.plot', 'plt.plot', (['(0)', '(0)', '"""o"""'], {}), "(0, 0, 'o')\n", (849, 860), True, 'import matplotlib.pyplot as plt\n'), ((865, 884), 'matplotlib.pyplot.plot', 'plt.plot', (['(...
from functools import partial from itertools import repeat import collections.abc as container_abcs import logging import os from collections import OrderedDict import numpy as np import scipy import paddle import paddlenlp import paddle.nn as nn import paddle.nn.functional as F from .rearrange impo...
[ "paddle.nn.Dropout", "paddle.nn.initializer.TruncatedNormal", "paddle.concat", "paddle.load", "paddle.nn.AvgPool2D", "os.path.isfile", "ppcls.vision_transformer.DropPath", "numpy.sqrt", "paddle.nn.functional.softmax", "paddle.squeeze", "scipy.ndimage.zoom", "paddle.nn.Conv2D", "paddle.nn.Bat...
[((1134, 1172), 'paddle.to_tensor', 'paddle.to_tensor', (['ret'], {'dtype': 'orig_type'}), '(ret, dtype=orig_type)\n', (1150, 1172), False, 'import paddle\n'), ((1691, 1730), 'paddle.nn.Linear', 'nn.Linear', (['in_features', 'hidden_features'], {}), '(in_features, hidden_features)\n', (1700, 1730), True, 'import paddle...
#coding:utf-8 import os import os.path as osp import numpy as np import torch from torch import nn import yaml import torch.nn.functional as F def build_critic(critic_params={}): critic = { "mse": nn.MSELoss(), "masked_mse": MaskedMSELoss(), "bce": nn.BCEWithLogitsLoss(), "ce": nn.C...
[ "torch.nn.MSELoss", "torch.nn.BCEWithLogitsLoss", "numpy.log", "torch.nn.CrossEntropyLoss", "torch.exp", "torch.sigmoid", "torch.nn.CTCLoss", "torch.arange", "torch.zeros", "torch.sum", "torch.log" ]
[((6127, 6169), 'torch.arange', 'torch.arange', (['(0)', 'maxlen'], {'dtype': 'torch.int64'}), '(0, maxlen, dtype=torch.int64)\n', (6139, 6169), False, 'import torch\n'), ((210, 222), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (220, 222), False, 'from torch import nn\n'), ((278, 300), 'torch.nn.BCEWithLogitsLo...
from numpy import array, append, cross, sign, seterr, around, array_equal from numpy.linalg import det, solve seterr(all='raise') def dist(p,q): """ Calculates the distance between the points p and q. Parameters --------- p : Point the first point q : Point the second point ...
[ "numpy.seterr", "numpy.append", "numpy.array", "numpy.sign", "numpy.array_equal", "numpy.linalg.det" ]
[((110, 129), 'numpy.seterr', 'seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (116, 129), False, 'from numpy import array, append, cross, sign, seterr, around, array_equal\n'), ((1779, 1802), 'numpy.array', 'array', (['[_a, _b, _c, _d]'], {}), '([_a, _b, _c, _d])\n', (1784, 1802), False, 'from numpy import a...
import numpy as np k = 5 def kfoldCV(model, train_valid_sets): sum_acc = .0 for (train_set, valid_set) in train_valid_sets: (X_train, y_train) = train_set (X_valid, y_valid) = valid_set model_fit = model.fit(X_train, y_train) yh_valid = model_fit.predict(X_valid) cmat ...
[ "numpy.sum", "numpy.zeros", "numpy.max", "numpy.random.permutation", "numpy.diag" ]
[((544, 568), 'numpy.random.permutation', 'np.random.permutation', (['n'], {}), '(n)\n', (565, 568), True, 'import numpy as np\n'), ((1048, 1080), 'numpy.zeros', 'np.zeros', (['(n_classes, n_classes)'], {}), '((n_classes, n_classes))\n', (1056, 1080), True, 'import numpy as np\n'), ((1019, 1028), 'numpy.max', 'np.max',...
import numpy as np import matplotlib.pyplot as plt def TestPigtail(IntModel='jrm09',ExtModel='Con2020', t0=(302,12,50),t1=(302,21,00)): from ..TraceField import TraceField from ..Con2020 import Config from ..Internal._ReadTestPos import _ReadTestPos import DateTimeTools as TT #read the data print('Readi...
[ "DateTimeTools.DayNotoDate", "numpy.where", "numpy.int32" ]
[((713, 728), 'numpy.int32', 'np.int32', (['dayno'], {}), '(dayno)\n', (721, 728), True, 'import numpy as np\n'), ((759, 783), 'DateTimeTools.DayNotoDate', 'TT.DayNotoDate', (['year', 'dn'], {}), '(year, dn)\n', (773, 783), True, 'import DateTimeTools as TT\n'), ((536, 575), 'numpy.where', 'np.where', (['((dayno >= d0)...
"""Class to perform under-sampling using balace cascade.""" from __future__ import print_function import numpy as np from sklearn.utils import check_X_y from .ensemble_sampler import EnsembleSampler class BalanceCascade(EnsembleSampler): """Perform under-sampling using an ensemble of subset selected using ...
[ "sklearn.ensemble.RandomForestClassifier", "sklearn.ensemble.AdaBoostClassifier", "numpy.random.seed", "numpy.count_nonzero", "sklearn.utils.check_X_y", "numpy.ones", "sklearn.tree.DecisionTreeClassifier", "numpy.nonzero", "sklearn.ensemble.GradientBoostingClassifier", "sklearn.neighbors.KNeighbor...
[((6671, 6686), 'sklearn.utils.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (6680, 6686), False, 'from sklearn.utils import check_X_y\n'), ((7652, 7667), 'sklearn.utils.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (7661, 7667), False, 'from sklearn.utils import check_X_y\n'), ((8665, 8692), 'numpy.a...
# -*- coding: utf-8 -*- import numpy as np def euler2RM(roll,pitch,yaw): R = np.array([[0.0,0.0,0.0],[0.0,0.0,0.0],[0.0,0.0,0.0]]) cr = np.cos(roll) sr = np.sin(roll) cp = np.cos(pitch) sp = np.sin(pitch) cy = np.cos(yaw) sy = np.sin(yaw) R[0,0] = cp*cy R[1,0] = -cr*s...
[ "numpy.sin", "numpy.array", "numpy.cos" ]
[((82, 143), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]'], {}), '([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]])\n', (90, 143), True, 'import numpy as np\n'), ((145, 157), 'numpy.cos', 'np.cos', (['roll'], {}), '(roll)\n', (151, 157), True, 'import numpy as np\n'), ((167, 17...
# -*- coding: utf-8 -*- """ ============================================================================= Title : Domain transforms script Project : Simulation environment for BckTrk app File : transform.py ----------------------------------------------------------------------------- Descripti...
[ "scipy.fftpack.dct", "numpy.zeros", "logging.getLogger" ]
[((742, 769), 'logging.getLogger', 'logging.getLogger', (['"""BckTrk"""'], {}), "('BckTrk')\n", (759, 769), False, 'import logging\n'), ((1368, 1408), 'numpy.zeros', 'np.zeros', (['(2, self.m_acquisition_length)'], {}), '((2, self.m_acquisition_length))\n', (1376, 1408), True, 'import numpy as np\n'), ((1442, 1487), 's...
import os import logging import math import numpy as np import cv2 from typing import Tuple, List class AdvancedLaneFinderError(Exception): """Exception to be thrown in case of failure in AdvancedLaneFinding.""" pass class AdvancedLaneFinder: """Class implementing lane line finding using advanced techn...
[ "numpy.absolute", "numpy.sum", "cv2.bitwise_and", "numpy.polyfit", "cv2.getPerspectiveTransform", "numpy.argmax", "cv2.fillPoly", "numpy.mean", "cv2.rectangle", "os.path.join", "cv2.undistort", "cv2.warpPerspective", "numpy.zeros_like", "os.path.abspath", "numpy.int_", "cv2.cvtColor", ...
[((1432, 1507), 'numpy.array', 'np.array', (['[[(0, 720), (640, 405), (640, 405), (1280, 720)]]'], {'dtype': 'np.int32'}), '([[(0, 720), (640, 405), (640, 405), (1280, 720)]], dtype=np.int32)\n', (1440, 1507), True, 'import numpy as np\n'), ((3327, 3362), 'os.path.isdir', 'os.path.isdir', (['chessboard_image_dir'], {})...
import copy import os.path as osp import numpy as np import pytest from mmcv.utils import build_from_cfg from mmtrack.datasets import PIPELINES class TestFormatting(object): @classmethod def setup_class(cls): cls.data_prefix = osp.join(osp.dirname(__file__), '../assets') def test_formatting(se...
[ "copy.deepcopy", "mmcv.utils.build_from_cfg", "numpy.random.randn", "os.path.dirname", "pytest.raises", "numpy.random.randint" ]
[((722, 753), 'mmcv.utils.build_from_cfg', 'build_from_cfg', (['load', 'PIPELINES'], {}), '(load, PIPELINES)\n', (736, 753), False, 'from mmcv.utils import build_from_cfg\n'), ((1070, 1104), 'mmcv.utils.build_from_cfg', 'build_from_cfg', (['collect', 'PIPELINES'], {}), '(collect, PIPELINES)\n', (1084, 1104), False, 'fr...
#template example #mandatory imports import pymodaq.daq_utils.parameter.utils from pymodaq.daq_utils.daq_utils import ThreadCommand from pymodaq.daq_viewer.utility_classes import comon_parameters from pymodaq.daq_viewer.utility_classes import DAQ_Viewer_base import numpy as np from collections import OrderedDict from ...
[ "PyQt5.QtCore.pyqtSignal", "PyQt5.QtWidgets.QMessageBox", "PyQt5.QtWidgets.QApplication.processEvents", "pymodaq.daq_utils.daq_utils.ThreadCommand", "easydict.EasyDict", "numpy.linspace", "platform.system", "platform.machine", "ctypes.util.find_library" ]
[((632, 649), 'platform.system', 'platform.system', ([], {}), '()\n', (647, 649), False, 'import platform\n'), ((674, 710), 'ctypes.util.find_library', 'ctypes.util.find_library', (['"""libandor"""'], {}), "('libandor')\n", (698, 710), False, 'import ctypes\n'), ((1594, 1613), 'PyQt5.QtCore.pyqtSignal', 'QtCore.pyqtSig...
import numpy as np import pandas as pd def classification(values, classes, ascending=True, bins=None, round_bins=None): """ Return the array of classes of the values, for the given classes Inputs: values: np.array of values to classify classes: ordered list of classe names ascendin...
[ "numpy.sort", "numpy.histogram", "numpy.array", "pandas.Series", "numpy.digitize", "numpy.round" ]
[((896, 927), 'numpy.histogram', 'np.histogram', (['values'], {'bins': 'bins'}), '(values, bins=bins)\n', (908, 927), True, 'import numpy as np\n'), ((1958, 1980), 'pandas.Series', 'pd.Series', (['result_dict'], {}), '(result_dict)\n', (1967, 1980), True, 'import pandas as pd\n'), ((1095, 1134), 'numpy.round', 'np.roun...
# ============================================================================= # Copyright 2016 The TensorFlow 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 #...
[ "tensorflow.python.ops.gradient_checker.compute_gradient_error", "tensorflow.python.ops.variables.global_variables_initializer", "tensorflow.contrib.periodic_resample.periodic_resample", "numpy.zeros", "tensorflow.python.platform.googletest.main", "numpy.array", "numpy.arange", "tensorflow.python.ops....
[((5666, 5683), 'tensorflow.python.platform.googletest.main', 'googletest.main', ([], {}), '()\n', (5681, 5683), False, 'from tensorflow.python.platform import googletest\n'), ((1473, 1495), 'numpy.array', 'numpy.array', (['[6, None]'], {}), '([6, None])\n', (1484, 1495), False, 'import numpy\n'), ((1871, 1893), 'numpy...
from .core import GridWorldScene import numpy as np from .util import compute_shortest_path_data, enumerate_positions class MazeGraph(GridWorldScene): def __init__(self, maze, goal, *args, **kwargs): super().__init__(*args, **kwargs) self._maze = maze self.graph, self.optimal_actions = comp...
[ "numpy.array", "numpy.expand_dims" ]
[((675, 700), 'numpy.array', 'np.array', (['[1.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0])\n', (683, 700), True, 'import numpy as np\n'), ((744, 769), 'numpy.array', 'np.array', (['[0.0, 1.0, 0.0]'], {}), '([0.0, 1.0, 0.0])\n', (752, 769), True, 'import numpy as np\n'), ((577, 606), 'numpy.expand_dims', 'np.expand_dims', (...
""" Neighborhood Components Analysis (NCA) Ported to Python from https://github.com/vomjom/nca Taken and adapted from: https://github.com/metric-learn/metric-learn/blob/master/metric_learn/nca.py """ from __future__ import absolute_import import warnings import time import sys import numpy as np from scipy.optimize ...
[ "numpy.fill_diagonal", "scipy.optimize.minimize", "sklearn.metrics.pairwise_distances", "sklearn.utils.validation.check_X_y", "numpy.zeros", "time.time", "numpy.finfo", "scipy.misc.logsumexp", "sys.stdout.flush", "numpy.dot", "sklearn.utils.validation.check_array" ]
[((1956, 1971), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (1964, 1971), True, 'import numpy as np\n'), ((2878, 2893), 'sklearn.utils.validation.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (2887, 2893), False, 'from sklearn.utils.validation import check_X_y\n'), ((3044, 3055), 'time.time', 'tim...
import numpy as np import unittest import os import openmdao.api as om from openmdao.utils.assert_utils import assert_near_equal import pycycle.api as pyc from example_cycles.simple_turbojet import MPTurbojet class SimpleTurbojetTestCase(unittest.TestCase): def benchmark_case1(self): pr...
[ "unittest.main", "openmdao.api.Problem", "numpy.seterr", "openmdao.utils.assert_utils.assert_near_equal", "example_cycles.simple_turbojet.MPTurbojet" ]
[((4153, 4168), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4166, 4168), False, 'import unittest\n'), ((325, 337), 'openmdao.api.Problem', 'om.Problem', ([], {}), '()\n', (335, 337), True, 'import openmdao.api as om\n'), ((376, 388), 'example_cycles.simple_turbojet.MPTurbojet', 'MPTurbojet', ([], {}), '()\n', ...
# import native Python packages import os from datetime import date from math import floor import multiprocessing import pathlib import orjson from time import perf_counter # import third party packages from fastapi import APIRouter, HTTPException, Depends, Path import numpy as np import pandas as pd import requests f...
[ "numpy.isin", "numpy.put", "numpy.ones", "numpy.random.default_rng", "pathlib.Path", "fastapi.Depends", "src.db.models.CBBTeam", "multiprocessing.cpu_count", "pandas.DataFrame", "fastapi.APIRouter", "src.db.models.PlayerSeason", "sklearn.cluster.KMeans", "requests.get", "numpy.repeat", "...
[((635, 668), 'os.getenv', 'os.getenv', (['"""FANTASY_DATA_KEY_CBB"""'], {}), "('FANTASY_DATA_KEY_CBB')\n", (644, 668), False, 'import os\n'), ((693, 727), 'os.getenv', 'os.getenv', (['"""FANTASY_DATA_KEY_FREE"""'], {}), "('FANTASY_DATA_KEY_FREE')\n", (702, 727), False, 'import os\n'), ((739, 793), 'fastapi.APIRouter',...
import numpy as np import matplotlib.pyplot as plt import csv import os import pandas as pd import seaborn as sns sns.set_style("whitegrid") blue, = sns.color_palette("muted", 1) path = 'comparison/' #make dir for plots try: os.mkdir(path) except OSError: print ("Creation of the directory %s failed" % path...
[ "matplotlib.pyplot.title", "os.mkdir", "matplotlib.pyplot.clf", "pandas.read_csv", "numpy.histogram", "numpy.mean", "numpy.arange", "matplotlib.pyplot.figure", "matplotlib.pyplot.axvline", "numpy.std", "matplotlib.pyplot.yticks", "matplotlib.pyplot.xticks", "matplotlib.pyplot.subplots", "s...
[((116, 142), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (129, 142), True, 'import seaborn as sns\n'), ((151, 180), 'seaborn.color_palette', 'sns.color_palette', (['"""muted"""', '(1)'], {}), "('muted', 1)\n", (168, 180), True, 'import seaborn as sns\n'), ((4226, 4251), 'numpy.c...
from tkinter import messagebox from PIL import ImageTk, Image from cv2 import cvtColor, COLOR_BGR2HSV, COLOR_HSV2BGR from numpy import uint8, sum from Constant import message import numpy def color_type(data, before, after): if before == 'bgr' and after == 'hsv': return [int(cvtColor(uint8([[data]]), COLO...
[ "PIL.Image.fromarray", "numpy.uint8", "numpy.sum", "tkinter.messagebox.showinfo" ]
[((3999, 4051), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', ([], {'title': 'msg', 'message': 'message[msg]'}), '(title=msg, message=message[msg])\n', (4018, 4051), False, 'from tkinter import messagebox\n'), ((3599, 3625), 'PIL.Image.fromarray', 'Image.fromarray', (['pil_image'], {}), '(pil_image)\n', (3614, ...
from sys import path path.insert(0, '..') import numpy as np from daepy import BVP, load_solution from test_system import DAE from matplotlib import pyplot as plt alpha = 5 dae = DAE(alpha) degree = 3 intervals = 10 bvp = BVP(dae, degree, intervals) sol = load_solution('test.npz') bvp.initial_solution(sol) print('R...
[ "test_system.DAE", "daepy.BVP", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "sys.path.insert", "numpy.linspace", "daepy.load_solution" ]
[((21, 41), 'sys.path.insert', 'path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (32, 41), False, 'from sys import path\n'), ((180, 190), 'test_system.DAE', 'DAE', (['alpha'], {}), '(alpha)\n', (183, 190), False, 'from test_system import DAE\n'), ((224, 251), 'daepy.BVP', 'BVP', (['dae', 'degree', 'intervals'], ...
#!/usr/bin/env python # METADATA __author__ = "<NAME>, <NAME>" __credits__ = ["<NAME>", "<NAME>"] __version__ = "1.0.0" __email__ = "<EMAIL>" import numpy as np import collections from keras.preprocessing import image def load_image(img_path, target_size=(64,64)): img = image.load_img(img_path, target_size=targ...
[ "keras.preprocessing.image.img_to_array", "keras.preprocessing.image.load_img", "numpy.expand_dims" ]
[((279, 328), 'keras.preprocessing.image.load_img', 'image.load_img', (['img_path'], {'target_size': 'target_size'}), '(img_path, target_size=target_size)\n', (293, 328), False, 'from keras.preprocessing import image\n'), ((346, 369), 'keras.preprocessing.image.img_to_array', 'image.img_to_array', (['img'], {}), '(img)...
import pandas as pd import pickle from sklearn.feature_extraction.text import CountVectorizer import numpy as np df = pd.read_csv('../save/trainDataFeatures.tsv', sep='\t', index_col = 0) clean_train_reviews = pickle.load(open('../save/clean_train_reviews.pickle', 'rb')) vectorizer = CountVectorizer(analyzer="word", ...
[ "sklearn.ensemble.RandomForestClassifier", "sklearn.feature_extraction.text.CountVectorizer", "numpy.sum", "pandas.read_csv", "numpy.asarray" ]
[((118, 185), 'pandas.read_csv', 'pd.read_csv', (['"""../save/trainDataFeatures.tsv"""'], {'sep': '"""\t"""', 'index_col': '(0)'}), "('../save/trainDataFeatures.tsv', sep='\\t', index_col=0)\n", (129, 185), True, 'import pandas as pd\n'), ((285, 392), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer'...
# # house-price-prediction.py # This is a very simple prediction of house prices based on house size, implemented # in TensorFlow. # import tensorflow as tf import numpy as np import math import matplotlib.pyplot as plt import matplotlib.animation as animation # Generate some houses between 1000 and 3500 sqft n...
[ "numpy.random.seed", "tensorflow.multiply", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.arange", "numpy.random.randn", "tensorflow.placeholder", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "tensorflow.global_variables_initializer", "numpy.asarray", "tensorflow.Sessio...
[((335, 353), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (349, 353), True, 'import numpy as np\n'), ((367, 421), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(1000)', 'high': '(3500)', 'size': 'num_house'}), '(low=1000, high=3500, size=num_house)\n', (384, 421), True, 'import numpy a...
import os import unittest from configparser import ConfigParser import numpy as np from puzzlesolver.classifiers.util import (GenerateTFRecord, TFRecordExtractor, _TestImageEmbedPrepper) from puzzlesolver.utils import get_project_root config = ConfigParser() ROOT = get_proj...
[ "puzzlesolver.classifiers.util.TFRecordExtractor", "puzzlesolver.classifiers.util.GenerateTFRecord", "os.path.isfile", "puzzlesolver.utils.get_project_root", "configparser.ConfigParser", "os.path.join", "numpy.all" ]
[((290, 304), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (302, 304), False, 'from configparser import ConfigParser\n'), ((312, 330), 'puzzlesolver.utils.get_project_root', 'get_project_root', ([], {}), '()\n', (328, 330), False, 'from puzzlesolver.utils import get_project_root\n'), ((345, 408), 'os....
from .. import settings from .. import logging as logg from ..preprocessing.neighbors import verify_neighbors from .transition_matrix import transition_matrix from .utils import groups_to_bool, strings_to_categoricals import numpy as np import scipy.special def random_walk( data, root_node=0, walk_length...
[ "numpy.argwhere", "numpy.zeros", "numpy.array", "numpy.random.choice" ]
[((3498, 3534), 'numpy.zeros', 'np.zeros', (['(n_walks, walk_length + 1)'], {}), '((n_walks, walk_length + 1))\n', (3506, 3534), True, 'import numpy as np\n'), ((3871, 3895), 'numpy.argwhere', 'np.argwhere', (['node_subset'], {}), '(node_subset)\n', (3882, 3895), True, 'import numpy as np\n'), ((3780, 3813), 'numpy.ran...
# Code in this file is copied and adapted from # https://github.com/openai/evolution-strategies-starter. from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf def compute_ranks(x): """Returns ranks in [0, len(x)) ...
[ "numpy.full", "numpy.asarray", "numpy.square", "numpy.zeros", "tensorflow.ConfigProto", "tensorflow.InteractiveSession" ]
[((776, 799), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (797, 799), True, 'import tensorflow as tf\n'), ((1824, 1857), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'np.float32'}), '(shape, dtype=np.float32)\n', (1832, 1857), True, 'import numpy as np\n'), ((1879, 1916), 'numpy.full...
from ffp_minvar import ffp_minvar_lib import numpy as np if __name__ == "__main__": #---------------- Initialize numbers ----------------# srng = np.random.RandomState N = 500 # number of securities K = 4 # number of factors # seed for beta and other factor exposures seed = np.rando...
[ "ffp_minvar.ffp_minvar_lib.ffp", "ffp_minvar.ffp_minvar_lib.psi", "numpy.zeros", "numpy.ones", "numpy.random.randint", "numpy.array", "numpy.diag", "ffp_minvar.ffp_minvar_lib.lo_minvar" ]
[((312, 340), 'numpy.random.randint', 'np.random.randint', (['(0)', '(100000)'], {}), '(0, 100000)\n', (329, 340), True, 'import numpy as np\n'), ((393, 403), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (400, 403), True, 'import numpy as np\n'), ((413, 426), 'numpy.diag', 'np.diag', (['ones'], {}), '(ones)\n', (420,...
# -*- coding: utf-8 -*- """ @Author: Lyzhang @Date: @Description: """ import torch from config import * import numpy as np import torch.nn.functional as func def evaluate_enc_dec(batch_iter, model): """ To evaluate the model in EDU segmentation. 因内存原因,我们依旧选择批量运算的方式 不同的解码评测,不同的是,这个...
[ "numpy.argwhere", "numpy.intersect1d", "torch.nn.functional.log_softmax" ]
[((877, 908), 'numpy.intersect1d', 'np.intersect1d', (['predict', 'target'], {}), '(predict, target)\n', (891, 908), True, 'import numpy as np\n'), ((1929, 1961), 'torch.nn.functional.log_softmax', 'func.log_softmax', (['score_'], {'dim': '(-1)'}), '(score_, dim=-1)\n', (1945, 1961), True, 'import torch.nn.functional a...
import copy import logging from typing import Dict, List, Optional import numpy as np from ray.tune.suggest.suggestion import Searcher logger = logging.getLogger(__name__) TRIAL_INDEX = "__trial_index__" """str: A constant value representing the repeat index of the trial.""" def _warn_num_samples(searcher: Search...
[ "copy.deepcopy", "logging.getLogger", "numpy.nanmean" ]
[((147, 174), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (164, 174), False, 'import logging\n'), ((4580, 4601), 'copy.deepcopy', 'copy.deepcopy', (['config'], {}), '(config)\n', (4593, 4601), False, 'import copy\n'), ((6224, 6242), 'numpy.nanmean', 'np.nanmean', (['scores'], {}), '(sc...
import numpy as np import pandas as pd import os def create_csv(data): import os.path name_of_file = input("What is the Path of the file: ") D= "Results" completeName = os.path.join( D,name_of_file + ".csv") np.savetxt(completeName, data, delimiter=",") def create_csv_diff(data,...
[ "numpy.savetxt", "os.path.join" ]
[((200, 238), 'os.path.join', 'os.path.join', (['D', "(name_of_file + '.csv')"], {}), "(D, name_of_file + '.csv')\n", (212, 238), False, 'import os\n'), ((244, 289), 'numpy.savetxt', 'np.savetxt', (['completeName', 'data'], {'delimiter': '""","""'}), "(completeName, data, delimiter=',')\n", (254, 289), True, 'import nu...
import numpy as np import cv2 from ..config import config def get_circles(img): final_rectangles = [] cascade = cv2.CascadeClassifier(config['CASCADE']['CascadeFile']) new_img = img.copy() sf = min(640. / new_img.shape[1], 480. / new_img.shape[0]) gray = cv2.resize(new_img, (0, 0), None, sf, sf) ...
[ "cv2.GaussianBlur", "numpy.ones", "cv2.adaptiveThreshold", "cv2.ellipse", "cv2.contourArea", "cv2.cvtColor", "numpy.math.sin", "cv2.fitEllipse", "cv2.resize", "cv2.Canny", "numpy.average", "cv2.morphologyEx", "cv2.calcHist", "numpy.math.cos", "numpy.concatenate", "numpy.all", "numpy....
[((122, 177), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (["config['CASCADE']['CascadeFile']"], {}), "(config['CASCADE']['CascadeFile'])\n", (143, 177), False, 'import cv2\n'), ((277, 318), 'cv2.resize', 'cv2.resize', (['new_img', '(0, 0)', 'None', 'sf', 'sf'], {}), '(new_img, (0, 0), None, sf, sf)\n', (287, 318...
from typing import Dict, Optional import numpy from overrides import overrides import torch from torch import nn import torch.nn.functional as F from allennlp.data import Vocabulary from allennlp.modules import FeedForward, Seq2SeqEncoder, Seq2VecEncoder, TextFieldEmbedder from allennlp.models.model import Model from...
[ "allennlp.nn.InitializerApplicator", "torch.nn.Dropout", "allennlp.nn.util.weighted_sum", "allennlp.models.model.Model.register", "allennlp.nn.util.get_text_field_mask", "numpy.argmax", "torch.nn.CrossEntropyLoss", "allennlp.nn.util.masked_softmax", "torch.nn.functional.softmax", "allennlp.trainin...
[((475, 516), 'allennlp.models.model.Model.register', 'Model.register', (['"""sequence_classification"""'], {}), "('sequence_classification')\n", (489, 516), False, 'from allennlp.models.model import Model\n'), ((854, 877), 'allennlp.nn.InitializerApplicator', 'InitializerApplicator', ([], {}), '()\n', (875, 877), Fals...
import heapq from scipy.sparse import csr_matrix from sklearn import preprocessing import numpy as np from socialsent.representations.matrix_serializer import load_vocabulary, load_matrix class Explicit: """ Base class for explicit representations. Assumes that the serialized input is (P)PMI. ...
[ "numpy.log", "socialsent.representations.matrix_serializer.load_vocabulary", "numpy.array", "sklearn.preprocessing.normalize", "socialsent.representations.matrix_serializer.load_matrix" ]
[((1197, 1214), 'socialsent.representations.matrix_serializer.load_matrix', 'load_matrix', (['path'], {}), '(path)\n', (1208, 1214), False, 'from socialsent.representations.matrix_serializer import load_vocabulary, load_matrix\n'), ((1252, 1278), 'socialsent.representations.matrix_serializer.load_vocabulary', 'load_voc...
from sklearn import preprocessing from sklearn import svm from sklearn import grid_search from sklearn import cross_validation from itertools import combinations_with_replacement from functools import partial import numpy as np def main(seed=None, with_combinations=False): colors = ['black', 'blue', 'brown', 'gra...
[ "sklearn.cross_validation.train_test_split", "sklearn.preprocessing.scale", "numpy.logspace", "numpy.zeros", "numpy.append", "numpy.array", "sklearn.grid_search.GridSearchCV", "sklearn.svm.SVC", "numpy.fromstring" ]
[((782, 799), 'numpy.zeros', 'np.zeros', (['(0, 61)'], {}), '((0, 61))\n', (790, 799), True, 'import numpy as np\n'), ((808, 820), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (816, 820), True, 'import numpy as np\n'), ((1363, 1385), 'sklearn.preprocessing.scale', 'preprocessing.scale', (['X'], {}), '(X)\n', (138...
""" merge.py Simple example showing the merging of two spike trains. Copyright 2014, <NAME> <<EMAIL>> Distributed under the BSD License """ from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import pyspike as spk # first load the data, ending time = 4000 spike_trains = spk.l...
[ "pyspike.merge_spike_trains", "matplotlib.pyplot.show", "pyspike.load_spike_trains_from_txt", "numpy.ones_like" ]
[((315, 375), 'pyspike.load_spike_trains_from_txt', 'spk.load_spike_trains_from_txt', (['"""PySpike_testdata.txt"""', '(4000)'], {}), "('PySpike_testdata.txt', 4000)\n", (345, 375), True, 'import pyspike as spk\n'), ((398, 456), 'pyspike.merge_spike_trains', 'spk.merge_spike_trains', (['[spike_trains[0], spike_trains[1...
# -*- coding: utf-8 -*- import queue import torch import torch.nn as nn import numpy as np import gurobipy from typing import Tuple import neural_network_lyapunov.utils as utils import neural_network_lyapunov.mip_utils as mip_utils import neural_network_lyapunov.gurobi_torch_mip as gurobi_torch_mip import neural_netw...
[ "torch.eye", "neural_network_lyapunov.utils.replace_binary_continuous_product", "torch.empty", "torch.cat", "numpy.arange", "neural_network_lyapunov.utils.check_shape_and_type", "torch.le", "neural_network_lyapunov.mip_utils.find_index_set_to_strengthen", "neural_network_lyapunov.mip_utils.strengthe...
[((1791, 1804), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (1802, 1804), False, 'import queue\n'), ((7313, 7343), 'torch.eye', 'torch.eye', (['x_size'], {'dtype': 'dtype'}), '(x_size, dtype=dtype)\n', (7322, 7343), False, 'import torch\n'), ((7358, 7395), 'torch.zeros', 'torch.zeros', (['(x_size, 1)'], {'dtype': '...
# -*- coding: utf-8 -*- # Copyright 2018 The Blueoil 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 # # Unles...
[ "numpy.zeros", "ctypes.cdll.LoadLibrary", "numpy.ctypeslib.ndpointer" ]
[((934, 962), 'ctypes.cdll.LoadLibrary', 'ct.cdll.LoadLibrary', (['libpath'], {}), '(libpath)\n', (953, 962), True, 'import ctypes as ct\n'), ((2763, 2784), 'numpy.zeros', 'np.zeros', (['r', 'np.int32'], {}), '(r, np.int32)\n', (2771, 2784), True, 'import numpy as np\n'), ((2946, 2967), 'numpy.zeros', 'np.zeros', (['r'...
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # Name: audioSearch.py # Purpose: base subroutines for all audioSearching and score following # routines # # Authors: <NAME> # <NAME> # # Copyright: Copyright © 2011 <...
[ "music21.metadata.Metadata", "numpy.argmax", "music21.features.native.MostCommonNoteQuarterLength", "scipy.signal.fftconvolve", "warnings.simplefilter", "math.pow", "math.modf", "warnings.catch_warnings", "math.log", "numpy.fromstring", "music21.note.Note", "music21.scale.ChromaticScale", "c...
[((1261, 1290), 'music21.environment.Environment', 'environment.Environment', (['_MOD'], {}), '(_MOD)\n', (1284, 1290), False, 'from music21 import environment\n'), ((4505, 4532), 'numpy.array', 'numpy.array', (['recordedSignal'], {}), '(recordedSignal)\n', (4516, 4532), False, 'import numpy\n'), ((4551, 4613), 'scipy....
from __future__ import print_function import sys import time import termios import logging import threading import ujson as json import csv import numpy as np import transformations as trans from cflib import crazyflie, crtp from cflib.crazyflie.log import LogConfig from util import * # Set a channel - if set to Non...
[ "numpy.abs", "time.strftime", "numpy.clip", "numpy.sin", "numpy.linalg.norm", "cflib.crtp.scan_interfaces", "cflib.crazyflie.Crazyflie", "cflib.crazyflie.log.LogConfig", "numpy.degrees", "transformations.euler_from_quaternion", "transformations.quaternion_matrix", "numpy.append", "numpy.resh...
[((18971, 19015), 'cflib.crtp.init_drivers', 'crtp.init_drivers', ([], {'enable_debug_driver': '(False)'}), '(enable_debug_driver=False)\n', (18988, 19015), False, 'from cflib import crazyflie, crtp\n'), ((19025, 19064), 'cflib.crazyflie.Crazyflie', 'crazyflie.Crazyflie', ([], {'rw_cache': '"""./cache"""'}), "(rw_cache...
""" Expression class Basic handling for microarray and rna-seq and realtime PCR like data """ import sys, os, csv, string, math, collections from operator import itemgetter import numpy from numpy import array, arange, meshgrid, zeros, linspace, mean, object_, std # This use of array here is not good. import gzip...
[ "csv.reader", "csv.writer", "gzip.open", "os.path.realpath", "numpy.array" ]
[((8146, 8201), 'numpy.array', 'numpy.array', (["[i['conditions'] for i in self.linearData]"], {}), "([i['conditions'] for i in self.linearData])\n", (8157, 8201), False, 'import numpy\n'), ((11510, 11536), 'os.path.realpath', 'os.path.realpath', (['filename'], {}), '(filename)\n', (11526, 11536), False, 'import sys, o...
import argparse import os import random import shutil def prepare(): from utils.common import get_save_path from utils.config import configs from utils.device import set_cuda_visible_devices # since PyTorch jams device selection, we have to parse args before import torch (issue #26790) parser = a...
[ "numpy.random.seed", "argparse.ArgumentParser", "utils.config.configs.train.criterion", "utils.config.configs.evaluate.best_checkpoint_path.replace", "utils.config.configs.update_from_modules", "torch.no_grad", "os.path.join", "utils.device.set_cuda_visible_devices", "torch.load", "utils.config.co...
[((319, 344), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (342, 344), False, 'import argparse\n'), ((759, 801), 'utils.config.configs.update_from_modules', 'configs.update_from_modules', (['*args.configs'], {}), '(*args.configs)\n', (786, 801), False, 'from utils.config import configs\n'), (...
import numpy as np import matplotlib.pyplot as plt import time from numpy.lib.function_base import select class SpringSim(object): def __init__( self, n_balls=5, box_size=5.0, loc_std=0.5, vel_norm=0.5, interaction_strength=0.1, noise_var=0.0, dim=2...
[ "numpy.abs", "numpy.sum", "numpy.ones", "matplotlib.pyplot.figure", "numpy.linalg.norm", "matplotlib.pyplot.gca", "numpy.random.randn", "numpy.linspace", "numpy.random.choice", "numpy.stack", "numpy.fill_diagonal", "matplotlib.pyplot.show", "numpy.cbrt", "numpy.all", "numpy.random.unifor...
[((33730, 33741), 'time.time', 'time.time', ([], {}), '()\n', (33739, 33741), False, 'import time\n'), ((33953, 33965), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (33963, 33965), True, 'import matplotlib.pyplot as plt\n'), ((33977, 33986), 'matplotlib.pyplot.gca', 'plt.gca', ([], {}), '()\n', (33984, 3...
""" This module contains basic measurement classes for data acquired with the ROACH. """ from __future__ import division import time from collections import OrderedDict import logging import numpy as np import pandas as pd from matplotlib.pyplot import mlab from scipy import signal from memoized_property import memoiz...
[ "kid_readout.roach.calculate.stream_sample_rate", "numpy.abs", "numpy.angle", "kid_readout.roach.calculate.modulation_period_samples", "numpy.ones", "kid_readout.measurement.core.MeasurementError", "numpy.isnan", "kid_readout.analysis.timeseries.periodic.fold", "numpy.arange", "kid_readout.roach.c...
[((563, 590), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (580, 590), False, 'import logging\n'), ((10023, 10258), 'collections.OrderedDict', 'OrderedDict', (["[('tone_bin', ('tone_bin',)), ('tone_amplitude', ('tone_bin',)), (\n 'tone_phase', ('tone_bin',)), ('tone_index', ('tone_in...
""" Implementation of Deep Active Inference for General Artificial Intelligence <NAME>, 2017 """ # Imports import cPickle import timeit import scipy import matplotlib.pyplot as plt import numpy import scipy import theano import theano.tensor as T from theano.ifelse import ifelse from theano impo...
[ "matplotlib.pyplot.title", "theano.tensor.tensor3", "numpy.iinfo", "numpy.ones", "cPickle.load", "matplotlib.pyplot.figure", "numpy.random.randint", "numpy.arange", "numpy.random.normal", "theano.tensor.log", "numpy.random.randn", "theano.tensor.set_subtensor", "matplotlib.pyplot.rc", "the...
[((616, 646), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(12, 9)'}), '(1, figsize=(12, 9))\n', (626, 646), True, 'import matplotlib.pyplot as plt\n'), ((20436, 20446), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (20444, 20446), True, 'import matplotlib.pyplot as plt\n'), ((724, 751), '...
import gym import numpy as np from flatland.core.env_observation_builder import ObservationBuilder from flatland.core.grid.grid4_utils import get_new_position from flatland.envs.agent_utils import RailAgentStatus from flatland.envs.rail_env import RailEnv from flatlander.envs.observations import Observation, register_...
[ "flatlander.envs.observations.register_obs", "numpy.count_nonzero", "numpy.argmax", "numpy.isnan", "numpy.max", "gym.spaces.Box", "flatland.core.grid.grid4_utils.get_new_position" ]
[((327, 356), 'flatlander.envs.observations.register_obs', 'register_obs', (['"""shortest_path"""'], {}), "('shortest_path')\n", (339, 356), False, 'from flatlander.envs.observations import Observation, register_obs\n'), ((2361, 2395), 'numpy.max', 'np.max', (['distance_map[nan_inf_mask]'], {}), '(distance_map[nan_inf_...
import os import torch import numpy as np from sentence_transformers import SentenceTransformer from experiment.qa.evaluation import BasicQAEvaluation class QAEvaluationSBert(BasicQAEvaluation): def __init__(self, config, config_global, logger): super(QAEvaluationSBert, self).__init__(config, config_glo...
[ "numpy.zeros", "sentence_transformers.SentenceTransformer", "torch.cosine_similarity" ]
[((418, 463), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (["config['sbert']['model']"], {}), "(config['sbert']['model'])\n", (437, 463), False, 'from sentence_transformers import SentenceTransformer\n'), ((1099, 1147), 'torch.cosine_similarity', 'torch.cosine_similarity', (['repr_queries', 'rep...
import math import time import numpy as np import jax from jax import numpy as jnp, random, lax from dm_control import suite import environments from environments.observation_domains import DOMAINS from environments import jax_specs import utils for env_name, task_name in [('point', 'velocity'), ...
[ "math.ceil", "dm_control.suite.load", "jax.numpy.expand_dims", "time.time", "jax.random.PRNGKey", "environments.jax_specs.convert_dm_spec", "utils.flatten_observation_spec", "numpy.array", "utils.sample_uniform_actions" ]
[((474, 505), 'dm_control.suite.load', 'suite.load', (['env_name', 'task_name'], {}), '(env_name, task_name)\n', (484, 505), False, 'from dm_control import suite\n'), ((592, 624), 'environments.jax_specs.convert_dm_spec', 'jax_specs.convert_dm_spec', (['aspec'], {}), '(aspec)\n', (617, 624), False, 'from environments i...
import os import streamlit.components.v1 as components import streamlit as st import time import numpy as np import IPython.display as ipd #ipd.Audio(audio, rate=16000) from online_scd.model import SCDModel from online_scd.streaming import StreamingDecoder import timeit import base64 import scipy.io.wavfile from on...
[ "os.remove", "streamlit.session_state.model.process_audio", "pydub.AudioSegment.empty", "os.path.isfile", "os.path.join", "streamlit_webrtc.ClientSettings", "streamlit.subheader", "os.path.abspath", "online_scd.streaming.StreamingDecoder", "online_scd.model.SCDModel.load_from_checkpoint", "os.st...
[((1589, 1662), 'streamlit.components.v1.declare_component', 'components.declare_component', (['"""my_component"""'], {'url': '"""http://localhost:3001"""'}), "('my_component', url='http://localhost:3001')\n", (1617, 1662), True, 'import streamlit.components.v1 as components\n'), ((2090, 2194), 'online_scd.model.SCDMod...
# coding: utf-8 """melting layer detection using scipy peak utilities""" import numpy as np import pandas as pd from scipy import signal from j24.tools import find from j24.math import weighted_median from radcomp.vertical import filtering H_MAX = 4200 def indicator(zdr_scaled, zh_scaled, rho, savgol_args=(35, 3))...
[ "j24.math.weighted_median", "j24.tools.find", "radcomp.vertical.filtering.fltr_rolling_median_thresh", "numpy.ones", "scipy.signal.find_peaks", "pandas.Series", "radcomp.vertical.filtering.fltr_no_hydrometeors", "numpy.concatenate" ]
[((1098, 1126), 'numpy.concatenate', 'np.concatenate', (['peaks.values'], {}), '(peaks.values)\n', (1112, 1126), True, 'import numpy as np\n'), ((1138, 1165), 'j24.math.weighted_median', 'weighted_median', (['parr', 'warr'], {}), '(parr, warr)\n', (1153, 1165), False, 'from j24.math import weighted_median\n'), ((1281, ...
""" Class that computes the angular momentun, spin parameter, anisotropy parameter, potential and kinetic energies. of a halo. To-Do: ------ 0. Speed up angular momentum computation! 1. Rvir and Mvir are not defined jet to compute the circular velocity. Should we comoute them here or made them as an input paramet...
[ "numpy.sum", "astropy.constants.G.to", "numpy.cross", "numpy.where", "numpy.array", "numpy.linalg.norm", "numpy.linspace", "numpy.mean", "numpy.dot", "numpy.sqrt" ]
[((876, 888), 'numpy.sum', 'np.sum', (['mass'], {}), '(mass)\n', (882, 888), True, 'import numpy as np\n'), ((929, 986), 'numpy.sqrt', 'np.sqrt', (['(pos[:, 0] ** 2 + pos[:, 1] ** 2 + pos[:, 2] ** 2)'], {}), '(pos[:, 0] ** 2 + pos[:, 1] ** 2 + pos[:, 2] ** 2)\n', (936, 986), True, 'import numpy as np\n'), ((1072, 1115)...
import os, yaml from pathlib import Path from click.testing import CliRunner from luna.radiology.cli.extract_voxels import cli import medpy.io import numpy as np def test_cli_voxels(tmp_path): runner = CliRunner() result = runner.invoke(cli, [ 'pyluna-radiology/tests/luna/testdata/data/2.000000-CTA...
[ "numpy.load", "os.path.exists", "numpy.mean", "yaml.safe_load", "click.testing.CliRunner" ]
[((211, 222), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (220, 222), False, 'from click.testing import CliRunner\n'), ((579, 617), 'os.path.exists', 'os.path.exists', (["metadata['npy_volume']"], {}), "(metadata['npy_volume'])\n", (593, 617), False, 'import os, yaml\n'), ((629, 660), 'numpy.load', 'np.lo...
#!/usr/bin/env python3 # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. import megengine.data.transform as T import numpy as np import pytest from basecls.data.rand_erase import RandomErasing @pytest.mark.parametrize("prob", [0.25]) @pytest.mark.parametrize("ratio", [0.4, (0.4, 1.5)]) @pytest.mark.parametr...
[ "pytest.mark.parametrize", "numpy.random.randint", "basecls.data.rand_erase.RandomErasing" ]
[((206, 245), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""prob"""', '[0.25]'], {}), "('prob', [0.25])\n", (229, 245), False, 'import pytest\n'), ((247, 298), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ratio"""', '[0.4, (0.4, 1.5)]'], {}), "('ratio', [0.4, (0.4, 1.5)])\n", (270, 298), Fa...
import os import json from PIL import Image import numpy as np import torch from torch.utils.data import Dataset class CARLA_Data(Dataset): def __init__(self, root, config): self.seq_len = config.seq_len self.pred_len = config.pred_len self.ignore_sides = config.ignore_sides ...
[ "numpy.load", "numpy.histogramdd", "numpy.isnan", "numpy.sin", "os.path.join", "numpy.transpose", "os.path.exists", "numpy.linspace", "numpy.stack", "numpy.save", "numpy.asarray", "numpy.linalg.inv", "numpy.cos", "os.listdir", "numpy.matrix", "json.load", "numpy.zeros", "PIL.Image....
[((12376, 12427), 'numpy.stack', 'np.stack', (['[below_features, above_features]'], {'axis': '(-1)'}), '([below_features, above_features], axis=-1)\n', (12384, 12427), True, 'import numpy as np\n'), ((12830, 12852), 'numpy.asarray', 'np.asarray', (['im_resized'], {}), '(im_resized)\n', (12840, 12852), True, 'import num...
# 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 applic...
[ "unittest.main", "random.sample", "hypothesis.strategies.sampled_from", "hypothesis.strategies.booleans", "numpy.array", "paddle.expand", "hypothesis.strategies.integers", "paddle.to_tensor" ]
[((4259, 4274), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4272, 4274), False, 'import unittest\n'), ((1123, 1157), 'paddle.expand', 'paddle.expand', (['inputs'], {'shape': 'shape'}), '(inputs, shape=shape)\n', (1136, 1157), False, 'import paddle\n'), ((1909, 1945), 'random.sample', 'random.sample', (['[1, 1,...
# -*- coding: utf-8 -*- """ DTW computation =============== This example illustrates DTW computation between time series and plots the optimal alignment path. """ # Author: <NAME> # License: BSD 3 clause import numpy from scipy.spatial.distance import cdist import matplotlib.pyplot as plt from tslearn.generators im...
[ "tslearn.preprocessing.TimeSeriesScalerMeanVariance", "scipy.spatial.distance.cdist", "tslearn.metrics.dtw_path", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.axes", "tslearn.generators.random_walks", "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.tight_layout"...
[((430, 450), 'numpy.random.seed', 'numpy.random.seed', (['(0)'], {}), '(0)\n', (447, 450), False, 'import numpy\n'), ((485, 520), 'tslearn.generators.random_walks', 'random_walks', ([], {'n_ts': 'n_ts', 'sz': 'sz', 'd': 'd'}), '(n_ts=n_ts, sz=sz, d=d)\n', (497, 520), False, 'from tslearn.generators import random_walks...
import os,sys import h5py import numpy as np import cv2 import json from skimage.measure import label from matplotlib import pyplot as plt from utils.T_util import bfly from config import * def readh5(filename, datasetname='main', rr=[1,1,1]): fid=h5py.File(filename,'r') if isinstance(datasetname, (list,)): ...
[ "os.mkdir", "h5py.File", "numpy.sum", "utils.T_util.bfly", "os.path.exists", "skimage.measure.label", "numpy.where", "numpy.array", "numpy.loadtxt", "numpy.max", "os.path.join", "cv2.resize" ]
[((2248, 2280), 'os.path.join', 'os.path.join', (['OUTPUT_DIR', '"""full"""'], {}), "(OUTPUT_DIR, 'full')\n", (2260, 2280), False, 'import os, sys\n'), ((2356, 2388), 'os.path.join', 'os.path.join', (['OUTPUT_DIR', '"""part"""'], {}), "(OUTPUT_DIR, 'part')\n", (2368, 2388), False, 'import os, sys\n'), ((2464, 2496), 'o...
from imagepy.core.engine import Table import pandas as pd import numpy as np class Count(Table): title = 'Values Frequency' para = {'cn':[]} view = [('fields', 'cn', 'fields to count')] def run(self, tps, snap, data, para=None): for i in para['cn']: df = pd.DataFrame(data[i].value_counts()) df.columns = [...
[ "pandas.DataFrame", "numpy.histogram" ]
[((1023, 1062), 'numpy.histogram', 'np.histogram', (['data[i]', "para['bins']", 'rg'], {}), "(data[i], para['bins'], rg)\n", (1035, 1062), True, 'import numpy as np\n'), ((1277, 1371), 'pandas.DataFrame', 'pd.DataFrame', (['vs'], {'columns': "[i for i in ['bins', 'count', 'frequency', 'weight'] if i in vs]"}), "(vs, co...
import numpy as np from pre_elab import generate_dataset import training_standard as ts import training_inductive as t import training_greedy_inductive as tg import pickle import tensorflow as tf import settings as s def run_tests_inductive( n_runs, include_greedy=True, include_e2e=True, ...
[ "tensorflow.random.set_seed", "training_inductive.train_and_evaluate_kenn_inductive", "pickle.dump", "pre_elab.generate_dataset", "numpy.random.seed", "training_greedy_inductive.train_and_evaluate_kenn_inductive_greedy", "training_standard.train_and_evaluate_standard" ]
[((494, 525), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['random_seed'], {}), '(random_seed)\n', (512, 525), True, 'import tensorflow as tf\n'), ((530, 557), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (544, 557), True, 'import numpy as np\n'), ((1583, 1618), 'pre_elab.ge...
from __future__ import print_function, division from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D, Dropout, concatenate from keras.models import Model from keras import backend as K from data_loader import DataLoader import datetime import numpy as np import os import scipy as sp import matplotl...
[ "keras.layers.Dropout", "matplotlib.pyplot.close", "matplotlib.pyplot.subplots", "data_loader.DataLoader", "keras.layers.Conv2D", "keras.layers.UpSampling2D", "keras.layers.Input", "keras.optimizers.RMSprop", "datetime.datetime.now", "keras.layers.MaxPooling2D", "numpy.concatenate" ]
[((1903, 1925), 'keras.layers.Input', 'Input', ([], {'shape': 'img_shape'}), '(shape=img_shape)\n', (1908, 1925), False, 'from keras.layers import Input, Dense, Conv2D, MaxPooling2D, UpSampling2D, Dropout, concatenate\n'), ((2234, 2295), 'data_loader.DataLoader', 'DataLoader', ([], {'dataset_name': 'dataset_name', 'img...
# # XDMC # Copyright (C) <NAME> (email <EMAIL>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later versi...
[ "matplotlib.pyplot.subplot", "parser.parse_wavefunction", "numpy.trapz", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.zeros", "numpy.array", "numpy.linspace", "matplotlib.pyplot.ylabel" ]
[((762, 801), 'parser.parse_wavefunction', 'parser.parse_wavefunction', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (787, 801), False, 'import parser\n'), ((2107, 2117), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2115, 2117), True, 'import matplotlib.pyplot as plt\n'), ((1091, 1102), 'numpy.array', 'np.ar...
#!/usr/bin/python3 # coding: utf-8 import argparse import multiprocessing import random as rn import sys import time import networkx as nx import numpy as np import tensorflow as tf from keras import Input from keras import backend from keras import optimizers from keras import regularizers from keras.callbacks impor...
[ "numpy.random.seed", "argparse.ArgumentParser", "helpers.batch_generator", "keras.models.Model", "tensorflow.ConfigProto", "keras.regularizers.l1", "keras.layers.merge.dot", "helpers.build_neighbors_map", "tensorflow.get_default_graph", "multiprocessing.cpu_count", "keras.layers.embeddings.Embed...
[((956, 1034), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Learning graph embeddings with path2vec"""'}), "(description='Learning graph embeddings with path2vec')\n", (979, 1034), False, 'import argparse\n'), ((4401, 4428), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([]...
import sys import matplotlib matplotlib.use('Agg') import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt args = sys.argv trial_file = args[1] score_file = args[2] save_file = args[3] tgt_scores = [] nontgt_scores = [] with open(trial_file, 'r') as tf, open(score_file, 'r') as sf: tf_l...
[ "matplotlib.pyplot.hist", "matplotlib.pyplot.plot", "numpy.std", "numpy.mean", "matplotlib.use", "matplotlib.pyplot.savefig" ]
[((30, 51), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (44, 51), False, 'import matplotlib\n'), ((905, 940), 'matplotlib.pyplot.plot', 'plt.plot', (['tgt_scores', 'fit_tgt', '"""-g"""'], {}), "(tgt_scores, fit_tgt, '-g')\n", (913, 940), True, 'import matplotlib.pyplot as plt\n'), ((941, 983),...
#! python3 # -*- coding: utf-8 -*- from pylots.temixins import CompInterface, TEM from wxpyJemacs import Layer import numpy as np class Plugin(CompInterface, Layer): """Plugin of compensation Adjust iscomp1-tilt [alpha] """ caption = "ISTILT" conf_key = 'compistilt' ## PYJEM には ISCOMP がない...
[ "pylots.temixins.CompInterface.cal", "pylots.temixins.CompInterface.Init", "numpy.array" ]
[((511, 533), 'numpy.array', 'np.array', (['self.__index'], {}), '(self.__index)\n', (519, 533), True, 'import numpy as np\n'), ((903, 927), 'pylots.temixins.CompInterface.Init', 'CompInterface.Init', (['self'], {}), '(self)\n', (921, 927), False, 'from pylots.temixins import CompInterface, TEM\n'), ((1369, 1392), 'pyl...
# Standard library imports import pandas as pd import numpy as np from math import pi # Local application/library specific imports from .water_demand import ( set_cropland_share, get_ky_list, get_kc_list, get_evap_i, get_eto, get_eff_rainfall_i, get_effective_rainfall, get_season_days, ...
[ "pandas.DataFrame", "numpy.log", "numpy.array", "numpy.arange", "numpy.linspace" ]
[((8533, 8594), 'numpy.linspace', 'np.linspace', (['initial_eff', 'final_eff', '(end_year - init_year + 1)'], {}), '(initial_eff, final_eff, end_year - init_year + 1)\n', (8544, 8594), True, 'import numpy as np\n'), ((8648, 8706), 'pandas.DataFrame', 'pd.DataFrame', (["{'Year': years, self.pump_eff: efficiencies}"], {}...
""" This file serves as a training interface for training the network """ # Built in import glob import os import shutil # Torch import torch # Own import flag_reader from utils import data_reader from class_wrapper import Network from model_maker import cINN from utils.helper_functions import put_param...
[ "utils.helper_functions.write_flags_and_BVE", "numpy.random.uniform", "os.path.join", "flag_reader.read_flag", "class_wrapper.Network", "utils.data_reader.read_data" ]
[((708, 736), 'utils.data_reader.read_data', 'data_reader.read_data', (['flags'], {}), '(flags)\n', (729, 736), False, 'from utils import data_reader\n'), ((804, 851), 'class_wrapper.Network', 'Network', (['cINN', 'flags', 'train_loader', 'test_loader'], {}), '(cINN, flags, train_loader, test_loader)\n', (811, 851), Fa...
# -*- coding: utf-8 -*- #!/usr/env python3 # Copyright (C) 2017 <NAME> # Author: <NAME> <<EMAIL>> # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at yo...
[ "cv2.circle", "cv2.HoughCircles", "cv2.cvtColor", "numpy.mean", "PyQt4.QtGui.QImage", "numpy.round" ]
[((1490, 1557), 'cv2.HoughCircles', 'cv2.HoughCircles', (['image', 'cv2.HOUGH_GRADIENT', 'self.dp', 'self.min_dist'], {}), '(image, cv2.HOUGH_GRADIENT, self.dp, self.min_dist)\n', (1506, 1557), False, 'import cv2\n'), ((2251, 2294), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BAYER_GR2BGR'], {}), '(image, cv2...
#Declarations****************************************************************************** from __future__ import print_function import numpy as np import os import sys import tarfile import math import random import sys from IPython.display import display, Image from scipy import ndimage from six.moves.urllib.request...
[ "tensorflow.reshape", "tensorflow.matmul", "tensorflow.Variable", "tensorflow.nn.conv2d", "tensorflow.InteractiveSession", "tensorflow.truncated_normal", "pandas.DataFrame", "tensorflow.nn.softmax_cross_entropy_with_logits_v2", "tensorflow.placeholder", "tensorflow.cast", "tensorflow.initialize_...
[((2032, 2055), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (2053, 2055), True, 'import tensorflow as tf\n'), ((2455, 2501), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, vectorSize]'], {}), '(tf.float32, [None, vectorSize])\n', (2469, 2501), True, 'import tensorflo...
from mpi4py import MPI from numpy import ones from numpy import zeros rank = -1 #we must initialize rank comm = MPI.COMM_WORLD rank = comm.Get_rank() root = 0 if rank == 0: value = ones(50,'int') else: value = zeros(50,'int') sum_value = zeros(50,'int') comm.Allreduce (value, sum_value, MPI.SUM) if rank == ...
[ "numpy.zeros", "numpy.ones" ]
[((249, 265), 'numpy.zeros', 'zeros', (['(50)', '"""int"""'], {}), "(50, 'int')\n", (254, 265), False, 'from numpy import zeros\n'), ((187, 202), 'numpy.ones', 'ones', (['(50)', '"""int"""'], {}), "(50, 'int')\n", (191, 202), False, 'from numpy import ones\n'), ((220, 236), 'numpy.zeros', 'zeros', (['(50)', '"""int"""'...
import stp.play as play import stp.tactic as tactic from rj_gameplay.tactic import striker_tactic, nmark_tactic, goalie_tactic, pass_seek, wall_tactic import stp.skill as skill import stp.role as role from stp.role.assignment.naive import NaiveRoleAssignment import stp.rc as rc from typing import Dict, Generic, Iterat...
[ "rj_gameplay.calculations.wall_calculations.find_wall_pts", "stp.play.unflatten_results", "rj_gameplay.tactic.wall_tactic.WallTactic", "stp.play.flatten_requests", "rj_gameplay.tactic.goalie_tactic.GoalieTactic", "stp.role.assignment.naive.NaiveRoleAssignment", "numpy.array", "rj_gameplay.tactic.pass_...
[((683, 703), 'numpy.array', 'np.array', (['[0.0, 9.0]'], {}), '([0.0, 9.0])\n', (691, 703), True, 'import numpy as np\n'), ((732, 800), 'rj_gameplay.tactic.striker_tactic.LineKickStrikerTactic', 'striker_tactic.LineKickStrikerTactic', ([], {'target_point': 'self.target_point'}), '(target_point=self.target_point)\n', (...
import numpy as np import jax from . adjacency_edge_face import adjacency_edge_face def adjacency_list_edge_face(F): ''' ADJACENCY_LIST_EDGE_FACE computes edge-face adjacency list Input: F (|F|,3) numpy array of face indices Output: adjList (|E|,2) numpy array of adjacency list between edges and faces...
[ "numpy.zeros", "numpy.arange", "jax.numpy.asarray" ]
[((416, 455), 'numpy.zeros', 'np.zeros', (['(E.shape[0], 2)'], {'dtype': 'np.int'}), '((E.shape[0], 2), dtype=np.int)\n', (424, 455), True, 'import numpy as np\n'), ((515, 536), 'numpy.arange', 'np.arange', (['F.shape[0]'], {}), '(F.shape[0])\n', (524, 536), True, 'import numpy as np\n'), ((682, 708), 'jax.numpy.asarra...
import pytest from nudging.simulation.utils import mixed_features from nudging.model.biregressor import BiRegressor from nudging.model.monoregressor import MonoRegressor from nudging.model.xregressor import XRegressor from sklearn.linear_model import BayesianRidge from nudging.model.base import BaseModel from scipy.sta...
[ "numpy.random.seed", "sklearn.linear_model.BayesianRidge", "scipy.stats.stats.spearmanr", "sklearn.linear_model.LogisticRegression", "nudging.simulation.utils.mixed_features", "numpy.mean", "nudging.simulation.generate_datasets", "pytest.mark.parametrize" ]
[((1692, 1771), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model_type"""', '[BiRegressor, MonoRegressor, XRegressor]'], {}), "('model_type', [BiRegressor, MonoRegressor, XRegressor])\n", (1715, 1771), False, 'import pytest\n'), ((552, 574), 'numpy.random.seed', 'np.random.seed', (['(123474)'], {}), '(1...
# -*- Mode: Python3; coding: utf-8; indent-tabs-mpythoode: nil; tab-width: 4 -*- import os import numpy as np from PIL import Image PATH = "../Images/" RED = 0 GREEN = 1 BLUE = 2 separator = 10 * '-' def details(data): print(separator) height, width, channels = data.shape result = "matrix: {0}D\n{1}x{...
[ "numpy.load", "numpy.amin", "numpy.zeros", "os.path.exists", "numpy.amax", "PIL.Image.fromarray" ]
[((999, 1020), 'PIL.Image.fromarray', 'Image.fromarray', (['data'], {}), '(data)\n', (1014, 1020), False, 'from PIL import Image\n'), ((1336, 1351), 'numpy.load', 'np.load', (['img_np'], {}), '(img_np)\n', (1343, 1351), True, 'import numpy as np\n'), ((1442, 1476), 'numpy.zeros', 'np.zeros', (['rgb.shape'], {'dtype': '...
""" :py:mod:`benchmarks.py` ------------------------------------- """ import numpy as np from scipy.optimize import rosen from scipy.interpolate import interp2d import math __all__ = ["test1d", "rosenbrock", "gaussian_shells", "eggbox", "multimodal", "logo"] ...
[ "numpy.meshgrid", "numpy.sum", "math.sqrt", "numpy.asarray", "scipy.optimize.rosen", "scipy.interpolate.interp2d", "numpy.sin", "numpy.arange", "numpy.array", "numpy.loadtxt", "numpy.cos" ]
[((594, 611), 'numpy.asarray', 'np.asarray', (['theta'], {}), '(theta)\n', (604, 611), True, 'import numpy as np\n'), ((1412, 1433), 'numpy.array', 'np.array', (['[-3.5, 0.0]'], {}), '([-3.5, 0.0])\n', (1420, 1433), True, 'import numpy as np\n'), ((1463, 1483), 'numpy.array', 'np.array', (['[3.5, 0.0]'], {}), '([3.5, 0...
# Copyright 2020 <NAME> and collaborators. # This program is distributed under the MIT license. from __future__ import annotations import functools import json import pathlib import string as string_module import statistics import webbrowser import time import itertools import random import logging import numbers imp...
[ "webbrowser.open_new", "pathlib.Path.home", "more_itertools.one", "click.option", "collections.defaultdict", "itertools.cycle", "random.randint", "itertools.product", "click.group", "datetime.datetime.now", "itertools.chain", "json.dump", "io.StringIO", "itertools.count", "time.sleep", ...
[((1290, 1336), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'order': '(True)', 'frozen': '(True)'}), '(order=True, frozen=True)\n', (1311, 1336), False, 'import dataclasses\n'), ((2617, 2663), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'order': '(True)', 'frozen': '(True)'}), '(order=True, froz...
from numpy import linalg as LA import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from collections import OrderedDict from sklearn.cluster import KMeans def read_data(filename): with open(filename, 'r') as f: lines = f.readlines() num_points = len(lines) ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "sklearn.cluster.KMeans", "numpy.empty", "matplotlib.pyplot.scatter", "numpy.zeros", "numpy.max", "numpy.where", "sklearn.decomposition.PCA", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((678, 697), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': '(2)'}), '(n_components=2)\n', (681, 697), False, 'from sklearn.decomposition import PCA\n'), ((773, 808), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': '(10)', 'max_iter': '(500)'}), '(n_clusters=10, max_iter=500)\n', (779, 808), False, ...
import unittest import numpy import medipy.base import medipy.io.dicom import medipy.diffusion class TestEstimation(unittest.TestCase): def test_least_squares(self) : signal = [1035.0, 555.0, 558.0, 597.0, 661.0, 503.0, 503.0, 469.0, 690.0, 522.0, 648.0, 580.0, 430.0, 697.0, 557.0...
[ "unittest.main", "numpy.testing.assert_almost_equal", "numpy.asarray" ]
[((2637, 2652), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2650, 2652), False, 'import unittest\n'), ((2441, 2584), 'numpy.testing.assert_almost_equal', 'numpy.testing.assert_almost_equal', (['tensors[0, 0, 0]', '[0.60645288, -0.04935496, -0.05629922, 0.41899708, 0.10537824, 0.79697168]'], {'decimal': '(5)'})...
""" Making templates with SPS tools """ def agn_templates(): import fsps import eazy import matplotlib.pyplot as plt sp = fsps.StellarPopulation() res = eazy.filters.FilterFile(path=None) jfilt = res[161] sp.params['dust_type'] = 2 sp.params['dust2'] = 0 sp.par...
[ "matplotlib.pyplot.loglog", "numpy.abs", "numpy.maximum", "numpy.argmax", "numpy.polyfit", "matplotlib.pyplot.figure", "numpy.arange", "numpy.exp", "numpy.interp", "eazy.sps.ExtendedFsps", "numpy.polyval", "numpy.append", "numpy.linspace", "dust_attenuation.radiative_transfer.WG00", "num...
[((149, 173), 'fsps.StellarPopulation', 'fsps.StellarPopulation', ([], {}), '()\n', (171, 173), False, 'import fsps\n'), ((184, 218), 'eazy.filters.FilterFile', 'eazy.filters.FilterFile', ([], {'path': 'None'}), '(path=None)\n', (207, 218), False, 'import eazy\n'), ((430, 456), 'matplotlib.pyplot.figure', 'plt.figure',...
from __future__ import division import gym import numpy as np from collections import deque from gym import spaces def create_env(env_id, args): env = gym.make(env_id) env = frame_stack(env, args) return env class frame_stack(gym.Wrapper): def __init__(self, env, args): super(frame_stack, se...
[ "numpy.stack", "numpy.float32", "gym.make", "collections.deque" ]
[((157, 173), 'gym.make', 'gym.make', (['env_id'], {}), '(env_id)\n', (165, 173), False, 'import gym\n'), ((406, 441), 'collections.deque', 'deque', (['[]'], {'maxlen': 'self.stack_frames'}), '([], maxlen=self.stack_frames)\n', (411, 441), False, 'from collections import deque\n'), ((658, 672), 'numpy.float32', 'np.flo...
import hashlib import os import sys from collections import defaultdict from functools import reduce from scipy.spatial.distance import cdist import numpy as np import cv2 import sklearn import sklearn.cluster import pickle from vision.framework.bcf.evolution import evolution from vision.framework.bcf.shape_context i...
[ "pickle.dump", "numpy.sum", "os.walk", "collections.defaultdict", "pickle.load", "cv2.imshow", "os.path.join", "numpy.append", "vision.framework.bcf.evolution.evolution", "sklearn.svm.LinearSVC", "cv2.drawContours", "scipy.spatial.distance.cdist", "cv2.circle", "cv2.waitKey", "numpy.rand...
[((663, 680), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (674, 680), False, 'from collections import defaultdict\n'), ((701, 718), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (712, 718), False, 'from collections import defaultdict\n'), ((742, 758), 'collections.defau...
import cv2 import torch import numpy as np class Compose(object): def __init__(self, transforms): self.transforms = transforms def __call__(self, image): for t in self.transforms: image= t(image) return image class OneOf(object): def __init__(self, transforms): ...
[ "numpy.full", "numpy.random.uniform", "numpy.abs", "numpy.zeros", "cv2.copyMakeBorder", "cv2.blur", "numpy.clip", "cv2.warpAffine", "numpy.random.randint", "numpy.array", "cv2.randn", "numpy.random.choice", "numpy.random.rand", "cv2.flip", "cv2.getRotationMatrix2D", "cv2.resize", "to...
[((413, 446), 'numpy.random.choice', 'np.random.choice', (['self.transforms'], {}), '(self.transforms)\n', (429, 446), True, 'import numpy as np\n'), ((2702, 2743), 'numpy.random.uniform', 'np.random.uniform', (['self.lower', 'self.upper'], {}), '(self.lower, self.upper)\n', (2719, 2743), True, 'import numpy as np\n'),...
import pandas as pd import numpy as np import os import time import cv2 import random import keras import matplotlib.pyplot as plt from PIL import Image,ImageOps from skimage.transform import resize from skimage.io import imread, imshow from skimage.feature import hog from skimage import exposure from sklearn.preproces...
[ "sklearn.preprocessing.StandardScaler", "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.metrics.accuracy_score", "cv2.xfeatures2d.SURF_create", "pandas.DataFrame", "keras.layers.Flatten", "sklearn.preprocessing.LabelEncoder", "sklearn.svm.LinearSVC", "keras.layers.MaxPoolin...
[((1426, 1442), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1436, 1442), False, 'import os\n'), ((2540, 2591), 'pandas.DataFrame', 'pd.DataFrame', (['twod'], {'columns': 'column_names_with_label'}), '(twod, columns=column_names_with_label)\n', (2552, 2591), True, 'import pandas as pd\n'), ((2656, 2679), 'p...
import datetime import logging import warnings from dataclasses import dataclass, field from functools import lru_cache, wraps from numbers import Number from typing import Callable, Dict, List, Optional, Tuple, Union import numpy as np import pandas as pd import timedelta _logger = logging.getLogger(__name__) def ...
[ "datetime.datetime.today", "pandas.read_csv", "numpy.floor", "logging.getLogger", "datetime.datetime", "dataclasses.field", "pandas.Series", "functools.wraps", "warnings.warn", "functools.lru_cache", "dataclasses.dataclass" ]
[((286, 313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (303, 313), False, 'import logging\n'), ((1477, 1499), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1486, 1499), False, 'from dataclasses import dataclass, field\n'), ((7341, 7363), 'func...
from openmdao.main.api import Component from openmdao.lib.datatypes.api import Float, Array, Int import numpy as np from numpy import pi, cos, sin, mean, linspace, sqrt class VortexRing(Component): """ Vortex ring calculations Computes the induced velocity on the rotor blades given the thrust distribu...
[ "openmdao.lib.datatypes.api.Float", "numpy.zeros", "numpy.mean", "numpy.sin", "numpy.linspace", "numpy.cos", "openmdao.lib.datatypes.api.Array", "openmdao.lib.datatypes.api.Int", "numpy.sqrt" ]
[((374, 415), 'openmdao.lib.datatypes.api.Int', 'Int', ([], {'iotype': '"""in"""', 'desc': '"""number of blades"""'}), "(iotype='in', desc='number of blades')\n", (377, 415), False, 'from openmdao.lib.datatypes.api import Float, Array, Int\n'), ((431, 474), 'openmdao.lib.datatypes.api.Int', 'Int', ([], {'iotype': '"""i...
# Copyright (c) 2020 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...
[ "functools.partial", "numpy.triu", "numpy.ones", "numpy.tile", "paddle.dataset.wmt16.train", "warnings.warn", "paddle.fluid.load_dygraph", "paddle.fluid.load" ]
[((8528, 8579), 'paddle.fluid.load', 'fluid.load', (['program', 'model_path', 'executor', 'var_list'], {}), '(program, model_path, executor, var_list)\n', (8538, 8579), True, 'import paddle.fluid as fluid\n'), ((9209, 9256), 'paddle.fluid.load_dygraph', 'fluid.load_dygraph', (['model_path', 'keep_name_table'], {}), '(m...
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test NetCDF driver support. # Author: <NAME> <<EMAIL>> # ############################################################################### # ...
[ "sys.stdout.write", "os.mkdir", "os.unlink", "gdaltest.download_file", "osgeo.ogr.FieldDefn", "netcdf_cf.netcdf_cf_check_file", "gdaltest.netcdf_drv.GetMetadata", "sys.stdout.flush", "numpy.arange", "osgeo.gdal.GetConfigOption", "shutil.rmtree", "osgeo.gdal.GetDriverByName", "shutil.copy", ...
[((1717, 1744), 'sys.path.append', 'sys.path.append', (['"""../pymod"""'], {}), "('../pymod')\n", (1732, 1744), False, 'import sys\n'), ((96770, 96841), 'gdaltest.GDALTest', 'gdaltest.GDALTest', (['"""netcdf"""', 'item[0]', 'item[1]', 'item[2]'], {'options': 'item[4]'}), "('netcdf', item[0], item[1], item[2], options=i...
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import numpy as np import tensorflow as tf from data_utils import IMDB from data_utils import PTB from log_utils import logger_fn from models.vae import VAE from models.hdgm i...
[ "models.vae.VAE", "os.makedirs", "data_utils.PTB", "tensorflow.Session", "os.path.exists", "tensorflow.summary.FileWriter", "models.hdgm.HDGM", "numpy.exp", "tensorflow.app.flags.DEFINE_string", "data_utils.IMDB", "log_utils.logger_fn", "tensorflow.app.run", "os.path.join" ]
[((333, 395), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""dataset"""', '"""ptb"""', '"""[\'imdb\',\'ptb\']"""'], {}), '(\'dataset\', \'ptb\', "[\'imdb\',\'ptb\']")\n', (359, 395), True, 'import tensorflow as tf\n'), ((395, 456), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_st...
import numpy as np from checker import is_not_concave, is_not_convex def convex_f(x): return x[:,0]**2+x[:,1]**2 def convex_f_1(x): return x[:,0]**3 def concave_f(x): return -x[:,0]**2-x[:,1]**2 def bohachevsky1(x): return x[:,0]**2+2*x[:,1]**2-0.3*np.cos(3*np.pi*x[:,0])-0.4*np.cos(4*np.pi*x[:,1])+0...
[ "numpy.array", "numpy.cos", "checker.is_not_convex" ]
[((441, 461), 'numpy.array', 'np.array', (['[[0], [1]]'], {}), '([[0], [1]])\n', (449, 461), True, 'import numpy as np\n'), ((1109, 1145), 'checker.is_not_convex', 'is_not_convex', (['convex_f_1', '(1)', 'bounds'], {}), '(convex_f_1, 1, bounds)\n', (1122, 1145), False, 'from checker import is_not_concave, is_not_convex...
import numpy def success_rate(pred, true): cnt = 0 for i in range(pred.shape[0]): t = numpy.where(true[i] == 1) # true set ary = numpy.intersect1d(pred[i], t) if ary.size > 0: cnt += 1 return cnt * 100 / pred.shape[0]
[ "numpy.intersect1d", "numpy.where" ]
[((103, 128), 'numpy.where', 'numpy.where', (['(true[i] == 1)'], {}), '(true[i] == 1)\n', (114, 128), False, 'import numpy\n'), ((154, 183), 'numpy.intersect1d', 'numpy.intersect1d', (['pred[i]', 't'], {}), '(pred[i], t)\n', (171, 183), False, 'import numpy\n')]
import pickle import numpy as np import scipy.stats as st import matplotlib as mpl from matplotlib import pyplot as plt np.seterr(divide='ignore', invalid='ignore') mpl.font_manager._rebuild() plt.rc('font', family='Raleway') # Source: https://stackoverflow.com/questions/30079590/ # For continuous: # n = 10 # colo...
[ "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show", "numpy.seterr", "matplotlib.font_manager._rebuild", "matplotlib.pyplot.cycler", "numpy.mean", "numpy.arange", "matplotlib.pyplot.rc", "pickle.load", "scipy.stats.sem", "matplotlib.pyplot.subplots" ]
[((123, 167), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""', 'invalid': '"""ignore"""'}), "(divide='ignore', invalid='ignore')\n", (132, 167), True, 'import numpy as np\n'), ((169, 196), 'matplotlib.font_manager._rebuild', 'mpl.font_manager._rebuild', ([], {}), '()\n', (194, 196), True, 'import matplotlib...
import glob import os from collections import OrderedDict import numpy as np from detectron2.evaluation.cityscapes_evaluation import CityscapesEvaluator from detectron2.utils import comm from detectron2.utils.file_io import PathManager from PIL import Image __all__ = ["CityscapesSemSegEvaluator"] class CityscapesSe...
[ "os.path.abspath", "os.path.join", "os.path.basename", "numpy.zeros", "PIL.Image.fromarray", "cityscapesscripts.evaluation.evalPixelLevelSemanticLabeling.evaluateImgLists", "detectron2.utils.file_io.PathManager.get_local_path", "cityscapesscripts.evaluation.evalPixelLevelSemanticLabeling.getPrediction...
[((1639, 1657), 'detectron2.utils.comm.synchronize', 'comm.synchronize', ([], {}), '()\n', (1655, 1657), False, 'from detectron2.utils import comm\n'), ((2184, 2215), 'os.path.abspath', 'os.path.abspath', (['self._temp_dir'], {}), '(self._temp_dir)\n', (2199, 2215), False, 'import os\n'), ((2557, 2606), 'detectron2.uti...
from bokeh.core.enums import SizingMode import numpy as np from bokeh.io import curdoc from bokeh.layouts import column, row from bokeh.models import ColumnDataSource, Slider, Toggle, Button, tools from bokeh.transform import linear_cmap from bokeh.plotting import figure """ Note button types are default, primary, su...
[ "bokeh.plotting.figure", "numpy.abs", "bokeh.models.Slider", "bokeh.transform.linear_cmap", "bokeh.models.Button", "numpy.zeros", "numpy.amax", "numpy.append", "bokeh.io.curdoc", "numpy.exp", "bokeh.models.Toggle", "numpy.linspace", "numpy.random.rand", "numpy.sqrt", "numpy.concatenate",...
[((791, 824), 'numpy.linspace', 'np.linspace', (['(-x_lim)', 'x_lim'], {'num': 'm'}), '(-x_lim, x_lim, num=m)\n', (802, 824), True, 'import numpy as np\n'), ((1461, 1576), 'bokeh.transform.linear_cmap', 'linear_cmap', ([], {'field_name': '"""color"""', 'palette': '"""Blues8"""', 'low': 'x_lim', 'high': '(0)', 'low_colo...
import cv2 import numpy as np from matplotlib import pyplot as plt def filter_2d (img,fc): #fft fft = np.fft.fft2(img) fshift = np.fft.fftshift(fft) """to set up the lowpass matrix""" rows, cols = img.shape crow,ccol = int(rows/2), int(cols/2) #to find the centre place matrix = np.zero...
[ "matplotlib.pyplot.title", "numpy.fft.ifftshift", "matplotlib.pyplot.subplot", "matplotlib.pyplot.show", "matplotlib.pyplot.imshow", "numpy.zeros", "matplotlib.pyplot.axis", "numpy.fft.fftshift", "numpy.fft.fft2", "numpy.fft.ifft2" ]
[((111, 127), 'numpy.fft.fft2', 'np.fft.fft2', (['img'], {}), '(img)\n', (122, 127), True, 'import numpy as np\n'), ((141, 161), 'numpy.fft.fftshift', 'np.fft.fftshift', (['fft'], {}), '(fft)\n', (156, 161), True, 'import numpy as np\n'), ((313, 345), 'numpy.zeros', 'np.zeros', (['(rows, cols)', 'np.uint8'], {}), '((ro...
#!/usr/bin/env python import os import numpy as np import math from pkg_resources import resource_filename from blimpy import Waterfall from blimpy import sigproc import h5py import logging logger = logging.getLogger(__name__) #For debugging #import cProfile #import pdb;# pdb.set_trace() SIZE_LIM = 256.0 # File s...
[ "numpy.abs", "blimpy.Waterfall", "os.stat", "blimpy.sigproc.is_filterbank", "numpy.log2", "numpy.zeros", "math.floor", "pkg_resources.resource_filename", "os.path.isfile", "numpy.array", "numpy.squeeze", "h5py.is_hdf5", "logging.getLogger" ]
[((201, 228), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (218, 228), False, 'import logging\n'), ((2102, 2143), 'blimpy.Waterfall', 'Waterfall', (['self.filename'], {'load_data': '(False)'}), '(self.filename, load_data=False)\n', (2111, 2143), False, 'from blimpy import Waterfall\n'),...
import os,sys import re import json import urllib.request import zipfile import hashlib import subprocess import uuid import time import zipfile from PIL import Image import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix import seaborn as sns os.environ['CUDA_VISIBLE_DEVICES'] = sys.argv[1] os...
[ "matplotlib.pyplot.title", "tensorflow.python.keras.models.save_model", "os.mkdir", "smtplib.SMTP_SSL", "email.mime.text.MIMEText", "os.walk", "keras_radam.RAdam", "tensorflow.ConfigProto", "os.path.isfile", "matplotlib.pyplot.figure", "os.path.join", "tools.custom.Yolo_Recall", "tensorflow....
[((2448, 2489), 'oss2.Auth', 'oss2.Auth', (['"""MEOWMEOWMEOW"""', '"""MEOWMEOWMEOW"""'], {}), "('MEOWMEOWMEOW', 'MEOWMEOWMEOW')\n", (2457, 2489), False, 'import oss2\n'), ((2499, 2548), 'oss2.Bucket', 'oss2.Bucket', (['auth', '"""MEOWMEOWMEOW"""', '"""MEOWMEOWMEOW"""'], {}), "(auth, 'MEOWMEOWMEOW', 'MEOWMEOWMEOW')\n", ...
#!/usr/bin/env python -O # -*- coding: ascii -*- import argparse import numpy as np import os import signal import sys from domains import Ringworld class GTD: def __init__(self, initial_x: np.ndarray): self.e = np.copy(initial_x) self.w = np.zeros(self.e.shape, dtype=float) self.h = np.z...
[ "numpy.save", "argparse.ArgumentParser", "numpy.copy", "numpy.seterr", "numpy.zeros", "numpy.ones", "numpy.clip", "numpy.random.RandomState", "numpy.array", "numpy.dot" ]
[((1414, 1427), 'numpy.array', 'np.array', (['[5]'], {}), '([5])\n', (1422, 1427), True, 'import numpy as np\n'), ((1448, 1464), 'numpy.array', 'np.array', (['[1000]'], {}), '([1000])\n', (1456, 1464), True, 'import numpy as np\n'), ((1481, 1499), 'numpy.array', 'np.array', (['[0.0005]'], {}), '([0.0005])\n', (1489, 14...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 3 15:46:31 2021 @author: github.com/sahandv """ import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence impo...
[ "tensorflow.keras.layers.Dense", "pandas.read_csv", "tensorflow.keras.callbacks.ModelCheckpoint", "tensorflow.keras.callbacks.EarlyStopping", "matplotlib.pyplot.xlabel", "tensorflow.keras.preprocessing.text.Tokenizer", "tensorflow.keras.Input", "tensorflow.keras.preprocessing.sequence.pad_sequences", ...
[((1713, 1724), 'tensorflow.keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {}), '()\n', (1722, 1724), False, 'from tensorflow.keras.preprocessing.text import Tokenizer\n'), ((2012, 2024), 'tqdm.tqdm', 'tqdm', (['corpus'], {}), '(corpus)\n', (2016, 2024), False, 'from tqdm import tqdm\n'), ((2429, 2494), 'tensor...
""" This one shares parameters across each spec's network so the information is shared across them """ import numpy as np import random import tensorflow as tf import sys import time from copy import deepcopy, copy from typing import TYPE_CHECKING, List, Optional, Dict, Any, Tuple, Sequence ## function and classes r...
[ "copy.deepcopy", "numpy.random.seed", "random.sample", "random.shuffle", "copy.copy", "tensorflow.set_random_seed", "numpy.min", "numpy.max", "random.seed", "numpy.array" ]
[((10896, 10920), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['seed'], {}), '(seed)\n', (10914, 10920), True, 'import tensorflow as tf\n'), ((10925, 10945), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (10939, 10945), True, 'import numpy as np\n'), ((10950, 10967), 'random.seed', 'random...