code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import itertools
from typing import List, Tuple, Union
import numpy as np
from quara.objects.state import State
from quara.objects.povm import Povm
from quara.objects.qoperation import QOperation
from quara.objects.qoperations import SetQOperations
from quara.protocol.qtomography.standard.standard_qtomography import ... | [
"numpy.zeros",
"quara.utils.number_util.to_stream",
"quara.qcircuit.experiment.Experiment",
"itertools.chain.from_iterable",
"quara.objects.qoperations.SetQOperations",
"numpy.sqrt"
] | [((2227, 2321), 'quara.qcircuit.experiment.Experiment', 'Experiment', ([], {'states': '[None]', 'gates': '[]', 'povms': 'povms', 'schedules': 'schedules', 'seed_data': 'seed_data'}), '(states=[None], gates=[], povms=povms, schedules=schedules,\n seed_data=seed_data)\n', (2237, 2321), False, 'from quara.qcircuit.expe... |
import numpy as np
from sys import platform
import os
def get_slash():
if platform == 'win32':
return '\\'
else:
return '/'
def kpoint_segment(first, second, pps):
"""
:param first: first k-point
:param second: second k-point
:param pps: points per segment
:return: normal... | [
"numpy.zeros",
"numpy.linalg.norm",
"numpy.array",
"numpy.linspace",
"numpy.linalg.solve"
] | [((390, 405), 'numpy.array', 'np.array', (['first'], {}), '(first)\n', (398, 405), True, 'import numpy as np\n'), ((419, 435), 'numpy.array', 'np.array', (['second'], {}), '(second)\n', (427, 435), True, 'import numpy as np\n'), ((447, 477), 'numpy.linalg.norm', 'np.linalg.norm', (['(second - first)'], {}), '(second - ... |
import numpy as np
from pyglib.model import circauxi
import shutil,subprocess
cmd = ['/home/ykent/WIEN_GUTZ/bin2/CyGutz', '-r', '-1']
for i,u in enumerate(np.arange(1.0,0.9,-10)):
print(' Running with u = {}'.format(u))
circauxi.gutz_model_setup(u=u, nmesh=5000, norb=3, tiny=0.0, mu=0.0)
subprocess.call(c... | [
"pyglib.model.circauxi.gutz_model_setup",
"shutil.copyfile",
"subprocess.call",
"numpy.arange"
] | [((157, 181), 'numpy.arange', 'np.arange', (['(1.0)', '(0.9)', '(-10)'], {}), '(1.0, 0.9, -10)\n', (166, 181), True, 'import numpy as np\n'), ((230, 298), 'pyglib.model.circauxi.gutz_model_setup', 'circauxi.gutz_model_setup', ([], {'u': 'u', 'nmesh': '(5000)', 'norb': '(3)', 'tiny': '(0.0)', 'mu': '(0.0)'}), '(u=u, nme... |
# coding:utf-8
from bokeh.charts import TimeSeries, show, output_file
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import json
from itertools import cycle
## 在这里设置好字体等因素
from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['Adobe Heiti Std'] # 指定默认字体
mpl.rcParams['a... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"bokeh.charts.show",
"numpy.random.random",
"matplotlib.ticker.OldScalarFormatter",
"itertools.cycle",
"matplotlib.pyplot.subplots",
"pandas.concat"
] | [((1024, 1038), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1036, 1038), True, 'import matplotlib.pyplot as plt\n'), ((2288, 2298), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2296, 2298), True, 'import matplotlib.pyplot as plt\n'), ((2611, 2764), 'itertools.cycle', 'cycle', (["['-', '... |
"""
SPDX-FileCopyrightText: 2019 oemof developer group <<EMAIL>>
SPDX-License-Identifier: MIT
"""
import pandas as pd
import numpy as np
import pytest
from pandas.util.testing import assert_frame_equal
from windpowerlib.power_curves import (smooth_power_curve,
wake_losses_to_pow... | [
"windpowerlib.power_curves.smooth_power_curve",
"windpowerlib.wind_turbine.WindTurbine",
"windpowerlib.power_curves.wake_losses_to_power_curve",
"pytest.raises",
"numpy.arange",
"pandas.Series",
"pandas.concat"
] | [((1218, 1274), 'pandas.Series', 'pd.Series', (['[6.0, 7.0, 8.0, 9.0, 10.0]'], {'name': '"""wind_speed"""'}), "([6.0, 7.0, 8.0, 9.0, 10.0], name='wind_speed')\n", (1227, 1274), True, 'import pandas as pd\n'), ((1344, 1473), 'pandas.Series', 'pd.Series', (['[1141906.9806766496, 1577536.8085282773, 1975480.993355767, \n ... |
import numpy as np
# Was told built-in libraries are acceptable.
from collections import Counter
class Node:
def __init__(self, left=None, right=None,
best_feature=None, threshold=None, value=None):
self.left = left
self.right = right
self.best_feature = best_feature
... | [
"numpy.log2",
"numpy.random.choice",
"numpy.argwhere",
"collections.Counter",
"numpy.bincount",
"numpy.unique"
] | [((1449, 1508), 'numpy.random.choice', 'np.random.choice', (['num_features', 'num_features'], {'replace': '(False)'}), '(num_features, num_features, replace=False)\n', (1465, 1508), True, 'import numpy as np\n'), ((3475, 3489), 'numpy.bincount', 'np.bincount', (['y'], {}), '(y)\n', (3486, 3489), True, 'import numpy as ... |
"""
Classes and code with MultiPLIER related functionality.
"""
import conf
import numpy as np
import pandas as pd
class MultiplierProjection(object):
"""Projects new data into the MultiPLIER latent space."""
def __init__(self):
pass
def transform(
self,
y: pd.DataFrame,
... | [
"pandas.read_pickle",
"warnings.warn",
"numpy.identity"
] | [((3704, 3758), 'pandas.read_pickle', 'pd.read_pickle', (["conf.MULTIPLIER['MODEL_Z_MATRIX_FILE']"], {}), "(conf.MULTIPLIER['MODEL_Z_MATRIX_FILE'])\n", (3718, 3758), True, 'import pandas as pd\n'), ((3881, 3935), 'pandas.read_pickle', 'pd.read_pickle', (["conf.MULTIPLIER['MODEL_METADATA_FILE']"], {}), "(conf.MULTIPLIER... |
import numpy as np
def softmax(a):
return np.exp(a) / np.sum(np.exp(a))
input_a = np.array([-3, -1.5, 0.3, 0.6, 1, 1.8, 3])
print(np.round(softmax(input_a), 3)) | [
"numpy.array",
"numpy.exp"
] | [((88, 129), 'numpy.array', 'np.array', (['[-3, -1.5, 0.3, 0.6, 1, 1.8, 3]'], {}), '([-3, -1.5, 0.3, 0.6, 1, 1.8, 3])\n', (96, 129), True, 'import numpy as np\n'), ((47, 56), 'numpy.exp', 'np.exp', (['a'], {}), '(a)\n', (53, 56), True, 'import numpy as np\n'), ((66, 75), 'numpy.exp', 'np.exp', (['a'], {}), '(a)\n', (72... |
import tensorflow as tf
import numpy as np
import scipy.io as scio
import os
import sys
import random
import network
import math
CATEGORY_NAME = ['Backpack', 'Basket', 'Bathtub', 'Bed', 'Bench', 'Bicycle', 'Bowl', 'Chair', 'Cup', 'Desk', 'DryingRack', 'Handcart',
'Hanger', 'Hook', 'Lamp', 'Laptop', 'Shelf', 'S... | [
"numpy.sum",
"os.makedirs",
"tensorflow.train.Saver",
"scipy.io.loadmat",
"numpy.random.rand",
"numpy.argmax",
"network.iSEG",
"tensorflow.global_variables_initializer",
"os.path.exists",
"numpy.zeros",
"numpy.amax",
"os.path.isfile",
"numpy.reshape",
"numpy.squeeze",
"tensorflow.GPUOpti... | [((725, 778), 'scipy.io.loadmat', 'scio.loadmat', (['"""../../DATA/label/interactionLabel.mat"""'], {}), "('../../DATA/label/interactionLabel.mat')\n", (737, 778), True, 'import scipy.io as scio\n'), ((801, 852), 'numpy.squeeze', 'np.squeeze', (["cate_label_idx_list['categoryLabelIdx']"], {}), "(cate_label_idx_list['ca... |
# -*- coding: utf-8 -*-
"""
Tests for neural spline flows.
"""
import numpy as np
import pytest
import torch
from glasflow.flows import CouplingNSF
@pytest.mark.parametrize("num_bins", [4, 10])
def test_coupling_nsf_init(num_bins):
"""Test the initialise method"""
CouplingNSF(2, 2, num_bins=num_bins)
@pyte... | [
"torch.randn",
"glasflow.flows.CouplingNSF",
"pytest.mark.parametrize",
"numpy.testing.assert_array_almost_equal",
"torch.no_grad"
] | [((152, 196), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_bins"""', '[4, 10]'], {}), "('num_bins', [4, 10])\n", (175, 196), False, 'import pytest\n'), ((276, 312), 'glasflow.flows.CouplingNSF', 'CouplingNSF', (['(2)', '(2)'], {'num_bins': 'num_bins'}), '(2, 2, num_bins=num_bins)\n', (287, 312), Fals... |
import numpy as np
import pandas as pd
import pytest
from locan import LocData
from locan.dependencies import HAS_DEPENDENCY
if HAS_DEPENDENCY["trackpy"]:
from trackpy import quiet as tp_quiet
from locan.data.tracking import link_locdata, track
pytestmark = pytest.mark.skipif(
not HAS_DEPENDENCY["track... | [
"pandas.DataFrame.from_dict",
"trackpy.quiet",
"pytest.fixture",
"pytest.mark.skipif",
"numpy.arange",
"locan.data.tracking.link_locdata",
"locan.data.tracking.track"
] | [((271, 347), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(not HAS_DEPENDENCY['trackpy'])"], {'reason': '"""requires trackpy"""'}), "(not HAS_DEPENDENCY['trackpy'], reason='requires trackpy')\n", (289, 347), False, 'import pytest\n'), ((453, 469), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (467, 469), Fal... |
import os
import logging
import glob
import yaml
import joblib
import numpy as np
from mathtools import utils
from kinemparse import airplanecorpus
logger = logging.getLogger(__name__)
def makeBinLabels(action_labels, part_idxs_to_bins, num_samples):
no_bin = part_idxs_to_bins[0] # 0 is the index of the null... | [
"numpy.full",
"mathtools.utils.copyFile",
"kinemparse.airplanecorpus.loadHandDetections",
"os.path.join",
"os.makedirs",
"kinemparse.airplanecorpus.loadParts",
"yaml.dump",
"os.path.exists",
"mathtools.utils.plot_array",
"numpy.isnan",
"kinemparse.airplanecorpus.loadLabels",
"mathtools.utils.p... | [((161, 188), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'import logging\n'), ((343, 382), 'numpy.full', 'np.full', (['num_samples', 'no_bin'], {'dtype': 'int'}), '(num_samples, no_bin, dtype=int)\n', (350, 382), True, 'import numpy as np\n'), ((749, 788), 'os.path.... |
"""Basic operations on ntuple dicts and track property dicts."""
from random import shuffle
from random import seed as set_seed
from copy import deepcopy
from functools import reduce
from math import inf
from warnings import warn
from numpy import cumsum
from numpy import array
from numpy import delete
from numpy impo... | [
"copy.deepcopy",
"random.shuffle",
"random.seed",
"numpy.array",
"functools.reduce"
] | [((2434, 2484), 'functools.reduce', 'reduce', (['add_two_track_prop_dicts', 'track_prop_dicts'], {}), '(add_two_track_prop_dicts, track_prop_dicts)\n', (2440, 2484), False, 'from functools import reduce\n'), ((6406, 6420), 'random.seed', 'set_seed', (['seed'], {}), '(seed)\n', (6414, 6420), True, 'from random import se... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 16 17:03:00 2018
@author: jumtsai
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
'''Import this part for using Tensor Board to visualizing each nodes in CNN.
'''
#DCNN's TensorFlow(G... | [
"tensorflow.nn.batch_normalization",
"os.remove",
"tensorflow.train.AdadeltaOptimizer",
"numpy.floor",
"tensorflow.reshape",
"astropy.io.fits.PrimaryHDU",
"logging.Formatter",
"tensorflow.ConfigProto",
"os.path.isfile",
"tensorflow.Variable",
"tensorflow.assign",
"tensorflow.nn.conv2d",
"ten... | [((659, 671), 'manager.GPUManager', 'GPUManager', ([], {}), '()\n', (669, 671), False, 'from manager import GPUManager\n'), ((991, 1083), 'logging.handlers.RotatingFileHandler', 'logging.handlers.RotatingFileHandler', (['LOG_FILE'], {'maxBytes': '(10 * 1024 * 1024)', 'backupCount': '(5)'}), '(LOG_FILE, maxBytes=10 * 10... |
import functools
import itertools
import logging
import operator
import numpy as np
from qecsim import graphtools as gt
from qecsim.model import Decoder, cli_description
logger = logging.getLogger(__name__)
@cli_description('Converging MWPM ([factor] FLOAT >=0, ...)')
class PlanarCMWPMDecoder(Decoder):
"""
... | [
"qecsim.model.cli_description",
"operator.index",
"numpy.sum",
"numpy.zeros",
"numpy.errstate",
"qecsim.graphtools.mwpm",
"itertools.combinations",
"qecsim.graphtools.SimpleGraph",
"functools.lru_cache",
"logging.getLogger"
] | [((182, 209), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'import logging\n'), ((213, 273), 'qecsim.model.cli_description', 'cli_description', (['"""Converging MWPM ([factor] FLOAT >=0, ...)"""'], {}), "('Converging MWPM ([factor] FLOAT >=0, ...)')\n", (228, 273), Fa... |
from modeldata import ModelData, netcdf_to_dimension, netcdf_to_quantity, from_local_file
from modeldata import Dimension
from utilities import get_dir, get_ncfiles_in_dir, get_ncfiles_in_time_range
from utilities import get_variable_name, get_variable_name_reverse
import log
from netCDF4 import Dataset
from datetime i... | [
"netCDF4.Dataset",
"modeldata.netcdf_to_dimension",
"utilities.get_ncfiles_in_dir",
"modeldata.from_local_file",
"os.path.exists",
"utilities.get_ncfiles_in_time_range",
"modeldata.netcdf_to_quantity",
"datetime.datetime",
"modeldata.ModelData",
"log.info",
"datetime.datetime.strptime",
"numpy... | [((496, 525), 'utilities.get_ncfiles_in_dir', 'get_ncfiles_in_dir', (['input_dir'], {}), '(input_dir)\n', (514, 525), False, 'from utilities import get_dir, get_ncfiles_in_dir, get_ncfiles_in_time_range\n'), ((530, 589), 'log.info', 'log.info', (['log_file', 'f"""Loading data {input_dir}{ncfiles[0]}"""'], {}), "(log_fi... |
#!/usr/bin/python
#
# CVEs: CVE-2016-6210 (Credits for this go to <NAME>)
#
# Author: 0_o -- null_null
# nu11.nu11 [at] yahoo.com
# Oh, and it is n-u-one-one.n-u-one-one, no l's...
# Wonder how the guys at packet... | [
"sys.stdout.write",
"paramiko.SSHClient",
"argparse.ArgumentParser",
"time.clock",
"numpy.array",
"sys.stdout.flush",
"paramiko.AutoAddPolicy",
"sys.exit"
] | [((1074, 1099), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1097, 1099), False, 'import argparse\n'), ((2395, 2415), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (2413, 2415), False, 'import paramiko\n'), ((2814, 2834), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), ... |
import Rate_calculation
#import constants as ct
from mpmath import mp
from mpmath import fp
import numpy as np
import scipy.integrate as spint
import time
methods=["mp-gl", "mp-ts", "fp-gl", "fp-ts", "sp-quad", "sp-gauss", "monte-carlo", "w-cumsum", "sp-simps", "romberg"];
#cumtrapz relative error tolerance
err_rel=... | [
"numpy.meshgrid",
"numpy.abs",
"mpmath.mp.quad",
"scipy.integrate.quad",
"mpmath.fp.quad",
"numpy.ndim",
"scipy.integrate.tplquad",
"time.time",
"numpy.max",
"numpy.min",
"numpy.arange",
"scipy.integrate.dblquad",
"numpy.random.rand",
"scipy.integrate.simps"
] | [((14219, 14230), 'time.time', 'time.time', ([], {}), '()\n', (14228, 14230), False, 'import time\n'), ((595, 648), 'mpmath.mp.quad', 'mp.quad', (['f', 'limx', 'limy', 'limz'], {'method': '"""gauss-legendre"""'}), "(f, limx, limy, limz, method='gauss-legendre')\n", (602, 648), False, 'from mpmath import mp\n'), ((711, ... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"jax.experimental.stax.BatchNorm",
"jax.experimental.stax.GeneralConv",
"jax.random.PRNGKey",
"jax.lax.psum",
"jax.tree_util.tree_unflatten",
"jax.tree_util.tree_map",
"jax.experimental.stax.parallel",
"jax.numpy.argmax",
"jax.experimental.stax.FanOut",
"numpy.random.RandomState",
"jax.experimen... | [((1615, 1642), 'ctypes.CDLL', 'ctypes.CDLL', (['"""libcudart.so"""'], {}), "('libcudart.so')\n", (1626, 1642), False, 'import ctypes\n'), ((2767, 2798), 'jax.experimental.stax.shape_dependent', 'stax.shape_dependent', (['make_main'], {}), '(make_main)\n', (2787, 2798), False, 'from jax.experimental import stax\n'), ((... |
import os
from math import *
import numpy as np
from scipy import misc
from scipy.ndimage import gaussian_filter
import cv2
def reviseImage():
img_names = [
"1.jpeg", "2.jpeg", "3.jpeg", "dark.jpeg", "overexposure.jpeg"
]
for filename in img_names:
fn = "./img_data/cutted/" + filename
... | [
"cv2.equalizeHist",
"cv2.imwrite",
"numpy.empty",
"numpy.zeros",
"numpy.clip",
"cv2.fastNlMeansDenoising",
"cv2.imread",
"cv2.LUT",
"numpy.random.normal",
"cv2.normalize",
"os.listdir",
"cv2.resize"
] | [((559, 580), 'os.listdir', 'os.listdir', (['"""./part1"""'], {}), "('./part1')\n", (569, 580), False, 'import os\n'), ((2020, 2041), 'os.listdir', 'os.listdir', (['"""./part3"""'], {}), "('./part3')\n", (2030, 2041), False, 'import os\n'), ((332, 368), 'cv2.imread', 'cv2.imread', (['fn', 'cv2.IMREAD_GRAYSCALE'], {}), ... |
'''
Author:
<NAME> <<EMAIL>>
<NAME> <<EMAIL>>
'''
import numpy as np
class Perceptron:
def __init__(self, datapoints, no_of_inputs, threshold=1000, learning_rate=0.0001, isPocket = False):
self.threshold = threshold
self.learning_rate = learning_rate
self.weights = np.random.... | [
"numpy.dot",
"numpy.genfromtxt",
"numpy.random.normal"
] | [((2356, 2394), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': '""","""'}), "(filename, delimiter=',')\n", (2369, 2394), True, 'import numpy as np\n'), ((310, 352), 'numpy.random.normal', 'np.random.normal', (['(0)', '(0.1)', '(no_of_inputs + 1)'], {}), '(0, 0.1, no_of_inputs + 1)\n', (326, 352), Tru... |
import numba
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
import strax
export, __all__ = strax.exporter(export_self=True)
def init_spe_scaling_factor_distributions(file):
# Extract the spe pdf from a csv file into a pandas dataframe
spe_shapes = pd.read_csv(file)
# Creat... | [
"numpy.zeros_like",
"numpy.sum",
"pandas.read_csv",
"numba.int32",
"numpy.cumsum",
"scipy.interpolate.interp1d",
"numpy.linspace",
"strax.exporter"
] | [((123, 155), 'strax.exporter', 'strax.exporter', ([], {'export_self': '(True)'}), '(export_self=True)\n', (137, 155), False, 'import strax\n'), ((290, 307), 'pandas.read_csv', 'pd.read_csv', (['file'], {}), '(file)\n', (301, 307), True, 'import pandas as pd\n'), ((1205, 1277), 'numba.int32', 'numba.int32', (['numba.in... |
import numpy as np
import scipy.linalg as la
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.colors import rgb_to_hsv
from imageio import imread
from progress.bar import IncrementalBar
def grayscale_to_coords(image):
"""Sorts a grayscale image's pixels by saturation, and re... | [
"numpy.dstack",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.close",
"progress.bar.IncrementalBar",
"imageio.imread",
"numpy.unravel_index",
"matplotlib.pyplot.axis",
"matplotlib.animation.FuncAnimation",
"numpy.argsort",
"matplotlib.pyplot.ion",
"numpy.rot90",
"numpy.linspace",
"matplotlib.... | [((488, 509), 'numpy.rot90', 'np.rot90', (['image'], {'k': '(-1)'}), '(image, k=-1)\n', (496, 509), True, 'import numpy as np\n'), ((907, 928), 'numpy.rot90', 'np.rot90', (['image'], {'k': '(-1)'}), '(image, k=-1)\n', (915, 928), True, 'import numpy as np\n'), ((978, 1004), 'numpy.argsort', 'np.argsort', (['hue'], {'ax... |
import numpy as np
from joblib import Parallel, delayed
from .affine import *
from .deformation import *
def select_image_samples(image, shape=(64,64,64), n=10, seed=None, with_augmentation=False):
"""
Select n samples from an image (z,x,y) with the given shape. Returns the sampled positions as (x,y,z) coordi... | [
"numpy.random.seed",
"numpy.power",
"numpy.expand_dims",
"numpy.max",
"numpy.random.randint",
"numpy.array",
"joblib.Parallel",
"numpy.squeeze",
"joblib.delayed"
] | [((3458, 3564), 'numpy.squeeze', 'np.squeeze', (['sample[padding:padding + shape[0], padding:padding + shape[1], padding:\n padding + shape[2]]'], {}), '(sample[padding:padding + shape[0], padding:padding + shape[1],\n padding:padding + shape[2]])\n', (3468, 3564), True, 'import numpy as np\n'), ((699, 719), 'num... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import time
import json
import random
import numpy as np
from jinja2 import Template
from PIL import Image, ImageDraw, ImageFont
class ConfigError(Exception):
pass
class ClickCaptcha(object):
def __init__(self):
# 根目录
self.basedir = os.getc... | [
"jinja2.Template",
"PIL.Image.new",
"json.load",
"random.randint",
"os.makedirs",
"os.getcwd",
"os.path.exists",
"random.choice",
"json.dumps",
"time.time",
"PIL.ImageFont.truetype",
"numpy.mean",
"PIL.ImageDraw.Draw",
"os.path.join"
] | [((313, 324), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (322, 324), False, 'import os\n'), ((1758, 1798), 'os.path.join', 'os.path.join', (['self.basedir', '"""JPEGImages"""'], {}), "(self.basedir, 'JPEGImages')\n", (1770, 1798), False, 'import os\n'), ((1829, 1870), 'os.path.join', 'os.path.join', (['self.basedir', ... |
import os
import numpy as np
import tensorflow as tf
import tensorflow.keras as tfk
import tensorflow.keras.backend as K
import tensorflow.keras.models as tfkm
import tensorflow.keras.optimizers as tfko
import tensorflow.keras.layers as tfkl
import tensorflow.keras.activations as tfka
import tensorflow.keras.initialize... | [
"tensorflow.keras.layers.Dense",
"tensorflow.nn.tanh",
"tensorflow.keras.activations.linear",
"tensorflow.keras.Input",
"tensorflow.keras.initializers.HeNormal",
"tensorflow.keras.layers.LayerNormalization",
"tensorflow.concat",
"tensorflow.keras.initializers.GlorotNormal",
"tensorflow.keras.Model",... | [((412, 485), 'tensorflow.keras.initializers.VarianceScaling', 'tfki.VarianceScaling', ([], {'distribution': '"""uniform"""', 'mode': '"""fan_out"""', 'scale': '(0.333)'}), "(distribution='uniform', mode='fan_out', scale=0.333)\n", (432, 485), True, 'import tensorflow.keras.initializers as tfki\n'), ((522, 541), 'tenso... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: 11360
# datetime: 2021/3/14 13:41
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_swiss_roll
from scipy.spatial import KDTree
import mpl_toolkits.mplot3d.axes3d as p3
from sklearn.cluster import AgglomerativeCluster... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"numpy.zeros",
"numpy.ones",
"sklearn.datasets.make_swiss_roll",
"matplotlib.pyplot.figure",
"numpy.linalg.svd",
"numpy.where",
"sklearn.cluster.AgglomerativeClustering",
"numpy.max",
"matplotlib.pyplot.gca",
"numpy.diag",
"mpl_toolkits.mp... | [((3258, 3304), 'sklearn.datasets.make_swiss_roll', 'make_swiss_roll', (['(1000)'], {'noise': '(0)', 'random_state': '(0)'}), '(1000, noise=0, random_state=0)\n', (3273, 3304), False, 'from sklearn.datasets import make_swiss_roll\n'), ((4712, 4733), 'numpy.linalg.svd', 'np.linalg.svd', (['self.B'], {}), '(self.B)\n', (... |
import os
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib import collections as mc
import torch
import task
from torchmodel import FullModel
from configs import FullConfig
import tools
device = 'cuda' if torch.cuda.is_available() else 'cpu'
def train(conf... | [
"torchmodel.FullModel",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"tools.save_config",
"numpy.arange",
"os.path.join",
"configs.FullConfig",
"os.path.exists",
"numpy.max",
"matplotlib.collections.LineCollection",
"tools.load_config",
"torch.cuda.is_available",
"numpy.... | [((267, 292), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (290, 292), False, 'import torch\n'), ((437, 471), 'tools.load_config', 'tools.load_config', (['config.data_dir'], {}), '(config.data_dir)\n', (454, 471), False, 'import tools\n'), ((701, 754), 'tools.save_config', 'tools.save_config'... |
from abc import ABC
import cv2
import numpy as np
from Operators.DummyAlgorithmWithModel import DummyAlgorithmWithModel
from Utils.GeometryUtils import center_pad_image_with_specific_base, \
resize_with_long_side, force_convert_image_to_bgr, correct_face_orientation
from Utils.InferenceHelpers import TritonInfere... | [
"Operators.ExampleFaceAlignmentOperator.GeneralLandmark106p",
"Utils.AnnotationTools.annotate_segmentation",
"argparse.ArgumentParser",
"Utils.GeometryUtils.correct_face_orientation",
"Operators.ExampleFaceDetectOperator.GeneralUltraLightFaceDetect",
"cv2.waitKey",
"cv2.destroyAllWindows",
"Utils.Geom... | [((4815, 4853), 'argparse.ArgumentParser', 'ArgumentParser', (['"""Face Parsing Example"""'], {}), "('Face Parsing Example')\n", (4829, 4853), False, 'from argparse import ArgumentParser\n'), ((5224, 5251), 'cv2.imread', 'cv2.imread', (['args.image_path'], {}), '(args.image_path)\n', (5234, 5251), False, 'import cv2\n'... |
import numpy as np
import os
import pickle
import joblib
import sys
import glob
import torch
window_size = 1000
normality = str(sys.argv[1]) # e.g. abnormal
source = str(sys.argv[2]) # e.g. ryerson_ab_train_sigOver
outname = '{}_{}.npy'.format(source, normality)
input_path = '/net/adv_spectrum/data/feature/downsampl... | [
"numpy.save",
"numpy.array",
"numpy.arange",
"glob.glob",
"numpy.concatenate"
] | [((1864, 1892), 'numpy.save', 'np.save', (['output_path', 'X_full'], {}), '(output_path, X_full)\n', (1871, 1892), True, 'import numpy as np\n'), ((744, 781), 'numpy.arange', 'np.arange', (['(0)', 'X.shape[0]', 'window_size'], {}), '(0, X.shape[0], window_size)\n', (753, 781), True, 'import numpy as np\n'), ((991, 1007... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
from PIL import Image
import pylab as pl
import matplotlib.cm as cm
def int2B(pat, binary=True):
_ = np.array(pat, float)
for i in range(len(_)):
for j in range(len(_[i])):
if binary:
if pat[i][j] > 130:
... | [
"numpy.array",
"PIL.Image.open"
] | [((169, 189), 'numpy.array', 'np.array', (['pat', 'float'], {}), '(pat, float)\n', (177, 189), True, 'import numpy as np\n'), ((613, 645), 'PIL.Image.open', 'Image.open', (['"""data/picture/1.jpg"""'], {}), "('data/picture/1.jpg')\n", (623, 645), False, 'from PIL import Image\n'), ((676, 708), 'PIL.Image.open', 'Image.... |
import numpy as np
from ...utils import transform_utils as T
from .base_interpolator import Interpolator
class LinearInterpolator(Interpolator):
"""
Simple class for implementing a linear interpolator.
Abstracted to interpolate n-dimensions
Args:
max_delta: Maximum single change in dx allowe... | [
"numpy.array",
"numpy.ceil"
] | [((2000, 2051), 'numpy.ceil', 'np.ceil', (['(ramp_ratio * controller_freq / policy_freq)'], {}), '(ramp_ratio * controller_freq / policy_freq)\n', (2007, 2051), True, 'import numpy as np\n'), ((3292, 3306), 'numpy.array', 'np.array', (['goal'], {}), '(goal)\n', (3300, 3306), True, 'import numpy as np\n')] |
import re
import pytest
import numpy as np
import torch
from obp.types import BanditFeedback
from obp.ope import (
DirectMethod,
DoublyRobust,
DoublyRobustWithShrinkage,
SwitchDoublyRobust,
SelfNormalizedDoublyRobust,
)
from conftest import generate_action_dist
# prepare instances
dm = DirectMeth... | [
"torch.ones",
"numpy.random.uniform",
"obp.ope.SelfNormalizedDoublyRobust",
"numpy.abs",
"conftest.generate_action_dist",
"numpy.zeros",
"numpy.ones",
"re.escape",
"obp.ope.DoublyRobustWithShrinkage",
"pytest.raises",
"obp.ope.SwitchDoublyRobust",
"numpy.arange",
"numpy.random.choice",
"to... | [((310, 324), 'obp.ope.DirectMethod', 'DirectMethod', ([], {}), '()\n', (322, 324), False, 'from obp.ope import DirectMethod, DoublyRobust, DoublyRobustWithShrinkage, SwitchDoublyRobust, SelfNormalizedDoublyRobust\n'), ((330, 344), 'obp.ope.DoublyRobust', 'DoublyRobust', ([], {}), '()\n', (342, 344), False, 'from obp.o... |
import numpy as np
from chainer import cuda, Link, Chain, ChainList
from chainer.training import extension
def _namedpersistents_as_link(target):
assert isinstance(target, Link)
d = target.__dict__
for name in target._persistent:
yield '/' + name, d[name]
def _namedpersistents_as_chain(target):... | [
"chainer.cuda.get_device_from_array",
"chainer.cuda.get_array_module",
"chainer.cuda.elementwise",
"numpy.array",
"chainer.cuda.to_gpu"
] | [((3435, 3464), 'chainer.cuda.get_device_from_array', 'cuda.get_device_from_array', (['p'], {}), '(p)\n', (3461, 3464), False, 'from chainer import cuda, Link, Chain, ChainList\n'), ((3596, 3699), 'chainer.cuda.elementwise', 'cuda.elementwise', (['"""T p, T decay"""', '"""T s"""', '"""s -= (1 - decay) * (s - p)"""', '"... |
#!/usr/bin/env python
import rospy
import os
import matplotlib.pyplot as plt
import pickle
from tello_driver.msg import TelloStatus
import numpy as np
import atexit
import datetime
RECORD_BATTERY = False
class BatteryLogPlot(object):
def __init__(self):
# current variables
self.zero_time = rospy... | [
"atexit.register",
"matplotlib.pyplot.show",
"rospy.Time.now",
"rospy.Subscriber",
"datetime.datetime.now",
"rospy.loginfo",
"matplotlib.pyplot.figure",
"numpy.arange",
"rospy.init_node",
"rospy.spin",
"matplotlib.pyplot.grid",
"os.getenv"
] | [((4337, 4349), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (4347, 4349), True, 'import matplotlib.pyplot as plt\n'), ((6745, 6768), 'matplotlib.pyplot.grid', 'plt.grid', ([], {'linewidth': '(0.5)'}), '(linewidth=0.5)\n', (6753, 6768), True, 'import matplotlib.pyplot as plt\n'), ((6772, 6782), 'matplotl... |
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import math
test_scores=[88,92,79,93,85]
print(np.mean(test_scores))
curved_5=[score + 5 for score in test_scores]
print(np.mean(curved_5))
curved_10=[score + 10 for score in test_scores]
print(np.mean(curved_10))
curved_sqrt=[math.sqrt(score)*10... | [
"numpy.mean",
"math.sqrt"
] | [((110, 130), 'numpy.mean', 'np.mean', (['test_scores'], {}), '(test_scores)\n', (117, 130), True, 'import numpy as np\n'), ((188, 205), 'numpy.mean', 'np.mean', (['curved_5'], {}), '(curved_5)\n', (195, 205), True, 'import numpy as np\n'), ((265, 283), 'numpy.mean', 'np.mean', (['curved_10'], {}), '(curved_10)\n', (27... |
#eci_ecef_conversions.py
#<NAME> (nhz2)
#November 24, 2019
# using examples from https://astropy.readthedocs.io/en/latest/coordinates/velocities.html
"""Module for using astropy to convert between ECI and ECEF coordinates and velocities"""
import astropy.units as u
from astropy.coordinates import (ITRS,GCRS)
from astro... | [
"astropy.time.Time",
"numpy.cov",
"numpy.array"
] | [((638, 712), 'astropy.time.Time', 'Time', (['(init_gps_weeknum * 7 * 24 * 60 * 60)', 'time'], {'scale': '"""tai"""', 'format': '"""gps"""'}), "(init_gps_weeknum * 7 * 24 * 60 * 60, time, scale='tai', format='gps')\n", (642, 712), False, 'from astropy.time import Time\n'), ((2277, 2294), 'numpy.array', 'np.array', (['v... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Date: 2018-08-10 19:31:47
"""
from __future__ import absolute_import, division, print_function
import csv
import os
import numpy as np
np.random.seed(0)
ratio = 0.9
def gen_lines(path, d):
path = os.path.join(path, d)
lines = []
for f ... | [
"numpy.random.seed",
"csv.writer",
"os.path.join",
"os.listdir",
"numpy.random.shuffle"
] | [((212, 229), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (226, 229), True, 'import numpy as np\n'), ((1097, 1127), 'numpy.random.shuffle', 'np.random.shuffle', (['train_lines'], {}), '(train_lines)\n', (1114, 1127), True, 'import numpy as np\n'), ((1128, 1158), 'numpy.random.shuffle', 'np.random.shu... |
import cv2
import numpy as np
import glob
import math
import scipy
from scipy.spatial import distance
from scipy import signal
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import metrics
#modulating function as defined in ... | [
"numpy.absolute",
"math.sqrt",
"scipy.signal.convolve2d",
"numpy.zeros",
"numpy.mean",
"numpy.exp"
] | [((663, 679), 'numpy.zeros', 'np.zeros', (['(8, 8)'], {}), '((8, 8))\n', (671, 679), True, 'import numpy as np\n'), ((2311, 2365), 'scipy.signal.convolve2d', 'scipy.signal.convolve2d', (['img_roi', 'filter1'], {'mode': '"""same"""'}), "(img_roi, filter1, mode='same')\n", (2334, 2365), False, 'import scipy\n'), ((2382, ... |
#export
import matplotlib
import matplotlib.pyplot as plt
from datetime import datetime
import glob
import emoji
import numpy as np
import seaborn as sns
def convert(year,month,date):
return int(datetime(year, month, date, 0, 0, 0).timestamp()*1000)
def convert_reverse(timestamp):
dt_object = datetime.fromti... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.axvline",
"numpy.trace",
"seaborn.heatmap",
"numpy.sum",
"emoji.demojize",
"datetime.datetime.fromtimestamp",
"numpy.asarray",
"matplotlib.pyplot.rcParams.get",
"datetime.datetime",
"matplotlib.pyplot.figure",
"glob.glob",
"matplotlib.pyplot.ylab... | [((305, 345), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['(timestamp / 1000)'], {}), '(timestamp / 1000)\n', (327, 345), False, 'from datetime import datetime\n'), ((762, 811), 'matplotlib.pyplot.axvline', 'plt.axvline', (['day_start'], {'linestyle': '"""--"""', 'color': '"""r"""'}), "(day_start, li... |
import os
import cv2
import numpy as np
import lxml.etree as ET
page_folder='moc_dataset/train/moc_train_xml/'
image_folder='moc_dataset/train/moc_train_images/'
pixel_label_folder='moc_dataset/train/moc_train_pixel_label/'
os.mkdir(pixel_label_folder)
for page_file in sorted(os.listdir(page_folder)):
print(page_... | [
"os.mkdir",
"cv2.imwrite",
"numpy.zeros",
"cv2.fillPoly",
"cv2.imread",
"numpy.array",
"lxml.etree.parse",
"os.listdir"
] | [((225, 253), 'os.mkdir', 'os.mkdir', (['pixel_label_folder'], {}), '(pixel_label_folder)\n', (233, 253), False, 'import os\n'), ((279, 302), 'os.listdir', 'os.listdir', (['page_folder'], {}), '(page_folder)\n', (289, 302), False, 'import os\n'), ((334, 387), 'cv2.imread', 'cv2.imread', (["(image_folder + page_file[:-4... |
from __future__ import unicode_literals
import copy
import heapq
import math
import numpy
import os
import types
import uuid
from .common import log
from .errors import MoleculeError, PTError, FileError
from .settings import Settings
from ..tools.pdbtools import PDBHandler, PDBRecord
from ..tools.utils import Units, ... | [
"copy.deepcopy",
"heapq.heapify",
"math.sqrt",
"os.path.basename",
"math.floor",
"numpy.identity",
"math.sin",
"heapq.heappop",
"math.acos",
"numpy.array",
"numpy.linalg.norm",
"math.cos",
"numpy.dot"
] | [((22720, 22739), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (22733, 22739), False, 'import copy\n'), ((35178, 35197), 'heapq.heapify', 'heapq.heapify', (['heap'], {}), '(heap)\n', (35191, 35197), False, 'import heapq\n'), ((39008, 39028), 'numpy.linalg.norm', 'numpy.linalg.norm', (['v'], {}), '(v)\n... |
"""
Module to run programs on ibex
"""
import numpy as np
import logging
from .executor import Executor
import re
from pathlib import Path
class RunError(Exception):
"""
Class for exceptions
"""
pass
class IbexRun(Executor):
"""
Class to create jobs to run in ibex. When the `run()` method i... | [
"logging.info",
"numpy.floor",
"re.search",
"numpy.ceil"
] | [((3405, 3433), 'numpy.floor', 'np.floor', (['(total_minutes / 60)'], {}), '(total_minutes / 60)\n', (3413, 3433), True, 'import numpy as np\n'), ((3450, 3477), 'numpy.ceil', 'np.ceil', (['(total_minutes % 60)'], {}), '(total_minutes % 60)\n', (3457, 3477), True, 'import numpy as np\n'), ((4668, 4726), 'logging.info', ... |
"""
<NAME>., <NAME>., & <NAME>. 2004, MNRAS, 347, 144
"""
import numpy as np
# Parameters for the Sazonov & Ostriker AGN template
_Alpha = 0.24
_Beta = 1.60
_Gamma = 1.06
_E_1 = 83e3
_K = 0.0041
_E_0 = (_Beta - _Alpha) * _E_1
_A = np.exp(2e3 / _E_1) * 2e3**_Alpha
_B = ((_E_0**(_Beta - _Alpha)) \
* np.exp(-(_Beta ... | [
"numpy.zeros_like",
"numpy.exp"
] | [((233, 254), 'numpy.exp', 'np.exp', (['(2000.0 / _E_1)'], {}), '(2000.0 / _E_1)\n', (239, 254), True, 'import numpy as np\n'), ((305, 330), 'numpy.exp', 'np.exp', (['(-(_Beta - _Alpha))'], {}), '(-(_Beta - _Alpha))\n', (311, 330), True, 'import numpy as np\n'), ((585, 608), 'numpy.exp', 'np.exp', (['(2000.0 / 2000.0)'... |
import numpy as np
from ._base import DMPBase, WeightParametersMixin
from ._forcing_term import ForcingTerm
from ._canonical_system import canonical_system_alpha
from ._dmp import dmp_imitate, dmp_open_loop
class DMPWithFinalVelocity(WeightParametersMixin, DMPBase):
"""Dynamical movement primitive (DMP) with fina... | [
"numpy.zeros_like",
"numpy.copy",
"numpy.empty_like",
"numpy.finfo",
"numpy.diff",
"numpy.array",
"numpy.dot",
"numpy.linalg.solve",
"numpy.vstack"
] | [((5868, 6113), 'numpy.array', 'np.array', (['[[1, t0, t02, t03, t04, t05], [0, 1, 2 * t0, 3 * t02, 4 * t03, 5 * t04], [0,\n 0, 2, 6 * t0, 12 * t02, 20 * t03], [1, t1, t12, t13, t14, t15], [0, 1, \n 2 * t1, 3 * t12, 4 * t13, 5 * t14], [0, 0, 2, 6 * t1, 12 * t12, 20 * t13]]'], {}), '([[1, t0, t02, t03, t04, t05], ... |
## https://www.kaggle.com/meaninglesslives/nested-unet-with-efficientnet-encoder
import tensorflow as tf
from tensorflow import keras
#from efficientnet import EfficientNetB4
from efficientnet.tfkeras import EfficientNetB4
import numpy as np
def convolution_block(x, filters, size, strides=(1,1), padding='sa... | [
"tensorflow.py_function",
"tensorflow.keras.losses.binary_crossentropy",
"tensorflow.keras.backend.sum",
"efficientnet.tfkeras.EfficientNetB4",
"tensorflow.keras.backend.flatten",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.MaxPooling2D",
... | [((1071, 1160), 'efficientnet.tfkeras.EfficientNetB4', 'EfficientNetB4', ([], {'weights': 'imagenet_weights', 'include_top': '(False)', 'input_shape': 'input_shape'}), '(weights=imagenet_weights, include_top=False, input_shape=\n input_shape)\n', (1085, 1160), False, 'from efficientnet.tfkeras import EfficientNetB4\... |
#!/usr/bin/env python
"""Plot Q test statistics"""
import argparse
import csv
import math
import matplotlib
import numpy as np
import shutil
import tensorflow.compat.v2 as tf
import b_meson_fit as bmf
tf.enable_v2_behavior()
def read_q_stats(csv_path):
"""Return list of Q stats from file"""
q_list = []
... | [
"numpy.sum",
"matplotlib.pylab.gca",
"numpy.histogram",
"numpy.mean",
"numpy.exp",
"matplotlib.pylab.figure",
"matplotlib.pylab.show",
"matplotlib.pylab.scatter",
"matplotlib.pylab.legend",
"numpy.std",
"shutil.get_terminal_size",
"argparse.HelpFormatter",
"numpy.linspace",
"math.log",
"... | [((203, 226), 'tensorflow.compat.v2.enable_v2_behavior', 'tf.enable_v2_behavior', ([], {}), '()\n', (224, 226), True, 'import tensorflow.compat.v2 as tf\n'), ((757, 783), 'shutil.get_terminal_size', 'shutil.get_terminal_size', ([], {}), '()\n', (781, 783), False, 'import shutil\n'), ((1722, 1752), 'b_meson_fit.Script',... |
# from socketIO_client import SocketIO, LoggingNamespace
import sys
import socketio
import numpy as np
import math
from random import randrange
sio = socketio.Client()
@sio.on('receive_chaos_output2')
def on_message(msg):
if msg['output'] == tpmclient.tpm.chaosmap():
tpmclient.IsSync = True
prin... | [
"socketio.Client",
"numpy.zeros",
"numpy.hstack",
"math.copysign",
"numpy.random.randint",
"numpy.array",
"random.randrange",
"numpy.dot"
] | [((152, 169), 'socketio.Client', 'socketio.Client', ([], {}), '()\n', (167, 169), False, 'import socketio\n'), ((4404, 4420), 'numpy.zeros', 'np.zeros', (['self.k'], {}), '(self.k)\n', (4412, 4420), True, 'import numpy as np\n'), ((4928, 4947), 'math.copysign', 'math.copysign', (['(1)', 'x'], {}), '(1, x)\n', (4941, 49... |
import torch
import torch.nn as nn
import numpy as np
def Angular(margin):#angular mc
#https://github.com/ronekko/deep_metric_learning/blob/master/lib/functions/angular_loss.py
return AngularLoss(margin=margin)
class AngularLoss(nn.Module):
def __init__(self,margin):
super(AngularLoss, self).__in... | [
"torch.ones",
"torch.eye",
"numpy.deg2rad"
] | [((557, 580), 'numpy.deg2rad', 'np.deg2rad', (['self.margin'], {}), '(self.margin)\n', (567, 580), True, 'import numpy as np\n'), ((998, 1026), 'torch.ones', 'torch.ones', (['n_pairs', 'n_pairs'], {}), '(n_pairs, n_pairs)\n', (1008, 1026), False, 'import torch\n'), ((1026, 1053), 'torch.eye', 'torch.eye', (['n_pairs', ... |
#Library
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import random
import itertools
import doctest
import copy
import math
import wandb
from tqdm import tqdm
from collections import defaultdict
#Node Class
#information set node class definition
class Node:
#1 #Leduc_node_definitions
de... | [
"matplotlib.pyplot.xscale",
"wandb.log",
"matplotlib.pyplot.yscale",
"random.shuffle",
"matplotlib.pyplot.legend",
"itertools.permutations",
"collections.defaultdict",
"numpy.array",
"wandb.save",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"pandas.set_option",
"doctest.testmod"
... | [((32412, 32451), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (32425, 32451), True, 'import pandas as pd\n'), ((32957, 32974), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (32972, 32974), False, 'import doctest\n'), ((3162, 3179), 'collectio... |
import numpy as np
class LossFunction:
@staticmethod
def calculate_cost(expected_value, predicted):
raise NotImplementedError("Should have implemented this!")
@staticmethod
def calculate_cost_gradient(expected_value, outputs, derivative_outputs):
raise NotImplementedError("Should have... | [
"numpy.linalg.norm"
] | [((478, 518), 'numpy.linalg.norm', 'np.linalg.norm', (['(expected_value - outputs)'], {}), '(expected_value - outputs)\n', (492, 518), True, 'import numpy as np\n')] |
from dataclasses import dataclass
@dataclass
class Pool:
param1: int
@dataclass
class HEPnOS:
pools: list
# metalgpy
import numpy as np
import metalgpy as mpy
rng = np.random.RandomState(42)
Pool_ = mpy.meta(Pool)
HEPnOS_ = mpy.meta(HEPnOS)
max_pools = 5
num_pools = mpy.Int(1, max_pools)
pools = mpy.Li... | [
"metalgpy.Int",
"metalgpy.sample",
"numpy.random.RandomState",
"metalgpy.meta"
] | [((179, 204), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (200, 204), True, 'import numpy as np\n'), ((214, 228), 'metalgpy.meta', 'mpy.meta', (['Pool'], {}), '(Pool)\n', (222, 228), True, 'import metalgpy as mpy\n'), ((239, 255), 'metalgpy.meta', 'mpy.meta', (['HEPnOS'], {}), '(HEPnO... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
import gym
import numpy
from gym.spaces.box import Box
__all__ = ["NoisyObservationWrapper", "NoisyActionWrapper"]
class NoisyObservationWrapper(gym.ObservationWrapper):
"""Make observation dynamic by adding noise"""
def __init__(self, en... | [
"gym.spaces.box.Box",
"numpy.random.randint"
] | [((763, 794), 'gym.spaces.box.Box', 'Box', (['(0.0)', '(255.0)', 'self.new_shape'], {}), '(0.0, 255.0, self.new_shape)\n', (766, 794), False, 'from gym.spaces.box import Box\n'), ((1780, 1811), 'gym.spaces.box.Box', 'Box', (['(0.0)', '(255.0)', 'self.new_shape'], {}), '(0.0, 255.0, self.new_shape)\n', (1783, 1811), Fal... |
import numpy as np
DEBUG = True
def py_box_voting_wrapper(IOU_thresh, score_thresh, with_nms):
if with_nms:
def _box_voting(nms_dets, dets):
return box_voting_nms(nms_dets, dets, IOU_thresh, score_thresh)
else:
def _box_voting(dets):
return box_voting(dets, IOU_thresh, ... | [
"numpy.minimum",
"numpy.maximum",
"numpy.sum",
"numpy.zeros",
"numpy.where",
"numpy.array",
"numpy.intersect1d"
] | [((3374, 3401), 'numpy.array', 'np.array', (['keep_fusion_boxes'], {}), '(keep_fusion_boxes)\n', (3382, 3401), True, 'import numpy as np\n'), ((6324, 6351), 'numpy.array', 'np.array', (['keep_fusion_boxes'], {}), '(keep_fusion_boxes)\n', (6332, 6351), True, 'import numpy as np\n'), ((1285, 1318), 'numpy.maximum', 'np.m... |
import numpy
from dedupe.distance.affinegap import normalizedAffineGapDistance as comparator
def getCentroid(attribute_variants, comparator):
"""
Takes in a list of attribute values for a field,
evaluates the centroid using the comparator,
& returns the centroid (i.e. the 'best' value for the field)
... | [
"dedupe.distance.affinegap.normalizedAffineGapDistance",
"numpy.zeros"
] | [((391, 410), 'numpy.zeros', 'numpy.zeros', (['[n, n]'], {}), '([n, n])\n', (402, 410), False, 'import numpy\n'), ((573, 629), 'dedupe.distance.affinegap.normalizedAffineGapDistance', 'comparator', (['attribute_variants[i]', 'attribute_variants[j]'], {}), '(attribute_variants[i], attribute_variants[j])\n', (583, 629), ... |
'''This example demonstrates the use of Convolution1D for text classification.
Gets to 0.89 test accuracy after 2 epochs.
90s/epoch on Intel i5 2.4Ghz CPU.
10s/epoch on Tesla K40 GPU.
'''
from __future__ import print_function
import numpy as np
import keras.callbacks
from keras.preprocessing import sequence
from ke... | [
"example_correctness_test_utils.TrainingHistory",
"keras.layers.Activation",
"keras.preprocessing.sequence.pad_sequences",
"keras.layers.Dropout",
"keras.layers.Conv1D",
"example_correctness_test_utils.StopwatchManager",
"keras.layers.Dense",
"numpy.array",
"keras.layers.Embedding",
"keras.models.... | [((809, 847), 'keras.datasets.imdb.load_data', 'imdb.load_data', ([], {'num_words': 'max_features'}), '(num_words=max_features)\n', (823, 847), False, 'from keras.datasets import imdb\n'), ((1201, 1247), 'keras.preprocessing.sequence.pad_sequences', 'sequence.pad_sequences', (['x_train'], {'maxlen': 'maxlen'}), '(x_tra... |
from IPython import get_ipython
# %%
####################
# GRAPH GENERATION #
####################
# TODO: remove duplicate of nbIndividuals in viz
nbIndividuals = 1000 # number of people in the graph | nombre d'individus dans le graphe
initHealthy = 0.85 # proportion of healthy people at start | la proportion de per... | [
"matplotlib.pyplot.show",
"random.randint",
"random.uniform",
"numpy.random.exponential",
"matplotlib.pyplot.subplots",
"random.random",
"matplotlib.pyplot.tight_layout",
"numpy.random.lognormal"
] | [((23541, 23577), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(2)'], {'figsize': '[15, 10]'}), '(2, 2, figsize=[15, 10])\n', (23553, 23577), True, 'import matplotlib.pyplot as plt\n'), ((27386, 27404), 'matplotlib.pyplot.tight_layout', 'plt.tight_layout', ([], {}), '()\n', (27402, 27404), True, 'import matp... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... | [
"utils.apply_mutations",
"numpy.random.RandomState",
"utils.merge_multiple_mutation_sets",
"itertools.combinations",
"collections.Counter",
"utils.get_top_n_mutation_pairs"
] | [((2032, 2081), 'itertools.combinations', 'itertools.combinations', (['mutations', '(num_rounds + 1)'], {}), '(mutations, num_rounds + 1)\n', (2054, 2081), False, 'import itertools\n'), ((2514, 2523), 'collections.Counter', 'Counter', ([], {}), '()\n', (2521, 2523), False, 'from collections import Counter\n'), ((3273, ... |
import numpy as np
def cubic_lattice(N):
array = np.arange(N)
xs, ys, zs = np.meshgrid(array, array, array)
return np.vstack((xs.flatten(), ys.flatten(), zs.flatten())).T
def donut(inner_r, outer_r, height=5, point_density=24, n_viewpoints=60,
offset=1e-3):
assert(isinstance(height, int))
... | [
"numpy.meshgrid",
"numpy.zeros",
"numpy.sin",
"numpy.arange",
"numpy.linspace",
"numpy.cos",
"numpy.vstack"
] | [((55, 67), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (64, 67), True, 'import numpy as np\n'), ((85, 117), 'numpy.meshgrid', 'np.meshgrid', (['array', 'array', 'array'], {}), '(array, array, array)\n', (96, 117), True, 'import numpy as np\n'), ((856, 873), 'numpy.arange', 'np.arange', (['height'], {}), '(heigh... |
# example-3.18-repressilator.py - Transcriptional regulation
# RMM, 29 Aug 2021
#
# Figure 3.26: The repressilator genetic regulatory network. (a) A schematic
# diagram of the repressilator, showing the layout of the genes in the
# plasmid that holds the circuit as well as the circuit diagram
# (center). (b) A simulati... | [
"matplotlib.pyplot.title",
"control.NonlinearIOSystem",
"numpy.log",
"matplotlib.pyplot.plot",
"numpy.empty",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.linspace",
"control.input_output_response",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlab... | [((3513, 3629), 'control.NonlinearIOSystem', 'ct.NonlinearIOSystem', ([], {'updfcn': 'repressilator', 'outfcn': '(lambda t, x, u, params: x[3:])', 'states': '(6)', 'inputs': '(0)', 'outputs': '(3)'}), '(updfcn=repressilator, outfcn=lambda t, x, u, params: x\n [3:], states=6, inputs=0, outputs=3)\n', (3533, 3629), Tr... |
import argparse
import re
import sys
import numpy as np
import pandas as pd
import tpch
from pydrill.client import PyDrill
def get_table_occurrences(query):
# [ y for y in a if y not in b]
return [name for name in tpch.tableNames if name in query.split()]
def replace_all(text, dic):
for i, j in dic.item... | [
"argparse.ArgumentParser",
"tpch.init_schema",
"numpy.asarray",
"numpy.dtype",
"pydrill.client.PyDrill",
"pandas.api.types.is_categorical_dtype",
"re.sub",
"pandas.to_numeric"
] | [((6477, 6513), 'pydrill.client.PyDrill', 'PyDrill', ([], {'host': '"""localhost"""', 'port': '(8047)'}), "(host='localhost', port=8047)\n", (6484, 6513), False, 'from pydrill.client import PyDrill\n'), ((6608, 6699), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate Input Generato... |
from bbpipe import PipelineStage
from .types import FitsFile, DirFile, HTMLFile, NpzFile
import sacc
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import dominate as dom
import dominate.tags as dtg
import os
class BBPlotter(PipelineStage):
name="BBPlotter"
inputs=[(... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.yscale",
"numpy.sum",
"bbpipe.PipelineStage.main",
"matplotlib.pyplot.figure",
"getdist.MCSamples",
"numpy.diag",
"matplotlib.pyplot.close",
"dominate.tags.link",
"matplotlib.pyplot.errorbar",
"dominate.tags.h1",
"numpy.ones_like",
"matplotlib.py... | [((138, 159), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (152, 159), False, 'import matplotlib\n'), ((11386, 11406), 'bbpipe.PipelineStage.main', 'PipelineStage.main', ([], {}), '()\n', (11404, 11406), False, 'from bbpipe import PipelineStage\n'), ((952, 991), 'dominate.document', 'dom.docume... |
# Finite Decks, Aces = reactive
# this program just uses the count information to maximize score.
import numpy as np
import matplotlib.pyplot as plt
import random
from rl_tools import (
simulation,
scorecalc,
countcalc,
initializedrawpile,
actionupdate,
acecheck,
cardvalue,
... | [
"rl_tools.initializedrawpile",
"matplotlib.pyplot.show",
"numpy.sum",
"rl_tools.twist",
"rl_tools.simulation",
"numpy.asarray",
"numpy.zeros",
"rl_tools.countcalc",
"numpy.append",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"numpy.array",
"rl_tools.newcard"
] | [((432, 452), 'numpy.zeros', 'np.zeros', (['(34, 2, 5)'], {}), '((34, 2, 5))\n', (440, 452), True, 'import numpy as np\n'), ((640, 660), 'numpy.zeros', 'np.zeros', (['(34, 2, 5)'], {}), '((34, 2, 5))\n', (648, 660), True, 'import numpy as np\n'), ((906, 918), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', ... |
# Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
import numpy as np
from ignite.metrics import Metric
def softmax(logit):
e_x = np.exp(logit - np.max(logit))
return e_x / e_x.sum()
def sigmoid(logit):
return 1 / (1 + np.exp(-logit))
class Hitat1(Metric):
"""
Performs a ... | [
"numpy.stack",
"numpy.average",
"numpy.argmax",
"numpy.any",
"numpy.argsort",
"numpy.max",
"numpy.cumsum",
"numpy.arange",
"numpy.exp",
"numpy.concatenate"
] | [((2169, 2184), 'numpy.stack', 'np.stack', (['preds'], {}), '(preds)\n', (2177, 2184), True, 'import numpy as np\n'), ((2200, 2214), 'numpy.stack', 'np.stack', (['acts'], {}), '(acts)\n', (2208, 2214), True, 'import numpy as np\n'), ((2239, 2259), 'numpy.any', 'np.any', (['acts'], {'axis': '(1)'}), '(acts, axis=1)\n', ... |
import numpy as np
import tensorflow as tf
class BatchRollout:
def __init__(self, env, max_episode_steps):
self.env = env
self.max_episode_steps = max_episode_steps
def __call__(self, policy, episodes, render=False):
assert len(self.env) == episodes
observation_space = self.e... | [
"tensorflow.convert_to_tensor",
"numpy.where",
"numpy.zeros",
"numpy.all"
] | [((410, 521), 'numpy.zeros', 'np.zeros', ([], {'shape': '((episodes, self.max_episode_steps) + observation_space.shape)', 'dtype': 'observation_space.dtype'}), '(shape=(episodes, self.max_episode_steps) + observation_space.shape,\n dtype=observation_space.dtype)\n', (418, 521), True, 'import numpy as np\n'), ((571, ... |
from typing import Callable
import numpy as np
def newtonSolver(f: Callable, f_prime: Callable, guess: float,
tol: float=10e-6, prev: float=0) -> float:
"""Newton method solver for 1 dimension, implemented recursively.
Arguments:
f {Callable} -- Objective function (must have zero... | [
"numpy.abs"
] | [((903, 923), 'numpy.abs', 'np.abs', (['(x_old - prev)'], {}), '(x_old - prev)\n', (909, 923), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
#%%
######################################################
# libraries
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import AxesGrid
import math
from scipy import stats
# matplotlib params
mpl.rcParams["axes.titlesiz... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"numpy.arange",
"pandas.Grouper",
"matplotlib.pyplot.xlabel",
"scipy.stats.lognorm.pdf",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.set_cmap",
"matplotlib.pyplot.subplots",
"scipy.stats.kstest",
"numpy.size",
"ma... | [((598, 686), 'pandas.read_csv', 'pd.read_csv', (['infile'], {'encoding': '"""utf-8"""', 'index_col': 'None', 'header': '(0)', 'lineterminator': '"""\n"""'}), "(infile, encoding='utf-8', index_col=None, header=0,\n lineterminator='\\n')\n", (609, 686), True, 'import pandas as pd\n'), ((1883, 1926), 'pandas.crosstab'... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib.camera.camera import CameraInfoPacket, catesian2homogenous
import ipdb
import copy
import json
import numpy as np
from camera_augmentation import h36m_cameras_intrinsic_params
from camera_augmentation import init_camera_h36m... | [
"camera_augmentation.get_intrinsic",
"json.dump",
"copy.deepcopy",
"numpy.load",
"numpy.savez",
"lib.camera.camera.catesian2homogenous",
"os.path.dirname",
"camera_augmentation.rotate_camera",
"camera_augmentation.check_in_frame",
"camera_augmentation.camera_translation",
"lib.camera.camera.Came... | [((1249, 1267), 'camera_augmentation.init_camera_h36m', 'init_camera_h36m', ([], {}), '()\n', (1265, 1267), False, 'from camera_augmentation import init_camera_h36m, get_camera_pose, camera_translation, mkdirs\n'), ((1286, 1314), 'camera_augmentation.get_camera_pose', 'get_camera_pose', (['camera_info'], {}), '(camera_... |
# basics
from typing import List, Tuple, DefaultDict, Dict, Union
from collections import defaultdict
import pandas as pd
import numpy as np
# pytorch
import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
#segnlp
from segnlp import utils
class DirLinkLabeler(nn.Module):
... | [
"pandas.DataFrame",
"numpy.zeros_like",
"segnlp.utils.np_cumsum_zero",
"torch.nn.functional.cross_entropy",
"segnlp.utils.ensure_numpy",
"torch.nn.Linear",
"torch.max",
"numpy.logical_or",
"numpy.repeat",
"segnlp.utils.init_weights",
"torch.logical_and"
] | [((1376, 1410), 'torch.nn.Linear', 'nn.Linear', (['input_size', 'output_size'], {}), '(input_size, output_size)\n', (1385, 1410), True, 'import torch.nn as nn\n'), ((1419, 1456), 'segnlp.utils.init_weights', 'utils.init_weights', (['self', 'weight_init'], {}), '(self, weight_init)\n', (1437, 1456), False, 'from segnlp ... |
import logging
import numpy as np
import pandas as pd
from sklearn import linear_model
RESOURCE_DIR = '/home/lucasx/PycharmProjects/DataHouse/DataSet/'
logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s \t', level=logging.INFO, filemode='a',
filename='loginfo.log')
def train_and_p... | [
"sklearn.externals.joblib.dump",
"numpy.concatenate",
"logging.basicConfig",
"pandas.read_excel",
"logging.info",
"numpy.array",
"sklearn.externals.joblib.load",
"numpy.array_split",
"sklearn.linear_model.Lasso"
] | [((154, 286), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(asctime)s:%(message)s \t"""', 'level': 'logging.INFO', 'filemode': '"""a"""', 'filename': '"""loginfo.log"""'}), "(format='%(levelname)s:%(asctime)s:%(message)s \\t',\n level=logging.INFO, filemode='a', filename='loginfo.... |
from .. import moment
from .. import mhealth_format as mh
import numpy as np
import pkg_resources
import pandas as pd
from loguru import logger
def _get_annotation_durations(annot_df):
durations = annot_df.groupby(annot_df.columns[3]).apply(
lambda rows: np.sum(rows.iloc[:, 2] - rows.iloc[:, 1]))
retu... | [
"numpy.sum",
"pandas.DataFrame.from_dict",
"pandas.read_csv",
"loguru.logger.warning",
"pkg_resources.resource_filename",
"numpy.timedelta64"
] | [((4347, 4419), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""arus"""', '"""spades_lab/task_class_map.csv"""'], {}), "('arus', 'spades_lab/task_class_map.csv')\n", (4378, 4419), False, 'import pkg_resources\n'), ((4440, 4465), 'pandas.read_csv', 'pd.read_csv', (['map_filepath'], {}), '(map... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 13:31:37 2019
@author: gsolana
Based on:
https://github.com/sam-cox/pytides/wiki/How-to-make-your-own-Tide-Table-using-Python-and-Pytides
https://ocefpaf.github.io/python4oceanographers/blog/2014/07/07/pytides/
"""
import csv
import numpy as np... | [
"pandas.DataFrame",
"matplotlib.pyplot.subplot",
"pytides.tide.Tide.decompose",
"csv.reader",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"datetime.datetime.strptime",
"pandas.to_datetime",
"numpy.array",
"datetime.timedelta",
"matplotlib.pyplot.savefig"
] | [((828, 848), 'csv.reader', 'csv.reader', (['csv_file'], {}), '(csv_file)\n', (838, 848), False, 'import csv\n'), ((1731, 1770), 'csv.reader', 'csv.reader', (['csv_file2011'], {'delimiter': '""","""'}), "(csv_file2011, delimiter=',')\n", (1741, 1770), False, 'import csv\n'), ((2620, 2795), 'pandas.read_csv', 'read_csv'... |
#!/usr/bin/env python3
'''
Code by <NAME>, <<EMAIL>>
based on "How to Share a Secret" by <NAME>
Published by :Communications of the ACM
November 1979, Volume 22, Num. 11
'''
import numpy as np
import random
def split_secret(secret, k, n):
'''
Secret in an integer
k is the minimum number of keys to get ... | [
"numpy.linalg.solve",
"numpy.array",
"random.randrange"
] | [((1611, 1622), 'numpy.array', 'np.array', (['A'], {}), '(A)\n', (1619, 1622), True, 'import numpy as np\n'), ((1631, 1642), 'numpy.array', 'np.array', (['D'], {}), '(D)\n', (1639, 1642), True, 'import numpy as np\n'), ((1651, 1672), 'numpy.linalg.solve', 'np.linalg.solve', (['a', 'd'], {}), '(a, d)\n', (1666, 1672), T... |
import numpy as np
id = None
with open('set_splits/bboxes_train_val_test_split_3buckets.csv', 'r') as bboxes:
count_boxes = []
boxes = 0
for line in bboxes:
filename, x1, y1, x2, y2, class_name, bucket, set = line.strip().split(',')
new_id = filename.split('_')[0]
if no... | [
"numpy.mean",
"numpy.array"
] | [((542, 563), 'numpy.array', 'np.array', (['count_boxes'], {}), '(count_boxes)\n', (550, 563), True, 'import numpy as np\n'), ((574, 589), 'numpy.mean', 'np.mean', (['np_arr'], {}), '(np_arr)\n', (581, 589), True, 'import numpy as np\n')] |
import numpy as np
from numpy.linalg import norm
from funcs.general_functions import *
from Topologies.Icosahedron import getNewBaseIcosahedron, subdivide
from funcs.general_functions import getFlatAngle
LABEL = "Truncated Icosahedron"
OPERATOR = "mesh.create_truncated_icosahedron"
# create operator
class MESH_OT_... | [
"Topologies.Icosahedron.subdivide",
"numpy.cross",
"numpy.linalg.norm",
"numpy.array",
"numpy.dot",
"Topologies.Icosahedron.getNewBaseIcosahedron",
"funcs.general_functions.getFlatAngle"
] | [((1778, 1807), 'Topologies.Icosahedron.getNewBaseIcosahedron', 'getNewBaseIcosahedron', (['radius'], {}), '(radius)\n', (1799, 1807), False, 'from Topologies.Icosahedron import getNewBaseIcosahedron, subdivide\n'), ((1871, 1904), 'Topologies.Icosahedron.subdivide', 'subdivide', (['bm', 'iterations', 'radius'], {}), '(... |
# This file is public domain, it can be freely copied without restrictions.
# SPDX-License-Identifier: CC0-1.0
import numpy as np
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import FallingEdge, Timer
import sys
sys.path.append('../../../py/')
import pdm
WINDOW_LEN = 250
def get_msg(i, receive... | [
"sys.path.append",
"cocotb.clock.Clock",
"pdm.pcm_to_pdm_pwm",
"cocotb.triggers.Timer",
"cocotb.test",
"cocotb.triggers.FallingEdge",
"numpy.random.randint",
"numpy.linspace",
"pdm.pdm_to_pcm",
"numpy.cos"
] | [((236, 267), 'sys.path.append', 'sys.path.append', (['"""../../../py/"""'], {}), "('../../../py/')\n", (251, 267), False, 'import sys\n'), ((2134, 2147), 'cocotb.test', 'cocotb.test', ([], {}), '()\n', (2145, 2147), False, 'import cocotb\n'), ((502, 522), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'n'], {}), '(0... |
import numpy as np
from numpy.polynomial import polynomial as poly
import scipy.signal as signal
import matplotlib.pyplot as plt
# Component values
GAIN = 1.0
R6 = 10e3
Ra = 100e3 * GAIN
R10b = 2e3 + 100e3 * (1-GAIN)
R11 = 15e3
R12 = 422e3
C3 = 0.1e-6
C5 = 68e-9
C7 = 82e-9
C8 = 390e-12
a0s = C7 * C8 * R10b * R11 *... | [
"numpy.logspace",
"matplotlib.pyplot.show",
"numpy.finfo"
] | [((613, 623), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (621, 623), True, 'import matplotlib.pyplot as plt\n'), ((503, 530), 'numpy.logspace', 'np.logspace', (['(1.3)', '(4.3)', '(1000)'], {}), '(1.3, 4.3, 1000)\n', (514, 530), True, 'import numpy as np\n'), ((590, 605), 'numpy.finfo', 'np.finfo', (['floa... |
import numpy as np
from sklearn.manifold import TSNE
from keyphrase.dataset import keyphrase_test_dataset
from keyphrase.dataset.keyphrase_test_dataset import testing_data_loader
from emolga.dataset.build_dataset import deserialize_from_file, serialize_to_file
from keyphrase.config import *
# We'll use matplotlib for... | [
"seaborn.set_style",
"numpy.set_printoptions",
"matplotlib.pyplot.show",
"sklearn.manifold.TSNE",
"keyphrase.dataset.keyphrase_test_dataset.load_additional_testing_data",
"matplotlib.pyplot.annotate",
"matplotlib.pyplot.scatter",
"numpy.asarray",
"emolga.dataset.build_dataset.deserialize_from_file",... | [((489, 514), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (502, 514), True, 'import seaborn as sns\n'), ((515, 539), 'seaborn.set_palette', 'sns.set_palette', (['"""muted"""'], {}), "('muted')\n", (530, 539), True, 'import seaborn as sns\n'), ((540, 612), 'seaborn.set_context', 'sn... |
import os
import typing
import pickle
import fasttext
import numpy as np
import tensorflow as tf
from utils import text_preprocessing
from utils import logging
logger = logging.getLogger()
PADDING_TOKEN = '<pad>'
UNKNOWN_TOKEN = '<unk>'
SAVED_MODEL_DIR = 'saved_model'
SHARED_PATH = '/project/cq-training-1/project2/... | [
"os.mkdir",
"os.path.join",
"numpy.concatenate",
"numpy.argmax",
"fasttext.train_unsupervised",
"os.path.exists",
"utils.text_preprocessing.process",
"tensorflow.TensorShape",
"numpy.argsort",
"tensorflow.cast",
"fasttext.load_model",
"numpy.array",
"utils.text_preprocessing.recapitalize",
... | [((172, 191), 'utils.logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (189, 191), False, 'from utils import logging\n'), ((1067, 1102), 'os.path.join', 'os.path.join', (['SAVED_MODEL_DIR', 'name'], {}), '(SAVED_MODEL_DIR, name)\n', (1079, 1102), False, 'import os\n'), ((1428, 1520), 'os.path.join', 'os.path.j... |
import matplotlib.pyplot as plt
from sympy import symbols,diff
#from mpl_toolkits.mplot3d.axes3d import Axes3D
from matplotlib import cm
import numpy as np
def f(x,y):
r=3**(-x*x -y*y)
return 1/(r+1)
def doFit():
a, b = symbols('x, y')
multiplier = 0.1
max_iter = 900
params = np.array([-3.0, 1... | [
"sympy.symbols",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.linspace"
] | [((838, 876), 'numpy.linspace', 'np.linspace', ([], {'start': '(-2)', 'stop': '(2)', 'num': '(200)'}), '(start=-2, stop=2, num=200)\n', (849, 876), True, 'import numpy as np\n'), ((877, 915), 'numpy.linspace', 'np.linspace', ([], {'start': '(-2)', 'stop': '(2)', 'num': '(200)'}), '(start=-2, stop=2, num=200)\n', (888, ... |
from utils import sample_utils as su, config, parse_midas_data, stats_utils, sfs_utils
import pylab, sys, numpy as np, random, math
from utils import temporal_changes_utils
from collections import defaultdict
import bz2
import pickle
adir = config.analysis_directory
ddir = config.data_directory
pdir = "%s/pickles" % c... | [
"utils.parse_midas_data.load_pickled_good_species_list",
"collections.defaultdict",
"numpy.array",
"utils.sample_utils.get_mi_tp_sample_dict",
"matplotlib.pyplot.subplots"
] | [((382, 431), 'utils.parse_midas_data.load_pickled_good_species_list', 'parse_midas_data.load_pickled_good_species_list', ([], {}), '()\n', (429, 431), False, 'from utils import sample_utils as su, config, parse_midas_data, stats_utils, sfs_utils\n'), ((1292, 1309), 'collections.defaultdict', 'defaultdict', (['dict'], ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
QUANDLKEY = '<ENTER YOUR QUANDLKEY HERE>'
"""
Created on Thu Oct 25 23:19:44 2018
@author: jeff
"""
'''*************************************
#1. Import libraries and key varable values
'''
import quandl
import plotly
import plotly.graph_objs as go
import numpy as np
fro... | [
"h5py.File",
"os.remove",
"os.path.dirname",
"os.path.exists",
"numpy.zeros",
"plotly.offline.plot",
"quandl.get_table",
"plotly.graph_objs.Candlestick",
"PIL.Image.fromarray",
"os.path.join",
"numpy.vstack"
] | [((791, 816), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (806, 816), False, 'import os\n'), ((830, 866), 'os.path.join', 'os.path.join', (['folder_path', '"""dataset"""'], {}), "(folder_path, 'dataset')\n", (842, 866), False, 'import os\n'), ((879, 915), 'os.path.join', 'os.path.join', ([... |
# PACKAGES
import numpy as np
import os
from scipy import stats as ss
import pickle
import h5py
import pandas as pd
from configs import *
path_to_results_folder = "%sresults/"%CV_save_path
path_to_preds_folder = "%spredictions/"%CV_save_path
path_to_final_chosen_models = "%sfinal_models_chosen/"%CV_save_path
if ... | [
"h5py.File",
"os.makedirs",
"os.path.isdir",
"pandas.read_csv",
"numpy.zeros",
"scipy.stats.rankdata",
"numpy.argmin",
"numpy.isnan",
"numpy.min",
"numpy.array",
"numpy.nanvar",
"os.listdir",
"numpy.nanmean"
] | [((2245, 2308), 'os.listdir', 'os.listdir', (["(path_to_results_folder + 'MTL/' + split_pca_dataset)"], {}), "(path_to_results_folder + 'MTL/' + split_pca_dataset)\n", (2255, 2308), False, 'import os\n'), ((324, 366), 'os.path.isdir', 'os.path.isdir', (['path_to_final_chosen_models'], {}), '(path_to_final_chosen_models... |
import numpy as np
import pandas as pd
import copy
import scipy.stats
from sklearn.metrics import mean_squared_error
from sklearn.ensemble import RandomForestRegressor
"""
define basic functions for AFT1
"""
def search_path(estimator, y_threshold):
"""
return path index list containing
[{leaf node id, ine... | [
"copy.deepcopy",
"numpy.where",
"numpy.array",
"numpy.unique"
] | [((3546, 3562), 'copy.deepcopy', 'copy.deepcopy', (['x'], {}), '(x)\n', (3559, 3562), False, 'import copy\n'), ((3586, 3617), 'numpy.unique', 'np.unique', (["path_info['feature']"], {}), "(path_info['feature'])\n", (3595, 3617), True, 'import numpy as np\n'), ((4761, 4777), 'copy.deepcopy', 'copy.deepcopy', (['x'], {})... |
#!/usr/bin/env python2
from __future__ import print_function
import roslib
import sys
import rospy
import numpy as np
import datetime
import time
import os
import pickle
from geometry_msgs.msg import PoseArray
from geometry_msgs.msg import Pose
from geometry_msgs.msg import PoseWithCovariance
from std_msgs.msg import B... | [
"dse_lib.pose_from_state_3D",
"dse_lib.sub_matrix",
"rospy.Subscriber",
"rospy.Time.now",
"os.path.join",
"dse_lib.state_from_pose_3D",
"rospy.signal_shutdown",
"rospy.get_param",
"roslib.load_manifest",
"numpy.where",
"numpy.array",
"rospy.init_node",
"numpy.linalg.inv",
"rospy.spin",
"... | [((822, 860), 'roslib.load_manifest', 'roslib.load_manifest', (['"""dse_simulation"""'], {}), "('dse_simulation')\n", (842, 860), False, 'import roslib\n'), ((6055, 6107), 'rospy.init_node', 'rospy.init_node', (['"""dse_plotting_node"""'], {'anonymous': '(True)'}), "('dse_plotting_node', anonymous=True)\n", (6070, 6107... |
import numpy as np
class Atom:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
self.type = 1
self.vx = 0.0
self.vy = 0.0
self.vz = 0.0
def save_file(filename, atoms, lo, hi):
with open(filename, "w") as f:
f.write(... | [
"numpy.arange"
] | [((1017, 1037), 'numpy.arange', 'np.arange', (['lo', 'hi', '(1)'], {}), '(lo, hi, 1)\n', (1026, 1037), True, 'import numpy as np\n')] |
import numpy as np
import matplotlib.pyplot as plt
from glsl_helpers import *
degtorad = lambda a: a / 180.0 * np.pi
def smooth_step(x, threshold, steepness):
return 1.0 / (1.0 + exp(-(x - threshold) * steepness))
def trace_u(pos, ray, path):
n_steps = path.shape[0]
u0 = 1.0 / length(pos)
u = u0
... | [
"matplotlib.pyplot.xlim",
"numpy.arctan2",
"numpy.sum",
"matplotlib.pyplot.plot",
"numpy.ravel",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.show",
"numpy.zeros",
"numpy.isfinite",
"numpy.where",
"numpy.sin",
"numpy.cos",
"numpy.interp"
] | [((1837, 1873), 'numpy.arctan2', 'np.arctan2', (['diffs[:, 1]', 'diffs[:, 0]'], {}), '(diffs[:, 1], diffs[:, 0])\n', (1847, 1873), True, 'import numpy as np\n'), ((2498, 2550), 'numpy.interp', 'np.interp', (['threshold', '[y[i1], y[i0]]', '[x[i1], x[i0]]'], {}), '(threshold, [y[i1], y[i0]], [x[i1], x[i0]])\n', (2507, 2... |
import numpy as np
from opfython.math import distance
from opfython.stream import loader, parser
from opfython.subgraphs import knn
csv = loader.load_csv('data/boat.csv')
X, Y = parser.parse_loader(csv)
def test_knn_subgraph_n_clusters():
subgraph = knn.KNNSubgraph(X, Y)
assert subgraph.n_clusters == 0
d... | [
"opfython.subgraphs.knn.KNNSubgraph",
"opfython.stream.parser.parse_loader",
"numpy.ones",
"opfython.stream.loader.load_csv"
] | [((140, 172), 'opfython.stream.loader.load_csv', 'loader.load_csv', (['"""data/boat.csv"""'], {}), "('data/boat.csv')\n", (155, 172), False, 'from opfython.stream import loader, parser\n'), ((180, 204), 'opfython.stream.parser.parse_loader', 'parser.parse_loader', (['csv'], {}), '(csv)\n', (199, 204), False, 'from opfy... |
from matplotlib import cm, rcParams
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib as matplotlib
import numpy as np
import math as math
import random as rand
import os, sys, csv
import pandas as pd
#matplotlib.pyplot.xkcd(scale=.5, length=100, randomness=2)
c = ['#aa3863', '#d9702... | [
"numpy.random.seed",
"matplotlib.pyplot.show",
"math.sqrt",
"matplotlib.pyplot.ylim",
"numpy.random.randn",
"matplotlib.pyplot.subplots",
"numpy.array",
"pandas.Series",
"numpy.linspace",
"matplotlib.pyplot.tight_layout"
] | [((436, 452), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (450, 452), True, 'import numpy as np\n'), ((4708, 4729), 'pandas.Series', 'pd.Series', (['phis1_corr'], {}), '(phis1_corr)\n', (4717, 4729), True, 'import pandas as pd\n'), ((4743, 4764), 'pandas.Series', 'pd.Series', (['phis2_corr'], {}), '(phis2_... |
import torch
from ue4nlp.dropconnect_mc import (
LinearDropConnectMC,
activate_mc_dropconnect,
convert_to_mc_dropconnect,
hide_dropout,
)
from ue4nlp.dropout_mc import DropoutMC, activate_mc_dropout, convert_to_mc_dropout
from utils.utils_dropout import set_last_dropout, get_last_dropout, set_last_dropc... | [
"ue4nlp.dropconnect_mc.activate_mc_dropconnect",
"numpy.argmin",
"ue4nlp.mahalanobis_distance.compute_covariance",
"ue4nlp.mahalanobis_distance.compute_centroids",
"utils.utils_heads.BertClassificationHeadIdentityPooler",
"utils.utils_inference.is_custom_head",
"ue4nlp.dropconnect_mc.convert_to_mc_dropc... | [((893, 912), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (910, 912), False, 'import logging\n'), ((1482, 1556), 'ue4nlp.dropconnect_mc.convert_to_mc_dropconnect', 'convert_to_mc_dropconnect', (['model.electra.encoder', "{'Linear': dropout_ctor}"], {}), "(model.electra.encoder, {'Linear': dropout_ctor})... |
import os
import errno
import numpy as np
import tensorflow as tf
def create_path(path):
"""Create path if not exist"""
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
def conv_layer(name, input_tensor, ksize, num_out_channels, keep... | [
"numpy.random.seed",
"os.makedirs",
"tensorflow.nn.conv2d",
"numpy.random.choice",
"numpy.round",
"numpy.random.shuffle"
] | [((616, 688), 'tensorflow.nn.conv2d', 'tf.nn.conv2d', (['input_tensor', 'conv_filter', '[1, 1, 1, 1]', '"""SAME"""'], {'name': 'name'}), "(input_tensor, conv_filter, [1, 1, 1, 1], 'SAME', name=name)\n", (628, 688), True, 'import tensorflow as tf\n'), ((1251, 1279), 'numpy.random.seed', 'np.random.seed', (['random_state... |
#! /usr/bin/env python
#################################################################################
# File Name : IPADS_GraphX_Plot_Partition_2.py
# Created By : xd
# Creation Date : [2014-08-14 22:09]
# Last Modified : [2014-08-14 22:11]
# Descrip... | [
"matplotlib.pyplot.title",
"matplotlib.cm.Paired",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.arange",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig"
] | [((693, 702), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (700, 702), True, 'import matplotlib.pyplot as plt\n'), ((768, 780), 'numpy.arange', 'np.arange', (['N'], {}), '(N)\n', (777, 780), True, 'import numpy as np\n'), ((1147, 1165), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['ylabel'], {}), '(ylabel)\n', ... |
# -*- coding: utf-8 -*-
import numpy as np
from chainercv.visualizations import vis_bbox as chainer_vis_bbox
def vis_bbox(img, bbox, label=None, score=None, label_names=None, ax=None):
"""A wrapper of chainer function for visualizing bbox inside image.
Args:
img (~torch.tensor):
an image ... | [
"numpy.uint8"
] | [((915, 934), 'numpy.uint8', 'np.uint8', (['(img * 255)'], {}), '(img * 255)\n', (923, 934), True, 'import numpy as np\n')] |
import os
import os.path as osp
import yaml
from operator import concat, sub
from utils.raw_utils import convert,scale,diff
from utils.io import imread, imwrite,get_exif,get_trip,raw2rgbg,mdwrite,raw_read_rgb,check_exif,extract_exif
from utils.isp import rgbg2linref, rgbg2srgb,rgbg2rgb
from utils.path import be,bj,mkdi... | [
"pprint.pformat",
"numpy.histogram",
"utils.io.imwrite",
"os.path.join",
"utils.io.raw_read_rgb",
"utils.io.imread",
"cv2.imwrite",
"utils.io.check_exif",
"utils.path.mkdir",
"rawpy.imread",
"pandas.concat",
"cv2.resize",
"utils.io.get_exif",
"multiprocessing.Pool",
"utils.io.parse_tripr... | [((1023, 1041), 'utils.io.check_exif', 'check_exif', (['inputs'], {}), '(inputs)\n', (1033, 1041), False, 'from utils.io import imread, imwrite, get_exif, get_trip, raw2rgbg, mdwrite, raw_read_rgb, check_exif, extract_exif\n'), ((1597, 1620), 'utils.io.imwrite', 'imwrite', (['outputs[3]', 'fo'], {}), '(outputs[3], fo)\... |
# -*- coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Jul 1, 2014
Deconvolutional layer.
████████████████... | [
"numpy.ceil",
"veles.ocl_blas.OCLBLAS.attach_to_device",
"zope.interface.implementer",
"numpy.zeros",
"numpy.ones",
"veles.compat.from_none",
"veles.memory.Array",
"numpy.prod"
] | [((1689, 1736), 'zope.interface.implementer', 'implementer', (['IOpenCLUnit', 'ICUDAUnit', 'INumpyUnit'], {}), '(IOpenCLUnit, ICUDAUnit, INumpyUnit)\n', (1700, 1736), False, 'from zope.interface import implementer\n'), ((3993, 4000), 'veles.memory.Array', 'Array', ([], {}), '()\n', (3998, 4000), False, 'from veles.memo... |
# @Author: <NAME> <narsi>
# @Date: 2018-11-12T14:06:36-06:00
# @Last modified by: narsi
# @Last modified time: 2019-01-27T20:55:47-06:00
import numpy as np
import torch
import torch.nn as nn
import torch.nn.init as init
'''
https://gist.github.com/jeasinema/ed9236ce743c8efaf30fa2ff732749f5
'''
def weight_init(m):
... | [
"torch.nn.init.normal",
"torch.nn.init.constant_",
"torch.nn.init.orthogonal",
"numpy.sqrt"
] | [((445, 471), 'torch.nn.init.normal', 'init.normal', (['m.weight.data'], {}), '(m.weight.data)\n', (456, 471), True, 'import torch.nn.init as init\n'), ((497, 521), 'torch.nn.init.normal', 'init.normal', (['m.bias.data'], {}), '(m.bias.data)\n', (508, 521), True, 'import torch.nn.init as init\n'), ((677, 707), 'torch.n... |
import carla
from __init__ import client, world
from TB_common_functions import wraptopi, calculateDistance, AgentColourToRGB
from path_planner_suite import astar_search, find_nearest
from shapely.geometry import LineString
import math
import numpy as np
import matplotlib.pyplot as plt
class vehicle_manual():
def __... | [
"numpy.fmin",
"TB_common_functions.AgentColourToRGB",
"math.radians",
"numpy.array",
"carla.VehicleControl"
] | [((2012, 2076), 'numpy.array', 'np.array', (['[agent_velocity.x, agent_velocity.y, agent_velocity.z]'], {}), '([agent_velocity.x, agent_velocity.y, agent_velocity.z])\n', (2020, 2076), True, 'import numpy as np\n'), ((2556, 2578), 'carla.VehicleControl', 'carla.VehicleControl', ([], {}), '()\n', (2576, 2578), False, 'i... |
#===============================WIMPFuncs.py===================================#
# Created by <NAME> 2020
# Contains all the functions for doing the WIMPy calculations
#==============================================================================#
import numpy as np
from numpy import pi, sqrt, exp, zeros, size, sha... | [
"LabFuncs.LabVelocity",
"numpy.ones",
"numpy.shape",
"numpy.sin",
"numpy.exp",
"LabFuncs.LabVelocitySimple",
"numpy.meshgrid",
"LabFuncs.efficiency",
"numpy.linspace",
"LabFuncs.FormFactorHelm",
"numpy.log10",
"numpy.trapz",
"numpy.size",
"scipy.special.erf",
"Params.WIMP",
"numpy.cos"... | [((1528, 1560), 'LabFuncs.LabVelocitySimple', 'LabFuncs.LabVelocitySimple', (['(67.0)'], {}), '(67.0)\n', (1554, 1560), False, 'import LabFuncs\n'), ((2213, 2240), 'Params.WIMP', 'Params.WIMP', (['m_chi', 'sigma_p'], {}), '(m_chi, sigma_p)\n', (2224, 2240), False, 'import Params\n'), ((2618, 2646), 'numpy.trapz', 'trap... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020-2022 INRAE
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, ... | [
"osgeo.osr.CoordinateTransformation",
"numpy.transpose",
"osgeo.gdal.SetConfigOption",
"osgeo.gdal.Open",
"osgeo.osr.SpatialReference",
"osgeo.gdal.AllRegister"
] | [((1412, 1431), 'osgeo.gdal.Open', 'gdal.Open', (['filename'], {}), '(filename)\n', (1421, 1431), False, 'from osgeo import gdal, osr\n'), ((1776, 1828), 'osgeo.gdal.SetConfigOption', 'gdal.SetConfigOption', (['"""GDAL_CACHEMAX"""', 'gdal_cachemax'], {}), "('GDAL_CACHEMAX', gdal_cachemax)\n", (1796, 1828), False, 'from... |
import face_recognition
from deepface import DeepFace
import cv2
import numpy as np
from tensorflow.keras.preprocessing import image
import pyscreenshot as ImageGrab
model = ""
def preprocess_img(img, target_size=(224,224)):
img = cv2.resize(img, target_size)
img_pixels = image.img_to_array(img)
img_pixel... | [
"numpy.argmax",
"pyscreenshot.grab",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"deepface.DeepFace.build_model",
"face_recognition.face_locations",
"face_recognition.load_image_file",
"cv2.resize"
] | [((237, 265), 'cv2.resize', 'cv2.resize', (['img', 'target_size'], {}), '(img, target_size)\n', (247, 265), False, 'import cv2\n'), ((283, 306), 'tensorflow.keras.preprocessing.image.img_to_array', 'image.img_to_array', (['img'], {}), '(img)\n', (301, 306), False, 'from tensorflow.keras.preprocessing import image\n'), ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.