code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
This module defines some functions aiming at describing subcavities
and caracterize their shapes
"""
import os
import numpy as np
from scipy import ndimage
from skimage.feature import peak_local_max
from skimage.morphology import watershed
from caviar.cavity_identification.gridtools import ... | [
"os.mkdir",
"numpy.sum",
"skimage.feature.peak_local_max",
"numpy.argmax",
"numpy.around",
"scipy.spatial.cKDTree",
"numpy.round",
"caviar.cavity_identification.gridtools.get_index_of_coor_list",
"numpy.unique",
"scipy.ndimage.distance_transform_edt",
"scipy.spatial.distance.cdist",
"numpy.div... | [((2728, 2748), 'numpy.zeros', 'np.zeros', (['grid_shape'], {}), '(grid_shape)\n', (2736, 2748), True, 'import numpy as np\n'), ((3780, 3910), 'scipy.ndimage.distance_transform_edt', 'ndimage.distance_transform_edt', (['im3d'], {'sampling': 'None', 'return_distances': '(True)', 'return_indices': '(False)', 'distances':... |
import ltfatpy
import numpy as np
__author__ = 'Andres'
class LTFATStft(object):
def __init__(self, windowLength, hopSize):
super().__init__()
self.windowLength = windowLength
self.hopSize = hopSize
self.g_analysis = {'name': 'gauss', 'M': windowLength}
self.g_synthesis = ... | [
"numpy.abs",
"numpy.angle",
"ltfatpy.dgtreal",
"numpy.clip",
"ltfatpy.idgtreal",
"numpy.max",
"numpy.exp"
] | [((1688, 1703), 'numpy.abs', 'np.abs', (['realDGT'], {}), '(realDGT)\n', (1694, 1703), True, 'import numpy as np\n'), ((443, 516), 'ltfatpy.dgtreal', 'ltfatpy.dgtreal', (['signal', 'self.g_analysis', 'self.hopSize', 'self.windowLength'], {}), '(signal, self.g_analysis, self.hopSize, self.windowLength)\n', (458, 516), F... |
#!/usr/bin/env python
"""
========================
Polynomial interpolation
========================
This example demonstrates how to approximate a function with a polynomial of
degree n_degree by using ridge regression. Concretely, from n_samples 1d
points, it suffices to build the Vandermonde matrix, which is n_samp... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"numpy.random.RandomState",
"numpy.sort",
"sklearn.preprocessing.PolynomialFeatures",
"numpy.sin",
"numpy.linspace",
"sklearn.linear_model.Ridge"
] | [((1274, 1297), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (1285, 1297), True, 'import numpy as np\n'), ((1347, 1370), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (1358, 1370), True, 'import numpy as np\n'), ((1377, 1401), 'numpy.random.Rand... |
#! /usr/bin/python3
# coding: utf-8
"""Matplotlib QtDesigner Widget."""
import numpy as np
import matplotlib.image as image
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSignal
from matplotlib.figure import Figure
from matplotlib.collections import LineCollection
from matplotlib.backends.backend_qt5agg i... | [
"PyQt5.QtCore.pyqtSignal",
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.setSizePolicy",
"matplotlib.image.imread",
"matplotlib.collections.LineCollection",
"numpy.absolute",
"numpy.asarray",
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.updateGeometry",
"PyQt5.QtWidgets.QVBoxLayout",
... | [((461, 510), 'numpy.concatenate', 'np.concatenate', (['[points[:-1], points[1:]]'], {'axis': '(1)'}), '([points[:-1], points[1:]], axis=1)\n', (475, 510), True, 'import numpy as np\n'), ((609, 621), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (619, 621), False, 'from PyQt5.QtCore import pyqtSignal\n'), ... |
# RBM class
'''
Adapted from code by <NAME> and <NAME>
Available at: http://science.sciencemag.org/content/suppl/2006/08/04/313.5786.504.DC1
A class defining a restricted Boltzmann machine.
'''
import numpy as np
import random
import matplotlib.pyplot as plt
from numba import jit, prange
learning_r... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"numpy.empty",
"numpy.isnan",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.exp",
"numpy.random.normal",
"numba.prange",
"matplotlib.pyplot.tight_layout",
"numpy.full",
"numpy.savetxt",
"numpy.empty_like",
"numpy.loadtxt",... | [((621, 655), 'numpy.zeros', 'np.zeros', (['(self.v_dim, self.h_dim)'], {}), '((self.v_dim, self.h_dim))\n', (629, 655), True, 'import numpy as np\n'), ((672, 697), 'numpy.zeros', 'np.zeros', (['(self.v_dim, 1)'], {}), '((self.v_dim, 1))\n', (680, 697), True, 'import numpy as np\n'), ((714, 739), 'numpy.zeros', 'np.zer... |
import numpy as np
import logging
from mtrack.solve import solve
logger = logging.getLogger(__name__)
class CoreSolver(object):
def check_forced(self, g1):
"""
Check that the number of forced egdes
incident to any vertex is <= 2 for
a given g1 graph.
"""
for v i... | [
"numpy.array",
"logging.getLogger"
] | [((76, 103), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (93, 103), False, 'import logging\n'), ((1782, 1807), 'numpy.array', 'np.array', (['[0.0, 0.0, 0.0]'], {}), '([0.0, 0.0, 0.0])\n', (1790, 1807), True, 'import numpy as np\n')] |
import numpy as np
import pandas as pd
import os
import librosa
from multiprocessing import Pool
SEED = int(1e9+7e7+17)
np.random.seed(SEED)
default_labels = ['blues']*100 + ['classical']*100 + ['country']*100 + ['disco']*100 + ['hiphop']*100 + ['jazz']*99 + ['metal']*100 + ['pop']*100 + ['reggae']*100 + ['roc... | [
"numpy.random.seed",
"os.walk",
"librosa.feature.chroma_stft",
"librosa.feature.mfcc",
"os.path.join",
"pandas.DataFrame",
"os.path.abspath",
"librosa.feature.spectral_bandwidth",
"librosa.feature.zero_crossing_rate",
"pandas.concat",
"librosa.feature.rms",
"librosa.feature.spectral_rolloff",
... | [((128, 148), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (142, 148), True, 'import numpy as np\n'), ((2197, 2214), 'numpy.array', 'np.array', (['dataset'], {}), '(dataset)\n', (2205, 2214), True, 'import numpy as np\n'), ((2554, 2567), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (2561, 256... |
"""
Visualization of a Histogram2D as a heaatmap
"""
import re
import logging
import base64
import io
import numpy as np
import scipy as sp
from PIL import Image
from progressivis.core.utils import indices_len
from progressivis.core.slot import SlotDescriptor
from progressivis.table import Table
from progressivis.table... | [
"io.BytesIO",
"progressivis.core.slot.SlotDescriptor",
"numpy.dtype",
"numpy.isnan",
"base64.b64decode",
"PIL.Image.fromarray",
"numpy.where",
"progressivis.table.Table",
"scipy.special.cbrt",
"progressivis.core.utils.indices_len",
"re.search",
"logging.getLogger"
] | [((358, 385), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (375, 385), False, 'import logging\n'), ((757, 792), 'progressivis.core.slot.SlotDescriptor', 'SlotDescriptor', (['"""array"""'], {'type': 'Table'}), "('array', type=Table)\n", (771, 792), False, 'from progressivis.core.slot imp... |
import numpy as np
import pandas as pd
import sklearn.svm
from sklearn.model_selection import train_test_split
def fitness(sol, total_features, label, split = 0.2):
feature = reduce_features(sol, total_features)
xtrain, xtest, ytrain, ytest = train_test_split(feature, label, test_size = split, random_state = 4 ... | [
"numpy.shape",
"sklearn.model_selection.train_test_split",
"numpy.random.randint",
"numpy.where"
] | [((709, 757), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)', 'high': '(2)', 'size': 'pop_shape'}), '(low=0, high=2, size=pop_shape)\n', (726, 757), True, 'import numpy as np\n'), ((251, 316), 'sklearn.model_selection.train_test_split', 'train_test_split', (['feature', 'label'], {'test_size': 'split', ... |
from .base import Source
from ..config import default_units
from ..util import make_properties
import astropy.units as u
import astropy.constants as const
import numpy as np
__all__ = ['Star']
_L0 = 3.0128E28 * u.W # https://www.iau.org/static/resolutions/IAU2015_English.pdf eq.1
_f0 = 2.518021002E-8 * u.W/u.m**2 ... | [
"numpy.log10"
] | [((670, 704), 'numpy.log10', 'np.log10', (['(luminosity / _L0).value'], {}), '((luminosity / _L0).value)\n', (678, 704), True, 'import numpy as np\n'), ((964, 998), 'numpy.log10', 'np.log10', (['(irradiance / _f0).value'], {}), '((irradiance / _f0).value)\n', (972, 998), True, 'import numpy as np\n')] |
import numpy as np
from lmfit import Model
import matplotlib.pyplot as plt
path = r'D:\data\20191206\141911_power_sweep_evaporated_drum_device'
power, fr, _, _, a ,_ = np.loadtxt(path, unpack=True)
pw = np.linspace(power[0],power[-1],31)
freq = np.split(fr, 31)[0]
data = np.split(a,31)
# def S21(f, f0... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"numpy.argmax",
"numpy.split",
"numpy.append",
"numpy.max",
"numpy.arange",
"numpy.loadtxt",
"numpy.linspace",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig"
] | [((174, 203), 'numpy.loadtxt', 'np.loadtxt', (['path'], {'unpack': '(True)'}), '(path, unpack=True)\n', (184, 203), True, 'import numpy as np\n'), ((212, 248), 'numpy.linspace', 'np.linspace', (['power[0]', 'power[-1]', '(31)'], {}), '(power[0], power[-1], 31)\n', (223, 248), True, 'import numpy as np\n'), ((285, 300),... |
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
import torchvision
import timm
from .gazenet import get_backbone
from models.backbone import *
class ITracker(nn.Module):
def __init__(self, pretrained=True):
super(ITracker, self).__init__()
self.face_bac... | [
"torchvision.ops.roi_align",
"torch.nn.ReLU",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.LayerNorm",
"torch.arange",
"torch.nn.Linear",
"torch.unbind",
"torch.matmul",
"numpy.sqrt"
] | [((1298, 1339), 'torch.cat', 'torch.cat', (['[batch_order, leye_box]'], {'dim': '(1)'}), '([batch_order, leye_box], dim=1)\n', (1307, 1339), False, 'import torch\n'), ((1360, 1401), 'torch.cat', 'torch.cat', (['[batch_order, reye_box]'], {'dim': '(1)'}), '([batch_order, reye_box], dim=1)\n', (1369, 1401), False, 'impor... |
import sys
import numpy as np
n, a, *x = map(int, sys.stdin.read().split())
def main():
m = 2500
dp = np.zeros((n + 1, m + 1), dtype=np.int64)
dp[0, 0] = 1
for i in range(n):
dp[1:, x[i] :] += dp[:-1, : -x[i]].copy()
i = np.arange(1, n + 1)
print(dp[i, i * a].sum())
... | [
"sys.stdin.read",
"numpy.zeros",
"numpy.arange"
] | [((123, 163), 'numpy.zeros', 'np.zeros', (['(n + 1, m + 1)'], {'dtype': 'np.int64'}), '((n + 1, m + 1), dtype=np.int64)\n', (131, 163), True, 'import numpy as np\n'), ((266, 285), 'numpy.arange', 'np.arange', (['(1)', '(n + 1)'], {}), '(1, n + 1)\n', (275, 285), True, 'import numpy as np\n'), ((56, 72), 'sys.stdin.read... |
import numpy as np
sbox = [
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x3... | [
"numpy.corrcoef"
] | [((1998, 2015), 'numpy.corrcoef', 'np.corrcoef', (['x', 'y'], {}), '(x, y)\n', (2009, 2015), True, 'import numpy as np\n')] |
import numpy as np
import pygame as pg
class gen_player_cloud:
def __init__ (self, num_players, player_class):
self.init_players(num_players, player_class)
self.set_random_colors()
self.tick = 0
def init_players(self, num_players, player_class):
self.active_players_num = num_pl... | [
"numpy.argsort"
] | [((1170, 1188), 'numpy.argsort', 'np.argsort', (['scores'], {}), '(scores)\n', (1180, 1188), True, 'import numpy as np\n')] |
import csv
import sys
import numpy as np
from fooof import FOOOF
# Take input arguments from matlab
inputname = sys.argv[1]
path2 = sys.argv[2]
withKnee = sys.argv[3]
# Read .csv file
with open(path2 + '\\' + inputname + '.csv', newline='') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|'... | [
"fooof.FOOOF",
"csv.reader",
"numpy.array",
"csv.writer"
] | [((534, 547), 'numpy.array', 'np.array', (['psd'], {}), '(psd)\n', (542, 547), True, 'import numpy as np\n'), ((553, 565), 'numpy.array', 'np.array', (['fs'], {}), '(fs)\n', (561, 565), True, 'import numpy as np\n'), ((272, 321), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""" """', 'quotechar': '"""|"""'}... |
'''This module contains the following:
Controller
A class for Keras (Tensorflow backend) based OpenAI gym controllers.
Models
A class implementing and supplying Keras models to the Controller
class.
ActionTransformations
A container class for methods that transform the controller (Keras model)
outpu... | [
"gym.make",
"numpy.argmax",
"keras.layers.Activation",
"tensorflow.device",
"keras.layers.Dense",
"numpy.array",
"numpy.reshape",
"keras.models.Sequential"
] | [((2305, 2318), 'gym.make', 'gym.make', (['env'], {}), '(env)\n', (2313, 2318), False, 'import gym\n'), ((6243, 6255), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (6253, 6255), False, 'from keras.models import Sequential\n'), ((6534, 6546), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (6544... |
import random
import numpy as np
from Utils.constants import Prior
class Cell:
"""
Represents a single cell in the Map() objects grid
"""
def __init__(self, center, cell_length:float=1) -> None:
self._center = center
self._cell_length = cell_length
self._probability = 0
... | [
"numpy.exp2",
"random.randint",
"numpy.square",
"numpy.linalg.norm",
"numpy.array",
"numpy.arange",
"numpy.sqrt"
] | [((438, 502), 'numpy.array', 'np.array', (['[[0, offset], [offset, 0], [0, -offset], [-offset, 0]]'], {}), '([[0, offset], [offset, 0], [0, -offset], [-offset, 0]])\n', (446, 502), True, 'import numpy as np\n'), ((1980, 2003), 'numpy.array', 'np.array', (['bottom_corner'], {}), '(bottom_corner)\n', (1988, 2003), True, ... |
import numpy as np
from keras.models import Model
from src.modules import config
class NeuronCoverage:
def __init__(self, model, threshold=None, excluded_layer=None):
if excluded_layer is None:
excluded_layer = ['pool', 'fc', 'flatten', 'input']
if threshold is None:
sel... | [
"src.modules.config.get",
"numpy.mean",
"numpy.zeros"
] | [((1407, 1442), 'numpy.zeros', 'np.zeros', ([], {'shape': 'layer_outputs.shape'}), '(shape=layer_outputs.shape)\n', (1415, 1442), True, 'import numpy as np\n'), ((340, 387), 'src.modules.config.get', 'config.get', (['"""evaluation.neuron_cover_threshold"""'], {}), "('evaluation.neuron_cover_threshold')\n", (350, 387), ... |
import cvxpy as cp
import numpy as np
import logging
from tprmp.models.coriolis import compute_coriolis_force
from tprmp.models.rmp import compute_dissipation_term, compute_hamiltonian, compute_obsrv_prob, compute_policy, compute_potential_term, compute_riemannian_metric
logger = logging.getLogger(__name__)
def opt... | [
"tprmp.demonstrations.manifold.Manifold.get_euclidean_manifold",
"numpy.ones",
"numpy.linalg.norm",
"tprmp.models.tp_gmm.TPGMM",
"tprmp.models.rmp.compute_potential_term",
"numpy.cumsum",
"numpy.linspace",
"cvxpy.pnorm",
"tprmp.models.coriolis.compute_coriolis_force",
"tprmp.models.rmp.compute_ham... | [((283, 310), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (300, 310), False, 'import logging\n'), ((1792, 1820), 'cvxpy.Variable', 'cp.Variable', (['tp_gmm.num_comp'], {}), '(tp_gmm.num_comp)\n', (1803, 1820), True, 'import cvxpy as cp\n'), ((2635, 2652), 'cvxpy.Minimize', 'cp.Minimize... |
from models import MLP, TwinHeadModel
from jax.random import PRNGKey
from buffer import Batch
from algo import (extract_latent_factors, get_transition, mse_loss,
select_action, update_ppo)
from segar.envs.env import SEGAREnv
import glob
import importlib
import os
import subprocess
from collections imp... | [
"wandb.log",
"optax.adam",
"numpy.random.seed",
"algo.update_ppo",
"jax.random.PRNGKey",
"numpy.mean",
"numpy.random.randint",
"absl.flags.DEFINE_boolean",
"glob.glob",
"os.path.join",
"collections.deque",
"importlib.util.module_from_spec",
"algo.extract_latent_factors",
"models.MLP",
"a... | [((1169, 1230), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""env_name"""', '"""empty-easy-rgb"""', '"""Env name"""'], {}), "('env_name', 'empty-easy-rgb', 'Env name')\n", (1188, 1230), False, 'from absl import app, flags\n'), ((1231, 1278), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""seed"""'... |
from rubymarshal.ruby import readruby, writeruby
import numpy as np
# Open a ruby map
data = readruby("Map032.rxdata")
# print(data.attributes["@data"].data)
# print(len(data.attributes["@data"].data))
# # DEPRECATED (use numpy instead): Set tile x=3 to 405.
# data.attributes["@data"][3, 0, 0] = 405
# Grab numpy a... | [
"rubymarshal.ruby.readruby",
"numpy.unique"
] | [((95, 120), 'rubymarshal.ruby.readruby', 'readruby', (['"""Map032.rxdata"""'], {}), "('Map032.rxdata')\n", (103, 120), False, 'from rubymarshal.ruby import readruby, writeruby\n'), ((497, 513), 'numpy.unique', 'np.unique', (['array'], {}), '(array)\n', (506, 513), True, 'import numpy as np\n')] |
import string
import time
import fire
from pathlib import Path
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
# helpers
def d(tensor=None):
if tensor is None:
return 'cuda' if torch.cuda.is_available() else 'cpu'
return 'cuda' if tensor.is_cuda else 'cpu'
# prep... | [
"torch.nn.Dropout",
"torch.eye",
"torch.sqrt",
"torch.cat",
"torch.nn.InstanceNorm2d",
"numpy.savez_compressed",
"pathlib.Path",
"torch.nn.Softmax",
"torch.inverse",
"torch.no_grad",
"torch.zeros",
"torch.log",
"torch.nn.Conv2d",
"torch.einsum",
"torch.nn.ELU",
"torch.cuda.is_available... | [((5631, 5646), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (5644, 5646), False, 'import torch\n'), ((1117, 1154), 'torch.cat', 'torch.cat', (['(f_i, h_i[:, None])'], {'dim': '(1)'}), '((f_i, h_i[:, None]), dim=1)\n', (1126, 1154), False, 'import torch\n'), ((1270, 1315), 'torch.einsum', 'torch.einsum', (['"""i... |
import cv2
import numpy as np
"""
"""
def get_hline(image, kernel_size=(2, 20), dx=5, dy=2):
up_line_list = []
down_line_list = []
up_y_list = []
down_y_list = []
shape = image.shape
area_size = kernel_size[0] * kernel_size[1]
w = shape[1]
h = shape[0]
for y in range(0, w - kerne... | [
"cv2.GaussianBlur",
"numpy.sum",
"cv2.bitwise_and",
"cv2.rectangle",
"cv2.imshow",
"cv2.line",
"cv2.contourArea",
"cv2.subtract",
"cv2.dilate",
"cv2.cvtColor",
"cv2.convertScaleAbs",
"cv2.destroyAllWindows",
"cv2.boundingRect",
"cv2.Canny",
"cv2.bitwise_not",
"cv2.waitKey",
"cv2.morp... | [((4575, 4594), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (4591, 4594), False, 'import cv2\n'), ((7800, 7823), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (7821, 7823), False, 'import cv2\n'), ((4167, 4204), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}... |
import numpy as np
def rev_lookup(dd, val):
key = next(key for key, value in dd.items() if value == val)
return key
def bin(s):
return str(s) if s<=1 else bin(s>>1) + str(s&1)
def test_bit(int_type, offset):
mask = 1 << offset
return ((int_type & mask) >> offset)
def gen_mask(bit_pos):
if ... | [
"numpy.array"
] | [((920, 932), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (928, 932), True, 'import numpy as np\n')] |
import numpy as np
import torch
import torch.nn as nn
import utils.network_utils as nu
import utils.tracking_utils as tu
from model import dla_up
from lib.model.roi_layers import ROIAlign, ROIPool
class Model(nn.Module):
def __init__(self, arch_name, roi_name, down_ratio, roi_kernel):
super(Model, self)... | [
"utils.network_utils.compute_cen_loss",
"lib.model.roi_layers.ROIPool",
"torch.nn.ReLU",
"lib.model.roi_layers.ROIAlign",
"numpy.sum",
"utils.network_utils.compute_dep_loss",
"torch.sqrt",
"numpy.log2",
"utils.tracking_utils.point3dcoord_torch",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.Sigmoi... | [((4125, 4150), 'utils.network_utils.init_module', 'nu.init_module', (['self.base'], {}), '(self.base)\n', (4139, 4150), True, 'import utils.network_utils as nu\n'), ((4159, 4183), 'utils.network_utils.init_module', 'nu.init_module', (['self.dim'], {}), '(self.dim)\n', (4173, 4183), True, 'import utils.network_utils as... |
"""
======================================
Compute LCMV beamformer on evoked data
======================================
Compute LCMV beamformer solutions on evoked dataset for three different choices
of source orientation and stores the solutions in stc files for visualisation.
"""
# Author: <NAME> <<EMAIL>>
#
# Lic... | [
"matplotlib.pyplot.title",
"mne.beamformer.lcmv",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"mne.pick_types",
"mne.io.Raw",
"mne.read_selection",
"matplotlib.pyplot.close",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"mne.compute_covariance",
"numpy.mean",
"mne.read_for... | [((521, 539), 'mne.datasets.sample.data_path', 'sample.data_path', ([], {}), '()\n', (537, 539), False, 'from mne.datasets import sample\n'), ((1068, 1082), 'mne.io.Raw', 'Raw', (['raw_fname'], {}), '(raw_fname)\n', (1071, 1082), False, 'from mne.io import Raw\n'), ((1154, 1182), 'mne.read_events', 'mne.read_events', (... |
#%%
"""
Kalman Filter
Implement single shot estimations for multi sensor localization
April 19, 2018
"""
import numpy as np
import time
import matplotlib.pyplot as plt
import os
#mpl.use('TkAgg')
# import matplotlib.animation as manimation
from numpy import unravel_index
# import mpld3
# mpld3.enable_notebook()
# Add ... | [
"numpy.random.seed",
"GAutils.graph_primitives.make_graph",
"matplotlib.pyplot.quiver",
"matplotlib.pyplot.figure",
"GAutils.mcft.get_mcfsigs_all",
"GAutils.proc_est.get_gard_true",
"GAutils.proc_est.plot_scene",
"numpy.copy",
"GAutils.PCRLB.ZZBrv",
"matplotlib.pyplot.colorbar",
"GAutils.graph_p... | [((893, 940), 'numpy.array', 'np.array', (['[sensor.mcs.tf for sensor in sensors]'], {}), '([sensor.mcs.tf for sensor in sensors])\n', (901, 940), True, 'import numpy as np\n'), ((1113, 1157), 'numpy.zeros', 'np.zeros', (['tfa_list.shape'], {'dtype': '"""complex128"""'}), "(tfa_list.shape, dtype='complex128')\n", (1121... |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | [
"jax.experimental.optix.apply_updates",
"jax.experimental.optix.adam",
"numpy.random.binomial",
"jax.jit",
"jax.vmap",
"numpy.random.randn",
"bsuite.baselines.utils.replay.Replay",
"numpy.float32",
"numpy.zeros",
"haiku.Flatten",
"haiku.PRNGSequence",
"haiku.transform",
"numpy.random.randint... | [((7794, 7825), 'jax.experimental.optix.adam', 'optix.adam', ([], {'learning_rate': '(0.001)'}), '(learning_rate=0.001)\n', (7804, 7825), False, 'from jax.experimental import optix\n'), ((3879, 3900), 'haiku.PRNGSequence', 'hk.PRNGSequence', (['seed'], {}), '(seed)\n', (3894, 3900), True, 'import haiku as hk\n'), ((391... |
import os
import cv2
import glob
import numpy as np
from utils import make_folder
from PIL import Image
from torchvision import transforms
import matplotlib.pyplot as plt
#list1
#label_list = ['skin', 'neck', 'hat', 'eye_g', 'hair', 'ear_r', 'neck_l', 'cloth', 'l_eye', 'r_eye', 'l_brow', 'r_brow', 'nose', 'l_ear', 'r_... | [
"cv2.imwrite",
"numpy.zeros",
"os.path.exists",
"cv2.imread",
"os.path.join"
] | [((1184, 1222), 'os.path.join', 'os.path.join', (['folder_base', 'folder_save'], {}), '(folder_base, folder_save)\n', (1196, 1222), False, 'import os\n'), ((1270, 1317), 'os.path.join', 'os.path.join', (['folder_base', '"""train_face_seg.lst"""'], {}), "(folder_base, 'train_face_seg.lst')\n", (1282, 1317), False, 'impo... |
import numpy as np
from bokeh.plotting import *
x = np.linspace(0, 4*np.pi, 200)
y = np.sin(x)
output_file("line.html", title="line.py example")
p = figure(title="simple line example")
p.line(x,y, color="#2222aa", line_with=2)
show(p)
| [
"numpy.sin",
"numpy.linspace"
] | [((54, 84), 'numpy.linspace', 'np.linspace', (['(0)', '(4 * np.pi)', '(200)'], {}), '(0, 4 * np.pi, 200)\n', (65, 84), True, 'import numpy as np\n'), ((87, 96), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (93, 96), True, 'import numpy as np\n')] |
# Copyright 2018 The TensorFlow Probability 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 applicable law o... | [
"tensorflow_probability.python.sts.internal.missing_values_util.moments_of_masked_time_series",
"tensorflow_probability.python.internal.prefer_static.shape",
"tensorflow.compat.v2.math.is_finite",
"tensorflow.compat.v2.nn.moments",
"tensorflow.compat.v2.broadcast_static_shape",
"tensorflow_probability.pyt... | [((2039, 2078), 'tensorflow.compat.v2.convert_to_tensor', 'tf.convert_to_tensor', ([], {'value': 'batch_shape'}), '(value=batch_shape)\n', (2059, 2078), True, 'import tensorflow.compat.v2 as tf\n'), ((3383, 3474), 'tensorflow.compat.v2.convert_to_tensor', 'tf.convert_to_tensor', ([], {'value': 'chain_batch_shape', 'nam... |
print("Composed by Dr <NAME>, CSU. version 3.1.2021.06.22. Xiangya School of Pharmaceutical Science.")
print("Please cite J. Org. Chem. 2020, 85, 17, 11350–11358")
print("作者:王文宣,中南大学,湘雅药学院")
print(" ")
#Parameters table
temp = 298 #termperature for Boltzmann population calculation (K)
threshold_geom = 0.1 #thre... | [
"pandas.DataFrame",
"linecache.getline",
"numpy.argsort",
"numpy.sort",
"numpy.array",
"glob.glob",
"pandas.ExcelWriter",
"numpy.delete"
] | [((1079, 1097), 'glob.glob', 'glob.glob', (['"""*.out"""'], {}), "('*.out')\n", (1088, 1097), False, 'import glob\n'), ((1141, 1159), 'glob.glob', 'glob.glob', (['"""*.log"""'], {}), "('*.log')\n", (1150, 1159), False, 'import glob\n'), ((3612, 3640), 'numpy.array', 'np.array', (['filenames_selected'], {}), '(filenames... |
#
# ImageViewBokeh.py -- classes implementing a ginga viewer backend for Bokeh
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
import time
import numpy as np
# Bokeh imports
from bokeh.plotting import curdoc
from bokeh.models import ColumnDataSource
from ... | [
"ginga.ImageView.ImageViewBase.__init__",
"bokeh.models.ColumnDataSource",
"ginga.canvas.render.get_render_class",
"numpy.flipud",
"time.time",
"bokeh.io.push_notebook",
"ginga.Mixins.UIMixin.__init__",
"bokeh.plotting.curdoc"
] | [((743, 834), 'ginga.ImageView.ImageViewBase.__init__', 'ImageView.ImageViewBase.__init__', (['self'], {'logger': 'logger', 'rgbmap': 'rgbmap', 'settings': 'settings'}), '(self, logger=logger, rgbmap=rgbmap,\n settings=settings)\n', (775, 834), False, 'from ginga import ImageView\n'), ((2219, 2227), 'bokeh.plotting.... |
# Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
# SPDX-License-Identifier: MIT
"""Contains helper functions that can be used across the example apps."""
import os
import errno
from pathlib import Path
import numpy as np
import pyarmnn as ann
def dict_labels(labels_file_path: str, include_rgb=Fals... | [
"pyarmnn.make_input_tensors",
"numpy.iinfo",
"numpy.clip",
"pathlib.Path",
"numpy.random.random",
"os.strerror"
] | [((854, 876), 'pathlib.Path', 'Path', (['labels_file_path'], {}), '(labels_file_path)\n', (858, 876), False, 'from pathlib import Path\n'), ((2134, 2194), 'pyarmnn.make_input_tensors', 'ann.make_input_tensors', (['[input_binding_info]', '[input_tensor]'], {}), '([input_binding_info], [input_tensor])\n', (2156, 2194), T... |
from copy import deepcopy
import numpy as np
import libs.state_node as STTREE
class IterativeDeepeningSearch:
def __init__(self, initialPuzzle, answerPuzzle, totalExpansions=0):
self.totalExpansions = totalExpansions
self.initialPuzzle = initialPuzzle
self.answerPuzzle = answerPuzzle
... | [
"numpy.array_equal",
"copy.deepcopy",
"libs.state_node.StateNode"
] | [((521, 573), 'numpy.array_equal', 'np.array_equal', (['nodePuzzle', 'self.answerPuzzle.puzzle'], {}), '(nodePuzzle, self.answerPuzzle.puzzle)\n', (535, 573), True, 'import numpy as np\n'), ((387, 442), 'libs.state_node.StateNode', 'STTREE.StateNode', (['initialPuzzle.puzzle', 'initialPuzzle.n'], {}), '(initialPuzzle.p... |
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial. Full
# text can be found in LICENSE.md
import os
import random
import numpy as np
from ruamel.yaml import YAML
import torch
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
"numpy.random.seed",
"os.makedirs",
"os.path.join",
"torch.manual_seed",
"torch.cuda.manual_seed",
"os.path.exists",
"ruamel.yaml.YAML",
"torch.cuda.manual_seed_all",
"random.seed",
"numpy.array",
"os.path.splitext",
"os.path.expanduser",
"os.listdir"
] | [((500, 517), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (511, 517), False, 'import random\n'), ((567, 587), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (581, 587), True, 'import numpy as np\n'), ((592, 615), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (60... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import pickle
import datetime
import argparse
import re
import glob
from obj.RBM import RBM
import tensorflow as tf
import numpy as np
import matplotlib.image as mpimg
from skimage.transform import resize
################################
# train RBM from input ... | [
"pickle.dump",
"matplotlib.image.imread",
"os.makedirs",
"argparse.ArgumentParser",
"numpy.std",
"numpy.asarray",
"tensorflow.reshape",
"obj.RBM.RBM",
"numpy.mean",
"glob.glob",
"datetime.datetime.now",
"re.sub"
] | [((1545, 1583), 'os.makedirs', 'os.makedirs', (["('pickles/' + current_time)"], {}), "('pickles/' + current_time)\n", (1556, 1583), False, 'import os\n'), ((1682, 1746), 'obj.RBM.RBM', 'RBM', (['dims[0]', 'dims[1]', 'learning_rate', 'k1', 'k2', 'epochs', 'batch_size'], {}), '(dims[0], dims[1], learning_rate, k1, k2, ep... |
import losses.triplet_loss as l
import numpy as np
import scipy.spatial as sp
import torch
from torch.autograd import Variable
from losses.triplet_loss import topk, active
from losses.multi_loss import LinearWeightedLoss, WeightModule, MultiLoss, DynamicFocalLoss, DynamicFocalLossModule
from losses.regression import MS... | [
"numpy.sum",
"losses.multi_loss.DynamicFocalLossModule",
"pytest.mark.parametrize",
"losses.regression.MSELoss",
"numpy.random.randn",
"numpy.random.rand",
"numpy.testing.assert_almost_equal",
"dataflow.DataFlowController",
"losses.triplet_loss.BatchHard",
"losses.dummy.DummyLoss",
"losses.tripl... | [((1255, 1301), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""cuda"""', '[True, False]'], {}), "('cuda', [True, False])\n", (1278, 1301), False, 'import pytest\n'), ((4143, 4184), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""cfg"""', 'test_cfgs'], {}), "('cfg', test_cfgs)\n", (4166, 4184), ... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 7 09:16:41 2021
@author: jhask
"""
import numpy as np
import csv
import re
import sys
from pyatlab import * # Tools for making things MATLAB compliant.
sys.path.insert(0,'C:/Users/jhask/OneDrive/Documents/Research/Projects/MIT/pOrgNO3/code/MCM_RCIM_SM... | [
"numpy.sum",
"csv.reader",
"decimal.Decimal",
"re.finditer",
"sys.path.insert",
"numpy.isnan",
"numpy.mod",
"numpy.argsort",
"numpy.arange",
"numpy.int64",
"numpy.float64"
] | [((221, 350), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:/Users/jhask/OneDrive/Documents/Research/Projects/MIT/pOrgNO3/code/MCM_RCIM_SMILES/python/pyMCM/"""'], {}), "(0,\n 'C:/Users/jhask/OneDrive/Documents/Research/Projects/MIT/pOrgNO3/code/MCM_RCIM_SMILES/python/pyMCM/'\n )\n", (236, 350), False, 'imp... |
# coding=utf-8
# Copyright 2022 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... | [
"numpy.trace",
"dim4.so8_supergravity_extrema.code.algebra.su8.m_28_8_8.astype",
"numpy.zeros",
"dim4.so8_supergravity_extrema.code.algebra.permutation_sign",
"numpy.array",
"collections.namedtuple",
"numpy.eye"
] | [((973, 1147), 'collections.namedtuple', 'collections.namedtuple', (['"""ScalarInfo"""', "['stationarity', 'potential', 'potential_a1', 'potential_a2', 'generator',\n 'vielbein', 't_tensor', 'a1', 'a2', 'grad_potential']"], {}), "('ScalarInfo', ['stationarity', 'potential',\n 'potential_a1', 'potential_a2', 'gene... |
import sys
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Flatten, Activation
from keras.layers import Convolution1D
from keras.layers import MaxPooling1D
from keras.layers import Embedding
from keras.layers import ThresholdedReLU
from keras.layers import Dropout
from keras.optimizers... | [
"keras.layers.Convolution1D",
"keras.layers.ThresholdedReLU",
"keras.layers.Dropout",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"keras.models.Model",
"keras.layers.MaxPooling1D",
"keras.layers.Dense",
"keras.layers.Embedding",
"data_utils.Data",
"numpy.random.permutation",
"keras.layers... | [((1659, 1711), 'keras.layers.Input', 'Input', ([], {'shape': '(l0,)', 'name': '"""sent_input"""', 'dtype': '"""int64"""'}), "(shape=(l0,), name='sent_input', dtype='int64')\n", (1664, 1711), False, 'from keras.layers import Input, Dense, Flatten, Activation\n'), ((2198, 2237), 'keras.models.Model', 'Model', ([], {'inp... |
"""
This module contains classes to handle datasets consisting of many files.
Created by <NAME>, June 2017
"""
import atexit
from collections import Counter, deque, OrderedDict
from copy import deepcopy
from datetime import datetime, timedelta
import gc
from itertools import tee
import json
import logging
from concur... | [
"atexit.register",
"posixpath.dirname",
"traceback.format_tb",
"numpy.argmin",
"gc.collect",
"pandas.Grouper",
"typhon.utils.timeutils.to_datetime",
"collections.deque",
"pandas.DataFrame",
"typhon.utils.unique",
"re.findall",
"datetime.timedelta",
"pandas.Timedelta",
"collections.Counter"... | [((1046, 1073), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1063, 1073), False, 'import logging\n'), ((29011, 29076), 'typhon.utils.unique', 'unique', (['(secondary for match in secondaries for secondary in match)'], {}), '(secondary for match in secondaries for secondary in match)\n'... |
# Copyright 2020 The HuggingFace Team. All rights reserved.
# Copyright 2020 Google LLC
# Modified from the original HuggingFace version.
#
# 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
#
# ... | [
"torch_xla.core.xla_model.xrt_world_size",
"torch.ones",
"seq2seq.utils.reset_config",
"transformers.file_utils.is_torch_tpu_available",
"torch.nn.CrossEntropyLoss",
"transformers.optimization.Adafactor",
"torch_xla.debug.metrics.metrics_report",
"torch_xla.core.xla_model.get_ordinal",
"transformers... | [((1648, 1676), 'transformers.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (1666, 1676), False, 'from transformers import PreTrainedModel, logging\n'), ((2036, 2060), 'transformers.file_utils.is_torch_tpu_available', 'is_torch_tpu_available', ([], {}), '()\n', (2058, 2060), False, 'fro... |
import numpy as np
import torch
import trimesh
from scipy.spatial import cKDTree as KDTree
from inside_mesh.triangle_hash import TriangleHash as _TriangleHash
'''
Some code included from 'inside_mesh' library of Occupancy Networks
https://github.com/autonomousvision/occupancy_networks
'''
def define_grid_3d(N, vox... | [
"numpy.full",
"trimesh.sample.sample_surface",
"trimesh.load",
"numpy.sum",
"numpy.abs",
"torch.LongTensor",
"numpy.square",
"numpy.cross",
"numpy.zeros",
"numpy.mod",
"numpy.sign",
"numpy.array",
"numpy.linalg.norm",
"scipy.spatial.cKDTree",
"torch.zeros",
"numpy.bincount",
"inside_... | [((663, 685), 'torch.zeros', 'torch.zeros', (['(N ** 3)', '(3)'], {}), '(N ** 3, 3)\n', (674, 685), False, 'import torch\n'), ((2935, 2961), 'scipy.spatial.cKDTree', 'KDTree', (['gen_points_sampled'], {}), '(gen_points_sampled)\n', (2941, 2961), True, 'from scipy.spatial import cKDTree as KDTree\n'), ((3142, 3162), 'sc... |
"""
PipelineExome.py - Tasks for variant calling
============================================
Reference
---------
"""
# Import modules
import os
import CGATCore.IOTools as IOTools
from CGATCore import Pipeline as P
import CGATCore.Experiment as E
from CGATCore.Pipeline import cluster_runnable
import numpy as np
impor... | [
"pandas.read_csv",
"collections.defaultdict",
"pandas.DataFrame",
"CGATCore.Pipeline.get_temp_dir",
"CGATCore.Pipeline.run",
"urllib.request.urlopen",
"CGATCore.IOTools.open_file",
"CGATCore.Experiment.info",
"collections.Counter",
"re.search",
"re.sub",
"numpy.divide",
"os.path.basename",
... | [((728, 744), 'urllib.request.urlopen', 'urlopen', (['address'], {}), '(address)\n', (735, 744), False, 'from urllib.request import urlopen\n'), ((785, 810), 'bs4.BeautifulSoup', 'BeautifulSoup', (['htmlSource'], {}), '(htmlSource)\n', (798, 810), False, 'from bs4 import BeautifulSoup, NavigableString\n'), ((1244, 1263... |
import os
import numpy as np
import mindspore.dataset as de
class npyDataset(object):
def __init__(self, data_dir, data_type, h, w):
super(npyDataset, self).__init__()
self.data = np.load(os.path.join(data_dir, '{}_data.npy'.format(data_type)))
self.data = np.reshape(self.data, (-1, 1, h, ... | [
"numpy.reshape",
"mindspore.dataset.GeneratorDataset"
] | [((875, 941), 'mindspore.dataset.GeneratorDataset', 'de.GeneratorDataset', (['dataset', "['feats', 'labels']"], {'shuffle': 'shuffle'}), "(dataset, ['feats', 'labels'], shuffle=shuffle)\n", (894, 941), True, 'import mindspore.dataset as de\n'), ((287, 323), 'numpy.reshape', 'np.reshape', (['self.data', '(-1, 1, h, w)']... |
#!/usr/bin/env python
"""
DeepAnchor was a CNN-based method to distinguish loop-associated CTCF binding sites from others.
It has two different mode: train, predict
When mode is train, it train a classifier and save it to file_model, while if mode is predict,
it uses the classifier to predict the score of all motifs.
... | [
"numpy.load",
"tensorflow.keras.layers.Dense",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"tensorflow.keras.models.Sequential",
"matplotlib.pyplot.tight_layout",
"tensorflow.keras.callbacks.EarlyStopping",
"tensorflow.keras.layers.Flatten",
"pandas.DataFrame",
"sklearn.metrics.average_precisio... | [((711, 771), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(2)'], {'figsize': '(9, 4)', 'sharex': '(True)', 'sharey': '(True)'}), '(1, 2, figsize=(9, 4), sharex=True, sharey=True)\n', (723, 771), True, 'import matplotlib.pyplot as plt\n'), ((788, 820), 'sklearn.metrics.roc_curve', 'metrics.roc_curve', (['y_r... |
# -*- coding: utf-8 -*-
# %reset -f
"""
@author: <NAME>
"""
import random
import numpy as np
import pandas as pd
from deap import base
from deap import creator
from deap import tools
from sklearn import model_selection
from sklearn import svm
# 設定 ここから
number_of_areas = 5 # 選択する領域の数
max_width_of_ar... | [
"deap.base.Toolbox",
"random.uniform",
"pandas.read_csv",
"numpy.floor",
"numpy.zeros",
"numpy.ones",
"sklearn.model_selection.cross_val_predict",
"random.random",
"deap.creator.create",
"deap.tools.selBest",
"random.seed",
"numpy.array",
"numpy.arange",
"numpy.round"
] | [((738, 799), 'pandas.read_csv', 'pd.read_csv', (['"""sample_spectra_dataset_with_y.csv"""'], {'index_col': '(0)'}), "('sample_spectra_dataset_with_y.csv', index_col=0)\n", (749, 799), True, 'import pandas as pd\n'), ((1049, 1107), 'deap.creator.create', 'creator.create', (['"""FitnessMax"""', 'base.Fitness'], {'weight... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 13 14:31:18 2020
@author: vatsal
"""
import numpy as np
import pandas as pd
df=pd.read_csv('Social_Network_Ads.csv')
print("\n")
print(df.columns)
print("\n")
print(df.shape)
print("\n")
print(df.isnull().sum())
print("\n")
print(df.corr())
import seaborn as sn... | [
"matplotlib.pyplot.title",
"seaborn.heatmap",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.show",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.figure",
"sk... | [((128, 165), 'pandas.read_csv', 'pd.read_csv', (['"""Social_Network_Ads.csv"""'], {}), "('Social_Network_Ads.csv')\n", (139, 165), True, 'import pandas as pd\n'), ((369, 397), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (379, 397), True, 'import matplotlib.pyplot as... |
import time
from config import parse_args, parse_class_weights
from seg_helper import *
from tfsolver import TFSolver, DELIMITER
from network_factory import seg_network
from dataset_iterator import *
from dataset_preloader import *
from data_augmentation import *
from libs import points_property, octree_property,check_... | [
"os.getpid",
"os.makedirs",
"tqdm.trange",
"os.path.basename",
"numpy.argmax",
"os.path.exists",
"time.time",
"learning_rate.LRFactory",
"libs.points_property",
"tensorflow.python.client.timeline.Timeline",
"network_factory.seg_network",
"numpy.array",
"config.parse_args",
"config.parse_cl... | [((26129, 26140), 'time.time', 'time.time', ([], {}), '()\n', (26138, 26140), False, 'import time\n'), ((26153, 26165), 'config.parse_args', 'parse_args', ([], {}), '()\n', (26163, 26165), False, 'from config import parse_args, parse_class_weights\n'), ((1426, 1481), 'libs.points_property', 'points_property', (['points... |
from typing import (
Callable,
Dict,
List,
Tuple,
Iterator,
Any,
TypeVar,
Optional,
TYPE_CHECKING,
)
import collections
import numpy as np
from ray.data.block import BlockAccessor, BlockMetadata, KeyFn, U
from ray.data.row import TableRow
from ray.data.impl.table_block import Table... | [
"pandas.DataFrame",
"pyarrow.table",
"ray.data.block.BlockAccessor.for_block",
"collections.namedtuple",
"typing.TypeVar",
"pandas.concat",
"numpy.issubdtype"
] | [((558, 570), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (565, 570), False, 'from typing import Callable, Dict, List, Tuple, Iterator, Any, TypeVar, Optional, TYPE_CHECKING\n'), ((2249, 2312), 'collections.namedtuple', 'collections.namedtuple', (['"""PandasBlockSchema"""', "['names', 'types']"], {}), "(... |
import unittest
import numpy as np
from mutils.water_vapor import *
#freezing point
fp = 273.15
class wv_round_trip(unittest.TestCase):
# def setUp(self):
# pass
# def tearDown(self):
# pass
def runTest(self):
# integer
T = 273.15 + 20
e = 611.
p = 1.013... | [
"unittest.main",
"numpy.zeros_like",
"numpy.ones_like",
"numpy.asarray",
"numpy.allclose",
"numpy.arange",
"numpy.linspace",
"numpy.round"
] | [((2109, 2124), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2122, 2124), False, 'import unittest\n'), ((656, 678), 'numpy.linspace', 'np.linspace', (['(125)', '(4000)'], {}), '(125, 4000)\n', (667, 678), True, 'import numpy as np\n'), ((1159, 1174), 'numpy.ones_like', 'np.ones_like', (['T'], {}), '(T)\n', (117... |
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import torch
import numpy as np
from mmcv.utils.registry import build_from_cfg
from mmcls.datasets.builder import DATASETS, PIPELINES
from mmcls.datasets.pipelines import Compose
from mmcls.datasets.base_dataset import BaseDataset
from mpa... | [
"mpa.utils.logger.get_logger",
"numpy.sum",
"mmcls.datasets.pipelines.Compose",
"numpy.mean",
"numpy.array",
"mmcls.datasets.builder.DATASETS.register_module",
"torch.tensor",
"mmcv.utils.registry.build_from_cfg",
"numpy.vstack"
] | [((362, 374), 'mpa.utils.logger.get_logger', 'get_logger', ([], {}), '()\n', (372, 374), False, 'from mpa.utils.logger import get_logger\n'), ((378, 404), 'mmcls.datasets.builder.DATASETS.register_module', 'DATASETS.register_module', ([], {}), '()\n', (402, 404), False, 'from mmcls.datasets.builder import DATASETS, PIP... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make statistics on the noise of benchmark FITS files.
"""
import common_functions as common
import argparse
from matplotlib import pyplot as plt
import os
import math
import numpy as np
from datapipe.io import images
def parse_fits_files(fits_file_name):
# R... | [
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"matplotlib.pyplot.subplots",
"numpy.array",
"datapipe.io.images.load_benchmark_images",
"numpy.random.poisson",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savefig"
] | [((392, 436), 'datapipe.io.images.load_benchmark_images', 'images.load_benchmark_images', (['fits_file_name'], {}), '(fits_file_name)\n', (420, 436), False, 'from datapipe.io import images\n'), ((801, 898), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Make statistics on the noise of be... |
import numpy as np
import pinocchio
from classic_framework import GotoCartPosImpedanceController
from classic_framework import GotoCartPosQuatImpedanceController
from classic_framework.controllers.TrajectoryTracking import GotoJointController
from classic_framework.controllers.TrajectoryTracking import JointTrajectory... | [
"pinocchio.framesForwardKinematics",
"classic_framework.controllers.TrajectoryTracking.JointTrajectoryTracker",
"classic_framework.GotoCartPosImpedanceController",
"numpy.zeros",
"pinocchio.Quaternion",
"pinocchio.getFrameJacobian",
"numpy.array",
"classic_framework.utils.sim_path.sim_framework_path",... | [((757, 815), 'classic_framework.utils.sim_path.sim_framework_path', 'sim_framework_path', (['"""./envs/panda_arm_hand_pinocchio.urdf"""'], {}), "('./envs/panda_arm_hand_pinocchio.urdf')\n", (775, 815), False, 'from classic_framework.utils.sim_path import sim_framework_path\n'), ((837, 875), 'pinocchio.buildModelFromUr... |
"""Tests for ribs.factory."""
import numpy as np
import pytest
import toml
import ribs.factory
from ribs.archives import GridArchive
from ribs.emitters import GaussianEmitter
from ribs.optimizers import Optimizer
@pytest.mark.parametrize(
"registration_func",
[
ribs.factory.register_archive,
... | [
"ribs.emitters.GaussianEmitter",
"pytest.raises",
"ribs.optimizers.Optimizer",
"numpy.array",
"ribs.archives.GridArchive",
"pytest.mark.parametrize",
"toml.dump"
] | [((217, 408), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""registration_func"""', '[ribs.factory.register_archive, ribs.factory.register_emitter, ribs.factory\n .register_optimizer]'], {'ids': "['archive', 'emitter', 'optimizer']"}), "('registration_func', [ribs.factory.register_archive,\n ribs.fac... |
# Copyright (c) 2018 <NAME>
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Code ported from java to python based on the mallet implementation:
#
# http://mallet.cs.umass.edu/index.php
import numpy as np
f... | [
"numpy.sum",
"numpy.log",
"numpy.ma.masked_where",
"numpy.argmax",
"scipy.io.loadmat",
"numpy.zeros",
"numpy.float",
"numpy.argsort",
"numpy.cumsum",
"numpy.max",
"numpy.random.randint",
"numpy.where",
"numpy.int64",
"numpy.random.rand",
"numpy.float64",
"numpy.round"
] | [((623, 636), 'numpy.sum', 'np.sum', (['alpha'], {}), '(alpha)\n', (629, 636), True, 'import numpy as np\n'), ((753, 789), 'numpy.zeros', 'np.zeros', (['locTopicDocCounts.shape[0]'], {}), '(locTopicDocCounts.shape[0])\n', (761, 789), True, 'import numpy as np\n'), ((833, 869), 'numpy.zeros', 'np.zeros', (['locTopicDocC... |
import numpy as np
from pathlib import Path
import json
import random
import torch
import os
def save_json(data, file_path):
'''
save json
:param data:
:param json_path:
:param file_name:
:return:
'''
if not isinstance(file_path, Path):
file_path = Path(file_pa... | [
"json.dump",
"json.load",
"numpy.random.seed",
"torch.manual_seed",
"torch.cuda.manual_seed",
"torch.cuda.manual_seed_all",
"pathlib.Path",
"random.seed"
] | [((1588, 1605), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1599, 1605), False, 'import random\n'), ((1657, 1677), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1671, 1677), True, 'import numpy as np\n'), ((1683, 1706), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see... |
import itertools
import operator
import numpy as np
from sklearn import cross_validation
from sklearn import feature_selection
from sklearn import ensemble
from sklearn import neighbors
from sklearn import svm
train = np.load('train.npy')
# Remove the labels
test = np.load('test_distribute.npy')[:,1:]
data = train[:... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.load",
"sklearn.ensemble.AdaBoostClassifier",
"sklearn.ensemble.GradientBoostingClassifier",
"operator.itemgetter"
] | [((220, 240), 'numpy.load', 'np.load', (['"""train.npy"""'], {}), "('train.npy')\n", (227, 240), True, 'import numpy as np\n'), ((268, 298), 'numpy.load', 'np.load', (['"""test_distribute.npy"""'], {}), "('test_distribute.npy')\n", (275, 298), True, 'import numpy as np\n'), ((1501, 1550), 'sklearn.ensemble.RandomForest... |
#
# GADANN - GPU Accelerated Deep Artificial Neural Network
#
# Copyright (C) 2014 <NAME> (<EMAIL>)
#
# 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 w... | [
"numpy.uint32",
"os.path.abspath",
"pycuda.compiler.SourceModule",
"re.compile",
"math.sqrt",
"math.ceil",
"pycuda.curandom.XORWOWRandomNumberGenerator",
"os.path.join",
"pycuda.gpuarray.arange"
] | [((1529, 1602), 'pycuda.curandom.XORWOWRandomNumberGenerator', 'pycuda.curandom.XORWOWRandomNumberGenerator', ([], {'seed_getter': 'seed_getter_func'}), '(seed_getter=seed_getter_func)\n', (1572, 1602), False, 'import pycuda\n'), ((10303, 10341), 'pycuda.compiler.SourceModule', 'pycuda.compiler.SourceModule', (['cuda_s... |
#!/usr/bin/env python3
# coding: utf-8
import json
import numpy as np
import pandas as pd
from visdom import Visdom
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.dates as mdate
# import seaborn
# seaborn.set()
# import pylab import mpl
import os, time, sys, pickle
from datetime import date... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"matplotlib.pyplot.legend",
"visdom.Visdom",
"matplotlib.pyplot.style.use",
"numpy.array",
"matplotlib.pyplot.xticks",
"pandas.Series",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid"
] | [((555, 589), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-whitegrid"""'], {}), "('seaborn-whitegrid')\n", (568, 589), True, 'import matplotlib.pyplot as plt\n'), ((594, 637), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['u"""时间轴"""'], {'fontproperties': '"""SimHei"""'}), "(u'时间轴', fontproperties='SimHe... |
import argparse
import time
import cv2
import numpy as np
import tensorflow as tf
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from models import vnect_model as vnect_model
import utils.utils as utils
parser = argparse.ArgumentParser()
parser.add_argument('--device', def... | [
"utils.utils.resize_pad_img",
"argparse.ArgumentParser",
"tensorflow.ConfigProto",
"utils.utils.draw_limbs_2d",
"pygame.display.set_mode",
"models.vnect_model.VNect",
"utils.utils.extract_2d_joint_from_heatmap",
"cv2.resize",
"cv2.circle",
"utils.utils.extract_3d_joints_from_heatmap",
"tensorflo... | [((259, 284), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (282, 284), False, 'import argparse\n'), ((1295, 1329), 'models.vnect_model.VNect', 'vnect_model.VNect', (['args.input_size'], {}), '(args.input_size)\n', (1312, 1329), True, 'from models import vnect_model as vnect_model\n'), ((1370,... |
# encoding: utf-8
"""
Interactive Data Visualization classes for Scene, Camera and BlockCollection
"""
# ----------------------------------------------------------------------------
# Copyright (c) 2016, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the f... | [
"OpenGL.GL.glBindFramebuffer",
"numpy.maximum",
"OpenGL.GL.glBlendEquation",
"OpenGL.GL.glBindTexture",
"OpenGL.GL.glGetIntegerv",
"OpenGL.GL.glGenBuffers",
"OpenGL.GL.glBlendColor",
"OpenGL.GL.glFramebufferRenderbuffer",
"OpenGL.GL.glVertexAttribPointer",
"numpy.ones",
"OpenGL.GL.glBindVertexAr... | [((1050, 1919), 'numpy.array', 'np.array', (['[[0.0, 0.0, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 1.0, 1.0, 1.0], [1.0, \n 1.0, 0.0, 1.0], [0.0, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0], [1.0, 0.0, \n 1.0, 1.0], [0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 1.0], [1.0, 1.0, 0.0, \n 1.0], [1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.... |
import collections
from sklearn.manifold import MDS
from sklearn.neighbors import KNeighborsClassifier
from sklearn.decomposition import PCA
from MDSimsEval.rmsf_analysis import reset_rmsf_calculations
from MDSimsEval.rmsf_analysis import get_avg_rmsf_per_residue
from MDSimsEval.rmsf_bootstrapped_analysis import find... | [
"numpy.abs",
"numpy.sum",
"MDSimsEval.rmsf_analysis.reset_rmsf_calculations",
"random.sample",
"MDSimsEval.rmsf_bootstrapped_analysis.find_rmsf_of_residues",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.decomposition.PCA",
"MDSimsEval.rmsf_analysis.get_avg_rmsf_per_residue",
"MDSimsEval.utils.... | [((1414, 1505), 'MDSimsEval.rmsf_analysis.reset_rmsf_calculations', 'reset_rmsf_calculations', (['train_analysis_actors', 'self.start', 'self.stop', 'self.rmsf_cache'], {}), '(train_analysis_actors, self.start, self.stop, self.\n rmsf_cache)\n', (1437, 1505), False, 'from MDSimsEval.rmsf_analysis import reset_rmsf_c... |
########################################################################
## basic sample ##
########################################################################
# https://docs.pymc.io/notebooks/GLM-negative-binomial-regression.html
import numpy as np
import mat... | [
"numpy.minimum",
"matplotlib.pyplot.show",
"scipy.stats.nbinom.rvs",
"matplotlib.pyplot.plot",
"scipy.stats.nbinom.pmf",
"numpy.arange",
"numpy.linspace",
"scipy.stats.nbinom.ppf",
"scipy.stats.nbinom"
] | [((420, 432), 'scipy.stats.nbinom', 'nbinom', (['a', 'b'], {}), '(a, b)\n', (426, 432), False, 'from scipy.stats import nbinom\n'), ((445, 468), 'numpy.arange', 'np.arange', (['(0.01)', '(1)', '(0.1)'], {}), '(0.01, 1, 0.1)\n', (454, 468), True, 'import numpy as np\n'), ((492, 517), 'scipy.stats.nbinom.rvs', 'nbinom.rv... |
"""
Projects anchors into bird's eye view and image space.
Returns the minimum and maximum box corners, and will only work
for anchors rotated at 0 or 90 degrees
"""
import numpy as np
from lib.dataset.kitti_util import compute_numpy_boxes_3d
# import tensorflow as tf
# from wavedata.tools.core import calib_utils
d... | [
"numpy.stack",
"numpy.amin",
"numpy.asarray",
"numpy.amax",
"numpy.array",
"lib.dataset.kitti_util.compute_numpy_boxes_3d"
] | [((949, 968), 'numpy.asarray', 'np.asarray', (['anchors'], {}), '(anchors)\n', (959, 968), True, 'import numpy as np\n'), ((1817, 1851), 'numpy.stack', 'np.stack', (['[x1, z1, x2, z2]'], {'axis': '(1)'}), '([x1, z1, x2, z2], axis=1)\n', (1825, 1851), True, 'import numpy as np\n'), ((3097, 3130), 'lib.dataset.kitti_util... |
import unittest
from chainer import backend
from chainer.backends import cuda
from chainer import initializers
from chainer import testing
from chainer.testing import attr
import numpy
@testing.parameterize(*testing.product({
'target': [
initializers.Uniform,
initializers.LeCunUniform,
in... | [
"chainer.testing.product",
"numpy.empty",
"chainer.backend.get_array_module",
"chainer.initializers.generate_array",
"chainer.testing.run_module",
"chainer.backends.cuda.cupy.empty"
] | [((1549, 1587), 'chainer.testing.run_module', 'testing.run_module', (['__name__', '__file__'], {}), '(__name__, __file__)\n', (1567, 1587), False, 'from chainer import testing\n'), ((796, 837), 'numpy.empty', 'numpy.empty', (['self.shape'], {'dtype': 'self.dtype'}), '(self.shape, dtype=self.dtype)\n', (807, 837), False... |
""" Version of slider example that uses a Python function as a callback,
which is transpiled to JavaScript using PyScript. Read more on PyScript
here:
http://flexx.readthedocs.org/en/stable/pyscript
"""
import numpy as np
from bokeh. layouts import row, widgetbox
from bokeh.plotting import figure, output_file, ... | [
"bokeh.plotting.figure",
"bokeh.models.Slider",
"bokeh.layouts.widgetbox",
"bokeh.plotting.output_file",
"numpy.sin",
"bokeh.plotting.show",
"numpy.linspace",
"bokeh.models.CustomJS.from_py_func"
] | [((390, 413), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(500)'], {}), '(0, 10, 500)\n', (401, 413), True, 'import numpy as np\n'), ((418, 427), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (424, 427), True, 'import numpy as np\n'), ((484, 542), 'bokeh.plotting.figure', 'figure', ([], {'y_range': '(-10, 10)', '... |
import os.path as op
import cooler
import cooltools
import cooltools.api
from numpy import testing
import numpy as np
def test_coverage_symmetric_upper(request):
# perform test:
clr = cooler.Cooler(op.join(request.fspath.dirname, "data/CN.mm9.1000kb.cool"))
cis_cov, tot_cov = cooltools.api.coverage.cover... | [
"numpy.fill_diagonal",
"numpy.testing.assert_allclose",
"numpy.sum",
"os.path.join"
] | [((587, 611), 'numpy.fill_diagonal', 'np.fill_diagonal', (['mtx', '(0)'], {}), '(mtx, 0)\n', (603, 611), True, 'import numpy as np\n'), ((616, 647), 'numpy.fill_diagonal', 'np.fill_diagonal', (['mtx[1:, :]', '(0)'], {}), '(mtx[1:, :], 0)\n', (632, 647), True, 'import numpy as np\n'), ((652, 683), 'numpy.fill_diagonal',... |
'''
Basic numpy style mathematics operations on arrays.
These include --
*
'''
import sys
import __builtin__
import numpy as np
import scipy.sparse as sp
from .operator.map import map, map2
from .operator.map_with_location import map_with_location
from .operator.reduce import reduce
from .operator.ndarray import nda... | [
"scipy.sparse.issparse",
"numpy.divide",
"numpy.dtype",
"numpy.multiply"
] | [((821, 835), 'scipy.sparse.issparse', 'sp.issparse', (['a'], {}), '(a)\n', (832, 835), True, 'import scipy.sparse as sp\n'), ((982, 996), 'scipy.sparse.issparse', 'sp.issparse', (['a'], {}), '(a)\n', (993, 996), True, 'import scipy.sparse as sp\n'), ((881, 898), 'numpy.multiply', 'np.multiply', (['a', 'b'], {}), '(a, ... |
# MIT License
# Copyright 2018 <NAME>
#
# 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, di... | [
"morpheus.core.unet.Model",
"numpy.testing.assert_array_equal",
"numpy.zeros",
"pytest.raises",
"tensorflow.zeros",
"morpheus.core.hparams.HParams",
"collections.namedtuple"
] | [((1690, 1756), 'collections.namedtuple', 'collections.namedtuple', (['"""Dataset"""', "['num_labels', 'train', 'test']"], {}), "('Dataset', ['num_labels', 'train', 'test'])\n", (1712, 1756), False, 'import collections\n'), ((2453, 2699), 'morpheus.core.hparams.HParams', 'HParams', ([], {'inference': 'inference', 'num_... |
#!/usr/bin/env python
import os
import numpy as np
import cv2
import argparse
import chumpy as ch
from chumpy import Ch
from argparse import ArgumentParser
import os.path as path
import SHLoss as sh
def is_valid_file(parser, arg):
if not path.exists(arg):
parser.error("The file %s does not exist!" % ar... | [
"os.mkdir",
"os.path.abspath",
"argparse.ArgumentParser",
"SHLoss.illum_error",
"cv2.imwrite",
"os.path.realpath",
"scipy.sparse.linalg.cg",
"SHLoss.computeSHEnergy",
"numpy.zeros",
"os.path.exists",
"time.time",
"SHLoss.illum_reg",
"cv2.imread",
"numpy.hstack",
"chumpy.array",
"chumpy... | [((557, 652), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Normals From Shading: Environment Light Estimation."""'}), "(description=\n 'Normals From Shading: Environment Light Estimation.')\n", (580, 652), False, 'import argparse\n'), ((1963, 1978), 'chumpy.array', 'ch.array', (['im... |
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
import numpy as np
from glumpy import library
from . transform... | [
"glumpy.library.get",
"numpy.asarray",
"numpy.array",
"numpy.clip"
] | [((2243, 2281), 'glumpy.library.get', 'library.get', (['"""transforms/panzoom.glsl"""'], {}), "('transforms/panzoom.glsl')\n", (2254, 2281), False, 'from glumpy import library\n'), ((2776, 2798), 'numpy.asarray', 'np.asarray', (['[1.0, 1.0]'], {}), '([1.0, 1.0])\n', (2786, 2798), True, 'import numpy as np\n'), ((3218, ... |
import multiprocessing
from utils.replay_memory import Memory
from utils.torch import *
import numpy as np
import math
import time
def collect_samples(pid, queue, env, policy, custom_reward,
mean_action, render, running_state, min_batch_size, count):
if pid > 0:
torch.manual_seed(torch... | [
"math.floor",
"time.time",
"utils.replay_memory.Memory",
"multiprocessing.Queue",
"numpy.vstack"
] | [((625, 633), 'utils.replay_memory.Memory', 'Memory', ([], {}), '()\n', (631, 633), False, 'from utils.replay_memory import Memory\n'), ((4200, 4211), 'time.time', 'time.time', ([], {}), '()\n', (4209, 4211), False, 'import time\n'), ((4359, 4382), 'multiprocessing.Queue', 'multiprocessing.Queue', ([], {}), '()\n', (43... |
"""
Image-Target generator for training this UNet.
"""
# import packages
import numpy as np
import rasterio
from tensorflow import keras
def read_tif(path: str, channels_last: bool = True):
"""
Load a tiff file into a numpy ndarray.
Parameters
----------
path: str
File path to tif fi... | [
"numpy.empty",
"rasterio.open",
"numpy.transpose",
"numpy.random.shuffle"
] | [((1131, 1166), 'numpy.transpose', 'np.transpose', (['image'], {'axes': '(1, 2, 0)'}), '(image, axes=(1, 2, 0))\n', (1143, 1166), True, 'import numpy as np\n'), ((5017, 5055), 'numpy.empty', 'np.empty', (['(self.batch_size, *self.dim)'], {}), '((self.batch_size, *self.dim))\n', (5025, 5055), True, 'import numpy as np\n... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 10 14:12:10 2019
@author: chxy
"""
import numpy as np
import torch
from torchvision import datasets
from torchvision import transforms
def get_train_loader(data_dir,
batch_size,
random_seed,
... | [
"numpy.random.seed",
"torch.utils.data.DataLoader",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomRotation",
"torchvision.datasets.CIFAR100",
"torchvision.transforms.Normalize",
"torchvision.transforms.RandomCrop",
"torchvision.transforms.ToTensor"
] | [((1408, 1485), 'torchvision.datasets.CIFAR100', 'datasets.CIFAR100', ([], {'root': 'data_dir', 'transform': 'trans', 'download': '(False)', 'train': '(True)'}), '(root=data_dir, transform=trans, download=False, train=True)\n', (1425, 1485), False, 'from torchvision import datasets\n'), ((1661, 1789), 'torch.utils.data... |
import numpy as np
import cv2
# Sobel class
# Sobel class
class SobelThreshold:
def __init__(self, sobel_profile):
self.sobel_profile = sobel_profile
def sobel_dir_thresh(self, img, sobel_kernel=3, thresh=(0, np.pi / 2)):
"""
Applies sobel x and y, compute direction of gradient and appl... | [
"numpy.absolute",
"numpy.zeros_like",
"numpy.arctan2",
"cv2.cvtColor",
"numpy.square",
"numpy.max",
"cv2.Sobel"
] | [((393, 430), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (405, 430), False, 'import cv2\n'), ((502, 555), 'cv2.Sobel', 'cv2.Sobel', (['gray', 'cv2.CV_64F', '(1)', '(0)'], {'ksize': 'sobel_kernel'}), '(gray, cv2.CV_64F, 1, 0, ksize=sobel_kernel)\n', (511, 555), Fa... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import base64
import numpy as np
import ray
_pinned_objects = []
PINNED_OBJECT_PREFIX = "ray.tune.PinnedObject:"
def pin_in_object_store(obj):
"""Pin an object in the object store.
It will be avail... | [
"ray.init",
"numpy.zeros",
"ray.get"
] | [((1318, 1328), 'ray.init', 'ray.init', ([], {}), '()\n', (1326, 1328), False, 'import ray\n'), ((555, 570), 'ray.get', 'ray.get', (['obj_id'], {}), '(obj_id)\n', (562, 570), False, 'import ray\n'), ((1181, 1192), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (1189, 1192), True, 'import numpy as np\n')] |
import numpy as np
def kldistance(p, q):
return np.sum(p * (np.log(p) - np.log(q)))
p = np.array([0.4, 0.6])
q = np.array([0.5, 0.5])
print(kldistance(p, q))
print(kldistance(q, p))
| [
"numpy.array",
"numpy.log"
] | [((95, 115), 'numpy.array', 'np.array', (['[0.4, 0.6]'], {}), '([0.4, 0.6])\n', (103, 115), True, 'import numpy as np\n'), ((120, 140), 'numpy.array', 'np.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (128, 140), True, 'import numpy as np\n'), ((66, 75), 'numpy.log', 'np.log', (['p'], {}), '(p)\n', (72, 75), True, 'i... |
"""Generate isotropic Gaussian blobs, 2D data, for metric demo.
https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_blobs.html
"""
from sklearn.datasets.samples_generator import make_blobs
import matplotlib.pyplot as plt
import random
import sys
import numpy as np
import argparse
from os.path im... | [
"sys.path.append",
"argparse.ArgumentParser",
"os.path.join",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"numpy.arange",
"numpy.array",
"sklearn.datasets.samples_generator.make_blobs",
"matplotlib.pyplot.xticks",
"matplotlib.pyp... | [((330, 355), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (345, 355), False, 'import sys\n'), ((403, 478), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""sum the integers at the command line"""'}), "(description='sum the integers at the command line')\n"... |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D,art3d
import math
import numpy as np
import json
def rotationMatrix3D(psi0, x1, y1, z1, eixo="yaw"):
if eixo == "yaw":
r = [[np.cos(psi0), np.sin(psi0) * -1, 0], [np.sin(psi0), np.cos(psi0), 0], [0, 0, 1]]
elif eixo == "pitch":
... | [
"json.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"math.radians",
"matplotlib.pyplot.axes",
"numpy.asarray",
"numpy.sin",
"numpy.cos",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.pause",
"numpy.concatenate"
] | [((2234, 2246), 'json.load', 'json.load', (['f'], {}), '(f)\n', (2243, 2246), False, 'import json\n'), ((2770, 2809), 'numpy.concatenate', 'np.concatenate', (['[x, px1, px2, px3, px4]'], {}), '([x, px1, px2, px3, px4])\n', (2784, 2809), True, 'import numpy as np\n'), ((2818, 2857), 'numpy.concatenate', 'np.concatenate'... |
import numpy as np
import time
class Accumulator:
def __init__(self, n) -> None:
self.data = [0.0]*n
def add(self, *args):
if len(args) == len(self.data):
self.data = [a + float(b)
for a, b in zip(self.data, args)]
def reset(self):
self.data = ... | [
"numpy.array",
"time.time"
] | [((579, 590), 'time.time', 'time.time', ([], {}), '()\n', (588, 590), False, 'import time\n'), ((638, 649), 'time.time', 'time.time', ([], {}), '()\n', (647, 649), False, 'import time\n'), ((848, 868), 'numpy.array', 'np.array', (['self.times'], {}), '(self.times)\n', (856, 868), True, 'import numpy as np\n')] |
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D
from keras import optimizers
from keras import backend as K
# Global variable
OUT_SHAPE = 2
INPUT_SHAPE = (120, 160, 3)
def customized_loss(y_true, y_pred, loss='euclidean'):
# ... | [
"keras.optimizers.adam",
"numpy.load",
"keras.layers.Dropout",
"keras.layers.Flatten",
"keras.layers.Dense",
"keras.layers.Conv2D",
"keras.models.Sequential",
"keras.backend.square"
] | [((761, 773), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (771, 773), False, 'from keras.models import Sequential\n'), ((1701, 1722), 'numpy.load', 'np.load', (['"""data/X.npy"""'], {}), "('data/X.npy')\n", (1708, 1722), True, 'import numpy as np\n'), ((1737, 1758), 'numpy.load', 'np.load', (['"""data/Y.... |
import os
import pickle
import threading
import numpy as np
from torch.utils import data
from tqdm import tqdm
from load_audio import load_wav
from load_video import load_mp4
from utils import colorize
class DemoDataset(data.Dataset):
def __init__(self, video_path, resize, fps, sample_rate):
self.resi... | [
"ipdb.set_trace",
"torchvision.transforms.functional.resize",
"os.path.exists",
"load_audio.load_wav",
"load_video.load_mp4",
"numpy.array",
"subprocess.call",
"os.path.splitext",
"PIL.Image.fromarray",
"numpy.round",
"os.path.join"
] | [((753, 779), 'os.path.splitext', 'os.path.splitext', (['vid_path'], {}), '(vid_path)\n', (769, 779), False, 'import os\n'), ((829, 867), 'os.path.join', 'os.path.join', (['self.data_path', 'vid_path'], {}), '(self.data_path, vid_path)\n', (841, 867), False, 'import os\n'), ((893, 946), 'os.path.join', 'os.path.join', ... |
# coding:utf-8
import numpy as np
class CatboostDataPrepare(object):
def __init__(self, *, train_feature, test_feature):
self.__train_feature = train_feature.copy()
self.__test_feature = test_feature.copy()
self.__categorical_index = None
self.__numeric_index = None
def data... | [
"numpy.where"
] | [((464, 513), 'numpy.where', 'np.where', (["(self.__train_feature.dtypes == 'object')"], {}), "(self.__train_feature.dtypes == 'object')\n", (472, 513), True, 'import numpy as np\n'), ((548, 597), 'numpy.where', 'np.where', (["(self.__train_feature.dtypes != 'object')"], {}), "(self.__train_feature.dtypes != 'object')\... |
#!@PYTHON_EXECUTABLE@
# MIT License
#
# Copyright (c) 2018, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy). All rights reserved.
#
# Permission is hereby granted, free of charge, to any person o... | [
"unittest.main",
"hatchet.GraphFrame.from_timemory",
"timemory.settings.parse",
"timemory.get",
"mpi4py.MPI.COMM_WORLD.Get_rank",
"numpy.ones",
"timemory.component.CurrentPeakRss.id",
"os.path.join",
"timemory.initialize"
] | [((1681, 1706), 'mpi4py.MPI.COMM_WORLD.Get_rank', 'MPI.COMM_WORLD.Get_rank', ([], {}), '()\n', (1704, 1706), False, 'from mpi4py import MPI\n'), ((5697, 5712), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5710, 5712), False, 'import unittest\n'), ((5746, 5772), 'timemory.initialize', 'tim.initialize', (['[__fil... |
import re
import numpy as np
import tqdm
from scipy.spatial.distance import pdist
from .paths import paths
from suggestion.tokenization import sentence_per_line_tokenize
import pandas as pd
def load_reviews():
data = pd.read_pickle(str(paths.preproc / 'all_data.pkl'))
reviews = data['data'].reset_index(drop=T... | [
"numpy.random.seed",
"sklearn.feature_extraction.text.TfidfVectorizer",
"suggestion.clustering.ConceptNetNumberBatch.load",
"suggestion.tokenization.sentence_per_line_tokenize",
"numpy.mean",
"scipy.spatial.distance.pdist",
"numpy.full_like",
"traceback.print_exc",
"numpy.cumsum",
"numpy.linspace"... | [((416, 433), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (430, 433), True, 'import numpy as np\n'), ((507, 538), 'numpy.random.permutation', 'np.random.permutation', (['num_docs'], {}), '(num_docs)\n', (528, 538), True, 'import numpy as np\n'), ((628, 653), 'numpy.split', 'np.split', (['indices', 's... |
# Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... | [
"unittest.main",
"tempfile.TemporaryDirectory",
"parameterized.parameterized.expand",
"monai.transforms.LoadImaged",
"numpy.random.randint",
"monai.data.PersistentDataset",
"numpy.eye",
"os.path.join",
"monai.transforms.SimulateDelayd"
] | [((2766, 2827), 'parameterized.parameterized.expand', 'parameterized.expand', (['[TEST_CASE_1, TEST_CASE_2, TEST_CASE_3]'], {}), '([TEST_CASE_1, TEST_CASE_2, TEST_CASE_3])\n', (2786, 2827), False, 'from parameterized import parameterized\n'), ((7387, 7402), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7400, 740... |
"""
.. _greedy-ar:
Autoregressive model
----------------------------------------------------------------------------------------------------
Greedy change point detection for piecewise autoregressive signals.
Sequential algorithm.
"""
import numpy as np
from numpy.lib.stride_tricks import as_strided
from numpy.linal... | [
"numpy.linalg.lstsq",
"numpy.zeros",
"numpy.ones",
"numpy.lib.stride_tricks.as_strided",
"numpy.arange",
"numpy.column_stack"
] | [((1517, 1605), 'numpy.arange', 'np.arange', ([], {'start': '(self.jump - self.order)', 'stop': '(n_samples - self.jump)', 'step': 'self.jump'}), '(start=self.jump - self.order, stop=n_samples - self.jump, step=\n self.jump)\n', (1526, 1605), True, 'import numpy as np\n'), ((4106, 4180), 'numpy.lib.stride_tricks.as_... |
from PIL import Image
import numpy as np
arr = np.random.uniform(size=(3,256,256))*255
arr = np.ascontiguousarray(arr.transpose(1,2,0))
img = Image.fromarray(arr, 'RGB')
img.save('out.png')
| [
"PIL.Image.fromarray",
"numpy.random.uniform"
] | [((143, 170), 'PIL.Image.fromarray', 'Image.fromarray', (['arr', '"""RGB"""'], {}), "(arr, 'RGB')\n", (158, 170), False, 'from PIL import Image\n'), ((48, 85), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': '(3, 256, 256)'}), '(size=(3, 256, 256))\n', (65, 85), True, 'import numpy as np\n')] |
# Standard Library
from up.utils.general.fp16_helper import to_float32
import time
# Import from third library
import numpy as np
import torch
from up.utils.general.global_flag import ALIGNED_FLAG
from up.extensions import gpu_iou_overlap
GPU_MEMORY = None
def allow_empty_tensor(num=1, empty_shape=(0, 4)):
"""... | [
"torch.cuda.synchronize",
"numpy.sum",
"torch.cuda.max_memory_allocated",
"torch.randn",
"numpy.mean",
"numpy.exp",
"torch.FloatTensor",
"torch.exp",
"numpy.max",
"torch.is_tensor",
"torch.log",
"torch.cuda.memory_allocated",
"numpy.average",
"torch.where",
"up.extensions.gpu_iou_overlap... | [((1397, 1426), 'torch.cuda.memory_allocated', 'torch.cuda.memory_allocated', ([], {}), '()\n', (1424, 1426), False, 'import torch\n'), ((2893, 2930), 'torch.max', 'torch.max', (['b1[:, None, :2]', 'b2[:, :2]'], {}), '(b1[:, None, :2], b2[:, :2])\n', (2902, 2930), False, 'import torch\n'), ((2940, 2979), 'torch.min', '... |
import numpy
class ClippingFilter(object):
"""Clips a value to given limits
"""
def __init__(self, min_value, max_value, u_init=None):
"""Constructor
Arguments:
min_value: the minimum value permitted for the output
max_value: the maximum value permitted for the outp... | [
"numpy.abs",
"numpy.clip",
"numpy.sign"
] | [((1130, 1181), 'numpy.clip', 'numpy.clip', (['value', 'self._min_value', 'self._max_value'], {}), '(value, self._min_value, self._max_value)\n', (1140, 1181), False, 'import numpy\n'), ((2782, 2802), 'numpy.abs', 'numpy.abs', (['slew_rate'], {}), '(slew_rate)\n', (2791, 2802), False, 'import numpy\n'), ((2861, 2882), ... |
#https://github.com/marload/DeepRL-TensorFlow2
import tensorflow as tf
import tensorflow.keras.layers as kl
import logging
tf.get_logger().setLevel(logging.ERROR)
import datetime
import gym
import argparse
import numpy as np
from collections import deque
import random
from gym import wrappers
import os
os.environ['T... | [
"argparse.ArgumentParser",
"tensorflow.keras.layers.Dense",
"random.sample",
"numpy.argmax",
"visdom.Visdom",
"collections.deque",
"tensorflow.get_logger",
"tensorflow.one_hot",
"random.randint",
"tensorflow.keras.layers.InputLayer",
"numpy.reshape",
"datetime.datetime.now",
"tensorflow.opti... | [((1864, 1872), 'visdom.Visdom', 'Visdom', ([], {}), '()\n', (1870, 1872), False, 'from visdom import Visdom\n'), ((412, 437), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (435, 437), False, 'import argparse\n'), ((12567, 12585), 'gym.make', 'gym.make', (['args.env'], {}), '(args.env)\n', (12... |
import tensorflow as tf
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from remtime import *
from collections import deque
from remtime import printTime
# top_param
LEARNING_RATE = 0.001
BATCH_SIZE = 2000
TS_BATCH_SIZE = 1000
N_EPOCHS = 26
REG_PENALTY = 0.25
NUM_FEAT = 16
# LEARNI... | [
"matplotlib.pyplot.title",
"pandas.read_csv",
"numpy.clip",
"tensorflow.train.AdamOptimizer",
"tensorflow.multiply",
"numpy.mean",
"collections.deque",
"tensorflow.subtract",
"numpy.power",
"numpy.asfarray",
"tensorflow.placeholder",
"numpy.random.shuffle",
"matplotlib.pyplot.show",
"tenso... | [((485, 536), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {'name': '"""user_batch"""'}), "(tf.int32, [None], name='user_batch')\n", (499, 536), True, 'import tensorflow as tf\n'), ((551, 603), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {'name': '"""movie_batch"""'}), "... |
from __future__ import division, print_function
import os
import sys
import argparse
import zqtflearn
import tempfile
import urllib
import numpy as np
import pandas as pd
import tensorflow as tf
#-----------------------------------------------------------------------------
COLUMNS = ["age", "workclass", "fnlwgt", "... | [
"os.mkdir",
"tensorflow.reduce_sum",
"tensorflow.trainable_variables",
"pandas.read_csv",
"tensorflow.reset_default_graph",
"tensorflow.get_collection",
"tensorflow.reshape",
"sys.stdout.flush",
"numpy.exp",
"glob.glob",
"zqtflearn.embedding",
"tensorflow.greater",
"tensorflow.subtract",
"... | [((19811, 19835), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (19833, 19835), True, 'import tensorflow as tf\n'), ((19873, 19893), 'os.path.exists', 'os.path.exists', (['cdir'], {}), '(cdir)\n', (19887, 19893), False, 'import os\n'), ((20129, 20159), 'glob.glob', 'glob.glob', (["('%s/*... |
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3
import copy
import pytest
import numpy as np
from braindecode.datasets import MOABBDataset
from braindecode.datautil.preprocess import preprocess, zscore, scale, \
Preprocessor, filterbank, exponential_moving_demean, \
exponential_mov... | [
"braindecode.datautil.preprocess.exponential_moving_standardize",
"braindecode.datautil.preprocess.Preprocessor",
"braindecode.datautil.preprocess.MNEPreproc",
"numpy.ones",
"braindecode.datautil.preprocess.preprocess",
"numpy.unique",
"pytest.warns",
"numpy.random.RandomState",
"pytest.raises",
"... | [((726, 786), 'braindecode.datasets.MOABBDataset', 'MOABBDataset', ([], {'dataset_name': '"""BNCI2014001"""', 'subject_ids': '[1, 2]'}), "(dataset_name='BNCI2014001', subject_ids=[1, 2])\n", (738, 786), False, 'from braindecode.datasets import MOABBDataset\n'), ((800, 1004), 'braindecode.datautil.windowers.create_fixed... |
# Copyright (c) 2019, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"pandas.DataFrame",
"cuml.test.utils.array_equal",
"cudf.Series",
"cudf.DataFrame.from_pandas",
"numpy.asarray",
"sklearn.datasets.make_regression",
"pytest.param",
"numpy.array",
"numpy.int32",
"pytest.mark.parametrize"
] | [((1228, 1289), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""datatype"""', '[np.float32, np.float64]'], {}), "('datatype', [np.float32, np.float64])\n", (1251, 1289), False, 'import pytest\n'), ((1291, 1350), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""X_type"""', "['dataframe', 'ndarray'... |
import numpy as np
n = int(input())
a = np.array([input().split() for _ in range(n)],int)
b = np.array([input().split() for _ in range(n)],int)
print(np.dot(a,b)) | [
"numpy.dot"
] | [((152, 164), 'numpy.dot', 'np.dot', (['a', 'b'], {}), '(a, b)\n', (158, 164), True, 'import numpy as np\n')] |
import time
import requests
import multiprocessing
import numpy as np
from keras.models import load_model
from utils.img_process import process, yolo_img_process
import utils.yolo_util as yolo_util
from deepgtav.messages import Start, Stop, Scenario, Commands, frame2numpy, Dataset
from deepgtav.client import Client
imp... | [
"keras.models.load_model",
"deepgtav.messages.Scenario",
"deepgtav.messages.Commands",
"tensorflow.ConfigProto",
"utils.yolo_util.read_coco_names",
"utils.yolo_util.cpu_nms",
"tensorflow.get_default_graph",
"deepgtav.messages.Dataset",
"deepgtav.messages.frame2numpy",
"requests.request",
"deepgt... | [((384, 400), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (398, 400), True, 'import tensorflow as tf\n'), ((447, 472), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (457, 472), True, 'import tensorflow as tf\n'), ((668, 816), 'deepgtav.messages.Dataset', 'Dataset... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.