code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Jared
"""
import pandas as pd
import pymongo
import json
from os import listdir
from os.path import isfile, join
import multiprocessing as mp
import numpy as np
import dbConfig
from builder.dummyCrystalBuilder import processDummyCrystals
from ml.feature impo... | [
"pymongo.MongoClient",
"os.listdir",
"builder.dummyCrystalBuilder.processDummyCrystals",
"pandas.read_csv",
"ml.feature.getCompFeature",
"multiprocessing.Pool",
"numpy.array_split",
"os.path.join",
"pandas.concat"
] | [((397, 418), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (408, 418), True, 'import pandas as pd\n'), ((1600, 1632), 'numpy.array_split', 'np.array_split', (['df', 'numProcesses'], {}), '(df, numProcesses)\n', (1614, 1632), True, 'import numpy as np\n'), ((1645, 1676), 'multiprocessing.Pool', ... |
def polyFit(xData, yData, degree):
pass
fitValues = np.polyfit(xData, yData, degree)
yFit = np.zeros(len(xData))
for i in range(degree+1):
yFit = yFit + xData**(degree-i)*fitValues[i]
def function(x):
func = 0
for i in fitValues:
func = func*x + i
return f... | [
"pandas.read_csv",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"numpy.polyfit"
] | [((60, 92), 'numpy.polyfit', 'np.polyfit', (['xData', 'yData', 'degree'], {}), '(xData, yData, degree)\n', (70, 92), True, 'import numpy as np\n'), ((554, 611), 'pandas.read_csv', 'pd.read_csv', (['"""polyFit.csv"""'], {'header': 'None', 'names': "['x', 'y']"}), "('polyFit.csv', header=None, names=['x', 'y'])\n", (565,... |
"""Minimal implementation of Wasserstein GAN for MNIST."""
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.contrib import layers
from tensorflow.examples.tutorials.mnist import input_data
import threading
from rendering import draw_figure, export_video
def leaky_relu(x):
... | [
"tensorflow.reduce_sum",
"tensorflow.get_collection",
"tensorflow.maximum",
"tensorflow.contrib.layers.flatten",
"tensorflow.reshape",
"tensorflow.InteractiveSession",
"numpy.random.randn",
"tensorflow.variable_scope",
"tensorflow.placeholder",
"tensorflow.contrib.layers.conv2d_transpose",
"tens... | [((2786, 2809), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (2807, 2809), True, 'import tensorflow as tf\n'), ((2942, 2981), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data"""'], {}), "('MNIST_data')\n", (2967, 2981), False, ... |
"""Parsing of signal logs from experiments, and version logging."""
import datetime
import importlib
import json
import logging
import os
import pprint
import subprocess
import time
import git
import numpy as np
# these should be moved to other (optional) module
from openpromela import logic
from openpromela import slu... | [
"json.dump",
"subprocess.Popen",
"json.load",
"pprint.pformat",
"logging.FileHandler",
"importlib.import_module",
"os.uname",
"openpromela.slugs._to_slugs",
"time.strftime",
"git.Repo",
"time.time",
"datetime.timedelta",
"numpy.array",
"openpromela.logic.compile_spec",
"openpromela.slugs... | [((334, 361), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (351, 361), False, 'import logging\n'), ((476, 490), 'git.Repo', 'git.Repo', (['path'], {}), '(path)\n', (484, 490), False, 'import git\n'), ((947, 981), 'time.strftime', 'time.strftime', (['"""%Y-%b-%d-%A-%T-%Z"""'], {}), "('%Y... |
import sklearn.tree
import os
import pandas as pd
import numpy as np
from hydroDL import kPath
from hydroDL.data import usgs, gageII
from hydroDL.post import axplot
import matplotlib.pyplot as plt
dirCQ = os.path.join(kPath.dirWQ, 'C-Q')
dfS = pd.read_csv(os.path.join(dirCQ, 'slope'), dtype={
'siteNo': str}).set_i... | [
"os.path.join",
"numpy.isnan",
"numpy.percentile",
"numpy.where",
"hydroDL.post.axplot.mapPoint",
"hydroDL.data.gageII.updateCode",
"hydroDL.data.gageII.readData",
"matplotlib.pyplot.subplots"
] | [((206, 238), 'os.path.join', 'os.path.join', (['kPath.dirWQ', '"""C-Q"""'], {}), "(kPath.dirWQ, 'C-Q')\n", (218, 238), False, 'import os\n'), ((682, 704), 'hydroDL.data.gageII.updateCode', 'gageII.updateCode', (['dfX'], {}), '(dfX)\n', (699, 704), False, 'from hydroDL.data import usgs, gageII\n'), ((713, 782), 'hydroD... |
from sklearn import svm
import numpy as np
X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])
y = np.array([1, 1, 2, 2])
model = svm.SVC(kernel='linear',C=1,gamma=1)
model.fit(X,y)
print(model.predict([[-0.8,-1]]))
| [
"numpy.array",
"sklearn.svm.SVC"
] | [((48, 94), 'numpy.array', 'np.array', (['[[-1, -1], [-2, -1], [1, 1], [2, 1]]'], {}), '([[-1, -1], [-2, -1], [1, 1], [2, 1]])\n', (56, 94), True, 'import numpy as np\n'), ((99, 121), 'numpy.array', 'np.array', (['[1, 1, 2, 2]'], {}), '([1, 1, 2, 2])\n', (107, 121), True, 'import numpy as np\n'), ((132, 170), 'sklearn.... |
#################################
# CSI function
#################################
#########################################################
# import libraries
import scipy.spatial.distance as ssd
import numpy as np
import scipy.io as sio
#########################################################
# Function... | [
"scipy.spatial.distance.euclidean",
"scipy.io.loadmat",
"numpy.asarray",
"numpy.zeros",
"scipy.io.savemat",
"numpy.ones",
"numpy.squeeze"
] | [((4331, 4353), 'numpy.asarray', 'np.asarray', (['dist_S_uav'], {}), '(dist_S_uav)\n', (4341, 4353), True, 'import numpy as np\n'), ((4470, 4492), 'numpy.asarray', 'np.asarray', (['dist_uav_F'], {}), '(dist_uav_F)\n', (4480, 4492), True, 'import numpy as np\n'), ((4614, 4637), 'numpy.asarray', 'np.asarray', (['dist_GT_... |
# Machine Learning/Data Science Precourse Work
# ###
# LAMBDA SCHOOL
# ###
# MIT LICENSE
# ###
# Free example function definition
# This function passes one of the 11 tests contained inside of test.py. Write the rest, defined in README.md, here,
# and execute python test.py to test. Passing this precourse work will g... | [
"numpy.dot",
"numpy.array",
"math.sqrt"
] | [((968, 987), 'math.sqrt', 'math.sqrt', (['sqvector'], {}), '(sqvector)\n', (977, 987), False, 'import math\n'), ((1013, 1038), 'numpy.array', 'np.array', (['[1, 1, 1, 1, 1]'], {}), '([1, 1, 1, 1, 1])\n', (1021, 1038), True, 'import numpy as np\n'), ((1064, 1083), 'numpy.array', 'np.array', (['[0, 0, 0]'], {}), '([0, 0... |
import h5py
import tools.pymus_utils as pymusutil
import numpy as np
import matplotlib.pyplot as plt
import logging
logging.basicConfig(level=logging.DEBUG)
class ImageFormatError(Exception):
pass
class EchoImage(object):
''' Echogeneicity grayscale image
'''
def __init__(self,scan):
self.scan = scan
self.d... | [
"logging.error",
"tools.pymus_utils.generic_hdf5_read",
"matplotlib.pyplot.show",
"logging.basicConfig",
"logging.debug",
"numpy.reshape",
"numpy.log10",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"tools.pymus_utils.generic_hdf5_write"
] | [((117, 157), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (136, 157), False, 'import logging\n'), ((1185, 1247), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(1.0 + x_ratio * base_sz, 0.3 + base_sz)'}), '(figsize=(1.0 + x_ratio * base_sz,... |
from functools import partial
import numpy as np
import tensorflow as tf
from tensorflow.keras.callbacks import EarlyStopping, TensorBoard
from tensorflow.keras.optimizers import Adam
from nets.facenet import facenet
from nets.facenet_training import FacenetDataset, LFWDataset, triplet_loss
from utils.callbacks impor... | [
"utils.callbacks.LFW_callback",
"functools.partial",
"numpy.random.seed",
"numpy.random.shuffle",
"nets.facenet_training.triplet_loss",
"tensorflow.config.experimental.set_memory_growth",
"tensorflow.keras.optimizers.schedules.ExponentialDecay",
"nets.facenet_training.LFWDataset",
"nets.facenet.face... | [((897, 960), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', ([], {'device_type': '"""GPU"""'}), "(device_type='GPU')\n", (941, 960), True, 'import tensorflow as tf\n'), ((982, 1033), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set... |
import nose.tools as nt
import numpy as np
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
from treeano.sandbox.nodes import wta_sparisty as wta
fX = theano.config.floatX
def test_wta_spatial_sparsity_node_serialization():
tn.check_serialization(wta.WTASpatialSparsityNode("a"... | [
"treeano.sandbox.nodes.wta_sparisty.WTASparsityNode",
"treeano.sandbox.nodes.wta_sparisty.WTASpatialSparsityNode",
"treeano.nodes.InputNode",
"numpy.arange",
"numpy.testing.assert_allclose"
] | [((1234, 1270), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['res', 'ans'], {}), '(res, ans)\n', (1260, 1270), True, 'import numpy as np\n'), ((290, 321), 'treeano.sandbox.nodes.wta_sparisty.WTASpatialSparsityNode', 'wta.WTASpatialSparsityNode', (['"""a"""'], {}), "('a')\n", (316, 321), True, 'from ... |
# Copyright (c) 2016-2019 <NAME>
#
# This file is part of XL-mHG.
"""Contains the `mHGResult` class."""
import sys
import hashlib
import logging
import numpy as np
try:
# This is a duct-tape fix for the Google App Engine, on which importing
# the C extension fails.
from . import mhg_cython
except Import... | [
"hashlib.md5",
"numpy.sum",
"numpy.zeros",
"logging.getLogger",
"numpy.issubdtype"
] | [((473, 500), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (490, 500), False, 'import logging\n'), ((4035, 4067), 'numpy.zeros', 'np.zeros', (['self.N'], {'dtype': 'np.uint8'}), '(self.N, dtype=np.uint8)\n', (4043, 4067), True, 'import numpy as np\n'), ((2366, 2405), 'numpy.issubdtype',... |
import numpy as np
import pytest
from dnnv.nn.converters.tensorflow import *
from dnnv.nn.operations import *
def test_Reshape():
original_shape = [0, 3, 4]
data = np.random.random_sample(original_shape).astype(np.float32)
new_shape = np.array([3, 4, 0], dtype=np.int64)
y = np.reshape(data, new_shape... | [
"numpy.random.random_sample",
"numpy.allclose",
"numpy.dtype",
"numpy.array",
"numpy.reshape"
] | [((250, 285), 'numpy.array', 'np.array', (['[3, 4, 0]'], {'dtype': 'np.int64'}), '([3, 4, 0], dtype=np.int64)\n', (258, 285), True, 'import numpy as np\n'), ((294, 321), 'numpy.reshape', 'np.reshape', (['data', 'new_shape'], {}), '(data, new_shape)\n', (304, 321), True, 'import numpy as np\n'), ((457, 479), 'numpy.allc... |
#!/usr/bin/python
import sys, platform, os
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from matplotlib import pyplot
import numpy as np
from matplotlib.patches import Ellipse
import camb
from camb import model, initialpower
from pysm.nominal import models
import healpy as hp
import site
plt.... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.fill_between",
"numpy.arctan2",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.legend",
"matplotlib.patches.Patch",
"matplotlib.pyplot.text",
"numpy.linalg.eigh",
"matplotlib.pyplot.gca",
"matplotl... | [((831, 897), 'matplotlib.patches.Ellipse', 'Ellipse', ([], {'xy': 'pos', 'width': 'width', 'height': 'height', 'angle': 'theta'}), '(xy=pos, width=width, height=height, angle=theta, **kwargs)\n', (838, 897), False, 'from matplotlib.patches import Ellipse\n'), ((1348, 1473), 'matplotlib.pyplot.legend', 'plt.legend', ([... |
import numpy as np
from base.RecommenderUtils import check_matrix
from base.BaseRecommender import RecommenderSystem
from tqdm import tqdm
import models.MF.Cython.MF_RMSE as mf
class IALS_numpy(RecommenderSystem):
'''
binary Alternating Least Squares model (or Weighed Regularized Matrix Factorization)
Re... | [
"base.RecommenderUtils.check_matrix",
"numpy.outer",
"numpy.random.seed",
"numpy.log",
"numpy.eye",
"numpy.zeros",
"numpy.random.normal",
"numpy.dot",
"numpy.linalg.solve",
"numpy.diag",
"numpy.in1d"
] | [((2790, 2819), 'numpy.random.seed', 'np.random.seed', (['self.rnd_seed'], {}), '(self.rnd_seed)\n', (2804, 2819), True, 'import numpy as np\n'), ((2877, 2952), 'numpy.random.normal', 'np.random.normal', (['self.init_mean', 'self.init_std'], {'size': '(M, self.num_factors)'}), '(self.init_mean, self.init_std, size=(M, ... |
import numpy as np
import heapq
import math
import time
import pygame
class Node:
def __init__(self, state=None, cost=float('inf'), costToCome=float('inf'), parent=None, collision=None):
self.state = state
self.parent = parent
self.cost = cost
self.costToCome = costToCome
s... | [
"numpy.load",
"pygame.draw.line",
"heapq.heappush",
"math.atan2",
"pygame.event.get",
"pygame.display.update",
"pygame.font.SysFont",
"math.radians",
"pygame.display.set_mode",
"math.cos",
"pygame.display.set_caption",
"pygame.quit",
"math.sqrt",
"pygame.init",
"math.sin",
"pygame.draw... | [((4574, 4593), 'math.floor', 'math.floor', (['(800 / r)'], {}), '(800 / r)\n', (4584, 4593), False, 'import math\n'), ((4604, 4623), 'math.floor', 'math.floor', (['(800 / r)'], {}), '(800 / r)\n', (4614, 4623), False, 'import math\n'), ((5885, 5927), 'math.sqrt', 'math.sqrt', (['((gx - sx) ** 2 + (gy - sy) ** 2)'], {}... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 9 20:00:55 2021
@author: oscar
"""
import numpy as np
import math
def bin_MUA_data(MUA,bin_res):
counter = 0
binned_MUA = np.zeros([math.ceil(len(MUA[:,1])/bin_res),len(MUA[1,:])])
for bin in range(math.ceil(len(MUA[:,1])/bin_res)):
if... | [
"numpy.sum",
"numpy.flip",
"numpy.argmax",
"numpy.argsort",
"numpy.arange",
"numpy.delete"
] | [((2571, 2586), 'numpy.argmax', 'np.argmax', (['hist'], {}), '(hist)\n', (2580, 2586), True, 'import numpy as np\n'), ((3054, 3069), 'numpy.argsort', 'np.argsort', (['idx'], {}), '(idx)\n', (3064, 3069), True, 'import numpy as np\n'), ((2778, 2799), 'numpy.delete', 'np.delete', (['idx', 'right'], {}), '(idx, right)\n',... |
from collections import OrderedDict
import numpy as np
import torch
import torch.optim as optim
from torch import nn as nn
from torch import autograd
from torch.autograd import Variable
import torch.nn.functional as F
from rlkit.core import logger
import rlkit.torch.pytorch_util as ptu
from rlkit.core.eval_util impo... | [
"torch.cat",
"rlkit.torch.pytorch_util.from_numpy",
"numpy.random.randint",
"numpy.linalg.norm",
"numpy.random.normal",
"torch.exp",
"rlkit.torch.distributions.ReparamMultivariateNormalDiag",
"numpy.random.choice",
"torch.nn.Linear",
"torch.log",
"torch.nn.BCEWithLogitsLoss",
"rlkit.torch.pyto... | [((1297, 1373), 'numpy.random.choice', 'np.random.choice', (['traj_len'], {'size': 'num_samples', 'replace': '(traj_len < num_samples)'}), '(traj_len, size=num_samples, replace=traj_len < num_samples)\n', (1313, 1373), True, 'import numpy as np\n'), ((2060, 2085), 'torch.nn.Linear', 'nn.Linear', (['hid_dim', 'z_dim'], ... |
import numpy as np
from plantcv.plantcv.visualize import colorize_label_img
def test_colorize_label_img():
"""Test for PlantCV."""
label_img = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
colored_img = colorize_label_img(label_img)
assert (colored_img.shape[0:-1] == label_img.shape) and colored_img.sha... | [
"numpy.array",
"plantcv.plantcv.visualize.colorize_label_img"
] | [((153, 196), 'numpy.array', 'np.array', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n', (161, 196), True, 'import numpy as np\n'), ((215, 244), 'plantcv.plantcv.visualize.colorize_label_img', 'colorize_label_img', (['label_img'], {}), '(label_img)\n', (233, 244), False, 'from plan... |
from matplotlib import pyplot
import numpy
x = numpy.linspace(-1, 1, 1000)
y1 = numpy.exp(-x**2 * 10) * (1 + 0.05 * numpy.random.rand(len(x)))
y2 = (numpy.exp(10*(-(x-0.3)**2 - 0.75*x**4 - 0.25*x**6)) + numpy.piecewise(x, [x < 0.3, x >= 0.3], [lambda x: -(x-0.3)*numpy.sqrt(1+x), 0])) * (1 + 0.05 * numpy.random.rand(le... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.plot",
"numpy.argmax",
"matplotlib.pyplot.axes",
"numpy.exp",
"numpy.linspace",
"matplotlib.pyplot.arrow",
"numpy.sqrt"
] | [((48, 75), 'numpy.linspace', 'numpy.linspace', (['(-1)', '(1)', '(1000)'], {}), '(-1, 1, 1000)\n', (62, 75), False, 'import numpy\n'), ((81, 104), 'numpy.exp', 'numpy.exp', (['(-x ** 2 * 10)'], {}), '(-x ** 2 * 10)\n', (90, 104), False, 'import numpy\n'), ((431, 448), 'matplotlib.pyplot.plot', 'pyplot.plot', (['x', 'y... |
import numpy as np
def cgls(A, b):
height, width = A.shape
x = np.zeros((height))
while(True):
sumA = A.sum()
if (sumA < 100):
break
if (np.linalg.det(A) < 1):
A = A + np.eye(height, width) * sumA * 0.000000005
else:
x = np.linalg.inv(A).d... | [
"numpy.linalg.det",
"numpy.linalg.inv",
"numpy.zeros",
"numpy.eye"
] | [((72, 88), 'numpy.zeros', 'np.zeros', (['height'], {}), '(height)\n', (80, 88), True, 'import numpy as np\n'), ((186, 202), 'numpy.linalg.det', 'np.linalg.det', (['A'], {}), '(A)\n', (199, 202), True, 'import numpy as np\n'), ((302, 318), 'numpy.linalg.inv', 'np.linalg.inv', (['A'], {}), '(A)\n', (315, 318), True, 'im... |
'''
Created on 19 Nov 2017
@author: Simon
'''
from fipy import Variable, FaceVariable, CellVariable, TransientTerm, DiffusionTerm
import numpy as np
import datetime
import pickle
from scipy.interpolate import interp1d
from boundary import BoundaryConditionCollection1D
from diagnostic import DiagnosticModu... | [
"fipy.CellVariable",
"numpy.abs",
"numpy.copy",
"fipy.DiffusionTerm",
"boundary.BoundaryConditionCollection1D",
"numpy.interp",
"datetime.datetime",
"numpy.mean",
"diagnostic.DiagnosticModule",
"numpy.array",
"fipy.Variable",
"datetime.timedelta",
"fipy.FaceVariable",
"scipy.interpolate.in... | [((858, 875), 'fipy.Variable', 'Variable', ([], {'value': '(0)'}), '(value=0)\n', (866, 875), False, 'from fipy import Variable, FaceVariable, CellVariable, TransientTerm, DiffusionTerm\n'), ((2770, 2832), 'fipy.CellVariable', 'CellVariable', ([], {'name': 'source_name', 'mesh': 'self.mesh.mesh', 'value': '(0.0)'}), '(... |
#!/usr/bin/env python
import numpy as np
from typing import Callable
def rectangle(a: float, b: float, f: Callable[[np.array], np.array],
h: float) -> float:
return h * np.sum(f(np.arange(a + h / 2, b + h / 2, h)))
def trapezoid(a: float, b: float, f: Callable[[np.array], np.array],
h: float) ... | [
"numpy.arange"
] | [((193, 227), 'numpy.arange', 'np.arange', (['(a + h / 2)', '(b + h / 2)', 'h'], {}), '(a + h / 2, b + h / 2, h)\n', (202, 227), True, 'import numpy as np\n'), ((370, 392), 'numpy.arange', 'np.arange', (['(a + h)', 'b', 'h'], {}), '(a + h, b, h)\n', (379, 392), True, 'import numpy as np\n'), ((590, 624), 'numpy.arange'... |
import pandas as pd
import numpy as np
class Packing(object):
def getMappedFitness(self, chromosome):
mappedChromosome = self.items[chromosome]
spaces = np.zeros(len(mappedChromosome), dtype=int)
result = np.cumsum(mappedChromosome) - self.BIN_CAPACITY
index_of_old_bin = 0
b... | [
"pandas.DataFrame",
"numpy.abs",
"numpy.ndenumerate",
"numpy.argmax",
"pandas.read_csv",
"numpy.flipud",
"numpy.argmin",
"numpy.insert",
"numpy.cumsum",
"numpy.max",
"numpy.random.randint",
"numpy.array",
"numpy.arange",
"numpy.where",
"numpy.random.rand",
"numpy.delete",
"numpy.rand... | [((2352, 2383), 'numpy.ndenumerate', 'np.ndenumerate', (['random_indicies'], {}), '(random_indicies)\n', (2366, 2383), True, 'import numpy as np\n'), ((2591, 2608), 'numpy.array', 'np.array', (['results'], {}), '(results)\n', (2599, 2608), True, 'import numpy as np\n'), ((2876, 2924), 'numpy.random.randint', 'np.random... |
'''
Munivariate statistics exercises
================================
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
np.random.seed(seed=42) # make the example reproducible
'''
### Dot product and Euclidean norm
'''
a = np.array([2,1])
b = np.array([1,1])
def euclidia... | [
"numpy.random.seed",
"numpy.random.randn",
"numpy.mean",
"numpy.array",
"numpy.random.multivariate_normal",
"numpy.linalg.inv",
"numpy.dot"
] | [((165, 188), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(42)'}), '(seed=42)\n', (179, 188), True, 'import numpy as np\n'), ((271, 287), 'numpy.array', 'np.array', (['[2, 1]'], {}), '([2, 1])\n', (279, 287), True, 'import numpy as np\n'), ((291, 307), 'numpy.array', 'np.array', (['[1, 1]'], {}), '([1, 1])\n'... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import itertools
from memory import State
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class DRRN(torch.nn.Module):
"""
Deep Reinforcement Relevance Network - He et al. '16
"""
def __i... | [
"torch.nn.Embedding",
"torch.cat",
"numpy.ones",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.no_grad",
"numpy.max",
"torch.nn.Linear",
"torch.nn.GRU",
"torch.logsumexp",
"torch.autograd.Variable",
"numpy.asarray",
"torch.cuda.is_available",
"torch.rand",
"torch.sort",
"torch.from_nu... | [((5580, 5595), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5593, 5595), False, 'import torch\n'), ((162, 187), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (185, 187), False, 'import torch\n'), ((434, 473), 'torch.nn.Embedding', 'nn.Embedding', (['vocab_size', 'embedding_dim'], {}),... |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.iinfo",
"numpy.ones",
"tensorflow.python.framework.ops.device",
"tensorflow.python.ipu.utils.set_ipu_model_options",
"tensorflow.python.client.session.Session",
"tensorflow.python.ipu.ipu_compiler.compile",
"tensorflow.python.platform.googletest.main",
"tensorflow.python.ops.array_ops.placehold... | [((2023, 2065), 'itertools.product', 'itertools.product', (['rate', 'seed', 'noise_shape'], {}), '(rate, seed, noise_shape)\n', (2040, 2065), False, 'import itertools\n'), ((3961, 4004), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (['*TEST_CASES'], {}), '(*TEST_CASES)\n', (3991, 400... |
from static import *
from lib import map_value
from point import Point
from ray import Ray
import numpy as np
import random
import math
class Source:
def __init__(self, x, y, fov, pg, screen):
self.pos = Point(x, y)
self.angle = np.random.randint(0, 360)
self.view_mode = 0
self.... | [
"numpy.sum",
"lib.map_value",
"random.choice",
"numpy.random.randint",
"ray.Ray",
"point.Point"
] | [((220, 231), 'point.Point', 'Point', (['x', 'y'], {}), '(x, y)\n', (225, 231), False, 'from point import Point\n'), ((253, 278), 'numpy.random.randint', 'np.random.randint', (['(0)', '(360)'], {}), '(0, 360)\n', (270, 278), True, 'import numpy as np\n'), ((876, 897), 'random.choice', 'random.choice', (['COLORS'], {}),... |
"""Simple client to the Channel Archiver using xmlrpc."""
import logging as log
from xmlrpc.client import ServerProxy
import numpy
from . import data, utils
from .fetcher import Fetcher
__all__ = [
"CaClient",
"CaFetcher",
]
class CaClient(object):
"""Class to handle XMLRPC interaction with a channel a... | [
"numpy.zeros",
"xmlrpc.client.ServerProxy"
] | [((468, 484), 'xmlrpc.client.ServerProxy', 'ServerProxy', (['url'], {}), '(url)\n', (479, 484), False, 'from xmlrpc.client import ServerProxy\n'), ((2181, 2198), 'numpy.zeros', 'numpy.zeros', (['(0,)'], {}), '((0,))\n', (2192, 2198), False, 'import numpy\n')] |
import random as rn
import numpy as np
import matplotlib.pyplot as plt
import math
from matplotlib import patches
from matplotlib.patches import Polygon
def random_population(_nv, n, _lb, _ub):
_pop = np.zeros((n, 2 * nv))
for i in range(n):
_pop[i, :] = np.random.uniform(lb, ub)
f... | [
"matplotlib.pyplot.title",
"numpy.sum",
"numpy.ones",
"numpy.argsort",
"matplotlib.patches.Polygon",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"numpy.arange",
"math.copysign",
"matplotlib.patches.Patch",
"random.randint",
"matplotlib.patches.Rectangle",
"numpy.append",
"math.cos"... | [((14013, 14075), 'matplotlib.patches.Patch', 'patches.Patch', ([], {'color': '"""blue"""', 'label': '"""Osobniki Pareto Optymalne"""'}), "(color='blue', label='Osobniki Pareto Optymalne')\n", (14026, 14075), False, 'from matplotlib import patches\n'), ((14089, 14141), 'matplotlib.patches.Patch', 'patches.Patch', ([], ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
outbursts --- Lightcurve and outburst analysis
==============================================
"""
__all__ = [
'CometaryTrends'
]
from collections import namedtuple
import logging
import numpy as np
from scipy.cluster import hierarchy
from scipy.... | [
"numpy.sum",
"scipy.optimize.leastsq",
"numpy.exp",
"numpy.diag",
"numpy.round",
"numpy.unique",
"astropy.stats.sigma_clip",
"numpy.std",
"numpy.isfinite",
"astropy.units.Quantity",
"numpy.average",
"astropy.time.Time",
"scipy.cluster.hierarchy.fclusterdata",
"numpy.hypot",
"numpy.ma.ave... | [((475, 551), 'collections.namedtuple', 'namedtuple', (['"""dmdtFit"""', "['m0', 'dmdt', 'm0_unc', 'dmdt_unc', 'rms', 'rchisq']"], {}), "('dmdtFit', ['m0', 'dmdt', 'm0_unc', 'dmdt_unc', 'rms', 'rchisq'])\n", (485, 551), False, 'from collections import namedtuple\n'), ((567, 640), 'collections.namedtuple', 'namedtuple',... |
import argparse
import numpy as np
import chainer
from siam_rpn.general.eval_sot_vot import eval_sot_vot
from siam_rpn.siam_rpn import SiamRPN
from siam_rpn.siam_rpn_tracker import SiamRPNTracker
from siam_rpn.siam_mask_tracker import SiamMaskTracker
from siam_rpn.general.vot_tracking_dataset import VOTTrackingDatase... | [
"siam_rpn.siam_rpn.SiamRPN",
"chainer.datasets.TupleDataset",
"argparse.ArgumentParser",
"chainer.serializers.load_npz",
"siam_rpn.general.predictor_with_gt.PredictorWithGT",
"siam_rpn.siam_mask_tracker.SiamMaskTracker",
"siam_rpn.general.eval_sot_vot.eval_sot_vot",
"numpy.sort",
"numpy.where",
"c... | [((1213, 1238), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1236, 1238), False, 'import argparse\n'), ((1448, 1474), 'siam_rpn.general.vot_tracking_dataset.VOTTrackingDataset', 'VOTTrackingDataset', (['"""data"""'], {}), "('data')\n", (1466, 1474), False, 'from siam_rpn.general.vot_tracking... |
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
"""
Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the Apache License Version 2.0.You may not use
this file except in compliance with the License.
This program ... | [
"caffe.set_mode_gpu",
"argparse.ArgumentParser",
"amct_caffe.set_gpu_mode",
"amct_caffe.create_quant_config",
"os.path.realpath",
"numpy.zeros",
"sys.path.insert",
"caffe.set_mode_cpu",
"amct_caffe.accuracy_based_auto_calibration",
"cv2.imread",
"caffe.set_device",
"pathlib.Path",
"datasets.... | [((1070, 1095), 'os.path.join', 'os.path.join', (['PATH', '"""tmp"""'], {}), "(PATH, 'tmp')\n", (1082, 1095), False, 'import os\n'), ((1105, 1134), 'os.path.join', 'os.path.join', (['PATH', '"""results"""'], {}), "(PATH, 'results')\n", (1117, 1134), False, 'import os\n'), ((1248, 1281), 'os.path.join', 'os.path.join', ... |
from pywim.utils.stats import iqr
import numpy as np
import pandas as pd
import peakutils
def sensors_estimation(
signal_data: pd.DataFrame, sensors_delta_distance: list
) -> [np.array]:
"""
:param signal_data:
:param sensors_delta_distance:
:return:
"""
# x axis: time
x = signal_dat... | [
"peakutils.indexes",
"numpy.array",
"pandas.Series",
"numpy.concatenate"
] | [((1659, 1671), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1667, 1671), True, 'import numpy as np\n'), ((506, 550), 'peakutils.indexes', 'peakutils.indexes', (['y'], {'thres': '(0.5)', 'min_dist': '(30)'}), '(y, thres=0.5, min_dist=30)\n', (523, 550), False, 'import peakutils\n'), ((1746, 1791), 'numpy.concate... |
"""@package MuSCADeT
"""
from scipy import signal as scp
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as pf
import scipy.ndimage.filters as med
import MuSCADeT.pca_ring_spectrum as pcas
import MuSCADeT.wave_transform as mw
NOISE_TAB = np.array([ 0.8907963 , 0.20066385, 0.08550751, 0... | [
"matplotlib.pyplot.title",
"MuSCADeT.pca_ring_spectrum.pca_lines",
"numpy.abs",
"numpy.sum",
"numpy.ones",
"numpy.shape",
"numpy.mean",
"scipy.signal.fftconvolve",
"numpy.int_",
"numpy.multiply",
"numpy.copy",
"numpy.max",
"numpy.reshape",
"MuSCADeT.wave_transform.wave_transform",
"numpy... | [((269, 379), 'numpy.array', 'np.array', (['[0.8907963, 0.20066385, 0.08550751, 0.04121745, 0.02042497, 0.01018976, \n 0.00504662, 0.00368314]'], {}), '([0.8907963, 0.20066385, 0.08550751, 0.04121745, 0.02042497, \n 0.01018976, 0.00504662, 0.00368314])\n', (277, 379), True, 'import numpy as np\n'), ((407, 494), '... |
import os
import typing as T
import warnings
import fsspec # type: ignore
import numpy as np
import numpy.typing as NT
import pandas as pd # type: ignore
import rioxarray # type: ignore
import xarray as xr
from xarray_sentinel import conventions, esa_safe
def open_calibration_dataset(calibration: esa_safe.PathTy... | [
"numpy.allclose",
"xarray.Variable",
"numpy.arange",
"os.path.join",
"numpy.full",
"rioxarray.open_rasterio",
"fsspec.get_fs_token_paths",
"os.path.dirname",
"numpy.linspace",
"numpy.fromstring",
"xarray_sentinel.esa_safe.get_ancillary_data_paths",
"xarray_sentinel.conventions.update_attribute... | [((365, 440), 'xarray_sentinel.esa_safe.parse_tag_list', 'esa_safe.parse_tag_list', (['calibration', '""".//calibrationVector"""', '"""calibration"""'], {}), "(calibration, './/calibrationVector', 'calibration')\n", (388, 440), False, 'from xarray_sentinel import conventions, esa_safe\n'), ((1404, 1424), 'numpy.array',... |
"""
Authors: <NAME>, <NAME>
Helper functions:
1. Overall score between, explainability and performance with normalization between 0-1 (logaritmic_power, sigmoid_power).
2. An explainability minimization (smaller is better) with additive constrains according the number of leaves and the error for the optimization.
... | [
"numpy.log2",
"sklearn.metrics.accuracy_score",
"math.exp"
] | [((500, 530), 'sklearn.metrics.accuracy_score', 'accuracy_score', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (514, 530), False, 'from sklearn.metrics import accuracy_score\n'), ((796, 811), 'numpy.log2', 'np.log2', (['(y ** z)'], {}), '(y ** z)\n', (803, 811), True, 'import numpy as np\n'), ((1104, 1116), 'math.... |
# Author : <NAME>
# Contact : <EMAIL>
# Date : Feb 16, 2020
import random
import time
import numpy as np
import random
import time
import numpy as np
try:
from CS5313_Localization_Env import maze
except:
print(
'Problem finding CS5313_Localization_Env.maze... Trying to "import maze" only...'... | [
"pandas.DataFrame",
"numpy.sum",
"random.randint",
"RobotLocalization.Game",
"maze.make_maze",
"time.sleep",
"random.random",
"random.seed",
"numpy.random.rand"
] | [((6124, 6146), 'random.seed', 'random.seed', (['self.seed'], {}), '(self.seed)\n', (6135, 6146), False, 'import random\n'), ((6214, 6264), 'maze.make_maze', 'maze.make_maze', (['dimensions[0]', 'dimensions[1]', 'seed'], {}), '(dimensions[0], dimensions[1], seed)\n', (6228, 6264), False, 'import maze\n'), ((7779, 7789)... |
#############################START LICENSE##########################################
# Copyright (C) 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/l... | [
"pymedphys.labs.pedromartinez.utils.utils.range_invert",
"tqdm.tqdm",
"pydicom.dcmread",
"argparse.ArgumentParser",
"os.path.dirname",
"numpy.zeros",
"skimage.feature.blob_log",
"numpy.argmin",
"pymedphys.labs.pedromartinez.utils.utils.norm01",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy... | [((1874, 1890), 'tqdm.tqdm', 'tqdm', (['imcirclist'], {}), '(imcirclist)\n', (1878, 1890), False, 'from tqdm import tqdm\n'), ((2983, 3006), 'pydicom.dcmread', 'pydicom.dcmread', (['filenm'], {}), '(filenm)\n', (2998, 3006), False, 'import pydicom\n'), ((3017, 3031), 'datetime.datetime.now', 'datetime.now', ([], {}), '... |
import nltk
import json
import numpy as np
from nltk import word_tokenize
import triton_python_backend_utils as pb_utils
class TritonPythonModel:
"""Your Python model must use the same class name. Every Python model
that is created must have "TritonPythonModel" as the class name.
"""
def initialize... | [
"triton_python_backend_utils.get_output_config_by_name",
"json.loads",
"triton_python_backend_utils.Tensor",
"triton_python_backend_utils.get_input_tensor_by_name",
"numpy.array",
"triton_python_backend_utils.InferenceResponse",
"triton_python_backend_utils.triton_string_to_numpy",
"nltk.download",
... | [((1180, 1212), 'json.loads', 'json.loads', (["args['model_config']"], {}), "(args['model_config'])\n", (1190, 1212), False, 'import json\n'), ((1275, 1334), 'triton_python_backend_utils.get_output_config_by_name', 'pb_utils.get_output_config_by_name', (['model_config', '"""OUTPUT0"""'], {}), "(model_config, 'OUTPUT0')... |
# -*- coding: UTF-8 -*-
"""
训练神经网络,将参数(Weight)存入 HDF5 文件
"""
import numpy as np
import tensorflow as tf
from utils import *
from network import *
"""
==== 一些术语的概念 ====
# Batch size : 批次(样本)数目。一次迭代(Forword 运算(用于得到损失函数)以及 BackPropagation 运算(用于更新神经网络参数))所用的样本数目。Batch size 越大,所需的内存就越大
# Iteration : 迭代。每一次迭代更新一次权重(网络参数)... | [
"tensorflow.keras.utils.to_categorical",
"numpy.reshape",
"tensorflow.keras.callbacks.ModelCheckpoint"
] | [((917, 1025), 'tensorflow.keras.callbacks.ModelCheckpoint', 'tf.keras.callbacks.ModelCheckpoint', (['filepath'], {'monitor': '"""loss"""', 'verbose': '(0)', 'save_best_only': '(True)', 'mode': '"""min"""'}), "(filepath, monitor='loss', verbose=0,\n save_best_only=True, mode='min')\n", (951, 1025), True, 'import ten... |
import numpy as np
import re
import pandas as pd
def clean_str(string):
"""
Tokenization/string cleaning for all datasets except for SST.
Original taken from https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
"""
string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string)
string = r... | [
"pandas.DataFrame",
"pandas.read_csv",
"numpy.array",
"numpy.arange",
"re.sub",
"numpy.concatenate"
] | [((260, 306), 're.sub', 're.sub', (['"""[^A-Za-z0-9(),!?\\\\\'\\\\`]"""', '""" """', 'string'], {}), '("[^A-Za-z0-9(),!?\\\\\'\\\\`]", \' \', string)\n', (266, 306), False, 'import re\n'), ((319, 348), 're.sub', 're.sub', (['"""\\\\\'s"""', '""" \'s"""', 'string'], {}), '("\\\\\'s", " \'s", string)\n', (325, 348), Fals... |
"""
Modified From https://github.com/OpenNMT/OpenNMT-tf/blob/r1/examples/library/minimal_transformer_training.py
MIT License
Copyright (c) 2017-present The OpenNMT Authors.
This example demonstrates how to train a standard Transformer model using
OpenNMT-tf as a library in about 200 lines of code. While relatively s... | [
"opennmt.encoders.SelfAttentionEncoder",
"numpy.random.seed",
"argparse.ArgumentParser",
"tensorflow.get_collection",
"tensorflow.ConfigProto",
"tensorflow.global_variables",
"tensorflow.train.latest_checkpoint",
"examples.tensorflow.decoder.utils.common.DecodingArgumentNew",
"tensorflow.tables_init... | [((1522, 1561), 'sys.path.append', 'sys.path.append', (["(dir_path + '/../../..')"], {}), "(dir_path + '/../../..')\n", (1537, 1561), False, 'import sys\n'), ((2406, 2601), 'opennmt.encoders.SelfAttentionEncoder', 'onmt.encoders.SelfAttentionEncoder', ([], {'num_layers': 'NUM_LAYERS', 'num_units': 'HIDDEN_UNITS', 'num_... |
import numpy as np
from Kuru import QuadratureRule, FunctionSpace , Mesh
from Kuru.FiniteElements.LocalAssembly._KinematicMeasures_ import _KinematicMeasures_
from Kuru.VariationalPrinciple._GeometricStiffness_ import GeometricStiffnessIntegrand as GetGeomStiffness
from .DisplacementApproachIndices import FillGeometric... | [
"numpy.sum",
"numpy.true_divide",
"numpy.zeros",
"Kuru.FunctionSpace",
"numpy.einsum",
"Kuru.QuadratureRule",
"numpy.arange",
"numpy.dot",
"numpy.ascontiguousarray"
] | [((6804, 6860), 'numpy.zeros', 'np.zeros', (['(nvar * SpatialGradient.shape[0], ndim * ndim)'], {}), '((nvar * SpatialGradient.shape[0], ndim * ndim))\n', (6812, 6860), True, 'import numpy as np\n'), ((6868, 6904), 'numpy.zeros', 'np.zeros', (['(ndim * ndim, ndim * ndim)'], {}), '((ndim * ndim, ndim * ndim))\n', (6876,... |
import exrex
import logging
import os
import multiprocessing
import numpy as np
from scipy.stats import genlogistic
from scipy.ndimage.filters import median_filter, uniform_filter1d
from functools import partial
from patteRNA.LBC import LBC
from patteRNA import rnalib, filelib, timelib, misclib, viennalib
from tqdm imp... | [
"os.remove",
"numpy.sum",
"multiprocessing.Lock",
"numpy.isnan",
"patteRNA.rnalib.compile_motif_constraints",
"scipy.ndimage.filters.uniform_filter1d",
"os.path.join",
"patteRNA.viennalib.hc_fold",
"scipy.stats.genlogistic.fit",
"numpy.max",
"patteRNA.LBC.LBC",
"numpy.log10",
"scipy.ndimage.... | [((337, 359), 'multiprocessing.Lock', 'multiprocessing.Lock', ([], {}), '()\n', (357, 359), False, 'import multiprocessing\n'), ((369, 396), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (386, 396), False, 'import logging\n'), ((405, 420), 'patteRNA.timelib.Clock', 'timelib.Clock', ([], ... |
import unittest
import numpy as np
from numpy.testing import assert_array_equal,\
assert_array_almost_equal, assert_almost_equal
from .image_generation import binary_circle_border
from ..spim import Spim, SpimStage
from ..process_opencv import ContourFinderSimple, FeatureFormFilter
class FeatureFil... | [
"numpy.random.randint",
"numpy.array",
"numpy.unique"
] | [((802, 834), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)', 'high': '(3)'}), '(low=0, high=3)\n', (819, 834), True, 'import numpy as np\n'), ((1149, 1167), 'numpy.array', 'np.array', (['[0, 255]'], {}), '([0, 255])\n', (1157, 1167), True, 'import numpy as np\n'), ((1128, 1146), 'numpy.unique', 'np.un... |
import numpy as np
import modeling.collision_model as cm
import visualization.panda.world as wd
if __name__ == '__main__':
base = wd.World(cam_pos=np.array([.7, .05, .3]), lookat_pos=np.zeros(3))
# object
object_ref = cm.CollisionModel(initor="./objects/bunnysim.stl",
cdp... | [
"numpy.array",
"numpy.zeros",
"modeling.collision_model.CollisionModel"
] | [((231, 331), 'modeling.collision_model.CollisionModel', 'cm.CollisionModel', ([], {'initor': '"""./objects/bunnysim.stl"""', 'cdprimit_type': '"""box"""', 'cdmesh_type': '"""triangles"""'}), "(initor='./objects/bunnysim.stl', cdprimit_type='box',\n cdmesh_type='triangles')\n", (248, 331), True, 'import modeling.col... |
# --------------------------------------------------------
# DenseFusion 6D Object Pose Estimation by Iterative Dense Fusion
# Licensed under The MIT License [see LICENSE for details]
# Written by Chen
# --------------------------------------------------------
import argparse
import os
import random
import time
import... | [
"argparse.ArgumentParser",
"pathlib.Path",
"numpy.mean",
"os.path.join",
"numpy.round",
"random.randint",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.close",
"torch.load",
"os.path.exists",
"DenseFusion.lib.network.PoseNet",
"random.seed",
"matplotlib.pyplot.cla",
"DenseFusion.datase... | [((1184, 1209), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1207, 1209), False, 'import argparse\n'), ((2502, 2526), 'random.randint', 'random.randint', (['(1)', '(10000)'], {}), '(1, 10000)\n', (2516, 2526), False, 'import random\n'), ((2532, 2565), 'torch.cuda.set_device', 'torch.cuda.set... |
import numpy as np
import pandas as pd
from ncls import NCLS
def _number_overlapping(scdf, ocdf, **kwargs):
keep_nonoverlapping = kwargs.get("keep_nonoverlapping", True)
column_name = kwargs.get("overlap_col", True)
if scdf.empty:
return None
if ocdf.empty:
if keep_nonoverlapping:
... | [
"pandas.DataFrame",
"numpy.nan_to_num",
"ncls.NCLS",
"numpy.setdiff1d",
"pandas.Series",
"pandas.concat"
] | [((471, 530), 'ncls.NCLS', 'NCLS', (['ocdf.Start.values', 'ocdf.End.values', 'ocdf.index.values'], {}), '(ocdf.Start.values, ocdf.End.values, ocdf.index.values)\n', (475, 530), False, 'from ncls import NCLS\n'), ((724, 748), 'pandas.Series', 'pd.Series', (['_self_indexes'], {}), '(_self_indexes)\n', (733, 748), True, '... |
import os
import sys
import platform
import numpy
import threading
import ctypes
import string
import random
import requests
import json
from colorama import Fore
VALID = 0
INVALID = 0
BOOST_LENGTH = 24
CLASSIC_LENGTH = 16
CODESET = []
BASEURL = "https://discord.gift/"
CODESET[:0] = string.ascii_letters + string... | [
"threading.Thread",
"os.system",
"ctypes.windll.kernel32.SetConsoleTitleW",
"requests.get",
"numpy.random.choice"
] | [((330, 422), 'ctypes.windll.kernel32.SetConsoleTitleW', 'ctypes.windll.kernel32.SetConsoleTitleW', (['f"""NoirGen and Checker | Valid: 0 | Invalid: 0"""'], {}), "(\n f'NoirGen and Checker | Valid: 0 | Invalid: 0')\n", (369, 422), False, 'import ctypes\n'), ((418, 434), 'os.system', 'os.system', (['"""cls"""'], {}),... |
import numpy as np
class RidgeRegression:
def __init__(self, bias=True, weight_l2=1e-3, scale=True):
self.bias = bias
self.weight_l2 = weight_l2
self.weights = None
self.scale = scale
def _scale(self, X):
return (X - self._min) / (self._max - self._mi... | [
"numpy.eye",
"numpy.ones",
"numpy.zeros",
"numpy.exp"
] | [((1402, 1422), 'numpy.zeros', 'np.zeros', (['n_features'], {}), '(n_features)\n', (1410, 1422), True, 'import numpy as np\n'), ((1195, 1205), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (1201, 1205), True, 'import numpy as np\n'), ((541, 565), 'numpy.ones', 'np.ones', (['(X.shape[0], 1)'], {}), '((X.shape[0], 1))... |
# -*- coding: utf-8 -*-
import numpy as np
from tensorflow.keras.utils import Sequence
from core.dataset import augment
from core.image import read_image, preprocess_image
from core.utils import decode_annotation, decode_name
class Dataset(Sequence):
def __init__(self, cfg, verbose=0):
self.verbose = v... | [
"core.dataset.augment.bbox_filter",
"numpy.argmax",
"core.dataset.augment.random_distort",
"numpy.arange",
"core.image.preprocess_image",
"core.utils.decode_annotation",
"core.dataset.augment.random_rotate",
"core.dataset.augment.random_flip_lr",
"numpy.random.choice",
"numpy.random.shuffle",
"c... | [((6246, 6276), 'core.utils.decode_cfg', 'decode_cfg', (['"""cfgs/custom.yaml"""'], {}), "('cfgs/custom.yaml')\n", (6256, 6276), False, 'from core.utils import decode_cfg, load_weights\n'), ((913, 956), 'core.utils.decode_annotation', 'decode_annotation', ([], {'anno_path': 'self.anno_path'}), '(anno_path=self.anno_pat... |
#!/usr/bin/env python
# Simple model of receptors diffusing in and out of synapses.
# Simulation of the Dynamcis with the Euler method.
# This simulates the effect of a sudden change in the pool size
#
# <NAME>, January-April 2017
import numpy as np
from matplotlib import pyplot as plt
# parameters
N = 3 ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.cycler",
"numpy.transpose",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.yla... | [((837, 848), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (845, 848), True, 'import numpy as np\n'), ((1294, 1309), 'numpy.zeros', 'np.zeros', (['steps'], {}), '(steps)\n', (1302, 1309), True, 'import numpy as np\n'), ((1334, 1349), 'numpy.zeros', 'np.zeros', (['steps'], {}), '(steps)\n', (1342, 1349), True, 'impo... |
import subprocess
import os
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
import scipy
from scipy.sparse.linalg import lsqr
import time
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
from matplotlib.widgets import Slider,... | [
"numpy.random.seed",
"numpy.sum",
"numpy.argmax",
"numpy.floor",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.arange",
"numpy.round",
"numpy.zeros_like",
"numpy.random.randn",
"numpy.max",
"numpy.linspace",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"numpy... | [((26405, 26422), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (26419, 26422), True, 'import numpy as np\n'), ((26443, 26463), 'numpy.zeros', 'np.zeros', (['(N * 2, 2)'], {}), '((N * 2, 2))\n', (26451, 26463), True, 'import numpy as np\n'), ((26537, 26546), 'numpy.cos', 'np.cos', (['t'], {}), '(t)\n',... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 30 09:52:31 2021
@author: HaoLI
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 8 11:48:41 2021
@author: HaoLI
"""
import torch, torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torc... | [
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"torch.nn.functional.dropout",
"torch.utils.data.TensorDataset",
"torch.device",
"torch.no_grad",
"os.chdir",
"pandas.DataFrame",
"torch.nn.BCELoss",
"torch.utils.d... | [((851, 876), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (874, 876), False, 'import torch, torch.nn as nn\n'), ((934, 957), 'random.seed', 'random.seed', (['randomseed'], {}), '(randomseed)\n', (945, 957), False, 'import random\n'), ((1253, 1295), 'os.chdir', 'os.chdir', (['"""/Users/HaoLI/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('.'))
import cv2
import numpy as np
import common
import imgpheno as ft
def main():
logging.basicConfig(level=logging.INFO, format='%(le... | [
"os.path.abspath",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.basename",
"common.scale_max_perimeter",
"cv2.imwrite",
"common.grabcut",
"imgpheno.split_by_mask",
"cv2.imread",
"logging.info",
"numpy.where",
"os.path.splitext",
"sys.stderr.write",
"os.path.join"
] | [((119, 140), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (134, 140), False, 'import os\n'), ((161, 181), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (176, 181), False, 'import os\n'), ((268, 343), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.IN... |
import os, glob
import numpy as np
import pandas as pd
from multiprocessing import Pool
from PIL import Image
from tqdm import tqdm
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tkinter as tk
import warnings
warnings.filterwarnings("ignore")
... | [
"utils.get_SE",
"utils.get_GR",
"utils.psd2im",
"torch.device",
"torch.no_grad",
"os.path.join",
"utils.get_next_day",
"tkinter.Label",
"utils.mkdirs",
"tkinter.Checkbutton",
"pandas.DataFrame",
"tkinter.Button",
"torch.load",
"matplotlib.figure.Figure",
"tkinter.Tk",
"tqdm.tqdm",
"u... | [((286, 319), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (309, 319), False, 'import warnings\n'), ((4704, 4719), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4717, 4719), False, 'import torch\n'), ((765, 804), 'os.path.join', 'os.path.join', (['opt.dataroot', '... |
"""
Copied from WRF_SPC.py Sep 20, 2019.
Given a model initialization time and a valid time, plot crefuh around hagelslag objects.
"""
import argparse
import datetime
import pdb
import os
import sys
import pandas as pd
import numpy as np
import fieldinfo # levels and color tables - Adapted from /glade/u/home/wrfrt/... | [
"numpy.abs",
"argparse.ArgumentParser",
"pandas.read_csv",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.figure",
"os.path.isfile",
"numpy.arange",
"matplotlib.colors.ListedColormap",
"netCDF4.Dataset",
"wrf.get_cartopy",
"matplotlib.pyplot.close",
"matplotlib.pyplot.colorbar",
"numpy.max",
... | [((511, 532), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (525, 532), False, 'import matplotlib\n'), ((679, 808), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Plot WRF and SPC storm reports"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(... |
import random
import matplotlib
import numpy
from matplotlib import pyplot as plt
from matplotlib.ticker import PercentFormatter
from Resources.data_loader import load_data
from Utils.CrossEntropy import CrossEntropySolver
from Algorithms.CrossEntropy.Solver.ACCADE_cross_entropy_solver import ACCADECrossEntropySolve... | [
"numpy.load",
"Algorithms.CrossEntropy.Solver.GIANT_cross_entropy_solver.GIANTCrossEntropySolver",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.random.randint",
"matplotlib.pyplot.gca",
"numpy.sqrt",
"matplotlib.pyplot.tight_layout",
"Algorithms.CrossEntropy.Solver.FedGD_cross... | [((950, 975), 'sys.path.append', 'sys.path.append', (['home_dir'], {}), '(home_dir)\n', (965, 975), False, 'import sys\n'), ((10791, 10810), 'numpy.mean', 'numpy.mean', (['x_train'], {}), '(x_train)\n', (10801, 10810), False, 'import numpy\n'), ((10943, 10961), 'numpy.mean', 'numpy.mean', (['x_test'], {}), '(x_test)\n'... |
from FEM.Mesh.Geometry import Geometry
from FEM.Mesh.Delaunay import Delaunay
from FEM.PlaneStrain import PlaneStrain
from FEM.Utils.polygonal import roundCorner, giveCoordsCircle
import matplotlib.pyplot as plt
import numpy as np
E = 30*10**(5)
v = 0.25
b = 10
h = 20
he = h/4
ancho_en_h10_in = 18
ancho_en_h20_in = 1... | [
"matplotlib.pyplot.show",
"FEM.PlaneStrain.PlaneStrain",
"numpy.zeros",
"FEM.Mesh.Delaunay.Delaunay",
"FEM.Utils.polygonal.giveCoordsCircle",
"FEM.Mesh.Delaunay.Delaunay._strdelaunay",
"numpy.array",
"numpy.linalg.solve"
] | [((1155, 1189), 'FEM.Utils.polygonal.giveCoordsCircle', 'giveCoordsCircle', (['cent', 'radi'], {'n': '(50)'}), '(cent, radi, n=50)\n', (1171, 1189), False, 'from FEM.Utils.polygonal import roundCorner, giveCoordsCircle\n'), ((1274, 1342), 'FEM.Mesh.Delaunay.Delaunay._strdelaunay', 'Delaunay._strdelaunay', ([], {'constr... |
import cv2
import math
import numpy as np
def get_density_map_gaussian(im, points):
im_density = np.zeros_like(im, dtype=np.float64)
h, w = im_density.shape
if points is None:
return im_density
if points.shape[0] == 1:
x1 = max(0, min(w-1, round(points[0, 0])))
y1 = max(0, min... | [
"numpy.zeros_like",
"math.floor",
"cv2.getGaussianKernel"
] | [((104, 139), 'numpy.zeros_like', 'np.zeros_like', (['im'], {'dtype': 'np.float64'}), '(im, dtype=np.float64)\n', (117, 139), True, 'import numpy as np\n'), ((506, 540), 'cv2.getGaussianKernel', 'cv2.getGaussianKernel', (['f_sz', 'sigma'], {}), '(f_sz, sigma)\n', (527, 540), False, 'import cv2\n'), ((543, 577), 'cv2.ge... |
# -*- coding: utf-8 -*-
"""Simple networks of caches modeled as single caches."""
import random
import numpy as np
from icarus.util import inheritdoc
from icarus.tools import DiscreteDist
from icarus.registry import register_cache_policy, CACHE_POLICY
from .policies import Cache
__all__ = [
'PathCache',
'Tr... | [
"numpy.sum",
"icarus.registry.register_cache_policy",
"random.choice",
"icarus.tools.DiscreteDist",
"icarus.util.inheritdoc"
] | [((622, 651), 'icarus.registry.register_cache_policy', 'register_cache_policy', (['"""PATH"""'], {}), "('PATH')\n", (643, 651), False, 'from icarus.registry import register_cache_policy, CACHE_POLICY\n'), ((2904, 2933), 'icarus.registry.register_cache_policy', 'register_cache_policy', (['"""TREE"""'], {}), "('TREE')\n"... |
# 混雑度トーナメント選択により新たな探索母集団Qt+1を生成
import numpy as np
import random
import copy
class Tournament(object):
"""混雑度トーナメント選択
"""
def __init__(self, archive_set):
self._archive_set = copy.deepcopy(archive_set)
def tournament(self):
# アーカイブ母集団の個体数分の探索母集団を生成
size = int(self._archive_set... | [
"numpy.append",
"copy.deepcopy",
"numpy.array",
"random.randrange"
] | [((197, 223), 'copy.deepcopy', 'copy.deepcopy', (['archive_set'], {}), '(archive_set)\n', (210, 223), False, 'import copy\n'), ((353, 383), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.float64'}), '([], dtype=np.float64)\n', (361, 383), True, 'import numpy as np\n'), ((435, 457), 'random.randrange', 'random.randra... |
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_array_almost_equal
from powersimdata.tests.mock_grid import MockGrid
from powersimdata.tests.mock_scenario import MockScenario
from postreise.analyze.generation.emissions import (
generate_emissions_stats,
summarize_emissions... | [
"pandas.DataFrame",
"powersimdata.tests.mock_grid.MockGrid",
"pandas.date_range",
"postreise.analyze.generation.emissions.generate_emissions_stats",
"pytest.raises",
"numpy.array",
"powersimdata.tests.mock_scenario.MockScenario",
"pytest.approx"
] | [((1354, 1448), 'powersimdata.tests.mock_scenario.MockScenario', 'MockScenario', ([], {'grid_attrs': "{'plant': mock_plant, 'gencost_before': mock_gencost}", 'pg': 'mock_pg'}), "(grid_attrs={'plant': mock_plant, 'gencost_before':\n mock_gencost}, pg=mock_pg)\n", (1366, 1448), False, 'from powersimdata.tests.mock_sce... |
# -*- coding: utf-8 -*-
import numpy as np
import pytest
from mrsimulator.method.query import TransitionQuery
from mrsimulator.methods import FiveQ_VAS
from mrsimulator.methods import SevenQ_VAS
from mrsimulator.methods import ThreeQ_VAS
__author__ = "<NAME>"
__email__ = "<EMAIL>"
methods = [ThreeQ_VAS, FiveQ_VAS, Se... | [
"mrsimulator.methods.ThreeQ_VAS",
"mrsimulator.method.query.TransitionQuery",
"numpy.allclose",
"pytest.raises",
"mrsimulator.methods.SevenQ_VAS",
"mrsimulator.methods.FiveQ_VAS"
] | [((2134, 2193), 'mrsimulator.methods.ThreeQ_VAS', 'ThreeQ_VAS', ([], {'channels': "['87Rb']", 'spectral_dimensions': '[{}, {}]'}), "(channels=['87Rb'], spectral_dimensions=[{}, {}])\n", (2144, 2193), False, 'from mrsimulator.methods import ThreeQ_VAS\n'), ((2639, 2697), 'numpy.allclose', 'np.allclose', (['mth.affine_ma... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
# from IPython import get_ipython
import time, os, sys, shutil
# from utils.fitting_utils import *
# for math and plotting
import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # <--- This is... | [
"utils.analysis_tools.particles_to_body_supports_cuda",
"ipywidgets.Valid",
"ipywidgets.Text",
"numpy.einsum",
"ipywidgets.jslink",
"ipywidgets.Output",
"matplotlib.pyplot.figure",
"pickle.load",
"numpy.arange",
"numpy.sin",
"ipywidgets.BoundedIntText",
"ipywidgets.Button",
"numpy.transpose"... | [((24684, 24793), 'ipywidgets.Play', 'widgets.Play', ([], {'value': '(0)', 'min': '(0)', 'max': '(10000)', 'step': '(10)', 'interval': '(100)', 'description': '"""Press play"""', 'disabled': '(False)'}), "(value=0, min=0, max=10000, step=10, interval=100, description=\n 'Press play', disabled=False)\n", (24696, 2479... |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import re, os, sys
from dwave_qbsolv import QBSolv
from dwave.system.samplers import DWaveSampler, DWaveCliqueSampler
from dwave.system.composites import EmbeddingComposite, FixedEmbeddingComposite
import dimod
import hybrid
import minorminer
import networkx as n... | [
"numpy.set_printoptions",
"hybrid.MergeSamples",
"random.randint",
"hybrid.InterruptableTabuSampler",
"numpy.zeros",
"os.system",
"math.floor",
"qpu_sampler_time.QPUTimeSubproblemAutoEmbeddingSampler",
"hybrid.SplatComposer",
"dimod.BQM.from_qubo",
"minorminer.find_embedding",
"hybrid.LoopUnti... | [((1645, 1660), 'numpy.zeros', 'np.zeros', (['[Dim]'], {}), '([Dim])\n', (1653, 1660), True, 'import numpy as np\n'), ((1755, 1775), 'numpy.zeros', 'np.zeros', (['[Dim, Dim]'], {}), '([Dim, Dim])\n', (1763, 1775), True, 'import numpy as np\n'), ((1855, 1887), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'prec... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import torch.nn as nn
class LabelSmoothSoftmaxCEV1(nn.Module):
'''
This is the autograd version, you can also try the LabelSmoothSoftmaxCEV2 that uses derived gradients
'''
def __init__(self, lb_smooth=0.1, reduction='mean', ignore_index=-10... | [
"torchvision.models.resnet18",
"torch.log_softmax",
"torch.randint",
"numpy.random.seed",
"torch.nn.LogSoftmax",
"torch.manual_seed",
"torch.randn",
"torch.softmax",
"torch.abs",
"random.seed",
"torch.empty_like",
"torch.no_grad",
"torch.sum"
] | [((3876, 3897), 'torch.manual_seed', 'torch.manual_seed', (['(15)'], {}), '(15)\n', (3893, 3897), False, 'import torch\n'), ((3902, 3917), 'random.seed', 'random.seed', (['(15)'], {}), '(15)\n', (3913, 3917), False, 'import random\n'), ((3922, 3940), 'numpy.random.seed', 'np.random.seed', (['(15)'], {}), '(15)\n', (393... |
# -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020-2021, <NAME> <<EMAIL>>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
"""
"""
import numpy ... | [
"thermosteam.ThermalCondition",
"thermosteam.functional.V_to_rho",
"thermosteam.functional.mu_to_nu",
"numpy.asarray",
"numpy.isfinite",
"thermosteam.settings.get_impact_indicator_units",
"chemicals.elements.array_to_atoms",
"thermosteam.functional.Pr",
"thermosteam.Stream",
"numpy.dot",
"thermo... | [((9089, 9115), 'thermosteam.ThermalCondition', 'tmo.ThermalCondition', (['T', 'P'], {}), '(T, P)\n', (9109, 9115), True, 'import thermosteam as tmo\n'), ((18628, 18646), 'numpy.isfinite', 'np.isfinite', (['price'], {}), '(price)\n', (18639, 18646), True, 'import numpy as np\n'), ((25333, 25388), 'chemicals.elements.ar... |
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import RandomForestClassifier
from sklearn.utils import check_array
import numpy as np
from ..utils.tools import Solver
class MissForest(Solver):
def __init__(
self,
n_estimators=300,
max_depth=None,
... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.sum",
"sklearn.utils.check_array",
"numpy.asarray",
"sklearn.ensemble.RandomForestRegressor"
] | [((2477, 2653), 'sklearn.ensemble.RandomForestRegressor', 'RandomForestRegressor', ([], {'n_estimators': 'n_estimators', 'max_depth': 'max_depth', 'min_samples_leaf': 'min_samples_leaf', 'max_features': 'max_features', 'min_samples_split': 'min_samples_split'}), '(n_estimators=n_estimators, max_depth=max_depth,\n mi... |
import numpy as np
import time
from nms.nums_py2 import py_cpu_nms # for cpu
# from nms.gpu_nms import gpu_nms # for gpu
np.random.seed( 1 ) # keep fixed
num_rois = 6000
minxy = np.random.randint(50,145,size=(num_rois ,2))
maxxy = np.random.randint(150,200,size=(num_rois ,2))
score = 0.8*np.random.random_sample... | [
"numpy.random.seed",
"numpy.random.random_sample",
"nms.nums_py2.py_cpu_nms",
"time.time",
"numpy.random.randint",
"numpy.concatenate"
] | [((127, 144), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (141, 144), True, 'import numpy as np\n'), ((186, 232), 'numpy.random.randint', 'np.random.randint', (['(50)', '(145)'], {'size': '(num_rois, 2)'}), '(50, 145, size=(num_rois, 2))\n', (203, 232), True, 'import numpy as np\n'), ((239, 286), 'nu... |
#coding=utf-8
#调色板
import cv2
import numpy as np
img = np.zeros((300, 512, 3), np.uint8)
cv2.namedWindow('image')
def callback(x):
pass
#参数1:名称;参数2:作用窗口,参数3、4:最小值和最大值;参数5:值更改回调方法
cv2.createTrackbar('R', 'image', 0, 255, callback)
cv2.createTrackbar('G', 'image', 0, 255, callback)
cv2.createTrackbar('B', 'image... | [
"cv2.createTrackbar",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.zeros",
"cv2.getTrackbarPos",
"cv2.imshow",
"cv2.namedWindow"
] | [((56, 89), 'numpy.zeros', 'np.zeros', (['(300, 512, 3)', 'np.uint8'], {}), '((300, 512, 3), np.uint8)\n', (64, 89), True, 'import numpy as np\n'), ((90, 114), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (105, 114), False, 'import cv2\n'), ((188, 238), 'cv2.createTrackbar', 'cv2.createTr... |
'''Code from python notebook by simoninithomas
available at https://github.com/simoninithomas/Deep_reinforcement_learning_Course/blob/master/Q%20learning/Q%20Learning%20with%20FrozenLake.ipynb
'''
import numpy as np
import gym
import random
env = gym.make("FrozenLake-v0")
action_size = env.action_space.n
state_siz... | [
"gym.make",
"numpy.argmax",
"random.uniform",
"numpy.zeros",
"numpy.max",
"numpy.exp"
] | [((252, 277), 'gym.make', 'gym.make', (['"""FrozenLake-v0"""'], {}), "('FrozenLake-v0')\n", (260, 277), False, 'import gym\n'), ((358, 393), 'numpy.zeros', 'np.zeros', (['(state_size, action_size)'], {}), '((state_size, action_size))\n', (366, 393), True, 'import numpy as np\n'), ((1299, 1319), 'random.uniform', 'rando... |
import os.path
import numpy as np
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from numpy import dot
from numpy.linalg import norm
class NotIntegerError(Exception):
pass
# 문서를 불러와 단어로 토큰화 후, 단어들을 word_list에 저장후 word_list 반환
def doc_tokenize(doc_name):
with open(doc_name, 'rt') as... | [
"numpy.log",
"numpy.linalg.norm",
"nltk.corpus.stopwords.words",
"numpy.dot",
"nltk.tokenize.word_tokenize"
] | [((369, 390), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['string'], {}), '(string)\n', (382, 390), False, 'from nltk.tokenize import word_tokenize\n'), ((2598, 2624), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (2613, 2624), False, 'from nltk.corpus import stopword... |
"""
NCL_conwomap_2.py
=================
This script illustrates the following concepts:
- Drawing a simple filled contour plot
- Selecting a different color map
- Changing the size/shape of a contour plot
See following URLs to see the reproduced NCL plot & script:
- Original NCL script: https://www.ncl.uc... | [
"matplotlib.pyplot.show",
"geocat.viz.util.set_titles_and_labels",
"matplotlib.pyplot.axes",
"geocat.datafiles.get",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"geocat.viz.util.add_major_minor_ticks",
"numpy.linspace",
"cartopy.crs.PlateCarree"
] | [((1170, 1197), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (1180, 1197), True, 'import matplotlib.pyplot as plt\n'), ((1243, 1261), 'cartopy.crs.PlateCarree', 'ccrs.PlateCarree', ([], {}), '()\n', (1259, 1261), True, 'import cartopy.crs as ccrs\n'), ((1267, 1298), 'ma... |
import os, os.path as op
import logging
import numpy as np
import cv2
import progressbar
import ast
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import pprint
import PIL
from lib.backend import backendDb
from lib.backend import backendMedia
from lib.utils import util
def add_parsers(subparsers)... | [
"pprint.pformat",
"numpy.sum",
"numpy.maximum",
"numpy.argmax",
"matplotlib.pyplot.clf",
"numpy.isnan",
"matplotlib.pyplot.figure",
"lib.backend.backendDb.connect",
"matplotlib.pyplot.gca",
"numpy.diag",
"numpy.bitwise_or",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"numpy.nanmean",... | [((4587, 4638), 'logging.info', 'logging.info', (['"""Total objects of interest: %d"""', 'n_gt'], {}), "('Total objects of interest: %d', n_gt)\n", (4599, 4638), False, 'import logging\n'), ((5041, 5054), 'numpy.cumsum', 'np.cumsum', (['fp'], {}), '(fp)\n', (5050, 5054), True, 'import numpy as np\n'), ((5064, 5077), 'n... |
#!/usr/bin/env python
# Tests for `xclim` package, command line interface
from __future__ import annotations
import numpy as np
import pytest
import xarray as xr
from click.testing import CliRunner
import xclim
from xclim.cli import cli
from xclim.testing import open_dataset
try:
from dask.distributed import Cli... | [
"pytest.importorskip",
"xclim.atmos.tg",
"xclim.core.indicator.registry.items",
"xarray.open_dataset",
"numpy.zeros",
"numpy.ones",
"xarray.concat",
"xarray.Dataset",
"xarray.merge",
"numpy.arange",
"pytest.mark.parametrize",
"xclim.set_options",
"numpy.testing.assert_allclose",
"click.tes... | [((380, 547), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""indicators,indnames"""', "[([xclim.atmos.tg_mean], ['tg_mean']), ([xclim.atmos.tn_mean, xclim.atmos.\n ice_days], ['tn_mean', 'ice_days'])]"], {}), "('indicators,indnames', [([xclim.atmos.tg_mean], [\n 'tg_mean']), ([xclim.atmos.tn_mean, xc... |
from tqdm import tqdm
import numpy as np
import pandas as pd
from scipy.spatial.distance import cdist
from scipy.sparse import issparse
import numdifftools as nd
from multiprocessing.dummy import Pool as ThreadPool
import multiprocessing as mp
import itertools, functools
from ..tools.utils import timeit
def is_outsid... | [
"numdifftools.Hessdiag",
"numpy.trace",
"numpy.sum",
"scipy.sparse.issparse",
"numpy.einsum",
"numpy.ones",
"numdifftools.Gradient",
"numpy.arange",
"numpy.exp",
"numpy.matlib.tile",
"numpy.linalg.norm",
"numpy.unique",
"multiprocessing.cpu_count",
"numpy.atleast_2d",
"pandas.DataFrame",... | [((3391, 3400), 'numpy.exp', 'np.exp', (['K'], {}), '(K)\n', (3397, 3400), True, 'import numpy as np\n'), ((4647, 4672), 'numpy.matlib.tile', 'np.matlib.tile', (['x', '[n, 1]'], {}), '(x, [n, 1])\n', (4661, 4672), True, 'import numpy as np\n'), ((4805, 4829), 'numpy.zeros', 'np.zeros', (['(d * m, d * n)'], {}), '((d * ... |
"""
PyCLES
Desc: This is an implementation of the Common Language Effect Size (CLES) in Python
Author: <NAME>
Date: 04/05/20
"""
import numpy as np
from scipy.stats import norm
def nonparametric_cles(a, b, half_credit=True) -> float:
"""Nonparametric solver for the common language effect size. This solves
... | [
"numpy.subtract.outer",
"scipy.stats.norm.cdf",
"numpy.where",
"numpy.mean",
"numpy.sign",
"numpy.sqrt"
] | [((789, 812), 'numpy.subtract.outer', 'np.subtract.outer', (['a', 'b'], {}), '(a, b)\n', (806, 812), True, 'import numpy as np\n'), ((821, 831), 'numpy.sign', 'np.sign', (['m'], {}), '(m)\n', (828, 831), True, 'import numpy as np\n'), ((902, 925), 'numpy.where', 'np.where', (['(m == -1)', '(0)', 'm'], {}), '(m == -1, 0... |
# Author: Yubo "Paul" Yang
# Email: <EMAIL>
# Kyrt is a versatile fabric exclusive to the planet Florina of Sark.
# The fluorescent and mutable kyrt is ideal for artsy decorations.
# OK, this is a library of reasonable defaults for matplotlib figures.
# May this library restore elegance to your plots.
import matplotli... | [
"matplotlib.cm.get_cmap",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.diag",
"matplotlib.pyplot.Normalize",
"matplotlib.lines.Line2D",
"sklearn.gaussian_process.kernels.DotProduct",
"matplotlib.pyplot.setp",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.cm.ScalarMappab... | [((573, 592), 'matplotlib.cm.get_cmap', 'get_cmap', (['"""viridis"""'], {}), "('viridis')\n", (581, 592), False, 'from matplotlib.cm import get_cmap\n'), ((1409, 1426), 'matplotlib.cm.get_cmap', 'cm.get_cmap', (['name'], {}), '(name)\n', (1420, 1426), False, 'from matplotlib import cm\n'), ((1688, 1713), 'matplotlib.py... |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2021 Graphcore Ltd. All Rights Reserved.
# Copyright (c) 2019 YunYang1994 <<EMAIL>>
# License: MIT (https://opensource.org/licenses/MIT)
# This file has been modified by Graphcore Ltd.
import argparse
import json
import math
import os
import shutil
import time
imp... | [
"os.mkdir",
"argparse.ArgumentParser",
"tensorflow.python.ipu.config.IPUConfig",
"core.utils.nms",
"tensorflow.ConfigProto",
"shutil.rmtree",
"core.utils.read_class_names",
"core.utils.postprocess_boxes",
"tensorflow.train.ExponentialMovingAverage",
"numpy.copy",
"cv2.imwrite",
"os.path.exists... | [((14187, 14266), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""evaluation in TensorFlow"""', 'add_help': '(False)'}), "(description='evaluation in TensorFlow', add_help=False)\n", (14210, 14266), False, 'import argparse\n'), ((781, 828), 'core.utils.read_class_names', 'utils.read_class... |
"""
MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, s... | [
"autohyper.HyperParameters",
"torchvision.models.resnet18",
"autohyper.optimize",
"torch.nn.CrossEntropyLoss",
"pathlib.Path",
"numpy.mean",
"torch.no_grad",
"torchvision.transforms.ToTensor"
] | [((2854, 2897), 'autohyper.HyperParameters', 'HyperParameters', ([], {'lr': '(True)', 'weight_decay': '(True)'}), '(lr=True, weight_decay=True)\n', (2869, 2897), False, 'from autohyper import optimize, LowRankMetrics, HyperParameters\n'), ((2913, 2985), 'autohyper.optimize', 'optimize', ([], {'epoch_trainer': 'epoch_tr... |
from pathlib import Path
import numpy as np
from tifffile import imread
from tracker.export import ExportResults
from tracker.extract_data import get_img_files
from tracker.extract_data import get_indices_pandas
from tracker.tracking import TrackingConfig, MultiCellTracker
def run_tracker(img_path, segm_path, res_p... | [
"numpy.stack",
"argparse.ArgumentParser",
"tracker.tracking.MultiCellTracker",
"tracker.extract_data.get_img_files",
"tracker.tracking.TrackingConfig",
"pathlib.Path",
"numpy.array",
"tracker.export.ExportResults"
] | [((372, 386), 'pathlib.Path', 'Path', (['img_path'], {}), '(img_path)\n', (376, 386), False, 'from pathlib import Path\n'), ((403, 418), 'pathlib.Path', 'Path', (['segm_path'], {}), '(segm_path)\n', (407, 418), False, 'from pathlib import Path\n'), ((434, 448), 'pathlib.Path', 'Path', (['res_path'], {}), '(res_path)\n'... |
import numpy as np
class BBoxFilter(object):
def __init__(self, min_area, max_area, min_ratio):
self.min_area = min_area
self.max_area = max_area
self.min_ratio = min_ratio
def __call__(self, bbox):
assert len(bbox) == 4
area = bbox[2] * bbox[3]
if area < self.min_area or area > self.... | [
"numpy.maximum",
"numpy.sum",
"numpy.argmax",
"numpy.empty",
"numpy.floor",
"numpy.clip",
"numpy.add.outer",
"numpy.prod",
"numpy.multiply",
"numpy.maximum.outer",
"numpy.divide",
"numpy.minimum",
"numpy.asarray",
"numpy.all",
"numpy.subtract",
"numpy.zeros",
"numpy.any",
"numpy.wh... | [((497, 523), 'numpy.clip', 'np.clip', (['bbox[0]', '(0)', '(w - 1)'], {}), '(bbox[0], 0, w - 1)\n', (504, 523), True, 'import numpy as np\n'), ((533, 569), 'numpy.clip', 'np.clip', (['(bbox[0] + bbox[2])', '(0)', '(w - 1)'], {}), '(bbox[0] + bbox[2], 0, w - 1)\n', (540, 569), True, 'import numpy as np\n'), ((579, 605)... |
#!/usr/bin/env python
import sys
from nibabel import load as nib_load
import nibabel as nib
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import statsmodels.api as sm
from scipy import signal
import os
from numpy import genfromtxt
from sklearn.decomposition import PCA
def... | [
"matplotlib.pyplot.title",
"os.mkdir",
"numpy.sum",
"numpy.abs",
"numpy.nanmedian",
"pandas.read_csv",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.figure",
"numpy.mean",
"os.path.join",
"numpy.nanmean",
"numpy.multiply",
"numpy.copy",
"numpy.std",
"numpy.power",
"matplotlib.pyplot.imsh... | [((525, 547), 'nibabel.load', 'nib_load', (['path_to_file'], {}), '(path_to_file)\n', (533, 547), True, 'from nibabel import load as nib_load\n'), ((764, 786), 'nibabel.load', 'nib_load', (['path_to_file'], {}), '(path_to_file)\n', (772, 786), True, 'from nibabel import load as nib_load\n'), ((1165, 1188), 'numpy.power... |
import open3d as o3d
import os
import glob
import numpy as np
import json
class Open3DReconstructionDataset:
def __init__(self, root_dir):
self.root_dir = root_dir
self.len_frame = len(list(glob.glob(os.path.join(root_dir, "color/*.jpg"))))
def get_rgb_paths(self):
open3d_rgb_paths = ... | [
"numpy.zeros",
"numpy.array",
"os.path.join",
"open3d.camera.PinholeCameraIntrinsic"
] | [((1236, 1250), 'numpy.array', 'np.array', (['rows'], {}), '(rows)\n', (1244, 1250), True, 'import numpy as np\n'), ((1576, 1800), 'open3d.camera.PinholeCameraIntrinsic', 'o3d.camera.PinholeCameraIntrinsic', (["intrinsics['width']", "intrinsics['height']", "intrinsics['intrinsic_matrix'][0]", "intrinsics['intrinsic_mat... |
import numpy as np
x = [0, 1, 2, 3, 4]
y = [5, 6, 7, 8, 9]
z = []
for i, j in zip(x, y):
z.append(i + j)
print(z)
z = np.add(x, y)
print(z)
def my_add(a, b):
return a + b
my_add = np.frompyfunc(my_add, 2, 1)
z = my_add(x, y)
print(z)
print(type(np.add))
print(type(np.concatenate))
print(type(my_add))
| [
"numpy.add",
"numpy.frompyfunc"
] | [((123, 135), 'numpy.add', 'np.add', (['x', 'y'], {}), '(x, y)\n', (129, 135), True, 'import numpy as np\n'), ((190, 217), 'numpy.frompyfunc', 'np.frompyfunc', (['my_add', '(2)', '(1)'], {}), '(my_add, 2, 1)\n', (203, 217), True, 'import numpy as np\n')] |
"""Asynchronized (distributed) cnn training."""
import os # noqa isort:skip
os.environ['OMP_NUM_THREADS'] = '1' # noqa isort:skip
import argparse
import logging
import pprint
import time
from dataclasses import asdict, dataclass
from functools import partial
from pathlib import Path
import numpy as np
from dqn.act... | [
"functools.partial",
"dqn.async_train.AsyncTrainerConfig",
"dqn.cnn.replay_buffer.ReplayBufferServer",
"argparse.ArgumentParser",
"dqn.evaluator.EvaluatorClient",
"dqn.actor_manager.ActorManagerClient",
"dqn.async_train.async_train",
"dqn.cnn.learner.Learner",
"dqn.param_distributor.ParamDistributor... | [((1198, 1218), 'dqn.async_train.AsyncTrainerConfig', 'AsyncTrainerConfig', ([], {}), '()\n', (1216, 1218), False, 'from dqn.async_train import AsyncTrainerConfig, async_train\n'), ((1804, 1831), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1821, 1831), False, 'import logging\n'), ((24... |
# class does ...
import sys
import numpy as np
import math
import random
import time
from enum import Enum
from chapters.wall.hyperspace_helper.Segment import Segment
from chapters.wall.hyperspace_helper.AssetLibrary import AssetLibrary
from chapters.wall.hyperspace_helper.RingAssembly import RingAssembly
from chapt... | [
"chapters.wall.hyperspace_helper.Segment.Segment",
"random.randint",
"chapters.wall.hyperspace_helper.AssetLibrary.AssetLibrary",
"numpy.identity",
"numpy.linalg.norm",
"numpy.array",
"numpy.dot",
"chapters.wall.hyperspace_helper.Maze.Maze",
"chapters.wall.hyperspace_helper.Curve.Curve.euler_angles_... | [((2598, 2621), 'chapters.wall.hyperspace_helper.AssetLibrary.AssetLibrary', 'AssetLibrary', (['self.pi3d'], {}), '(self.pi3d)\n', (2610, 2621), False, 'from chapters.wall.hyperspace_helper.AssetLibrary import AssetLibrary\n'), ((2724, 2730), 'chapters.wall.hyperspace_helper.Maze.Maze', 'Maze', ([], {}), '()\n', (2728,... |
import itertools
import numpy as np
import string
__all__ = ['BigramGenerator', 'SkipgramGenerator',
'id2bigram', 'vocabulary_size', 'all_bigrams']
letters = sorted(set((string.ascii_letters + string.digits + " ").lower()))
class WhitelistTable(object):
# there will be stories
def __init__(self,... | [
"numpy.zeros",
"numpy.array",
"itertools.product"
] | [((944, 978), 'numpy.array', 'np.array', (['sequence'], {'dtype': 'np.int16'}), '(sequence, dtype=np.int16)\n', (952, 978), True, 'import numpy as np\n'), ((1512, 1560), 'numpy.zeros', 'np.zeros', ([], {'shape': 'self._batch_size', 'dtype': 'np.int16'}), '(shape=self._batch_size, dtype=np.int16)\n', (1520, 1560), True,... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
"""
This file implements a psychrometric chart for air at 1 atm
"""
from CoolProp.HumidAirProp import HAPropsSI
from .Plots import InlineLabel
import matplotlib, numpy, textwrap
import_template = (
"""
# This file was auto-gener... | [
"textwrap.dedent",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"CoolProp.HumidAirProp.HAPropsSI",
"numpy.linspace"
] | [((799, 827), 'numpy.linspace', 'numpy.linspace', (['(-10)', '(60)', '(100)'], {}), '(-10, 60, 100)\n', (813, 827), False, 'import matplotlib, numpy, textwrap\n'), ((5180, 5221), 'matplotlib.pyplot.figure', 'matplotlib.pyplot.figure', ([], {'figsize': '(10, 8)'}), '(figsize=(10, 8))\n', (5204, 5221), False, 'import mat... |
# This is an answer to: https://codegolf.stackexchange.com/questions/189277/bridge-the-gaps
import sys
import os
from PIL import Image
import numpy as np
import scipy.ndimage
def obtain_groups(image, threshold, structuring_el):
"""
Obtain isles of unconnected pixels via a threshold on the R channel
"""
... | [
"numpy.ndindex",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"os.listdir"
] | [((2124, 2144), 'os.listdir', 'os.listdir', (['"""images"""'], {}), "('images')\n", (2134, 2144), False, 'import os\n'), ((2349, 2361), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (2357, 2361), True, 'import numpy as np\n'), ((2604, 2631), 'numpy.ndindex', 'np.ndindex', (['image.shape[:2]'], {}), '(image.shape[:... |
#!/usr/bin/env python
import rospy
import sys
import time
import numpy as np
from realtimepseudoAstar import plan
from globaltorobotcoords import transform
from nubot_common.msg import ActionCmd, VelCmd, OminiVisionInfo, BallInfo, ObstaclesInfo, RobotInfo, BallIsHolding
#Initialize desired x depending on obstacle num... | [
"globaltorobotcoords.transform",
"nubot_common.msg.ActionCmd",
"rospy.Rate",
"numpy.array",
"numpy.linalg.norm",
"rospy.spin",
"numpy.all"
] | [((822, 839), 'rospy.Rate', 'rospy.Rate', (['hertz'], {}), '(hertz)\n', (832, 839), False, 'import rospy\n'), ((955, 983), 'numpy.array', 'np.array', (['[r.pos.x, r.pos.y]'], {}), '([r.pos.x, r.pos.y])\n', (963, 983), True, 'import numpy as np\n'), ((1494, 1560), 'globaltorobotcoords.transform', 'transform', (['target[... |
import numpy as np
from keras.callbacks import Callback
from keras import backend as K
import tensorflow as tf
class SummaryCallback(Callback):
def __init__(self, trainer, validation=False):
super(SummaryCallback, self)
self.trainer = trainer
self.summarysteps = trainer.config['summarystep... | [
"tensorflow.assign",
"tensorflow.Variable",
"keras.backend.eval",
"numpy.rollaxis"
] | [((382, 420), 'tensorflow.Variable', 'tf.Variable', (['(0.0)'], {'validate_shape': '(False)'}), '(0.0, validate_shape=False)\n', (393, 420), True, 'import tensorflow as tf\n'), ((440, 478), 'tensorflow.Variable', 'tf.Variable', (['(0.0)'], {'validate_shape': '(False)'}), '(0.0, validate_shape=False)\n', (451, 478), Tru... |
import cv2
import numpy as np
import mediapipe as mp
mp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles
mp_pose = mp.solutions.pose
# ---------------------------------------------------------------------
filter = np.array(
[
[0, -1, 0],
[-1, 5, -1],
[0,-1... | [
"cv2.getPerspectiveTransform",
"cv2.bilateralFilter",
"cv2.rectangle",
"cv2.absdiff",
"cv2.imshow",
"cv2.warpPerspective",
"cv2.contourArea",
"cv2.filter2D",
"cv2.dilate",
"cv2.cvtColor",
"cv2.boundingRect",
"cv2.destroyAllWindows",
"cv2.resize",
"cv2.waitKey",
"numpy.float32",
"cv2.th... | [((250, 297), 'numpy.array', 'np.array', (['[[0, -1, 0], [-1, 5, -1], [0, -1, 0]]'], {}), '([[0, -1, 0], [-1, 5, -1], [0, -1, 0]])\n', (258, 297), True, 'import numpy as np\n'), ((514, 578), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""../video_file/Hackathon_high_home_1_Trim.mp4"""'], {}), "('../video_file/Hackathon_... |
import tensorflow as tf
import numpy as np
import pandas as pd
import re
import nltk
import string
import random
random.seed(0)
np.random.seed(0)
tf.random.set_seed(42)
tf.random.set_seed(42)
from nltk.tokenize import word_tokenize
from nltk.tokenize.treebank import TreebankWordDetokenizer
df = pd.read_csv("imdb.csv... | [
"tensorflow.random.set_seed",
"pickle.dump",
"numpy.random.seed",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"tensorflow.keras.callbacks.ModelCheckpoint",
"nltk.tokenize.treebank.TreebankWordDetokenizer",
"tensorflow.keras.preprocessing.text.Token... | [((114, 128), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (125, 128), False, 'import random\n'), ((129, 146), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (143, 146), True, 'import numpy as np\n'), ((147, 169), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(42)'], {}), '(42)\n', (16... |
# ---
# jupyter:
# jupytext_format_version: '1.2'
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# language_info:
# codemirror_mode:
# name: ipython
# version: 3
# file_extension: .py
# mimetype: text/x-python
# name: python
# nbconvert_export... | [
"matplotlib.pyplot.title",
"numpy.sum",
"abs_models.attack_utils.LineSearchAttack",
"numpy.sqrt",
"foolbox.criteria.Misclassification",
"foolbox.models.TensorFlowModel",
"matplotlib.pyplot.imshow",
"abs_models.utils.get_batch",
"foolbox.adversarial.Adversarial",
"abs_models.models.get_VAE",
"abs... | [((405, 432), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./../"""'], {}), "(0, './../')\n", (420, 432), False, 'import sys\n'), ((800, 821), 'abs_models.models.get_VAE', 'mz.get_VAE', ([], {'n_iter': '(10)'}), '(n_iter=10)\n', (810, 821), True, 'from abs_models import models as mz\n'), ((1840, 1861), 'abs_model... |
"""
# T: maturity
# n: # option periods
# N: # futures periods
# S: initial stock price
# r: continuously-compounded interest rate
# c: dividend yield
# sigma: annualized volatility
# K: strike price
# cp: +1/-1 with regards to call/put
"""
from __future__ import division
from math import exp, sqrt
import numpy as np... | [
"math.exp",
"numpy.zeros",
"math.sqrt",
"numpy.sqrt"
] | [((771, 782), 'math.exp', 'exp', (['(r * dt)'], {}), '(r * dt)\n', (774, 782), False, 'from math import exp, sqrt\n'), ((1034, 1058), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1)'], {}), '((n + 1, n + 1))\n', (1042, 1058), True, 'import numpy as np\n'), ((1755, 1779), 'numpy.zeros', 'np.zeros', (['(n + 1, n + 1)'], {})... |
# -*- coding: utf-8 -*-
"""
PID Control Class
"""
# Author: <NAME> <<EMAIL>>
# License: MIT
from collections import deque
import math
import numpy as np
import carla
class Controller:
"""
PID Controller implementation.
Parameters
----------
args : dict
The configuration dictionary parse... | [
"math.radians",
"numpy.cross",
"numpy.clip",
"numpy.array",
"numpy.linalg.norm",
"numpy.dot",
"carla.VehicleControl",
"collections.deque"
] | [((1110, 1126), 'collections.deque', 'deque', ([], {'maxlen': '(10)'}), '(maxlen=10)\n', (1115, 1126), False, 'from collections import deque\n'), ((1362, 1378), 'collections.deque', 'deque', ([], {'maxlen': '(10)'}), '(maxlen=10)\n', (1367, 1378), False, 'from collections import deque\n'), ((2932, 3022), 'numpy.clip', ... |
#!/usr/bin/env python
# Copyright 2019-2022 AstroLab Software
# Author: <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | [
"asyncio.get_event_loop",
"argparse.ArgumentParser",
"gzip.open",
"fink_alert_simulator.alertProducer.schedule_delays",
"time.time",
"fink_alert_simulator.parser.getargs",
"fink_alert_simulator.avroUtils.readschemadata",
"fink_alert_simulator.alertProducer.AlertProducer",
"numpy.array_split",
"os.... | [((962, 1006), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (985, 1006), False, 'import argparse\n'), ((1018, 1033), 'fink_alert_simulator.parser.getargs', 'getargs', (['parser'], {}), '(parser)\n', (1025, 1033), False, 'from fink_alert_simulator.par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.