code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# Copyright (c) 2019 <NAME>
"""
A collection of Poker games often used in computational poker research.
"""
import numpy as np
from PokerRL.game.Poker import Poker
from PokerRL.game._.rl_env.game_rules import HoldemRules, LeducRules, FlopHoldemRules, BigLeducRules
from PokerRL.game._.rl_env.poker_types.DiscretizedPok... | [
"PokerRL.game._.rl_env.poker_types.LimitPokerEnv.LimitPokerEnv.__init__",
"numpy.sum",
"PokerRL.game._.rl_env.game_rules.HoldemRules.__init__",
"PokerRL.game._.rl_env.game_rules.BigLeducRules.__init__",
"PokerRL.game._.rl_env.poker_types.NoLimitPokerEnv.NoLimitPokerEnv.__init__",
"PokerRL.game._.rl_env.ba... | [((1459, 1484), 'PokerRL.game._.rl_env.game_rules.LeducRules.__init__', 'LeducRules.__init__', (['self'], {}), '(self)\n', (1478, 1484), False, 'from PokerRL.game._.rl_env.game_rules import HoldemRules, LeducRules, FlopHoldemRules, BigLeducRules\n'), ((1493, 1596), 'PokerRL.game._.rl_env.poker_types.LimitPokerEnv.Limit... |
import numpy as np
import pandas as pd
import lightgbm as lgb
from catboost import CatBoost
from catboost import Pool
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix, classification_report, f1_score
from tqdm import tqdm
class Report:
def __init__(self, y_train_prob... | [
"lightgbm.train",
"lightgbm.Dataset",
"pandas.read_csv",
"numpy.std",
"sklearn.linear_model.LogisticRegression",
"sklearn.metrics.f1_score",
"numpy.mean",
"catboost.CatBoost",
"numpy.round",
"catboost.Pool"
] | [((1293, 1322), 'lightgbm.Dataset', 'lgb.Dataset', (['X_train', 'y_train'], {}), '(X_train, y_train)\n', (1304, 1322), True, 'import lightgbm as lgb\n'), ((1339, 1389), 'lightgbm.Dataset', 'lgb.Dataset', (['X_valid', 'y_valid'], {'reference': 'lgb_train'}), '(X_valid, y_valid, reference=lgb_train)\n', (1350, 1389), Tru... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import seaborn as sns
data = pd.read_csv('/home/atrides/Desktop/R/statistics_with_Python/04_Exploring_Data_with_Graphs/Data_Files/Exam Anxiety.dat', sep='\s+')
data.set_index(['Code'],drop=True,inplace=True)
print(data.he... | [
"numpy.poly1d",
"seaborn.lmplot",
"matplotlib.pyplot.show",
"numpy.polyfit",
"pandas.read_csv",
"seaborn.regplot",
"numpy.array",
"matplotlib.pyplot.subplots"
] | [((128, 269), 'pandas.read_csv', 'pd.read_csv', (['"""/home/atrides/Desktop/R/statistics_with_Python/04_Exploring_Data_with_Graphs/Data_Files/Exam Anxiety.dat"""'], {'sep': '"""\\\\s+"""'}), "(\n '/home/atrides/Desktop/R/statistics_with_Python/04_Exploring_Data_with_Graphs/Data_Files/Exam Anxiety.dat'\n , sep='\\... |
import luigi
import mlflow
import numpy as np
import random
import yaml
# from src.models import get_model_task_by_name
from src.utils.params_to_filename import encode_task_to_filename
from src.visualization.log_metrics import LogMetrics
_inf = np.finfo(np.float64).max
class SearchRandom(luigi.Task):
model_name... | [
"mlflow.start_run",
"numpy.random.uniform",
"yaml.load",
"numpy.random.seed",
"src.utils.params_to_filename.encode_task_to_filename",
"mlflow.set_tag",
"luigi.run",
"yaml.dump",
"src.visualization.log_metrics.LogMetrics",
"random.choice",
"numpy.finfo",
"random.seed",
"luigi.LocalTarget",
... | [((247, 267), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (255, 267), True, 'import numpy as np\n'), ((323, 427), 'luigi.Parameter', 'luigi.Parameter', ([], {'default': '"""logistic-regression"""', 'description': '"""model name (e.g. logistic-regression)"""'}), "(default='logistic-regression', de... |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: Python [conda env:PROJ_irox_oer] *
# language: python
# name: conda-env-PROJ_irox_... | [
"pandas.DataFrame",
"pickle.dump",
"methods.get_df_dft",
"methods.get_df_features_targets",
"os.path.join",
"os.makedirs",
"os.getcwd",
"methods.get_df_jobs_data",
"numpy.cross",
"ase_modules.ase_methods.create_species_element_dict",
"os.path.exists",
"time.time",
"numpy.linalg.norm",
"met... | [((489, 500), 'time.time', 'time.time', ([], {}), '()\n', (498, 500), False, 'import time\n'), ((556, 598), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (569, 598), True, 'import pandas as pd\n'), ((1336, 1348), 'methods.isnotebook', 'isnotebook',... |
import numpy as np
import random
ROW=10
COLUMN=10
def myboard():
board=np.zeros((ROW,COLUMN))
return board
r=[0,1,2,3,4,5,6,7,8,9]
c=[0,1,2,3,4,5,6,7,8,9]
def location(board,gotti,dicevalue):
board[r][c]=gotti
if dicevalue <11:
return board[0][dicevalue-1] == got... | [
"numpy.zeros",
"random.randint",
"numpy.flip"
] | [((78, 101), 'numpy.zeros', 'np.zeros', (['(ROW, COLUMN)'], {}), '((ROW, COLUMN))\n', (86, 101), True, 'import numpy as np\n'), ((1918, 1935), 'numpy.flip', 'np.flip', (['board', '(0)'], {}), '(board, 0)\n', (1925, 1935), True, 'import numpy as np\n'), ((2286, 2306), 'random.randint', 'random.randint', (['(1)', '(6)'],... |
"""
Added file for pre-processing the testing dataset for testing
"""
import os
import shutil
import json
import numpy as np
import sys
class PoseParser:
def __init__(self, camera_json, gt_json, images_path, diameter, output_path, obj_dict=None):
self.camera_file_path = camera_json
with open(os.pa... | [
"os.mkdir",
"os.remove",
"json.load",
"numpy.save",
"os.path.abspath",
"os.path.exists",
"numpy.zeros",
"numpy.array",
"shutil.rmtree",
"os.listdir",
"numpy.sqrt"
] | [((1089, 1158), 'numpy.sqrt', 'np.sqrt', (['(bbox_sizes[0] ** 2 + bbox_sizes[1] ** 2 + bbox_sizes[2] ** 2)'], {}), '(bbox_sizes[0] ** 2 + bbox_sizes[1] ** 2 + bbox_sizes[2] ** 2)\n', (1096, 1158), True, 'import numpy as np\n'), ((2133, 2161), 'os.path.exists', 'os.path.exists', (['cam_out_file'], {}), '(cam_out_file)\n... |
'''I/O operations'''
import numpy as np
import nibabel as nib
def load_bvec(fpath):
'''Loads bvec into numpy array
Args:
fpath (str): path to bvec file
Returns:
bvec (np.ndarray): bvec array, shape -> (3, b)
'''
bvec = np.genfromtxt(fpath, dtype=np.float32)
if bvec.shape[1] ... | [
"nibabel.as_closest_canonical",
"numpy.sum",
"nibabel.load",
"numpy.asarray",
"numpy.savetxt",
"numpy.genfromtxt",
"numpy.expand_dims",
"nibabel.save",
"nibabel.aff2axcodes",
"numpy.concatenate",
"nibabel.Nifti2Image"
] | [((260, 298), 'numpy.genfromtxt', 'np.genfromtxt', (['fpath'], {'dtype': 'np.float32'}), '(fpath, dtype=np.float32)\n', (273, 298), True, 'import numpy as np\n'), ((560, 598), 'numpy.genfromtxt', 'np.genfromtxt', (['fpath'], {'dtype': 'np.float32'}), '(fpath, dtype=np.float32)\n', (573, 598), True, 'import numpy as np\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
interview_meter.py: Analyze camera time for studio interviews.
Author: <NAME> github.com/joaquincabezas
Date: 10/04/2020
Instructions:
Extract the reference frames using ffmpeg
ffmpeg -ss 00:00:XX -t 00:00:00.01 -i YOURMOVIE.MP4 -r 25.0 REFERENCE_NAME... | [
"cv2.putText",
"argparse.ArgumentParser",
"numpy.count_nonzero",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.savetxt",
"numpy.zeros",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.imread",
"skimage.metrics.structural_similarity",
"os.path.splitext",
"glob.glob",
"cv2.destroyAllWindows"
] | [((1516, 1536), 'glob.glob', 'glob.glob', (['"""./*.png"""'], {}), "('./*.png')\n", (1525, 1536), False, 'import glob\n'), ((2426, 2494), 'numpy.savetxt', 'np.savetxt', (["(project_name + '.csv')", 'matches'], {'delimiter': '""","""', 'fmt': '"""%1d"""'}), "(project_name + '.csv', matches, delimiter=',', fmt='%1d')\n",... |
import logging
import os
import sys
from collections import OrderedDict
import numpy as np
import matplotlib.pyplot as plt
from bisect import bisect_right
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
import torch
from torch import nn
from .RawDeformationNetSolverV0 import RawDeformationNetS... | [
"matplotlib.pyplot.tight_layout",
"metrics.miou_shape.calc_miou",
"warnings.filterwarnings",
"matplotlib.pyplot.figure",
"numpy.linspace",
"collections.OrderedDict",
"torch.no_grad",
"util.util_visual.plot_3d_point_cloud",
"logging.getLogger"
] | [((171, 226), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'UserWarning'}), "('ignore', category=UserWarning)\n", (194, 226), False, 'import warnings\n'), ((576, 601), 'logging.getLogger', 'logging.getLogger', (['"""base"""'], {}), "('base')\n", (593, 601), False, 'import loggin... |
"""Module to read, check and write a HDSR meetpuntconfiguratie."""
__title__ = "histTags2mpt"
__description__ = "to evaluate a HDSR FEWS-config with a csv with CAW histTags"
__version__ = "0.1.0"
__author__ = "<NAME>"
__author_email__ = "<EMAIL>"
__license__ = "MIT License"
from meetpuntconfig.fews_utilities import Fe... | [
"pandas.read_csv",
"openpyxl.load_workbook",
"pathlib.Path",
"pandas.api.types.is_datetime64_dtype",
"pandas.Timestamp.now",
"openpyxl.styles.PatternFill",
"numpy.unique",
"pandas.DataFrame",
"logging.warning",
"pandas.Timedelta",
"re.sub",
"pandas.ExcelWriter",
"pandas.concat",
"meetpuntc... | [((6040, 6077), 'meetpuntconfig.fews_utilities.FewsConfig', 'FewsConfig', (["self.paths['fews_config']"], {}), "(self.paths['fews_config'])\n", (6050, 6077), False, 'from meetpuntconfig.fews_utilities import FewsConfig, xml_to_dict\n'), ((7278, 7364), 'pandas.read_excel', 'pd.read_excel', (["self.paths['consistency_xls... |
import numpy as np
import cv2
from glob import glob
import os
import os.path as path
import random
import pickle
import scipy.stats as st
import torch
import torch.utils.data as Data
def process_pts(line):
line = line.replace(',', '')
line = line.split(' ')
fname = line[0]
pts = line[1:-3]
ang = line[-3:]
ang... | [
"numpy.fft.ifft",
"numpy.outer",
"numpy.abs",
"os.path.basename",
"random.sample",
"numpy.fft.fft",
"numpy.float32",
"numpy.floor",
"numpy.zeros",
"scipy.stats.norm.pdf",
"random.choice",
"cv2.imread",
"os.path.isfile",
"numpy.fft.fftshift",
"numpy.linspace",
"glob.glob",
"os.path.sp... | [((354, 369), 'numpy.float32', 'np.float32', (['ang'], {}), '(ang)\n', (364, 369), True, 'import numpy as np\n'), ((408, 423), 'numpy.float32', 'np.float32', (['pts'], {}), '(pts)\n', (418, 423), True, 'import numpy as np\n'), ((544, 568), 'numpy.linspace', 'np.linspace', (['(-3)', '(3)', 'size'], {}), '(-3, 3, size)\n... |
import sys
sys.path.append('../../')
import cnvfc
import numpy as np
import pandas as pd
import pathlib as pal
root_p = pal.Path('../../data/')
profile_p = root_p / 'processed/fc_profiles/cnv_FC_profile.tsv'
connectomes_p = root_p / 'processed/residual_connectomes/icc_residual_connectomes.npy'
out_p = root_p / 'proces... | [
"sys.path.append",
"cnvfc.tools.conn2mat",
"numpy.load",
"numpy.save",
"pandas.read_csv",
"numpy.ones",
"pathlib.Path",
"cnvfc.stats.make_weights"
] | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((121, 144), 'pathlib.Path', 'pal.Path', (['"""../../data/"""'], {}), "('../../data/')\n", (129, 144), True, 'import pathlib as pal\n'), ((398, 430), 'pandas.read_csv', 'pd.read_csv', (['profile_p... |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import numpy as np
import matplotlib.pyplot as plt
from indra import trips
from indra.assemblers import PysbAssembler
from indra.util.plot_formatting import *
from pysb import Observable, Parameter
from pys... | [
"matplotlib.pyplot.savefig",
"pysb.Parameter",
"matplotlib.pyplot.plot",
"pysb.integrate.Solver",
"matplotlib.pyplot.yticks",
"os.path.exists",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"indra.assemblers.PysbAssembler",
"matplotlib.py... | [((1008, 1023), 'indra.assemblers.PysbAssembler', 'PysbAssembler', ([], {}), '()\n', (1021, 1023), False, 'from indra.assemblers import PysbAssembler\n'), ((2976, 3024), 'numpy.linspace', 'np.linspace', (['(0)', '(sim_hours * 3600)', '(sim_hours * 60)'], {}), '(0, sim_hours * 3600, sim_hours * 60)\n', (2987, 3024), Tru... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | [
"numpy.eye",
"pyscf.lib.prange",
"numpy.empty",
"numpy.asarray",
"collections.Counter",
"pyscf.pbc.dft.numint.eval_rho",
"numpy.zeros",
"time.ctime",
"pyscf.pbc.dft.numint.eval_ao",
"numpy.arange",
"numpy.dot",
"pyscf.tools.chgcar.orbital",
"pyscf.pbc.scf.RHF",
"pyscf.lib.cartesian_prod"
] | [((2451, 2470), 'numpy.empty', 'numpy.empty', (['ngrids'], {}), '(ngrids)\n', (2462, 2470), False, 'import numpy\n'), ((2491, 2521), 'pyscf.lib.prange', 'lib.prange', (['(0)', 'ngrids', 'blksize'], {}), '(0, ngrids, blksize)\n', (2501, 2521), False, 'from pyscf import lib\n'), ((4162, 4181), 'numpy.empty', 'numpy.empty... |
import logging
from numpy.random import uniform
from problems.test_case import TestCase, TestCaseTypeEnum
from problems.solutions.plump_moose import moose_body_mass
logger = logging.getLogger(__name__)
FUNCTION_NAME = "moose_body_mass"
INPUT_VARS = ["latitude"]
OUTPUT_VARS = ["mass"]
STATIC_RESOURCES = []
PHYSICAL... | [
"numpy.random.uniform",
"problems.solutions.plump_moose.moose_body_mass",
"logging.getLogger"
] | [((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'import logging\n'), ((1488, 1513), 'problems.solutions.plump_moose.moose_body_mass', 'moose_body_mass', (['latitude'], {}), '(latitude)\n', (1503, 1513), False, 'from problems.solutions.plump_moose import moo... |
import numpy as np
import pytest
from astropy.io import fits
from astropy.utils.data import get_pkg_data_filename
from astropy.wcs import WCS
from astropy.nddata import NDData
from ..utils import parse_input_data, parse_output_projection
def test_parse_input_data(tmpdir):
header = fits.Header.fromtextfile(get_p... | [
"astropy.io.fits.ImageHDU",
"astropy.nddata.NDData",
"astropy.utils.data.get_pkg_data_filename",
"astropy.wcs.WCS",
"pytest.raises",
"numpy.arange",
"numpy.testing.assert_allclose"
] | [((412, 431), 'astropy.io.fits.ImageHDU', 'fits.ImageHDU', (['data'], {}), '(data)\n', (425, 431), False, 'from astropy.io import fits\n'), ((503, 542), 'numpy.testing.assert_allclose', 'np.testing.assert_allclose', (['array', 'data'], {}), '(array, data)\n', (529, 542), True, 'import numpy as np\n'), ((967, 1006), 'nu... |
from EQTransformer.core.EqT_utils import f1, SeqSelfAttention, FeedForward, LayerNormalization
from EQTransformer.core.mseed_predictor import (
mseed_predictor,
_mseed2nparry,
PreLoadGeneratorTest,
_picker,
_get_snr,
_output_writter_prediction,
_plotter_prediction,
_resampling,
)
impor... | [
"keras.models.load_model",
"EQTransformer.core.mseed_predictor._picker",
"obspy.core.Stream",
"shutil.rmtree",
"os.path.join",
"EQTransformer.core.mseed_predictor.PreLoadGeneratorTest",
"csv.writer",
"keras.optimizers.Adam",
"EQTransformer.core.mseed_predictor._resampling",
"platform.system",
"o... | [((2147, 2185), 'keras.engine.training_utils.iter_sequence_infinite', 'iter_sequence_infinite', (['pred_generator'], {}), '(pred_generator)\n', (2169, 2185), False, 'from keras.engine.training_utils import iter_sequence_infinite\n'), ((3108, 3128), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (3117, ... |
#-------by HYH -------#
import numpy as np
p=[0,0.5,0,0.5,0]
u=2
pExact=0.8
pOvershoot=0.1
pUndershoot=0.1
def move(p,u,pExact,pOvershoot,pUndershoot):
n=len(p)
q=np.zeros(n)
for i in range(n):
q[i]=pExact*p[(i-u)%n]
q[i]=q[i]+pOvershoot*p[(i-1-u)%n]
q[i]=q[i]+pUndershoot*p[(i+1-u)%n]
return q
q=move(p, u, pE... | [
"numpy.zeros"
] | [((165, 176), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (173, 176), True, 'import numpy as np\n')] |
import numpy as np
from sk_dsp_comm import fec_conv
from sk_dsp_comm import digitalcom as dc
np.random.seed(100)
cc = fec_conv.FecConv()
print(cc.Nstates)
import matplotlib.pyplot as plt
import numpy as np
from sk_dsp_comm import fec_conv as fc
SNRdB = np.arange(2,12,.1)
Pb_uc = fc.conv_Pb_bound(1/2,5,[1,4,12,32,80... | [
"sk_dsp_comm.fec_conv.conv_Pb_bound",
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axis",
"sk_dsp_comm.fec_conv.FecConv",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid... | [((95, 114), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (109, 114), True, 'import numpy as np\n'), ((121, 139), 'sk_dsp_comm.fec_conv.FecConv', 'fec_conv.FecConv', ([], {}), '()\n', (137, 139), False, 'from sk_dsp_comm import fec_conv\n'), ((257, 278), 'numpy.arange', 'np.arange', (['(2)', '(12)... |
# -*- coding: utf-8 -*-
"""various utilities not related to optimization"""
from __future__ import (absolute_import, division, print_function,
) #unicode_literals, with_statement)
import os, sys, time
import warnings
import ast # ast.literal_eval is safe eval
import numpy as np
from collection... | [
"numpy.abs",
"os.path.join",
"tarfile.TarFile.gzopen",
"numpy.isscalar",
"numpy.asarray",
"numpy.ascontiguousarray",
"numpy.isnan",
"time.time",
"numpy.log10",
"numpy.diff",
"pprint.pprint",
"numpy.dot",
"shutil.rmtree",
"collections.defaultdict.__init__",
"numpy.round",
"urllib2.urlop... | [((2891, 2904), 'numpy.isnan', 'np.isnan', (['var'], {}), '(var)\n', (2899, 2904), True, 'import numpy as np\n'), ((3186, 3206), 'numpy.isscalar', 'np.isscalar', (['x[0][0]'], {}), '(x[0][0])\n', (3197, 3206), True, 'import numpy as np\n'), ((6940, 6964), 'pprint.pprint', 'pp.pprint', (['to_be_printed'], {}), '(to_be_p... |
import requests
import json
import pickle
import sys
text = "please cal"
with open('input_lang.pkl', 'rb') as input1:
input_lang = pickle.load(input1)
with open('output_lang.pkl', 'rb') as target:
target_lang = pickle.load(target)
with open('output_lang1.pkl', 'rb') as target1:
lang_target = pickle.load(t... | [
"json.loads",
"numpy.argmax",
"numpy.zeros",
"pickle.load",
"requests.post"
] | [((137, 156), 'pickle.load', 'pickle.load', (['input1'], {}), '(input1)\n', (148, 156), False, 'import pickle\n'), ((221, 240), 'pickle.load', 'pickle.load', (['target'], {}), '(target)\n', (232, 240), False, 'import pickle\n'), ((307, 327), 'pickle.load', 'pickle.load', (['target1'], {}), '(target1)\n', (318, 327), Fa... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import numpy as np
from pyiron_atomistics.atomistics.job.atomistic import AtomisticGenericJob
from pyiron_atomistics.ato... | [
"numpy.linalg.norm",
"numpy.intersect1d",
"numpy.array",
"numpy.sum"
] | [((3353, 3380), 'numpy.array', 'np.array', (['water_oxy_indices'], {}), '(water_oxy_indices)\n', (3361, 3380), True, 'import numpy as np\n'), ((3420, 3447), 'numpy.array', 'np.array', (['water_hyd_indices'], {}), '(water_hyd_indices)\n', (3428, 3447), True, 'import numpy as np\n'), ((2670, 2697), 'numpy.array', 'np.arr... |
#!/usr/bin/env python
# encoding: utf-8
#
# @Author: <NAME>
# @Date: Oct 10, 2017
# @Filename: tiling.py
# @License: BSD 3-Clause
# @Copyright: <NAME>
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import copy
import numpy as np
from astropy import coor... | [
"numpy.radians",
"copy.deepcopy",
"astropy.coordinates.Angle",
"astropy.coordinates.SkyCoord"
] | [((1690, 1718), 'astropy.coordinates.Angle', 'coo.Angle', (['angle'], {'unit': '"""deg"""'}), "(angle, unit='deg')\n", (1699, 1718), True, 'from astropy import coordinates as coo\n'), ((6275, 6316), 'copy.deepcopy', 'copy.deepcopy', (['self.target.region.shapely'], {}), '(self.target.region.shapely)\n', (6288, 6316), F... |
# Modified from: vispy: gallery 2
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# --------------------------------------------------------------... | [
"vispy.color.get_colormaps",
"vispy.visuals.transforms.STTransform",
"numpy.load",
"scipy.ndimage.distance_transform_edt",
"numpy.save",
"vispy.scene.cameras.TurntableCamera",
"vispy.scene.cameras.ArcballCamera",
"vispy.app.run",
"vispy.scene.cameras.FlyCamera",
"os.path.exists",
"numpy.asarray"... | [((2470, 2495), 'numpy.load', 'np.load', (['"""./smoothed.npy"""'], {}), "('./smoothed.npy')\n", (2477, 2495), True, 'import numpy as np\n'), ((2523, 2588), 'vispy.scene.SceneCanvas', 'scene.SceneCanvas', ([], {'keys': '"""interactive"""', 'size': '(800, 600)', 'show': '(True)'}), "(keys='interactive', size=(800, 600),... |
# Author: <NAME>
# <EMAIL>
#
# Counter needs to be configured to print to serial port at 1 Hz.
#
# Line choices optimized for D2 lamp and CsTe PMT.
import serial
import numpy as np
import sys
import vm502
# Wavelengths for scan
LAMBDA = ['65.0', '116.9', '117.9', '118.9', '119.7',
'120.6', '121.4', '122.8... | [
"serial.Serial",
"vm502.vm502_get_lambda",
"vm502.vm502_goto",
"numpy.average",
"numpy.std",
"numpy.array",
"numpy.column_stack"
] | [((1218, 1229), 'numpy.array', 'np.array', (['l'], {}), '(l)\n', (1226, 1229), True, 'import numpy as np\n'), ((1304, 1340), 'serial.Serial', 'serial.Serial', (['mp', '(9600)'], {'timeout': '(5.0)'}), '(mp, 9600, timeout=5.0)\n', (1317, 1340), False, 'import serial\n'), ((1352, 1388), 'serial.Serial', 'serial.Serial', ... |
#!/usr/bin/env python
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from builtins import zip
from builtins import str
from builtins import map
from past.utils import old_div
import numpy as np
from math import radians, cos, sin
from .spacegroup import Spa... | [
"subprocess.Popen",
"spacegroup.expand_to_p1",
"spacegroup.generate_hkl_listing",
"past.utils.old_div",
"math.radians",
"numpy.power",
"re.match",
"IPython.embed",
"math.sin",
"re.findall",
"numpy.array",
"math.cos",
"builtins.str",
"builtins.map",
"re.compile"
] | [((609, 638), 're.compile', 're.compile', (['"""([A-z]+|[0-9]+)"""'], {}), "('([A-z]+|[0-9]+)')\n", (619, 638), False, 'import re\n'), ((647, 675), 're.findall', 're.findall', (['pat', 'composition'], {}), '(pat, composition)\n', (657, 675), False, 'import re\n'), ((14072, 14098), 'spacegroup.generate_hkl_listing', 'ge... |
import numpy as np
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_absolute_error, mean_squared_error
from PyEMD import CEEMDAN # Empirical Mode Decomposition (EMD). Most popular expan... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"pandas.DataFrame.from_dict",
"matplotlib.pyplot.plot",
"numpy.abs",
"datetime.datetime.today",
"numpy.frombuffer",
"matplotlib.pyplot.legend",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.metrics.mean_absolute_error",
... | [((3878, 3913), 'PyEMD.CEEMDAN', 'CEEMDAN', ([], {'parallel': '(True)', 'processes': '(8)'}), '(parallel=True, processes=8)\n', (3885, 3913), False, 'from PyEMD import CEEMDAN\n'), ((10470, 10512), 'pandas.DataFrame', 'pd.DataFrame', (['train_dict'], {'columns': 'features'}), '(train_dict, columns=features)\n', (10482,... |
import os
import cv2
import numpy as np
import io
import random, math
from utils.data_aug import random_crop, random_translate, random_scale, scale_crop
from utils.lpr_util import sparse_tuple_from, CHARS_DICT, decode_sparse_tensor
provinces = ["皖", "沪", "津", "渝", "冀", "晋", "蒙", "辽", "吉", "黑", "苏", "浙", "京", "闽", "赣",... | [
"numpy.maximum",
"random.shuffle",
"numpy.ones",
"numpy.clip",
"utils.data_aug.random_crop",
"numpy.random.randint",
"numpy.exp",
"os.path.join",
"numpy.pad",
"utils.data_aug.random_scale",
"cv2.cvtColor",
"numpy.finfo",
"numpy.reshape",
"cv2.resize",
"math.ceil",
"utils.data_aug.scale... | [((1375, 1409), 'os.path.join', 'os.path.join', (['self.img_dir', 'img_id'], {}), '(self.img_dir, img_id)\n', (1387, 1409), False, 'import os\n'), ((1509, 1545), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(img, cv2.COLOR_BGR2RGB)\n', (1521, 1545), False, 'import cv2\n'), ((1684, 1719), 'utils.... |
from render_util import get_shader_dirname
import glob
import os
import numpy
import numpy as np
import skimage
import skimage.io
import scipy.ndimage
import sys
sys.path += ['..']
import argparse_util
tolerance = 2.0
dtype = 'float32'
lo_pct = 20
hi_pct = 80
# Make a simplified normalization assumption
# Once we u... | [
"numpy.load",
"numpy.moveaxis",
"render_util.get_shader_dirname",
"numpy.asarray",
"numpy.zeros",
"numpy.isinf",
"argparse_util.ArgumentParser",
"numpy.isnan",
"numpy.searchsorted",
"numpy.sort",
"numpy.finfo",
"os.path.join"
] | [((2698, 2718), 'numpy.load', 'numpy.load', (['filename'], {}), '(filename)\n', (2708, 2718), False, 'import numpy\n'), ((2827, 2874), 'numpy.moveaxis', 'numpy.moveaxis', (['ans', '[0, 1, 2, 3]', '[3, 2, 0, 1]'], {}), '(ans, [0, 1, 2, 3], [3, 2, 0, 1])\n', (2841, 2874), False, 'import numpy\n'), ((3270, 3331), 'argpars... |
import cv2
import numpy as np
import dlib
from imutils import face_utils
import math
def sigmoid(x):
return 1 / (1 + math.exp(-x))
from src.analysis_module import PoseAnalyser
## Template borrowed from Openface project (for author credits view README.md)
### https://github.com/cmusatyalab/openface/blob/maste... | [
"cv2.line",
"math.exp",
"cv2.circle",
"cv2.putText",
"numpy.float32",
"cv2.solvePnP",
"cv2.projectPoints",
"numpy.max",
"numpy.min",
"cv2.Rodrigues",
"cv2.hconcat",
"dlib.get_frontal_face_detector",
"imutils.face_utils.shape_to_np",
"numpy.array",
"dlib.shape_predictor",
"cv2.decompose... | [((356, 2827), 'numpy.float32', 'np.float32', (['[(0.0792396913815, 0.339223741112), (0.0829219487236, 0.456955367943), (\n 0.0967927109165, 0.575648016728), (0.122141515615, 0.691921601066), (\n 0.168687863544, 0.800341263616), (0.239789390707, 0.895732504778), (\n 0.325662452515, 0.977068762493), (0.42231828... |
"""End-to-end, Variational Autoencoder (VAE) - MNIST
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import sys
import time
from six.moves import urllib
from six.moves import xrange # pylint: disable=redefined-builtin
import tenso... | [
"tensorflow.gfile.Exists",
"tensorflow.gfile.MakeDirs",
"gzip.open",
"numpy.frombuffer",
"encoder.FC_Encoder",
"tensorflow.train.SummaryWriter",
"tensorflow.Session",
"tensorflow.get_variable_scope",
"decoder.FC_Decoder",
"vae.VAE",
"tensorflow.placeholder",
"time.time",
"tensorflow.gfile.GF... | [((2667, 2719), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(BATCH_SIZE, SIZE)'}), '(tf.float32, shape=(BATCH_SIZE, SIZE))\n', (2681, 2719), True, 'import tensorflow as tf\n'), ((2738, 2790), 'encoder.FC_Encoder', 'FC_Encoder', (['SIZE', 'LATENT_SIZE', 'NUM_NODES', 'NUM_LAYERS'], {}), '(SIZE... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import datetime
import logging
import time
from collections import OrderedDict
from contextlib import contextmanager
import torch
import cv2
import numpy as np
import os.path as osp
from detectron2.utils.comm import is_main_process
from detectron2.... | [
"torch.distributed.is_initialized",
"torch.cuda.synchronize",
"numpy.uint8",
"cv2.cvtColor",
"logging.getLogger",
"time.time",
"cv2.rectangle",
"cv2.addWeighted",
"numpy.min",
"numpy.max",
"datetime.timedelta",
"torch.distributed.get_world_size",
"cv2.applyColorMap",
"collections.OrderedDi... | [((3571, 3598), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3588, 3598), False, 'import logging\n'), ((3875, 3886), 'time.time', 'time.time', ([], {}), '()\n', (3884, 3886), False, 'import time\n'), ((9279, 9322), 'cv2.resize', 'cv2.resize', (['img'], {'dsize': '(target_w, target_h)'}... |
# pylint: disable=missing-function-docstring, missing-module-docstring/
# coding: utf-8
from pyccel.stdlib.internal.mpi import mpi_init
from pyccel.stdlib.internal.mpi import mpi_finalize
from pyccel.stdlib.internal.mpi import mpi_comm_size
from pyccel.stdlib.internal.mpi import mpi_comm_rank
from pyccel.stdlib.intern... | [
"pyccel.stdlib.internal.mpi.mpi_bcast",
"numpy.zeros",
"pyccel.stdlib.internal.mpi.mpi_finalize",
"pyccel.stdlib.internal.mpi.mpi_init",
"pyccel.stdlib.internal.mpi.mpi_comm_free",
"pyccel.stdlib.internal.mpi.mpi_comm_size",
"numpy.int32",
"pyccel.stdlib.internal.mpi.mpi_comm_split",
"pyccel.stdlib.... | [((764, 776), 'numpy.int32', 'np.int32', (['(-1)'], {}), '(-1)\n', (772, 776), True, 'import numpy as np\n'), ((789, 801), 'numpy.int32', 'np.int32', (['(-1)'], {}), '(-1)\n', (797, 801), True, 'import numpy as np\n'), ((822, 834), 'numpy.int32', 'np.int32', (['(-1)'], {}), '(-1)\n', (830, 834), True, 'import numpy as ... |
import matplotlib.pyplot as plt
import numpy as np
import skimage
import utils
def convolve_im(im: np.array,
fft_kernel: np.array,
verbose=True):
""" Convolves the image (im) with the frequency kernel (fft_kernel),
and returns the resulting image.
"verbose" can b... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.abs",
"utils.uint8_to_float",
"matplotlib.pyplot.imshow",
"utils.create_low_pass_frequency_kernel",
"matplotlib.pyplot.figure",
"utils.create_high_pass_frequency_kernel",
"numpy.fft.fft2",
"numpy.real",
"s... | [((720, 735), 'numpy.fft.fft2', 'np.fft.fft2', (['im'], {}), '(im)\n', (731, 735), True, 'import numpy as np\n'), ((821, 854), 'numpy.fft.ifft2', 'np.fft.ifft2', (['(fft_im * fft_kernel)'], {}), '(fft_im * fft_kernel)\n', (833, 854), True, 'import numpy as np\n'), ((918, 941), 'numpy.real', 'np.real', (['inverse_fft_im... |
import unittest
import numpy as np
import pandas as pd
from grafener.energyplus import process_csv
class TestEnergyPlusDataProcessing(unittest.TestCase):
def test_sim_year(self):
df = pd.DataFrame.from_dict({"Date/Time": [" 01/01 00:15:00", " 01/01 00:30:00", " 01/01 00:45:00"],
... | [
"numpy.datetime64",
"numpy.arange",
"grafener.energyplus.process_csv"
] | [((379, 409), 'grafener.energyplus.process_csv', 'process_csv', (['df'], {'sim_year': '(2020)'}), '(df, sim_year=2020)\n', (390, 409), False, 'from grafener.energyplus import process_csv\n'), ((526, 556), 'grafener.energyplus.process_csv', 'process_csv', (['df'], {'sim_year': '(2021)'}), '(df, sim_year=2021)\n', (537, ... |
import numpy as np
import argparse
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='remove odd data for 3c beyond some criteria')
## args
parser.add_argument('-i', '--input', default='fit2.value', nargs='?',
help='input list file of transition densities/tempera... | [
"numpy.average",
"argparse.ArgumentParser",
"numpy.std",
"numpy.append",
"numpy.array",
"numpy.loadtxt"
] | [((44, 192), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""remove odd data for 3c beyond some criteria"""'}), "(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, description=\n 'remove odd data for 3c beyond som... |
#!/usr/bin/env python
"""Check Points class (constructed from ROOT objects)"""
from load import ROOT as R
from matplotlib import pyplot as plt
import numpy as np
import gna.constructors as C
from gna import context
from mpl_toolkits.mplot3d import Axes3D
from mpl_tools import bindings
from mpl_tools.helpers import sa... | [
"matplotlib.pyplot.subplot",
"numpy.logspace",
"matplotlib.pyplot.close",
"gna.constructors.Histogram2d",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.linspace",
"mpl_tools.helpers.savefig",
"gna.constructors.Histogram",
"numpy.all"
] | [((413, 435), 'numpy.logspace', 'np.logspace', (['(-3)', '(3)', '(40)'], {}), '(-3, 3, 40)\n', (424, 435), True, 'import numpy as np\n'), ((448, 485), 'numpy.arange', 'np.arange', (['(1.0)', 'edges.size'], {'dtype': '"""d"""'}), "(1.0, edges.size, dtype='d')\n", (457, 485), True, 'import numpy as np\n'), ((497, 521), '... |
import numpy as np
from astropy.table import Table
from xwavecal.tests.utils import FakeContext, FakeImage
from xwavecal.utils.basic_utils import median_subtract_channels_y
from xwavecal import basic
class TestBasic:
CONTEXT = FakeContext()
def test_gain_normalizer(self):
image = FakeImage()
... | [
"xwavecal.basic.MedianSubtractReadoutsAlongY",
"xwavecal.basic.Trimmer",
"numpy.allclose",
"numpy.zeros",
"numpy.ones",
"xwavecal.basic.GainNormalizer",
"xwavecal.tests.utils.FakeContext",
"xwavecal.tests.utils.FakeImage",
"numpy.arange",
"numpy.array",
"xwavecal.basic.OverscanSubtractor",
"xw... | [((234, 247), 'xwavecal.tests.utils.FakeContext', 'FakeContext', ([], {}), '()\n', (245, 247), False, 'from xwavecal.tests.utils import FakeContext, FakeImage\n'), ((301, 312), 'xwavecal.tests.utils.FakeImage', 'FakeImage', ([], {}), '()\n', (310, 312), False, 'from xwavecal.tests.utils import FakeContext, FakeImage\n'... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
__author__ = '<NAME>'
from collections import defaultdict
from itertools import tee, zip
import matplotlib.pyplot as plt
import numpy as np
from numpy import float64
p_x, p_y = lambda p: p[0], lambda p: p[1]
def get_rightest_point(points):
return max(points, k... | [
"matplotlib.pyplot.show",
"collections.defaultdict",
"itertools.zip",
"matplotlib.pyplot.figure",
"numpy.fromiter",
"itertools.tee",
"numpy.float64"
] | [((741, 754), 'itertools.tee', 'tee', (['iterable'], {}), '(iterable)\n', (744, 754), False, 'from itertools import tee, zip\n'), ((784, 793), 'itertools.zip', 'zip', (['a', 'b'], {}), '(a, b)\n', (787, 793), False, 'from itertools import tee, zip\n'), ((1765, 1782), 'collections.defaultdict', 'defaultdict', (['list'],... |
import colorsys
import random
import os
import numpy as np
from yolo import YOLO
from PIL import Image
import cv2
import math
#import cv2 as cv
#import argparse
import matplotlib.pyplot as plt
video_path = "D:/test.mp4"
output_path = "D:/0.mp4"
ImageDir = os.listdir("D:/test/testimages")
j = 0
a = 0
b... | [
"cv2.medianBlur",
"numpy.floor",
"numpy.shape",
"numpy.sin",
"cv2.VideoWriter",
"cv2.imshow",
"cv2.line",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.destroyAllWindows",
"cv2.resize",
"yolo.YOLO",
"cv2.Canny",
"cv2.waitKey",
"numpy.asarray",
"cv2.HoughLines",
"numpy.cos",
"os.listdir",
"... | [((271, 303), 'os.listdir', 'os.listdir', (['"""D:/test/testimages"""'], {}), "('D:/test/testimages')\n", (281, 303), False, 'import os\n'), ((9468, 9487), 'yolo.YOLO', 'YOLO', ([], {}), '(**yolov3_args)\n', (9472, 9487), False, 'from yolo import YOLO\n'), ((9505, 9533), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video... |
import os
import time
import math
from typing import Optional, Tuple
from itertools import zip_longest
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from ufotest.util import cprint, cresult
from ufotest.util import setup_environment, random_string, force_aspect
from ufotest.ca... | [
"numpy.sum",
"numpy.mean",
"numpy.ma.masked_array",
"ufotest.testing.DictTestResult",
"ufotest.testing.CombinedTestResult",
"os.path.join",
"ufotest.testing.FigureTestResult",
"ufotest.util.setup_environment",
"matplotlib.colors.Normalize",
"numpy.std",
"numpy.cumsum",
"numpy.max",
"matplotl... | [((1958, 1998), 'ufotest.testing.AbstractTest.__init__', 'AbstractTest.__init__', (['self', 'test_runner'], {}), '(self, test_runner)\n', (1979, 1998), False, 'from ufotest.testing import AbstractTest, TestRunner, ImageTestResult, CombinedTestResult, DictTestResult, FigureTestResult\n'), ((2555, 2609), 'os.path.join', ... |
import random
import numpy as np
from tqdm import tqdm
from collections import defaultdict
from scipy.sparse import identity
import os
import pickle
def parallel_generate_walks(d_graph: dict, global_walk_length: int, num_walks: int, cpu_num: int,
sampling_strategy: dict = None, num_walks_ke... | [
"numpy.sum",
"random.shuffle",
"scipy.sparse.identity",
"numpy.random.choice",
"os.path.join"
] | [((4499, 4536), 'os.path.join', 'os.path.join', (['output_folder', 'filename'], {}), '(output_folder, filename)\n', (4511, 4536), False, 'import os\n'), ((5038, 5075), 'os.path.join', 'os.path.join', (['output_folder', 'filename'], {}), '(output_folder, filename)\n', (5050, 5075), False, 'import os\n'), ((5527, 5564), ... |
# -*- coding: utf-8 -*-
import os
from typing import Dict, Callable, List, Optional, Tuple
import numpy as np
import matplotlib.pyplot as plt
from time import time
try:
import sklearn.cluster
except ModuleNotFoundError as e:
print(e)
try:
import pyclustering.cluster.kmedoids
import pyclustering.... | [
"os.mkdir",
"pickle.dump",
"stochoptim.scengen.scenario_tree.ScenarioTree.from_file",
"numpy.ones",
"pickle.load",
"numpy.mean",
"os.path.join",
"numpy.unique",
"numpy.set_printoptions",
"os.path.exists",
"numpy.max",
"matplotlib.pyplot.subplots",
"stochoptim.scengen.decision_process.Decisio... | [((10192, 10247), 'stochoptim.scenclust.cost_space_partition.CostSpaceScenarioPartitioning', 'CostSpaceScenarioPartitioning', (['self._opport_cost_matrix'], {}), '(self._opport_cost_matrix)\n', (10221, 10247), False, 'from stochoptim.scenclust.cost_space_partition import CostSpaceScenarioPartitioning\n'), ((10270, 1027... |
import numpy as np
import torch
import csv
import os
import cv2
import math
import random
import json
import pickle
import os.path as osp
from lietorch import SE3
from .stream import RGBDStream
from .rgbd_utils import loadtum
intrinsics_dict = {
'freiburg1': [517.3, 516.5, 318.6, 255.3],
'freiburg2': [520.9... | [
"numpy.eye",
"cv2.imread",
"numpy.array",
"torch.as_tensor",
"cv2.undistort"
] | [((621, 630), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (627, 630), True, 'import numpy as np\n'), ((2195, 2217), 'cv2.imread', 'cv2.imread', (['image_file'], {}), '(image_file)\n', (2205, 2217), False, 'import cv2\n'), ((2233, 2264), 'cv2.undistort', 'cv2.undistort', (['image', 'K', 'd_coef'], {}), '(image, K, d_... |
# Copyright 2021 University College London. 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 appl... | [
"tensorflow_mri.python.ops.image_ops.psnr3d",
"numpy.arctan2",
"tensorflow_mri.python.util.io_util.read_hdf5",
"tensorflow_mri.python.ops.image_ops.total_variation",
"tensorflow.reshape",
"numpy.floor",
"tensorflow_mri.python.ops.image_ops.extract_glimpses",
"tensorflow_mri.python.ops.image_ops._birdc... | [((24037, 24100), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['"""shepp_logan"""', '"""modified_shepp_logan"""'], {}), "('shepp_logan', 'modified_shepp_logan')\n", (24061, 24100), False, 'from absl.testing import parameterized\n'), ((24400, 24463), 'absl.testing.parameterized.parameters', 'pa... |
#!/usr/bin/env python
"""
Provided by <NAME>. Thanks!
"""
import sys
import numpy as np
from astropy import constants as c
import pyPLUTO as pp
GAMMA= 5.0 / 3.0
#First get scaling factorz from the definitions file
inp=open('definitions.h','ro')
for line in inp.readlines():
data=line.split()
if len(data)>1:
i... | [
"pyPLUTO.pload",
"numpy.transpose",
"numpy.sqrt"
] | [((987, 1002), 'pyPLUTO.pload', 'pp.pload', (['fname'], {}), '(fname)\n', (995, 1002), True, 'import pyPLUTO as pp\n'), ((1588, 1616), 'numpy.sqrt', 'np.sqrt', (['(v_r ** 2 + v_t ** 2)'], {}), '(v_r ** 2 + v_t ** 2)\n', (1595, 1616), True, 'import numpy as np\n'), ((1044, 1063), 'numpy.transpose', 'np.transpose', (['D.... |
from . import *
from .arctor import *
# from . import Arctor
import exoplanet as xo
import numpy as np
import os
import pygtc
import pymc3 as pm
import starry
import theano.tensor as tt
from statsmodels.robust.scale import mad
from astropy.io import fits
from astropy.stats import mad_std, sigma_clip
from astropy.tim... | [
"starry.Primary",
"numpy.sum",
"exoplanet.optimize",
"numpy.random.seed",
"pymc3.math.sum",
"pymc3.Deterministic",
"numpy.allclose",
"pymc3.Normal",
"numpy.ones",
"numpy.mean",
"pymc3.Uniform",
"numpy.arange",
"starry.System",
"os.path.join",
"astropy.stats.sigma_clip",
"theano.tensor.... | [((853, 902), 'numpy.median', 'np.median', (['phot_vals.iloc[planet.idx_rev]'], {'axis': '(0)'}), '(phot_vals.iloc[planet.idx_rev], axis=0)\n', (862, 902), True, 'import numpy as np\n'), ((920, 969), 'numpy.median', 'np.median', (['phot_vals.iloc[planet.idx_rev]'], {'axis': '(0)'}), '(phot_vals.iloc[planet.idx_rev], ax... |
#!/usr/bin/env python
import os
import glob
import sys
import shutil
import pdb
import re
from argparse import ArgumentParser
import pandas as pd
import numpy as np
import math
import matplotlib.pyplot as plt
import seaborn as sns
sys.path.insert(0,'..')
import ESM_utils as esm
from scipy.optimize import curve_fi... | [
"matplotlib.pyplot.title",
"numpy.absolute",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.preprocessing.MinMaxScaler",
"ESM_utils.Prepare_Inputs_for_ESM",
"matplotlib.pyplot.figure",
"numpy.exp",
"glob.glob",
"os.path.join",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"ma... | [((237, 261), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (252, 261), False, 'import sys\n'), ((1093, 1119), 'pandas.concat', 'pd.concat', (['ab_prob_df_list'], {}), '(ab_prob_df_list)\n', (1102, 1119), True, 'import pandas as pd\n'), ((2921, 2949), 'matplotlib.pyplot.figure', 'plt.f... |
"""
The model's parameters module
=============================
This module defines the main classes containing the model configuration parameters.
The parameters are typically specified as :class:`~.params.parameter.Parameter` objects.
There are seven types of parameters arranged in classes:
... | [
"pickle.dump",
"qgs.basis.fourier.ChannelFourierBasis",
"qgs.params.parameter.Parameter",
"qgs.basis.fourier.BasinFourierBasis",
"numpy.zeros",
"pickle.load",
"numpy.array",
"qgs.basis.fourier.contiguous_basin_basis",
"numpy.sin",
"numpy.cos",
"warnings.warn",
"qgs.basis.fourier.contiguous_cha... | [((7259, 7286), 'numpy.array', 'np.array', (['arr'], {'dtype': 'object'}), '(arr, dtype=object)\n', (7267, 7286), True, 'import numpy as np\n'), ((7826, 7850), 'pickle.load', 'pickle.load', (['f'], {}), '(f, **kwargs)\n', (7837, 7850), False, 'import pickle\n'), ((8343, 8382), 'pickle.dump', 'pickle.dump', (['self.__di... |
#!/usr/bin/python
"""
c60mc gives yout the equilibrium configuration of the anti-ferromagnetic Ising model on the c60 lattice using the Monte Carlo simulation method.
"""
import numpy as np
def totalE(x, l):
"""
Parmeters:
x The spin configuration on the Buckyball lattice.
l The Buckyball... | [
"numpy.load",
"numpy.zeros",
"numpy.mean",
"numpy.random.randint",
"numpy.exp",
"numpy.random.rand"
] | [((1381, 1400), 'numpy.zeros', 'np.zeros', (['(num, 60)'], {}), '((num, 60))\n', (1389, 1400), True, 'import numpy as np\n'), ((1414, 1442), 'numpy.random.randint', 'np.random.randint', (['(-1)', '(1)', '(60)'], {}), '(-1, 1, 60)\n', (1431, 1442), True, 'import numpy as np\n'), ((1552, 1588), 'numpy.random.randint', 'n... |
# -*- coding: utf-8 -*-
import numpy as np
from sklearn.datasets import load_digits
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.preprocessing import LabelBinarizer
from NeuralNetwork import NeuralNetwork
from sklearn.cross_validation import train_test_split
digits = load_digits()
X... | [
"sklearn.datasets.load_digits",
"sklearn.cross_validation.train_test_split",
"sklearn.preprocessing.LabelBinarizer",
"numpy.argmax",
"sklearn.metrics.classification_report",
"sklearn.metrics.confusion_matrix",
"NeuralNetwork.NeuralNetwork"
] | [((305, 318), 'sklearn.datasets.load_digits', 'load_digits', ([], {}), '()\n', (316, 318), False, 'from sklearn.datasets import load_digits\n'), ((385, 425), 'NeuralNetwork.NeuralNetwork', 'NeuralNetwork', (['[64, 100, 10]', '"""logistic"""'], {}), "([64, 100, 10], 'logistic')\n", (398, 425), False, 'from NeuralNetwork... |
# -*- coding: utf-8 -*-
import sys
import numpy as np
import pickle
import matplotlib.pyplot as plt
from collections import Counter
#import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from sklearn.manifold import TSNE
import random
import time
from ogm import viz_ogm, grid_index_to_array... | [
"tensorflow.compat.v1.zeros",
"tensorflow.compat.v1.reduce_mean",
"tensorflow.compat.v1.transpose",
"tensorflow.compat.v1.GPUOptions",
"numpy.random.randint",
"tensorflow.compat.v1.truncated_normal",
"tensorflow.compat.v1.global_variables_initializer",
"tensorflow.compat.v1.square",
"tensorflow.comp... | [((191, 215), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (213, 215), True, 'import tensorflow.compat.v1 as tf\n'), ((1236, 1273), 'numpy.random.randint', 'np.random.randint', (['(1)', '(window_size + 1)'], {}), '(1, window_size + 1)\n', (1253, 1273), True, 'import numpy as n... |
import unittest
from dynd import nd, ndt
import numpy as np
from numpy.testing import *
@unittest.skip('Test disabled since callables were reworked')
class TestNumpyDTypeInterop(unittest.TestCase):
def setUp(self):
if sys.byteorder == 'little':
self.nonnative = '>'
else:
sel... | [
"numpy.bool_",
"dynd.ndt.float32.as_numpy",
"dynd.ndt.complex_float32.as_numpy",
"numpy.uint32",
"numpy.uint64",
"dynd.ndt.float64.as_numpy",
"dynd.nd.asarray",
"numpy.arange",
"dynd.nd.type_of",
"dynd.ndt.type",
"numpy.float64",
"numpy.complex64",
"numpy.int8",
"unittest.main",
"dynd.nd... | [((90, 150), 'unittest.skip', 'unittest.skip', (['"""Test disabled since callables were reworked"""'], {}), "('Test disabled since callables were reworked')\n", (103, 150), False, 'import unittest\n'), ((7349, 7409), 'unittest.skip', 'unittest.skip', (['"""Test disabled since callables were reworked"""'], {}), "('Test ... |
import os.path
import numpy as np
import librosa
import matplotlib.pyplot as plt
from madmom.audio.signal import *
def featureExtract(FILE_NAME):
try:
y= Signal(FILE_NAME, sample_rate=16000,dtype=np.float32,num_channels=1)
sr = y.sample_rate
mel_S = librosa.feature.melspectrogram(y, sr=sr... | [
"numpy.load",
"librosa.power_to_db",
"numpy.zeros",
"librosa.feature.melspectrogram"
] | [((641, 680), 'numpy.zeros', 'np.zeros', ([], {'shape': '(num_frames, 75, 80, 1)'}), '(shape=(num_frames, 75, 80, 1))\n', (649, 680), True, 'import numpy as np\n'), ((1011, 1047), 'numpy.load', 'np.load', (['"""./x_data_mean_svad_75.npy"""'], {}), "('./x_data_mean_svad_75.npy')\n", (1018, 1047), True, 'import numpy as ... |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2018 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation ... | [
"chocolate.SQLiteConnection",
"numpy.average",
"pyannote.database.get_annotated",
"numpy.asscalar"
] | [((7585, 7635), 'chocolate.SQLiteConnection', 'chocolate.SQLiteConnection', (['f"""sqlite:///{tune_db}"""'], {}), "(f'sqlite:///{tune_db}')\n", (7611, 7635), False, 'import chocolate\n'), ((3157, 3184), 'pyannote.database.get_annotated', 'get_annotated', (['current_file'], {}), '(current_file)\n', (3170, 3184), False, ... |
import warnings
from copy import deepcopy
import numpy as np
from pydace import Dace
from scipy.linalg import norm
from ..core.nlp import optimize_nlp
from ..core.options.nlp import DockerNLPOptions, NLPOptions
from ..core.procedures import InfillProcedure
from ..core.procedures.output import Report
from ..core.utils... | [
"copy.deepcopy",
"numpy.greater",
"numpy.ones",
"numpy.all",
"numpy.argmin",
"numpy.any",
"numpy.append",
"numpy.max",
"scipy.linalg.norm",
"numpy.less",
"warnings.warn",
"pydace.Dace",
"numpy.vstack"
] | [((8576, 8592), 'copy.deepcopy', 'deepcopy', (['self.x'], {}), '(self.x)\n', (8584, 8592), False, 'from copy import deepcopy\n'), ((8614, 8630), 'copy.deepcopy', 'deepcopy', (['self.g'], {}), '(self.g)\n', (8622, 8630), False, 'from copy import deepcopy\n'), ((8652, 8668), 'copy.deepcopy', 'deepcopy', (['self.f'], {}),... |
from rollerpy.models.curve import Curve, ParametricCurve, NoramlizedCurve
import numpy as np
class HelixCircleParam(Curve, ParametricCurve, NoramlizedCurve):
def __init__(
self, A, B, C=1, tmin=0, tmax=np.pi, n=100, initialPosition=[0, 0, 0]
):
# Helix parameters
self.A = A
se... | [
"numpy.sin",
"numpy.cos",
"numpy.linspace"
] | [((518, 554), 'numpy.linspace', 'np.linspace', (['self.tmin', 'self.tmax', 'n'], {}), '(self.tmin, self.tmax, n)\n', (529, 554), True, 'import numpy as np\n'), ((1866, 1892), 'numpy.linspace', 'np.linspace', (['tmin', 'tmax', 'n'], {}), '(tmin, tmax, n)\n', (1877, 1892), True, 'import numpy as np\n'), ((1025, 1039), 'n... |
# -*- coding: utf-8 -*-
""" Code for generating plots
"""
import matplotlib.pyplot as plt
import mne
import neo
import nibabel as nib
from nibabel.affines import apply_affine
import nilearn
from nilearn.input_data import NiftiMasker
from nilearn.mass_univariate import permuted_ols
from nilearn.plotting import plot_st... | [
"matplotlib.pyplot.NullLocator",
"matplotlib.pyplot.plot",
"numpy.std",
"matplotlib.pyplot.figure",
"numpy.mean",
"matplotlib.pyplot.subplots"
] | [((1059, 1093), 'matplotlib.pyplot.subplots', 'plt.subplots', (['rows', '(1)'], {'sharex': '(True)'}), '(rows, 1, sharex=True)\n', (1071, 1093), True, 'import matplotlib.pyplot as plt\n'), ((2056, 2068), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (2066, 2068), True, 'import matplotlib.pyplot as plt\n')... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 10 20:01:20 2020
@author: login
"""
import pandas as pd
import matplotlib.pyplot as plt
import pylab as pl
import numpy as np
import sklearn.linear_model as sklm
from sklearn.metrics import r2_score as skmr2
#File Path
file_Address="F:\\KamyabJawan Prog... | [
"matplotlib.pyplot.title",
"numpy.absolute",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"numpy.asanyarray",
"sklearn.metrics.r2_score",
"sklearn.linear_model.LinearRegression",
"numpy.mean",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((400, 425), 'pandas.read_csv', 'pd.read_csv', (['file_Address'], {}), '(file_Address)\n', (411, 425), True, 'import pandas as pd\n'), ((1973, 1996), 'sklearn.linear_model.LinearRegression', 'sklm.LinearRegression', ([], {}), '()\n', (1994, 1996), True, 'import sklearn.linear_model as sklm\n'), ((2006, 2042), 'numpy.a... |
"""
Performance check of AutoGL model + PYG (trainer + dataset)
"""
import os
import random
import numpy as np
from tqdm import tqdm
import pickle
import torch
import torch.nn.functional as F
from torch_geometric.datasets import Planetoid
import torch_geometric.transforms as T
from torch_geometric.nn import GCNConv, G... | [
"pickle.loads",
"torch_geometric.nn.GCNConv",
"numpy.random.seed",
"argparse.ArgumentParser",
"logging.basicConfig",
"torch.nn.ModuleList",
"numpy.std",
"torch.manual_seed",
"torch_geometric.transforms.NormalizeFeatures",
"torch_geometric.nn.SAGEConv",
"torch.nn.functional.dropout",
"numpy.mea... | [((353, 393), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.ERROR'}), '(level=logging.ERROR)\n', (372, 393), False, 'import logging\n'), ((3246, 3282), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""pyg model"""'], {}), "('pyg model')\n", (3269, 3282), False, 'import argparse\n'), (... |
from .lin_op import LinOp
import numpy as np
import cv2
from proximal.halide.halide import Halide
from proximal.utils.utils import Impl
class warp(LinOp):
"""Warp using a homography.
"""
def __init__(self, arg, H, implem=None):
self.H = H.copy()
# Compute inverse
self.Hinv = np.... | [
"numpy.zeros",
"numpy.asfortranarray",
"numpy.reshape",
"proximal.halide.halide.Halide",
"numpy.copyto",
"numpy.linalg.pinv"
] | [((317, 334), 'numpy.zeros', 'np.zeros', (['H.shape'], {}), '(H.shape)\n', (325, 334), True, 'import numpy as np\n'), ((511, 528), 'numpy.linalg.pinv', 'np.linalg.pinv', (['H'], {}), '(H)\n', (525, 528), True, 'import numpy as np\n'), ((446, 472), 'numpy.linalg.pinv', 'np.linalg.pinv', (['H[:, :, j]'], {}), '(H[:, :, j... |
import numpy as np
import scipy.special as sp
# import matplotlib.pyplot as plt
import math
import pyvista as pv
# from pyvistaqt import BackgroundPlotter
# import time
#
# Purpose: Check out the kernel function for imaginary frequency
# Parameters
# L = 30.0 # 2.0 * np.pi / 1.4 # 10.0 # larmor radii
# k = 2.0 * np.... | [
"numpy.multiply",
"pyvista.StructuredGrid",
"numpy.amin",
"numpy.ones_like",
"pyvista.Plotter",
"numpy.amax",
"numpy.sin",
"numpy.exp",
"numpy.real",
"numpy.linspace",
"numpy.cos",
"math.factorial",
"scipy.special.jv"
] | [((504, 535), 'numpy.linspace', 'np.linspace', (['(1e-06)', '(8.5)'], {'num': '(75)'}), '(1e-06, 8.5, num=75)\n', (515, 535), True, 'import numpy as np\n'), ((543, 578), 'numpy.linspace', 'np.linspace', (['(0)', '(2.0 * np.pi)'], {'num': '(75)'}), '(0, 2.0 * np.pi, num=75)\n', (554, 578), True, 'import numpy as np\n'),... |
import numpy as np
import pandas as pd
from sklearn.manifold import TSNE
from sklearn.preprocessing import scale
import os
import sys
from collections import Counter
sys.path.append('../../../../PlotUtils')
from Population import Population
def get_y_est(path_to_experiment, I):
path = [f'{path_to_experiment}/img/... | [
"sys.path.append",
"pandas.DataFrame",
"numpy.full",
"os.makedirs",
"sklearn.manifold.TSNE",
"sklearn.preprocessing.scale",
"collections.Counter",
"numpy.vstack",
"numpy.arange",
"numpy.loadtxt",
"Population.Population",
"numpy.concatenate"
] | [((167, 207), 'sys.path.append', 'sys.path.append', (['"""../../../../PlotUtils"""'], {}), "('../../../../PlotUtils')\n", (182, 207), False, 'import sys\n'), ((536, 548), 'numpy.vstack', 'np.vstack', (['y'], {}), '(y)\n', (545, 548), True, 'import numpy as np\n'), ((743, 770), 'numpy.concatenate', 'np.concatenate', (['... |
from unittest import TestCase
import numpy.testing as npt
import dlpy.maths as dlm
import numpy as np
class Test(TestCase):
def test_linear_interp(self):
npt.assert_almost_equal(dlm.linear_interp(0.5, 0, 0, 1, 1), 0.5)
npt.assert_almost_equal(dlm.linear_interp(400, 100, 0, 500, 1), 0.75)
n... | [
"numpy.testing.assert_almost_equal",
"dlpy.maths.decay_exponential",
"numpy.testing.assert_array_equal",
"dlpy.maths.pw_linear",
"dlpy.maths.decay_linear",
"dlpy.maths.linear_interp",
"numpy.testing.assert_array_almost_equal"
] | [((433, 467), 'dlpy.maths.decay_linear', 'dlm.decay_linear', (['(100)', '(1)', '(1)', '(-1)', '(0)'], {}), '(100, 1, 1, -1, 0)\n', (449, 467), True, 'import dlpy.maths as dlm\n'), ((476, 515), 'numpy.testing.assert_almost_equal', 'npt.assert_almost_equal', (['value', '(1 / 100)'], {}), '(value, 1 / 100)\n', (499, 515),... |
# @verbatim
# This file contains functions that can be used to build circuit models
# representing the electrical behaviour of neural electrodes.
# The models used are
# @endverbatim
import numpy as np
import matplotlib.pyplot as plt
## Impedances
def imp_cap(cap, f):
# Equivalent impedance of a capacitor
# c... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.angle",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.cosh",
"matplotlib.pyplot.ylabel",
"numpy.log10",
"ma... | [((4067, 4119), 'numpy.sqrt', 'np.sqrt', (['(eps_0 * eps_r * v_t / (2 * n0 * z ** 2 * q))'], {}), '(eps_0 * eps_r * v_t / (2 * n0 * z ** 2 * q))\n', (4074, 4119), True, 'import numpy as np\n'), ((5887, 5899), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5897, 5899), True, 'import matplotlib.pyplot as pl... |
import numpy as np
import sys
import math
import pickle
import os
import matplotlib
matplotlib.use('Agg')
import skimage.io as skio
from skimage.transform import resize
from bell2014.params import IntrinsicParameters
from bell2014.solver import IntrinsicSolver
from bell2014.input import IntrinsicInput
from bell2014 i... | [
"numpy.sum",
"bell2014.input.IntrinsicInput.from_file",
"skimage.transform.resize",
"numpy.exp",
"numpy.lib.pad",
"numpy.meshgrid",
"numpy.copy",
"numpy.reshape",
"bell2014.solver.IntrinsicSolver",
"skimage.io.imread",
"math.sqrt",
"matplotlib.use",
"bell2014.image_util.save",
"math.floor"... | [((85, 106), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (99, 106), False, 'import matplotlib\n'), ((413, 438), 'numpy.array', 'np.array', (['[104, 117, 123]'], {}), '([104, 117, 123])\n', (421, 438), True, 'import numpy as np\n'), ((591, 621), 'skimage.transform.resize', 'resize', (['im', '(c... |
"""Covid analysis utility functions"""
import yaml
import numpy as np
import pandas as pd
import h5py
import xarray
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability.python.internal import dtype_util
tfd = tfp.distributions
tfs = tfp.stats
def copy_nc_attrs(src, dest):
"""... | [
"tensorflow.einsum",
"yaml.load",
"tensorflow.reduce_sum",
"numpy.sum",
"tensorflow.clip_by_value",
"tensorflow.cumsum",
"numpy.mean",
"gemlib.util.compute_state",
"numpy.float64",
"tensorflow.scatter_nd",
"tensorflow_probability.python.internal.dtype_util.common_dtype",
"tensorflow.roll",
"... | [((497, 524), 'xarray.Dataset', 'xarray.Dataset', ([], {'attrs': 'attrs'}), '(attrs=attrs)\n', (511, 524), False, 'import xarray\n'), ((1465, 1522), 'tensorflow_probability.python.internal.dtype_util.common_dtype', 'dtype_util.common_dtype', (['[n, rate]'], {'dtype_hint': 'tf.float64'}), '([n, rate], dtype_hint=tf.floa... |
#!/usr/bin/env python
import os
import warnings
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.patches import Ellipse
import rosparam
plt.style.use("seaborn-talk")
matplotlib.rcParams["pdf.fonttype"] = 42
matplotlib.rcParams["ps.fonttype"] = 42
"""
This script is to load logs fro... | [
"rosparam.load_file",
"numpy.arctan2",
"numpy.isnan",
"matplotlib.pyplot.style.use",
"numpy.rot90",
"numpy.sin",
"matplotlib.pyplot.gca",
"numpy.diag",
"matplotlib.pyplot.tight_layout",
"warnings.simplefilter",
"matplotlib.pyplot.close",
"numpy.identity",
"warnings.catch_warnings",
"numpy.... | [((173, 202), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-talk"""'], {}), "('seaborn-talk')\n", (186, 202), True, 'import matplotlib.pyplot as plt\n'), ((445, 474), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.ros/"""'], {}), "('~/.ros/')\n", (463, 474), False, 'import os\n'), ((484, 530), 'ro... |
"""
Take the results from generate2.py, and bucket by caption
From looking at how jda's code works, negative samples are
drawn approximately uniformly from all examples.
This latest version is basically heavily based on jda's code now, just basically using the already-saved
image-caption pairs, rather than calling in... | [
"h5py.File",
"numpy.random.seed",
"argparse.ArgumentParser",
"ulfs.git_info.get_git_diff",
"numpy.random.RandomState",
"time.time",
"collections.defaultdict",
"ulfs.git_info.get_git_log",
"json.dumps",
"numpy.random.randint",
"random.seed",
"os.path.isfile",
"numpy.random.shuffle",
"ulfs.h... | [((12130, 12147), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (12141, 12147), False, 'import random\n'), ((12152, 12172), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (12166, 12172), True, 'import numpy as np\n'), ((12181, 12208), 'numpy.random.RandomState', 'np.random.RandomState', ... |
import pyzbar.pyzbar as pyzbar
from pyzbar.pyzbar import decode, ZBarSymbol
import cv2
import numpy as np
image = cv2.imread('C:\\Users\\GEFORCE\\Documents\\img-qr2.png')
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(gray, 220, 255, cv2.THRESH_BINARY)
contours, hierarchy = cv2.findCont... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"numpy.zeros",
"cv2.imread",
"cv2.convexHull",
"cv2.drawContours",
"cv2.imshow",
"cv2.findContours"
] | [((116, 172), 'cv2.imread', 'cv2.imread', (['"""C:\\\\Users\\\\GEFORCE\\\\Documents\\\\img-qr2.png"""'], {}), "('C:\\\\Users\\\\GEFORCE\\\\Documents\\\\img-qr2.png')\n", (126, 172), False, 'import cv2\n'), ((182, 221), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n... |
import os,sys
import json
import tensorflow as tf
from tensorflow.python.framework import sparse_tensor as sparse_tensor_lib
import numpy as np
import string
import gzip
from nltk.stem import PorterStemmer
class MsMarcoData:
settings = None
vocabulary = None
vocab_idxs = None
max_list_length = 0
max_doc_length = ... | [
"nltk.stem.PorterStemmer",
"tensorflow.logging.info",
"tensorflow.train.Int64List",
"os.path.isfile",
"tensorflow.train.FloatList",
"tensorflow.feature_column.categorical_column_with_identity",
"os.path.exists",
"tensorflow.parse_single_example",
"tensorflow.SparseFeature",
"tensorflow.feature_col... | [((630, 645), 'nltk.stem.PorterStemmer', 'PorterStemmer', ([], {}), '()\n', (643, 645), False, 'from nltk.stem import PorterStemmer\n'), ((867, 970), 'tensorflow.feature_column.categorical_column_with_identity', 'tf.feature_column.categorical_column_with_identity', ([], {'key': '"""doc_unigrams"""', 'num_buckets': 'voc... |
import torch
import torch.nn as nn
import numpy as np
import torch.optim as optim
from tqdm import trange
X = np.random.randint(1,9,(1000,2))
y = np.prod(X,axis=1).reshape(1000,1)
X,y = torch.from_numpy(X)*.1, torch.from_numpy(y)*1.
class mul(nn.Module):
def __init__(self):
super(mul,self).__init__()
... | [
"torch.nn.ReLU",
"torch.nn.BCELoss",
"tqdm.trange",
"numpy.random.randint",
"torch.nn.Linear",
"torch.tensor",
"torch.no_grad",
"numpy.prod",
"torch.from_numpy"
] | [((112, 146), 'numpy.random.randint', 'np.random.randint', (['(1)', '(9)', '(1000, 2)'], {}), '(1, 9, (1000, 2))\n', (129, 146), True, 'import numpy as np\n'), ((609, 621), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (619, 621), True, 'import torch.nn as nn\n'), ((653, 664), 'tqdm.trange', 'trange', (['(100)'],... |
# @Author: <NAME>
# @Date: Tue, March 31st 2020, 12:34 am
# @Email: <EMAIL>
# @Filename: base_dataset.py
'''
Script for defining base class BaseDataset for managing information about a particular subset or collection of datasets during preparation for a particular experiment.
'''
from boltons.dictutils import One... | [
"pyleaves.leavesdb.init_local_db",
"pandas.read_csv",
"random.shuffle",
"dataset.enforce_class_whitelist",
"pyleaves.tests.test_utils.MetaData.from_Dataset",
"os.path.join",
"numpy.unique",
"pandas.DataFrame",
"dataset.exclude_rare_classes",
"pandas.concat",
"json.dump",
"boltons.dictutils.One... | [((12977, 13017), 'collections.OrderedDict', 'OrderedDict', (["{'train': 0.5, 'test': 0.5}"], {}), "({'train': 0.5, 'test': 0.5})\n", (12988, 13017), False, 'from collections import OrderedDict\n'), ((14934, 14990), 'dataset.exclude_rare_classes', 'dataset.exclude_rare_classes', ([], {'threshold': 'config.threshold'}),... |
from PIL import Image
import astropy.io.fits as pyfits
from astropy.coordinates import SkyCoord
import glob
import numpy as np
import sys
import os
FLIPUD = True # Important: PNGs are inverted from fits
hdu = 0
bands_des = "griz"
magzps_des = [30, 30, 30, 30]
bands_cfhtls = "ugriz"
pixel_scale = .263 # DES
scale = 4... | [
"os.path.isdir",
"os.path.exists",
"numpy.flipud",
"PIL.Image.open",
"astropy.io.fits.open",
"glob.glob",
"numpy.log10",
"sys.exit"
] | [((1972, 2016), 'glob.glob', 'glob.glob', (["(indir + '/' + masksdir + '/*.bmp')"], {}), "(indir + '/' + masksdir + '/*.bmp')\n", (1981, 2016), False, 'import glob\n'), ((449, 469), 'os.path.isdir', 'os.path.isdir', (['indir'], {}), '(indir)\n', (462, 469), False, 'import os\n'), ((520, 531), 'sys.exit', 'sys.exit', ([... |
import os
import struct
from array import array
import numpy as np
import png
from PIL import Image
from tqdm import tqdm
# Begin 'raw_to_png'
def read(dataset="train", path="."):
if dataset is "train":
fname_img = os.path.join(path, 'train-images-idx3-ubyte')
fname_lbl = os.path.join(path, 't... | [
"tqdm.tqdm",
"os.path.abspath",
"os.makedirs",
"os.path.realpath",
"os.walk",
"os.path.exists",
"os.path.dirname",
"numpy.zeros",
"PIL.Image.open",
"png.Writer",
"os.path.join"
] | [((1003, 1037), 'os.path.join', 'os.path.join', (['output_path', 'dataset'], {}), '(output_path, dataset)\n', (1015, 1037), False, 'import os\n'), ((1251, 1294), 'os.path.join', 'os.path.join', (['output_path', "(dataset + '.txt')"], {}), "(output_path, dataset + '.txt')\n", (1263, 1294), False, 'import os\n'), ((1408,... |
from plato.backend.units import Units
from plato.backend.datasources.pevent_trace.datasource import PeventDataSource
from ..general_trace.adapter import GeneralTraceAdapter
import numpy as np
# Example adapter for a random pseudo-data-source
class PeventTraceAdapter(GeneralTraceAdapter):
statsForUnits = {Units.C... | [
"numpy.searchsorted"
] | [((1136, 1186), 'numpy.searchsorted', 'np.searchsorted', (['currentColumn', 'first'], {'side': '"""left"""'}), "(currentColumn, first, side='left')\n", (1151, 1186), True, 'import numpy as np\n'), ((1215, 1264), 'numpy.searchsorted', 'np.searchsorted', (['currentColumn', 'last'], {'side': '"""left"""'}), "(currentColum... |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Interstellar Technologies Inc. All Rights Reserved.
# Authors : <NAME>
#
# Lisence : MIT Lisence
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software... | [
"jinja2.Template",
"json.load",
"bokeh.plotting.figure",
"bokeh.util.browser.view",
"pandas.read_csv",
"numpy.deg2rad",
"os.path.exists",
"bokeh.resources.INLINE.render_css",
"bokeh.models.PrintfTickFormatter",
"bokeh.layouts.gridplot",
"bokeh.resources.INLINE.render_js",
"io.open",
"bokeh.e... | [((11253, 12056), 'jinja2.Template', 'Template', (['"""<!DOCTYPE html>\n<html lang="en">\n <head>\n <meta charset="utf-8">\n <title>Bokeh Scatter Plots</title>\n {{ js_resources }}\n {{ css_resources }}\n {{ script1 }}\n {{ script2 }}\n {{ script3 }}\n <style>\... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 3 18:26:32 2017
@author: TT
"""
import numpy as np
import tensorflow as tf
from params import MLP_model_params as hp
def softmax_layers(inputs,
num_units,
activation=tf.nn.softmax):
length, width = inputs.get_shape().as_list()
... | [
"tensorflow.constant_initializer",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.Variable",
"tensorflow.nn.conv2d",
"tensorflow.nn.conv1d",
"tensorflow.truncated_normal",
"tensorflow.get_variable",
"tensorflow.pad",
"tensorflow.TensorShape",
"tensorflow.variable_scope",
"tensorflow.to... | [((773, 829), 'tensorflow.nn.conv2d', 'tf.nn.conv2d', (['x', 'W'], {'strides': '[1, 1, 1, 1]', 'padding': '"""SAME"""'}), "(x, W, strides=[1, 1, 1, 1], padding='SAME')\n", (785, 829), True, 'import tensorflow as tf\n'), ((920, 995), 'tensorflow.nn.max_pool', 'tf.nn.max_pool', (['x'], {'ksize': '[1, 2, 2, 1]', 'strides'... |
"""
Created on Mon 20, 2020
"""
import numpy as np
import modern_robotics as mr
import yaml
import csv
from math import cos,sin, acos, atan2, copysign, fabs
class Odometry:
def __init__(self,bot_params):
# Vb = F*Δθ
l = bot_params["chasis"]["l"]
w = bot_params["chasis"]["w"]
se... | [
"yaml.load",
"modern_robotics.VecTose3",
"csv.writer",
"math.atan2",
"math.fabs",
"math.sin",
"math.copysign",
"numpy.array",
"math.cos",
"modern_robotics.MatrixExp6"
] | [((572, 642), 'numpy.array', 'np.array', (['[[0, 0, 0, 0], [0, 0, 0, 0], F[0], F[1], F[2], [0, 0, 0, 0]]'], {}), '([[0, 0, 0, 0], [0, 0, 0, 0], F[0], F[1], F[2], [0, 0, 0, 0]])\n', (580, 642), True, 'import numpy as np\n'), ((3333, 3349), 'modern_robotics.VecTose3', 'mr.VecTose3', (['Vb6'], {}), '(Vb6)\n', (3344, 3349)... |
#!/usr/bin/env python3
"""Inference the predictions of the clinical datasets using the supervised model."""
import argparse
from pathlib import Path
import joblib
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from tqdm import tqdm
from utils import COLUMNS_NAME, load_data... | [
"tensorflow.random.set_seed",
"pandas.DataFrame",
"numpy.random.seed",
"argparse.ArgumentParser",
"tensorflow.keras.models.load_model",
"numpy.true_divide",
"joblib.load",
"tensorflow.concat",
"utils.load_dataset",
"numpy.mean",
"pathlib.Path.cwd",
"numpy.concatenate"
] | [((340, 350), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (348, 350), False, 'from pathlib import Path\n'), ((1201, 1232), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['random_seed'], {}), '(random_seed)\n', (1219, 1232), True, 'import tensorflow as tf\n'), ((1237, 1264), 'numpy.random.seed', 'np.random.... |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import collections as cl
import json
from .util import *
class Waterbank():
def __init__(self, df, name, key):
self.T = len(df)
self.index = df.index
self.number_years = self.index.year[self.T - 1] -... | [
"pandas.DataFrame",
"numpy.zeros",
"pandas.Series"
] | [((1170, 1186), 'numpy.zeros', 'np.zeros', (['self.T'], {}), '(self.T)\n', (1178, 1186), True, 'import numpy as np\n'), ((11616, 11630), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (11628, 11630), True, 'import pandas as pd\n'), ((11783, 11832), 'pandas.Series', 'pd.Series', (['self.recharge_rate_series'], {'... |
import numpy as np
from PIL import Image, ImageFilter
import matplotlib.pyplot as plt
import glob, os
import pandas as pd
# パスは各環境に合わせて書き換える
coordspath = 'data/coords.csv'
train_folder = 'H:/KaggleNOAASeaLions/Train/'
save_folder = 'H:/KaggleNOAASeaLions/classified_images/'
data = pd.read_csv(coordspath)
print(data)
... | [
"pandas.read_csv",
"numpy.asarray",
"PIL.Image.fromarray",
"PIL.Image.open"
] | [((284, 307), 'pandas.read_csv', 'pd.read_csv', (['coordspath'], {}), '(coordspath)\n', (295, 307), True, 'import pandas as pd\n'), ((657, 677), 'PIL.Image.open', 'Image.open', (['filepath'], {}), '(filepath)\n', (667, 677), False, 'from PIL import Image, ImageFilter\n'), ((694, 715), 'numpy.asarray', 'np.asarray', (['... |
import numpy as np
import cv2
import socket
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Bind the socket to the port
server_address = ('0.0.0.0', 7777)
print('starting up on %s port %s' % server_address)
sock.bind(server_address)
# Listen for incoming connections... | [
"cv2.waitKey",
"numpy.frombuffer",
"socket.socket",
"cv2.destroyAllWindows"
] | [((84, 133), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (97, 133), False, 'import socket\n'), ((376, 411), 'numpy.frombuffer', 'np.frombuffer', (['data'], {'dtype': 'np.uint8'}), '(data, dtype=np.uint8)\n', (389, 411), True, 'import numpy ... |
import numpy, os
def load_data(filepath):
return numpy.load(filepath);
| [
"numpy.load"
] | [((54, 74), 'numpy.load', 'numpy.load', (['filepath'], {}), '(filepath)\n', (64, 74), False, 'import numpy, os\n')] |
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import f1_score
from sklearn import svm
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
from imblearn.over_sampling import SMOTE... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.preprocessing.StandardScaler",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.linear_model.LogisticRegression",
"numpy.min",
"imblearn.over_sampling.SMOTE",
"numpy.max",
"sklearn.metrics.f1_score",
"sklearn.svm.SVC"
] | [((695, 751), 'imblearn.over_sampling.SMOTE', 'SMOTE', ([], {'random_state': '(42)', 'sampling_strategy': '"""not majority"""'}), "(random_state=42, sampling_strategy='not majority')\n", (700, 751), False, 'from imblearn.over_sampling import SMOTE\n'), ((1459, 1556), 'sklearn.linear_model.LogisticRegression', 'Logistic... |
# -*- coding: utf-8 -*-
# CIELAB Chroma Enhancement
import numpy as np
import cv2
ep=1e-06
def rgb_gamma(rgb):
rgb2=np.zeros((rgb.shape[0],rgb.shape[1]),dtype=np.float)
rgb2[rgb[:,0]<=0.03928,0] = rgb[rgb[:,0]<=0.03928,0]/12.92
rgb2[rgb[:,1]<=0.03928,1] = rgb[rgb[:,1]<=0.03928,1]/12.92
rgb2[rgb[:,2]<=0... | [
"numpy.abs",
"numpy.arctan2",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.zeros",
"numpy.hstack",
"cv2.imread",
"numpy.min",
"numpy.array",
"numpy.loadtxt",
"numpy.sign",
"cv2.imshow",
"numpy.round",
"cv2.namedWindow",
"numpy.sqrt"
] | [((2727, 2750), 'cv2.imread', 'cv2.imread', (['file_inp', '(1)'], {}), '(file_inp, 1)\n', (2737, 2750), False, 'import cv2\n'), ((2763, 2821), 'numpy.loadtxt', 'np.loadtxt', ([], {'fname': '"""cmax.csv"""', 'dtype': '"""float"""', 'delimiter': '""","""'}), "(fname='cmax.csv', dtype='float', delimiter=',')\n", (2773, 28... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import argparse
import math
import numpy as np
import unireedsolomon as urs
from lib import *
parser = argparse.ArgumentParser(
description='Listen to a pyaudio device, or read data from a file, and try to decode messages.'
)
parser.add_argument(
'-x', '--hex',
... | [
"math.isnan",
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.zeros",
"numpy.max"
] | [((151, 281), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Listen to a pyaudio device, or read data from a file, and try to decode messages."""'}), "(description=\n 'Listen to a pyaudio device, or read data from a file, and try to decode messages.'\n )\n", (174, 281), False, 'imp... |
# Copyright 2022 Xanadu Quantum Technologies Inc.
# 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 agre... | [
"flamingpy.cv.gkp.Z_err",
"numpy.array_equal",
"numpy.allclose",
"flamingpy.cv.gkp.Z_err_cond",
"flamingpy.cv.gkp.integer_fractional",
"numpy.random.default_rng",
"numpy.random.rand",
"pytest.mark.parametrize",
"flamingpy.cv.gkp.GKP_binner",
"numpy.all",
"numpy.sqrt"
] | [((963, 977), 'numpy.sqrt', 'np.sqrt', (['np.pi'], {}), '(np.pi)\n', (970, 977), True, 'import numpy as np\n'), ((1052, 1096), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""alpha"""', 'alpha_vals'], {}), "('alpha', alpha_vals)\n", (1075, 1096), False, 'import pytest\n'), ((2988, 3041), 'pytest.mark.parame... |
import os
import numpy as np
from matplotlib import pyplot as pp
from matplotlib.backends.backend_pdf import PdfPages
SPINE_COLOR = 'gray'
class Plot:
def __init__(self, title, for_print: bool = False, small: bool = False):
if small:
self.setsize(fig_width=8, fig_height=6)
else:
... | [
"matplotlib.backends.backend_pdf.PdfPages",
"os.path.join",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.errorbar",
... | [((527, 536), 'matplotlib.pyplot.axes', 'pp.axes', ([], {}), '()\n', (534, 536), True, 'from matplotlib import pyplot as pp\n'), ((1609, 1635), 'matplotlib.pyplot.rcParams.update', 'pp.rcParams.update', (['params'], {}), '(params)\n', (1627, 1635), True, 'from matplotlib import pyplot as pp\n'), ((2724, 2788), 'matplot... |
# coding:UTF-8
import numpy as np
# d_2 = {'9244.png': '108', '3293.png': '108', '6532.png': '108', '2661.png': '108', '9715.png': '108', '3310.png': '108', '7264.png': '108', '9406.png': '108', '5155.png': '108', '5521.png': '108'}
# d_1 = {'6777.png': '92', '7049.png': '92', '9510.png': '92', '15189.png': '92', '880... | [
"numpy.zeros",
"os.path.join"
] | [((566, 595), 'numpy.zeros', 'np.zeros', (['(2, 2, 3)', 'np.uint8'], {}), '((2, 2, 3), np.uint8)\n', (574, 595), True, 'import numpy as np\n'), ((625, 657), 'os.path.join', 'os.path.join', (['"""11"""', '"""ewe"""', '"""ede"""'], {}), "('11', 'ewe', 'ede')\n", (637, 657), False, 'import os\n')] |
__author__ = 'fnaiser'
import pickle
import cv2
import numpy as np
from core.region import cyMser
from core.region.mser_operations import children_filter
from core.region.region import Region
from core.config import config
from .mser_operations import get_region_groups_dict_, margin_filter_dict_, min_intensity_filter... | [
"pickle.dump",
"cv2.cvtColor",
"core.region.cyMser.PyMser",
"numpy.percentile",
"pickle.load",
"core.region.region.Region",
"utils.video_manager.get_auto_video_manager"
] | [((484, 499), 'core.region.cyMser.PyMser', 'cyMser.PyMser', ([], {}), '()\n', (497, 499), False, 'from core.region import cyMser\n'), ((3968, 3999), 'utils.video_manager.get_auto_video_manager', 'get_auto_video_manager', (['project'], {}), '(project)\n', (3990, 3999), False, 'from utils.video_manager import get_auto_vi... |
#!/usr/bin/env python3
from matplotlib import pylab as plt
from mpl_toolkits.mplot3d import axes3d
import sys
import numpy as np
from numpy.fft import rfftn, fftshift
import flash as FLASH
from shellavg import shell_avg_3d
import ulz
sys.argv.reverse()
progpath = sys.argv.pop()
flsfp = sys.argv.pop()
flsfp2 = sys.... | [
"matplotlib.pylab.savefig",
"matplotlib.pylab.legend",
"sys.argv.pop",
"ulz.norm",
"flash.File",
"sys.argv.reverse",
"numpy.fft.rfftn",
"matplotlib.pylab.xlim",
"matplotlib.pylab.grid",
"matplotlib.pylab.loglog",
"numpy.prod",
"shellavg.shell_avg_3d"
] | [((239, 257), 'sys.argv.reverse', 'sys.argv.reverse', ([], {}), '()\n', (255, 257), False, 'import sys\n'), ((269, 283), 'sys.argv.pop', 'sys.argv.pop', ([], {}), '()\n', (281, 283), False, 'import sys\n'), ((292, 306), 'sys.argv.pop', 'sys.argv.pop', ([], {}), '()\n', (304, 306), False, 'import sys\n'), ((316, 330), '... |
import cv2
import numpy as np
# mouse callback function
def pick_color(event,x,y,flags,param):
if event == cv2.EVENT_LBUTTONDOWN:
pixel = image[y,x]
#you might want to adjust the ranges(+-10, etc):
upper = np.array([pixel[0] + 20, pixel[1] + 50, pixel[2] + 50])
lower = np.array([... | [
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.setMouseCallback",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.getWindowProperty"
] | [((418, 437), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (434, 437), False, 'import cv2\n'), ((715, 738), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (736, 738), False, 'import cv2\n'), ((494, 535), 'cv2.setMouseCallback', 'cv2.setMouseCallback', (['"""image"""', 'pick_color... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
def calc_normal_matrix(data, k, mean_vec, cov_mat):
'''
Given data, integer k denoting number of mixtures, and
the corresponding means and covariance, returns the matrix of
multiv normal probabilities
Inputs:
- dat... | [
"matplotlib.pyplot.title",
"numpy.full",
"numpy.sum",
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"numpy.log",
"matplotlib.pyplot.scatter",
"numpy.empty",
"numpy.zeros",
"numpy.argmin",
"numpy.random.randint",
"numpy.array",
"numpy.loadtxt",
"scipy.stats.multivariate_... | [((6142, 6167), 'numpy.loadtxt', 'np.loadtxt', (['"""toydata.txt"""'], {}), "('toydata.txt')\n", (6152, 6167), True, 'import numpy as np\n'), ((6441, 6450), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (6448, 6450), True, 'import matplotlib.pyplot as plt\n'), ((6654, 6704), 'matplotlib.pyplot.scatter', 'plt.sc... |
from .custom_json import *
import json
import pytest
import numpy as np
from numpy import testing as npt
from . import test_utils
class TestJSONSerializerDeserializer(object):
def test_add_codec(self):
# without bytes codec, can't serialize numpy
serialization = JSONSerializerDeserializer([numpy_... | [
"json.loads",
"numpy.testing.assert_array_equal",
"json.dumps",
"pytest.raises",
"numpy.array",
"numpy.testing.assert_equal"
] | [((342, 376), 'numpy.array', 'np.array', (['[[1.0, 0.0], [2.0, 3.2]]'], {}), '([[1.0, 0.0], [2.0, 3.2]])\n', (350, 376), True, 'import numpy as np\n'), ((712, 748), 'numpy.testing.assert_equal', 'npt.assert_equal', (['obj', 'reconstructed'], {}), '(obj, reconstructed)\n', (728, 748), True, 'from numpy import testing as... |
import pickle
import random
import math
import numpy as np
from nltk.stem import WordNetLemmatizer
import string
random.seed(a=101)
wordnet_lemmatizer = WordNetLemmatizer()
window_size = 3
with open('Processed_Data/vocab_and_embd.pkl', 'rb') as fp:
data = pickle.load(fp)
vocab2idx = data[0]
def vectorize(tweet... | [
"pickle.dump",
"nltk.stem.WordNetLemmatizer",
"random.shuffle",
"numpy.zeros",
"pickle.load",
"random.seed"
] | [((114, 132), 'random.seed', 'random.seed', ([], {'a': '(101)'}), '(a=101)\n', (125, 132), False, 'import random\n'), ((154, 173), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (171, 173), False, 'from nltk.stem import WordNetLemmatizer\n'), ((2875, 2892), 'random.shuffle', 'random.shuffle', (['... |
from typing import Tuple, Union, Iterable, List, Callable, Dict, Optional
import os
import json
import copy
import numpy as np
import scipy.stats as spstats
from nnuncert.models._pred_base import BasePred, PredConditionalGaussian
from nnuncert.models.nlm import NLM
from nnuncert.models.pnn import PNN
class Ensembl... | [
"nnuncert.models.pnn.PNN",
"scipy.stats.norm.ppf",
"copy.deepcopy",
"os.makedirs",
"nnuncert.models.nlm.NLM",
"copy.copy",
"scipy.stats.norm.pdf",
"scipy.stats.norm.cdf",
"numpy.mean",
"numpy.array",
"os.path.join",
"numpy.vstack"
] | [((1059, 1091), 'os.makedirs', 'os.makedirs', (['path'], {'exist_ok': '(True)'}), '(path, exist_ok=True)\n', (1070, 1091), False, 'import os\n'), ((1122, 1154), 'copy.deepcopy', 'copy.deepcopy', (['self._model_paras'], {}), '(self._model_paras)\n', (1135, 1154), False, 'import copy\n'), ((1224, 1259), 'os.path.join', '... |
#-*- coding:utf-8 -*-
# &Author AnFany
# 适用于多维输出
from BPNN_DATA_Reg import model_data as R_data
import numpy as np
import tensorflow as tf
'''第一部分:数据准备'''
train_x_data = R_data[0] # 训练输入
train_y_data = R_data[1] # 训练输出
predict_x_data = R_data[2] # 测试输入
predict_y_data = R_data[3] # 测试输出
'''第二部分... | [
"matplotlib.pyplot.title",
"tensorflow.nn.tanh",
"tensorflow.train.AdamOptimizer",
"tensorflow.matmul",
"matplotlib.pyplot.xlabel",
"tensorflow.nn.relu",
"tensorflow.placeholder",
"numpy.random.choice",
"matplotlib.pyplot.show",
"tensorflow.train.Saver",
"tensorflow.global_variables_initializer"... | [((1111, 1170), 'tensorflow.placeholder', 'tf.placeholder', ([], {'shape': '[None, Input_Dimen]', 'dtype': 'tf.float32'}), '(shape=[None, Input_Dimen], dtype=tf.float32)\n', (1125, 1170), True, 'import tensorflow as tf\n'), ((2461, 2495), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', (['learn_rate'], {}),... |
import numpy as np
INST_SIZE = 4
instructions = np.loadtxt('input.csv', delimiter=',', dtype=np.int)
def run_program(instructions, noun=None, verb=None):
# Enter error code instructions
instructions[1] = noun
instructions[2] = verb
ip = 0
while True:
opcode, param1, param2, dst = instru... | [
"numpy.loadtxt"
] | [((50, 102), 'numpy.loadtxt', 'np.loadtxt', (['"""input.csv"""'], {'delimiter': '""","""', 'dtype': 'np.int'}), "('input.csv', delimiter=',', dtype=np.int)\n", (60, 102), True, 'import numpy as np\n')] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.