code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Copyright (c) 2017, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only
# under the conditions described in the aforementioned license. The license
# is also available online at http://www.ent... | [
"cellular_automata.rules.forest.BurnGrovesRule",
"matplotlib.pyplot.plot",
"numpy.log",
"numpy.logspace",
"joblib.Parallel",
"matplotlib.pyplot.subplot",
"cellular_automata.rules.forest.MoldRule",
"numpy.linspace",
"numpy.random.seed",
"cellular_automata.automata_recorder.AutomataRecorder",
"job... | [((2204, 2224), 'numpy.random.seed', 'np.random.seed', (['None'], {}), '(None)\n', (2218, 2224), True, 'import numpy as np\n'), ((2254, 2319), 'cellular_automata.rules.change_state_rule.ChangeStateRule', 'ChangeStateRule', ([], {'from_state': 'EMPTY', 'to_state': 'TREE', 'p_change': '(0.0025)'}), '(from_state=EMPTY, to... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 11:02:21 2019
@author: elizabethhutton
"""
import pandas as pd
import numpy as np
from sklearn.manifold import TSNE
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from wordcloud import WordCloud
from yellowbrick.cluster ... | [
"sklearn.cluster.KMeans",
"sklearn.manifold.TSNE",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.figure",
"sklearn.neighbors.NearestNeighbors",
"matplotlib.pyplot.scatter",
"pandas.DataFrame",
"numpy.set_printoptions"
] | [((829, 878), 'sklearn.cluster.KMeans', 'KMeans', ([], {'n_clusters': 'num_clusters', 'init': '"""k-means++"""'}), "(n_clusters=num_clusters, init='k-means++')\n", (835, 878), False, 'from sklearn.cluster import KMeans\n'), ((1131, 1197), 'pandas.DataFrame', 'pd.DataFrame', (['idx'], {'columns': "['clusterid']", 'index... |
"""
Code for the optimization and gaming component of the Baselining work.
@author: <NAME>, <NAME>
@date Mar 2, 2016
"""
import numpy as np
import pandas as pd
import logging
from gurobipy import GRB, Model, quicksum, LinExpr
from pandas.tseries.holiday import USFederalHolidayCalendar
from datetime import datetime
f... | [
"pandas.Series",
"datetime.datetime",
"numpy.unique",
"pandas.tseries.holiday.USFederalHolidayCalendar",
"pandas.DatetimeIndex",
"numpy.size",
"numpy.linalg.norm",
"numpy.asarray",
"numpy.max",
"gurobipy.quicksum",
"gurobipy.LinExpr",
"numpy.isnan",
"gurobipy.Model",
"pandas.DataFrame",
... | [((907, 914), 'gurobipy.Model', 'Model', ([], {}), '()\n', (912, 914), False, 'from gurobipy import GRB, Model, quicksum, LinExpr\n'), ((19530, 19541), 'numpy.isnan', 'np.isnan', (['M'], {}), '(M)\n', (19538, 19541), True, 'import numpy as np\n'), ((19974, 20009), 'pandas.Series', 'pd.Series', (['isBusiness'], {'index'... |
# Front matter
##############
import os
from os import fdopen, remove
from tempfile import mkstemp
from shutil import move
import glob
import re
import time
import pandas as pd
import numpy as np
from scipy import constants
from scipy.optimize import curve_fit, fsolve
from scipy.interpolate import interp1d
import matpl... | [
"numpy.sqrt",
"pandas.read_csv",
"seaborn.set_style",
"matplotlib.pyplot.close",
"matplotlib.rc",
"time.time",
"matplotlib.pyplot.subplots"
] | [((509, 545), 'matplotlib.rc', 'matplotlib.rc', (['"""xtick"""'], {'labelsize': '(16)'}), "('xtick', labelsize=16)\n", (522, 545), False, 'import matplotlib\n'), ((547, 583), 'matplotlib.rc', 'matplotlib.rc', (['"""ytick"""'], {'labelsize': '(16)'}), "('ytick', labelsize=16)\n", (560, 583), False, 'import matplotlib\n'... |
import cv2
import numpy as np
import picamera
import time
def identifySq(pt, w, h):
tlx = 80
tly = 210
ppx = 94
ppy = 82
sqx = (pt[0]-(tlx-ppx/2))/ppx
sqy = (pt[1]-(tly-ppy/2))/ppy
# print ("ID",pt, w, h, sqx, sqy)
if sqx < 0 or sqx >= 4 or sqy < 0 or sqy >= 4:
return 0, False
... | [
"cv2.imwrite",
"cv2.findHomography",
"numpy.where",
"picamera.PiCamera",
"cv2.imshow",
"numpy.array",
"cv2.warpPerspective",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.resize",
"cv2.matchTemplate",
"cv2.imread"
] | [((417, 436), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (434, 436), False, 'import picamera\n'), ((506, 530), 'cv2.imread', 'cv2.imread', (['"""newimg.jpg"""'], {}), "('newimg.jpg')\n", (516, 530), False, 'import cv2\n'), ((682, 736), 'cv2.resize', 'cv2.resize', (['im_src', 'dim1'], {'interpolation': ... |
import numpy as np
from mpi4py import MPI
from tacs import TACS, elements, constitutive, functions
from static_analysis_base_test import StaticTestCase
'''
Create a two separate cantilevered plates connected by an RBE3 element.
Apply a load at the RBE2 center node and test KSFailure, StructuralMass,
and Compliance fu... | [
"tacs.functions.Compliance",
"tacs.TACS.Creator",
"tacs.constitutive.IsoShellConstitutive",
"tacs.functions.KSFailure",
"numpy.arange",
"numpy.logical_and",
"tacs.constitutive.MaterialProperties",
"tacs.elements.RBE2",
"numpy.append",
"numpy.array",
"numpy.linspace",
"tacs.elements.ShellNatura... | [((612, 690), 'numpy.array', 'np.array', (['[1.2600980396870352, 51400.0, 3767896.1409673616, 2.912191091671254]'], {}), '([1.2600980396870352, 51400.0, 3767896.1409673616, 2.912191091671254])\n', (620, 690), True, 'import numpy as np\n'), ((863, 925), 'numpy.array', 'np.array', (['[100000000.0, 0.0, 1000000.0, 0.0, 0.... |
import sys
import pylab as plb
import numpy as np
import mountaincar
class DummyAgent():
"""A not so good agent for the mountain-car task.
"""
def __init__(self, mountain_car = None, parameter1 = 3.0):
if mountain_car is None:
self.mountain_car = mountaincar.MountainCar()
... | [
"pylab.ion",
"numpy.random.randint",
"pylab.pause",
"mountaincar.MountainCar",
"sys.stdout.flush",
"mountaincar.MountainCarViewer",
"pylab.show"
] | [((1688, 1698), 'pylab.show', 'plb.show', ([], {}), '()\n', (1696, 1698), True, 'import pylab as plb\n'), ((674, 683), 'pylab.ion', 'plb.ion', ([], {}), '()\n', (681, 683), True, 'import pylab as plb\n'), ((692, 709), 'pylab.pause', 'plb.pause', (['(0.0001)'], {}), '(0.0001)\n', (701, 709), True, 'import pylab as plb\n... |
import numpy as np
from pyquil import Program
from pyquil.api import QuantumComputer, get_qc
from grove.alpha.jordan_gradient.gradient_utils import (binary_float_to_decimal_float,
measurements_to_bf)
from grove.alpha.phaseestimation.phase_estimation import phase_... | [
"grove.alpha.phaseestimation.phase_estimation.phase_estimation",
"grove.alpha.jordan_gradient.gradient_utils.measurements_to_bf",
"numpy.array",
"grove.alpha.jordan_gradient.gradient_utils.binary_float_to_decimal_float",
"numpy.sign"
] | [((744, 792), 'numpy.array', 'np.array', (['[[phase_factor, 0], [0, phase_factor]]'], {}), '([[phase_factor, 0], [0, phase_factor]])\n', (752, 792), True, 'import numpy as np\n'), ((828, 858), 'grove.alpha.phaseestimation.phase_estimation.phase_estimation', 'phase_estimation', (['U', 'precision'], {}), '(U, precision)\... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
Code written by <NAME> with modifications by <NAME> and <NAME>
This file produces plots comparing our first order sensitivity with BS vega.
"""
# %%
# To run the stuff, you need the package plotly in your anaconda "conda install plotly"
import plotly.graph_objs as go
from... | [
"numpy.sqrt",
"plotly.offline.iplot",
"scipy.optimize.minimize",
"plotly.offline.init_notebook_mode",
"numpy.log",
"numpy.exp",
"numpy.array",
"numpy.linspace",
"time.time",
"plotly.graph_objs.Figure",
"numpy.vectorize"
] | [((418, 438), 'plotly.offline.init_notebook_mode', 'init_notebook_mode', ([], {}), '()\n', (436, 438), False, 'from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot\n'), ((2182, 2217), 'numpy.vectorize', 'np.vectorize', (['Robust_Call_Exact_fun'], {}), '(Robust_Call_Exact_fun)\n', (2194, 2217), ... |
import numpy as np
import torchvision.datasets as datasets
from pathlib import Path
import libs.dirs as dirs
import libs.utils as utils
import libs.dataset_utils as dutils
import models.utils as mutils
import libs.commons as commons
from libs.vis_fun... | [
"numpy.mean",
"libs.dataset_utils.get_input_network_type",
"pathlib.Path",
"numpy.std",
"numpy.argmin",
"models.utils.train_network",
"models.utils.compute_class_acc",
"models.utils.resnet_transforms",
"libs.vis_functions.plot_confusion_matrix"
] | [((556, 625), 'models.utils.resnet_transforms', 'mutils.resnet_transforms', (['commons.IMAGENET_MEAN', 'commons.IMAGENET_STD'], {}), '(commons.IMAGENET_MEAN, commons.IMAGENET_STD)\n', (580, 625), True, 'import models.utils as mutils\n'), ((1045, 1252), 'models.utils.train_network', 'mutils.train_network', (['dataset_pa... |
import cv2 as cv
import sys
import numpy as np
import tifffile as ti
import argparse
import itertools
max_lowThreshold = 100
window_name = 'Edge Map'
title_trackbar = 'Min Threshold:'
ratio = 3
kernel_size = 3
def CannyThreshold(val):
low_threshold = val
#img_blur = cv.blur(src_gray, (3,3))
... | [
"numpy.ones",
"cv2.samples.findFile",
"cv2.medianBlur",
"cv2.imshow",
"numpy.array",
"cv2.cvtColor",
"cv2.Canny",
"cv2.waitKey"
] | [((339, 408), 'cv2.Canny', 'cv.Canny', (['src_gray', 'low_threshold', '(low_threshold * ratio)', 'kernel_size'], {}), '(src_gray, low_threshold, low_threshold * ratio, kernel_size)\n', (347, 408), True, 'import cv2 as cv\n'), ((496, 523), 'cv2.imshow', 'cv.imshow', (['window_name', 'dst'], {}), '(window_name, dst)\n', ... |
from ._base import BaseWeight
from ..exceptions import NotFittedError
from ..utils.functions import mean_log_beta
import numpy as np
from scipy.special import loggamma
class PitmanYorProcess(BaseWeight):
def __init__(self, pyd=0, alpha=1, truncation_length=-1, rng=None):
super().__init__(rng=rng)
... | [
"scipy.special.loggamma",
"numpy.array",
"numpy.sum",
"numpy.empty",
"numpy.concatenate",
"numpy.cumsum",
"numpy.bincount",
"numpy.arange"
] | [((449, 479), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.float64'}), '([], dtype=np.float64)\n', (457, 479), True, 'import numpy as np\n'), ((2706, 2757), 'numpy.empty', 'np.empty', (['(self.variational_k, 2)'], {'dtype': 'np.float64'}), '((self.variational_k, 2), dtype=np.float64)\n', (2714, 2757), True, 'impor... |
###################################################
## ##
## This file is part of the KinBot code v2.0 ##
## ##
## The contents are covered by the terms of the ##
## BSD 3-clause license included in the LICENSE ##
## file,... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"logging.warning",
"numpy.asarray",
"matplotlib.pyplot.clf",
"time.sleep",
"numpy.array",
"numpy.cos",
"numpy.sin"
] | [((1651, 1667), 'numpy.asarray', 'np.asarray', (['cart'], {}), '(cart)\n', (1661, 1667), True, 'import numpy as np\n'), ((6232, 6311), 'logging.warning', 'logging.warning', (["('Hindered rotor potential has more than 2 failures for ' + job)"], {}), "('Hindered rotor potential has more than 2 failures for ' + job)\n", (... |
import torch.utils.data
from torch.utils.tensorboard import SummaryWriter
from torch import nn
from tqdm import tqdm
import numpy as np
from datasets.preprocess import DatasetWrapper
from utils import AverageMeter
class IOC_MLP(torch.nn.Module):
def __init__(self, input_features, out_classes):
super()._... | [
"torch.nn.ELU",
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.CrossEntropyLoss",
"torch.nn.Flatten",
"numpy.exp",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"utils.AverageMeter"
] | [((960, 974), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (972, 974), False, 'from utils import AverageMeter\n'), ((988, 1002), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (1000, 1002), False, 'from utils import AverageMeter\n'), ((2598, 2612), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()... |
# Copyright (c) 2019 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... | [
"paddle.fluid.embedding",
"paddle.fluid.layers.data",
"paddle.fluid.layers.shape",
"paddle.fluid.layers.sequence_mask",
"paddle.fluid.contrib.layers.rnn_impl.BasicLSTMUnit",
"unittest.main",
"paddle.fluid.optimizer.Adam",
"paddle.fluid.layers.transpose",
"paddle.fluid.executor.Executor",
"paddle.f... | [((20147, 20204), 'paddle.fluid.data', 'fluid.data', ([], {'name': '"""src"""', 'shape': '[None, None]', 'dtype': '"""int64"""'}), "(name='src', shape=[None, None], dtype='int64')\n", (20157, 20204), True, 'import paddle.fluid as fluid\n'), ((20225, 20292), 'paddle.fluid.data', 'fluid.data', ([], {'name': '"""src_seque... |
#!/usr/bin/python3
import sys
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, FileType
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pyfsdb
def parse_args():
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter,
desc... | [
"argparse.FileType",
"pyfsdb.Fsdb",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"numpy.array",
"matplotlib.pyplot.subplots"
] | [((226, 339), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'formatter_class': 'ArgumentDefaultsHelpFormatter', 'description': '__doc__', 'epilog': '"""Exmaple Usage: """'}), "(formatter_class=ArgumentDefaultsHelpFormatter, description=\n __doc__, epilog='Exmaple Usage: ')\n", (240, 339), False, 'from argparse ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 27 13:59:43 2018
@author: ofn77899
"""
import numpy
from ccpi.segmentation.SimpleflexSegmentor import SimpleflexSegmentor
from ccpi.viewer.CILViewer import CILViewer
from ccpi.viewer.CILViewer2D import CILViewer2D, Converter
import vtk
#Text-based input s... | [
"numpy.sqrt",
"vtk.vtkMetaImageReader",
"vtk.vtkTriangle",
"vtk.vtkCamera",
"vtk.vtkCellArray",
"vtk.vtkPolyData",
"numpy.asarray",
"vtk.vtkPoints",
"numpy.dot",
"numpy.cos",
"ccpi.segmentation.SimpleflexSegmentor.SimpleflexSegmentor",
"numpy.sin",
"ccpi.viewer.CILViewer.CILViewer"
] | [((4710, 4734), 'vtk.vtkMetaImageReader', 'vtk.vtkMetaImageReader', ([], {}), '()\n', (4732, 4734), False, 'import vtk\n'), ((4814, 4835), 'ccpi.segmentation.SimpleflexSegmentor.SimpleflexSegmentor', 'SimpleflexSegmentor', ([], {}), '()\n', (4833, 4835), False, 'from ccpi.segmentation.SimpleflexSegmentor import Simplef... |
from easyvec import Mat2, Vec2
import numpy as np
from pytest import approx
def test_constructor1():
m = Mat2(1,2,3,4)
assert m is not None
assert m.m11 == approx(1)
assert m.m12 == approx(2)
assert m.m21 == approx(3)
assert m.m22 == approx(4)
def test_constructor2():
m = Mat2([1,2,3,4])
... | [
"pytest.approx",
"easyvec.Vec2",
"easyvec.Mat2",
"easyvec.Mat2.eye",
"math.cos",
"numpy.random.uniform",
"easyvec.Mat2.from_angle",
"easyvec.Mat2.from_xaxis",
"math.sin"
] | [((110, 126), 'easyvec.Mat2', 'Mat2', (['(1)', '(2)', '(3)', '(4)'], {}), '(1, 2, 3, 4)\n', (114, 126), False, 'from easyvec import Mat2, Vec2\n'), ((304, 322), 'easyvec.Mat2', 'Mat2', (['[1, 2, 3, 4]'], {}), '([1, 2, 3, 4])\n', (308, 322), False, 'from easyvec import Mat2, Vec2\n'), ((500, 522), 'easyvec.Mat2', 'Mat2'... |
import numpy as np
from two_d_nav.envs.static_maze import StaticMazeNavigation
def test_goal():
env = StaticMazeNavigation()
for i in range(60):
obs, reward, done, _ = env.step(np.array([1.0, -0.1]))
env.render()
for i in range(30):
obs, reward, done, _ = env.step(np.array([-1.0... | [
"two_d_nav.envs.static_maze.StaticMazeNavigation",
"numpy.array"
] | [((109, 131), 'two_d_nav.envs.static_maze.StaticMazeNavigation', 'StaticMazeNavigation', ([], {}), '()\n', (129, 131), False, 'from two_d_nav.envs.static_maze import StaticMazeNavigation\n'), ((917, 939), 'two_d_nav.envs.static_maze.StaticMazeNavigation', 'StaticMazeNavigation', ([], {}), '()\n', (937, 939), False, 'fr... |
import os
import numpy as np
import tensorflow as tf
import cPickle
from utils import shared, get_name
from nn import HiddenLayer, EmbeddingLayer, LSTM, forward
class Model(object):
"""
Network architecture.
"""
def __init__(self, parameters=None, models_path=None, model_path=None):
"""
... | [
"tensorflow.shape",
"tensorflow.transpose",
"nn.forward",
"tensorflow.gradients",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"numpy.array",
"nn.LSTM",
"tensorflow.nn.dropout",
"tensorflow.reverse_sequence",
"tensorflow.nn.softmax",
"tensorflow.reduce_mean",
"tensorflow.scan",
... | [((3248, 3309), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[None, None]', 'name': '"""word_ids"""'}), "(tf.int32, shape=[None, None], name='word_ids')\n", (3262, 3309), True, 'import tensorflow as tf\n'), ((3373, 3432), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[No... |
import numpy as np
import json
from collections import Counter
import matplotlib.pyplot as plt
DATASET_DIR = './dataset/tacred/train_mod.json'
with open(DATASET_DIR) as f:
examples = json.load(f)
def plot_counts(data):
counts = Counter(data)
del counts["no_relation"]
labels, values = zip(*counts.it... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"collections.Counter",
"numpy.array",
"numpy.argsort",
"matplotlib.pyplot.tight_layout",
"json.load",
"matplotlib.pyplot.show"
] | [((190, 202), 'json.load', 'json.load', (['f'], {}), '(f)\n', (199, 202), False, 'import json\n'), ((240, 253), 'collections.Counter', 'Counter', (['data'], {}), '(data)\n', (247, 253), False, 'from collections import Counter\n'), ((634, 710), 'matplotlib.pyplot.xticks', 'plt.xticks', (['(indexes_sorted + width * 0.5)'... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 19 06:10:55 2018
@author: <NAME>
Demo of gradient boosting tree
A very nice reference for gradient boosting
http://homes.cs.washington.edu/~tqchen/pdf/BoostedTree.pdf
LightGBM
https://github.com/Microsoft/LightGBM/tree/master/examples/python-guide
Catboost
https://gith... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.mean_squared_error",
"lightgbm.Dataset",
"numpy.min",
"sklearn.ensemble.GradientBoostingClassifier",
"lightgbm.plot_importance",
"matplotlib.pyplot.show"
] | [((768, 819), 'pandas.read_csv', 'pd.read_csv', (['"""../Data/winequality-red.csv"""'], {'sep': '""";"""'}), "('../Data/winequality-red.csv', sep=';')\n", (779, 819), True, 'import pandas as pd\n'), ((1008, 1061), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'rando... |
import numpy
from scipy.ndimage import gaussian_filter
from skimage.data import binary_blobs
from skimage.util import random_noise
from aydin.it.transforms.fixedpattern import FixedPatternTransform
def add_patterned_noise(image, n):
image = image.copy()
image *= 1 + 0.1 * (numpy.random.rand(n, n) - 0.5)
... | [
"numpy.abs",
"aydin.it.transforms.fixedpattern.FixedPatternTransform",
"numpy.random.rand",
"skimage.data.binary_blobs",
"skimage.util.random_noise",
"scipy.ndimage.gaussian_filter"
] | [((413, 468), 'skimage.util.random_noise', 'random_noise', (['image'], {'mode': '"""gaussian"""', 'var': '(1e-05)', 'seed': '(0)'}), "(image, mode='gaussian', var=1e-05, seed=0)\n", (425, 468), False, 'from skimage.util import random_noise\n'), ((483, 536), 'skimage.util.random_noise', 'random_noise', (['image'], {'mod... |
#
# Licensed under the BSD license. See full license in LICENSE file.
# http://www.lightshowpi.com/
#
# Author: <NAME> (<EMAIL>)
"""FFT methods for computing / analyzing frequency response of audio.
This is simply a wrapper around FFT support in numpy.
Initial FFT code inspired from the code posted here:
http://www... | [
"numpy.abs",
"numpy.log10",
"numpy.fft.rfft",
"numpy.sum",
"numpy.zeros",
"numpy.frombuffer"
] | [((1559, 1588), 'numpy.frombuffer', 'frombuffer', (['data'], {'dtype': 'int16'}), '(data, dtype=int16)\n', (1569, 1588), False, 'from numpy import log10, frombuffer, empty, hanning, fft, delete, int16, zeros\n'), ((2132, 2146), 'numpy.fft.rfft', 'fft.rfft', (['data'], {}), '(data)\n', (2140, 2146), False, 'from numpy i... |
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
default_params = {
'text.usetex': False,
'font.family': 'Times New Roman',
'font.serif': 'Times New Roman'
}
if __name__ == '__main__':
plt.rcParams.update(default_params)
myfont1 = matplotlib.font_manager.FontProperties(fname='C... | [
"matplotlib.pyplot.text",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.font_manager.FontProperties",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matpl... | [((223, 258), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (['default_params'], {}), '(default_params)\n', (242, 258), True, 'import matplotlib.pyplot as plt\n'), ((273, 343), 'matplotlib.font_manager.FontProperties', 'matplotlib.font_manager.FontProperties', ([], {'fname': '"""C:\\\\times.ttf"""', 'size... |
#
# plot-sine-wave.py
# Produce a PNG file of a sine wave plot
#
# <NAME> | https://butiran.github.io
#
# Execute: py plot-sine-wave.py
# Output: sine-t-<time>.png
#
# 20210212
# 1901 Create this by modifying moving-sine-wave.py from [1].
# 1902 Remove FuncAnimation from matplotlib.animation.
# 1904 Can save as PNG... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.style.use",
"matplotlib.offsetbox.AnchoredText",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.axes",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((2653, 2684), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-pastel"""'], {}), "('seaborn-pastel')\n", (2666, 2684), True, 'from matplotlib import pyplot as plt\n'), ((2734, 2764), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(2.5, 2.5)'}), '(figsize=(2.5, 2.5))\n', (2744, 2764), True, '... |
import numpy as np
from nlpaug.model.audio import Audio
class Normalization(Audio):
def manipulate(self, data, method, start_pos, end_pos):
aug_data = data.copy()
if method == 'minmax':
new_data = self._min_max(aug_data[start_pos:end_pos])
elif method == 'max':
new_data = self._max(aug_data[start_pos:en... | [
"numpy.abs",
"numpy.mean",
"numpy.std"
] | [((611, 623), 'numpy.std', 'np.std', (['data'], {}), '(data)\n', (617, 623), True, 'import numpy as np\n'), ((732, 744), 'numpy.abs', 'np.abs', (['data'], {}), '(data)\n', (738, 744), True, 'import numpy as np\n'), ((594, 607), 'numpy.mean', 'np.mean', (['data'], {}), '(data)\n', (601, 607), True, 'import numpy as np\n... |
from __future__ import print_function, division
import numpy as np
weights = np.transpose(np.load('w0.npy'))
print(weights.shape)
feature_names = ["" for i in range(125)]
prev = 0
prev_name = ''
for line in open('feature_names.txt'):
if line.startswith('#'):
continue
words = line.split()
index = ... | [
"numpy.absolute",
"numpy.load"
] | [((92, 109), 'numpy.load', 'np.load', (['"""w0.npy"""'], {}), "('w0.npy')\n", (99, 109), True, 'import numpy as np\n'), ((772, 792), 'numpy.absolute', 'np.absolute', (['weights'], {}), '(weights)\n', (783, 792), True, 'import numpy as np\n')] |
"""
Generate and save maps for each template.
"""
import random
import numpy as np
from scipy import stats
import healpy as hp
import matplotlib.pyplot as plt
import os
import pickle
from .data_utils import get_fermi_pdf_sampler, masked_to_full
from .utils import multipage, auto_garbage_collect
import ray
import time
i... | [
"numpy.log10",
"numpy.sqrt",
"healpy.mollview",
"numpy.isfinite",
"ray.init",
"numpy.random.chisquare",
"numpy.random.poisson",
"numpy.asarray",
"matplotlib.pyplot.close",
"numpy.random.seed",
"numpy.random.normal",
"random.uniform",
"matplotlib.pyplot.ioff",
"time.time",
"pickle.dump",
... | [((919, 930), 'time.time', 'time.time', ([], {}), '()\n', (928, 930), False, 'import time\n'), ((2321, 2348), 'numpy.random.seed', 'np.random.seed', (['random_seed'], {}), '(random_seed)\n', (2335, 2348), True, 'import numpy as np\n'), ((2874, 2913), 'os.makedirs', 'os.makedirs', (['output_path'], {'exist_ok': '(True)'... |
import numpy as np
from numpy.testing import assert_allclose
from robogym.envs.rearrange.common.utils import (
get_mesh_bounding_box,
make_block,
make_blocks_and_targets,
)
from robogym.envs.rearrange.simulation.composer import RandomMeshComposer
from robogym.mujoco.mujoco_xml import MujocoXML
def _get_d... | [
"numpy.allclose",
"numpy.ones",
"robogym.envs.rearrange.common.utils.make_blocks_and_targets",
"numpy.testing.assert_allclose",
"robogym.envs.rearrange.simulation.composer.RandomMeshComposer",
"robogym.envs.rearrange.common.utils.get_mesh_bounding_box",
"numpy.max",
"robogym.mujoco.mujoco_xml.MujocoXM... | [((536, 569), 'robogym.mujoco.mujoco_xml.MujocoXML.from_string', 'MujocoXML.from_string', (['xml_source'], {}), '(xml_source)\n', (557, 569), False, 'from robogym.mujoco.mujoco_xml import MujocoXML\n'), ((1524, 1566), 'numpy.testing.assert_allclose', 'assert_allclose', (['sim.model.geom_size', '(0.05)'], {}), '(sim.mod... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 9 09:42:00 2021
@author: barraly
"""
import sabs_pkpd
import numpy as np
import matplotlib.pyplot as plt
import os
# Select the folder in which this repo is downloaded in the line below
os.chdir('The/location/of/the/root/folder/of/this/repo')
# In[Loa... | [
"matplotlib.pyplot.savefig",
"sabs_pkpd.cardiac.compute_APD",
"os.chdir",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.subplots",
"numpy.round",
"sabs_pkpd.load_model.load_simulation_from_mmt"
] | [((250, 306), 'os.chdir', 'os.chdir', (['"""The/location/of/the/root/folder/of/this/repo"""'], {}), "('The/location/of/the/root/folder/of/this/repo')\n", (258, 306), False, 'import os\n'), ((397, 452), 'sabs_pkpd.load_model.load_simulation_from_mmt', 'sabs_pkpd.load_model.load_simulation_from_mmt', (['filename'], {}), ... |
import sys
import argparse
import numpy as np
import tensorflow as tf
from tensorflow import keras
class SampleModel(keras.Model):
def __init__(self, num_classes=10):
super(SampleModel, self).__init__(name='my_model')
self.num_classes = num_classes
# Define your layers here.
s... | [
"tensorflow.keras.estimator.model_to_estimator",
"argparse.ArgumentParser",
"tensorflow.data.Dataset.from_tensor_slices",
"numpy.random.random",
"tensorflow.train.RMSPropOptimizer",
"tensorflow.keras.layers.Dense",
"tensorflow.TensorShape",
"tensorflow.app.run"
] | [((1126, 1161), 'numpy.random.random', 'np.random.random', (['(num_samples, 32)'], {}), '((num_samples, 32))\n', (1142, 1161), True, 'import numpy as np\n'), ((1175, 1210), 'numpy.random.random', 'np.random.random', (['(num_samples, 10)'], {}), '((num_samples, 10))\n', (1191, 1210), True, 'import numpy as np\n'), ((126... |
import os
import threading
import time
from collections import deque
import numpy as np
from threading import Thread
from agents.dqn_agent import DqnAgent
from main import App
# Number of games to play
from utils.logger import DataLogger
n_episodes = 10000
save_period = 50 # Saves off every n episodes' model
bat... | [
"os.path.exists",
"numpy.reshape",
"os.makedirs",
"threading.Lock",
"time.sleep",
"utils.logger.DataLogger",
"main.App",
"threading.Thread",
"time.time",
"agents.dqn_agent.DqnAgent"
] | [((1426, 1484), 'main.App', 'App', ([], {'training_mode': '(True)', 'ml_step_callback': 'handler.callback'}), '(training_mode=True, ml_step_callback=handler.callback)\n', (1429, 1484), False, 'from main import App\n'), ((1494, 1524), 'threading.Thread', 'Thread', ([], {'target': 'game.on_execute'}), '(target=game.on_ex... |
import numpy as np
from random import sample, seed
#import matplotlib.pyplot as plt
from sys import argv, stdout
#from scipy.stats import gumbel_r
from score_matrix import readScoreMatrix, getMatrix
from seqali import smithWaterman, smithFast, plotMat, plotTraceMat
from multiprocessing import Process, Manager
def scra... | [
"score_matrix.readScoreMatrix",
"numpy.median",
"score_matrix.getMatrix",
"multiprocessing.Process",
"seqali.smithFast",
"seqali.smithWaterman",
"random.seed",
"multiprocessing.Manager"
] | [((1193, 1216), 'score_matrix.readScoreMatrix', 'readScoreMatrix', (['matrix'], {}), '(matrix)\n', (1208, 1216), False, 'from score_matrix import readScoreMatrix, getMatrix\n'), ((1229, 1240), 'score_matrix.getMatrix', 'getMatrix', ([], {}), '()\n', (1238, 1240), False, 'from score_matrix import readScoreMatrix, getMat... |
import numpy as np
def make_grid_edges(x, neighborhood=4, return_lists=False):
if neighborhood not in [4, 8]:
raise ValueError("neighborhood can only be '4' or '8', got %s" %
repr(neighborhood))
inds = np.arange(x.shape[0] * x.shape[1]).reshape(x.shape[:2])
inds = inds.ast... | [
"numpy.zeros",
"numpy.vstack",
"numpy.arange"
] | [((745, 761), 'numpy.vstack', 'np.vstack', (['edges'], {}), '(edges)\n', (754, 761), True, 'import numpy as np\n'), ((814, 834), 'numpy.vstack', 'np.vstack', (['edge_list'], {}), '(edge_list)\n', (823, 834), True, 'import numpy as np\n'), ((855, 884), 'numpy.zeros', 'np.zeros', (['(edges.shape[0], 2)'], {}), '((edges.s... |
# Copyright (c) 2020, Xilinx
# 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 follow... | [
"numpy.prod",
"finn.transformation.infer_datatypes.InferDataTypes",
"numpy.abs",
"onnx.helper.make_node",
"finn.util.basic.get_by_name",
"numpy.sign",
"finn.custom_op.registry.getCustomOp"
] | [((14258, 14274), 'finn.transformation.infer_datatypes.InferDataTypes', 'InferDataTypes', ([], {}), '()\n', (14272, 14274), False, 'from finn.transformation.infer_datatypes import InferDataTypes\n'), ((6198, 6214), 'numpy.prod', 'np.prod', (['A.shape'], {}), '(A.shape)\n', (6205, 6214), True, 'import numpy as np\n'), (... |
# coding: utf-8
#
# This code is part of qclib.
#
# Copyright (c) 2021, <NAME>
import numpy as np
from ..math import apply_statevec, apply_density, density_matrix
from .measure import measure_qubit, measure_qubit_rho
class DensityMatrix:
def __init__(self, mat):
self._data = np.asarray(mat)
def __l... | [
"numpy.asarray"
] | [((292, 307), 'numpy.asarray', 'np.asarray', (['mat'], {}), '(mat)\n', (302, 307), True, 'import numpy as np\n'), ((931, 946), 'numpy.asarray', 'np.asarray', (['vec'], {}), '(vec)\n', (941, 946), True, 'import numpy as np\n')] |
#!/usr/bin/env python
# coding: utf-8
# #### Modeling the elemental stoichiometry of phytoplankton and surrounding surface waters in and upwelling or estuarine system
# >Steps to complete project:
# >1. Translate matlab physical model into python
# >2. Substitute Dynamic CFM into model for eco component
# >3. Analyze ... | [
"matplotlib.pyplot.savefig",
"numpy.ones",
"numpy.full_like",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.size",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"math.sin",
"matplotlib.pyplot.subplot",
"numpy.arange",
"matplotlib.pyp... | [((757, 781), 'numpy.arange', 'np.arange', (['(0)', '(T + dt)', 'dt'], {}), '(0, T + dt, dt)\n', (766, 781), True, 'import numpy as np\n'), ((1016, 1041), 'numpy.arange', 'np.arange', (['(0)', '(Lx + dx)', 'dx'], {}), '(0, Lx + dx, dx)\n', (1025, 1041), True, 'import numpy as np\n'), ((2479, 2502), 'numpy.arange', 'np.... |
"""Test weighted path counting methods."""
# pylint: disable=redefined-outer-name,too-few-public-methods
# pylint: disable=too-many-branches
import pytest
from pytest import approx
import numpy as np
import pandas as pd
from pathcensus.definitions import PathDefinitionsWeighted
from pathcensus import PathCensus
@pyte... | [
"pathcensus.PathCensus",
"pytest.approx",
"numpy.allclose",
"numpy.isclose",
"pandas.DataFrame",
"pathcensus.definitions.PathDefinitionsWeighted",
"pytest.mark.parametrize",
"numpy.isnan",
"pytest.fixture",
"numpy.zeros_like"
] | [((316, 347), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (330, 347), False, 'import pytest\n'), ((575, 606), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (589, 606), False, 'import pytest\n'), ((746, 777), 'pytest.fixture'... |
""" Custom Fairness Metrics
Note that ratio and difference computation is handled by AIF360's
sklearn.metrics module. As of the V 0.4.0 release, these are calculated as
[unprivileged/privileged] and [unprivileged - privileged], respectively
"""
from typing import Callable
from aif360.sklearn.metrics import... | [
"aif360.sklearn.metrics.ratio",
"aif360.sklearn.metrics.difference",
"warnings.catch_warnings",
"numpy.isnan",
"warnings.filterwarnings"
] | [((1702, 1774), 'aif360.sklearn.metrics.ratio', 'ratio', (['precision', 'y_true', 'y_pred'], {'prot_attr': 'pa_name', 'priv_group': 'priv_grp'}), '(precision, y_true, y_pred, prot_attr=pa_name, priv_group=priv_grp)\n', (1707, 1774), False, 'from aif360.sklearn.metrics import difference, ratio\n'), ((2221, 2307), 'aif36... |
#***************************************************#
# This file is part of PFNET. #
# #
# Copyright (c) 2015, <NAME>. #
# #
# PFNET is released under the BSD 2-clause license. #
#***********... | [
"pfnet.Parser",
"pfnet.Constraint",
"numpy.linalg.norm",
"sys.path.append",
"numpy.random.randn"
] | [((413, 433), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (428, 433), False, 'import sys\n'), ((671, 712), 'pfnet.Constraint', 'pfnet.Constraint', (['"""AC power balance"""', 'net'], {}), "('AC power balance', net)\n", (687, 712), False, 'import pfnet\n'), ((1071, 1094), 'numpy.random.randn', 'n... |
import os
import pytest
import pandas as pd
import numpy as np
from shclassify.utils import (inverse_logit,
choose_from_multinomial_probs,
choose_from_binary_probs)
def test_inverse_logit():
assert inverse_logit(0) == 0.5
def test_choose_from_multinomia... | [
"shclassify.utils.choose_from_multinomial_probs",
"shclassify.utils.inverse_logit",
"pytest.raises",
"numpy.random.uniform",
"shclassify.utils.choose_from_binary_probs"
] | [((489, 522), 'shclassify.utils.choose_from_multinomial_probs', 'choose_from_multinomial_probs', (['df'], {}), '(df)\n', (518, 522), False, 'from shclassify.utils import inverse_logit, choose_from_multinomial_probs, choose_from_binary_probs\n'), ((1242, 1287), 'shclassify.utils.choose_from_binary_probs', 'choose_from_b... |
import numpy as np
from scipy import interpolate, signal
from scipy.special import gamma
import ndmath
import warnings
import pkg_resources
class PlaningBoat():
"""Prismatic planing craft
Attributes:
speed (float): Speed (m/s). It is an input to :class:`PlaningBoat`.
weight (float): Weigh... | [
"numpy.log10",
"numpy.sqrt",
"ndmath.complexGrad",
"numpy.column_stack",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.sin",
"numpy.genfromtxt",
"scipy.interpolate.interp2d",
"ndmath.nDimNewton",
"scipy.signal.step",
"numpy.multiply",
"numpy.exp",
"numpy.real",
"numpy.polyval",
"... | [((10728, 10758), 'numpy.array', 'np.array', (['[0, -self.weight, 0]'], {}), '([0, -self.weight, 0])\n', (10736, 10758), True, 'import numpy as np\n'), ((33506, 33544), 'numpy.array', 'np.array', (['[[-np.Inf, np.Inf], tauLims]'], {}), '([[-np.Inf, np.Inf], tauLims])\n', (33514, 33544), True, 'import numpy as np\n'), (... |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 6 09:54:17 2015
@author: jmilli
"""
import numpy as np
from scipy.interpolate import interp1d
def create2dMap(values,inputRadii=None,maxRadius=None):
"""
This function takes a 1D radial distribution in input and builds a 2map
"""
nbValues=len(values)
... | [
"numpy.meshgrid",
"numpy.isfinite",
"numpy.arange",
"scipy.interpolate.interp1d"
] | [((533, 573), 'numpy.arange', 'np.arange', (['(-maxRadius / 2)', '(maxRadius / 2)'], {}), '(-maxRadius / 2, maxRadius / 2)\n', (542, 573), True, 'import numpy as np\n'), ((579, 612), 'numpy.meshgrid', 'np.meshgrid', (['imageAxis', 'imageAxis'], {}), '(imageAxis, imageAxis)\n', (590, 612), True, 'import numpy as np\n'),... |
# !/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
# Modified by <NAME> on 20 April 2020
import argparse
import datetime
impo... | [
"numpy.dtype",
"pygame.font.get_fonts",
"numpy.reshape",
"argparse.ArgumentParser",
"pygame.event.get",
"carla.WeatherParameters",
"pygame.font.match_font",
"math.radians",
"math.cos",
"numpy.array",
"numpy.dot",
"pdb.set_trace",
"numpy.linalg.norm",
"numpy.finfo",
"pygame.font.Font",
... | [((2198, 2292), 'numpy.array', 'np.array', (['[target_location.x - current_location.x, target_location.y - current_location.y\n ]'], {}), '([target_location.x - current_location.x, target_location.y -\n current_location.y])\n', (2206, 2292), True, 'import numpy as np\n'), ((2307, 2336), 'numpy.linalg.norm', 'np.l... |
import warnings
from collections.abc import Iterable
from collections import OrderedDict
import torch
import numpy as np
from torch.utils.data import Dataset
from deep_staple.utils.torch_utils import interpolate_sample, augmentNoise, spatial_augment, torch_manual_seeded, ensure_dense
from deep_staple.utils.common_uti... | [
"torch.utils.data._utils.collate.default_collate",
"deep_staple.utils.torch_utils.ensure_dense",
"torch.load",
"torch.max",
"deep_staple.utils.torch_utils.augmentNoise",
"torch.tensor",
"numpy.quantile",
"numpy.linspace",
"deep_staple.utils.torch_utils.interpolate_sample",
"deep_staple.utils.torch... | [((14231, 14259), 'deep_staple.utils.torch_utils.ensure_dense', 'ensure_dense', (['modified_label'], {}), '(modified_label)\n', (14243, 14259), False, 'from deep_staple.utils.torch_utils import interpolate_sample, augmentNoise, spatial_augment, torch_manual_seeded, ensure_dense\n'), ((22241, 22287), 'deep_staple.utils.... |
from __future__ import annotations
from argparse import ArgumentParser
from collections import deque
import numpy as np
def count_lte(mat: np.ndarray) -> np.ndarray:
"""
lte[i,j] = count (neighbours <= mat[i,j])
. t .
l . r
. b .
"""
aug = np.pad(mat.astype(float), (1, 1), mode="constant... | [
"numpy.product",
"collections.deque",
"argparse.ArgumentParser",
"numpy.where",
"matplotlib.colors.ListedColormap",
"numpy.sum",
"numpy.linspace",
"matplotlib.pyplot.scatter",
"numpy.zeros_like",
"matplotlib.pyplot.show"
] | [((544, 568), 'numpy.sum', 'np.sum', (['(1 + xs[lte == 0])'], {}), '(1 + xs[lte == 0])\n', (550, 568), True, 'import numpy as np\n'), ((787, 794), 'collections.deque', 'deque', ([], {}), '()\n', (792, 794), False, 'from collections import deque\n'), ((1510, 1529), 'numpy.product', 'np.product', (['top[:3]'], {}), '(top... |
import numpy as np
import tensorflow as tf
def split_reim(array):
"""Split a complex valued matrix into its real and imaginary parts.
Args:
array(complex): An array of shape (batch_size, N, N) or (batch_size, N, N, 1)
Returns:
split_array(float): An array of shape (batch_size, N, N, 2) conta... | [
"tensorflow.math.imag",
"numpy.real",
"numpy.stack",
"tensorflow.concat",
"tensorflow.math.real",
"tensorflow.cast",
"numpy.imag",
"tensorflow.stack"
] | [((417, 431), 'numpy.real', 'np.real', (['array'], {}), '(array)\n', (424, 431), True, 'import numpy as np\n'), ((443, 457), 'numpy.imag', 'np.imag', (['array'], {}), '(array)\n', (450, 457), True, 'import numpy as np\n'), ((476, 506), 'numpy.stack', 'np.stack', (['(real, imag)'], {'axis': '(3)'}), '((real, imag), axis... |
# /bin/env python
# coding: utf-8
from __future__ import print_function
import sys
import argparse
import logging
import os
import math
import cv2
import numpy as np
class GenerateSyntheticData:
import PythonMagick as Magick
def __init__(self, logger=None):
if logger == None:
logging.b... | [
"logging.basicConfig",
"logging.getLogger",
"cv2.__version__.split",
"numpy.random.normal",
"cv2.imwrite",
"argparse.ArgumentParser",
"os.path.isfile",
"numpy.random.uniform",
"argparse.Namespace",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"sys.exit",
"cv2.imread",
"numpy.random.binomi... | [((23128, 23153), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (23151, 23153), False, 'import argparse\n'), ((23668, 23728), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'args.log_level'}), '(stream=sys.stdout, level=args.log_level)\n', (23687, 23728), ... |
from service_objects import services
import numpy as np
import pandas as pd
from django.db import connection
import datetime
from front.models import Match, Match_Stats, Player, Tourney, Tourney_Level, Surface
class IngestMatchesService(services.Service):
def process(self):
cursor = connection.cursor()
... | [
"front.models.Tourney_Level.objects.filter",
"pandas.isnull",
"front.models.Match.objects.filter",
"front.models.Surface",
"front.models.Tourney_Level",
"datetime.datetime.now",
"front.models.Match_Stats.objects.filter",
"front.models.Player.objects.filter",
"django.db.connection.cursor",
"numpy.i... | [((299, 318), 'django.db.connection.cursor', 'connection.cursor', ([], {}), '()\n', (316, 318), False, 'from django.db import connection\n'), ((9006, 9034), 'front.models.Player.objects.filter', 'Player.objects.filter', ([], {'id': 'id'}), '(id=id)\n', (9027, 9034), False, 'from front.models import Match, Match_Stats, ... |
import numpy as np
import cv2
import os
from matplotlib import pyplot as plt
#### INPUT ####
# folder that contains datapoints
folderName = '2dIR'
#### SETTINGS ####
# settings listed below are suitable for 2D data
# intensity of noise filtering; higher values mean more blurring
medianKernel = 5
# bl... | [
"matplotlib.pyplot.ylabel",
"numpy.ascontiguousarray",
"numpy.genfromtxt",
"os.listdir",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.sort",
"cv2.medianBlur",
"numpy.amin",
"numpy.average",
"numpy.argmax",
"cv2.putText",
"numpy.isnan",
"numpy.savetxt",
"numpy.std",
"cv2... | [((11748, 11777), 'os.listdir', 'os.listdir', (["(folderName + '/.')"], {}), "(folderName + '/.')\n", (11758, 11777), False, 'import os\n'), ((13133, 13182), 'numpy.savetxt', 'np.savetxt', (['"""results.txt"""', 'results'], {'delimiter': '""","""'}), "('results.txt', results, delimiter=',')\n", (13143, 13182), True, 'i... |
import numpy as np
from matplotlib import pyplot as plt
from env import DrivingEnv
from solvers import GridSolver, SampleGraphSolver
def time_compare(seed=1234, min_sample=10, max_sample=50, count=10):
sample_count = np.linspace(min_sample, max_sample, count).astype(int)
grid_times = []
graph_times = []
... | [
"matplotlib.pyplot.semilogy",
"env.DrivingEnv",
"solvers.SampleGraphSolver",
"numpy.mean",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"solvers.GridSolver",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.title",
"numpy.logspace",
"matplotlib.pyplot... | [((650, 662), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (660, 662), True, 'from matplotlib import pyplot as plt\n'), ((667, 725), 'matplotlib.pyplot.semilogy', 'plt.semilogy', (['sample_count', 'grid_times'], {'label': '"""Grid-based"""'}), "(sample_count, grid_times, label='Grid-based')\n", (679, 725... |
import numpy as np
import math
from scipy.stats import truncnorm
class ElectricMotor:
"""
Base class for all technical electrical motor models.
A motor consists of the ode-state. These are the dynamic quantities of its ODE.
For example:
ODE-State of a DC-shunt motor... | [
"numpy.abs",
"numpy.sqrt",
"numpy.random.random_sample",
"numpy.asarray",
"math.cos",
"numpy.array",
"numpy.matmul",
"math.sin",
"numpy.zeros_like",
"numpy.atleast_1d"
] | [((18618, 18695), 'numpy.array', 'np.array', (["[[-mp['r_a'], 0, -mp['l_e_prime'], 1, 0], [0, -mp['r_e'], 0, 0, 1]]"], {}), "([[-mp['r_a'], 0, -mp['l_e_prime'], 1, 0], [0, -mp['r_e'], 0, 0, 1]])\n", (18626, 18695), True, 'import numpy as np\n'), ((29603, 29660), 'numpy.array', 'np.array', (["[[-mp['r_a'] - mp['r_e'], -... |
import os
import sys
sys.path.append('.')
import argparse
import numpy as np
import os.path as osp
from multiprocessing import Process, Pool
from glob import glob
from tqdm import tqdm
import tensorflow as tf
from PIL import Image
from lib.core.config import INSTA_DIR, INSTA_IMG_DIR
def process_single_record(fname,... | [
"tensorflow.train.Example",
"os.makedirs",
"argparse.ArgumentParser",
"tensorflow.python_io.tf_record_iterator",
"tensorflow.Session",
"numpy.squeeze",
"sys.path.append",
"glob.glob",
"tensorflow.image.decode_jpeg"
] | [((21, 41), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (36, 41), False, 'import sys\n'), ((348, 360), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (358, 360), True, 'import tensorflow as tf\n'), ((1226, 1251), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (124... |
from pathlib import Path
import sys
path = str(Path(Path(__file__).parent.absolute()).parent.absolute())
sys.path.insert(0, path)
from mnist_utils.util import _x, _y_int
from sklearn.cluster import MiniBatchKMeans
from sklearn.metrics import accuracy_score, adjusted_rand_score
import numpy as np
from fast_pytorch_kmean... | [
"fast_pytorch_kmeans.KMeans",
"tabulate.tabulate",
"sys.path.insert",
"numpy.unique",
"pathlib.Path",
"numpy.where",
"sklearn.cluster.MiniBatchKMeans",
"sklearn.metrics.adjusted_rand_score",
"torch.from_numpy",
"numpy.bincount",
"sklearn.metrics.accuracy_score"
] | [((105, 129), 'sys.path.insert', 'sys.path.insert', (['(0)', 'path'], {}), '(0, path)\n', (120, 129), False, 'import sys\n'), ((849, 905), 'sklearn.cluster.MiniBatchKMeans', 'MiniBatchKMeans', ([], {'n_clusters': 'cluster_count', 'verbose': '(False)'}), '(n_clusters=cluster_count, verbose=False)\n', (864, 905), False, ... |
import numpy as np
from JacobiPolynomials import *
import math
# 1D - LINE
#------------------------------------------------------------------------------------------------------------------#
#------------------------------------------------------------------------------------------------------------------#
#---------... | [
"numpy.sqrt",
"numpy.isclose",
"math.sqrt",
"numpy.array",
"numpy.zeros"
] | [((464, 479), 'numpy.zeros', 'np.zeros', (['(C + 2)'], {}), '(C + 2)\n', (472, 479), True, 'import numpy as np\n'), ((1188, 1199), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (1196, 1199), True, 'import numpy as np\n'), ((2575, 2586), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (2583, 2586), True, 'import num... |
#!/usr/bin/python3
from tools import *
from sys import argv
from os.path import join
import h5py
import matplotlib.pylab as plt
from matplotlib.patches import Wedge
import numpy as np
if len(argv) > 1:
pathToSimFolder = argv[1]
else:
pathToSimFolder = "../data/"
parameters, electrodes = readParameters(pathT... | [
"matplotlib.pylab.subplots",
"matplotlib.pylab.Circle",
"matplotlib.patches.Wedge",
"matplotlib.colors.to_rgba",
"os.path.join",
"matplotlib.pylab.Rectangle",
"numpy.cos",
"numpy.sin",
"matplotlib.pylab.close"
] | [((637, 672), 'os.path.join', 'join', (['pathToSimFolder', '"""device.txt"""'], {}), "(pathToSimFolder, 'device.txt')\n", (641, 672), False, 'from os.path import join\n'), ((2671, 2726), 'os.path.join', 'join', (['pathToSimFolder', 'f"""swapTrackFile{fileNumber}.txt"""'], {}), "(pathToSimFolder, f'swapTrackFile{fileNum... |
# coding: utf-8
"""
2018-03-19.
Maximum screenshots in 1 second by computing BGRA raw values to RGB.
GNU/Linux
pil_frombytes 139
mss_rgb 119
pil_frombytes_rgb 51
numpy_flip 31
numpy_slice 29
macOS
pil_frombytes 209
mss_rgb 174
pil_frombytes_rgb 113
numpy_fl... | [
"numpy.flip",
"mss.mss",
"numpy.array",
"PIL.Image.frombytes",
"time.time"
] | [((655, 689), 'numpy.array', 'numpy.array', (['im'], {'dtype': 'numpy.uint8'}), '(im, dtype=numpy.uint8)\n', (666, 689), False, 'import numpy\n'), ((1057, 1066), 'mss.mss', 'mss.mss', ([], {}), '()\n', (1064, 1066), False, 'import mss\n'), ((701, 731), 'numpy.flip', 'numpy.flip', (['frame[:, :, :3]', '(2)'], {}), '(fra... |
import os
import random
import argparse
import multiprocessing
import numpy as np
import torch
from torchvision import models, transforms
from torch.utils.data import DataLoader, Dataset
from pathlib import Path
from PIL import Image
from utils import Bar, config, mkdir_p, AverageMeter
from datetime import datetime
fro... | [
"utils.mkdir_p",
"torchvision.models.resnet18",
"multiprocessing.cpu_count",
"torchvision.transforms.ColorJitter",
"torch.cuda.is_available",
"argparse.ArgumentParser",
"pathlib.Path",
"os.path.isdir",
"numpy.random.seed",
"torchvision.transforms.ToTensor",
"random.randint",
"torchvision.model... | [((409, 467), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""byol-lightning-test"""'}), "(description='byol-lightning-test')\n", (432, 467), False, 'import argparse\n'), ((1935, 1960), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1958, 1960), False, 'import to... |
import cv2
import pickle
import numpy as np
from flag import Flag
flag = Flag()
with open('assets/colors.h5', 'rb') as f:
colors = pickle.loads(f.read())
with open('label.txt', 'r') as f:
classes = f.readlines()
def detector(image, label):
image = np.asarray(image * 255., np.uint8)
image = cv2.cvtCo... | [
"numpy.ones",
"numpy.where",
"numpy.asarray",
"cv2.filter2D",
"cv2.imshow",
"numpy.max",
"cv2.cvtColor",
"cv2.findContours",
"numpy.load",
"cv2.waitKey",
"flag.Flag"
] | [((74, 80), 'flag.Flag', 'Flag', ([], {}), '()\n', (78, 80), False, 'from flag import Flag\n'), ((264, 299), 'numpy.asarray', 'np.asarray', (['(image * 255.0)', 'np.uint8'], {}), '(image * 255.0, np.uint8)\n', (274, 299), True, 'import numpy as np\n'), ((311, 349), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_... |
import requests
import io
import dask
from bs4 import BeautifulSoup as BS
import nltk
import pandas
import numpy as np
def News(ticker):
B = BS(requests.get(f"https://www.wsj.com/market-data/quotes/{ticker}", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) ... | [
"requests.get",
"numpy.asarray",
"nltk.word_tokenize",
"pandas.read_csv"
] | [((504, 525), 'nltk.word_tokenize', 'nltk.word_tokenize', (['h'], {}), '(h)\n', (522, 525), False, 'import nltk\n'), ((578, 594), 'numpy.asarray', 'np.asarray', (['News'], {}), '(News)\n', (588, 594), True, 'import numpy as np\n'), ((150, 370), 'requests.get', 'requests.get', (['f"""https://www.wsj.com/market-data/quot... |
from abc import ABCMeta, abstractmethod
from functools import partial
from typing import Tuple, Union
import numexpr
import numpy as np
from scipy import sparse, special
from tabmat import MatrixBase, StandardizedMatrix
from ._functions import (
binomial_logit_eta_mu_deviance,
binomial_logit_rowwise_gradient_... | [
"numpy.clip",
"scipy.special.xlogy",
"numpy.less_equal",
"numpy.log",
"numpy.asanyarray",
"numpy.array",
"numpy.isfinite",
"numpy.greater_equal",
"numpy.multiply",
"numpy.less",
"numpy.greater",
"numpy.isscalar",
"numpy.exp",
"numpy.dot",
"numpy.maximum",
"numpy.arctan",
"numpy.abs",... | [((34790, 34826), 'numpy.average', 'np.average', (['y'], {'weights': 'sample_weight'}), '(y, weights=sample_weight)\n', (34800, 34826), True, 'import numpy as np\n'), ((10487, 10509), 'numpy.empty_like', 'np.empty_like', (['cur_eta'], {}), '(cur_eta)\n', (10500, 10509), True, 'import numpy as np\n'), ((10527, 10549), '... |
#!/usr/bin/env python
import collections
# import itertools
import numpy as np
# from sklearn import linear_model as linear # for VAR
# from .utils import sliding_window as window
# from .utils.distance import kmeans, dists_sq
# from .utils import distance as dist
# from python import compress
# ===============... | [
"numpy.mean",
"numpy.median",
"numpy.argmax",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"collections.Counter",
"numpy.empty",
"numpy.sum",
"numpy.sign"
] | [((3011, 3025), 'numpy.array', 'np.array', (['keys'], {}), '(keys)\n', (3019, 3025), True, 'import numpy as np\n'), ((3039, 3055), 'numpy.array', 'np.array', (['coeffs'], {}), '(coeffs)\n', (3047, 3055), True, 'import numpy as np\n'), ((3068, 3086), 'numpy.argsort', 'np.argsort', (['coeffs'], {}), '(coeffs)\n', (3078, ... |
import numpy as np
def mean_or_nan(xs):
"""Return its mean a non-empty sequence, numpy.nan for a empty one."""
return np.mean(xs) if xs else np.nan | [
"numpy.mean"
] | [((128, 139), 'numpy.mean', 'np.mean', (['xs'], {}), '(xs)\n', (135, 139), True, 'import numpy as np\n')] |
### based on https://github.com/kylemcdonald/Parametric-t-SNE/blob/master/Parametric%20t-SNE%20(Keras).ipynb
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.losses import categorical_crossentropy
from tqdm.autonotebook import tqdm
import tensorflow as tf
def Hbeta(D, beta):
""... | [
"tensorflow.math.pow",
"numpy.sqrt",
"tensorflow.transpose",
"tensorflow.math.log",
"numpy.log",
"numpy.arange",
"numpy.multiply",
"numpy.exp",
"numpy.isinf",
"numpy.eye",
"numpy.ones",
"tensorflow.keras.backend.reshape",
"numpy.square",
"tensorflow.math.maximum",
"numpy.isnan",
"numpy... | [((532, 549), 'numpy.exp', 'np.exp', (['(-D * beta)'], {}), '(-D * beta)\n', (538, 549), True, 'import numpy as np\n'), ((561, 570), 'numpy.sum', 'np.sum', (['P'], {}), '(P)\n', (567, 570), True, 'import numpy as np\n'), ((1437, 1453), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (1445, 1453), True, 'impo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Compare to numpy data"""
import sys
import numpy as np
import multipletau
from test_correlate import get_sample_arrays_cplx
def test_corresponds_ac():
myframe = sys._getframe()
myname = myframe.f_code.co_name
print("running ", myname)
a = np.concatenate... | [
"multipletau.correlate_numpy",
"numpy.allclose",
"numpy.average",
"numpy.where",
"sys._getframe",
"numpy.array",
"multipletau.correlate",
"numpy.concatenate",
"test_correlate.get_sample_arrays_cplx",
"multipletau.autocorrelate"
] | [((215, 230), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (228, 230), False, 'import sys\n'), ((377, 465), 'multipletau.autocorrelate', 'multipletau.autocorrelate', ([], {'a': '(1 * a)', 'm': 'm', 'copy': '(True)', 'normalize': '(True)', 'dtype': 'np.float_'}), '(a=1 * a, m=m, copy=True, normalize=True, dtype=n... |
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from nilearn.datasets.utils import _fetch_files
from scipy import sparse
class StudyID(str):
pass
class TfIDf(float):
pass
NS_DATA_URL = "https://github.com/neurosynth/neurosynth-data/raw/master/"
def fetch_stud... | [
"numpy.hstack",
"scipy.sparse.load_npz",
"numpy.array",
"pandas.concat",
"nilearn.datasets.utils._fetch_files",
"pandas.read_table",
"numpy.genfromtxt"
] | [((1891, 1919), 'pandas.read_table', 'pd.read_table', (['metadata_file'], {}), '(metadata_file)\n', (1904, 1919), True, 'import pandas as pd\n'), ((3386, 3480), 'nilearn.datasets.utils._fetch_files', '_fetch_files', (['data_dir', '[(fn, NS_DATA_URL + fn, {}) for fn in file_names]'], {'verbose': 'verbose'}), '(data_dir,... |
# Created by <NAME>.
import sys
import numpy as np
sys.path.append('../')
from envs import GridWorld
from itertools import product
from utils import print_episode, eps_greedy_policy, test_policy
'''
n-step Tree Backup used to estimate the optimal policy for
the gridworld environment defined on page 48 of
"Reinforcemen... | [
"utils.test_policy",
"utils.print_episode",
"numpy.argmax",
"envs.GridWorld",
"numpy.zeros",
"sys.path.append",
"utils.eps_greedy_policy"
] | [((51, 73), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (66, 73), False, 'import sys\n'), ((1122, 1133), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1130, 1133), True, 'import numpy as np\n'), ((1148, 1159), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1156, 1159), True, 'import n... |
import sys
import os
import timeit
# use local python package rather than the system install
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../python"))
from bitboost import BitBoostRegressor
import numpy as np
import sklearn.metrics
nfeatures = 5
nexamples = 10000
data = np.random.choice(np.array([0.0,... | [
"os.path.dirname",
"numpy.array",
"bitboost.BitBoostRegressor"
] | [((719, 738), 'bitboost.BitBoostRegressor', 'BitBoostRegressor', ([], {}), '()\n', (736, 738), False, 'from bitboost import BitBoostRegressor\n'), ((306, 361), 'numpy.array', 'np.array', (['[0.0, 1.0, 2.0]'], {'dtype': 'BitBoostRegressor.numt'}), '([0.0, 1.0, 2.0], dtype=BitBoostRegressor.numt)\n', (314, 361), True, 'i... |
import os
import numpy as np
from six.moves import cPickle
from tensorflow import keras
from tensorflow import keras
import helper
from tfomics import utils, metrics, explain
#------------------------------------------------------------------------
model_names = ['residualbind']
activations = ['exponential', 'relu']... | [
"helper.get_callbacks",
"helper.load_data",
"numpy.where",
"six.moves.cPickle.dump",
"os.path.join",
"helper.load_model",
"tfomics.explain.saliency",
"helper.compile_model",
"tensorflow.keras.backend.clear_session",
"tfomics.utils.make_directory",
"tfomics.metrics.calculate_metrics"
] | [((338, 381), 'tfomics.utils.make_directory', 'utils.make_directory', (['"""../results"""', '"""task6"""'], {}), "('../results', 'task6')\n", (358, 381), False, 'from tfomics import utils, metrics, explain\n'), ((396, 446), 'tfomics.utils.make_directory', 'utils.make_directory', (['results_path', '"""model_params"""'],... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 14:15:38 2019
@author: Satish
"""
# doing the ortho-correction on the processed data from matchedFilter
import os
import numpy as np
import spectral as spy
import spectral.io.envi as envi
import spectral.algorithms as algo
from spectral.algorith... | [
"logging.getLogger",
"spectral.io.envi.read_envi_header",
"spectral.io.envi.gen_params",
"numpy.save",
"os.path.exists",
"os.listdir",
"os.path.isdir",
"numpy.vstack",
"os.mkdir",
"spectral.io.bipfile.BipFile",
"logging.basicConfig",
"coloredlogs.install",
"numpy.absolute",
"os.path.join",... | [((467, 506), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (486, 506), False, 'import logging\n'), ((516, 555), 'logging.getLogger', 'logging.getLogger', (['"""aviris_data_loader"""'], {}), "('aviris_data_loader')\n", (533, 555), False, 'import logging\n'), ((... |
# -*- coding: utf-8 -*-
import numpy as np
import csv
import tensorflow as tf
from config import Config
from DataFeeder import DataFeeder,TestData
from model import DKT
from sklearn.metrics import f1_score,precision_score,recall_score
indices = [precision_score,recall_score,f1_score]
def make_prediction(... | [
"tensorflow.reset_default_graph",
"model.DKT",
"tensorflow.Session",
"config.Config",
"csv.writer",
"DataFeeder.TestData",
"DataFeeder.DataFeeder",
"tensorflow.global_variables_initializer",
"numpy.concatenate",
"numpy.arange"
] | [((388, 412), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (410, 412), True, 'import tensorflow as tf\n'), ((424, 471), 'config.Config', 'Config', ([], {'dataFile': "('%s/Training.csv' % folderName)"}), "(dataFile='%s/Training.csv' % folderName)\n", (430, 471), False, 'from config impor... |
import numpy as np
def ratios(pops1, pops2):
totals1 = np.array(pops1[0]) + np.array(pops1[1])
totals2 = np.array(pops2[0]) + np.array(pops2[1])
change_ratio = np.delete(totals2, 0) / np.delete(totals1, -1)
change_ratio = np.delete(change_ratio, -1)
baby_ratio = totals2[0] / np.sum(np.array(pops1... | [
"numpy.delete",
"numpy.array",
"numpy.sum"
] | [((241, 268), 'numpy.delete', 'np.delete', (['change_ratio', '(-1)'], {}), '(change_ratio, -1)\n', (250, 268), True, 'import numpy as np\n'), ((61, 79), 'numpy.array', 'np.array', (['pops1[0]'], {}), '(pops1[0])\n', (69, 79), True, 'import numpy as np\n'), ((82, 100), 'numpy.array', 'np.array', (['pops1[1]'], {}), '(po... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# Set fontsize larger for latex plots
matplotlib.rcParams.update({'font.size': 20})
# Generate data from file
x, y = np.genfromtxt("bin/python_Aufgabe2.txt", unpack=True)
m, n = x[-1], y[-1]
# Plotting
plt.figure(figsize=(12,7))
plt.grid()
plt.xla... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.rcParams.update",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.genfromtxt",
"matplotlib.pyplot.legend"
] | [((108, 153), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'font.size': 20}"], {}), "({'font.size': 20})\n", (134, 153), False, 'import matplotlib\n'), ((188, 241), 'numpy.genfromtxt', 'np.genfromtxt', (['"""bin/python_Aufgabe2.txt"""'], {'unpack': '(True)'}), "('bin/python_Aufgabe2.txt', unpack=True... |
'''
Created on April 15, 2018
@author: <NAME>
'''
import numpy as np
import warnings
from scipy.stats import gamma, lognorm
from sklearn.linear_model import ElasticNet
from spn.structure.leaves.conditional.Conditional import Conditional_Gaussian, Conditional_Poisson, \
Conditional_Bernoulli
import statsmodels.api... | [
"statsmodels.api.families.Poisson",
"numpy.savez",
"sklearn.linear_model.ElasticNet",
"numpy.ones",
"statsmodels.api.families.Gaussian",
"tensorflow_probability.glm.Poisson",
"tensorflow.Session",
"statsmodels.api.families.Binomial",
"os.path.dirname",
"tensorflow.constant",
"numpy.isnan",
"st... | [((364, 381), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (371, 381), False, 'from os.path import dirname\n'), ((939, 1013), 'sklearn.linear_model.ElasticNet', 'ElasticNet', ([], {'random_state': '(0)', 'alpha': '(0.01)', 'max_iter': '(2000)', 'fit_intercept': '(False)'}), '(random_state=0, alpha=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from NumPyNet.activations import Activations
from NumPyNet.utils import _check_activation
from NumPyNet.utils import check_is_fitted
import numpy as np
from NumPyNet.layers.base import BaseLayer
__aut... | [
"PIL.Image.open",
"numpy.ones",
"NumPyNet.utils._check_activation",
"NumPyNet.utils.check_is_fitted",
"os.path.dirname",
"numpy.zeros",
"NumPyNet.activations.Hardtan",
"numpy.expand_dims",
"pylab.subplots",
"pylab.show"
] | [((4263, 4284), 'NumPyNet.activations.Hardtan', 'activations.Hardtan', ([], {}), '()\n', (4282, 4284), False, 'from NumPyNet import activations\n'), ((4751, 4779), 'numpy.expand_dims', 'np.expand_dims', (['inpt'], {'axis': '(0)'}), '(inpt, axis=0)\n', (4765, 4779), True, 'import numpy as np\n'), ((4971, 5009), 'numpy.o... |
"""
This script shows the usage of scikit-learns linear regression functionality.
"""
# %% [markdown]
# # Linear Regression using Scikit-Learn #
# %% [markdown]
# ## Ice Cream Dataset ##
# | Temperature C° | Ice Cream Sales |
# |:--------------:|:---------------:|
# | 15 | 34 |
# | 24 ... | [
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"sklearn.metrics.mean_squared_error",
"numpy.array",
"matplotlib.pyplot.scatter",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.show"
] | [((1100, 1247), 'numpy.array', 'np.array', (['[[15, 34], [24, 587], [34, 1200], [31, 1080], [29, 989], [26, 734], [17, 80\n ], [11, 1], [23, 523], [25, 651], [0, 0], [2, 0], [12, 5]]'], {}), '([[15, 34], [24, 587], [34, 1200], [31, 1080], [29, 989], [26, 734],\n [17, 80], [11, 1], [23, 523], [25, 651], [0, 0], [2... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''test_Rainbow_pen
'''
import sys, os
import numpy as np
from matplotlib import pyplot as plt
from PIL import Image
FN_OUT = 'rainbow_pen_320x240.png'
def mk_col(w, h, x, y):
a = 255
i = int(7 * y / h)
if i == 0: c, u, v = (192, 0, 0), (32, 0, 0), (0, 32, 0) # R... | [
"PIL.Image.fromarray",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.ndarray",
"matplotlib.pyplot.show"
] | [((1087, 1106), 'numpy.array', 'np.array', (['(r, g, b)'], {}), '((r, g, b))\n', (1095, 1106), True, 'import numpy as np\n'), ((1475, 1509), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(6, 4)', 'dpi': '(96)'}), '(figsize=(6, 4), dpi=96)\n', (1485, 1509), True, 'from matplotlib import pyplot as plt\n'), ... |
from numpy import array as np_array, zeros as np_zeros, sum as np_sum, empty as np_empty, \
amax as np_amax, interp as np_interp, ones as np_ones, tile as np_tile, isnan as np_isnan
import yaml
from seir_model import SEIR_matrix
from common import Window, get_datetime, timesteps_between_dates, get_datetime_arra... | [
"yaml.full_load",
"common.timesteps_over_timedelta_weeks",
"common.get_datetime",
"numpy.ones",
"common.get_datetime_array",
"common.timesteps_between_dates",
"numpy.sum",
"numpy.zeros",
"numpy.empty",
"numpy.interp",
"sys.exit",
"seir_model.SEIR_matrix",
"numpy.amax"
] | [((1888, 1920), 'numpy.sum', 'np_sum', (['proportion_total'], {'axis': '(0)'}), '(proportion_total, axis=0)\n', (1894, 1920), True, 'from numpy import array as np_array, zeros as np_zeros, sum as np_sum, empty as np_empty, amax as np_amax, interp as np_interp, ones as np_ones, tile as np_tile, isnan as np_isnan\n'), ((... |
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import matplotlib.gridspec as gs
import sys
data = np.loadtxt('NbSe2.freq.gp')
symmetryfile = 'plotband.out'
lbd = np.loadtxt("lambda.dat")
lbd_val = np.where(lbd<1 , lbd, 1)
def Symmetries(fstring):
f = open(fstring, 'r')
x = np.... | [
"numpy.tile",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"numpy.where",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.ylim",
"numpy.loadtxt",
"matplotlib.pyplot.axvline",
"mat... | [((133, 160), 'numpy.loadtxt', 'np.loadtxt', (['"""NbSe2.freq.gp"""'], {}), "('NbSe2.freq.gp')\n", (143, 160), True, 'import numpy as np\n'), ((197, 221), 'numpy.loadtxt', 'np.loadtxt', (['"""lambda.dat"""'], {}), "('lambda.dat')\n", (207, 221), True, 'import numpy as np\n'), ((232, 257), 'numpy.where', 'np.where', (['... |
"""
Regression tests for the REINFORCE agent on OpenAI gym environments
"""
import pytest
import numpy as np
import shutil
from yarlp.utils.env_utils import NormalizedGymEnv
from yarlp.agent.ddqn_agent import DDQNAgent
env = NormalizedGymEnv(
'PongNoFrameskip-v4',
is_atari=True
)
def test_ddqn():
a... | [
"yarlp.agent.ddqn_agent.DDQNAgent.load",
"yarlp.utils.env_utils.NormalizedGymEnv",
"numpy.array",
"shutil.rmtree",
"yarlp.agent.ddqn_agent.DDQNAgent"
] | [((232, 285), 'yarlp.utils.env_utils.NormalizedGymEnv', 'NormalizedGymEnv', (['"""PongNoFrameskip-v4"""'], {'is_atari': '(True)'}), "('PongNoFrameskip-v4', is_atari=True)\n", (248, 285), False, 'from yarlp.utils.env_utils import NormalizedGymEnv\n'), ((327, 418), 'yarlp.agent.ddqn_agent.DDQNAgent', 'DDQNAgent', (['env'... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
import tensorflow_probability as tfp
from tensorflow_proba... | [
"seaborn.distplot",
"matplotlib.use",
"odin.visual.plot_save",
"tensorflow.reduce_sum",
"tensorflow.enable_eager_execution",
"matplotlib.pyplot.figure",
"tensorflow.sqrt",
"numpy.concatenate",
"matplotlib.pyplot.title"
] | [((107, 128), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (121, 128), False, 'import matplotlib\n'), ((233, 260), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (258, 260), True, 'import tensorflow as tf\n'), ((1194, 1206), 'matplotlib.pyplot.figure', 'plt.... |
try:
import tensorflow
except ModuleNotFoundError:
pkg_name = 'tensorflow'
import os
import sys
import subprocess
from cellacdc import myutils
cancel = myutils.install_package_msg(pkg_name)
if cancel:
raise ModuleNotFoundError(
f'User aborted {pkg_name} installation'
... | [
"numpy.__version__.split",
"subprocess.check_call",
"cellacdc.myutils.install_package_msg"
] | [((180, 217), 'cellacdc.myutils.install_package_msg', 'myutils.install_package_msg', (['pkg_name'], {}), '(pkg_name)\n', (207, 217), False, 'from cellacdc import myutils\n'), ((334, 411), 'subprocess.check_call', 'subprocess.check_call', (["[sys.executable, '-m', 'pip', 'install', 'tensorflow']"], {}), "([sys.executabl... |
import os, sys, re, json, random, importlib
import numpy as np
import pandas as pd
from collections import OrderedDict
from tqdm import tqdm
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import logomaker as lm
from venn import venn
from venn import generate_petal_labels, draw_venn
from scipy.s... | [
"pandas.read_csv",
"numpy.log",
"numpy.array",
"seaborn.scatterplot",
"scipy.stats.pearsonr",
"seaborn.regplot",
"os.listdir",
"numpy.where",
"scipy.cluster.hierarchy.linkage",
"matplotlib.pyplot.scatter",
"logomaker.alignment_to_matrix",
"pandas.DataFrame",
"collections.OrderedDict",
"mat... | [((412, 445), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (435, 445), False, 'import warnings\n'), ((3833, 3870), 'pandas.read_csv', 'pd.read_csv', (['df_filename'], {'index_col': '(0)'}), '(df_filename, index_col=0)\n', (3844, 3870), True, 'import pandas as pd\n'), ((9... |
from utils import *
import torch
import sys
import numpy as np
import time
import torchvision
from torch.autograd import Variable
import torchvision.transforms as transforms
import torchvision.datasets as datasets
def validate_pgd(val_loader, model, criterion, K, step, configs, logger, save_image=False, HE=False):
... | [
"torchvision.transforms.CenterCrop",
"torchvision.transforms.ToTensor",
"torch.max",
"torch.min",
"numpy.array",
"torch.autograd.grad",
"torchvision.transforms.Resize",
"torch.no_grad",
"sys.stdout.flush",
"torch.autograd.Variable",
"time.time"
] | [((873, 884), 'time.time', 'time.time', ([], {}), '()\n', (882, 884), False, 'import time\n'), ((4940, 4951), 'time.time', 'time.time', ([], {}), '()\n', (4949, 4951), False, 'import time\n'), ((7509, 7520), 'time.time', 'time.time', ([], {}), '()\n', (7518, 7520), False, 'import time\n'), ((377, 405), 'numpy.array', '... |
import numpy as np
from numexpr_kernel import numexpr_kernel
from numba_kernel import numba_kernel
N = 10000
x = np.random.rand(N)
y = np.random.rand(N)
z = np.random.rand(N)
tau = np.random.rand(N)
r1 = numexpr_kernel(x, y, z, tau)
r1 = numexpr_kernel(x, y, z, tau)
r2 = np.zeros(N, dtype=float)
numba_kernel(x, y, z,... | [
"numexpr_kernel.numexpr_kernel",
"numpy.zeros",
"numba_kernel.numba_kernel",
"numpy.random.rand"
] | [((114, 131), 'numpy.random.rand', 'np.random.rand', (['N'], {}), '(N)\n', (128, 131), True, 'import numpy as np\n'), ((136, 153), 'numpy.random.rand', 'np.random.rand', (['N'], {}), '(N)\n', (150, 153), True, 'import numpy as np\n'), ((158, 175), 'numpy.random.rand', 'np.random.rand', (['N'], {}), '(N)\n', (172, 175),... |
"""
This module give the classification results for test data using SVM with RBF
kernel.
Email: <EMAIL>
Dtd: 2 - August - 2020
Parameters
----------
classification_type : string
DESCRIPTION - classification_type == "binary_class" loads binary classification artificial data.
classification_type == "... | [
"sklearn.metrics.f1_score",
"sklearn.metrics.confusion_matrix",
"os.makedirs",
"numpy.unique",
"sklearn.metrics.classification_report",
"os.getcwd",
"load_data_synthetic.get_data",
"numpy.max",
"sklearn.metrics.accuracy_score",
"numpy.save",
"sklearn.svm.SVC"
] | [((1369, 1380), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1378, 1380), False, 'import os\n'), ((1867, 1896), 'load_data_synthetic.get_data', 'get_data', (['classification_type'], {}), '(classification_type)\n', (1875, 1896), False, 'from load_data_synthetic import get_data\n'), ((2376, 2412), 'sklearn.svm.SVC', 'svm... |
import torch
import numpy as np
import time
import datetime
import random
from Kfold import KFold
from split_data import DataManager
from transformers import BertTokenizer
from transformers import BertTokenizer
from torch.utils.data import TensorDataset, random_split
from torch.utils.data import DataLoader, RandomSamp... | [
"torch.cuda.is_available",
"datetime.timedelta",
"numpy.random.seed",
"torch.utils.data.SequentialSampler",
"numpy.argmax",
"torch.utils.data.TensorDataset",
"transformers.BertForSequenceClassification.from_pretrained",
"time.time",
"torch.cat",
"torch.device",
"torch.cuda.manual_seed_all",
"t... | [((638, 708), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', (['"""bert-base-uncased"""'], {'do_lower_case': '(True)'}), "('bert-base-uncased', do_lower_case=True)\n", (667, 708), False, 'from transformers import BertTokenizer\n'), ((1706, 1733), 'torch.cat', 'torch.cat', (['input_ids'],... |
import numpy as np
import operator
# TODO: Make Mutation Operator.
class TerminationCriteria:
@staticmethod
def _convergence_check(convergence_ratio, population_fitness):
if abs((np.max(population_fitness) - np.mean(population_fitness)) / np.mean(
population_fitness)) <= convergence_... | [
"numpy.random.choice",
"numpy.array",
"numpy.mean",
"numpy.max"
] | [((674, 700), 'numpy.max', 'np.max', (['population_fitness'], {}), '(population_fitness)\n', (680, 700), True, 'import numpy as np\n'), ((3339, 3371), 'numpy.random.choice', 'np.random.choice', (['contestants', 'm'], {}), '(contestants, m)\n', (3355, 3371), True, 'import numpy as np\n'), ((3744, 3762), 'numpy.array', '... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# <NAME> (<EMAIL>)
import py_trees as pt
import py_trees_ros as ptr
import time
import numpy as np
import rospy
import tf
import actionlib
# from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from smarc_msgs.msg import GotoWaypointAction, Got... | [
"std_srvs.srv.SetBool",
"numpy.radians",
"rospy.logerr",
"rospy.logwarn",
"imc_ros_bridge.msg.EstimatedState",
"numpy.argsort",
"py_trees.behaviour.Behaviour.__init__",
"numpy.array",
"rospy.logwarn_throttle",
"tf.TransformListener",
"imc_ros_bridge.msg.PlanDBState",
"imc_ros_bridge.msg.PlanDB... | [((1112, 1138), 'py_trees.blackboard.Blackboard', 'pt.blackboard.Blackboard', ([], {}), '()\n', (1136, 1138), True, 'import py_trees as pt\n'), ((1238, 1245), 'std_msgs.msg.Empty', 'Empty', ([], {}), '()\n', (1243, 1245), False, 'from std_msgs.msg import Float64, Header, Bool, Empty\n'), ((1297, 1345), 'rospy.Publisher... |
""" This Script contain the different function used in the framework
part1. Data processing
part2. Prediction and analisys
part3. Plotting
"""
import numpy as np
import librosa
import matplotlib.pyplot as plt
from sklearn import metrics
import os
import pickle
import time
import struct
""" Data processing """
def g... | [
"matplotlib.pyplot.ylabel",
"librosa.feature.mfcc",
"numpy.arange",
"librosa.load",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sklearn.metrics.confusion_matrix",
"pickle.load",
"struct.unpack",
"matplotlib.pyplot.title",
"librosa.util.normalize",
"matplotlib.pyplot.legend",
"matp... | [((3975, 3992), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (3986, 3992), False, 'import pickle\n'), ((5073, 5118), 'os.path.join', 'os.path.join', (['audio_path', 'fold_num', 'file_name'], {}), '(audio_path, fold_num, file_name)\n', (5085, 5118), False, 'import os\n'), ((5135, 5222), 'os.path.join', 'os.... |
import os
import tarfile
import time
import pickle
import numpy as np
from Bio.Seq import Seq
from scipy.special import expit
from scipy.special import logit
import torch
import torch.nn.functional as F
""" Get directories for model and seengenes """
module_dir = os.path.dirname(os.path.realpath(__file__))
model_dir ... | [
"tarfile.open",
"torch.LongTensor",
"Bio.Seq.Seq",
"torch.cuda.device_count",
"time.sleep",
"numpy.argsort",
"numpy.count_nonzero",
"os.path.exists",
"numpy.asarray",
"torch.hub.load",
"pickle.load",
"torch.hub.set_dir",
"torch.nn.functional.one_hot",
"torch.cuda.empty_cache",
"torch.sta... | [((322, 363), 'os.path.join', 'os.path.join', (['module_dir', '"""balrog_models"""'], {}), "(module_dir, 'balrog_models')\n", (334, 363), False, 'import os\n'), ((282, 308), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (298, 308), False, 'import os\n'), ((3091, 3136), 'torch.tensor', 'tor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 18:18:29 2020
@author: xuhuiying
"""
import numpy as np
import matplotlib.pyplot as plt
def plotHistory(history,times,xLabelText,yLabelText,legendText):#画出每个history plot each history
history = np.array(history) #history是二维数组 history is a 2D... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.plot",
"numpy.array"
] | [((273, 290), 'numpy.array', 'np.array', (['history'], {}), '(history)\n', (281, 290), True, 'import numpy as np\n'), ((589, 623), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['xLabelText'], {'fontsize': '(8)'}), '(xLabelText, fontsize=8)\n', (599, 623), True, 'import matplotlib.pyplot as plt\n'), ((629, 663), 'matplotl... |
import os
from bc import Imitator
import numpy as np
from dataset import Example, Dataset
import utils
#from ale_wrapper import ALEInterfaceWrapper
from evaluator import Evaluator
from pdb import set_trace
import matplotlib.pyplot as plt
#try bmh
plt.style.use('bmh')
def smooth(losses, run=10):
new_losses = []
... | [
"numpy.float",
"matplotlib.pyplot.ylabel",
"evaluator.Evaluator",
"matplotlib.pyplot.xlabel",
"os.path.join",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.legend"
] | [((247, 267), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""bmh"""'], {}), "('bmh')\n", (260, 267), True, 'import matplotlib.pyplot as plt\n'), ((619, 639), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Update"""'], {}), "('Update')\n", (629, 639), True, 'import matplotlib.pyplot as plt\n'), ((648, 666), 'mat... |
#
# See top-level LICENSE.rst file for Copyright information
#
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from ..defs import (task_name_sep, task_state_to_int, task_int_to_state)
from ...util import option_list
from ...io import find... | [
"desiutil.log.get_logger",
"collections.OrderedDict",
"numpy.sum",
"glob.glob"
] | [((2223, 2236), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2234, 2236), False, 'from collections import OrderedDict\n'), ((2860, 2885), 'glob.glob', 'glob.glob', (['template_input'], {}), '(template_input)\n', (2869, 2885), False, 'import sys, re, os, glob\n'), ((3726, 3738), 'desiutil.log.get_logger'... |
# Load in our dependencies
# Forking from http://matplotlib.org/xkcd/examples/showcase/xkcd.html
from matplotlib import pyplot
import numpy
"""
Comments on PRs about style
20 | --------\
| |
| |
| |
| |
1 | \--\
0 | -------
------------------... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xkcd",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"matplotlib.pyplot.title",
"numpy.arange"
] | [((499, 512), 'matplotlib.pyplot.xkcd', 'pyplot.xkcd', ([], {}), '()\n', (510, 512), False, 'from matplotlib import pyplot\n'), ((561, 609), 'matplotlib.pyplot.figure', 'pyplot.figure', (['(1)'], {'figsize': '(600 / dpi, 400 / dpi)'}), '(1, figsize=(600 / dpi, 400 / dpi))\n', (574, 609), False, 'from matplotlib import ... |
import logging
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from networkx import DiGraph
from torch import Tensor, nn as nn
from torch.autograd.variable import Variable
from binlin.data.ud import index_data
from binlin.model.nn_utils import get_embed_matr... | [
"logging.getLogger",
"torch.nn.functional.leaky_relu",
"binlin.utils.combinatorics.flatten_nested_lists",
"torch.bmm",
"torch.LongTensor",
"torch.sigmoid",
"numpy.asarray",
"torch.from_numpy",
"binlin.model.nn_utils.pad_seq",
"torch.nn.Linear",
"binlin.data.ud.index_data",
"torch.FloatTensor",... | [((552, 577), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (569, 577), False, 'import logging\n'), ((1419, 1475), 'torch.nn.Linear', 'nn.Linear', (['self._dim_emb_proj_in', 'self._dim_emb_proj_out'], {}), '(self._dim_emb_proj_in, self._dim_emb_proj_out)\n', (1428, 1475), True, 'from tor... |
## This script will define the functions used in the locate lane lines pipeline
## The end of this script will process a video file to locate and plot the lane lines
import pickle
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from moviepy.editor import VideoFileClip
imp... | [
"cv2.rectangle",
"numpy.polyfit",
"numpy.hstack",
"matplotlib.image.imread",
"numpy.array",
"cv2.warpPerspective",
"sys.exit",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.where",
"numpy.delete",
"matplotlib.pyplot.plot",
"cv2.undistort",
"numpy.max",
"cv2.addWeighted",
"numpy.lins... | [((666, 726), 'cv2.undistort', 'cv2.undistort', (['img_RGB_in', 'cam_mtx', 'dist_coef', 'None', 'cam_mtx'], {}), '(img_RGB_in, cam_mtx, dist_coef, None, cam_mtx)\n', (679, 726), False, 'import cv2\n'), ((795, 838), 'matplotlib.image.imread', 'mpimg.imread', (['"""camera_cal/calibration1.jpg"""'], {}), "('camera_cal/cal... |
import math
import random
from typing import Tuple
import cv2
import numpy as np
def np_free_form_mask(
max_vertex: int, max_length: int, max_brush_width: int, max_angle: int, height: int, width: int
) -> np.ndarray:
mask = np.zeros((height, width), np.float32)
num_vertex = random.randint(0, max_vertex)... | [
"numpy.minimum",
"cv2.line",
"math.radians",
"cv2.circle",
"numpy.zeros",
"numpy.cos",
"numpy.sin",
"random.random",
"random.randint"
] | [((235, 272), 'numpy.zeros', 'np.zeros', (['(height, width)', 'np.float32'], {}), '((height, width), np.float32)\n', (243, 272), True, 'import numpy as np\n'), ((291, 320), 'random.randint', 'random.randint', (['(0)', 'max_vertex'], {}), '(0, max_vertex)\n', (305, 320), False, 'import random\n'), ((335, 364), 'random.r... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Copyright (c) 2015-2019 Analog Devices, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... | [
"numpy.convolve",
"matplotlib.pyplot.grid",
"numpy.ones",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
"numpy.max",
"numpy.sum",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"scipy.signal.freqz",
"matplotlib.pyplot.show... | [((3234, 3248), 'numpy.ones', 'np.ones', (['osr50'], {}), '(osr50)\n', (3241, 3248), True, 'import numpy as np\n'), ((3260, 3274), 'numpy.ones', 'np.ones', (['osr60'], {}), '(osr60)\n', (3267, 3274), True, 'import numpy as np\n'), ((3320, 3351), 'numpy.convolve', 'np.convolve', (['sinc1_50', 'sinc1_50'], {}), '(sinc1_5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.