code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/python
import sys, time
import numpy as np
from math import *
import argparse
import general_scripts as gs
from distutils.version import LooseVersion
def read_file(fn, field, key="none"):
legs=[]
nplots=0
nlines=[]
xlist=[]
ylist=[]
tmp=0
tmpx=[]
tmpy=[]
if key=="none":... | [
"argparse.ArgumentParser",
"general_scripts.print_sxylist",
"numpy.array",
"numpy.zeros",
"numpy.stack",
"numpy.array_equal",
"numpy.interp",
"sys.exit",
"distutils.version.LooseVersion",
"time.time"
] | [((2807, 3199), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Takes a number of xmgrace-like files containing equivalent dataeach from a different replicate, and perform averaging acrossthese files.More info: For each file containing sets of difference curves,e.g. s0, s1, s2... perform ... |
"""
Evaluation Scripts
"""
from __future__ import absolute_import
from __future__ import division
from collections import namedtuple, OrderedDict
from network import mynn
import argparse
import logging
import os
import torch
import time
import numpy as np
from config import cfg, assert_and_infer_cfg
import network
imp... | [
"network.get_net",
"sklearn.metrics.auc",
"config.assert_and_infer_cfg",
"numpy.array",
"sklearn.metrics.roc_curve",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"numpy.random.seed",
"numpy.concatenate",
"torchvision.transforms.ToTensor",
"torch.nn.SyncBatchNorm.convert_sync_batc... | [((756, 781), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (771, 781), False, 'import os\n'), ((806, 863), 'os.path.join', 'os.path.join', (['dirname', '"""pretrained/r101_os8_base_cty.pth"""'], {}), "(dirname, 'pretrained/r101_os8_base_cty.pth')\n", (818, 863), False, 'import os\n'), ((892... |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.ones_like",
"official.nlp.data.tagging_dataloader.TaggingDataConfig",
"absl.testing.parameterized.parameters",
"tensorflow.io.TFRecordWriter",
"tensorflow.test.main",
"numpy.random.randint",
"tensorflow.train.Features",
"official.nlp.data.tagging_dataloader.TaggingDataLoader"
] | [((924, 957), 'tensorflow.io.TFRecordWriter', 'tf.io.TFRecordWriter', (['output_path'], {}), '(output_path)\n', (944, 957), True, 'import tensorflow as tf\n'), ((1853, 1890), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['(True)', '(False)'], {}), '(True, False)\n', (1877, 1890), False, 'from a... |
# -*- coding:utf-8 -*-
import cv2
import numpy as np
def cvcar(videoUrl, pic):
weightsPath = 'yolov3.weights' # 模型权重文件
configPath = 'yolov3.cfg' # 模型配置文件
labelsPath = 'yolov3.txt' # 模型类别标签文件
# 初始化一些参数
LABELS = open(labelsPath).read().strip().split("\n")
boxes = []
confidences = []
... | [
"cv2.dnn.blobFromImage",
"cv2.imwrite",
"cv2.rectangle",
"numpy.argmax",
"cv2.putText",
"numpy.array",
"cv2.VideoCapture",
"cv2.dnn.NMSBoxes",
"cv2.imread",
"cv2.dnn.readNetFromDarknet"
] | [((387, 438), 'cv2.dnn.readNetFromDarknet', 'cv2.dnn.readNetFromDarknet', (['configPath', 'weightsPath'], {}), '(configPath, weightsPath)\n', (413, 438), False, 'import cv2\n'), ((509, 532), 'cv2.imwrite', 'cv2.imwrite', (['pic', 'frame'], {}), '(pic, frame)\n', (520, 532), False, 'import cv2\n'), ((545, 560), 'cv2.imr... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 16 15:45:10 2021
@author: trite
"""
from MIDISynth import midi2piece
import numpy as np
from pathlib import Path
file_name = 'tempest'
file_path = Path('..') / Path('data') / Path('midi') \
/ Path(file_name + 'mid')
piece = midi2piece(file_name, file_path... | [
"pathlib.Path",
"numpy.arange",
"MIDISynth.midi2piece"
] | [((289, 326), 'MIDISynth.midi2piece', 'midi2piece', (['file_name', 'file_path', '(1.0)'], {}), '(file_name, file_path, 1.0)\n', (299, 326), False, 'from MIDISynth import midi2piece\n'), ((257, 280), 'pathlib.Path', 'Path', (["(file_name + 'mid')"], {}), "(file_name + 'mid')\n", (261, 280), False, 'from pathlib import P... |
from collections import namedtuple, deque
from random import sample, random, randint
from math import exp
from numpy import array, zeros, argmax
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv1D, MaxPool1D, LSTM, Dropout, Flatten, Dense
from tensorflow.keras.op... | [
"random.sample",
"collections.namedtuple",
"collections.deque",
"tensorflow.keras.layers.Dropout",
"numpy.argmax",
"numpy.max",
"tensorflow.keras.optimizers.Adam",
"numpy.array",
"numpy.zeros",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.LSTM",
"tensorflow.keras.layers.Conv1D",
... | [((548, 637), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('Current_State', 'Action', 'Reward', 'Next_State', 'done')"], {}), "('Transition', ('Current_State', 'Action', 'Reward', 'Next_State',\n 'done'))\n", (558, 637), False, 'from collections import namedtuple, deque\n'), ((1070, 1096), 'collec... |
import csv
from datetime import datetime, timezone
import numpy as np
from exetera.core.session import Session
from exetera.core.persistence import DataStore
from exetera.core import utils, dataframe, dataset
from exetera.core import persistence as prst
from exeteracovid.algorithms.test_type_from_mechanism import tes... | [
"exeteracovid.algorithms.test_type_from_mechanism.pcr_standard_summarize",
"numpy.ones_like",
"exetera.core.session.Session",
"exetera.core.persistence.foreign_key_is_in_primary_key",
"numpy.where",
"csv.writer",
"exeteracovid.algorithms.test_type_from_mechanism.test_type_from_mechanism_v2",
"numpy.lo... | [((1109, 1120), 'exetera.core.persistence.DataStore', 'DataStore', ([], {}), '()\n', (1118, 1120), False, 'from exetera.core.persistence import DataStore\n'), ((1130, 1156), 'datetime.datetime.now', 'datetime.now', (['timezone.utc'], {}), '(timezone.utc)\n', (1142, 1156), False, 'from datetime import datetime, timezone... |
import operator
import logging
import numpy as np
import pandas as pd
from .coordinates import Coordinates
from .visual import VisualAttributes
from .visual import COLORS
from .exceptions import IncompatibleAttribute
from .component_link import (ComponentLink, CoordinateComponentLink,
Bin... | [
"numpy.product",
"logging.debug",
"numpy.unique",
"numpy.searchsorted",
"numpy.asarray",
"numpy.can_cast",
"numpy.issubdtype",
"numpy.isfinite",
"numpy.broadcast_arrays",
"numpy.random.RandomState"
] | [((5012, 5080), 'logging.debug', 'logging.debug', (['"""Using %s to index data of shape %s"""', 'key', 'self.shape'], {}), "('Using %s to index data of shape %s', key, self.shape)\n", (5025, 5080), False, 'import logging\n'), ((5236, 5273), 'numpy.can_cast', 'np.can_cast', (['self.data[0]', 'np.complex'], {}), '(self.d... |
import sys
from timeit import timeit
import matplotlib.pyplot as plt
import numpy as np
# from numba import jit, njit
# from numba.typed import List
from statistics import mean
import ray
from multiprocessing import Pool
# Silences Numba warnings about a Python list being passed into a numba function
import warnings
... | [
"statistics.mean",
"ray.get",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"julia.Main.include",
"numpy.array",
"multiprocessing.Pool",
"matplotlib.pyplot.autoscale",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"warnings.filterwarnings",
"matplot... | [((320, 353), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (343, 353), False, 'import warnings\n'), ((878, 912), 'numpy.array', 'np.array', (['pyList'], {'dtype': 'np.float64'}), '(pyList, dtype=np.float64)\n', (886, 912), True, 'import numpy as np\n'), ((4029, 4057), 'j... |
#! /usr/bin/env python
#<NAME>
#<EMAIL>
import sys
import os
import argparse
import numpy as np
from osgeo import gdal
from pygeotools.lib import iolib
#Can use ASP image_calc for multithreaded ndv replacement of huge images
#image_calc -o ${1%.*}_ndv.tif -c 'var_0' --output-nodata-value $2 $1
def getparser():
... | [
"osgeo.gdal.Open",
"pygeotools.lib.iolib.ds_getma",
"argparse.ArgumentParser",
"numpy.ma.fix_invalid",
"pygeotools.lib.iolib.get_ndv_b",
"os.path.splitext"
] | [((331, 397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Replace raster NoData value"""'}), "(description='Replace raster NoData value')\n", (354, 397), False, 'import argparse\n'), ((1175, 1192), 'osgeo.gdal.Open', 'gdal.Open', (['src_fn'], {}), '(src_fn)\n', (1184, 1192), False, 'f... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 1 13:38:59 2019
@author: ryancompton
"""
import os
import pandas as pd
import numpy as np
print("CONVERTING ACCOUNTS TO AMLSIM FORMATTED ACCOUNTS")
file_path = os.path.join("output_datasets")
files = [os.path.join(file_path,x) for x in os.list... | [
"os.listdir",
"pandas.read_csv",
"numpy.random.choice",
"os.path.join",
"numpy.random.randint"
] | [((236, 267), 'os.path.join', 'os.path.join', (['"""output_datasets"""'], {}), "('output_datasets')\n", (248, 267), False, 'import os\n'), ((416, 447), 'pandas.read_csv', 'pd.read_csv', (['latest_account_csv'], {}), '(latest_account_csv)\n', (427, 447), True, 'import pandas as pd\n'), ((792, 823), 'pandas.read_csv', 'p... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 12 19:07:50 2016
@author: ngordon
"""
#==============================================================================
# 3d animation 0 stackoverflow
#==============================================================================
import numpy as np
from mpl_t... | [
"numpy.sin",
"matplotlib.pyplot.figure",
"numpy.cos",
"matplotlib.pyplot.show"
] | [((855, 867), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (865, 867), True, 'import matplotlib.pyplot as plt\n'), ((995, 1005), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1003, 1005), True, 'import matplotlib.pyplot as plt\n'), ((526, 539), 'numpy.cos', 'np.cos', (['angle'], {}), '(angle)\... |
import numpy as np
from numpy import abs, cos, exp, mean, pi, prod, sin, sqrt, sum
from autotune import TuningProblem
from autotune.space import *
# problem space
task_space = None
input_space = Space([
Real(-15, 15, name=f'x_{i}') for i in range(10)
])
output_space = Space([
Real(-inf, inf, name='y')
])
de... | [
"numpy.sqrt",
"autotune.TuningProblem",
"numpy.exp",
"numpy.sum",
"numpy.cos",
"numpy.asarray_chkfinite"
] | [((721, 855), 'autotune.TuningProblem', 'TuningProblem', ([], {'task_space': 'None', 'input_space': 'input_space', 'output_space': 'output_space', 'objective': 'myobj', 'constraints': 'None', 'model': 'None'}), '(task_space=None, input_space=input_space, output_space=\n output_space, objective=myobj, constraints=Non... |
import numpy as np
import pandas as pd
MAXEPOCH = 1000
file = open("Train.txt")
lines = file.readlines()
numClass, numFeature, datasetLen = 0, 0, 0
dataset = []
count = 0
for line in lines:
if count == 0:
var = line.split()
numFeature = int(var[0])
numClass = int(var[1])
datas... | [
"numpy.array",
"numpy.dot",
"numpy.zeros",
"numpy.random.seed",
"numpy.random.uniform"
] | [((625, 643), 'numpy.random.seed', 'np.random.seed', (['(41)'], {}), '(41)\n', (639, 643), True, 'import numpy as np\n'), ((648, 690), 'numpy.random.uniform', 'np.random.uniform', (['(-10)', '(10)', '(numFeature + 1)'], {}), '(-10, 10, numFeature + 1)\n', (665, 690), True, 'import numpy as np\n'), ((961, 975), 'numpy.a... |
import numpy as np
from .binarygrid_util import MfGrdFile
def get_structured_faceflows(
flowja, grb_file=None, ia=None, ja=None, verbose=False
):
"""
Get the face flows for the flow right face, flow front face, and
flow lower face from the MODFLOW 6 flowja flows. This method can
be useful for bui... | [
"numpy.zeros"
] | [((3865, 3893), 'numpy.zeros', 'np.zeros', (['nodes'], {'dtype': 'float'}), '(nodes, dtype=float)\n', (3873, 3893), True, 'import numpy as np\n'), ((1796, 1824), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'float'}), '(shape, dtype=float)\n', (1804, 1824), True, 'import numpy as np\n'), ((1845, 1873), 'numpy.zeros... |
#!/usr/bin/python3
''' Summary: Script to process images and update the database '''
import datetime
import os
import sqlite3
from pathlib import Path
from sqlite3 import Error
import cv2
import numpy as np
from numpy import array
from shapely.geometry import Polygon, asPoint
import mrcnn.config
from mrcnn.model impo... | [
"os.path.exists",
"sqlite3.connect",
"pathlib.Path",
"numpy.delete",
"os.path.join",
"os.path.dirname",
"numpy.array",
"datetime.datetime.now",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"shapely.geometry.Polygon"
] | [((1720, 1750), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""logs"""'], {}), "(ROOT_DIR, 'logs')\n", (1732, 1750), False, 'import os\n'), ((1807, 1850), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mask_rcnn_coco.h5"""'], {}), "(ROOT_DIR, 'mask_rcnn_coco.h5')\n", (1819, 1850), False, 'import os\n'), ((356, 38... |
"""
Python implementation of the LiNGAM algorithms.
The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam
"""
import numpy as np
from scipy.stats import gamma
from statsmodels.nonparametric import bandwidths
__all__ = ['get_kernel_width', 'get_gram_matrix', 'hsic_teststat', 'hsic_test_gamma']
def get_... | [
"numpy.tile",
"numpy.eye",
"numpy.median",
"scipy.stats.gamma.cdf",
"numpy.ones",
"statsmodels.nonparametric.bandwidths.bw_silverman",
"numpy.diag",
"numpy.exp",
"numpy.sum",
"numpy.dot",
"numpy.tril",
"statsmodels.nonparametric.bandwidths.bw_scott"
] | [((995, 1021), 'numpy.tile', 'np.tile', (['G', '(1, n_samples)'], {}), '(G, (1, n_samples))\n', (1002, 1021), True, 'import numpy as np\n'), ((1030, 1058), 'numpy.tile', 'np.tile', (['G.T', '(n_samples, 1)'], {}), '(G.T, (n_samples, 1))\n', (1037, 1058), True, 'import numpy as np\n'), ((1499, 1527), 'numpy.tile', 'np.t... |
from __future__ import print_function
import sys
import numpy
import pytest
import struct
from stl import mesh
_STL_FILE = '''
solid test.stl
facet normal -0.014565 0.073223 -0.002897
outer loop
vertex 0.399344 0.461940 1.044090
vertex 0.500000 0.500000 1.500000
vertex 0.576120 0.500000 1.117320
endlo... | [
"struct.pack",
"numpy.array",
"numpy.zeros",
"pytest.raises",
"stl.mesh.Mesh"
] | [((3715, 3752), 'numpy.zeros', 'numpy.zeros', (['(3)'], {'dtype': 'mesh.Mesh.dtype'}), '(3, dtype=mesh.Mesh.dtype)\n', (3726, 3752), False, 'import numpy\n'), ((3778, 3826), 'numpy.array', 'numpy.array', (['[[0, 0, 0], [1, 0, 0], [0, 1, 1.0]]'], {}), '([[0, 0, 0], [1, 0, 0], [0, 1, 1.0]])\n', (3789, 3826), False, 'impo... |
from mri_modules.utils import *
import os
import numpy as np
import cv2
import shutil
from skimage.measure import marching_cubes_lewiner as marching_cubes
import stl
from stl import mesh
import tensorflow as tf
from tensorflow.keras.models import load_model
import skimage.transform
import nibabel as nib
imp... | [
"tensorflow.keras.layers.Conv3D",
"scipy.ndimage.measurements.label",
"numpy.isin",
"skimage.measure.marching_cubes_lewiner",
"numpy.count_nonzero",
"tensorflow.keras.layers.UpSampling3D",
"tensorflow.keras.models.load_model",
"numpy.rot90",
"scipy.ndimage.gaussian_filter",
"scipy.ndimage.interpol... | [((19163, 19174), 'time.time', 'time.time', ([], {}), '()\n', (19172, 19174), False, 'import time\n'), ((827, 872), 'scipy.ndimage.generate_binary_structure', 'scipy.ndimage.generate_binary_structure', (['(3)', '(1)'], {}), '(3, 1)\n', (866, 872), False, 'import scipy\n'), ((2353, 2415), 'scipy.ndimage.measurements.lab... |
# coding=utf-8
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | [
"tensorflow.compat.v2.argmax",
"tensorflow_probability.distributions.Categorical",
"tensorflow.compat.v2.keras.optimizers.Adam",
"tensorflow.compat.v2.equal",
"tensorflow.compat.v2.nn.log_softmax",
"valan.r2r.curriculum_env_config.get_default_curriculum_env_config",
"valan.r2r.env_config.get_default_env... | [((1432, 1535), 'collections.namedtuple', 'collections.namedtuple', (['"""R2RDebugInfo"""', "['episode_undisc_reward', 'episode_num_steps', 'num_paths']"], {}), "('R2RDebugInfo', ['episode_undisc_reward',\n 'episode_num_steps', 'num_paths'])\n", (1454, 1535), False, 'import collections\n'), ((4123, 4176), 'tensorflo... |
'''
MIT License
Copyright 2019 Oak Ridge National Laboratory
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, mer... | [
"faro.FaceGallery.SearchableGalleryWorker",
"faro.proto.face_service_pb2.FaceServiceInfo",
"os.path.join",
"pyvision.CenteredRect",
"numpy.zeros",
"insightface.model_zoo.get_model",
"numpy.linalg.norm",
"faro.proto.proto_types.image_pv2proto",
"faro.proto.proto_types.vector_np2proto",
"faro.proto.... | [((1442, 1487), 'faro.FaceGallery.SearchableGalleryWorker', 'SearchableGalleryWorker', (['options', 'fsd.NEG_DOT'], {}), '(options, fsd.NEG_DOT)\n', (1465, 1487), False, 'from faro.FaceGallery import SearchableGalleryWorker\n'), ((1847, 1909), 'insightface.model_zoo.get_model', 'insightface.model_zoo.get_model', (['"""... |
import numpy as np
import copy
def update_income(behavioral_effect, calcY):
delta_inc = np.where(calcY.c00100 > 0, behavioral_effect, 0)
# Attribute the behavioral effects across itemized deductions,
# wages, and other income.
_itemized = np.where(calcY.c04470 < calcY._standard,
... | [
"numpy.where",
"copy.deepcopy"
] | [((94, 142), 'numpy.where', 'np.where', (['(calcY.c00100 > 0)', 'behavioral_effect', '(0)'], {}), '(calcY.c00100 > 0, behavioral_effect, 0)\n', (102, 142), True, 'import numpy as np\n'), ((259, 316), 'numpy.where', 'np.where', (['(calcY.c04470 < calcY._standard)', '(0)', 'calcY.c04470'], {}), '(calcY.c04470 < calcY._st... |
import numpy as np
import sacrebleu
import torch
from torch import nn, optim
from tqdm import tqdm
from src.modules import make_baseline_model, make_ps_model
class ModelManager:
"""
Manages PyTorch nn.Module instance
- Train Loop
- Evaluate Loop
- TODO: early stopping, better logging... | [
"torch.manual_seed",
"torch.load",
"torch.nn.NLLLoss",
"numpy.random.seed",
"torch.save",
"torch.no_grad"
] | [((3998, 4031), 'torch.save', 'torch.save', (['checkpoint', 'self.path'], {}), '(checkpoint, self.path)\n', (4008, 4031), False, 'import torch\n'), ((4085, 4106), 'torch.load', 'torch.load', (['self.path'], {}), '(self.path)\n', (4095, 4106), False, 'import torch\n'), ((4339, 4360), 'numpy.random.seed', 'np.random.seed... |
import base64
import logging
import operator
import numpy as np
from api.v1alpha1.grpc_proto.grpc_algorithm.python3 import api_pb2
logger = logging.getLogger(__name__)
class Parameter:
def __init__(self, name, space_list):
self.name = name
self.space_list = space_list
self.space_list.so... | [
"logging.getLogger",
"operator.attrgetter",
"api.v1alpha1.grpc_proto.grpc_algorithm.python3.api_pb2.KeyValue",
"numpy.random.randint",
"api.v1alpha1.grpc_proto.grpc_algorithm.python3.api_pb2.ParameterAssignments"
] | [((143, 170), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (160, 170), False, 'import logging\n'), ((570, 596), 'operator.attrgetter', 'operator.attrgetter', (['"""key"""'], {}), "('key')\n", (589, 596), False, 'import operator\n'), ((1170, 1197), 'operator.attrgetter', 'operator.attrge... |
"""Makes event-attribution schematics for 2019 tornado-prediction paper."""
import numpy
import pandas
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as pyplot
from descartes import PolygonPatch
from gewittergefahr.gg_utils import storm_tracking_utils as tracking_utils
from gewittergefahr.gg_utils im... | [
"numpy.sqrt",
"numpy.array",
"numpy.mean",
"numpy.where",
"pandas.DataFrame.from_dict",
"numpy.max",
"matplotlib.pyplot.close",
"gewittergefahr.plotting.imagemagick_utils.concatenate_images",
"numpy.min",
"gewittergefahr.gg_utils.polygons.vertex_arrays_to_polygon_object",
"numpy.round",
"matpl... | [((122, 143), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (136, 143), False, 'import matplotlib\n'), ((875, 919), 'numpy.array', 'numpy.array', (['[-1, 1, 1, -1, -1]'], {'dtype': 'float'}), '([-1, 1, 1, -1, -1], dtype=float)\n', (886, 919), False, 'import numpy\n'), ((1038, 1102), 'numpy.array... |
from sklearn.neighbors import KernelDensity
from scipy import signal
import networkx as nx
import numpy as np
def ClusterPeak(List,sd):
sd = max(10,sd)
x=np.array(sorted(List))
y=[[i] for i in x]
kde = KernelDensity(kernel='gaussian', bandwidth=min(sd/2,100)).fit(y)
log_density = kde.score_samples(y)
... | [
"numpy.median",
"networkx.connected_component_subgraphs",
"numpy.linalg.pinv",
"numpy.ones",
"numpy.delete",
"networkx.Graph",
"numpy.exp",
"numpy.array",
"numpy.dot",
"scipy.signal.find_peaks",
"numpy.percentile"
] | [((334, 353), 'numpy.exp', 'np.exp', (['log_density'], {}), '(log_density)\n', (340, 353), True, 'import numpy as np\n'), ((369, 411), 'scipy.signal.find_peaks', 'signal.find_peaks', (['est_density'], {'distance': '(3)'}), '(est_density, distance=3)\n', (386, 411), False, 'from scipy import signal\n'), ((1692, 1702), '... |
import numpy as np
X = np.array(([2, 9], [1, 5], [3, 6]), dtype=float)
y = np.array(([92], [86], [89]), dtype=float)
X = X/np.amax(X,axis=0) # maximum of X array longitudinally
y = y/100
#Sigmoid Function
def sigmoid (x):
return 1/(1 + np.exp(-x))
#Derivative of Sigmoid Function
def derivatives_sigmoid(x)... | [
"numpy.exp",
"numpy.array",
"numpy.dot",
"numpy.random.uniform",
"numpy.amax"
] | [((24, 71), 'numpy.array', 'np.array', (['([2, 9], [1, 5], [3, 6])'], {'dtype': 'float'}), '(([2, 9], [1, 5], [3, 6]), dtype=float)\n', (32, 71), True, 'import numpy as np\n'), ((77, 118), 'numpy.array', 'np.array', (['([92], [86], [89])'], {'dtype': 'float'}), '(([92], [86], [89]), dtype=float)\n', (85, 118), True, 'i... |
import torch
import sys
import os
import numpy as np
from abc import ABC
from transformers import BertTokenizer
import transformers
from typing import List
sys.path.append(os.path.join('..', 'stel'))
from set_for_global import set_global_seed, set_torch_device, set_logging, EVAL_BATCH_SIZE
BERT_MAX_WORDS = 250
# OPT... | [
"transformers.RobertaTokenizer.from_pretrained",
"numpy.array",
"torch.nn.functional.softmax",
"transformers.BertForNextSentencePrediction.from_pretrained",
"transformers.BertModel.from_pretrained",
"set_for_global.set_global_seed",
"set_for_global.set_torch_device",
"transformers.PreTrainedModel.from... | [((447, 460), 'set_for_global.set_logging', 'set_logging', ([], {}), '()\n', (458, 460), False, 'from set_for_global import set_global_seed, set_torch_device, set_logging, EVAL_BATCH_SIZE\n'), ((461, 502), 'transformers.logging.set_verbosity_info', 'transformers.logging.set_verbosity_info', ([], {}), '()\n', (500, 502)... |
import pytest
import warnings
warnings.filterwarnings('ignore')
@pytest.mark.basic
def test_resize_ratio():
"""
Testing the resize_ratio function
Returns: Nothing
"""
import numpy as np
from deep_utils import resize_ratio
dummy_images = [np.random.randint(0, 255, (1200, 900, 3), dtype=np.... | [
"numpy.random.randint",
"deep_utils.resize_ratio",
"warnings.filterwarnings"
] | [((31, 64), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (54, 64), False, 'import warnings\n'), ((269, 326), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(1200, 900, 3)'], {'dtype': 'np.uint8'}), '(0, 255, (1200, 900, 3), dtype=np.uint8)\n', (286, 326)... |
import os
import numpy as np
from azureml.monitoring import ModelDataCollector
from inference_schema.parameter_types.numpy_parameter_type import NumpyParameterType
from inference_schema.schema_decorators import input_schema, output_schema
# sklearn.externals.joblib is removed in 0.23
from sklearn import __version__ as... | [
"os.getenv",
"azureml.monitoring.ModelDataCollector",
"inference_schema.parameter_types.numpy_parameter_type.NumpyParameterType",
"numpy.array",
"packaging.version.Version",
"joblib.load"
] | [((1350, 1383), 'numpy.array', 'np.array', (['[[30, -85, 21, 150, 6]]'], {}), '([[30, -85, 21, 150, 6]])\n', (1358, 1383), True, 'import numpy as np\n'), ((1400, 1417), 'numpy.array', 'np.array', (['[8.995]'], {}), '([8.995])\n', (1408, 1417), True, 'import numpy as np\n'), ((373, 392), 'packaging.version.Version', 'Ve... |
#!/usr/bin/env python3
########################################################################
# File: compareSampleSets.py
# executable:
# Purpose:
#
#
# Author: <NAME>
# History: cms 01/08/2020 Created
#
########################################################################
###################... | [
"numpy.mean",
"argparse.ArgumentParser",
"statsmodels.stats.multitest.multipletests",
"numpy.isin",
"numpy.isnan",
"scipy.stats.ranksums",
"sys.exit",
"numpy.load"
] | [((1455, 1669), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TBD"""', 'epilog': '"""Please feel free to forward any usage questions or concerns"""', 'add_help': '(True)', 'prefix_chars': '"""-"""', 'usage': '"""%(prog)s -m1 manifest1.txt -m2 manifest2.txt"""'}), "(description='TBD', ep... |
import os
import numpy as np
import json
import random
import jieba
import collections
from tqdm import tqdm
import config.args as args
from util.Logginger import init_logger
from pytorch_pretrained_bert.tokenization import BertTokenizer
logger = init_logger("QA", logging_path=args.log_path)
with open('TC/pybert/io/P... | [
"jieba.lcut",
"collections.namedtuple",
"random.shuffle",
"tqdm.tqdm",
"os.path.join",
"json.dumps",
"random.seed",
"util.Logginger.init_logger",
"os.path.isfile",
"pytorch_pretrained_bert.tokenization.BertTokenizer",
"numpy.zeros",
"json.load",
"numpy.load",
"numpy.save"
] | [((248, 293), 'util.Logginger.init_logger', 'init_logger', (['"""QA"""'], {'logging_path': 'args.log_path'}), "('QA', logging_path=args.log_path)\n", (259, 293), False, 'from util.Logginger import init_logger\n'), ((377, 389), 'json.load', 'json.load', (['f'], {}), '(f)\n', (386, 389), False, 'import json\n'), ((3120, ... |
import optuna
import json
import numpy as np
import argparse
import os
from optuna.visualization import plot_optimization_history, plot_param_importances
parser = argparse.ArgumentParser()
parser.add_argument("--study-name", help="Study name used during hyperparameter optimization", type=str, default=None)
parser.add... | [
"os.makedirs",
"argparse.ArgumentParser",
"optuna.visualization.plot_param_importances",
"json.dumps",
"numpy.argsort",
"optuna.visualization.plot_optimization_history",
"optuna.create_study"
] | [((165, 190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (188, 190), False, 'import argparse\n'), ((786, 824), 'os.makedirs', 'os.makedirs', (['output_dir'], {'exist_ok': '(True)'}), '(output_dir, exist_ok=True)\n', (797, 824), False, 'import os\n'), ((834, 950), 'optuna.create_study', 'opt... |
import json
import random
from argparse import ArgumentParser
from numpy.random import default_rng
parser = ArgumentParser()
parser.add_argument("--in_file", type=str, default="data/NewsQA.train.json",)
parser.add_argument("--out_file_dev", type=str, default="dataNewsQA.sample.dev.json")
parser.add_argument("... | [
"numpy.random.default_rng",
"argparse.ArgumentParser",
"random.seed"
] | [((114, 130), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (128, 130), False, 'from argparse import ArgumentParser\n'), ((994, 1011), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1005, 1011), False, 'import random\n'), ((1023, 1036), 'numpy.random.default_rng', 'default_rng', ([], {}), '... |
# This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... | [
"scipy.sparse.linalg.spsolve",
"numpy.eye",
"numpy.linalg.solve",
"numpy.abs",
"numpy.ones",
"matplotlib.pyplot.show",
"numpy.conj",
"numpy.where",
"GridCal.Engine.FileOpen",
"numpy.ix_",
"pandas.set_option",
"numpy.zeros",
"numpy.dot",
"matplotlib.pyplot.figure",
"scipy.sparse.hstack",
... | [((2526, 2544), 'numpy.zeros', 'np.zeros', (['(npq, n)'], {}), '((npq, n))\n', (2534, 2544), True, 'import numpy as np\n'), ((2653, 2667), 'scipy.sparse.linalg.spsolve', 'spsolve', (['J', 'dS'], {}), '(J, dS)\n', (2660, 2667), False, 'from scipy.sparse.linalg import factorized, spsolve, inv\n'), ((2752, 2763), 'scipy.s... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import roc_auc_score, roc_curve, classification_report
from xgboost import XGBClassifier
from time import time
idx = pd.IndexSlice
# COMMAND ----------
# MAGIC %md General
# COMMAND ----------
def coun... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.roc_curve",
"numpy.row_stack",
"numpy.random.RandomState",
"numpy.arange",
"pandas.to_datetime",
"pandas.MultiIndex.from_product",
"seaborn.color_palet... | [((10980, 10999), 'seaborn.color_palette', 'sns.color_palette', ([], {}), '()\n', (10997, 10999), True, 'import seaborn as sns\n'), ((1231, 1266), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (1252, 1266), True, 'import numpy as np\n'), ((5035, 5053), 'numpy.arange', ... |
import numpy as np
import unittest
from monte_carlo_tree_search import Node, MCTS, ucb_score
from game import Connect2Game
class MCTSTests(unittest.TestCase):
def test_mcts_from_root_with_equal_priors(self):
class MockModel:
def predict(self, board):
# starting board is:
... | [
"game.Connect2Game",
"numpy.array",
"unittest.main",
"monte_carlo_tree_search.MCTS",
"monte_carlo_tree_search.Node",
"monte_carlo_tree_search.ucb_score"
] | [((8109, 8124), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8122, 8124), False, 'import unittest\n'), ((429, 443), 'game.Connect2Game', 'Connect2Game', ([], {}), '()\n', (441, 443), False, 'from game import Connect2Game\n'), ((527, 550), 'monte_carlo_tree_search.MCTS', 'MCTS', (['game', 'model', 'args'], {}), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""First simple sklearn classifier"""
from __future__ import division # 1/2 == 0.5, as in Py3
from __future__ import absolute_import # avoid hiding global modules with locals
from __future__ import print_function # force use of print("hello")
from __future__ import unico... | [
"matplotlib.pyplot.ylabel",
"sklearn.naive_bayes.BernoulliNB",
"copy.copy",
"sql_convenience.update_class",
"nltk.corpus.stopwords.words",
"argparse.ArgumentParser",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotli... | [((1507, 1575), 'sql_convenience.extract_classifications_and_tweets', 'sql_convenience.extract_classifications_and_tweets', (['validation_table'], {}), '(validation_table)\n', (1557, 1575), False, 'import sql_convenience\n'), ((2904, 3075), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""... |
import os
import time
import cv2
import matplotlib.pyplot as plt
import numpy as np
import png
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
from colormap.colors import Color, hex2rgb
from sklearn.metrics import average_precision_score as ap_score
from torch.utils.data import DataLo... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"sklearn.metrics.average_precision_score",
"tqdm.tqdm",
"dataset.FacadeDataset",
"numpy.max",
"torch.nn.Conv2d",
"numpy.zeros",
"torch.cuda.is_available",
"colormap.colors.hex2rgb",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"torch.no_gr... | [((1243, 1313), 'png.Writer', 'png.Writer', (['label.shape[1]', 'label.shape[0]'], {'palette': 'colors', 'bitdepth': '(4)'}), '(label.shape[1], label.shape[0], palette=colors, bitdepth=4)\n', (1253, 1313), False, 'import png\n'), ((1494, 1505), 'time.time', 'time.time', ([], {}), '()\n', (1503, 1505), False, 'import ti... |
import importlib.util
import logging
import os
import re
import signal
import sys
class FrameworkError(Exception):
pass
def load_module(name, path):
spec = importlib.util.spec_from_file_location(name, path)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exe... | [
"logging.getLogger",
"logging.basicConfig",
"logging.StreamHandler",
"amlb.utils.Namespace.walk",
"re.compile",
"amlb.utils.touch",
"os.environ.get",
"amlb.utils.Namespace.dict",
"os.path.join",
"numpy.save",
"amlb.utils.json_dump",
"sys.stdin.read",
"numpy.load",
"amlb.utils.kill_proc_tre... | [((369, 396), 'os.environ.get', 'os.environ.get', (['"""AMLB_PATH"""'], {}), "('AMLB_PATH')\n", (383, 396), False, 'import os\n'), ((795, 822), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (812, 822), False, 'import logging\n'), ((1511, 1543), 're.compile', 're.compile', (['"""^(X|y|dat... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import torch
import numpy as np
import pandas as pd
def to_one_hot(y, n_class=2):
oh = np.zeros((y.shape[0], n_class), np.float32)
oh[np.arange(y.shape[0]), y] = ... | [
"numpy.unique",
"torch.from_numpy",
"numpy.sum",
"torch.is_tensor",
"numpy.zeros",
"numpy.arange"
] | [((241, 284), 'numpy.zeros', 'np.zeros', (['(y.shape[0], n_class)', 'np.float32'], {}), '((y.shape[0], n_class), np.float32)\n', (249, 284), True, 'import numpy as np\n'), ((848, 860), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (857, 860), True, 'import numpy as np\n'), ((465, 485), 'torch.is_tensor', 'torch.is... |
# -*- coding: utf-8 -*-
####################################################
# 作者: 刘朝阳
# 时间: 2020.05.01
# 更新时间: 2021.11.25
# 功能: 在计算PERCLOS时, 需要知道驾驶在正常情况下的眼睛开度, 来作为基准计算
# 使用说明: 自动调用, 无需操作
####################################################
import os
import numpy as np
import cv2
import dlib
fro... | [
"numpy.mean",
"os.listdir",
"head_posture_estimation.head_posture_estimation",
"dlib.shape_predictor",
"os.path.join",
"dlib.get_frontal_face_detector",
"os.path.isdir",
"cv2.cvtColor",
"numpy.min",
"imutils.face_utils.shape_to_np",
"aspect_ratio_estimation.aspect_ratio_estimation",
"cv2.imrea... | [((479, 504), 'head_posture_estimation.head_posture_estimation', 'head_posture_estimation', ([], {}), '()\n', (502, 504), False, 'from head_posture_estimation import head_posture_estimation\n'), ((512, 537), 'aspect_ratio_estimation.aspect_ratio_estimation', 'aspect_ratio_estimation', ([], {}), '()\n', (535, 537), Fals... |
"""
Creates a theano based gradient descent optimiser for finding good choices of
weights to combine model predictions.
"""
import theano as th
import theano.tensor as tt
import numpy as np
def compile_model_combination_weight_optimiser(lr_adjuster = lambda h, t: h):
model_weights = tt.vector('w') # indexed over ... | [
"theano.tensor.exp",
"theano.tensor.iscalar",
"theano.function",
"theano.gradient.jacobian",
"theano.tensor.matrix",
"theano.tensor.tensor3",
"theano.tensor.vector",
"theano.tensor.arange",
"numpy.zeros",
"theano.tensor.scalar",
"theano.tensor.log",
"numpy.random.RandomState"
] | [((290, 304), 'theano.tensor.vector', 'tt.vector', (['"""w"""'], {}), "('w')\n", (299, 304), True, 'import theano.tensor as tt\n'), ((347, 362), 'theano.tensor.tensor3', 'tt.tensor3', (['"""P"""'], {}), "('P')\n", (357, 362), True, 'import theano.tensor as tt\n'), ((428, 442), 'theano.tensor.matrix', 'tt.matrix', (['""... |
"""
Some basic inference functions adapted from my inferno module which should be available
here soon:
https://github.com/nealegibson/inferno
Really they are just rewritten versions of https://github.com/nealegibson/Infer
But there are many other options for optimisers/MCMCs/etc, and they should (in principle)
all do m... | [
"numpy.sqrt",
"numpy.random.rand",
"numpy.array",
"scipy.optimize.fmin",
"numpy.where",
"numpy.exp",
"numpy.empty",
"numpy.ones",
"numpy.any",
"numpy.std",
"time.time",
"matplotlib.pyplot.subplots_adjust",
"numpy.copy",
"numpy.diag",
"numpy.sum",
"numpy.random.randint",
"matplotlib.p... | [((1305, 1316), 'numpy.copy', 'np.copy', (['x0'], {}), '(x0)\n', (1312, 1316), True, 'import numpy as np\n'), ((1684, 1731), 'scipy.optimize.fmin', 'fmin', (['wrapper', 'x0[var_ind]'], {'args': 'args'}), '(wrapper, x0[var_ind], args=args, **kwargs)\n', (1688, 1731), False, 'from scipy.optimize import fmin\n'), ((2403, ... |
from pyomo.opt import SolverFactory, SolverStatus, TerminationCondition
import pyomo.environ as en
import os
import numpy as np
import logging
logger = logging.getLogger(__name__)
####################################################################
# Define some useful container objects to define the optimisation ob... | [
"logging.getLogger",
"pyomo.environ.Objective",
"os.environ.get",
"pyomo.environ.Param",
"logging.warning",
"numpy.zeros",
"pyomo.environ.Var",
"pyomo.opt.SolverFactory",
"pyomo.environ.RangeSet",
"pyomo.environ.Constraint",
"pyomo.environ.ConcreteModel"
] | [((153, 180), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (170, 180), False, 'import logging\n'), ((4342, 4360), 'pyomo.environ.ConcreteModel', 'en.ConcreteModel', ([], {}), '()\n', (4358, 4360), True, 'import pyomo.environ as en\n'), ((4501, 4545), 'pyomo.environ.RangeSet', 'en.RangeS... |
"""Visualize convergence"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from .test_functions import simple_nonconvex_function, ackley
from .visualisation import FIGSIZE
def max_distances(history, f):
data = {'max_distance': max_distances}
stats = pd.DataFrame(... | [
"seaborn.lmplot",
"seaborn.set",
"matplotlib.pyplot.gcf",
"numpy.log",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.all",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((307, 325), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (319, 325), True, 'import pandas as pd\n'), ((401, 411), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (409, 411), True, 'import matplotlib.pyplot as plt\n'), ((472, 498), 'numpy.arange', 'np.arange', (['(-10)', '(10)', '(0.0001)'],... |
import numpy as np
from numpy import linalg as LA
from sklearn.decomposition import PCA
from utils import pulse_helper
np.set_printoptions(suppress=True)
if __name__ == '__main__':
TEN_BITS_ADC_VALUE = 1023
pedestal = 0
dimension = 7
number_of_data = 20
qtd_for_training = 10
qtd_for_testing =... | [
"numpy.linalg.eig",
"sklearn.decomposition.PCA",
"numpy.random.random",
"numpy.asmatrix",
"utils.pulse_helper.get_jitter_pulse",
"numpy.diag",
"numpy.zeros",
"numpy.matrix",
"numpy.transpose",
"numpy.random.randn",
"numpy.var",
"numpy.set_printoptions"
] | [((121, 155), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)'}), '(suppress=True)\n', (140, 155), True, 'import numpy as np\n'), ((574, 1451), 'numpy.matrix', 'np.matrix', (['[[-0.8756796, -0.9904594, 0.0763564, 0.2866689, -0.8491597, -2.6331943, \n 0.4875299], [0.5691059, 1.0500695, 0.20... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 18 14:42:02 2020
@author: figueroa
"""
import sys
import numpy as np
import warnings
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.gaussian_process.kernels import RBF, WhiteKernel, ConstantKernel as C
from scipy import l... | [
"scipy.linalg.cholesky",
"numpy.array",
"sklearn.gaussian_process.kernels.WhiteKernel",
"numpy.save",
"numpy.arange",
"sklearn.gaussian_process.GaussianProcessRegressor",
"scipy.linalg.cho_solve",
"numpy.mean",
"sklearn.gaussian_process.kernels.ConstantKernel",
"numpy.max",
"numpy.exp",
"numpy... | [((453, 469), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (467, 469), True, 'import numpy as np\n'), ((470, 503), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (493, 503), False, 'import warnings\n'), ((1289, 1376), 'sklearn.gaussian_process.GaussianProcessRe... |
# Implementation based on tf.keras.callbacks.py and tf.keras.utils.generic_utils.py
# https://github.com/tensorflow/tensorflow/blob/2b96f3662bd776e277f86997659e61046b56c315/tensorflow/python/keras/callbacks.py
# https://github.com/tensorflow/tensorflow/blob/2b96f3662bd776e277f86997659e61046b56c315/tensorflow/python/ker... | [
"numpy.ceil",
"numpy.log10",
"numpy.floor",
"copy.copy",
"sys.stdout.isatty",
"sys.stdout.flush",
"time.time",
"sys.stdout.write"
] | [((6671, 6682), 'time.time', 'time.time', ([], {}), '()\n', (6680, 6682), False, 'import time\n'), ((8688, 8699), 'time.time', 'time.time', ([], {}), '()\n', (8697, 8699), False, 'import time\n'), ((12602, 12613), 'time.time', 'time.time', ([], {}), '()\n', (12611, 12613), False, 'import time\n'), ((4286, 4301), 'copy.... |
#!/usr/bin/python
'''
Distance calculation substitute for cosmolopy
All formula used are from
https://arxiv.org/pdf/astro-ph/9905116.pdf
'''
import numpy as np
from scipy.integrate import quad
class cosmo_distance(object):
def __init__(self, **cosmology):
'''
To initiate, cosmological parameters ... | [
"numpy.abs",
"numpy.size",
"numpy.sqrt",
"numpy.atleast_1d"
] | [((1724, 1801), 'numpy.sqrt', 'np.sqrt', (['(self.om0 * (1.0 + z) ** 3.0 + self.ok0 * (1.0 + z) ** 2.0 + self.ode)'], {}), '(self.om0 * (1.0 + z) ** 3.0 + self.ok0 * (1.0 + z) ** 2.0 + self.ode)\n', (1731, 1801), True, 'import numpy as np\n'), ((2304, 2320), 'numpy.atleast_1d', 'np.atleast_1d', (['z'], {}), '(z)\n', (2... |
import numpy as np
import argparse
import logging
import time
SUFFIX = '_shuffle.txt'
def load_input(filename):
t = time.time()
with open(filename) as f:
data = f.readlines()
logging.info('load %d lines in %.4f s', len(data), time.time() - t)
t = time.time()
np.random.shuffle(data)
lo... | [
"logging.basicConfig",
"time.time",
"argparse.ArgumentParser",
"numpy.random.shuffle"
] | [((123, 134), 'time.time', 'time.time', ([], {}), '()\n', (132, 134), False, 'import time\n'), ((274, 285), 'time.time', 'time.time', ([], {}), '()\n', (283, 285), False, 'import time\n'), ((290, 313), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (307, 313), True, 'import numpy as np\n'), ((... |
from __future__ import division
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
import nupic
from nupic.encoders import RandomDistributedScalarEncoder
from nupic.encoders.date import DateEncoder
from nupic.algorithms.spatial_pooler import SpatialPooler
from nupic.algorithms.temporal... | [
"numpy.concatenate"
] | [((835, 861), 'numpy.concatenate', 'np.concatenate', (['[res, enc]'], {}), '([res, enc])\n', (849, 861), True, 'import numpy as np\n')] |
import os
import argparse
import torch
import random
import numpy as np
from shutil import copyfile
from src.config import Config
from src.grad_match import GradientMatch, GradientMatch2
from src.create_data_list import create_data_list
def load_config(mode = None):
parser = argparse.ArgumentParser()
parser.ad... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"os.path.exists",
"src.grad_match.GradientMatch",
"src.create_data_list.create_data_list",
"argparse.ArgumentParser",
"os.makedirs",
"src.config.Config",
"os.path.join",
"random.seed",
"shutil.copyfile",
"torch.cuda.is_available",
"numpy.ran... | [((281, 306), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (304, 306), False, 'import argparse\n'), ((927, 1026), 'src.create_data_list.create_data_list', 'create_data_list', (['args.train_img_path', 'args.test_img_path', 'args.eval_img_path', '"""./list_folder"""'], {}), "(args.train_img_pat... |
"""
Copyright Declaration (C)
From: https://github.com/leeykang/
Use and modification of information, comment(s) or code provided in this document
is granted if and only if this copyright declaration, located between lines 1 to
9 of this document, is preserved at the top of any document where such
information, co... | [
"numpy.ones_like",
"scipy.stats.poisson.pmf",
"numpy.abs",
"os.path.join",
"matplotlib.pyplot.close",
"scipy.stats.poisson.cdf",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.array_equal",
"multiprocessing.Pool",
"copy.deepcopy",
"os.path.abspath",
"numpy.maximum",
"numpy.zeros_like",
... | [((4138, 4193), 'numpy.zeros', 'np.zeros', (['(self.num_locations, self.num_locations)', 'int'], {}), '((self.num_locations, self.num_locations), int)\n', (4146, 4193), True, 'import numpy as np\n'), ((4227, 4282), 'numpy.zeros', 'np.zeros', (['(self.num_locations, self.num_locations)', 'int'], {}), '((self.num_locatio... |
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
import pickle
import os
import pytest
import numpy as np
from renormalizer.model import MolList, MolList2, ModelTranslator, Mol, Phonon
from renormalizer.mps import Mpo, Mps
from renormalizer.tests.parameter import mol_list, ph_phys_dim, omega_quantities
from renorm... | [
"renormalizer.tests.parameter_PBI.construct_mol",
"renormalizer.mps.Mps.random",
"renormalizer.tests.parameter.mol_list.switch_scheme",
"renormalizer.mps.Mpo",
"numpy.array",
"renormalizer.mps.Mpo.exact_propagator",
"renormalizer.mps.Mps.gs",
"renormalizer.mps.Mpo.onsite",
"numpy.linalg.eigh",
"nu... | [((398, 477), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dt, space, shift"""', "([30, 'GS', 0.0], [30, 'EX', 0.0])"], {}), "('dt, space, shift', ([30, 'GS', 0.0], [30, 'EX', 0.0]))\n", (421, 477), False, 'import pytest\n'), ((777, 824), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scheme... |
# @<NAME>, SRA 2019
# This Foolbox module has been modified to reflect our "augmented"
# projection algorithm
# Please replace the "iterative_projected_gradient.py" file under
# foolbox Python library directory
from __future__ import division
import numpy as np
from abc import abstractmethod
import logging
import warn... | [
"numpy.clip",
"logging.getLogger",
"pandas.read_csv",
"numpy.array",
"os.listdir",
"matplotlib.pyplot.plot",
"warnings.warn",
"numpy.abs",
"logging.warning",
"numpy.square",
"os.path.isfile",
"numpy.sign",
"matplotlib.pyplot.show",
"numpy.copy",
"math.ceil",
"urllib.parse.urlparse",
... | [((1187, 1204), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (1196, 1204), False, 'import os\n'), ((2244, 2277), 'os.listdir', 'os.listdir', (['self.BASE_CRAWLED_DIR'], {}), '(self.BASE_CRAWLED_DIR)\n', (2254, 2277), False, 'import os\n'), ((4304, 4339), 'scipy.spatial.distance.cdist', 'distance.cdist'... |
'''
Tests for API Utilities. These are codes shared with other
files in core.
'''
from scisheets.core import helpers_test as ht
import mysite.settings as settings
from CommonUtil.util import stripFileExtension
from scisheets.core.helpers_test import TEST_DIR
import api_util as api_util
from extended_array import Exte... | [
"api_util.copyTableToFile",
"os.path.exists",
"api_util.readObjectFromFile",
"os.path.join",
"CommonUtil.util.stripFileExtension",
"numpy.array",
"api_util.writeObjectToFile",
"scisheets.core.helpers_test.createTable",
"unittest.main",
"scisheets.core.helpers_test.setupTableInitialization",
"api... | [((2638, 2653), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2651, 2653), False, 'import unittest\n'), ((718, 751), 'scisheets.core.helpers_test.setupTableInitialization', 'ht.setupTableInitialization', (['self'], {}), '(self)\n', (745, 751), True, 'from scisheets.core import helpers_test as ht\n'), ((877, 897)... |
import pandas as pd
import os
import numpy as np
from matplotlib import pyplot as plt
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from model import LSTM
from prepare_data import Data, Dataset
stock = "MC.PA"
input_size = 4
output_size = 1
nb_neurons = 200
learning_rate = 0.001
nb_epoc... | [
"numpy.mean",
"os.listdir",
"model.LSTM",
"torch.load",
"prepare_data.Data",
"os.path.join",
"matplotlib.pyplot.plot",
"torch.nn.MSELoss",
"torch.no_grad",
"torch.zeros",
"torch.utils.data.DataLoader",
"prepare_data.Dataset",
"matplotlib.pyplot.title",
"torch.FloatTensor",
"matplotlib.py... | [((905, 917), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (915, 917), True, 'import torch.nn as nn\n'), ((1919, 1935), 'prepare_data.Data', 'Data', (['self.stock'], {}), '(self.stock)\n', (1923, 1935), False, 'from prepare_data import Data, Dataset\n'), ((2332, 2373), 'prepare_data.Dataset', 'Dataset', (['train... |
import os
import numpy as np
import holoviews as hv
import pandas as pd
import logging
from bokeh.models import HoverTool
import holoviews as hv
import datashader as ds
from holoviews.operation.datashader import aggregate, datashade, dynspread
import colorcet as cc
import param
import parambokeh
from lsst.pipe.ta... | [
"datashader.mean",
"param.ObjectSelector",
"lsst.pipe.tasks.functors.PsfSdssTraceSizeDiff",
"holoviews.operation.histogram",
"numpy.isfinite",
"holoviews.streams.RangeXY",
"holoviews.Dimension",
"lsst.pipe.tasks.functors.PsfHsmTraceSizeDiff",
"os.listdir",
"lsst.pipe.tasks.functors.RAColumn",
"p... | [((670, 689), 'lsst.pipe.tasks.functors.Mag', 'Mag', (['"""base_PsfFlux"""'], {}), "('base_PsfFlux')\n", (673, 689), False, 'from lsst.pipe.tasks.functors import Mag, CustomFunctor, DeconvolvedMoments, StarGalaxyLabeller, RAColumn, DecColumn, Column, SdssTraceSize, PsfSdssTraceSizeDiff, HsmTraceSize, PsfHsmTraceSizeDif... |
import logging
import os
from os.path import isfile, join
import numpy as np
from data_io import file_reading
from data_io import x_y_spliting
#import matplotlib.pyplot as plt
def data_plot(data_file, class_column=0, delimiter=' '):
x_matrix, attr_num = file_reading(data_file, delimiter, True)
x_matrix, y_vect... | [
"numpy.unique",
"numpy.where",
"numpy.delete",
"numpy.array",
"data_io.x_y_spliting",
"data_io.file_reading"
] | [((259, 299), 'data_io.file_reading', 'file_reading', (['data_file', 'delimiter', '(True)'], {}), '(data_file, delimiter, True)\n', (271, 299), False, 'from data_io import file_reading\n'), ((325, 361), 'data_io.x_y_spliting', 'x_y_spliting', (['x_matrix', 'class_column'], {}), '(x_matrix, class_column)\n', (337, 361),... |
"""
-------------------------------------
# -*- coding: utf-8 -*-
# @Time : 2021/4/16 12:03:46
# @Author : Giyn
# @Email : <EMAIL>
# @File : mobility_model_construction.py
# @Software: PyCharm
-------------------------------------
"""
import numpy as np
from utils import ProgressBar
def markov_model(trajs:... | [
"utils.ProgressBar",
"numpy.zeros",
"numpy.random.laplace"
] | [((613, 639), 'numpy.zeros', 'np.zeros', (['(n_grid, n_grid)'], {}), '((n_grid, n_grid))\n', (621, 639), True, 'import numpy as np\n'), ((1012, 1082), 'utils.ProgressBar', 'ProgressBar', (['n_grid', '"""Generate midpoint transition probability matrix"""'], {}), "(n_grid, 'Generate midpoint transition probability matrix... |
# Copyright 2019 Xilinx 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 agreed to in writing, ... | [
"sys.path.insert",
"scipy.ndimage.filters.gaussian_filter",
"math.sqrt",
"numpy.array",
"numpy.logical_and.reduce",
"caffe.set_mode_cpu",
"numpy.divide",
"numpy.multiply",
"argparse.ArgumentParser",
"numpy.delete",
"json.dumps",
"numpy.subtract",
"numpy.linspace",
"numpy.vstack",
"numpy.... | [((977, 1002), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1000, 1002), False, 'import argparse\n'), ((1764, 1798), 'os.path.join', 'os.path.join', (['args.caffe', '"""python"""'], {}), "(args.caffe, 'python')\n", (1776, 1798), False, 'import os\n'), ((2278, 2339), 'numpy.tile', 'np.tile', ... |
import argparse
import json
import os
from pprint import pprint
import numpy as np
from sklearn.metrics import precision_recall_fscore_support
from a2t.topic_classification.mlm import MLMTopicClassifier
from a2t.topic_classification.mnli import (
NLITopicClassifier,
NLITopicClassifierWithMappingHead,
)
from a... | [
"argparse.ArgumentParser",
"os.makedirs",
"json.dump",
"numpy.argmax",
"numpy.argsort",
"numpy.array",
"json.load",
"pprint.pprint",
"numpy.save"
] | [((711, 818), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""run_evaluation"""', 'description': '"""Run a evaluation for each configuration."""'}), "(prog='run_evaluation', description=\n 'Run a evaluation for each configuration.')\n", (734, 818), False, 'import argparse\n'), ((1488, 1504), ... |
'''
Author: <NAME>
'''
import numpy as np
from qpsolvers import solve_qp
def linear(x1,x2,p = None):
return np.dot(x1,x2)
def polynomial(x1,x2,d):
return ( 1+np.dot(x1,x2) )**d
def rbf(x1,x2,l):
return np.exp( -np.divide(np.dot(x1-x2,x1-x2), 2*(l**2 ) ) )
def ND_hyperplane(x1,svecto... | [
"numpy.identity",
"numpy.mean",
"numpy.multiply",
"numpy.ones",
"qpsolvers.solve_qp",
"numpy.where",
"numpy.size",
"numpy.asarray",
"numpy.dot",
"numpy.outer",
"numpy.zeros",
"numpy.empty",
"numpy.sign"
] | [((122, 136), 'numpy.dot', 'np.dot', (['x1', 'x2'], {}), '(x1, x2)\n', (128, 136), True, 'import numpy as np\n'), ((1429, 1452), 'numpy.asarray', 'np.asarray', (['data[:, :2]'], {}), '(data[:, :2])\n', (1439, 1452), True, 'import numpy as np\n'), ((1471, 1494), 'numpy.asarray', 'np.asarray', (['data[:, 2:]'], {}), '(da... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 7 14:28:52 2017
@author: ning
This script is to do two things,
1. converting epochs to power spectrograms
2. fit and test a linear model to the data
"""
import numpy as np
from matplotlib import pyplot as plt
import os
import mne
from glob import glob
fr... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"numpy.sqrt",
"numpy.array",
"matplotlib.rc",
"numpy.arange",
"os.path.exists",
"numpy.mean",
"mne.decoding.LinearModel",
"numpy.linspace",
"mne.read_epochs",
"numpy.concatenate",
"mne.time_frequency.read_tfrs",
"os.mkdir",
"sklearn.preproc... | [((1132, 1174), 'os.chdir', 'os.chdir', (['"""D:/Ning - spindle/training set"""'], {}), "('D:/Ning - spindle/training set')\n", (1140, 1174), False, 'import os\n'), ((1888, 1910), 'numpy.concatenate', 'np.concatenate', (['labels'], {}), '(labels)\n', (1902, 1910), True, 'import numpy as np\n'), ((2591, 2619), 'numpy.co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""objetos.py: Objetos e utilidades necessários para a implementação do algoritmo"""
__copyright__ = "Copyright (c) 2021 <NAME> & <NAME>. MIT. See attached LICENSE.txt file"
from math import sqrt
from copy import deepcopy
from sys import maxsize as int_inf
from typing i... | [
"numpy.power",
"dataclasses.dataclass",
"copy.deepcopy",
"pandas.DataFrame",
"dataclasses.field"
] | [((655, 677), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (664, 677), False, 'from dataclasses import dataclass, field\n'), ((911, 933), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (920, 933), False, 'from dataclasses import dataclass, fi... |
import argparse
import os
import time
import datetime
import yaml
import tensorflow as tf
import numpy as np
import src.core as core
from src.retina_net import config_utils
from src.core import constants
from src.retina_net.builders import dataset_handler_builder
from src.retina_net.models.retinanet_model import Reti... | [
"tensorflow.data.experimental.cardinality",
"yaml.load",
"tensorflow.GradientTape",
"src.retina_net.models.retinanet_model.RetinaNetModel",
"tensorflow.cast",
"tensorflow.clip_by_global_norm",
"argparse.ArgumentParser",
"src.retina_net.config_utils.setup",
"tensorflow.concat",
"src.core.model_dir"... | [((615, 677), 'src.retina_net.builders.dataset_handler_builder.build_dataset', 'dataset_handler_builder.build_dataset', (['dataset_config', '"""train"""'], {}), "(dataset_config, 'train')\n", (652, 677), False, 'from src.retina_net.builders import dataset_handler_builder\n'), ((1620, 1716), 'tensorflow.keras.optimizers... |
import os
import sys
import json
import random
import numpy as np
import torch
from tqdm import tqdm, trange
from scipy.sparse import coo_matrix
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
import blink.candidate_ranking.utils as utils
from blink.common.params import BlinkParser
from blin... | [
"torch.LongTensor",
"blink.joint.joint_eval.evaluation.compute_linking_metrics",
"os.path.exists",
"blink.joint.joint_eval.evaluation._get_global_maximum_spanning_tree",
"json.dumps",
"numpy.random.seed",
"scipy.sparse.coo_matrix",
"blink.common.params.BlinkParser",
"torch.utils.data.SequentialSampl... | [((986, 1013), 'torch.LongTensor', 'torch.LongTensor', (['mod_input'], {}), '(mod_input)\n', (1002, 1013), False, 'import torch\n'), ((1197, 1222), 'tqdm.trange', 'trange', (['contexts.shape[0]'], {}), '(contexts.shape[0])\n', (1203, 1222), False, 'from tqdm import tqdm, trange\n'), ((1663, 1696), 'torch.cat', 'torch.c... |
import numpy as np
from .. import Geometry, Line, LineSegmentMaterial
class BoxHelper(Line):
"""A line box object. Commonly used to visualize bounding boxes.
Parameters:
size (float): The length of the box' edges (default 1).
thickness (float): the thickness of the lines (default 1 px).
... | [
"numpy.array",
"numpy.asarray"
] | [((420, 719), 'numpy.array', 'np.array', (['[[0, 0, 0], [1, 0, 0], [0, 0, 0], [0, 0, 1], [1, 0, 1], [1, 0, 0], [1, 0, 1\n ], [0, 0, 1], [0, 1, 0], [1, 1, 0], [0, 1, 0], [0, 1, 1], [1, 1, 1], [1,\n 1, 0], [1, 1, 1], [0, 1, 1], [0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0],\n [0, 0, 1], [0, 1, 1], [1, 0, 1], [1, 1,... |
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def unison_shuffled_copies(a, b):
assert len(a) == len(b)
p = np.random.permutation(len(a))
return a[p], b[p]
def plot_swing(swing_data, shot_type=None, dist=None):
"""
swing_data: Dx6 array of IMU data
"""
... | [
"pandas.read_csv",
"matplotlib.pyplot.plot",
"numpy.argmax",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.suptitle",
"glob.glob"
] | [((377, 404), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 7)'}), '(figsize=(15, 7))\n', (387, 404), True, 'import matplotlib.pyplot as plt\n'), ((781, 806), 'glob.glob', 'glob.glob', (["(path + '*.csv')"], {}), "(path + '*.csv')\n", (790, 806), False, 'import glob\n'), ((1074, 1090), 'numpy.array',... |
"""
This script shows you how to select gripper for an environment.
This is controlled by gripper_type keyword argument
demo script:
python3 examples/policy.py GQCNN-4.0-PJ --depth_image <depth.npy> --segmask <seg.png> --camera_intr data/calib/phoxi/phoxi.intr
"""
import numpy as np
import math
import cv2
import robo... | [
"cv2.imwrite",
"ik_controller.robosuite_IKmover",
"numpy.max",
"numpy.array",
"dexnet.DexNet",
"robosuite.environments.SawyerLift_vj",
"numpy.min",
"mujoco_py.MjRenderContextOffscreen",
"numpy.save"
] | [((2136, 2315), 'robosuite.environments.SawyerLift_vj', 'SawyerLift_vj', ([], {'ignore_done': '(True)', 'gripper_type': '"""TwoFingerGripper"""', 'use_camera_obs': '(False)', 'has_offscreen_renderer': '(False)', 'has_renderer': '(True)', 'camera_name': 'None', 'control_freq': '(100)'}), "(ignore_done=True, gripper_type... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
def calculate_effect_of_credit_drop(model, X, credit_factors):
probs = model.predict_proba(X)[:, 1]
all_probs_changes = {}
all_credit_amount_changes = {}
all_expected_costs_in_credit = {}
for factor in credit_factors:
probs... | [
"numpy.divide",
"numpy.where",
"numpy.isnan",
"pandas.DataFrame",
"numpy.round"
] | [((5209, 5458), 'pandas.DataFrame', 'pd.DataFrame', (["{'defaulted': y, 'credit_given': X['credit_given'], 'prob': probs,\n 'factors': all_processed_factors, 'costs': all_processed_costs,\n 'credit_losses': all_processed_credit_changes, 'probs_changes':\n all_processed_probs_changes}"], {}), "({'defaulted': y,... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
from tqdm import tqdm
from functools import reduce
import disk.funcs as dfn
import h5py
import os
import glob
import sys
from matplotlib import pyplot as plt
class binary_mbh(object):
def __init__(self, filename):
self.parse_file(filename)
... | [
"numpy.abs",
"numpy.ones",
"numpy.nanmedian",
"numpy.where",
"os.path.join",
"numpy.diff",
"h5py.File",
"os.getcwd",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.full",
"numpy.nansum",
"numpy.isinf",
"disk.funcs.dm1dm2_lk"
] | [((1840, 1872), 'numpy.zeros', 'np.zeros', (['(self.sep.shape[0], 3)'], {}), '((self.sep.shape[0], 3))\n', (1848, 1872), True, 'import numpy as np\n'), ((2443, 2475), 'numpy.zeros', 'np.zeros', (['(self.sep.shape[0], 3)'], {}), '((self.sep.shape[0], 3))\n', (2451, 2475), True, 'import numpy as np\n'), ((3037, 3069), 'n... |
import math
import os
import random
import time
import gc
import dgl
import dgl.function as fn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.decomposition import PCA
from dataset import load_dataset
from utils import compute_spectral_emb, entropy
def neighbor_ave... | [
"numpy.union1d",
"dataset.load_dataset",
"torch.LongTensor",
"numpy.log",
"torch.pow",
"os.path.exists",
"torch.cuda.device",
"dgl.function.copy_src",
"torch.zeros_like",
"torch.argmax",
"dgl.function.sum",
"torch.ones_like",
"os.path.dirname",
"dgl.function.mean",
"torch.nn.functional.o... | [((4853, 5007), 'os.path.join', 'os.path.join', (['""".."""', '"""embeddings"""', 'args.dataset', "(args.model if args.model != 'simple_sagn' else args.model + '_' + args.\n weight_style)", '"""smoothed_emb.pt"""'], {}), "('..', 'embeddings', args.dataset, args.model if args.model !=\n 'simple_sagn' else args.mod... |
"""Get counterfactual prediction for 2000 US dollars tuition subsidy.
Get counterfactual prediction for 2000 US dollars tuition subsidy for
different parametrization of the model with hyperbolic discounting and choice
restrictions based on Keane and Wolpin (1994) :cite:`KeaneWolpin1994`.
Looking at the bivariate dist... | [
"bld.project_paths.project_paths_join",
"respy.get_simulate_func",
"src.library.housekeeping._temporary_working_directory",
"numpy.linspace",
"respy.get_example_model",
"pandas.concat"
] | [((1260, 1290), 'numpy.linspace', 'np.linspace', (['(0)', '(99)', 'n_datasets'], {}), '(0, 99, n_datasets)\n', (1271, 1290), True, 'import numpy as np\n'), ((1307, 1342), 'numpy.linspace', 'np.linspace', (['(1000)', '(1099)', 'n_datasets'], {}), '(1000, 1099, n_datasets)\n', (1318, 1342), True, 'import numpy as np\n'),... |
#Filename : plankton.py
#written by <NAME>
#on
import csv
import numpy as np
from scipy import interpolate
def reader(filename):
"""reader reads the .csv file and returns the data as list"""
with open(filename, 'r') as fl:
reader = csv.reader(fl, dialect = 'excel')
data = list(reader)
... | [
"csv.reader",
"scipy.interpolate.interp2d",
"numpy.savetxt",
"numpy.arctan"
] | [((1998, 2052), 'numpy.savetxt', 'np.savetxt', (['"""out.csv"""', 'output'], {'delimiter': '""","""', 'fmt': '"""%s"""'}), "('out.csv', output, delimiter=',', fmt='%s')\n", (2008, 2052), True, 'import numpy as np\n'), ((6268, 6311), 'scipy.interpolate.interp2d', 'interpolate.interp2d', (['x', 'y', 'z'], {'kind': '"""cu... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from linear_regression import Linear_regression
def Call_myLRmodel(data):
# add ones column
data.insert(0, 'Ones', 1)
# set X (training data) and y (target variable)
cols = data.shape[1]
X = data.iloc[:,0:cols-1]
y = data.... | [
"pandas.read_csv",
"numpy.array",
"numpy.zeros",
"pandas.DataFrame",
"linear_regression.Linear_regression",
"sklearn.linear_model.LinearRegression"
] | [((396, 414), 'numpy.array', 'np.array', (['X.values'], {}), '(X.values)\n', (404, 414), True, 'import numpy as np\n'), ((423, 441), 'numpy.array', 'np.array', (['y.values'], {}), '(y.values)\n', (431, 441), True, 'import numpy as np\n'), ((454, 477), 'numpy.zeros', 'np.zeros', (['[1, cols - 1]'], {}), '([1, cols - 1])... |
""" This file does the calculatoin, it saves the files and deletes a file from the do list.
This scripts loads ERA5 hourly atmospheric data and tries to close the AM budget.
This is pyhton 3
"""
import os
import sys
root_path= 'path_to_project'
sys.path.append(root_path)
import tools_AM_budget as M
from tools_AM_b... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.ylabel",
"tools_AM_budget.save_log_txt",
"tools_AM_budget.json_load",
"numpy.array",
"tools_AM_budget.write_log",
"numpy.sin",
"sys.path.append",
"xarray.merge",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"tools_AM_budget.json_save",
"too... | [((249, 275), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (264, 275), False, 'import sys\n'), ((627, 638), 'time.time', 'time.time', ([], {}), '()\n', (636, 638), False, 'import time\n'), ((1018, 1050), 'tools_AM_budget.json_load', 'M.json_load', (['"""config"""', 'root_path'], {}), "('c... |
import codecs
import gzip
import logging
import numpy
from ..layers.time_distributed_embedding import TimeDistributedEmbedding
from .data_indexer import DataIndexer
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class PretrainedEmbeddings:
@staticmethod
def initialize_random_matrix(sh... | [
"logging.getLogger",
"gzip.open",
"numpy.asarray",
"codecs.open",
"numpy.random.RandomState"
] | [((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'import logging\n'), ((468, 498), 'numpy.random.RandomState', 'numpy.random.RandomState', (['seed'], {}), '(seed)\n', (492, 498), False, 'import numpy\n'), ((1926, 1962), 'gzip.open', 'gzip.open', (['embedding... |
# Copyright (c) 2015, <NAME>
# See LICENSE file for details: <https://github.com/moble/scri/blob/master/LICENSE>
import math
import numpy as np
import quaternion
import scri
import spherical_functions as sf
import warnings
def modes_constructor(constructor_statement, data_functor, **kwargs):
"""WaveformModes obj... | [
"numpy.sqrt",
"scipy.special.factorial",
"numpy.log",
"math.sqrt",
"spherical_functions.Wigner3j",
"numpy.array",
"scri.SpinWeights.index",
"spherical_functions.LM_index",
"numpy.arange",
"scri.sample_waveforms.fake_precessing_waveform",
"scipy.interpolate.CubicSpline",
"numpy.exp",
"numpy.l... | [((1874, 2171), 'scri.WaveformModes', 'scri.WaveformModes', ([], {'t': 't', 'frame': 'frame', 'data': 'data', 'history': "['# Called from constant_waveform']", 'frameType': 'frameType', 'dataType': 'dataType', 'r_is_scaled_out': 'r_is_scaled_out', 'm_is_scaled_out': 'm_is_scaled_out', 'constructor_statement': 'construc... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
" Location Head."
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import kaiming_uniform, normal
from alphastarmini.lib.hyper_parameters import Arch_Hyper_Parameters as AHP
from alphastarmini.lib.hype... | [
"torch.nn.BatchNorm2d",
"torch.multinomial",
"torch.nn.Softmax",
"torch.nn.ModuleList",
"alphastarmini.lib.utils.get_location_mask",
"torch.nn.Conv2d",
"torch.randint",
"numpy.array",
"torch.tensor",
"torch.nn.functional.relu",
"torch.nn.Linear",
"torch.zeros",
"alphastarmini.lib.utils.actio... | [((14470, 14528), 'torch.randn', 'torch.randn', (['batch_size', 'AHP.autoregressive_embedding_size'], {}), '(batch_size, AHP.autoregressive_embedding_size)\n', (14481, 14528), False, 'import torch\n'), ((14658, 14728), 'torch.randint', 'torch.randint', ([], {'low': '(0)', 'high': 'SFS.available_actions', 'size': '(batc... |
import unittest
import numpy as np
import tensorflow as tf
import twodlearn as tdl
class ConstrainedTest(unittest.TestCase):
def test_positive_variable(self):
with tf.Session().as_default():
test = tdl.constrained.PositiveVariableExp(
initial_value=lambda:
tf.ex... | [
"unittest.main",
"numpy.testing.assert_almost_equal",
"tensorflow.Session",
"tensorflow.truncated_normal_initializer"
] | [((661, 676), 'unittest.main', 'unittest.main', ([], {}), '()\n', (674, 676), False, 'import unittest\n'), ((589, 627), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (['x1', 'x2'], {}), '(x1, x2)\n', (619, 627), True, 'import numpy as np\n'), ((178, 190), 'tensorflow.Session', 'tf.Session', ([]... |
import numpy as np
import wave
import struct
def note( pitch, beat ):
fs = 44000
amplitude = 30000
frequency = np.array( [ 261.6, 293.7, 329.6, 349.2, 392.0, 440.0, 493.9 ] )
num_samples = beat * fs
t = np.linspace( 0, beat, num_samples, endpoint = False )
a = np.linspace( 0, 1, num_samples, endpoint = False )
... | [
"wave.open",
"numpy.size",
"numpy.append",
"numpy.array",
"numpy.linspace",
"numpy.cos"
] | [((115, 174), 'numpy.array', 'np.array', (['[261.6, 293.7, 329.6, 349.2, 392.0, 440.0, 493.9]'], {}), '([261.6, 293.7, 329.6, 349.2, 392.0, 440.0, 493.9])\n', (123, 174), True, 'import numpy as np\n'), ((209, 258), 'numpy.linspace', 'np.linspace', (['(0)', 'beat', 'num_samples'], {'endpoint': '(False)'}), '(0, beat, nu... |
import sys
import queue
import random
import time
import copy
import numpy as np
from multiprocessing import Process,Queue
file_path=sys.argv[1]
termin_time=sys.argv[3]
random_seed=sys.argv[5]
start=time.time()
random.seed(random_seed)
f=open(file_path,encoding='utf-8')
sentimentlist = []
for line in f:
s = line... | [
"numpy.random.rand",
"multiprocessing.Process",
"queue.get",
"random.seed",
"random.random",
"copy.deepcopy",
"queue.PriorityQueue",
"multiprocessing.Queue",
"time.time",
"random.randint",
"numpy.random.shuffle"
] | [((200, 211), 'time.time', 'time.time', ([], {}), '()\n', (209, 211), False, 'import time\n'), ((212, 236), 'random.seed', 'random.seed', (['random_seed'], {}), '(random_seed)\n', (223, 236), False, 'import random\n'), ((58481, 58488), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (58486, 58488), False, 'from mul... |
import pandas as pd
import os
from PIL import Image
import numpy as np
from keras.callbacks import ModelCheckpoint, LearningRateScheduler, EarlyStopping, ReduceLROnPlateau, TensorBoard
from keras import optimizers, losses, activations, models
from keras.layers import Convolution2D, Dense, Input, Flatten, Dropout, MaxPo... | [
"pandas.read_csv",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.array",
"keras.layers.Dense",
"numpy.mean",
"numpy.max",
"keras.models.Model",
"keras.callbacks.EarlyStopping",
"keras.backend.clear_session",
"keras.layers.GlobalMaxPooling2D",
"sklearn.model_selection.train_test_split",
... | [((1031, 1156), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rotation_range': '(6)', 'width_shift_range': '(0.1)', 'height_shift_range': '(0.1)', 'horizontal_flip': '(True)', 'zoom_range': '(0.1)'}), '(rotation_range=6, width_shift_range=0.1,\n height_shift_range=0.1, horizontal_flip=... |
"""
What is denoising?
Noise is modeled as samples from a certain distribution, it can be referred
with the name of distribution it follows, for example, a Gaussian noise.
Mode (noise_type and noise_params):
- "gaussian", [standard deviation of the distribution]: Gaussian noise
- "poisson", [peak value]: Poisson nois... | [
"nnimgproc.util.parameters.Parameters",
"numpy.copy",
"numpy.random.poisson",
"numpy.random.normal"
] | [((784, 796), 'nnimgproc.util.parameters.Parameters', 'Parameters', ([], {}), '()\n', (794, 796), False, 'from nnimgproc.util.parameters import Parameters\n'), ((1087, 1099), 'numpy.copy', 'np.copy', (['img'], {}), '(img)\n', (1094, 1099), True, 'import numpy as np\n'), ((1348, 1377), 'numpy.random.poisson', 'np.random... |
from nltk.tag import pos_tag
import numpy as np
import pandas as pd
from transformers import TFGPT2LMHeadModel, GPT2Tokenizer
from string import punctuation
from os import path, listdir
import pickle
import copy
from helper_functions import get_embeddings
from nltk import word_tokenize
#Model
MODEL_ID_GPT2... | [
"transformers.GPT2Tokenizer.from_pretrained",
"os.listdir",
"pickle.dump",
"helper_functions.get_embeddings",
"pandas.read_csv",
"nltk.word_tokenize",
"os.path.join",
"pickle.load",
"numpy.squeeze",
"numpy.array",
"copy.deepcopy",
"transformers.TFGPT2LMHeadModel.from_pretrained"
] | [((344, 448), 'transformers.TFGPT2LMHeadModel.from_pretrained', 'TFGPT2LMHeadModel.from_pretrained', (['MODEL_ID_GPT2'], {'output_hidden_states': '(True)', 'output_attentions': '(False)'}), '(MODEL_ID_GPT2, output_hidden_states=True,\n output_attentions=False)\n', (377, 448), False, 'from transformers import TFGPT2L... |
# Copyright 2018 Amazon.com, Inc. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | [
"logging.getLogger",
"argparse.ArgumentParser",
"numpy.arange",
"sklearn.model_selection.train_test_split",
"tensorflow.contrib.saved_model.save_keras_model",
"tensorflow.logging.set_verbosity",
"os.environ.get",
"tensorflow.keras.optimizers.Adam",
"numpy.zeros",
"tensorflow.keras.callbacks.ModelC... | [((873, 915), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.ERROR'], {}), '(tf.logging.ERROR)\n', (897, 915), True, 'import tensorflow as tf\n'), ((1006, 1043), 'os.system', 'os.system', (['"""mkdir /opt/ml/model/code"""'], {}), "('mkdir /opt/ml/model/code')\n", (1015, 1043), False, 'imp... |
import os
import gzip
import logging
import tempfile
from pathlib import Path
import h5py
import numpy
import sunpy.map
from astropy import units as u
from astropy.io import fits
from astropy.time import Time
from sunpy.util.exceptions import warn_user
from sunkit_instruments.suvi._variables import (
COMPOSITE_M... | [
"astropy.io.fits.getheader",
"logging.debug",
"sunpy.util.exceptions.warn_user",
"pathlib.Path",
"gzip.open",
"numpy.longlong",
"numpy.float64",
"h5py.File",
"astropy.time.Time",
"tempfile.gettempdir",
"os.path.basename",
"astropy.io.fits.open",
"astropy.io.fits.Header.fromstring",
"sunkit... | [((7669, 7714), 'astropy.io.fits.Header.fromstring', 'fits.Header.fromstring', (['hdr_str_new'], {'sep': '"""\n"""'}), "(hdr_str_new, sep='\\n')\n", (7691, 7714), False, 'from astropy.io import fits\n'), ((1689, 1713), 'astropy.io.fits.getheader', 'fits.getheader', (['filename'], {}), '(filename)\n', (1703, 1713), Fals... |
from aide_design.shared.units import unit_registry as u
from datetime import datetime, timedelta
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
from pathlib import Path
def ftime(data_file_path, start, end=-1):
"""This function extracts the column of times from a ProCoDA data fil... | [
"numpy.insert",
"pandas.read_csv",
"numpy.average",
"datetime.datetime.strptime",
"numpy.size",
"matplotlib.pyplot.plot",
"os.path.join",
"os.path.split",
"numpy.append",
"numpy.array",
"matplotlib.pyplot.figure",
"pandas.to_numeric",
"numpy.vstack",
"aide_design.shared.units.unit_registry... | [((1033, 1076), 'pandas.read_csv', 'pd.read_csv', (['data_file_path'], {'delimiter': '"""\t"""'}), "(data_file_path, delimiter='\\t')\n", (1044, 1076), True, 'import pandas as pd\n'), ((1149, 1185), 'pandas.to_numeric', 'pd.to_numeric', (['df.iloc[start:end, 0]'], {}), '(df.iloc[start:end, 0])\n', (1162, 1185), True, '... |
from __future__ import annotations
from typing import List, Tuple, Union
import numpy as np
# now just for the 2x2 mat or 1x2 vec
class Matrix():
def __init__(self,
arr: Union[List[float], np.ndarray],
data_type: str = 'mat',
row: int = 2,
col: ... | [
"numpy.isclose",
"numpy.linalg.det",
"numpy.square",
"numpy.array",
"numpy.dot",
"numpy.linalg.inv",
"numpy.arctan2",
"numpy.cos",
"numpy.sin"
] | [((5993, 6017), 'numpy.linalg.det', 'np.linalg.det', (['self._val'], {}), '(self._val)\n', (6006, 6017), True, 'import numpy as np\n'), ((6200, 6224), 'numpy.linalg.inv', 'np.linalg.inv', (['self._val'], {}), '(self._val)\n', (6213, 6224), True, 'import numpy as np\n'), ((6809, 6853), 'numpy.arctan2', 'np.arctan2', (['... |
# -*- coding: utf-8 -*-
# OPTIMIZE: using caching improves speed significantly at the cost of memory. I
# need to see which is preferable in higher-level tests.
from functools import cached_property
import numpy
from numba import njit as numba_speedup
class Lattice:
"""
This class is for 3D crystal lattices... | [
"numpy.arccos",
"numba.njit",
"numpy.array",
"numpy.dot",
"numpy.sum",
"numpy.degrees"
] | [((1774, 1799), 'numba.njit', 'numba_speedup', ([], {'cache': '(True)'}), '(cache=True)\n', (1787, 1799), True, 'from numba import njit as numba_speedup\n'), ((3248, 3273), 'numba.njit', 'numba_speedup', ([], {'cache': '(True)'}), '(cache=True)\n', (3261, 3273), True, 'from numba import njit as numba_speedup\n'), ((112... |
import sqlite3
from tqdm import tqdm
import numpy as np
import array
import sys
import math
import os
import multiprocessing
import shutil
import pandas as pd
from scipy.signal import savgol_filter
class Reload:
def __init__(self, path_pri, path_tra, fold):
self.path_pri = path_pri
self.path_tra =... | [
"os.path.exists",
"os.listdir",
"sys.exit",
"sqlite3.connect",
"pandas.read_csv",
"numpy.where",
"tqdm.tqdm",
"math.sqrt",
"scipy.signal.savgol_filter",
"shutil.rmtree",
"numpy.argsort",
"numpy.array",
"os.chdir",
"multiprocessing.Pool",
"numpy.concatenate",
"os.mkdir",
"pandas.DataF... | [((10978, 11006), 'math.sqrt', 'math.sqrt', (['(energy / duration)'], {}), '(energy / duration)\n', (10987, 11006), False, 'import math\n'), ((11953, 12030), 'pandas.DataFrame', 'pd.DataFrame', (["{'time_pop1': Time[cls_KKM[0]], 'energy_pop1': Eny[cls_KKM[0]]}"], {}), "({'time_pop1': Time[cls_KKM[0]], 'energy_pop1': En... |
#!/usr/bin/env python3
# coding: utf-8
#libraries
import keras
import tensorflow as tf
from keras import backend as K
import cv2
import os
import numpy as np
from keras.optimizers import Adam
from keras.models import model_from_json, load_model
from keras.layers import Input, Dense
from keras.models import Model,Seque... | [
"keras.backend.shape",
"keras.backend.sum",
"keras.callbacks.TerminateOnNaN",
"keras.backend.flatten",
"keras.layers.Activation",
"keras.layers.Dense",
"numpy.reshape",
"keras.backend.square",
"numpy.random.seed",
"keras.models.Model",
"keras.callbacks.EarlyStopping",
"keras.backend.exp",
"g... | [((818, 850), 'keras.callbacks.TerminateOnNaN', 'keras.callbacks.TerminateOnNaN', ([], {}), '()\n', (848, 850), False, 'import keras\n'), ((860, 880), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (874, 880), True, 'import numpy as np\n'), ((1916, 1985), 'keras.callbacks.CSVLogger', 'CSVLogger', ([... |
#! /usr/bin/env python
from __future__ import absolute_import
from pybedtools import BedTool
import argparse
import numpy as np
parser = argparse.ArgumentParser(
description="""
Given two or mote bed files, ``multiBedSumary.py`` computes the sum of overlapping intervals in every genomic region. The default outpu... | [
"pybedtools.BedTool",
"numpy.array",
"argparse.ArgumentParser"
] | [((139, 531), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n\nGiven two or mote bed files, ``multiBedSumary.py`` computes the sum of overlapping intervals in every genomic region. The default output of ``multiBedSumary.py`` (a compressed numpy array, .npz) can be used from various too... |
"""
Data handling for images and reflectance
"""
from gzopen import gzopen
import logging
import logging.config
import yaml
import copy as cp
import re
import ntpath
import h5py
import datetime
import numpy as np
import time
import io
import glob
import pandas as pd
import matplotlib.pyplot as plt
class wafer():
... | [
"logging.getLogger",
"ntpath.basename",
"pandas.read_csv",
"numpy.average",
"numpy.fft.rfft",
"numpy.array",
"numpy.linspace",
"gzopen.gzopen",
"numpy.savetxt",
"copy.deepcopy",
"io.StringIO",
"time.time"
] | [((480, 506), 'logging.getLogger', 'logging.getLogger', (['"""Wafer"""'], {}), "('Wafer')\n", (497, 506), False, 'import logging\n'), ((772, 786), 'numpy.fft.rfft', 'np.fft.rfft', (['d'], {}), '(d)\n', (783, 786), True, 'import numpy as np\n'), ((1052, 1081), 'logging.getLogger', 'logging.getLogger', (['"""WaferLSA"""'... |
"""
=================================
Find Photodiode On and Off Events
=================================
In this example, we use ``pd-parser`` to find photodiode events and
align both the onset of the deflection and the cessation to
to behavior.
"""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
###########... | [
"mne.utils._TempDir",
"mne.create_info",
"pd_parser.parse_pd._load_data",
"pd_parser.add_pd_off_events",
"pd_parser.simulate_pd_data",
"numpy.random.random",
"os.path.join",
"mne.events_from_annotations",
"numpy.array",
"numpy.random.seed",
"matplotlib.pyplot.subplots",
"numpy.random.randn",
... | [((835, 845), 'mne.utils._TempDir', '_TempDir', ([], {}), '()\n', (843, 845), False, 'from mne.utils import _TempDir\n'), ((874, 892), 'numpy.random.seed', 'np.random.seed', (['(29)'], {}), '(29)\n', (888, 892), True, 'import numpy as np\n'), ((1099, 1200), 'pd_parser.simulate_pd_data', 'pd_parser.simulate_pd_data', ([... |
import unittest
import os
import numpy as np
from astropy import constants
import lal
import matplotlib.pyplot as plt
import bilby
from bilby.core import utils
class TestConstants(unittest.TestCase):
def test_speed_of_light(self):
self.assertEqual(utils.speed_of_light, lal.C_SI)
self.assertLess(... | [
"bilby.core.utils.get_sampling_frequency_and_duration_from_time_array",
"bilby.core.utils.infer_args_from_method",
"bilby.core.utils.reflect",
"numpy.array",
"bilby.core.utils.infft",
"numpy.sin",
"unittest.main",
"os.remove",
"numpy.random.random",
"numpy.linspace",
"numpy.random.normal",
"nu... | [((12385, 12400), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12398, 12400), False, 'import unittest\n'), ((1445, 1504), 'bilby.core.utils.create_time_series', 'utils.create_time_series', (['self.sampling_frequency', 'duration'], {}), '(self.sampling_frequency, duration)\n', (1469, 1504), False, 'from bilby.co... |
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import scipy as sc
import pickle
import os
from . import preprocess
from scipy.sparse import vstack, csr_matrix, csc_matrix, lil_matrix
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import no... | [
"pandas.Series",
"numpy.sqrt",
"numpy.union1d",
"pandas.read_csv",
"scipy.sparse.vstack",
"numpy.where",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.argsort",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"pandas.DataFrame",
"scipy.sparse.csr_matrix"
] | [((8274, 8286), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (8282, 8286), True, 'import numpy as np\n'), ((8301, 8313), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (8309, 8313), True, 'import numpy as np\n'), ((12314, 12375), 'pandas.DataFrame', 'pd.DataFrame', (['dataset.target_playlists[:pred_matrix.sha... |
import numpy as np
from math import sin, cos, atan2, tan, sqrt, pi
import matplotlib.pyplot as plt
import time
from bdsim.components import TransferBlock, FunctionBlock
from bdsim.graphics import GraphicsBlock
class MultiRotor(TransferBlock):
"""
:blockname:`MULTIROTOR`
.. table::
:align: le... | [
"numpy.clip",
"numpy.sqrt",
"numpy.cross",
"numpy.any",
"math.cos",
"numpy.array",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.linspace",
"math.atan2",
"numpy.sum",
"matplotlib.pyplot.draw",
"math.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((29901, 29935), 'numpy.sqrt', 'np.sqrt', (['((900 ** 2 + 700 ** 2) / 2)'], {}), '((900 ** 2 + 700 ** 2) / 2)\n', (29908, 29935), True, 'import numpy as np\n'), ((7082, 7109), 'numpy.zeros', 'np.zeros', (['(3, self.nrotors)'], {}), '((3, self.nrotors))\n', (7090, 7109), True, 'import numpy as np\n'), ((7130, 7155), 'n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.