code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
from sklearn.cluster import KMeans
from random import randint
import numpy as np
import csv
import matplotlib.pyplot as plt
matriz = []
arrayCriacaoCentroides = []
with open('dataset_iris.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
largPetala = (row['larguraPetala'])
... | [
"matplotlib.pyplot.show",
"random.randint",
"csv.DictReader",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"sklearn.cluster.KMeans",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((432, 448), 'numpy.array', 'np.array', (['matriz'], {}), '(matriz)\n', (440, 448), True, 'import numpy as np\n'), ((2352, 2362), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2360, 2362), True, 'import matplotlib.pyplot as plt\n'), ((221, 244), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {}), '(csvfi... |
import logging
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
from matplotlib.animation import FuncAnimation
from scipy import integrate
from utils.objects import Body
logger = logging.getLogger(__name__)
# Arbitrary value for G (gravitational constant)
G = 1
def... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"scipy.integrate.ode",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axes",
"streamlit.sidebar.progress",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.linspace",
"streamlit.pyplot",
"logging.getLogger"
] | [((231, 258), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (248, 258), False, 'import logging\n'), ((4142, 4165), 'numpy.linspace', 'np.linspace', (['t0', 't1', 'dt'], {}), '(t0, t1, dt)\n', (4153, 4165), True, 'import numpy as np\n'), ((4667, 4689), 'streamlit.sidebar.progress', 'st.si... |
import sys
from operator import itemgetter
import numpy as np
import cv2
import math
import matplotlib.pyplot as plt
# -----------------------------#
# 计算原始输入图像
# 每一次缩放的比例
# -----------------------------#
def calculateScales(img):
copy_img = img.copy()
pr_scale = 1.0
h, w, _ = copy_img.shape
if ... | [
"numpy.maximum",
"numpy.empty",
"cv2.warpAffine",
"numpy.mean",
"numpy.linalg.norm",
"numpy.linalg.svd",
"cv2.getRotationMatrix2D",
"cv2.invertAffineTransform",
"numpy.multiply",
"numpy.std",
"numpy.swapaxes",
"numpy.reshape",
"numpy.repeat",
"numpy.minimum",
"numpy.fix",
"numpy.square... | [((984, 1011), 'numpy.swapaxes', 'np.swapaxes', (['cls_prob', '(0)', '(1)'], {}), '(cls_prob, 0, 1)\n', (995, 1011), True, 'import numpy as np\n'), ((1022, 1044), 'numpy.swapaxes', 'np.swapaxes', (['roi', '(0)', '(2)'], {}), '(roi, 0, 2)\n', (1033, 1044), True, 'import numpy as np\n'), ((1171, 1202), 'numpy.where', 'np... |
# Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"numpy.sum",
"numpy.abs",
"numpy.allclose",
"numpy.ones",
"numpy.arange",
"numpy.linalg.norm",
"numpy.exp",
"numpy.diag",
"pytest.raises",
"hypothesis.strategies.complex_numbers",
"hypothesis.strategies.integers",
"mrmustard.physics.fock.dm_to_ket",
"scipy.special.factorial",
"numpy.tanh",... | [((901, 944), 'hypothesis.strategies.floats', 'st.floats', ([], {'min_value': '(0)', 'max_value': '(2 * np.pi)'}), '(min_value=0, max_value=2 * np.pi)\n', (910, 944), True, 'from hypothesis import settings, given, strategies as st\n'), ((1475, 1488), 'numpy.diag', 'np.diag', (['diag'], {}), '(diag)\n', (1482, 1488), Tr... |
# Kokeillaan mediaanin ja keskiarvon eroa. Kuvissa (30kpl) on oppilaita
# satunnaisissa kohdissa, ja kamera oli jalustalla luokkahuoneessa. Otetaan
# toisaalta keskiarvot ja toisaalta mediaanit pikseliarvoista.
# Lopputulokset ovat hyvin erilaiset!
#
# <NAME> huhtikuu 2021
# Matlab -> Python Ville Tilvis kesäkuu 2021
... | [
"matplotlib.pyplot.subplot",
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.median",
"numpy.power",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"matplotlib.pyplot.axis",
"numpy.max",
"numpy.mean",
"matplotlib.pyplot.imsave",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.imread",
"numpy.concate... | [((479, 504), 'numpy.zeros', 'np.zeros', (['[2000, 2997, 3]'], {}), '([2000, 2997, 3])\n', (487, 504), True, 'import numpy as np\n'), ((515, 540), 'numpy.zeros', 'np.zeros', (['[2000, 2997, 3]'], {}), '([2000, 2997, 3])\n', (523, 540), True, 'import numpy as np\n'), ((547, 577), 'numpy.zeros', 'np.zeros', (['[2000, 299... |
import numpy as np
import gym
from reps.acreps import acREPS
np.random.seed(1337)
env = gym.make('Pendulum-RL-v1')
env._max_episode_steps = 250
env.unwrapped.dt = 0.05
env.unwrapped.sigma = 1e-4
# env.seed(1337)
acreps = acREPS(env=env, kl_bound=0.1, discount=0.985, lmbda=0.95,
scale=[1., 1., 8.0, 2... | [
"reps.acreps.acREPS",
"numpy.random.seed",
"gym.make",
"matplotlib.pyplot.show",
"matplotlib.pyplot.subplots"
] | [((63, 83), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (77, 83), True, 'import numpy as np\n'), ((91, 117), 'gym.make', 'gym.make', (['"""Pendulum-RL-v1"""'], {}), "('Pendulum-RL-v1')\n", (99, 117), False, 'import gym\n'), ((225, 365), 'reps.acreps.acREPS', 'acREPS', ([], {'env': 'env', 'kl_bo... |
from sage.all import RDF, CDF, matrix, prod
import scipy.linalg
import numpy as np
def column_space_intersection(*As, tol, orthonormal=False):
r"""
Return a matrix with orthonormal columns spanning the intersection of the
column spaces of the given matrices.
INPUT:
- ``*As`` -- matrices with a fi... | [
"numpy.linalg.matrix_rank",
"numpy.sum",
"sage.all.ZZ.random_element"
] | [((2226, 2245), 'numpy.sum', 'np.sum', (['(1 - Σ < tol)'], {}), '(1 - Σ < tol)\n', (2232, 2245), True, 'import numpy as np\n'), ((5203, 5222), 'numpy.linalg.matrix_rank', 'matrix_rank', (['A', 'tol'], {}), '(A, tol)\n', (5214, 5222), False, 'from numpy.linalg import matrix_rank\n'), ((5226, 5245), 'numpy.linalg.matrix_... |
'''
This file is a modification of the file below to enable map save
https://github.com/simondlevy/PyRoboViz/blob/master/roboviz/__init__.py
roboviz.py - Python classes for displaying maps and robots
Requires: numpy, matplotlib
Copyright (C) 2018 <NAME>
This file is part of PyRoboViz.
PyRoboViz is free software: ... | [
"matplotlib.pyplot.title",
"numpy.radians",
"matplotlib.lines.Line2D",
"numpy.frombuffer",
"matplotlib.pyplot.draw",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.arange",
"numpy.sin",
"numpy.cos",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.gcf",
"datetime.datetime.now"
] | [((1023, 1046), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (1037, 1046), False, 'import matplotlib\n'), ((2046, 2093), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 10)', 'facecolor': '"""white"""'}), "(figsize=(10, 10), facecolor='white')\n", (2056, 2093), True, 'impor... |
#!/usr/bin/env python
# coding: utf-8
# # Import libraries and data
#
# Dataset was obtained in the capstone project description (direct link [here](https://d3c33hcgiwev3.cloudfront.net/_429455574e396743d399f3093a3cc23b_capstone.zip?Expires=1530403200&Signature=FECzbTVo6TH7aRh7dXXmrASucl~Cy5mlO94P7o0UXygd13S~Afi38FqC... | [
"matplotlib.pyplot.title",
"numpy.isin",
"numpy.random.seed",
"numpy.sum",
"numpy.abs",
"pandas.read_csv",
"numpy.isnan",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.ndarray",
"pandas.DataFrame",
"numpy.empty_like",
"numpy.random.choice",
"numpy.average",
"numpy.log2",
"sklearn... | [((1069, 1158), 'pandas.read_csv', 'pd.read_csv', (['"""data/capstone/Capstone Data - Office Products - Items.csv"""'], {'index_col': '(0)'}), "('data/capstone/Capstone Data - Office Products - Items.csv',\n index_col=0)\n", (1080, 1158), True, 'import pandas as pd\n'), ((1173, 1264), 'pandas.read_csv', 'pd.read_csv... |
from keras.preprocessing.image import img_to_array
from keras.models import load_model
import imutils
import cv2
import numpy as np
import sys
# parameters for loading data and images
detection_model_path = 'haarcascade_files/haarcascade_frontalface_default.xml'
emotion_model_path = 'models/_mini_XCEPTION.106-0.65.hdf... | [
"keras.models.load_model",
"cv2.putText",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.expand_dims",
"cv2.rectangle",
"cv2.imread",
"keras.preprocessing.image.img_to_array",
"numpy.max",
"cv2.CascadeClassifier",
"sys.exit",
"cv2.imshow",
"cv2.resize"
] | [((425, 468), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['detection_model_path'], {}), '(detection_model_path)\n', (446, 468), False, 'import cv2\n'), ((490, 535), 'keras.models.load_model', 'load_model', (['emotion_model_path'], {'compile': '(False)'}), '(emotion_model_path, compile=False)\n', (500, 535), Fal... |
from ehr_functions.models.types._sklearn import SKLearnModel
from sklearn.linear_model import ElasticNet as EN
import numpy as np
class ElasticNet(SKLearnModel):
def __init__(self, round_output=False, **kwargs):
super().__init__(EN, kwargs)
self.round_output = round_output
def predict(self, x... | [
"numpy.round"
] | [((410, 426), 'numpy.round', 'np.round', (['output'], {}), '(output)\n', (418, 426), True, 'import numpy as np\n')] |
from __future__ import annotations
from typing import Iterable, Optional, Union
import materia as mtr
import numpy as np
import scipy.linalg
__all__ = [
"Identity",
"Inversion",
"Reflection",
"ProperRotation",
"ImproperRotation",
"SymmetryOperation",
]
class SymmetryOperation:
def __ini... | [
"materia.rotation_matrix",
"numpy.trace",
"numpy.abs",
"numpy.log",
"numpy.eye",
"materia.normalize",
"numpy.allclose",
"numpy.triu_indices",
"numpy.isclose",
"numpy.array",
"numpy.cos",
"numpy.sign",
"numpy.linalg.det",
"materia.periodicity",
"numpy.arccos",
"numpy.diag"
] | [((1568, 1589), 'numpy.trace', 'np.trace', (['self.matrix'], {}), '(self.matrix)\n', (1576, 1589), True, 'import numpy as np\n'), ((1904, 1938), 'numpy.isclose', 'np.isclose', (['(self.tr * self.det)', '(-1)'], {}), '(self.tr * self.det, -1)\n', (1914, 1938), True, 'import numpy as np\n'), ((2202, 2225), 'numpy.triu_in... |
# Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | [
"os.system",
"numpy.random.RandomState"
] | [((775, 799), 'numpy.random.RandomState', 'np.random.RandomState', (['(1)'], {}), '(1)\n', (796, 799), True, 'import numpy as np\n'), ((2026, 2040), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (2035, 2040), False, 'import os\n'), ((1788, 1802), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (1797, 1802), F... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
# Módulo de Gauss:
# Métodos de calculo da solução de um sistema linear por eliminação de gauss
# Método para calculo do erro da solução de gauss em relação a solução real
import numpy as np
import construtor
import solve
# Calcula o vetor solução pelo método de Ga... | [
"solve.v_sol",
"numpy.max",
"construtor.vetor",
"numpy.array",
"construtor.matriz"
] | [((1625, 1654), 'construtor.matriz', 'construtor.matriz', (['q', 'x', 'h', 'n'], {}), '(q, x, h, n)\n', (1642, 1654), False, 'import construtor\n'), ((1666, 1702), 'construtor.vetor', 'construtor.vetor', (['r', 'x', 'h', 'n', 'a_', 'b_'], {}), '(r, x, h, n, a_, b_)\n', (1682, 1702), False, 'import construtor\n'), ((263... |
"""
Datacube interop functions are here
"""
import numpy as np
from itertools import chain
from types import SimpleNamespace
from datacube.storage.storage import measurement_paths
from datacube.utils import uri_to_local_path
from datacube.api import GridWorkflow
def flatmap(f, items):
return chain.from_iterable(m... | [
"datacube.storage.storage.measurement_paths",
"numpy.array",
"datacube.utils.uri_to_local_path",
"datacube.api.GridWorkflow"
] | [((621, 663), 'datacube.api.GridWorkflow', 'GridWorkflow', (['index'], {'grid_spec': 'p.grid_spec'}), '(index, grid_spec=p.grid_spec)\n', (633, 663), False, 'from datacube.api import GridWorkflow\n'), ((2234, 2255), 'datacube.storage.storage.measurement_paths', 'measurement_paths', (['ds'], {}), '(ds)\n', (2251, 2255),... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from skimage import transform
from skimage.transform import estimate_transform
source = np.array([(129, 72),
(302, 76),
(90, 185),
(326, 193)])
target = np.array([[0, 0... | [
"matplotlib.pyplot.show",
"numpy.ones_like",
"numpy.array",
"numpy.linalg.inv",
"skimage.transform.warp",
"skimage.transform.estimate_transform",
"numpy.dot",
"matplotlib.pyplot.imread",
"matplotlib.pyplot.subplots"
] | [((182, 237), 'numpy.array', 'np.array', (['[(129, 72), (302, 76), (90, 185), (326, 193)]'], {}), '([(129, 72), (302, 76), (90, 185), (326, 193)])\n', (190, 237), True, 'import numpy as np\n'), ((305, 355), 'numpy.array', 'np.array', (['[[0, 0], [400, 0], [0, 400], [400, 400]]'], {}), '([[0, 0], [400, 0], [0, 400], [40... |
"""
Test that computes the refined mean field approximation for the two-choice model
(with order 1 and 2 and a few parameter)
Compare the computed value with a value already stored in a pickle file
"""
import pickle
import numpy as np
from approximately_equal import approximately_equal
import os
PWD=os.getcwd()
if PW... | [
"sys.path.append",
"src.rmf_tool.DDPP",
"pickle.dump",
"os.getcwd",
"numpy.zeros",
"pickle.load",
"approximately_equal.approximately_equal"
] | [((303, 314), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (312, 314), False, 'import os\n'), ((425, 447), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (440, 447), False, 'import sys\n'), ((448, 468), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (463, 468), False, 'impor... |
import time
import numpy as np
from sklearn.model_selection import train_test_split
from keras.optimizers import Adam
from keras.utils import plot_model
from CNNTripletModel import build_network, build_model
from BatchBuilder import get_batch_random_demo
input_shape = (28, 28, 1)
evaluate_every = 5
n_val = 5
batc... | [
"numpy.load",
"CNNTripletModel.build_network",
"sklearn.model_selection.train_test_split",
"keras.optimizers.Adam",
"time.time",
"keras.utils.plot_model",
"BatchBuilder.get_batch_random_demo",
"CNNTripletModel.build_model"
] | [((340, 404), 'numpy.load', 'np.load', (['"""/Users/niklastecklenburg/Desktop/Test/Data/images.npy"""'], {}), "('/Users/niklastecklenburg/Desktop/Test/Data/images.npy')\n", (347, 404), True, 'import numpy as np\n'), ((414, 478), 'numpy.load', 'np.load', (['"""/Users/niklastecklenburg/Desktop/Test/Data/labels.npy"""'], ... |
import numpy as np
from torch.optim.lr_scheduler import _LRScheduler
from torch.utils.data.dataset import Dataset
from math import cos, pi
import librosa
from scipy.io import wavfile
import random
class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
s... | [
"numpy.sum",
"numpy.maximum",
"numpy.abs",
"numpy.clip",
"numpy.argsort",
"numpy.random.randint",
"librosa.power_to_db",
"numpy.mean",
"numpy.arange",
"numpy.pad",
"numpy.power",
"numpy.cumsum",
"math.cos",
"numpy.hanning",
"numpy.log10",
"numpy.random.beta",
"random.uniform",
"num... | [((6190, 6204), 'numpy.array', 'np.array', (['gain'], {}), '(gain)\n', (6198, 6204), True, 'import numpy as np\n'), ((9986, 10011), 'numpy.flatnonzero', 'np.flatnonzero', (['(truth > 0)'], {}), '(truth > 0)\n', (10000, 10011), True, 'import numpy as np\n'), ((10332, 10367), 'numpy.zeros', 'np.zeros', (['num_classes'], ... |
import numpy as np
import matplotlib.pyplot as plt
def make_pulses(data, T, pulse):
widen = np.zeros(len(data) * T, dtype=np.complex64)
for idx, val in enumerate(widen):
if idx % T == 0:
widen[idx] = data[ idx//T ]
return np.array(np.convolve(widen, pulse, 'full'), dtype=np.complex64)... | [
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.zeros",
"numpy.ones",
"numpy.sinc",
"numpy.array",
"numpy.cos",
"numpy.random.choice",
"numpy.convolve",
"numpy.concatenate"
] | [((374, 408), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'np.complex64'}), '(size, dtype=np.complex64)\n', (382, 408), True, 'import numpy as np\n'), ((617, 632), 'matplotlib.pyplot.plot', 'plt.plot', (['pulse'], {}), '(pulse)\n', (625, 632), True, 'import matplotlib.pyplot as plt\n'), ((637, 647), 'matplotlib.pyp... |
from nipype.interfaces.ants.base import ANTSCommandInputSpec, ANTSCommand
from nipype.interfaces.ants.segmentation import N4BiasFieldCorrectionOutputSpec
from nipype.interfaces.base import (File, traits, isdefined)
from nipype.utils.filemanip import split_filename
import nipype.pipeline.engine as pe
import nipype.inter... | [
"nipype.interfaces.fsl.ApplyTOPUP",
"nipype.interfaces.base.traits.Float",
"nipype.interfaces.utility.IdentityInterface",
"nipype.interfaces.fsl.ExtractROI",
"nipype.interfaces.fsl.Split",
"nipype.interfaces.fsl.Merge",
"nipype.workflows.dmri.fsl.utils.apply_all_corrections",
"nipype.interfaces.base.i... | [((3100, 3123), 'nipype.workflows.dmri.fsl.utils.apply_all_corrections', 'apply_all_corrections', ([], {}), '()\n', (3121, 3123), False, 'from nipype.workflows.dmri.fsl.utils import b0_average, apply_all_corrections, insert_mat, rotate_bvecs, vsm2warp, extract_bval, recompose_xfm, recompose_dwi, _checkinitxfm, enhance\... |
import os
import glob
import numpy as np
import pandas as pd
# geospatial libaries
from osgeo import gdal, osr
from xml.etree import ElementTree
def read_geo_info(fname):
""" This function takes as input the geotiff name and the path of the
folder that the images are stored, reads the geographic information ... | [
"numpy.dstack",
"xml.etree.ElementTree.parse",
"os.path.join",
"numpy.max",
"numpy.array",
"numpy.arange",
"osgeo.gdal.BuildVRTOptions",
"xml.etree.ElementTree.SubElement",
"glob.glob",
"osgeo.gdal.Open",
"osgeo.gdal.GetDriverByName",
"osgeo.gdal.BuildVRT"
] | [((1163, 1179), 'osgeo.gdal.Open', 'gdal.Open', (['fname'], {}), '(fname)\n', (1172, 1179), False, 'from osgeo import gdal, osr\n'), ((1538, 1550), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1546, 1550), True, 'import numpy as np\n'), ((2892, 2908), 'osgeo.gdal.Open', 'gdal.Open', (['fname'], {}), '(fname)\n',... |
import logging
import math
import re
from collections import defaultdict
from dataclasses import dataclass
from typing import Dict, Iterable, Iterator, List, Optional, Sequence, Set, Tuple
import cv2
import numpy as np
import scipy.spatial
from lib.image_processing import (
Point,
Rectangle,
_contains_sta... | [
"lib.image_processing.Point",
"lib.image_processing._contains_start_graphic",
"numpy.array_equal",
"lib.image_processing.Rectangle",
"math.sqrt",
"cv2.cvtColor",
"numpy.empty",
"logging.getLogger",
"lib.image_processing.find_boxes_with_rgb",
"collections.defaultdict",
"numpy.where",
"lib.image... | [((494, 527), 'logging.getLogger', 'logging.getLogger', (['"""texsymdetect"""'], {}), "('texsymdetect')\n", (511, 527), False, 'import logging\n'), ((562, 584), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (571, 584), False, 'from dataclasses import dataclass\n'), ((2173, 2280), ... |
import logging
from typing import List
import numpy as np
import tensorflow as tf
try:
import tensorflow_probability as tfp
distributions = tfp.distributions
except:
distributions = tf.distributions
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils import check_X_y
from sklearn.uti... | [
"numpy.full",
"spn.gpu.TensorFlow.optimize_tf",
"numpy.sum",
"tensorflow.compat.v1.variable_scope",
"sklearn.utils.check_X_y",
"numpy.all",
"tensorflow.constant",
"sklearn.utils.validation.check_is_fitted",
"tensorflow.compat.v1.train.AdamOptimizer",
"numpy.max",
"numpy.array",
"spn.structure.... | [((685, 712), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (702, 712), False, 'import logging\n'), ((1378, 1431), 'tensorflow.compat.v1.train.AdamOptimizer', 'tf.compat.v1.train.AdamOptimizer', ([], {'learning_rate': '(0.001)'}), '(learning_rate=0.001)\n', (1410, 1431), True, 'import te... |
""" render_rgb.py renders obj file to rgb image
Aviable function:
- clear_mash: delete all the mesh in the secene
- scene_setting_init: set scene configurations
- node_setting_init: set node configurations
- render: render rgb image for one obj file and one viewpoint
- render_obj_by_vp_lists: wrapper function for rend... | [
"argparse.ArgumentParser",
"bpy.context.scene.frame_set",
"os.path.isfile",
"bpy.data.textures.remove",
"bpy.ops.import_scene.obj",
"os.path.join",
"bpy.ops.object.select_all",
"os.path.abspath",
"os.path.dirname",
"numpy.savetxt",
"os.path.exists",
"bpy.data.meshes.remove",
"bpy.ops.object.... | [((770, 795), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (785, 795), False, 'import os\n'), ((812, 837), 'os.path.dirname', 'os.path.dirname', (['abs_path'], {}), '(abs_path)\n', (827, 837), False, 'import os\n'), ((1457, 1501), 'bpy.ops.object.select_all', 'bpy.ops.object.select_all', ([... |
'''read ENVI/raw binary format. Dimensions from header, data from .bin file..
..then segment image using flood-fill segmentation'''
import os
import sys
import pickle
import numpy as np
from flood import flood
import matplotlib.pyplot as plt
from dist import normalize, to_list, centroid
def read_hdr(hdr): # read th... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.figure",
"sys.setrecursionlimit",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"os.path.exists",
"dist.to_list",
"dist.centroid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"os.system",
"matplo... | [((1278, 1307), 'numpy.zeros', 'np.zeros', (['(rows, cols, bands)'], {}), '((rows, cols, bands))\n', (1286, 1307), True, 'import numpy as np\n'), ((1394, 1409), 'matplotlib.pyplot.imshow', 'plt.imshow', (['rgb'], {}), '(rgb)\n', (1404, 1409), True, 'import matplotlib.pyplot as plt\n'), ((1414, 1424), 'matplotlib.pyplot... |
import sys
import os
from settings import beaver_broker_ip, beaver_broker_port, autotestdir, beaver_datanode_file, gflagsfile, config_path, log_dir, index_forsearch, pb_forsearch
import psutil
import time
import numpy as np
import requests
#MEM_MAX = psutil.virtual_memory().total
MEM_MAX = 0.8*32*1024*1024*1024 ... | [
"os.remove",
"os.rename",
"os.popen",
"numpy.zeros",
"os.path.exists",
"os.path.dirname",
"time.sleep",
"requests.post",
"os.path.join"
] | [((6072, 6101), 'requests.post', 'requests.post', (['url'], {'data': 'data'}), '(url, data=data)\n', (6085, 6101), False, 'import requests\n'), ((8870, 8929), 'os.path.join', 'os.path.join', (['autotestdir', '"""conf"""', '"""beaver_test.gflags_new"""'], {}), "(autotestdir, 'conf', 'beaver_test.gflags_new')\n", (8882, ... |
import time
import bisect
import numpy as np
import pandas as pd
import networkx as nx
import scipy
import scipy.optimize
import scipy as sp
import os
import matplotlib.pyplot as plt
import random
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction, Colours
import asyncio
import thre... | [
"numpy.abs",
"numpy.sum",
"numpy.expand_dims"
] | [((2226, 2257), 'numpy.expand_dims', 'np.expand_dims', (['timings'], {'axis': '(0)'}), '(timings, axis=0)\n', (2240, 2257), True, 'import numpy as np\n'), ((2841, 2872), 'numpy.expand_dims', 'np.expand_dims', (['timings'], {'axis': '(0)'}), '(timings, axis=0)\n', (2855, 2872), True, 'import numpy as np\n'), ((2288, 235... |
import os
import numpy as np
import pytest
from ananse.network import Network
from .test_02_utils import write_file
@pytest.fixture
def binding_fname():
return "tests/example_data/binding2.tsv"
@pytest.fixture
def network():
genome = "tests/data/genome.fa"
if not os.path.exists(genome):
write_... | [
"numpy.isclose",
"os.path.exists",
"ananse.network.Network"
] | [((361, 420), 'ananse.network.Network', 'Network', ([], {'genome': 'genome', 'gene_bed': '"""ananse/db/hg38.genes.bed"""'}), "(genome=genome, gene_bed='ananse/db/hg38.genes.bed')\n", (368, 420), False, 'from ananse.network import Network\n'), ((1202, 1251), 'numpy.isclose', 'np.isclose', (["dw.loc[100, 'weight']", '(0)... |
"""Miscellaneous utility functions."""
from functools import reduce
from PIL import Image
import numpy as np
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
import spacy
import re
import cv2
import time
from keras_bert.tokenizer import Tokenizer
from keras_bert.loader import load_trained_model_from_checkpoint, l... | [
"PIL.Image.new",
"os.path.join",
"numpy.random.rand",
"numpy.zeros",
"numpy.expand_dims",
"numpy.shape",
"numpy.array",
"keras_bert.loader.load_vocabulary",
"re.sub",
"PIL.Image.fromarray",
"keras_bert.tokenizer.Tokenizer",
"cv2.resize"
] | [((1069, 1108), 'PIL.Image.new', 'Image.new', (['"""RGB"""', 'size', '(128, 128, 128)'], {}), "('RGB', size, (128, 128, 128))\n", (1078, 1108), False, 'from PIL import Image\n'), ((1302, 1332), 'keras_bert.tokenizer.Tokenizer', 'Tokenizer', (['vocabs'], {'cased': '(False)'}), '(vocabs, cased=False)\n', (1311, 1332), Fa... |
#!/usr/bin/env python
import argparse
from functools import partial
from pathlib import Path
from requests_futures.sessions import FuturesSession
import pandas as pd
import numpy as np
# see https://stackoverflow.com/a/50039149
import resource
resource.setrlimit(resource.RLIMIT_NOFILE, (110000, 110000))
__version__... | [
"numpy.count_nonzero",
"pandas.read_hdf",
"argparse.ArgumentParser",
"resource.setrlimit",
"requests_futures.sessions.FuturesSession",
"pathlib.Path"
] | [((247, 307), 'resource.setrlimit', 'resource.setrlimit', (['resource.RLIMIT_NOFILE', '(110000, 110000)'], {}), '(resource.RLIMIT_NOFILE, (110000, 110000))\n', (265, 307), False, 'import resource\n'), ((1187, 1226), 'requests_futures.sessions.FuturesSession', 'FuturesSession', ([], {'max_workers': 'max_workers'}), '(ma... |
import os, fnmatch, sys, time
import dill as pickle
import scipy.interpolate as interp
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import bead_util as bu
import calib_util as cu
import configuration as config
import time
dirname = '/data/old_trap/20201202/power/init'
files,... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"bead_util.find_all_fnames",
"numpy.mean",
"bead_util.DataFile"
] | [((325, 368), 'bead_util.find_all_fnames', 'bu.find_all_fnames', (['dirname'], {'sort_time': '(True)'}), '(dirname, sort_time=True)\n', (343, 368), True, 'import bead_util as bu\n'), ((549, 572), 'matplotlib.pyplot.plot', 'plt.plot', (['fb_set', 'power'], {}), '(fb_set, power)\n', (557, 572), True, 'import matplotlib.p... |
import numpy as np
from scipy.linalg import expm
from pymanopt.manifolds.manifold import EuclideanEmbeddedSubmanifold
from pymanopt.tools.multi import multiprod, multisym, multitransp
class Stiefel(EuclideanEmbeddedSubmanifold):
"""
Factory class for the Stiefel manifold. Instantiation requires the
dimen... | [
"numpy.eye",
"numpy.random.randn",
"numpy.tensordot",
"numpy.linalg.qr",
"numpy.zeros",
"pymanopt.tools.multi.multiprod",
"numpy.shape",
"numpy.bmat",
"pymanopt.tools.multi.multitransp",
"numpy.linalg.norm",
"pymanopt.tools.multi.multisym",
"numpy.diag",
"numpy.sqrt"
] | [((1309, 1335), 'numpy.sqrt', 'np.sqrt', (['(self._p * self._k)'], {}), '(self._p * self._k)\n', (1316, 1335), True, 'import numpy as np\n'), ((1510, 1541), 'numpy.tensordot', 'np.tensordot', (['G', 'H'], {'axes': 'G.ndim'}), '(G, H, axes=G.ndim)\n', (1522, 1541), True, 'import numpy as np\n'), ((2011, 2024), 'pymanopt... |
###############################################################
import os
import cv2
import math
import numpy as np
from scipy.ndimage import interpolation as inter
from scipy.ndimage import rotate
###############################################################
C_percentage = 0
ACCEPTED_EXTENSIONS = (".jpeg", ".jpg", "... | [
"os.listdir",
"numpy.sum",
"cv2.threshold",
"scipy.ndimage.interpolation.rotate",
"cv2.warpAffine",
"numpy.array",
"numpy.arange",
"os.path.join",
"cv2.getRotationMatrix2D",
"cv2.resize"
] | [((847, 880), 'numpy.sum', 'np.sum', (['((hit[1:] - hit[:-1]) ** 2)'], {}), '((hit[1:] - hit[:-1]) ** 2)\n', (853, 880), True, 'import numpy as np\n'), ((997, 1046), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['image_center', 'angle', '(1.0)'], {}), '(image_center, angle, 1.0)\n', (1020, 1046), False, 'impo... |
from logging import error
import numpy as np
class Plane:
def __init__(self, origin: np.array, vector1: np.array, vector2: np.array) -> None:
self.origin = origin
self.vector1 = vector1
self.vector2 = vector2
def getBarycentricCoordinates(self, point: np.array, direction: np.array):
... | [
"logging.error",
"numpy.deg2rad",
"numpy.sin",
"numpy.array",
"numpy.cos",
"numpy.matmul",
"numpy.linalg.solve"
] | [((430, 451), 'numpy.linalg.solve', 'np.linalg.solve', (['a', 'b'], {}), '(a, b)\n', (445, 451), True, 'import numpy as np\n'), ((468, 494), 'numpy.array', 'np.array', (['[sol[0], sol[1]]'], {}), '([sol[0], sol[1]])\n', (476, 494), True, 'import numpy as np\n'), ((2348, 2392), 'numpy.matmul', 'np.matmul', (['rotation_m... |
import cv2
import numpy as np
import sys, getopt
import time
import dlib
import math
i=False
class Controller():
def __init__(self):
self.detector = dlib.get_frontal_face_detector()
self.predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")
self.frame = None
self.... | [
"cv2.GaussianBlur",
"getopt.getopt",
"cv2.bitwise_and",
"cv2.fillPoly",
"cv2.rectangle",
"screeninfo.get_monitors",
"cv2.imshow",
"dlib.shape_predictor",
"cv2.line",
"cv2.cvtColor",
"numpy.append",
"numpy.max",
"cv2.destroyAllWindows",
"cv2.boundingRect",
"cv2.resize",
"cv2.circle",
... | [((161, 193), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (191, 193), False, 'import dlib\n'), ((219, 280), 'dlib.shape_predictor', 'dlib.shape_predictor', (['"""shape_predictor_68_face_landmarks.dat"""'], {}), "('shape_predictor_68_face_landmarks.dat')\n", (239, 280), False, '... |
# ============================================================================
# ~/cerebstats/cerebstats/stat_scores/chi2GOFScore.py
#
# This py-file contains custum score functions initiated by
#
# from cerebstats import scoreScores
# from cerebstats.scoreScores import ABCScore
# ======================================... | [
"numpy.array",
"scipy.stats.chisquare"
] | [((5745, 5807), 'scipy.stats.chisquare', 'chisquare', (["observation['observed_freq']"], {'f_exp': 'expected_counts'}), "(observation['observed_freq'], f_exp=expected_counts)\n", (5754, 5807), False, 'from scipy.stats import chisquare\n'), ((5377, 5414), 'numpy.array', 'np.array', (["prediction['probabilities']"], {}),... |
"""
A simple script for generating sample data for learning to give personalised offers.
"""
import json
import pandas as pd
import numpy as np
import gzip
import random
import logging
GENERATE_INBALANCED_DATA = False
NUM_INTERACTIONS_PER_USER = 3
FIRST_TIMESTAMP = 1591803782 # 2020-06-10, 18:43:02
LAST_TIMESTAMP = ... | [
"pandas.DataFrame",
"json.load",
"numpy.random.seed",
"gzip.open",
"logging.basicConfig",
"random.seed",
"numpy.arange",
"numpy.random.choice",
"numpy.random.shuffle"
] | [((880, 904), 'random.seed', 'random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (891, 904), False, 'import random\n'), ((909, 936), 'numpy.random.seed', 'np.random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (923, 936), True, 'import numpy as np\n'), ((1803, 1832), 'numpy.random.shuffle', 'np.random.shuffle'... |
from kmodes.util.dissim import num_TZ_dissim,cat_TZ_dissim
from sklearn.decomposition import PCA
import numpy
centroid = [
[1,2,3],
[5,6,6]
]
Xnum = [
[54,2,44],
[89,6,4],
[1.5,0,-5],
[5346,874,212]
]
centroid = numpy.array(centroid)
Xnum = numpy.array(Xnum)
x = numpy.array([[1,2,3],[2,3,3],[12... | [
"numpy.array",
"sklearn.decomposition.PCA"
] | [((236, 257), 'numpy.array', 'numpy.array', (['centroid'], {}), '(centroid)\n', (247, 257), False, 'import numpy\n'), ((265, 282), 'numpy.array', 'numpy.array', (['Xnum'], {}), '(Xnum)\n', (276, 282), False, 'import numpy\n'), ((288, 360), 'numpy.array', 'numpy.array', (['[[1, 2, 3], [2, 3, 3], [12938, 9999, 666], [54,... |
"""Tests for log_linear_exp function."""
import chex
import jax
import jax.numpy as jnp
import numpy as np
from vmcnet.utils.log_linear_exp import log_linear_exp
import vmcnet.utils.slog_helpers as slog_helpers
def test_log_linear_exp_shape():
"""Test output shape of log linear exp."""
signs = jnp.ones((5, ... | [
"jax.numpy.array",
"vmcnet.utils.slog_helpers.array_to_slog",
"jax.numpy.isfinite",
"jax.numpy.log",
"chex.assert_shape",
"jax.random.normal",
"jax.numpy.dot",
"numpy.testing.assert_allclose",
"jax.random.PRNGKey",
"jax.numpy.ones",
"jax.numpy.zeros",
"vmcnet.utils.log_linear_exp.log_linear_ex... | [((307, 329), 'jax.numpy.ones', 'jnp.ones', (['(5, 2, 4, 3)'], {}), '((5, 2, 4, 3))\n', (315, 329), True, 'import jax.numpy as jnp\n'), ((341, 364), 'jax.numpy.zeros', 'jnp.zeros', (['(5, 2, 4, 3)'], {}), '((5, 2, 4, 3))\n', (350, 364), True, 'import jax.numpy as jnp\n'), ((379, 395), 'jax.numpy.ones', 'jnp.ones', (['(... |
import pyopencl as cl
import pyopencl.array as cl_array
import numpy
import numpy.linalg as la
a = numpy.random.rand(50000).astype(numpy.float32)
b = numpy.random.rand(50000).astype(numpy.float32)
ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx)
a_dev = cl_array.to_device(queue, a)
b_dev = cl_array.to_dev... | [
"pyopencl.array.empty_like",
"pyopencl.create_some_context",
"pyopencl.array.to_device",
"pyopencl.CommandQueue",
"pyopencl.Program",
"numpy.random.rand"
] | [((205, 229), 'pyopencl.create_some_context', 'cl.create_some_context', ([], {}), '()\n', (227, 229), True, 'import pyopencl as cl\n'), ((238, 258), 'pyopencl.CommandQueue', 'cl.CommandQueue', (['ctx'], {}), '(ctx)\n', (253, 258), True, 'import pyopencl as cl\n'), ((268, 296), 'pyopencl.array.to_device', 'cl_array.to_d... |
import sys
sys.path.append("PerceptualSimilarity\\")
import os
import utils
import torch
import numpy as np
from torch import nn
import torchgeometry
from kornia import color
import torch.nn.functional as F
from torchvision import transforms
class Dense(nn.Module):
def __init__(self, in_features, out_features, a... | [
"utils.get_rnd_brightness_torch",
"torch.dot",
"numpy.ones",
"torch.cat",
"torch.roll",
"utils.random_blur_kernel",
"sys.path.append",
"torch.nn.BCELoss",
"torch.nn.init.kaiming_normal_",
"torch.nn.functional.grid_sample",
"torch.FloatTensor",
"torch.nn.Upsample",
"kornia.color.rgb_to_yuv",
... | [((12, 53), 'sys.path.append', 'sys.path.append', (['"""PerceptualSimilarity\\\\"""'], {}), "('PerceptualSimilarity\\\\')\n", (27, 53), False, 'import sys\n'), ((7002, 7067), 'utils.get_rnd_brightness_torch', 'utils.get_rnd_brightness_torch', (['rnd_bri', 'rnd_hue', 'args.batch_size'], {}), '(rnd_bri, rnd_hue, args.bat... |
import json
import random
import numpy as np
from Source.Utility.Pathfinding.Graph import Graph
def get_distance_to_players(game_state):
own_player = game_state["players"][str(game_state["you"])]
distances = [0, 0, 0, 0, 0, 0]
current_position = (own_player["x"], own_player["y"])
if game_state["players... | [
"numpy.power",
"Source.Utility.Pathfinding.Graph.Graph",
"json.loads"
] | [((3807, 3829), 'json.loads', 'json.loads', (['game_state'], {}), '(game_state)\n', (3817, 3829), False, 'import json\n'), ((3842, 3948), 'Source.Utility.Pathfinding.Graph.Graph', 'Graph', (["game_state['cells']", 'x', 'y', "game_state['width']", "game_state['height']", 'new_direction', 'field_size'], {}), "(game_state... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Functions for estimating the precision matrix based on the covariance of
either the residuals (temporal based precision matrix) or of the measurements
(instance based precision matrix)
"""
from collections.abc import Iterable
import numpy as np
from rsatoolbox.data im... | [
"numpy.outer",
"numpy.sum",
"numpy.eye",
"rsatoolbox.util.data_utils.get_unique_inverse",
"rsatoolbox.data.average_dataset_by",
"numpy.zeros",
"numpy.einsum",
"numpy.expand_dims",
"numpy.mean",
"numpy.linalg.inv",
"numpy.diag",
"numpy.sqrt"
] | [((3735, 3779), 'numpy.zeros', 'np.zeros', (['(matrix.shape[1], matrix.shape[1])'], {}), '((matrix.shape[1], matrix.shape[1]))\n', (3743, 3779), True, 'import numpy as np\n'), ((3793, 3837), 'numpy.zeros', 'np.zeros', (['(matrix.shape[1], matrix.shape[1])'], {}), '((matrix.shape[1], matrix.shape[1]))\n', (3801, 3837), ... |
import sys
import h5py
import numpy as np
import torch
from torch.autograd import Variable
def print_args(args):
print("===== Experiment Configuration =====")
options = vars(args)
for key, value in options.items():
print(f'{key}: {value}')
print("====================================")
def ran... | [
"numpy.stack",
"h5py.File",
"numpy.sum",
"numpy.zeros",
"torch.FloatTensor",
"numpy.random.randint",
"numpy.random.rand",
"numpy.random.shuffle",
"numpy.sqrt"
] | [((417, 442), 'numpy.random.randint', 'np.random.randint', (['lo', 'hi'], {}), '(lo, hi)\n', (434, 442), True, 'import numpy as np\n'), ((476, 524), 'numpy.sqrt', 'np.sqrt', (['((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)'], {}), '((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)\n', (483, 524), True, 'import numpy as np\n'), ((6... |
import numpy as np
class LinearConstraints():
def __init__(self, A, b, mode='Intersection'):
"""
Defines linear functions f(x) = Ax + b.
The integration domain is defined as the union of where all of these functions are positive if mode='Union'
or the domain where any of the functio... | [
"numpy.dot"
] | [((832, 849), 'numpy.dot', 'np.dot', (['self.A', 'x'], {}), '(self.A, x)\n', (838, 849), True, 'import numpy as np\n')] |
# Imports
import math
import numpy as np
import matplotlib.pyplot as plt
class ParkingTrajectoryGenerator:
# Class Variables
# Vehicle Parameters
__l = 0.356 # length between front and rear axle in m
__b = 0.37 # width of car in m
__l_1 = 0.12 # length between front axle and bumper in m
_... | [
"numpy.poly1d",
"matplotlib.pyplot.show",
"numpy.tanh",
"math.sqrt",
"numpy.degrees",
"math.radians",
"math.tan",
"numpy.zeros",
"matplotlib.pyplot.stem",
"numpy.ones",
"numpy.tan",
"numpy.sin",
"numpy.linspace",
"numpy.cos"
] | [((15864, 15976), 'numpy.zeros', 'np.zeros', (['ParkingTrajectoryGenerator1._ParkingTrajectoryGenerator__parkingTrajectoryPoints_y_rear_axle.size'], {}), '(ParkingTrajectoryGenerator1.\n _ParkingTrajectoryGenerator__parkingTrajectoryPoints_y_rear_axle.size)\n', (15872, 15976), True, 'import numpy as np\n'), ((16330,... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 13:07:35 2018
@author: Sunny
"""
import numpy as np
import cv2
print(cv2.__version__)
TOTAL_CAMERAS=1
HEIGHT = 240
WIDTH = 320
RECORD_WIDTH = WIDTH*3
RECORD_HEIGHT = HEIGHT
FPS = 90
cam = []
frame = []
ret = []
rgb = []
i = 0
rgb_current=0
cam = cv2.VideoCapture(0... | [
"cv2.resize",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"numpy.hstack",
"cv2.VideoCapture",
"numpy.vstack",
"cv2.VideoWriter",
"cv2.flip",
"cv2.destroyAllWindows",
"cv2.namedWindow"
] | [((302, 321), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (318, 321), False, 'import cv2\n'), ((543, 574), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'DIVX'"], {}), "(*'DIVX')\n", (565, 574), False, 'import cv2\n'), ((581, 690), 'cv2.VideoWriter', 'cv2.VideoWriter', (['"""C:\\\\Users\\\... |
import numpy as np
from instResp.polezero import polezero
from instResp.plotResp import plotResponse
import os
import logging
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
'''
This module contains a collection of non-bulletproof codes
for cr... | [
"instResp.libNom.RC",
"logging.basicConfig",
"numpy.logspace",
"instResp.polezero.polezero",
"numpy.zeros",
"instResp.libNom.WA",
"instResp.plotResp.plotResponse",
"os.path.join",
"logging.getLogger",
"numpy.sqrt"
] | [((129, 204), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(message)s"""', 'level': 'logging.INFO'}), "(format='%(levelname)s:%(message)s', level=logging.INFO)\n", (148, 204), False, 'import logging\n'), ((214, 241), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__n... |
# Module file for conductance measurements with the
# SR830. Implementing the good ideas of <NAME>
from typing import Union, Optional
from time import sleep
import numpy as np
import qcodes as qc
from qcodes.instrument.parameter import Parameter
from qdev_wrappers.sweep_functions import _do_measurement
from qcodes.ins... | [
"qcodes.Task",
"qdev_wrappers.sweep_functions._do_measurement",
"numpy.linspace",
"time.sleep"
] | [((3995, 4011), 'qcodes.Task', 'qc.Task', (['trigger'], {}), '(trigger)\n', (4002, 4011), True, 'import qcodes as qc\n'), ((4029, 4050), 'qcodes.Task', 'qc.Task', (['reset_buffer'], {}), '(reset_buffer)\n', (4036, 4050), True, 'import qcodes as qc\n'), ((4068, 4089), 'qcodes.Task', 'qc.Task', (['start_buffer'], {}), '(... |
import numpy as np
import tensorflow as tf
class PositionalEncodings(tf.keras.Model):
"""Sinusoidal positional encoding generator.
"""
def __init__(self, channels: int, presize: int = 128):
"""Initializer.
Args:
channels: size of the channels.
presize: initial pe ca... | [
"tensorflow.range",
"tensorflow.sin",
"numpy.log",
"tensorflow.reshape",
"tensorflow.cast",
"tensorflow.cos"
] | [((1155, 1169), 'tensorflow.range', 'tf.range', (['size'], {}), '(size)\n', (1163, 1169), True, 'import tensorflow as tf\n'), ((1211, 1240), 'tensorflow.range', 'tf.range', (['(0)', 'self.channels', '(2)'], {}), '(0, self.channels, 2)\n', (1219, 1240), True, 'import tensorflow as tf\n'), ((1626, 1663), 'tensorflow.resh... |
#!/usr/bin/env python3
# Copyright 2021 <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 agre... | [
"matplotlib.pyplot.show",
"matplotlib.dates.DayLocator",
"numpy.cumsum",
"matplotlib.dates.DateFormatter",
"datetime.date.fromisoformat",
"numpy.array",
"matplotlib.pyplot.rc",
"numpy.loadtxt",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.subplots",
"numpy.vstack"
] | [((1244, 1300), 'numpy.array', 'np.array', (["[d for d in data if d[0] not in ('', 'total')]"], {}), "([d for d in data if d[0] not in ('', 'total')])\n", (1252, 1300), True, 'import numpy as np\n'), ((1493, 1531), 'numpy.vstack', 'np.vstack', (['[[[data[0, 0], 0.0]], data]'], {}), '([[[data[0, 0], 0.0]], data])\n', (1... |
"""
Created on Mon Sep 9 15:51:35 2013
QgasUtils: Basic Quantum Gas Utilities functions
@author: ispielman
Modified on Wed Dec 10 11:26: 2014
@author: aputra
"""
import numpy
import scipy.ndimage
def ImageSlice(xVals, yVals, Image, r0, Width, Scaled = False):
"""
Produces a pair of slices from image of a ... | [
"numpy.ceil",
"numpy.ravel",
"numpy.floor",
"numpy.array",
"numpy.round"
] | [((936, 958), 'numpy.round', 'numpy.round', (['(Width / 2)'], {}), '(Width / 2)\n', (947, 958), False, 'import numpy\n'), ((986, 1008), 'numpy.round', 'numpy.round', (['(Width / 2)'], {}), '(Width / 2)\n', (997, 1008), False, 'import numpy\n'), ((2672, 2687), 'numpy.floor', 'numpy.floor', (['r0'], {}), '(r0)\n', (2683,... |
import os
import json
import multiprocessing
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
import matplotlib.animation
from sklearn.model_selection import train_test_split
fr... | [
"sklearn.metrics.accuracy_score",
"sklearn.metrics.classification_report",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"sklearn.metrics.f1_score",
"numpy.arange",
"matplotlib.colors.ListedColormap",
"numpy.round",
"numpy.unique",
"numpy.linspace",
"matplotlib.pyplot.subplot... | [((2528, 2546), 'numpy.zeros', 'np.zeros', (['(256, 4)'], {}), '((256, 4))\n', (2536, 2546), True, 'import numpy as np\n'), ((2604, 2626), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(256)'], {}), '(0, 1, 256)\n', (2615, 2626), True, 'import numpy as np\n'), ((2677, 2721), 'matplotlib.colors.ListedColormap', 'mpl... |
import nose
import numpy as np
from numpy.polynomial.polynomial import polyval
import pySDC.helpers.transfer_helper as th
from pySDC.core.Collocation import CollBase
from pySDC.tests.test_helpers import get_derived_from_in_package
classes = []
def setup():
global classes, t_start, t_end
# generate random bo... | [
"numpy.polynomial.polynomial.polyval",
"numpy.linalg.norm",
"pySDC.helpers.transfer_helper.restriction_matrix_1d",
"pySDC.tests.test_helpers.get_derived_from_in_package",
"numpy.random.rand",
"nose.tools.with_setup",
"pySDC.helpers.transfer_helper.interpolation_matrix_1d"
] | [((576, 604), 'nose.tools.with_setup', 'nose.tools.with_setup', (['setup'], {}), '(setup)\n', (597, 604), False, 'import nose\n'), ((2290, 2318), 'nose.tools.with_setup', 'nose.tools.with_setup', (['setup'], {}), '(setup)\n', (2311, 2318), False, 'import nose\n'), ((491, 577), 'pySDC.tests.test_helpers.get_derived_from... |
from numpy import ndarray
from src.domain.cs_column import Column
import numpy as np
from src.model.stop_at_station_summary import StopAtStationSummary
class CargoSpace(object):
""" Represents cargo space in transport vehicle/ship ect.
"""
def __init__(self, width: int, height: int):
self._widt... | [
"src.domain.cs_column.Column",
"numpy.argmin"
] | [((407, 421), 'src.domain.cs_column.Column', 'Column', (['height'], {}), '(height)\n', (413, 421), False, 'from src.domain.cs_column import Column\n'), ((2339, 2366), 'numpy.argmin', 'np.argmin', (['packages_per_col'], {}), '(packages_per_col)\n', (2348, 2366), True, 'import numpy as np\n')] |
import numpy as np
class BayesLinearRegressor:
def __init__(self, number_of_features, alpha=1e6):
'''
:param number_of_features: Integer number of features in the training rows, excluding the intercept and output values
:param alpha: Float inverse ridge regularizaiton constant, set to 1e... | [
"numpy.eye",
"numpy.linalg.inv",
"numpy.array",
"numpy.random.multivariate_normal"
] | [((965, 1021), 'numpy.array', 'np.array', (['([0] * (number_of_features + 1))'], {'dtype': 'np.float'}), '([0] * (number_of_features + 1), dtype=np.float)\n', (973, 1021), True, 'import numpy as np\n'), ((3376, 3417), 'numpy.linalg.inv', 'np.linalg.inv', (['inverted_covariance_matrix'], {}), '(inverted_covariance_matri... |
import numpy as np
class Camera(object):
"""Camera is a simple finite pinhole camera defined by the matrices K, R
and t.
see "Multiple View Geometry in Computer Vision" by <NAME> and <NAME> for notation.
Parameters
----------
K: The 3x3 intrinsic camera parameters
R: The 3x3 rota... | [
"numpy.linalg.inv",
"numpy.linalg.pinv",
"numpy.hstack"
] | [((1711, 1733), 'numpy.linalg.pinv', 'np.linalg.pinv', (['self.P'], {}), '(self.P)\n', (1725, 1733), True, 'import numpy as np\n'), ((1560, 1589), 'numpy.hstack', 'np.hstack', (['[self._R, self._t]'], {}), '([self._R, self._t])\n', (1569, 1589), True, 'import numpy as np\n'), ((1263, 1284), 'numpy.linalg.inv', 'np.lina... |
#! python
# -*- coding: utf-8 -*-
## import time
import wx
import cv2
import numpy as np
from mwx.controls import Param, LParam
from mwx.controls import ToggleButton, Choice
from mwx.graphman import Layer, Thread
import editor as edi
class Plugin(Layer):
"""Plugins of camera viewer
"""
menu = "Cameras"
... | [
"cv2.line",
"cv2.circle",
"cv2.bitwise_xor",
"mwx.controls.Param",
"cv2.destroyAllWindows",
"mwx.graphman.Frame",
"cv2.waitKey",
"cv2.imshow",
"mwx.controls.Choice",
"numpy.zeros",
"mwx.graphman.Layer.Destroy",
"wx.App",
"mwx.controls.LParam",
"mwx.graphman.Thread",
"cv2.getWindowPropert... | [((3655, 3663), 'wx.App', 'wx.App', ([], {}), '()\n', (3661, 3663), False, 'import wx\n'), ((3674, 3685), 'mwx.graphman.Frame', 'Frame', (['None'], {}), '(None)\n', (3679, 3685), False, 'from mwx.graphman import Frame\n'), ((542, 554), 'mwx.graphman.Thread', 'Thread', (['self'], {}), '(self)\n', (548, 554), False, 'fro... |
from __future__ import print_function
import tensorflow as tf
import numpy as np
import pytest
import sys
from tensorflow.python.ops import array_ops
shapes = [
(3, 4),
(50, 70, 12)
]
seed = 123
def _test_random_func(func_name, shape):
print('func_name', func_name)
func = eval(func_name)
with t... | [
"numpy.abs",
"tensorflow.device",
"tensorflow.ConfigProto",
"numpy.array",
"tensorflow.initialize_all_variables",
"tensorflow.Graph",
"pytest.mark.parametrize",
"pytest.mark.skip"
] | [((1229, 1269), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shape"""', 'shapes'], {}), "('shape', shapes)\n", (1252, 1269), False, 'import pytest\n'), ((1362, 1402), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""shape"""', 'shapes'], {}), "('shape', shapes)\n", (1385, 1402), False, 'import... |
import os
import numpy as np
import pandas as pd
'''This script is for preprocessing the label, finding the mistake in it and stroe label in a unified format in processed_label dic'''
file_dic_Extra = os.listdir('../../label/Extra_Labels')
file_dic_Train = os.listdir('../../label/Train_labels')
file_dic_Test = os.lis... | [
"pandas.read_csv",
"numpy.asarray",
"numpy.where",
"numpy.array",
"os.listdir",
"numpy.concatenate"
] | [((203, 241), 'os.listdir', 'os.listdir', (['"""../../label/Extra_Labels"""'], {}), "('../../label/Extra_Labels')\n", (213, 241), False, 'import os\n'), ((259, 297), 'os.listdir', 'os.listdir', (['"""../../label/Train_labels"""'], {}), "('../../label/Train_labels')\n", (269, 297), False, 'import os\n'), ((314, 351), 'o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from dataclasses import dataclass, field
from typing import Callable, List
from astropy.coordinates import SkyCoord, Longitude, Latitude, Angle
from astropy.time import Time
from astropy.units.quantity import Quantity
from astropy.wcs import WCS
from astropy.visualization.w... | [
"pandas.DataFrame",
"numpy.stack",
"shapely.geometry.Point",
"shapely.geometry.MultiPoint",
"descartes.patch.PolygonPatch",
"shapely.geometry.Polygon",
"matplotlib.patches.Rectangle",
"numpy.zeros",
"numpy.expand_dims",
"scipy.optimize.least_squares",
"matplotlib.pyplot.figure",
"numpy.sin",
... | [((1409, 1427), 'numpy.array', 'np.array', (['position'], {}), '(position)\n', (1417, 1427), True, 'import numpy as np\n'), ((2059, 2084), 'astropy.coordinates.Angle', 'Angle', (['(0.0)'], {'unit': '"""degree"""'}), "(0.0, unit='degree')\n", (2064, 2084), False, 'from astropy.coordinates import SkyCoord, Longitude, Lat... |
#!/usr/bin/env python3
#------------------------------------------------------------
# Programmer(s): <NAME> @ SMU
#------------------------------------------------------------
# Copyright (c) 2019, Southern Methodist University.
# All rights reserved.
# For details, see the LICENSE file.
#----------------------------... | [
"matplotlib.pyplot.title",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.close",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"numpy.sqrt"
] | [((1092, 1123), 'numpy.zeros', 'np.zeros', (['(ny, nz)'], {'dtype': 'float'}), '((ny, nz), dtype=float)\n', (1100, 1123), True, 'import numpy as np\n'), ((1131, 1162), 'numpy.zeros', 'np.zeros', (['(ny, nz)'], {'dtype': 'float'}), '((ny, nz), dtype=float)\n', (1139, 1162), True, 'import numpy as np\n'), ((1170, 1201), ... |
###############################################
##<NAME>, 2018##
##Topo-Seq analysis##
#The script takes raw GCSs data, returns only trusted GCSs,
#computes GCSs shared between different conditions,
#draws Venn diagrams of the sets overlappings,
#writes GCSs sets.
###############################################
##... | [
"numpy.mean",
"os.path.exists",
"os.makedirs"
] | [((1698, 1731), 'os.path.exists', 'os.path.exists', (['Replicas_path_out'], {}), '(Replicas_path_out)\n', (1712, 1731), False, 'import os\n'), ((1737, 1767), 'os.makedirs', 'os.makedirs', (['Replicas_path_out'], {}), '(Replicas_path_out)\n', (1748, 1767), False, 'import os\n'), ((11670, 11688), 'numpy.mean', 'np.mean',... |
__copyright__ = "Copyright (c) Microsoft Corporation and Mila - Quebec AI Institute"
__license__ = "MIT"
"""Billiards game
"""
__all__ = ("billiards_default_config", "Billiards", "BilliardsInitialization")
import math
from typing import Optional
import numpy as np
from segar.mdps.initializations import ArenaInitia... | [
"math.sqrt",
"segar.things.Hole",
"segar.sim.location_priors.RandomBottomLocation",
"segar.factors.GaussianNoise",
"segar.rules.Prior",
"segar.mdps.rewards.l2_distance_reward_fn",
"numpy.array",
"segar.factors.Circle",
"segar.things.Ball",
"numpy.random.normal",
"segar.mdps.rewards.dead_reward_f... | [((1278, 1292), 'math.sqrt', 'math.sqrt', (['(2.0)'], {}), '(2.0)\n', (1287, 1292), False, 'import math\n'), ((1893, 1904), 'segar.factors.Circle', 'Circle', (['(0.2)'], {}), '(0.2)\n', (1899, 1904), False, 'from segar.factors import Label, Mass, Charge, Shape, Text, Circle, GaussianNoise, Size, Position, ID, Done, Ali... |
# Create by Packetsss
# Personal use is allowed
# Commercial use is prohibited
import numpy as np
import cv2
from scipy import ndimage
import math
from copy import deepcopy
class Images:
def __init__(self, img):
self.img = cv2.imread(img, 1)
if self.img.shape[0] / self.img.shape[1] ... | [
"cv2.bitwise_and",
"cv2.medianBlur",
"math.atan2",
"cv2.adaptiveThreshold",
"numpy.clip",
"cv2.edgePreservingFilter",
"cv2.imshow",
"cv2.inRange",
"cv2.cvtColor",
"math.radians",
"cv2.imwrite",
"cv2.detailEnhance",
"cv2.split",
"cv2.convertScaleAbs",
"math.cos",
"cv2.destroyAllWindows"... | [((7505, 7534), 'cv2.imshow', 'cv2.imshow', (['img_name', 'img.img'], {}), '(img_name, img.img)\n', (7515, 7534), False, 'import cv2\n'), ((7540, 7553), 'cv2.waitKey', 'cv2.waitKey', ([], {}), '()\n', (7551, 7553), False, 'import cv2\n'), ((7559, 7582), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n'... |
"""
Minimizes D(b, Ax) for x ∈ ℝ₊^N where aₙ, b ∈ ℝ₊^M and D is a divergence.
These occur as ingredients of algorithms for the sparse case.
"""
import cvxpy
import numpy
def euclidean(A, b):
return _solve_convex(A, b, lambda p, q: cvxpy.norm2(p - q))
def total_variation(A, b):
return _solve_convex(A, b, ... | [
"cvxpy.norm1",
"numpy.isclose",
"cvxpy.Problem",
"cvxpy.Variable",
"cvxpy.norm2"
] | [((397, 423), 'cvxpy.Variable', 'cvxpy.Variable', (['A.shape[1]'], {}), '(A.shape[1])\n', (411, 423), False, 'import cvxpy\n'), ((509, 546), 'cvxpy.Problem', 'cvxpy.Problem', (['objective', 'constraints'], {}), '(objective, constraints)\n', (522, 546), False, 'import cvxpy\n'), ((706, 725), 'numpy.isclose', 'numpy.iscl... |
"""Split each echo to prepare for registration."""
import os
import subprocess
import numpy as np
import nibabel as nb
# =============================================================================
NII_NAMES = [
'/home/faruk/data/DATA_MRI_NIFTI/derived/sub-23/T2s/01_crop/sub-23_ses-T2s_run-01_dir-AP_part-mag_MEG... | [
"nibabel.Nifti1Image",
"os.makedirs",
"nibabel.load",
"os.path.basename",
"numpy.asanyarray",
"os.path.exists",
"numpy.squeeze",
"os.path.join"
] | [((928, 950), 'os.path.exists', 'os.path.exists', (['OUTDIR'], {}), '(OUTDIR)\n', (942, 950), False, 'import os\n'), ((956, 975), 'os.makedirs', 'os.makedirs', (['OUTDIR'], {}), '(OUTDIR)\n', (967, 975), False, 'import os\n'), ((1115, 1132), 'nibabel.load', 'nb.load', (['nii_name'], {}), '(nii_name)\n', (1122, 1132), T... |
import numpy as np
class layer():
def __init__(self,name,type,nodes_number):
self.name=name
self.type=type
self.nodes_number=nodes_number
self.input_values=np.zeros(shape=(nodes_number,1),dtype=float)##input values of nodes
self.sum_values=np.zeros(shape=(nodes_number,1),dty... | [
"numpy.where",
"numpy.zeros",
"numpy.argmax"
] | [((193, 239), 'numpy.zeros', 'np.zeros', ([], {'shape': '(nodes_number, 1)', 'dtype': 'float'}), '(shape=(nodes_number, 1), dtype=float)\n', (201, 239), True, 'import numpy as np\n'), ((285, 331), 'numpy.zeros', 'np.zeros', ([], {'shape': '(nodes_number, 1)', 'dtype': 'float'}), '(shape=(nodes_number, 1), dtype=float)\... |
"""File with the preprocessing tools."""
import os
import numpy as np
import nibabel as nib
import pandas as pd
from tqdm import tqdm
from sklearn.metrics import pairwise_distances
from sklearn.metrics.pairwise import linear_kernel
# Change this path
path = '' # folder containing the gray-matter maps
# Folders wi... | [
"pandas.DataFrame",
"tqdm.tqdm",
"numpy.load",
"sklearn.metrics.pairwise.linear_kernel",
"pandas.read_csv",
"numpy.empty",
"numpy.asarray",
"sklearn.metrics.pairwise_distances",
"pandas.Series",
"os.path.join",
"os.listdir"
] | [((789, 812), 'os.listdir', 'os.listdir', (['output_data'], {}), '(output_data)\n', (799, 812), False, 'import os\n'), ((1026, 1058), 'numpy.empty', 'np.empty', (['(n_samples, n_samples)'], {}), '((n_samples, n_samples))\n', (1034, 1058), True, 'import numpy as np\n'), ((1076, 1108), 'numpy.empty', 'np.empty', (['(n_sa... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import random
import math
import logging
import itertools
from fairseq import utils
from fairseq.data import ... | [
"fairseq.data.data_utils.collate_tokens",
"numpy.full",
"torch.LongTensor",
"torch.FloatTensor",
"random.random",
"numpy.append",
"numpy.array",
"numpy.arange",
"logging.getLogger"
] | [((488, 515), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (505, 515), False, 'import logging\n'), ((842, 978), 'fairseq.data.data_utils.collate_tokens', 'data_utils.collate_tokens', (['[s[key] for s in samples]', 'pad_idx', 'eos_idx', 'left_pad', 'move_eos_to_beginning'], {'pad_to_leng... |
#! /usr/bin/python
import numpy as np
import math
from scipy.spatial import KDTree
import openravepy as orpy
import transformations
from robotiqloader import RobotiqHand, InvalidTriangleException
import sys, time, logging, copy
import itertools
from utils import ObjectFileIO, clamp, compute_grasp_stability, normal_dis... | [
"openravepy.RaveDestroy",
"numpy.sum",
"numpy.random.randint",
"numpy.linalg.norm",
"utils.normal_distance",
"rospy.logwarn",
"openravepy.Environment",
"IPython.embed",
"numpy.random.choice",
"math.isnan",
"transformations.rotation_from_matrix",
"numpy.asarray",
"transformations.rotation_mat... | [((931, 1053), 'openravepy.databases.inversekinematics.InverseKinematicsModel', 'orpy.databases.inversekinematics.InverseKinematicsModel', (['self._robot'], {'iktype': 'orpy.IkParameterization.Type.Transform6D'}), '(self._robot, iktype\n =orpy.IkParameterization.Type.Transform6D)\n', (986, 1053), True, 'import openr... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 1 16:33:02 2018
@author: <NAME>
"""
# Calculate the distance map between the C-alpha atoms in a protein. The input
# file is required to be a C_alpha coordinate file
import sys
import re
import numpy as np
import matplotlib.pyplot as plt
def ge... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"re.match",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linalg.norm"
] | [((1873, 1885), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1883, 1885), True, 'import matplotlib.pyplot as plt\n'), ((1886, 1918), 'matplotlib.pyplot.imshow', 'plt.imshow', (['dist_mat'], {'cmap': '"""jet"""'}), "(dist_mat, cmap='jet')\n", (1896, 1918), True, 'import matplotlib.pyplot as plt\n'), ((19... |
# coding=utf-8
# Author: <NAME> <<EMAIL>>
import numpy as np
from torch import nn
from torch.nn import Parameter
from eeggan.pytorch.modules.conv.multiconv import MultiConv1d
class WeightScale(object):
"""
Implemented for PyTorch using WeightNorm implementation
https://pytorch.org/docs/stable/_modules... | [
"torch.nn.Parameter",
"numpy.sqrt"
] | [((1836, 1846), 'numpy.sqrt', 'np.sqrt', (['(2)'], {}), '(2)\n', (1843, 1846), True, 'import numpy as np\n'), ((1207, 1232), 'torch.nn.Parameter', 'nn.Parameter', (['weight.data'], {}), '(weight.data)\n', (1219, 1232), False, 'from torch import nn\n'), ((1665, 1687), 'torch.nn.Parameter', 'Parameter', (['weight.data'],... |
#!/usr/bin/env python3
"""
Python EKF Planner
@Author: <NAME>, original MATLAB code and Python version
@Author: <NAME>, initial MATLAB port
Based on code by <NAME>, Oxford University,
http://www.robots.ox.ac.uk/~pnewman
"""
from collections import namedtuple
import numpy as np
import scipy as sp
import matplotlib.... | [
"matplotlib.pyplot.xlim",
"spatialmath.base.expand_dims",
"matplotlib.pyplot.plot",
"numpy.ones",
"numpy.random.default_rng",
"numpy.cumsum",
"spatialmath.base.array2str",
"numpy.linalg.inv",
"spatialmath.base.plotvol3",
"collections.namedtuple",
"numpy.array",
"numpy.exp",
"matplotlib.pyplo... | [((3961, 3988), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (3982, 3988), True, 'import numpy as np\n'), ((4096, 4141), 'collections.namedtuple', 'namedtuple', (['"""PFlog"""', '"""t odo xest std weights"""'], {}), "('PFlog', 't odo xest std weights')\n", (4106, 4141), False, 'from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Generate various Similarity matrix
through the MatrixGenerator methods
gen_matrix for synthetic data, and
gen_E_coli_matrix for DNA data.
"""
import numpy as np
# from scipy import sparse as sp
from scipy.linalg import toeplitz
def gen_lambdas(type_matrix, n):
''... | [
"scipy.linalg.toeplitz",
"numpy.floor",
"numpy.zeros",
"numpy.shape",
"numpy.sort",
"numpy.where",
"numpy.arange",
"numpy.mean",
"numpy.random.permutation",
"numpy.random.rand"
] | [((444, 455), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (452, 455), True, 'import numpy as np\n'), ((1336, 1353), 'scipy.linalg.toeplitz', 'toeplitz', (['lambdas'], {}), '(lambdas)\n', (1344, 1353), False, 'from scipy.linalg import toeplitz\n'), ((3120, 3144), 'numpy.where', 'np.where', (['(N > noise_prop)'], {}... |
from __future__ import print_function
import torch
import numpy as np
import os
# from torch_scatter import scatter_add
def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
MESH_EXTENSIONS = [
'.obj',
]
def is_mesh_file(filename):
return any(filename.endswith(extension) for extensi... | [
"numpy.pad",
"torch.ones",
"numpy.sum",
"torch.stack",
"numpy.log",
"os.makedirs",
"os.path.exists",
"torch.nn.functional.one_hot",
"torch.cat",
"numpy.min",
"numpy.max",
"torch.zeros"
] | [((522, 593), 'numpy.pad', 'np.pad', (['input_arr'], {'pad_width': 'npad', 'mode': '"""constant"""', 'constant_values': 'val'}), "(input_arr, pad_width=npad, mode='constant', constant_values=val)\n", (528, 593), True, 'import numpy as np\n'), ((1190, 1235), 'torch.zeros', 'torch.zeros', (['num_classes'], {'dtype': 'tor... |
import logging
import os
import numpy as np
from sklearn.metrics import classification_report
import torch
from torch.optim import Adam
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.nn import CrossEntropyLoss
from data.dataset import COVIDxFolder
from data import transforms
from torch.utils.data i... | [
"numpy.random.seed",
"model.architecture.COVIDNext50",
"torch.argmax",
"sklearn.metrics.classification_report",
"torch.no_grad",
"util.load_model_weights",
"os.path.join",
"util.clf_metrics",
"torch.utils.data.DataLoader",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.FloatTensor",
"tor... | [((402, 429), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (419, 429), False, 'import logging\n'), ((430, 469), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (449, 469), False, 'import logging\n'), ((1108, 1146), 'os.path.join',... |
import cv2
import numpy as np
from calibration import get_calib_from_file
# kitti
# name = '000000'
# pc_pathname = '/home/alex/github/waymo_to_kitti_converter/tools/kitti/velodyne/'+name+'.bin'
# img_pathname = '/home/alex/github/waymo_to_kitti_converter/tools/kitti/image_2/'+name+'.png'
# calib_pathname = '/home/ale... | [
"cv2.waitKey",
"calibration.get_calib_from_file",
"numpy.fromfile",
"numpy.transpose",
"numpy.ones",
"numpy.clip",
"cv2.imread",
"cv2.imshow",
"matplotlib.pyplot.cm.get_cmap",
"cv2.namedWindow"
] | [((2141, 2176), 'calibration.get_calib_from_file', 'get_calib_from_file', (['calib_pathname'], {}), '(calib_pathname)\n', (2160, 2176), False, 'from calibration import get_calib_from_file\n'), ((3845, 3872), 'matplotlib.pyplot.cm.get_cmap', 'plt.cm.get_cmap', (['"""hsv"""', '(256)'], {}), "('hsv', 256)\n", (3860, 3872)... |
from __future__ import division, print_function
# coding=utf-8
import sys
import os
import glob
import re
import numpy as np
import tensorflow as tf
import pathlib
import wget
# from tensorflow.compat.v1.compat import ConfigProto
# from tensorflow.compat.v1 import InteractiveSession
#from tensorflow.pyt... | [
"tensorflow.keras.models.load_model",
"numpy.argmax",
"os.path.dirname",
"flask.Flask",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"werkzeug.utils.secure_filename",
"wget.download",
"tensorflow.keras.preprocessing.image.load_img",
"pathlib.Path",
"flask.render_temp... | [((1368, 1383), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1373, 1383), False, 'from flask import Flask, redirect, url_for, request, render_template\n'), ((1871, 1893), 'tensorflow.keras.models.load_model', 'load_model', (['MODEL_PATH'], {}), '(MODEL_PATH)\n', (1881, 1893), False, 'from tensorflow.ker... |
#!/usr/bin/env python
# module TEST_ACD
import unittest
import numpy as np
from .test_common import BaseCommon
from pylocus.point_set import PointSet
from pylocus.algorithms import reconstruct_acd
from pylocus.simulation import create_noisy_edm
class TestACD(BaseCommon.TestAlgorithms):
def setUp(self):
B... | [
"unittest.main",
"pylocus.simulation.create_noisy_edm",
"numpy.ones",
"pylocus.point_set.PointSet"
] | [((1073, 1088), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1086, 1088), False, 'import unittest\n'), ((507, 521), 'pylocus.point_set.PointSet', 'PointSet', (['N', 'd'], {}), '(N, d)\n', (515, 521), False, 'from pylocus.point_set import PointSet\n'), ((1002, 1039), 'pylocus.simulation.create_noisy_edm', 'creat... |
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import config as cfg
sns.set_style('darkgrid')
sns.set_context('notebook')
sns.despine(trim=True)
plt.close('all')
fig, ax = plt.subplots(1, 1, figsize=(8, 6))
scores = np.load(op.join(cfg.path_outputs,
'a... | [
"seaborn.set_style",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"numpy.std",
"matplotlib.pyplot.close",
"seaborn.despine",
"numpy.mean",
"matplotlib.pyplot.subplots",
"seaborn.set_context"
] | [((118, 143), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (131, 143), True, 'import seaborn as sns\n'), ((144, 171), 'seaborn.set_context', 'sns.set_context', (['"""notebook"""'], {}), "('notebook')\n", (159, 171), True, 'import seaborn as sns\n'), ((172, 194), 'seaborn.despine', '... |
import alepy
import numpy as np
import os.path as osp
from control3 import CTRL_ROOT
# import cv2
world = alepy.AtariWorld(osp.join(CTRL_ROOT,"domain_data/atari_roms/space_invaders.bin"))
for j in xrange(5):
x0 = world.GetInitialState(np.random.randint(0,50))
u0 = np.array([0],'uint8')
y,r,o,d = world.St... | [
"numpy.array",
"numpy.random.randint",
"os.path.join"
] | [((124, 188), 'os.path.join', 'osp.join', (['CTRL_ROOT', '"""domain_data/atari_roms/space_invaders.bin"""'], {}), "(CTRL_ROOT, 'domain_data/atari_roms/space_invaders.bin')\n", (132, 188), True, 'import os.path as osp\n'), ((276, 298), 'numpy.array', 'np.array', (['[0]', '"""uint8"""'], {}), "([0], 'uint8')\n", (284, 29... |
#!/usr/bin/env python3
import json
import sys
import numpy as np
import cv2
import math
import time
from collections import namedtuple
from cscore import CameraServer
from networktables import NetworkTables
# Magic Numbers
lowerGreen = (50, 120, 130) # Our Robot's Camera
higherGreen = (100, 220, 220)
minContourArea ... | [
"networktables.NetworkTables.getTable",
"networktables.NetworkTables.flush",
"json.dumps",
"cv2.boxPoints",
"numpy.mean",
"cv2.minAreaRect",
"cv2.inRange",
"cv2.line",
"cv2.contourArea",
"cv2.cvtColor",
"networktables.NetworkTables.setUpdateRate",
"math.isnan",
"numpy.int0",
"networktables... | [((609, 663), 'collections.namedtuple', 'namedtuple', (['"""CameraConfig"""', "['name', 'path', 'config']"], {}), "('CameraConfig', ['name', 'path', 'config'])\n", (619, 663), False, 'from collections import namedtuple\n'), ((1154, 1180), 'cscore.CameraServer.getInstance', 'CameraServer.getInstance', ([], {}), '()\n', ... |
#!/usr/bin/python
import os.path
import os
import glob
import subprocess
import numpy as np
import numpy.lib.recfunctions as rfn
from astropy.io import fits
from astropy.stats import bayesian_blocks
import argparse
from collections import defaultdict
def checkDatFile(datFileName):
if not os.path.isfile(datFileNa... | [
"numpy.load",
"numpy.random.seed",
"argparse.ArgumentParser",
"astropy.stats.bayesian_blocks",
"numpy.argmax",
"numpy.abs",
"numpy.core.records.fromarrays",
"collections.defaultdict",
"os.path.isfile",
"os.path.join",
"subprocess.check_call",
"numpy.copy",
"numpy.power",
"numpy.savetxt",
... | [((1234, 1251), 'numpy.zeros', 'np.zeros', (['n_steps'], {}), '(n_steps)\n', (1242, 1251), True, 'import numpy as np\n'), ((1269, 1311), 'numpy.linspace', 'np.linspace', (['min_prior', 'max_prior', 'n_steps'], {}), '(min_prior, max_prior, n_steps)\n', (1280, 1311), True, 'import numpy as np\n'), ((1451, 1484), 'numpy.a... |
import sys
import numpy as np
from mayavi import mlab
from mayavi.scripts import mayavi2
from traits.api import HasTraits, Button, Instance
from traitsui.api import View, Item
from ._plot3d import plot3d_embeddings
def plot3d_gmphd(dataset, embeddings, grid, gm_s=None, gm_list=None,
observation=None,... | [
"sys.stdout.write",
"mayavi.mlab.colorbar",
"traits.api.Button",
"mayavi.mlab.show",
"mayavi.mlab.draw",
"numpy.zeros",
"numpy.ones",
"mayavi.mlab.points3d",
"numpy.finfo",
"traitsui.api.Item",
"mayavi.mlab.contour3d",
"numpy.block"
] | [((2505, 2611), 'mayavi.mlab.contour3d', 'mlab.contour3d', (['grid[0]', 'grid[1]', 'grid[2]', 'contour_s'], {'contours': 'contours', 'transparent': '(True)', 'opacity': '(0.5)'}), '(grid[0], grid[1], grid[2], contour_s, contours=contours,\n transparent=True, opacity=0.5)\n', (2519, 2611), False, 'from mayavi import ... |
import numpy as np
def gauss2D(x, y, fwhmx, fwhmy, x0=0, y0=0, offset=0, order=1, int_FWHM=True):
"""
Define a (super-)Gaussian 2D beam. Identical to laser.misc.gauss2D.
Parameters
----------
x: float 2D np.array
Horizontal axis of the Gaussian
y: float 2D np.array
Vertical a... | [
"numpy.angle",
"numpy.abs",
"numpy.log",
"numpy.linspace"
] | [((2122, 2142), 'numpy.abs', 'np.abs', (['(x + 1.0j * y)'], {}), '(x + 1.0j * y)\n', (2128, 2142), True, 'import numpy as np\n'), ((2142, 2164), 'numpy.angle', 'np.angle', (['(x + 1.0j * y)'], {}), '(x + 1.0j * y)\n', (2150, 2164), True, 'import numpy as np\n'), ((2606, 2630), 'numpy.linspace', 'np.linspace', (['(0)', ... |
#!/usr/bin/env python
from typing import Optional
import datetime
import logging
import pathlib
import cv2
import numpy as np
import yacs.config
from gaze_estimation.gaze_estimator.common import (Face, FacePartsName,
Visualizer)
from gaze_estimation.utils import lo... | [
"os.mkdir",
"helper_fn.calc_metrics",
"cv2.VideoWriter_fourcc",
"draw_utils.display_canv",
"pathlib.Path",
"numpy.random.randint",
"numpy.mean",
"imutils.resize",
"cv2.imshow",
"gaze_estimation.gaze_estimator.common.Visualizer",
"cv2.undistort",
"gaze_estimation.utils.load_config",
"helper_f... | [((395, 434), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (414, 434), False, 'import logging\n'), ((444, 471), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (461, 471), False, 'import logging\n'), ((1148, 1174), 'numpy.zeros', ... |
import numpy as np
from openmdao.main.api import Component
from openmdao.lib.datatypes.api import Float, Array
class KSfunction(object):
"""Helper class that can be used inside other components to aggregate constraint
vectors with a KS function."""
def compute(self, g, rho=50):
"""Gets the va... | [
"numpy.sum",
"numpy.log",
"openmdao.lib.datatypes.api.Float",
"numpy.max",
"numpy.exp"
] | [((1169, 1235), 'openmdao.lib.datatypes.api.Float', 'Float', (['(0.1)'], {'iotype': '"""in"""', 'desc': '"""Hyperparameter for the KS function"""'}), "(0.1, iotype='in', desc='Hyperparameter for the KS function')\n", (1174, 1235), False, 'from openmdao.lib.datatypes.api import Float, Array\n'), ((1277, 1342), 'openmdao... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
from __future__ import division
import finite_difference as fd
import numpy as np
def rtm1d(v,seis,dt,dz):
nt = len(seis)
nx = len(v)
a = fd.alpha(v,dt,dz)
ul, u, up = np.zeros((3,nx))
data = np.zeros((nt,nx))
g = np.zeros(u.shape)
g[0] = 1... | [
"numpy.copy",
"finite_difference.abc1D",
"numpy.zeros",
"numpy.arange",
"finite_difference.alpha"
] | [((202, 221), 'finite_difference.alpha', 'fd.alpha', (['v', 'dt', 'dz'], {}), '(v, dt, dz)\n', (210, 221), True, 'import finite_difference as fd\n'), ((236, 253), 'numpy.zeros', 'np.zeros', (['(3, nx)'], {}), '((3, nx))\n', (244, 253), True, 'import numpy as np\n'), ((264, 282), 'numpy.zeros', 'np.zeros', (['(nt, nx)']... |
from scipy.io import loadmat
import tables
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os, os.path
import time
import scipy.signal
from scipy import signal
from lmfit import minimize, Parameters
import scipy.optimize as optimization
import operator
class temperature_preprocessing_extr... | [
"pandas.DataFrame",
"numpy.abs",
"scipy.signal.filtfilt",
"numpy.fft.fft",
"numpy.angle",
"numpy.zeros",
"numpy.max",
"lmfit.minimize",
"numpy.array",
"numpy.min",
"numpy.sin",
"operator.itemgetter",
"scipy.signal.butter",
"lmfit.Parameters"
] | [((819, 882), 'scipy.signal.butter', 'signal.butter', (['order', 'normal_cutoff'], {'btype': '"""high"""', 'analog': '(False)'}), "(order, normal_cutoff, btype='high', analog=False)\n", (832, 882), False, 'from scipy import signal\n'), ((1041, 1068), 'scipy.signal.filtfilt', 'signal.filtfilt', (['b', 'a', 'data'], {}),... |
# Copyright (c) 2020 Foundry.
#
# 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,... | [
"tensorflow.image.rgb_to_grayscale",
"models.common.util.print_",
"tensorflow.compat.v1.disable_eager_execution",
"tensorflow.histogram_fixed_width",
"tensorflow.divide",
"os.path.join",
"message_pb2.FieldValuePairAttrib",
"tensorflow.compat.v1.placeholder",
"tensorflow.stack",
"tensorflow.compat.... | [((802, 840), 'tensorflow.compat.v1.disable_eager_execution', 'tf.compat.v1.disable_eager_execution', ([], {}), '()\n', (838, 840), True, 'import tensorflow as tf\n'), ((1405, 1442), 'os.path.join', 'os.path.join', (['dir_path', '"""checkpoints"""'], {}), "(dir_path, 'checkpoints')\n", (1417, 1442), False, 'import os\n... |
import json
import numpy as np
import os
import skimage
def save_np_arrays(images, img_names, save_path):
for img, img_name in zip(images, img_names):
np.save(f'{save_path}/{img_name}', img)
def load_np_arrays(path, num=None):
images = []
img_names = sorted(os.listdir(path))
if nu... | [
"json.dump",
"numpy.load",
"numpy.save",
"json.load",
"os.makedirs",
"os.path.isdir",
"os.path.dirname",
"numpy.array",
"os.listdir",
"skimage.io.imread"
] | [((513, 529), 'numpy.array', 'np.array', (['images'], {}), '(images)\n', (521, 529), True, 'import numpy as np\n'), ((2242, 2267), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (2257, 2267), False, 'import os\n'), ((164, 203), 'numpy.save', 'np.save', (['f"""{save_path}/{img_name}"""', 'img'... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import time
import numpy as np
import torch
import torch.utils.data
from optimization.training import evaluate, plot_samples
from utils.load_data import load_dataset
from os.path import join
parser = argparse.ArgumentParser(description='P... | [
"torch.cuda.synchronize",
"optimization.training.evaluate",
"argparse.ArgumentParser",
"torch.load",
"torch.cuda.device_count",
"time.time",
"numpy.mean",
"torch.cuda.is_available",
"optimization.training.plot_samples",
"torch.nn.DataParallel",
"torch.no_grad",
"os.path.join",
"utils.load_da... | [((282, 355), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch Discrete Normalizing flows"""'}), "(description='PyTorch Discrete Normalizing flows')\n", (305, 355), False, 'import argparse\n'), ((869, 894), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (89... |
import numpy as np
from manimlib import *
class Quaternion:
def __init__(self, x=None, y=0, z=0, w=1):
"""Quaternion style [x, y, z, w]"""
if issubclass(type(x), (np.ndarray, list, tuple)):
self._x = x[0]
self._y = x[1]
self._z = x[2]
self._w = x[3]
... | [
"numpy.cross",
"numpy.sin",
"numpy.linalg.norm",
"numpy.array",
"numpy.cos"
] | [((3676, 3695), 'numpy.array', 'np.array', (['[1, 1, 1]'], {}), '([1, 1, 1])\n', (3684, 3695), True, 'import numpy as np\n'), ((499, 536), 'numpy.array', 'np.array', (['[self._x, self._y, self._z]'], {}), '([self._x, self._y, self._z])\n', (507, 536), True, 'import numpy as np\n'), ((555, 586), 'numpy.array', 'np.array... |
import matplotlib.pyplot as plt
import cv2
#import imutils
import requests
import base64
import json
import numpy as np
from PIL import Image
from PIL import ImageEnhance
from skimage import color, data, restoration
from scipy.signal import convolve2d
import pytesseract
import PIL.ImageOps
pytesseract.pytesseract.tess... | [
"cv2.GaussianBlur",
"PIL.ImageEnhance.Brightness",
"cv2.bitwise_and",
"cv2.approxPolyDP",
"cv2.arcLength",
"cv2.adaptiveThreshold",
"cv2.bilateralFilter",
"cv2.imshow",
"cv2.cvtColor",
"numpy.max",
"cv2.drawContours",
"cv2.destroyAllWindows",
"cv2.resize",
"cv2.Canny",
"cv2.waitKey",
"... | [((428, 461), 'cv2.imread', 'cv2.imread', (['img', 'cv2.IMREAD_COLOR'], {}), '(img, cv2.IMREAD_COLOR)\n', (438, 461), False, 'import cv2\n'), ((472, 499), 'cv2.resize', 'cv2.resize', (['img', '(600, 400)'], {}), '(img, (600, 400))\n', (482, 499), False, 'import cv2\n'), ((510, 537), 'cv2.resize', 'cv2.resize', (['img',... |
import sys
import gym
import numpy as np
import gym.spaces
import math
import pandas as pd
df = pd.read_csv('./logs.csv', sep=',')
df = df.sample(frac=1)
def getData(line, keyNum):
if keyNum == 0: # vec
vec = str(df.iloc[line, 0])
v = np.zeros(11, dtype=np.float32)
for i in range(11):
... | [
"pandas.read_csv",
"gym.spaces.Discrete",
"math.floor",
"numpy.zeros",
"gym.spaces.Box"
] | [((97, 131), 'pandas.read_csv', 'pd.read_csv', (['"""./logs.csv"""'], {'sep': '""","""'}), "('./logs.csv', sep=',')\n", (108, 131), True, 'import pandas as pd\n'), ((259, 289), 'numpy.zeros', 'np.zeros', (['(11)'], {'dtype': 'np.float32'}), '(11, dtype=np.float32)\n', (267, 289), True, 'import numpy as np\n'), ((620, 6... |
# -*- coding: utf-8 -*-
"""
@file
@brief Generates random answers for challenges.
"""
import os
import numpy
import pandas
def random_answers_2020_images():
"""
Generates random answers the deep learning challenge of
hackathons :ref:`l-hackathon-2020`.
"""
name = os.path.join(os.path.split(__file_... | [
"pandas.read_csv",
"numpy.random.randint",
"numpy.arange",
"numpy.random.random",
"os.path.split"
] | [((417, 473), 'numpy.random.randint', 'numpy.random.randint', ([], {'low': '(0)', 'high': '(2)', 'size': '(df.shape[0],)'}), '(low=0, high=2, size=(df.shape[0],))\n', (437, 473), False, 'import numpy\n'), ((493, 528), 'numpy.random.random', 'numpy.random.random', (['(df.shape[0],)'], {}), '((df.shape[0],))\n', (512, 52... |
#!/usr/bin/env python
# Copyright (c) 2021 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Here are defined all the CARLA sensors
"""
import copy
import math
import... | [
"copy.deepcopy",
"numpy.flip",
"math.sqrt",
"numpy.dtype",
"numpy.zeros",
"numpy.array",
"numpy.reshape",
"carla.Rotation",
"carla.Location"
] | [((3460, 3521), 'numpy.reshape', 'np.reshape', (['array', '(sensor_data.height, sensor_data.width, 4)'], {}), '(array, (sensor_data.height, sensor_data.width, 4))\n', (3470, 3521), True, 'import numpy as np\n'), ((4610, 4678), 'numpy.zeros', 'np.zeros', (['(sensor_data.height, sensor_data.width, 3)'], {'dtype': 'np.uin... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from scipy.interpolate import interp2d
from scipy.ndimage import convolve1d
from PIL import Image
c = 299792.0 # um/ns
class Ray:
def __init__(self, lambda0: "um" = .532,
pulse_length: "ns" = 10, radius:... | [
"numpy.fft.rfft",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.imag",
"numpy.sin",
"numpy.exp",
"numpy.zeros_like",
"numpy.meshgrid",
"numpy.fft.irfft",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"numpy.cumsum",
"numpy.apply_along_axis",
"numpy.linspace",
"numpy.real",
... | [((9115, 9131), 'numpy.zeros_like', 'np.zeros_like', (['t'], {}), '(t)\n', (9128, 9131), True, 'import numpy as np\n'), ((9778, 9794), 'numpy.zeros_like', 'np.zeros_like', (['t'], {}), '(t)\n', (9791, 9794), True, 'import numpy as np\n'), ((10530, 10560), 'PIL.Image.fromarray', 'Image.fromarray', (['ref'], {'mode': '""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.