code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
import pandas as pd
import numpy as np
import sys
import traceback
from tqdm.auto import tqdm
import os
import csv
import git
import sys
repo = git.Repo("./", search_parent_directories=True)
homedir = repo.working_dir
def get_date(x):
return '-'.join(x.split('-')[:3])
def get_fips(x):
return x.split('-')[-1]
... | [
"numpy.sum",
"pandas.read_csv",
"git.Repo",
"sys.stderr.write",
"pandas.concat"
] | [((145, 191), 'git.Repo', 'git.Repo', (['"""./"""'], {'search_parent_directories': '(True)'}), "('./', search_parent_directories=True)\n", (153, 191), False, 'import git\n'), ((2982, 3052), 'pandas.read_csv', 'pd.read_csv', (["(f'{homedir}' + '/data/us/covid/nyt_us_counties_daily.csv')"], {}), "(f'{homedir}' + '/data/u... |
# getconti.py
# 12/05/2016 ALS
"""
tools to isolate continuum
"""
import numpy as np
import copy
import scipy.ndimage.filters as scif
import modelBC03
from ..filters import getllambda
from . import linelist
def decompose_cont_line_t2AGN(spec, ws, z, method='modelBC03'):
"""
decompose the spectrum of type ... | [
"numpy.absolute",
"numpy.logical_not",
"copy.copy",
"numpy.any",
"numpy.array",
"scipy.ndimage.filters.generic_filter",
"numpy.arange",
"modelBC03.modelBC03"
] | [((1629, 1644), 'copy.copy', 'copy.copy', (['spec'], {}), '(spec)\n', (1638, 1644), False, 'import copy\n'), ((1693, 1749), 'scipy.ndimage.filters.generic_filter', 'scif.generic_filter', (['speccon_nan', 'np.nanmedian'], {'size': '(300)'}), '(speccon_nan, np.nanmedian, size=300)\n', (1712, 1749), True, 'import scipy.nd... |
#!/usr/bin/python3
import rospy
from std_msgs.msg import Int16MultiArray, String, Bool
import numpy as np
import pickle
import os
import yaml
import h5py
from utils.audio import get_mfcc
from utils.model import get_deep_speaker
from utils.utils import batch_cosine_similarity, dist2id
n_embs = 0
X = []
y = []
def sav... | [
"h5py.File",
"os.path.abspath",
"rospy.wait_for_message",
"h5py.special_dtype",
"yaml.full_load",
"utils.audio.get_mfcc",
"rospy.Publisher",
"numpy.expand_dims",
"os.path.isfile",
"numpy.array",
"rospy.init_node",
"utils.utils.dist2id",
"rospy.spin",
"os.path.join"
] | [((363, 374), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (371, 374), True, 'import numpy as np\n'), ((384, 412), 'h5py.special_dtype', 'h5py.special_dtype', ([], {'vlen': 'str'}), '(vlen=str)\n', (402, 412), False, 'import h5py\n'), ((426, 447), 'numpy.array', 'np.array', (['y'], {'dtype': 'dt'}), '(y, dtype=dt)\... |
import unittest
import numpy as np
import zarr
from functools import partial
from scout import utils
def double_elements(arr, start_coord, chunks):
stop = np.minimum(start_coord + chunks, arr.shape)
data = utils.extract_box(arr, start_coord, stop)
return 2 * data
shm = utils.SharedMemory((25, 25), np.fl... | [
"scout.utils.SharedMemory",
"numpy.minimum",
"scout.utils.extract_box",
"numpy.asarray",
"numpy.arange",
"zarr.zeros",
"scout.utils.pmap_chunks"
] | [((286, 326), 'scout.utils.SharedMemory', 'utils.SharedMemory', (['(25, 25)', 'np.float32'], {}), '((25, 25), np.float32)\n', (304, 326), False, 'from scout import utils\n'), ((161, 204), 'numpy.minimum', 'np.minimum', (['(start_coord + chunks)', 'arr.shape'], {}), '(start_coord + chunks, arr.shape)\n', (171, 204), Tru... |
import numpy as np
import tensorflow as tf
from PIL import Image
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
n_train = mnist.train.num_examples # Taining data
n_validation = mnist.validation.num_examples # Validation data
n_test = mnist.tes... | [
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow.Session",
"tensorflow.truncated_normal",
"tensorflow.constant",
"tensorflow.train.AdamOptimizer",
"tensorflow.placeholder",
"tensorflow.matmul",
"tensorflow.cast",
"PIL.... | [((133, 187), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data/"""'], {'one_hot': '(True)'}), "('MNIST_data/', one_hot=True)\n", (158, 187), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((619, 659), 'tensorflow.placeholder', 'tf.pl... |
#!/usr/bin/python3
import math
from random import random
import numpy as np
import csv
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
class FeedForward:
def __init__(self, w1, b1, w2, b2, w3, b3):
self.w1 = w1
self.b1 = b1
self.w2 = ... | [
"math.exp",
"matplotlib.pyplot.show",
"numpy.argmax",
"matplotlib.pyplot.imshow",
"tensorflow.keras.datasets.mnist.load_data",
"numpy.loadtxt",
"matplotlib.pyplot.grid"
] | [((3100, 3132), 'tensorflow.keras.datasets.mnist.load_data', 'keras.datasets.mnist.load_data', ([], {}), '()\n', (3130, 3132), False, 'from tensorflow import keras\n'), ((3286, 3301), 'matplotlib.pyplot.grid', 'plt.grid', (['(False)'], {}), '(False)\n', (3294, 3301), True, 'import matplotlib.pyplot as plt\n'), ((3311, ... |
import argparse
import numpy as np
import time
import torch
import json
import torch.nn as nn
import cv2
import random
import torch.nn.functional as F
from solver_learnToAdd import Solver
from models.synthesizer import gumbel_softmax_sample
from os.path import basename, exists, join, splitext
from os import makedirs
f... | [
"numpy.abs",
"argparse.ArgumentParser",
"utils.data_loader_stargan.get_dataset",
"numpy.ones",
"json.dumps",
"numpy.random.randint",
"numpy.linalg.norm",
"torch.no_grad",
"os.path.join",
"numpy.set_printoptions",
"cv2.imwrite",
"torch.load",
"torch.FloatTensor",
"os.path.exists",
"cv2.re... | [((1243, 1332), 'cv2.putText', 'cv2.putText', (['fVFrm', 'text', '(4, img_size[0] - 10)', 'font', '(0.8)', '(0, 0, 0)', '(1)', 'cv2.LINE_AA'], {}), '(fVFrm, text, (4, img_size[0] - 10), font, 0.8, (0, 0, 0), 1,\n cv2.LINE_AA)\n', (1254, 1332), False, 'import cv2\n'), ((4683, 4705), 'numpy.hstack', 'np.hstack', (['ed... |
# -*- coding: UTF-8 -*-
"""
Train CNN for leaf counting, panicle emergence detection, and hyper segmentation
"""
import os
import sys
import os.path as op
from pathlib import Path
from numpy.random import uniform
from schnablelab.apps.Tools import eprint
from schnablelab.apps.natsort import natsorted
from schnablelab... | [
"numpy.random.uniform",
"schnablelab.apps.base.ActionDispatcher",
"pathlib.Path",
"schnablelab.apps.base.OptionParser"
] | [((620, 645), 'schnablelab.apps.base.ActionDispatcher', 'ActionDispatcher', (['actions'], {}), '(actions)\n', (636, 645), False, 'from schnablelab.apps.base import ActionDispatcher, OptionParser\n'), ((1341, 1366), 'schnablelab.apps.base.OptionParser', 'OptionParser', (['dpp.__doc__'], {}), '(dpp.__doc__)\n', (1353, 13... |
"""
.. module:: pytfa
:platform: Unix, Windows
:synopsis: Thermodynamics-based Flux Analysis
.. moduleauthor:: pyTFA team
Input/Output tools to import or export pytfa models
"""
import pickle
import zlib
import numpy as np
import re
from cobra import Model, Reaction, Metabolite
from cobra.io import load_mat... | [
"scipy.io.loadmat",
"cobra.io.load_matlab_model",
"scipy.io.savemat",
"numpy.where",
"numpy.array",
"cobra.io.mat.create_mat_dict",
"re.compile"
] | [((952, 965), 'scipy.io.loadmat', 'loadmat', (['path'], {}), '(path)\n', (959, 965), False, 'from scipy.io import loadmat, savemat\n'), ((1546, 1569), 'cobra.io.load_matlab_model', 'load_matlab_model', (['path'], {}), '(path)\n', (1563, 1569), False, 'from cobra.io import load_matlab_model\n'), ((7454, 7477), 'cobra.io... |
import numpy as np
import torch
import subt.artf_model
class Detector:
def __init__(self, model, confidence_thresholds, categories, device,
max_gap, min_group_size):
self.model = model
self.confidence_thresholds = confidence_thresholds
self.categories = categories
... | [
"cv2.circle",
"argparse.ArgumentParser",
"os.path.basename",
"cv2.waitKey",
"torch.set_grad_enabled",
"cv2.imshow",
"osgar.logger.lookup_stream_id",
"numpy.hypot",
"cv2.imread",
"numpy.indices",
"numpy.mean",
"torch.cuda.is_available",
"cv2.rectangle",
"torch.device",
"osgar.logger.LogRe... | [((5097, 5122), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5120, 5122), False, 'import argparse\n'), ((6881, 6906), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (6904, 6906), False, 'import torch\n'), ((6920, 6963), 'torch.device', 'torch.device', (["('cuda' if u... |
# Copyright 2018 The Simons Foundation, Inc. - All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by appli... | [
"netket.operator.LocalOperator",
"netket.optimizer.Sgd",
"netket.optimizer.SR",
"netket.SteadyState",
"netket.graph.Hypercube",
"netket.machine.NdmSpinPhase",
"netket.hilbert.Spin",
"netket.sampler.MetropolisLocal",
"numpy.kron",
"netket.utils.RandomEngine",
"netket.operator.LocalLiouvillian"
] | [((656, 688), 'netket.utils.RandomEngine', 'nk.utils.RandomEngine', ([], {'seed': '(1234)'}), '(seed=1234)\n', (677, 688), True, 'import netket as nk\n'), ((733, 781), 'netket.graph.Hypercube', 'nk.graph.Hypercube', ([], {'length': 'L', 'n_dim': '(1)', 'pbc': '(False)'}), '(length=L, n_dim=1, pbc=False)\n', (751, 781),... |
import numpy as np
# import parameters as param
from neuron import neuron
import random as rd
# initializes neurons and assigns ID, connections, weights, etc.
def init_nrn(params):
neurons = [] # List containing neuron objects
nconn_Mat = [np.empty(3)] # 2D matrix for storing new connections.
... | [
"numpy.heaviside",
"random.uniform",
"numpy.empty",
"numpy.zeros",
"random.choice",
"random.random",
"neuron.neuron",
"numpy.where",
"random.seed",
"numpy.arange",
"numpy.random.choice",
"numpy.delete",
"numpy.concatenate"
] | [((3883, 3909), 'numpy.zeros', 'np.zeros', (['(numnrn, numnrn)'], {}), '((numnrn, numnrn))\n', (3891, 3909), True, 'import numpy as np\n'), ((9546, 9572), 'numpy.delete', 'np.delete', (['nconn_Mat', '(0)', '(0)'], {}), '(nconn_Mat, 0, 0)\n', (9555, 9572), True, 'import numpy as np\n'), ((9895, 9924), 'numpy.empty', 'np... |
# coding=utf-8
# Copyright 2018 Google LLC & <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"tensorflow.image.resize_images",
"numpy.load",
"numpy.random.uniform",
"six.moves.range",
"tensorflow.data.TFRecordDataset",
"tensorflow.reshape",
"numpy.zeros",
"tensorflow.constant",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.image.decode_png",
"tensorflow.cast",
"tensorflow.... | [((1043, 1085), 'os.path.join', 'os.path.join', (['FLAGS.dataset_root', '"""convex"""'], {}), "(FLAGS.dataset_root, 'convex')\n", (1055, 1085), False, 'import os\n'), ((1578, 1621), 'tensorflow.image.decode_png', 'tf.image.decode_png', (["value['image/encoded']"], {}), "(value['image/encoded'])\n", (1597, 1621), True, ... |
import click
import cv2
import h5py
import numpy as np
from skimage.feature import peak_local_max
from PIL import Image
import torch
import base64
from functools import partial
import glob
import json
import os
from pathlib import Path
import platform
import random
import string
import timeit
from data_loader import ... | [
"click.option",
"numpy.isnan",
"pathlib.Path",
"numpy.mean",
"glob.glob",
"cv2.imshow",
"os.path.join",
"numpy.round",
"platform.node",
"torch.utils.data.DataLoader",
"cv2.cvtColor",
"torch.load",
"click.command",
"click.Choice",
"data_loader.MultiDimH5Dataset",
"numpy.stack",
"numpy... | [((431, 453), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (451, 453), False, 'import timeit\n'), ((12788, 12803), 'click.command', 'click.command', ([], {}), '()\n', (12801, 12803), False, 'import click\n'), ((12805, 13030), 'click.option', 'click.option', (['"""-m"""', '"""--model_path"""'], {'re... |
# coding=utf-8
import tensorflow as tf
import numpy as np
import cv2
import time
import shutil
import os
from PIL import Image
import sys
import app_config as cfg
import add_sys_path # Place this import before import modules from project.
from nets import model_train as model
from utils.image_processing import trans... | [
"PIL.Image.new",
"tensorflow.constant_initializer",
"os.walk",
"tensorflow.ConfigProto",
"shutil.rmtree",
"tensorflow.get_default_graph",
"numpy.round",
"os.path.join",
"tensorflow.train.ExponentialMovingAverage",
"utils.text_connector.detectors.TextDetector",
"utils.rpn_msr.proposal_layer.propo... | [((443, 505), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""test_data_path"""', '"""data/demo/"""', '""""""'], {}), "('test_data_path', 'data/demo/', '')\n", (469, 505), True, 'import tensorflow as tf\n'), ((506, 564), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['""... |
from typing import Union, List, Dict
import numpy as np
import pandas as pd
from django.views import generic
from django_neomodel import DjangoNode
import data
from application import tables, charts
from application.charts.chart import Chart
from application.sequences import make_motif_logo, make_motif_img, make_pwm
... | [
"application.charts.RegulatorsGenesTopChart",
"application.sequences.make_motif_logo",
"application.sequences.make_motif_img",
"pandas.DataFrame",
"application.charts.RegulatorsExternalChart",
"application.tables.RegulatorEffectorsTable",
"application.sequences.make_pwm",
"application.charts.Regulator... | [((1385, 1495), 'domain.neo.NeoLinkedQuerySet', 'NeoLinkedQuerySet', ([], {'source': 'self.model', 'fields': "['protrend_id']", 'target': '"""gene"""', 'target_fields': "['protrend_id']"}), "(source=self.model, fields=['protrend_id'], target='gene',\n target_fields=['protrend_id'])\n", (1402, 1495), False, 'from dom... |
#-*- coding: utf8 -*-
from __future__ import division
import numpy as n, pylab as p, networkx as x, random as r, collections as c, string
from scipy import special # special.binom(x,y) ~ binom(x,y)
__doc__="""Script to plot both scale-free network and random network distributions."""
N=1200
# for the free scale netw... | [
"scipy.special.binom",
"pylab.title",
"pylab.subplots_adjust",
"numpy.log",
"pylab.ylabel",
"pylab.plot",
"pylab.xticks",
"pylab.savefig",
"pylab.yticks",
"numpy.arange",
"pylab.figure",
"pylab.xlabel",
"pylab.text",
"pylab.ylim",
"pylab.legend"
] | [((390, 401), 'numpy.arange', 'n.arange', (['N'], {}), '(N)\n', (398, 401), True, 'import numpy as n, pylab as p, networkx as x, random as r, collections as c, string\n'), ((776, 805), 'pylab.figure', 'p.figure', ([], {'figsize': '(10.0, 3.0)'}), '(figsize=(10.0, 3.0))\n', (784, 805), True, 'import numpy as n, pylab as... |
import torchvision
import torchvision.transforms as transforms
import torchvision.transforms.functional as TF
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from DRE import DeepRecursiveEmbedding
# Deep Recursive Embedding test code using MNIST/Fashion-MNIST datasets loaded with torchvision
t... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.scatter",
"numpy.expand_dims",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.array",
"torchvision.datasets.MNIST",
"numpy.int16",
"DRE.DeepRecursiveEmbedding",
"matplotlib.colors.ListedColormap",
"torchvision.transforms.ToTensor"
] | [((398, 502), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': '"""./datasets"""', 'train': '(True)', 'transform': 'transform_train', 'download': '(True)'}), "(root='./datasets', train=True, transform=\n transform_train, download=True)\n", (424, 502), False, 'import torchvision\n'), ((553, 5... |
from __future__ import absolute_import, division, print_function
import logging
import pywt
import numpy as np
from TotalActivation.filters.filter_boundary import filter_boundary_normal, filter_boundary_transpose
# from TotalActivation.process.utils import mad
logging.basicConfig(format='%(levelname)s:%(message)s'... | [
"numpy.minimum",
"numpy.zeros_like",
"numpy.abs",
"logging.basicConfig",
"numpy.median",
"pywt.wavedec",
"numpy.fft.fft",
"numpy.power",
"TotalActivation.filters.filter_boundary.filter_boundary_transpose",
"numpy.zeros",
"numpy.arange",
"numpy.kron",
"TotalActivation.filters.filter_boundary.... | [((266, 342), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(levelname)s:%(message)s', level=logging.DEBUG)\n", (285, 342), False, 'import logging\n'), ((1256, 1295), 'pywt.wavedec', 'pywt.wavedec', (['X', '"""db3"""'], {'level': ... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 4 10:46:36 2020
@author: amarmore
"""
### Module defining the functions used for the tests in the paper.
from IPython.display import display, Markdown
import numpy as np
import pandas as pd
pd.set_option('precision', 4)
import tensorly as tl
import warnings
import mat... | [
"numpy.argmax",
"musicntd.scripts.overall_scripts.load_RWC_dataset",
"musicntd.scripts.overall_scripts.load_or_save_spectrogram_and_bars",
"tensorly.unfold",
"numpy.mean",
"pandas.set_option",
"pandas.DataFrame",
"musicntd.model.errors.InvalidArgumentValueException",
"musicntd.autosimilarity_segment... | [((242, 271), 'pandas.set_option', 'pd.set_option', (['"""precision"""', '(4)'], {}), "('precision', 4)\n", (255, 271), True, 'import pandas as pd\n'), ((1540, 1592), 'musicntd.scripts.overall_scripts.load_RWC_dataset', 'scr.load_RWC_dataset', (['dataset_path', 'annotations_type'], {}), '(dataset_path, annotations_type... |
'''
Conv functions for tfscripts:
convolution helper functions,
locally connected 2d and 3d convolutions [tf.Modules],
dynamic 2d and 3d convolution,
local trafo 2d and 3d,
wrapper: trafo on patch 2d and 3d
stacked convolution 3d and 4d
'''
from __future__ import division, print_function
imp... | [
"tensorflow.reduce_sum",
"numpy.empty",
"tensorflow.reshape",
"numpy.ones",
"numpy.argmin",
"tensorflow.zeros_like",
"tensorflow.nn.conv2d",
"tensorflow.split",
"numpy.prod",
"tensorflow.add_n",
"tensorflow.pad",
"tensorflow.concat",
"tensorflow.stack",
"tfscripts.weights.new_locally_conne... | [((27358, 27380), 'numpy.empty', 'np.empty', (['(5)'], {'dtype': 'int'}), '(5, dtype=int)\n', (27366, 27380), True, 'import numpy as np\n'), ((32505, 32529), 'tensorflow.stack', 'tf.stack', (['output'], {'axis': '(1)'}), '(output, axis=1)\n', (32513, 32529), True, 'import tensorflow as tf\n'), ((32543, 32575), 'tensorf... |
# keras-check.py
# Verify that Keras can interact with the backend
import numpy as np
from keras import backend as kbe
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]="2"
# Test Keras - backend interaction
data = kbe.variable(np.random.random((4,2))) # create 4 X 2 tensor of random numbers
zero_data = kbe.zeros_... | [
"keras.backend.eval",
"keras.backend.zeros_like",
"numpy.random.random"
] | [((310, 330), 'keras.backend.zeros_like', 'kbe.zeros_like', (['data'], {}), '(data)\n', (324, 330), True, 'from keras import backend as kbe\n'), ((230, 254), 'numpy.random.random', 'np.random.random', (['(4, 2)'], {}), '((4, 2))\n', (246, 254), True, 'import numpy as np\n'), ((382, 401), 'keras.backend.eval', 'kbe.eval... |
import time
import telepot
from _datetime import datetime
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
from pandas import DataFrame
from selenium import webdriver
import json
import os
admin_info_file = os.getenv('APPLICATION_ADMIN_INFO') # 환경 변수에 저장한 중요 개인 정보 불러옴
with open(admin_info_file, 'r'... | [
"pandas.DataFrame",
"json.load",
"telepot.Bot",
"time.sleep",
"_datetime.datetime.now",
"numpy.where",
"selenium.webdriver.Chrome",
"bs4.BeautifulSoup",
"os.getenv",
"pandas.to_numeric"
] | [((228, 263), 'os.getenv', 'os.getenv', (['"""APPLICATION_ADMIN_INFO"""'], {}), "('APPLICATION_ADMIN_INFO')\n", (237, 263), False, 'import os\n'), ((345, 357), 'json.load', 'json.load', (['f'], {}), '(f)\n', (354, 357), False, 'import json\n'), ((542, 578), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""chromed... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
set of functions to drive EasyQuake
"""
print(r"""
____ __
___ ____ ________ __/ __ \__ ______ _/ /_____
/ _ \/ __ `/ ___/ / / / / / / / / / __ `/ //_/ _ \
/ __/ /_/ (__ ) /_/ / /_/ / /_/ / /_/ / ,< / __/
\___/\__,_/____... | [
"os.remove",
"numpy.abs",
"obspy.Catalog",
"obspy.clients.fdsn.Client",
"numpy.nanmedian",
"pandas.read_csv",
"obspy.geodetics.gps2dist_azimuth",
"obspy.core.event.Pick",
"numpy.isnan",
"obspy.core.event.ResourceIdentifier",
"datetime.datetime.utcnow",
"matplotlib.pyplot.figure",
"numpy.aran... | [((962, 998), 'os.stat', 'os.stat', (["(pathgpd + '/gpd_predict.py')"], {}), "(pathgpd + '/gpd_predict.py')\n", (969, 998), False, 'import os\n'), ((1003, 1043), 'os.stat', 'os.stat', (["(pathEQT + '/mseed_predictor.py')"], {}), "(pathEQT + '/mseed_predictor.py')\n", (1010, 1043), False, 'import os\n'), ((3835, 3939), ... |
import pytest
import numpy as np
from lumicks.pylake import channel
from lumicks.pylake.calibration import ForceCalibration
def test_calibration_timeseries_channels():
time_field = 'Stop time (ns)'
mock_calibration = ForceCalibration(time_field=time_field,
items=[
... | [
"lumicks.pylake.channel.TimeSeries",
"lumicks.pylake.channel.TimeTags.from_dataset",
"numpy.allclose",
"numpy.testing.assert_allclose",
"lumicks.pylake.channel.TimeTags",
"numpy.equal",
"lumicks.pylake.channel.Continuous",
"pytest.raises",
"numpy.arange",
"lumicks.pylake.channel.TimeSeries.from_da... | [((227, 592), 'lumicks.pylake.calibration.ForceCalibration', 'ForceCalibration', ([], {'time_field': 'time_field', 'items': "[{'Calibration Data': 50, time_field: 50}, {'Calibration Data': 20,\n time_field: 20}, {'Calibration Data': 30, time_field: 30}, {\n 'Calibration Data': 40, time_field: 40}, {'Calibration D... |
from ekphrasis.classes.preprocessor import TextPreProcessor
from ekphrasis.classes.tokenizer import SocialTokenizer
from ekphrasis.dicts.emoticons import emoticons
import re
from transformers import AutoTokenizer,AutoModelForSequenceClassification,AutoConfig
import numpy as np
import torch
from .model import *
from .ut... | [
"transformers.AutoConfig.from_pretrained",
"ekphrasis.classes.tokenizer.SocialTokenizer",
"torch.cat",
"transformers.AutoTokenizer.from_pretrained",
"torch.cuda.is_available",
"numpy.array",
"transformers.AutoModelForSequenceClassification.from_pretrained",
"re.sub"
] | [((1250, 1293), 'transformers.AutoConfig.from_pretrained', 'AutoConfig.from_pretrained', (['self.model_path'], {}), '(self.model_path)\n', (1276, 1293), False, 'from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig\n'), ((1305, 1330), 'torch.cuda.is_available', 'torch.cuda.is_available'... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
"""
AdaBoost/adaptive boosting工具类
"""
import matplotlib.pyplot as plt
import numpy as np
def ada_boost_train_ds(data_arr, class_labels, num_it=40):
"""
adaBoost训练
:param data_arr: 特征标签集合
:param class_labels: 分类标签集合
:param num_it: 迭代次数
:return: weak_cl... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"numpy.zeros",
"numpy.ones",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.exp",
"numpy.sign",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.mat"
] | [((1953, 1969), 'numpy.mat', 'np.mat', (['data_arr'], {}), '(data_arr)\n', (1959, 1969), True, 'import numpy as np\n'), ((2020, 2038), 'numpy.shape', 'np.shape', (['data_mat'], {}), '(data_mat)\n', (2028, 2038), True, 'import numpy as np\n'), ((4082, 4103), 'numpy.mat', 'np.mat', (['data_to_class'], {}), '(data_to_clas... |
# Copyright (c) 2021, TU Wien, Department of Geodesy and Geoinformation
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice,... | [
"numpy.sum",
"os.path.basename",
"numpy.datetime64",
"os.path.dirname",
"numpy.savetxt",
"numpy.dtype",
"datetime.datetime.now",
"numpy.hstack",
"datetime.timedelta",
"numpy.loadtxt",
"numpy.arange",
"glob.glob",
"warnings.warn",
"os.path.join"
] | [((13606, 13632), 'glob.glob', 'glob.glob', (['search_filename'], {}), '(search_filename)\n', (13615, 13632), False, 'import glob\n'), ((18412, 18429), 'datetime.timedelta', 'timedelta', ([], {'days': '(1)'}), '(days=1)\n', (18421, 18429), False, 'from datetime import timedelta\n'), ((19240, 19257), 'datetime.timedelta... |
import csv
import datetime
import os
import random
import re
import string
import warnings
from html import unescape
import graphviz
import lime
import lime.lime_tabular
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import shap
import spacy
import statsmodels.api as sm
from gensim.corpora impo... | [
"matplotlib.pyplot.title",
"spacy.cli.download",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.argmax",
"sklearn.feature_extraction.text.TfidfVectorizer",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.r2_score",
"sklea... | [((1169, 1202), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (1192, 1202), False, 'import warnings\n'), ((1219, 1247), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {}), "('en_core_web_sm')\n", (1229, 1247), False, 'import spacy\n'), ((1270, 1296), 'spacy.cli.do... |
import pandas as pd
import pickle
import numpy as np
from sk import rdivDemo
file = "./Processed/processed_100.p"
content = pickle.load(open(file))
temp = content['x264'][100]
files = temp.keys()
ll = []
for source in files:
targets = temp[source].keys()
l = [source]
for target in targets:
l.a... | [
"numpy.median",
"sk.rdivDemo"
] | [((378, 432), 'sk.rdivDemo', 'rdivDemo', (['"""x264"""', 'll'], {'isLatex': '(False)', 'globalMinMax': '(True)'}), "('x264', ll, isLatex=False, globalMinMax=True)\n", (386, 432), False, 'from sk import rdivDemo\n'), ((326, 357), 'numpy.median', 'np.median', (['temp[source][target]'], {}), '(temp[source][target])\n', (3... |
import sys
import numpy as np
import torch
def normalize_screen_coordinates(X, w, h):
assert X.shape[-1] == 2
return X / w * 2 - [1, h / w]
def world_to_camera(X, R, t):
Rt = wrap(qinverse, R)
return wrap(qrot, np.tile(Rt, (*X.shape[:-1], 1)), X - t)
def camera_to_world(X, R, t):
return wrap(... | [
"numpy.tile",
"torch.from_numpy"
] | [((231, 262), 'numpy.tile', 'np.tile', (['Rt', '(*X.shape[:-1], 1)'], {}), '(Rt, (*X.shape[:-1], 1))\n', (238, 262), True, 'import numpy as np\n'), ((326, 356), 'numpy.tile', 'np.tile', (['R', '(*X.shape[:-1], 1)'], {}), '(R, (*X.shape[:-1], 1))\n', (333, 356), True, 'import numpy as np\n'), ((510, 531), 'torch.from_nu... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 <NAME> <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
Study the problem where sensor reading and target-current offset is used.
And in this file, the target can be changing, different from sensor_offset_problem which as... | [
"matplotlib.pyplot.switch_backend",
"matplotlib.pyplot.show",
"numpy.sum",
"indoor_gym_model.SensorRangeGoalProblem",
"pyLib.all.subplots",
"floorPlan.construct_default_floor_plan",
"ppo_util.get_train_gym_config",
"ppo_util.train_a_gym_model",
"numpy.random.randint",
"numpy.array",
"matplotlib.... | [((910, 988), 'pyLib.all.getArgs', 'pl.getArgs', (['"""train"""', '"""show"""', '"""num4"""', '"""masstest"""', '"""final"""', '"""finaleval"""', '"""novio"""'], {}), "('train', 'show', 'num4', 'masstest', 'final', 'finaleval', 'novio')\n", (920, 988), True, 'import pyLib.all as pl\n'), ((1611, 1641), 'floorPlan.constr... |
import numpy as np
import torch
import imageio
# from action2motion
# Define a kinematic tree for the skeletal struture
humanact12_kinematic_chain = [[0, 1, 4, 7, 10],
[0, 2, 5, 8, 11],
[0, 3, 6, 9, 12, 15],
[9, 13, 16, 18, 20, 2... | [
"numpy.copy",
"matplotlib.pyplot.close",
"matplotlib.animation.FuncAnimation",
"imageio.mimread",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.tile",
"torch.is_tensor",
"matplotlib.pyplot.tight_layout"
] | [((1376, 1388), 'numpy.copy', 'np.copy', (['img'], {}), '(img)\n', (1383, 1388), True, 'import numpy as np\n'), ((1771, 1810), 'numpy.tile', 'np.tile', (['lastframe', '(timesize, 1, 1, 1)'], {}), '(lastframe, (timesize, 1, 1, 1))\n', (1778, 1810), True, 'import numpy as np\n'), ((2321, 2342), 'matplotlib.use', 'matplot... |
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 15 14:19:45 2014
@author: zah
"""
import abc
from collections import Sequence
from itertools import chain, repeat
import numpy as np
from nnets.neural_networks import (NeuralNetwork, HiddenNode, InputNode, OutputNode,
sigmoid_g, linear_g ... | [
"numpy.random.rand",
"itertools.chain",
"itertools.repeat"
] | [((6816, 6836), 'itertools.repeat', 'repeat', (['Layer', '(l - 2)'], {}), '(Layer, l - 2)\n', (6822, 6836), False, 'from itertools import chain, repeat\n'), ((6393, 6412), 'itertools.chain', 'chain', (['*self.layers'], {}), '(*self.layers)\n', (6398, 6412), False, 'from itertools import chain, repeat\n'), ((6475, 6500)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
LR with free ts
Created on Wed Dec 7 02:38:05 2016
@author: maxwell
"""
import numpy as np
import matplotlib.pyplot as plt
import time
import atmosphere as a
from parm import ChemParm, LWParm, SWParm
from solver import SolverFactory
from misc.humidity import mana... | [
"matplotlib.pyplot.clf",
"numpy.empty",
"atmosphere.Atmosphere.mcclatchy",
"matplotlib.pyplot.figure",
"solver.SolverFactory.create",
"parm.LWParm",
"parm.SWParm",
"time.clock",
"numpy.linspace",
"numpy.log10",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
... | [((379, 391), 'time.clock', 'time.clock', ([], {}), '()\n', (389, 391), False, 'import time\n'), ((580, 594), 'misc.humidity.manaberh', 'manaberh', (['plev'], {}), '(plev)\n', (588, 594), False, 'from misc.humidity import manaberh\n'), ((709, 731), 'numpy.linspace', 'np.linspace', (['(4)', '(10)', '(61)'], {}), '(4, 10... |
# -*- coding: utf-8 -*-
"""
Simple examples demonstrating the use of GLMeshItem.
"""
## Add path to library (just for examples; you do not need this)
import initExample
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
import pyqtgraph.opengl as gl
app = pg.mkQApp("GLMeshItem Example")
w = gl.GLViewWidg... | [
"numpy.empty",
"pyqtgraph.opengl.MeshData.sphere",
"pyqtgraph.opengl.GLGridItem",
"pyqtgraph.mkQApp",
"numpy.random.random",
"numpy.array",
"pyqtgraph.opengl.GLViewWidget",
"numpy.linspace",
"pyqtgraph.opengl.MeshData.cylinder",
"numpy.cos",
"numpy.sin",
"pyqtgraph.opengl.GLMeshItem"
] | [((271, 302), 'pyqtgraph.mkQApp', 'pg.mkQApp', (['"""GLMeshItem Example"""'], {}), "('GLMeshItem Example')\n", (280, 302), True, 'import pyqtgraph as pg\n'), ((307, 324), 'pyqtgraph.opengl.GLViewWidget', 'gl.GLViewWidget', ([], {}), '()\n', (322, 324), True, 'import pyqtgraph.opengl as gl\n'), ((422, 437), 'pyqtgraph.o... |
from bfmplot import pl
from bfmplot import mpl
from cycler import cycler
import numpy as np
from bfmplot.niceticks import NiceTicks
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
def strip_axis(ax,horizontal='right'):
"""Remove the right and the top axis"""
if horizontal == 'right':
ant... | [
"cycler.cycler",
"bfmplot.pl.xlim",
"numpy.arctan2",
"bfmplot.strip_axis",
"bfmplot.pl.locator_params",
"bfmplot.pl.yscale",
"bfmplot.pl.plot",
"mpl_toolkits.axes_grid1.inset_locator.inset_axes",
"numpy.array",
"bfmplot.niceticks.NiceTicks",
"numpy.linspace",
"bfmplot.pl.show",
"numpy.interp... | [((1414, 1434), 'cycler.cycler', 'cycler', ([], {'color': 'colors'}), '(color=colors)\n', (1420, 1434), False, 'from cycler import cycler\n'), ((5018, 5026), 'bfmplot.pl.gca', 'pl.gca', ([], {}), '()\n', (5024, 5026), False, 'from bfmplot import pl\n'), ((5031, 5041), 'bfmplot.pl.sca', 'pl.sca', (['ax'], {}), '(ax)\n',... |
import numpy as np
def SSE(thetas,BaseModel,data,states,parNames,weights,checkpoints=None):
"""
A function to return the sum of squared errors given a model prediction and a dataset.
Preferentially, the MLE is used to perform optimizations.
Parameters
-----------
BaseModel: model object
... | [
"numpy.log",
"numpy.isfinite"
] | [((5753, 5765), 'numpy.log', 'np.log', (['prob'], {}), '(prob)\n', (5759, 5765), True, 'import numpy as np\n'), ((5823, 5838), 'numpy.isfinite', 'np.isfinite', (['lp'], {}), '(lp)\n', (5834, 5838), True, 'import numpy as np\n'), ((7234, 7249), 'numpy.isfinite', 'np.isfinite', (['lp'], {}), '(lp)\n', (7245, 7249), True,... |
import os
import sys
import numpy as np
#sys.path.append("..")
sys.path.append("c:\\Users\\ali21\\Documents\\GitHub\\a-nice-mc")
#sys.path.append(os.getcwd())
def noise_sampler(bs):
return np.random.normal(0.0, 1.0, [bs, 64])
if __name__ == '__main__':
from a_nice_mc.objectives.expression.xy_exp_a_nice_mc i... | [
"sys.path.append",
"a_nice_mc.train.wgan_nll.Trainer",
"a_nice_mc.models.discriminator.MLPDiscriminator",
"numpy.random.normal",
"a_nice_mc.objectives.expression.xy_exp_a_nice_mc.XYModel",
"a_nice_mc.models.generator.create_nice_network"
] | [((64, 129), 'sys.path.append', 'sys.path.append', (['"""c:\\\\Users\\\\ali21\\\\Documents\\\\GitHub\\\\a-nice-mc"""'], {}), "('c:\\\\Users\\\\ali21\\\\Documents\\\\GitHub\\\\a-nice-mc')\n", (79, 129), False, 'import sys\n'), ((196, 232), 'numpy.random.normal', 'np.random.normal', (['(0.0)', '(1.0)', '[bs, 64]'], {}), ... |
## grama core functions
# <NAME>, March 2019
__all__ = [
"CopulaIndependence",
"CopulaGaussian",
"Domain",
"Density",
"Function",
"FunctionModel",
"FunctionVectorized",
"Model",
"NaN",
]
import copy
import networkx as nx
import warnings
from grama import pipe, valid_dist, param_dis... | [
"scipy.linalg.solve",
"numpy.random.seed",
"numpy.ones",
"numpy.diag",
"networkx.draw_networkx_edge_labels",
"pandas.DataFrame",
"warnings.simplefilter",
"numpy.isfinite",
"scipy.stats.norm.cdf",
"warnings.catch_warnings",
"numpy.linalg.cholesky",
"scipy.stats.norm.ppf",
"copy.deepcopy",
"... | [((3102, 3143), 'pandas.DataFrame', 'DataFrame', ([], {'data': 'results', 'columns': 'self.out'}), '(data=results, columns=self.out)\n', (3111, 3143), False, 'from pandas import DataFrame, concat\n'), ((5147, 5165), 'copy.copy', 'copy.copy', (['md.name'], {}), '(md.name)\n', (5156, 5165), False, 'import copy\n'), ((944... |
# Mute tensorflow debugging information on console
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from flask import Flask, request, render_template, jsonify
from scipy.misc import imsave, imread, imresize
import numpy as np
import argparse
from keras.models import model_from_yaml
import re
import base64
import pic... | [
"argparse.ArgumentParser",
"numpy.invert",
"numpy.argmax",
"flask.Flask",
"base64.decodebytes",
"flask.jsonify",
"flask.request.get_data",
"flask.render_template",
"scipy.misc.imsave",
"scipy.misc.imresize",
"tensorflow.get_default_graph",
"re.search",
"numpy.delete",
"scipy.misc.imread",
... | [((376, 398), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (396, 398), True, 'import tensorflow as tf\n'), ((406, 421), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (411, 421), False, 'from flask import Flask, request, render_template, jsonify\n'), ((808, 842), 'keras.models.... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import Lasso, Ridge, LinearRegression
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.datasets import load_diabetes
diabetes = load_diabetes()
# create dataframe for easy boxplot
df = pd... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.plot",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"numpy.logspace",
"sklearn.datasets.load_diabetes",
"sklearn.linear_model.LinearRegress... | [((260, 275), 'sklearn.datasets.load_diabetes', 'load_diabetes', ([], {}), '()\n', (273, 275), False, 'from sklearn.datasets import load_diabetes\n'), ((318, 377), 'pandas.DataFrame', 'pd.DataFrame', (['diabetes.data'], {'columns': 'diabetes.feature_names'}), '(diabetes.data, columns=diabetes.feature_names)\n', (330, 3... |
import tensorflow as tf
import numpy as np
from tensorflow import keras
# simplest possible neural network
# one layer
# that layer has one neuron
# the input shape to it is only one value
model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])])
# loss function measures the distance of the guess fr... | [
"numpy.array",
"tensorflow.keras.layers.Dense"
] | [((595, 649), 'numpy.array', 'np.array', (['[-1.0, 0.0, 1.0, 2.0, 3.0, 4.0]'], {'dtype': 'float'}), '([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float)\n', (603, 649), True, 'import numpy as np\n'), ((655, 711), 'numpy.array', 'np.array', (['[-2.0, 1.0, 4.0, 7.0, 10.0, 13.0]'], {'dtype': 'float'}), '([-2.0, 1.0, 4.0, 7.0, ... |
import numpy as np
import scipy.linalg as sla
import scipy.stats as stats
def normpdf(X, mu, sigma, method='direct'):
"""
Evaluates the PDF under the current GMM parameters.
Parameters
----------
X : array, shape (N, d)
The data.
mu : array, shape (d,)
Mean of the Gaussian.
... | [
"scipy.stats.norm",
"numpy.log",
"scipy.stats.entropy",
"numpy.zeros",
"numpy.einsum",
"scipy.stats.multivariate_normal",
"scipy.stats.norm.pdf",
"scipy.linalg.inv",
"scipy.linalg.det",
"numpy.exp"
] | [((2000, 2024), 'numpy.zeros', 'np.zeros', ([], {'shape': 'px.shape'}), '(shape=px.shape)\n', (2008, 2024), True, 'import numpy as np\n'), ((2149, 2170), 'scipy.stats.entropy', 'stats.entropy', (['px', 'qx'], {}), '(px, qx)\n', (2162, 2170), True, 'import scipy.stats as stats\n'), ((3049, 3060), 'numpy.zeros', 'np.zero... |
# coding: utf-8
import numpy as np
import random
import cv2
import glob
import os
import math
import xml.etree.cElementTree as ET
import xml.dom.minidom
from xml.dom.minidom import Document
from PIL import Image, ImageDraw
# 随机平移
def random_translate(img, bboxes, p=0.5):
# 随机平移
if random.random() < p:
... | [
"xml.dom.minidom.Document",
"numpy.ones",
"cv2.transpose",
"cv2.warpAffine",
"numpy.mean",
"numpy.sin",
"cv2.rectangle",
"os.path.join",
"cv2.getRotationMatrix2D",
"xml.etree.cElementTree.parse",
"random.randint",
"numpy.copy",
"numpy.random.randn",
"numpy.max",
"cv2.boundingRect",
"co... | [((5846, 5879), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(0)', 'high': '(90)'}), '(low=0, high=90)\n', (5863, 5879), True, 'import numpy as np\n'), ((6127, 6172), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['center', 'angle', 'scale'], {}), '(center, angle, scale)\n', (6150, 6172), False, ... |
# author: <NAME>
DUMP_DIR = '__PKL__'
TF_LIST_FILENAME_POSTFIX = '_tf.pkl'
DF_LIST_FILENAME_POSTFIX = '_df.npy'
DL_LIST_FILENAME_POSTFIX = '_dl.npy'
LINK_LIST_FILENAME_POSTFIX = '_link.npz'
TERM2ID_DICT_FILENAME_POSTFIX = '_term2id.pkl'
ID2TERM_DICT_FILENAME_POSTFIX = '_id2term.pkl'
POSTING_LIST_FILENAME_POSTFIX = '_po... | [
"os.mkdir",
"numpy.load",
"numpy.save",
"pickle.dump",
"os.path.exists",
"numpy.zeros",
"numpy.append",
"wiki_xml_handler.wiki_xmlhandler",
"pickle.load",
"numpy.array",
"collections.Counter",
"os.path.join",
"termer.Termer",
"array_list.Array_List"
] | [((520, 544), 'os.path.exists', 'os.path.exists', (['DUMP_DIR'], {}), '(DUMP_DIR)\n', (534, 544), False, 'import os\n'), ((550, 568), 'os.mkdir', 'os.mkdir', (['DUMP_DIR'], {}), '(DUMP_DIR)\n', (558, 568), False, 'import os\n'), ((2656, 2686), 'wiki_xml_handler.wiki_xmlhandler', 'wiki_xmlhandler', (['xml_file_name'], {... |
# Copyright 2014-2019 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
#
# Unless required by appl... | [
"pyscf.adc.get_trans_moments",
"numpy.sum",
"numpy.einsum",
"pyscf.adc.uadc_ao2mo.calculate_chunk_size",
"numpy.argsort",
"pyscf.lib.logger.info",
"numpy.shape",
"pyscf.adc.ADC",
"pyscf.adc.get_properties",
"pyscf.adc.compute_trans_moments",
"pyscf.lib.current_memory",
"pyscf.adc.uadc_ao2mo.tr... | [((1042, 1060), 'pyscf.adc.method.lower', 'adc.method.lower', ([], {}), '()\n', (1058, 1060), False, 'from pyscf import adc\n'), ((1216, 1254), 'pyscf.lib.logger.Logger', 'logger.Logger', (['adc.stdout', 'adc.verbose'], {}), '(adc.stdout, adc.verbose)\n', (1229, 1254), False, 'from pyscf.lib import logger\n'), ((1321, ... |
# coding:utf-8
from __future__ import print_function
import tensorflow as tf
from config import *
import numpy as np
from numpy import *
import argparse
# import matplotlib
# matplotlib.use('Agg')
import sys
sys.path.insert(0, 'models')
from data_utils_hatn import *
from models import HATN
os.environ['CUDA_VISIBLE_DEV... | [
"tensorflow.train.Coordinator",
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.argmax",
"tensorflow.Session",
"sys.path.insert",
"tensorflow.concat",
"tensorflow.set_random_seed",
"tensorflow.train.start_queue_runners",
"tensorflow.ConfigProto",
"models.HATN",
"numpy.exp",
"tensorflo... | [((208, 236), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""models"""'], {}), "(0, 'models')\n", (223, 236), False, 'import sys\n'), ((333, 366), 'numpy.random.seed', 'np.random.seed', (['FLAGS.random_seed'], {}), '(FLAGS.random_seed)\n', (347, 366), True, 'import numpy as np\n'), ((409, 434), 'argparse.ArgumentPa... |
from csv import reader
import numpy as np
import numpy.polynomial.polynomial as poly
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
concentrations = []
delaR = []
with open("./data/twitch_ratio.csv") as csvFile:
data = reader(csvFile, delimite... | [
"mpl_toolkits.axes_grid1.host_subplot",
"matplotlib.pyplot.show",
"csv.reader",
"numpy.polynomial.polynomial.polyfit",
"matplotlib.pyplot.draw",
"numpy.polynomial.polynomial.polyval",
"numpy.linspace",
"matplotlib.pyplot.tight_layout"
] | [((442, 470), 'numpy.linspace', 'np.linspace', (['(-7.5)', '(-5)', '(10000)'], {}), '(-7.5, -5, 10000)\n', (453, 470), True, 'import numpy as np\n'), ((483, 510), 'numpy.linspace', 'np.linspace', (['(-7.5)', '(-6)', '(1000)'], {}), '(-7.5, -6, 1000)\n', (494, 510), True, 'import numpy as np\n'), ((519, 557), 'numpy.pol... |
# 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.
from __future__ import print_function
import numpy as np
import scipy.constants
from pyiron_atomistics.atomistics.maste... | [
"numpy.trace",
"numpy.sum",
"numpy.floor",
"numpy.einsum",
"collections.defaultdict",
"numpy.isclose",
"numpy.mean",
"numpy.arange",
"numpy.linalg.norm",
"numpy.round",
"numpy.unique",
"numpy.zeros_like",
"numpy.eye",
"itertools.product",
"numpy.linalg.det",
"numpy.asarray",
"numpy.t... | [((1529, 1551), 'numpy.zeros', 'np.zeros', (['(3, 3, 3, 3)'], {}), '((3, 3, 3, 3))\n', (1537, 1551), True, 'import numpy as np\n'), ((1560, 1572), 'numpy.arange', 'np.arange', (['(3)'], {}), '(3)\n', (1569, 1572), True, 'import numpy as np\n'), ((1595, 1624), 'itertools.product', 'itertools.product', (['r', 'r', 'r', '... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
import numpy as np
from collections import defaultdict
import math
def get_mcts_agent(model_path,num_sims=25):
model = Connect4Net()
model.load_state_dict(torch.load(model_path))
model.eval()
mcts = MCTS(Game(),model)
de... | [
"torch.nn.Dropout",
"copy.deepcopy",
"torch.load",
"torch.nn.Conv2d",
"torch.nn.BatchNorm1d",
"collections.defaultdict",
"torch.exp",
"torch.nn.BatchNorm2d",
"numpy.array",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.device",
"torch.nn.functional.relu",
"torch.no_grad",
... | [((5472, 5492), 'copy.deepcopy', 'copy.deepcopy', (['board'], {}), '(board)\n', (5485, 5492), False, 'import copy\n'), ((5932, 5952), 'copy.deepcopy', 'copy.deepcopy', (['board'], {}), '(board)\n', (5945, 5952), False, 'import copy\n'), ((9693, 9708), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (9706, 9708), Fa... |
# Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... | [
"unittest.main",
"monai.transforms.RandGaussianSharpend",
"parameterized.parameterized.expand",
"numpy.array",
"numpy.testing.assert_allclose"
] | [((852, 1078), 'numpy.array', 'np.array', (['[[[5.2919216, 5.5854445, 5.29192], [11.3982, 12.62332, 11.398202], [\n 14.870525, 17.323769, 14.870527]], [[20.413757, 22.767355, 20.413757],\n [28.495504, 31.558315, 28.495499], [29.99236, 34.505676, 29.992361]]]'], {}), '([[[5.2919216, 5.5854445, 5.29192], [11.3982, ... |
import numpy as np
import keras.backend as K
from keras.models import Model
from keras.applications.resnet50 import ResNet50
from keras import layers
from keras.layers import Input
from keras.layers import Dense
from keras.layers import Flatten
from keras.layers import Activation
from keras.layers import LeakyReLU
f... | [
"keras.layers.Activation",
"keras.layers.DepthwiseConv2D",
"numpy.log2",
"keras.layers.add",
"keras.layers.Conv2DTranspose",
"keras.models.Model",
"keras.applications.resnet50.ResNet50",
"numpy.array",
"keras.layers.Conv2D",
"keras.layers.UpSampling2D",
"keras.layers.ZeroPadding2D",
"keras.lay... | [((2448, 2469), 'keras.layers.add', 'layers.add', (['[x, skip]'], {}), '([x, skip])\n', (2458, 2469), False, 'from keras import layers\n'), ((3838, 3901), 'keras.applications.resnet50.ResNet50', 'ResNet50', ([], {'include_top': '(False)', 'input_tensor': 'x', 'weights': '"""imagenet"""'}), "(include_top=False, input_te... |
# Test unit test
import unittest
import sys
sys.path.append('../../')
import shutil
import heat_conduction
import pybitup
import numpy as np
from matplotlib import pyplot as plt
import pandas as pd
import pickle
class TestPCE(unittest.TestCase):
def test_pce_only(self):
""" Test pce using implemen... | [
"numpy.load",
"pandas.read_csv",
"matplotlib.pyplot.figure",
"numpy.mean",
"pickle.load",
"numpy.arange",
"shutil.rmtree",
"sys.path.append",
"matplotlib.pyplot.rcParams.update",
"numpy.loadtxt",
"heat_conduction.HeatConduction",
"numpy.var",
"numpy.trapz",
"matplotlib.pyplot.show",
"mat... | [((48, 73), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (63, 73), False, 'import sys\n'), ((1036, 1059), 'shutil.rmtree', 'shutil.rmtree', (['"""output"""'], {}), "('output')\n", (1049, 1059), False, 'import shutil\n'), ((1827, 1850), 'shutil.rmtree', 'shutil.rmtree', (['"""output"""']... |
'''
This module has functions or callable objects that can be used to compute features from segmented
time series data
Sets of these functions or callables can be passed in a dictionary object to initialize the
``FeatureRep`` transformer.
All functions follow the same template and process a single segmented time seri... | [
"scipy.stats.gmean",
"numpy.sum",
"numpy.abs",
"scipy.stats.variation",
"numpy.histogram",
"numpy.mean",
"numpy.arange",
"numpy.std",
"numpy.fft.fft",
"numpy.max",
"numpy.median",
"numpy.corrcoef",
"numpy.triu_indices",
"numpy.min",
"numpy.atleast_3d",
"numpy.count_nonzero",
"numpy.z... | [((2558, 2576), 'numpy.mean', 'np.mean', (['X'], {'axis': '(1)'}), '(X, axis=1)\n', (2565, 2576), True, 'import numpy as np\n'), ((2681, 2701), 'numpy.median', 'np.median', (['X'], {'axis': '(1)'}), '(X, axis=1)\n', (2690, 2701), True, 'import numpy as np\n'), ((2774, 2796), 'scipy.stats.gmean', 'stats.gmean', (['X'], ... |
from typing import Union
import numpy as np
from numba import njit
from jesse.helpers import get_candle_source, slice_candles
def high_pass_2_pole(candles: np.ndarray, period: int = 48, source_type: str = "close", sequential: bool = False) -> \
Union[
float, np.ndarray]:
"""
(2 pole) hig... | [
"numpy.copy",
"jesse.helpers.get_candle_source",
"numpy.isnan",
"numpy.sin",
"numpy.cos",
"jesse.helpers.slice_candles"
] | [((569, 603), 'jesse.helpers.slice_candles', 'slice_candles', (['candles', 'sequential'], {}), '(candles, sequential)\n', (582, 603), False, 'from jesse.helpers import get_candle_source, slice_candles\n'), ((618, 669), 'jesse.helpers.get_candle_source', 'get_candle_source', (['candles'], {'source_type': 'source_type'})... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 12:05:08 2018
@author: Alexandre
"""
###############################################################################
import numpy as np
###############################################################################
from pyro.dynamic import pendulum
from pyro.control ... | [
"pyro.planning.plan.load_trajectory",
"pyro.dynamic.pendulum.DoublePendulum",
"pyro.control.nonlinear.SlidingModeController",
"numpy.array"
] | [((457, 482), 'pyro.dynamic.pendulum.DoublePendulum', 'pendulum.DoublePendulum', ([], {}), '()\n', (480, 482), False, 'from pyro.dynamic import pendulum\n'), ((505, 552), 'pyro.planning.plan.load_trajectory', 'plan.load_trajectory', (['"""double_pendulum_rrt.npy"""'], {}), "('double_pendulum_rrt.npy')\n", (525, 552), F... |
# -*- coding: utf-8 -*-
#
from __future__ import division, print_function
import math
import numpy
from quadpy.helpers import get_all_exponents
def check_degree_1d(quadrature, exact, max_degree, tol=1.0e-14):
val = quadrature(
lambda x: [x ** degree for degree in range(max_degree + 1)]
).flatten()
... | [
"numpy.vectorize",
"numpy.sum",
"numpy.logical_not",
"numpy.prod",
"numpy.any",
"numpy.finfo",
"quadpy.helpers.get_all_exponents",
"numpy.array",
"math.gamma",
"numpy.where",
"numpy.all"
] | [((816, 850), 'quadpy.helpers.get_all_exponents', 'get_all_exponents', (['dim', 'max_degree'], {}), '(dim, max_degree)\n', (833, 850), False, 'from quadpy.helpers import get_all_exponents\n'), ((886, 950), 'numpy.array', 'numpy.array', (['[item for sublist in exponents for item in sublist]'], {}), '([item for sublist i... |
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import pytest
import alchemlyb
from alchemtest.gmx import load_benzene
from alchemlyb.parsing.gmx import extract_u_nk, extract_dHdl
from alchemlyb.estimators import MBAR, TI, BAR
from alchemlyb.visualisation.mbar_matrix import plo... | [
"alchemlyb.parsing.gmx.extract_u_nk",
"alchemlyb.convergence.forward_backward_convergence",
"alchemlyb.estimators.BAR",
"alchemlyb.estimators.MBAR",
"matplotlib.pyplot.close",
"alchemlyb.estimators.TI",
"alchemlyb.visualisation.dF_state.plot_dF_state",
"pytest.fixture",
"alchemlyb.visualisation.mbar... | [((773, 779), 'alchemlyb.estimators.MBAR', 'MBAR', ([], {}), '()\n', (777, 779), False, 'from alchemlyb.estimators import MBAR, TI, BAR\n'), ((1474, 1478), 'alchemlyb.estimators.TI', 'TI', ([], {}), '()\n', (1476, 1478), False, 'from alchemlyb.estimators import MBAR, TI, BAR\n'), ((1516, 1537), 'alchemlyb.visualisation... |
# -*- coding: utf-8 -*-
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2012-2018 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: <NAME> (<EMAIL>)
# <NAME> (<EMAIL>)
#
# Permission is hereby g... | [
"numpy.uint32",
"numpy.empty",
"numpy.float32",
"numpy.dtype",
"numpy.ascontiguousarray",
"numpy.finfo",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.linspace",
"os.linesep.join",
"threading.Semaphore",
"collections.OrderedDict",
"logging.getLogger",
"numpy.int8"
] | [((2705, 2732), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2722, 2732), False, 'import logging\n'), ((3721, 3742), 'threading.Semaphore', 'threading.Semaphore', ([], {}), '()\n', (3740, 3742), False, 'import threading\n'), ((5374, 5690), 'os.linesep.join', 'os.linesep.join', (["[\n ... |
import numpy as np
import nnabla as nn
import nnabla.functions as F
def clip_by_value(x, minimum, maximum):
return F.minimum_scalar(F.maximum_scalar(x, minimum), maximum)
def set_seed(seed):
np.random.seed(seed)
nn.random.prng = np.random.RandomState(seed)
| [
"nnabla.functions.maximum_scalar",
"numpy.random.seed",
"numpy.random.RandomState"
] | [((203, 223), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (217, 223), True, 'import numpy as np\n'), ((245, 272), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (266, 272), True, 'import numpy as np\n'), ((138, 166), 'nnabla.functions.maximum_scalar', 'F.maximum_... |
from typing import Dict, List
import numpy as np
from pprint import pprint
from numba import jit, njit
file = '2021/inputs/d17.txt'
# Read the file
with open(file) as f:
lines = [line.strip() for line in f if line.strip()]
Rx, Ry = lines[0].replace('target area: ', '').split(', ')
Rx = list(map(int, Rx[len('x=')... | [
"numpy.array",
"numpy.arange"
] | [((2457, 2480), 'numpy.array', 'np.array', (['possibilities'], {}), '(possibilities)\n', (2465, 2480), True, 'import numpy as np\n'), ((913, 942), 'numpy.arange', 'np.arange', (['vy_min', '(vy_max + 1)'], {}), '(vy_min, vy_max + 1)\n', (922, 942), True, 'import numpy as np\n'), ((1657, 1686), 'numpy.arange', 'np.arange... |
import os
import h5py
from PIL import Image
from skimage import img_as_ubyte
import numpy as np
from sklearn.decomposition import PCA
from sklearn import svm
from sklearn.ensemble import (
ExtraTreesClassifier,
RandomForestClassifier,
GradientBoostingClassifier,
)
from sklearn.neural_network... | [
"survos2.frontend.nb_utils.slice_plot",
"survos2.entity.entities.make_entity_df",
"numpy.sum",
"numpy.nan_to_num",
"sklearn.preprocessing.StandardScaler",
"numpy.argmax",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"survos2.entity.pipeline_ops.make_features",
"sur... | [((2015, 2085), 'sklearn.model_selection.train_test_split', 'train_test_split', (['reduced_data', 'labels'], {'test_size': '(0.9)', 'random_state': '(41)'}), '(reduced_data, labels, test_size=0.9, random_state=41)\n', (2031, 2085), False, 'from sklearn.model_selection import train_test_split\n'), ((2538, 2585), 'sklear... |
import datetime
import numpy as np
import copy
import write_midi
import tensorflow as tf
# new added functions for cyclegan
class ImagePool(object):
def __init__(self, maxsize=50):
self.maxsize = maxsize
self.num_img = 0
self.images = []
def __call__(self, image):
... | [
"numpy.load",
"tensorflow.logical_and",
"numpy.zeros",
"copy.copy",
"write_midi.write_piano_rolls_to_midi",
"numpy.random.rand",
"tensorflow.reduce_max",
"datetime.datetime.now"
] | [((2362, 2523), 'write_midi.write_piano_rolls_to_midi', 'write_midi.write_piano_rolls_to_midi', ([], {'piano_rolls': 'padded_bars_list', 'program_nums': '[0]', 'is_drum': '[False]', 'filename': 'file_path', 'tempo': 'tempo', 'beat_resolution': '(4)'}), '(piano_rolls=padded_bars_list,\n program_nums=[0], is_drum=[Fal... |
import matplotlib
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
from visual_dynamics.utils.visualization import vis_square
matplotlib.rcParams['image.cmap'] = 'viridis'
class GridImageVisualizer(object):
def __init__(self, fig, gs, num_plots=None, rows=None, cols=Non... | [
"matplotlib.pyplot.subplot",
"visual_dynamics.utils.visualization.vis_square",
"numpy.squeeze",
"matplotlib.gridspec.GridSpecFromSubplotSpec",
"numpy.sqrt"
] | [((1196, 1274), 'matplotlib.gridspec.GridSpecFromSubplotSpec', 'gridspec.GridSpecFromSubplotSpec', (['rows', 'cols'], {'subplot_spec': 'self._gs_image_axis'}), '(rows, cols, subplot_spec=self._gs_image_axis)\n', (1228, 1274), True, 'import matplotlib.gridspec as gridspec\n'), ((1304, 1339), 'matplotlib.pyplot.subplot',... |
import numpy as np
import utm
import cv2
from collections import defaultdict
import logging
logger = logging.getLogger('app.' + __name__)
class Fov:
def __init__(self):
logger.debug(f'Creating instance of Fov {self}')
self.image_size = None
self.horizontal_fov = None
self.vertical... | [
"numpy.load",
"utm.from_latlon",
"utm.to_latlon",
"numpy.transpose",
"collections.defaultdict",
"numpy.tan",
"numpy.array",
"numpy.sin",
"numpy.matmul",
"numpy.cos",
"logging.getLogger"
] | [((102, 138), 'logging.getLogger', 'logging.getLogger', (["('app.' + __name__)"], {}), "('app.' + __name__)\n", (119, 138), False, 'import logging\n'), ((678, 695), 'numpy.load', 'np.load', (['mat_file'], {}), '(mat_file)\n', (685, 695), True, 'import numpy as np\n'), ((1816, 1874), 'numpy.array', 'np.array', (['[self.... |
"""
Code for the velociraptor project.
"""
import logging as logger
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table
from matplotlib.ticker import MaxNLocator
from scipy.stats import norm
from astropy.io import fits
import stan_utils as stan
import mpl_utils
plt.style.use(mpl_utils... | [
"numpy.random.seed",
"numpy.polyfit",
"matplotlib.pyplot.style.use",
"numpy.mean",
"numpy.unique",
"numpy.nanmean",
"numpy.atleast_2d",
"numpy.polyval",
"numpy.isfinite",
"numpy.max",
"numpy.linspace",
"numpy.log10",
"matplotlib.pyplot.subplots",
"numpy.percentile",
"numpy.min",
"astro... | [((297, 331), 'matplotlib.pyplot.style.use', 'plt.style.use', (['mpl_utils.mpl_style'], {}), '(mpl_utils.mpl_style)\n', (310, 331), True, 'import matplotlib.pyplot as plt\n'), ((333, 351), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (347, 351), True, 'import numpy as np\n'), ((732, 758), 'astropy.t... |
# Script to transform netCDF4 files to netCDF3
import pdb
import cdms2
import cdtime
import MV2
import numpy as np
#import pdb (python debugger)
# Creates a netCDF3 file
cdms2.setNetcdfShuffleFlag(0)
cdms2.setNetcdfDeflateFlag(0)
cdms2.setNetcdfDeflateLevelFlag(0)
# Reads-in text file skipping header and last lin... | [
"cdms2.setNetcdfDeflateFlag",
"cdms2.setNetcdfShuffleFlag",
"cdms2.open",
"cdms2.setNetcdfDeflateLevelFlag",
"cdtime.comptime",
"numpy.zeros",
"cdms2.createAxis",
"numpy.loadtxt"
] | [((174, 203), 'cdms2.setNetcdfShuffleFlag', 'cdms2.setNetcdfShuffleFlag', (['(0)'], {}), '(0)\n', (200, 203), False, 'import cdms2\n'), ((204, 233), 'cdms2.setNetcdfDeflateFlag', 'cdms2.setNetcdfDeflateFlag', (['(0)'], {}), '(0)\n', (230, 233), False, 'import cdms2\n'), ((234, 268), 'cdms2.setNetcdfDeflateLevelFlag', '... |
import numpy as np
import matplotlib.pyplot as plt
min_val = 0
max_val = 1
init_val = 0.2 + 0.0001
fig, ax = plt.subplots(2)
for i in range(1000):
steps = np.arange(0, 100)
sigma = (max_val - min_val) * 0.001
sigmas = [sigma]
vals = [init_val]
for step in steps:
if step == 0:
c... | [
"numpy.abs",
"matplotlib.pyplot.show",
"numpy.arange",
"numpy.random.normal",
"matplotlib.pyplot.subplots"
] | [((111, 126), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)'], {}), '(2)\n', (123, 126), True, 'import matplotlib.pyplot as plt\n'), ((769, 779), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (777, 779), True, 'import matplotlib.pyplot as plt\n'), ((161, 178), 'numpy.arange', 'np.arange', (['(0)', '(10... |
import tensorflow
from tensorflow import keras
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras.models import load_model
# Pegando o dataset
dataset = keras.datasets.fashion_mnist
((imagens_treino, identificacoes_treino), (imagens_teste, identificacoes_teste)) = dataset.load_data()
len(imagens... | [
"matplotlib.pyplot.title",
"tensorflow.keras.models.load_model",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.argmax",
"tensorflow.keras.layers.Dense",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.legend",
"tensorflow.keras.layers.Dropout",
"matplotlib.pyplot.colorbar",
"matplotl... | [((680, 709), 'matplotlib.pyplot.imshow', 'plt.imshow', (['imagens_treino[0]'], {}), '(imagens_treino[0])\n', (690, 709), True, 'import matplotlib.pyplot as plt\n'), ((710, 724), 'matplotlib.pyplot.colorbar', 'plt.colorbar', ([], {}), '()\n', (722, 724), True, 'import matplotlib.pyplot as plt\n'), ((1364, 1387), 'tenso... |
# Copyright 2018-2020 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... | [
"pennylane.beta.queuing.operation.BetaTensor",
"pennylane.RX",
"pennylane._queuing.AnnotatedQueue",
"pennylane.Hermitian",
"pennylane.beta.queuing.measure.probs",
"pytest.raises",
"pennylane.device",
"numpy.array",
"pennylane.qnode",
"pennylane.CNOT",
"pytest.mark.parametrize"
] | [((996, 1109), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""stat_func,return_type"""', '[(expval, Expectation), (var, Variance), (sample, Sample)]'], {}), "('stat_func,return_type', [(expval, Expectation), (\n var, Variance), (sample, Sample)])\n", (1019, 1109), False, 'import pytest\n'), ((3535, 3594... |
'''
Implementation of Compositional Pattern Producing Networks in Tensorflow
https://en.wikipedia.org/wiki/Compositional_pattern-producing_network
@hardmaru, 2016
'''
import numpy as np
import tensorflow as tf
from ops import *
class CPPN():
def __init__(self, batch_size=1, z_dim = 4, c_dim = 1, scale = 8.0, net... | [
"tensorflow.ones",
"numpy.random.uniform",
"tensorflow.trainable_variables",
"tensorflow.nn.tanh",
"tensorflow.reshape",
"tensorflow.Session",
"numpy.ones",
"tensorflow.get_variable_scope",
"tensorflow.placeholder",
"numpy.arange",
"tensorflow.initialize_all_variables",
"numpy.sqrt"
] | [((1030, 1091), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[batch_size, x_dim, y_dim, c_dim]'], {}), '(tf.float32, [batch_size, x_dim, y_dim, c_dim])\n', (1044, 1091), True, 'import tensorflow as tf\n'), ((1266, 1323), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[self.batch_size, self... |
from datetime import datetime
import numpy as np
import pandas as pd
from pandas import (
Period,
Series,
date_range,
period_range,
to_datetime,
)
import pandas._testing as tm
class TestCombineFirst:
def test_combine_first_period_datetime(self):
# GH#3367
didx = date_range(st... | [
"pandas.date_range",
"numpy.random.randn",
"numpy.isfinite",
"pandas.DatetimeIndex",
"datetime.datetime",
"pandas._testing.makeIntIndex",
"pandas._testing.assert_series_equal",
"pandas.Period",
"pandas.Series",
"pandas._testing.makeStringIndex"
] | [((307, 365), 'pandas.date_range', 'date_range', ([], {'start': '"""1950-01-31"""', 'end': '"""1950-07-31"""', 'freq': '"""M"""'}), "(start='1950-01-31', end='1950-07-31', freq='M')\n", (317, 365), False, 'from pandas import Period, Series, date_range, period_range, to_datetime\n'), ((1337, 1377), 'pandas._testing.asse... |
import numpy
import logging
import sys
import os
from keras.models import Sequential
from keras.layers import Dense
from keras.losses import mean_squared_error
from keras.callbacks import ModelCheckpoint
from utils.file_names_builder import get_checkpoints_filename, get_neural_network_model_filename
from configuration.... | [
"numpy.random.seed",
"utils.file_names_builder.get_checkpoints_filename",
"keras.callbacks.ModelCheckpoint",
"utils.file_names_builder.get_neural_network_model_filename",
"keras.layers.Dense",
"keras.models.Sequential",
"sys.exit"
] | [((667, 693), 'utils.file_names_builder.get_checkpoints_filename', 'get_checkpoints_filename', ([], {}), '()\n', (691, 693), False, 'from utils.file_names_builder import get_checkpoints_filename, get_neural_network_model_filename\n'), ((1179, 1191), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1189, 1191... |
import numpy as np
def f(x):
return np.exp(-1*x**2)
def g(x):
return np.sin(x) / x
def compound_trapezoid_formula(inte, func, tol):
""" Calculate the integral by compound trapezoid formula
Args:
inte: ndarray, the integrand interval
func: function object, the integrand function
... | [
"numpy.fabs",
"numpy.sin",
"numpy.array",
"numpy.exp",
"numpy.linspace"
] | [((42, 61), 'numpy.exp', 'np.exp', (['(-1 * x ** 2)'], {}), '(-1 * x ** 2)\n', (48, 61), True, 'import numpy as np\n'), ((731, 772), 'numpy.linspace', 'np.linspace', (['inte[0]', 'inte[1]', '(2 ** n + 1)'], {}), '(inte[0], inte[1], 2 ** n + 1)\n', (742, 772), True, 'import numpy as np\n'), ((1544, 1576), 'numpy.linspac... |
# -*- coding: utf-8 -*-
# pylint: disable=missing-module-docstring
import cv2
import numpy as np
import pytesseract
from PIL import Image
def solve(path_or_img, show_process=False):
def _try_display():
if show_process:
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAl... | [
"cv2.bitwise_not",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"cv2.destroyAllWindows",
"cv2.copyMakeBorder",
"numpy.ones",
"pytesseract.image_to_string",
"cv2.imread",
"numpy.array",
"cv2.erode",
"cv2.imshow"
] | [((840, 877), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (852, 877), False, 'import cv2\n'), ((911, 958), 'cv2.threshold', 'cv2.threshold', (['img', '(150)', '(255)', 'cv2.THRESH_BINARY'], {}), '(img, 150, 255, cv2.THRESH_BINARY)\n', (924, 958), False, 'import cv... |
#!/usr/bin/python3
"""
Polyhedral set library.
This library implements convex regions of the form H x <= k, where H, x, and k
are matricies. It also provides convenient methods to find all the verticies.
"""
__author__ = '<NAME> (<EMAIL>)'
from frc971.control_loops.python import libcdd
import numpy
import string
im... | [
"frc971.control_loops.python.libcdd.dd_FreePolyhedra",
"frc971.control_loops.python.libcdd.dd_FreeMatrix",
"frc971.control_loops.python.libcdd.dd_DDMatrix2Poly",
"numpy.zeros",
"frc971.control_loops.python.libcdd.dd_get_d",
"frc971.control_loops.python.libcdd.dd_CopyGenerators",
"frc971.control_loops.py... | [((2914, 2973), 'frc971.control_loops.python.libcdd.dd_CreateMatrix', 'libcdd.dd_CreateMatrix', (['self.num_constraints', '(self.ndim + 1)'], {}), '(self.num_constraints, self.ndim + 1)\n', (2936, 2973), False, 'from frc971.control_loops.python import libcdd\n'), ((3657, 3691), 'frc971.control_loops.python.libcdd.dd_DD... |
#
# ImageViewGtk.py -- a backend for Ginga using Gtk widgets and Cairo
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
import os
import numpy as np
import gtk
import cairo
from ginga.gtkw import GtkHelp
from ginga.cairow import ImageViewCairo
from ginga i... | [
"ginga.gtkw.GtkHelp.pixbuf_new_from_data",
"ginga.gtkw.GtkHelp.make_cursor",
"gtk.VScrollbar",
"ginga.cairow.ImageViewCairo.ImageViewCairo.__init__",
"ginga.gtkw.GtkHelp.pixbuf_new_from_array",
"gtk.gdk.keyval_name",
"ginga.gtkw.GtkHelp.get_scroll_info",
"numpy.ascontiguousarray",
"os.path.join",
... | [((579, 676), 'ginga.cairow.ImageViewCairo.ImageViewCairo.__init__', 'ImageViewCairo.ImageViewCairo.__init__', (['self'], {'logger': 'logger', 'rgbmap': 'rgbmap', 'settings': 'settings'}), '(self, logger=logger, rgbmap=rgbmap,\n settings=settings)\n', (617, 676), False, 'from ginga.cairow import ImageViewCairo\n'), ... |
import copy
import pandas as pd
from ecmtool import extract_sbml_stoichiometry, get_conversion_cone
from ecmtool.helpers import unsplit_metabolites, print_ecms_direct, unique
import numpy as np
import os
def calc_ECMs(file_path, print_results=False, input_file_path='', print_metabolites_info=True):
"""
Calcul... | [
"pandas.DataFrame",
"copy.deepcopy",
"numpy.abs",
"os.getcwd",
"pandas.read_csv",
"ecmtool.extract_sbml_stoichiometry",
"numpy.transpose",
"numpy.where",
"numpy.array",
"numpy.repeat"
] | [((800, 868), 'ecmtool.extract_sbml_stoichiometry', 'extract_sbml_stoichiometry', (['file_path'], {'determine_inputs_outputs': '(True)'}), '(file_path, determine_inputs_outputs=True)\n', (826, 868), False, 'from ecmtool import extract_sbml_stoichiometry, get_conversion_cone\n'), ((1307, 1401), 'pandas.DataFrame', 'pd.D... |
# NCC: Neural Code Comprehension
# https://github.com/spcl/ncc
# Copyright 2018 ETH Zurich
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above... | [
"keras.models.load_model",
"pickle.dump",
"numpy.random.seed",
"numpy.argmax",
"keras.preprocessing.sequence.pad_sequences",
"numpy.empty",
"tensorflow.nn.l2_normalize",
"keras.models.Model",
"numpy.shape",
"tensorflow.ConfigProto",
"pickle.load",
"numpy.mean",
"keras.layers.Input",
"os.pa... | [((2025, 2100), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""input_data"""', '"""task/classifyapp"""', '"""Path to input data"""'], {}), "('input_data', 'task/classifyapp', 'Path to input data')\n", (2044, 2100), False, 'from absl import flags\n'), ((2101, 2222), 'absl.flags.DEFINE_string', 'flags.DEFINE_st... |
#!/bin/env python
import inspect
import os
from collections import OrderedDict
"""
# shell
aws s3 ls s3://grizli-v1/Pipeline/j000200m5558/Prep/j000200m5558_visits.npy --request-payer requester
# Python
import boto3
s3 = boto3.resource('s3')
bkt = s3.Bucket('grizli-v1')
field = 'j000200m5558'
s3_file = '{0}_visits.np... | [
"numpy.load",
"os.remove",
"grizli.utils.column_values_in_list",
"numpy.sum",
"boto3.client",
"numpy.clip",
"json.dumps",
"grizli.utils.drizzle_from_visit",
"inspect.getargvalues",
"matplotlib.pyplot.figure",
"boto3.resource",
"numpy.arange",
"glob.glob",
"astropy.io.fits.HDUList",
"os.p... | [((532, 545), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (543, 545), False, 'from collections import OrderedDict\n'), ((1058, 1076), 'grizli.aws.db.get_db_engine', 'db.get_db_engine', ([], {}), '()\n', (1074, 1076), False, 'from grizli.aws import db\n'), ((1090, 1188), 'grizli.aws.db.from_sql', 'db.fro... |
import numpy as np
from copy import deepcopy
from mushroom_rl.algorithms.value.td import TD
from mushroom_rl.utils.table import Table
class SpeedyQLearning(TD):
"""
Speedy Q-Learning algorithm.
"Speedy Q-Learning". Ghavamzadeh et. al.. 2011.
"""
def __init__(self, mdp_info, policy, learning_rate... | [
"copy.deepcopy",
"numpy.max",
"mushroom_rl.utils.table.Table"
] | [((335, 355), 'mushroom_rl.utils.table.Table', 'Table', (['mdp_info.size'], {}), '(mdp_info.size)\n', (340, 355), False, 'from mushroom_rl.utils.table import Table\n'), ((377, 388), 'copy.deepcopy', 'deepcopy', (['Q'], {}), '(Q)\n', (385, 388), False, 'from copy import deepcopy\n'), ((584, 600), 'copy.deepcopy', 'deepc... |
import numpy as np
import matplotlib.pyplot as plt
from scripts.forest import Forest
from sklearn.ensemble import IsolationForest
from sklearn.neighbors import LocalOutlierFactor
from sklearn.svm import OneClassSVM
import scripts.timeseries as ts
import pandas as pd
import time
import scipy.io as sio
from sklearn impor... | [
"pyod.models.pca.PCA",
"pandas.read_csv",
"numpy.std",
"numpy.transpose",
"numpy.zeros",
"scipy.io.savemat",
"time.time",
"numpy.shape",
"sklearn.metrics.precision_recall_curve",
"sklearn.metrics.roc_auc_score",
"numpy.mean",
"numpy.array",
"scripts.timeseries.shingle",
"pyod.models.knn.KN... | [((610, 664), 'pandas.read_csv', 'pd.read_csv', (["('../data/numenta/' + datasets[i] + '.csv')"], {}), "('../data/numenta/' + datasets[i] + '.csv')\n", (621, 664), True, 'import pandas as pd\n'), ((703, 718), 'numpy.array', 'np.array', (['value'], {}), '(value)\n', (711, 718), True, 'import numpy as np\n'), ((823, 842)... |
import cv2
import numpy as np
frameWidth = 640
frameHeight = 480
# select webcam
# 0 will select default webcamera
cap = cv2.VideoCapture(0)
# set frame size
cap.set(3, frameWidth)
cap.set(4, frameHeight)
#change brightness. Id for it is 10
cap.set(10,150)
myColors = [[5,107,0,19,255,255],
... | [
"cv2.boundingRect",
"cv2.contourArea",
"cv2.circle",
"cv2.approxPolyDP",
"cv2.cvtColor",
"cv2.arcLength",
"cv2.waitKey",
"cv2.VideoCapture",
"numpy.array",
"cv2.imshow",
"cv2.inRange",
"cv2.findContours"
] | [((127, 146), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (143, 146), False, 'import cv2\n'), ((690, 726), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (702, 726), False, 'import cv2\n'), ((1256, 1319), 'cv2.findContours', 'cv2.findContours', (['i... |
"""A mini synthetic dataset for graph classification benchmark."""
import math, os
import networkx as nx
import numpy as np
from .dgl_dataset import DGLDataset
from .utils import save_graphs, load_graphs, makedirs
from .. import backend as F
from ..convert import graph as dgl_graph
from ..transform import add_self_loo... | [
"networkx.lollipop_graph",
"networkx.circular_ladder_graph",
"networkx.wheel_graph",
"numpy.random.seed",
"networkx.grid_graph",
"os.path.exists",
"networkx.cycle_graph",
"numpy.random.randint",
"networkx.convert_node_labels_to_integers",
"numpy.array",
"networkx.complete_graph",
"networkx.sta... | [((3119, 3145), 'os.path.exists', 'os.path.exists', (['graph_path'], {}), '(graph_path)\n', (3133, 3145), False, 'import math, os\n'), ((3829, 3849), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (3843, 3849), True, 'import numpy as np\n'), ((4580, 4629), 'numpy.random.randint', 'np.random.randint'... |
import numpy as np
import lsst.geom as geom
import pickle
outFile = open('pointingList.obj', 'wb')
## Get pointing angles
pointingList = []
currLat = 2
while(currLat < 89):
# Go to center
currLon = 90
midPoint = geom.SpherePoint(currLon, currLat, geom.degrees)
pointingList.append(midPoint)
# G... | [
"lsst.geom.SpherePoint",
"pickle.dump",
"numpy.arange",
"numpy.cos"
] | [((1776, 1810), 'pickle.dump', 'pickle.dump', (['pointingList', 'outFile'], {}), '(pointingList, outFile)\n', (1787, 1810), False, 'import pickle\n'), ((229, 277), 'lsst.geom.SpherePoint', 'geom.SpherePoint', (['currLon', 'currLat', 'geom.degrees'], {}), '(currLon, currLat, geom.degrees)\n', (245, 277), True, 'import l... |
import os
import cv2
import re
import sys
import argparse
import numpy as np
import copy
import json
import annolist.AnnotationLib as al
from xml.etree import ElementTree
def annotation_to_h5(H, a, cell_width, cell_height, max_len):
region_size = H['region_size']
assert H['region_size'] == H['image_height'] / ... | [
"numpy.random.uniform",
"copy.deepcopy",
"json.load",
"json.dump",
"xml.etree.ElementTree.parse",
"scipy.io.loadmat",
"random.shuffle",
"os.path.dirname",
"numpy.zeros",
"annolist.AnnotationLib.AnnoRect",
"numpy.fliplr",
"numpy.array",
"numpy.random.random_integers",
"cv2.resize"
] | [((712, 773), 'numpy.zeros', 'np.zeros', (['(1, cells_per_image, 4, max_len, 1)'], {'dtype': 'np.float'}), '((1, cells_per_image, 4, max_len, 1), dtype=np.float)\n', (720, 773), True, 'import numpy as np\n'), ((792, 853), 'numpy.zeros', 'np.zeros', (['(1, cells_per_image, 1, max_len, 1)'], {'dtype': 'np.float'}), '((1,... |
# -*- coding: utf-8 -*-
"""CoolProp media model library.
The CoolProp media model library provides interfaces to calculations of
equations of state and transport properties with the CoolProp and
CoolProp HumidAir library.
"""
from __future__ import annotations
from enum import Enum, auto
from typing import List, Ty... | [
"numpy.poly1d",
"math.exp",
"CoolProp.AbstractState",
"thermd.core.StatePhases",
"scipy.optimize.fsolve",
"CoolProp.CoolProp.PropsSI",
"numpy.array",
"CoolProp.HumidAirProp.HAPropsSI",
"enum.auto",
"numpy.float64",
"math.log",
"thermd.helper.get_logger"
] | [((712, 732), 'thermd.helper.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (722, 732), False, 'from thermd.helper import get_logger\n'), ((5438, 5444), 'enum.auto', 'auto', ([], {}), '()\n', (5442, 5444), False, 'from enum import Enum, auto\n'), ((5459, 5465), 'enum.auto', 'auto', ([], {}), '()\n', (54... |
import os, sys
sys.path.append("./scripts/data_loader")
from augmentation import augment
import tensorflow as tf
import numpy as np
from contextlib import ExitStack
def mnist_batch_input_fn(dataset, batch_size=100, seed=555, num_epochs=1):
# If seed is defined, this will shuffle data into batches
np_labels ... | [
"sys.path.append",
"tensorflow.convert_to_tensor",
"numpy.asarray",
"tensorflow.reshape",
"tensorflow.constant",
"augmentation.augment",
"contextlib.ExitStack",
"tensorflow.cast",
"tensorflow.image.decode_image",
"tensorflow.read_file",
"tensorflow.train.batch",
"os.path.join",
"tensorflow.t... | [((15, 55), 'sys.path.append', 'sys.path.append', (['"""./scripts/data_loader"""'], {}), "('./scripts/data_loader')\n", (30, 55), False, 'import os, sys\n'), ((322, 360), 'numpy.asarray', 'np.asarray', (['dataset[1]'], {'dtype': 'np.int32'}), '(dataset[1], dtype=np.int32)\n', (332, 360), True, 'import numpy as np\n'), ... |
#!/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 ... | [
"pyannote.database.util.get_unique_identifier",
"pyannote.core.feature.SlidingWindowFeature",
"numpy.isnan",
"pyannote.audio.features.utils.read_audio",
"pyannote.core.segment.SlidingWindow",
"python_speech_features.mfcc"
] | [((2079, 2165), 'pyannote.core.segment.SlidingWindow', 'SlidingWindow', ([], {'start': '(-0.5 * self.duration)', 'duration': 'self.duration', 'step': 'self.step'}), '(start=-0.5 * self.duration, duration=self.duration, step=self\n .step)\n', (2092, 2165), False, 'from pyannote.core.segment import SlidingWindow\n'), ... |
import numpy as np
def load_lc():
DATA_DIR = "/Users/annaho/Dropbox/Projects/Research/ZTF18abukavn/data"
lsun = 3.839E33
dat = np.loadtxt("%s/physevol.dat" %DATA_DIR, dtype=str)
mjd = dat[:,0].astype(float)
mjd0 = 58370.1473
dt = mjd-mjd0
lum = dat[:,8].astype(float) * lsun # original unit... | [
"numpy.loadtxt"
] | [((141, 192), 'numpy.loadtxt', 'np.loadtxt', (["('%s/physevol.dat' % DATA_DIR)"], {'dtype': 'str'}), "('%s/physevol.dat' % DATA_DIR, dtype=str)\n", (151, 192), True, 'import numpy as np\n')] |
#!/usr/bin/python
#
# RBDL - Rigid Body Dynamics Library
# Copyright (c) 2011-2015 <NAME> <<EMAIL>>
#
# Licensed under the zlib license. See LICENSE for more details.
import unittest
import math
import numpy as np
from numpy.testing import *
import rbdl
class JointTests (unittest.TestCase):
def test_JointConst... | [
"rbdl.SpatialVector.fromPythonArray",
"numpy.ones",
"rbdl.CalcPointVelocity",
"unittest.main",
"rbdl.SpatialTransform",
"rbdl.ConstraintSet",
"rbdl.Joint.fromJointType",
"rbdl.Model",
"rbdl.Joint.fromJointAxes",
"rbdl.InverseDynamics",
"rbdl.CalcPointJacobian",
"math.sqrt",
"numpy.asarray",
... | [((10363, 10378), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10376, 10378), False, 'import unittest\n'), ((359, 403), 'numpy.asarray', 'np.asarray', (['[[1.0, 0.0, 0.0, 0.0, 0.0, 0.0]]'], {}), '([[1.0, 0.0, 0.0, 0.0, 0.0, 0.0]])\n', (369, 403), True, 'import numpy as np\n'), ((420, 450), 'rbdl.Joint.fromJoint... |
__all__ = ['imread']
import numpy as np
try:
from PIL import Image
except ImportError:
raise ImportError("The Python Image Library could not be found. "
"Please refer to http://pypi.python.org/pypi/PIL/ "
"for further instructions.")
from skimage.util import img_as... | [
"skimage.util.img_as_ubyte",
"numpy.asarray",
"PIL.Image.open",
"numpy.diff",
"numpy.array",
"numpy.issubdtype"
] | [((409, 426), 'PIL.Image.open', 'Image.open', (['fname'], {}), '(fname)\n', (419, 426), False, 'from PIL import Image\n'), ((892, 917), 'numpy.array', 'np.array', (['im'], {'dtype': 'dtype'}), '(im, dtype=dtype)\n', (900, 917), True, 'import numpy as np\n'), ((2411, 2442), 'numpy.issubdtype', 'np.issubdtype', (['arr.dt... |
"""Deep Mask heads above CenterNet (DeepMAC)[1] architecture.
[1]: https://arxiv.org/abs/2104.00613
"""
import collections
from absl import logging
import numpy as np
import tensorflow as tf
from object_detection.builders import losses_builder
from object_detection.core import box_list
from object_detection.core im... | [
"tensorflow.reduce_sum",
"tensorflow.clip_by_value",
"tensorflow.keras.layers.Dense",
"tensorflow.gather_nd",
"object_detection.models.keras_models.resnet_v1.stack_basic",
"tensorflow.reshape",
"object_detection.core.box_list.BoxList",
"object_detection.models.keras_models.hourglass_network.hourglass_... | [((935, 954), 'object_detection.utils.tf_version.is_tf2', 'tf_version.is_tf2', ([], {}), '()\n', (952, 954), False, 'from object_detection.utils import tf_version\n'), ((1538, 2045), 'collections.namedtuple', 'collections.namedtuple', (['"""DeepMACParams"""', "['classification_loss', 'dim', 'task_loss_weight', 'pixel_e... |
import numbers
import tensorflow as tf
from tensorflow.python.ops.parallel_for.gradients import batch_jacobian
import numpy as np
import importlib
# from https://github.com/tensorflow/tensorflow/blob/r1.9/tensorflow/contrib/layers/python/layers/regularizers.py
def ring_loss_regularizer(scale, scope=None):
# Re... | [
"tensorflow.python.ops.parallel_for.gradients.batch_jacobian",
"tensorflow.reduce_sum",
"importlib.import_module",
"tensorflow.summary.scalar",
"tensorflow.convert_to_tensor",
"tensorflow.reshape",
"tensorflow.reduce_mean",
"tensorflow.add",
"tensorflow.cast",
"tensorflow.multiply",
"tensorflow.... | [((18666, 18699), 'importlib.import_module', 'importlib.import_module', (['__name__'], {}), '(__name__)\n', (18689, 18699), False, 'import importlib\n'), ((890, 953), 'tensorflow.name_scope', 'tf.name_scope', (['scope', '"""contractive_regularizer"""', '[mean, cov, x]'], {}), "(scope, 'contractive_regularizer', [mean, ... |
# coding: utf-8
import os
import numpy as np
from scipy import sparse as sp
def load_corpus():
path = os.path.dirname(os.path.abspath(__file__))
train_data = open(os.path.join(path, "dexter_train.data"), "r")
train_labels = open(os.path.join(path, "dexter_train.labels"), "r")
valid_data = open(os.pat... | [
"os.path.abspath",
"scipy.sparse.vstack",
"numpy.asarray",
"scipy.sparse.lil_matrix",
"os.path.join"
] | [((446, 473), 'scipy.sparse.lil_matrix', 'sp.lil_matrix', (['(300, 20000)'], {}), '((300, 20000))\n', (459, 473), True, 'from scipy import sparse as sp\n'), ((503, 530), 'scipy.sparse.lil_matrix', 'sp.lil_matrix', (['(300, 20000)'], {}), '((300, 20000))\n', (516, 530), True, 'from scipy import sparse as sp\n'), ((125, ... |
import pickle
import cv2
import numpy as np
import torch
from tqdm import tqdm
# file_name -> path + name of the file
def load_images(file_name):
# get file content
with open(file_name, 'rb') as f:
info = pickle.load(f)
img_data = info['image_data']
class_dict = info['class_dict']
# crea... | [
"cv2.cvtColor",
"pickle.load",
"numpy.array",
"numpy.random.choice",
"numpy.random.permutation",
"numpy.unique",
"torch.from_numpy"
] | [((1321, 1341), 'numpy.unique', 'np.unique', (['img_set_y'], {}), '(img_set_y)\n', (1330, 1341), True, 'import numpy as np\n'), ((1421, 1476), 'numpy.random.choice', 'np.random.choice', (['unique_labels', 'num_way'], {'replace': '(False)'}), '(unique_labels, num_way, replace=False)\n', (1437, 1476), True, 'import numpy... |
""" test indexing with ix """
from warnings import catch_warnings
import numpy as np
import pandas as pd
from pandas.types.common import is_scalar
from pandas.compat import lrange
from pandas import Series, DataFrame, option_context, MultiIndex
from pandas.util import testing as tm
from pandas.core.common import Per... | [
"pandas.DataFrame",
"pandas.util.testing.getSeriesData",
"pandas.util.testing.assert_frame_equal",
"pandas.types.common.is_scalar",
"pandas.option_context",
"numpy.random.randn",
"pandas.MultiIndex.from_arrays",
"pandas.date_range",
"pandas.compat.lrange",
"pandas.to_datetime",
"pandas.Series",
... | [((434, 461), 'pandas.DataFrame', 'DataFrame', (["{'A': [1, 2, 3]}"], {}), "({'A': [1, 2, 3]})\n", (443, 461), False, 'from pandas import Series, DataFrame, option_context, MultiIndex\n'), ((728, 754), 'pandas.Series', 'Series', (['(0)'], {'index': '[4, 5, 6]'}), '(0, index=[4, 5, 6])\n', (734, 754), False, 'from panda... |
# -*- coding: utf-8 -*-
"""
Post-processing of WEST L and H modes
J.Hillairet
20/06/2014
ICRH Antenna radial position in WEST : 2890-3060 (170mm).
LPA radial position in WEST : 2880-3080 (200mm)
LH Antenna radial position in WEST : 2910-3060 (150mm)
Assumes %pylab environment
"""
import numpy as np
import scipy a... | [
"scipy.io.loadmat",
"numpy.savetxt",
"numpy.append",
"numpy.min",
"numpy.where",
"numpy.loadtxt",
"numpy.interp"
] | [((521, 599), 'numpy.loadtxt', 'np.loadtxt', (['"""Ne_prof_WEST_Hmode_01_LAD6_Rsep_293.txt"""'], {'skiprows': '(1)', 'unpack': '(True)'}), "('Ne_prof_WEST_Hmode_01_LAD6_Rsep_293.txt', skiprows=1, unpack=True)\n", (531, 599), True, 'import numpy as np\n'), ((614, 692), 'numpy.loadtxt', 'np.loadtxt', (['"""Ne_prof_WEST_H... |
import os
import numpy as np
import torch
from glob import glob
from torch.utils import data
from PIL import Image
from imageio import imread
import random
import cv2
class MVTec_Dataset(data.Dataset):
def __init__(self,root,obj,split="train"):
super().__init__()
self.root = root
self.split... | [
"torch.utils.data.DataLoader",
"datasets.CyCIF_Dataset",
"random.shuffle",
"numpy.asarray",
"imageio.imread",
"numpy.transpose",
"numpy.expand_dims",
"numpy.zeros",
"os.path.dirname",
"numpy.shape",
"PIL.Image.fromarray",
"os.path.splitext",
"glob.glob",
"torch.unsqueeze",
"os.path.split... | [((8873, 8910), 'datasets.CyCIF_Dataset', 'CyCIF_Dataset', (['data_path'], {'split': '"""val"""'}), "(data_path, split='val')\n", (8886, 8910), False, 'from datasets import CyCIF_Dataset\n'), ((8940, 8994), 'torch.utils.data.DataLoader', 'data.DataLoader', (['dataset'], {'batch_size': 'bs', 'num_workers': '(0)'}), '(da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.