code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# coding:utf-8 import pandas as pd import numpy as np import math from sklearn.tree import DecisionTreeClassifier, _tree from sklearn.cluster import KMeans from .utils import fillna, bin_by_splits, to_ndarray, clip from .utils.decorator import support_dataframe from .utils.forwardSplit import * DEFAULT_BINS = 10 DEFA...
[ "pandas.DataFrame", "numpy.quantile", "sklearn.cluster.KMeans", "numpy.empty", "numpy.unique", "numpy.zeros", "numpy.nanmin", "sklearn.tree.DecisionTreeClassifier", "numpy.sort", "numpy.array", "numpy.arange", "numpy.nanmax" ]
[((575, 589), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (587, 589), True, 'import pandas as pd\n'), ((2055, 2130), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {'min_samples_leaf': 'min_samples', 'max_leaf_nodes': 'n_bins'}), '(min_samples_leaf=min_samples, max_leaf_nodes=n_bins)\n'...
import cv2 import click import numpy as np def main(): rgb = cv2.imread("../data/rgb.jpg") bgrLower = np.array([10, 10, 80]) bgrUpper = np.array([100, 100, 255]) img_mask = cv2.inRange(rgb, bgrLower, bgrUpper) img_mask = cv2.morphologyEx(img_mask, cv2.MORPH_OPEN, (15, 15)) img_mask[:100, :] =...
[ "cv2.bitwise_not", "cv2.dilate", "cv2.waitKey", "cv2.morphologyEx", "cv2.imwrite", "cv2.imread", "numpy.array", "cv2.inRange" ]
[((67, 96), 'cv2.imread', 'cv2.imread', (['"""../data/rgb.jpg"""'], {}), "('../data/rgb.jpg')\n", (77, 96), False, 'import cv2\n'), ((113, 135), 'numpy.array', 'np.array', (['[10, 10, 80]'], {}), '([10, 10, 80])\n', (121, 135), True, 'import numpy as np\n'), ((151, 176), 'numpy.array', 'np.array', (['[100, 100, 255]'],...
""" Distributed evaluating script for 3D shape classification with PipeWork dataset """ import argparse import os import sys import time import json import random import pickle import numpy as np BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(BASE_DIR) sys.path.append(ROOT_DIR) impor...
[ "argparse.ArgumentParser", "torch.cat", "sklearn.metrics.classification_report", "os.path.isfile", "datasets.data_utils.BatchPointcloudScaleAndJitter", "numpy.arange", "torch.no_grad", "utils.util.AverageMeter", "os.path.join", "sys.path.append", "torch.ones", "os.path.abspath", "utils.util....
[((262, 287), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (277, 287), False, 'import os\n'), ((288, 313), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (303, 313), False, 'import sys\n'), ((224, 249), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(_...
from mpi4py import MPI from solver import Solver import torch import os import time import warnings import datetime import numpy as np from tqdm import tqdm from misc.utils import color, get_fake, get_labels, get_loss_value from misc.utils import split, TimeNow, to_var from misc.losses import _compute_loss_s...
[ "torch.cat", "torch.cuda.device_count", "misc.utils.split", "misc.utils.color", "misc.losses._compute_loss_smooth", "datetime.timedelta", "torch.mean", "misc.utils.TimeNow", "os.path.realpath", "torch.max", "misc.utils.to_var", "misc.utils.get_fake", "misc.utils.get_loss_value", "misc.util...
[((413, 422), 'misc.utils.horovod', 'horovod', ([], {}), '()\n', (420, 422), False, 'from misc.utils import horovod\n'), ((447, 480), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (470, 480), False, 'import warnings\n'), ((1850, 1946), 'misc.utils.get_labels', 'get_labels...
import pandas as pd from bs4 import BeautifulSoup import numpy as np import nltk import random import os from collections import Counter, defaultdict import re import json import math import matplotlib.pyplot as plt import time import csv import pickle from tqdm import tqdm import numpy as np import datetime import pi...
[ "math.isnan", "pandas.read_csv", "numpy.std", "os.path.dirname", "sys.path.insert", "utils.Insitution_Fuzzy_Mather", "sklearn.metrics.roc_auc_score", "collections.defaultdict", "numpy.where", "numpy.mean", "scipy.stats.pointbiserialr", "inspect.currentframe" ]
[((539, 566), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (554, 566), False, 'import os, sys, inspect\n'), ((567, 596), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (582, 596), False, 'import os, sys, inspect\n'), ((805, 852), 'pandas.read_csv',...
import nengo import nengo.spa as spa import numpy as np digits = ['ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE'] D = 16 vocab = spa.Vocabulary(D) model = nengo.Network() with model: model.config[nengo.Ensemble].neuron_type=nengo.Direct() num1 = spa.State(D, vocab=vocab) num2 = s...
[ "nengo.Direct", "nengo.spa.State", "nengo.LIF", "numpy.hstack", "nengo.spa.Vocabulary", "nengo.Network", "nengo.Connection", "nengo.Ensemble" ]
[((156, 173), 'nengo.spa.Vocabulary', 'spa.Vocabulary', (['D'], {}), '(D)\n', (170, 173), True, 'import nengo.spa as spa\n'), ((183, 198), 'nengo.Network', 'nengo.Network', ([], {}), '()\n', (196, 198), False, 'import nengo\n'), ((256, 270), 'nengo.Direct', 'nengo.Direct', ([], {}), '()\n', (268, 270), False, 'import n...
""" ================== scatter(X, Y, ...) ================== """ import matplotlib.pyplot as plt import numpy as np plt.style.use('mpl_plot_gallery') # make the data np.random.seed(3) X = 4 + np.random.normal(0, 2, 24) Y = 4 + np.random.normal(0, 2, len(X)) # size and color: S = np.random.uniform(15, 80, len(X)) # p...
[ "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.get_cmap", "matplotlib.pyplot.style.use", "numpy.arange", "numpy.random.normal", "matplotlib.pyplot.subplots" ]
[((117, 150), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""mpl_plot_gallery"""'], {}), "('mpl_plot_gallery')\n", (130, 150), True, 'import matplotlib.pyplot as plt\n'), ((168, 185), 'numpy.random.seed', 'np.random.seed', (['(3)'], {}), '(3)\n', (182, 185), True, 'import numpy as np\n'), ((334, 348), 'matplotli...
#Copyright (c) 2016, <NAME> #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: # #* Redistributions of source code must retain the above copyright notice, this # list of conditions and the following di...
[ "numpy.argmax", "numpy.argmin", "time.time", "numpy.array", "cv2.boundingRect" ]
[((1793, 1818), 'cv2.boundingRect', 'cv2.boundingRect', (['contour'], {}), '(contour)\n', (1809, 1818), False, 'import cv2\n'), ((1972, 1988), 'numpy.array', 'np.array', (['roiPts'], {}), '(roiPts)\n', (1980, 1988), True, 'import numpy as np\n'), ((2268, 2279), 'time.time', 'time.time', ([], {}), '()\n', (2277, 2279), ...
import tensorflow as tf import numpy as np def lstm(rnn_size, keep_prob,reuse=False): lstm_cell =tf.nn.rnn_cell.LSTMCell(rnn_size,reuse=reuse) drop =tf.nn.rnn_cell.DropoutWrapper(lstm_cell, output_keep_prob=keep_prob) return drop def model_input(): input_data = tf.placeholder(tf.int32, [None, None],na...
[ "tensorflow.contrib.seq2seq.BahdanauAttention", "tensorflow.nn.rnn_cell.LSTMStateTuple", "tensorflow.clip_by_value", "tensorflow.identity", "tensorflow.nn.rnn_cell.DropoutWrapper", "tensorflow.nn.rnn_cell.LSTMCell", "tensorflow.nn.bidirectional_dynamic_rnn", "tensorflow.contrib.seq2seq.BasicDecoder", ...
[((102, 148), 'tensorflow.nn.rnn_cell.LSTMCell', 'tf.nn.rnn_cell.LSTMCell', (['rnn_size'], {'reuse': 'reuse'}), '(rnn_size, reuse=reuse)\n', (125, 148), True, 'import tensorflow as tf\n'), ((158, 226), 'tensorflow.nn.rnn_cell.DropoutWrapper', 'tf.nn.rnn_cell.DropoutWrapper', (['lstm_cell'], {'output_keep_prob': 'keep_p...
import cv2 import os import numpy as np import json import glob import datetime from pathlib import Path class CocoDatasetMaker: def __init__(self, dataset_dir, img_index_offset=0, label_index_offset=0, output_dir="dataset_output"): self.coco = { "info": { "year": 2020, ...
[ "json.dump", "cv2.contourArea", "json.load", "os.mkdir", "os.path.basename", "cv2.cvtColor", "os.path.isdir", "cv2.approxPolyDP", "cv2.arcLength", "datetime.datetime.now", "cv2.imread", "pathlib.Path", "numpy.array", "glob.glob", "cv2.drawContours", "cv2.boundingRect", "os.path.join"...
[((2126, 2161), 'glob.glob', 'glob.glob', (['f"""{self.dataset_dir}/*/"""'], {}), "(f'{self.dataset_dir}/*/')\n", (2135, 2161), False, 'import glob\n'), ((2243, 2293), 'os.path.join', 'os.path.join', (['self.output_dir', '"""img_with_contours"""'], {}), "(self.output_dir, 'img_with_contours')\n", (2255, 2293), False, '...
# -*- coding: utf-8 -*- """ Created on Wed Jun 7 09:31:55 2017 @author: matthew.goodwin """ import datetime import sqlite3 import pandas as pd import numpy as np import os import xlwt sqlite_file="reservations.db" # Set path for output based on relative path and location of script FileDir = os.path.dirname(__file...
[ "xlwt.Workbook", "os.makedirs", "os.path.dirname", "os.path.exists", "datetime.datetime.now", "datetime.datetime", "numpy.timedelta64", "sqlite3.connect", "pandas.to_datetime", "pandas.read_sql_query", "datetime.timedelta", "os.path.join" ]
[((298, 323), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (313, 323), False, 'import os\n'), ((349, 380), 'os.path.join', 'os.path.join', (['FileDir', '"""output"""'], {}), "(FileDir, 'output')\n", (361, 380), False, 'import os\n'), ((1352, 1380), 'sqlite3.connect', 'sqlite3.connect', (['s...
import tempfile import os import shutil import unittest import numpy as np from deeprankcore.tools.pssm_3dcons_to_deeprank import pssm_3dcons_to_deeprank from deeprankcore.tools.hdf5_to_csv import hdf5_to_csv from deeprankcore.tools.CustomizeGraph import add_target from deeprankcore.tools.embedding import manifold_embe...
[ "unittest.main", "os.remove", "tempfile.mkstemp", "deeprankcore.tools.CustomizeGraph.add_target", "deeprankcore.tools.hdf5_to_csv.hdf5_to_csv", "deeprankcore.tools.pssm_3dcons_to_deeprank.pssm_3dcons_to_deeprank", "os.close", "deeprankcore.tools.embedding.manifold_embedding", "numpy.random.rand", ...
[((1677, 1692), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1690, 1692), False, 'import unittest\n'), ((707, 746), 'deeprankcore.tools.pssm_3dcons_to_deeprank.pssm_3dcons_to_deeprank', 'pssm_3dcons_to_deeprank', (['self.pssm_path'], {}), '(self.pssm_path)\n', (730, 746), False, 'from deeprankcore.tools.pssm_3d...
import tensorflow as tf import random as rn import numpy as np import os os.environ['PYTHONHASHSEED'] = '0' np.random.seed(45) # Setting the graph-level random seed. tf.set_random_seed(1337) rn.seed(73) from keras import backend as K session_conf = tf.ConfigProto( intra_op_parallelism_threads=1, inter_op_p...
[ "keras.models.load_model", "keras.regularizers.l2", "numpy.random.seed", "numpy.argmax", "pandas.read_csv", "keras.layers.merge.concatenate", "keras.models.Model", "sklearn.metrics.classification_report", "skopt.space.Real", "tensorflow.ConfigProto", "keras.layers.Input", "tensorflow.get_defau...
[((109, 127), 'numpy.random.seed', 'np.random.seed', (['(45)'], {}), '(45)\n', (123, 127), True, 'import numpy as np\n'), ((168, 192), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(1337)'], {}), '(1337)\n', (186, 192), True, 'import tensorflow as tf\n'), ((194, 205), 'random.seed', 'rn.seed', (['(73)'], {}), ...
import matplotlib.pyplot as plt import pandas as pd import numpy as np df=pd.read_csv('/Users/CoraJune/Google Drive/Pozyx/Data/lab_applications/lab_redos/atwood_machine/alpha_ema_testing/alpha0.9/atwood_0.9_4diff.csv', delimiter=',', usecols=['Time', '0x6103 Range']) df.columns = ['Time', 'Range'] x = df['Time'] y =...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "numpy.stack", "pandas.Series.ewm", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.tight_layout" ]
[((75, 278), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/CoraJune/Google Drive/Pozyx/Data/lab_applications/lab_redos/atwood_machine/alpha_ema_testing/alpha0.9/atwood_0.9_4diff.csv"""'], {'delimiter': '""","""', 'usecols': "['Time', '0x6103 Range']"}), "(\n '/Users/CoraJune/Google Drive/Pozyx/Data/lab_applications...
# coding=utf-8 import numpy as np import paddle from tb_paddle import SummaryWriter import matplotlib matplotlib.use('TkAgg') writer = SummaryWriter('./log') BATCH_SIZE = 768 train_reader = paddle.batch( paddle.reader.shuffle(paddle.dataset.mnist.train(), buf_size=5120), batch_size=BATCH_SIZE) mat = np.zeros(...
[ "paddle.dataset.mnist.train", "matplotlib.use", "numpy.zeros", "tb_paddle.SummaryWriter" ]
[((102, 125), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (116, 125), False, 'import matplotlib\n'), ((136, 158), 'tb_paddle.SummaryWriter', 'SummaryWriter', (['"""./log"""'], {}), "('./log')\n", (149, 158), False, 'from tb_paddle import SummaryWriter\n'), ((311, 338), 'numpy.zeros', 'np.z...
from baconian.envs.gym_env import make from baconian.core.core import EnvSpec from baconian.test.tests.set_up.setup import BaseTestCase from baconian.common.data_pre_processing import * import numpy as np class TestDataPreProcessing(BaseTestCase): def test_min_max(self): for env in (make('Pendulum-v0'), m...
[ "baconian.envs.gym_env.make", "numpy.zeros", "numpy.ones", "numpy.equal", "numpy.max", "numpy.mean", "numpy.array", "numpy.min", "numpy.var" ]
[((298, 317), 'baconian.envs.gym_env.make', 'make', (['"""Pendulum-v0"""'], {}), "('Pendulum-v0')\n", (302, 317), False, 'from baconian.envs.gym_env import make\n'), ((319, 337), 'baconian.envs.gym_env.make', 'make', (['"""Acrobot-v1"""'], {}), "('Acrobot-v1')\n", (323, 337), False, 'from baconian.envs.gym_env import m...
#!/usr/bin/env python import cv2 import numpy as np from tensorflow.keras.models import load_model from flask import Flask, Response, request, g from flask_cors import CORS from camera_opencv import Camera import time import os from collections import deque app = Flask(__name__) CORS(app, resources={r'/*': {'origin...
[ "tensorflow.keras.models.load_model", "cv2.putText", "numpy.argmax", "flask_cors.CORS", "flask.Flask", "collections.deque", "numpy.expand_dims", "time.time", "numpy.array", "cv2.imencode", "camera_opencv.Camera", "cv2.resize" ]
[((268, 283), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (273, 283), False, 'from flask import Flask, Response, request, g\n'), ((284, 329), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/*': {'origins': '*'}}"}), "(app, resources={'/*': {'origins': '*'}})\n", (288, 329), False, 'from flask_cor...
""" We consider a randomly generated svf v in the Lie algebra. We then consider its inverse in the lie Algebra: -v The composition in the Lie algebra does not exist. But we apply the numerical method anyway to see what may happen. v dot (-v) and (-v) dot v does not return the approximated identity (in green). Afterwa...
[ "matplotlib.pyplot.show", "numpy.copy", "calie.fields.generate.generate_random", "calie.visualisations.fields.fields_at_the_window.see_field", "calie.operations.lie_exp.LieExp", "calie.visualisations.fields.fields_at_the_window.see_2_fields", "calie.fields.compose.lagrangian_dot_lagrangian" ]
[((770, 815), 'calie.fields.generate.generate_random', 'gen.generate_random', (['omega'], {'parameters': '(2, 2)'}), '(omega, parameters=(2, 2))\n', (789, 815), True, 'from calie.fields import generate as gen\n'), ((832, 851), 'numpy.copy', 'np.copy', (['(-1 * svf_v)'], {}), '(-1 * svf_v)\n', (839, 851), True, 'import ...
import time import cv2 import numpy as np from test.screenUtils import grabscreen def make_coordinates(image, line_parameters): slope, intercept = line_parameters y1 = image.shape[0] y2 = int(y1 * (33 / 80)) x1 = int((y1 - intercept) / slope) x2 = int((y2 - intercept) / slope) return np.arra...
[ "cv2.line", "cv2.GaussianBlur", "cv2.Canny", "numpy.zeros_like", "numpy.average", "cv2.bitwise_and", "numpy.polyfit", "cv2.cvtColor", "cv2.waitKey", "test.screenUtils.grabscreen.printWindow", "cv2.imshow", "time.sleep", "cv2.fillPoly", "cv2.addWeighted", "numpy.array", "test.screenUtil...
[((2254, 2267), 'time.sleep', 'time.sleep', (['(4)'], {}), '(4)\n', (2264, 2267), False, 'import time\n'), ((2268, 2292), 'test.screenUtils.grabscreen.printWindow', 'grabscreen.printWindow', ([], {}), '()\n', (2290, 2292), False, 'from test.screenUtils import grabscreen\n'), ((2941, 2964), 'cv2.destroyAllWindows', 'cv2...
# Copyright (c) 2021 PaddlePaddle 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 appli...
[ "functools.partial", "numpy.minimum", "numpy.maximum", "argparse.ArgumentParser", "shapely.geometry.Polygon", "numpy.min", "numpy.max", "numpy.array", "re.findall", "numpy.where", "os.path.split", "os.path.join", "re.compile" ]
[((1412, 1423), 'numpy.array', 'np.array', (['g'], {}), '(g)\n', (1420, 1423), True, 'import numpy as np\n'), ((1432, 1443), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (1440, 1443), True, 'import numpy as np\n'), ((1971, 2000), 'numpy.min', 'np.min', (['obbs[:, 0::2]'], {'axis': '(1)'}), '(obbs[:, 0::2], axis=1)\...
# -*- coding: utf-8 -*- """ Created on Wed Dec 26 23:30:13 2018 @author: luyfc """ # python onlinetrain2_2.py import numpy as np import csv import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset,DataLoader,TensorDataset #from model import SimpleNet from mode...
[ "game2048.expectimax.board_to_move", "numpy.empty", "game2048.game.Game", "torch.utils.data.TensorDataset", "torch.device", "torch.utils.data.DataLoader", "numpy.append", "numpy.swapaxes", "numpy.loadtxt", "numpy.random.shuffle", "tqdm.tqdm", "modelv3_0.SimpleNet3", "torch.cuda.is_available"...
[((801, 848), 'numpy.zeros', 'np.zeros', ([], {'shape': '(OUT_SHAPE + (CAND,))', 'dtype': 'bool'}), '(shape=OUT_SHAPE + (CAND,), dtype=bool)\n', (809, 848), True, 'import numpy as np\n'), ((973, 995), 'numpy.swapaxes', 'np.swapaxes', (['ret', '(0)', '(2)'], {}), '(ret, 0, 2)\n', (984, 995), True, 'import numpy as np\n'...
# This code is part of Mthree. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
[ "qiskit.QuantumCircuit", "qiskit.test.mock.FakeAthens", "numpy.allclose", "numpy.ones", "scipy.sparse.linalg.LinearOperator", "numpy.arange", "qiskit.execute", "mthree.M3Mitigation" ]
[((833, 845), 'qiskit.test.mock.FakeAthens', 'FakeAthens', ([], {}), '()\n', (843, 845), False, 'from qiskit.test.mock import FakeAthens\n'), ((856, 873), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(5)'], {}), '(5)\n', (870, 873), False, 'from qiskit import QuantumCircuit, execute\n'), ((1042, 1070), 'mthree.M3Mitig...
import numpy as np import math def spatial_accuracy(ps1, ps2, thresh): ''' Args) ps1, ps2 : normalized point sets Retern) acc: spatial accuracy ''' assert len(ps1) == len(ps2), \ f"length of given point sets are differenct: len(ps1)={len(ps1)}, len(ps2)={len(ps2)}" dists = (ps...
[ "numpy.mean", "numpy.sum", "numpy.sqrt" ]
[((346, 368), 'numpy.sum', 'np.sum', (['dists'], {'axis': '(-1)'}), '(dists, axis=-1)\n', (352, 368), True, 'import numpy as np\n'), ((381, 395), 'numpy.sqrt', 'np.sqrt', (['dists'], {}), '(dists)\n', (388, 395), True, 'import numpy as np\n'), ((407, 431), 'numpy.mean', 'np.mean', (['(dists <= thresh)'], {}), '(dists <...
import numpy as np from math import pi,asin,sin import lattice_utils as lu from mpl_toolkits.axes_grid.grid_helper_curvelinear import GridHelperCurveLinear from mpl_toolkits.axes_grid.axislines import Subplot import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt def dynamic_range(Efixed,E,E_max,th...
[ "matplotlib.pyplot.title", "math.asin", "numpy.empty", "lattice_utils.lattice", "mpl_toolkits.axes_grid.axislines.Subplot", "matplotlib.pyplot.figure", "numpy.arange", "lattice_utils.dspacing", "numpy.round", "mpl_toolkits.axes_grid.grid_helper_curvelinear.GridHelperCurveLinear", "numpy.linspace...
[((230, 251), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (244, 251), False, 'import matplotlib\n'), ((474, 500), 'numpy.linspace', 'np.linspace', (['(0)', 'E_max', '(100)'], {}), '(0, E_max, 100)\n', (485, 500), True, 'import numpy as np\n'), ((513, 606), 'numpy.arange', 'np.arange', (['(thet...
import sys from pprint import pprint from silk import Silk, ValidationError from silk.mixed import Monitor, SilkBackend, MixedObject def reset_backend(sb=None): if sb is None: sb = silk_backend sb._data = None sb._form = None sb._storage = None sb._silk = None def adder(self, other): r...
[ "numpy.sum", "math.sqrt", "silk.mixed.SilkBackend", "silk.mixed.Monitor", "numpy.array", "pprint.pprint", "silk.Silk", "silk.mixed.MixedObject" ]
[((357, 370), 'silk.mixed.SilkBackend', 'SilkBackend', ([], {}), '()\n', (368, 370), False, 'from silk.mixed import Monitor, SilkBackend, MixedObject\n'), ((381, 402), 'silk.mixed.Monitor', 'Monitor', (['silk_backend'], {}), '(silk_backend)\n', (388, 402), False, 'from silk.mixed import Monitor, SilkBackend, MixedObjec...
import numpy as np from collections import OrderedDict import logging import astropy.units as apu from astropy import table from astropy.extern import six from astropy import coordinates from astropyp.utils import misc logger = logging.getLogger('astropyp.catalog') class Catalog(object): """ Wrapper for `~as...
[ "numpy.ones", "astropy.table.Table", "numpy.sum", "numpy.zeros", "numpy.isfinite", "logging.getLogger", "astropyp.utils.misc.update_ma_idx", "numpy.argsort", "numpy.ma.array", "numpy.fliplr", "numpy.where", "numpy.array", "numpy.hstack", "numpy.ma.vstack", "collections.OrderedDict", "n...
[((230, 267), 'logging.getLogger', 'logging.getLogger', (['"""astropyp.catalog"""'], {}), "('astropyp.catalog')\n", (247, 267), False, 'import logging\n'), ((5558, 5573), 'numpy.argsort', 'np.argsort', (['idx'], {}), '(idx)\n', (5568, 5573), True, 'import numpy as np\n'), ((8984, 8999), 'numpy.isfinite', 'np.isfinite',...
from __future__ import annotations import logging from typing import ( Optional, Union, NewType, List, Any, Callable ) import numpy as np # type: ignore import numba # type: ignore from numba.core.typing import cffi_utils # type: ignore from sunode import _cvodes __all__ = [ "lib", ...
[ "numba.core.typing.cffi_utils.register_module", "numpy.frombuffer", "numpy.dtype", "numba.types.Opaque", "typing.NewType", "logging.getLogger" ]
[((423, 456), 'logging.getLogger', 'logging.getLogger', (['"""sunode.basic"""'], {}), "('sunode.basic')\n", (440, 456), False, 'import logging\n'), ((505, 540), 'numba.core.typing.cffi_utils.register_module', 'cffi_utils.register_module', (['_cvodes'], {}), '(_cvodes)\n', (531, 540), False, 'from numba.core.typing impo...
""" This script demonstrates initialisation, training, evaluation, and forecasting of ForecastNet. The dataset used for the time-invariance test in section 6.1 of the ForecastNet paper is used for this demonstration. Paper: "ForecastNet: A Time-Variant Deep Feed-Forward Neural Network Architecture for Multi-Step-Ahead...
[ "forecastNet.forecastnet", "numpy.random.seed", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "numpy.std", "numpy.zeros", "demoDataset.generate_data", "evaluate.evaluate", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "train.train" ]
[((656, 673), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (670, 673), True, 'import numpy as np\n'), ((742, 774), 'demoDataset.generate_data', 'generate_data', ([], {'T': '(2750)', 'period': '(50)'}), '(T=2750, period=50)\n', (755, 774), False, 'from demoDataset import generate_data\n'), ((993, 1194)...
""" This is the main class for the NARPS analysis There are three classes defined here: Narps: this is a class that wraps the entire dataset NarpsTeam: this class is instantiated for each team NarpsDirs: This class contains info about all of the directories that are needed for this and subsequent analyses The code und...
[ "os.mkdir", "os.remove", "pickle.dump", "numpy.sum", "numpy.nan_to_num", "numpy.abs", "pandas.read_csv", "numpy.ones", "numpy.isnan", "pickle.load", "numpy.mean", "shutil.rmtree", "nipype.interfaces.fsl.model.SmoothEstimate", "os.path.join", "shutil.copy", "pandas.DataFrame", "utils....
[((3282, 3333), 'os.path.join', 'os.path.join', (["os.environ['FSLDIR']", '"""data/standard"""'], {}), "(os.environ['FSLDIR'], 'data/standard')\n", (3294, 3333), False, 'import os\n'), ((3598, 3642), 'os.path.join', 'os.path.join', (["self.dirs['logs']", '"""narps.txt"""'], {}), "(self.dirs['logs'], 'narps.txt')\n", (3...
import optmod import unittest import numpy as np class TestAdd(unittest.TestCase): def test_contruction(self): x = optmod.variable.VariableScalar(name='x') f = optmod.function.add([x, optmod.expression.make_Expression(1.)]) self.assertEqual(f.name, 'add') self.assertEqual(len(f.a...
[ "numpy.matrix", "optmod.utils.repr_number", "optmod.variable.VariableMatrix", "optmod.variable.VariableScalar", "optmod.constant.Constant", "numpy.random.random", "optmod.expression.make_Expression", "numpy.array" ]
[((130, 170), 'optmod.variable.VariableScalar', 'optmod.variable.VariableScalar', ([], {'name': '"""x"""'}), "(name='x')\n", (160, 170), False, 'import optmod\n'), ((702, 731), 'optmod.constant.Constant', 'optmod.constant.Constant', (['(4.0)'], {}), '(4.0)\n', (726, 731), False, 'import optmod\n'), ((743, 772), 'optmod...
__all__ = ['ANTsImage', 'LabelImage', 'copy_image_info', 'set_origin', 'get_origin', 'set_direction', 'get_direction', 'set_spacing', 'get_spacing', 'image_physical_space_consistency', 'image_type_cast', ...
[ "numpy.stack", "pandas.DataFrame", "functools.partialmethod", "numpy.asarray", "numpy.allclose", "numpy.sort", "numpy.rollaxis", "os.path.expanduser", "numpy.unique" ]
[((11412, 11440), 'os.path.expanduser', 'os.path.expanduser', (['filename'], {}), '(filename)\n', (11430, 11440), False, 'import os\n'), ((31292, 31351), 'numpy.allclose', 'np.allclose', (['img1.direction', 'img2.direction'], {'atol': 'tolerance'}), '(img1.direction, img2.direction, atol=tolerance)\n', (31303, 31351), ...
""" Tests for all functions in cost_function.py """ import numpy as np from pyquil.quil import (QubitPlaceholder, get_default_qubit_mapping) from pyquil.api import WavefunctionSimulator from pyquil import get_qc, Program from pyquil.gates import RX, RY, X from pyquil.paulis import PauliSum, Pa...
[ "pyquil.quil.QubitPlaceholder", "entropica_qaoa.vqe.cost_function.PrepareAndMeasureOnQVM", "pyquil.paulis.PauliTerm", "numpy.allclose", "pyquil.get_qc", "entropica_qaoa.vqe.cost_function.PrepareAndMeasureOnWFSim", "pyquil.api.WavefunctionSimulator", "pyquil.gates.RY", "pyquil.gates.RX", "pyquil.Pr...
[((518, 527), 'pyquil.Program', 'Program', ([], {}), '()\n', (525, 527), False, 'from pyquil import get_qc, Program\n'), ((791, 808), 'pyquil.paulis.PauliTerm', 'PauliTerm', (['"""Z"""', '(0)'], {}), "('Z', 0)\n", (800, 808), False, 'from pyquil.paulis import PauliSum, PauliTerm\n'), ((821, 838), 'pyquil.paulis.PauliTe...
import sys import numpy as np from pprint import pprint import time import os import argparse as argparse import json import queue OBSTACLE = 100 INIT_VAL = 10000 DESTINATION = -1 def loadProject(projectFile): with open(projectFile) as f: return json.load(f) def searchPath(curLoc, weight=0): global ...
[ "numpy.full", "json.load", "argparse.ArgumentParser", "json.loads", "numpy.savetxt", "numpy.reshape", "pprint.pprint" ]
[((3556, 3594), 'numpy.reshape', 'np.reshape', (['rawMap', '(numRows, numCols)'], {}), '(rawMap, (numRows, numCols))\n', (3566, 3594), True, 'import numpy as np\n'), ((3614, 3660), 'numpy.full', 'np.full', (['rawMap.shape', 'INIT_VAL'], {'dtype': '"""int16"""'}), "(rawMap.shape, INIT_VAL, dtype='int16')\n", (3621, 3660...
import pandas as pd import h5py import numpy as np tng = 300 if tng==100: extension = 'L75n1820' elif tng == 300: extension = 'L205n2500' else: extension = 'NotFound' data_path = '/cosma5/data/dp004/hvrn44/HOD/' if tng==100: matching_file = f'MatchedHaloes_{extension}TNG.dat' else: matching_file...
[ "pandas.DataFrame", "h5py.File", "pandas.read_csv", "pandas.merge", "numpy.vstack" ]
[((616, 742), 'pandas.read_csv', 'pd.read_csv', (['(data_path + matching_file)'], {'delimiter': '""" """', 'skiprows': '(1)', 'names': "['ID_DMO', 'ID_HYDRO', 'M200_DMO', 'M200_HYDRO']"}), "(data_path + matching_file, delimiter=' ', skiprows=1, names=[\n 'ID_DMO', 'ID_HYDRO', 'M200_DMO', 'M200_HYDRO'])\n", (627, 742...
from __future__ import absolute_import import pytest import numpy as np from . import ( get_standard_values_images_box, get_tensor_decomposition_images_box, assert_output_properties_box, assert_output_properties_box_linear, ) import tensorflow.python.keras.backend as K from tensorflow.keras.layers impor...
[ "tensorflow.keras.layers.Reshape", "decomon.layers.decomon_layers.to_monotonic", "decomon.layers.decomon_reshape.DecomonReshape", "numpy.transpose", "tensorflow.keras.layers.Permute", "tensorflow.python.keras.backend.epsilon", "tensorflow.python.keras.backend.function", "numpy.reshape", "decomon.lay...
[((471, 758), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""odd, m_0, m_1, mode, floatx"""', "[(0, 0, 1, 'hybrid', 32), (0, 0, 1, 'forward', 32), (0, 0, 1, 'ibp', 32), (\n 0, 0, 1, 'hybrid', 64), (0, 0, 1, 'forward', 64), (0, 0, 1, 'ibp', 64),\n (0, 0, 1, 'hybrid', 16), (0, 0, 1, 'forward', 16), (0,...
import functions as fun import exceptions as exc import matplotlib.pyplot as plt import numpy as np """This file tests multiple functions used in the algorithm.""" def testStdevAndMeanOfWholeImage(image,area): '''Calculates the mean and the standard deviation of an image in a sampling window from 0 to the value ente...
[ "numpy.absolute", "functions.stdevAndMeanWholeImage", "exceptions.areValuesEqual", "numpy.zeros", "functions.absSumAllPixels", "functions.image" ]
[((740, 756), 'functions.image', 'fun.image', (['image'], {}), '(image)\n', (749, 756), True, 'import functions as fun\n'), ((1061, 1093), 'numpy.zeros', 'np.zeros', ([], {'shape': '(shape1, shape2)'}), '(shape=(shape1, shape2))\n', (1069, 1093), True, 'import numpy as np\n'), ((1423, 1453), 'functions.absSumAllPixels'...
import numpy num = int(input('Digite um número para calcular seu fatorial: ')) print('Calculando {}! = {}'.format(num, num), end = ' x ') list = [num, ] while num != 1: num = num - 1 list.append(num) print(num, end=' ') print(' x' if num > 1 else ' = ', end = ' ') resultado = numpy.prod(list) ...
[ "numpy.prod" ]
[((302, 318), 'numpy.prod', 'numpy.prod', (['list'], {}), '(list)\n', (312, 318), False, 'import numpy\n')]
# Despy: A discrete event simulation framework for Python # Version 0.1 # Released under the MIT License (MIT) # Copyright (c) 2015, <NAME> """ ********************* despy.model.simulation ********************* .. autosummary:: Simulation FutureEvent NoEventsRemainingError .. todo ...
[ "numpy.random.seed", "datetime.datetime.today", "despy.model.trigger.TimeTrigger", "itertools.count", "heapq.heappop", "despy.output.results.Results", "despy.output.console.display_header", "collections.namedtuple", "random.seed", "despy.output.console.display_message", "collections.OrderedDict"...
[((1539, 1600), 'collections.namedtuple', 'namedtuple', (['"""FutureEventTuple"""', "['time', 'event', 'priority']"], {}), "('FutureEventTuple', ['time', 'event', 'priority'])\n", (1549, 1600), False, 'from collections import namedtuple, OrderedDict\n'), ((4493, 4502), 'despy.session.Session', 'Session', ([], {}), '()\...
# coding: utf-8 # # Sampling High-Dimensional Vectors # <NAME> (January 15, 2016) # In[ ]: import numpy as np import pylab try: import seaborn as sns # optional; prettier graphs except ImportError: sns = None import nengo from nengolib.compat import get_activities from nengolib.stats import ScatteredHype...
[ "seaborn.kdeplot", "numpy.empty", "nengo.utils.numpy.norm", "pylab.subplots", "numpy.mean", "pylab.figure", "nengolib.stats.Sobol", "nengo.Simulator", "nengolib.stats.ScatteredHypersphere", "pylab.title", "nengo.Node", "nengo.dists.UniformHypersphere", "numpy.random.RandomState", "pylab.yl...
[((351, 396), 'nengo.dists.UniformHypersphere', 'nengo.dists.UniformHypersphere', ([], {'surface': '(False)'}), '(surface=False)\n', (381, 396), False, 'import nengo\n'), ((414, 458), 'nengo.dists.UniformHypersphere', 'nengo.dists.UniformHypersphere', ([], {'surface': '(True)'}), '(surface=True)\n', (444, 458), False, ...
""" aero_csm_component.py Created by NWTC Systems Engineering Sub-Task on 2012-08-01. Copyright (c) NREL. All rights reserved. """ import numpy as np from math import pi, gamma, exp from wisdem.commonse.utilities import smooth_abs, smooth_min, hstack from wisdem.nrelcsm.csmPPI import PPI # Initialize ref and current...
[ "wisdem.commonse.utilities.smooth_min", "math.exp", "wisdem.nrelcsm.csmPPI.PPI", "numpy.zeros", "wisdem.commonse.utilities.smooth_abs", "math.gamma", "numpy.array", "numpy.diag", "numpy.sqrt" ]
[((462, 501), 'wisdem.nrelcsm.csmPPI.PPI', 'PPI', (['ref_yr', 'ref_mon', 'curr_yr', 'curr_mon'], {}), '(ref_yr, ref_mon, curr_yr, curr_mon)\n', (465, 501), False, 'from wisdem.nrelcsm.csmPPI import PPI\n'), ((2518, 2531), 'numpy.zeros', 'np.zeros', (['(161)'], {}), '(161)\n', (2526, 2531), True, 'import numpy as np\n')...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 3 19:49:16 2021 @author: ghiggi """ import os import glob import shutil import time import torch import zarr import dask import numpy as np import xarray as xr from modules.dataloader_autoregressive import remove_unused_Y from modules.dataloader_...
[ "numpy.isin", "modules.utils_zarr.rechunk_Dataset", "modules.utils_autoregressive.check_ar_settings", "modules.utils_torch.check_prefetch_factor", "shutil.rmtree", "modules.dataloader_autoregressive.AutoregressiveDataset", "os.path.join", "zarr.Blosc", "torch.no_grad", "os.path.dirname", "os.pat...
[((5528, 5582), 'numpy.stack', 'np.stack', (['list_to_stack'], {'axis': "dim_info_dynamic['time']"}), "(list_to_stack, axis=dim_info_dynamic['time'])\n", (5536, 5582), True, 'import numpy as np\n'), ((5923, 5955), 'modules.utils_io._get_feature_order', '_get_feature_order', (['data_dynamic'], {}), '(data_dynamic)\n', (...
import numpy as np import tensorflow as tf import tensorflow_probability as tfp from probflow.modules import Dense, Sequential from probflow.parameters import Parameter from probflow.utils.settings import Sampling tfd = tfp.distributions def is_close(a, b, tol=1e-3): return np.abs(a - b) < tol def test_Sequen...
[ "probflow.modules.Dense", "probflow.utils.settings.Sampling", "numpy.abs", "tensorflow.random.normal" ]
[((642, 666), 'tensorflow.random.normal', 'tf.random.normal', (['[4, 5]'], {}), '([4, 5])\n', (658, 666), True, 'import tensorflow as tf\n'), ((283, 296), 'numpy.abs', 'np.abs', (['(a - b)'], {}), '(a - b)\n', (289, 296), True, 'import numpy as np\n'), ((908, 921), 'probflow.utils.settings.Sampling', 'Sampling', ([], {...
from pop_finder import __version__ from pop_finder import pop_finder from pop_finder import contour_classifier import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats import os import shutil import pytest # helper data infile_all = "tests/test_inputs/onlyAtl_500.recode.vcf.locato...
[ "numpy.load", "os.remove", "pandas.read_csv", "pop_finder.contour_classifier.cont_finder", "os.path.isfile", "matplotlib.pyplot.figure", "shutil.rmtree", "pop_finder.contour_classifier.kfcv", "pandas.DataFrame", "pop_finder.contour_classifier.contour_classifier", "matplotlib.pyplot.close", "po...
[((766, 806), 'numpy.load', 'np.load', (['"""tests/test_inputs/X_train.npy"""'], {}), "('tests/test_inputs/X_train.npy')\n", (773, 806), True, 'import numpy as np\n'), ((823, 840), 'numpy.zeros', 'np.zeros', ([], {'shape': '(0)'}), '(shape=0)\n', (831, 840), True, 'import numpy as np\n'), ((851, 895), 'pandas.read_csv'...
# Compatibility Python 2/3 from __future__ import division, print_function, absolute_import from builtins import range # ---------------------------------------------------------------------------------------------------------------------- import opto from dotmap import DotMap import matplotlib.pyplot as plt import nu...
[ "opto.opto.plot.paretoFront", "matplotlib.pyplot.show", "logging.FileHandler", "matplotlib.pyplot.ioff", "matplotlib.pyplot.scatter", "opto.PAREGO", "opto.opto.classes.StopCriteria", "dotmap.DotMap", "opto.utils.create_folder", "matplotlib.pyplot.figure", "numpy.array", "opto.data.load", "op...
[((438, 457), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (455, 457), False, 'import logging\n'), ((510, 551), 'opto.utils.create_folder', 'rutils.create_folder', ([], {'nameFolder': 'NAMEFILE'}), '(nameFolder=NAMEFILE)\n', (530, 551), True, 'import opto.utils as rutils\n'), ((572, 615), 'logging.FileHa...
# This code demonstrates subtle crime I with Compressed sensing # Run the *fast* experiment to see the images & NRMSE valus on top of them. # Run the *long* experiment (10 slices x 3 samlpling mask realizations each) to get statistics. # Then run the script CS_DL_knee_prep_NRMSE_figure.py to produce the statistics g...
[ "h5py.File", "numpy.save", "numpy.ones_like", "os.makedirs", "sigpy.ifft", "numpy.multiply", "os.path.exists", "numpy.expand_dims", "numpy.isnan", "sigpy.mri.app.L1WaveletRecon", "subtle_data_crimes.functions.sampling_funcs.gen_2D_var_dens_mask", "numpy.rot90", "numpy.array", "os.listdir" ...
[((935, 951), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (943, 951), True, 'import numpy as np\n'), ((975, 991), 'numpy.array', 'np.array', (['[1, 2]'], {}), '([1, 2])\n', (983, 991), True, 'import numpy as np\n'), ((10189, 10222), 'numpy.save', 'np.save', (['gold_filename', 'gold_dict'], {}), '(gold_fi...
import numpy as np import torch as th from tpp.processes.hawkes import neg_log_likelihood_old as nll_old from tpp.processes.hawkes import neg_log_likelihood as nll_new from tpp.utils.keras_preprocessing.sequence import pad_sequences def test_nll(): n_seq = 10 my_alpha = 0.7 my_mu = 0.1 pad_id = -1. ...
[ "torch.stack", "tpp.utils.keras_preprocessing.sequence.pad_sequences", "numpy.allclose", "tpp.processes.hawkes.neg_log_likelihood_old", "numpy.random.randint", "torch.rand", "tpp.processes.hawkes.neg_log_likelihood", "torch.from_numpy" ]
[((609, 631), 'torch.stack', 'th.stack', (['nll_1'], {'dim': '(0)'}), '(nll_1, dim=0)\n', (617, 631), True, 'import torch as th\n'), ((656, 728), 'tpp.utils.keras_preprocessing.sequence.pad_sequences', 'pad_sequences', (['my_points'], {'padding': '"""post"""', 'dtype': 'np.float32', 'value': 'pad_id'}), "(my_points, pa...
import numpy as np def is_sklearn_linear_classifier(obj): """ Checks if object is a sklearn linear classifier for a binary outcome :param obj: object """ binary_flag = hasattr(obj, 'classes_') and len(obj.classes_) == 2 linear_flag = hasattr(obj, 'coef_') and hasattr(obj, 'intercept_'...
[ "numpy.array", "numpy.isfinite" ]
[((2083, 2097), 'numpy.isfinite', 'np.isfinite', (['t'], {}), '(t)\n', (2094, 2097), True, 'import numpy as np\n'), ((1998, 2009), 'numpy.array', 'np.array', (['w'], {}), '(w)\n', (2006, 2009), True, 'import numpy as np\n'), ((2050, 2064), 'numpy.isfinite', 'np.isfinite', (['w'], {}), '(w)\n', (2061, 2064), True, 'impo...
import numpy as np def generate_features(draw_graphs, raw_data, axes, sampling_freq, scale_axes): # features is a 1D array, reshape so we have a matrix raw_data = raw_data.reshape(int(len(raw_data) / len(axes)), len(axes)) features = [] graphs = [] # split out the data from all axes for ax in...
[ "numpy.array" ]
[((511, 522), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (519, 522), True, 'import numpy as np\n')]
import os from random import randint, seed import torch import numpy as np import cv2 ''' Code adapted from https://github.com/MathiasGruber/PConv-Keras/blob/master/libs/util.py ''' class MaskGenerator: def __init__(self, channels=1, rand_seed=None, filepath=None, channels_first=True): """Convenience fun...
[ "cv2.line", "os.listdir", "numpy.moveaxis", "cv2.circle", "random.randint", "numpy.zeros", "numpy.ones", "cv2.warpAffine", "cv2.ellipse", "random.seed", "numpy.random.randint", "numpy.random.choice", "cv2.erode", "cv2.getRotationMatrix2D", "torch.tensor" ]
[((1585, 1645), 'numpy.zeros', 'np.zeros', (['(self.height, self.width, self.channels)', 'np.uint8'], {}), '((self.height, self.width, self.channels), np.uint8)\n', (1593, 1645), True, 'import numpy as np\n'), ((2940, 2959), 'torch.tensor', 'torch.tensor', (['img_1'], {}), '(img_1)\n', (2952, 2959), False, 'import torc...
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Feb 28 10:58:32 2020 @author: seba """ # Prueba con serial # Recordar instalar la libreria serial #pip install pyserial #from serial import Serial #python -m serial.tools.list_ports # Hace una lista de los puertos import serial import time import numpy...
[ "serial.Serial", "statistics.median", "statistics.stdev", "numpy.zeros", "time.time", "time.sleep", "sys.stdout.flush", "math.trunc" ]
[((904, 919), 'serial.Serial', 'serial.Serial', ([], {}), '()\n', (917, 919), False, 'import serial\n'), ((999, 1012), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1009, 1012), False, 'import time\n'), ((1146, 1162), 'numpy.zeros', 'np.zeros', (['(3, 1)'], {}), '((3, 1))\n', (1154, 1162), True, 'import numpy as...
# -*- coding: utf-8 -*- # https://gist.github.com/mikalv/3947ccf21366669ac06a01f39d7cff05 # http://cv-tricks.com/tensorflow-tutorial/save-restore-tensorflow-models-quick-complete-tutorial/ import tensorflow as tf import numpy as np import os, sys import re import collections #set hyperparameters max_len = 40 step = ...
[ "os.mkdir", "numpy.sum", "numpy.argmax", "tensorflow.get_collection", "tensorflow.reset_default_graph", "numpy.random.multinomial", "tensorflow.reshape", "tensorflow.train.RMSPropOptimizer", "tensorflow.matmul", "tensorflow.contrib.rnn.static_rnn", "tensorflow.train.latest_checkpoint", "numpy....
[((708, 734), 'collections.Counter', 'collections.Counter', (['WORDS'], {}), '(WORDS)\n', (727, 734), False, 'import collections\n'), ((450, 475), 'os.path.exists', 'os.path.exists', (['SAVE_PATH'], {}), '(SAVE_PATH)\n', (464, 475), False, 'import os, sys\n'), ((481, 500), 'os.mkdir', 'os.mkdir', (['SAVE_PATH'], {}), '...
# coding=utf-8 # date: 2018/12/24, 15:27 # name: smz import numpy as np import tensorflow as tf from LinearModel.modules.model import TumorModel from LinearModel.configuration.options import opts def TumorModelTrain(): data_X = np.load("../data/train_data_X.npy") data_Y = np.load("../data/train_data_Y.npy") ...
[ "numpy.load", "tensorflow.global_variables_initializer", "LinearModel.modules.model.TumorModel", "tensorflow.Session", "numpy.expand_dims" ]
[((235, 270), 'numpy.load', 'np.load', (['"""../data/train_data_X.npy"""'], {}), "('../data/train_data_X.npy')\n", (242, 270), True, 'import numpy as np\n'), ((284, 319), 'numpy.load', 'np.load', (['"""../data/train_data_Y.npy"""'], {}), "('../data/train_data_Y.npy')\n", (291, 319), True, 'import numpy as np\n'), ((359...
# -*- coding: utf-8 -*- """ Created on 2020.05.19 @author: <NAME>, <NAME>, <NAME>, <NAME> Code based on: """ import numpy as np from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor class RandomForest: """docstring for RandomForest""" def __init__(self, model_configs, task_type='Regre...
[ "sklearn.ensemble.RandomForestClassifier", "numpy.random.seed", "sklearn.ensemble.RandomForestRegressor" ]
[((726, 763), 'numpy.random.seed', 'np.random.seed', ([], {'seed': 'self.random_seed'}), '(seed=self.random_seed)\n', (740, 763), True, 'import numpy as np\n'), ((921, 1161), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': 'self.n_estimators', 'max_features': 'self.max_feature...
""" Geographical measurement and analysis Provides Point, Line, and Polygon classes, and their Multipart equivalents, with methods for simple measurements such as distance, area, and direction. """ from __future__ import division import math import itertools import numbers import numpy as np from coordstring import C...
[ "numpy.sum", "numpy.linalg.lstsq", "math.sqrt", "numpy.eye", "math.atan2", "numpy.zeros", "math.sin", "numpy.argmin", "numpy.equal", "numpy.min", "numpy.array", "math.cos", "numpy.reshape", "numpy.dot", "coordstring.CoordString", "itertools.chain", "numpy.vstack" ]
[((63355, 63391), 'numpy.linalg.lstsq', 'np.linalg.lstsq', (['A', 'vecp'], {'rcond': 'None'}), '(A, vecp, rcond=None)\n', (63370, 63391), True, 'import numpy as np\n'), ((63403, 63424), 'numpy.reshape', 'np.reshape', (['M', '[2, 3]'], {}), '(M, [2, 3])\n', (63413, 63424), True, 'import numpy as np\n'), ((1746, 1780), '...
from __future__ import division, print_function from os import mkdir import numpy as np import torch from torch import nn import torch.nn.functional as F import sys import time import torch.utils.data from torchvision import transforms, datasets from torch._six import with_metaclass from torch._C import _ImperativeEngi...
[ "os.mkdir", "torch.distributions.Categorical", "torch.mm", "sys.stdout.flush", "torchvision.transforms.Normalize", "torch._C._ImperativeEngine", "torch.utils.data.DataLoader", "torch.load", "torch.Tensor", "torch.nn.functional.nll_loss", "torch.log", "torch.manual_seed", "torch.norm", "tor...
[((1316, 1374), 'torch._six.with_metaclass', 'with_metaclass', (['VariableMeta', 'torch._C._LegacyVariableBase'], {}), '(VariableMeta, torch._C._LegacyVariableBase)\n', (1330, 1374), False, 'from torch._six import with_metaclass\n'), ((1417, 1435), 'torch._C._ImperativeEngine', 'ImperativeEngine', ([], {}), '()\n', (14...
# -*- coding: utf-8 -*- from os import path import numpy as np from mrsimulator.models import CzjzekDistribution from mrsimulator.models import ExtCzjzekDistribution from mrsimulator.models.utils import x_y_from_zeta_eta from mrsimulator.models.utils import x_y_to_zeta_eta __author__ = "<NAME>" __email__ = "<EMAIL>" ...
[ "os.path.abspath", "numpy.meshgrid", "numpy.load", "numpy.testing.assert_almost_equal", "mrsimulator.models.CzjzekDistribution", "numpy.histogram", "mrsimulator.models.ExtCzjzekDistribution", "numpy.arange", "numpy.exp", "mrsimulator.models.utils.x_y_to_zeta_eta", "os.path.join" ]
[((347, 369), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__file__)\n', (359, 369), False, 'from os import path\n'), ((452, 502), 'os.path.join', 'path.join', (['MODULE_DIR', '"""test_data"""', '"""eps=0.05.npy"""'], {}), "(MODULE_DIR, 'test_data', 'eps=0.05.npy')\n", (461, 502), False, 'from os import pat...
import numpy as np import matplotlib.pyplot as plt import matplotlib from tensorflow.keras.preprocessing import image import os import glob import PIL #PIL.Image.MAX_IMAGE_PIXELS = 933120000 images = "F:/Datasets/DigestPath/mask_npy" outfolder = "F:/Datasets/DigestPath/masks" paths = glob.glob(os.path.join(images,"*....
[ "numpy.load", "os.makedirs", "os.path.exists", "os.path.split", "os.path.join" ]
[((297, 326), 'os.path.join', 'os.path.join', (['images', '"""*.npy"""'], {}), "(images, '*.npy')\n", (309, 326), False, 'import os\n'), ((335, 360), 'os.path.exists', 'os.path.exists', (['outfolder'], {}), '(outfolder)\n', (349, 360), False, 'import os\n'), ((370, 392), 'os.makedirs', 'os.makedirs', (['outfolder'], {}...
import cv2 import numpy as np import pytest from ..utils import vis, display @pytest.mark.vis def test_vis_line_scalar_positive(): image = np.zeros((120, 160, 3), np.uint8) vis_image = vis.vis_line_scalar(image, 0.5) assert not np.array_equal(vis_image, image) cv2.imshow("test_vis_line_scalar_positi...
[ "numpy.array_equal", "pytest.raises", "cv2.imshow", "numpy.zeros" ]
[((146, 179), 'numpy.zeros', 'np.zeros', (['(120, 160, 3)', 'np.uint8'], {}), '((120, 160, 3), np.uint8)\n', (154, 179), True, 'import numpy as np\n'), ((281, 335), 'cv2.imshow', 'cv2.imshow', (['"""test_vis_line_scalar_positive"""', 'vis_image'], {}), "('test_vis_line_scalar_positive', vis_image)\n", (291, 335), False...
import numpy from btypes.big_endian import * import gl import gx from OpenGL.GL import * import logging logger = logging.getLogger(__name__) class Header(Struct): magic = ByteString(4) section_size = uint32 shape_count = uint16 __padding__ = Padding(2) shape_offset = uint32 index_offset = uin...
[ "gx.PrimitiveType", "gl.Buffer", "numpy.empty", "numpy.frombuffer", "logging.getLogger", "gl.VertexArray", "numpy.unique" ]
[((114, 141), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (131, 141), False, 'import logging\n'), ((3110, 3150), 'numpy.empty', 'numpy.empty', (['element_count', 'numpy.uint16'], {}), '(element_count, numpy.uint16)\n', (3121, 3150), False, 'import numpy\n'), ((6340, 6356), 'gl.VertexAr...
import argparse import torch import torch.nn.functional as F import librosa import numpy import tqdm import soundfile as sf from net import UpsampleNet from net import WaveNet from dataset import MuLaw from dataset import Preprocess import pytorch_lightning as pl class WavenetLightningModule(pl.LightningModule): ...
[ "numpy.random.choice", "dataset.Preprocess", "argparse.ArgumentParser", "torch.zeros_like", "dataset.MuLaw", "net.UpsampleNet", "torch.nn.functional.softmax", "torch.Tensor", "net.WaveNet", "soundfile.write", "torch.zeros", "torch.no_grad" ]
[((777, 802), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (800, 802), False, 'import argparse\n'), ((1593, 1651), 'torch.zeros', 'torch.zeros', (['(1, model.a_channels, 1)'], {'dtype': 'torch.float32'}), '((1, model.a_channels, 1), dtype=torch.float32)\n', (1604, 1651), False, 'import torch\...
# 評価関数による評価 import numpy as np import copy from .generator import Generator from .standard_data import StandardData from .leave_one_out import LeaveOneOut from prediction import Prediction class CrossValidation(object): def __init__(self, data, design_variables, objective_variables): # CrossValidation を使...
[ "copy.deepcopy", "numpy.count_nonzero", "numpy.zeros", "numpy.ones", "numpy.argsort", "numpy.append", "numpy.max", "numpy.min", "numpy.array", "numpy.any", "prediction.Prediction" ]
[((738, 767), 'copy.deepcopy', 'copy.deepcopy', (['individual_set'], {}), '(individual_set)\n', (751, 767), False, 'import copy\n'), ((1151, 1195), 'numpy.array', 'np.array', (['self._data[0:, 0:design_variables]'], {}), '(self._data[0:, 0:design_variables])\n', (1159, 1195), True, 'import numpy as np\n'), ((1213, 1262...
# -*- coding: utf-8 -*- import numpy as np from typing import Callable from scipy.integrate import nquad from .entropy import coupled_entropy def shannon_entropy(density_func: Callable[..., np.ndarray], dim: int = 1, support: list = [[-np.inf, np.inf]], root...
[ "numpy.array", "scipy.integrate.nquad" ]
[((2476, 2490), 'numpy.array', 'np.array', (['args'], {}), '(args)\n', (2484, 2490), True, 'import numpy as np\n'), ((2646, 2688), 'scipy.integrate.nquad', 'nquad', (['un_normalized_density_func', 'support'], {}), '(un_normalized_density_func, support)\n', (2651, 2688), False, 'from scipy.integrate import nquad\n'), ((...
from ctapipe.utils.datasets import get_example_simtelarray_file from ctapipe.io.hessio import hessio_event_source from ctapipe.core import Container from ctapipe.io.containers import RawData from ctapipe.io.containers import MCShowerData, CentralTriggerData from ctapipe.reco.cleaning import tailcuts_clean from ctapipe...
[ "numpy.abs", "argparse.ArgumentParser", "numpy.sum", "ctapipe.core.Container", "pyhessio.get_mc_shower_altitude", "ctapipe.io.containers.MCShowerData", "pyhessio.get_pedestal", "ctapipe.io.CameraGeometry.guess", "ctapipe.calib.array.muon_ring_finder.chaudhuri_kundu_circle_fit", "ctapipe.coordinate...
[((816, 856), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (835, 856), False, 'import logging\n'), ((1541, 1606), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Perform simple Hillas Reco"""'}), "(description='Perform simple H...
from libs.can import CANSocket from libs.myactuator import MyActuator from time import perf_counter, sleep import numpy as np # import getpass # password = getpass.getpass() # the serial port of device # you may find one by examing /dev/ folder, # this is usually devices ttyACM # os.system(f"sudo slcand -o -c -s8 /d...
[ "matplotlib.pyplot.show", "numpy.zeros", "time.perf_counter", "time.sleep", "libs.can.CANSocket", "numpy.sin", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig", "libs.myactuator.MyActuator" ]
[((526, 562), 'libs.can.CANSocket', 'CANSocket', ([], {'serial_port': 'serial_device'}), '(serial_port=serial_device)\n', (535, 562), False, 'from libs.can import CANSocket\n'), ((589, 616), 'libs.myactuator.MyActuator', 'MyActuator', ([], {'can_bus': 'can_bus'}), '(can_bus=can_bus)\n', (599, 616), False, 'from libs.my...
import time import pathlib import numpy as np import json from .logging import logger # Timing and Performance def timing_info(method): def wrapper(*args, **kw): start_time = time.time() result = method(*args, **kw) end_time = time.time() logger.info(f"timing_info: {method.__name__}...
[ "json.dump", "json.load", "time.time", "pathlib.Path", "numpy.asscalar" ]
[((570, 581), 'time.time', 'time.time', ([], {}), '()\n', (579, 581), False, 'import time\n'), ((188, 199), 'time.time', 'time.time', ([], {}), '()\n', (197, 199), False, 'import time\n'), ((256, 267), 'time.time', 'time.time', ([], {}), '()\n', (265, 267), False, 'import time\n'), ((1567, 1621), 'json.dump', 'json.dum...
#!/usr/bin/env python # -*- coding: utf-8 -*- # 3rd party imports import numpy as np import xarray as xr __author__ = "<NAME>" __email__ = "<EMAIL>" __copyright__ = "Copyright 2020-2021" __license__ = "MIT" __version__ = "2.3.7" __status__ = "Prototype" def feeps_sector_spec(inp_alle): r"""Creates sector-spectr...
[ "numpy.where", "numpy.nanmean", "numpy.arange", "xarray.Dataset" ]
[((1784, 1804), 'xarray.Dataset', 'xr.Dataset', (['out_dict'], {}), '(out_dict)\n', (1794, 1804), True, 'import xarray as xr\n'), ((1408, 1456), 'numpy.nanmean', 'np.nanmean', (['sensor_data[c_start:spin, :]'], {'axis': '(1)'}), '(sensor_data[c_start:spin, :], axis=1)\n', (1418, 1456), True, 'import numpy as np\n'), ((...
import numpy as np import cv2 import os def handsegment(frame): hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) #lower, upper = boundaries[0] #lower = np.array(lower, dtype="uint8") #upper = np.array(upper, dtype="uint8") lower = np.array([0, 48, 80], dtype="uint8") upper = np.array([20, 255, 255]...
[ "cv2.bitwise_not", "cv2.bitwise_and", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "numpy.ones", "cv2.VideoCapture", "numpy.array", "cv2.destroyAllWindows", "cv2.inRange", "os.listdir", "cv2.resize" ]
[((75, 113), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2HSV'], {}), '(frame, cv2.COLOR_BGR2HSV)\n', (87, 113), False, 'import cv2\n'), ((248, 284), 'numpy.array', 'np.array', (['[0, 48, 80]'], {'dtype': '"""uint8"""'}), "([0, 48, 80], dtype='uint8')\n", (256, 284), True, 'import numpy as np\n'), ((297, 3...
import os import struct from enum import Enum from typing import Optional import numpy as np import torch from hivemind.utils import DHTExpiration, MPFuture, get_dht_time, get_logger logger = get_logger(__name__) class AveragingStage(Enum): IDLE = 0 # still initializing LOOKING_FOR_GROUP = 1 # running de...
[ "os.getpid", "numpy.isfinite", "hivemind.utils.get_logger", "torch.zeros", "hivemind.utils.get_dht_time" ]
[((195, 215), 'hivemind.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'from hivemind.utils import DHTExpiration, MPFuture, get_dht_time, get_logger\n'), ((3946, 3965), 'numpy.isfinite', 'np.isfinite', (['weight'], {}), '(weight)\n', (3957, 3965), True, 'import numpy as np\n'), ...
""" ObservationBuilder objects are objects that can be passed to environments designed for customizability. The ObservationBuilder-derived custom classes implement 2 functions, reset() and get() or get(handle). + `reset()` is called after each environment reset (i.e. at the beginning of a new episode), to allow for pr...
[ "numpy.count_nonzero", "numpy.zeros", "numpy.append", "numpy.min", "flatland.core.grid.grid_utils.coordinate_to_position", "numpy.where", "collections.namedtuple", "src.utils.assign_priority", "numpy.delete" ]
[((1542, 1615), 'collections.namedtuple', 'collections.namedtuple', (['"""Node"""', '"""cell_position agent_direction is_target"""'], {}), "('Node', 'cell_position agent_direction is_target')\n", (1564, 1615), False, 'import collections\n'), ((5979, 6025), 'numpy.zeros', 'np.zeros', (['self.max_prediction_depth'], {'dt...
""" Implimentation of Density-Based Clustering Validation "DBCV" """ import numpy as np from scipy.spatial.distance import cdist from scipy.sparse.csgraph import minimum_spanning_tree from scipy.sparse import csgraph from tqdm import tqdm class DBCV: def __init__(self, samples: np.ndarray, labels: np.ndarray, di...
[ "scipy.spatial.distance.cdist", "numpy.sum", "numpy.unique", "numpy.transpose", "scipy.sparse.csgraph.minimum_spanning_tree", "numpy.shape", "numpy.max", "numpy.min", "numpy.where", "numpy.array", "numpy.concatenate", "scipy.sparse.csgraph.dijkstra" ]
[((1571, 1592), 'scipy.sparse.csgraph.dijkstra', 'csgraph.dijkstra', (['mst'], {}), '(mst)\n', (1587, 1592), False, 'from scipy.sparse import csgraph\n'), ((2807, 2852), 'scipy.spatial.distance.cdist', 'cdist', (['samples', 'samples'], {'metric': 'dist_function'}), '(samples, samples, metric=dist_function)\n', (2812, 2...
import numpy as np import scipy import matplotlib.pyplot as plt plt.rcParams.update({'font.size': 16}) def plot_results(title, ylim=None, xlim=None, whether_save=True): plt.figure(figsize=(6,4)) for method in ('lh_sgpr', 'lh_vhgpr', 'seq_vhgpr'): results = np.load('data/' + method + '.npy', ...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.xlim", "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.ylim", "numpy.std", "matplotlib.pyplot.figure", "matplotlib.pyplot.rcParams.update", "numpy.mean", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.savefig"...
[((64, 102), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 16}"], {}), "({'font.size': 16})\n", (83, 102), True, 'import matplotlib.pyplot as plt\n'), ((180, 206), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4)'}), '(figsize=(6, 4))\n', (190, 206), True, 'import matplo...
from collections import defaultdict import numpy as np from sklearn.model_selection import train_test_split class Samples: def __init__(self, x, y): self.x = x self.y = y class Data: def __init__(self, train, test, build_probs, name): self.train = train self.test = test ...
[ "collections.defaultdict", "sklearn.model_selection.train_test_split", "numpy.transpose" ]
[((764, 812), 'sklearn.model_selection.train_test_split', 'train_test_split', (['samples', 'labels'], {'test_size': '(0.2)'}), '(samples, labels, test_size=0.2)\n', (780, 812), False, 'from sklearn.model_selection import train_test_split\n'), ((7049, 7070), 'collections.defaultdict', 'defaultdict', (['np.array'], {}), ...
import torch import numpy as np def gaussian_pdf(x, mu, sigma): return (1 / (sigma * np.sqrt(2 * np.pi))) * torch.exp( (-1 / 2) * torch.square((x - mu) / (sigma)) ) def signed_gaussian_pdf(x, mu, sigma): return ( (1 / (sigma * np.sqrt(2 * np.pi))) * torch.exp((-1 / 2) * torch.squ...
[ "torch.sign", "torch.square", "doctest.testmod", "numpy.sqrt" ]
[((1674, 1691), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (1689, 1691), False, 'import doctest\n'), ((355, 373), 'torch.sign', 'torch.sign', (['(x - mu)'], {}), '(x - mu)\n', (365, 373), False, 'import torch\n'), ((1588, 1601), 'torch.sign', 'torch.sign', (['y'], {}), '(y)\n', (1598, 1601), False, 'import...
import logging import warnings import numpy as np from pytplot import get_data, store_data, options # use nanmean from bottleneck if it's installed, otherwise use the numpy one # bottleneck nanmean is ~2.5x faster try: import bottleneck as bn nanmean = bn.nanmean except ImportError: nanmean = np.nanmean ...
[ "pytplot.store_data", "numpy.abs", "warnings.simplefilter", "logging.basicConfig", "pytplot.get_data", "logging.captureWarnings", "numpy.array", "warnings.catch_warnings", "pytplot.options" ]
[((320, 349), 'logging.captureWarnings', 'logging.captureWarnings', (['(True)'], {}), '(True)\n', (343, 349), False, 'import logging\n'), ((350, 458), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s: %(message)s"""', 'datefmt': '"""%d-%b-%y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format...
""" Masked Grid for Two Sides of a Fault ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In this example, I demonstrate how to use a surface mesh of a fault in the subsurface to create a data mask on a modeling grid. This is a particularly useful exercise for scenarios where you may want to perform some sort of modeling in a dif...
[ "numpy.sum", "pyvista.examples.downloads._download_file", "pyvista.read", "numpy.zeros", "pyvista.Plotter", "numpy.arange", "numpy.argwhere", "pyvista.UniformGrid", "numpy.repeat" ]
[((656, 713), 'pyvista.examples.downloads._download_file', 'examples.downloads._download_file', (['"""opal_mound_fault.vtk"""'], {}), "('opal_mound_fault.vtk')\n", (689, 713), False, 'from pyvista import examples\n'), ((722, 735), 'pyvista.read', 'pv.read', (['path'], {}), '(path)\n', (729, 735), True, 'import pyvista ...
#! /usr/bin/env python # # # Tool: dumps a candidate waveform to a frame file. # Default GPS time used is boring # Tries to be as close to C as possible -- no interface via pylal/glue # # EXAMPLE # python util_NRWriteFrame.py --group 'Sequence-SXS-All' --param 1 --verbose # python util_NRWriteFrame.py --incl 1.5 ...
[ "argparse.ArgumentParser", "numpy.argmax", "matplotlib.pyplot.figure", "glue.ligolw.table.get_table", "numpy.arange", "matplotlib.get_backend", "RIFT.lalsimutils.hoft_to_frame_data", "RIFT.lalsimutils.frame_data_to_hoft", "numpy.max", "matplotlib.pyplot.show", "RIFT.lalsimutils.ChooseWaveformPar...
[((787, 812), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (810, 812), False, 'import argparse\n'), ((2921, 2955), 'RIFT.lalsimutils.ChooseWaveformParams', 'lalsimutils.ChooseWaveformParams', ([], {}), '()\n', (2953, 2955), True, 'import RIFT.lalsimutils as lalsimutils\n'), ((4288, 4332), 'RI...
# Copyright 2019 kubeflow.org. # # 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,...
[ "logging.info", "numpy.array", "logging.basicConfig" ]
[((977, 1019), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'SELDON_LOGLEVEL'}), '(level=SELDON_LOGLEVEL)\n', (996, 1019), False, 'import logging\n'), ((1404, 1420), 'numpy.array', 'np.array', (['inputs'], {}), '(inputs)\n', (1412, 1420), True, 'import numpy as np\n'), ((1429, 1495), 'logging.info', 'lo...
import numpy as np from preprocessing import extractFeatures def predict(wav, model): mfccs = extractFeatures(wav) if mfccs.shape[1] > 433: mfccs = mfccs[:,:433] elif mfccs.shape[1] < 433: mfccs = np.concatenate((mfccs,mfccs[:,(mfccs.shape[1] - (433-mfccs.shape[1])):mfccs.shape[1]]), axis=...
[ "numpy.concatenate", "preprocessing.extractFeatures", "numpy.argmax" ]
[((100, 120), 'preprocessing.extractFeatures', 'extractFeatures', (['wav'], {}), '(wav)\n', (115, 120), False, 'from preprocessing import extractFeatures\n'), ((509, 527), 'numpy.argmax', 'np.argmax', (['results'], {}), '(results)\n', (518, 527), True, 'import numpy as np\n'), ((227, 329), 'numpy.concatenate', 'np.conc...
""" Imports we need. Note: You may _NOT_ add any more imports than these. """ import argparse import imageio import logging import numpy as np from PIL import Image def load_image(filename): """Loads the provided image file, and returns it as a numpy array.""" im = Image.open(filename) return np.array(im...
[ "numpy.zeros_like", "argparse.ArgumentParser", "logging.basicConfig", "numpy.zeros", "numpy.linalg.eig", "PIL.Image.open", "logging.info", "numpy.min", "numpy.max", "numpy.int", "numpy.array", "numpy.linalg.inv", "imageio.imwrite" ]
[((277, 297), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (287, 297), False, 'from PIL import Image\n'), ((309, 321), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (317, 321), True, 'import numpy as np\n'), ((1096, 1979), 'numpy.array', 'np.array', (['[[pts1[0, 0], pts1[0, 1], 1, 0, 0, 0, -...
""" Experiment to compute the fraction of unique filtration values for cells in an Alpha complex """ import os import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from dmt.complexes import AlphaComplex RESULT_PATH = os.path.join(os.path.dirname(__file__), "reducible.csv") PL...
[ "pandas.DataFrame", "seaborn.lineplot", "dmt.complexes.AlphaComplex", "pandas.read_csv", "os.path.dirname", "numpy.random.random", "pandas.melt", "pandas.concat", "matplotlib.pyplot.savefig" ]
[((274, 299), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (289, 299), False, 'import os\n'), ((343, 368), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (358, 368), False, 'import os\n'), ((444, 480), 'numpy.random.random', 'np.random.random', (['(point_count, di...
from FT.weighted_tracts import load_ft, nodes_labels_mega, nodes_by_index_mega import matplotlib.pyplot as plt from FT.all_subj import all_subj_names from dipy.tracking import utils import numpy as np from dipy.tracking.streamline import values_from_volume import nibabel as nib import os index_to_text_file = r'C:\User...
[ "matplotlib.pyplot.subplot", "FT.weighted_tracts.nodes_labels_mega", "numpy.save", "matplotlib.pyplot.show", "nibabel.load", "dipy.tracking.utils.connectivity_matrix", "dipy.tracking.streamline.values_from_volume", "matplotlib.pyplot.figure", "numpy.mean", "FT.weighted_tracts.nodes_by_index_mega",...
[((580, 599), 'FT.weighted_tracts.load_ft', 'load_ft', (['tract_path'], {}), '(tract_path)\n', (587, 599), False, 'from FT.weighted_tracts import load_ft, nodes_labels_mega, nodes_by_index_mega\n'), ((616, 639), 'os.listdir', 'os.listdir', (['folder_name'], {}), '(folder_name)\n', (626, 639), False, 'import os\n'), ((8...
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as N def main(dt=1e-1, R=4, T=1): """Example linear stochastic differential equation: λX(t) dt + μX(t)dW(t) """ # The number of points in weiner process we need wN = int(N.ceil(T/dt)) # First get the random numbers needed to m...
[ "matplotlib.pyplot.show", "numpy.ceil", "matplotlib.pyplot.plot", "numpy.random.randn", "numpy.insert", "numpy.cumsum", "numpy.arange", "numpy.exp", "numpy.random.rand", "numpy.sqrt" ]
[((396, 409), 'numpy.cumsum', 'N.cumsum', (['dWt'], {}), '(dWt)\n', (404, 409), True, 'import numpy as N\n'), ((418, 435), 'numpy.insert', 'N.insert', (['W', '(0)', '(0)'], {}), '(W, 0, 0)\n', (426, 435), True, 'import numpy as N\n'), ((1616, 1634), 'numpy.arange', 'N.arange', (['(0)', 'T', 'dt'], {}), '(0, T, dt)\n', ...
import sys import os os.environ['ABACUS'] = os.environ['HOME'] + '/abacus' sys.path.insert(0, os.environ['ABACUS']) from pathlib import Path from abacusnbody.data import read_abacus from abacusnbody.data.compaso_halo_catalog import CompaSOHaloCatalog import astropy.table from astropy.table import Table import numba ...
[ "numpy.abs", "numpy.log", "numpy.roll", "numpy.empty_like", "sys.path.insert", "abacusnbody.data.read_abacus.read_asdf", "pathlib.Path", "numpy.linspace", "Corrfunc.theory.DD", "matplotlib.pyplot.subplots" ]
[((76, 116), 'sys.path.insert', 'sys.path.insert', (['(0)', "os.environ['ABACUS']"], {}), "(0, os.environ['ABACUS'])\n", (91, 116), False, 'import sys\n'), ((421, 467), 'pathlib.Path', 'Path', (['"""/mnt/home/lgarrison/ceph/AbacusSummit/"""'], {}), "('/mnt/home/lgarrison/ceph/AbacusSummit/')\n", (425, 467), False, 'fro...
#!/usr/bin/python3 """ Sentiment analysis using NLTK package in Python """ __author__ = "Sunil" __copyright__ = "Copyright (c) 2017 Sunil" __license__ = "MIT License" __email__ = "<EMAIL>" __version__ = "0.1" import random import sys import numpy as np from nltk.corpus import movie_reviews as reviews from nltk.corp...
[ "nltk.corpus.movie_reviews.raw", "sklearn.linear_model.SGDClassifier", "sklearn.feature_extraction.text.TfidfVectorizer", "sklearn.metrics.accuracy_score", "numpy.dtype", "sklearn.preprocessing.LabelEncoder", "sklearn.model_selection.KFold", "numpy.mean", "numpy.array", "nltk.corpus.movie_reviews....
[((1926, 1949), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (1943, 1949), True, 'import numpy as np\n'), ((1981, 1992), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1989, 1992), True, 'import numpy as np\n'), ((2001, 2012), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (2009, 2012),...
#!/usr/bin/env python import argparse import configparser import os import itertools import pathlib import random import matplotlib.pyplot as plt import numpy as np import matplotlib.patches as mpatches from matplotlib.lines import Line2D from matplotlib import gridspec from numpy.polynomial.polynomial import polyfi...
[ "numpy.sum", "argparse.ArgumentParser", "numpy.argmax", "numpy.empty", "pathlib.Path", "mpl_toolkits.axes_grid1.inset_locator.mark_inset", "os.path.join", "numpy.append", "numpy.loadtxt", "matplotlib.pyplot.rc", "numpy.linspace", "itertools.product", "configparser.ConfigParser", "matplotli...
[((5320, 5349), 'matplotlib.pyplot.rc', 'plt.rc', (['"""xtick"""'], {'labelsize': '(16)'}), "('xtick', labelsize=16)\n", (5326, 5349), True, 'import matplotlib.pyplot as plt\n'), ((5354, 5383), 'matplotlib.pyplot.rc', 'plt.rc', (['"""ytick"""'], {'labelsize': '(16)'}), "('ytick', labelsize=16)\n", (5360, 5383), True, '...
from __future__ import print_function from retinanet.dataloader2 import UnNormalizer import numpy as np import json import os import matplotlib import matplotlib.pyplot as plt import torch import cv2 import pandas as pd def compute_overlap(a, b): """ Parameters ---------- a: (N, 4) ndarray of float ...
[ "matplotlib.pyplot.title", "numpy.sum", "numpy.maximum", "numpy.argmax", "numpy.argsort", "matplotlib.pyplot.figure", "torch.no_grad", "pandas.DataFrame", "numpy.cumsum", "numpy.finfo", "numpy.append", "matplotlib.pyplot.ylim", "retinanet.dataloader2.UnNormalizer", "matplotlib.use", "tor...
[((738, 755), 'numpy.maximum', 'np.maximum', (['iw', '(0)'], {}), '(iw, 0)\n', (748, 755), True, 'import numpy as np\n'), ((765, 782), 'numpy.maximum', 'np.maximum', (['ih', '(0)'], {}), '(ih, 0)\n', (775, 782), True, 'import numpy as np\n'), ((1454, 1471), 'numpy.maximum', 'np.maximum', (['iw', '(0)'], {}), '(iw, 0)\n...
from operator import matmul from matplotlib import image import numpy as np import cv2 # OpenCV import math from matplotlib import pyplot as plt import os from ..utils.process_text_file import ProcessTextFile class Image: def __init__(self): self.gs = [] def load_image(self, image_fname, display=Fals...
[ "matplotlib.pyplot.show", "cv2.cvtColor", "matplotlib.pyplot.imshow", "matplotlib.pyplot.yticks", "numpy.ones", "cv2.imread", "numpy.linspace", "matplotlib.pyplot.xticks" ]
[((346, 369), 'cv2.imread', 'cv2.imread', (['image_fname'], {}), '(image_fname)\n', (356, 369), False, 'import cv2\n'), ((388, 433), 'cv2.cvtColor', 'cv2.cvtColor', (['color_image', 'cv2.COLOR_BGR2GRAY'], {}), '(color_image, cv2.COLOR_BGR2GRAY)\n', (400, 433), False, 'import cv2\n'), ((731, 750), 'matplotlib.pyplot.ims...
# Copyright 2019 AUI, Inc. Washington DC, USA # # 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 ...
[ "xarray.merge", "numpy.unique", "xarray.Dataset", "xarray.concat" ]
[((4658, 4703), 'xarray.concat', 'xarray.concat', (['ndss'], {'dim': '"""time"""', 'coords': '"""all"""'}), "(ndss, dim='time', coords='all')\n", (4671, 4703), False, 'import xarray\n'), ((4718, 4757), 'xarray.merge', 'xarray.merge', (['[new_xds, xds[remaining]]'], {}), '([new_xds, xds[remaining]])\n', (4730, 4757), Fa...
import numpy as np from uq360.utils.batch_features.histogram_feature import SingleHistogramFeature from uq360.utils.transformers.confidence_delta import ConfidenceDeltaTransformer from uq360.utils.transformers.confidence_top import ConfidenceTopTransformer from uq360.utils.transformers.confidence_entropy import Confi...
[ "uq360.utils.transformers.confidence_delta.ConfidenceDeltaTransformer", "numpy.histogram", "numpy.linspace", "uq360.utils.transformers.class_frequency.ClassFrequencyTransformer", "uq360.utils.transformers.confidence_top.ConfidenceTopTransformer", "uq360.utils.transformers.confidence_entropy.ConfidenceEntr...
[((1175, 1203), 'numpy.histogram', 'np.histogram', (['vec'], {'bins': 'bins'}), '(vec, bins=bins)\n', (1187, 1203), True, 'import numpy as np\n'), ((2672, 2700), 'numpy.histogram', 'np.histogram', (['vec'], {'bins': 'bins'}), '(vec, bins=bins)\n', (2684, 2700), True, 'import numpy as np\n'), ((3775, 3818), 'numpy.histo...
"""Utils for the command line tool.""" # Standard library import datetime as dt import logging import os import pickle import sys from pathlib import Path # Third-party import matplotlib.path as mpath import matplotlib.pyplot as plt import numpy as np import pandas as pd import xarray as xr # from ipdb import set_tra...
[ "pandas.DataFrame", "logging.debug", "pandas.date_range", "numpy.sum", "logging.warning", "xarray.open_dataset", "os.system", "numpy.isnan", "logging.info", "pathlib.Path", "matplotlib.path.Path", "datetime.timedelta", "numpy.arange", "sys.exit" ]
[((895, 944), 'logging.debug', 'logging.debug', (['f"""Apply fxfilter to: {grib_file}."""'], {}), "(f'Apply fxfilter to: {grib_file}.')\n", (908, 944), False, 'import logging\n'), ((980, 1025), 'pathlib.Path', 'Path', (['out_dir', 'f"""tqc_{date_str}_{lt:03}.grb2"""'], {}), "(out_dir, f'tqc_{date_str}_{lt:03}.grb2')\n"...
#! /usr/bin/env python3 """Test collapse.""" # --- import ------------------------------------------------------------------------------------- import WrightTools as wt import numpy as np # --- tests -------------------------------------------------------------------------------------- def test_gradient(): ...
[ "WrightTools.Data", "numpy.arange", "numpy.array" ]
[((327, 336), 'WrightTools.Data', 'wt.Data', ([], {}), '()\n', (334, 336), True, 'import WrightTools as wt\n'), ((368, 383), 'numpy.arange', 'np.arange', (['(0)', '(6)'], {}), '(0, 6)\n', (377, 383), True, 'import numpy as np\n'), ((467, 497), 'numpy.array', 'np.array', (['[1, 2, 4, 7, 11, 16]'], {}), '([1, 2, 4, 7, 11...
import random from typing import Tuple import numpy as np from maenv.core import World, Agent, Team from maenv.exceptions.scenario_exceptions import ScenarioNotSymmetricError from maenv.interfaces.scenario import BaseTeamScenario from maenv.utils.colors import generate_colors class TeamsScenario(BaseTeamScenario): ...
[ "maenv.utils.colors.generate_colors", "maenv.core.Agent", "maenv.core.Team", "numpy.all", "random.random", "maenv.core.World", "numpy.array", "maenv.exceptions.scenario_exceptions.ScenarioNotSymmetricError", "numpy.concatenate" ]
[((1140, 1156), 'numpy.array', 'np.array', (['bounds'], {}), '(bounds)\n', (1148, 1156), True, 'import numpy as np\n'), ((2382, 2570), 'maenv.core.World', 'World', ([], {'n_agents': 'total_n_agents', 'n_teams': 'self.teams_n', 'grid_size': 'self.grid_size', 'ai': 'self.ai', 'ai_config': 'self.ai_config', 'attack_range_...
import random import numbers import torchvision.transforms.functional as F from PIL import Image import torch import scipy.ndimage as ndimage import numpy as np #import cv2 from skimage.transform import rescale class Resize(object): """ Rescales the inputs and target arrays to the given 'size'. 'size' will be ...
[ "torch.stack", "random.randint", "skimage.transform.rescale", "torchvision.transforms.functional.to_tensor", "numpy.transpose", "random.random", "numpy.fliplr", "torchvision.transforms.functional.normalize", "torch.from_numpy" ]
[((3069, 3094), 'random.randint', 'random.randint', (['(0)', '(w - tw)'], {}), '(0, w - tw)\n', (3083, 3094), False, 'import random\n'), ((3107, 3132), 'random.randint', 'random.randint', (['(0)', '(h - th)'], {}), '(0, h - th)\n', (3121, 3132), False, 'import random\n'), ((1322, 1376), 'skimage.transform.rescale', 're...
# Copyright (C) 2020 University of Oxford # # 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 t...
[ "netCDF4.Dataset", "pandas.DataFrame", "os.remove", "json.load", "numpy.std", "os.path.dirname", "pickle.load", "numpy.mean", "requests.get" ]
[((1061, 1069), 'requests.get', 'get', (['url'], {}), '(url)\n', (1064, 1069), False, 'from requests import get\n'), ((2547, 2573), 'netCDF4.Dataset', 'netCDF4.Dataset', (['temp_file'], {}), '(temp_file)\n', (2562, 2573), False, 'import netCDF4\n'), ((3400, 3420), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'd'})...
import wave import os,sys import ctypes import contextlib import numpy as np from ctypes import util from scipy.io import wavfile from pydub import AudioSegment import pandas as pd #loading libraries and setting up the environment lib_path = util.find_library("rnnoise") if (not("/" in lib_path)): lib_path = (os.po...
[ "wave.open", "numpy.ndarray", "numpy.frombuffer", "os.popen", "ctypes.cdll.LoadLibrary", "pydub.AudioSegment.from_wav", "ctypes.util.find_library", "ctypes.POINTER" ]
[((243, 271), 'ctypes.util.find_library', 'util.find_library', (['"""rnnoise"""'], {}), "('rnnoise')\n", (260, 271), False, 'from ctypes import util\n'), ((441, 474), 'ctypes.cdll.LoadLibrary', 'ctypes.cdll.LoadLibrary', (['lib_path'], {}), '(lib_path)\n', (464, 474), False, 'import ctypes\n'), ((2508, 2539), 'pydub.Au...
import cv2 import numpy as np def is_cv2(): # if we are using OpenCV 2, then our cv2.__version__ will start # with '2.' return check_opencv_version("2.") def is_cv3(): # if we are using OpenCV 3.X, then our cv2.__version__ will start # with '3.' return check_opencv_version("3.") def check_ope...
[ "cv2.boundingRect", "numpy.array", "cv2.findContours", "cv2.__version__.startswith" ]
[((555, 588), 'cv2.__version__.startswith', 'lib.__version__.startswith', (['major'], {}), '(major)\n', (581, 588), True, 'import cv2 as lib\n'), ((664, 732), 'cv2.findContours', 'cv2.findContours', (['thresh', 'cv2.RETR_EXTERNAL', 'cv2.CHAIN_APPROX_SIMPLE'], {}), '(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)\n...
from flask import Flask, request, jsonify, abort import base64 import requests from datetime import datetime import subprocess import os import sys import argparse __dir__ = os.path.dirname(os.path.abspath(__file__)) sys.path.append(__dir__) sys.path.append(os.path.abspath(os.path.join(__dir__, '../..'))) import cv2 ...
[ "os.mkdir", "tools.infer.utility.draw_ocr_box_txt", "cv2.getPerspectiveTransform", "base64.b64decode", "flask.jsonify", "numpy.rot90", "numpy.linalg.norm", "os.path.join", "flask.request.get_json", "sys.path.append", "os.path.abspath", "cv2.warpPerspective", "ppocr.utils.utility.get_image_fi...
[((218, 242), 'sys.path.append', 'sys.path.append', (['__dir__'], {}), '(__dir__)\n', (233, 242), False, 'import sys\n'), ((785, 800), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (790, 800), False, 'from flask import Flask, request, jsonify, abort\n'), ((811, 823), 'ppocr.utils.logging.get_logger', 'get...
import os import io import glob import errno import json import numpy as np import scipy.interpolate as spi import scipy.optimize as spo import matplotlib.pyplot as plt import scipy.ndimage as ndimage np.set_printoptions(linewidth=500) def fvb_crr(raw_array, offset=0, medianRatio=1, noiseCoeff=5, debugging=False): ...
[ "os.mkdir", "numpy.sum", "json.dumps", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.mean", "numpy.arange", "scipy.interpolate.interp1d", "os.path.join", "pyqtgraph.GraphicsLayoutWidget", "pyqtgraph.QtGui.QApplication", "numpy.atleast_2d", "numpy.set_printoptions", "json.loads", "num...
[((202, 236), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(500)'}), '(linewidth=500)\n', (221, 236), True, 'import numpy as np\n'), ((879, 898), 'numpy.array', 'np.array', (['raw_array'], {}), '(raw_array)\n', (887, 898), True, 'import numpy as np\n'), ((910, 977), 'scipy.ndimage.filters.median...
# direct to proper path import os import sys module_path = os.path.abspath(os.path.join('..')) if module_path not in sys.path: sys.path.append(module_path) import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm, rcParams from matplotlib.colors import ListedColormap, ...
[ "sys.path.append", "numpy.load", "pandas.read_csv", "numpy.array", "os.path.join", "numpy.concatenate" ]
[((993, 1027), 'pandas.read_csv', 'pd.read_csv', (['result_path'], {'header': '(0)'}), '(result_path, header=0)\n', (1004, 1027), True, 'import pandas as pd\n'), ((75, 93), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (87, 93), False, 'import os\n'), ((131, 159), 'sys.path.append', 'sys.path.append',...
import pytest from scipy import signal from scipy.interpolate import interp1d import numpy as np from numpy import pi # This package must first be installed with `pip install -e .` or similar from waveform_analysis import ABC_weighting, A_weighting, A_weight # It will plot things for sanity-checking if MPL is install...
[ "numpy.fft.rfft", "pytest.main", "matplotlib.pyplot.figure", "scipy.interpolate.interp1d", "scipy.signal.sosfreqz", "waveform_analysis.A_weighting", "scipy.signal.freqs_zpk", "waveform_analysis.A_weight", "pytest.raises", "numpy.less_equal", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend"...
[((475, 823), 'numpy.array', 'np.array', (['(10.0, 12.59, 15.85, 19.95, 25.12, 31.62, 39.81, 50.12, 65.1, 79.43, 100.0,\n 125.9, 158.5, 199.5, 251.2, 316.2, 398.1, 501.2, 631.0, 794.3, 1000.0, \n 1259.0, 1585.0, 1995.0, 2512.0, 3162.0, 3981.0, 5012.0, 6310.0, 7943.0,\n 10000.0, 12590.0, 15850.0, 19950.0, 25120...