code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# -*- coding: utf-8 -*- import sys,os import pandas as pd import numpy as np from collections import Counter import joblib from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.model_selection import RandomizedSearchCV from sklearn.model_selection import GroupKFold, StratifiedKFold f...
[ "sys.path.append", "sklearn.ensemble.RandomForestClassifier", "sklearn.preprocessing.StandardScaler", "os.makedirs", "pandas.read_csv", "numpy.unique", "sklearn.preprocessing.OneHotEncoder", "os.path.exists", "sklearn.model_selection.RandomizedSearchCV", "sklearn.metrics.make_scorer", "numpy.vst...
[((584, 615), 'sys.path.append', 'sys.path.append', (['"""../analysis/"""'], {}), "('../analysis/')\n", (599, 615), False, 'import sys, os\n'), ((850, 880), 'os.path.join', 'os.path.join', (['outdir', '"""models"""'], {}), "(outdir, 'models')\n", (862, 880), False, 'import sys, os\n'), ((1039, 1142), 'pandas.read_csv',...
import unittest from yauber_algo.errors import * class TWMATestCase(unittest.TestCase): def test_twma(self): import yauber_algo.sanitychecks as sc from numpy import array, nan, inf import os import sys import pandas as pd import numpy as np from yauber_algo...
[ "pandas.Series", "numpy.random.random", "numpy.array", "yauber_algo.sanitychecks.SanityChecker" ]
[((443, 465), 'yauber_algo.sanitychecks.SanityChecker', 'sc.SanityChecker', (['algo'], {}), '(algo)\n', (459, 465), True, 'import yauber_algo.sanitychecks as sc\n'), ((589, 616), 'numpy.array', 'array', (['[nan, nan, 2, 7 / 3]'], {}), '([nan, nan, 2, 7 / 3])\n', (594, 616), False, 'from numpy import array, nan, inf\n')...
# coding=utf-8 from pypint.integrators.node_providers.gauss_legendre_nodes import GaussLegendreNodes import unittest from nose.tools import * import numpy as np test_num_nodes = range(2, 7) def manual_initialization(n_nodes): nodes = GaussLegendreNodes() nodes.init(n_nodes) assert_equal(nodes.num_nodes,...
[ "pypint.integrators.node_providers.gauss_legendre_nodes.GaussLegendreNodes", "numpy.sqrt" ]
[((242, 262), 'pypint.integrators.node_providers.gauss_legendre_nodes.GaussLegendreNodes', 'GaussLegendreNodes', ([], {}), '()\n', (260, 262), False, 'from pypint.integrators.node_providers.gauss_legendre_nodes import GaussLegendreNodes\n'), ((803, 823), 'pypint.integrators.node_providers.gauss_legendre_nodes.GaussLege...
# -*- coding: utf-8 -*- """ Created on Mon Sep 30 13:23:53 2019 @author: casimp """ import numpy as np import csv import matplotlib.pyplot as plt from cpex.transformation import strain_transformation class Extract(): def __init__(self): pass def extract_grains(self, data='elastic', idx=...
[ "numpy.moveaxis", "numpy.sum", "numpy.abs", "numpy.ones", "numpy.argsort", "matplotlib.pyplot.contourf", "numpy.arange", "numpy.unique", "numpy.nanmean", "numpy.meshgrid", "numpy.zeros_like", "numpy.transpose", "matplotlib.pyplot.colorbar", "numpy.cumsum", "numpy.max", "numpy.linspace"...
[((2844, 2872), 'numpy.argsort', 'np.argsort', (['euc_dist'], {'axis': '(0)'}), '(euc_dist, axis=0)\n', (2854, 2872), True, 'import numpy as np\n'), ((6900, 6912), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (6910, 6912), True, 'import matplotlib.pyplot as plt\n'), ((6921, 6934), 'matplotlib.pyplot.ylab...
from __future__ import print_function, absolute_import, division import numpy as np from poseutils.logger import log from poseutils.datasets.unprocessed.Dataset import Dataset class TDPWDataset(Dataset): """Dataset class for handling 3DPW dataset :param path: path to npz file :type path: str ...
[ "numpy.load", "poseutils.logger.log" ]
[((885, 907), 'poseutils.logger.log', 'log', (['"""Loaded raw data"""'], {}), "('Loaded raw data')\n", (888, 907), False, 'from poseutils.logger import log\n'), ((483, 534), 'numpy.load', 'np.load', (['path'], {'allow_pickle': '(True)', 'encoding': '"""latin1"""'}), "(path, allow_pickle=True, encoding='latin1')\n", (49...
# Copyright 2020 Makani Technologies LLC # # 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...
[ "makani.config.mconfig.Config", "numpy.deg2rad" ]
[((711, 806), 'makani.config.mconfig.Config', 'mconfig.Config', ([], {'deps': "{'gs_model': 'base_station.gs_model', 'test_site': 'common.test_site'}"}), "(deps={'gs_model': 'base_station.gs_model', 'test_site':\n 'common.test_site'})\n", (725, 806), False, 'from makani.config import mconfig\n'), ((2688, 2706), 'num...
import os import csv import sys import time import json import h5py import pickle as pkl import logging import argparse import random from collections import OrderedDict import torch import numpy as np from tqdm import tqdm, trange from nglib.common import utils def get_arguments(argv): parser = argparse.Argume...
[ "nglib.common.utils.get_root_logger", "nglib.common.utils.bin_config", "h5py.File", "numpy.random.seed", "argparse.ArgumentParser", "random.randint", "torch.manual_seed", "random.shuffle", "time.time", "random.seed", "collections.OrderedDict", "os.path.join", "os.listdir", "numpy.concatena...
[((305, 370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""more intrinsic evaluations"""'}), "(description='more intrinsic evaluations')\n", (328, 370), False, 'import argparse\n'), ((1360, 1377), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1371, 1377), False, 'import ra...
# RUN: %PYTHON %s import numpy as np from shark.shark_importer import SharkImporter import pytest model_path = "https://tfhub.dev/tensorflow/lite-model/albert_lite_base/squadv1/1?lite-format=tflite" # Inputs modified to be useful albert inputs. def generate_inputs(input_details): for input in input_details: ...
[ "numpy.random.randint", "numpy.zeros", "numpy.ones", "shark.shark_importer.SharkImporter" ]
[((905, 1038), 'shark.shark_importer.SharkImporter', 'SharkImporter', ([], {'model_path': 'model_path', 'model_type': '"""tflite"""', 'model_source_hub': '"""tfhub"""', 'device': '"""cpu"""', 'dynamic': '(False)', 'jit_trace': '(True)'}), "(model_path=model_path, model_type='tflite', model_source_hub=\n 'tfhub', dev...
from typing import List, Tuple, Optional import numpy as np import os import torch from torch import nn from environments.environment_abstract import Environment, State from collections import OrderedDict import re from random import shuffle from torch import Tensor import torch.optim as optim from torch.optim.optimize...
[ "numpy.random.choice", "torch.nn.MSELoss", "numpy.maximum", "random.shuffle", "torch.load", "torch.multiprocessing.get_context", "numpy.zeros", "torch.nn.DataParallel", "time.time", "os.environ.get", "torch.cuda.is_available", "torch.device", "collections.OrderedDict", "torch.tensor", "r...
[((904, 963), 'numpy.random.choice', 'np.random.choice', (['num_examples', 'num_examples'], {'replace': '(False)'}), '(num_examples, num_examples, replace=False)\n', (920, 963), True, 'import numpy as np\n'), ((1661, 1673), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (1671, 1673), False, 'from torch import nn\n...
import cv2 import numpy as np from imutils import perspective, rotate_bound from pymatting import estimate_alpha_knn, estimate_foreground_ml, stack_images from typing import Tuple PAPER_SIZE = (1485, 1050) def find_paper(image_bgr: np.ndarray) -> np.ndarray: image_hsv = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2HS...
[ "cv2.approxPolyDP", "numpy.ones", "numpy.argmin", "cv2.erode", "cv2.inRange", "cv2.contourArea", "numpy.zeros_like", "cv2.cvtColor", "numpy.max", "imutils.perspective.four_point_transform", "cv2.drawContours", "cv2.resize", "numpy.uint8", "numpy.min", "cv2.convexHull", "numpy.squeeze",...
[((280, 322), 'cv2.cvtColor', 'cv2.cvtColor', (['image_bgr', 'cv2.COLOR_BGR2HSV'], {}), '(image_bgr, cv2.COLOR_BGR2HSV)\n', (292, 322), False, 'import cv2\n'), ((340, 390), 'cv2.inRange', 'cv2.inRange', (['image_hsv', '(0, 0, 90)', '(180, 60, 255)'], {}), '(image_hsv, (0, 0, 90), (180, 60, 255))\n', (351, 390), False, ...
import tkinter as tk from tkinter import filedialog from tkinter import * from PIL import ImageTk ,Image import numpy as np from keras.models import load_model #load the model model = load_model('traffic_classifier.h5') #defince the class labels in the dictionary classes = { 1:'Speed limit (20km/h)', 2:'S...
[ "keras.models.load_model", "PIL.ImageTk.PhotoImage", "numpy.expand_dims", "tkinter.filedialog.askopenfilename", "PIL.Image.open", "numpy.array", "tkinter.Tk" ]
[((185, 220), 'keras.models.load_model', 'load_model', (['"""traffic_classifier.h5"""'], {}), "('traffic_classifier.h5')\n", (195, 220), False, 'from keras.models import load_model\n'), ((1873, 1880), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1878, 1880), True, 'import tkinter as tk\n'), ((2147, 2168), 'PIL.Image.open'...
import matplotlib.pyplot as plt import numpy as np from typing import Callable import tensorflow as tf from tensorflow import keras from tensorflow.keras import datasets, layers, models import skimage from skimage.metrics import structural_similarity as ssim from sklearn.model_selection import train_test_split from de...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "tensorflow.keras.layers.BatchNormalization", "deep_raman.utils.generate_training_set", "sklearn.model_selection.train_test_split", "tensorflow.keras.Input", "tensorflow.keras.layers.Conv1D", "tensorflow.keras.layers.MaxPooling1D", "tensorflow....
[((461, 489), 'numpy.linspace', 'np.linspace', (['(-200)', '(200)', '(1024)'], {}), '(-200, 200, 1024)\n', (472, 489), True, 'import numpy as np\n'), ((502, 554), 'deep_raman.utils.generate_training_set', 'utils.generate_training_set', (['x'], {'num_base_examples': '(64)'}), '(x, num_base_examples=64)\n', (529, 554), F...
from typing import Dict, Tuple, TYPE_CHECKING import numpy as np from ..continuous_sensor import ContinuousSensor if TYPE_CHECKING: from task import StackingTask # TODO: This should be a DiscreteSensor class CurrentPartReleasedSensor(ContinuousSensor["StackingEnv"]): def __init__(self, part_release_distanc...
[ "numpy.zeros", "numpy.ones" ]
[((645, 656), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (653, 656), True, 'import numpy as np\n'), ((658, 668), 'numpy.ones', 'np.ones', (['(1)'], {}), '(1)\n', (665, 668), True, 'import numpy as np\n')]
import numpy as np import tensorflow as tf from collections import Counter from utils.process_utils import calculate_iou, non_maximum_suppression def evaluate(y_pred, y_true, num_classes, score_thresh=0.5, iou_thresh=0.5): num_images = y_true[0].shape[0] true_labels_dict = {i:0 for i in range(num_classes)} ...
[ "utils.process_utils.non_maximum_suppression", "numpy.argmax", "numpy.array", "utils.process_utils.calculate_iou", "collections.Counter" ]
[((1303, 1362), 'utils.process_utils.non_maximum_suppression', 'non_maximum_suppression', (['pred_boxes', 'pred_confs', 'pred_probs'], {}), '(pred_boxes, pred_confs, pred_probs)\n', (1326, 1362), False, 'from utils.process_utils import calculate_iou, non_maximum_suppression\n'), ((1385, 1410), 'numpy.array', 'np.array'...
import numpy as np from mltk.core.preprocess.audio.audio_feature_generator import AudioFeatureGenerator from mltk.core.preprocess.audio.audio_feature_generator.tests.data import ( DEFAULT_SETTINGS, YES_INPUT_AUDIO, YES_OUTPUT_FEATURES_INT8, NO_INPUT_AUDIO, NO_OUTPUT_FEATURES_INT8 ) def test_yes...
[ "numpy.asarray", "mltk.core.preprocess.audio.audio_feature_generator.AudioFeatureGenerator", "numpy.array", "numpy.allclose" ]
[((374, 405), 'mltk.core.preprocess.audio.audio_feature_generator.AudioFeatureGenerator', 'AudioFeatureGenerator', (['settings'], {}), '(settings)\n', (395, 405), False, 'from mltk.core.preprocess.audio.audio_feature_generator import AudioFeatureGenerator\n'), ((419, 462), 'numpy.asarray', 'np.asarray', (['YES_INPUT_AU...
#!/usr/bin/env python3 """ Implementation of building LSTM model """ # 3rd party imports import pandas as pd import numpy as np import random as rn import datetime as datetime # model import tensorflow as tf from keras.models import Sequential from keras.layers import LSTM from keras.layers import Dense from keras.los...
[ "numpy.random.seed", "pandas.get_dummies", "pandas.merge", "sklearn.model_selection.train_test_split", "keras.layers.LSTM", "keras.layers.Dense", "random.seed", "numpy.array", "keras.losses.MeanSquaredLogarithmicError", "db.model.db.session.query", "pandas.read_sql_table", "keras.models.Sequen...
[((3581, 3599), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (3595, 3599), True, 'import numpy as np\n'), ((3604, 3618), 'random.seed', 'rn.seed', (['(12345)'], {}), '(12345)\n', (3611, 3618), True, 'import random as rn\n'), ((652, 701), 'pandas.read_sql_table', 'pd.read_sql_table', (['"""stat"""', ...
# -*- coding: utf-8 -*- """ Created on Thu May 9 13:46:08 2019 @author: <NAME> """ from binomialTreePricer import asianOptionBinomialTree import pandas as pd import numpy as np from datetime import datetime, timedelta uly_names = ['Crude Oil WTI', 'Ethanol', 'Gold', 'Silver', 'Natural Gas'] uly_init = df_uly[uly_na...
[ "pandas.DataFrame", "binomialTreePricer.asianOptionBinomialTree", "datetime.datetime.strptime", "datetime.timedelta", "numpy.busday_count" ]
[((555, 618), 'pandas.DataFrame', 'pd.DataFrame', (['[[0.3, 0.01, 0.4, 0.1, 0.001]]'], {'columns': 'uly_names'}), '([[0.3, 0.01, 0.4, 0.1, 0.001]], columns=uly_names)\n', (567, 618), True, 'import pandas as pd\n'), ((632, 697), 'pandas.DataFrame', 'pd.DataFrame', (['[[0.01, 0.0001, 1, 0.001, 0.01]]'], {'columns': 'uly_...
import numpy as np import pytest import xarray as xr from pyomeca import Analogs, Markers, Angles, Rototrans from ._constants import ANALOGS_DATA, MARKERS_DATA, EXPECTED_VALUES from .utils import is_expected_array def test_analogs_creation(): dims = ("channel", "time") array = Analogs() np.testing.assert...
[ "pyomeca.Markers.from_random_data", "pyomeca.Markers", "pyomeca.Rototrans", "pyomeca.Angles", "pyomeca.Rototrans.from_random_data", "pytest.raises", "pyomeca.Angles.from_random_data", "xarray.DataArray", "numpy.eye", "pyomeca.Analogs.from_random_data", "pyomeca.Analogs" ]
[((289, 298), 'pyomeca.Analogs', 'Analogs', ([], {}), '()\n', (296, 298), False, 'from pyomeca import Analogs, Markers, Angles, Rototrans\n'), ((403, 431), 'pyomeca.Analogs', 'Analogs', (['ANALOGS_DATA.values'], {}), '(ANALOGS_DATA.values)\n', (410, 431), False, 'from pyomeca import Analogs, Markers, Angles, Rototrans\...
import cv2 as cv import numpy as np class FaceMaskAppEngine: """ Perform detector which detects faces from input video, and classifier to classify croped faces to face or mask class :param config: Is a Config instance which provides necessary parameters. """ def __init__(self, config): ...
[ "numpy.multiply", "libs.classifiers.edgetpu.classifier.Classifier", "cv2.cvtColor", "cv2.VideoCapture", "numpy.shape", "numpy.array", "libs.detectors.edgetpu.detector.Detector" ]
[((1691, 1735), 'cv2.cvtColor', 'cv.cvtColor', (['resized_image', 'cv.COLOR_BGR2RGB'], {}), '(resized_image, cv.COLOR_BGR2RGB)\n', (1702, 1735), True, 'import cv2 as cv\n'), ((2826, 2841), 'numpy.array', 'np.array', (['faces'], {}), '(faces)\n', (2834, 2841), True, 'import numpy as np\n'), ((3585, 3611), 'cv2.VideoCapt...
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # U...
[ "numpy.zeros_like", "numpy.ix_", "pyscf.lib.diis.DIIS", "numpy.zeros", "numpy.transpose", "numpy.prod", "inspect.getargspec", "numpy.reshape", "numpy.linalg.norm", "numpy.arange", "collections.OrderedDict", "numpy.diag", "numpy.concatenate", "numpy.repeat" ]
[((2682, 2707), 'numpy.concatenate', 'numpy.concatenate', (['result'], {}), '(result)\n', (2699, 2707), False, 'import numpy\n'), ((7597, 7626), 'numpy.diag', 'numpy.diag', (["hamiltonian['oo']"], {}), "(hamiltonian['oo'])\n", (7607, 7626), False, 'import numpy\n'), ((7639, 7668), 'numpy.diag', 'numpy.diag', (["hamilto...
from collections import OrderedDict import os.path as osp import matplotlib.pyplot as plt import numpy as np from rlkit.torch.networks import ConcatMlp from rlkit.torch.sets import set_vae_trainer as svt from rlkit.torch.sets import models from rlkit.torch.sets.discriminator import ( DiscriminatorDataset, Dis...
[ "matplotlib.pyplot.quiver", "rlkit.torch.sets.batch_algorithm.BatchTorchAlgorithm", "rlkit.torch.pytorch_util.from_numpy", "rlkit.torch.networks.ConcatMlp", "matplotlib.pyplot.figure", "numpy.sin", "rlkit.torch.sets.parallel_algorithms.ParallelAlgorithms", "rlkit.core.logger.get_snapshot_dir", "os.p...
[((970, 1000), 'numpy.concatenate', 'np.concatenate', (['[x, y]'], {'axis': '(1)'}), '([x, y], axis=1)\n', (984, 1000), True, 'import numpy as np\n'), ((1061, 1120), 'numpy.random.uniform', 'np.random.uniform', (['xlim[0]', 'xlim[1]'], {'size': '(num_examples, 1)'}), '(xlim[0], xlim[1], size=(num_examples, 1))\n', (107...
import numpy as np def avoid_backward_action(action): ## if backward movement is initiated, stop the car if np.all(action > 0.0): action[0] = 0.0 action[1] = 0.0 return action def reward_path_divergence(position_history, pos_ptr, reward_multiplier): v2 = position_history[pos_ptr] - positio...
[ "numpy.linalg.norm", "numpy.sum", "numpy.all" ]
[((114, 134), 'numpy.all', 'np.all', (['(action > 0.0)'], {}), '(action > 0.0)\n', (120, 134), True, 'import numpy as np\n'), ((421, 439), 'numpy.linalg.norm', 'np.linalg.norm', (['v1'], {}), '(v1)\n', (435, 439), True, 'import numpy as np\n'), ((449, 467), 'numpy.linalg.norm', 'np.linalg.norm', (['v2'], {}), '(v2)\n',...
import numpy as np from gym import spaces from brs_envs.base_envs import BaseURDFBulletEnv from brs_envs.base_envs import parse_collision from brs_envs.rocket_landing_scene import RocketLandingScene from brs_envs.martlet9.martlet9_robot import Martlet9Robot class RocketLanderEnv(BaseURDFBulletEnv): LANDING_SPEED...
[ "brs_envs.rocket_landing_scene.RocketLandingScene", "numpy.random.uniform", "brs_envs.base_envs.BaseURDFBulletEnv.__init__", "brs_envs.martlet9.martlet9_robot.Martlet9Robot", "numpy.linalg.norm", "brs_envs.martlet9.martlet9_robot.Martlet9Robot.describeState", "brs_envs.base_envs.BaseURDFBulletEnv.reset"...
[((955, 995), 'brs_envs.base_envs.BaseURDFBulletEnv.__init__', 'BaseURDFBulletEnv.__init__', (['self', 'render'], {}), '(self, render)\n', (981, 995), False, 'from brs_envs.base_envs import BaseURDFBulletEnv\n'), ((2750, 2789), 'brs_envs.martlet9.martlet9_robot.Martlet9Robot.describeState', 'Martlet9Robot.describeState...
# -*- coding: utf-8 -*- """ Defines a convolutional neural network with residual connections. Based on the architecture described in: <NAME>, <NAME>, <NAME>, <NAME>. "Deep residual learning for image recognition". https://arxiv.org/abs/1512.03385 With batch normalization as described in: <NAME>, <NAME>. "Batch normal...
[ "tensorflow.nn.softmax", "tensorflow.metrics.accuracy", "tensorflow.argmax", "tensorflow.pad", "numpy.zeros", "tensorflow.reduce_mean" ]
[((2294, 2339), 'tensorflow.argmax', 'tf.argmax', (["target_vars['predictions']"], {'axis': '(1)'}), "(target_vars['predictions'], axis=1)\n", (2303, 2339), True, 'import tensorflow as tf\n'), ((2356, 2398), 'tensorflow.argmax', 'tf.argmax', (["out_vars['predictions']"], {'axis': '(1)'}), "(out_vars['predictions'], axi...
import sys sys.path.append("./") import shiftnet_cuda import numpy as np import torch import torch.cuda def main(): pattern = np.arange(18 * 18).reshape(18, 18) src_buf = np.zeros((32, 64, 18, 18)).astype(np.float32) for bnr in range(32): for ch in range(64): src_buf[bnr,ch,:,:] = pattern x_hin = ...
[ "sys.path.append", "numpy.zeros", "numpy.arange", "torch.zeros", "shiftnet_cuda.moduloshiftgeneric_nchw", "torch.from_numpy" ]
[((11, 32), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (26, 32), False, 'import sys\n'), ((601, 654), 'shiftnet_cuda.moduloshiftgeneric_nchw', 'shiftnet_cuda.moduloshiftgeneric_nchw', (['x', 'y', '(7)', '(2)', '(-1)'], {}), '(x, y, 7, 2, -1)\n', (638, 654), False, 'import shiftnet_cuda\n'), (...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from .anchor_head_template import AnchorHeadTemplate class GradReverse(torch.autograd.Function): def __init__(self, lambd): self.lambd = lambd def forward(self, x): return x.view_as(x) def backward(self...
[ "torch.nn.Dropout", "torch.cat", "torch.randn", "torch.nn.ModuleDict", "torch.arange", "torch.nn.functional.sigmoid", "torch.ones", "torch.nn.Linear", "torch.zeros", "torch.nn.Parameter", "torch.mean", "torch.nn.Conv2d", "torch.nn.functional.conv2d", "torch.mul", "torch.nn.Sigmoid", "t...
[((941, 980), 'torch.nn.Parameter', 'nn.Parameter', (['param'], {'requires_grad': '(True)'}), '(param, requires_grad=True)\n', (953, 980), True, 'import torch.nn as nn\n'), ((1096, 1108), 'torch.nn.Sigmoid', 'nn.Sigmoid', ([], {}), '()\n', (1106, 1108), True, 'import torch.nn as nn\n'), ((2171, 2210), 'torch.nn.Paramet...
""" Script for extracting the ground plane from the KITTI dataset. We need to determine the ground plane position and orientation in order to be able to reconstruct points on it, which we are trying to detect. We will collect all the points on the ground plane from the dataset and then fit a plane to them with RANSAC...
[ "numpy.meshgrid", "matplotlib.pyplot.show", "argparse.ArgumentParser", "numpy.sum", "shared.geometry.t3x1", "numpy.power", "numpy.cross", "os.path.exists", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.asmatrix", "numpy.arange", "numpy.array", "shared.geometry.R3x3_y", "os.path.join"...
[((2022, 2046), 'numpy.cross', 'np.cross', (['l1', 'l2'], {'axis': '(0)'}), '(l1, l2, axis=0)\n', (2030, 2046), True, 'import numpy as np\n'), ((2129, 2187), 'numpy.asmatrix', 'np.asmatrix', (['[normal[0, 0], normal[1, 0], normal[2, 0], d]'], {}), '([normal[0, 0], normal[1, 0], normal[2, 0], d])\n', (2140, 2187), True,...
import pytest import numpy as np from FastDSP.structures import GPUArray class TestGPUArray: @classmethod def setup_class(cls): cls.rows = 4 cls.cols = 6 cls.array_uint8 = np.ones((cls.rows, cls.cols), dtype=np.uint8) cls.array_int = np.ones((cls.rows, cls.cols), dtype=np.in...
[ "FastDSP.structures.GPUArray", "numpy.ones" ]
[((209, 254), 'numpy.ones', 'np.ones', (['(cls.rows, cls.cols)'], {'dtype': 'np.uint8'}), '((cls.rows, cls.cols), dtype=np.uint8)\n', (216, 254), True, 'import numpy as np\n'), ((279, 324), 'numpy.ones', 'np.ones', (['(cls.rows, cls.cols)'], {'dtype': 'np.int32'}), '((cls.rows, cls.cols), dtype=np.int32)\n', (286, 324)...
import numpy as np class MotionExplorer: """ Aim at exploring motions, represented as sampled observations of a n-dimensional input vector. This stream of vectors describe a vector space in which the Mahalanobis distance is used to assess the distance of new samples to previously seen samples. Everyti...
[ "numpy.dot", "numpy.ravel", "numpy.empty", "numpy.zeros", "numpy.ones", "numpy.hstack", "numpy.sort", "numpy.mean", "numpy.array", "numpy.arange", "numpy.interp", "numpy.eye", "numpy.linalg.pinv", "numpy.vstack" ]
[((2181, 2222), 'numpy.zeros', 'np.zeros', (['(1, self.inputdim * self.order)'], {}), '((1, self.inputdim * self.order))\n', (2189, 2222), True, 'import numpy as np\n'), ((2240, 2276), 'numpy.zeros', 'np.zeros', (['(self.inputdim * self.order)'], {}), '(self.inputdim * self.order)\n', (2248, 2276), True, 'import numpy ...
import numpy as np import bokeh.plotting as bp bp.output_file("bokeh1.html") x = np.linspace(0, 2 * np.pi, 1024) y = np.cos(x) fig = bp.figure( ) fig.line(x, y) bp.show(fig)
[ "bokeh.plotting.figure", "bokeh.plotting.output_file", "bokeh.plotting.show", "numpy.cos", "numpy.linspace" ]
[((47, 76), 'bokeh.plotting.output_file', 'bp.output_file', (['"""bokeh1.html"""'], {}), "('bokeh1.html')\n", (61, 76), True, 'import bokeh.plotting as bp\n'), ((81, 112), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', '(1024)'], {}), '(0, 2 * np.pi, 1024)\n', (92, 112), True, 'import numpy as np\n'), ((117, ...
import pdb import torch import numpy as np import time from tools.utils import Progbar,AverageMeter from matplotlib import pyplot as plt from scipy.integrate import simps def predict_set(nets, dataloader, runtime_params): run_type = runtime_params['run_type'] #net = net.eval() progbar = Progbar(len(datalo...
[ "matplotlib.pyplot.savefig", "numpy.sum", "numpy.concatenate", "matplotlib.pyplot.plot", "numpy.count_nonzero", "time.time", "numpy.argsort", "numpy.max", "numpy.mean", "numpy.array", "numpy.arange", "numpy.linalg.norm", "numpy.min", "torch.no_grad", "scipy.integrate.simps", "tools.uti...
[((383, 397), 'tools.utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (395, 397), False, 'from tools.utils import Progbar, AverageMeter\n'), ((434, 446), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (442, 446), True, 'import numpy as np\n'), ((466, 478), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (4...
######################################## # MIT License # # Copyright (c) 2020 <NAME> ######################################## ''' Define the data_types.for the variables to use in the package. ''' import ctypes import numpy as np __all__ = [] # Types for numpy.ndarray objects cpu_float = np.float64 # double cpu_comp...
[ "numpy.full", "numpy.empty", "numpy.array", "numpy.fromiter", "ctypes.POINTER" ]
[((1258, 1282), 'ctypes.POINTER', 'ctypes.POINTER', (['c_double'], {}), '(c_double)\n', (1272, 1282), False, 'import ctypes\n'), ((1314, 1335), 'ctypes.POINTER', 'ctypes.POINTER', (['c_int'], {}), '(c_int)\n', (1328, 1335), False, 'import ctypes\n'), ((627, 669), 'numpy.array', 'np.array', (['*args'], {'dtype': 'cpu_fl...
# bezier_curve()生成贝塞尔曲线坐标。 import numpy as np from skimage.draw import bezier_curve img = np.zeros((10, 10), dtype=np.uint8) print(img[1, 5]) rr, cc = bezier_curve(1, 5, 5, -2, 8, 8, 2) img[rr, cc] = 1 print(img) print(img[1, 5]) print(img[5, -2]) print(img[8, 8])
[ "numpy.zeros", "skimage.draw.bezier_curve" ]
[((90, 124), 'numpy.zeros', 'np.zeros', (['(10, 10)'], {'dtype': 'np.uint8'}), '((10, 10), dtype=np.uint8)\n', (98, 124), True, 'import numpy as np\n'), ((151, 185), 'skimage.draw.bezier_curve', 'bezier_curve', (['(1)', '(5)', '(5)', '(-2)', '(8)', '(8)', '(2)'], {}), '(1, 5, 5, -2, 8, 8, 2)\n', (163, 185), False, 'fro...
import numpy as np import cv2 import imutils import os import time # This function calculates the distance between the center of two individuals in a # single frame of the video def Check(a, b): dist = (((a[0] - b[0]) ** 2) + (a[1] - b[1]) ** 2) ** 0.5 calibration = (a[1] + b[1]) / 2 if 0 < dist < 0.25 * ...
[ "cv2.dnn.NMSBoxes", "cv2.VideoWriter_fourcc", "numpy.argmax", "cv2.waitKey", "cv2.dnn.blobFromImage", "cv2.dnn.readNetFromDarknet", "time.time", "cv2.VideoCapture", "cv2.rectangle", "numpy.array", "cv2.VideoWriter", "imutils.resize", "cv2.destroyAllWindows", "os.path.sep.join" ]
[((3685, 3711), 'cv2.VideoCapture', 'cv2.VideoCapture', (['filename'], {}), '(filename)\n', (3701, 3711), False, 'import cv2\n'), ((3888, 3899), 'time.time', 'time.time', ([], {}), '()\n', (3897, 3899), False, 'import time\n'), ((4501, 4512), 'time.time', 'time.time', ([], {}), '()\n', (4510, 4512), False, 'import time...
""" Transformer 实现 Author: <NAME> Date: 2021/3/7 REF: http://nlp.seas.harvard.edu/2018/04/03/attention.html """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import copy import math from torch.autograd import Variable from torch.nn.modules.container import Sequential from torch....
[ "torch.nn.Dropout", "torch.sqrt", "torch.nn.Embedding", "numpy.ones", "torch.cos", "matplotlib.pyplot.figure", "numpy.arange", "torch.arange", "torch.ones", "torch.nn.Linear", "torch.zeros", "math.log", "torch.matmul", "torch.nn.modules.normalization.LayerNorm", "copy.deepcopy", "matpl...
[((7195, 7222), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 5)'}), '(figsize=(15, 5))\n', (7205, 7222), True, 'import matplotlib.pyplot as plt\n'), ((7354, 7364), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (7362, 7364), True, 'import matplotlib.pyplot as plt\n'), ((4623, 4648), 'torch....
import matplotlib.pyplot as plt import numpy as np import sys from environment import MountainCar def get_state(mode, state): if mode == 'raw': s = np.zeros((2, 1)) else: s = np.zeros((2048, 1)) for k in state: s[k] = state[k] return s def get_q(s, w, b): ...
[ "matplotlib.pyplot.title", "numpy.random.uniform", "matplotlib.pyplot.show", "environment.MountainCar", "matplotlib.pyplot.legend", "numpy.zeros", "numpy.cumsum", "numpy.random.randint", "numpy.array" ]
[((618, 638), 'numpy.zeros', 'np.zeros', (['(n_S, n_A)'], {}), '((n_S, n_A))\n', (626, 638), True, 'import numpy as np\n'), ((683, 700), 'environment.MountainCar', 'MountainCar', (['mode'], {}), '(mode)\n', (694, 700), False, 'from environment import MountainCar\n'), ((2142, 2167), 'numpy.cumsum', 'np.cumsum', (['a'], ...
# - * - coding: utf - 8 - * - """ This module tests the functions in dam_tol.py. """ __version__ = '1.0' __author__ = '<NAME>' import sys import pytest import numpy as np sys.path.append(r'C:\LAYLA') from src.LAYLA_V02.constraints import Constraints from src.guidelines.dam_tol import is_dam_tol @pytest.mark.param...
[ "sys.path.append", "src.LAYLA_V02.constraints.Constraints", "numpy.array", "src.guidelines.dam_tol.is_dam_tol" ]
[((176, 204), 'sys.path.append', 'sys.path.append', (['"""C:\\\\LAYLA"""'], {}), "('C:\\\\LAYLA')\n", (191, 204), False, 'import sys\n'), ((788, 818), 'src.guidelines.dam_tol.is_dam_tol', 'is_dam_tol', (['stack', 'constraints'], {}), '(stack, constraints)\n', (798, 818), False, 'from src.guidelines.dam_tol import is_da...
import numpy as np import torch import logging logger = logging.getLogger(__name__) class Learner(object): def __init__(self, config): self.config = config self.npr = np.random.RandomState(config.seed) self.calibrate = config.learner.calibrate self.semi_supervised = config.learner...
[ "torch.cuda.is_available", "numpy.random.RandomState", "logging.getLogger" ]
[((57, 84), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (74, 84), False, 'import logging\n'), ((190, 224), 'numpy.random.RandomState', 'np.random.RandomState', (['config.seed'], {}), '(config.seed)\n', (211, 224), True, 'import numpy as np\n'), ((413, 438), 'torch.cuda.is_available', '...
from typing import Optional, Callable import os import torch from torch import nn from torch.nn import functional as F from torch.utils.data import Dataset, DataLoader from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.serialization import save import numpy as np import pandas as pd from glog import log...
[ "torch.nn.Dropout", "sklearn.preprocessing.StandardScaler", "pandas.read_csv", "joblib.dump", "numpy.isnan", "numpy.mean", "torch.no_grad", "sklearn.impute.SimpleImputer", "torch.utils.data.DataLoader", "os.path.exists", "torch.optim.lr_scheduler.ReduceLROnPlateau", "torch.nn.Linear", "sklea...
[((1547, 1583), 'glog.logger.info', 'logger.info', (['f"""Mapping is {mapping}"""'], {}), "(f'Mapping is {mapping}')\n", (1558, 1583), False, 'from glog import logger\n'), ((1595, 1633), 'numpy.array', 'np.array', (['[mapping[y] for y in y_full]'], {}), '([mapping[y] for y in y_full])\n', (1603, 1633), True, 'import nu...
import numpy as np import sympy from enum import Enum from detmodel.hit import Hit from detmodel.signal import Signal, Segment from detmodel.muon import Muon from detmodel import util class DetType(Enum): MM = 'mm' MDT = 'mdt' STGC = 'stgc' def asint(self): return { DetType.MM: ...
[ "detmodel.util.distpoint2line", "numpy.random.uniform", "numpy.abs", "detmodel.hit.Hit", "sympy.Line3D", "sympy.Point", "numpy.zeros", "sympy.Plane", "sympy.Line", "numpy.tan", "detmodel.signal.Signal", "numpy.random.poisson", "numpy.linspace", "numpy.random.normal", "sympy.Point3D" ]
[((1130, 1168), 'sympy.Point3D', 'sympy.Point3D', (['(0)', '(0)', 'z'], {'evaluate': '(False)'}), '(0, 0, z, evaluate=False)\n', (1143, 1168), False, 'import sympy\n'), ((1187, 1235), 'sympy.Plane', 'sympy.Plane', (['self.point'], {'normal_vector': '(0, 0, 1)'}), '(self.point, normal_vector=(0, 0, 1))\n', (1198, 1235),...
"""An agent that makes random decisions using a TensorFlow policy." This agent creates and uses a new randomly initialized TensorFlow NN policy for each step but doesn't do any learning. """ import agentos from tensorflow import keras import numpy as np class Policy: def __init__(self): self.nn = keras.S...
[ "tensorflow.keras.layers.Dense", "numpy.median", "numpy.mean", "numpy.array", "agentos.run_agent" ]
[((1280, 1338), 'agentos.run_agent', 'agentos.run_agent', (['RandomTFAgent', 'CartPoleEnv'], {'max_iters': '(5)'}), '(RandomTFAgent, CartPoleEnv, max_iters=5)\n', (1297, 1338), False, 'import agentos\n'), ((361, 436), 'tensorflow.keras.layers.Dense', 'keras.layers.Dense', (['(4)'], {'activation': '"""relu"""', 'input_s...
#!/usr/bin/env python # -*- coding: utf-8 -*- ## For Testing Matrix2vec on dataset MNIST ## PCA, Kernel PCA, ISOMAP, NMDS, LLE, LE # import tensorflow as ts import logging import os.path import sys import multiprocessing import numpy as np import argparse import scipy.io import datetime import matrix2vec from skle...
[ "sklearn.model_selection.GridSearchCV", "gzip.open", "sklearn.preprocessing.scale", "sklearn.model_selection.cross_val_score", "numpy.zeros", "sklearn.neighbors.KNeighborsClassifier", "pickle.load", "numpy.array", "sklearn.datasets.load_svmlight_file", "sklearn.decomposition.PCA", "matrix2vec.ma...
[((1143, 1170), 'sklearn.datasets.load_svmlight_file', 'ds.load_svmlight_file', (['path'], {}), '(path)\n', (1164, 1170), True, 'from sklearn import datasets as ds\n'), ((1273, 1299), 'gzip.open', 'gzip.open', (['data_file', '"""rb"""'], {}), "(data_file, 'rb')\n", (1282, 1299), False, 'import gzip\n'), ((1363, 1395), ...
import os import numpy as np import logging log = logging.getLogger('data_utils') def resample_ants(nii_file, nii_file_newres, new_res=(1.37, 1.37, 10, 1)): ''' Call ANTs to resample an image to a given resolution and save a new resampled file. :param nii_file: the path of the input file :param...
[ "numpy.pad", "numpy.random.seed", "numpy.random.shuffle", "numpy.ceil", "numpy.concatenate", "numpy.empty", "numpy.min", "numpy.array", "logging.getLogger" ]
[((50, 81), 'logging.getLogger', 'logging.getLogger', (['"""data_utils"""'], {}), "('data_utils')\n", (67, 81), False, 'import logging\n'), ((4156, 4188), 'numpy.array', 'np.array', (['[data[i] for i in idx]'], {}), '([data[i] for i in idx])\n', (4164, 4188), True, 'import numpy as np\n'), ((1692, 1731), 'numpy.min', '...
from mmdet.apis import init_detector, inference_detector, show_result_pyplot import mmcv import cv2 import numpy as np import time import sys import glob import os from datetime import datetime def process_video_crcnn(frame_offset, frame_count, config_file, checkpoint_file, video_path): """ frame_offset: skipp...
[ "numpy.full", "numpy.concatenate", "os.path.join", "cv2.imwrite", "mmdet.apis.init_detector", "mmdet.apis.inference_detector", "mmcv.VideoReader", "time.time", "cv2.imread", "cv2.rectangle", "datetime.datetime.now", "numpy.vstack" ]
[((504, 532), 'mmcv.VideoReader', 'mmcv.VideoReader', (['video_path'], {}), '(video_path)\n', (520, 532), False, 'import mmcv\n'), ((545, 605), 'mmdet.apis.init_detector', 'init_detector', (['config_file', 'checkpoint_file'], {'device': '"""cuda:0"""'}), "(config_file, checkpoint_file, device='cuda:0')\n", (558, 605), ...
import numpy as np def add_noise(a): if len(a.shape) == 2: b = np.random.rand(a.shape[0], a.shape[1]) return a + b else: return a def dot_product(a, b): if len(a.shape) == 2 and len(b.shape) == 1 and a.shape[1] == b.shape[0]: return a.dot(b) else: return "Inco...
[ "numpy.random.rand", "numpy.eye", "numpy.ones" ]
[((391, 402), 'numpy.eye', 'np.eye', (['dim'], {}), '(dim)\n', (397, 402), True, 'import numpy as np\n'), ((411, 426), 'numpy.ones', 'np.ones', (['(dim,)'], {}), '((dim,))\n', (418, 426), True, 'import numpy as np\n'), ((76, 114), 'numpy.random.rand', 'np.random.rand', (['a.shape[0]', 'a.shape[1]'], {}), '(a.shape[0], ...
import time import numpy as np import copy import sys sys.path.append(".") import ai.parameters import ai.actionplanner import ai.energyplanner # get/set/update/check/ # random.choice(d.keys()) class BehaviourPlanner: def __init__(self): self.energy = ai.energyplanner.EnergyPlanner() self.last_be...
[ "sys.path.append", "copy.deepcopy", "time.time", "numpy.random.gamma", "numpy.random.random", "numpy.random.normal" ]
[((55, 75), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (70, 75), False, 'import sys\n'), ((538, 549), 'time.time', 'time.time', ([], {}), '()\n', (547, 549), False, 'import time\n'), ((2811, 2835), 'copy.deepcopy', 'copy.deepcopy', (['behaviour'], {}), '(behaviour)\n', (2824, 2835), False, 'imp...
""" This module contains mathematically focused functions """ import numpy as np from math import sin, cos def normalise(vector): """Return a normalised vector""" return vector / np.linalg.norm(vector) def rotZ(theta): """ Return rotation matrix that rotates with repect to z axis with theta degress...
[ "numpy.roots", "numpy.linalg.svd", "numpy.sin", "numpy.linalg.norm", "numpy.exp", "numpy.diag", "numpy.linalg.solve", "numpy.transpose", "numpy.identity", "numpy.append", "math.cos", "numpy.linspace", "numpy.cross", "math.sin", "numpy.linalg.inv", "numpy.cos", "numpy.compress", "nu...
[((833, 897), 'numpy.array', 'np.array', (['[[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]]'], {}), '([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]])\n', (841, 897), True, 'import numpy as np\n'), ((1666, 2065), 'numpy.array', 'np.array', (['[[-Kx * eps[2, 0] / eps[2, 2], -Kx * eps[2, 1] / eps[2, 2], 0, ...
import io import re import numpy as np class NamedPoints(): def __init__(self, fl): data = np.genfromtxt(fl, dtype=None) self.xyz = np.array([[l[1], l[2], l[3]] for l in data]) self.names = [l[0].decode('ascii') for l in data] self.name_to_xyz = dict(zip(self.names, self.xyz)) cl...
[ "numpy.array", "numpy.genfromtxt", "re.compile" ]
[((374, 413), 're.compile', 're.compile', (['"""^([A-Za-z]+[\']?)([0-9]+)$"""'], {}), '("^([A-Za-z]+[\']?)([0-9]+)$")\n', (384, 413), False, 'import re\n'), ((441, 489), 're.compile', 're.compile', (['"""^([A-Za-z]+[\']?)([0-9]+)-([0-9]+)$"""'], {}), '("^([A-Za-z]+[\']?)([0-9]+)-([0-9]+)$")\n', (451, 489), False, 'impo...
import math import numpy as np from numerical_analysis.splines.bezier import Bezier from numerical_analysis.dependencies import Polynomial from numerical_analysis.root_finding import newton_raphson_2x2 from numerical_analysis.dependencies.geometry import StraightLine, Circle from output_lib.csv_lib import ScvExporter...
[ "numerical_analysis.root_finding.newton_raphson_2x2", "numerical_analysis.dependencies.Polynomial", "output_lib.plot_lib.PlotExporter", "output_lib.csv_lib.ScvExporter", "math.sqrt", "numerical_analysis.splines.bezier.Bezier", "output_lib.screen_lib.ScreenPrinter", "math.sin", "numerical_analysis.de...
[((1016, 1056), 'numerical_analysis.dependencies.geometry.StraightLine', 'StraightLine', (['[[0, [0, 0]], [1, [1, 1]]]'], {}), '([[0, [0, 0]], [1, [1, 1]]])\n', (1028, 1056), False, 'from numerical_analysis.dependencies.geometry import StraightLine, Circle\n'), ((1287, 1347), 'numpy.array', 'np.array', (['[[a, 0], [b, ...
from __future__ import division import numpy as np from sklearn import preprocessing as skpp __all__ = ['pre', 'post', '_remove_constant', '_add_constant'] def pre(matrix): """ Take the training data and put everything needed to undo this operation later into a dictionary. :param matrixTrain: :...
[ "numpy.shape", "numpy.var", "sklearn.preprocessing.StandardScaler", "numpy.invert" ]
[((1521, 1538), 'numpy.var', 'np.var', (['matrix', '(0)'], {}), '(matrix, 0)\n', (1527, 1538), True, 'import numpy as np\n'), ((567, 588), 'sklearn.preprocessing.StandardScaler', 'skpp.StandardScaler', ([], {}), '()\n', (586, 588), True, 'from sklearn import preprocessing as skpp\n'), ((1756, 1772), 'numpy.invert', 'np...
import unittest import numpy as np from small_text.utils.data import list_length class DataUtilsTest(unittest.TestCase): def test_list_length(self): self.assertEqual(10, list_length(list(range(10)))) self.assertEqual(10, list_length(np.random.rand(10, 2)))
[ "numpy.random.rand" ]
[((257, 278), 'numpy.random.rand', 'np.random.rand', (['(10)', '(2)'], {}), '(10, 2)\n', (271, 278), True, 'import numpy as np\n')]
import os import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from matplotlib import cm from matplotlib import rcParams from sklearn import metrics from sklearn import tree rcParams["font.serif"] = "Times New Roman" rcParams["font.family"] = "serif" dirs = dict(m...
[ "numpy.sum", "sklearn.metrics.accuracy_score", "sklearn.metrics.classification_report", "numpy.argsort", "numpy.arange", "matplotlib.pyplot.tight_layout", "numpy.round", "os.path.join", "numpy.unique", "numpy.int8", "matplotlib.pyplot.imshow", "matplotlib.pyplot.close", "numpy.int32", "mat...
[((393, 467), 'os.path.join', 'os.path.join', (["('F:' + os.sep + 'Masterarbeit')", '"""THESIS"""', '"""general"""', '"""plots"""'], {}), "('F:' + os.sep + 'Masterarbeit', 'THESIS', 'general', 'plots')\n", (405, 467), False, 'import os\n'), ((484, 519), 'os.path.join', 'os.path.join', (["dirs['main']", '"""truth"""'], ...
import string import numpy as np import sys import random import os from shutil import copyfile import subprocess from rpt_ele import rpt_ele import update_process_model_input_file as up import swmm_mpc as sm def get_flood_cost_from_dict(rpt, node_flood_weight_dict): node_flood_costs = [] for nodeid, weight i...
[ "sys.platform.startswith", "os.remove", "update_process_model_input_file.update_controls_and_hotstart", "update_process_model_input_file.read_hs_filename", "random.choice", "subprocess.call", "shutil.copyfile", "numpy.squeeze", "os.path.split", "os.path.join" ]
[((7428, 7460), 'shutil.copyfile', 'copyfile', (['proc_inp', 'tmp_proc_inp'], {}), '(proc_inp, tmp_proc_inp)\n', (7436, 7460), False, 'from shutil import copyfile\n'), ((7508, 7537), 'update_process_model_input_file.read_hs_filename', 'up.read_hs_filename', (['proc_inp'], {}), '(proc_inp)\n', (7527, 7537), True, 'impor...
from _context import sparse from sparse import util import torch from torch import nn from torch.autograd import Variable import torch.nn.functional as F import torch.distributions as dist import numpy as np from argparse import ArgumentParser from torch.utils.tensorboard import SummaryWriter import random, tqdm, s...
[ "torch.nn.Dropout", "torch.distributions.Categorical", "argparse.ArgumentParser", "sparse.util.inv", "torch.bmm", "torch.nn.Embedding", "torch.cat", "torch.randn", "matplotlib.pyplot.figure", "sparse.util.plot1d", "torch.arange", "torch.no_grad", "torch.nn.functional.pad", "sparse.util.plo...
[((355, 369), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (362, 369), True, 'import matplotlib as mpl\n'), ((635, 652), 'math.log2', 'math.log2', (['math.e'], {}), '(math.e)\n', (644, 652), False, 'import random, tqdm, sys, math\n'), ((774, 813), 'torch.nn.functional.softmax', 'F.softmax', (['(lnprob...
"""Unit tests for instrupy.radiometer_model. References: [1] Chapter 6,7 in "Microwave Radar and Radiometric Remote Sensing," <NAME> , <NAME> 2014 @TODO Include rectangular antenna tests """ import unittest import json import numpy as np import sys, os from instrupy.radiometer_model import PredetectionSectionPara...
[ "instrupy.radiometer_model.BalancedDikeRadiometerSystem.from_dict", "instrupy.util.Antenna.from_dict", "instrupy.radiometer_model.FixedScan.from_dict", "instrupy.radiometer_model.TotalPowerRadiometerSystem.compute_integration_time", "instrupy.radiometer_model.PredetectionSectionParams", "instrupy.radiomet...
[((2357, 2413), 'instrupy.radiometer_model.TotalPowerRadiometerSystem.from_json', 'TotalPowerRadiometerSystem.from_json', (['self.tpr_sys1_json'], {}), '(self.tpr_sys1_json)\n', (2393, 2413), False, 'from instrupy.radiometer_model import RadiometerModel, SystemType, TotalPowerRadiometerSystem, UnbalancedDikeRadiometerS...
"""Main""" import sys sys.stderr = open("error.log", "w") import time # import msvcrt import os import subprocess import cv2 import sqlite3 import numpy as np from pyzbar import pyzbar from easytello.tello import Tello from httprequest import HTTPRequest from easytello.tello_control import ControlCommand as CoCo from ...
[ "numpy.abs", "easytello.tello_control.ControlCommand", "httprequest.HTTPRequest", "easytello.tello.Tello", "pyzbar.pyzbar.decode", "time.sleep", "sqlite3.connect", "numpy.array", "easytello.tello_control.TelloControl" ]
[((1007, 1014), 'easytello.tello.Tello', 'Tello', ([], {}), '()\n', (1012, 1014), False, 'from easytello.tello import Tello\n'), ((1058, 1072), 'easytello.tello_control.TelloControl', 'TelloControl', ([], {}), '()\n', (1070, 1072), False, 'from easytello.tello_control import TelloControl\n'), ((6642, 6655), 'time.sleep...
from enum import Enum import numpy as np def mean_squared_error(observed_value: np.ndarray, predicted_value: np.ndarray, axis: tuple = None) -> np.ndarray: if axis is None: return np.mean(np.square(np.subtract(observed_value, predicted_value))) else: return np.mean(np.square(np.subtract(obser...
[ "numpy.subtract" ]
[((213, 257), 'numpy.subtract', 'np.subtract', (['observed_value', 'predicted_value'], {}), '(observed_value, predicted_value)\n', (224, 257), True, 'import numpy as np\n'), ((303, 347), 'numpy.subtract', 'np.subtract', (['observed_value', 'predicted_value'], {}), '(observed_value, predicted_value)\n', (314, 347), True...
import numpy as np from PIL import Image from PIL import ImageFilter import matplotlib.pyplot as plt import os from itertools import permutations from IPython.display import clear_output from copy import deepcopy from collections import namedtuple # ---------------- Image utilities ---------------- def read_img(filen...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "PIL.Image.new", "copy.deepcopy", "matplotlib.pyplot.imshow", "itertools.permutations", "numpy.square", "PIL.Image.open", "matplotlib.pyplot.figure", "numpy.array", "collections.namedtuple", "numpy.linspace", "IPython.display.clear_outp...
[((380, 400), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (390, 400), False, 'from PIL import Image\n'), ((1631, 1658), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (1641, 1658), True, 'import matplotlib.pyplot as plt\n'), ((1979, 1994), 'matplot...
from numpy import random import numpy as np import matplotlib.pyplot as plt import math ### Defining theta theta = math.pi/4 ### Generates count number of random values in the range [0, 1] def getU(count): u = [] for i in range(count): key = random.rand() u.append(key) return u def getX(u): x = [] for t in...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "numpy.append", "numpy.histogram", "numpy.cumsum", "numpy.exp", "numpy.linspace", "matplotlib.pyplot.gca", "numpy.random.rand", "matplotlib.pyplot.ylabel", "...
[((649, 686), 'numpy.append', 'np.append', (['data_set', '(data_set[-1] + 1)'], {}), '(data_set, data_set[-1] + 1)\n', (658, 686), True, 'import numpy as np\n'), ((707, 751), 'numpy.histogram', 'np.histogram', (['data'], {'bins': 'bins', 'density': '(False)'}), '(data, bins=bins, density=False)\n', (719, 751), True, 'i...
# Copyright (c) Facebook, Inc. and its affiliates. import logging import numpy as np from typing import Dict, List, Optional, Tuple import torch from torch import nn import torch.nn.functional as F from detectron2.config import configurable from detectron2.data.detection_utils import convert_image_to_rgb from detectro...
[ "detectron2.structures.ImageList.from_tensors", "torch.jit.is_scripting", "torch.cat", "torch.randn", "detectron2.utils.logger.log_first_n", "detectron2.utils.visualizer.Visualizer", "detectron2.utils.events.get_event_storage", "torch.Tensor", "torch.zeros", "torch.split", "torch.nn.Conv2d", "...
[((1746, 1861), 'torch.nn.Conv2d', 'nn.Conv2d', (['self.in_channels', '(self.out_channels - self.dv)', 'self.kernel_size'], {'stride': 'stride', 'padding': 'self.padding'}), '(self.in_channels, self.out_channels - self.dv, self.kernel_size,\n stride=stride, padding=self.padding)\n', (1755, 1861), False, 'from torch ...
import sys import numpy as np file = sys.argv[-1] with open(file) as f: cnt = f.readlines() count = [] distortion = [] calibration = [] linf = [] for line in cnt: if line.startswith('Adversarial Example Found Successfully:'): count.append(int(line.split(' ')[-2])) distortion.append(eval(line.split(' ')[-6])) e...
[ "numpy.median", "numpy.min", "numpy.mean", "numpy.max" ]
[((493, 507), 'numpy.mean', 'np.mean', (['count'], {}), '(count)\n', (500, 507), True, 'import numpy as np\n'), ((509, 525), 'numpy.median', 'np.median', (['count'], {}), '(count)\n', (518, 525), True, 'import numpy as np\n'), ((527, 540), 'numpy.min', 'np.min', (['count'], {}), '(count)\n', (533, 540), True, 'import n...
import numpy as np import pytest from artemis.general.nondeterminism_hunting import delete_vars, assert_variable_matches_between_runs, variable_matches_between_runs, \ reset_variable_tracker def _runs_are_the_same(var_gen_1, var_gen_2, use_assert = False): delete_vars(['_test_random_var_32r5477w32']) for...
[ "artemis.general.nondeterminism_hunting.delete_vars", "numpy.random.RandomState", "artemis.general.nondeterminism_hunting.variable_matches_between_runs", "pytest.raises", "artemis.general.nondeterminism_hunting.reset_variable_tracker", "artemis.general.nondeterminism_hunting.assert_variable_matches_betwee...
[((268, 312), 'artemis.general.nondeterminism_hunting.delete_vars', 'delete_vars', (["['_test_random_var_32r5477w32']"], {}), "(['_test_random_var_32r5477w32'])\n", (279, 312), False, 'from artemis.general.nondeterminism_hunting import delete_vars, assert_variable_matches_between_runs, variable_matches_between_runs, re...
# Copyright 2018 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwa...
[ "adnc.model.utils.layer_norm", "tensorflow.global_variables_initializer", "tensorflow.reset_default_graph", "pytest.fixture", "tensorflow.Session", "tensorflow.constant", "numpy.random.RandomState", "numpy.random.randint" ]
[((751, 767), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (765, 767), False, 'import pytest\n'), ((864, 880), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (878, 880), False, 'import pytest\n'), ((837, 861), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (859, 861), True...
from scipy.integrate import quad,dblquad import numpy as np from scipy.special import gamma from scipy.special import gammainc def poisson_integrand(tau, rho, beta, fm=1, K=1, alpha=2): #lambda = beta*f(m)*rho*tau L = np.array([(tau*beta*rho*fm)**k/gamma(k+1) for k in range(K)]) return (1-np.exp(-tau*beta*...
[ "matplotlib.pyplot.loglog", "matplotlib.pyplot.show", "numpy.sum", "scipy.integrate.quad", "numpy.logspace", "matplotlib.pyplot.legend", "scipy.special.gammainc", "numpy.exp", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "scipy.special.gamma" ]
[((2512, 2535), 'numpy.logspace', 'np.logspace', (['(-3)', '(0)', '(100)'], {}), '(-3, 0, 100)\n', (2523, 2535), True, 'import numpy as np\n'), ((2945, 2957), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (2955, 2957), True, 'import matplotlib.pyplot as plt\n'), ((2962, 2983), 'matplotlib.pyplot.xlabel', ...
import cv2 import numpy as np import random import argparse import logging import glog as log import os import sys from stcgan.shadow6.nets import * import stcgan.shadow6.module as module import glob import mxnet as mx # import pydevd # pydevd.settrace('172.17.122.65', port=10203, stdoutToServer=True, stderrToServer=...
[ "os.mkdir", "numpy.abs", "argparse.ArgumentParser", "random.shuffle", "glob.glob", "mxnet.metric.CustomMetric", "os.path.join", "logging.FileHandler", "random.randint", "glog.info", "cv2.imwrite", "os.path.exists", "numpy.transpose", "mxnet.gpu", "cv2.resize", "mxnet.cpu", "mxnet.nd....
[((369, 429), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Shadow Removel Params"""'}), "(description='Shadow Removel Params')\n", (392, 429), False, 'import argparse\n'), ((1430, 1449), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1447, 1449), False, 'import logging\n'...
import sys,os,time,csv,getopt,cv2,argparse import numpy, ctypes, array import numpy as np #import matplotlib as plt from datetime import datetime from ctypes import cdll, c_char_p from skimage.transform import resize from numpy.ctypeslib import ndpointer from lime import lime_image from skimage.segmentation import mark...
[ "skimage.segmentation.mark_boundaries", "numpy.ctypeslib.ndpointer", "argparse.ArgumentParser", "ntpath.basename", "numpy.frombuffer", "numpy.empty", "numpy.ascontiguousarray", "ctypes.cdll.LoadLibrary", "lime.lime_image.LimeImageExplainer", "cv2.imread", "skimage.transform.resize", "ctypes.c_...
[((406, 482), 'ctypes.cdll.LoadLibrary', 'ctypes.cdll.LoadLibrary', (['"""/home/rajy/work/inceptionv4/build/libannmodule.so"""'], {}), "('/home/rajy/work/inceptionv4/build/libannmodule.so')\n", (429, 482), False, 'import numpy, ctypes, array\n'), ((609, 656), 'numpy.ctypeslib.ndpointer', 'ndpointer', (['ctypes.c_float'...
# -*- coding: utf-8 -*- ### ATENÇÃO ### # Antes de executar instale o pyfirmata: # pip install pyfirmata --user # E compile no arduino o código do ArduinoIDE encontrado em: # Arquivo -> Exemplos -> Firmata -> StandardFirmata ### IMPORTANTE ### # O valor da frequencia fica aproximado # imports import pyfirmata imp...
[ "pandas.DataFrame", "matplotlib.pyplot.show", "matplotlib.pyplot.suptitle", "pyfirmata.util.Iterator", "loguru.logger.warning", "numpy.zeros", "numpy.ones", "time.sleep", "time.time", "loguru.logger.info", "pyfirmata.Arduino", "matplotlib.pyplot.subplots_adjust", "loguru.logger.debug", "ma...
[((4782, 4800), 'numpy.zeros', 'np.zeros', (['sizeStep'], {}), '(sizeStep)\n', (4790, 4800), True, 'import numpy as np\n'), ((11161, 11214), 'loguru.logger.info', 'logger.info', (['f"""Configurando conexão com o arduino..."""'], {}), "(f'Configurando conexão com o arduino...')\n", (11172, 11214), False, 'from loguru im...
import os, sys import time import torch import numpy as np sys.path.append(os.path.dirname(os.path.abspath(__file__))) from vis_utils import get_vis_depth, get_vis_mask, get_vis_normal import copy import cv2 import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import matplotlib.cm as cm from PIL impo...
[ "vis_utils.get_vis_depth", "pickle.dump", "numpy.abs", "torch.cat", "os.path.abspath", "matplotlib.colors.Normalize", "cv2.cvtColor", "matplotlib.cm.ScalarMappable", "cv2.imwrite", "matplotlib.pyplot.close", "vis_utils.get_vis_mask", "matplotlib.pyplot.subplots", "matplotlib.use", "matplot...
[((233, 247), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (240, 247), True, 'import matplotlib as mpl\n'), ((91, 116), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (106, 116), False, 'import os, sys\n'), ((3133, 3153), 'pickle.dump', 'pickle.dump', (['data', 'f'], {}), '(...
import os import time import numpy as np import torch from torch import nn from butterfly_factor import butterfly_factor_mult_intermediate # from butterfly import Block2x2DiagProduct # from test_factor_multiply import twiddle_list_concat exps = np.arange(6, 14) sizes = 1 << exps batch_size = 256 ntrials = [100000...
[ "torch.cuda.synchronize", "pickle.dump", "torch.randn_like", "butterfly_factor.butterfly_factor_mult_intermediate", "torch.autograd.grad", "numpy.zeros", "time.perf_counter", "torch.randn", "numpy.arange", "torch.rfft", "torch.nn.Linear" ]
[((249, 265), 'numpy.arange', 'np.arange', (['(6)', '(14)'], {}), '(6, 14)\n', (258, 265), True, 'import numpy as np\n'), ((387, 406), 'numpy.zeros', 'np.zeros', (['exps.size'], {}), '(exps.size)\n', (395, 406), True, 'import numpy as np\n'), ((419, 438), 'numpy.zeros', 'np.zeros', (['exps.size'], {}), '(exps.size)\n',...
from pandas import Series from sklearn.metrics import roc_curve, auc from sklearn.model_selection import StratifiedKFold, ShuffleSplit import numpy as np from scipy import interp import matplotlib.pyplot as plt from sklearn import metrics from sklearn.preprocessing import LabelEncoder def transform_labels(y) -> Seri...
[ "matplotlib.pyplot.title", "numpy.maximum", "numpy.mean", "matplotlib.pyplot.fill_between", "numpy.std", "sklearn.preprocessing.LabelEncoder", "numpy.linspace", "numpy.minimum", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "pandas.Series", "matplotlib.pyplo...
[((444, 453), 'pandas.Series', 'Series', (['y'], {}), '(y)\n', (450, 453), False, 'from pandas import Series\n'), ((720, 754), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': 'n_splits'}), '(n_splits=n_splits)\n', (735, 754), False, 'from sklearn.model_selection import StratifiedKFold, S...
######################################################################################################################## # Module: tests/test_core.py # Description: Tests for core and Sampler # # Web: https://github.com/SamDuffield/mocat ##################################################################################...
[ "unittest.main", "numpy.testing.assert_array_equal", "numpy.testing.assert_equal", "jax.numpy.ones", "jax.numpy.zeros" ]
[((3308, 3323), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3321, 3323), False, 'import unittest\n'), ((851, 895), 'numpy.testing.assert_equal', 'npt.assert_equal', (['self.cdict.test_float', '(3.0)'], {}), '(self.cdict.test_float, 3.0)\n', (867, 895), True, 'import numpy.testing as npt\n'), ((1209, 1249), 'nu...
import numpy as np import diversipy def test_distance_to_boundary(): points = np.array([[0.1, 0.2], [0.3, 0.9]]) np.testing.assert_almost_equal( diversipy.distance.distance_to_boundary(points), np.array([0.1, 0.1]) ) np.testing.assert_almost_equal( diversipy.distance.distance_to_bounda...
[ "diversipy.distance.distance_to_boundary", "numpy.array", "diversipy.distance.distance_matrix" ]
[((84, 118), 'numpy.array', 'np.array', (['[[0.1, 0.2], [0.3, 0.9]]'], {}), '([[0.1, 0.2], [0.3, 0.9]])\n', (92, 118), True, 'import numpy as np\n'), ((439, 485), 'numpy.array', 'np.array', (['[[0.1, 0.2], [0.3, 0.9], [0.6, 0.1]]'], {}), '([[0.1, 0.2], [0.3, 0.9], [0.6, 0.1]])\n', (447, 485), True, 'import numpy as np\...
import numpy as np import os import configparser import tensorflow as tf from pkg_resources import resource_filename from pyniel.python_tools.path_tools import make_dir_if_not_exists import crowd_sim # adds CrowdSim-v0 to gym # noqa from crowd_sim.envs.crowd_sim import CrowdSim # reference to env code # noqa from ...
[ "pkg_resources.resource_filename", "numpy.clip", "numpy.sin", "crowd_sim.envs.utils.action.ActionRot", "os.path.join", "pyniel.python_tools.path_tools.make_dir_if_not_exists", "configparser.RawConfigParser", "navrep.envs.ianenv.IANEnv", "crowd_nav.policy.network_om.SDOADRL", "crowd_sim.envs.utils....
[((6596, 6615), 'navrep.tools.commonargs.parse_common_args', 'parse_common_args', ([], {}), '()\n', (6613, 6615), False, 'from navrep.tools.commonargs import parse_common_args\n'), ((6827, 6898), 'navrep.scripts.cross_test_navreptrain_in_ianenv.run_test_episodes', 'run_test_episodes', (['env', 'policy'], {'render': 'ar...
from collections import OrderedDict import matplotlib.pyplot as plt import seaborn as sns import torch import torch.nn as nn from seaborn.palettes import color_palette import numpy as np # import seaborn as sns import torch import os from BatchTransNorm import BatchTransNorm2d from datasets import (Chest_few_shot, ...
[ "seaborn.kdeplot", "torch.utils.data.DataLoader", "matplotlib.pyplot.figure", "torch.nn.BatchNorm2d", "torch.cuda.is_available", "numpy.array", "BatchTransNorm.BatchTransNorm2d", "torch.device", "torch.no_grad" ]
[((1082, 1107), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1105, 1107), False, 'import torch\n'), ((1159, 1176), 'torch.device', 'torch.device', (['dev'], {}), '(dev)\n', (1171, 1176), False, 'import torch\n'), ((2159, 2191), 'BatchTransNorm.BatchTransNorm2d', 'BatchTransNorm2d', ([], {'nu...
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019, 2020. # # 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. #...
[ "numpy.iinfo", "numpy.imag", "numpy.mean", "numpy.arange", "numpy.real", "warnings.warn", "numpy.unique" ]
[((5144, 5312), 'warnings.warn', 'warn', (["('Warning: qubit_lo_freq was not specified in PulseQobj or in PulseSystemModel, '\n + 'so it is beign automatically determined from the drift Hamiltonian.')"], {}), "(\n 'Warning: qubit_lo_freq was not specified in PulseQobj or in PulseSystemModel, '\n + 'so it is ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ atmospheres.py includes functions to calculate atmospheric quantities. Created on Tue Nov 29 11:45:15 2016 @author: tr1010 (<NAME>) """ import sys sys.path.append('atmosphere_models/Python-NRLMSISE-00-master') from nrlmsise_00_header import * from nrlmsise_00 impor...
[ "sys.path.append", "numpy.divide", "numpy.sum", "numpy.multiply", "numpy.zeros", "numpy.array", "numpy.exp", "numpy.float64", "numpy.sqrt" ]
[((202, 264), 'sys.path.append', 'sys.path.append', (['"""atmosphere_models/Python-NRLMSISE-00-master"""'], {}), "('atmosphere_models/Python-NRLMSISE-00-master')\n", (217, 264), False, 'import sys\n'), ((4385, 4396), 'numpy.zeros', 'np.zeros', (['(8)'], {}), '(8)\n', (4393, 4396), True, 'import numpy as np\n'), ((4770,...
import numpy as np import matplotlib.pyplot as plt from nt_toolbox.signal import imageplot def plot_levelset(Z, level=0, f=[]): """ f is supposed to be of the same shape as Z """ if len(f) == 0: f = np.copy(Z) n,p = np.shape(Z) X,Y = np.meshgrid(np.arange(0,n),np.arange(0,p...
[ "numpy.copy", "nt_toolbox.signal.imageplot", "numpy.shape", "matplotlib.pyplot.contour", "numpy.arange" ]
[((258, 269), 'numpy.shape', 'np.shape', (['Z'], {}), '(Z)\n', (266, 269), True, 'import numpy as np\n'), ((327, 384), 'matplotlib.pyplot.contour', 'plt.contour', (['X', 'Y', 'Z', '[level]'], {'linewidths': '(2)', 'colors': '"""red"""'}), "(X, Y, Z, [level], linewidths=2, colors='red')\n", (338, 384), True, 'import mat...
# python3 # # Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
[ "PIL.Image.fromarray", "numpy.argpartition", "tflite_runtime.interpreter.Interpreter" ]
[((2208, 2239), 'numpy.argpartition', 'np.argpartition', (['(-output)', 'top_k'], {}), '(-output, top_k)\n', (2223, 2239), True, 'import numpy as np\n'), ((3261, 3279), 'tflite_runtime.interpreter.Interpreter', 'Interpreter', (['model'], {}), '(model)\n', (3272, 3279), False, 'from tflite_runtime.interpreter import Int...
""" Context class for the pushing task as used in the paper "How to Train Your Differentiable Filter". """ # this code only works with tensorflow 1 import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import tensorflow_probability as tfp import numpy as np import os import csv from matplotlib.patches import Ell...
[ "tensorflow.compat.v1.zeros", "numpy.arctan2", "numpy.ones", "tensorflow.compat.v1.summary.histogram", "matplotlib.patches.Polygon", "numpy.arange", "differentiable_filters.utils.push_utils.physical_model", "tensorflow.compat.v1.name_scope", "os.path.dirname", "tensorflow.compat.v1.constant_initia...
[((183, 207), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (205, 207), True, 'import tensorflow.compat.v1 as tf\n'), ((1337, 1386), 'differentiable_filters.contexts.paper_base_context.PaperBaseContext.__init__', 'base.PaperBaseContext.__init__', (['self', 'param', 'mode'], {})...
import numpy as np from scipy.optimize import leastsq import matplotlib matplotlib.use('TkAgg') import pylab as plt from math import sqrt, atan, cos from process_data import * guess_mean = np.mean(y1)/2 guess_std = 3*np.std(y1)/(2**0.5) guess_phase = 0 guess_stretch = 0.3 data_first_guess = guess_std*np.sin(np.sin(g...
[ "pylab.show", "numpy.std", "pylab.ylabel", "scipy.optimize.leastsq", "matplotlib.use", "pylab.figure", "numpy.mean", "pylab.xlabel", "numpy.sin", "pylab.xlim", "pylab.legend", "pylab.plot" ]
[((72, 95), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (86, 95), False, 'import matplotlib\n'), ((533, 571), 'pylab.figure', 'plt.figure', (['(1)'], {'figsize': '(9, 5)', 'dpi': '(150)'}), '(1, figsize=(9, 5), dpi=150)\n', (543, 571), True, 'import pylab as plt\n'), ((741, 804), 'pylab.pl...
"""basic array functions""" import multiprocessing import warnings import numpy as np try: import numexpr numexpr.set_num_threads(multiprocessing.cpu_count()) numexpr.set_vml_num_threads(multiprocessing.cpu_count()) except ImportError: warnings.warn('numexpr not detected, use `sudo pip install numexp...
[ "numpy.sum", "numpy.nan_to_num", "numpy.copy", "numpy.zeros", "numexpr.evaluate", "numpy.isnan", "warnings.warn", "numpy.concatenate", "multiprocessing.cpu_count" ]
[((559, 593), 'numpy.zeros', 'np.zeros', (['array.shape'], {'dtype': 'dtype'}), '(array.shape, dtype=dtype)\n', (567, 593), True, 'import numpy as np\n'), ((605, 660), 'numexpr.evaluate', 'numexpr.evaluate', (['"""array"""'], {'out': 'result', 'casting': '"""unsafe"""'}), "('array', out=result, casting='unsafe')\n", (6...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
[ "sys.stdout.write", "json.load", "argparse.ArgumentParser", "os.path.basename", "numpy.zeros", "os.path.exists", "PIL.Image.open", "sys.stdout.flush", "numpy.array", "PIL.Image.fromarray", "os.path.join", "numpy.concatenate" ]
[((2186, 2234), 'numpy.array', 'np.array', (["metadata['alphapose_input_size'][::-1]"], {}), "(metadata['alphapose_input_size'][::-1])\n", (2194, 2234), True, 'import numpy as np\n'), ((2250, 2285), 'numpy.array', 'np.array', (["metadata['size_LR'][::-1]"], {}), "(metadata['size_LR'][::-1])\n", (2258, 2285), True, 'imp...
import collections import copy import datetime import gc import time # import torch import numpy as np from util.logconf import logging log = logging.getLogger(__name__) # log.setLevel(logging.WARN) # log.setLevel(logging.INFO) log.setLevel(logging.DEBUG) IrcTuple = collections.namedtuple('IrcTuple', ['index', 'row'...
[ "datetime.datetime.now", "time.time", "util.logconf.logging.getLogger", "numpy.histogram", "numpy.array", "collections.namedtuple", "numpy.linalg.inv", "datetime.datetime.fromtimestamp", "datetime.timedelta", "numpy.round" ]
[((144, 171), 'util.logconf.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'from util.logconf import logging\n'), ((270, 329), 'collections.namedtuple', 'collections.namedtuple', (['"""IrcTuple"""', "['index', 'row', 'col']"], {}), "('IrcTuple', ['index', 'row', 'col'])\...
import os import sys import argparse import datetime import time import os.path as osp import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import numpy as np import torch import torch.nn as nn from torch.optim import lr_scheduler import torch.backends.cudnn as cudnn import datasets import mod...
[ "os.mkdir", "torch.optim.lr_scheduler.StepLR", "argparse.ArgumentParser", "torch.no_grad", "os.path.join", "models.create", "utils.AverageMeter", "matplotlib.pyplot.close", "os.path.exists", "datetime.timedelta", "datasets.create", "torch.manual_seed", "matplotlib.pyplot.legend", "center_l...
[((105, 126), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (119, 126), False, 'import matplotlib\n'), ((408, 454), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Center Loss Example"""'], {}), "('Center Loss Example')\n", (431, 454), False, 'import argparse\n'), ((1781, 1809), 'tor...
#!/usr/bin/env python # coding: utf-8 # In[1]: #read in ipsilateral breast labelmap/volume #mask this patient's breast #generate histogram of intensity #DIR to new patient's breast #expand/dilate region (might need to be manual) #mask new patient's breast #generate histogram of intensity # In[2]: #import modules...
[ "SimpleITK.BinaryThreshold", "SimpleITK.Resample", "platipy.imaging.registration.registration.fast_symmetric_forces_demons_registration", "SimpleITK.ConnectedComponent", "SimpleITK.GetArrayViewFromImage", "SimpleITK.ReadImage", "SimpleITK.GetArrayFromImage", "numpy.max", "SimpleITK.BinaryMorphologic...
[((588, 648), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['"""/home/alicja/Downloads/Segmentation.nii.gz"""'], {}), "('/home/alicja/Downloads/Segmentation.nii.gz')\n", (602, 648), True, 'import SimpleITK as sitk\n'), ((677, 850), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['"""/home/alicja/Documents/WES_010/IMAGES/WES_01...
import numpy as np def hole_filling(img, kernel=3): N, M = img.shape for i in range(N): for j in range(M): if img[i, j] == 0: neighbour = img[max(int((i-(kernel-1)/2)), 0):min(int((i+(kernel-1)/2)), N), max(int((j-(kernel-1)/2)),0):min(int((j+(kernel-1)/2)), M)] ...
[ "numpy.amax" ]
[((429, 447), 'numpy.amax', 'np.amax', (['neighbour'], {}), '(neighbour)\n', (436, 447), True, 'import numpy as np\n')]
''' adapted from Harry ''' import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np from pyPCGA import PCGA # import mf import math import datetime as dt import os import sys from poro import Model #print(np.__version__) # domain parameters nx = 128 ny = 128 N...
[ "numpy.meshgrid", "poro.Model", "pyPCGA.PCGA", "numpy.ones", "matplotlib.use", "numpy.array", "numpy.loadtxt", "numpy.linspace", "numpy.exp", "numpy.prod" ]
[((49, 70), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (63, 70), False, 'import matplotlib\n'), ((323, 341), 'numpy.array', 'np.array', (['[nx, ny]'], {}), '([nx, ny])\n', (331, 341), True, 'import numpy as np\n'), ((347, 357), 'numpy.prod', 'np.prod', (['N'], {}), '(N)\n', (354, 357), True, ...
#!/usr/bin/env python3 import tensorflow as tf tf.config.run_functions_eagerly(True) import numpy as np from graph2tensor.model.layers import GCNConv from graph2tensor.model.models import MessagePassing from unittest import TestCase, main conv_layers = [ GCNConv(units=32, name="layer1"), GCNConv(units=32, name...
[ "unittest.main", "tensorflow.config.run_functions_eagerly", "graph2tensor.model.layers.GCNConv", "tensorflow.range", "graph2tensor.model.models.MessagePassing.from_config", "numpy.random.random", "numpy.testing.assert_allclose", "graph2tensor.model.models.MessagePassing" ]
[((47, 84), 'tensorflow.config.run_functions_eagerly', 'tf.config.run_functions_eagerly', (['(True)'], {}), '(True)\n', (78, 84), True, 'import tensorflow as tf\n'), ((376, 469), 'graph2tensor.model.models.MessagePassing', 'MessagePassing', (['[conv_layers, conv_layers, conv_layers]'], {'name': '"""sage"""', 'concat_hi...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ High level functions for signal characterization from 1D signals Code licensed under both GPL and BSD licenses Authors: <NAME> <<EMAIL>> <NAME> <<EMAIL>> """ from scipy.signal import periodogram, welch import pandas as pd import numpy as np def psd(s,...
[ "scipy.signal.periodogram", "numpy.mean", "pandas.Series", "scipy.signal.welch" ]
[((2212, 2247), 'pandas.Series', 'pd.Series', (['psd_s'], {'index': 'index_names'}), '(psd_s, index=index_names)\n', (2221, 2247), True, 'import pandas as pd\n'), ((2260, 2295), 'pandas.Series', 'pd.Series', (['f_idx'], {'index': 'index_names'}), '(f_idx, index=index_names)\n', (2269, 2295), True, 'import pandas as pd\...
import os from PIL import Image import numpy as np path='faces/faces_4/an2i' trainx=[] trainy=[] for filename in os.listdir(path): pixel=[] im=Image.open(path+'/'+filename) for i in range(im.size[0]): row=[] for j in range(im.size[1]): row.append(im.getpixel((i,j))) pixel.append(row) trainx.append(pixel) ...
[ "numpy.transpose", "numpy.array", "os.listdir", "PIL.Image.open" ]
[((114, 130), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (124, 130), False, 'import os\n'), ((565, 581), 'numpy.array', 'np.array', (['trainx'], {}), '(trainx)\n', (573, 581), True, 'import numpy as np\n'), ((590, 606), 'numpy.array', 'np.array', (['trainy'], {}), '(trainy)\n', (598, 606), True, 'import nu...
import glob import os import torch from torch.utils.data import Dataset, DataLoader import numpy as np import matplotlib.image as mpimg import pandas as pd import cv2 class FacialKeypointsDataset(Dataset): """Face Landmarks dataset.""" def __init__(self, csv_file, root_dir, transform=None): """ ...
[ "matplotlib.image.imread", "numpy.copy", "pandas.read_csv", "cv2.cvtColor", "numpy.ones", "cv2.warpAffine", "numpy.random.randint", "numpy.random.random", "numpy.matmul", "os.path.join", "cv2.getRotationMatrix2D", "cv2.resize", "torch.from_numpy" ]
[((608, 629), 'pandas.read_csv', 'pd.read_csv', (['csv_file'], {}), '(csv_file)\n', (619, 629), True, 'import pandas as pd\n'), ((815, 875), 'os.path.join', 'os.path.join', (['self.root_dir', 'self.key_pts_frame.iloc[idx, 0]'], {}), '(self.root_dir, self.key_pts_frame.iloc[idx, 0])\n', (827, 875), False, 'import os\n')...
# class Event(object): # _observers = [] # # def __init__(self, webscraper, item): # self.webscraper = webscraper # self.item = item # # def __repr__(self): # return self.__class__.__name__ # # @classmethod # def register(cls, observer): # if observer not in cls._obse...
[ "numpy.arange" ]
[((2095, 2113), 'numpy.arange', 'np.arange', (['(0)', 'c', 'f'], {}), '(0, c, f)\n', (2104, 2113), True, 'import numpy as np\n')]
from copy import copy import time import os import numpy as np import numpy.linalg as linalg import gym from gym import spaces from gym.utils import seeding from roboball2d.physics import B2World from roboball2d.robot import DefaultRobotConfig from roboball2d.robot import DefaultRobotState from roboball2d.ball impor...
[ "roboball2d.rendering.pyglet_utils.draw_vector", "numpy.clip", "roboball2d.rendering.pyglet_utils.draw_box", "roboball2d.physics.B2World", "gym.utils.seeding.np_random", "roboball2d.robot.DefaultRobotState", "roboball2d.ball.BallConfig", "pyglet.gl.glTranslatef", "roboball2d.ball_gun.DefaultBallGun"...
[((2207, 2227), 'roboball2d.robot.DefaultRobotConfig', 'DefaultRobotConfig', ([], {}), '()\n', (2225, 2227), False, 'from roboball2d.robot import DefaultRobotConfig\n'), ((3020, 3183), 'roboball2d.physics.B2World', 'B2World', ([], {'robot_configs': 'self._robot_config', 'ball_configs': 'self._ball_configs', 'visible_ar...
from typing import Optional, Union, List, Tuple import os import cv2 as cv import numpy as np from PySide6.QtWidgets import QLayout, QLabel, QWidget, QGridLayout from PySide6.QtGui import QImage, QMouseEvent, QCloseEvent, QResizeEvent, QMoveEvent, QPixmap from PySide6.QtCore import Slot, QSize, QPoint, Qt, Signal f...
[ "numpy.load", "os.path.dirname", "PySide6.QtWidgets.QLabel", "PySide6.QtGui.QImage", "PySide6.QtCore.Signal", "PySide6.QtCore.QSize", "PySide6.QtGui.QPixmap.fromImage", "PySide6.QtCore.Slot", "PySide6.QtWidgets.QGridLayout", "os.path.join" ]
[((2253, 2265), 'PySide6.QtCore.Signal', 'Signal', (['list'], {}), '(list)\n', (2259, 2265), False, 'from PySide6.QtCore import Slot, QSize, QPoint, Qt, Signal\n'), ((4502, 4536), 'PySide6.QtCore.Slot', 'Slot', (['LayerImageEntry', 'QMouseEvent'], {}), '(LayerImageEntry, QMouseEvent)\n', (4506, 4536), False, 'from PySi...
import numpy as np import torch from tensorboardX import SummaryWriter from tqdm import tqdm import argparse import config from data_gen import TextMelLoader, TextMelCollate from taco2models.loss_function import Tacotron2Loss from taco2models.models import Tacotron2 from taco2models.optimizer import Tacotron2Optimizer ...
[ "tensorboardX.SummaryWriter", "numpy.random.seed", "utils_1.get_logger", "torch.utils.data.DataLoader", "argparse.ArgumentParser", "utils_1.AverageMeter", "torch.manual_seed", "torch.load", "taco2models.loss_function.Tacotron2Loss", "data_gen.TextMelLoader", "torch.cuda.empty_cache", "utils_1....
[((426, 446), 'torch.manual_seed', 'torch.manual_seed', (['(7)'], {}), '(7)\n', (443, 446), False, 'import torch\n'), ((451, 468), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (465, 468), True, 'import numpy as np\n'), ((564, 579), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (577,...
# -*- coding: utf-8 -*- """ Created on Wed May 6 09:28:40 2020 @author: yo Función auxiliar para calcular el RSE """ import numpy as np def calc_rse(valores,prediccion): return(sum(valores-prediccion)**2/sum((valores-np.mean(valores))**2))
[ "numpy.mean" ]
[((226, 242), 'numpy.mean', 'np.mean', (['valores'], {}), '(valores)\n', (233, 242), True, 'import numpy as np\n')]
#!/usr/bin/env python import glob import cv2 import numpy as np import torch import architecture as arch import argparse import warnings import time import sys try: import tqdm except ImportError: pass from pathlib import Path from chunks import DataChunks model_docs = { "RRDB_ESRGAN_x4.pth": "Official p...
[ "tqdm.tqdm", "argparse.ArgumentParser", "warnings.simplefilter", "chunks.DataChunks", "sys.modules.keys", "torch.load", "architecture.RRDB_Net", "numpy.transpose", "torch.set_num_interop_threads", "torch.set_num_threads", "torch.cuda.is_available", "pathlib.Path", "warnings.catch_warnings", ...
[((6290, 6391), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Upscale images with ESRGAN"""', 'formatter_class': 'SmartFormatter'}), "(description='Upscale images with ESRGAN',\n formatter_class=SmartFormatter)\n", (6313, 6391), False, 'import argparse\n'), ((8599, 8621), 'time.perf_...
import matplotlib.pyplot as plt import numpy as np import math # tip geometry dia = 0.057 # m r = dia/2 offset = 3 * dia pen_rate_labels = ['1 m/min','2 m/min','3 m/min','4 m/min','5 m/min'] pen_rates = [1/60 , 2/60 , 3/60 , 4/60 , 5/60] # m/seks rpm = 25 * (2*math.pi) / 60 # rad/secs X = [] Y = [] Z = [] k=0 for ...
[ "matplotlib.pyplot.show", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "numpy.sin", "numpy.array", "numpy.linspace", "numpy.cos" ]
[((769, 781), 'numpy.array', 'np.array', (['xs'], {}), '(xs)\n', (777, 781), True, 'import numpy as np\n'), ((787, 799), 'numpy.array', 'np.array', (['ys'], {}), '(ys)\n', (795, 799), True, 'import numpy as np\n'), ((805, 817), 'numpy.array', 'np.array', (['zs'], {}), '(zs)\n', (813, 817), True, 'import numpy as np\n')...
import torch import torch.nn as nn import numpy as np print('loading model and train data...') # load model from file net = torch.load('models/torch_rnn.model') # load data from file train_loader = torch.load('data/processed/torch_rnn_train.loader') valid_loader = torch.load('data/processed/torch_rnn_validate.loader'...
[ "torch.nn.BCELoss", "torch.load", "torch.save", "numpy.mean", "torch.cuda.is_available" ]
[((125, 161), 'torch.load', 'torch.load', (['"""models/torch_rnn.model"""'], {}), "('models/torch_rnn.model')\n", (135, 161), False, 'import torch\n'), ((200, 251), 'torch.load', 'torch.load', (['"""data/processed/torch_rnn_train.loader"""'], {}), "('data/processed/torch_rnn_train.loader')\n", (210, 251), False, 'impor...
import numpy as np class RBFMMD2(object): def __init__(self, sigma_list, num_bit, is_binary): self.sigma_list = sigma_list self.num_bit = num_bit self.is_binary = is_binary self.basis = np.arange(2**num_bit,dtype='int32') self.K = mix_rbf_kernel(self.basis, self.basis, self....
[ "numpy.log", "numpy.arange", "numpy.exp" ]
[((223, 261), 'numpy.arange', 'np.arange', (['(2 ** num_bit)'], {'dtype': '"""int32"""'}), "(2 ** num_bit, dtype='int32')\n", (232, 261), True, 'import numpy as np\n'), ((1270, 1290), 'numpy.exp', 'np.exp', (['(-gamma * dx2)'], {}), '(-gamma * dx2)\n', (1276, 1290), True, 'import numpy as np\n'), ((955, 964), 'numpy.lo...