code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#!/usr/bin/env python
"""Check Identity class"""
from matplotlib import pyplot as plt
import numpy as N
from load import ROOT as R
from matplotlib.ticker import MaxNLocator
from gna import constructors as C
from gna.bindings import DataType
from gna.unittest import *
from gna import context
#
# Create the matrix
#
d... | [
"argparse.ArgumentParser",
"numpy.allclose",
"gna.constructors.Points",
"gna.env.env.globalns",
"load.ROOT.Identity",
"numpy.arange",
"gna.constructors.Dummy",
"gna.context.manager"
] | [((551, 564), 'gna.constructors.Points', 'C.Points', (['mat'], {}), '(mat)\n', (559, 564), True, 'from gna import constructors as C\n'), ((580, 592), 'load.ROOT.Identity', 'R.Identity', ([], {}), '()\n', (590, 592), True, 'from load import ROOT as R\n'), ((829, 849), 'numpy.allclose', 'N.allclose', (['mat', 'res'], {})... |
"""
Combines predictions based on votes by a set of answer files.
"""
import re
from os import listdir
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
from sklearn.metrics import accuracy_score
from .consta... | [
"numpy.load",
"numpy.abs",
"numpy.argmax",
"pandas.read_csv",
"sklearn.metrics.accuracy_score",
"numpy.isclose",
"numpy.mean",
"pandas.set_option",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"matplotlib.ticker.FormatStrFormatter",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.s... | [((463, 486), 'numpy.argmax', 'np.argmax', (['conf'], {'axis': '(0)'}), '(conf, axis=0)\n', (472, 486), True, 'import numpy as np\n'), ((566, 613), 'sklearn.metrics.accuracy_score', 'accuracy_score', ([], {'y_true': 'y_true', 'y_pred': 'conf_vote'}), '(y_true=y_true, y_pred=conf_vote)\n', (580, 613), False, 'from sklea... |
# Databricks notebook source
import numpy as np
import pandas as pd
from scipy import stats
# COMMAND ----------
# Simulate original ice cream dataset
df = pd.DataFrame()
df['temperature'] = np.random.uniform(60, 80, 1000)
df['number_of_cones_sold'] = np.random.uniform(0, 20, 1000)
flavors = ["Vanilla"] * 300 + ['... | [
"pandas.DataFrame",
"numpy.random.uniform",
"numpy.random.normal",
"numpy.random.shuffle"
] | [((160, 174), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (172, 174), True, 'import pandas as pd\n'), ((195, 226), 'numpy.random.uniform', 'np.random.uniform', (['(60)', '(80)', '(1000)'], {}), '(60, 80, 1000)\n', (212, 226), True, 'import numpy as np\n'), ((256, 286), 'numpy.random.uniform', 'np.random.unifo... |
from __future__ import division
__author__ = '<NAME>'
import numpy as np
from scipy.stats import norm
import string
import bottleneck as bn
import math
# paa tranformation, window = incoming data, string_length = length of outcoming data
class sax():
def process(self, window, output_length, sax_vocab):
sa... | [
"numpy.divide",
"scipy.stats.norm",
"numpy.mean",
"numpy.array",
"numpy.where",
"numpy.linspace",
"numpy.array_split",
"numpy.sqrt"
] | [((661, 675), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (669, 675), True, 'import numpy as np\n'), ((804, 839), 'numpy.array_split', 'np.array_split', (['data', 'string_length'], {}), '(data, string_length)\n', (818, 839), True, 'import numpy as np\n'), ((2446, 2485), 'scipy.stats.norm', 'norm', (['data', ... |
import numpy as np
from astropy.table import Table
import glob
models = ['MIST_v1.2_feh_m4.00_afe_p0.0_vvcrit0.0_EEPS',
'MIST_v1.2_feh_m4.00_afe_p0.0_vvcrit0.4_EEPS',
'MIST_v1.2_feh_p0.00_afe_p0.0_vvcrit0.0_EEPS',
'MIST_v1.2... | [
"astropy.table.Table",
"numpy.loadtxt",
"glob.glob"
] | [((820, 827), 'astropy.table.Table', 'Table', ([], {}), '()\n', (825, 827), False, 'from astropy.table import Table\n'), ((640, 667), 'glob.glob', 'glob.glob', (["(model + '/*.txt')"], {}), "(model + '/*.txt')\n", (649, 667), False, 'import glob\n'), ((684, 700), 'numpy.loadtxt', 'np.loadtxt', (['file'], {}), '(file)\n... |
import json
import csv
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import itertools
import os
import shutil
def get_dtype_groups(data_types):
float_unis = []
object_unis = []
int_unis = []
for i, v in data_types.items():
if i == np.dtype('float... | [
"os.makedirs",
"matplotlib.pyplot.axes",
"os.path.isdir",
"itertools.permutations",
"numpy.dtype",
"os.path.exists",
"pandas.unique",
"matplotlib.pyplot.figure",
"seaborn.color_palette",
"shutil.rmtree",
"matplotlib.pyplot.subplots"
] | [((933, 953), 'os.makedirs', 'os.makedirs', (['dirpath'], {}), '(dirpath)\n', (944, 953), False, 'import os\n'), ((1107, 1119), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1117, 1119), True, 'import matplotlib.pyplot as plt\n'), ((1129, 1154), 'matplotlib.pyplot.axes', 'plt.axes', ([], {'projection': '... |
import numpy as np
from deepen.activation import relu, relu_backward, sigmoid, sigmoid_backward
def initialize_params(layer_dims):
"""Create and initialize the params of an L-layer neural network.
Parameters
----------
layer_dims : list or tuple of int
The number of neurons in each layer of th... | [
"numpy.divide",
"deepen.activation.relu",
"numpy.sum",
"numpy.log",
"numpy.random.randn",
"numpy.zeros",
"deepen.activation.sigmoid",
"numpy.squeeze",
"numpy.dot",
"deepen.activation.relu_backward",
"deepen.activation.sigmoid_backward",
"numpy.sqrt"
] | [((4728, 4744), 'numpy.squeeze', 'np.squeeze', (['cost'], {}), '(cost)\n', (4738, 4744), True, 'import numpy as np\n'), ((5651, 5666), 'numpy.dot', 'np.dot', (['W.T', 'dZ'], {}), '(W.T, dZ)\n', (5657, 5666), True, 'import numpy as np\n'), ((877, 905), 'numpy.zeros', 'np.zeros', (['(layer_dims[l], 1)'], {}), '((layer_di... |
import matplotlib.pyplot as plt
import numpy as np
import random
from collections import namedtuple
def plot_winsratio(
wins: list,
title: str,
start_idx: int = 0,
wsize_mean: int = 100,
wsize_means_mean: int = 1000,
opponent_update_idxs=None,
):
"""Winrate plotting function, plots both a ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.plot",
"random.sample",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.cumsum",
"collections.namedtuple",
"matplotlib.pyplot.savefig"
] | [((2784, 2852), 'collections.namedtuple', 'namedtuple', (['"""Transition"""', "('ob', 'action', 'next_ob', 'rew', 'done')"], {}), "('Transition', ('ob', 'action', 'next_ob', 'rew', 'done'))\n", (2794, 2852), False, 'from collections import namedtuple\n'), ((1078, 1106), 'numpy.cumsum', 'np.cumsum', (['wins'], {'dtype':... |
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.lines import Line2D
import matplotlib.ticker as ticker
def movingAverage(x, window):
ret = np.zeros_like(x)
for i in range(len(x)):
idx1 = max(0, i - (window - 1) // 2)
idx2 = min(len(x), i + (window - 1) // 2 + (2 - (window % 2)))
... | [
"numpy.zeros_like",
"matplotlib.pyplot.show",
"numpy.mean",
"numpy.array",
"matplotlib.ticker.FormatStrFormatter",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((168, 184), 'numpy.zeros_like', 'np.zeros_like', (['x'], {}), '(x)\n', (181, 184), True, 'import numpy as np\n'), ((458, 481), 'numpy.mean', 'np.mean', (['x[min_idx:idx]'], {}), '(x[min_idx:idx])\n', (465, 481), True, 'import numpy as np\n'), ((527, 541), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n'... |
# SPDX-License-Identifier: Apache-2.0
"""
Tests scikit-normalizer converter.
"""
import unittest
import numpy
from sklearn.preprocessing import Normalizer
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import (
Int64TensorType, FloatTensorType, DoubleTensorType)
from test_utils import dump_da... | [
"unittest.main",
"skl2onnx.common.data_types.DoubleTensorType",
"skl2onnx.common.data_types.Int64TensorType",
"skl2onnx.common.data_types.FloatTensorType",
"numpy.array",
"sklearn.preprocessing.Normalizer"
] | [((4006, 4021), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4019, 4021), False, 'import unittest\n'), ((459, 480), 'sklearn.preprocessing.Normalizer', 'Normalizer', ([], {'norm': '"""l2"""'}), "(norm='l2')\n", (469, 480), False, 'from sklearn.preprocessing import Normalizer\n'), ((824, 845), 'sklearn.preproces... |
import numpy as np
from flask import Flask, session,abort,request, jsonify, render_template,redirect,url_for,flash
import pickle
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from keras.models import load_model
import os
import stripe
... | [
"keras.models.load_model",
"flask.request.form.values",
"flask.Flask",
"numpy.array",
"flask.render_template"
] | [((610, 625), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (615, 625), False, 'from flask import Flask, session, abort, request, jsonify, render_template, redirect, url_for, flash\n'), ((670, 699), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (685, 699), Fal... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('/home/jordibisbal/WS18-MSc-JordiBisbalAnsaldo--NetworkSlicing/evaluation/experiments/1/forks/forks_pow.csv')
x = np.arange(0.0, 100, 1)
data = df[['T1', 'T2','T3','T4', 'T5','T6','T7', 'T8','T9','T10', 'T11','T12','T13', 'T14',... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"numpy.sqrt",
"numpy.arange",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.grid"
] | [((78, 209), 'pandas.read_csv', 'pd.read_csv', (['"""/home/jordibisbal/WS18-MSc-JordiBisbalAnsaldo--NetworkSlicing/evaluation/experiments/1/forks/forks_pow.csv"""'], {}), "(\n '/home/jordibisbal/WS18-MSc-JordiBisbalAnsaldo--NetworkSlicing/evaluation/experiments/1/forks/forks_pow.csv'\n )\n", (89, 209), True, 'imp... |
import collections
import math
import numpy as np
import mlpy
class TermFrequencyAnalyzer(object):
def __init__(self, *documents):
self.idf = self.compute_idf(*documents)
def compute_idf(self, *documents):
# document frequency
df = collections.defaultdict(int)
for tokens in d... | [
"collections.defaultdict",
"numpy.zeros",
"mlpy.lcs_std"
] | [((268, 296), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (291, 296), False, 'import collections\n'), ((1437, 1455), 'mlpy.lcs_std', 'mlpy.lcs_std', (['a', 'b'], {}), '(a, b)\n', (1449, 1455), False, 'import mlpy\n'), ((1660, 1680), 'numpy.zeros', 'np.zeros', (['(2, N + 1)'], {}), '(... |
import os, glob, sys
from turbo_seti.find_event.plot_dat import plot_dat
from turbo_seti import find_event as find
import numpy as np
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--dir', default=os.getcwd())
parser.add_argument('--minHit', type=float, default=None... | [
"os.mkdir",
"turbo_seti.find_event.read_dat",
"argparse.ArgumentParser",
"os.getcwd",
"os.path.exists",
"glob.glob",
"numpy.round",
"turbo_seti.find_event.plot_dat.plot_dat"
] | [((180, 205), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (203, 205), False, 'import argparse\n'), ((453, 478), 'glob.glob', 'glob.glob', (["(path + '*.dat')"], {}), "(path + '*.dat')\n", (462, 478), False, 'import os, glob, sys\n'), ((1166, 1186), 'numpy.round', 'np.round', (['min_hit', '(2... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `marble` package."""
import unittest
import marble
import numpy as np
import sympl as sp
test_era5_filename = '/home/twine/data/era5/era5-interp-2016.nc'
def get_test_state(pc_value=0.):
n_features = marble.components.marble.name_feature_counts
st... | [
"unittest.main",
"marble.DiagnosticPrincipalComponentsToHeight",
"numpy.allclose",
"sympl.timedelta",
"numpy.ones",
"marble.InputPrincipalComponentsToHeight",
"marble.InputHeightToPrincipalComponents"
] | [((3497, 3512), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3510, 3512), False, 'import unittest\n'), ((344, 359), 'sympl.timedelta', 'sp.timedelta', (['(0)'], {}), '(0)\n', (356, 359), True, 'import sympl as sp\n'), ((2010, 2051), 'marble.InputPrincipalComponentsToHeight', 'marble.InputPrincipalComponentsToHe... |
### Figure 5 C and E - Obenhaus et al.
# Figure S6 A, C, E and F - Obenhaus et al.
#
# NN distance analysis
# Pairwise distance analysis
#
import sys, os
import os.path
import numpy as np
import pandas as pd
import datajoint as dj
import cmasher as cmr
from tabulate import tabulate
import itertools
# Make plot... | [
"pandas.DataFrame",
"helpers_topography.notebooks.pairw_distances.plot_pairw_nn_summary",
"numpy.std",
"helpers_topography.notebooks.pairw_distances.norm_pairw_nn_df",
"os.path.dirname",
"dj_plotter.helpers.plotting_helpers.make_linear_colormap",
"numpy.nanmean",
"seaborn.set",
"general.print_wilcox... | [((352, 374), 'seaborn.set', 'sns.set', ([], {'style': '"""white"""'}), "(style='white')\n", (359, 374), True, 'import seaborn as sns\n'), ((2598, 2676), 'dj_plotter.helpers.plotting_helpers.make_linear_colormap', 'make_linear_colormap', (['pairw_df.animal_name'], {'categorical': '(True)', 'cmap': '"""cmr.guppy"""'}), ... |
import base64
import json
import os
import zlib
from urllib.request import urlretrieve
import boto3
import mrcnn.model as modellib
import numpy as np
import pandas as pd
import skimage.io
from mrcnn import utils
from mrcnn.config import Config
from superai.meta_ai import BaseModel
s3 = boto3.client("s3")
_MODEL_PAT... | [
"os.listdir",
"mrcnn.utils.download_trained_weights",
"json.loads",
"boto3.client",
"os.getcwd",
"os.path.exists",
"pandas.read_json",
"zlib.compress",
"urllib.request.urlretrieve",
"numpy.where",
"base64.b64encode",
"os.path.join",
"numpy.delete"
] | [((290, 308), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (302, 308), False, 'import boto3\n'), ((324, 381), 'os.path.join', 'os.path.join', (['"""sagify_base/local_test/test_dir/"""', '"""model"""'], {}), "('sagify_base/local_test/test_dir/', 'model')\n", (336, 381), False, 'import os\n'), ((3886, ... |
import tkinter as tk
from tkinter import filedialog
from tkinter import *
from PIL import ImageTk, Image
import numpy as np
import cv2
#load the trained model to classify sign
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.models i... | [
"PIL.ImageTk.PhotoImage",
"tensorflow.keras.models.load_model",
"tensorflow.keras.applications.inception_v3.preprocess_input",
"numpy.argmax",
"tensorflow.keras.applications.inception_v3.InceptionV3",
"tensorflow.keras.preprocessing.image.img_to_array",
"numpy.expand_dims",
"tkinter.filedialog.askopen... | [((533, 606), 'tensorflow.keras.applications.inception_v3.InceptionV3', 'InceptionV3', ([], {'weights': '"""inception_v3_weights_tf_dim_ordering_tf_kernels.h5"""'}), "(weights='inception_v3_weights_tf_dim_ordering_tf_kernels.h5')\n", (544, 606), False, 'from tensorflow.keras.applications.inception_v3 import InceptionV3... |
import pandas as pd
import argparse
import os
import mdtraj
import numpy as np
parser = argparse.ArgumentParser(description='Script to generate trajectories containing only top scoring frames as scored by RWPlus. These top scoring trajectories can then be averaged with Gromacs to produce an averaged structure.')
pars... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"numpy.array",
"numpy.arange",
"os.path.join",
"os.listdir"
] | [((90, 325), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script to generate trajectories containing only top scoring frames as scored by RWPlus. These top scoring trajectories can then be averaged with Gromacs to produce an averaged structure."""'}), "(description=\n 'Script to gen... |
"""
{This script reads in the raw chain and plots times series for all parameters
in order to identify the burn-in}
"""
# Libs
from cosmo_utils.utils import work_paths as cwpaths
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib
import pandas as pd
import numpy as np
import math
import os
_... | [
"matplotlib.pyplot.title",
"matplotlib.rc",
"numpy.abs",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"numpy.isnan",
"numpy.histogram",
"numpy.mean",
"numpy.exp",
"cosmo_utils.utils.work_paths.cookiecutter_paths",
"numpy.round",
"numpy.unique",
"pandas.DataFrame",
"pandas.read_hdf",
"nump... | [((344, 420), 'matplotlib.rc', 'rc', (['"""font"""'], {'size': '(20)'}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Helvetica']}, size=20)\n", (346, 420), False, 'from matplotlib import rc\n'), ((416, 439), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (418, 439), F... |
import numpy as np
import matplotlib.pyplot as plt
def plot_tsp(parameters, rank):
rank = np.concatenate([rank, rank[0:1]], axis=0)
plt.figure()
plt.plot(parameters[:, 0], parameters[:, 1], 'ro', color='red')
plt.plot(parameters[:, 0][rank], parameters[:, 1][rank], 'r-', color='blue')
plt.show()
| [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.concatenate"
] | [((96, 137), 'numpy.concatenate', 'np.concatenate', (['[rank, rank[0:1]]'], {'axis': '(0)'}), '([rank, rank[0:1]], axis=0)\n', (110, 137), True, 'import numpy as np\n'), ((143, 155), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (153, 155), True, 'import matplotlib.pyplot as plt\n'), ((160, 223), 'matplot... |
"""build_test_dataset.py -- The functions to build simulated data sets.
"""
import pickle
import numpy as np
from scipy import stats
# import matplotlib.pyplot as plt
# import corner
DATA_NAME = 'simple' # default
DATA_NAME = '3_gaus'
MB_HOST = 'indirect' # default
MB_HOST = 'step' # todo implement this
M... | [
"numpy.random.dirichlet",
"numpy.random.triangular",
"numpy.random.seed",
"numpy.abs",
"numpy.random.randn",
"numpy.random.exponential",
"numpy.expand_dims",
"numpy.ones",
"numpy.append",
"numpy.diag",
"numpy.concatenate"
] | [((340, 364), 'numpy.random.seed', 'np.random.seed', (['(13048293)'], {}), '(13048293)\n', (354, 364), True, 'import numpy as np\n'), ((644, 682), 'numpy.concatenate', 'np.concatenate', (['(mass_young, mass_old)'], {}), '((mass_young, mass_old))\n', (658, 682), True, 'import numpy as np\n'), ((1011, 1040), 'numpy.appen... |
"""Run model ensemble
The canonical form of `job run` is:
job run [OPTIONS] -- EXECUTABLE [OPTIONS]
where `EXECUTABLE` is your model executable or a command, followed by its
arguments. Note the `--` that separates `job run` arguments `OPTIONS` from the
executable. When there is no ambiguity in the command-line ... | [
"argparse.ArgumentParser",
"numpy.empty",
"runner.param.MultiParam",
"runner.xrun.XParams.read",
"runner.job.config.program",
"runner.job.config.ParserIO",
"numpy.arange",
"runner.job.model.interface.get",
"os.path.join",
"runner.xrun.XRun"
] | [((2929, 2968), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (2952, 2968), False, 'import argparse\n'), ((4063, 4102), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (4086, 4102), False, 'import arg... |
import os
import h5py
import torch
import numpy as np
import scipy
import json
class CorresPondenceNet(torch.utils.data.Dataset):
def __init__(self, cfg, flag='train'):
super().__init__()
with open(os.path.join(cfg['data_path'], 'name2id.json'), 'r') as f:
self.name2id = json.load(f)
... | [
"h5py.File",
"json.load",
"numpy.array",
"os.path.join",
"torch.tensor"
] | [((306, 318), 'json.load', 'json.load', (['f'], {}), '(f)\n', (315, 318), False, 'import json\n'), ((2186, 2232), 'numpy.array', 'np.array', (['self.keypoints[item]'], {'dtype': 'np.int32'}), '(self.keypoints[item], dtype=np.int32)\n', (2194, 2232), True, 'import numpy as np\n'), ((219, 265), 'os.path.join', 'os.path.j... |
import os
import time
import torch
import random
import numpy as np
from tqdm import tqdm
import torch.nn as nn
from util import epoch_time
import torch.optim as optim
from model.neural_network import RandomlyWiredNeuralNetwork
from data.data_util import fetch_dataloader, test_voc, test_imagenet
SEED = 981126
random... | [
"util.epoch_time",
"tqdm.tqdm",
"numpy.random.seed",
"torch.manual_seed",
"data.data_util.fetch_dataloader",
"model.neural_network.RandomlyWiredNeuralNetwork",
"torch.cuda.manual_seed",
"torch.nn.CrossEntropyLoss",
"time.perf_counter",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"data.data_uti... | [((314, 331), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (325, 331), False, 'import random\n'), ((332, 352), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (346, 352), True, 'import numpy as np\n'), ((353, 376), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (37... |
import trimesh
import numpy as np
import cv2
import copy
import pickle
import torch
import pdb
def depth2normal(depth, f_pix_x, f_pix_y=None):
'''
To compute a normal map from the depth map
Input:
- depth: torch.Tensor (H, W)
- f_pix_x: K[0, 0]
- f_pix_y: K[1, 1]
Return:
- normal: t... | [
"torch.ones_like",
"copy.deepcopy",
"trimesh.sample.sample_surface",
"pickle.dump",
"torch.norm",
"torch.cat",
"pickle.load",
"torch.zeros",
"mathutils.Matrix",
"numpy.concatenate",
"torch.from_numpy"
] | [((1268, 1298), 'torch.norm', 'torch.norm', (['normal'], {'p': '(2)', 'dim': '(2)'}), '(normal, p=2, dim=2)\n', (1278, 1298), False, 'import torch\n'), ((2244, 2276), 'torch.cat', 'torch.cat', (['[R, T[:, :, None]]', '(2)'], {}), '([R, T[:, :, None]], 2)\n', (2253, 2276), False, 'import torch\n'), ((2607, 2616), 'mathu... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2020 by ShabaniPy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT license.
#
# The full license is in the file LICENCE, distributed with this software.
# ----------------... | [
"numpy.testing.assert_almost_equal",
"shabanipy.jj.fraunhofer.estimation.guess_current_distribution",
"numpy.empty_like",
"numpy.ones",
"numpy.sinc",
"numpy.array",
"numpy.linspace",
"numpy.cos"
] | [((556, 580), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(1001)'], {}), '(-1, 1, 1001)\n', (567, 580), True, 'import numpy as np\n'), ((676, 700), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(1001)'], {}), '(-1, 1, 1001)\n', (687, 700), True, 'import numpy as np\n'), ((885, 928), 'numpy.testing.assert_al... |
"""
Author :
<NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
from keras import backend as K
from tqdm.keras import TqdmCallback
from scipy.stats import spearmanr
from tensorflow.keras import Input
from tensorflow.keras import optimizers
from tensorflow.keras import models
from t... | [
"keras.models.load_model",
"numpy.load",
"numpy.abs",
"argparse.ArgumentParser",
"tensorflow.keras.layers.Dense",
"random.shuffle",
"tensorflow.keras.models.Sequential",
"tensorflow.keras.layers.Flatten",
"os.path.exists",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.optimizers.Adam",... | [((1330, 1362), 'tensorflow.keras.backend.clear_session', 'tf.keras.backend.clear_session', ([], {}), '()\n', (1360, 1362), True, 'import tensorflow as tf\n'), ((1559, 1579), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (1573, 1579), False, 'import random\n'), ((3628, 3647), 'tensorflow.keras.models.... |
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
try:
import sionna
except ImportError as e:
import sys
sys.path.append("../")
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
print('Number ... | [
"numpy.load",
"numpy.array_equal",
"sionna.fec.polar.utils.generate_5g_ranking",
"numpy.allclose",
"tensorflow.reshape",
"tensorflow.zeros_like",
"numpy.ones",
"numpy.isnan",
"sionna.fec.polar.decoding.Polar5GDecoder",
"numpy.arange",
"numpy.exp",
"sionna.fec.polar.decoding.PolarSCLDecoder",
... | [((267, 305), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (298, 305), True, 'import tensorflow as tf\n'), ((9161, 9228), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore: Required ressource allocation"""'], {}), "('ignore: Requi... |
from scipy.integrate import odeint
from scipy.optimize import fsolve
import numpy as np
import itertools
import matplotlib.pyplot as plt
from colorlines import colorline
from matplotlib import style
class PhaseDiagram:
def __init__(self, system):
self.system = system
self.fig, self.a... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"scipy.integrate.odeint",
"numpy.zeros",
"scipy.optimize.fsolve",
"numpy.isclose",
"numpy.linspace",
"itertools.product",
"matplotlib.pyplot.subplots",
"colorlines.colorline"
] | [((2448, 2475), 'numpy.linspace', 'np.linspace', (['(0.1)', '(2.5)', '(1000)'], {}), '(0.1, 2.5, 1000)\n', (2459, 2475), True, 'import numpy as np\n'), ((2227, 2244), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2)'}), '(shape=2)\n', (2235, 2244), True, 'import numpy as np\n'), ((324, 342), 'matplotlib.pyplot.subplots',... |
import torch
import torch.nn as nn
from torchvision import models
import numpy as np
from torch.autograd import Variable
import os
class Model:
def __init__(self, key = 'abnormal'):
self.INPUT_DIM = 224
self.MAX_PIXEL_VAL = 255
self.MEAN = 58.09
self.STDDEV = 49.73
self.mode... | [
"numpy.stack",
"torch.nn.AdaptiveAvgPool2d",
"numpy.load",
"torch.autograd.Variable",
"torch.load",
"torchvision.models.alexnet",
"torch.FloatTensor",
"torch.cat",
"torch.squeeze",
"torch.sigmoid",
"numpy.min",
"torch.max",
"numpy.max",
"torch.nn.Linear"
] | [((1031, 1062), 'numpy.stack', 'np.stack', (['((series,) * 3)'], {'axis': '(1)'}), '((series,) * 3, axis=1)\n', (1039, 1062), True, 'import numpy as np\n'), ((1084, 1109), 'torch.FloatTensor', 'torch.FloatTensor', (['series'], {}), '(series)\n', (1101, 1109), False, 'import torch\n'), ((1220, 1239), 'numpy.load', 'np.l... |
from scipy import optimize
import matplotlib.pyplot as plt
import numpy as np
x = np.array([1, 1.1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13, 14, 15], dtype=float)
y = np.array([5, 3, 7, 9, 11, 13, 15, 28.92, 42.81, 56.7, 70.59,
84.47, 98.36, 112.25, 126.14, 140.03])
# 一个输入序列,4个未知参数,2个分段函数
d... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.square",
"numpy.zeros",
"numpy.array",
"numpy.linspace",
"numpy.piecewise"
] | [((87, 166), 'numpy.array', 'np.array', (['[1, 1.1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]'], {'dtype': 'float'}), '([1, 1.1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], dtype=float)\n', (95, 166), True, 'import numpy as np\n'), ((172, 276), 'numpy.array', 'np.array', (['[5, 3, 7, 9, 11, 13, 15, 28.92, 42... |
# %%
"""
<NAME> любит французские багеты. Длина французского
багета равна 1 метру. За один заглот <NAME> заглатывает
кусок случайной длины равномерно распределенной на отрезке
[0; 1]. Для того, чтобы съесть весь багет удаву потребуется случайное
количество N заглотов.
Оцените P(N=2), P(N=3), E(N)
"""
# %%
import nump... | [
"pandas.DataFrame",
"numpy.mean",
"random.randint",
"random.uniform"
] | [((381, 398), 'random.uniform', 'uniform', ([], {'a': '(0)', 'b': '(1)'}), '(a=0, b=1)\n', (388, 398), False, 'from random import uniform\n'), ((795, 814), 'numpy.mean', 'np.mean', (['udaff_life'], {}), '(udaff_life)\n', (802, 814), True, 'import numpy as np\n'), ((1218, 1235), 'random.randint', 'randint', ([], {'a': '... |
import pandas as pd
import numpy as np
from matplotlib.collections import PatchCollection, LineCollection
from descartes.patch import PolygonPatch
try:
import geopandas # noqa: F401
except ImportError:
HAS_GEOPANDAS = False
else:
HAS_GEOPANDAS = True
from ..doctools import document
from ..exceptions impo... | [
"matplotlib.collections.LineCollection",
"descartes.patch.PolygonPatch",
"numpy.array",
"matplotlib.collections.PatchCollection",
"pandas.concat",
"numpy.all"
] | [((1860, 1913), 'numpy.array', 'np.array', (["[(g is not None) for g in data['geometry']]"], {}), "([(g is not None) for g in data['geometry']])\n", (1868, 1913), True, 'import numpy as np\n'), ((2741, 2774), 'pandas.concat', 'pd.concat', (['[data, bounds]'], {'axis': '(1)'}), '([data, bounds], axis=1)\n', (2750, 2774)... |
# Copyright 2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.random.seed",
"sklearn.model_selection.KFold",
"logging.info",
"random.seed",
"numpy.array",
"sklearn.model_selection.StratifiedKFold",
"numpy.unique"
] | [((854, 920), 'logging.info', 'logging.info', (['"""[DATALOADER]: Initializing Spectrometer Dataloader"""'], {}), "('[DATALOADER]: Initializing Spectrometer Dataloader')\n", (866, 920), False, 'import logging\n'), ((1192, 1243), 'logging.info', 'logging.info', (['"""[DATALOADER]: Loading Dataset Files"""'], {}), "('[DA... |
#!/home/roberto/anaconda3/envs/tensorflow/bin/python
# Copyright 2022 <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 requ... | [
"os.getcwd",
"utils.label_map_util.create_category_index",
"utils.label_map_util.load_labelmap",
"tensorflow.GraphDef",
"tensorflow.Session",
"numpy.expand_dims",
"utils.label_map_util.convert_label_map_to_categories",
"cv2.VideoCapture",
"tensorflow.ConfigProto",
"numpy.where",
"tensorflow.gfil... | [((996, 1034), 'multiprocessing.Process.__init__', 'multiprocessing.Process.__init__', (['self'], {}), '(self)\n', (1028, 1034), False, 'import multiprocessing\n'), ((1340, 1351), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1349, 1351), False, 'import os\n'), ((1375, 1443), 'os.path.join', 'os.path.join', (['cwd_path'... |
import objax
from jax import vmap, grad, jacrev
import jax.numpy as np
from jax.scipy.linalg import cholesky, cho_factor
from .utils import inv, solve, gaussian_first_derivative_wrt_mean, gaussian_second_derivative_wrt_mean
from numpy.polynomial.hermite import hermgauss
import numpy as onp
import itertools
class Cuba... | [
"numpy.polynomial.hermite.hermgauss",
"jax.numpy.atleast_2d",
"numpy.ones",
"jax.numpy.squeeze",
"itertools.product",
"jax.numpy.diag",
"jax.numpy.sum",
"jax.vmap",
"jax.numpy.maximum",
"jax.scipy.linalg.cho_factor",
"numpy.concatenate",
"numpy.block",
"jax.jacrev",
"jax.scipy.linalg.chole... | [((2062, 2074), 'numpy.polynomial.hermite.hermgauss', 'hermgauss', (['H'], {}), '(H)\n', (2071, 2074), False, 'from numpy.polynomial.hermite import hermgauss\n'), ((2977, 2998), 'numpy.sqrt', 'onp.sqrt', (['(dim + kappa)'], {}), '(dim + kappa)\n', (2985, 2998), True, 'import numpy as onp\n'), ((4231, 4248), 'numpy.sqrt... |
from RandomGenerator.randomInt import randomInt
from numpy import random
def randomIntSeed (start, end, seed):
state = random.get_state()
random.seed(seed)
try:
randIntSeeded = randomInt(start, end)
return randIntSeeded
finally:
random.set_state(state)
| [
"numpy.random.get_state",
"numpy.random.seed",
"RandomGenerator.randomInt.randomInt",
"numpy.random.set_state"
] | [((124, 142), 'numpy.random.get_state', 'random.get_state', ([], {}), '()\n', (140, 142), False, 'from numpy import random\n'), ((147, 164), 'numpy.random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (158, 164), False, 'from numpy import random\n'), ((198, 219), 'RandomGenerator.randomInt.randomInt', 'randomInt', ... |
from numpy import random, pi
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
Ntrials, Nhits = 1_000_000, 0
for n in range(Ntrials):
x, y, z = random.uniform(-1, 1, 3) # draw 2 samples, each uniformly distributed over (-1,1)
if x**2 + y**2 + z**2 < 1:
Nhits += 1
print("Monte Car... | [
"numpy.random.uniform"
] | [((171, 195), 'numpy.random.uniform', 'random.uniform', (['(-1)', '(1)', '(3)'], {}), '(-1, 1, 3)\n', (185, 195), False, 'from numpy import random, pi\n')] |
# Author: <NAME>
# License: BSD
import warnings
from nilearn.input_data import NiftiMasker
warnings.filterwarnings("ignore", category=DeprecationWarning)
import os
from os.path import expanduser, join
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from joblib import Memory, dump
from jobli... | [
"sklearn.utils.check_random_state",
"modl.decomposition.fmri.fMRIDictFact",
"sklearn.model_selection.train_test_split",
"numpy.argmin",
"matplotlib.pyplot.figure",
"modl.plotting.fmri.display_maps",
"os.path.join",
"os.path.exists",
"nilearn.datasets.fetch_atlas_smith_2009",
"nilearn.input_data.Ni... | [((93, 155), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (116, 155), False, 'import warnings\n'), ((1015, 1040), 'modl.datasets.fetch_adhd', 'fetch_adhd', ([], {'n_subjects': '(40)'}), '(n_subjects=40)\n', (10... |
"""
stateinterpreter
Interpretation of metastable states from MD simulations
"""
import sys
from setuptools import setup, find_packages, Extension
import versioneer
import numpy
os_name = sys.platform
compile_args = ["-O3", "-ffast-math", "-march=native", "-fopenmp" ]
libraries = ["m"]
link_args = ['-fopenmp']
if os_... | [
"versioneer.get_version",
"Cython.Build.cythonize",
"versioneer.get_cmdclass",
"numpy.get_include",
"setuptools.find_packages"
] | [((1487, 1509), 'Cython.Build.cythonize', 'cythonize', (['ext_modules'], {}), '(ext_modules)\n', (1496, 1509), False, 'from Cython.Build import cythonize\n'), ((1809, 1833), 'versioneer.get_version', 'versioneer.get_version', ([], {}), '()\n', (1831, 1833), False, 'import versioneer\n'), ((1848, 1873), 'versioneer.get_... |
# Here we provide the key functions for tile-coding. To avoid huge dimensionality expansion, we have tiled
# per feature variable, but using feature-column cross functionality a pair of feature-variables
# also can be tiled, and also higher orders.
from typing import List
import numpy as np
import tensorflow as tf
fr... | [
"tensorflow.python.ops.math_ops.bucketize",
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.cast",
"numpy.array"
] | [((652, 672), 'numpy.array', 'np.array', (['boundaries'], {}), '(boundaries)\n', (660, 672), True, 'import numpy as np\n'), ((1062, 1093), 'tensorflow.cast', 'tf.cast', (['input_data', 'tf.float64'], {}), '(input_data, tf.float64)\n', (1069, 1093), True, 'import tensorflow as tf\n'), ((1452, 1480), 'tensorflow.concat',... |
import tensorflow as tf
import numpy as np
import src.utils as utils
"""
Implementation of InfoVAE
https://arxiv.org/abs/1706.02262
"""
def reparameterise(x, n, stddev):
"""
Model each output as bing guassian distributed.
Use the reparameterisation trick so we can sample while remaining
differentiable... | [
"tensorflow.reshape",
"tensorflow.zeros_like",
"tensorflow.keras.Sequential",
"numpy.round",
"numpy.pad",
"tensorflow.cast",
"tensorflow.keras.layers.Activation",
"tensorflow.exp",
"numpy.reshape",
"tensorflow.gradients",
"tensorflow.name_scope",
"tensorflow.norm",
"tensorflow.layers.flatten... | [((1473, 1495), 'tensorflow.norm', 'tf.norm', (['(x - y)'], {'axis': '(1)'}), '(x - y, axis=1)\n', (1480, 1495), True, 'import tensorflow as tf\n'), ((1630, 1650), 'tensorflow.layers.flatten', 'tf.layers.flatten', (['z'], {}), '(z)\n', (1647, 1650), True, 'import tensorflow as tf\n'), ((6352, 6379), 'tensorflow.enable_... |
#!/usr/bin/env python3
import argparse
def parse_args():
p = argparse.ArgumentParser()
p.add_argument('path', type=str)
p.add_argument('-m', '--minpow', type=int, default=3)
p.add_argument('-M', '--maxpow', type=int, default=7)
p.add_argument('-s', '--step', type=int, default=2)
p.add_argument... | [
"speedfuncs3d.speed_funcs",
"common3d.time_marcher",
"h5py.File",
"argparse.ArgumentParser",
"common3d.get_marcher_name",
"numpy.logspace",
"sys.path.insert",
"speedfuncs3d.get_soln_func",
"itertools.product",
"numpy.round",
"common3d.compute_soln",
"speedfuncs3d.get_speed_func_name",
"speed... | [((67, 92), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (90, 92), False, 'import argparse\n'), ((694, 735), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../build/Release"""'], {}), "(0, '../../build/Release')\n", (709, 735), False, 'import sys\n'), ((1395, 1461), 'numpy.logspace', '... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 19 18:03:59 2016
@author: jones_000
"""
import copy as cp
import numpy as np
import math
import Solver
import Physics
import Body
import vector
import matplotlib.pyplot as plt
class Simulation(object):
'''Parent Simulation class
Attributes
----------
... | [
"matplotlib.pyplot.title",
"Solver.RK2",
"copy.deepcopy",
"math.sqrt",
"matplotlib.pyplot.plot",
"math.floor",
"Physics.NBody",
"matplotlib.pyplot.figure",
"Body.GravBody",
"numpy.array",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.ylabel",
"vector.Vector",
"numpy.arccos",
"numpy.sqrt... | [((4569, 4654), 'math.sqrt', 'math.sqrt', (['(self.G * M2 ** 3.0 / (a1 * (M1 + M2) ** 2.0) * ((1.0 + e) / (1.0 - e)))'], {}), '(self.G * M2 ** 3.0 / (a1 * (M1 + M2) ** 2.0) * ((1.0 + e) / (1.0 -\n e)))\n', (4578, 4654), False, 'import math\n'), ((4671, 4699), 'vector.Vector', 'vector.Vector', (['r1p', '(0.0)', '(0.0... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch.utils.data as data
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import os
import time
import argparse
import numpy as np
from PIL import Ima... | [
"utils.augmentations.to_chw_bgr",
"argparse.ArgumentParser",
"torch.set_default_tensor_type",
"torch.cat",
"cv2.rectangle",
"os.path.join",
"torch.load",
"os.path.exists",
"torch.Tensor",
"cv2.resize",
"importlib.import_module",
"os.path.basename",
"torch.cuda.is_available",
"os.listdir",
... | [((543, 601), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""face detection demo"""'}), "(description='face detection demo')\n", (566, 601), False, 'import argparse\n'), ((1751, 1776), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1774, 1776), False, 'import to... |
from glob import glob
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import argparse
"""
This is a reproduction of Fernando's 2011 normalized commit rate plot. This
shows roughly the bus factor
"""
parser = argparse.ArgumentParser()
parser.add_argument("--outname", "-o")
args = parse... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"os.path.dirname",
"numpy.arange",
"glob.glob",
"matplotlib.pyplot.subplots",
"numpy.unique"
] | [((243, 268), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (266, 268), False, 'import argparse\n'), ((372, 407), 'glob.glob', 'glob', (['"""data/raw_data/*/commits.tsv"""'], {}), "('data/raw_data/*/commits.tsv')\n", (376, 407), False, 'from glob import glob\n'), ((436, 450), 'matplotlib.pyplo... |
import numpy
import pytest
from grunnur import dtypes
from grunnur.modules import render_with_modules
def test_normalize_type():
dtype = dtypes.normalize_type(numpy.int32)
assert dtype == numpy.int32
assert type(dtype) == numpy.dtype
def test_ctype_builtin():
assert dtypes.ctype(numpy.int32) == 'in... | [
"numpy.uint64",
"grunnur.dtypes.is_double",
"numpy.empty",
"grunnur.dtypes.is_complex",
"grunnur.dtypes.detect_type",
"grunnur.dtypes._align",
"grunnur.dtypes._find_minimum_alignment",
"numpy.arange",
"grunnur.dtypes.align",
"numpy.float64",
"numpy.complex64",
"numpy.int8",
"grunnur.dtypes.c... | [((144, 178), 'grunnur.dtypes.normalize_type', 'dtypes.normalize_type', (['numpy.int32'], {}), '(numpy.int32)\n', (165, 178), False, 'from grunnur import dtypes\n'), ((359, 393), 'grunnur.dtypes.is_complex', 'dtypes.is_complex', (['numpy.complex64'], {}), '(numpy.complex64)\n', (376, 393), False, 'from grunnur import d... |
# AUTOGENERATED! DO NOT EDIT! File to edit: dev/52_USB_camera.ipynb (unless otherwise specified).
__all__ = ['Camera']
# Cell
from FLIRCam.core import *
# Cell
# Standard imports:
from pathlib import Path
import logging
from logging.handlers import RotatingFileHandler
from time import sleep, time as timestamp
from ... | [
"PySpin.System.GetInstance",
"logging.StreamHandler",
"numpy.flipud",
"logging.Formatter",
"datetime.datetime.utcnow",
"pathlib.Path",
"numpy.fliplr",
"threading.Event",
"numpy.rot90",
"weakref.ref",
"logging.handlers.RotatingFileHandler",
"logging.getLogger"
] | [((3110, 3138), 'logging.getLogger', 'logging.getLogger', (['f"""{name}"""'], {}), "(f'{name}')\n", (3127, 3138), False, 'import logging\n'), ((5060, 5067), 'threading.Event', 'Event', ([], {}), '()\n', (5065, 5067), False, 'from threading import Thread, Event\n'), ((11271, 11281), 'pathlib.Path', 'Path', (['path'], {}... |
import sys
from pathlib import Path
from argparse import ArgumentParser
import h5py
import pandas as pd
import numpy as np
from tqdm import tqdm
from export import export_read_file
def get_args():
parser = ArgumentParser(description="Parse sequencing_summary.txt files and .paf files to find split reads "
... | [
"pandas.DataFrame",
"export.export_read_file",
"tqdm.tqdm",
"h5py.File",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.floor",
"pandas.concat",
"sys.exit"
] | [((214, 369), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Parse sequencing_summary.txt files and .paf files to find split reads in an Oxford Nanopore Dataset"""', 'add_help': '(False)'}), "(description=\n 'Parse sequencing_summary.txt files and .paf files to find split reads in an Oxford Na... |
from autumn.projects.covid_19.vaccine_optimisation.vaccine_opti import (
get_decision_vars_names,
initialise_opti_object,
)
import numpy as np
import yaml
COUNTRY = "malaysia" # should use "malaysia" or "philippines"
def run_sample_code():
# Initialisation of the optimisation object. This needs to be r... | [
"numpy.random.uniform",
"yaml.load",
"autumn.projects.covid_19.vaccine_optimisation.vaccine_opti.initialise_opti_object",
"autumn.projects.covid_19.vaccine_optimisation.vaccine_opti.get_decision_vars_names",
"yaml.dump"
] | [((365, 396), 'autumn.projects.covid_19.vaccine_optimisation.vaccine_opti.initialise_opti_object', 'initialise_opti_object', (['COUNTRY'], {}), '(COUNTRY)\n', (387, 396), False, 'from autumn.projects.covid_19.vaccine_optimisation.vaccine_opti import get_decision_vars_names, initialise_opti_object\n'), ((2009, 2040), 'a... |
import numpy as np
import os
from astropy.time import Time
from pandas import DataFrame
from orbitize.kepler import calc_orbit
from orbitize import read_input, system, sampler
def test_secondary_rv_lnlike_calc():
"""
Generates fake secondary RV data and asserts that
the log(likelihood) of the true paramet... | [
"pandas.DataFrame",
"orbitize.kepler.calc_orbit",
"orbitize.read_input.read_file",
"os.system",
"orbitize.system.System",
"numpy.array",
"orbitize.sampler.MCMC",
"numpy.all",
"numpy.sqrt"
] | [((628, 679), 'numpy.array', 'np.array', (['[a, e, i, omega, Omega, tau, plx, m1, m0]'], {}), '([a, e, i, omega, Omega, tau, plx, m1, m0])\n', (636, 679), True, 'import numpy as np\n'), ((778, 856), 'orbitize.kepler.calc_orbit', 'calc_orbit', (['epochs', 'a', 'e', 'i', 'omega', 'Omega', 'tau', 'plx', '(m0 + m1)'], {'ma... |
import tensorflow as tf
import numpy as np
def get_infos2Laplace_1D(input_dim=1, out_dim=1, intervalL=0.0, intervalR=1.0, equa_name=None):
# -uxx = f
if equa_name == 'PDE1':
# u=sin(pi*x), f=-pi*pi*sin(pi*x)
fside = lambda x: -(np.pi)*(np.pi)*tf.sin(np.pi*x)
utrue = lambda x: ... | [
"tensorflow.sin",
"numpy.square",
"tensorflow.pow",
"tensorflow.ones_like",
"tensorflow.exp",
"tensorflow.square"
] | [((320, 337), 'tensorflow.sin', 'tf.sin', (['(np.pi * x)'], {}), '(np.pi * x)\n', (326, 337), True, 'import tensorflow as tf\n'), ((363, 388), 'tensorflow.sin', 'tf.sin', (['(np.pi * intervalL)'], {}), '(np.pi * intervalL)\n', (369, 388), True, 'import tensorflow as tf\n'), ((415, 440), 'tensorflow.sin', 'tf.sin', (['(... |
import modelexp
from modelexp.experiments import Generic
from modelexp.models.Generic import Parabola
import numpy as np
import random
app = modelexp.App()
app.setExperiment(Generic)
modelRef = app.setModel(Parabola)
modelRef.defineDomain(np.linspace(-3, 3, 100))
modelRef.setParam('a', 1.3)
modelRef.setParam('x0', 0... | [
"modelexp.App",
"random.gauss",
"numpy.array",
"numpy.linspace"
] | [((142, 156), 'modelexp.App', 'modelexp.App', ([], {}), '()\n', (154, 156), False, 'import modelexp\n'), ((536, 558), 'numpy.array', 'np.array', (['randomized_y'], {}), '(randomized_y)\n', (544, 558), True, 'import numpy as np\n'), ((242, 265), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', '(100)'], {}), '(-3, 3, 1... |
import tensorflow as tf
import numpy as np
import os
SCRIPT_PATH = os.path.abspath(__file__)
SCRIPT_DIR = os.path.dirname(SCRIPT_PATH)
MODEL_PATH = os.path.join(SCRIPT_DIR, "model/model.h5")
MODEL = None
INPUT_SIZE = 7 * 12
OUTPUT_SIZE = 1
def _load_model():
"""
Load the TensorFlow model if it is not loaded... | [
"os.path.abspath",
"tensorflow.keras.models.load_model",
"numpy.log",
"os.path.dirname",
"numpy.array",
"numpy.exp",
"os.path.join"
] | [((68, 93), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (83, 93), False, 'import os\n'), ((107, 135), 'os.path.dirname', 'os.path.dirname', (['SCRIPT_PATH'], {}), '(SCRIPT_PATH)\n', (122, 135), False, 'import os\n'), ((149, 191), 'os.path.join', 'os.path.join', (['SCRIPT_DIR', '"""model/mo... |
"""
ModelFit.py
Author: <NAME>
Affiliation: University of Colorado at Boulder
Created on: Mon May 12 14:01:29 MDT 2014
Description:
"""
import signal
import numpy as np
from ..util.PrintInfo import print_fit
from ..util.Pickling import write_pickle_file
from ..physics.Constants import nu_0_mhz
import gc, os, sys,... | [
"numpy.zeros_like",
"numpy.log",
"numpy.isnan",
"numpy.array",
"numpy.interp",
"re.search"
] | [((1966, 1982), 'numpy.array', 'np.array', (['(nu + T)'], {}), '(nu + T)\n', (1974, 1982), True, 'import numpy as np\n'), ((2066, 2126), 'numpy.interp', 'np.interp', (['self.xdata', "sim.history['nu']", "sim.history['dTb']"], {}), "(self.xdata, sim.history['nu'], sim.history['dTb'])\n", (2075, 2126), True, 'import nump... |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
#! [auto_compilation]
import openvino.runtime as ov
compiled_model = ov.compile_model("model.xml")
#! [auto_compilation]
#! [properties_example]
core = ov.Core()
input_a = ov.opset8.parameter([8])
res = ov.opset8.a... | [
"openvino.runtime.opset8.parameter",
"openvino.runtime.Core",
"numpy.array_equal",
"openvino.runtime.opset8.absolute",
"openvino.runtime.Model",
"openvino.runtime.opset8.add",
"numpy.ones",
"numpy.expand_dims",
"openvino.runtime.AsyncInferQueue",
"openvino.runtime.compile_model",
"cv2.imread",
... | [((173, 202), 'openvino.runtime.compile_model', 'ov.compile_model', (['"""model.xml"""'], {}), "('model.xml')\n", (189, 202), True, 'import openvino.runtime as ov\n'), ((257, 266), 'openvino.runtime.Core', 'ov.Core', ([], {}), '()\n', (264, 266), True, 'import openvino.runtime as ov\n'), ((278, 302), 'openvino.runtime.... |
# <NAME> 2014-2020
# mlxtend Machine Learning Library Extensions
#
# Nonparametric Permutation Test
# Author: <NAME> <<EMAIL>>
#
# License: BSD 3 clause
import numpy as np
from itertools import combinations
from math import factorial
try:
from nose.tools import nottest
except ImportError:
# Use a no-op decorat... | [
"numpy.mean",
"math.factorial",
"numpy.random.RandomState",
"numpy.hstack"
] | [((3160, 3187), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (3181, 3187), True, 'import numpy as np\n'), ((3230, 3247), 'numpy.hstack', 'np.hstack', (['(x, y)'], {}), '((x, y))\n', (3239, 3247), True, 'import numpy as np\n'), ((4453, 4469), 'math.factorial', 'factorial', (['(m + n)'... |
# OLD USAGE
# python align_faces.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/example_01.jpg
# import the necessary packages
from imutils.face_utils import FaceAligner
from PIL import Image
import numpy as np
# import argparse
import imutils
import dlib
import cv2
# construct the argument... | [
"cv2.cvtColor",
"PIL.Image.open",
"PIL.Image.fromarray",
"numpy.array",
"dlib.get_frontal_face_detector",
"imutils.resize",
"dlib.shape_predictor",
"imutils.face_utils.FaceAligner"
] | [((836, 868), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (866, 868), False, 'import dlib\n'), ((881, 942), 'dlib.shape_predictor', 'dlib.shape_predictor', (['"""shape_predictor_68_face_landmarks.dat"""'], {}), "('shape_predictor_68_face_landmarks.dat')\n", (901, 942), False, '... |
from styx_msgs.msg import TrafficLight
import cv2
import numpy as np
class TLClassifier(object):
def __init__(self):
pass
def get_classification(self, image):
"""Determines the color of the traffic light in the image
Args:
image (cv::Mat): image containing the traffic ligh... | [
"cv2.cvtColor",
"cv2.countNonZero",
"numpy.array",
"cv2.medianBlur"
] | [((453, 477), 'cv2.medianBlur', 'cv2.medianBlur', (['image', '(3)'], {}), '(image, 3)\n', (467, 477), False, 'import cv2\n'), ((495, 536), 'cv2.cvtColor', 'cv2.cvtColor', (['img_blur', 'cv2.COLOR_BGR2HSV'], {}), '(img_blur, cv2.COLOR_BGR2HSV)\n', (507, 536), False, 'import cv2\n'), ((586, 619), 'numpy.array', 'np.array... |
"""
Script to compute dci score of learned representation.
"""
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import numpy as np
from absl import flags, app
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from disentanglement_lib.eva... | [
"numpy.load",
"sklearn.preprocessing.StandardScaler",
"numpy.sum",
"numpy.invert",
"sklearn.model_selection.train_test_split",
"numpy.ones",
"numpy.arange",
"absl.flags.DEFINE_list",
"os.path.join",
"warnings.simplefilter",
"disentanglement_lib.visualize.visualize_scores.heat_square",
"absl.fl... | [((79, 141), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (100, 141), False, 'import warnings\n'), ((438, 509), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""c_path"""', '""""""', '"""File path ... |
import numpy as np
import math as math
import cv2
def get_ideal_low_pass_filter( shape, cutoff,width):
[h, w] = shape
mask_image = np.zeros((h, w))
for i in range(h):
for j in range(w):
distance = math.sqrt((i - (h / 2)) * (i - (h / 2)) + (j - (w / 2)) * (j - (w / 2)))
if... | [
"numpy.fft.ifftshift",
"numpy.absolute",
"math.exp",
"math.sqrt",
"numpy.zeros",
"numpy.shape",
"numpy.min",
"numpy.max",
"numpy.fft.fftshift",
"numpy.fft.fft2",
"numpy.fft.ifft2"
] | [((143, 159), 'numpy.zeros', 'np.zeros', (['(h, w)'], {}), '((h, w))\n', (151, 159), True, 'import numpy as np\n'), ((747, 763), 'numpy.zeros', 'np.zeros', (['(h, w)'], {}), '((h, w))\n', (755, 763), True, 'import numpy as np\n'), ((1395, 1411), 'numpy.zeros', 'np.zeros', (['(h, w)'], {}), '((h, w))\n', (1403, 1411), T... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by <NAME> at 2019-09-02
"""Step_simulate.py
:description : script
:param :
:returns:
:rtype:
"""
import os
import cobra
import matplotlib.pyplot as plt
import numpy as np
os.chdir('../../ComplementaryData/Step_03_Compare_Refine/')
print('----- loading model... | [
"matplotlib.pyplot.show",
"numpy.arange",
"brewer2mpl.get_map",
"cobra.io.load_json_model",
"matplotlib.pyplot.subplots",
"os.chdir"
] | [((234, 293), 'os.chdir', 'os.chdir', (['"""../../ComplementaryData/Step_03_Compare_Refine/"""'], {}), "('../../ComplementaryData/Step_03_Compare_Refine/')\n", (242, 293), False, 'import os\n'), ((338, 394), 'cobra.io.load_json_model', 'cobra.io.load_json_model', (['"""../../ModelFiles/iHL622.json"""'], {}), "('../../M... |
import miniml
import numpy as np
# Adapted from:
# https://lucidar.me/en/neural-networks/curve-fitting-nonlinear-regression/
# init data
np.random.seed(3)
X = np.linspace(-10, 10, num=1000)
Y = 0.1*X*np.cos(X) + 0.1*np.random.normal(size=1000)
X = X.reshape((len(X), 1))
Y = Y.reshape((len(Y), 1))
# create model
mod... | [
"miniml.Model",
"numpy.random.seed",
"miniml.plot_costs",
"miniml.plot_regression",
"numpy.linspace",
"numpy.cos",
"numpy.random.normal",
"miniml.Adam"
] | [((139, 156), 'numpy.random.seed', 'np.random.seed', (['(3)'], {}), '(3)\n', (153, 156), True, 'import numpy as np\n'), ((161, 191), 'numpy.linspace', 'np.linspace', (['(-10)', '(10)'], {'num': '(1000)'}), '(-10, 10, num=1000)\n', (172, 191), True, 'import numpy as np\n'), ((325, 339), 'miniml.Model', 'miniml.Model', (... |
from copy import deepcopy
from .helpers import set_n_jobs, replace_with_in_params
from sklearn.ensemble import (StackingRegressor, StackingClassifier,
VotingClassifier, VotingRegressor)
from joblib import Parallel, delayed
from sklearn.base import clone, is_classifier
from sklearn.utils... | [
"numpy.abs",
"numpy.shape",
"numpy.mean",
"sklearn.base.clone",
"pandas.DataFrame",
"sklearn.utils.Bunch",
"numpy.random.RandomState",
"sklearn.preprocessing.LabelEncoder",
"sklearn.base.is_classifier",
"sklearn.utils.metaestimators.available_if",
"numpy.bincount",
"copy.deepcopy",
"numpy.av... | [((1400, 1407), 'sklearn.utils.Bunch', 'Bunch', ([], {}), '()\n', (1405, 1407), False, 'from sklearn.utils import Bunch\n'), ((5663, 5694), 'sklearn.utils.multiclass.check_classification_targets', 'check_classification_targets', (['y'], {}), '(y)\n', (5691, 5694), False, 'from sklearn.utils.multiclass import check_clas... |
'''
This script plots spectrograms for pre-ictal periods.
Then, it uses NMF to find subgraphs and expressions for pre-ictal periods.
Finally, it calculates states as the subgraph with maximal expression at each time point
and calculates the dissimilarity between states.
Inputs:
target-electrodes-{mode}.mat
bandpower-... | [
"sys.path.append",
"kneed.KneeLocator",
"numpy.size",
"json.load",
"sklearn.decomposition.NMF",
"os.makedirs",
"warnings.filterwarnings",
"os.path.exists",
"time.time",
"numpy.insert",
"numpy.min",
"pull_sz_starts.pull_sz_starts",
"numpy.where",
"numpy.timedelta64",
"numpy.squeeze",
"o... | [((699, 723), 'sys.path.append', 'sys.path.append', (['"""tools"""'], {}), "('tools')\n", (714, 723), False, 'import sys\n'), ((1227, 1296), 'warnings.filterwarnings', 'warnings.filterwarnings', ([], {'action': '"""ignore"""', 'category': 'ConvergenceWarning'}), "(action='ignore', category=ConvergenceWarning)\n", (1250... |
# This script compares reading from an array in a loop using the
# tables.Array.read method. In the first case, read is used without supplying
# an 'out' argument, which causes a new output buffer to be pre-allocated
# with each call. In the second case, the buffer is created once, and then
# reused.
from __future_... | [
"numpy.empty",
"numpy.ones",
"time.time",
"tables.open_file",
"numpy.all"
] | [((506, 537), 'numpy.ones', 'np.ones', (['array_size'], {'dtype': '"""i8"""'}), "(array_size, dtype='i8')\n", (513, 537), True, 'import numpy as np\n'), ((547, 579), 'tables.open_file', 'tables.open_file', (['"""test.h5"""', '"""w"""'], {}), "('test.h5', 'w')\n", (563, 579), False, 'import tables\n'), ((773, 805), 'tab... |
import numpy as np
def distance_from_region(label_mask, distance_mask=None, scale=1, ord=2):
"""Find the distance at every point in an image from a set of labeled points.
Parameters
==========
label_mask : ndarray
A mask designating the points to find the distance from. A True value
ind... | [
"numpy.ma.getdata",
"numpy.ma.getmaskarray",
"numpy.zeros",
"numpy.ones",
"numpy.logical_not",
"numpy.indices",
"pylab.subplots",
"numpy.array",
"numpy.linalg.norm",
"numpy.linspace"
] | [((1046, 1061), 'numpy.array', 'np.array', (['scale'], {}), '(scale)\n', (1054, 1061), True, 'import numpy as np\n'), ((1075, 1101), 'numpy.zeros', 'np.zeros', (['label_mask.shape'], {}), '(label_mask.shape)\n', (1083, 1101), True, 'import numpy as np\n'), ((1115, 1143), 'numpy.indices', 'np.indices', (['label_mask.sha... |
from nose.plugins.attrib import attr
from numpy.testing.utils import assert_equal, assert_allclose, assert_raises
import numpy as np
from brian2.spatialneuron import *
from brian2.units import um, second
@attr('codegen-independent')
def test_basicshapes():
morpho = Soma(diameter=30*um)
morpho.L = Cylinder(len... | [
"numpy.testing.utils.assert_equal",
"numpy.testing.utils.assert_allclose",
"numpy.testing.utils.assert_raises",
"nose.plugins.attrib.attr"
] | [((207, 234), 'nose.plugins.attrib.attr', 'attr', (['"""codegen-independent"""'], {}), "('codegen-independent')\n", (211, 234), False, 'from nose.plugins.attrib import attr\n'), ((767, 794), 'nose.plugins.attrib.attr', 'attr', (['"""codegen-independent"""'], {}), "('codegen-independent')\n", (771, 794), False, 'from no... |
import os
import cv2
from matplotlib.pyplot import gray
import numpy as np
people = ['<NAME>', '<NAME>', '<NAME>', 'Madonna', '<NAME>']
DIR = r'/home/senai/tiago-projects/opencv-course/Resources/Faces/train'
haar_cascade = cv2.CascadeClassifier('/home/senai/tiago-projects/opencv-course/face_detection/haar_face.xml')
... | [
"numpy.save",
"cv2.face.LBPHFaceRecognizer_create",
"cv2.cvtColor",
"cv2.imread",
"numpy.array",
"cv2.CascadeClassifier",
"os.path.join",
"os.listdir"
] | [((224, 323), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""/home/senai/tiago-projects/opencv-course/face_detection/haar_face.xml"""'], {}), "(\n '/home/senai/tiago-projects/opencv-course/face_detection/haar_face.xml')\n", (245, 323), False, 'import cv2\n'), ((956, 974), 'numpy.array', 'np.array', (['featu... |
'''
Specialized scientific functions for biogeophysical variables and L4C model
processes.
'''
import numpy as np
from functools import partial
from scipy.ndimage import generic_filter
from scipy.linalg import solve_banded
from scipy.sparse import dia_matrix
from pyl4c import suppress_warnings
from pyl4c.data.fixtures... | [
"numpy.sum",
"numpy.ones",
"numpy.isnan",
"numpy.exp",
"numpy.unique",
"numpy.nanmean",
"numpy.multiply",
"pyl4c.stats.linear_constraint",
"numpy.power",
"numpy.isfinite",
"numpy.place",
"numpy.apply_along_axis",
"pyl4c.utils.get_pft_array",
"scipy.sparse.dia_matrix",
"numpy.var",
"num... | [((4740, 4761), 'numpy.sort', 'np.sort', (['series[:, 0]'], {}), '(series[:, 0])\n', (4747, 4761), True, 'import numpy as np\n'), ((4769, 4790), 'numpy.sort', 'np.sort', (['series[:, 1]'], {}), '(series[:, 1])\n', (4776, 4790), True, 'import numpy as np\n'), ((9339, 9367), 'numpy.zeros', 'np.zeros', (['arr_24hr.shape[1... |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2022 Scipp contributors (https://github.com/scipp)
# @author <NAME>
from .view import PlotView
from ..core import zeros, scalar
import numpy as np
from matplotlib.collections import PathCollection
class PlotView2d(PlotView):
"""
View object for 2 dimens... | [
"numpy.array",
"numpy.abs"
] | [((3143, 3206), 'numpy.abs', 'np.abs', (['(self.current_lims[dimx][1] - self.current_lims[dimx][0])'], {}), '(self.current_lims[dimx][1] - self.current_lims[dimx][0])\n', (3149, 3206), True, 'import numpy as np\n'), ((3220, 3283), 'numpy.abs', 'np.abs', (['(self.current_lims[dimy][1] - self.current_lims[dimy][0])'], {}... |
# -*- coding: utf-8 -*-
"""
Measure Rabi oscillation by changing the amplitude of the control pulse.
The control pulse has a sin^2 envelope, while the readout pulse is square.
"""
import ast
import math
import os
import time
import h5py
import numpy as np
from numpy.typing import ArrayLike
from mla_server import set... | [
"presto.pulsed.Pulsed",
"numpy.fft.rfft",
"presto.utils.rotate_opt",
"numpy.abs",
"numpy.angle",
"numpy.imag",
"numpy.mean",
"numpy.arange",
"numpy.exp",
"numpy.diag",
"os.path.join",
"presto.utils.sin2",
"numpy.max",
"numpy.linspace",
"numpy.real",
"mla_server.set_dc_bias",
"numpy.a... | [((14644, 14658), 'numpy.fft.rfft', 'np.fft.rfft', (['y'], {}), '(y)\n', (14655, 14658), True, 'import numpy as np\n'), ((14872, 14888), 'numpy.arccos', 'np.arccos', (['first'], {}), '(first)\n', (14881, 14888), True, 'import numpy as np\n'), ((14994, 15023), 'scipy.optimize.curve_fit', 'curve_fit', (['_func', 'x', 'y'... |
import copy
import warnings
from collections.abc import Iterable
from inspect import Parameter, signature
import numpy as np
from sklearn.utils.validation import (
check_array,
column_or_1d,
assert_all_finite,
check_consistent_length,
check_random_state as check_random_state_sklearn,
)
from ._labe... | [
"numpy.sum",
"numpy.ones",
"sklearn.utils.validation.check_consistent_length",
"numpy.diag",
"numpy.unique",
"numpy.random.RandomState",
"numpy.max",
"inspect.signature",
"sklearn.utils.validation.check_array",
"copy.deepcopy",
"sklearn.utils.validation.column_or_1d",
"numpy.nanmax",
"numpy.... | [((5175, 5199), 'numpy.isscalar', 'np.isscalar', (['class_prior'], {}), '(class_prior)\n', (5186, 5199), True, 'import numpy as np\n'), ((17167, 17194), 'copy.deepcopy', 'copy.deepcopy', (['random_state'], {}), '(random_state)\n', (17180, 17194), False, 'import copy\n'), ((17214, 17254), 'sklearn.utils.validation.check... |
#!/usr/bin/env python
# coding: utf-8
import argparse
import concurrent.futures
import logging
import numpy as np
import pandas as pd
import pyBigWig
import pysam
import os
import re
import sys
from Bio import SeqIO
from Bio.Seq import Seq
from collections import Counter
from numpy.lib.stride_tricks import sliding_wind... | [
"os.remove",
"Bio.Seq.Seq",
"argparse.ArgumentParser",
"pandas.read_csv",
"re.finditer",
"numpy.clip",
"numpy.histogram",
"numpy.linalg.norm",
"pandas.DataFrame",
"logging.error",
"sys.stderr.isatty",
"os.path.exists",
"numpy.append",
"numpy.swapaxes",
"collections.Counter",
"numpy.sta... | [((519, 801), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""aligned_bam_to_cpg_scores.py"""', 'description': '"""Calculate CpG positions and scores from an aligned bam file. Outputs raw and \n coverage-filtered results in bed and bigwig format, including haplotype-specific results (when... |
import numpy as np
def get_monthly_rate(rate) -> float:
"""
computes the monthy interest rate based on the yearly interest rate
:param float rate: the yearly interest rate
:return: the monthly interest rate
This computation uses the 12th root on the growth factor
"""
growth_year = rate ... | [
"numpy.power"
] | [((343, 374), 'numpy.power', 'np.power', (['growth_year', '(1.0 / 12)'], {}), '(growth_year, 1.0 / 12)\n', (351, 374), True, 'import numpy as np\n')] |
import numpy as np, pyemma as py
# from msmbuilder.decomposition.tica import tICA
from sklearn.kernel_approximation import Nystroem
class Kernel_tica(object):
def __init__(self, n_components, lag_time,
gamma, # gamma value for rbf kernel
n_components_nystroem=100, # ... | [
"sklearn.kernel_approximation.Nystroem",
"pyemma.coordinates.tica",
"numpy.sum",
"numpy.concatenate"
] | [((975, 1032), 'sklearn.kernel_approximation.Nystroem', 'Nystroem', ([], {'gamma': 'gamma', 'n_components': 'n_components_nystroem'}), '(gamma=gamma, n_components=n_components_nystroem)\n', (983, 1032), False, 'from sklearn.kernel_approximation import Nystroem\n'), ((1691, 1822), 'pyemma.coordinates.tica', 'py.coordina... |
import sys
sys.path.append('../src/')
import os
import numpy as np
from mask_rcnn.mrcnn import utils
import mask_rcnn.mrcnn.model as modellib
from mask_rcnn.samples.coco import coco
import cv2
import argparse as ap
class InferenceConfig(coco.CocoConfig):
# Set batch size to 1 since we'll be running inference on
... | [
"sys.path.append",
"os.mkdir",
"cv2.equalizeHist",
"argparse.ArgumentParser",
"cv2.cvtColor",
"os.path.exists",
"numpy.shape",
"cv2.imread",
"numpy.where",
"mask_rcnn.mrcnn.model.MaskRCNN",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((11, 37), 'sys.path.append', 'sys.path.append', (['"""../src/"""'], {}), "('../src/')\n", (26, 37), False, 'import sys\n'), ((591, 620), 'numpy.where', 'np.where', (["(r['class_ids'] != 0)"], {}), "(r['class_ids'] != 0)\n", (599, 620), True, 'import numpy as np\n'), ((831, 853), 'numpy.where', 'np.where', (['(scores ... |
from abc import ABC, abstractmethod
from collections import OrderedDict
from functools import reduce
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import gym
import matplotlib.pyplot as plt
class Params():
"""
policy which outputs the policy parameters directly, i.e. ... | [
"numpy.random.randn"
] | [((517, 546), 'numpy.random.randn', 'np.random.randn', (['self.dim_act'], {}), '(self.dim_act)\n', (532, 546), True, 'import numpy as np\n')] |
import socket
import nengo
import numpy as np
import pytest
from nengo.exceptions import SimulationError
from nengo_loihi.block import Axon, LoihiBlock, Synapse
from nengo_loihi.builder.builder import Model
from nengo_loihi.builder.discretize import discretize_model
from nengo_loihi.hardware import interface as hardw... | [
"nengo_loihi.builder.builder.Model",
"nengo_loihi.block.Axon",
"numpy.random.randint",
"nengo.Connection",
"nengo_loihi.hardware.builder.build_board",
"pytest.warns",
"nengo.Node",
"nengo_loihi.block.LoihiBlock",
"nengo_loihi.hardware.interface.HostSnip",
"pytest.raises",
"nengo.Network",
"nen... | [((4928, 4988), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:Model is precomputable."""'], {}), "('ignore:Model is precomputable.')\n", (4954, 4988), False, 'import pytest\n'), ((1655, 1683), 'pytest.importorskip', 'pytest.importorskip', (['"""nxsdk"""'], {}), "('nxsdk')\n", (1674, 1683), Fa... |
import os
import numpy as np
# from skimage.io import imread
import cv2
import copy
from skimage.transform import resize
def load_data_siamese(x_size,y_size,data_path,label_path,image_s_path,uncentain_path,validation_name,test_name):
tmp = np.loadtxt(label_path, dtype=np.str, delimiter=",")
# delete one image ... | [
"cv2.imread",
"numpy.append",
"numpy.loadtxt",
"numpy.argwhere",
"numpy.delete",
"cv2.resize"
] | [((245, 296), 'numpy.loadtxt', 'np.loadtxt', (['label_path'], {'dtype': 'np.str', 'delimiter': '""","""'}), "(label_path, dtype=np.str, delimiter=',')\n", (255, 296), True, 'import numpy as np\n'), ((431, 463), 'numpy.delete', 'np.delete', (['tmp', '(8252 + 1)'], {'axis': '(0)'}), '(tmp, 8252 + 1, axis=0)\n', (440, 463... |
#! /usr/bin/env python
import os,sys
import cv2, re
import numpy as np
try:
from pyutil import PyLogger
except ImportError:
from .. import PyLogger
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__version__ = "0.0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
SRC_TYPE_NAME = ["WebCam","Video","IPCam"]
OUTPUT_V... | [
"cv2.VideoWriter_fourcc",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"numpy.amax",
"numpy.where",
"numpy.array",
"re.search",
"cv2.destroyAllWindows",
"os.path.join",
"pyutil.PyLogger"
] | [((566, 596), 'pyutil.PyLogger', 'PyLogger', ([], {'log': 'log', 'debug': 'debug'}), '(log=log, debug=debug)\n', (574, 596), False, 'from pyutil import PyLogger\n'), ((987, 1023), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (['*SAVE_FORMAT'], {}), '(*SAVE_FORMAT)\n', (1009, 1023), False, 'import cv2, re\n'), ((... |
"""Example of count data sampled from negative-binomial distribution
"""
import numpy as np
from matplotlib import pyplot as plt
from scipy import stats
from sklearn.model_selection import train_test_split
from xgboost_distribution import XGBDistribution
def generate_count_data(n_samples=10_000):
X = np.random.u... | [
"numpy.random.uniform",
"numpy.meshgrid",
"numpy.random.seed",
"matplotlib.pyplot.show",
"xgboost_distribution.XGBDistribution",
"numpy.random.negative_binomial",
"sklearn.model_selection.train_test_split",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.subplots"
] | [((309, 344), 'numpy.random.uniform', 'np.random.uniform', (['(-2)', '(0)', 'n_samples'], {}), '(-2, 0, n_samples)\n', (326, 344), True, 'import numpy as np\n'), ((421, 474), 'numpy.random.negative_binomial', 'np.random.negative_binomial', ([], {'n': 'n', 'p': 'p', 'size': 'n_samples'}), '(n=n, p=p, size=n_samples)\n',... |
import os
import numpy as np
import tensorflow as tf
from utils.recorder import RecorderTf2 as Recorder
class Base(tf.keras.Model):
def __init__(self, a_dim_or_list, action_type, base_dir):
super().__init__()
physical_devices = tf.config.experimental.list_physical_devices('GPU')
if len(p... | [
"os.path.join",
"tensorflow.summary.scalar",
"os.makedirs",
"utils.recorder.RecorderTf2",
"tensorflow.config.experimental.set_memory_growth",
"os.path.exists",
"tensorflow.summary.experimental.set_step",
"tensorflow.Variable",
"numpy.array",
"tensorflow.train.latest_checkpoint",
"tensorflow.kera... | [((252, 303), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (296, 303), True, 'import tensorflow as tf\n'), ((514, 552), 'tensorflow.keras.backend.set_floatx', 'tf.keras.backend.set_floatx', (['"""float64"""'], {}), "('float64')... |
# Copyright 2019 the ProGraML authors.
#
# Contact <NAME> <<EMAIL>>.
#
# 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 a... | [
"numpy.arange",
"labm8.py.app.DEFINE_string",
"numpy.argmax"
] | [((928, 1167), 'labm8.py.app.DEFINE_string', 'app.DEFINE_string', (['"""batch_scores_averaging_method"""', '"""weighted"""', '"""Selects the averaging method to use when computing recall/precision/F1 scores. See <https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html>"""'], {}), "('batch_scores... |
import collections
import os
import numpy as np
import tensorflow as tf
from pysc2.lib import actions
from tensorflow.contrib import layers
from tensorflow.contrib.layers.python.layers.optimizers import OPTIMIZER_SUMMARIES
from actorcritic.policy import FullyConvPolicy
from common.preprocess import ObsProcesser, FEATUR... | [
"tensorflow.reduce_sum",
"tensorflow.clip_by_value",
"tensorflow.trainable_variables",
"tensorflow.get_collection",
"tensorflow.global_variables",
"tensorflow.assign",
"common.util.ravel_index_pairs",
"tensorflow.variable_scope",
"tensorflow.minimum",
"tensorflow.placeholder",
"tensorflow.summar... | [((1528, 1605), 'collections.namedtuple', 'collections.namedtuple', (['"""SelectedLogProbs"""', "['action_id', 'spatial', 'total']"], {}), "('SelectedLogProbs', ['action_id', 'spatial', 'total'])\n", (1550, 1605), False, 'import collections\n'), ((3882, 3922), 'os.makedirs', 'os.makedirs', (['summary_path'], {'exist_ok... |
#!/usr/bin/env python
# coding:utf-8
from __future__ import print_function
#import sys
import re
import glob
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
all_files = glob.glob('../*/dat_L*_tau_inf')
list_L = []
list_N = []
list_mx = []
list_mz0mz1 = []
list_ene = []
for ... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.array",
"glob.glob",
"matplotlib.pyplot.xlabel",
"re.sub",
"numpy.fromstring"
] | [((147, 168), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (161, 168), False, 'import matplotlib\n'), ((214, 246), 'glob.glob', 'glob.glob', (['"""../*/dat_L*_tau_inf"""'], {}), "('../*/dat_L*_tau_inf')\n", (223, 246), False, 'import glob\n'), ((2106, 2118), 'matplotlib.pyplot.figure', 'plt.fig... |
#!/usr/bin/env python
# encoding: utf-8
import argparse
import prody
import os
import shutil
import subprocess
import numpy
from os.path import join
GMX_PATH = '/usr/local/gromacs/bin/'
mdp_string = '''
define = -DPOSRES
integrator = {integrator}
nsteps = 1000
emtol = 1
nstlist = 1
coulombtype = Cut-off
vdwtype =... | [
"os.mkdir",
"subprocess.Popen",
"argparse.ArgumentParser",
"prody.PDBEnsemble",
"os.path.join",
"os.path.isdir",
"prody.AtomGroup",
"numpy.argmin",
"prody.parsePDB",
"shutil.rmtree",
"prody.writePDB",
"os.chdir",
"subprocess.check_call"
] | [((534, 625), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate trajectory with gaussian flucutations."""'}), "(description=\n 'Generate trajectory with gaussian flucutations.')\n", (557, 625), False, 'import argparse\n'), ((7413, 7467), 'prody.writePDB', 'prody.writePDB', (['ou... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module defines filters for Cell instances
"""
from __future__ import print_function
import copy
import numpy as np
from tunacell.filters.main import FilterGeneral, bounded, included, FilterAND
from tunacell.base.datatools import multiplicative_increments
from tu... | [
"tunacell.filters.main.included",
"copy.deepcopy",
"numpy.abs",
"numpy.amin",
"tunacell.base.datatools.multiplicative_increments",
"tunacell.filters.main.bounded",
"tunacell.base.observable.Observable",
"numpy.amax",
"numpy.array"
] | [((6363, 6391), 'tunacell.base.observable.Observable', 'Observable', ([], {'name': '"""undefined"""'}), "(name='undefined')\n", (6373, 6391), False, 'from tunacell.base.observable import Observable\n'), ((4970, 5062), 'tunacell.filters.main.included', 'included', (["cell.data['time']"], {'lower_bound': 'self.lower_boun... |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 16 18:04:26 2020
@author: hp
"""
import pandas as pd
import numpy as np
ratings= pd.read_csv('ratings.csv')
movies= pd.read_csv(r'movies.csv' )
ts = ratings['timestamp']
ts = pd.to_datetime(ts, unit = 's').dt.hour
movies['hours'] = ts
merged = ratin... | [
"pandas.DataFrame",
"numpy.stack",
"pandas.read_csv",
"numpy.min",
"numpy.max",
"pandas.to_datetime"
] | [((141, 167), 'pandas.read_csv', 'pd.read_csv', (['"""ratings.csv"""'], {}), "('ratings.csv')\n", (152, 167), True, 'import pandas as pd\n'), ((177, 202), 'pandas.read_csv', 'pd.read_csv', (['"""movies.csv"""'], {}), "('movies.csv')\n", (188, 202), True, 'import pandas as pd\n'), ((1461, 1489), 'pandas.read_csv', 'pd.r... |
# A neural network which approximates linear function y = 2x + 3.
# The network has 1 layer with 1 node, which has 1 input (and a bias).
# As there is no activation effectively this node is a linear function.
# After +/- 10.000 iterations W should be close to 2 and B should be close to 3.
import matplotlib.pyplot as p... | [
"matplotlib.pyplot.title",
"numpy.set_printoptions",
"numpy.random.seed",
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.average",
"numpy.array",
"numpy.random.normal",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((343, 420), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'formatter': "{'float': '{: 0.3f}'.format}", 'linewidth': 'np.inf'}), "(formatter={'float': '{: 0.3f}'.format}, linewidth=np.inf)\n", (362, 420), True, 'import numpy as np\n'), ((421, 438), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n'... |
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
from numpy import log10 as lg
from numpy import pi as pi
from scipy.interpolate import interp1d as sp_interp1d
from scipy.integrate import odeint
from scipy.integrate import ode
import warnings
import timeit
import sci... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"numpy.genfromtxt",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.tick_params",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.subplots_adjust"
] | [((1228, 1255), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (1234, 1255), True, 'import matplotlib.pyplot as plt\n'), ((1310, 1367), 'matplotlib.pyplot.tick_params', 'plt.tick_params', ([], {'axis': '"""both"""', 'which': '"""minor"""', 'labelsize': '(18)'}), "(a... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""
Training script for split miniImageNET 100 experiment.
"""
from __future__ import print_function
import argparse
import o... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"utils.utils.average_acc_stats_across_runs",
"tensorflow.reset_default_graph",
"numpy.ones",
"utils.utils.average_fgt_stats_across_runs",
"tensorflow.ConfigProto",
"numpy.arange",
"utils.vis_utils.snapshot_experiment_meta_data",
"utils.data_utils.con... | [((3393, 3425), 'os.path.join', 'os.path.join', (['logdir', 'model_name'], {}), '(logdir, model_name)\n', (3405, 3425), False, 'import os\n'), ((4050, 4135), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script for split miniImagenet experiment."""'}), "(description='Script for split mi... |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from tilec.fg import dBnudT,get_mix
"""
compute various conversion factors for LFI bandpasses
"""
TCMB = 2.726 # Kelvin
TCMB_uK = 2.726e6 # micro-Kelvin
hplanck = 6.626068e-34 # MKS
kboltz = 1.3806503e-23 # MKS
clight = 2997924... | [
"numpy.trapz",
"tilec.fg.dBnudT",
"numpy.array",
"numpy.exp",
"numpy.loadtxt",
"tilec.fg.get_mix"
] | [((506, 534), 'numpy.array', 'np.array', (['[30.0, 44.0, 70.0]'], {}), '([30.0, 44.0, 70.0])\n', (514, 534), True, 'import numpy as np\n'), ((714, 738), 'numpy.loadtxt', 'np.loadtxt', (['LFI_files[i]'], {}), '(LFI_files[i])\n', (724, 738), True, 'import numpy as np\n'), ((888, 924), 'numpy.trapz', 'np.trapz', (['LFI_lo... |
'''
An Elman Network is implemented, taking the output of the last time step of the time series as prediction, and also to
compute the training loss. This is done because this output is thought of as the most informed one.
'''
import torch
from torch import nn
from sklearn.preprocessing import MaxAbsScaler
from sklea... | [
"sys.stdout.write",
"torch.argmax",
"sklearn.metrics.accuracy_score",
"random.shuffle",
"sklearn.preprocessing.MaxAbsScaler",
"torch.nn.Softmax",
"sys.stdout.flush",
"torch.device",
"os.path.join",
"sklearn.metrics.precision_recall_fscore_support",
"importlib.util.module_from_spec",
"os.path.e... | [((572, 646), 'importlib.util.spec_from_file_location', 'importlib.util.spec_from_file_location', (['chosen_experiment', 'experiment_path'], {}), '(chosen_experiment, experiment_path)\n', (610, 646), False, 'import importlib\n'), ((656, 693), 'importlib.util.module_from_spec', 'importlib.util.module_from_spec', (['spec... |
import numpy as np
import pymc3 as pm
import theano
import theano.tensor as tt
# for reproducibility here's some version info for modules used in this notebook
import platform
import IPython
import matplotlib
import matplotlib.pyplot as plt
import emcee
import corner
import os
from autograd import grad
from files.myI... | [
"pymc3.sample",
"matplotlib.pyplot.title",
"platform.python_version",
"numpy.random.seed",
"arviz.plot_joint",
"arviz.from_pymc3",
"matplotlib.pyplot.figure",
"numpy.mean",
"pymc3.Uniform",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.axvline",
"theano.tensor.as_tensor_variable",
"ar... | [((1211, 1222), 'time.time', 'time.time', ([], {}), '()\n', (1220, 1222), False, 'import time\n'), ((21085, 21096), 'time.time', 'time.time', ([], {}), '()\n', (21094, 21096), False, 'import time\n'), ((21351, 21377), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 2)'}), '(figsize=(8, 2))\n', (21361, 2... |
# Some implementation details regarding PyBullet:
#
# PyBullet's IK solver uses damped least squares (DLS) optimization. This is commonly
# known as Levenberg-Marquardt (LM) optimization.
from __future__ import annotations
import dataclasses
from typing import NamedTuple, Optional
import numpy as np
import pybullet ... | [
"numpy.random.uniform",
"coffee.client.ClientConfig",
"numpy.sum",
"coffee.joints.Joints.from_body_id",
"numpy.empty",
"dm_robotics.transformations.transformations.quat_diff_active",
"numpy.clip",
"coffee.utils.geometry_utils.as_quaternion_wxyz",
"coffee.utils.geometry_utils.as_quaternion_xyzw",
"... | [((2359, 2415), 'coffee.joints.Joints.from_body_id', 'Joints.from_body_id', (['shadow_body_id', 'self._shadow_client'], {}), '(shadow_body_id, self._shadow_client)\n', (2378, 2415), False, 'from coffee.joints import Joints\n'), ((10821, 10882), 'dm_robotics.transformations.transformations.quat_diff_active', 'tr.quat_di... |
import os
import json
import shutil
import argparse
import numpy as np
from PIL import Image
def getSeqInfo(dataset_dir, seq):
ann_dir = os.path.join(dataset_dir, 'Annotations', '480p')
seq_path = os.path.join(ann_dir, seq)
frame_list = os.listdir(seq_path)
frame_num = len(frame_list)
frames = os... | [
"json.dump",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.isdir",
"os.path.exists",
"shutil.copyfile",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((143, 191), 'os.path.join', 'os.path.join', (['dataset_dir', '"""Annotations"""', '"""480p"""'], {}), "(dataset_dir, 'Annotations', '480p')\n", (155, 191), False, 'import os\n'), ((207, 233), 'os.path.join', 'os.path.join', (['ann_dir', 'seq'], {}), '(ann_dir, seq)\n', (219, 233), False, 'import os\n'), ((251, 271), ... |
#
# Created by djz on 2022/04/01.
#
import numpy as np
from typing import Dict
from transformers.file_utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
from .base import GenericTensor, Pipeline
def sigmoid(_outputs):
return 1.0 / (1.0 + np.exp(-_outputs))
def softmax(_outputs):
... | [
"numpy.max",
"numpy.exp"
] | [((331, 371), 'numpy.max', 'np.max', (['_outputs'], {'axis': '(-1)', 'keepdims': '(True)'}), '(_outputs, axis=-1, keepdims=True)\n', (337, 371), True, 'import numpy as np\n'), ((390, 414), 'numpy.exp', 'np.exp', (['(_outputs - maxes)'], {}), '(_outputs - maxes)\n', (396, 414), True, 'import numpy as np\n'), ((276, 293)... |
#coding: UTF-8
import sys
import os
import os.path
import glob
import cv2
import numpy as np
CAPTUREDDIR = './captured'
CALIBFLAG = 0 # cv2.CALIB_FIX_K3
def calibFromImages(dirname, chess_shape, chess_block_size):
if not os.path.exists(dirname):
print('Directory \'' + dirname + '\' was not found')
... | [
"cv2.findChessboardCorners",
"numpy.zeros",
"os.path.exists",
"cv2.imread",
"cv2.FileStorage",
"cv2.Rodrigues",
"numpy.array",
"cv2.calibrateCamera",
"glob.glob"
] | [((548, 606), 'numpy.zeros', 'np.zeros', (['(chess_shape[0] * chess_shape[1], 3)', 'np.float32'], {}), '((chess_shape[0] * chess_shape[1], 3), np.float32)\n', (556, 606), True, 'import numpy as np\n'), ((1422, 1513), 'cv2.calibrateCamera', 'cv2.calibrateCamera', (['objp_list', 'imgp_list', 'img_shape', 'None', 'None', ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.