code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import numpy as np
import matplotlib.pyplot as plt
import os
import trimesh
from mpl_toolkits.mplot3d import axes3d
import time, warnings
from skimage import measure
import random
from sympy import sympify
warnings.filterwarnings("ignore")
class SingleFormulaBasedMaterial:
def __gyroid(self):
... | [
"trimesh.smoothing.filter_humphrey",
"matplotlib.pyplot.imshow",
"argparse.ArgumentParser",
"sympy.sympify",
"numpy.meshgrid",
"matplotlib.pyplot.axis",
"sympy.utilities.lambdify.lambdify",
"random.choice",
"trimesh.base.Trimesh",
"trimesh.voxel.ops.matrix_to_marching_cubes",
"numpy.logical_xor"... | [((209, 242), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (232, 242), False, 'import time, warnings\n'), ((996, 1019), 'sympy.sympify', 'sympify', (['self.__formula'], {}), '(self.__formula)\n', (1003, 1019), False, 'from sympy import sympify\n'), ((1124, 1155), 'sympy.... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 15 18:53:22 2021
@author: <NAME>
"""
import argparse
import numpy as np
from zdm import zdm
#import pcosmic
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cm
from scipy import interpolate
import matplotlib
from pkg_resources im... | [
"numpy.log10",
"matplotlib.pyplot.ylabel",
"zdm.misc_functions.get_zdm_grid",
"numpy.array",
"time.process_time",
"zdm.iteration.calc_likelihoods_2D",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.linspace",
"scipy.interpolate.splev",
... | [((621, 647), 'numpy.seterr', 'np.seterr', ([], {'divide': '"""ignore"""'}), "(divide='ignore')\n", (630, 647), True, 'import numpy as np\n'), ((723, 750), 'zdm.cosmology.set_cosmology', 'cos.set_cosmology', ([], {'H0': 'setH0'}), '(H0=setH0)\n', (740, 750), True, 'from zdm import cosmology as cos\n'), ((810, 888), 'zd... |
import numpy as np
def point_dist(a, b):
return np.sqrt(np.sum(np.square(a-b)))
def point_center(a, b):
return (a+b)/2
def face_sz(l_eye, r_eye, mouse):
return point_dist(mouse, point_center(l_eye, r_eye))
def face_bbox(l_eye, r_eye, mouse):
sz = face_sz(l_eye, r_eye, mouse)
center = poi... | [
"numpy.square"
] | [((68, 84), 'numpy.square', 'np.square', (['(a - b)'], {}), '(a - b)\n', (77, 84), True, 'import numpy as np\n')] |
import numpy as np
import tflearn
import sys
# Load CSV file
# For some reason, the CSV must have a single label column. So the dataset has a last dummy column.
from tflearn.data_utils import load_csv
input_data, dummy = load_csv("data.csv", columns_to_ignore=[5, 6, 7, 8])
input_labels, dummy = load_csv("data.csv", co... | [
"tflearn.DNN",
"sys.stdin.readline",
"numpy.array",
"tflearn.data_utils.load_csv",
"tflearn.regression",
"tflearn.fully_connected",
"tflearn.input_data"
] | [((222, 274), 'tflearn.data_utils.load_csv', 'load_csv', (['"""data.csv"""'], {'columns_to_ignore': '[5, 6, 7, 8]'}), "('data.csv', columns_to_ignore=[5, 6, 7, 8])\n", (230, 274), False, 'from tflearn.data_utils import load_csv\n'), ((297, 349), 'tflearn.data_utils.load_csv', 'load_csv', (['"""data.csv"""'], {'columns_... |
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_katex
import numpy as np
import plotly.express as px
from scipy import stats
from app import app
layout = html.Div([
dash_katex.DashKatex(
expression=r'f_X(x) = \frac{1}{b - a}'... | [
"dash.dependencies.Output",
"dash.dependencies.Input",
"plotly.express.line",
"numpy.linspace",
"scipy.stats.uniform.pdf",
"dash_katex.DashKatex",
"dash_core_components.Graph"
] | [((853, 876), 'numpy.linspace', 'np.linspace', (['a', 'b', '(1000)'], {}), '(a, b, 1000)\n', (864, 876), True, 'import numpy as np\n'), ((885, 915), 'scipy.stats.uniform.pdf', 'stats.uniform.pdf', (['x', 'a', '(b - a)'], {}), '(x, a, b - a)\n', (902, 915), False, 'from scipy import stats\n'), ((994, 1045), 'plotly.expr... |
import torch
import torch.utils.data
from rlkit.torch.pytorch_util import from_numpy
from torch import nn
from torch.autograd import Variable
from torch.nn import functional as F
from rlkit.pythonplusplus import identity
from rlkit.torch import pytorch_util as ptu
import numpy as np
class RefinementNetwork(nn.Module):... | [
"numpy.prod",
"torch.nn.ReLU",
"torch.nn.ModuleList",
"torch.nn.LSTM",
"torch.nn.Conv2d",
"numpy.stack",
"numpy.linspace",
"numpy.zeros",
"torch.nn.Linear",
"torch.zeros",
"torch.cat"
] | [((839, 848), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (846, 848), False, 'from torch import nn\n'), ((1731, 1746), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1744, 1746), False, 'from torch import nn\n'), ((1779, 1794), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1792, 1794), False,... |
import logging
from ledfxcontroller.devices import Device
import voluptuous as vol
import numpy as np
import sacn
import time
_LOGGER = logging.getLogger(__name__)
class E131Device(Device):
"""E1.31 device support"""
CONFIG_SCHEMA = vol.Schema({
vol.Required('host'): str,
vol.Required('univer... | [
"logging.getLogger",
"voluptuous.Required",
"sacn.sACNsender",
"voluptuous.Any",
"time.sleep",
"numpy.array",
"numpy.zeros",
"voluptuous.Coerce"
] | [((137, 164), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (154, 164), False, 'import logging\n'), ((1495, 1512), 'sacn.sACNsender', 'sacn.sACNsender', ([], {}), '()\n', (1510, 1512), False, 'import sacn\n'), ((2564, 2579), 'time.sleep', 'time.sleep', (['(1.5)'], {}), '(1.5)\n', (2574, ... |
import numpy as np
from scipy.stats import skew, kurtosis
__all__ = ['sky_noise_error', 'propagate_noise_error', 'mcnoise']
def sky_noise_error(nu_obs, nu_emit, nu_ch_bw, tint, a_eff, n_station, bmax):
"""Calculate instrument noise error of an interferometer.
This assume that Tsys is dominated by Tsky.
... | [
"numpy.random.normal",
"numpy.mean",
"numpy.sqrt",
"scipy.stats.kurtosis",
"numpy.asarray",
"scipy.stats.skew",
"numpy.std",
"numpy.var"
] | [((1127, 1145), 'numpy.asarray', 'np.asarray', (['nu_obs'], {}), '(nu_obs)\n', (1137, 1145), True, 'import numpy as np\n'), ((3402, 3434), 'numpy.var', 'np.var', (['(data + noise_arr)'], {'axis': '(1)'}), '(data + noise_arr, axis=1)\n', (3408, 3434), True, 'import numpy as np\n'), ((3453, 3483), 'scipy.stats.skew', 'sk... |
import pandas as pd
import matplotlib.pyplot as plt
from PPImage import PPImage
import numpy as np
from PIL import Image
import os
import config
def plot_df_count(df, column='diagnosis'):
df_plot = df[column].value_counts().sort_index()
print(df_plot)
df_plot.plot.bar(df_plot)
plt.show()
def preproces... | [
"PIL.Image.fromarray",
"os.listdir",
"os.makedirs",
"pandas.read_csv",
"PPImage.PPImage",
"numpy.array",
"numpy.sum",
"pandas.DataFrame",
"matplotlib.pyplot.show"
] | [((1692, 1720), 'PPImage.PPImage', 'PPImage', (['config.TARGET_IMAGE'], {}), '(config.TARGET_IMAGE)\n', (1699, 1720), False, 'from PPImage import PPImage\n'), ((1731, 1759), 'pandas.read_csv', 'pd.read_csv', (['config.CSV_PATH'], {}), '(config.CSV_PATH)\n', (1742, 1759), True, 'import pandas as pd\n'), ((1760, 1810), '... |
import sys
import numpy as np
import argparse
from PIL import Image
def find_message(img_path):
input_img = Image.open(img_path)
pixels = np.array(input_img)
colors = pixels.flatten()
message = ""
character_byte = 0x00
for i, color in enumerate(colors):
if i % 8 == 0 and i != 0:
... | [
"numpy.array",
"PIL.Image.open",
"argparse.ArgumentParser"
] | [((114, 134), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (124, 134), False, 'from PIL import Image\n'), ((148, 167), 'numpy.array', 'np.array', (['input_img'], {}), '(input_img)\n', (156, 167), True, 'import numpy as np\n'), ((1091, 1177), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (... |
import h5py
import numpy as np
import include.diag as diag
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
def angular_derivative(array, wvn):
return np.fft.ifft(1j * wvn * np.fft.fft(array))
quench_rates = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.fft.fft",
"h5py.File",
"numpy.real",
"include.diag.calculate_spin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((109, 132), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (123, 132), False, 'import matplotlib\n'), ((1740, 1787), 'matplotlib.pyplot.plot', 'plt.plot', (['quench_rates', 'spin_winding_list', '"""ko"""'], {}), "(quench_rates, spin_winding_list, 'ko')\n", (1748, 1787), True, 'import matplo... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 3 15:55:18 2014
@author: leo
"""
import numpy as np
import matplotlib.pyplot as plt
# Macros
pi = np.pi; exp = np.exp; arange = np.arange; zeros = np.zeros
indexed = lambda l, offset=0: zip(np.arange(len(l))+offset,l)
# Constantes
w = 2.0*pi*0.25
a0 = 6.0/4.0
# Funções
... | [
"numpy.abs",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.legend"
] | [((998, 1010), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1008, 1010), True, 'import matplotlib.pyplot as plt\n'), ((1141, 1158), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(-11)', '(11)'], {}), '(-11, 11)\n', (1149, 1158), True, 'import matplotlib.pyplot as plt\n'), ((1159, 1173), 'matplotlib.pyplot.gr... |
# -*- coding:utf-8 -*-
#
# cluster.py
"""Cluster module."""
import networkx as nx
import numpy as np
import pandas as pd
from .utils import flatten_dict
from .utils import get_within_cutoff_matrix
from .utils import pairwise_distances
class Cluster:
"""Object to store and compute data about an individual parti... | [
"numpy.abs",
"numpy.mean",
"numpy.allclose",
"numpy.linalg.eig",
"numpy.ones",
"numpy.where",
"numpy.sort",
"numpy.linalg.norm",
"numpy.any",
"numpy.sum",
"numpy.isnan",
"networkx.minimum_node_cut",
"pandas.DataFrame",
"numpy.all",
"numpy.imag",
"networkx.dfs_edges"
] | [((17203, 17227), 'networkx.dfs_edges', 'nx.dfs_edges', (['self.graph'], {}), '(self.graph)\n', (17215, 17227), True, 'import networkx as nx\n'), ((18066, 18120), 'numpy.all', 'np.all', (['(unwrapped_x_df.index == self.particle_df.index)'], {}), '(unwrapped_x_df.index == self.particle_df.index)\n', (18072, 18120), True... |
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
import gizmo_analysis as ga
import utilities as ga_ut
import sys
FIRE_elements = ['h','he','c','n','o','ne','mg','si','s','ca','fe']
FIRE_metals = ['c','n','o','ne','mg','si','s','ca','fe']
#
# wrapper to load data set a... | [
"numpy.histogram",
"numpy.log10",
"matplotlib.use",
"numpy.size",
"gizmo_analysis.agetracers.construct_yield_table",
"gizmo_analysis.io.Read.read_snapshots",
"numpy.max",
"numpy.sum",
"numpy.cumsum",
"numpy.min",
"numpy.percentile",
"gizmo_analysis.agetracers.FIRE2_yields",
"numpy.genfromtxt... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (32, 39), False, 'import matplotlib\n'), ((642, 715), 'gizmo_analysis.io.Read.read_snapshots', 'ga.io.Read.read_snapshots', (["['gas']", '"""index"""', '(0)'], {'simulation_directory': 'wdir'}), "(['gas'], 'index', 0, simulation_directory... |
import unittest
import numpy as np
from src.classical_processing.pre_processing import compute_sigma
from src.tests.test_data_sets import ExampleDataSetRef19, ExampleDataSetMain
class ComputeSigmaTestCase(unittest.TestCase):
def test_with_data_set_main(self):
self.skipTest("error unitary operation compu... | [
"numpy.trace",
"src.tests.test_data_sets.ExampleDataSetRef19",
"src.tests.test_data_sets.ExampleDataSetMain",
"unittest.main",
"src.classical_processing.pre_processing.compute_sigma"
] | [((1202, 1217), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1215, 1217), False, 'import unittest\n'), ((349, 369), 'src.tests.test_data_sets.ExampleDataSetMain', 'ExampleDataSetMain', ([], {}), '()\n', (367, 369), False, 'from src.tests.test_data_sets import ExampleDataSetRef19, ExampleDataSetMain\n'), ((484, ... |
import numpy as np
import numpy.testing
import pytest
from gl0learn import Bounds
from gl0learn.utils import ClosedInterval
@pytest.mark.parametrize(
"bounds", [(0, 0), (-1, -1), (1, 1), (np.NAN, np.NAN), (np.NAN, 1), (-1, np.NAN)]
)
def test_scalar_bad_bounds(bounds):
with pytest.raises(ValueError):
... | [
"numpy.ones",
"gl0learn.Bounds",
"gl0learn.utils.ClosedInterval",
"pytest.mark.parametrize",
"numpy.zeros",
"pytest.raises",
"numpy.arange"
] | [((128, 239), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bounds"""', '[(0, 0), (-1, -1), (1, 1), (np.NAN, np.NAN), (np.NAN, 1), (-1, np.NAN)]'], {}), "('bounds', [(0, 0), (-1, -1), (1, 1), (np.NAN, np.\n NAN), (np.NAN, 1), (-1, np.NAN)])\n", (151, 239), False, 'import pytest\n'), ((1695, 1710), 'gl0... |
from scipy import stats
import numpy as np
def simbolizar(X, m = 3):
"""
Convierte una serie numérica de valores a su versión simbólica basándose en
ventanas de m valores consecutivos.
Parámetros
----------
X : Serie a simbolizar
m : Longitud de la ventana
Regresa
--------... | [
"numpy.roll",
"scipy.stats.rankdata",
"numpy.array2string",
"numpy.log",
"numpy.array",
"numpy.empty",
"numpy.concatenate",
"numpy.log2"
] | [((633, 648), 'numpy.array', 'np.array', (['dummy'], {}), '(dummy)\n', (641, 648), True, 'import numpy as np\n'), ((903, 917), 'numpy.array', 'np.array', (['simX'], {}), '(simX)\n', (911, 917), True, 'import numpy as np\n'), ((3590, 3609), 'numpy.empty', 'np.empty', (['(pasos + 1)'], {}), '(pasos + 1)\n', (3598, 3609),... |
from nltk.tokenize import WordPunctTokenizer
import nltk.data
import numpy as np
import re
import os
root = os.path.dirname(os.path.abspath(__file__))
##################
# TEXTS INVOLVED #
##################
##<NAME>
# 0:The Three Musketeers
# 1:Twenty Years After (D'Artagnan Series: Part Two)
# 2:The Count of Monte ... | [
"nltk.tokenize.WordPunctTokenizer",
"numpy.log",
"numpy.random.multinomial",
"numpy.exp",
"os.path.abspath",
"re.sub",
"re.search"
] | [((125, 150), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (140, 150), False, 'import os\n'), ((1224, 1256), 're.sub', 're.sub', (['rulesMeta[idx]', '""""""', 'file'], {}), "(rulesMeta[idx], '', file)\n", (1230, 1256), False, 'import re\n'), ((2541, 2550), 'numpy.log', 'np.log', (['a'], {})... |
from pathlib import Path
import hydra
import numpy as np
import torch
from hydra.utils import to_absolute_path
from nnsvs.base import PredictionType
from nnsvs.mdn import mdn_loss
from nnsvs.pitch import nonzero_segments
from nnsvs.train_util import save_checkpoint, setup
from nnsvs.util import make_non_pad_mask
from ... | [
"torch.sort",
"numpy.allclose",
"hydra.main",
"nnsvs.mdn.mdn_loss",
"nnsvs.pitch.nonzero_segments",
"nnsvs.train_util.save_checkpoint",
"torch.nn.MSELoss",
"nnsvs.train_util.setup",
"hydra.utils.to_absolute_path",
"omegaconf.OmegaConf.save",
"torch.finfo",
"torch.cuda.is_available",
"nnsvs.u... | [((11126, 11190), 'hydra.main', 'hydra.main', ([], {'config_path': '"""conf/train_resf0"""', 'config_name': '"""config"""'}), "(config_path='conf/train_resf0', config_name='config')\n", (11136, 11190), False, 'import hydra\n'), ((723, 757), 'nnsvs.pitch.nonzero_segments', 'nonzero_segments', (['lf0_score_denorm'], {}),... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import StratifiedKFold
from sklearn.linear_model import Perceptron
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive... | [
"sklearn.naive_bayes.ComplementNB",
"sklearn.svm.SVC",
"sklearn.linear_model.Perceptron",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.model_selection.StratifiedKFold",
"n... | [((1312, 1387), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': 'folds', 'shuffle': 'shuffle', 'random_state': 'random_state'}), '(n_splits=folds, shuffle=shuffle, random_state=random_state)\n', (1327, 1387), False, 'from sklearn.model_selection import StratifiedKFold\n'), ((2412, 2428),... |
import paddle
import numpy as np
from ppgan.models.generators.generator_styleganv2ada import StyleGANv2ADA_AugmentPipe
# 默认配置
xflip = 0
rotate90 = 0
xint = 0
xint_max = 0.125
scale = 0
rotate = 0
aniso = 0
xfrac = 0
scale_std = 0.2
rotate_max = 1
aniso_std = 0.2
xfrac_std = 0.125
brightness = 0
contrast = 0
lumaflip... | [
"numpy.mean",
"paddle.ones",
"ppgan.models.generators.generator_styleganv2ada.StyleGANv2ADA_AugmentPipe",
"numpy.sum",
"paddle.to_tensor",
"numpy.load"
] | [((1463, 1797), 'ppgan.models.generators.generator_styleganv2ada.StyleGANv2ADA_AugmentPipe', 'StyleGANv2ADA_AugmentPipe', (['xflip', 'rotate90', 'xint', 'xint_max', 'scale', 'rotate', 'aniso', 'xfrac', 'scale_std', 'rotate_max', 'aniso_std', 'xfrac_std', 'brightness', 'contrast', 'lumaflip', 'hue', 'saturation', 'brigh... |
import Examples.metadata_manager_results as results_manager
import Source.io_util as io
import numpy as np
import os
def improvements_err_speedup_size(obj: np.ndarray, ref: np.ndarray, i_obj=0) -> np.ndarray:
assert obj.shape[1] > i_obj and ref.shape[0] > i_obj
valid = obj[:, i_obj] < ref[i_obj]
obj = o... | [
"numpy.less",
"numpy.ones",
"os.path.join",
"numpy.array",
"numpy.zeros",
"numpy.argmin",
"Examples.metadata_manager_results.get_ids_by_fieldval",
"Examples.metadata_manager_results.get_results_by_id"
] | [((349, 386), 'numpy.ones', 'np.ones', (['(obj.shape[1], obj.shape[1])'], {}), '((obj.shape[1], obj.shape[1]))\n', (356, 386), True, 'import numpy as np\n'), ((1007, 1044), 'numpy.ones', 'np.ones', (['(obj.shape[1], obj.shape[1])'], {}), '((obj.shape[1], obj.shape[1]))\n', (1014, 1044), True, 'import numpy as np\n'), (... |
""" Classes to implement the artificial bee colony algorithm. """
from numpy.random import uniform
class Colony:
""" Implements the artificial bee colony algorithm.
Args:
objective: objective function called by each bee at each food source.
Must return a "honey" value that will be max... | [
"numpy.random.uniform"
] | [((4169, 4180), 'numpy.random.uniform', 'uniform', (['*v'], {}), '(*v)\n', (4176, 4180), False, 'from numpy.random import uniform\n')] |
import numpy as np
import scipy as sp
from ipdb import set_trace as st
import skimage as ski
import utils
from matplotlib import pyplot as plt
import matplotlib as mpl
from common import *
from munch import Munch as M
from scipy import sparse
from scipy.interpolate import Rbf
import os
class Register:
def __init__... | [
"utils.get_nearest_neighbors",
"numpy.unique",
"numpy.ones",
"utils.nearby_pairs",
"numpy.arange",
"numpy.sort",
"numpy.stack",
"numpy.zeros",
"os.path.basename",
"numpy.linalg.norm",
"numpy.percentile",
"munch.Munch",
"numpy.save",
"utils.fit_affine"
] | [((383, 574), 'munch.Munch', 'M', ([], {'max_stars': '(500)', 'nneighbors': '(500)', 'ba_max_ratio': '(0.99)', 'cb_max_ratio': '(0.99)', 'epsilon': '(0.001)', 'min_abs_diff': '(1)', 'min_rel_diff': '(1.4)', 'ransac_iters': '(50)', 'ransac_keep_percentile': '(99)', 'linear_fit_tol': '(2.0)'}), '(max_stars=500, nneighbor... |
"""
@author : <NAME>
@date : 1-10-2021
Ensemble Learning is an often overshadowed and underestimated field of machine learning. Here we provide 2 algorithms
central to the game - random forests and ensemble/voting classifier. Random Forests are very especially fast
with parallel processing to fit multiple decision tre... | [
"random.sample",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"multiprocessing.cpu_count",
"joblib.delayed",
"numpy.array_split",
"numpy.array",
"joblib.Parallel",
"joblib.parallel_backend",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.cla",
"warnings.filterwa... | [((521, 576), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (544, 576), False, 'import warnings\n'), ((6863, 6872), 'matplotlib.pyplot.cla', 'plt.cla', ([], {}), '()\n', (6870, 6872), True, 'import matplotlib.pyplot as plt\n'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
activations = nn.ModuleDict([
['sigmoid', nn.Sigmoid()],
['tanh', nn.Tanh()],
['lrelu', nn.LeakyReLU()],
['relu', nn.ReLU()],
['selu', nn.SELU()],
... | [
"numpy.prod",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.Tanh",
"torch.nn.Sequential",
"torch.nn.BatchNorm1d",
"torch.nn.MaxPool1d",
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"torch.nn.init.xavier_uniform_",
"torch.nn.AdaptiveAvgPool2d",
"torch.randn",
"torch.nn.LeakyReLU",
"numpy.fl... | [((626, 657), 'torch.randn', 'torch.randn', (['(1)', '(1)', '*input_shape'], {}), '(1, 1, *input_shape)\n', (637, 657), False, 'import torch\n'), ((726, 746), 'numpy.prod', 'np.prod', (['x.shape[1:]'], {}), '(x.shape[1:])\n', (733, 746), True, 'import numpy as np\n'), ((14486, 14514), 'torch.rand', 'torch.rand', (['(2,... |
# coding=utf-8
import math
import types
import numpy as np
import pandas as pd
from ....data.materials.CompositionEntry import CompositionEntry
from ....data.materials.util.LookUpData import LookUpData
class YangOmegaAttributeGenerator:
"""Class to compute the attributes :math:`\Omega` and :math:`\delta`
devel... | [
"pandas.DataFrame",
"math.sqrt",
"math.log",
"numpy.average"
] | [((5705, 5752), 'pandas.DataFrame', 'pd.DataFrame', (['feat_values'], {'columns': 'feat_headers'}), '(feat_values, columns=feat_headers)\n', (5717, 5752), True, 'import pandas as pd\n'), ((4572, 4616), 'numpy.average', 'np.average', (['tmp_meltingT'], {'weights': 'elem_fracs'}), '(tmp_meltingT, weights=elem_fracs)\n', ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 27 15:54:52 2019
@author: <NAME>.
"""
#importing the libraries.
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
import torch.autograd as variable
from sklearn.model_selection import train_test_... | [
"torch.abs",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.zeros",
"torch.FloatTensor"
] | [((637, 695), 'sklearn.model_selection.train_test_split', 'train_test_split', (['test_set'], {'test_size': '(0.5)', 'random_state': '(42)'}), '(test_set, test_size=0.5, random_state=42)\n', (653, 695), False, 'from sklearn.model_selection import train_test_split\n'), ((495, 541), 'pandas.read_csv', 'pd.read_csv', (['""... |
'''
SpeakDiar.py
21 audio recordings of academic conferences making up the NIST speaker
diarization dataset, created to asses the ability of different models to
segment speech data into unique speakers.
The 21 recordings are meant to be trained on independently.
Thus, get_data() takes a meetingNum parameter (default ... | [
"matplotlib.pylab.xlim",
"matplotlib.pylab.xticks",
"numpy.argsort",
"matplotlib.pylab.hold",
"bnpy.data.GroupXData.read_from_mat",
"matplotlib.pylab.show",
"argparse.ArgumentParser",
"numpy.asarray",
"os.path.isdir",
"numpy.maximum",
"matplotlib.pylab.plot",
"numpy.allclose",
"numpy.size",
... | [((1925, 1950), 'os.path.isdir', 'os.path.isdir', (['datasetdir'], {}), '(datasetdir)\n', (1938, 1950), False, 'import os\n'), ((2583, 2651), 'os.path.join', 'os.path.join', (['datasetdir', '"""rawData"""', '"""speakerDiarizationData"""', 'fName'], {}), "(datasetdir, 'rawData', 'speakerDiarizationData', fName)\n", (259... |
# -*- coding: utf-8 -*-
"""
Clase perteneciente al módulo de procesamiento de datos e inferencias Ama.
.. module:: dbscan_processor
:platform: Unix
:synopsis: Detección de clusters de tormenta utilizando el algoritmo DBSCAN.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import ama.utils as utils
import ama.processor... | [
"ama.processor.Processor.process",
"shapely.geometry.MultiPoint",
"numpy.column_stack",
"numpy.ndenumerate",
"matplotlib.pyplot.style.use",
"numpy.array",
"wradlib.georef.polar2lonlat",
"geopy.distance.great_circle",
"numpy.matrix",
"time.time",
"matplotlib.pyplot.subplots",
"sklearn.cluster.D... | [((3043, 3080), 'ama.processor.Processor.process', 'processor.Processor.process', (['filename'], {}), '(filename)\n', (3070, 3080), True, 'import ama.processor as processor\n'), ((3358, 3403), 'numpy.ndenumerate', 'np.ndenumerate', (["data[layer_key][u'Z']['data']"], {}), "(data[layer_key][u'Z']['data'])\n", (3372, 340... |
import cv2
import numpy as np
from PIL import Image
from PIL import ImageDraw
from subprocess import Popen, PIPE
import pycocotools.mask as coco_mask_util
def draw_bboxes(image, bboxes, labels=None, output_file=None, fill='red'):
"""
Draw bounding boxes on image.
Return image with drawings as BGR ndarray.... | [
"PIL.Image.fromarray",
"PIL.Image.open",
"subprocess.Popen",
"numpy.array",
"PIL.ImageDraw.Draw"
] | [((926, 947), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['image'], {}), '(image)\n', (940, 947), False, 'from PIL import ImageDraw\n'), ((2274, 2322), 'subprocess.Popen', 'Popen', (['cmd'], {'stdin': 'PIPE', 'stdout': 'PIPE', 'stderr': 'PIPE'}), '(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)\n', (2279, 2322), False, 'from... |
#!/usr/bin/env python3
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
"warnings.warn",
"numpy.prod"
] | [((2584, 2689), 'warnings.warn', 'warn', (['(\'Please use class "hnets.hnet_interface.CLHyperNetInterface" \' + \'instead.\')', 'DeprecationWarning'], {}), '(\'Please use class "hnets.hnet_interface.CLHyperNetInterface" \' +\n \'instead.\', DeprecationWarning)\n', (2588, 2689), False, 'from warnings import warn\n'),... |
import io
import time
from functools import lru_cache
from urllib.error import HTTPError
import numpy as np
import pandas as pd
import requests
import sidekick as sk
import mundi
from mundi import transforms
from ..cache import ttl_cache
from ..logging import log
from ..utils import today
HOURS = 3600
TIMEOUT = 6 * ... | [
"mundi.transforms.sum_children",
"pandas.read_csv",
"numpy.arange",
"io.BytesIO",
"sidekick.retry",
"requests.get",
"sidekick.import_later",
"mundi.region",
"mundi.code",
"pandas.DataFrame",
"functools.lru_cache",
"time.time",
"pandas.to_datetime",
"mundi.regions"
] | [((2205, 2228), 'sidekick.retry', 'sk.retry', (['(10)'], {'sleep': '(0.5)'}), '(10, sleep=0.5)\n', (2213, 2228), True, 'import sidekick as sk\n'), ((4286, 4309), 'sidekick.retry', 'sk.retry', (['(10)'], {'sleep': '(0.5)'}), '(10, sleep=0.5)\n', (4294, 4309), True, 'import sidekick as sk\n'), ((5195, 5218), 'sidekick.re... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from packaging import version
import dask
import dask.array as da
import numpy as np
import pytest
import scipy
import scipy.ndimage
import dask_image.ndinterp
# mode lists for the case with prefilter = False
_supported_modes = ['constant', 'nearest', 'reflect', 'mirror... | [
"numpy.dtype",
"dask.array.from_array",
"numpy.allclose",
"pytest.skip",
"numpy.random.random",
"pytest.mark.parametrize",
"pytest.importorskip",
"pytest.raises",
"numpy.random.seed",
"numpy.empty",
"packaging.version.parse",
"cupy.asarray"
] | [((3241, 3280), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n"""', '[1, 2, 3]'], {}), "('n', [1, 2, 3])\n", (3264, 3280), False, 'import pytest\n'), ((3282, 3324), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""axis_size"""', '[64]'], {}), "('axis_size', [64])\n", (3305, 3324), False, 'impo... |
"""Stereographic projection module."""
import numpy as np
from .__main__ import Projection
from ..angles import DEC, RA
class Sky(Projection):
"""Stereographic projection object.
Parameters
----------
ra: float, optional
Center west longitude.
dec: float, optional
Center latitud... | [
"numpy.prod",
"numpy.reshape",
"numpy.power",
"numpy.arcsin",
"numpy.ndim",
"numpy.array",
"numpy.dot",
"numpy.arctan2",
"numpy.shape",
"numpy.divide"
] | [((2153, 2242), 'numpy.array', 'np.array', (['[[self.__cdec, 0, self.__sdec], [0, 1, 0], [-self.__sdec, 0, self.__cdec]]'], {}), '([[self.__cdec, 0, self.__sdec], [0, 1, 0], [-self.__sdec, 0, self.\n __cdec]])\n', (2161, 2242), True, 'import numpy as np\n'), ((2299, 2384), 'numpy.array', 'np.array', (['[[self.__cra,... |
"""Generate a single discrete time SIR model.
"""
from . import data_model
import numpy as np
from scipy import stats
import xarray as xr
# Generate Betas
# Beta, or the growth rate of the infection, depends on the covariates.
# Here we implement three different functional forms for the dependency.
SPLIT_TIME = 100
... | [
"numpy.ones",
"scipy.stats.binom.rvs",
"numpy.log",
"xarray.concat",
"xarray.zeros_like",
"numpy.random.randint",
"numpy.zeros",
"numpy.exp",
"numpy.array",
"xarray.DataArray",
"numpy.random.uniform",
"numpy.concatenate",
"numpy.matmul",
"numpy.random.binomial"
] | [((1768, 1823), 'xarray.DataArray', 'xr.DataArray', (['beta_np'], {'dims': "{'location': num_locations}"}), "(beta_np, dims={'location': num_locations})\n", (1780, 1823), True, 'import xarray as xr\n'), ((2910, 2927), 'numpy.ones', 'np.ones', (['num_pred'], {}), '(num_pred)\n', (2917, 2927), True, 'import numpy as np\n... |
'''
@Author: JosieHong
@Date: 2020-04-26 12:40:11
@LastEditAuthor: JosieHong
LastEditTime: 2021-07-11 12:52:18
'''
import os.path as osp
import warnings
import math
import cv2
import mmcv
import numpy as np
from imagecorruptions import corrupt
from mmcv.parallel import DataContainer as DC
import torch
from .utils imp... | [
"numpy.random.rand",
"numpy.hstack",
"torch.sqrt",
"math.sqrt",
"mmcv.imrescale",
"cv2.contourArea",
"torch.sort",
"torch.Tensor",
"torch.cat",
"imagecorruptions.corrupt",
"torch.stack",
"os.path.join",
"torch.atan2",
"mmcv.parallel.DataContainer",
"torch.tensor",
"mmcv.imcrop",
"cv2... | [((11949, 11990), 'torch.cat', 'torch.cat', (['expanded_regress_ranges'], {'dim': '(0)'}), '(expanded_regress_ranges, dim=0)\n', (11958, 11990), False, 'import torch\n'), ((12015, 12045), 'torch.cat', 'torch.cat', (['all_level_points', '(0)'], {}), '(all_level_points, 0)\n', (12024, 12045), False, 'import torch\n'), ((... |
import numpy as np
import pandas as pd
from nilearn import image, input_data
from nilearn.datasets import load_mni152_brain_mask
def get_masker(mask_img=None, target_affine=None):
if isinstance(mask_img, input_data.NiftiMasker):
return mask_img
if mask_img is None:
mask_img = load_mni152_brai... | [
"nilearn.image.new_img_like",
"numpy.atleast_2d",
"numpy.eye",
"numpy.linalg.pinv",
"nilearn.image.load_img",
"numpy.floor",
"numpy.ndim",
"nilearn.image.smooth_img",
"numpy.diag",
"numpy.zeros",
"nilearn.datasets.load_mni152_brain_mask",
"pandas.DataFrame",
"nilearn.image.resample_img",
"... | [((907, 928), 'numpy.atleast_2d', 'np.atleast_2d', (['coords'], {}), '(coords)\n', (920, 928), True, 'import numpy as np\n'), ((1275, 1299), 'nilearn.image.load_img', 'image.load_img', (['mask_img'], {}), '(mask_img)\n', (1289, 1299), False, 'from nilearn import image, input_data\n'), ((1360, 1384), 'numpy.zeros', 'np.... |
# authors: <NAME>, Manish
# date: 2020-01-23
"""Calculates MSE error for test set
Usage: src/vegas_test_results.py --test=<test> --out_dir=<out_dir>
Options:
--test=<test> Path (including filename) to training data
--out_dir=<out_dir> Path to directory where model results on test set need to be saved
"""
... | [
"pandas.read_csv",
"sklearn.metrics.mean_squared_error",
"warnings.simplefilter",
"numpy.load",
"docopt.docopt"
] | [((995, 1057), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (1016, 1057), False, 'import warnings\n'), ((1087, 1102), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (1093, 1102), False, 'from... |
""" Matrix profile anomaly detection.
Reference:
<NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>., <NAME>. (2016, December).
Matrix profile I: all pairs similarity joins for time series: a unifying view that includes motifs, discords and shapelets.
In Data Mining (ICDM), 2016 IEEE 16th International Co... | [
"pandas.Series",
"numpy.sqrt",
"numpy.ones",
"numpy.arange",
"numpy.divide",
"numpy.round",
"numpy.sort",
"numpy.where",
"scipy.signal.fftconvolve",
"numpy.array",
"numpy.zeros",
"numpy.dot",
"numpy.sum",
"numpy.concatenate",
"numpy.linalg.norm",
"numpy.cumsum",
"numpy.nan_to_num",
... | [((1605, 1621), 'numpy.nan_to_num', 'np.nan_to_num', (['T'], {}), '(T)\n', (1618, 1621), True, 'import numpy as np\n'), ((1685, 1697), 'pandas.Series', 'pd.Series', (['T'], {}), '(T)\n', (1694, 1697), True, 'import pandas as pd\n'), ((3673, 3685), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (3681, 3685), True, '... |
import numpy as np
import random
def is_valid(pos, board):
try:
board[pos[0]][pos[1]]
except IndexError:
return False
if min(pos) < 0:
return False
return True
def _next_move(pos, board):
moves = {
"RIGHT": np.array((0, 1)),
"UP": np.array((-1, 0)),
... | [
"numpy.array",
"random.randint"
] | [((263, 279), 'numpy.array', 'np.array', (['(0, 1)'], {}), '((0, 1))\n', (271, 279), True, 'import numpy as np\n'), ((295, 312), 'numpy.array', 'np.array', (['(-1, 0)'], {}), '((-1, 0))\n', (303, 312), True, 'import numpy as np\n'), ((330, 347), 'numpy.array', 'np.array', (['(0, -1)'], {}), '((0, -1))\n', (338, 347), T... |
import numpy as np
import cv2
import collections
import numbers
import random
import math
import copy
from up.data.datasets.transforms import Augmentation
from up.utils.general.registry_factory import AUGMENTATION_REGISTRY
@AUGMENTATION_REGISTRY.register('color_jitter_mmseg')
class RandomColorJitterMMSeg(Augmentatio... | [
"numpy.clip",
"numpy.uint8",
"up.utils.general.registry_factory.AUGMENTATION_REGISTRY.register",
"math.sqrt",
"numpy.asanyarray",
"copy.copy",
"numpy.asarray",
"random.randint",
"random.uniform",
"cv2.warpAffine",
"random.choice",
"numpy.random.choice",
"numpy.around",
"cv2.cvtColor",
"c... | [((227, 279), 'up.utils.general.registry_factory.AUGMENTATION_REGISTRY.register', 'AUGMENTATION_REGISTRY.register', (['"""color_jitter_mmseg"""'], {}), "('color_jitter_mmseg')\n", (257, 279), False, 'from up.utils.general.registry_factory import AUGMENTATION_REGISTRY\n'), ((3806, 3850), 'up.utils.general.registry_facto... |
from numpy.core.numeric import count_nonzero
import pandas as pd
import numpy as np
import re
data = pd.read_csv("data/day13.csv", header = None, dtype=str, delimiter= '\n')[0]
codes = [re.split("\s\S\S\s", word) for word in data.values][1:]
# Challenge 1
word = np.array(data.values)[0]
c_dic = {c[0]:c[1] for c in co... | [
"numpy.array",
"pandas.read_csv",
"re.split"
] | [((102, 171), 'pandas.read_csv', 'pd.read_csv', (['"""data/day13.csv"""'], {'header': 'None', 'dtype': 'str', 'delimiter': '"""\n"""'}), "('data/day13.csv', header=None, dtype=str, delimiter='\\n')\n", (113, 171), True, 'import pandas as pd\n'), ((265, 286), 'numpy.array', 'np.array', (['data.values'], {}), '(data.valu... |
import argparse
import pickle
import numpy as np
from numba import njit
@njit
def count_trees(tau, phi, order, traversal):
assert traversal == 'dfs' or traversal == 'bfs'
K = len(tau)
expected_colsum = np.ones(K)
expected_colsum[0] = 0
first_partial = np.copy(tau)
np.fill_diagonal(first_partial, 0)
firs... | [
"numpy.copy",
"numpy.eye",
"numpy.ones",
"argparse.ArgumentParser",
"pickle.load",
"numpy.fill_diagonal",
"numpy.any",
"numpy.argsort",
"numpy.sum",
"numpy.nonzero",
"numpy.all"
] | [((209, 219), 'numpy.ones', 'np.ones', (['K'], {}), '(K)\n', (216, 219), True, 'import numpy as np\n'), ((264, 276), 'numpy.copy', 'np.copy', (['tau'], {}), '(tau)\n', (271, 276), True, 'import numpy as np\n'), ((279, 313), 'numpy.fill_diagonal', 'np.fill_diagonal', (['first_partial', '(0)'], {}), '(first_partial, 0)\n... |
import numpy as np
class OUNoiseGenerator(object):
def __init__(self, action_dim, action_low, action_high,
mu=0.0, theta=0.15, max_sigma=0.3, min_sigma=0.3, decay_period=100000):
self.mu_ = mu
self.theta_ = theta
self.sigma_ = max_sigma
self.max_sigma_ = max_sigma
... | [
"numpy.clip",
"numpy.random.randn",
"numpy.ones"
] | [((1035, 1084), 'numpy.clip', 'np.clip', (['(action + ou_state)', 'self.low_', 'self.high_'], {}), '(action + ou_state, self.low_, self.high_)\n', (1042, 1084), True, 'import numpy as np\n'), ((592, 617), 'numpy.ones', 'np.ones', (['self.action_dim_'], {}), '(self.action_dim_)\n', (599, 617), True, 'import numpy as np\... |
import numpy as np
def measure_curvature_pixels(y_eval, left_fit, right_fit):
'''
Calculates the curvature of polynomial functions in pixels.
PARAMETERS
* y_eval : where we want radius of curvature to be evaluated (We'll choose the maximum y-value, bottom of image)
'''
# Calculation of R_curve ... | [
"numpy.absolute",
"numpy.polyfit"
] | [((1317, 1374), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(left_fitx * xm_per_pix)', '(2)'], {}), '(ploty * ym_per_pix, left_fitx * xm_per_pix, 2)\n', (1327, 1374), True, 'import numpy as np\n'), ((1390, 1448), 'numpy.polyfit', 'np.polyfit', (['(ploty * ym_per_pix)', '(right_fitx * xm_per_pix)', '(2)'],... |
from collections import namedtuple
import re
import glob
import os.path
import numpy as np
import scipy.io.wavfile as wavfile
import scipy.signal as signal
import math
import paths
from minimum_phase import minimum_phase
files = glob.glob(os.path.join(paths.data_path, "elev*", "L*.wav"), recursive=True)
def to_coords... | [
"collections.namedtuple",
"numpy.sqrt",
"numpy.minimum",
"numpy.fft.fft",
"re.match",
"scipy.signal.blackmanharris",
"scipy.io.wavfile.read",
"minimum_phase.minimum_phase"
] | [((2678, 2795), 'collections.namedtuple', 'namedtuple', (['"""HrtfData"""', "['num_elevs', 'elev_increment', 'elev_min', 'num_azimuths', 'azimuths',\n 'impulse_length']"], {}), "('HrtfData', ['num_elevs', 'elev_increment', 'elev_min',\n 'num_azimuths', 'azimuths', 'impulse_length'])\n", (2688, 2795), False, 'from... |
import itertools as it
import math
from . import base_objs
import gen_basis_helpers.shared.misc_utils as misc
import numpy as np
class BroadenFunctCompositeStandard(base_objs.BroadenFunctionStandard):
leafObjs = misc.StandardComponentDescriptor("leafObjs")
def __init__(self, objs:iter):
""" Initializer for comp... | [
"itertools.zip_longest",
"gen_basis_helpers.shared.misc_utils.StandardComponentDescriptor",
"math.sqrt",
"math.log",
"numpy.exp",
"numpy.array"
] | [((217, 261), 'gen_basis_helpers.shared.misc_utils.StandardComponentDescriptor', 'misc.StandardComponentDescriptor', (['"""leafObjs"""'], {}), "('leafObjs')\n", (249, 261), True, 'import gen_basis_helpers.shared.misc_utils as misc\n'), ((1318, 1347), 'itertools.zip_longest', 'it.zip_longest', (['vals', 'allObjs'], {}),... |
from abc import ABC
from dataclasses import asdict, dataclass
from typing import Any, Dict, List, Optional, Sequence, Union
import numpy as np
import torch
from lhotse.features.base import FeatureExtractor, register_extractor
from lhotse.utils import EPSILON, Seconds, is_module_available
@dataclass
class KaldifeatF... | [
"dataclasses.asdict",
"torch.stack",
"torch.from_numpy",
"numpy.exp",
"lhotse.utils.is_module_available"
] | [((770, 782), 'dataclasses.asdict', 'asdict', (['self'], {}), '(self)\n', (776, 782), False, 'from dataclasses import asdict, dataclass\n'), ((1712, 1724), 'dataclasses.asdict', 'asdict', (['self'], {}), '(self)\n', (1718, 1724), False, 'from dataclasses import asdict, dataclass\n'), ((2194, 2226), 'lhotse.utils.is_mod... |
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Any, Callable, Dict, Tuple
import numpy as np
from dppy.finite_dpps import FiniteDPP
from scipydirect import minimize
from .acquisition import (
AcquisitionFunction,
OneShotBatchAcquisitionFunction,
SequentialBatchAcq... | [
"numpy.array",
"numpy.concatenate",
"dppy.finite_dpps.FiniteDPP"
] | [((6859, 6896), 'dppy.finite_dpps.FiniteDPP', 'FiniteDPP', (['"""likelihood"""'], {'L': 'likelihood'}), "('likelihood', L=likelihood)\n", (6868, 6896), False, 'from dppy.finite_dpps import FiniteDPP\n'), ((2845, 2862), 'numpy.array', 'np.array', (['[x_min]'], {}), '([x_min])\n', (2853, 2862), True, 'import numpy as np\... |
"""main server script
will sit onboard host and operate as Nebula --- its dynamic soul"""
# --------------------------------------------------
#
# Embodied AI Engine Prototype v0.10
# 2021/01/25
#
# © <NAME> 2020
# <EMAIL>
#
# Dedicated to <NAME>
#
# --------------------------------------------------
from random impo... | [
"numpy.abs",
"numpy.reshape",
"random.randrange",
"pydub.playback.play",
"pydub.AudioSegment.from_mp3",
"robot.rerobot.Robot",
"time.sleep",
"tensorflow.keras.models.load_model",
"time.time",
"random.random",
"pyaudio.PyAudio",
"arm.arm.Arm",
"pydub.AudioSegment.from_wav"
] | [((899, 954), 'tensorflow.keras.models.load_model', 'load_model', (['"""models/EMR-v4_RNN_skeleton_data.nose.x.h5"""'], {}), "('models/EMR-v4_RNN_skeleton_data.nose.x.h5')\n", (909, 954), False, 'from tensorflow.keras.models import load_model\n'), ((1218, 1261), 'tensorflow.keras.models.load_model', 'load_model', (['""... |
import numpy as np
import matplotlib.pyplot as plt
from astropy.wcs import WCS
from kidsdata import KissData
from kidsdata.db import list_scan, get_scan
plt.ion()
# Open the scan 431
kd = KissData(get_scan(431))
# Read All the valid data from array B
list_data = kd.names.DataSc + kd.names.DataUc + ["I", "Q"]
kd.re... | [
"matplotlib.pyplot.imshow",
"numpy.abs",
"numpy.sqrt",
"numpy.nanmedian",
"numpy.array",
"kidsdata.db.get_scan",
"matplotlib.pyplot.ion",
"astropy.wcs.WCS"
] | [((156, 165), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (163, 165), True, 'import matplotlib.pyplot as plt\n'), ((1226, 1263), 'matplotlib.pyplot.imshow', 'plt.imshow', (['data.data'], {'origin': '"""lower"""'}), "(data.data, origin='lower')\n", (1236, 1263), True, 'import matplotlib.pyplot as plt\n'), ((20... |
"""
This code explores Different Models of Convolutional Neural Networks
for the San Salvador Gang Project
@author: falba and ftop
"""
import os
import google_streetview.api
import pandas as pd
import numpy as np
import sys
import matplotlib.image as mp_img
from matplotlib import pyplot as plot
from skima... | [
"keras.layers.Conv2D",
"pandas.read_csv",
"keras.layers.Dense",
"numpy.reshape",
"matplotlib.pyplot.plot",
"keras.regularizers.l1",
"skimage.color.rgb2gray",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"sklearn.model_selection.train_test_split",
"keras.models.Sequential",
"skimage.io.... | [((1094, 1170), 'os.chdir', 'os.chdir', (['"""C:/Users/falba/Dropbox/ImageAnalysis/San Salvador/GangBoundaries"""'], {}), "('C:/Users/falba/Dropbox/ImageAnalysis/San Salvador/GangBoundaries')\n", (1102, 1170), False, 'import os\n'), ((1177, 1287), 'pandas.read_csv', 'pd.read_csv', (['"""C:/Users/falba/Dropbox/ImageAnal... |
# Code based on https://github.com/yaringal/ConcreteDropout
# License:
# MIT License
#
# Copyright (c) 2017
#
# 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 wi... | [
"torch.mul",
"torch.nn.ReLU",
"torch.log",
"torch.rand_like",
"torch.nn.Sequential",
"torch.sigmoid",
"numpy.log",
"torch.pow",
"torch.nn.Linear",
"torch.nn.Identity",
"torch.empty"
] | [((1816, 1843), 'torch.sigmoid', 'torch.sigmoid', (['self.p_logit'], {}), '(self.p_logit)\n', (1829, 1843), False, 'import torch\n'), ((2585, 2603), 'torch.rand_like', 'torch.rand_like', (['x'], {}), '(x)\n', (2600, 2603), False, 'import torch\n'), ((2819, 2850), 'torch.sigmoid', 'torch.sigmoid', (['(drop_prob / temp)'... |
'''
A compatibility layer for DSS C-API that mimics the official OpenDSS COM interface.
Copyright (c) 2016-2020 <NAME>
'''
from __future__ import absolute_import
from .._cffi_api_util import Base
import numpy as np
class IYMatrix(Base):
__slots__ = []
def GetCompressedYMatrix(self, factor=True):
'''R... | [
"numpy.array"
] | [((2540, 2555), 'numpy.array', 'np.array', (['NodeV'], {}), '(NodeV)\n', (2548, 2555), True, 'import numpy as np\n')] |
import os
import random
import numpy as np
from PIL import Image
def get_loss_train_data():
if not os.path.exists('.data/DIV2K'):
# DIV2K Home Page: https://data.vision.ee.ethz.ch/cvl/DIV2K/
# DIV2K Training Set: http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_HR.zip
raise os.error('No... | [
"os.path.exists",
"os.listdir",
"PIL.Image.open",
"numpy.reshape",
"numpy.asarray",
"os.error",
"numpy.transpose"
] | [((1319, 1344), 'os.listdir', 'os.listdir', (['""".data/DIV2K"""'], {}), "('.data/DIV2K')\n", (1329, 1344), False, 'import os\n'), ((105, 134), 'os.path.exists', 'os.path.exists', (['""".data/DIV2K"""'], {}), "('.data/DIV2K')\n", (119, 134), False, 'import os\n'), ((308, 451), 'os.error', 'os.error', (['"""No DIV2K Tra... |
import os.path
from absl import app
from absl import flags
from absl import logging
from typing import Any, Dict
import tensorflow as tf
import tensorflow.keras as keras
import uncertainty_baselines as ub
import uncertainty_metrics as um
import numpy as np
# import sklearn.isotonic
# import sklearn.neural_network
... | [
"tensorflow.keras.losses.MSE",
"tensorflow.tile",
"tensorflow.shape",
"numpy.random.rand",
"tensorflow.math.log",
"tensorflow.reduce_sum",
"uncertainty_baselines.optimizers.get",
"tensorflow.math.divide",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.GradientTape",
"numpy.array",
"... | [((6352, 6376), 'tensorflow.math.log', 'tf.math.log', (['(certs + eps)'], {}), '(certs + eps)\n', (6363, 6376), True, 'import tensorflow as tf\n'), ((25718, 25733), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (25726, 25733), True, 'import numpy as np\n'), ((25747, 25763), 'numpy.array', 'np.array', (['labe... |
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 17 19:39:45 2019
@author: aimldl
"""
import numpy as np
print( np.random.choice(5, 3, replace=False ) )
a = ['pooh', 'rabbit', 'piglet', 'Christopher']
print( np.random.choice(a, 3, replace=False ) )
print( np.random.choice(8, 32, replace=False ) )
| [
"numpy.random.choice"
] | [((122, 159), 'numpy.random.choice', 'np.random.choice', (['(5)', '(3)'], {'replace': '(False)'}), '(5, 3, replace=False)\n', (138, 159), True, 'import numpy as np\n'), ((222, 259), 'numpy.random.choice', 'np.random.choice', (['a', '(3)'], {'replace': '(False)'}), '(a, 3, replace=False)\n', (238, 259), True, 'import nu... |
"""implementation of argmin step"""
from scipy import optimize
import numpy as np
from BanditPricing import randUnitVector
def argmin(eta, s_radius, barrier, g_bar_aggr_t, g_tilde, d, max_iter = 1e4):
#implement argmin_ball(eta * (g_bar_1:t + g_tilde_t+1)^T x + barrier(x)
#argmin is over ball with radius r
... | [
"BanditPricing.randUnitVector",
"numpy.real",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.imag"
] | [((1067, 1100), 'numpy.dot', 'np.dot', (['(g_bar_aggr_t + g_tilde)', 'x'], {}), '(g_bar_aggr_t + g_tilde, x)\n', (1073, 1100), True, 'import numpy as np\n'), ((1347, 1357), 'numpy.real', 'np.real', (['z'], {}), '(z)\n', (1354, 1357), True, 'import numpy as np\n'), ((1359, 1369), 'numpy.imag', 'np.imag', (['z'], {}), '(... |
"""
Author: michealowen
Last edited: 2019.11.1,Friday
LASSO回归算法,使用波士顿房价数据集
在损失函数中加入L1正则项,后验概率的符合拉普拉斯分布
"""
#encoding=UTF-8
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
class ridgeRegression:
'''
... | [
"numpy.mean",
"numpy.abs",
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_boston",
"numpy.dot",
"numpy.std"
] | [((4743, 4756), 'sklearn.datasets.load_boston', 'load_boston', ([], {}), '()\n', (4754, 4756), False, 'from sklearn.datasets import load_boston\n'), ((4817, 4892), 'sklearn.model_selection.train_test_split', 'train_test_split', (['boston.data', 'boston.target'], {'test_size': '(0.1)', 'random_state': '(0)'}), '(boston.... |
import copy
import os
import torch
import torchvision
import warnings
import math
import utils.misc
import numpy as np
import os.path as osp
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import models.modified_resnet_cifar as modified_resnet_cifar
import models.modified_resnetmtl_cif... | [
"torchvision.datasets.CIFAR100",
"torch.optim.lr_scheduler.MultiStepLR",
"math.sqrt",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"copy.deepcopy",
"numpy.linalg.norm",
"trainer.incremental.incremental_train_and_eval",
"numpy.arange",
"os.path.exists",
"utils.compute_accuracy.... | [((832, 865), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (855, 865), False, 'import warnings\n'), ((1852, 1959), 'torchvision.datasets.CIFAR100', 'torchvision.datasets.CIFAR100', ([], {'root': '"""./data"""', 'train': '(True)', 'download': '(True)', 'transform': 'self.... |
#!/usr/bin/env python3
import numpy
import rawcam
import random
from hashlib import md5
while True:
rc = rawcam.init() # initializes camera interface, returns config object
#rc.pack = rawcam.Pack.NONE
#rc.unpack = rawcam.Unpack.NONE
#rawcam.set_timing(0, 0, 0, 0, 0, 0, 0)
rawcam.set_data_lanes(2)
... | [
"rawcam.set_buffer_size",
"rawcam.set_pack_mode",
"rawcam.set_unpack_mode",
"rawcam.set_buffer_dimensions",
"rawcam.set_camera_num",
"rawcam.buffer_get",
"numpy.frombuffer",
"rawcam.set_data_lanes",
"hashlib.md5",
"rawcam.init",
"rawcam.set_buffer_num",
"rawcam.set_zero_copy",
"rawcam.buffer... | [((110, 123), 'rawcam.init', 'rawcam.init', ([], {}), '()\n', (121, 123), False, 'import rawcam\n'), ((295, 319), 'rawcam.set_data_lanes', 'rawcam.set_data_lanes', (['(2)'], {}), '(2)\n', (316, 319), False, 'import rawcam\n'), ((324, 347), 'rawcam.set_image_id', 'rawcam.set_image_id', (['(42)'], {}), '(42)\n', (343, 34... |
import argparse
import admin as ad
from config import Config
import numpy as np
"""Bring in the configuration filename from the command line"""
parser = argparse.ArgumentParser(
description="Get input YAML file as inputFile")
parser.add_argument('inputFile',
help='The input YAML file to drive the ... | [
"numpy.random.normal",
"argparse.ArgumentParser",
"config.Config",
"admin.array2csv",
"numpy.array",
"admin.yaml_loader",
"numpy.zeros"
] | [((154, 225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get input YAML file as inputFile"""'}), "(description='Get input YAML file as inputFile')\n", (177, 225), False, 'import argparse\n'), ((374, 404), 'admin.yaml_loader', 'ad.yaml_loader', (['args.inputFile'], {}), '(args.inputFi... |
import sys
import time
import argparse
import os
import warnings
import numpy as np
import torch
import torch.nn as nn
from collections import defaultdict
import pickle as pk
from torch.nn import Parameter
from layers import DNANodeRepModule, ConvNodeRepModule
from metrics import compute_mae, compute_mape, compute_ss... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.L1Loss",
"metrics.compute_mape",
"torch.nn.MSELoss",
"torch.nn.BatchNorm1d",
"training_environment.checkpoint_filepath",
"torch.cuda.is_available",
"dataset.UrbanPlanningDataset",
"numpy.nanmean",
"numpy.array",
"layers.DNANodeRepModule",
"layer... | [((762, 803), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""UP"""'}), "(description='UP')\n", (785, 803), False, 'import argparse\n'), ((972, 997), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (995, 997), False, 'import torch\n'), ((1017, 1037), 'torch.device'... |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import scipy
# ==============================================================================
# ==============================================================================
# ========================================================================... | [
"pandas.Series",
"numpy.array",
"scipy.interpolate.splev",
"scipy.interpolate.splrep",
"numpy.arange"
] | [((1718, 1777), 'scipy.interpolate.splrep', 'scipy.interpolate.splrep', ([], {'x': 'value_times', 'y': 'values', 'k': '(3)', 's': '(0)'}), '(x=value_times, y=values, k=3, s=0)\n', (1742, 1777), False, 'import scipy\n'), ((1851, 1883), 'numpy.arange', 'np.arange', (['(0)', 'value_times[-1]', '(1)'], {}), '(0, value_time... |
# Copyright 2018 The CapsLayer Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"capslayer.shape",
"numpy.prod",
"tensorflow.compat.v1.variable_scope",
"tensorflow.split",
"capslayer.norm",
"capslayer.core.transforming",
"capslayer.ops.squash",
"tensorflow.layers.conv2d",
"numpy.zeros",
"tensorflow.sigmoid",
"tensorflow.name_scope",
"tensorflow.clip_by_value",
"numpy.co... | [((1880, 1913), 'tensorflow.compat.v1.variable_scope', 'tf.compat.v1.variable_scope', (['name'], {}), '(name)\n', (1907, 1913), True, 'import tensorflow as tf\n'), ((4250, 4310), 'capslayer.core.routing', 'routing', (['vote', 'activation', 'routing_method'], {'num_iter': 'num_iter'}), '(vote, activation, routing_method... |
import numpy as np
def sweepcut(p,g):
"""
Computes a cluster using sweep cut and conductance as a criterion.
Parameters
----------
p: numpy array
A vector that is used to perform rounding.
g: graph object
Returns
-------
In a list of l... | [
"numpy.argsort",
"numpy.count_nonzero",
"numpy.zeros"
] | [((1345, 1371), 'numpy.argsort', 'np.argsort', (['(-1 * p)'], {'axis': '(0)'}), '(-1 * p, axis=0)\n', (1355, 1371), True, 'import numpy as np\n'), ((1394, 1413), 'numpy.count_nonzero', 'np.count_nonzero', (['p'], {}), '(p)\n', (1410, 1413), True, 'import numpy as np\n'), ((1480, 1496), 'numpy.zeros', 'np.zeros', (['(n,... |
# All credits to the fmriprep peeps
from nipype.interfaces.utility import Function
def erode_mask(in_file, epi_mask, epi_mask_erosion_mm=0,
erosion_mm=0):
import os
import nibabel as nib
import scipy.ndimage as nd
# thresholding
probability_map_nii = nib.load(in_fil... | [
"nipype.interfaces.utility.Function",
"nibabel.load",
"scipy.ndimage.binary_erosion",
"pandas.concat",
"nibabel.Nifti1Image",
"os.path.abspath",
"numpy.zeros_like"
] | [((1623, 1782), 'nipype.interfaces.utility.Function', 'Function', ([], {'function': 'erode_mask', 'input_names': "['in_file', 'epi_mask', 'epi_mask_erosion_mm', 'erosion_mm']", 'output_names': "['roi_eroded', 'epi_mask_eroded']"}), "(function=erode_mask, input_names=['in_file', 'epi_mask',\n 'epi_mask_erosion_mm', '... |
import unittest
import numpy as np
from RyStats.inferential import pearsons_correlation, polyserial_correlation
class TestCorrelation(unittest.TestCase):
"""Test Fixture for correlation."""
def test_pearsons_correlation(self):
"""Testing pearsons correlation."""
rng = np.random.default_rng(... | [
"numpy.abs",
"numpy.random.default_rng",
"numpy.corrcoef",
"numpy.digitize",
"numpy.count_nonzero",
"RyStats.inferential.polyserial_correlation",
"unittest.main",
"RyStats.inferential.pearsons_correlation"
] | [((2540, 2555), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2553, 2555), False, 'import unittest\n'), ((298, 347), 'numpy.random.default_rng', 'np.random.default_rng', (['(34982750394857201981982375)'], {}), '(34982750394857201981982375)\n', (319, 347), True, 'import numpy as np\n'), ((444, 473), 'RyStats.infe... |
import numpy as np
from stable_baselines3 import SAC
# from stable_baselines3.sac import CnnPolicy
from stable_baselines3.sac import MlpPolicy
import gym
import d4rl
import json
import os
env = gym.make("carla-lane-v0")
exp_name = "baseline_carla"
total_timesteps = 1000000
save_every = 5000
tensorboard_log = os.path... | [
"numpy.mean",
"stable_baselines3.SAC",
"os.path.join",
"numpy.std",
"gym.make",
"json.dump"
] | [((196, 221), 'gym.make', 'gym.make', (['"""carla-lane-v0"""'], {}), "('carla-lane-v0')\n", (204, 221), False, 'import gym\n'), ((313, 345), 'os.path.join', 'os.path.join', (['"""./logs"""', 'exp_name'], {}), "('./logs', exp_name)\n", (325, 345), False, 'import os\n'), ((355, 442), 'stable_baselines3.SAC', 'SAC', (['Ml... |
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from collections import OrderedDict
import warnings
import numpy as np
import pytest
from openvino.tools.pot.algorithms.sparsity.default.utils import check_model_sparsity_level
from openvino.tools.pot.data_loaders.creator import create... | [
"pytest.approx",
"numpy.mean",
"openvino.tools.pot.data_loaders.creator.create_data_loader",
"tests.utils.check_graph.check_model",
"openvino.tools.pot.graph.load_model",
"openvino.tools.pot.pipeline.initializer.create_pipeline",
"openvino.tools.pot.engines.creator.create_engine",
"openvino.tools.pot.... | [((1177, 1207), 'openvino.tools.pot.graph.load_model', 'load_model', (['model.model_params'], {}), '(model.model_params)\n', (1187, 1207), False, 'from openvino.tools.pot.graph import load_model, save_model\n'), ((1226, 1266), 'openvino.tools.pot.data_loaders.creator.create_data_loader', 'create_data_loader', (['engine... |
from scipy.io import wavfile
import numpy as np
import scipy.signal
import matplotlib.pyplot as plt
import pylab
import math
from utils import escribir_pixel, filtrar
from PIL import Image
''' constantes '''
PORCH_TIME = 0.00208
SYNC_TIME = 0.02
DETECT_SYNC_TIME = SYNC_TIME * 0.7
LINE_COMP_TIME = 0.1216
#fs, data = w... | [
"numpy.convolve",
"raw_file.write_complex_sample",
"PIL.Image.new",
"numpy.kaiser",
"utils.filtrar",
"raw_file.write_sample",
"numpy.diff",
"numpy.angle",
"numpy.concatenate"
] | [((845, 863), 'numpy.kaiser', 'np.kaiser', (['m', 'beta'], {}), '(m, beta)\n', (854, 863), True, 'import numpy as np\n'), ((1234, 1271), 'numpy.concatenate', 'np.concatenate', (['[zeros, datos, zeros]'], {}), '([zeros, datos, zeros])\n', (1248, 1271), True, 'import numpy as np\n'), ((1612, 1651), 'PIL.Image.new', 'Imag... |
# Copyright (c) 2019 <NAME>
from ipywidgets import Box
from aixplot.widget import Filter, NoneFilter
from aixplot.widget import Widget as Aixplot
import numpy as np
from .cacher import IterationCacher
from .label import Label
from IPython.core.magic import line_magic, magics_class, Magics
from IPython.core.magic_argu... | [
"IPython.core.magic_arguments.parse_argstring",
"numpy.array",
"IPython.core.magic_arguments.argument",
"IPython.core.magic_arguments.magic_arguments",
"aixplot.widget.NoneFilter"
] | [((1047, 1064), 'IPython.core.magic_arguments.magic_arguments', 'magic_arguments', ([], {}), '()\n', (1062, 1064), False, 'from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring\n'), ((1070, 1143), 'IPython.core.magic_arguments.argument', 'argument', (['"""--filename"""', '"""-f"""'], {'hel... |
from numpy import pi, isclose
from pyroll.core import CircularOvalGroove
def test_circular_oval():
g = CircularOvalGroove(depth=5.05, r1=7, r2=33)
assert isclose(g.usable_width, 17.63799973 * 2)
assert isclose(g.alpha1, 29.102618 / 180 * pi)
assert isclose(g.alpha2, 29.102618 / 180 * pi)
assert ... | [
"pyroll.core.CircularOvalGroove",
"numpy.isclose"
] | [((110, 153), 'pyroll.core.CircularOvalGroove', 'CircularOvalGroove', ([], {'depth': '(5.05)', 'r1': '(7)', 'r2': '(33)'}), '(depth=5.05, r1=7, r2=33)\n', (128, 153), False, 'from pyroll.core import CircularOvalGroove\n'), ((166, 206), 'numpy.isclose', 'isclose', (['g.usable_width', '(17.63799973 * 2)'], {}), '(g.usabl... |
#0 -*- coding: utf-8 -*-
"""
Population genomics statistics.
Functions in this module are used to estimate population genomics statistics along a sequence.
"""
import pandas as pd
from Bio.Seq import Seq
import PiSlice.input as input
from itertools import compress
import numpy as np
import mapply
import multiprocessi... | [
"numpy.mean",
"multiprocessing.cpu_count",
"numpy.max",
"numpy.sum",
"intervaltree.IntervalTree.from_tuples",
"mapply.parallel.sensible_cpu_count",
"re.findall"
] | [((1766, 1802), 'mapply.parallel.sensible_cpu_count', 'mapply.parallel.sensible_cpu_count', ([], {}), '()\n', (1800, 1802), False, 'import mapply\n'), ((11114, 11131), 'numpy.mean', 'np.mean', (['feat_len'], {}), '(feat_len)\n', (11121, 11131), True, 'import numpy as np\n'), ((11507, 11531), 'numpy.max', 'np.max', (["c... |
"""
Module containing the Company Class.
Abreviations used in code:
dfi = input dataframe
dfo = output dataframe
"""
from typing import Literal
import numpy as np
import pandas as pd
from . import config as c
class Company:
"""
Finance Data Class for listed Brazilian Companies.
Attributes
---... | [
"pandas.merge",
"pandas.DataFrame.from_dict",
"numpy.append",
"pandas.DateOffset",
"pandas.DataFrame",
"numpy.datetime_as_string",
"pandas.concat",
"pandas.to_datetime"
] | [((7638, 7710), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['company_info'], {'orient': '"""index"""', 'columns': "['Values']"}), "(company_info, orient='index', columns=['Values'])\n", (7660, 7710), True, 'import pandas as pd\n'), ((12778, 12799), 'pandas.merge', 'pd.merge', (['df1', 'df_ttm'], {}), '(df... |
"""
Impulse response functions for the LQ permanent income model permanent and
transitory shocks.
"""
import numpy as np
import matplotlib.pyplot as plt
r = 0.05
beta = 1 / (1 + r)
T = 20 # Time horizon
S = 5 # Impulse date
sigma1 = sigma2 = 0.15
def time_path(permanent=False):
"Time p... | [
"numpy.zeros",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.show"
] | [((700, 718), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (712, 718), True, 'import matplotlib.pyplot as plt\n'), ((719, 750), 'matplotlib.pyplot.subplots_adjust', 'plt.subplots_adjust', ([], {'hspace': '(0.5)'}), '(hspace=0.5)\n', (738, 750), True, 'import matplotlib.pyplot as plt\n... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 <NAME> <<EMAIL>>
#
# Distributed under terms of the GNU-License license.
"""
"""
import numpy as np
def jonswap(w, Hs, Tp):
""" JONSWAP wave spectrum, IEC 61400-3
w: ndarray of shape (n,), frequencies to be sampled at, rad/s... | [
"numpy.ones",
"numpy.log",
"numpy.squeeze",
"numpy.exp",
"numpy.sum",
"numpy.errstate",
"numpy.isinf"
] | [((403, 416), 'numpy.squeeze', 'np.squeeze', (['w'], {}), '(w)\n', (413, 416), True, 'import numpy as np\n'), ((1542, 1557), 'numpy.sum', 'np.sum', (['(Sw * dw)'], {}), '(Sw * dw)\n', (1548, 1557), True, 'import numpy as np\n'), ((426, 454), 'numpy.errstate', 'np.errstate', ([], {'divide': '"""ignore"""'}), "(divide='i... |
import numpy as np
import pytest
from bmi_tester.api import check_unit_is_valid
def test_get_var_itemsize(initialized_bmi, var_name):
"""Test getting a variable's itemsize"""
itemsize = initialized_bmi.get_var_itemsize(var_name)
assert itemsize > 0
# @pytest.mark.dependency()
def test_get_var_nbytes(in... | [
"pytest.skip",
"numpy.empty",
"bmi_tester.api.check_unit_is_valid"
] | [((1985, 2011), 'bmi_tester.api.check_unit_is_valid', 'check_unit_is_valid', (['units'], {}), '(units)\n', (2004, 2011), False, 'from bmi_tester.api import check_unit_is_valid\n'), ((984, 1041), 'pytest.skip', 'pytest.skip', (['f"""var, {var_name}, is not located on a grid"""'], {}), "(f'var, {var_name}, is not located... |
import numpy as np
from bokeh.plotting import figure
from dq_poc.util import plot_grid
def plot(f):
x = np.linspace(0, 2 * 3.14159)
p = figure(plot_height=1500, plot_width=2000)
p.line(x, f(x))
return p
title = 'Coffee Machine Uptime'
content = plot_grid(2, plot(np.sin), plot(np.cos), plot(np.tan),... | [
"numpy.linspace",
"bokeh.plotting.figure"
] | [((109, 136), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * 3.14159)'], {}), '(0, 2 * 3.14159)\n', (120, 136), True, 'import numpy as np\n'), ((146, 187), 'bokeh.plotting.figure', 'figure', ([], {'plot_height': '(1500)', 'plot_width': '(2000)'}), '(plot_height=1500, plot_width=2000)\n', (152, 187), False, 'from bokeh... |
import numpy as np
import pdb
class ModelBranch:
def __init__(self, initialW, initialGrad):
print("initializing model")
self.chain = [[initialW, initialGrad]]
self.pendingGradients = []
self.gradientHistory = []
def updateModel(self):
### TODO:: Refactor out ###
... | [
"numpy.zeros"
] | [((331, 362), 'numpy.zeros', 'np.zeros', (['self.chain[0][0].size'], {}), '(self.chain[0][0].size)\n', (339, 362), True, 'import numpy as np\n')] |
"""
module for crystal structure
"""
import numpy as np
import sys
import os
import shutil
import copy
import pymatflow.base as base
from pymatflow.base.atom import Atom
"""
Usage:
"""
class Crystal:
""" an abstraction of crystal structure
usage:
>>> a = Crystal()
"""
d... | [
"pymatflow.base.atom.Atom",
"pymatflow.base.BaseXyz",
"numpy.linalg.det",
"numpy.array",
"numpy.linalg.inv",
"copy.deepcopy"
] | [((717, 731), 'pymatflow.base.BaseXyz', 'base.BaseXyz', ([], {}), '()\n', (729, 731), True, 'import pymatflow.base as base\n'), ((3081, 3100), 'numpy.array', 'np.array', (['self.cell'], {}), '(self.cell)\n', (3089, 3100), True, 'import numpy as np\n'), ((3120, 3144), 'numpy.linalg.inv', 'np.linalg.inv', (['latcell.T'],... |
import cv2
import joblib
from skimage.feature import hog
import numpy
import pygame
clf = joblib.load("digits.pkl")
pygame.init()
screen = pygame.display.set_mode((600, 400))
screen.fill((255, 255, 255))
pygame.display.set_caption("Draw the Number")
loop = True
while loop:
for event in pygame.event.get():
... | [
"cv2.rectangle",
"pygame.mouse.get_pressed",
"pygame.init",
"pygame.quit",
"cv2.imshow",
"numpy.array",
"cv2.threshold",
"pygame.display.set_mode",
"pygame.mouse.get_pos",
"pygame.image.save",
"joblib.load",
"pygame.display.update",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.resize",
"cv2.Gau... | [((90, 115), 'joblib.load', 'joblib.load', (['"""digits.pkl"""'], {}), "('digits.pkl')\n", (101, 115), False, 'import joblib\n'), ((117, 130), 'pygame.init', 'pygame.init', ([], {}), '()\n', (128, 130), False, 'import pygame\n'), ((141, 176), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(600, 400)'], {}), '... |
#%%
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
x = np.linspace(0, 20, 100)
plt.plot(x, np.sin(x))
plt.show()
# %%
x = np.arange(0,9,0.1)
y = np.sin(x)
y1 = np.cos(x)
plt.title("y=xin(x)")
plt.xlabel("x")
plt.ylabel("y")
plt.plot(x,y,"-b",x,y1,"-r")
plt.show()
# %%
a = np.array([22,87... | [
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.title",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((85, 108), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', '(100)'], {}), '(0, 20, 100)\n', (96, 108), True, 'import numpy as np\n'), ((132, 142), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (140, 142), True, 'import matplotlib.pyplot as plt\n'), ((153, 173), 'numpy.arange', 'np.arange', (['(0)', '(9)',... |
from ClusterDataGen.NetworkToTree import *
from ClusterDataGen.LGT_network import *
from ClusterDataGen.tree_to_newick import *
from datetime import datetime
import pandas as pd
import numpy as np
import pickle
import time
import sys
def make_data_fun(net_num, unique, partial, num_trees, train_data=True):
# PARA... | [
"pickle.dump",
"datetime.datetime.now",
"numpy.random.randint",
"numpy.quantile",
"numpy.log2",
"time.time",
"numpy.round"
] | [((755, 766), 'time.time', 'time.time', ([], {}), '()\n', (764, 766), False, 'import time\n'), ((790, 816), 'numpy.random.randint', 'np.random.randint', (['(10)', '(120)'], {}), '(10, 120)\n', (807, 816), True, 'import numpy as np\n'), ((1030, 1041), 'time.time', 'time.time', ([], {}), '()\n', (1039, 1041), False, 'imp... |
import numpy as np
from sklearn.utils import indexable
from sklearn.utils.validation import _num_samples
from sklearn.model_selection._split import _BaseKFold
from hypernets.utils import logging
logger = logging.get_logger(__name__)
class PrequentialSplit(_BaseKFold):
STRATEGY_PREQ_BLS = 'preq-bls'
STRATEGY_... | [
"sklearn.utils.indexable",
"sklearn.utils.validation._num_samples",
"hypernets.utils.logging.get_logger",
"numpy.arange"
] | [((205, 233), 'hypernets.utils.logging.get_logger', 'logging.get_logger', (['__name__'], {}), '(__name__)\n', (223, 233), False, 'from hypernets.utils import logging\n'), ((3521, 3544), 'sklearn.utils.indexable', 'indexable', (['X', 'y', 'groups'], {}), '(X, y, groups)\n', (3530, 3544), False, 'from sklearn.utils impor... |
"""Command line tools for optimisation."""
import datetime
import json
import logging
from pathlib import Path
from typing import List
import click
import matplotlib.pyplot as plt
import numpy as np
from hoqunm.data_tools.base import (EXAMPLE_FILEPATH_OPTIMISATION_COMPUTATION,
EXA... | [
"numpy.prod",
"click.Choice",
"pathlib.Path",
"click.option",
"hoqunm.data_tools.modelling.HospitalModel.load",
"hoqunm.simulation.evaluators.EvaluationResults.load",
"numpy.ndindex",
"hoqunm.simulation.evaluators.SimulationEvaluator",
"matplotlib.pyplot.close",
"hoqunm.optimisation.optimators.Opt... | [((5230, 5245), 'click.command', 'click.command', ([], {}), '()\n', (5243, 5245), False, 'import click\n'), ((5793, 5912), 'click.option', 'click.option', (['"""--waiting"""', '"""-w"""'], {'is_flag': '(True)', 'help': '"""If waiting shall be assessed according to given waiting map."""'}), "('--waiting', '-w', is_flag=... |
import numpy as np
import networkx as nx
from scipy.spatial.distance import cosine
from scipy import sparse
from tqdm import tqdm
class RandomWalk:
def __init__(self, graph: nx.Graph, num_walks: int = 10, walk_length: int = 80) -> None:
r"""
Generate randomly uniform random walks
"""
... | [
"networkx.adjacency_matrix",
"numpy.random.choice",
"tqdm.tqdm",
"numpy.array",
"scipy.sparse.coo_matrix"
] | [((2066, 2097), 'networkx.adjacency_matrix', 'nx.adjacency_matrix', (['self.graph'], {}), '(self.graph)\n', (2085, 2097), True, 'import networkx as nx\n'), ((2262, 2316), 'tqdm.tqdm', 'tqdm', (['edges'], {'desc': '"""Computing Transition probabilities"""'}), "(edges, desc='Computing Transition probabilities')\n", (2266... |
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 14:52:52 2019
@author: yifan
"""
import csv, time, random, math
from mpi4py import MPI
import numpy
def eucl_distance(point_one, point_two):#计算两点欧式距离
if(len(point_one) != len(point_two)):
raise Exception("Error: non comparable points")
... | [
"math.sqrt",
"numpy.array",
"numpy.zeros",
"mpi4py.MPI.Finalize",
"time.time"
] | [((486, 505), 'math.sqrt', 'math.sqrt', (['sum_diff'], {}), '(sum_diff)\n', (495, 505), False, 'import csv, time, random, math\n'), ((1562, 1573), 'time.time', 'time.time', ([], {}), '()\n', (1571, 1573), False, 'import csv, time, random, math\n'), ((3111, 3125), 'mpi4py.MPI.Finalize', 'MPI.Finalize', ([], {}), '()\n',... |
import numpy as np
import pykin.utils.transform_utils as t_utils
import pykin.utils.kin_utils as k_utils
import pykin.kinematics.jacobian as jac
from pykin.planners.planner import Planner
from pykin.utils.error_utils import OriValueError, CollisionError
from pykin.utils.kin_utils import ShellColors as sc, logging_ti... | [
"numpy.identity",
"pykin.utils.log_utils.create_logger",
"pykin.utils.transform_utils.get_quaternion_from_rpy",
"pykin.utils.error_utils.OriValueError",
"pykin.utils.kin_utils.calc_pose_error",
"pykin.utils.transform_utils.get_linear_interpoation",
"pykin.utils.error_utils.CollisionError",
"numpy.asar... | [((467, 510), 'pykin.utils.log_utils.create_logger', 'create_logger', (['"""Cartesian Planner"""', '"""debug"""'], {}), "('Cartesian Planner', 'debug')\n", (480, 510), False, 'from pykin.utils.log_utils import create_logger\n'), ((6242, 6253), 'numpy.zeros', 'np.zeros', (['(7)'], {}), '(7)\n', (6250, 6253), True, 'impo... |
# Copyright 2020, Battelle Energy Alliance, LLC
# ALL RIGHTS RESERVED
import random
import numpy as np
def initialize(self, runInfo, inputs):
seed = 9491
random.seed(seed)
def run(self,Input):
# intput:
# output:
numberDaysSD = float(random.randint(10,30))
costPerDay = 0.8 + 0.4 * random.random()
cos... | [
"numpy.ones",
"random.random",
"random.randint",
"random.seed"
] | [((159, 176), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (170, 176), False, 'import random\n'), ((247, 269), 'random.randint', 'random.randint', (['(10)', '(30)'], {}), '(10, 30)\n', (261, 269), False, 'import random\n'), ((381, 408), 'numpy.ones', 'np.ones', (["Input['time'].size"], {}), "(Input['time']... |
# -*- coding: utf-8 -*-
from __future__ import division
import random
from operator import itemgetter
import numpy as np
from common.gamestate import BoardState
def other_player(player_id):
if player_id == 1:
return 2
elif player_id == 2:
return 1
def state_transition(player_id, state, a... | [
"random.choice",
"numpy.random.choice",
"common.gamestate.BoardState",
"numpy.array",
"operator.itemgetter"
] | [((2650, 2681), 'random.choice', 'random.choice', (['possible_actions'], {}), '(possible_actions)\n', (2663, 2681), False, 'import random\n'), ((3197, 3239), 'numpy.random.choice', 'np.random.choice', (['actions'], {'p': 'probabilities'}), '(actions, p=probabilities)\n', (3213, 3239), True, 'import numpy as np\n'), ((4... |
import numpy as np
import seaborn as sns
import matplotlib.pylab as plt
import math
import os
import pandas as pd
import re
def search_year(year, years):
for idx, _year in enumerate(years):
if idx == len(years) -1:
continue
if year >= _year and year < years[idx + 1]:
return ... | [
"os.path.exists",
"math.ceil",
"os.makedirs",
"matplotlib.pylab.tight_layout",
"matplotlib.pylab.figure",
"matplotlib.pylab.title",
"os.path.join",
"seaborn.heatmap",
"numpy.sum",
"numpy.zeros",
"pandas.DataFrame",
"re.search"
] | [((10689, 10723), 'numpy.zeros', 'np.zeros', (['topic_numbers'], {'dtype': 'int'}), '(topic_numbers, dtype=int)\n', (10697, 10723), True, 'import numpy as np\n'), ((12076, 12100), 'numpy.zeros', 'np.zeros', (['(150)'], {'dtype': 'int'}), '(150, dtype=int)\n', (12084, 12100), True, 'import numpy as np\n'), ((22191, 2222... |
import pytest
from PySide2 import QtWidgets
import sys
from numpy import ones
from SciDataTool import DataTime, DataLinspace
class TestGUI(object):
@classmethod
def setup_class(cls):
"""Run at the begining of every test to setup the gui"""
if not QtWidgets.QApplication.instance():
... | [
"SciDataTool.DataTime",
"numpy.ones",
"PySide2.QtWidgets.QApplication.instance",
"PySide2.QtWidgets.QApplication",
"SciDataTool.DataLinspace"
] | [((462, 529), 'SciDataTool.DataLinspace', 'DataLinspace', ([], {'name': '"""time"""', 'unit': '"""s"""', 'initial': '(0)', 'final': '(10)', 'number': '(11)'}), "(name='time', unit='s', initial=0, final=10, number=11)\n", (474, 529), False, 'from SciDataTool import DataTime, DataLinspace\n'), ((550, 558), 'numpy.ones', ... |
###################################################################################################
# Copyright (c) 2021 <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 restr... | [
"numpy.product",
"tensorflow.shape_n",
"tensorflow.py_function",
"tensorflow.dynamic_stitch",
"tensorflow.GradientTape",
"tensorflow.range",
"tensorflow.constant",
"base.custom_lbfgs.Struct",
"tensorflow.dynamic_partition",
"tensorflow.reshape",
"numpy.finfo",
"tensorflow.cast"
] | [((2416, 2453), 'tensorflow.shape_n', 'tf.shape_n', (['model.trainable_variables'], {}), '(model.trainable_variables)\n', (2426, 2453), True, 'import tensorflow as tf\n'), ((2899, 2916), 'tensorflow.constant', 'tf.constant', (['part'], {}), '(part)\n', (2910, 2916), True, 'import tensorflow as tf\n'), ((2736, 2756), 'n... |
import numpy as np
import pandas as pd
from loguru import logger
def count_column_values_within_ranges(df_inp, column_name, bins=None):
"""
Count the number of values of a specific column according to the define ranges.
:param pd.DataFrame df_inp: pandas dataframe
:param column_name: column name to b... | [
"loguru.logger.warning",
"numpy.arange"
] | [((432, 455), 'numpy.arange', 'np.arange', (['(0)', '(7000)', '(100)'], {}), '(0, 7000, 100)\n', (441, 455), True, 'import numpy as np\n'), ((1602, 1671), 'loguru.logger.warning', 'logger.warning', (['"""No bins specified, will use a default range 0-10000"""'], {}), "('No bins specified, will use a default range 0-1000... |
#!/usr/bin/env python
# Columbia Engineering
# MECS 4603 - Fall 2017
import math
import numpy
import time
import rospy
import random
from std_msgs.msg import Header
from geometry_msgs.msg import Pose2D
from state_estimator.msg import RobotPose
from state_estimator.msg import SensorData
from state_estimator.msg impor... | [
"numpy.random.normal",
"state_estimator.msg.Landmark",
"state_estimator.msg.RobotPose",
"rospy.init_node",
"math.sqrt",
"state_estimator.msg.SensorData",
"math.sin",
"rospy.Time.now",
"math.cos",
"state_estimator.msg.LandmarkSet",
"math.fabs",
"rospy.spin",
"math.atan2",
"state_estimator.m... | [((458, 468), 'state_estimator.msg.Landmark', 'Landmark', ([], {}), '()\n', (466, 468), False, 'from state_estimator.msg import Landmark\n'), ((4985, 5036), 'rospy.init_node', 'rospy.init_node', (['"""mobile_robot_sim"""'], {'anonymous': '(True)'}), "('mobile_robot_sim', anonymous=True)\n", (5000, 5036), False, 'import... |
import cv2
import os
import numpy as np
import traceback
from time import *
import winsound
import pyttsx3
# s1,s2:就是识别人的名字
subjects = ["stranger", "hfp", "lc"]
def menu():
"""菜单"""
print("*"*10 + "人脸识别系统" + "*"*10)
print("*"*10 + "菜单" + "*"*10)
print("*"*5 + "1、进行检测" + "*"*8)
... | [
"cv2.rectangle",
"cv2.face.LBPHFaceRecognizer_create",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.CascadeClassifier",
"os.listdir",
"cv2.VideoWriter",
"cv2.VideoWriter_fourcc",
"traceback.print_exc",
"cv2.waitKey",
"cv2.putText",
"cv2.cvtColor",
"cv2.imread",
"cv2.imwrite... | [((550, 569), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (566, 569), False, 'import cv2\n'), ((612, 733), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""G:\\\\Opencv 4.5.3\\\\opencv\\\\build\\\\etc\\\\lbpcascades\\\\lbpcascade_frontalface_improved.xml"""'], {}), "(\n 'G:\\\\Opencv 4.5.3... |
"""
Requires matplotlib
pipenv install matplotlib
python plot.py
"""
import yaml
import numpy
import matplotlib.pyplot as plt
from connected_conics import conic, helpers
fullspec = """
- r: [8]
e: [0.0]
d: 6.0
- r: [9]
e: [0.5]
d: 10.0
- r: [11]
e: [1.1]
d: 12.0
"""
fullspec_dict = yaml.safe_load(fullspec)... | [
"connected_conics.conic.find_val_vectorized",
"connected_conics.helpers.get_conic_from_fullspec",
"matplotlib.pyplot.plot",
"yaml.safe_load",
"numpy.linspace",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((296, 320), 'yaml.safe_load', 'yaml.safe_load', (['fullspec'], {}), '(fullspec)\n', (310, 320), False, 'import yaml\n'), ((325, 374), 'connected_conics.helpers.get_conic_from_fullspec', 'helpers.get_conic_from_fullspec', (['fullspec_dict', '(0)'], {}), '(fullspec_dict, 0)\n', (356, 374), False, 'from connected_conics... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# #
# RMG Website - A Django-powered website for Reaction Mechanism Generator #
# ... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"numpy.exp",
"numpy.array",
"django.urls.reverse",
"numpy.arange"
] | [((2799, 2851), 'django.shortcuts.render', 'render', (['request', '"""pdep.html"""', "{'networks': networks}"], {}), "(request, 'pdep.html', {'networks': networks})\n", (2805, 2851), False, 'from django.shortcuts import render, get_object_or_404\n'), ((3472, 3513), 'django.shortcuts.get_object_or_404', 'get_object_or_4... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.