code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
"""High level add faults function."""
import logging
log = logging.getLogger(__name__)
import os
import numpy as np
import resqpy.crs as rqc
import resqpy.grid as grr
import resqpy.lines as rql
import resqpy.model as rq
import resqpy.olio.grid_functions as gf
import resqpy.olio.simple_lines as sl
import resqpy.olio... | [
"logging.getLogger",
"resqpy.model.Model",
"resqpy.olio.simple_lines.nearest_pillars",
"resqpy.olio.vector_utilities.unit_vector",
"numpy.array",
"resqpy.olio.xml_et.citation_title_for_node",
"resqpy.derived_model._common._write_grid",
"resqpy.derived_model._common._prepare_simple_inheritance",
"os.... | [((61, 88), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (78, 88), False, 'import logging\n'), ((5177, 5232), 'resqpy.derived_model._common._establish_model_and_source_grid', '_establish_model_and_source_grid', (['epc_file', 'source_grid'], {}), '(epc_file, source_grid)\n', (5209, 5232)... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may ... | [
"numpy.array",
"ocw.dataset.Dataset",
"ocw.dataset_processor.spatial_regrid",
"unittest.main",
"datetime.timedelta",
"os.remove",
"datetime.datetime",
"ocw.data_source.local.load_file",
"numpy.meshgrid",
"ocw.dataset_processor.safe_subset",
"numpy.testing.assert_array_equal",
"ocw.dataset_proc... | [((1003, 1046), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL'}), '(level=logging.CRITICAL)\n', (1022, 1046), False, 'import logging\n'), ((15929, 16043), 'ocw.dataset.Dataset', 'ds.Dataset', (['lats', 'lons', 'times', 'values'], {'variable': '"""test variable name"""', 'units': '"""tes... |
import tensorflow as tf
import flask
from flask import request
import base64
import cv2
import numpy as np
from PIL import Image
from io import BytesIO
import transform
# print('Downloading CUM...')
# url = 'https://face-off-ai.s3.amazonaws.com/CUMv6.h5'
# r = requests.get(url)
# with open('CUMv6.h5', 'wb') as mod:
#... | [
"flask.Flask",
"transform.transformIndividual",
"flask.request.get_json",
"tensorflow.keras.models.load_model",
"cv2.cvtColor",
"numpy.expand_dims",
"flask.jsonify"
] | [((570, 591), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (581, 591), False, 'import flask\n'), ((747, 785), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""CUMv6.h5"""'], {}), "('CUMv6.h5')\n", (773, 785), True, 'import tensorflow as tf\n'), ((926, 944), 'flask.request.g... |
from pliers.extractors import (GoogleVisionAPIFaceExtractor,
GoogleVisionAPILabelExtractor,
GoogleVisionAPIPropertyExtractor,
GoogleVisionAPISafeSearchExtractor)
from pliers.extractors.google import GoogleVisionAPIExtractor
fro... | [
"pliers.extractors.GoogleVisionAPIFaceExtractor",
"pliers.extractors.GoogleVisionAPIPropertyExtractor",
"pliers.extractors.google.GoogleVisionAPIExtractor",
"numpy.isfinite",
"pliers.stimuli.ImageStim",
"pytest.mark.skipif",
"pliers.extractors.GoogleVisionAPILabelExtractor",
"pliers.extractors.GoogleV... | [((465, 537), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""\'GOOGLE_APPLICATION_CREDENTIALS\' not in os.environ"""'], {}), '("\'GOOGLE_APPLICATION_CREDENTIALS\' not in os.environ")\n', (483, 537), False, 'import pytest\n'), ((738, 810), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""\'GOOGLE_APPLICATION_CREDENT... |
# coding=utf-8
import argparse
import os
import time
from math import ceil
import caffe
import cv2
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--caffe_prototxt_path', default="model/RFB-320/RFB-320.prototxt", type=str, help='caffe_prototxt_path')
parser.add_argument('--caffe_model_path'... | [
"numpy.clip",
"cv2.rectangle",
"cv2.imshow",
"numpy.argsort",
"numpy.array",
"cv2.destroyAllWindows",
"caffe.set_mode_cpu",
"os.path.exists",
"os.listdir",
"numpy.reshape",
"argparse.ArgumentParser",
"numpy.exp",
"numpy.concatenate",
"numpy.maximum",
"cv2.waitKey",
"cv2.cvtColor",
"c... | [((129, 154), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (152, 154), False, 'import argparse\n'), ((990, 1015), 'numpy.array', 'np.array', (['[127, 127, 127]'], {}), '([127, 127, 127])\n', (998, 1015), True, 'import numpy as np\n'), ((906, 926), 'caffe.set_mode_cpu', 'caffe.set_mode_cpu', (... |
# Name: <NAME>
# Date: 2 March 2020
# Program: biot_helix.py
import numpy as np
import matplotlib.pyplot as plt
import time as time
from matplotlib.patches import Circle
def biot(Rvec, wire, I):
mu_4pi = 10
dB = np.zeros((len(wire), 3))
R = Rvec - wire
Rsqr = np.sum( R**2, axis = 1 )
d... | [
"numpy.roll",
"numpy.cross",
"numpy.column_stack",
"numpy.sum",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.array",
"numpy.concatenate",
"numpy.cos",
"numpy.sin",
"numpy.meshgrid",
"time.time",
"matplotlib.patches.Circle",
"numpy.arange"
] | [((1150, 1180), 'numpy.arange', 'np.arange', (['(-L / 2)', '(L / 2)', 'segL'], {}), '(-L / 2, L / 2, segL)\n', (1159, 1180), True, 'import numpy as np\n'), ((1410, 1454), 'numpy.column_stack', 'np.column_stack', (['(helix_x, helix_y, helix_z)'], {}), '((helix_x, helix_y, helix_z))\n', (1425, 1454), True, 'import numpy ... |
from chainer import functions as F
from scipy import special
import numpy as np
from scipy import ndimage
def log_beta_distribution(x, a, b):
eps = 1e-5
lnp = ((a - 1) * F.log(x + eps)
+ (b - 1) * F.log(1 - x + eps)
- float(special.beta(a, b)))
return lnp
def make_laplacian_of_gau... | [
"chainer.functions.log",
"scipy.special.beta",
"numpy.exp",
"numpy.zeros",
"scipy.ndimage.rotate",
"numpy.arange"
] | [((403, 423), 'numpy.zeros', 'np.zeros', (['[101, 101]'], {}), '([101, 101])\n', (411, 423), True, 'import numpy as np\n'), ((432, 450), 'numpy.arange', 'np.arange', (['(-50)', '(51)'], {}), '(-50, 51)\n', (441, 450), True, 'import numpy as np\n'), ((579, 627), 'scipy.ndimage.rotate', 'ndimage.rotate', (['f', 'angle'],... |
import os
import re
import base64
import webbrowser
import time
import tempfile
import numpy as np
import matplotlib
from numpy.testing import assert_warns, assert_no_warnings
try:
from lxml import etree
LXML_INSTALLED = True
except ImportError:
LXML_INSTALLED = False
from nilearn.plotting import js_plott... | [
"nilearn.datasets.fetch_surf_fsaverage",
"time.sleep",
"numpy.arange",
"os.remove",
"numpy.testing.assert_warns",
"lxml.etree.HTMLParser",
"nilearn.surface.load_surf_mesh",
"nilearn.plotting.js_plotting_utils.to_color_strings",
"nilearn.plotting.js_plotting_utils.get_html_template",
"nilearn.plott... | [((577, 602), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'text'], {}), "('\\\\s+', ' ', text)\n", (583, 602), False, 'import re\n'), ((639, 704), 'nilearn.plotting.js_plotting_utils.get_html_template', 'js_plotting_utils.get_html_template', (['"""surface_plot_template.html"""'], {}), "('surface_plot_template.html... |
import random
import numpy as np
def read_data(pairs_file):
with open(pairs_file, 'r') as file:
tcrs = set()
peps = set()
all_pairs = []
for line in file:
tcr, pep, cd = line.strip().split('\t')
# print(tcr, pep)
# Proper tcr and peptides
... | [
"random.choice",
"random.shuffle",
"numpy.random.binomial"
] | [((2380, 2401), 'random.shuffle', 'random.shuffle', (['train'], {}), '(train)\n', (2394, 2401), False, 'import random\n'), ((2437, 2457), 'random.shuffle', 'random.shuffle', (['test'], {}), '(test)\n', (2451, 2457), False, 'import random\n'), ((777, 803), 'numpy.random.binomial', 'np.random.binomial', (['(1)', '(0.8)']... |
"""
Tests functions in the spiketools module
"""
import numpy as np
import pyret.spiketools as spk
def test_binspikes():
# assert the proper indices are returned
spike_times = [1.0, 2.0, 2.5, 3.0]
dt = 0.01
bin_edges = np.arange(0, 3, dt)
bspk = spk.binspikes(spike_times, bin_edges)
assert np... | [
"numpy.hstack",
"pyret.spiketools.estfr",
"numpy.argsort",
"numpy.array",
"numpy.gradient",
"numpy.arange",
"numpy.where",
"numpy.diff",
"numpy.exp",
"numpy.linspace",
"numpy.random.seed",
"numpy.abs",
"numpy.allclose",
"numpy.ones",
"pyret.spiketools.binspikes",
"pyret.spiketools.dete... | [((238, 257), 'numpy.arange', 'np.arange', (['(0)', '(3)', 'dt'], {}), '(0, 3, dt)\n', (247, 257), True, 'import numpy as np\n'), ((269, 306), 'pyret.spiketools.binspikes', 'spk.binspikes', (['spike_times', 'bin_edges'], {}), '(spike_times, bin_edges)\n', (282, 306), True, 'import pyret.spiketools as spk\n'), ((702, 71... |
# Least Square Sample
# ========================================
# [] File Name : ls_sample.py
#
# [] Creation Date : December 2017
#
# [] Created By : <NAME> (<EMAIL>)
# ========================================
#
import matplotlib.pyplot as plt
import numpy as numpy
dataset = numpy.array([[3,5],[5,3],[8,4],[3,1],[6,4... | [
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.show"
] | [((279, 356), 'numpy.array', 'numpy.array', (['[[3, 5], [5, 3], [8, 4], [3, 1], [6, 4], [5, 4], [7, 5], [8, 3]]'], {}), '([[3, 5], [5, 3], [8, 4], [3, 1], [6, 4], [5, 4], [7, 5], [8, 3]])\n', (290, 356), True, 'import numpy as numpy\n'), ((1466, 1478), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1476, ... |
# -----------------------------------------------------------------------------
# Copyright (c) 2009-2016 <NAME>. All rights reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
"""
A framebuffer is a collection of buffers that can be used ... | [
"glumpy.gl.glCheckFramebufferStatus",
"glumpy.gl.glDeleteRenderbuffer",
"glumpy.gl.glFramebufferTexture2D",
"numpy.array",
"glumpy.gl.glGenFramebuffers",
"numpy.resize",
"glumpy.gl.glRenderbufferStorage",
"glumpy.gl.glFramebufferRenderbuffer",
"glumpy.gl.glGenRenderbuffers",
"glumpy.gloo.globject.... | [((1624, 1647), 'glumpy.gloo.globject.GLObject.__init__', 'GLObject.__init__', (['self'], {}), '(self)\n', (1641, 1647), False, 'from glumpy.gloo.globject import GLObject\n'), ((2471, 2509), 'glumpy.log.log.debug', 'log.debug', (['"""GPU: Create render buffer"""'], {}), "('GPU: Create render buffer')\n", (2480, 2509), ... |
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import albumentations
import albumentations.pytorch
import numpy as np
import math
import pandas as pd
import random
import os
import matplotlib
import argparse
import wandb
from EnD import *
from configs import *
from collections im... | [
"torch.cuda.manual_seed_all",
"torch.manual_seed",
"wandb.log",
"torch.enable_grad",
"torch.max",
"tqdm.tqdm",
"torch.optim.lr_scheduler.StepLR",
"random.seed",
"os.path.join",
"collections.defaultdict",
"numpy.random.seed",
"torch.nn.functional.cross_entropy",
"models.simple_convnet",
"to... | [((403, 422), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (415, 422), False, 'import torch\n'), ((472, 497), 'torch.max', 'torch.max', (['outputs'], {'dim': '(1)'}), '(outputs, dim=1)\n', (481, 497), False, 'import torch\n'), ((775, 804), 'tqdm.tqdm', 'tqdm', (['dataloader'], {'leave': '(False)'})... |
# coding: utf-8
# Gather breast cancer data
from sklearn.datasets import load_breast_cancer
breast_cancer = load_breast_cancer()
breast_cancer_data = breast_cancer.data
breast_cancer_labels = breast_cancer.target
# Prepare data as pandas dataframe
import numpy as np
labels = np.reshape(breast_cancer_labels,(569,1... | [
"numpy.reshape",
"sklearn.model_selection.train_test_split",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.datasets.load_breast_cancer",
"numpy.append",
"sklearn.preprocessing.StandardScaler",
"numpy.concatenate",
"sklearn.feature_selection.SelectPercentile",
"pandas.DataFrame"
] | [((110, 130), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (128, 130), False, 'from sklearn.datasets import load_breast_cancer\n'), ((282, 324), 'numpy.reshape', 'np.reshape', (['breast_cancer_labels', '(569, 1)'], {}), '(breast_cancer_labels, (569, 1))\n', (292, 324), True, 'import nu... |
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
from torch import save as tsave
from .general_functions import create_dir
class Logger:
def __init__(
self,
save_path="",
save_every=100,
save_best=False,
log_every=50,
log_style="block",
... | [
"numpy.mean",
"numpy.convolve",
"pickle.dump",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"numpy.std",
"numpy.cumsum",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((2202, 2217), 'numpy.mean', 'np.mean', (['losses'], {}), '(losses)\n', (2209, 2217), True, 'import numpy as np\n'), ((2297, 2313), 'numpy.mean', 'np.mean', (['rewards'], {}), '(rewards)\n', (2304, 2313), True, 'import numpy as np\n'), ((3417, 3438), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Episode"""'], {}), "... |
"""
h2o2_mk2012_ad.py
Hydrogen peroxide, H2O2, ground state surface from
Ref [1]_. The coefficients are available from the references
supplementary information as the 'adiabatic PES', which
corresponds to the "V+C+R+H+D" results.
The surface is implemented in internal coordinates.
X1 ... O1 -- H1 bond length (Angst... | [
"nitrogen.autodiff.forward.cos",
"nitrogen.dfun.DFun",
"numpy.array",
"nitrogen.dfun.X2adf",
"nitrogen.dfun.adf2array",
"nitrogen.autodiff.forward.const_like"
] | [((1555, 1585), 'nitrogen.dfun.DFun', 'n2.dfun.DFun', (['Vfun'], {'nf': '(1)', 'nx': '(6)'}), '(Vfun, nf=1, nx=6)\n', (1567, 1585), True, 'import nitrogen as n2\n'), ((2432, 8340), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 2], [0, 0, 0, 0, 0,\n 3], [0, 0, 0, 0, 0, 4], [0,... |
import os
import re
import json
import time
import numpy as np
import pandas as pd
from plotnine import *
# Config
PATH = os.getcwd()
path_n = re.split(pattern=r"/|\\", string=PATH)[1:]
if os.name == "posix":
path_n = "/" + os.path.join(*path_n)
else:
drive = PATH[0:3]
path_n = drive + os.path.join(*path_n... | [
"re.split",
"numpy.mean",
"numpy.median",
"os.path.join",
"re.match",
"os.getcwd",
"numpy.max",
"numpy.min",
"pandas.DataFrame",
"time.time",
"re.search"
] | [((123, 134), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (132, 134), False, 'import os\n'), ((2648, 2669), 'pandas.DataFrame', 'pd.DataFrame', (['results'], {}), '(results)\n', (2660, 2669), True, 'import pandas as pd\n'), ((144, 183), 're.split', 're.split', ([], {'pattern': '"""/|\\\\\\\\"""', 'string': 'PATH'}), "(... |
import pytest
from numerous.engine.model import Model
from numerous.engine.simulation import Simulation
from numerous.utils.logger_levels import LoggerLevel
from numerous.multiphysics.equation_base import EquationBase
from numerous.multiphysics.equation_decorators import Equation
from numerous.engine.system.item import... | [
"pytest.approx",
"numerous.multiphysics.equation_decorators.Equation",
"numpy.ones",
"numerous.engine.simulation.Simulation",
"pytest.mark.parametrize",
"numpy.linspace",
"numpy.exp",
"numerous.engine.model.Model",
"shutil.rmtree",
"pytest.fixture"
] | [((548, 576), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (562, 576), False, 'import pytest\n'), ((1459, 1506), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""solver"""', 'solver_types'], {}), "('solver', solver_types)\n", (1482, 1506), False, 'import pytest\n'), ((... |
#!/usr/bin/env python
"""
Scheduling tactician.
"""
import os
import logging
import numpy as np
import ephem
from collections import OrderedDict as odict
from obztak import get_survey
from obztak.utils.projector import angsep
from obztak.utils import projector as proj
from obztak.ctio import CTIO
from obztak.utils i... | [
"numpy.sqrt",
"ephem.Sun",
"obztak.ctio.CTIO",
"numpy.isfinite",
"ephem.Date",
"argparse.ArgumentParser",
"obztak.utils.projector.angsep",
"numpy.argmin",
"numpy.degrees",
"ephem.Moon",
"collections.OrderedDict",
"numpy.in1d",
"numpy.any",
"numpy.nonzero",
"numpy.char.count",
"obztak.u... | [((391, 609), 'collections.OrderedDict', 'odict', (["[(None, [0.0, 2.0]), ('great', [1.6, 2.0]), ('good', [0.0, 2.0]), (\n 'complete', [0.0, 2.0]), ('maglites', [0.0, 2.0]), ('fine', [0.0, 1.9]),\n ('ok', [0.0, 1.6]), ('poor', [0.0, 1.5]), ('bad', [0.0, 1.4])]"], {}), "([(None, [0.0, 2.0]), ('great', [1.6, 2.0]),... |
""" A PointSampleCam emulates a camera which has been calibrated to associate real-world coordinates (xr, yr) with each pixel position (xp, yp). A calibration data file is consulted which provides these associations. """
import pymunk
import numpy as np
from math import atan2, sqrt, fabs
from common import *
from pym... | [
"numpy.delete",
"math.sqrt",
"pyglet.gl.glPointSize",
"numpy.zeros",
"pyglet.graphics.draw",
"math.fabs",
"math.atan2",
"pymunk.ShapeFilter",
"numpy.loadtxt",
"configsingleton.ConfigSingleton.get_instance"
] | [((1019, 1049), 'configsingleton.ConfigSingleton.get_instance', 'ConfigSingleton.get_instance', ([], {}), '()\n', (1047, 1049), False, 'from configsingleton import ConfigSingleton\n'), ((1652, 1693), 'numpy.loadtxt', 'np.loadtxt', (['calib_filename'], {'delimiter': '""","""'}), "(calib_filename, delimiter=',')\n", (166... |
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
pgf_with_custom_preamble = {
"font.family": "serif", # use serif/main font for text elements
"text.usetex": True, # use inline math for ticks
# "pgf.rcfonts": False, # don't setup fonts from rc parameters
"pgf.preamble": [
"\\usep... | [
"argparse.ArgumentParser",
"matplotlib.rcParams.update",
"matplotlib.use",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.min",
"numpy.cumsum",
"numpy.loadtxt",
"numpy.arange"
] | [((44, 58), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (51, 58), True, 'import matplotlib as mpl\n'), ((401, 446), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (['pgf_with_custom_preamble'], {}), '(pgf_with_custom_preamble)\n', (420, 446), True, 'import matplotlib as mpl\n'), ((1377, 1432), ... |
'''
Copyright 2017 <NAME>, <NAME>, <NAME> and the Max Planck Gesellschaft. All rights reserved.
This software is provided for research purposes only.
By using this software you agree to the terms of the MANO/SMPL+H Model license here http://mano.is.tue.mpg.de/license
More information about MANO/SMPL+H is available at... | [
"cv2.imwrite",
"numpy.ones_like",
"numpy.eye",
"numpy.random.rand",
"cv2.imshow",
"opendr.renderer.ColoredRenderer",
"numpy.zeros",
"numpy.array",
"cv2.destroyAllWindows",
"psbody.mesh.Mesh",
"psbody.mesh.MeshViewers",
"cv2.waitKey",
"webuser.smpl_handpca_wrapper.load_model"
] | [((2118, 2194), 'webuser.smpl_handpca_wrapper.load_model', 'load_model', (['"""../../models/SMPLH_female.pkl"""'], {'ncomps': '(12)', 'flat_hand_mean': '(False)'}), "('../../models/SMPLH_female.pkl', ncomps=12, flat_hand_mean=False)\n", (2128, 2194), False, 'from webuser.smpl_handpca_wrapper import load_model\n'), ((35... |
from typing import List, Optional, Iterable
import numpy as np
import pandas as pd
from fire import Fire
from icecream import ic
from sacrebleu import sentence_bleu, corpus_bleu
from torchmetrics import ROUGEScore
class OracleReranker:
def __init__(self,
target_path: Optional[str] = None,
... | [
"icecream.ic",
"numpy.repeat",
"fire.Fire",
"sacrebleu.sentence_bleu",
"torchmetrics.ROUGEScore",
"pandas.DataFrame",
"sacrebleu.corpus_bleu"
] | [((6121, 6141), 'fire.Fire', 'Fire', (['OracleReranker'], {}), '(OracleReranker)\n', (6125, 6141), False, 'from fire import Fire\n'), ((2176, 2249), 'pandas.DataFrame', 'pd.DataFrame', (['rows'], {'columns': "['example_index', 'confidence', 'prediction']"}), "(rows, columns=['example_index', 'confidence', 'prediction']... |
'''This is a module that tries to use emcee to solve SNooPy models.
The SN object should have all the necessary ingredients. All that is
left is to define prior probabilities.'''
import emcee
import numpy as np
from scipy.optimize import minimize
import types,os
gconst = -0.5*np.log(2*np.pi)
def builtin_priors(x, st... | [
"numpy.shape",
"numpy.sometrue",
"numpy.power",
"numpy.log",
"emcee.EnsembleSampler",
"os.path.isfile",
"numpy.zeros",
"numpy.isfinite",
"numpy.loadtxt",
"numpy.random.randn"
] | [((279, 296), 'numpy.log', 'np.log', (['(2 * np.pi)'], {}), '(2 * np.pi)\n', (285, 296), True, 'import numpy as np\n'), ((1293, 1321), 'numpy.zeros', 'np.zeros', (["(varinfo['Nvar'],)"], {}), "((varinfo['Nvar'],))\n", (1301, 1321), True, 'import numpy as np\n'), ((1330, 1358), 'numpy.zeros', 'np.zeros', (["(varinfo['Nv... |
from reprojection import runSuperGlueSinglePair,image_pair_candidates, runSIFTSinglePair
from ray_dist_loss import preprocess_match, proj_ray_dist_loss_single
import torch
import numpy as np
import os
from random import random
import numpy as np
import torch
import torchvision.transforms as TF
import matplotlib.pypl... | [
"torchvision.transforms.ToPILImage",
"matplotlib.pyplot.imshow",
"reprojection.image_pair_candidates",
"numpy.where",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"ray_dist_loss.proj_ray_dist_loss_single",
"ray_dist_loss.preprocess_match",
"matplotlib.pyplot.savefig",
"torch.einsum",
"to... | [((1325, 1358), 'os.path.join', 'os.path.join', (['dirname', 'scene_name'], {}), '(dirname, scene_name)\n', (1337, 1358), False, 'import os\n'), ((1363, 1401), 'os.makedirs', 'os.makedirs', (['scene_path'], {'exist_ok': '(True)'}), '(scene_path, exist_ok=True)\n', (1374, 1401), False, 'import os\n'), ((1473, 1507), 'os... |
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from sklearn import decomposition
import scipy.signal
import os
import pandas as pd
from skimage.transform import resize
def get_mean(signal: np.ndarray, axis=0):
return signal.mean(axis=axis)
def get_std_dev(signal: np.nd... | [
"numpy.abs",
"sklearn.decomposition.PCA",
"numpy.fft.fft",
"matplotlib.pyplot.clf",
"os.walk",
"os.path.join",
"matplotlib.pyplot.plot",
"numpy.sum",
"matplotlib.pyplot.figure",
"pandas.concat",
"os.path.basename",
"pandas.DataFrame",
"skimage.transform.resize",
"matplotlib.pyplot.cla",
... | [((659, 677), 'numpy.fft.fft', 'np.fft.fft', (['signal'], {}), '(signal)\n', (669, 677), True, 'import numpy as np\n'), ((846, 875), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {'figsize': '(4, 3)'}), '(1, figsize=(4, 3))\n', (856, 875), True, 'import matplotlib.pyplot as plt\n'), ((880, 889), 'matplotlib.pyplo... |
import librosa
import numpy as np
import matplotlib.pyplot as plt
from sys import argv
script, content_audio_name, style_audio_name, output_audio_name = argv
N_FFT=2048
def read_audio_spectum(filename):
x, fs = librosa.load(filename, duration=58.04) # Duration=58.05 so as to make sizes convenient
S = librosa.stft(x... | [
"matplotlib.pyplot.imshow",
"numpy.abs",
"librosa.load",
"numpy.angle",
"matplotlib.pyplot.figure",
"librosa.stft",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((660, 688), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(15, 25)'}), '(figsize=(15, 25))\n', (670, 688), True, 'import matplotlib.pyplot as plt\n'), ((688, 708), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(3)', '(1)'], {}), '(1, 3, 1)\n', (699, 708), True, 'import matplotlib.pyplot as plt\n... |
import numpy as np
class Ingredients:
'''
Class for calculations of ingredients inside an area.
'''
def __init__(self, pizza_lines):
self._lines = [list(l) for l in pizza_lines]
self._unique, self._map = np.unique(self._lines, return_inverse=True)
self._map = self._map.reshape(... | [
"numpy.copy",
"numpy.zeros",
"numpy.unique",
"numpy.max"
] | [((238, 281), 'numpy.unique', 'np.unique', (['self._lines'], {'return_inverse': '(True)'}), '(self._lines, return_inverse=True)\n', (247, 281), True, 'import numpy as np\n'), ((674, 716), 'numpy.zeros', 'np.zeros', (['(*self.shape, self.total_unique)'], {}), '((*self.shape, self.total_unique))\n', (682, 716), True, 'im... |
#!/usr/bin/env python
import numpy as np
import argparse
from PIL import Image
import imutils
import cv2
import os
import pprint
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
ap = argparse.ArgumentParser()
ap.add_argument("-m", "--model", required=True,
help="base path for TFlite dete... | [
"cv2.rectangle",
"PIL.Image.open",
"tensorflow.contrib.lite.Interpreter",
"argparse.ArgumentParser",
"numpy.asarray",
"numpy.squeeze",
"cv2.imshow",
"cv2.putText",
"cv2.waitKey",
"numpy.expand_dims",
"cv2.imread",
"pprint.pprint"
] | [((199, 224), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (222, 224), False, 'import argparse\n'), ((985, 1038), 'tensorflow.contrib.lite.Interpreter', 'tf.contrib.lite.Interpreter', ([], {'model_path': "args['model']"}), "(model_path=args['model'])\n", (1012, 1038), True, 'import tensorflow... |
"""
Display a plot and an image with minimal setup.
pg.plot() and pg.image() are indended to be used from an interactive prompt
to allow easy data inspection (but note that PySide unfortunately does not
call the Qt event loop while the interactive prompt is running, in this case
it is necessary to call QApplica... | [
"numpy.random.normal",
"pyqtgraph.image",
"pyqtgraph.plot",
"pyqtgraph.QtGui.QApplication.exec_"
] | [((510, 537), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(1000)'}), '(size=1000)\n', (526, 537), True, 'import numpy as np\n'), ((539, 596), 'pyqtgraph.plot', 'pg.plot', (['data'], {'title': '"""Simplest possible plotting example"""'}), "(data, title='Simplest possible plotting example')\n", (546, 596), ... |
# -*- coding: utf-8 -*-
import gc
import numpy as np
import pandas as pd
import lightgbm as lgb
from data import *
from feat import *
from resource import *
from utils import (load_dataframe, convert_dtype, CrossValidation, merge_all)
def rank_feat_inside_session(df, cols):
for col in cols:
col_n = '... | [
"utils.CrossValidation",
"numpy.mean",
"lightgbm.LGBMClassifier",
"gc.collect"
] | [((2226, 2243), 'utils.CrossValidation', 'CrossValidation', ([], {}), '()\n', (2241, 2243), False, 'from utils import load_dataframe, convert_dtype, CrossValidation, merge_all\n'), ((2257, 2541), 'lightgbm.LGBMClassifier', 'lgb.LGBMClassifier', ([], {'n_estimators': '(50000)', 'objective': '"""binary"""', 'metric': '""... |
from numpy import argsort, diff, max, where
from numpy import abs as np_abs
from numpy import mean as np_mean
from numpy import median as np_median
from numpy import var as np_var
from numpy import min as np_min
from numpy import max as np_max
import numpy as np
from numpy.lib.histograms import _unsigned_subtract
from ... | [
"numpy.abs",
"scipy.signal.convolve",
"numpy.where",
"numpy.diff",
"numpy.argsort",
"scipy.signal.find_peaks"
] | [((4597, 4637), 'scipy.signal.convolve', 'convolve', (['data', 'self.filter'], {'mode': '"""same"""'}), "(data, self.filter, mode='same')\n", (4605, 4637), False, 'from scipy.signal import convolve, find_peaks\n'), ((3208, 3241), 'numpy.where', 'where', (['(arr_ind_peaks > trough_ind)'], {}), '(arr_ind_peaks > trough_i... |
import os
import pickle
import glob
import numpy as np
from tqdm import tqdm
import random
class Create:
"""
Reads, transforms and saves the data in the format your network will use.
Keyword arguments:
raw_data_folder_path -- the Folder Path where all the raw data is saved.
save_data_folder_path ... | [
"numpy.mean",
"os.path.exists",
"os.makedirs",
"tqdm.tqdm",
"pickle.load",
"os.remove",
"numpy.array",
"numpy.save",
"numpy.std",
"numpy.load",
"glob.glob",
"numpy.random.shuffle"
] | [((2345, 2392), 'glob.glob', 'glob.glob', (["(self.raw_data_folder_path + '/*.pkl')"], {}), "(self.raw_data_folder_path + '/*.pkl')\n", (2354, 2392), False, 'import glob\n'), ((2603, 2616), 'tqdm.tqdm', 'tqdm', (['listing'], {}), '(listing)\n', (2607, 2616), False, 'from tqdm import tqdm\n'), ((6970, 7026), 'numpy.arra... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
from pandas_datareader import data
import statsmodels.api as sm
from statsmodels.tsa.seasonal import STL
import pandas_datareader.data as DataReader
def get_stock(stock,start,end):
df = data.DataReader(stock, 'stooq',star... | [
"pandas.Series",
"pandas_datareader.data.DataReader",
"matplotlib.pyplot.close",
"numba.jit",
"numpy.empty_like",
"datetime.date",
"statsmodels.api.tsa.filters.hpfilter",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.subplots"
] | [((404, 422), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (407, 422), False, 'from numba import jit\n'), ((467, 483), 'numpy.empty_like', 'np.empty_like', (['x'], {}), '(x)\n', (480, 483), True, 'import numpy as np\n'), ((1107, 1126), 'datetime.date', 'dt.date', (['(2020)', '(1)', '(1)'], {})... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 17 11:02:24 2022
@author: rossgra
"""
import numpy as np
from numpy.core.fromnumeric import std
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import scipy
from scipy.stats import mannwhitneyu
import statistics as stat
metric = input('SAE or N... | [
"seaborn.displot",
"numpy.mean",
"numpy.median",
"pandas.read_csv",
"numpy.average",
"statistics.median",
"scipy.stats.wilcoxon",
"scipy.stats.ttest_ind",
"numpy.std",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((1581, 1609), 'pandas.read_csv', 'pd.read_csv', (['No_hood_MJ_path'], {}), '(No_hood_MJ_path)\n', (1592, 1609), True, 'import pandas as pd\n'), ((1620, 1645), 'pandas.read_csv', 'pd.read_csv', (['Hood_MJ_Path'], {}), '(Hood_MJ_Path)\n', (1631, 1645), True, 'import pandas as pd\n'), ((18233, 18331), 'scipy.stats.ttest... |
from sklearn.feature_extraction.text import CountVectorizer
from nltk.corpus import names
from nltk.stem import WordNetLemmatizer
import glob
import os
import numpy as np
file_path = 'enron1/ham/0007.1999-12-14.farmer.ham.txt'
with open(file_path, 'r') as infile:
ham_sample = infile.read()
print(ham_sample)
fil... | [
"matplotlib.pyplot.ylabel",
"sklearn.metrics.classification_report",
"numpy.log",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sklearn.model_selection.StratifiedKFold",
"numpy.array",
"numpy.arange",
"sklearn.feature_extraction.text.CountVect... | [((465, 520), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer', ([], {'stop_words': '"""english"""', 'max_features': '(500)'}), "(stop_words='english', max_features=500)\n", (480, 520), False, 'from sklearn.feature_extraction.text import CountVectorizer\n'), ((1076, 1095), 'nltk.stem.WordNetLemmatiz... |
import numpy as np
import tensorflow as tf
def get_angles(pos, i, d_model):
angle_rates = 1 / np.power(10000, (2 * (i//2)) / np.float32(d_model))
return pos * angle_rates
def positional_encoding(position, d_model):
angle_rads = get_angles(np.arange(position)[:, np.newaxis],
np.ar... | [
"tensorflow.shape",
"numpy.float32",
"tensorflow.image.resize",
"numpy.arange",
"tensorflow.io.read_file",
"numpy.zeros",
"tensorflow.constant",
"numpy.cos",
"tensorflow.maximum",
"numpy.sin",
"tensorflow.cast",
"numpy.zeros_like",
"tensorflow.minimum",
"tensorflow.stack",
"tensorflow.im... | [((461, 488), 'numpy.sin', 'np.sin', (['angle_rads[:, 0::2]'], {}), '(angle_rads[:, 0::2])\n', (467, 488), True, 'import numpy as np\n'), ((566, 593), 'numpy.cos', 'np.cos', (['angle_rads[:, 1::2]'], {}), '(angle_rads[:, 1::2])\n', (572, 593), True, 'import numpy as np\n'), ((654, 693), 'tensorflow.cast', 'tf.cast', ([... |
####################################### MALETESS ##################################
################################################################################
#
# Copyright (C) 2019 <NAME>
# <EMAIL>
#
# This program is free software: you can redistribute it and/or modify
# it under the te... | [
"scipy.fftpack.fftfreq",
"scipy.fftpack.fft",
"astropy.io.fits.open",
"numpy.arange",
"numpy.mean",
"argparse.ArgumentParser",
"json.dumps",
"scipy.signal.find_peaks",
"numpy.abs",
"pickle.load",
"numpy.argmax",
"scipy.ndimage.filters.gaussian_filter1d",
"numpy.interp",
"numpy.std",
"num... | [((1412, 1589), 'argparse.ArgumentParser', 'argp.ArgumentParser', ([], {'prog': '"""maletess.py"""', 'description': '"""This is a Python3 algorithm to make predictions for planets candidates using Machine Learning """', 'usage': '"""%(prog)s"""'}), "(prog='maletess.py', description=\n 'This is a Python3 algorithm to... |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 22 09:22:42 2021
@author: luyao.li
"""
import numpy as np
import os
from functools import partial
from collections import defaultdict
import matplotlib.pyplot as plt
def hash_fun(a,b,n_buckets,x, p=123457):
y=x%p
hash_val = (a*y+b ) %p
return hash_val % n_b... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.log",
"numpy.exp",
"matplotlib.pyplot.figure",
"collections.defaultdict",
"os.path.abspath",
"matplotlib.pyplot.title",
"numpy.loadtxt",
"matplotlib.pyplot.show"
] | [((526, 571), 'numpy.loadtxt', 'np.loadtxt', (['"""hash_params.txt"""'], {'delimiter': '"""\t"""'}), "('hash_params.txt', delimiter='\\t')\n", (536, 571), True, 'import numpy as np\n'), ((583, 593), 'numpy.exp', 'np.exp', (['(-5)'], {}), '(-5)\n', (589, 593), True, 'import numpy as np\n'), ((1662, 1690), 'matplotlib.py... |
import numpy as np
from .qnumber import is_qsparse
__all__ = ['retained_bond_indices', 'split_matrix_svd', 'qr']
def retained_bond_indices(s, tol):
"""
Indices of retained singular values based on given tolerance.
"""
w = np.linalg.norm(s)
if w == 0:
return np.array([], dtype=int)
# ... | [
"numpy.intersect1d",
"numpy.linalg.qr",
"numpy.where",
"numpy.argsort",
"numpy.array",
"numpy.zeros",
"numpy.linalg.norm",
"numpy.linalg.svd",
"numpy.cumsum"
] | [((241, 258), 'numpy.linalg.norm', 'np.linalg.norm', (['s'], {}), '(s)\n', (255, 258), True, 'import numpy as np\n'), ((423, 436), 'numpy.argsort', 'np.argsort', (['s'], {}), '(s)\n', (433, 436), True, 'import numpy as np\n'), ((455, 477), 'numpy.cumsum', 'np.cumsum', (['s[sort_idx]'], {}), '(s[sort_idx])\n', (464, 477... |
import copy
import inspect
import itertools
import types
import warnings
from typing import Any, Dict
import numpy as np
from axelrod import _module_random
from axelrod.action import Action
from axelrod.game import DefaultGame
from axelrod.history import History
from axelrod.random_ import RandomGenerator
C, D = Acti... | [
"axelrod.random_.RandomGenerator",
"itertools.cycle",
"axelrod._module_random.random_seed_int",
"itertools.tee",
"inspect.signature",
"numpy.array_equal",
"axelrod.history.History",
"copy.deepcopy",
"warnings.warn",
"copy.copy"
] | [((2878, 2909), 'inspect.signature', 'inspect.signature', (['cls.__init__'], {}), '(cls.__init__)\n', (2895, 2909), False, 'import inspect\n'), ((3407, 3416), 'axelrod.history.History', 'History', ([], {}), '()\n', (3414, 3416), False, 'from axelrod.history import History\n'), ((3443, 3473), 'copy.deepcopy', 'copy.deep... |
from typing import List
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from chemcharts.core.container.chemdata import ChemData
from chemcharts.core.plots.base_plot import BasePlot, _check_value_input
from chemcharts.core.utils.value_functions import generate_value
from c... | [
"numpy.atleast_2d",
"matplotlib.pyplot.gcf",
"seaborn.set_context",
"matplotlib.pyplot.close",
"chemcharts.core.utils.value_functions.generate_value",
"chemcharts.core.plots.base_plot._check_value_input",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.subplots"
] | [((854, 900), 'chemcharts.core.plots.base_plot._check_value_input', '_check_value_input', (['chemdata_list', '"""Histogram"""'], {}), "(chemdata_list, 'Histogram')\n", (872, 900), False, 'from chemcharts.core.plots.base_plot import BasePlot, _check_value_input\n'), ((1693, 1707), 'matplotlib.pyplot.subplots', 'plt.subp... |
from scipy.stats import multivariate_normal as normal
import numpy as np
from time import time
from experiments.lnpdfs.create_target_lnpfs import build_target_likelihood_planar_n_link
from sampler.SliceSampling.slice_sampler import slice_sample
num_dimensions = 10
conf_likelihood_var = 4e-2 * np.ones(num_dimensions)
c... | [
"numpy.savez",
"numpy.eye",
"numpy.ones",
"experiments.lnpdfs.create_target_lnpfs.build_target_likelihood_planar_n_link",
"numpy.array",
"numpy.zeros",
"time.time"
] | [((368, 394), 'numpy.array', 'np.array', (['[0.0001, 0.0001]'], {}), '([0.0001, 0.0001])\n', (376, 394), True, 'import numpy as np\n'), ((295, 318), 'numpy.ones', 'np.ones', (['num_dimensions'], {}), '(num_dimensions)\n', (302, 318), True, 'import numpy as np\n'), ((400, 499), 'experiments.lnpdfs.create_target_lnpfs.bu... |
import xlrd
import numpy as np
import xlwt
from tempfile import TemporaryFile
book = xlwt.Workbook()
sheet1 = book.add_sheet('sheet1')
data=xlrd.open_workbook(r'C:\Users\Desktop\teamE\D1_route.xlsx')
table=data.sheets()[0]
all_data=[]
row_num=table.nrows
col_num=table.ncols
all_loc=[]
for i in ran... | [
"numpy.where",
"numpy.delete",
"xlrd.open_workbook",
"numpy.array",
"numpy.min",
"tempfile.TemporaryFile",
"xlwt.Workbook"
] | [((93, 108), 'xlwt.Workbook', 'xlwt.Workbook', ([], {}), '()\n', (106, 108), False, 'import xlwt\n'), ((152, 214), 'xlrd.open_workbook', 'xlrd.open_workbook', (['"""C:\\\\Users\\\\Desktop\\\\teamE\\\\D1_route.xlsx"""'], {}), "('C:\\\\Users\\\\Desktop\\\\teamE\\\\D1_route.xlsx')\n", (170, 214), False, 'import xlrd\n'), ... |
import pandas as pd
# data from https://archive.ics.uci.edu/ml/datasets/Computer+Hardware
df = pd.read_csv('../data/machine.data', header=None)
df.columns = [
'VENDOR', 'MODEL', 'MYCT', 'MMIN', 'MMAX',
'CACH', 'CHMIN', 'CHMAX', 'PRP', 'ERP'
]
# print(df.head())
import matplotlib.pyplot as plt
import seaborn... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.logical_not",
"sklearn.metrics.r2_score",
"numpy.arange",
"seaborn.set",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.dot",
"matplotlib.pyplot.scatter",
"numpy.abs",
"numpy.corrcoef",
"sklearn.model_selection.train_test_sp... | [((97, 145), 'pandas.read_csv', 'pd.read_csv', (['"""../data/machine.data"""'], {'header': 'None'}), "('../data/machine.data', header=None)\n", (108, 145), True, 'import pandas as pd\n'), ((328, 374), 'seaborn.set', 'sns.set', ([], {'style': '"""whitegrid"""', 'context': '"""notebook"""'}), "(style='whitegrid', context... |
# -*- coding: utf-8 -*-
import collections
import pytest
import numpy as np
from skmpe import mpe, parameters, OdeSolverMethod, EndPointNotReachedError
TRAVEL_TIME_ABS_TOL = 100
travel_time_order_param = pytest.mark.parametrize('travel_time_order', [
pytest.param(1),
pytest.param(2),
])
@pytest.mark.par... | [
"pytest.approx",
"pytest.param",
"pytest.mark.parametrize",
"skmpe.mpe",
"pytest.raises",
"numpy.ma.masked_array",
"skmpe.parameters",
"numpy.zeros_like"
] | [((305, 723), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ode_method, start_point, end_point"""', '[(OdeSolverMethod.RK23, (37, 255), (172, 112)), (OdeSolverMethod.RK45, (37,\n 255), (172, 112)), (OdeSolverMethod.DOP853, (37, 255), (172, 112)), (\n OdeSolverMethod.Radau, (37, 255), (172, 112)), (O... |
import numpy as np
import os.path
import time
import matplotlib._pylab_helpers
from matplotlib.backends.backend_pdf import PdfPages
# import plotly.plotly as py
# import plotly.tools as tls
def return_length_of_nonzero_array(X):
"""
Takes in a numpy.ndarray X of shape (m,n) and returns the length of the array that r... | [
"numpy.shape",
"time.strftime",
"matplotlib.backends.backend_pdf.PdfPages"
] | [((648, 659), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (656, 659), True, 'import numpy as np\n'), ((2359, 2391), 'matplotlib.backends.backend_pdf.PdfPages', 'PdfPages', (['(FilePath + PDFFileName)'], {}), '(FilePath + PDFFileName)\n', (2367, 2391), False, 'from matplotlib.backends.backend_pdf import PdfPages\n'... |
import pickle
from collections import Counter
from math import log
from typing import List, Dict, Tuple
import numpy as np
from scipy.sparse import csr_matrix
from scipy.spatial.distance import cosine
from common import check_data_set, flatten_nested_iterables
from preprocessors.configs import PreProcessingConfigs
fr... | [
"scipy.spatial.distance.cosine",
"pickle.dump",
"common.check_data_set",
"math.log",
"collections.Counter",
"numpy.array",
"common.flatten_nested_iterables",
"scipy.sparse.csr_matrix",
"utils.file_ops.check_paths",
"utils.file_ops.create_dir"
] | [((2033, 2042), 'collections.Counter', 'Counter', ([], {}), '()\n', (2040, 2042), False, 'from collections import Counter\n'), ((5051, 5060), 'collections.Counter', 'Counter', ([], {}), '()\n', (5058, 5060), False, 'from collections import Counter\n'), ((7067, 7138), 'common.check_data_set', 'check_data_set', ([], {'da... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 21 11:05:24 2017
The oil and sugar separation (pretreatment) section for the baseline lipid cane biorefinery is defined here as System objects. The systems include all streams and units starting from enzyme treatment to purification of the sugar sol... | [
"biosteam.units.MixTank",
"biosteam.units.CrushingMill",
"biosteam.units.ConveyingBelt",
"numpy.array",
"biosteam.biorefineries.lipidcane.species.pretreatment_species.indices",
"biosteam.units.Pump",
"biosteam.units.Mixer",
"biosteam.units.EnzymeTreatment",
"biosteam.Stream.indices",
"biosteam.Str... | [((1507, 1579), 'biosteam.Stream', 'Stream', (['"""lipid_cane"""', 'f1', 'psp1'], {'units': '"""kg/hr"""', 'price': "price['Lipid cane']"}), "('lipid_cane', f1, psp1, units='kg/hr', price=price['Lipid cane'])\n", (1513, 1579), False, 'from biosteam import System, Stream\n'), ((1622, 1709), 'biosteam.Stream', 'Stream', ... |
"""
There are a few important sets of datastructures:
dimensions
* N - Size of the dstore.
* K - Number of retrieved neighbors.
* D - Size of the key vectors.
dstore - This is the "ground truth" source of keys, values, and other important
items created by the KNN-LM.
... | [
"torch.ones_like",
"numpy.unique",
"torch.log_softmax",
"argparse.ArgumentParser",
"numpy.logical_and",
"numpy.sort",
"torch.stack",
"numpy.log",
"os.path.join",
"torch.from_numpy",
"numpy.sum",
"numpy.zeros",
"numpy.concatenate",
"numpy.take_along_axis",
"numpy.arange",
"torch.logsume... | [((2131, 2173), 'numpy.logical_and', 'np.logical_and', (['has_positive', 'has_negative'], {}), '(has_positive, has_negative)\n', (2145, 2173), True, 'import numpy as np\n'), ((17064, 17089), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (17087, 17089), False, 'import argparse\n'), ((3442, 3455... |
#exec(open("C:\\dev\\blender\\blogo\\src\\blogo.py").read())
import bpy
import math
import mathutils
import numpy as np
import runpy
#exec(open("C:\\dev\\blender\\blogo\\src\\blogo_colours.py").read())
import blogo_colours
import blogo
# TODO
# Clean up functions
# Add config file reading (with defau... | [
"bpy.data.lights.new",
"mathutils.Matrix.Rotation",
"math.sqrt",
"bpy.data.objects.new",
"bpy.data.libraries.load",
"math.cos",
"numpy.array",
"bpy.context.scene.collection.children.link",
"blogo.Blogo.clean_up",
"numpy.linalg.norm",
"bpy.context.copy",
"bpy.data.images.load",
"mathutils.Vec... | [((1804, 1826), 'blogo.Blogo.clean_up', 'blogo.Blogo.clean_up', ([], {}), '()\n', (1824, 1826), False, 'import blogo\n'), ((2365, 2384), 'numpy.array', 'np.array', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (2373, 2384), True, 'import numpy as np\n'), ((3859, 3884), 'bpy.ops.info.select_all', 'bpy.ops.info.select_all', ([],... |
import numpy as np
from phi import struct
from phi.math.math_util import is_static_shape
# creates normal distributed noise that can vary over the batch
def generateNoise(grid, var, mean=0, seed=0, dtype=np.float32):
size = grid.data.shape
rand = np.random.RandomState(seed)
def array(shape):
result... | [
"numpy.mean",
"numpy.repeat",
"numpy.ones",
"numpy.random.rand",
"numpy.arange",
"numpy.asarray",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"numpy.sum",
"numpy.concatenate",
"numpy.min",
"numpy.sin",
"numpy.pad",
"numpy.zeros_like",
"numpy.random.RandomState"... | [((256, 283), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (277, 283), True, 'import numpy as np\n'), ((482, 537), 'phi.struct.map', 'struct.map', (['array', 'grid'], {'leaf_condition': 'is_static_shape'}), '(array, grid, leaf_condition=is_static_shape)\n', (492, 537), False, 'from p... |
import torch
import torch.nn as nn
import torch.nn.functional as f
from mlp import MultiLayerPerceptron
import torch
import torch.nn as nn
import torch.optim as optim
import logging
import numpy as np
device = "cuda" if torch.cuda.is_available() else "cpu"
logger = logging.getLogger(__name__)
logging.basicConfig... | [
"logging.getLogger",
"torch.manual_seed",
"logging.basicConfig",
"torch.nn.ReLU",
"numpy.mean",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.no_grad",
"torch.cat"
] | [((273, 300), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (290, 300), False, 'import logging\n'), ((301, 322), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (320, 322), False, 'import logging\n'), ((227, 252), 'torch.cuda.is_available', 'torch.cuda.is_available', ([],... |
# imports
import matplotlib.pyplot as plt
import pandas as pd
from pathlib import Path
import numpy as np
from matplotlib.animation import FuncAnimation
import matplotlib.gridspec as gridspec
import os
import time
from manipulate_readinuvot import uvot
import scipy
from scipy.interpolate import interp1d
import matplot... | [
"random.shuffle",
"bokeh.plotting.figure",
"pandas.read_csv",
"bokeh.plotting.show",
"bokeh.plotting.save",
"os.path.join",
"bokeh.io.curdoc",
"scipy.interpolate.interp1d",
"numpy.array_split",
"numpy.linspace",
"bokeh.plotting.output_file"
] | [((859, 891), 'random.shuffle', 'random.shuffle', (['random_color_arr'], {}), '(random_color_arr)\n', (873, 891), False, 'import random\n'), ((1491, 1637), 'bokeh.plotting.figure', 'figure', ([], {'title': '"""Flux vs Wavelength"""', 'x_axis_label': '"""Wavelength (angstroms)"""', 'y_axis_label': '"""log(flux)+constant... |
# coding:utf-8
"""
Copyright 2021 Huawei Technologies Co., Ltd
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... | [
"numpy.mean",
"os.path.exists",
"os.path.join",
"os.path.split",
"numpy.array",
"numpy.zeros",
"pandas.DataFrame",
"numpy.loadtxt"
] | [((1220, 1253), 'pandas.DataFrame', 'pd.DataFrame', (['T[1:]'], {'columns': 'T[0]'}), '(T[1:], columns=T[0])\n', (1232, 1253), True, 'import pandas as pd\n'), ((1857, 1905), 'os.path.join', 'os.path.join', (['info_path', '"""music_tagging_tmp.txt"""'], {}), "(info_path, 'music_tagging_tmp.txt')\n", (1869, 1905), False,... |
## @ingroup Methods-Flight_Dynamics-Dynamic_Stability-Full_Linearized_Equations-Supporting_Functions
# cy_psi.py
#
# Created: Jun 2014, <NAME>
# Modified: Jan 2016, <NAME>
# ----------------------------------------------------------------------
# Imports
# -----------------------------------------------------------... | [
"numpy.tan"
] | [((1153, 1166), 'numpy.tan', 'np.tan', (['theta'], {}), '(theta)\n', (1159, 1166), True, 'import numpy as np\n')] |
"""Testing send_data functionality."""
import time
import pandas as pd
import pytest
import numpy as np
from dbrequests.mysql.tests.conftest import set_up_cats as reset
from dbrequests.mysql.tests.conftest import (
set_up_membership as reset_membership,
set_up_diffs as reset_diffs)
from sqlalchemy.exc import O... | [
"dbrequests.mysql.tests.conftest.set_up_cats",
"time.sleep",
"dbrequests.mysql.tests.conftest.set_up_diffs",
"numpy.isnan",
"pytest.mark.usefixtures",
"dbrequests.mysql.tests.conftest.set_up_membership",
"pytest.raises",
"pandas.DataFrame"
] | [((354, 383), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db"""'], {}), "('db')\n", (377, 383), False, 'import pytest\n'), ((4652, 4681), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db"""'], {}), "('db')\n", (4675, 4681), False, 'import pytest\n'), ((5697, 5726), 'pytest.mark.usefixtures... |
"""
Base Model
Base structure for creation of new models
Methods:
calc_error: Estimates error according to SciKit's regression metrics
filter_ts: Returns model's residuals
"""
import sys
sys.path.append('../')
from skfore.skfore import series_viewer
from skfore.datasets import *
import pandas
import numpy
... | [
"numpy.random.normal",
"pandas.Series",
"pandas.DataFrame",
"sklearn.preprocessing.MinMaxScaler",
"matplotlib.pyplot.plot",
"random.seed",
"sklearn.model_selection.TimeSeriesSplit",
"sklearn.metrics.mean_squared_error",
"numpy.array",
"skfore.extras.add_next_date",
"sklearn.utils.resample",
"n... | [((198, 220), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (213, 220), False, 'import sys\n'), ((2531, 2555), 'skfore.skfore.series_viewer', 'series_viewer', (['residuals'], {}), '(residuals)\n', (2544, 2555), False, 'from skfore.skfore import series_viewer\n'), ((4299, 4324), 'random.seed', ... |
"""Dummy fill to keep density constant."""
import itertools
from typing import Optional, Union
import gdspy
import numpy as np
from numpy import sqrt
from phidl.device_layout import _parse_layer
from phidl.geometry import (
_expand_raster,
_loop_over,
_raster_index_to_coords,
_rasterize_polygons,
)
fr... | [
"gdsfactory.components.rectangle.rectangle",
"numpy.sqrt",
"itertools.groupby",
"gdspy.boolean",
"phidl.geometry._loop_over",
"phidl.geometry._rasterize_polygons",
"numpy.size",
"phidl.geometry._raster_index_to_coords",
"numpy.array",
"gdsfactory.component.Component",
"gdsfactory.add_padding_con... | [((1345, 1356), 'gdsfactory.component.Component', 'Component', ([], {}), '()\n', (1354, 1356), False, 'from gdsfactory.component import Component\n'), ((3345, 3368), 'phidl.geometry._loop_over', '_loop_over', (['fill_layers'], {}), '(fill_layers)\n', (3355, 3368), False, 'from phidl.geometry import _expand_raster, _loo... |
from __future__ import absolute_import
from __future__ import print_function
import logging
import numpy as np
from numpy.lib.recfunctions import append_fields
from sklearn.cluster import DBSCAN
from lmatools.coordinateSystems import GeographicSystem
from lmatools.flashsort.flash_stats import calculate_... | [
"logging.getLogger",
"lmatools.flashsort.flash_stats.calculate_flash_stats",
"numpy.ones",
"numpy.hstack",
"numpy.arange",
"sklearn.cluster.DBSCAN",
"numpy.lib.recfunctions.append_fields",
"numpy.where",
"numpy.asarray",
"numpy.logical_not",
"numpy.argsort",
"numpy.empty_like",
"numpy.vstack... | [((2228, 2267), 'logging.getLogger', 'logging.getLogger', (['"""FlashAutorunLogger"""'], {}), "('FlashAutorunLogger')\n", (2245, 2267), False, 'import logging\n'), ((2801, 2819), 'lmatools.coordinateSystems.GeographicSystem', 'GeographicSystem', ([], {}), '()\n', (2817, 2819), False, 'from lmatools.coordinateSystems im... |
import numpy as np
import quaternion
def from_tqs_to_matrix(translation, quater, scale):
"""
(T(3), Q(4), S(3)) -> 4x4 Matrix
:param translation: 3 dim translation vector (np.array or list)
:param quater: 4 dim rotation quaternion (np.array or list)
:param scale: 3 dim scale vector (np.array or li... | [
"numpy.eye",
"quaternion.as_rotation_matrix",
"numpy.diag",
"numpy.linalg.inv",
"numpy.quaternion"
] | [((379, 436), 'numpy.quaternion', 'np.quaternion', (['quater[0]', 'quater[1]', 'quater[2]', 'quater[3]'], {}), '(quater[0], quater[1], quater[2], quater[3])\n', (392, 436), True, 'import numpy as np\n'), ((445, 454), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (451, 454), True, 'import numpy as np\n'), ((491, 500), ... |
"""Build hypothesis file by applying post-processing rules
to LSTM output
Requires LSTM output
Produces a hypothesis txt file
"""
# +
import sys
# Root folder of main library
sys.path.insert(0, 'library')
# Root folder of EDF files
EDF_ROOT = '/esat/biomeddata/Neureka_challenge/edf/dev/'
# Root folder of prediction... | [
"os.join",
"sys.path.insert",
"pickle.load",
"numpy.max",
"numpy.array",
"spir.merge_events"
] | [((179, 208), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""library"""'], {}), "(0, 'library')\n", (194, 208), False, 'import sys\n'), ((771, 795), 'pickle.load', 'pickle.load', (['filehandler'], {}), '(filehandler)\n', (782, 795), False, 'import pickle\n'), ((1067, 1093), 'spir.merge_events', 'spir.merge_events',... |
import gym
import numpy as np
from gym import error, spaces, utils
from gym.utils import seeding
from gym import Env
from gym.spaces import Discrete, MultiDiscrete, MultiBinary, Box
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
class SYSTEM():
def __init__(self, action_dim, fixed_m... | [
"numpy.ones",
"numpy.random.rand",
"matplotlib.use",
"gym.spaces.Box",
"numpy.array",
"numpy.zeros",
"numpy.matmul",
"numpy.linalg.svd"
] | [((201, 222), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (215, 222), False, 'import matplotlib\n'), ((981, 997), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (995, 997), True, 'import numpy as np\n'), ((1764, 1833), 'gym.spaces.Box', 'Box', ([], {'low': '(-1000)', 'high': '(1000)'... |
"""
.. module:: HarmonicKMeans
HarmonicKMeans
*************
:Description: HarmonicKMeans
"""
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
import numpy as np
from sklearn.base import TransformerMixin, ClusterMixin, BaseEstimator
from sklearn.utils import check_random_state
class HarmonicKMeans(TransformerM... | [
"sklearn.utils.check_random_state",
"numpy.arange",
"sklearn.datasets.make_blobs",
"numpy.sum",
"numpy.dot",
"numpy.zeros",
"numpy.var"
] | [((5663, 5740), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': '(1200)', 'centers': 'centers', 'cluster_std': '(0.3)', 'random_state': '(42)'}), '(n_samples=1200, centers=centers, cluster_std=0.3, random_state=42)\n', (5673, 5740), False, 'from sklearn.datasets import make_blobs\n'), ((2956, 2993), 'sk... |
import numpy as np
from sklearn.decomposition import TruncatedSVD
def rpca(M,lam):
# <NAME> - Oct-2017
# computes rpca separation of M into L and S using the parameter lam
# this uses the alternating directions augmented method of multipliers
# as described in my blog
Nr = M.sh... | [
"numpy.fabs",
"numpy.multiply",
"numpy.zeros",
"numpy.sign",
"numpy.linalg.norm",
"numpy.linalg.svd"
] | [((544, 567), 'numpy.zeros', 'np.zeros', (['(Nr * Nc, Nt)'], {}), '((Nr * Nc, Nt))\n', (552, 567), True, 'import numpy as np\n'), ((1275, 1285), 'numpy.sign', 'np.sign', (['x'], {}), '(x)\n', (1282, 1285), True, 'import numpy as np\n'), ((1341, 1358), 'numpy.multiply', 'np.multiply', (['a', 'b'], {}), '(a, b)\n', (1352... |
# coding: utf-8
""" Classes for accessing simulation data for Sgr-like streams with
different mass progenitors.
"""
from __future__ import division, print_function
__author__ = "adrn <<EMAIL>>"
# Standard library
import os, sys
from random import sample
# Third-party
import numpy as np
import numexpr
import as... | [
"os.path.exists",
"numpy.fabs",
"numpy.log10",
"numpy.ones",
"gary.io.SCFReader",
"os.path.join",
"numpy.sum",
"numpy.array",
"numpy.isnan",
"numexpr.evaluate"
] | [((1304, 1324), 'gary.io.SCFReader', 'SCFReader', (['self.path'], {}), '(self.path)\n', (1313, 1324), False, 'from gary.io import SCFReader\n'), ((1561, 1570), 'numpy.sum', 'np.sum', (['m'], {}), '(m)\n', (1567, 1570), True, 'import numpy as np\n'), ((4736, 4783), 'numexpr.evaluate', 'numexpr.evaluate', (['"""tub==0"""... |
import torch
from numpy.testing import assert_almost_equal
import numpy
from allennlp.common import Params
from allennlp.common.testing.test_case import AllenNlpTestCase
from allennlp.modules.matrix_attention import CosineMatrixAttention
from allennlp.modules.matrix_attention.matrix_attention import MatrixAttention
... | [
"numpy.array",
"allennlp.common.Params",
"torch.FloatTensor",
"allennlp.modules.matrix_attention.CosineMatrixAttention"
] | [((462, 488), 'allennlp.common.Params', 'Params', (["{'type': 'cosine'}"], {}), "({'type': 'cosine'})\n", (468, 488), False, 'from allennlp.common import Params\n'), ((824, 847), 'allennlp.modules.matrix_attention.CosineMatrixAttention', 'CosineMatrixAttention', ([], {}), '()\n', (845, 847), False, 'from allennlp.modul... |
import threading
import cv2
import numpy as np
from utils.misc import color_filter, kill_thread
from screen import Screen
from item import ItemFinder
from config import Config
from template_finder import TemplateFinder
class GraphicDebuggerController:
"""
This class takes care of handling the graphic debugge... | [
"screen.Screen",
"item.ItemFinder",
"cv2.setWindowProperty",
"template_finder.TemplateFinder",
"config.Config",
"utils.misc.color_filter",
"cv2.imshow",
"cv2.putText",
"numpy.zeros",
"cv2.circle",
"cv2.bitwise_or",
"threading.Thread",
"cv2.resize",
"cv2.waitKey",
"utils.misc.kill_thread"... | [((872, 895), 'item.ItemFinder', 'ItemFinder', (['self.config'], {}), '(self.config)\n', (882, 895), False, 'from item import ItemFinder\n'), ((918, 956), 'screen.Screen', 'Screen', (["self.config.general['monitor']"], {}), "(self.config.general['monitor'])\n", (924, 956), False, 'from screen import Screen\n'), ((988, ... |
#!/usr/bin/env python
###########################################################################
##
## The class to handle P3D simulation data in python. An object is created
## that has the run parameters attached with it. The basic usage of the
## class can be done in the following ways.
##
## Example 1:
## > fro... | [
"TurbAn.Analysis.Simulations.pgrad",
"os.path.exists",
"numpy.fromfile",
"numpy.sqrt",
"numpy.reshape",
"TurbAn.Analysis.Simulations.pcurl",
"numpy.size",
"os.path.realpath",
"numpy.linspace",
"TurbAn.Analysis.Simulations.pdiv",
"numpy.loadtxt",
"subprocess.getstatusoutput"
] | [((1982, 2004), 'os.path.realpath', 'realpath', (['shelldirname'], {}), '(shelldirname)\n', (1990, 2004), False, 'from os.path import basename, realpath, exists\n'), ((2744, 2790), 'os.path.exists', 'exists', (["(self.rundir + '/param_' + self.dirname)"], {}), "(self.rundir + '/param_' + self.dirname)\n", (2750, 2790),... |
## imports
import os
import sys
import numpy as np
import cv2
import logging
import imutils
from matplotlib import pyplot as plt
from pathlib import Path
from pylab import array, plot, show, axis, arange, figure, uint8
# setup logger
logger = logging.getLogger(__name__)
# https://www.pyimagesearch.com/2014/08/25/... | [
"logging.getLogger",
"numpy.sqrt",
"pylab.array",
"numpy.array",
"cv2.warpPerspective",
"cv2.threshold",
"cv2.erode",
"numpy.diff",
"cv2.contourArea",
"cv2.minAreaRect",
"numpy.argmin",
"cv2.boxPoints",
"cv2.getPerspectiveTransform",
"numpy.argmax",
"cv2.cvtColor",
"cv2.resize",
"cv2... | [((247, 274), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (264, 274), False, 'import logging\n'), ((666, 699), 'numpy.zeros', 'np.zeros', (['(4, 2)'], {'dtype': '"""float32"""'}), "((4, 2), dtype='float32')\n", (674, 699), True, 'import numpy as np\n'), ((1097, 1117), 'numpy.diff', 'np... |
import tkinter as tk
from PIL import ImageTk, Image
from os import listdir
import cv2
import numpy as np
root=tk.Tk()
root.title("DataX: Team OST, Plastic Part Matching")
#Init database
path=r"C:\Users\tobias.grab\IWK_data\test"
files=listdir(path)
nrOfFiles=len(files)
bf = cv2.BFMatcher()
fast=1
i... | [
"cv2.BFMatcher",
"cv2.AKAZE_create",
"tkinter.Canvas",
"tkinter.Label",
"numpy.load",
"os.listdir",
"cv2.drawMatchesKnn",
"cv2.xfeatures2d.SURF_create",
"tkinter.filedialog.askopenfilename",
"numpy.squeeze",
"cv2.imread",
"tkinter.IntVar",
"PIL.Image.fromarray",
"cv2.KAZE_create",
"cv2.d... | [((119, 126), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (124, 126), True, 'import tkinter as tk\n'), ((250, 263), 'os.listdir', 'listdir', (['path'], {}), '(path)\n', (257, 263), False, 'from os import listdir\n'), ((294, 309), 'cv2.BFMatcher', 'cv2.BFMatcher', ([], {}), '()\n', (307, 309), False, 'import cv2\n'), ((578... |
# The experiment logic and analysis
import copy
import gym
import json
import matplotlib
import multiprocessing as mp
import warnings
import numpy as np
import platform
import pandas as pd
import traceback
from keras import backend as K
from os import path, environ
from rl.util import *
from rl.agent import *
from rl.m... | [
"multiprocessing.cpu_count",
"copy.copy",
"gym.make",
"numpy.divide",
"numpy.mean",
"pandas.DataFrame.from_dict",
"numpy.max",
"platform.system",
"keras.backend.clear_session",
"traceback.print_exc",
"keras.backend.set_session",
"os.path.dirname",
"numpy.transpose",
"warnings.filterwarning... | [((684, 706), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (693, 706), True, 'import numpy as np\n'), ((707, 761), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'module': '"""matplotlib"""'}), "('ignore', module='matplotlib')\n", (730, 761), False, 'import wa... |
import pandas as pd
from datetime import time, timedelta, datetime
import numpy as np
import geopandas as gp
import random
from halo import Halo
from lps.core import samplers, generators
from lps.core.population import Population, Agent, Plan, Activity, Leg
times = {
(7, 10): 0,
(10, 16): 1,
(16, 19): 2
}... | [
"lps.core.samplers.sample_point",
"pandas.read_csv",
"lps.core.samplers.build_journey_time",
"lps.core.samplers.get_approx_distance",
"lps.core.population.Activity",
"numpy.array",
"random.choices",
"datetime.timedelta",
"numpy.arange",
"datetime.datetime",
"datetime.time",
"geopandas.read_fil... | [((1876, 1934), 'pandas.Series', 'pd.Series', (['self.zones.loc[self.zones.london == 1, :].index'], {}), '(self.zones.loc[self.zones.london == 1, :].index)\n', (1885, 1934), True, 'import pandas as pd\n'), ((4806, 4829), 'numpy.array', 'np.array', (['daily_profile'], {}), '(daily_profile)\n', (4814, 4829), True, 'impor... |
#! /usr/bin/env python
"""
Aegean Residual (AeRes) has the following capability:
- convert a catalogue into an image model
- subtract image model from image
- write model and residual files
"""
__author__ = "<NAME>"
import logging
import numpy as np
from astropy.io import fits
from AegeanTools import catalogs, fittin... | [
"numpy.radians",
"logging.getLogger",
"AegeanTools.fitting.elliptical_gaussian",
"numpy.ceil",
"numpy.where",
"AegeanTools.wcs_helpers.WCSHelper.from_header",
"numpy.log",
"numpy.floor",
"AegeanTools.catalogs.load_table",
"numpy.squeeze",
"numpy.zeros",
"numpy.isfinite",
"numpy.cos",
"astr... | [((1026, 1055), 'AegeanTools.catalogs.load_table', 'catalogs.load_table', (['filename'], {}), '(filename)\n', (1045, 1055), False, 'from AegeanTools import catalogs, fitting, wcs_helpers\n'), ((1685, 1721), 'AegeanTools.catalogs.table_to_source_list', 'catalogs.table_to_source_list', (['table'], {}), '(table)\n', (1714... |
import os
import sys
try:
base_directory = os.path.split(sys.executable)[0]
os.environ['PATH'] += ';' + base_directory
import cntk
os.environ['KERAS_BACKEND'] = 'cntk'
except ImportError:
print('CNTK not installed')
import keras
import keras.utils
import keras.datasets
import keras.models
import ... | [
"keras.preprocessing.image.ImageDataGenerator",
"keras.layers.Dense",
"numpy.save",
"numpy.load",
"numpy.reshape",
"matplotlib.pyplot.plot",
"os.path.split",
"keras.applications.VGG16",
"keras.layers.Flatten",
"keras.models.Sequential",
"os.path.isfile",
"matplotlib.pyplot.title",
"keras.lay... | [((542, 573), 'os.path.join', 'os.path.join', (['base_dir', '"""train"""'], {}), "(base_dir, 'train')\n", (554, 573), False, 'import os\n'), ((591, 627), 'os.path.join', 'os.path.join', (['base_dir', '"""validation"""'], {}), "(base_dir, 'validation')\n", (603, 627), False, 'import os\n'), ((639, 669), 'os.path.join', ... |
"""loading training, validation and test data
This script is to load training, validation and test data
"""
import numpy as np
import os
import dicom
from geometry_parameters import GEOMETRY, RECONSTRUCT_PARA
from geometry_parameters import TRAIN_INDEX, VALID_INDEX, TEST_INDEX
from geometry_parameters import NUM_TRA... | [
"numpy.round",
"os.listdir",
"numpy.load",
"dicom.read_file"
] | [((1091, 1116), 'numpy.load', 'np.load', (['train_label_file'], {}), '(train_label_file)\n', (1098, 1116), True, 'import numpy as np\n'), ((1931, 1956), 'numpy.load', 'np.load', (['valid_label_file'], {}), '(valid_label_file)\n', (1938, 1956), True, 'import numpy as np\n'), ((2717, 2741), 'numpy.load', 'np.load', (['te... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 21 15:06:43 2018
@author: Michelle
"""
# -*- coding: utf-8 -*-
"""
Updated on Wed May 23 10:58:10 2018
- adjusted the orientation of the image to column major
- set origin to bottom left
- switched stepx and stepy in grid so the real and imaginary... | [
"matplotlib.pyplot.imshow",
"numpy.multiply",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.suptitle",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1418, 1452), 'numpy.arange', 'np.arange', (['(1)', '(steps * steps + 1)', '(1)'], {}), '(1, steps * steps + 1, 1)\n', (1427, 1452), True, 'import numpy as np\n'), ((2379, 2409), 'matplotlib.pyplot.suptitle', 'plt.suptitle', (['"""Mandelbrot Set"""'], {}), "('Mandelbrot Set')\n", (2391, 2409), True, 'import matplotli... |
from __future__ import annotations
import pickle
import numpy as np
from lightgbm import LGBMRegressor
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import (
ElasticNet,
HuberRegressor,
Lasso,
LinearRegression,
MultiTaskElasticNet,
MultiTaskLasso,
)
from sklearn.... | [
"numpy.clip",
"sklearn.neural_network.MLPRegressor",
"sklearn.ensemble.RandomForestRegressor",
"pickle.dump",
"sklearn.tree.DecisionTreeRegressor",
"sklearn.linear_model.Lasso",
"sklearn.linear_model.ElasticNet",
"sklearn.linear_model.MultiTaskLasso",
"numpy.log",
"sklearn.multioutput.MultiOutputR... | [((1208, 1266), 'sklearn.tree.DecisionTreeRegressor', 'DecisionTreeRegressor', ([], {'max_depth': "config['dt']['max_depth']"}), "(max_depth=config['dt']['max_depth'])\n", (1229, 1266), False, 'from sklearn.tree import DecisionTreeRegressor\n'), ((1287, 1318), 'sklearn.multioutput.MultiOutputRegressor', 'MultiOutputReg... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Test a trained classification model."""
import argparse
import numpy as np
import sys
import torch
from sscls.cor... | [
"sscls.utils.checkpoint.load_checkpoint",
"sscls.utils.metrics.flops_count",
"sys.exit",
"sscls.utils.distributed.scaled_all_reduce",
"argparse.ArgumentParser",
"sscls.datasets.loader.construct_test_loader",
"sscls.core.config.cfg.merge_from_file",
"numpy.random.seed",
"sscls.core.config.cfg.merge_f... | [((700, 723), 'sscls.utils.logging.get_logger', 'lu.get_logger', (['__name__'], {}), '(__name__)\n', (713, 723), True, 'import sscls.utils.logging as lu\n'), ((1525, 1540), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1538, 1540), False, 'import torch\n'), ((789, 863), 'argparse.ArgumentParser', 'argparse.Argum... |
from tensorflow.examples.tutorials.mnist import input_data
from modeler.gaussianAE import GaussianAutoencoderModel
from trainer.tftrainer import TFTrainer
import sklearn.preprocessing as prep
import numpy as np
class GaussianAETrainer(TFTrainer):
def __init__(self):
self.training_epochs = 20
self... | [
"numpy.random.normal",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"sklearn.preprocessing.StandardScaler",
"modeler.gaussianAE.GaussianAutoencoderModel"
] | [((456, 509), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data"""'], {'one_hot': '(True)'}), "('MNIST_data', one_hot=True)\n", (481, 509), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((734, 760), 'modeler.gaussianAE.GaussianAutoen... |
import numpy as np
import scipy.misc
import time
import h5py
def make_generator(hdf5_file, n_images, batch_size, res, res_slack=2, label_name=None):
epoch_count = [1]
def get_epoch():
images = np.zeros((batch_size, 3, res, res), dtype='int32')
labels = np.zeros(batch_size, dtype='int32')
... | [
"h5py.File",
"numpy.zeros",
"time.time",
"numpy.amax",
"numpy.random.RandomState"
] | [((1486, 1511), 'h5py.File', 'h5py.File', (['data_file', '"""r"""'], {}), "(data_file, 'r')\n", (1495, 1511), False, 'import h5py\n'), ((2080, 2091), 'time.time', 'time.time', ([], {}), '()\n', (2089, 2091), False, 'import time\n'), ((210, 260), 'numpy.zeros', 'np.zeros', (['(batch_size, 3, res, res)'], {'dtype': '"""i... |
# -*- coding: utf-8 -*-
"""FFT functions.
This module contains FFT functions that support centered operation.
"""
import numpy as np
from sigpy import backend, config, interp, util
if config.cupy_enabled:
import cupy as cp
__all__ = ['fft', 'ifft', 'nufft', 'nufft_adjoint', 'estimate_shape']
def fft(input, o... | [
"numpy.i0",
"sigpy.util._normalize_axes",
"sigpy.interp.gridding",
"numpy.issubdtype",
"sigpy.backend.get_device",
"sigpy.util.resize",
"sigpy.interp.interpolate",
"sigpy.backend.to_device",
"numpy.arange"
] | [((799, 824), 'sigpy.backend.get_device', 'backend.get_device', (['input'], {}), '(input)\n', (817, 824), False, 'from sigpy import backend, config, interp, util\n'), ((1806, 1831), 'sigpy.backend.get_device', 'backend.get_device', (['input'], {}), '(input)\n', (1824, 1831), False, 'from sigpy import backend, config, i... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"os.path.exists",
"sys.platform.startswith",
"os.path.abspath",
"numpy.sum",
"os.path.sep.join",
"paddle.to_tensor",
"paddle.dot",
"site.getsitepackages",
"numpy.random.uniform",
"unittest.main",
"os.system",
"paddle.set_device"
] | [((2921, 2936), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2934, 2936), False, 'import unittest\n'), ((1044, 1058), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (1053, 1058), False, 'import os\n'), ((1787, 1852), 'os.path.sep.join', 'os.path.sep.join', (["[paddle_lib_path, '..', '..', 'paddle-plugins']... |
# coding:utf-8
# Test for upsample_2d
# Created : 7, 5, 2018
# Revised : 7, 5, 2018
# All rights reserved
#------------------------------------------------------------------------------------------------
__author__ = 'dawei.leng'
import os, sys
os.environ['THEANO_FLAGS'] = "floatX=float32, mode=FAST_RUN, warn... | [
"numpy.abs",
"lasagne_ext.utils.get_layer_by_name",
"theano.function",
"numpy.random.rand",
"lasagne.layers.InputLayer",
"os.path.split",
"lasagne.layers.get_output",
"numpy.random.randint",
"theano.tensor.ftensor4",
"lasagne.layers.Upscale2DLayer",
"dandelion.functional.upsample_2d"
] | [((577, 610), 'os.path.split', 'os.path.split', (['dandelion.__file__'], {}), '(dandelion.__file__)\n', (590, 610), False, 'import os, sys\n'), ((1124, 1144), 'theano.tensor.ftensor4', 'tensor.ftensor4', (['"""x"""'], {}), "('x')\n", (1139, 1144), False, 'from theano import tensor\n'), ((1174, 1252), 'lasagne.layers.In... |
# -*- coding: utf-8 -*-
from .derivest import derivest
import numpy as np
def directional_diff(fun, x, d, par = None, normalize = True, **kwargs):
"""
Estimate the directional derivative of a function of n variables.
Uses the derivest method to provide both a directional derivative
and an error e... | [
"numpy.array",
"numpy.zeros_like",
"numpy.sum"
] | [((2724, 2753), 'numpy.array', 'np.array', (['d'], {'dtype': 'np.float64'}), '(d, dtype=np.float64)\n', (2732, 2753), True, 'import numpy as np\n'), ((2651, 2662), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (2659, 2662), True, 'import numpy as np\n'), ((3022, 3038), 'numpy.zeros_like', 'np.zeros_like', (['d'], {}... |
"""
Created on February 28, 2020
@author: <NAME>
Implementation of vignette_filter function in the pymagine package.
"""
import numpy as np
import cv2
def vignette_filter(
image_path,
strength=1.0,
x=0.5,
y=0.5,
file_name="vignette.jpg"):
"""
Applies vignette filter to... | [
"cv2.getGaussianKernel",
"numpy.copy",
"cv2.imwrite",
"cv2.imread"
] | [((1923, 1948), 'cv2.imread', 'cv2.imread', (['image_path', '(1)'], {}), '(image_path, 1)\n', (1933, 1948), False, 'import cv2\n'), ((2661, 2675), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (2668, 2675), True, 'import numpy as np\n'), ((2978, 3016), 'cv2.imwrite', 'cv2.imwrite', (['file_name', 'image_modifi... |
import csv
import os
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
from path import Path
from vector_math import *
from find_matches import *
from file_paths import *
#********************
#**** this function reads a CSV file and returns a header, and a list that has been converted to fl... | [
"numpy.amax",
"numpy.amin",
"csv.writer",
"matplotlib.pyplot.plot",
"path.Path",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"time.time",
"csv.reader"
] | [((439, 459), 'csv.reader', 'csv.reader', (['fileopen'], {}), '(fileopen)\n', (449, 459), False, 'import csv\n'), ((1189, 1200), 'time.time', 'time.time', ([], {}), '()\n', (1198, 1200), False, 'import time\n'), ((7903, 7924), 'csv.writer', 'csv.writer', (['final_out'], {}), '(final_out)\n', (7913, 7924), False, 'impor... |
import pytest
# import unittest
import numpy as np
import femnurbs.SplineUsefulFunctions as SUF
def test_isValidU():
with pytest.raises(TypeError):
SUF.isValidU()
assert SUF.isValidU(0) is False
assert SUF.isValidU(1.2) is False
assert SUF.isValidU({}) is False
assert SUF.isV... | [
"numpy.eye",
"femnurbs.SplineUsefulFunctions.getNfromU",
"femnurbs.SplineUsefulFunctions.transformHtoSides",
"numpy.ones",
"femnurbs.SplineUsefulFunctions.transformUtoH",
"femnurbs.SplineUsefulFunctions.isDiagonalDominant",
"femnurbs.SplineUsefulFunctions.isValidU",
"femnurbs.SplineUsefulFunctions.URa... | [((1399, 1421), 'numpy.array', 'np.array', (['[0, 0, 1, 1]'], {}), '([0, 0, 1, 1])\n', (1407, 1421), True, 'import numpy as np\n'), ((1435, 1451), 'femnurbs.SplineUsefulFunctions.UBezier', 'SUF.UBezier', ([], {'p': '(1)'}), '(p=1)\n', (1446, 1451), True, 'import femnurbs.SplineUsefulFunctions as SUF\n'), ((1457, 1501),... |
import numpy as np
import matplotlib.pyplot as plt
from read_file import select_original_breakpoints
def plot_ave_curve(slopes, intervals, filename, color):
all_curve_descr = []
for curve in slopes:
curve_descr = np.zeros(N - 1)
for i in range(N - 1):
if curve[i] > curve[i + 1]:
... | [
"numpy.radians",
"numpy.mean",
"matplotlib.pyplot.savefig",
"numpy.unique",
"matplotlib.pyplot.ylabel",
"read_file.select_original_breakpoints",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.argsort",
"matplotlib.pyplot.figure",
"numpy.zeros",
"matplotlib.pyplot.tight_layout",
... | [((416, 470), 'numpy.unique', 'np.unique', (['all_curve_descr'], {'return_counts': '(True)', 'axis': '(0)'}), '(all_curve_descr, return_counts=True, axis=0)\n', (425, 470), True, 'import numpy as np\n'), ((482, 495), 'numpy.argsort', 'np.argsort', (['B'], {}), '(B)\n', (492, 495), True, 'import numpy as np\n'), ((647, ... |
# Importing the required packages
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
from catboost import CatBoostClassifier
import statistic... | [
"statistics.mean",
"numpy.copy",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"numpy.delete",
"sklearn.metrics.classification_report",
"numpy.array",
"numpy.concatenate",
"catboost.CatBoostClassifier",
"sklearn.metrics.accuracy_score",
"numpy.random.shuffle"
] | [((389, 556), 'pandas.read_csv', 'pd.read_csv', (["('https://raw.githubusercontent.com/ssfaruque/HD_Computing/master/chemometrics/datasets/DTreeSets/'\n + 'DNA_inLiquidDNA.csv')"], {'sep': '""","""', 'header': 'None'}), "(\n 'https://raw.githubusercontent.com/ssfaruque/HD_Computing/master/chemometrics/datasets/D... |
"""__init__
License: BSD 3-Clause License
Copyright (C) 2021, New York University
Copyright note valid unless otherwise stated in individual files.
All rights reserved.
"""
import numpy as np
class SimHead:
def __init__(self, robot, vicon_name='', with_sliders=True, joint_index=None,
measurement... | [
"numpy.zeros",
"numpy.zeros_like",
"numpy.diag"
] | [((843, 855), 'numpy.zeros', 'np.zeros', (['nj'], {}), '(nj)\n', (851, 855), True, 'import numpy as np\n'), ((896, 908), 'numpy.zeros', 'np.zeros', (['nj'], {}), '(nj)\n', (904, 908), True, 'import numpy as np\n'), ((1448, 1460), 'numpy.zeros', 'np.zeros', (['nj'], {}), '(nj)\n', (1456, 1460), True, 'import numpy as np... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 16 12:56:17 2021
@author: Luigi
"""
import numpy as np
import scipy as sci
import sympy as sym
import matplotlib.pyplot as plt
def Lagrange(xnodi, i):
if i == 0:
xzeri = xnodi[1:]
else:
xzeri = np.append(xnodi[:i], xnodi[i + 1 :])
... | [
"numpy.abs",
"numpy.poly",
"numpy.sqrt",
"numpy.arange",
"numpy.append",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"numpy.polyval",
"numpy.dot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((1163, 1183), 'numpy.linspace', 'np.linspace', (['a', 'b', '(4)'], {}), '(a, b, 4)\n', (1174, 1183), True, 'import numpy as np\n'), ((1190, 1212), 'numpy.linspace', 'np.linspace', (['a', 'b', '(100)'], {}), '(a, b, 100)\n', (1201, 1212), True, 'import numpy as np\n'), ((1291, 1365), 'matplotlib.pyplot.legend', 'plt.l... |
from django.http import JsonResponse, HttpResponse
from django.views import View
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
import json
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from re... | [
"json.loads",
"django.http.JsonResponse",
"django.http.HttpResponse",
"numpy.asarray",
"numpy.expand_dims"
] | [((1634, 1657), 'json.loads', 'json.loads', (['byte_string'], {}), '(byte_string)\n', (1644, 1657), False, 'import json\n'), ((1900, 1916), 'numpy.asarray', 'np.asarray', (['body'], {}), '(body)\n', (1910, 1916), True, 'import numpy as np\n'), ((1931, 1958), 'numpy.expand_dims', 'np.expand_dims', (['arr'], {'axis': '(0... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>, 2021
"""
def load_binary(path, dtype="<f"):
import numpy as np
with open(path, "rb") as file:
# specify little endian float: dtype="<f"
dat = np.fromfile(file, dtype=dtype)
return dat
def write_binary(dataArray, path):
with open(path, "wb"... | [
"numpy.clip",
"numpy.fromfile",
"scipy.interpolate.RegularGridInterpolator",
"numpy.flipud",
"numpy.fliplr",
"matplotlib.colors.to_hex",
"numpy.max",
"numpy.rot90",
"numpy.min",
"imageio.imread",
"numpy.arange"
] | [((659, 681), 'numpy.arange', 'np.arange', (['im.shape[0]'], {}), '(im.shape[0])\n', (668, 681), True, 'import numpy as np\n'), ((690, 712), 'numpy.arange', 'np.arange', (['im.shape[1]'], {}), '(im.shape[1])\n', (699, 712), True, 'import numpy as np\n'), ((783, 818), 'scipy.interpolate.RegularGridInterpolator', 'Regula... |
#!/usr/bin/env python -W ignore::DeprecationWarning
# -*- coding: utf-8 -*-
"""Adenine analyzer module."""
######################################################################
# Copyright (C) 2016 <NAME>, <NAME>, <NAME>
#
# FreeBSD License
######################################################################
import... | [
"sklearn.metrics.homogeneity_score",
"adenine.utils.scores.confusion_matrix",
"adenine.core.plotting.eigs",
"multiprocessing.Process",
"sklearn.metrics.adjusted_rand_score",
"adenine.utils.extra.title_from_filename",
"sklearn.metrics.completeness_score",
"adenine.core.plotting.silhouette",
"logging.... | [((372, 393), 'matplotlib.use', 'matplotlib.use', (['"""AGG"""'], {}), "('AGG')\n", (386, 393), False, 'import matplotlib\n'), ((3961, 3998), 'logging.info', 'logging.info', (['"""Dumped : %s"""', 'filename'], {}), "('Dumped : %s', filename)\n", (3973, 3998), False, 'import logging\n'), ((4631, 4644), 'os.walk', 'os.wa... |
from numba import jit
import numpy as np
import cProfile
import timeit
def L1distances(a,b):
n = len(a)
m = len(b)
distance = [[] for _ in range(n)]
for i in range(0, n):
for j in range(0, m):
distance[i].append(0)
containsNaN = False
for i in range(n):
if a[i] == 'nan' or b[j] == 'nan':
containsNaN ... | [
"cProfile.run",
"numpy.sin",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.cos",
"timeit.timeit"
] | [((1470, 1481), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1478, 1481), True, 'import numpy as np\n'), ((1488, 1499), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1496, 1499), True, 'import numpy as np\n'), ((1501, 1549), 'cProfile.run', 'cProfile.run', (['"""L1distances(x,y)"""'], {'sort': '"""tottime"""'}... |
import os
import glob
import errno
import random
import urllib.request as urllib
import numpy as np
from scipy.io import loadmat
class CWRU:
def __init__(self, exp, rpm, length):
if exp not in ('12DriveEndFault', '12FanEndFault', '48DriveEndFault'):
print("wrong experiment name: {}".format(ex... | [
"os.path.exists",
"urllib.request.URLopener",
"os.makedirs",
"random.Random",
"scipy.io.loadmat",
"os.path.join",
"os.getcwd",
"os.path.dirname",
"numpy.zeros",
"os.path.isdir",
"numpy.vstack",
"os.path.expanduser"
] | [((529, 540), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (538, 540), False, 'import os\n'), ((1724, 1750), 'numpy.zeros', 'np.zeros', (['(0, self.length)'], {}), '((0, self.length))\n', (1732, 1750), True, 'import numpy as np\n'), ((1773, 1799), 'numpy.zeros', 'np.zeros', (['(0, self.length)'], {}), '((0, self.length)... |
import cv2
import numpy as np
writer = cv2.VideoWriter("output.avi",
cv2.VideoWriter_fourcc(*"MJPG"), 30,(220,220))
image = np.random.randint(0, 255, (220,220,3)).astype('uint8')
for frame in range(1000):
writer.write(image)
writer.release() | [
"numpy.random.randint",
"cv2.VideoWriter_fourcc"
] | [((69, 100), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'MJPG'"], {}), "(*'MJPG')\n", (91, 100), False, 'import cv2\n'), ((124, 164), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(220, 220, 3)'], {}), '(0, 255, (220, 220, 3))\n', (141, 164), True, 'import numpy as np\n')] |
import numpy as np
import os
import pandas as pd
import pickle
def get_user_avg_ratings(user_item_mat):
"""
Given one user-item matrix, calculate the average rating a user has given.
Input:
- user_item_mat: file containing a dataframe, with rows indicating users
columns indicating items, each valu... | [
"os.path.dirname",
"numpy.array"
] | [((878, 903), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (893, 903), False, 'import os\n'), ((1810, 1830), 'numpy.array', 'np.array', (['index_list'], {}), '(index_list)\n', (1818, 1830), True, 'import numpy as np\n'), ((2082, 2107), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}... |
# -*- coding: utf-8 -*-
"""
NoveltyHainsworth
computes the novelty measure used by Hainsworth
Args:
X: spectrogram (dimension FFTLength X Observations)
f_s: sample rate
Returns:
d_hai novelty measure
"""
import numpy as np
def NoveltyHainsworth(X, f_s):
epsilon = 1e-5
# ... | [
"numpy.sum",
"numpy.sqrt",
"numpy.arange"
] | [((533, 555), 'numpy.sum', 'np.sum', (['afDiff'], {'axis': '(0)'}), '(afDiff, axis=0)\n', (539, 555), True, 'import numpy as np\n'), ((386, 396), 'numpy.sqrt', 'np.sqrt', (['X'], {}), '(X)\n', (393, 396), True, 'import numpy as np\n'), ((448, 472), 'numpy.arange', 'np.arange', (['(1)', 'X.shape[1]'], {}), '(1, X.shape[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.