code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import torch
import numpy as np
import torch.nn as nn
import cv2
from scipy import signal
import imageio
from PIL import Image
import os
import os.path as osp
import numbers
import math
from torch.nn import functional as F
'''
convert image to tensor and back
'''
img = imageio.imread(pth, pilmode='RG... | [
"numpy.random.normal",
"torch.nn.functional.pad",
"PIL.Image.fromarray",
"os.path.join",
"math.sqrt",
"torch.from_numpy",
"numpy.ascontiguousarray",
"torch.exp",
"PIL.Image.from_numpy",
"torch.arange",
"torch.sum",
"imageio.imread",
"torch.clamp"
] | [((289, 323), 'imageio.imread', 'imageio.imread', (['pth'], {'pilmode': '"""RGB"""'}), "(pth, pilmode='RGB')\n", (303, 323), False, 'import imageio\n'), ((804, 825), 'PIL.Image.from_numpy', 'Image.from_numpy', (['img'], {}), '(img)\n', (820, 825), False, 'from PIL import Image\n'), ((2836, 2879), 'torch.nn.functional.p... |
"""
Sugarscape Constant Growback Model
================================
Replication of the model found in Netlogo:
<NAME>. and <NAME>. (2009). NetLogo Sugarscape 2 Constant Growback model.
http://ccl.northwestern.edu/netlogo/models/Sugarscape2ConstantGrowback.
Center for Connected Learning and Computer-Based Modeling,... | [
"os.makedirs",
"mesa.space.MultiGrid",
"datetime.datetime.now",
"numpy.ndarray",
"numpy.genfromtxt"
] | [((1655, 1702), 'mesa.space.MultiGrid', 'MultiGrid', (['self.height', 'self.width'], {'torus': '(False)'}), '(self.height, self.width, torus=False)\n', (1664, 1702), False, 'from mesa.space import MultiGrid\n'), ((2133, 2167), 'numpy.genfromtxt', 'np.genfromtxt', (['"""src/sugar-map.txt"""'], {}), "('src/sugar-map.txt'... |
from collections.abc import Callable, Iterable, Mapping
from scipy.sparse import csr_matrix, csc_matrix
from scipy.sparse.linalg import expm
import cupy as cp
import math
import neuwon.species.voronoi
import numba.cuda
import numpy as np
F = 96485.3321233100184 # Faraday's constant, Coulombs per Mole of electrons
R = ... | [
"numpy.abs",
"cupy.get_array_module",
"numpy.array",
"cupy.maximum",
"cupy.fuse",
"math.exp"
] | [((13008, 13017), 'cupy.fuse', 'cp.fuse', ([], {}), '()\n', (13015, 13017), True, 'import cupy as cp\n'), ((12327, 12368), 'cupy.get_array_module', 'cp.get_array_module', (['inside_concentration'], {}), '(inside_concentration)\n', (12346, 12368), True, 'import cupy as cp\n'), ((12606, 12647), 'cupy.get_array_module', '... |
"""
Module for running FaIR
"""
import logging
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
import numpy as np
from scmdata import ScmRun, run_append
from ...settings import config
from ..utils._parallel_process import _parallel_process
from ._compat import fair_scm
LOGGER = logging.getL... | [
"logging.getLogger",
"numpy.asarray",
"multiprocessing.cpu_count",
"numpy.sum",
"scmdata.run_append",
"numpy.vstack",
"concurrent.futures.ProcessPoolExecutor",
"numpy.arange"
] | [((308, 335), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (325, 335), False, 'import logging\n'), ((1550, 1565), 'scmdata.run_append', 'run_append', (['res'], {}), '(res)\n', (1560, 1565), False, 'from scmdata import ScmRun, run_append\n'), ((9283, 9306), 'numpy.sum', 'np.sum', (['forc... |
"""Uses Mk4py, aka metakit.
Python bindings are native-compiled: http://equi4.com/metakit/python.html
"""
from __future__ import print_function, absolute_import
import Mk4py
import numpy as np
import os
import struct
import zlib
from argparse import ArgumentParser
from construct import (
Struct, Int64ul, Array, Con... | [
"numpy.column_stack",
"numpy.array",
"construct.Const",
"construct.Adapter.__init__",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"construct.Array",
"zlib.decompress",
"struct.unpack",
"construct.Struct",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show",
"construct.GreedyRange",... | [((4705, 4726), 'construct.GreedyRange', 'GreedyRange', (['Property'], {}), '(Property)\n', (4716, 4726), False, 'from construct import Struct, Int64ul, Array, Const, Float64l, Int32sl, Int16ul, Switch, Int32ul, Bytes, Padding, Adapter, Container, GreedyRange, IfThenElse, Peek, Embedded, ExprAdapter, this\n'), ((3699, ... |
'''
This program is not working completely I'm sorry about it because it's my fault.
This program have to worked for Count the greenPixels on webcam but it is not working very well.
Thank you
Sincerely,
<NAME>
'''
import cv2
import numpy as np
class greenfinder():
img = cv2.VideoCapture(0)
lower... | [
"cv2.inRange",
"cv2.imshow",
"numpy.array",
"cv2.bitwise_or",
"cv2.VideoCapture",
"cv2.waitKey"
] | [((286, 305), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (302, 305), False, 'import cv2\n'), ((329, 353), 'numpy.array', 'np.array', (['[45, 100, 100]'], {}), '([45, 100, 100])\n', (337, 353), True, 'import numpy as np\n'), ((377, 401), 'numpy.array', 'np.array', (['[75, 255, 255]'], {}), '([75, 25... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
# For reproducibility
np.random.seed(1000)
if __name__ == '__main__':
# Load MNIST digits
digits = load_digits()
# Show some random dig... | [
"sklearn.decomposition.PCA",
"sklearn.datasets.load_digits",
"numpy.random.randint",
"numpy.random.seed",
"numpy.cumsum",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((193, 213), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (207, 213), True, 'import numpy as np\n'), ((279, 292), 'sklearn.datasets.load_digits', 'load_digits', ([], {}), '()\n', (290, 292), False, 'from sklearn.datasets import load_digits\n'), ((340, 376), 'numpy.random.randint', 'np.random.ra... |
import time
import cv2
import numpy as np
from ..openvino_base.base_model import Base
EMOTION_STATES = ("neutral", "happy", "sad", "surprise", "anger")
class Emotions(Base):
"""Class for the Emotions Recognition Model."""
def __init__(
self,
model_name,
source_width=None,
s... | [
"numpy.vstack",
"numpy.argmax"
] | [((846, 866), 'numpy.argmax', 'np.argmax', (['emo_state'], {}), '(emo_state)\n', (855, 866), True, 'import numpy as np\n'), ((757, 785), 'numpy.vstack', 'np.vstack', (['inference_results'], {}), '(inference_results)\n', (766, 785), True, 'import numpy as np\n')] |
from manimlib.imports import *
import numpy as np
import bats
# slide scene
from manim_reveal import SlideScene
# manim interface with bats
from manimtda import *
import matplotlib
from scipy.spatial import ConvexHull
def gen_circle2(n, r=1.0):
theta = np.linspace(0, 2*np.pi*(1 - 1./n), n)
pts = np.array([r*... | [
"numpy.random.normal",
"numpy.mean",
"bats.bivariate_cover",
"bats.Matrix",
"bats.Nerve",
"bats.LInfDist",
"scipy.spatial.ConvexHull",
"numpy.array",
"numpy.linspace",
"bats.Euclidean",
"bats.F2",
"numpy.cos",
"numpy.zeros",
"numpy.random.uniform",
"numpy.sin"
] | [((260, 304), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi * (1 - 1.0 / n))', 'n'], {}), '(0, 2 * np.pi * (1 - 1.0 / n), n)\n', (271, 304), True, 'import numpy as np\n'), ((476, 530), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-scale)', 'high': 'scale', 'size': '(n, 2)'}), '(low=-scale, high=s... |
import unittest
import numpy as np
from pecanpy.graph import BaseGraph, AdjlstGraph, SparseGraph, DenseGraph
MAT = np.array([[0, 1, 1], [1, 0, 0], [1, 0, 0]], dtype=float)
INDPTR = np.array([0, 2, 3, 4], dtype=np.uint32)
INDICES = np.array([1, 2, 0, 0], dtype=np.uint32)
DATA = np.array([1.0, 1.0, 1.0, 1.0], dtype=np.... | [
"numpy.all",
"pecanpy.graph.DenseGraph.from_mat",
"pecanpy.graph.AdjlstGraph.from_mat",
"numpy.array",
"pecanpy.graph.BaseGraph",
"unittest.main",
"pecanpy.graph.SparseGraph.from_mat"
] | [((117, 173), 'numpy.array', 'np.array', (['[[0, 1, 1], [1, 0, 0], [1, 0, 0]]'], {'dtype': 'float'}), '([[0, 1, 1], [1, 0, 0], [1, 0, 0]], dtype=float)\n', (125, 173), True, 'import numpy as np\n'), ((183, 222), 'numpy.array', 'np.array', (['[0, 2, 3, 4]'], {'dtype': 'np.uint32'}), '([0, 2, 3, 4], dtype=np.uint32)\n', ... |
from matplotlib import pyplot as plt
import numpy as np
from math import cos, sin, atan
class Neuron():
def __init__(self, x, y, weight=[]):
self.x = x
self.y = y
if weight: self.weight = weight
def draw(self,texter):
circle = plt.Circle((self.x, self.y), radius=neuron_radius, ... | [
"matplotlib.pyplot.text",
"matplotlib.pyplot.Circle",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.gca",
"numpy.size",
"math.cos",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.Line2D",
"matplotlib.pyplot.axis",
"math.sin",
"matplo... | [((269, 331), 'matplotlib.pyplot.Circle', 'plt.Circle', (['(self.x, self.y)'], {'radius': 'neuron_radius', 'fill': '(False)'}), '((self.x, self.y), radius=neuron_radius, fill=False)\n', (279, 331), True, 'from matplotlib import pyplot as plt\n'), ((347, 425), 'matplotlib.pyplot.annotate', 'plt.annotate', (['texter', '(... |
"""
.. module:: magneticSensor
:synopsis: Magnetic sensor reader
.. moduleauthor:: <NAME> <<EMAIL>>
Data reader for Arduino controlled magnetic field sensor
"""
__author__ = '<NAME>'
import time
import numpy as np
from serial.serialutil import SerialException
from labtools.log import create_logger
from labtools... | [
"numpy.mean",
"serial.tools.list_ports.comports",
"time.sleep",
"numpy.append",
"numpy.array",
"serial.Serial",
"numpy.empty",
"labtools.utils.instr.InstrError",
"time.time",
"labtools.log.create_logger"
] | [((615, 648), 'labtools.log.create_logger', 'create_logger', (['__name__', 'LOGLEVEL'], {}), '(__name__, LOGLEVEL)\n', (628, 648), False, 'from labtools.log import create_logger\n'), ((923, 933), 'serial.tools.list_ports.comports', 'comports', ([], {}), '()\n', (931, 933), False, 'from serial.tools.list_ports import co... |
from __future__ import division
import numpy as np
from scipy.fftpack import fft, ifft
from mpl_toolkits.mplot3d.axes3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from math import sqrt, pi
def initialize_all(y0, t0, t1, n):
""" An initialization routine for the different ODE s... | [
"numpy.linspace",
"numpy.empty"
] | [((524, 546), 'numpy.linspace', 'np.linspace', (['t0', 't1', 'n'], {}), '(t0, t1, n)\n', (535, 546), True, 'import numpy as np\n'), ((482, 508), 'numpy.empty', 'np.empty', (['n'], {'dtype': 'complex'}), '(n, dtype=complex)\n', (490, 508), True, 'import numpy as np\n'), ((422, 459), 'numpy.empty', 'np.empty', (['(n, y0.... |
import numpy as np
import os, sys, random, copy
import torch
try:
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages')
except:
pass
from detectron2.structures import BoxMode
from detectron2.data import MetadataCatalog, DatasetCatalog
from detectron2.utils.visualizer import Visualizer
from detectron... | [
"numpy.tile",
"os.listdir",
"detectron2.data.build.build_detection_train_loader",
"data.cgrcnn_dataset_as_torch_loader.cgrcnn_dataset_torch",
"numpy.hstack",
"torch.utils.data.RandomSampler",
"sys.path.remove",
"detectron2.structures.Instances",
"numpy.array",
"detectron2.data.build.build_batch_da... | [((71, 134), 'sys.path.remove', 'sys.path.remove', (['"""/opt/ros/kinetic/lib/python2.7/dist-packages"""'], {}), "('/opt/ros/kinetic/lib/python2.7/dist-packages')\n", (86, 134), False, 'import os, sys, random, copy\n'), ((696, 716), 'os.listdir', 'os.listdir', (['img_path'], {}), '(img_path)\n', (706, 716), False, 'imp... |
import logging
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import model
import simulation
import complexity
import rateless
import plot
import stats
from math import log2
from evaluation.binsearch import SampleEvaluator
from evaluation import analytic
from solvers.heuristicsolver import Heur... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"math.log2",
"matplotlib.pyplot.semilogy",
"numpy.fromiter",
"plot.encode_decode_plot",
"numpy.searchsorted",
"matplotlib.pyplot.xlabel",
"stats.order_mean_shiftexp",
"matplotlib.pyplot.style.use",
"numpy.diff",
"simulation.simulate_parameter_list... | [((378, 401), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (391, 401), True, 'import matplotlib.pyplot as plt\n'), ((402, 437), 'matplotlib.pyplot.rc', 'plt.rc', (['"""pgf"""'], {'texsystem': '"""pdflatex"""'}), "('pgf', texsystem='pdflatex')\n", (408, 437), True, 'import matp... |
import numpy
import json
import os
import sys
import time
import sh_common
if len(sys.argv) != 2:
print("import_vgg7.py JSONPATH")
print(" i.e. import_vgg7.py /home/you/Documents/External/waifu2x/models/vgg_7/art/scale2.0x_model.json")
sys.exit(1)
try:
os.mkdir("model-kipper")
except:
pass
data_l... | [
"numpy.array",
"sh_common.save_param",
"os.mkdir",
"sys.exit"
] | [((249, 260), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (257, 260), False, 'import sys\n'), ((271, 295), 'os.mkdir', 'os.mkdir', (['"""model-kipper"""'], {}), "('model-kipper')\n", (279, 295), False, 'import os\n'), ((422, 450), 'numpy.array', 'numpy.array', (["layer['weight']"], {}), "(layer['weight'])\n", (433,... |
# Import the standard modules
import sqlite3
import spiceypy
# Import the installed modules
import pandas as pd
import numpy as np
# Import matplotlib for plotting
from matplotlib import pyplot as plt
# Import scipy for the Kernel Density Estimator functionality
from scipy import stats
#%%
# Connect to the comet d... | [
"spiceypy.convrt",
"numpy.radians",
"spiceypy.oscltx",
"scipy.stats.gaussian_kde",
"sqlite3.connect",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"spiceypy.spkgeo",
"spiceypy.utc2et",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.rcParams.update",
"numpy.linspace",
"spiceypy.bodvcd",
"n... | [((454, 508), 'sqlite3.connect', 'sqlite3.connect', (['"""../_databases/_comets/mpc_comets.db"""'], {}), "('../_databases/_comets/mpc_comets.db')\n", (469, 508), False, 'import sqlite3\n'), ((706, 836), 'pandas.read_sql', 'pd.read_sql', (['"""SELECT NAME, SEMI_MAJOR_AXIS_AU, INCLINATION_DEG, ECCENTRICITY FROM comets_ma... |
# -*- coding: utf-8 -*-
"""
.. module:: hindex
:synopsis: Calculate the hindex.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import sys
import pandas as pd
import numpy as np
# determine if we are loading from a jupyter notebook (to make pretty progress bars)
if 'ipykernel' in sys.modules:
from tqdm.notebook imp... | [
"numpy.sort",
"tqdm.tqdm.pandas",
"numpy.arange"
] | [((1577, 1630), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {'desc': '"""Hindex"""', 'disable': '(not show_progress)'}), "(desc='Hindex', disable=not show_progress)\n", (1588, 1630), False, 'from tqdm import tqdm\n'), ((763, 784), 'numpy.arange', 'np.arange', (['a.shape[0]'], {}), '(a.shape[0])\n', (772, 784), True, 'impor... |
# author: <NAME>
# date: 2022-03-25
"""
Usage: single_linear_regression.py --xtrainpath=<xtrainpath> --ytrainpath=<ytrainpath> --preprocessorpath=<preprocessorpath> --bestalpha=<bestalpha> --path=<path>
Options:
--xtrainpath=<xtrainpath>: csv file previously saved in the previous script the training data for the x... | [
"pandas.read_pickle",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.cross_validate",
"matplotlib.pyplot.xlabel",
"sklearn.linear_model.Ridge",
"numpy.random.seed",
"matplotlib.pyplot.title",
"pandas.to_csv",
"docopt.docopt"
] | [((962, 977), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (968, 977), False, 'from docopt import docopt\n'), ((979, 997), 'numpy.random.seed', 'np.random.seed', (['(12)'], {}), '(12)\n', (993, 997), True, 'import numpy as np\n'), ((1320, 1392), 'sklearn.model_selection.cross_validate', 'cross_validate'... |
from matplotlib import pyplot
from mpl_toolkits import mplot3d
import struct
import numpy
class stl_object:
'''
stl_object() -> new empty stl_object
stl_object(triangles,normals,header,triangle_numbers) -> new stl_object
triangles: List of triangles (List) of 3 tupules, each tupule (x,y,z)... | [
"mpl_toolkits.mplot3d.art3d.Poly3DCollection",
"numpy.cross",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.dot",
"numpy.linalg.norm",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.show"
] | [((2856, 2871), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (2869, 2871), False, 'from matplotlib import pyplot\n'), ((3275, 3321), 'mpl_toolkits.mplot3d.art3d.Poly3DCollection', 'mplot3d.art3d.Poly3DCollection', (['self.triangles'], {}), '(self.triangles)\n', (3305, 3321), False, 'from mpl_toolkits ... |
import carla
import os
import sys
import cv2
import json
import numpy as np
CARLA_ROOT = os.getenv("CARLA_ROOT")
if CARLA_ROOT is None:
raise ValueError("CARLA_ROOT must be defined.")
scriptdir = CARLA_ROOT + "PythonAPI/"
sys.path.append(scriptdir)
from examples.synchronous_mode import CarlaSyncMode
scriptdir = ... | [
"scenarios.run_intersection_scenario.CarlaParams",
"scenarios.run_intersection_scenario.DroneVizParams",
"numpy.reshape",
"os.getenv",
"scenarios.run_intersection_scenario.RunIntersectionScenario",
"cv2.line",
"os.path.join",
"scenarios.run_intersection_scenario.PredictionParams",
"examples.synchron... | [((90, 113), 'os.getenv', 'os.getenv', (['"""CARLA_ROOT"""'], {}), "('CARLA_ROOT')\n", (99, 113), False, 'import os\n'), ((228, 254), 'sys.path.append', 'sys.path.append', (['scriptdir'], {}), '(scriptdir)\n', (243, 254), False, 'import sys\n'), ((385, 411), 'sys.path.append', 'sys.path.append', (['scriptdir'], {}), '(... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 00:01:29 2021
@author: lukepinkel
"""
import tqdm
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib as mpl
import scipy.sparse as sps
import matplotlib.pyplot as plt
from .model_matrices import (construct_model_matrices, make_theta, make_gc... | [
"numpy.product",
"numpy.linalg.matrix_rank",
"numpy.sqrt",
"numpy.linalg.pinv",
"numpy.hstack",
"sksparse.cholmod.cholesky",
"numpy.log",
"scipy.interpolate.interp1d",
"matplotlib.collections.LineCollection",
"numpy.array",
"numpy.argsort",
"numpy.einsum",
"numpy.linalg.norm",
"numpy.arang... | [((2005, 2029), 'scipy.sparse.csc_matrix', 'sp.sparse.csc_matrix', (['XZ'], {}), '(XZ)\n', (2025, 2029), True, 'import scipy as sp\n'), ((2125, 2155), 'scipy.sparse.bmat', 'sps.bmat', (['[[C, m], [m.T, yty]]'], {}), '([[C, m], [m.T, yty]])\n', (2133, 2155), True, 'import scipy.sparse as sps\n'), ((2545, 2564), 'scipy.s... |
import librosa
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Model
layer_name = 'global_max_pooling2d'
model = tf.keras.models.load_model('models/resnet.h5')
intermediate_layer_model = Model(inputs=model.input, outputs=model.get_layer(layer_name).output)
# 读取音频数据
def load_data(data_... | [
"librosa.feature.melspectrogram",
"numpy.array",
"numpy.dot",
"tensorflow.keras.models.load_model",
"numpy.linalg.norm",
"librosa.effects.split",
"librosa.load"
] | [((146, 192), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""models/resnet.h5"""'], {}), "('models/resnet.h5')\n", (172, 192), True, 'import tensorflow as tf\n'), ((341, 374), 'librosa.load', 'librosa.load', (['data_path'], {'sr': '(16000)'}), '(data_path, sr=16000)\n', (353, 374), False, 'im... |
#!/usr/bin/env python
import numpy as np
from spt3g import core
from spt3g.maps import FlatSkyMap, MapProjection, get_ra_dec_map, get_map_stats, get_map_median
from scipy.stats import skew, kurtosis
# Sparse extension operators
m = FlatSkyMap(500, 20, core.G3Units.arcmin)
m[7345] = 4
m[7345-500] = 4 # Backward
m[7345... | [
"scipy.signal.convolve2d",
"numpy.mean",
"numpy.allclose",
"numpy.median",
"numpy.ones",
"spt3g.maps.get_map_median",
"scipy.stats.kurtosis",
"spt3g.maps.get_ra_dec_map",
"numpy.asarray",
"spt3g.maps.convolve_map",
"spt3g.maps.FlatSkyMap",
"scipy.stats.skew",
"numpy.array",
"numpy.isfinite... | [((234, 274), 'spt3g.maps.FlatSkyMap', 'FlatSkyMap', (['(500)', '(20)', 'core.G3Units.arcmin'], {}), '(500, 20, core.G3Units.arcmin)\n', (244, 274), False, 'from spt3g.maps import FlatSkyMap, MapProjection, get_ra_dec_map, get_map_stats, get_map_median\n'), ((645, 685), 'spt3g.maps.FlatSkyMap', 'FlatSkyMap', (['(500)',... |
# Copyright 2018 The GamePad Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
"numpy.mean",
"json.loads",
"coq.constr_util.COQEXP_HIST.merges",
"scipy.stats.kurtosis",
"scipy.stats.moment",
"coq.tactics.TACTIC_HIST.view",
"lib.myutil.inc_update",
"coq.tactics.TACTIC_HIST.merge",
"coq.tactics.TACTIC_HIST.empty",
"coq.constr_util.COQEXP_HIST.view"
] | [((2785, 2796), 'numpy.mean', 'np.mean', (['ls'], {}), '(ls)\n', (2792, 2796), True, 'import numpy as np\n'), ((2861, 2877), 'scipy.stats.kurtosis', 'sps.kurtosis', (['ls'], {}), '(ls)\n', (2873, 2877), True, 'import scipy.stats as sps\n'), ((3264, 3283), 'coq.tactics.TACTIC_HIST.empty', 'TACTIC_HIST.empty', ([], {}), ... |
# Renishaw wdf Raman spectroscopy file reader
# Code inspired by Henderson, Alex DOI:10.5281/zenodo.495477
from __future__ import print_function
import struct
import numpy
import io
from .types import LenType, DataType, MeasurementType
from .types import ScanType, UnitType, DataType
from .types import Offsets, ExifTags... | [
"numpy.abs",
"numpy.fromfile",
"PIL.Image.open",
"numpy.isclose",
"numpy.reshape",
"io.BytesIO",
"numpy.array",
"numpy.zeros",
"numpy.nonzero",
"numpy.min"
] | [((10511, 10569), 'numpy.fromfile', 'numpy.fromfile', (['self.file_obj'], {'dtype': '"""float32"""', 'count': 'size'}), "(self.file_obj, dtype='float32', count=size)\n", (10525, 10569), False, 'import numpy\n'), ((11369, 11459), 'numpy.fromfile', 'numpy.fromfile', (['self.file_obj'], {'dtype': '"""float32"""', 'count':... |
import argparse
import numpy as np
import torch
import os
class AverageMeter(object):
def __init__(self) -> None:
self.reset()
def reset(self) -> None:
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val: float, n: int = 1) -> None:
... | [
"torch.manual_seed",
"torch.cuda.manual_seed",
"numpy.random.seed",
"argparse.ArgumentParser"
] | [((467, 487), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (481, 487), True, 'import numpy as np\n'), ((492, 515), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (509, 515), False, 'import torch\n'), ((520, 548), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['seed'],... |
import pandas as pd
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
import os
import math
np.set_printoptions(precision=3, suppress=False)
if not os.path.exists("Slike"):
os.mkdir("Slike")
def line_fit(x, k, l):
return k*x + l
def rolling_median(mase, br_dana):
br_mj = int(l... | [
"os.path.exists",
"plotly.io.write_image",
"numpy.mean",
"pandas.read_csv",
"numpy.polyfit",
"math.isnan",
"numpy.array",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Scatter",
"os.mkdir",
"numpy.set_printoptions"
] | [((120, 168), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)', 'suppress': '(False)'}), '(precision=3, suppress=False)\n', (139, 168), True, 'import numpy as np\n'), ((688, 711), 'pandas.read_csv', 'pd.read_csv', (['"""masa.csv"""'], {}), "('masa.csv')\n", (699, 711), True, 'import pandas as p... |
"""
Q3: Fourier filtering and smoothing
Plot the actual data, then calculate Fourier coefficients
Then plot the transformed data
"""
import numpy as np
import matplotlib.pyplot as plt
# import the Dow data
dow = np.loadtxt("dow.txt", float)
# plot it all onto a graph
dow_l = np.arange(len(dow))
plt.figure(1)
plt.ti... | [
"numpy.copy",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.fft.irfft",
"numpy.fft.rfft",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"numpy.loadtxt",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((214, 242), 'numpy.loadtxt', 'np.loadtxt', (['"""dow.txt"""', 'float'], {}), "('dow.txt', float)\n", (224, 242), True, 'import numpy as np\n'), ((300, 313), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (310, 313), True, 'import matplotlib.pyplot as plt\n'), ((314, 362), 'matplotlib.pyplot.title',... |
import os.path as osp
from data_generator.object_detection_2d_data_generator import DataGenerator
from data_generator.data_augmentation_chain_constant_input_size import DataAugmentationConstantInputSize
from ssd_encoder_decoder.ssd_input_encoder import SSDInputEncoder
from bounding_box_utils.bounding_box_utils import c... | [
"cv2.rectangle",
"data_generator.data_augmentation_chain_constant_input_size.DataAugmentationConstantInputSize",
"data_generator.object_detection_2d_data_generator.DataGenerator",
"numpy.round",
"os.path.join",
"cv2.imshow",
"cv2.putText",
"bounding_box_utils.bounding_box_utils.convert_coordinates",
... | [((386, 454), 'data_generator.object_detection_2d_data_generator.DataGenerator', 'DataGenerator', ([], {'load_images_into_memory': '(False)', 'hdf5_dataset_path': 'None'}), '(load_images_into_memory=False, hdf5_dataset_path=None)\n', (399, 454), False, 'from data_generator.object_detection_2d_data_generator import Data... |
from __future__ import print_function
import numpy as np
import regreg.api as rr
from selection.tests.decorators import wait_for_return_value, register_report, set_sampling_params_iftrue
import selection.tests.reports as reports
from selection.tests.flags import SMALL_SAMPLES
from selection.api import multiple_queri... | [
"numpy.sqrt",
"selection.api.glm_target",
"numpy.arange",
"numpy.random.binomial",
"selection.tests.reports.pivot_plot",
"selection.api.multiple_queries",
"selection.randomized.glm.split_glm_group_lasso",
"numpy.where",
"regreg.api.glm.logistic",
"selection.tests.decorators.wait_for_return_value",... | [((518, 595), 'selection.tests.decorators.register_report', 'register_report', (["['mle', 'truth', 'pvalue', 'cover', 'naive_cover', 'active']"], {}), "(['mle', 'truth', 'pvalue', 'cover', 'naive_cover', 'active'])\n", (533, 595), False, 'from selection.tests.decorators import wait_for_return_value, register_report, se... |
import random
import cv2
from torchvision import transforms
import torchvision.transforms.functional as ttf
from PIL import Image
import matplotlib.pyplot as plt
import numpy as np
import os
import PIL
def makecon():
path1 = "./dataset/DRIVE/test/1st_manual/"
path2 = "./dataset/DRIVE/... | [
"numpy.array",
"PIL.Image.fromarray",
"PIL.Image.open"
] | [((706, 731), 'PIL.Image.open', 'PIL.Image.open', (['img1_path'], {}), '(img1_path)\n', (720, 731), False, 'import PIL\n'), ((756, 781), 'PIL.Image.open', 'PIL.Image.open', (['img2_path'], {}), '(img2_path)\n', (770, 781), False, 'import PIL\n'), ((1313, 1327), 'numpy.array', 'np.array', (['img1'], {}), '(img1)\n', (13... |
from sklearn.externals import joblib
import numpy as np
np.random.seed(1337)
def gen_data(pos, neg, niter=100):
n = pos.shape[0]
nn = neg.shape[0]
pos_lst = []
neg_lst = []
for i in range(niter):
idx_pos = np.random.choice(range(n), size=n * 2, replace=True)
idx_neg = np.random.ch... | [
"sklearn.externals.joblib.load",
"numpy.random.seed",
"sklearn.externals.joblib.dump"
] | [((57, 77), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (71, 77), True, 'import numpy as np\n'), ((487, 517), 'sklearn.externals.joblib.load', 'joblib.load', (['"""data/sg_div.pkl"""'], {}), "('data/sg_div.pkl')\n", (498, 517), False, 'from sklearn.externals import joblib\n'), ((526, 550), 'skl... |
import json
from twisted.logger import Logger
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
from autobahn.twisted.wamp import ApplicationRunner
from bokeh.client import push_session
from bokeh.plotting import figure, curdoc
from bokeh.models.widgets import Pan... | [
"json.loads",
"bokeh.models.Range1d",
"autobahn.twisted.wamp.ApplicationRunner",
"numpy.array",
"autobahn.twisted.wamp.ApplicationSession.__init__",
"pandas.DataFrame",
"bokeh.plotting.curdoc"
] | [((4273, 4339), 'autobahn.twisted.wamp.ApplicationRunner', 'ApplicationRunner', ([], {'url': 'u"""ws://localhost:55058/ws"""', 'realm': 'u"""realm1"""'}), "(url=u'ws://localhost:55058/ws', realm=u'realm1')\n", (4290, 4339), False, 'from autobahn.twisted.wamp import ApplicationRunner\n'), ((492, 533), 'autobahn.twisted.... |
from __future__ import division, absolute_import, print_function
import unittest
import numpy.testing as testing
import numpy as np
import healpy as hp
import healsparse
class CoverageMapTestCase(unittest.TestCase):
def test_coverage_map_float(self):
"""
Test coverage_map functionality for floats... | [
"numpy.testing.assert_warns",
"healsparse.utils.check_sentinel",
"numpy.testing.assert_array_almost_equal",
"numpy.unique",
"healsparse.HealSparseMap",
"numpy.ones",
"healsparse.HealSparseMap.make_empty",
"healpy.nside2npix",
"unittest.main"
] | [((5839, 5854), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5852, 5854), False, 'import unittest\n'), ((750, 827), 'healsparse.HealSparseMap', 'healsparse.HealSparseMap', ([], {'healpix_map': 'full_map', 'nside_coverage': 'nside_coverage'}), '(healpix_map=full_map, nside_coverage=nside_coverage)\n', (774, 827)... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
DATE:19/04/2020
Information theory and coding
Title:(7,4) systematic cyclic codes Encoder
Author:<NAME>
17BEC02
IIIT Dharwad
"""
######################### ENCODER ######################################################
import numpy as np
import pandas as pd
... | [
"numpy.polymul",
"numpy.polydiv",
"numpy.polyadd",
"numpy.poly1d",
"numpy.mod"
] | [((583, 596), 'numpy.poly1d', 'np.poly1d', (['ip'], {}), '(ip)\n', (592, 596), True, 'import numpy as np\n'), ((603, 619), 'numpy.poly1d', 'np.poly1d', (['gen_p'], {}), '(gen_p)\n', (612, 619), True, 'import numpy as np\n'), ((719, 747), 'numpy.polymul', 'np.polymul', (['[1, 0, 0, 0]', 'ip'], {}), '([1, 0, 0, 0], ip)\n... |
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import cv2
from detection_functions.feature_extraction import *
from toolbox.draw_on_image import *
from detection_functions.sliding_window import *
# Define a function to extract features from a single image window
# This function... | [
"numpy.copy",
"numpy.array",
"numpy.int",
"numpy.concatenate",
"cv2.cvtColor",
"cv2.GaussianBlur",
"numpy.zeros_like"
] | [((7344, 7363), 'numpy.array', 'np.array', (['bbox_list'], {}), '(bbox_list)\n', (7352, 7363), True, 'import numpy as np\n'), ((7723, 7742), 'numpy.array', 'np.array', (['bbox_list'], {}), '(bbox_list)\n', (7731, 7742), True, 'import numpy as np\n'), ((854, 866), 'numpy.copy', 'np.copy', (['img'], {}), '(img)\n', (861,... |
import math
import copy
import warnings
import numpy as np
from itertools import product
from analysis.abstract_interpretation import AbstractInterpretation
import parse.parse_format_text as parse_format_text
from solver import Range, Array
from utils import OVERFLOW_LIMIT, UNDERFLOW_LIMIT, resolve_type
turn_on_bool ... | [
"math.floor",
"solver.Range",
"numpy.int32",
"numpy.log",
"math.sqrt",
"math.log",
"numpy.array",
"copy.deepcopy",
"analysis.abstract_interpretation.AbstractInterpretation",
"numpy.arange",
"numpy.reshape",
"itertools.product",
"numpy.tanh",
"numpy.max",
"numpy.exp",
"numpy.linspace",
... | [((1708, 1757), 'solver.Range', 'Range', ([], {'left': '(-OVERFLOW_LIMIT)', 'right': 'OVERFLOW_LIMIT'}), '(left=-OVERFLOW_LIMIT, right=OVERFLOW_LIMIT)\n', (1713, 1757), False, 'from solver import Range, Array\n'), ((1934, 1947), 'numpy.array', 'np.array', (['ans'], {}), '(ans)\n', (1942, 1947), True, 'import numpy as n... |
"""Create an icosphere from convex regular polyhedron.
Adapted from:
https://gist.github.com/AbhilashReddyM/aed58c60438bf4c313831718013ce48f
Thank you <NAME> (abhilashreddy.com)!
Original authorship:
Author: <NAME>
(<EMAIL> where cu=columbia.edu) (github.com/wgm2111)
copyright (c) 2010
liscence: BSD style
Modifie... | [
"numpy.mean",
"numpy.sqrt",
"matplotlib.tri.Triangulation",
"numpy.tensordot",
"numpy.min",
"numpy.max",
"numpy.inner",
"numpy.array",
"numpy.zeros",
"numpy.empty_like",
"numpy.arctan2",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.arange"
] | [((1175, 1220), 'numpy.empty_like', 'numpy.empty_like', (['self.triangles'], {'dtype': 'float'}), '(self.triangles, dtype=float)\n', (1191, 1220), False, 'import numpy\n'), ((1596, 1614), 'numpy.array', 'numpy.array', (['edges'], {}), '(edges)\n', (1607, 1614), False, 'import numpy\n'), ((1667, 1708), 'numpy.empty_like... |
import json
import time
import copy
import checkpoint as loader
import argparse
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from torch.autograd import Variable
from torch import nn,optim
import torch
import torchvision
import torch.nn.functional as F
from torch import nn
from PIL impor... | [
"numpy.clip",
"torch.exp",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"torch.nn.functional.softmax",
"argparse.ArgumentParser",
"seaborn.color_palette",
"checkpoint",
"torchvision.transforms.ToTensor",
"torchvision.transforms.Resize",
"numpy.transpose",
"matplotlib.pyplot.... | [((784, 815), 'numpy.array', 'np.array', (['[0.485, 0.456, 0.406]'], {}), '([0.485, 0.456, 0.406])\n', (792, 815), True, 'import numpy as np\n'), ((826, 857), 'numpy.array', 'np.array', (['[0.229, 0.224, 0.225]'], {}), '([0.229, 0.224, 0.225])\n', (834, 857), True, 'import numpy as np\n'), ((992, 1012), 'numpy.clip', '... |
import scipy.io
import numpy as np
import os
import random
import json
import pdb
def split_voxel_then_image(cls):
# , 'depth_render_{}'.format(cls[7:])
root = os.path.abspath('.')
in_dir = os.path.join(root, '../input/3dprnn/depth_map')
pre_match_id_file = os.path.join(in_dir, '../random_sample_id_mu... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"numpy.array",
"os.path.abspath"
] | [((170, 190), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (185, 190), False, 'import os\n'), ((204, 251), 'os.path.join', 'os.path.join', (['root', '"""../input/3dprnn/depth_map"""'], {}), "(root, '../input/3dprnn/depth_map')\n", (216, 251), False, 'import os\n'), ((276, 331), 'os.path.join', 'o... |
""" fivethirtyeight baseball puzzle
This code computes exact runs-scored probabilities, using the
negative binomial distribution and convolutions of the runs-scored
distributions
"""
import argparse
import numpy as np
import pandas as pd
from collections import defaultdict
from scipy.stats import distributions
from f... | [
"numpy.sqrt",
"argparse.ArgumentParser",
"collections.defaultdict",
"functools.partial",
"copy.deepcopy",
"pandas.DataFrame"
] | [((4194, 4219), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4217, 4219), False, 'import argparse\n'), ((652, 711), 'functools.partial', 'partial', (['distributions.nbinom.pmf'], {'n': '(3)', 'p': 'self.failure_prob'}), '(distributions.nbinom.pmf, n=3, p=self.failure_prob)\n', (659, 711), Fa... |
#!../../../../virtualenv/bin/python3
# -*- coding: utf-8 -*-
# NB: The shebang line above assumes you've installed a python virtual environment alongside your working copy of the
# <4most-4gp-scripts> git repository. It also only works if you invoke this python script from the directory where it
# is located. If these... | [
"logging.basicConfig",
"logging.getLogger",
"fourgp_speclib.SpectrumLibrarySqlite",
"argparse.ArgumentParser",
"os.path.join",
"os.path.split",
"astropy.io.fits.open",
"os.path.abspath",
"numpy.zeros_like",
"glob.glob"
] | [((1024, 1061), 'os.path.join', 'os_path.join', (['our_path', '"""../../../.."""'], {}), "(our_path, '../../../..')\n", (1036, 1061), True, 'from os import path as os_path\n'), ((1096, 1140), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (1119, 1140),... |
# This example is written for the new interface
import StateModeling as stm
import numpy as np
import matplotlib.pyplot as plt
import fetch_data
import pandas as pd
import tensorflow as tf
basePath = r"C:\Users\pi96doc\Documents\Programming\PythonScripts\StateModeling"
if False:
data = fetch_data.DataFetcher().fet... | [
"fetch_data.DataFetcher",
"StateModeling.Model",
"StateModeling.cumulate",
"tensorflow.reduce_sum",
"numpy.array",
"numpy.sum",
"pandas.read_excel",
"numpy.load",
"numpy.save"
] | [((1521, 1532), 'StateModeling.Model', 'stm.Model', ([], {}), '()\n', (1530, 1532), True, 'import StateModeling as stm\n'), ((376, 427), 'pandas.read_excel', 'pd.read_excel', (["(basePath + '\\\\Examples\\\\bev_lk.xlsx')"], {}), "(basePath + '\\\\Examples\\\\bev_lk.xlsx')\n", (389, 427), True, 'import pandas as pd\n'),... |
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import functional_ops
from tensorflow.python.ops import array_ops
from tensorflow.python.framework import ops
from gpflow import settings
float_type = settings.float_type
jitter_level = settings.jitter
cla... | [
"tensorflow.shape",
"tensorflow.python.ops.functional_ops.scan",
"tensorflow.concat",
"numpy.linspace",
"tensorflow.sqrt",
"tensorflow.python.framework.ops.convert_to_tensor",
"tensorflow.python.ops.math_ops.cast",
"tensorflow.python.ops.array_ops.concat",
"tensorflow.python.ops.functional_ops.foldl... | [((400, 434), 'numpy.linspace', 'np.linspace', (['(0)', 'total_time', 'nsteps'], {}), '(0, total_time, nsteps)\n', (411, 434), True, 'import numpy as np\n'), ((523, 591), 'tensorflow.python.framework.ops.convert_to_tensor', 'ops.convert_to_tensor', (['self.ts'], {'preferred_dtype': 'float_type', 'name': '"""t"""'}), "(... |
import numpy as np
class ReplayMemory(object):
def __init__(self, max_size, obs_dim, act_dim):
self.max_size = int(max_size)
self.obs = np.zeros((max_size, ) + obs_dim, dtype='float32')
self.action = np.zeros((max_size, act_dim), dtype='float32')
self.reward = np.zeros((max_size,)... | [
"numpy.zeros",
"numpy.random.randint"
] | [((159, 207), 'numpy.zeros', 'np.zeros', (['((max_size,) + obs_dim)'], {'dtype': '"""float32"""'}), "((max_size,) + obs_dim, dtype='float32')\n", (167, 207), True, 'import numpy as np\n'), ((231, 277), 'numpy.zeros', 'np.zeros', (['(max_size, act_dim)'], {'dtype': '"""float32"""'}), "((max_size, act_dim), dtype='float3... |
import os
import numpy as np
import matplotlib.pyplot as plt
import PIL
import cv2
import scipy.stats
import torch
import torch.nn as nn
from torch import optim
from torch.autograd.variable import Variable
import torch.nn.functional as F
from skimage.util import montage
from time import time
import warnings
warnings.... | [
"numpy.sqrt",
"torch.max",
"torch.sqrt",
"numpy.log",
"torch.exp",
"numpy.array",
"skimage.util.montage",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.functional.softmax",
"os.listdir",
"torch.nn.LSTM",
"numpy.where",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.sta... | [((311, 344), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (334, 344), False, 'import warnings\n'), ((352, 377), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (375, 377), False, 'import torch\n'), ((2792, 2836), 'numpy.load', 'np.load', (['hp.da... |
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
data=np.genfromtxt(path, delimiter=",", skip_header=1)
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
census = np.concatenate((data, new_record))
# ------... | [
"numpy.mean",
"numpy.std",
"numpy.max",
"numpy.array",
"numpy.sum",
"numpy.concatenate",
"numpy.min",
"numpy.argmin",
"numpy.genfromtxt"
] | [((132, 181), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (145, 181), True, 'import numpy as np\n'), ((275, 309), 'numpy.concatenate', 'np.concatenate', (['(data, new_record)'], {}), '((data, new_record))\n', (289, 309), True... |
from __future__ import division
import numpy as np
__author__ = '<NAME>'
__license__ = '''Copyright (c) 2014-2017, The IceCube Collaboration
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
... | [
"numpy.sin",
"numpy.zeros",
"numpy.sqrt",
"numpy.cos"
] | [((1359, 1371), 'numpy.sqrt', 'np.sqrt', (['x12'], {}), '(x12)\n', (1366, 1371), True, 'import numpy as np\n'), ((1393, 1405), 'numpy.sqrt', 'np.sqrt', (['x13'], {}), '(x13)\n', (1400, 1405), True, 'import numpy as np\n'), ((1427, 1439), 'numpy.sqrt', 'np.sqrt', (['x23'], {}), '(x23)\n', (1434, 1439), True, 'import num... |
# calculate_ICEO.py
"""
Notes
"""
# import modules
import numpy as np
import matplotlib.pyplot as plt
def calculate_ICEO(testSetup, testCol, plot_figs=False, savePath=None):
# write script to calculate and output all of the below terms using the testSetup class
"""
Required Inputs:
# physical consta... | [
"numpy.sqrt",
"numpy.sinh",
"numpy.max",
"numpy.array",
"numpy.linspace",
"numpy.exp",
"numpy.vstack",
"numpy.concatenate",
"numpy.savetxt",
"numpy.cosh",
"matplotlib.rc",
"cycler.cycler",
"matplotlib.pyplot.tight_layout",
"numpy.sign",
"matplotlib.pyplot.subplots",
"numpy.round",
"m... | [((15600, 15638), 'numpy.array', 'np.array', (['electric_fields'], {'dtype': 'float'}), '(electric_fields, dtype=float)\n', (15608, 15638), True, 'import numpy as np\n'), ((15656, 15689), 'numpy.array', 'np.array', (['frequencys'], {'dtype': 'float'}), '(frequencys, dtype=float)\n', (15664, 15689), True, 'import numpy ... |
import os
import numpy as np
from glob import glob
import skimage.measure as meas
from skimage.util import pad
import xml.etree.ElementTree as ET
from skimage import draw
from class_data import options, BaseData
mapping_dict = {
"TCGA-55-1594": "lung",
"TCGA-69-7760": "lung",
"TCGA-69-A59K": "lung",
... | [
"xml.etree.ElementTree.parse",
"os.path.join",
"skimage.util.pad",
"numpy.zeros",
"os.path.basename",
"skimage.measure.label",
"class_data.options",
"glob.glob",
"skimage.draw.polygon"
] | [((2154, 2200), 'skimage.util.pad', 'pad', (['raw', '(pad_width + [(0, 0)])'], {'mode': '"""reflect"""'}), "(raw, pad_width + [(0, 0)], mode='reflect')\n", (2157, 2200), False, 'from skimage.util import pad\n'), ((2210, 2244), 'skimage.util.pad', 'pad', (['gt', 'pad_width'], {'mode': '"""reflect"""'}), "(gt, pad_width,... |
import os
import logging
import numpy as np
import pandas as pd
import torch
from torch_geometric.data import Data
from .graph import edge_normalization
from .data import Dictionary
logging.basicConfig(level = logging.INFO,format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger()
... | [
"logging.basicConfig",
"numpy.tile",
"logging.getLogger",
"numpy.reshape",
"numpy.unique",
"pandas.read_csv",
"numpy.random.choice",
"torch.stack",
"os.path.join",
"torch.from_numpy",
"torch.cat",
"numpy.zeros",
"numpy.stack",
"torch.tensor",
"numpy.concatenate",
"numpy.random.uniform"... | [((184, 291), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n", (203, 291), False, 'import logging\n'), ((299, 318), 'loggin... |
import os, pandas as pd, numpy as np, DataBase, gams
from dreamtools.gamY import Precompiler
from DB2Gams_l2 import gams_model_py, gams_settings
def append_index_with_1dindex(index1,index2):
"""
index1 is a pandas index/multiindex. index 2 is a pandas index (not multiindex).
Returns a pandas multiindex with the car... | [
"DataBase.return_version",
"DataBase.GPM_database",
"numpy.linspace",
"numpy.empty",
"pandas.MultiIndex.from_tuples",
"DB2Gams_l2.gams_settings"
] | [((2403, 2414), 'numpy.empty', 'np.empty', (['N'], {}), '(N)\n', (2411, 2414), True, 'import os, pandas as pd, numpy as np, DataBase, gams\n'), ((5078, 5148), 'DataBase.GPM_database', 'DataBase.GPM_database', ([], {'workspace': 'db0.workspace'}), "(workspace=db0.workspace, **{'name': shock_name})\n", (5099, 5148), Fals... |
import numpy as np
import matplotlib.pyplot as plt
def plot_line(ax, w):
# input data
X = np.zeros((2, 2))
X[0, 0] = -5.0
X[1, 0] = 5.0
X[:, 1] = 1.0
# have to flip transpose
y = w.dot(X.T)
ax.plot(X[:,0], y)
# create prior
tau = 1.0*np.eye(2)
w_0 = np.zeros((2, 1))
# sample from pri... | [
"numpy.eye",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.show"
] | [((285, 301), 'numpy.zeros', 'np.zeros', (['(2, 1)'], {}), '((2, 1))\n', (293, 301), True, 'import numpy as np\n'), ((436, 463), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 5)'}), '(figsize=(10, 5))\n', (446, 463), True, 'import matplotlib.pyplot as plt\n'), ((571, 589), 'matplotlib.pyplot.tight_la... |
##############################
# Generate risk distribution #
##############################
import numpy as np
import pandas as pd
from scipy.stats import norm
from pathlib import Path
import os
# Make a new directory
PATH = Path('...')
SAVE_PATH = PATH / 'data/processed/a_risk/'
os.makedirs(SAVE_PATH, exist_ok=True)... | [
"numpy.sqrt",
"os.makedirs",
"pathlib.Path",
"numpy.round",
"numpy.log",
"pandas.read_excel",
"pandas.DataFrame",
"scipy.stats.norm.cdf",
"numpy.arange"
] | [((227, 238), 'pathlib.Path', 'Path', (['"""..."""'], {}), "('...')\n", (231, 238), False, 'from pathlib import Path\n'), ((283, 320), 'os.makedirs', 'os.makedirs', (['SAVE_PATH'], {'exist_ok': '(True)'}), '(SAVE_PATH, exist_ok=True)\n', (294, 320), False, 'import os\n'), ((356, 373), 'numpy.sqrt', 'np.sqrt', (['varian... |
from scipy.optimize import minimize
import numpy as np
import argparse
import pandas as pd
import subprocess
import os
from repli1d.analyse_RFD import smooth
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--init', type=str, default="K562")
parser.add_argument('--alpha... | [
"numpy.abs",
"os.makedirs",
"argparse.ArgumentParser",
"numpy.where",
"pandas.read_csv",
"subprocess.Popen",
"numpy.array",
"numpy.sum",
"numpy.isnan",
"pandas.DataFrame"
] | [((201, 226), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (224, 226), False, 'import argparse\n'), ((644, 676), 'os.makedirs', 'os.makedirs', (['root'], {'exist_ok': '(True)'}), '(root, exist_ok=True)\n', (655, 676), False, 'import os\n'), ((694, 716), 'pandas.read_csv', 'pd.read_csv', (['ar... |
import csv
import matplotlib.pyplot as plt
import numpy as np
import custom_tools.fftplot as fftplot
import scipy.signal as sig
import scipy.fftpack as fft
pi = np.pi
def angle2(x):
fin_res = []
for i in x:
imag = i.imag
real = i.real
if real == 0 and isinstance(real, float):
... | [
"numpy.abs",
"scipy.fftpack.fftfreq",
"scipy.fftpack.fftshift",
"numpy.round",
"custom_tools.fftplot.winfft",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.arctan2",
"numpy.cos",
"scipy.fftpack.fft",
"custom_tools.fftplot.plot_spectrum",
"numpy.sin",
"matplotlib.pyplot.title",
"numpy.a... | [((647, 676), 'numpy.cos', 'np.cos', (['(2 * np.pi * ftone * t)'], {}), '(2 * np.pi * ftone * t)\n', (653, 676), True, 'import numpy as np\n'), ((789, 819), 'custom_tools.fftplot.winfft', 'fftplot.winfft', (['adc_out'], {'fs': 'fs'}), '(adc_out, fs=fs)\n', (803, 819), True, 'import custom_tools.fftplot as fftplot\n'), ... |
"""
Dataset for clip model
"""
import os
import logging
import copy
import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
import time
import math
import random
import h5py
from tqdm import tqdm
from easydict import EasyDict as edict
import sys
sys.path.append(".")
from AQVSR.utils.basic_utils... | [
"numpy.ones",
"AQVSR.utils.basic_utils.load_from_feature_package",
"numpy.linalg.norm",
"os.path.join",
"torch.from_numpy",
"easydict.EasyDict",
"numpy.random.randint",
"torch.tensor",
"copy.deepcopy",
"torch.zeros_like",
"sys.path.append",
"torch.randn",
"numpy.arange",
"torch.ones"
] | [((271, 291), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (286, 291), False, 'import sys\n'), ((3315, 3322), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (3320, 3322), True, 'from easydict import EasyDict as edict\n'), ((3961, 4201), 'easydict.EasyDict', 'edict', ([], {'seg_id': 'batch_collec... |
import numpy as np
from PIL import Image
def image_to_array(filename):
picture = Image.open(filename)
nparray = np.asarray(picture, dtype = int)
lines = nparray[:, :, 0]
return lines
| [
"PIL.Image.open",
"numpy.asarray"
] | [((87, 107), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (97, 107), False, 'from PIL import Image\n'), ((122, 152), 'numpy.asarray', 'np.asarray', (['picture'], {'dtype': 'int'}), '(picture, dtype=int)\n', (132, 152), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : img.py
# @Author: <EMAIL>
# @Date : 2019-03-23
# @Desc :
import numpy as np
from PIL import Image
def RGB_to_gray(obs):
img = Image.fromarray(obs).crop((0, 40, 256, 240)).resize((200, 200))
img = img.convert('L')
return np.asarray(img)
def get_g... | [
"PIL.Image.fromarray",
"numpy.asarray"
] | [((293, 308), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (303, 308), True, 'import numpy as np\n'), ((398, 419), 'PIL.Image.fromarray', 'Image.fromarray', (['item'], {}), '(item)\n', (413, 419), False, 'from PIL import Image\n'), ((191, 211), 'PIL.Image.fromarray', 'Image.fromarray', (['obs'], {}), '(obs)... |
import numpy
import pypoman
from ..critical_region import CriticalRegion
from ..mplp_program import MPLP_Program
from ..utils.chebyshev_ball import chebyshev_ball
def get_chebyshev_information(region: CriticalRegion, deterministic_solver='glpk'):
region_constraints = region.get_constraints()
return chebyshev... | [
"numpy.random.rand",
"numpy.random.choice",
"numpy.random.random",
"numpy.linalg.norm",
"numpy.random.uniform",
"numpy.all"
] | [((1502, 1561), 'numpy.random.choice', 'numpy.random.choice', (['num_vertices', 'num_combs'], {'replace': '(False)'}), '(num_vertices, num_combs, replace=False)\n', (1521, 1561), False, 'import numpy\n'), ((1616, 1646), 'numpy.random.random', 'numpy.random.random', (['num_combs'], {}), '(num_combs)\n', (1635, 1646), Fa... |
import os
from enum import Enum
from typing import Any, Dict, Tuple, List, Union
from pathlib import Path
from glob import glob
import numpy as np
import SimpleITK as sitk
from .augment import DataAugmentation
from .preprocess import Preprocess, Registration, RegionOfInterest
class FileType(Enum):
sa_ed = 'S... | [
"os.path.exists",
"SimpleITK.Flip",
"os.makedirs",
"pathlib.Path",
"SimpleITK.WriteTransform",
"SimpleITK.ReadTransform",
"os.path.join",
"SimpleITK.GetArrayFromImage",
"SimpleITK.WriteImage",
"os.path.normpath",
"numpy.swapaxes",
"os.path.isdir",
"SimpleITK.PermuteAxesImageFilter",
"numpy... | [((2124, 2156), 'os.path.join', 'os.path.join', (['""".."""', '""".."""', '"""data"""'], {}), "('..', '..', 'data')\n", (2136, 2156), False, 'import os\n'), ((2282, 2320), 'os.path.join', 'os.path.join', (['""".."""', '""".."""', '"""data_cache"""'], {}), "('..', '..', 'data_cache')\n", (2294, 2320), False, 'import os\... |
"""Animation of a model increasing in voxel resolution."""
import fourier_feature_nets as ffn
import numpy as np
import scenepic as sp
def voxels_animation(voxels: ffn.OcTree, min_depth=4, num_frames=300,
up_dir=(0, 1, 0), forward_dir=(0, 0, -1),
fov_y_degrees=40, resolution... | [
"fourier_feature_nets.Resolution",
"numpy.unique",
"scenepic.Scene",
"numpy.array",
"numpy.linspace",
"fourier_feature_nets.orbit",
"fourier_feature_nets.ETABar",
"fourier_feature_nets.OcTree.load",
"scenepic.Shading"
] | [((1743, 1771), 'numpy.array', 'np.array', (['up_dir', 'np.float32'], {}), '(up_dir, np.float32)\n', (1751, 1771), True, 'import numpy as np\n'), ((1790, 1823), 'numpy.array', 'np.array', (['forward_dir', 'np.float32'], {}), '(forward_dir, np.float32)\n', (1798, 1823), True, 'import numpy as np\n'), ((1841, 1868), 'fou... |
import numpy as np
import scipy.sparse as sp
import warnings
#import pdb
# Matrix-vector product wrapper
# A is a numpy 2d array or matrix, or a scipy matrix or sparse matrix.
# x is a numpy vector only.
# Compute A.dot(x) if t is False,
# A.transpose().dot(x) otherwise.
def mult(A, x, t=False):
if sp.isspa... | [
"numpy.abs",
"scipy.sparse.issparse",
"numpy.linalg.svd",
"numpy.diag",
"numpy.zeros",
"numpy.linalg.norm",
"warnings.warn",
"numpy.finfo",
"scipy.sparse.csr_matrix",
"numpy.random.randn"
] | [((312, 326), 'scipy.sparse.issparse', 'sp.issparse', (['A'], {}), '(A)\n', (323, 326), True, 'import scipy.sparse as sp\n'), ((977, 1051), 'warnings.warn', 'warnings.warn', (['"""Ill-conditioning encountered, result accuracy may be poor"""'], {}), "('Ill-conditioning encountered, result accuracy may be poor')\n", (990... |
from controller import Robot, Motor, DistanceSensor, Camera, Emitter, GPS
import struct
import numpy as np
import cv2 as cv
timeStep = 32 # Set the time step for the simulation
max_velocity = 6.28 # Set a maximum velocity time constant
robot = Robot()
# Create an object to control the left wheel
whee... | [
"controller.Robot",
"cv2.threshold",
"struct.pack",
"cv2.contourArea",
"cv2.cvtColor",
"cv2.findContours",
"numpy.frombuffer",
"cv2.boundingRect"
] | [((262, 269), 'controller.Robot', 'Robot', ([], {}), '()\n', (267, 269), False, 'from controller import Robot, Motor, DistanceSensor, Camera, Emitter, GPS\n'), ((2295, 2330), 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY'], {}), '(img, cv.COLOR_BGR2GRAY)\n', (2306, 2330), True, 'import cv2 as cv\n'), ((243... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import scipy.io as sio
import numpy as np
import matplotlib.pyplot as plt
# In[2]:
a = sio.loadmat('time_1_4.mat')
cells = a['timedata']
# In[3]:
cells.shape
# In[4]:
t = np.linspace(0, 180/12, 181)
title_list = ['No delay', 'Half day delay (ddT=0)', 'Half d... | [
"scipy.io.loadmat",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.subplots_adjust"
] | [((141, 168), 'scipy.io.loadmat', 'sio.loadmat', (['"""time_1_4.mat"""'], {}), "('time_1_4.mat')\n", (152, 168), True, 'import scipy.io as sio\n'), ((233, 262), 'numpy.linspace', 'np.linspace', (['(0)', '(180 / 12)', '(181)'], {}), '(0, 180 / 12, 181)\n', (244, 262), True, 'import numpy as np\n'), ((679, 726), 'matplot... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ["RegionEditor"]
import os
import sys
import cv2
import copy
import numpy as np
from functools import partial
from matplotlib.path import Path
from matplotlib.widgets import (
Button, Slider, RadioButtons, CheckButtons,
RectangleSelector, EllipseSelector... | [
"cv2.resize",
"numpy.logical_and",
"matplotlib.widgets.Button",
"numpy.array",
"numpy.zeros",
"pyutils.figure.Figure",
"cv2.cvtColor",
"matplotlib.pyplot.Rectangle",
"numpy.full",
"matplotlib.widgets.Slider",
"sys.path.append"
] | [((407, 427), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (422, 427), False, 'import sys\n'), ((1340, 1367), 'numpy.array', 'np.array', (['range_of_interest'], {}), '(range_of_interest)\n', (1348, 1367), True, 'import numpy as np\n'), ((1497, 1520), 'pyutils.figure.Figure', 'Figure', ([], {'figs... |
"""
@author: <NAME>
@contact: <EMAIL>
"""
import argparse
from ifpd import const, query
from ifpd.scripts import arguments as ap # type: ignore
from ifpd.exception import enable_rich_assert
from joblib import Parallel, delayed # type: ignore
import logging
import numpy as np # type: ignore
import os
import pandas a... | [
"ifpd.scripts.arguments.add_version_option",
"ifpd.query.ProbeFeatureTable",
"numpy.argsort",
"logging.info",
"os.path.isdir",
"os.mkdir",
"rich.logging.RichHandler",
"ifpd.query.OligoProbe",
"numpy.round",
"ifpd.query.OligoDatabase",
"logging.warning",
"os.path.isfile",
"ifpd.scripts.argume... | [((2881, 2910), 'ifpd.scripts.arguments.add_version_option', 'ap.add_version_option', (['parser'], {}), '(parser)\n', (2902, 2910), True, 'from ifpd.scripts import arguments as ap\n'), ((7375, 7463), 'numpy.logical_and', 'np.logical_and', (['(chromData.iloc[:, 0] >= chromStart)', '(chromData.iloc[:, 1] <= chromEnd)'], ... |
import h5py # HDF5 support
import os
import glob
import numpy as n
from scipy.interpolate import interp1d
import astropy.io.fits as fits
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmoMD = FlatLambdaCDM(H0=67.77*u.km/u.s/u.Mpc, Om0=0.307115, Ob0=0.048206)
def write_fits_lc(path_to_lc, ... | [
"numpy.log10",
"astropy.io.fits.PrimaryHDU",
"astropy.io.fits.HDUList",
"astropy.io.fits.Column",
"astropy.cosmology.FlatLambdaCDM",
"h5py.File",
"astropy.io.fits.Header",
"astropy.io.fits.BinTableHDU.from_columns",
"os.system"
] | [((221, 293), 'astropy.cosmology.FlatLambdaCDM', 'FlatLambdaCDM', ([], {'H0': '(67.77 * u.km / u.s / u.Mpc)', 'Om0': '(0.307115)', 'Ob0': '(0.048206)'}), '(H0=67.77 * u.km / u.s / u.Mpc, Om0=0.307115, Ob0=0.048206)\n', (234, 293), False, 'from astropy.cosmology import FlatLambdaCDM\n'), ((372, 398), 'h5py.File', 'h5py.... |
import numpy as np
import claude_low_level_library as low_level
import claude_top_level_library as top_level
def grid_lat(mul, xx, yy, rad):
return (mul * np.arccos(((xx**2 + yy**2)**0.5)/rad)*180.0/np.pi).flatten()
def grid_lon(xx, yy):
return (180.0 - np.arctan2(yy,xx)*180.0/np.pi).flatten()
def cos_mul_si... | [
"numpy.sin",
"numpy.arctan2",
"numpy.arccos",
"numpy.cos"
] | [((390, 420), 'numpy.sin', 'np.sin', (['(lon[j] * np.pi / 180.0)'], {}), '(lon[j] * np.pi / 180.0)\n', (396, 420), True, 'import numpy as np\n'), ((502, 532), 'numpy.cos', 'np.cos', (['(lon[j] * np.pi / 180.0)'], {}), '(lon[j] * np.pi / 180.0)\n', (508, 532), True, 'import numpy as np\n'), ((361, 391), 'numpy.cos', 'np... |
from functools import partial
from textwrap import dedent
from io import StringIO
import pytest
import pandas.testing as pdtest
import numpy
import pandas
from wqio.utils import misc
from wqio.tests import helpers
@pytest.fixture
def basic_data():
testcsv = """\
Date,A,B,C,D
X,1,2,3,4
Y,5,6,7,8
... | [
"pandas.read_csv",
"wqio.utils.misc.expand_columns",
"wqio.utils.misc.categorize_columns",
"pandas.testing.assert_frame_equal",
"pandas.MultiIndex.from_tuples",
"numpy.arange",
"wqio.utils.misc.redefine_index_level",
"pandas.MultiIndex.from_product",
"textwrap.dedent",
"pandas.testing.assert_index... | [((1561, 1602), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""L1"""', "[0, 'loc']"], {}), "('L1', [0, 'loc'])\n", (1584, 1602), False, 'import pytest\n'), ((1604, 1647), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""L2"""', "[2, 'units']"], {}), "('L2', [2, 'units'])\n", (1627, 1647), False,... |
import numpy as np
from scipy import signal
from golem import DataSet
from golem.nodes import BaseNode
from psychic.utils import get_samplerate
class Filter(BaseNode):
def __init__(self, filt_design_func):
'''
Forward-backward filtering node. filt_design_func is a function that takes
the sample rate as a... | [
"psychic.utils.get_samplerate",
"numpy.clip",
"numpy.hstack",
"scipy.signal.filtfilt",
"numpy.sort",
"scipy.signal.lfilter",
"numpy.zeros",
"numpy.linspace",
"golem.DataSet",
"golem.nodes.BaseNode.__init__",
"numpy.atleast_1d"
] | [((388, 411), 'golem.nodes.BaseNode.__init__', 'BaseNode.__init__', (['self'], {}), '(self)\n', (405, 411), False, 'from golem.nodes import BaseNode\n'), ((490, 507), 'psychic.utils.get_samplerate', 'get_samplerate', (['d'], {}), '(d)\n', (504, 507), False, 'from psychic.utils import get_samplerate\n'), ((772, 797), 'g... |
# external modules
import unittest
import tempfile
import shutil
import numpy as num
# ANUGA modules
from anuga.shallow_water.shallow_water_domain import Domain
from anuga.coordinate_transforms.geo_reference import Geo_reference
from anuga.file.sww import Write_sww, SWW_file
from anuga.abstract_2d_finite_volumes.gene... | [
"anuga.abstract_2d_finite_volumes.mesh_factory.rectangular",
"numpy.allclose",
"unittest.makeSuite",
"anuga.file.netcdf.NetCDFFile",
"anuga.coordinate_transforms.geo_reference.Geo_reference",
"numpy.ascontiguousarray",
"anuga.abstract_2d_finite_volumes.generic_boundary_conditions.Transmissive_boundary",... | [((10409, 10447), 'unittest.makeSuite', 'unittest.makeSuite', (['Test_2Pts', '"""test_"""'], {}), "(Test_2Pts, 'test_')\n", (10427, 10447), False, 'import unittest\n'), ((10461, 10486), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (10484, 10486), False, 'import unittest\n'), ((2812, 2834), 'a... |
"""
* @author 孟子喻
* @time 2020.6.2
* @file HMM.py
"""
import numpy as np
class HMM():
def __init__(self, A, B, Pi):
self.A = A # 状态转移概率矩阵
self.B = B # 观测概率矩阵
self.Pi = Pi # 初始状态序列
def forward(self, sequence, t):
"""计算前向概率
:param t 观测时间
... | [
"numpy.ones",
"numpy.argmax",
"numpy.max",
"numpy.sum",
"numpy.array",
"numpy.zeros"
] | [((2430, 2464), 'numpy.array', 'np.array', (['[0, 1, 0, 0, 1, 0, 1, 1]'], {}), '([0, 1, 0, 0, 1, 0, 1, 1])\n', (2438, 2464), True, 'import numpy as np\n'), ((2500, 2561), 'numpy.array', 'np.array', (['[[0.5, 0.1, 0.4], [0.3, 0.5, 0.2], [0.2, 0.2, 0.6]]'], {}), '([[0.5, 0.1, 0.4], [0.3, 0.5, 0.2], [0.2, 0.2, 0.6]])\n', ... |
'''
Compute classification metrics for the preference learning models. Plot the predictions.
Created on 21 Oct 2016
@author: simpson
'''
import logging
import numpy as np
from matplotlib import pyplot as plt
from sklearn.metrics import f1_score, roc_auc_score, log_loss, accuracy_score
from scipy.stats import kendallt... | [
"numpy.log",
"sklearn.metrics.roc_auc_score",
"logging.info",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.concatenate",
"numpy.round",
"scipy.stats.kendalltau",
"numpy.abs",
"matplotlib.pyplot.savefig",
"numpy.any",
"sklearn.metrics.accuracy_score",
"matplo... | [((840, 884), 'logging.info', 'logging.info', (['"""Task C2/C4, accuracy metrics"""'], {}), "('Task C2/C4, accuracy metrics')\n", (852, 884), False, 'import logging\n'), ((3421, 3474), 'logging.info', 'logging.info', (['"""Task C9/10, plotting accuracy metrics"""'], {}), "('Task C9/10, plotting accuracy metrics')\n", (... |
# Lint as: python2, python3
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law ... | [
"tensorflow.tile",
"tensorflow.equal",
"tensorflow.shape",
"tensorflow.pad",
"tensorflow.reduce_sum",
"tensorflow.compat.v1.reverse_v2",
"tensorflow.control_dependencies",
"tensorflow.ones_like",
"tensorflow.image.random_saturation",
"tensorflow.compat.v2.image.resize",
"tensorflow.cast",
"ten... | [((1731, 1752), 'tensorflow.random.uniform', 'tf.random.uniform', (['[]'], {}), '([])\n', (1748, 1752), True, 'import tensorflow as tf\n'), ((2040, 2073), 'tensorflow.less_equal', 'tf.less_equal', (['random_value', 'prob'], {}), '(random_value, prob)\n', (2053, 2073), True, 'import tensorflow as tf\n'), ((2086, 2133), ... |
import os
import numpy as np
import cv2
from enhance_image import Image_Loader_Utils#, Adjust_Bright_Illumination, Illumination_Finder, Adjust_Darkness
def correct_image_illumination(path):
h,w,ci,gi = Image_Loader_Utils(path).convert_img_to_array()
return ci
def template_matcher(template_gray, image_to_... | [
"os.listdir",
"numpy.where",
"cv2.minMaxLoc",
"cv2.cvtColor",
"enhance_image.Image_Loader_Utils",
"cv2.matchTemplate",
"cv2.imread"
] | [((432, 517), 'cv2.matchTemplate', 'cv2.matchTemplate', (['image_to_be_checked_gray', 'template_gray', 'cv2.TM_CCOEFF_NORMED'], {}), '(image_to_be_checked_gray, template_gray, cv2.TM_CCOEFF_NORMED\n )\n', (449, 517), False, 'import cv2\n'), ((553, 571), 'cv2.minMaxLoc', 'cv2.minMaxLoc', (['res'], {}), '(res)\n', (56... |
import numpy as np
import re
import math
import yaml
import importlib
def read_rle(path):
with open(path, "r") as f:
clean_lines = []
for line in f.readlines():
if line[0] != '#': # skip comments
if line[0] == 'x': # get header
header = line
... | [
"math.ceil",
"importlib.import_module",
"math.floor",
"numpy.logical_or",
"yaml.safe_load",
"numpy.zeros",
"numpy.rot90",
"re.findall"
] | [((651, 695), 'numpy.zeros', 'np.zeros', (['(shape_x, shape_y)'], {'dtype': 'np.uint8'}), '((shape_x, shape_y), dtype=np.uint8)\n', (659, 695), True, 'import numpy as np\n'), ((2183, 2214), 'importlib.import_module', 'importlib.import_module', (['module'], {}), '(module)\n', (2206, 2214), False, 'import importlib\n'), ... |
"""Module about the selector element."""
import enum
import numpy as np
from .element import ElementId, Element
@enum.unique
class Symmetry(enum.Enum):
"""List the available kind of symmetry."""
SYMMETRY_NONE = enum.auto()
SYMMETRY_X = enum.auto()
SYMMETRY_Y = enum.auto()
SYMMETRY_XY = enum.auto... | [
"numpy.max",
"numpy.asarray",
"enum.auto",
"numpy.min"
] | [((223, 234), 'enum.auto', 'enum.auto', ([], {}), '()\n', (232, 234), False, 'import enum\n'), ((252, 263), 'enum.auto', 'enum.auto', ([], {}), '()\n', (261, 263), False, 'import enum\n'), ((281, 292), 'enum.auto', 'enum.auto', ([], {}), '()\n', (290, 292), False, 'import enum\n'), ((311, 322), 'enum.auto', 'enum.auto'... |
from transformers import (AutoModelForTokenClassification,
AutoModelForSequenceClassification,
TrainingArguments,
AutoTokenizer,
AutoConfig,
Trainer)
from biobert_ner.utils_ner import (con... | [
"logging.getLogger",
"biobert_ner.utils_ner.NerTestDataset",
"torch.nn.CrossEntropyLoss",
"transformers.TrainingArguments",
"os.path.join",
"bilstm_crf_ner.model.ner_model.NERModel",
"numpy.argmax",
"ehr.HealthRecord",
"annotations.Entity",
"biobert_ner.utils_ner.get_labels",
"biobert_re.utils_r... | [((929, 956), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (946, 956), False, 'import logging\n'), ((1251, 1300), 'biobert_ner.utils_ner.get_labels', 'get_labels', (['"""biobert_ner/dataset_full/labels.txt"""'], {}), "('biobert_ner/dataset_full/labels.txt')\n", (1261, 1300), False, 'fro... |
"""
Tools to process galaxy spectra .fits files from SDSS-II Legacy survey.
Authored by <NAME> 02/13/16
"""
# TODO: add parameter descriptions to SpecProcessor, normalize, and process_fits
from __future__ import absolute_import, print_function, division
import numpy as np
from scipy import interp
import time
import... | [
"numpy.mean",
"numpy.log10",
"scipy.interp",
"numpy.zeros",
"numpy.isnan",
"sys.exit",
"time.time",
"numpy.arange"
] | [((3424, 3527), 'numpy.mean', 'np.mean', (['spectra[:, (10 ** self.loglam_grid > 4400.0) * (10 ** self.loglam_grid < \n 4450.0)]'], {'axis': '(1)'}), '(spectra[:, (10 ** self.loglam_grid > 4400.0) * (10 ** self.\n loglam_grid < 4450.0)], axis=1)\n', (3431, 3527), True, 'import numpy as np\n'), ((4282, 4293), 'tim... |
import numpy as np
from .population import Population
from spike_swarm_sim.utils import eigendecomposition, normalize
class CMA_EA_Population(Population):
def __init__(self, *args, **kwargs):
super(CMA_EA_Population, self).__init__(*args, **kwargs)
self.mu = int(.5 * self.pop_size)
... | [
"numpy.clip",
"numpy.eye",
"numpy.sqrt",
"numpy.linalg.eig",
"numpy.arange",
"numpy.random.random",
"numpy.log",
"numpy.diag",
"numpy.outer",
"numpy.linalg.norm",
"numpy.zeros_like",
"numpy.triu"
] | [((3401, 3431), 'numpy.linalg.eig', 'np.linalg.eig', (['self.strategy_C'], {}), '(self.strategy_C)\n', (3414, 3431), True, 'import numpy as np\n'), ((3450, 3473), 'numpy.diag', 'np.diag', (['(self.D ** -0.5)'], {}), '(self.D ** -0.5)\n', (3457, 3473), True, 'import numpy as np\n'), ((4031, 4054), 'numpy.eye', 'np.eye',... |
import unittest
import numpy as np
from tnpy.linalg import KrylovExpm
class TestLinAlg(unittest.TestCase):
def test_eigshmv(self):
# self.assertEqual(True, False)
pass
class TestKrylovExpm(unittest.TestCase):
def test_construct_krylov_space(self):
mat = np.random.random((50, 50))
... | [
"unittest.main",
"tnpy.linalg.KrylovExpm",
"numpy.random.random"
] | [((468, 483), 'unittest.main', 'unittest.main', ([], {}), '()\n', (481, 483), False, 'import unittest\n'), ((292, 318), 'numpy.random.random', 'np.random.random', (['(50, 50)'], {}), '((50, 50))\n', (308, 318), True, 'import numpy as np\n'), ((332, 352), 'numpy.random.random', 'np.random.random', (['(50)'], {}), '(50)\... |
"""
3D Point Cloud Visualization
Original Author: https://github.com/argoai/argoverse-api
Modified by <NAME>
Date October 2019
"""
import os
import numpy as np
import argparse
import matplotlib
import matplotlib.pyplot as plt
from PIL import Image
from mpl_toolkits.mplot3d import Axes3D
from mayavi import mlab
from t... | [
"os.path.exists",
"mayavi.mlab.points3d",
"mayavi.mlab.view",
"numpy.sqrt",
"os.makedirs",
"os.path.join",
"mayavi.mlab.figure",
"mayavi.mlab.close",
"numpy.array",
"mayavi.mlab.plot3d",
"numpy.concatenate",
"os.system",
"numpy.load"
] | [((1871, 2023), 'mayavi.mlab.points3d', 'mlab.points3d', (['points[:, 0]', 'points[:, 1]', 'points[:, 2]', 'per_pt_color_strengths'], {'mode': '"""point"""', 'colormap': 'colormap', 'color': 'fixed_color', 'figure': 'fig'}), "(points[:, 0], points[:, 1], points[:, 2],\n per_pt_color_strengths, mode='point', colormap... |
from __future__ import print_function, division
import sys
import os, os.path
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
period_rng = (50, 300)
rp_rng = (0.75, 20)
# Read synthetic catalog
koi_file = sys.argv[1]
kois = pd.read_hdf(koi_file, 'kois'... | [
"numpy.ones_like",
"matplotlib.use",
"scipy.optimize.minimize",
"os.path.splitext",
"numpy.diff",
"emcee.EnsembleSampler",
"numpy.exp",
"numpy.array",
"numpy.sum",
"numpy.isfinite",
"corner.corner",
"numpy.load",
"numpy.random.randn",
"pandas.read_hdf"
] | [((137, 158), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (151, 158), False, 'import matplotlib\n'), ((292, 321), 'pandas.read_hdf', 'pd.read_hdf', (['koi_file', '"""kois"""'], {}), "(koi_file, 'kois')\n", (303, 321), True, 'import pandas as pd\n'), ((446, 472), 'numpy.load', 'np.load', (['com... |
from scipy import interpolate
import random
import numpy as np
import matplotlib.pyplot as plt
import math
from types import SimpleNamespace
from gym_space_racer.geometry import intersect, intersection
class CircularMap:
"""Generate random map in shape of circle"""
PRECISION = 100
def __init__(self, n=10,... | [
"numpy.random.normal",
"scipy.interpolate.splprep",
"matplotlib.pyplot.plot",
"gym_space_racer.geometry.intersection",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"scipy.interpolate.splev",
"numpy.random.seed",
"numpy.random.randint",
"math.atan2",
"numpy.sin",
"numpy.hypot",
"numpy.co... | [((466, 491), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (480, 491), True, 'import numpy as np\n'), ((1617, 1660), 'matplotlib.pyplot.plot', 'plt.plot', (['self.start[0]', 'self.start[1]', '"""x"""'], {}), "(self.start[0], self.start[1], 'x')\n", (1625, 1660), True, 'import matplotlib.... |
import os.path
import os
import sys
import math
import argparse
import time
import random
from collections import OrderedDict
import torch
import options.options as option
from utils import util
from data import create_dataloader, create_dataset
from models import create_model
from utils.logger import Logger, PrintLo... | [
"utils.util.psnr",
"utils.util.mkdir_and_rename",
"numpy.arange",
"utils.util.tensor2img",
"argparse.ArgumentParser",
"sampler.generate_code_samples",
"utils.util.save_img",
"random.randint",
"collections.OrderedDict",
"utils.util.mkdir",
"data.create_dataloader",
"utils.logger.Logger",
"tim... | [((521, 532), 'time.time', 'time.time', ([], {}), '()\n', (530, 532), False, 'import time\n'), ((2176, 2189), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2187, 2189), False, 'from collections import OrderedDict\n'), ((2660, 2685), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', ... |
import numpy as np
a1 = np.ones((2, 3), int)
print(a1)
# [[1 1 1]
# [1 1 1]]
a2 = np.full((2, 3), 2)
print(a2)
# [[2 2 2]
# [2 2 2]]
print(np.block([a1, a2]))
# [[1 1 1 2 2 2]
# [1 1 1 2 2 2]]
print(np.block([[a1], [a2]]))
# [[1 1 1]
# [1 1 1]
# [2 2 2]
# [2 2 2]]
print(np.block([[a1, a2], [a2, a1]]))
# [[1 ... | [
"numpy.full",
"numpy.block",
"numpy.ones"
] | [((25, 45), 'numpy.ones', 'np.ones', (['(2, 3)', 'int'], {}), '((2, 3), int)\n', (32, 45), True, 'import numpy as np\n'), ((85, 103), 'numpy.full', 'np.full', (['(2, 3)', '(2)'], {}), '((2, 3), 2)\n', (92, 103), True, 'import numpy as np\n'), ((531, 544), 'numpy.full', 'np.full', (['(6)', '(3)'], {}), '(6, 3)\n', (538,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from config import Config
from itertools import permutations
from unittest import TestCase
from unittest.mock import MagicMock
import numpy as np
from baseline_players import RandomCardPlayer
from card import Card
from const import Const
from encoding import Encoding
fro... | [
"parameterized.parameterized.expand",
"unittest.mock.MagicMock",
"utils.flatten",
"encoding.Encoding",
"numpy.random.randint",
"card.Card",
"numpy.random.seed",
"player.Player._sort_decision_state",
"itertools.permutations"
] | [((1649, 1688), 'parameterized.parameterized.expand', 'parameterized.expand', (['[[True], [False]]'], {}), '([[True], [False]])\n', (1669, 1688), False, 'from parameterized import parameterized\n'), ((4418, 4457), 'parameterized.parameterized.expand', 'parameterized.expand', (['[[True], [False]]'], {}), '([[True], [Fal... |
import pandas as pd
import numpy as np
import py_entitymatching as em
from .magellan_modified_feature_generation import get_features
#Given a CANDIDATE SET and the list of ACTUAL duplicates (duplicates_df),
#this function adds the 1/0 labels (column name = GOLD) to the candset dataframe
def add_labels_to_candset(dupl... | [
"py_entitymatching.get_attr_corres",
"numpy.add",
"py_entitymatching.set_property",
"numpy.where",
"pandas.merge",
"py_entitymatching.extract_feature_vecs",
"py_entitymatching.get_features_for_matching",
"py_entitymatching.set_key",
"numpy.zeros",
"py_entitymatching.get_tokenizers_for_matching",
... | [((652, 753), 'pandas.merge', 'pd.merge', (['candset_df', 'duplicates_df'], {'on': "['ltable_id', 'rtable_id']", 'how': '"""left"""', 'indicator': '"""gold"""'}), "(candset_df, duplicates_df, on=['ltable_id', 'rtable_id'], how=\n 'left', indicator='gold')\n", (660, 753), True, 'import pandas as pd\n'), ((866, 909), ... |
import os
from scipy.io import loadmat
import h5py
import numpy as np
from tools.getDistSqrtVar import getDistSqrtVar
from tools.getCNNFeature import getCNNFeature
from tools.get_ilsvrimdb import readAnnotation as ilsvr_readAnnotation
from tools.get_cubimdb import readAnnotation as cub_readAnnotation
from tools... | [
"tools.getCNNFeature.getCNNFeature",
"numpy.power",
"tools.get_ilsvrimdb.readAnnotation",
"tools.getDistSqrtVar.getDistSqrtVar",
"numpy.argmax",
"h5py.File",
"numpy.squeeze",
"numpy.max",
"numpy.zeros",
"numpy.isnan",
"numpy.concatenate",
"tools.get_cubimdb.readAnnotation",
"tools.get_vocimd... | [((500, 538), 'numpy.concatenate', 'np.concatenate', (['(idx_h, idx_w)'], {'axis': '(0)'}), '((idx_h, idx_w), axis=0)\n', (514, 538), True, 'import numpy as np\n'), ((1301, 1317), 'numpy.zeros', 'np.zeros', (['imgNum'], {}), '(imgNum)\n', (1309, 1317), True, 'import numpy as np\n'), ((1811, 1840), 'numpy.zeros', 'np.ze... |
from data.base_dataset import BaseDataset
import numpy as np
import torch
class DataManager:
def __init__(self, config):
self.config = config
def get_dataloader(self):
dataset = BaseDataset(self.config)
dataloader = torch.utils.data.DataLoader(
dataset,
batch_... | [
"torch.utils.data.sampler.SubsetRandomSampler",
"data.base_dataset.BaseDataset",
"numpy.random.seed",
"torch.utils.data.DataLoader",
"numpy.random.shuffle"
] | [((205, 229), 'data.base_dataset.BaseDataset', 'BaseDataset', (['self.config'], {}), '(self.config)\n', (216, 229), False, 'from data.base_dataset import BaseDataset\n'), ((252, 412), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': "self.config['batch_size']", 'shuffle': '(Tru... |
from random import randrange
import keras
from keras.layers import Dense, Input
from keras.optimizers import Adam
import numpy as np
import random
from breakout_RL.agents.RLAgent import RLAgent
class NNAgent(RLAgent):
ID2ACTION = {0: 2, 1: 3, 2:0}
ACTION2ID = {2: 0, 3: 1, 0:2}
"""Breakout RL with func... | [
"keras.optimizers.Adam",
"random.sample",
"numpy.ones",
"random.randrange",
"numpy.max",
"keras.layers.Input",
"numpy.zeros",
"keras.models.Model",
"keras.layers.multiply",
"keras.layers.Dense",
"random.random",
"numpy.arange"
] | [((1247, 1287), 'keras.layers.Input', 'Input', (['(self.input_size,)'], {'name': '"""states"""'}), "((self.input_size,), name='states')\n", (1252, 1287), False, 'from keras.layers import Dense, Input\n'), ((1312, 1348), 'keras.layers.Input', 'Input', (['(self.nactions,)'], {'name': '"""mask"""'}), "((self.nactions,), n... |
from . import numpy_ndarray_as
def random(size, nulls=False):
"""Return random xnd.xnd instance of 64 bit floats.
"""
import xnd
import numpy as np
r = numpy_ndarray_as.random(size, nulls=nulls)
if nulls:
xr = xnd.xnd(r.tolist(), dtype='?float64')
for i in np.where(np.isnan(r))... | [
"numpy.array",
"numpy.isnan"
] | [((575, 603), 'numpy.array', 'np.array', (['xd_arr'], {'copy': '(False)'}), '(xd_arr, copy=False)\n', (583, 603), True, 'import numpy as np\n'), ((890, 918), 'numpy.array', 'np.array', (['xd_arr'], {'copy': '(False)'}), '(xd_arr, copy=False)\n', (898, 918), True, 'import numpy as np\n'), ((308, 319), 'numpy.isnan', 'np... |
"""
Created on Mon Feb 1 10:08:31 2016
"""
#------------------------------------------------------------------------------
#CHAPTER 6: The Finite-Element Method
#------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
# Basic parameters
nt = 1... | [
"matplotlib.pyplot.text",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.plot",
"numpy.diff",
"numpy.exp",
"matplotlib.pyplot.subplot",
"numpy.zeros",
"numpy.linalg.inv",
"matplotlib.pyplot.figure",
"numpy.mod",
"numpy.arange",
"matplotlib.pyplot.... | [((671, 681), 'numpy.diff', 'np.diff', (['x'], {}), '(x)\n', (678, 681), True, 'import numpy as np\n'), ((989, 1001), 'numpy.zeros', 'np.zeros', (['nx'], {}), '(nx)\n', (997, 1001), True, 'import numpy as np\n'), ((1064, 1082), 'numpy.zeros', 'np.zeros', (['(nx, nx)'], {}), '((nx, nx))\n', (1072, 1082), True, 'import n... |
import numpy as np
import pickle
ANOMALY_MODEL_PATH_FROM_ROOT = 'data/anomaly_detection.pkl'
def predict(joules: float) -> bool:
with open(ANOMALY_MODEL_PATH_FROM_ROOT, 'rb') as open_file:
model = pickle.load(open_file)
label = model.predict(np.array(joules).reshape(-1,1))[0]
return labe... | [
"numpy.array",
"pickle.load"
] | [((213, 235), 'pickle.load', 'pickle.load', (['open_file'], {}), '(open_file)\n', (224, 235), False, 'import pickle\n'), ((266, 282), 'numpy.array', 'np.array', (['joules'], {}), '(joules)\n', (274, 282), True, 'import numpy as np\n')] |
"""
Created by <NAME>, Sep. 2018.
FLOW Lab
Brigham Young University
"""
import unittest
import numpy as np
from _porteagel_fortran import porteagel_analyze, x0_func, theta_c_0_func, sigmay_func, sigma_spread_func
from _porteagel_fortran import sigmaz_func, wake_offset_func, deltav_func, deltav_near_wake_lin_func
from... | [
"_porteagel_fortran.wake_offset_func",
"_porteagel_fortran.discontinuity_point_func",
"_porteagel_fortran.k_star_func",
"_porteagel_fortran.ct_to_axial_ind_func",
"_porteagel_fortran.added_ti_func",
"_porteagel_fortran.overlap_area_func",
"gaussianwake.gaussianwake.GaussianWake",
"numpy.argsort",
"n... | [((35943, 35969), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (35956, 35969), False, 'import unittest\n'), ((1227, 1293), '_porteagel_fortran.x0_func', 'x0_func', (['self.d', 'self.yaw', 'self.ct', 'self.alpha', 'self.ti', 'self.beta'], {}), '(self.d, self.yaw, self.ct, self.alpha, ... |
import math
try:
from ulab import scipy, numpy as np
except ImportError:
import scipy
import numpy as np
A = np.array([[3, 0, 2, 6], [2, 1, 0, 1], [1, 0, 1, 4], [1, 2, 1, 8]])
b = np.array([4, 2, 4, 2])
# forward substitution
result = scipy.linalg.solve_triangular(A, b, lower=True)
ref_result = np.array(... | [
"numpy.array",
"scipy.linalg.solve_triangular",
"math.isclose"
] | [((123, 189), 'numpy.array', 'np.array', (['[[3, 0, 2, 6], [2, 1, 0, 1], [1, 0, 1, 4], [1, 2, 1, 8]]'], {}), '([[3, 0, 2, 6], [2, 1, 0, 1], [1, 0, 1, 4], [1, 2, 1, 8]])\n', (131, 189), True, 'import numpy as np\n'), ((194, 216), 'numpy.array', 'np.array', (['[4, 2, 4, 2]'], {}), '([4, 2, 4, 2])\n', (202, 216), True, 'i... |
"""
Implementation of DDPG - Deep Deterministic Policy Gradient Algorithm and hyperparameter details can be found here:
http://arxiv.org/pdf/1509.02971v2.pdf
The algorithm is tested on the Pendulum-v0 and MountainCarContinuous-v0 OpenAI gym task
"""
import numpy as np
import datetime
import gym
from gym.wrappers ... | [
"src.agent.ddpg_agent.DDPGAgent",
"src.explorationnoise.GreedyPolicy",
"src.network.ddpg_network.ActorNetwork",
"src.replaybuffer.ReplayBuffer",
"datetime.datetime.now",
"src.explorationnoise.OrnsteinUhlenbeckProcess",
"gym.wrappers.Monitor",
"tensorflow.ConfigProto",
"numpy.all",
"tensorflow.GPUO... | [((2361, 2393), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'allow_growth': '(True)'}), '(allow_growth=True)\n', (2374, 2393), True, 'import tensorflow as tf\n'), ((4406, 4418), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (4416, 4418), True, 'import tensorflow as tf\n'), ((1024, 1047), 'datetime.datetime.... |
import numpy as np
a_soll = np.zeros((1000,20), dtype=np.complex64)
for ind in range(a_soll.shape[0]):
for jnd in range(a_soll.shape[1]):
i = ind + 1
j = jnd + 1
a_soll[ind,jnd] = - i * 0.3 + 1j*( j*j + 0.4)
b_soll = np.zeros(1200, dtype=np.complex64)
for ind in range(b_soll.shape[0... | [
"numpy.abs",
"numpy.zeros",
"numpy.load"
] | [((31, 71), 'numpy.zeros', 'np.zeros', (['(1000, 20)'], {'dtype': 'np.complex64'}), '((1000, 20), dtype=np.complex64)\n', (39, 71), True, 'import numpy as np\n'), ((254, 288), 'numpy.zeros', 'np.zeros', (['(1200)'], {'dtype': 'np.complex64'}), '(1200, dtype=np.complex64)\n', (262, 288), True, 'import numpy as np\n'), (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.