code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# Copyright (c) 2020, <NAME>. All rights reserved. # # This work is made available under the CC BY-NC-SA 4.0. # To view a copy of this license, see LICENSE import numpy as np import scipy.ndimage import PIL.Image def create_perspective_transform_matrix(src, dst): """ Creates a perspective transformation matrix wh...
[ "numpy.identity", "numpy.mean", "numpy.clip", "numpy.uint8", "numpy.median", "numpy.flipud", "numpy.floor", "numpy.stack", "numpy.array", "numpy.linalg.inv", "numpy.rint", "numpy.concatenate", "numpy.hypot", "numpy.matrix", "numpy.float32" ]
[((835, 871), 'numpy.matrix', 'np.matrix', (['in_matrix'], {'dtype': 'np.float'}), '(in_matrix, dtype=np.float)\n', (844, 871), True, 'import numpy as np\n'), ((5077, 5101), 'numpy.array', 'np.array', (['face_landmarks'], {}), '(face_landmarks)\n', (5085, 5101), True, 'import numpy as np\n'), ((5603, 5631), 'numpy.mean...
# # Unary operator classes and methods # import numbers import numpy as np import pybamm from scipy.sparse import csr_matrix class Broadcast(pybamm.SpatialOperator): """A node in the expression tree representing a broadcasting operator. Broadcasts a child to a specified domain. After discretisation, this will...
[ "numpy.ones", "pybamm.evaluate_for_shape_using_domain", "pybamm.Scalar", "numpy.outer", "scipy.sparse.csr_matrix", "pybamm.DomainError" ]
[((5397, 5448), 'pybamm.evaluate_for_shape_using_domain', 'pybamm.evaluate_for_shape_using_domain', (['self.domain'], {}), '(self.domain)\n', (5435, 5448), False, 'import pybamm\n'), ((9329, 9380), 'pybamm.evaluate_for_shape_using_domain', 'pybamm.evaluate_for_shape_using_domain', (['self.domain'], {}), '(self.domain)\...
# -------------------------------------------------------- # FaceNet Datasets # Licensed under The MIT License [see LICENSE for details] # Copyright 2019 smarsu. All Rights Reserved. # -------------------------------------------------------- import numpy as np def euclidean_distance(a, b): """""" ...
[ "numpy.square" ]
[((342, 358), 'numpy.square', 'np.square', (['(a - b)'], {}), '(a - b)\n', (351, 358), True, 'import numpy as np\n')]
# coding: utf-8 import numpy as np import matplotlib.pylab as plt def sigmoid(x): return 1 / (1 + np.exp(-x)) def step_function(x): return np.array(x > 0, dtype=np.int) x = np.arange(-5.0, 5.0, 0.1) y1 = sigmoid(x) y2 = step_function(x) plt.plot(x, y1) plt.plot(x, y2, 'k--') plt.ylim...
[ "numpy.exp", "numpy.array", "matplotlib.pylab.show", "matplotlib.pylab.plot", "matplotlib.pylab.ylim", "numpy.arange" ]
[((202, 227), 'numpy.arange', 'np.arange', (['(-5.0)', '(5.0)', '(0.1)'], {}), '(-5.0, 5.0, 0.1)\n', (211, 227), True, 'import numpy as np\n'), ((271, 286), 'matplotlib.pylab.plot', 'plt.plot', (['x', 'y1'], {}), '(x, y1)\n', (279, 286), True, 'import matplotlib.pylab as plt\n'), ((288, 310), 'matplotlib.pylab.plot', '...
import re import string import numpy as np import tensorflow as tf import tensorflow.keras as keras def custom_activation(x): return tf.nn.tanh(x) ** 2 class CustomLayer(keras.layers.Layer): def __init__(self, units=32, **kwargs): super(CustomLayer, self).__init__(**kwargs) self.units = tf....
[ "re.escape", "numpy.asfarray", "tensorflow.keras.layers.Dense", "tensorflow.keras.initializers.Ones", "tensorflow.keras.layers.GlobalMaxPooling1D", "tensorflow.matmul", "tensorflow.keras.layers.Conv1D", "tensorflow.nn.tanh", "tensorflow.Variable", "tensorflow.keras.layers.Dropout", "tensorflow.T...
[((975, 1008), 'tensorflow.keras.optimizers.Adam', 'keras.optimizers.Adam', (['(0.002)', '(0.5)'], {}), '(0.002, 0.5)\n', (996, 1008), True, 'import tensorflow.keras as keras\n'), ((1616, 1746), 'tensorflow.keras.layers.experimental.preprocessing.TextVectorization', 'TextVectorization', ([], {'standardize': 'custom_sta...
import numpy as np from keras import models import json, base64, cv2 import FLutils from FLutils.weight_summarizer import WeightSummarizer class Server: def __init__(self, model_fn, weight_summarizer: WeightSummarizer, nb_clients: int = 100): self.nb_clients = nb_clients ...
[ "FLutils.fast_ctc_decode", "cv2.merge", "numpy.mean", "base64.b64decode", "FLutils.get_rid_of_the_models", "numpy.zeros", "numpy.array", "FLutils.generator" ]
[((599, 638), 'FLutils.get_rid_of_the_models', 'FLutils.get_rid_of_the_models', (['model_fn'], {}), '(model_fn)\n', (628, 638), False, 'import FLutils\n'), ((5168, 5204), 'FLutils.get_rid_of_the_models', 'FLutils.get_rid_of_the_models', (['model'], {}), '(model)\n', (5197, 5204), False, 'import FLutils\n'), ((5396, 545...
# -*- coding: utf-8 -*- from numpy import real, min as np_min, max as np_max, zeros, hstack from ....Classes.MeshMat import MeshMat from ....Classes.MeshVTK import MeshVTK from ....definitions import config_dict COLOR_MAP = config_dict["PLOT"]["COLOR_DICT"]["COLOR_MAP"] def plot_deflection( self, *args, ...
[ "pyvista.set_plot_theme", "pyvista.BackgroundPlotter", "numpy.real", "numpy.zeros", "pyvista.Plotter" ]
[((4251, 4262), 'numpy.real', 'real', (['field'], {}), '(field)\n', (4255, 4262), False, 'from numpy import real, min as np_min, max as np_max, zeros, hstack\n'), ((4096, 4112), 'numpy.real', 'real', (['vect_field'], {}), '(vect_field)\n', (4100, 4112), False, 'from numpy import real, min as np_min, max as np_max, zero...
import glob import matplotlib.pyplot as plt import numpy as np import os import pickle import scipy.ndimage import scipy.signal import shutil import display_pyutils # Load the FOCUS packageimport sys import sys sys.path.append('/home/allie/projects/focus') # Just to remember where this path is from! IM_DIR = '/home/...
[ "display_pyutils.savefig", "sys.path.append", "numpy.where", "numpy.sort", "matplotlib.pyplot.close", "os.mkdir", "matplotlib.pyplot.ylim", "glob.glob", "numpy.ones", "matplotlib.pyplot.gcf", "shutil.copyfile", "numpy.std", "matplotlib.pyplot.title", "matplotlib.pyplot.legend", "display_...
[((212, 257), 'sys.path.append', 'sys.path.append', (['"""/home/allie/projects/focus"""'], {}), "('/home/allie/projects/focus')\n", (227, 257), False, 'import sys\n'), ((700, 716), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (709, 716), True, 'import matplotlib.pyplot as plt\n'), ((629, 67...
import os import logging from torch.utils import data import numpy as np import yaml from src.common import decide_total_volume_range, update_reso import ipdb st = ipdb.set_trace logger = logging.getLogger(__name__) # Fields class Field(object): ''' Data fields class. ''' def load(self, data_path, idx,...
[ "logging.getLogger", "torch.utils.data.dataloader.default_collate", "os.path.exists", "os.listdir", "mkl.set_num_threads", "os.urandom", "os.path.join", "yaml.load", "numpy.array", "numpy.random.randint", "os.path.isdir", "numpy.random.seed", "numpy.load", "src.common.decide_total_volume_r...
[((190, 217), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'import logging\n'), ((9164, 9202), 'torch.utils.data.dataloader.default_collate', 'data.dataloader.default_collate', (['batch'], {}), '(batch)\n', (9195, 9202), False, 'from torch.utils import data\n'), ((966...
from argparse import ArgumentParser import h5py import multiprocessing import numpy as np from pathlib import Path import pickle import re import tempfile import time import torch import torch.utils.tensorboard from types import SimpleNamespace from utils.data import central_shift, EventCrop, ImageCrop from utils.data...
[ "utils.model.import_module", "time.sleep", "numpy.array", "utils.model.filter_kwargs", "torch.utils.tensorboard.SummaryWriter", "argparse.ArgumentParser", "pathlib.Path", "numpy.searchsorted", "utils.serializer.Serializer", "utils.options.options2model_kwargs", "tempfile.NamedTemporaryFile", "...
[((641, 657), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (655, 657), False, 'from argparse import ArgumentParser\n'), ((720, 744), 'utils.options.validate_test_args', 'validate_test_args', (['args'], {}), '(args)\n', (738, 744), False, 'from utils.options import add_test_arguments, validate_test_arg...
import numpy as np import numpy.random as nr from rlkit.exploration_strategies.base import RawExplorationStrategy from rlkit.core.serializable import Serializable class OUStrategy(RawExplorationStrategy, Serializable): """ This strategy implements the Ornstein-Uhlenbeck process, which adds time-correlate...
[ "numpy.clip", "numpy.prod", "numpy.random.randn", "numpy.ones" ]
[((1187, 1218), 'numpy.prod', 'np.prod', (['action_space.low.shape'], {}), '(action_space.low.shape)\n', (1194, 1218), True, 'import numpy as np\n'), ((1870, 1917), 'numpy.clip', 'np.clip', (['(action + ou_state)', 'self.low', 'self.high'], {}), '(action + ou_state, self.low, self.high)\n', (1877, 1917), True, 'import ...
#!/usr/bin/env python import rospy import numpy as np from state_visualizer import CostmapVisualizer from neuro_local_planner_wrapper.msg import Transition # Global variable (not ideal but works) viewer = CostmapVisualizer() def callback(data): if not data.is_episode_finished: data_1d = np.asarray([(...
[ "rospy.is_shutdown", "rospy.init_node", "numpy.asarray", "numpy.rollaxis", "numpy.expand_dims", "rospy.Subscriber", "state_visualizer.CostmapVisualizer" ]
[((209, 228), 'state_visualizer.CostmapVisualizer', 'CostmapVisualizer', ([], {}), '()\n', (226, 228), False, 'from state_visualizer import CostmapVisualizer\n'), ((649, 707), 'rospy.init_node', 'rospy.init_node', (['"""neuro_input_visualizer"""'], {'anonymous': '(False)'}), "('neuro_input_visualizer', anonymous=False)...
"""Test distributed save and load.""" import subprocess import tempfile import unittest import jax import jax.numpy as jnp import numpy as np import optax from alpa import (init, shutdown, DistributedArray, PipeshardParallel, save_checkpoint, restore_checkpoint) from alpa.device_mesh import get_glo...
[ "alpa.testing.get_bert_layer_train_step", "numpy.array", "alpa.shutdown", "unittest.TextTestRunner", "unittest.TestSuite", "jax.random.PRNGKey", "alpa.testing.assert_allclose", "subprocess.run", "jax.random.normal", "alpa.device_mesh.get_global_cluster", "subprocess.check_output", "alpa.testin...
[((10982, 11002), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (11000, 11002), False, 'import unittest\n'), ((11342, 11367), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (11365, 11367), False, 'import unittest\n'), ((684, 703), 'alpa.init', 'init', ([], {'cluster': '"""ray"""...
# -*- coding: utf-8 -*- """ Recriação do Jogo da Velha @author: Prof. <NAME> """ import pygame import sys import os import traceback import random import numpy as np import copy # Import - Inicialização da arvore e busca em profundidade import tree_dfs class GameConstants: # ...
[ "pygame.init", "pygame.quit", "sys.exit", "copy.copy", "tree_dfs.NodeBoard", "pygame.display.set_mode", "tree_dfs.tree", "pygame.mouse.get_pos", "pygame.draw.rect", "pygame.display.update", "traceback.print_exc", "pygame.time.Clock", "pygame.font.SysFont", "tree_dfs.probability_next_moves"...
[((1140, 1160), 'tree_dfs.NodeBoard', 'tree_dfs.NodeBoard', ([], {}), '()\n', (1158, 1160), False, 'import tree_dfs\n'), ((7115, 7152), 'random.seed', 'random.seed', (['GameConstants.randomSeed'], {}), '(GameConstants.randomSeed)\n', (7126, 7152), False, 'import random\n'), ((7158, 7171), 'pygame.init', 'pygame.init', ...
import numpy as np from inferelator.utils import Validator as check from inferelator import utils from inferelator.regression import base_regression from inferelator.distributed.inferelator_mp import MPControl from sklearn.base import BaseEstimator from inferelator.regression.base_regression import _MultitaskRegression...
[ "numpy.abs", "numpy.repeat", "inferelator.utils.Validator.argument_type", "inferelator.utils.make_array_2d", "inferelator.distributed.dask_functions.sklearn_regress_dask", "inferelator.utils.Validator.argument_is_subclass", "inferelator.regression.base_regression.recalculate_betas_from_selected", "inf...
[((911, 945), 'inferelator.utils.Validator.argument_type', 'check.argument_type', (['x', 'np.ndarray'], {}), '(x, np.ndarray)\n', (930, 945), True, 'from inferelator.utils import Validator as check\n'), ((957, 991), 'inferelator.utils.Validator.argument_type', 'check.argument_type', (['y', 'np.ndarray'], {}), '(y, np.n...
import matplotlib.image as mpimg import os import camera import numpy as np import cv2 import matplotlib.pyplot as plt import config import line import time import math class ProcessImage(): def __init__(self, config): self.config = config self.left_line = line.Line(config) self.right_line ...
[ "cv2.rectangle", "numpy.convolve", "numpy.hstack", "numpy.int32", "numpy.array", "cv2.warpPerspective", "numpy.mean", "numpy.max", "cv2.addWeighted", "numpy.linspace", "numpy.vstack", "numpy.concatenate", "numpy.ones", "numpy.argmax", "cv2.putText", "cv2.cvtColor", "numpy.int_", "n...
[((278, 295), 'line.Line', 'line.Line', (['config'], {}), '(config)\n', (287, 295), False, 'import line\n'), ((322, 339), 'line.Line', 'line.Line', (['config'], {}), '(config)\n', (331, 339), False, 'import line\n'), ((361, 413), 'numpy.linspace', 'np.linspace', (['(0)', '(config.shape[0] - 1)', 'config.shape[0]'], {})...
#!/usr/bin/env python """ Test module for level set transport """ from __future__ import print_function from builtins import range from builtins import object from proteus.iproteus import * import os import numpy as np import tables from . import (ls_vortex_2d_p, redist_vortex_2d_p, vof_vo...
[ "os.path.exists", "numpy.allclose", "os.path.join", "tables.open_file", "os.path.abspath", "os.remove" ]
[((2760, 2811), 'tables.open_file', 'tables.open_file', (["(ls_vortex_2d_so.name + '.h5')", '"""r"""'], {}), "(ls_vortex_2d_so.name + '.h5', 'r')\n", (2776, 2811), False, 'import tables\n'), ((2824, 2887), 'numpy.allclose', 'np.allclose', (['expected.root.u_t80', 'actual.root.u_t80'], {'atol': '(1e-10)'}), '(expected.r...
# web-app for API image manipulation from flask import Flask, request, render_template, send_from_directory import os from PIL import Image import tensorflow as tf import cv2 import numpy as np from model import generator_model app = Flask(__name__) APP_ROOT = os.path.dirname(os.path.abspath(__file__)) # default ac...
[ "flask.render_template", "flask.Flask", "numpy.array", "os.remove", "flask.send_from_directory", "numpy.reshape", "numpy.max", "os.path.isdir", "os.mkdir", "os.path.splitext", "os.path.isfile", "cv2.cvtColor", "numpy.shape", "PIL.Image.fromarray", "PIL.Image.open", "flask.request.files...
[((235, 250), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (240, 250), False, 'from flask import Flask, request, render_template, send_from_directory\n'), ((279, 304), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (294, 304), False, 'import os\n'), ((369, 398), 'flask.render_t...
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2018. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
[ "logging.getLogger", "qiskit.quantum_info.synthesis.one_qubit_decompose.ONE_QUBIT_EULER_BASIS_GATES.items", "numpy.eye", "qiskit.quantum_info.Operator", "qiskit.converters.circuit_to_dag", "qiskit.quantum_info.synthesis.one_qubit_decompose.OneQubitEulerDecomposer" ]
[((806, 833), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (823, 833), False, 'import logging\n'), ((2099, 2108), 'numpy.eye', 'np.eye', (['(2)'], {}), '(2)\n', (2105, 2108), True, 'import numpy as np\n'), ((1490, 1545), 'qiskit.quantum_info.synthesis.one_qubit_decompose.ONE_QUBIT_EULER...
import time import cv2 import imutils import numpy as np import pyautogui from imutils.video import WebcamVideoStream from .finger_tracking import HandDetector class FingerDetector: def __init__(self, cam, smooth=9): self.cam = cam self.width = 640 self.height = 480 self.screen_s...
[ "cv2.moveWindow", "imutils.video.WebcamVideoStream", "cv2.flip", "pyautogui.moveTo", "pyautogui.size", "cv2.imshow", "pyautogui.click", "imutils.resize", "cv2.circle", "numpy.interp", "time.time", "cv2.waitKey", "cv2.namedWindow" ]
[((326, 342), 'pyautogui.size', 'pyautogui.size', ([], {}), '()\n', (340, 342), False, 'import pyautogui\n'), ((647, 704), 'imutils.resize', 'imutils.resize', (['img'], {'width': 'self.width', 'height': 'self.height'}), '(img, width=self.width, height=self.height)\n', (661, 704), False, 'import imutils\n'), ((1916, 197...
from matplotlib import pyplot as plt import numpy as np import os if __name__ == '__main__': cores = [] time = [] for d in os.listdir("./output/"): print(d) if(os.path.isdir("./output/"+d)): print(d) cores.append(int(d.split("_")[1])) with open("./output/...
[ "os.listdir", "matplotlib.pyplot.savefig", "numpy.array", "os.path.isdir", "matplotlib.pyplot.subplots", "numpy.save", "matplotlib.pyplot.show" ]
[((136, 159), 'os.listdir', 'os.listdir', (['"""./output/"""'], {}), "('./output/')\n", (146, 159), False, 'import os\n'), ((467, 495), 'numpy.save', 'np.save', (['"""./times.npy"""', 'time'], {}), "('./times.npy', time)\n", (474, 495), True, 'import numpy as np\n'), ((500, 529), 'numpy.save', 'np.save', (['"""./cores....
from snu.snu import Vector from snu.snu import Twist from snu.snu import Wrench from snu.snu import Quaternion import numpy as np import pytest def test_vector(): v = Vector(1.,2.,3.) # assert v.x == 1 and v.y == 2 and v.z == 3 assert np.all([v, [1,2,3]]) assert np.all([v.to_tuple(), [1,2,3]]) ass...
[ "snu.snu.Quaternion", "numpy.all", "snu.snu.Vector", "snu.snu.Twist" ]
[((173, 194), 'snu.snu.Vector', 'Vector', (['(1.0)', '(2.0)', '(3.0)'], {}), '(1.0, 2.0, 3.0)\n', (179, 194), False, 'from snu.snu import Vector\n'), ((249, 271), 'numpy.all', 'np.all', (['[v, [1, 2, 3]]'], {}), '([v, [1, 2, 3]])\n', (255, 271), True, 'import numpy as np\n'), ((539, 554), 'snu.snu.Vector', 'Vector', ([...
# -*- coding: utf-8 -*- import logging import utool as ut import numpy as np # NOQA (print, rrr, profile) = ut.inject2(__name__, '[_wbia_object]') logger = logging.getLogger('wbia') def _find_wbia_attrs(ibs, objname, blacklist=[]): r""" Developer function to help figure out what attributes are available ...
[ "logging.getLogger", "utool.unindent", "utool.list_alignment", "utool.isiterable", "utool.make_index_lookup", "utool.invert_dict", "utool.take", "numpy.array", "utool.get_funcname", "utool.repr2", "utool.search_module", "utool.set_funcname", "utool.get_func_sourcecode", "utool.partial", ...
[((110, 148), 'utool.inject2', 'ut.inject2', (['__name__', '"""[_wbia_object]"""'], {}), "(__name__, '[_wbia_object]')\n", (120, 148), True, 'import utool as ut\n'), ((158, 183), 'logging.getLogger', 'logging.getLogger', (['"""wbia"""'], {}), "('wbia')\n", (175, 183), False, 'import logging\n'), ((1113, 1149), 'utool.s...
import torch.nn as nn import os import pandas as pd import torch.optim as optim from tqdm import tqdm import numpy as np import torch import torch.nn.functional as nnf import SimpleITK as sitk import json import random import time import medpy.metric.binary as mmb from scipy import ndimage from batchgener...
[ "numpy.clip", "medpy.io.load", "numpy.array", "torch.sum", "MyLoss.DC_and_Focal_loss", "MyDataloader.get_cmbdataloader", "os.path.exists", "os.listdir", "numpy.stack", "numpy.random.choice", "MyLoss.SoftDiceLoss", "DiscriTrainer.DiscriTrainer", "torch.save", "os.makedirs", "MyDataloader....
[((1807, 1970), 'ScreenTrainer.ScreenTrainer', 'ScreenTrainer', ([], {'data_path': 'data_path', 'model_save_path': 'screen_model_path', 'dataset_path': 'dataset_path', 'device': 'device', 'fold': 'fold', 'modality': 'modality', 'if_test': '(True)'}), '(data_path=data_path, model_save_path=screen_model_path,\n datase...
import numpy as np import rclpy from rclpy.node import Node import tf_transformations from geometry_msgs.msg import Twist, Quaternion from nav_msgs.msg import Odometry class OdometryPublisher(Node): def __init__(self): super().__init__('odom_publisher') # subscriber self.vel_sub = self.c...
[ "tf_transformations.quaternion_about_axis", "nav_msgs.msg.Odometry", "rclpy.spin", "numpy.cos", "numpy.sin", "rclpy.init", "rclpy.shutdown" ]
[((2270, 2291), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (2280, 2291), False, 'import rclpy\n'), ((2339, 2365), 'rclpy.spin', 'rclpy.spin', (['odom_publisher'], {}), '(odom_publisher)\n', (2349, 2365), False, 'import rclpy\n'), ((2556, 2572), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()...
""" This file regroups several custom keras layers used in the generation model: - RandomSpatialDeformation, - RandomCrop, - RandomFlip, - SampleConditionalGMM, - SampleResolution, - GaussianBlur, - DynamicGaussianBlur, - MimicAcquisition, - BiasFieldCorruption, - IntensityAugmen...
[ "tensorflow.equal", "tensorflow.shape", "tensorflow.pad", "tensorflow.keras.backend.epsilon", "keras.backend.sum", "keras.backend.reshape", "ext.neuron.layers.SpatialTransformer", "tensorflow.split", "tensorflow.math.floor", "numpy.array", "tensorflow.ones_like", "tensorflow.math.exp", "tens...
[((11760, 11819), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['(self.crop_shape + [-1])'], {'dtype': '"""int32"""'}), "(self.crop_shape + [-1], dtype='int32')\n", (11780, 11819), True, 'import tensorflow as tf\n'), ((11835, 11880), 'tensorflow.slice', 'tf.slice', (['vol'], {'begin': 'crop_idx', 'size': 'c...
import numpy as np import openmdao.api as om from ...utils.constants import INF_BOUND from ...options import options as dymos_options class BoundaryConstraintComp(om.ExplicitComponent): def __init__(self, **kwargs): super().__init__(**kwargs) self._no_check_partials = not dymos_options['include_...
[ "numpy.prod", "numpy.ones", "numpy.arange" ]
[((1965, 1980), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (1974, 1980), True, 'import numpy as np\n'), ((1998, 2013), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (2007, 2013), True, 'import numpy as np\n'), ((1920, 1945), 'numpy.prod', 'np.prod', (["options['shape']"], {}), "(options['shape'...
import pytest from datetime import datetime import pytz import platform from time import sleep import os import numpy as np import pandas as pd from pandas import compat, DataFrame from pandas.compat import range import pandas.util.testing as tm pandas_gbq = pytest.importorskip('pandas_gbq') PROJECT_ID = None PRIVA...
[ "pytz.timezone", "pandas.compat.range", "os.environ.get", "time.sleep", "numpy.random.randint", "pytest.importorskip", "pytest.skip", "numpy.random.randn", "platform.python_version" ]
[((262, 295), 'pytest.importorskip', 'pytest.importorskip', (['"""pandas_gbq"""'], {}), "('pandas_gbq')\n", (281, 295), False, 'import pytest\n'), ((594, 619), 'platform.python_version', 'platform.python_version', ([], {}), '()\n', (617, 619), False, 'import platform\n'), ((1634, 1646), 'pandas.compat.range', 'range', ...
import pickle import numpy as np from numpy.testing import (assert_almost_equal, assert_equal, assert_, assert_allclose) from refnx.analysis import Parameter, Model def line(x, params, *args, **kwds): p_arr = np.array(params) return p_arr[0] + x * p_arr[1] def line2(x, p): r...
[ "refnx.analysis.Model", "pickle.dumps", "numpy.testing.assert_", "numpy.array", "numpy.linspace", "refnx.analysis.Parameter", "pickle.loads" ]
[((244, 260), 'numpy.array', 'np.array', (['params'], {}), '(params)\n', (252, 260), True, 'import numpy as np\n'), ((516, 540), 'refnx.analysis.Parameter', 'Parameter', (['(1.0)'], {'name': '"""c"""'}), "(1.0, name='c')\n", (525, 540), False, 'from refnx.analysis import Parameter, Model\n'), ((553, 577), 'refnx.analys...
"""Colormaps.""" # --- import -------------------------------------------------------------------------------------- import collections import numpy as np from numpy import r_ import matplotlib import matplotlib.pyplot as plt import matplotlib.colors as mplcolors import matplotlib.gridspec as grd # --- define --...
[ "collections.OrderedDict", "matplotlib.colors.ColorConverter", "numpy.floor_divide", "numpy.sin", "matplotlib.colors.LinearSegmentedColormap", "matplotlib.pyplot.plot", "matplotlib.pyplot.subplot", "numpy.mod", "matplotlib.pyplot.figure", "matplotlib.gridspec.GridSpec", "numpy.linspace", "nump...
[((11685, 11710), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (11708, 11710), False, 'import collections\n'), ((11735, 11759), 'matplotlib.pyplot.get_cmap', 'plt.get_cmap', (['"""coolwarm"""'], {}), "('coolwarm')\n", (11747, 11759), True, 'import matplotlib.pyplot as plt\n'), ((11785, 11812)...
import numpy as np import cv2 import tensorflow as tf from tflearn.layers.conv import global_avg_pool import argparse class Model(): """docstring for ClassName""" def __init__(self, arg): self.arg = arg self.trainingmode = tf.constant(True,dtype=tf.bool) self.testingmode = tf.constant(False,dtype=tf...
[ "tensorflow.image.resize_images", "tensorflow.contrib.layers.l2_regularizer", "tensorflow.multiply", "tensorflow.truncated_normal_initializer", "tensorflow.cast", "matplotlib.pyplot.imshow", "argparse.ArgumentParser", "tensorflow.Session", "tensorflow.nn.sigmoid", "tensorflow.concat", "tensorflo...
[((50538, 50593), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""depth completion"""'}), "(description='depth completion')\n", (50561, 50593), False, 'import argparse\n'), ((51496, 51516), 'cv2.imread', 'cv2.imread', (['test_rgb'], {}), '(test_rgb)\n', (51506, 51516), False, 'import cv2\...
## HAND discretised and visualised ## <NAME> import rasterio as rio import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import numpy as np import numpy.ma as ma import argparse def argparser(): parser = argparse.ArgumentParser() parser.add_argument("-d", "--dd", type=str, help="") pa...
[ "matplotlib.pyplot.savefig", "argparse.ArgumentParser", "numpy.ma.array", "matplotlib.use", "rasterio.open", "numpy.digitize", "numpy.diff", "matplotlib.colors.ListedColormap", "numpy.zeros", "numpy.linspace", "matplotlib.pyplot.subplots", "matplotlib.cm.get_cmap", "matplotlib.pyplot.show" ]
[((94, 108), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (101, 108), True, 'import matplotlib as mpl\n'), ((230, 255), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (253, 255), False, 'import argparse\n'), ((933, 953), 'rasterio.open', 'rio.open', (['options.dd'], {}), '(opt...
import numpy as np class GridMove: def __init__(self, grid): self._Grid = grid self._height = grid.shape[0] self._width = grid.shape[1] def _in_bound(self, x, y): if x < 0 or x >= self._height: return False if y < 0 or y >= self._width: return F...
[ "numpy.where" ]
[((1183, 1212), 'numpy.where', 'np.where', (['(self._Grid == index)'], {}), '(self._Grid == index)\n', (1191, 1212), True, 'import numpy as np\n')]
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2017 Alibaba Group Holding 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/LICENS...
[ "numpy.radians", "re.compile", "datetime.datetime.strptime", "numpy.arcsinh", "numpy.arccosh", "numpy.arctanh", "numpy.degrees", "datetime.timedelta" ]
[((12927, 12948), 're.compile', 're.compile', (['pat', 'flgs'], {}), '(pat, flgs)\n', (12937, 12948), False, 'import re\n'), ((13499, 13527), 're.compile', 're.compile', (['pat'], {'flags': 'flags'}), '(pat, flags=flags)\n', (13509, 13527), False, 'import re\n'), ((8437, 8462), 'datetime.timedelta', 'timedelta', ([], {...
import typing from scipy.interpolate import interp1d import numpy as np import slippy from slippy.core import _SubModelABC from slippy.core.materials import _IMMaterial from slippy.core.influence_matrix_utils import bccg, plan_convolve # TODO add from_offset option to get the displacement from the offset class Tangen...
[ "slippy.asnumpy", "numpy.ones_like", "numpy.logical_and", "slippy.core.influence_matrix_utils.bccg", "numpy.logical_not", "scipy.interpolate.interp1d", "numpy.array", "numpy.zeros_like", "slippy.core.influence_matrix_utils.plan_convolve" ]
[((5150, 5238), 'slippy.core.influence_matrix_utils.plan_convolve', 'plan_convolve', (['self._im_total', 'self._im_total', 'domain'], {'circular': 'self._periodic_axes'}), '(self._im_total, self._im_total, domain, circular=self.\n _periodic_axes)\n', (5163, 5238), False, 'from slippy.core.influence_matrix_utils impo...
from pymatgen.core.structure import Molecule from pymatgen.core.operations import SymmOp from pymatgen.symmetry.analyzer import PointGroupAnalyzer from pymatgen.symmetry.analyzer import generate_full_symmops import numpy as np from numpy.linalg import eigh from numpy.linalg import det from copy import deepcopy from mat...
[ "numpy.arccos", "pymatgen.core.structure.Molecule", "numpy.array", "pymatgen.core.operations.SymmOp.from_xyz_string", "numpy.linalg.norm", "numpy.sin", "copy.deepcopy", "pymatgen.core.structure.Molecule.from_file", "numpy.cross", "numpy.dot", "numpy.linalg.eigh", "numpy.identity", "pymatgen....
[((958, 1001), 'numpy.array', 'np.array', (['[[1, 0, 0], [0, 1, 0], [0, 0, 1]]'], {}), '([[1, 0, 0], [0, 1, 0], [0, 0, 1]])\n', (966, 1001), True, 'import numpy as np\n'), ((1006, 1052), 'numpy.array', 'np.array', (['[[-1, 0, 0], [0, -1, 0], [0, 0, -1]]'], {}), '([[-1, 0, 0], [0, -1, 0], [0, 0, -1]])\n', (1014, 1052), ...
import numpy as np class Placeable: def __init__(self, width, height, dic, msg=True): self.size = 0 self.width = width self.height = height self.div, self.i, self.j, self.k = [], [], [], [] self.invP = np.full((2, self.height, self.width, 0), np.nan, dtype="int") s...
[ "numpy.append", "numpy.full" ]
[((248, 309), 'numpy.full', 'np.full', (['(2, self.height, self.width, 0)', 'np.nan'], {'dtype': '"""int"""'}), "((2, self.height, self.width, 0), np.nan, dtype='int')\n", (255, 309), True, 'import numpy as np\n'), ((750, 782), 'numpy.append', 'np.append', (['self.invP', 'ap'], {'axis': '(3)'}), '(self.invP, ap, axis=3...
import unittest import numpy as np from codecarbon.external.hardware import RAM # TODO: need help: test multiprocess case class TestRAM(unittest.TestCase): def test_ram_diff(self): ram = RAM(tracking_mode="process") for array_size in [ # (10, 10), # too small to be noticed ...
[ "codecarbon.external.hardware.RAM", "numpy.ones", "numpy.isclose" ]
[((204, 232), 'codecarbon.external.hardware.RAM', 'RAM', ([], {'tracking_mode': '"""process"""'}), "(tracking_mode='process')\n", (207, 232), False, 'from codecarbon.external.hardware import RAM\n'), ((727, 761), 'numpy.ones', 'np.ones', (['array_size'], {'dtype': 'np.int8'}), '(array_size, dtype=np.int8)\n', (734, 761...
#/ Type: DRS #/ Name: Hf Isotopes Example #/ Authors: <NAME> and <NAME> #/ Description: A Hf isotopes example #/ References: None #/ Version: 1.0 #/ Contact: <EMAIL> from iolite import QtGui import numpy as np def runDRS(): drs.message("Starting Hf isotopes DRS...") drs.progress(0) # Get settings settings = drs...
[ "iolite.QtGui.QWidget", "numpy.power", "iolite.QtGui.QFormLayout", "numpy.log", "iolite.QtGui.QCheckBox", "iolite.QtGui.QComboBox", "iolite.QtGui.QLineEdit" ]
[((4679, 4694), 'iolite.QtGui.QWidget', 'QtGui.QWidget', ([], {}), '()\n', (4692, 4694), False, 'from iolite import QtGui\n'), ((4709, 4728), 'iolite.QtGui.QFormLayout', 'QtGui.QFormLayout', ([], {}), '()\n', (4726, 4728), False, 'from iolite import QtGui\n'), ((5400, 5423), 'iolite.QtGui.QComboBox', 'QtGui.QComboBox',...
import json import os import sys import numpy as np import logging logging.basicConfig(level=logging.DEBUG) from stage1_active_pref_learning import process_cmd_line_args, save_selected_results, save_selected_results_allreps # import matplotlib # from matplotlib.ticker import MultipleLocator # matplotlib.use("Agg") # ...
[ "logging.basicConfig", "os.path.exists", "stage1_active_pref_learning.save_selected_results_allreps", "stage1_active_pref_learning.save_selected_results", "numpy.isscalar", "json.load", "sys.exit", "stage1_active_pref_learning.process_cmd_line_args" ]
[((67, 107), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (86, 107), False, 'import logging\n'), ((2255, 2286), 'stage1_active_pref_learning.process_cmd_line_args', 'process_cmd_line_args', (['sys.argv'], {}), '(sys.argv)\n', (2276, 2286), False, 'from stage...
import os import numpy as np import gym from gym.utils import seeding from .cake_paddle import CakePaddle, RENDER_RATIO from .manual_control import manual_control from pettingzoo import AECEnv from pettingzoo.utils import wrappers from pettingzoo.utils.agent_selector import agent_selector from pettingzoo.utils.to_paral...
[ "pygame.init", "pygame.display.quit", "gym.utils.EzPickle.__init__", "pygame.surfarray.pixels3d", "numpy.rot90", "pygame.event.pump", "numpy.sin", "gym.utils.seeding.np_random", "pettingzoo.utils.wrappers.NanNoOpWrapper", "pettingzoo.utils.wrappers.OrderEnforcingWrapper", "pygame.display.flip", ...
[((12892, 12916), 'pettingzoo.utils.to_parallel.parallel_wrapper_fn', 'parallel_wrapper_fn', (['env'], {}), '(env)\n', (12911, 12916), False, 'from pettingzoo.utils.to_parallel import parallel_wrapper_fn\n'), ((507, 530), 'pygame.image.load', 'pygame.image.load', (['path'], {}), '(path)\n', (524, 530), False, 'import p...
"""Predict with the most-common-label algorithm.""" import argparse import logging from pathlib import Path import muspy import numpy as np import tqdm from arranger.utils import ( load_config, reconstruct_tracks, save_sample_flat, setup_loggers, ) # Load configuration CONFIG = load_config() def pa...
[ "arranger.utils.load_config", "muspy.load", "muspy.write_audio", "arranger.utils.save_sample_flat", "logging.debug", "argparse.ArgumentParser", "pathlib.Path", "tqdm.tqdm", "arranger.utils.reconstruct_tracks", "numpy.array", "numpy.loadtxt", "logging.info" ]
[((298, 311), 'arranger.utils.load_config', 'load_config', ([], {}), '()\n', (309, 311), False, 'from arranger.utils import load_config, reconstruct_tracks, save_sample_flat, setup_loggers\n'), ((390, 415), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (413, 415), False, 'import argparse\n'), ...
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
[ "paddle.rand", "paddle.nn.Dropout", "paddle.matmul", "math.ceil", "paddle.nn.Conv2D", "paddle.shape", "paddle.nn.LayerList", "ppcls.utils.save_load.load_dygraph_pretrain", "numpy.linspace", "paddle.nn.initializer.TruncatedNormal", "paddle.floor", "paddle.to_tensor", "paddle.nn.Linear", "pa...
[((1063, 1088), 'paddle.nn.initializer.TruncatedNormal', 'TruncatedNormal', ([], {'std': '(0.02)'}), '(std=0.02)\n', (1078, 1088), False, 'from paddle.nn.initializer import TruncatedNormal, Constant\n'), ((1097, 1116), 'paddle.nn.initializer.Constant', 'Constant', ([], {'value': '(0.0)'}), '(value=0.0)\n', (1105, 1116)...
import csv lines = [] with open('data/driving_log.csv') as csvfile: reader = csv.reader(csvfile) for line in reader: lines.append(line) import cv2 images = [] steerings = [] throttles = [] brakes = [] speeds = [] for line in lines[1:]: image_path = 'data/' + line[0] image = cv2.imread...
[ "keras.layers.Convolution2D", "keras.layers.Flatten", "keras.layers.MaxPooling2D", "keras.layers.Lambda", "keras.models.Sequential", "numpy.array", "keras.layers.Dropout", "keras.layers.Cropping2D", "csv.reader", "keras.layers.Dense", "cv2.imread" ]
[((531, 547), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (539, 547), True, 'import numpy as np\n'), ((558, 577), 'numpy.array', 'np.array', (['steerings'], {}), '(steerings)\n', (566, 577), True, 'import numpy as np\n'), ((722, 734), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (732, 734),...
import os import time import datetime import json import pandas as pd import numpy as np from pathlib import Path from tqdm import tqdm from typing import List, Optional class PrepareData: """ Limpiar y extraer las series de tiempo de una tabla CSV + Asegurar fechas continuas, completar con 0 las n...
[ "os.path.exists", "pandas.read_csv", "pathlib.Path", "json.dump", "tqdm.tqdm", "os.path.splitext", "time.sleep", "numpy.array", "datetime.date.fromisoformat", "datetime.timedelta", "numpy.save" ]
[((1882, 1895), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1892, 1895), False, 'import time\n'), ((1925, 1950), 'tqdm.tqdm', 'tqdm', (['self.id_time_series'], {}), '(self.id_time_series)\n', (1929, 1950), False, 'from tqdm import tqdm\n'), ((4758, 4772), 'numpy.array', 'np.array', (['rows'], {}), '(rows)\n', ...
import numpy as np def select_threshold(yval, pval): f1 = 0 # You have to return these values correctly best_eps = 0 best_f1 = 0 for epsilon in np.linspace(np.min(pval), np.max(pval), num=1001): # ===================== Your Code Here ===================== # Instructions: Compute ...
[ "numpy.max", "numpy.logical_not", "numpy.logical_and", "numpy.min" ]
[((180, 192), 'numpy.min', 'np.min', (['pval'], {}), '(pval)\n', (186, 192), True, 'import numpy as np\n'), ((194, 206), 'numpy.max', 'np.max', (['pval'], {}), '(pval)\n', (200, 206), True, 'import numpy as np\n'), ((894, 927), 'numpy.logical_and', 'np.logical_and', (['predictions', 'yval'], {}), '(predictions, yval)\n...
# --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.13.7 # kernelspec: # display_name: Python [conda env:gis] # language: python # name: conda-env-gis-py # --...
[ "geopandas.read_file", "cartopy.crs.LambertConformal", "matplotlib.pyplot.colorbar", "numpy.asarray", "matplotlib.collections.PatchCollection", "matplotlib.cm.ScalarMappable", "matplotlib.pyplot.axes", "pyPRMS.ParamDb.ParamDb", "cartopy.crs.AlbersEqualArea", "osgeo.ogr.GetDriverByName", "matplot...
[((1240, 1296), 'pyPRMS.ParamDb.ParamDb', 'ParamDb', ([], {'paramdb_dir': 'work_dir', 'verbose': '(True)', 'verify': '(True)'}), '(paramdb_dir=work_dir, verbose=True, verify=True)\n', (1247, 1296), False, 'from pyPRMS.ParamDb import ParamDb\n'), ((3430, 3467), 'osgeo.ogr.GetDriverByName', 'ogr.GetDriverByName', (['"""E...
from __future__ import division import unittest from numpy.testing import assert_allclose class TestInterpolation(unittest.TestCase): # def test_chebychev(self): # # import numpy as np # from dolo.numeric.interpolation.smolyak import chebychev, chebychev2 # # points = np.linspac...
[ "dolo.numeric.interpolation.smolyak.SmolyakGrid", "numpy.column_stack", "numpy.row_stack", "unittest.main", "time.time" ]
[((2522, 2537), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2535, 2537), False, 'import unittest\n'), ((1076, 1099), 'numpy.row_stack', 'numpy.row_stack', (['[a, b]'], {}), '([a, b])\n', (1091, 1099), False, 'import numpy\n'), ((1181, 1201), 'dolo.numeric.interpolation.smolyak.SmolyakGrid', 'SmolyakGrid', (['a...
"""Plot mean absolute error (MAE) figures. Two types of plots are done: - MAE versus the chronological age, - MAE of one modality versus MAE of another modality. """ from itertools import combinations import os import shutil import matplotlib.pyplot as plt import numpy as np import pandas as pd FIG_OUT_PATH...
[ "os.path.exists", "numpy.abs", "matplotlib.pyplot.grid", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.colorbar", "os.path.join", "itertools.combinations", "matplotlib.pyplot.close", "matplotlib.pyplot.figure", "os.mkdir", "matplotlib.pyplot.scatter", "shutil.rmt...
[((425, 468), 'pandas.read_hdf', 'pd.read_hdf', (['PREDICTIONS'], {'key': '"""predictions"""'}), "(PREDICTIONS, key='predictions')\n", (436, 468), True, 'import pandas as pd\n'), ((661, 700), 'os.path.join', 'os.path.join', (['FIG_OUT_PATH', '"""ae_vs_age"""'], {}), "(FIG_OUT_PATH, 'ae_vs_age')\n", (673, 700), False, '...
import numpy as np import matplotlib.pyplot as plt import cv2 import os from scipy import ndimage as ndi from skimage.morphology import watershed from skimage.feature import peak_local_max from sklearn.cluster import MeanShift from PIL import Image size = 100, 100 img_names = ["../Images/Segmentation/strawberry.png"...
[ "matplotlib.pyplot.imshow", "scipy.ndimage.distance_transform_edt", "skimage.morphology.watershed", "PIL.Image.open", "matplotlib.pyplot.title", "numpy.reshape", "sklearn.cluster.MeanShift", "numpy.ones", "scipy.ndimage.label", "os.path.split", "numpy.array", "matplotlib.pyplot.figure", "cv2...
[((706, 718), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (716, 718), True, 'import matplotlib.pyplot as plt\n'), ((814, 832), 'matplotlib.pyplot.imshow', 'plt.imshow', (['image1'], {}), '(image1)\n', (824, 832), True, 'import matplotlib.pyplot as plt\n'), ((837, 852), 'matplotlib.pyplot.axis', 'plt.axi...
import cv2 as cv import numpy as np import scipy import math import copy # import matplotlib # #%matplotlib inline # import pylab as plt # import json from PIL import Image from shutil import copyfile from skimage import img_as_float from functools import reduce from renderopenpose import * import os import sys def m...
[ "os.path.exists", "PIL.Image.fromarray", "os.makedirs", "os.path.isfile", "numpy.array", "sys.exit", "cv2.imread" ]
[((1409, 1449), 'os.path.exists', 'os.path.exists', (["(save_dir + '/saved_ims/')"], {}), "(save_dir + '/saved_ims/')\n", (1423, 1449), False, 'import os\n'), ((1453, 1490), 'os.makedirs', 'os.makedirs', (["(save_dir + '/saved_ims/')"], {}), "(save_dir + '/saved_ims/')\n", (1464, 1490), False, 'import os\n'), ((1512, 1...
# Copyright (c) 2021. <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distri...
[ "numpy.savez", "numpy.eye", "numpy.asanyarray", "numpy.lib.format.read_magic", "numpy.array", "numpy.zeros", "numpy.lib.format.read_array_header_1_0", "tqdm.auto.tqdm", "copy.copy", "numpy.load" ]
[((1374, 1409), 'numpy.asanyarray', 'np.asanyarray', (['self[:]'], {'dtype': 'dtype'}), '(self[:], dtype=dtype)\n', (1387, 1409), True, 'import numpy as np\n'), ((1541, 1556), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (1550, 1556), False, 'import copy\n'), ((1728, 1743), 'copy.copy', 'copy.copy', (['self'],...
import unittest import numpy as np import cal_joint_lps import data_set_4 import mix_lp def CalGamma(dataC, dataU, pD, pA, g1, g2, calc_type): rt_c, rt_u, rt_cu = cal_joint_lps.CalJointLPS(dataC, dataU, g1, g2) if calc_type == 0: res = mix_lp.MyGetMixLP2(rt_cu, pA) return res lp = rt_...
[ "unittest.main", "numpy.exp", "mix_lp.MyGetMixLP2", "cal_joint_lps.CalJointLPS" ]
[((172, 219), 'cal_joint_lps.CalJointLPS', 'cal_joint_lps.CalJointLPS', (['dataC', 'dataU', 'g1', 'g2'], {}), '(dataC, dataU, g1, g2)\n', (197, 219), False, 'import cal_joint_lps\n'), ((363, 389), 'mix_lp.MyGetMixLP2', 'mix_lp.MyGetMixLP2', (['lp', 'pD'], {}), '(lp, pD)\n', (381, 389), False, 'import mix_lp\n'), ((1609...
import os import time import pickle import random import numpy as np import tensorflow as tf import sys from input import DataInput, DataInputTest from model import Model import argparse parser = argparse.ArgumentParser() parser.add_argument("--batch_size", type=int, default=256, help="inference batch size") args = pa...
[ "input.DataInputTest", "model.Model", "argparse.ArgumentParser", "pickle.load", "random.seed", "numpy.append", "numpy.empty", "numpy.random.seed", "time.time", "tensorflow.ConfigProto", "tensorflow.set_random_seed", "tensorflow.GPUOptions" ]
[((197, 222), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (220, 222), False, 'import argparse\n'), ((339, 356), 'random.seed', 'random.seed', (['(1234)'], {}), '(1234)\n', (350, 356), False, 'import random\n'), ((357, 377), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n',...
#!/usr/bin/env python import os import time import numpy as np import pyscf from pyscf.pbc.dft import multigrid log = pyscf.lib.logger.Logger(verbose=5) with open('/proc/cpuinfo') as f: for line in f: if 'model name' in line: log.note(line[:-1]) break with open('/proc/meminfo') as ...
[ "numpy.eye", "pyscf.pbc.dft.multigrid.MultiGridFFTDF", "time.clock", "numpy.random.random", "os.environ.get", "pyscf.lib.logger.Logger", "time.time" ]
[((120, 154), 'pyscf.lib.logger.Logger', 'pyscf.lib.logger.Logger', ([], {'verbose': '(5)'}), '(verbose=5)\n', (143, 154), False, 'import pyscf\n'), ((388, 427), 'os.environ.get', 'os.environ.get', (['"""OMP_NUM_THREADS"""', 'None'], {}), "('OMP_NUM_THREADS', None)\n", (402, 427), False, 'import os\n'), ((9893, 9921), ...
#!/usr/bin/python ''' The MIT License (MIT) Copyright (c) 2018 <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, ...
[ "numpy.mean", "numpy.median", "string.replace", "utils.checkOutput", "utils.uniquify", "numpy.log2", "utils.formatFolder", "os.path.realpath", "collections.defaultdict", "pipeline_dfci.map_regions", "scipy.stats.sem", "numpy.std", "utils.unParseTable", "utils.parseTable", "sys.path.appen...
[((1716, 1741), 'sys.path.append', 'sys.path.append', (['whereAmI'], {}), '(whereAmI)\n', (1731, 1741), False, 'import sys, os\n'), ((1742, 1771), 'sys.path.append', 'sys.path.append', (['pipeline_dir'], {}), '(pipeline_dir)\n', (1757, 1771), False, 'import sys, os\n'), ((1623, 1649), 'os.path.realpath', 'os.path.realp...
import multiprocessing as mp import logging import traceback from numba.cuda.testing import unittest, CUDATestCase from numba.cuda.testing import skip_on_cudasim, xfail_with_cuda_python def child_test(): from numba import cuda, int32, void from numba.core import config import io import numpy as np ...
[ "logging.getLogger", "traceback.format_exc", "logging.StreamHandler", "numba.cuda.default_stream", "numba.cuda.grid", "multiprocessing.get_context", "numpy.random.randint", "numba.cuda.testing.unittest.main", "numba.cuda.synchronize", "numpy.random.seed", "numba.cuda.to_device", "numba.void", ...
[((3042, 3099), 'numba.cuda.testing.skip_on_cudasim', 'skip_on_cudasim', (['"""Streams not supported on the simulator"""'], {}), "('Streams not supported on the simulator')\n", (3057, 3099), False, 'from numba.cuda.testing import skip_on_cudasim, xfail_with_cuda_python\n'), ((687, 700), 'io.StringIO', 'io.StringIO', ([...
# import the necessary packages(we used only numpy and matplotlib :D ) import numpy as np import matplotlib.image as mpimg import matplotlib.pyplot as plt import time def rectangle(img,x,y,w,h,t): img[y-t:y,x-t:x+w+t,:]=255 img[y-t:y+h+t,x+w:x+w+t,:]=255 img[y+h:y+h+t,x-t:x+w+t,:]=255 img[y-t...
[ "matplotlib.pyplot.imshow", "numpy.flip", "numpy.where", "matplotlib.image.imread", "numpy.square", "matplotlib.pyplot.subplot", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.arctan2", "numpy.linspace", "matplotlib.pyplot.title", "numpy.rad2deg", "time.time", "matplotlib.pyplot.show"...
[((1315, 1338), 'numpy.zeros', 'np.zeros', (['enlargedShape'], {}), '(enlargedShape)\n', (1323, 1338), True, 'import numpy as np\n'), ((2419, 2440), 'numpy.zeros', 'np.zeros', (['image.shape'], {}), '(image.shape)\n', (2427, 2440), True, 'import numpy as np\n'), ((2623, 2688), 'numpy.zeros', 'np.zeros', (['(image_row +...
""" Filtering and dataset mapping methods based on training dynamics. By default, this module reads training dynamics from a given trained model and computes the metrics---confidence, variability, correctness, as well as baseline metrics of forgetfulness and threshold closeness for each instance in the training data. I...
[ "logging.getLogger", "torch.nn.CrossEntropyLoss", "pandas.read_csv", "torch.LongTensor", "seaborn.scatterplot", "os.path.exists", "seaborn.set", "numpy.mean", "argparse.ArgumentParser", "json.dumps", "pandas.concat", "numpy.ceil", "seaborn.diverging_palette", "torch.Tensor", "numpy.argma...
[((923, 1030), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', level=logging.INFO)\n", (942, 1030), False, 'import logging\n'), ((1039, 1066), 'lo...
from .metric import Metric import numpy as np class SpatialDensity(Metric): ''' This Metric calculates the Spatialdensity accross the screen ''' def __init__(self, fixation_array, cellx, celly, screen_dimension): super().__init__(fixation_array) self.cellx = cellx ...
[ "numpy.where", "numpy.sum", "numpy.zeros", "numpy.linspace" ]
[((1218, 1251), 'numpy.zeros', 'np.zeros', (['(num_height, num_width)'], {}), '((num_height, num_width))\n', (1226, 1251), True, 'import numpy as np\n'), ((1332, 1380), 'numpy.linspace', 'np.linspace', (['(0)', 'self.screen_x'], {'num': '(num_width + 1)'}), '(0, self.screen_x, num=num_width + 1)\n', (1343, 1380), True,...
# -*- coding: utf-8 -*- """ Detect CV (consonant-vowel) pair events in speaker and microphone channels. """ # Third party libraries import numpy as np import scipy.signal as sgn from ecogvis.signal_processing.resample import resample def detect_events(speaker_data, mic_data=None, interval=None, dfact=30, ...
[ "numpy.abs", "numpy.ceil", "ecogvis.signal_processing.resample.resample", "numpy.where", "numpy.delete", "numpy.diff", "numpy.append", "numpy.array", "numpy.zeros", "numpy.log2" ]
[((2331, 2350), 'numpy.zeros', 'np.zeros', (['extraBins'], {}), '(extraBins)\n', (2339, 2350), True, 'import numpy as np\n'), ((2363, 2387), 'numpy.append', 'np.append', (['X', 'extraZeros'], {}), '(X, extraZeros)\n', (2372, 2387), True, 'import numpy as np\n'), ((2408, 2427), 'ecogvis.signal_processing.resample.resamp...
import numpy as np import mxnet as mx from mxnet import nd, autograd, gluon from mxnet.gluon import nn, Block from mxnet.gluon.loss import Loss class InnerEncoderBlock(Block): def __init__(self, num_filters, **kwargs): super(InnerEncoderBlock, self).__init__(**kwargs) with self.name_scope(): ...
[ "mxnet.nd.relu", "mxnet.nd.mean", "numpy.ones", "mxnet.gluon.nn.Conv2D", "mxnet.gluon.nn.Dense", "mxnet.nd.log_softmax", "mxnet.init.Xavier", "mxnet.nd.shape", "mxnet.nd.tile", "mxnet.gluon.nn.LayerNorm", "mxnet.nd.softmax", "mxnet.nd.concat" ]
[((519, 529), 'mxnet.nd.relu', 'nd.relu', (['x'], {}), '(x)\n', (526, 529), False, 'from mxnet import nd, autograd, gluon\n'), ((944, 974), 'mxnet.nd.softmax', 'nd.softmax', (['(q * k.T * 1.0 / dk)'], {}), '(q * k.T * 1.0 / dk)\n', (954, 974), False, 'from mxnet import nd, autograd, gluon\n'), ((2125, 2193), 'numpy.one...
def set_seeds(seed_val=42): '''fix seeds for reproducibility. ''' from numpy.random import seed seed(seed_val) from tensorflow import random random.set_seed(seed_val) def get_zero_based_task_id(default_return=None): '''fetches the environment variable for this process' task id. Retur...
[ "tensorflow.random.set_seed", "os.environ.get", "numpy.random.seed" ]
[((113, 127), 'numpy.random.seed', 'seed', (['seed_val'], {}), '(seed_val)\n', (117, 127), False, 'from numpy.random import seed\n'), ((166, 191), 'tensorflow.random.set_seed', 'random.set_seed', (['seed_val'], {}), '(seed_val)\n', (181, 191), False, 'from tensorflow import random\n'), ((409, 444), 'os.environ.get', 'o...
#!/usr/bin/python3 from ctypes import * import cv2 import numpy as np import sys import os import time from ipdb import set_trace as dbg from enum import IntEnum import imutils tracking=False lib_dir='/home/atsg/PycharmProjects/face_recognition/FaceKit/PCN/' class CPoint(Structure): _fields_ = [("x", c_int), ...
[ "os.path.exists", "os.listdir", "os.makedirs", "cv2.polylines", "cv2.line", "os.path.join", "cv2.imshow", "numpy.array", "cv2.circle", "cv2.waitKey", "imutils.rotate_bound", "cv2.VideoCapture", "cv2.getRotationMatrix2D", "time.time" ]
[((2824, 2877), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['(centerX, centerY)', 'angle', '(1)'], {}), '((centerX, centerY), angle, 1)\n', (2847, 2877), False, 'import cv2\n'), ((2885, 2957), 'numpy.array', 'np.array', (['[[x1, y1, 1], [x1, y2, 1], [x2, y2, 1], [x2, y1, 1]]', 'np.int32'], {}), '([[x1, y1, ...
# Pseudocolor any grayscale image import os import cv2 import numpy as np from matplotlib import pyplot as plt from plantcv.plantcv import params from plantcv.plantcv import plot_image from plantcv.plantcv import fatal_error def pseudocolor(gray_img, obj=None, mask=None, cmap=None, background="image", min_value=0, m...
[ "matplotlib.pyplot.imshow", "numpy.copy", "cv2.rectangle", "plantcv.plantcv.fatal_error", "matplotlib.pyplot.xticks", "plantcv.plantcv.plot_image", "matplotlib.pyplot.gcf", "cv2.copyMakeBorder", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.show", "matplotlib.pyplot.close", "matplotlib.pypl...
[((1610, 1627), 'numpy.copy', 'np.copy', (['gray_img'], {}), '(gray_img)\n', (1617, 1627), True, 'import numpy as np\n'), ((1712, 1751), 'plantcv.plantcv.fatal_error', 'fatal_error', (['"""Image must be grayscale."""'], {}), "('Image must be grayscale.')\n", (1723, 1751), False, 'from plantcv.plantcv import fatal_error...
import numpy as np import matplotlib matplotlib.use('PDF') import matplotlib.pyplot as plt from scipy.stats import beta as Beta i=9 n=10 alpha=5 beta=5 samples=np.random.choice(2, n, replace=True, p=[0.3,0.7]) k=len([y for y in samples if y==1]) #x-axis values x=np.linspace(0,1, 100) #r'$\alpha=1, \beta$=1' plt....
[ "matplotlib.pyplot.ylabel", "matplotlib.use", "numpy.random.choice", "matplotlib.pyplot.xlabel", "numpy.linspace", "scipy.stats.beta.pdf" ]
[((37, 58), 'matplotlib.use', 'matplotlib.use', (['"""PDF"""'], {}), "('PDF')\n", (51, 58), False, 'import matplotlib\n'), ((164, 214), 'numpy.random.choice', 'np.random.choice', (['(2)', 'n'], {'replace': '(True)', 'p': '[0.3, 0.7]'}), '(2, n, replace=True, p=[0.3, 0.7])\n', (180, 214), True, 'import numpy as np\n'), ...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2020 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
[ "numpy.ones", "numpy.absolute", "improver.wind_calculations.wind_direction.WindDirection", "numpy.array", "numpy.linspace", "unittest.main", "numpy.full", "numpy.pad", "iris.cube.Cube", "numpy.arange" ]
[((2134, 3096), 'numpy.array', 'np.array', (['[1.0 + 0.0j, 0.984807753 + 0.173648178j, 0.939692621 + 0.342020143j, \n 0.866025404 + 0.5j, 0.766044443 + 0.64278761j, 0.64278761 + \n 0.766044443j, 0.5 + 0.866025404j, 0.342020143 + 0.939692621j, \n 0.173648178 + 0.984807753j, 0.0 + 1.0j, -0.173648178 + 0.98480775...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import shutil import itertools from multiprocessing import Pool import numpy as np from dmriqcpy.analysis.stats import stats_mask_volume from dmriqcpy.io.report import Report from dmriqcpy.io.utils import (add_online_arg, add_overwrite_arg, ...
[ "os.path.exists", "dmriqcpy.viz.utils.dataframe_to_html", "itertools.repeat", "numpy.unique", "argparse.ArgumentParser", "os.makedirs", "dmriqcpy.viz.utils.analyse_qa", "dmriqcpy.io.report.Report", "dmriqcpy.viz.screenshot.screenshot_mosaic_wrapper", "dmriqcpy.io.utils.add_online_arg", "dmriqcpy...
[((673, 773), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESCRIPTION', 'formatter_class': 'argparse.RawTextHelpFormatter'}), '(description=DESCRIPTION, formatter_class=argparse.\n RawTextHelpFormatter)\n', (696, 773), False, 'import argparse\n'), ((1833, 1850), 'dmriqcpy.io.utils.add...
from scipy.sparse import csc_matrix from sklearn.preprocessing import StandardScaler import numpy as np import pandas as pd class Dispersion(object): def __init__(self, corpus=None, term_doc_mat=None): """ From https://www.researchgate.net/publication/332120488_Analyzing_dispersion <NAME>. ...
[ "numpy.tile", "numpy.abs", "numpy.sqrt", "numpy.log", "sklearn.preprocessing.StandardScaler", "numpy.array", "pandas.DataFrame" ]
[((6308, 6320), 'numpy.array', 'np.array', (['da'], {}), '(da)\n', (6316, 6320), True, 'import numpy as np\n'), ((6949, 6986), 'pandas.DataFrame', 'pd.DataFrame', (['df_content'], {'index': 'terms'}), '(df_content, index=terms)\n', (6961, 6986), True, 'import pandas as pd\n'), ((2244, 2260), 'numpy.sqrt', 'np.sqrt', ([...
import sys sys.path.append("Mask_RCNN") import os import sys import glob import osmmodelconfig import skimage import math import imagestoosm.config as osmcfg import model as modellib import visualize as vis import numpy as np import csv import QuadKey.quadkey as quadkey import shapely.geometry as geometry import shape...
[ "shapely.geometry.Point", "math.cos", "numpy.array", "shapely.geometry.Polygon", "cv2.approxPolyDP", "QuadKey.quadkey.TileSystem.geo_to_pixel", "sys.path.append", "matplotlib.pyplot.imshow", "numpy.mean", "os.listdir", "cv2.threshold", "model.load_image_gt", "os.path.split", "cv2.contourAr...
[((11, 39), 'sys.path.append', 'sys.path.append', (['"""Mask_RCNN"""'], {}), "('Mask_RCNN')\n", (26, 39), False, 'import sys\n'), ((3072, 3103), 'os.path.join', 'os.path.join', (['ROOT_DIR_', '"""logs"""'], {}), "(ROOT_DIR_, 'logs')\n", (3084, 3103), False, 'import os\n'), ((3282, 3327), 'os.path.join', 'os.path.join',...
from tensorboardX import SummaryWriter import os, glob, csv, random, time import datetime, time, json, shutil from tqdm import tqdm import numpy as np import PIL, cv2 import torch import torch.nn as nn import torch.nn.functional as F from torchvision import transforms from PIL import Image import matp...
[ "model.Model", "torch.from_numpy", "os.path.exists", "numpy.mean", "tensorboardX.SummaryWriter", "shutil.copy2", "utils.new_sim", "numpy.stack", "utils.new_cc", "numpy.random.seed", "os.mkdir", "data.data_generator", "utils.new_kld", "numpy.squeeze", "utils.information_gain", "data.Dat...
[((483, 506), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (500, 506), False, 'import torch\n'), ((512, 540), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['seed'], {}), '(seed)\n', (534, 540), False, 'import torch\n'), ((546, 578), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_...
from __future__ import division from __future__ import print_function from __future__ import absolute_import import tensorflow as tf import numpy as np class TensorStandardScaler: """Helper class for automatically normalizing inputs into the network. """ def __init__(self, x_dim, suffix): """Init...
[ "numpy.mean", "numpy.ones", "tensorflow.variable_scope", "numpy.zeros", "tensorflow.constant_initializer", "numpy.std" ]
[((1433, 1469), 'numpy.mean', 'np.mean', (['data'], {'axis': '(0)', 'keepdims': '(True)'}), '(data, axis=0, keepdims=True)\n', (1440, 1469), True, 'import numpy as np\n'), ((1486, 1521), 'numpy.std', 'np.std', (['data'], {'axis': '(0)', 'keepdims': '(True)'}), '(data, axis=0, keepdims=True)\n', (1492, 1521), True, 'imp...
from __future__ import print_function import numpy as np import math from scipy.misc import logsumexp import torch import torch.utils.data import torch.nn as nn from torch.nn import Linear from torch.autograd import Variable from ..utils.distributions import log_Bernoulli, log_Normal_diag, log_Normal_standard, lo...
[ "torch.nn.Hardtanh", "numpy.mean", "numpy.prod", "torch.nn.Sigmoid", "numpy.reshape", "torch.mean", "torch.max", "numpy.asarray", "math.log", "numpy.array", "torch.nn.Linear", "torch.FloatTensor", "torch.clamp", "scipy.misc.logsumexp" ]
[((1000, 1030), 'torch.nn.Linear', 'Linear', (['(300)', 'self.args.z1_size'], {}), '(300, self.args.z1_size)\n', (1006, 1030), False, 'from torch.nn import Linear\n'), ((4117, 4142), 'numpy.array', 'np.array', (['likelihood_test'], {}), '(likelihood_test)\n', (4125, 4142), True, 'import numpy as np\n'), ((2973, 2989), ...
#!/usr/bin/python import argparse import copy import json import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import re import scipy as sp import tensorflow as tf from functools import reduce from sklearn.metrics import auc from sklearn.metrics import roc_curve from sklearn.preprocessing i...
[ "pandas.read_csv", "numpy.hstack", "sklearn.metrics.auc", "sklearn.metrics.roc_curve", "tensorflow.keras.layers.Dense", "copy.deepcopy", "numpy.mean", "argparse.ArgumentParser", "numpy.sort", "numpy.max", "numpy.vstack", "numpy.min", "numpy.argmin", "tensorflow.keras.models.Sequential", ...
[((349, 374), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (372, 374), False, 'import argparse\n'), ((3056, 3108), 'pandas.merge', 'pd.merge', ([], {'left': 'pred_df', 'right': 'response_df', 'on': '"""Date"""'}), "(left=pred_df, right=response_df, on='Date')\n", (3064, 3108), True, 'import p...
import numpy as np import torch from bisect import bisect_left class TinyImages(torch.utils.data.Dataset): def __init__(self, transform=None, exclude_cifar=True): data_file = open('datasets/unlabeled_datasets/80M_Tiny_Images/tiny_images.bin', "rb") def load_image(idx): data_file.seek...
[ "numpy.random.randint", "numpy.fromstring" ]
[((1690, 1717), 'numpy.random.randint', 'np.random.randint', (['(79302017)'], {}), '(79302017)\n', (1707, 1717), True, 'import numpy as np\n'), ((392, 426), 'numpy.fromstring', 'np.fromstring', (['data'], {'dtype': '"""uint8"""'}), "(data, dtype='uint8')\n", (405, 426), True, 'import numpy as np\n')]
import matplotlib.pylab as plt import numpy as np #x = np.linspace(-np.pi, np.pi, 10) #plt.plot(x, np.sin(x)) #plt.xlabel('Angle [rad]') #plt.ylabel('sin(x)') #plt.axis('tight') #plt.show() def sin_static(): # raw x = np.linspace(-np.pi, np.pi, 252) y = np.sin(x) * 4 # discretize y axis y_disc = y...
[ "matplotlib.pylab.axis", "matplotlib.pylab.xlabel", "numpy.linspace", "matplotlib.pylab.show", "numpy.sin", "matplotlib.pylab.plot", "matplotlib.pylab.ylabel" ]
[((376, 407), 'numpy.linspace', 'np.linspace', (['(-np.pi)', 'np.pi', '(252)'], {}), '(-np.pi, np.pi, 252)\n', (387, 407), True, 'import numpy as np\n'), ((408, 422), 'matplotlib.pylab.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (416, 422), True, 'import matplotlib.pylab as plt\n'), ((423, 448), 'matplotlib.pylab....
import math from typing import Dict, Optional, Tuple import numpy as np import networkx as nx def GetRecvWeights(topo: nx.DiGraph, rank: int) -> Tuple[float, Dict[int, float]]: """Return a Tuple of self_weight and neighbor_weights for receiving dictionary.""" weight_matrix = nx.to_numpy_array(topo) self_...
[ "numpy.roll", "numpy.sqrt", "networkx.to_numpy_array", "math.log", "numpy.array", "numpy.zeros", "networkx.from_numpy_array", "numpy.empty", "numpy.nonzero" ]
[((287, 310), 'networkx.to_numpy_array', 'nx.to_numpy_array', (['topo'], {}), '(topo)\n', (304, 310), True, 'import networkx as nx\n'), ((805, 828), 'networkx.to_numpy_array', 'nx.to_numpy_array', (['topo'], {}), '(topo)\n', (822, 828), True, 'import networkx as nx\n'), ((1693, 1715), 'numpy.empty', 'np.empty', (['(siz...
import ConfigSpace import numpy as np import threading from robo.models.lcnet import LCNet, get_lc_net from hpbandster.core.base_config_generator import base_config_generator def smoothing(lc): new_lc = [] curr_best = np.inf for i in range(len(lc)): if lc[i] < curr_best: curr_best = ...
[ "numpy.repeat", "numpy.sqrt", "numpy.ones", "numpy.random.choice", "threading.Lock", "numpy.max", "numpy.append", "numpy.sum", "numpy.linspace", "numpy.concatenate", "numpy.min", "ConfigSpace.Configuration" ]
[((1678, 1694), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1692, 1694), False, 'import threading\n'), ((3133, 3187), 'ConfigSpace.Configuration', 'ConfigSpace.Configuration', (['self.config_space'], {'vector': 'c'}), '(self.config_space, vector=c)\n', (3158, 3187), False, 'import ConfigSpace\n'), ((4221, 42...
from typing import Dict, List, Tuple from itertools import product import re import yaml from pathlib import Path import numpy as np import os import shutil from abc import ABCMeta, abstractmethod import nncase import struct from compare_util import compare_with_ground_truth, VerboseType class Edict: def __init__...
[ "numpy.random.rand", "nncase.ImportOptions", "re.compile", "nncase.CompileOptions", "nncase.test_target", "os.path.exists", "pathlib.Path", "itertools.product", "numpy.asarray", "compare_util.compare_with_ground_truth", "os.path.splitext", "struct.pack", "os.path.dirname", "nncase.RuntimeT...
[((1547, 1579), 'numpy.random.randint', 'np.random.randint', (['(0)', '(256)', 'shape'], {}), '(0, 256, shape)\n', (1564, 1579), True, 'import numpy as np\n'), ((2464, 2488), 'struct.pack', 'struct.pack', (['"""!f"""', 'value'], {}), "('!f', value)\n", (2475, 2488), False, 'import struct\n'), ((2846, 2871), 'os.path.di...
from os.path import getmtime from contextlib import contextmanager import re import os from pathlib import Path import pytest import numpy as np import qcodes.tests.dataset from qcodes.dataset.sqlite_base import get_experiments from qcodes.dataset.experiment_container import Experiment from qcodes.dataset.data_set im...
[ "re.escape", "qcodes.tests.instrument_mocks.DummyInstrument", "numpy.array", "qcodes.dataset.data_set.DataSet", "qcodes.dataset.data_set.load_by_id", "pytest.fixture", "qcodes.dataset.experiment_container.Experiment", "qcodes.dataset.database_extract_runs.extract_runs_into_db", "os.path.exists", "...
[((1428, 1460), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (1442, 1460), False, 'import pytest\n'), ((1093, 1115), 'os.path.getmtime', 'getmtime', (['path_to_file'], {}), '(path_to_file)\n', (1101, 1115), False, 'from os.path import getmtime\n'), ((1287, 1309), 'os.pa...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[ "numpy.clip", "tvm.rpc.LocalSession", "vta.build", "tvm.lower", "tvm.te.reduce_axis", "vta.program_fpga", "vta.get_env", "tvm.te.placeholder", "vta.lower", "tvm.nd.array", "vta.testing.simulator.clear_stats", "tvm.te.create_schedule", "vta.testing.simulator.stats", "vta.reconfig_runtime", ...
[((1758, 1771), 'vta.get_env', 'vta.get_env', ([], {}), '()\n', (1769, 1771), False, 'import vta\n'), ((1859, 1905), 'os.environ.get', 'os.environ.get', (['"""VTA_RPC_HOST"""', '"""192.168.2.99"""'], {}), "('VTA_RPC_HOST', '192.168.2.99')\n", (1873, 1905), False, 'import os\n'), ((4586, 4645), 'tvm.te.reduce_axis', 'te...
#!/usr/bin/env python # # # Generate a "tuning" datset, where each datapoint in the set consists of the information from two bouncing ball # simulators. Used to train TuneNet. import os import os.path as osp import matplotlib.pyplot as plt import numpy as np import torch import torchvision.transforms as transforms f...
[ "numpy.mean", "numpy.savez", "tune.utils.get_torch_device", "numpy.std", "os.path.join", "torchvision.transforms.Lambda", "tune.utils.get_immediate_subdirectories", "os.path.isfile", "torch.tensor", "numpy.stack", "numpy.vstack", "torch.utils.data.DataLoader", "tune.utils.get_dataset_base_pa...
[((460, 478), 'tune.utils.get_torch_device', 'get_torch_device', ([], {}), '()\n', (476, 478), False, 'from tune.utils import get_torch_device, get_dataset_base_path, get_immediate_subdirectories\n'), ((1116, 1151), 'tune.utils.get_dataset_base_path', 'get_dataset_base_path', (['dataset_name'], {}), '(dataset_name)\n',...
import numpy as np from numpy import linalg from gym import utils import os from gym.envs.mujoco import mujoco_env import math #from gym_reinmav.envs.mujoco import MujocoQuadEnv # For testing whether a number is close to zero _FLOAT_EPS = np.finfo(np.float64).eps _EPS4 = _FLOAT_EPS * 4.0 class BallBouncingQuadEnv(mu...
[ "numpy.clip", "numpy.eye", "math.asin", "numpy.asarray", "numpy.linalg.norm", "gym.envs.mujoco.mujoco_env.MujocoEnv.__init__", "numpy.square", "math.cos", "numpy.sum", "gym.utils.EzPickle.__init__", "numpy.empty", "numpy.concatenate", "numpy.expand_dims", "numpy.finfo" ]
[((241, 261), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (249, 261), True, 'import numpy as np\n'), ((607, 671), 'gym.envs.mujoco.mujoco_env.MujocoEnv.__init__', 'mujoco_env.MujocoEnv.__init__', (['self', '"""ball_bouncing_quad.xml"""', '(5)'], {}), "(self, 'ball_bouncing_quad.xml', 5)\n", (636,...
''' Here will see how to use shapes features of opencv to be use in different application. ''' import cv2 import numpy as np # First we try one sample image - # The grey level or grey value indicates the brightness of a pixel. The minimum grey level is 0. # The maximum grey level depends on the digitisation depth of...
[ "cv2.rectangle", "cv2.polylines", "cv2.line", "cv2.imshow", "cv2.putText", "cv2.ellipse", "numpy.zeros", "cv2.circle", "numpy.array", "cv2.destroyAllWindows", "cv2.waitKey", "cv2.imread" ]
[((421, 454), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uint8)\n', (429, 454), True, 'import numpy as np\n'), ((957, 1047), 'cv2.line', 'cv2.line', (['black_img', '(0, 0)', '(black_img.shape[0], black_img.shape[1])', '(0, 255, 0)', '(2)'], {}), '(black_img, (0, 0), (black_img.s...
import abc from mpl_toolkits.mplot3d import Axes3D from matplotlib import pyplot as plt from numpy import inf, arange, meshgrid, vectorize, full, zeros, array, ndarray from matplotlib import cm class Benchmark(metaclass=abc.ABCMeta): def __init__(self, lower, upper, dimension): self.dimension = dimension...
[ "numpy.full", "matplotlib.pyplot.clf", "matplotlib.pyplot.close", "numpy.array", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.meshgrid", "numpy.vectorize", "numpy.arange", "matplotlib.pyplot.show" ]
[((1128, 1140), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1138, 1140), True, 'from matplotlib import pyplot as plt\n'), ((1335, 1361), 'numpy.meshgrid', 'meshgrid', (['X_range', 'Y_range'], {}), '(X_range, Y_range)\n', (1343, 1361), False, 'from numpy import inf, arange, meshgrid, vectorize, full, ze...
from __future__ import absolute_import, print_function, division import numpy from .type import TypedListType import theano from theano.gof import Apply, Constant, Op, Variable from theano.tensor.type_other import SliceType from theano import tensor as T from theano.compile.debugmode import _lessbroken_deepcopy cla...
[ "theano.tensor.constant", "theano.compile.debugmode._lessbroken_deepcopy", "theano.tensor.type_other.SliceType", "numpy.asarray", "theano.gof.Apply", "theano.tensor.as_tensor_variable", "theano.tensor.scalar", "theano.typed_list.TypedListType" ]
[((4437, 4467), 'theano.compile.debugmode._lessbroken_deepcopy', '_lessbroken_deepcopy', (['toAppend'], {}), '(toAppend)\n', (4457, 4467), False, 'from theano.compile.debugmode import _lessbroken_deepcopy\n'), ((9291, 9321), 'theano.compile.debugmode._lessbroken_deepcopy', '_lessbroken_deepcopy', (['toInsert'], {}), '(...
################################################################################ # skforecast # # # # This work by <NAME> is licensed under a Creative Commons # # Attribut...
[ "logging.basicConfig", "numpy.hstack", "numpy.random.choice", "numpy.column_stack", "numpy.append", "numpy.array", "numpy.isnan", "numpy.vstack", "numpy.percentile", "warnings.warn", "numpy.full", "numpy.arange" ]
[((801, 914), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)-5s %(name)-10s %(levelname)-5s %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)-5s %(name)-10s %(levelname)-5s %(message)s', level=logging.INFO\n )\n", (820, 914), False, 'import logging\n'), ((6907, 6925...
# -*- coding: utf-8 -*- # @Time : 2018/05/18 # @Author : <NAME> import datetime import json import cv2 import numpy as np import time import core import os from PIL import Image, ImageDraw def transformation_points(src_img, src_points, dst_img, dst_points): src_points = src_points.astype(np.float64) dst_p...
[ "numpy.uint8", "numpy.hstack", "core.morph_triangle", "numpy.array", "PIL.ImageDraw.Draw", "numpy.mean", "core.affine_triangle", "cv2.blur", "cv2.warpAffine", "core.matrix_rectangle", "cv2.findHomography", "core.measure_triangle", "numpy.std", "numpy.linalg.svd", "cv2.getRotationMatrix2D...
[((421, 448), 'numpy.mean', 'np.mean', (['src_points'], {'axis': '(0)'}), '(src_points, axis=0)\n', (428, 448), True, 'import numpy as np\n'), ((458, 485), 'numpy.mean', 'np.mean', (['dst_points'], {'axis': '(0)'}), '(dst_points, axis=0)\n', (465, 485), True, 'import numpy as np\n'), ((539, 557), 'numpy.std', 'np.std',...
# Copyright 2020 Huawei Technologies Co., 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 to...
[ "mindspore.context.get_context", "mindspore.ops.operations.ReduceSum", "mindspore.ops.functional.make_tuple", "mindspore.ops.composite.GradOperation", "numpy.random.seed", "mindspore.common.api._executor.compile", "numpy.random.uniform" ]
[((1135, 1152), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1149, 1152), True, 'import numpy as np\n'), ((1669, 1700), 'mindspore.common.api._executor.compile', '_executor.compile', (['net', '*inputs'], {}), '(net, *inputs)\n', (1686, 1700), False, 'from mindspore.common.api import _executor, ms_fun...
from deep_tobit.util import to_numpy, to_torch import torch as t from scipy.stats import norm import numpy as np from deep_tobit.util import normalize class __CDF(t.autograd.Function): @staticmethod def forward(ctx, x: t.Tensor) -> t.Tensor: type, device = x.dtype, x.device _x = to_numpy(x) ...
[ "torch.log", "numpy.log", "deep_tobit.util.to_torch", "deep_tobit.util.normalize", "numpy.array", "torch.sum", "scipy.stats.norm.pdf", "deep_tobit.util.to_numpy", "scipy.stats.norm.cdf" ]
[((840, 855), 'numpy.array', 'np.array', (['input'], {}), '(input)\n', (848, 855), True, 'import numpy as np\n'), ((909, 932), 'deep_tobit.util.normalize', 'normalize', (['x', 'mean', 'std'], {}), '(x, mean, std)\n', (918, 932), False, 'from deep_tobit.util import normalize\n'), ((952, 974), 'scipy.stats.norm.cdf', 'no...
import pytest from lazydiff import ops from lazydiff.vars import Var import numpy as np def test_sin(): var1 = Var([np.pi, np.pi]) var2 = ops.sin(var1) var2.backward() assert var2.val == pytest.approx([0, 0]) assert np.all(var2.grad(var1) == np.array([-1, -1])) def test_cos(): var1 = Var([np.p...
[ "numpy.arccos", "numpy.sqrt", "lazydiff.ops.sqrt", "lazydiff.ops.tanh", "numpy.array", "numpy.linalg.norm", "lazydiff.ops.div", "lazydiff.ops.sum", "lazydiff.ops.arctanh", "lazydiff.ops.norm", "lazydiff.ops.arcsin", "lazydiff.ops.abs", "numpy.arccosh", "lazydiff.ops.exp", "lazydiff.ops.s...
[((116, 135), 'lazydiff.vars.Var', 'Var', (['[np.pi, np.pi]'], {}), '([np.pi, np.pi])\n', (119, 135), False, 'from lazydiff.vars import Var\n'), ((147, 160), 'lazydiff.ops.sin', 'ops.sin', (['var1'], {}), '(var1)\n', (154, 160), False, 'from lazydiff import ops\n'), ((311, 330), 'lazydiff.vars.Var', 'Var', (['[np.pi, n...
#!/usr/bin/env python3 import numpy as np from dr_phil_hardware.vision.ray import Ray from shapely.geometry import LineString import math from tf import transformations as t def invert_homog_mat(hm): """ inverts homogenous matrix expressing rotation and translation in 3D or 2D """ return t.inverse_mat...
[ "dr_phil_hardware.vision.ray.Ray", "numpy.allclose", "numpy.linalg.norm", "tf.transformations.inverse_matrix" ]
[((307, 327), 'tf.transformations.inverse_matrix', 't.inverse_matrix', (['hm'], {}), '(hm)\n', (323, 327), True, 'from tf import transformations as t\n'), ((817, 836), 'numpy.linalg.norm', 'np.linalg.norm', (['dir'], {}), '(dir)\n', (831, 836), True, 'import numpy as np\n'), ((849, 873), 'dr_phil_hardware.vision.ray.Ra...
from struct import Struct from numpy import frombuffer from pyNastran.op2.op2_interface.op2_common import OP2Common from pyNastran.op2.op2_interface.op2_reader import mapfmt from pyNastran.op2.tables.ogs_grid_point_stresses.ogs_surface_stresses import ( GridPointSurfaceStressesArray, GridPointStressesVolumeDire...
[ "struct.Struct", "numpy.frombuffer", "pyNastran.op2.op2_interface.op2_reader.mapfmt", "pyNastran.op2.op2_interface.op2_common.OP2Common.__init__" ]
[((695, 719), 'pyNastran.op2.op2_interface.op2_common.OP2Common.__init__', 'OP2Common.__init__', (['self'], {}), '(self)\n', (713, 719), False, 'from pyNastran.op2.op2_interface.op2_common import OP2Common\n'), ((13400, 13411), 'struct.Struct', 'Struct', (['fmt'], {}), '(fmt)\n', (13406, 13411), False, 'from struct imp...
import numpy as np def naive_contrast_image(image): result = np.zeros(image.shape, dtype=np.uint8) min_color, max_color = np.min(image), np.max(image) delta_color = max_color-min_color for row in range(image.shape[0]): for col in range(image.shape[1]): pixel = image[row,col] ...
[ "numpy.max", "numpy.zeros", "numpy.min" ]
[((66, 103), 'numpy.zeros', 'np.zeros', (['image.shape'], {'dtype': 'np.uint8'}), '(image.shape, dtype=np.uint8)\n', (74, 103), True, 'import numpy as np\n'), ((131, 144), 'numpy.min', 'np.min', (['image'], {}), '(image)\n', (137, 144), True, 'import numpy as np\n'), ((146, 159), 'numpy.max', 'np.max', (['image'], {}),...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import cv2 import time import numpy as np import pathmagic # noqa import panorama._refmodels.face.detect_face as detect_face import panorama._refmodels.face.facenet as facenet from panor...
[ "panorama._refmodels.face.detect_face.create_mtcnn", "tensorflow.Graph", "panorama._refmodels.face.facenet.prewhiten", "tensorflow.Session", "panorama._refmodels.face.detect_face.detect_face", "numpy.array", "cv2.cvtColor", "time.time", "panorama._refmodels.face.facenet.load_model", "cv2.resize", ...
[((868, 878), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (876, 878), True, 'import tensorflow as tf\n'), ((899, 927), 'tensorflow.Session', 'tf.Session', ([], {'graph': 'self.graph'}), '(graph=self.graph)\n', (909, 927), True, 'import tensorflow as tf\n'), ((1187, 1209), 'cv2.imread', 'cv2.imread', (['image_path...
import numpy as np import minibatch import sys import cv2 sys.path.append("../") from config import config class TestLoader: def __init__(self, imdb, batch_size=1, shuffle=False): self.imdb = imdb self.batch_size = batch_size self.shuffle = shuffle self.size = len(imdb)#num of data...
[ "cv2.imread", "minibatch.get_minibatch", "sys.path.append", "numpy.arange", "numpy.random.shuffle" ]
[((58, 80), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (73, 80), False, 'import sys\n'), ((1651, 1667), 'cv2.imread', 'cv2.imread', (['imdb'], {}), '(imdb)\n', (1661, 1667), False, 'import cv2\n'), ((1993, 2013), 'numpy.arange', 'np.arange', (['self.size'], {}), '(self.size)\n', (2002, 2013...
# ---------------------------------------------------------------------------- # Title: Scientific Visualisation - Python & Matplotlib # Author: <NAME> # License: BSD # ---------------------------------------------------------------------------- import numpy as np import matplotlib.pyplot as plt from matplotlib.coll...
[ "matplotlib.pyplot.savefig", "numpy.tan", "matplotlib.collections.PolyCollection", "numpy.argsort", "numpy.array", "matplotlib.pyplot.figure", "numpy.zeros", "numpy.cos", "numpy.sin", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.show" ]
[((3222, 3241), 'numpy.argsort', 'np.argsort', (['zbuffer'], {}), '(zbuffer)\n', (3232, 3241), True, 'import numpy as np\n'), ((3316, 3342), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 6)'}), '(figsize=(6, 6))\n', (3326, 3342), True, 'import matplotlib.pyplot as plt\n'), ((3685, 3748), 'matplotlib.p...
# -*- coding: utf-8 -*- # Copyright (c) 2016-2020 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import numpy as np from scipy.optimize import linprog from pandapower.estimation.algorithm.matrix_base import BaseAlgebra from pan...
[ "numpy.abs", "numpy.eye", "numpy.ones", "pandapower.estimation.algorithm.matrix_base.BaseAlgebra", "numpy.array", "numpy.zeros" ]
[((688, 706), 'pandapower.estimation.algorithm.matrix_base.BaseAlgebra', 'BaseAlgebra', (['eppci'], {}), '(eppci)\n', (699, 706), False, 'from pandapower.estimation.algorithm.matrix_base import BaseAlgebra\n'), ((1968, 1984), 'numpy.zeros', 'np.zeros', (['(n, 1)'], {}), '((n, 1))\n', (1976, 1984), True, 'import numpy a...
import socket import time import os import numpy as np import matplotlib.pyplot as plt from src.algorithms.QDoubleDeepLearn import QLearn # can be QLearn, QDeepLearn, QDoubleDeepLearn or RandomAgent from src.environments.jsbsim.JSBSimEnv import Env # can be jsbsim.JSBSimEnv or xplane.XPlaneEnv from src.scenarios.delt...
[ "matplotlib.pyplot.ylabel", "numpy.array", "numpy.save", "src.algorithms.QDoubleDeepLearn.QLearn", "os.path.exists", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "numpy.max", "numpy.random.seed", "numpy.min", "src.environments.jsbsim.JSBSimEnv.Env", "numpy.average", "numpy.argmax", ...
[((955, 966), 'time.time', 'time.time', ([], {}), '()\n', (964, 966), False, 'import time\n'), ((1001, 1012), 'time.time', 'time.time', ([], {}), '()\n', (1010, 1012), False, 'import time\n'), ((1456, 1498), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': 'logDecimals'}), '(precision=logDecimals)\n'...
import numpy as np import tensorflow as tf from agents import TabularBasicAgent, capacities class TabularMCAgent(TabularBasicAgent): """ Agent implementing tabular Q-learning. """ def set_agent_props(self): self.discount = self.config['discount'] self.N0 = self.config['N0'] sel...
[ "agents.capacities.tabular_learning", "numpy.array", "tensorflow.VariableScope", "tensorflow.set_random_seed", "numpy.random.random", "tensorflow.placeholder", "agents.capacities.get_mc_target", "tensorflow.summary.scalar", "agents.capacities.tabular_UCB", "numpy.dtype", "tensorflow.summary.merg...
[((4573, 4650), 'numpy.dtype', 'np.dtype', (["[('states', 'int32'), ('actions', 'int32'), ('rewards', 'float32')]"], {}), "([('states', 'int32'), ('actions', 'int32'), ('rewards', 'float32')])\n", (4581, 4650), True, 'import numpy as np\n'), ((4669, 4700), 'numpy.array', 'np.array', (['[]'], {'dtype': 'episodeType'}), ...