code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
#! /usr/bin/env python
# -*- coding: iso-8859-15 -*-
# Updates:
# 2019 - 04 - 10: CLD incorporated instrument sensitivity assessment
# to convert transmission to units of % of expected stellar ... | [
"mircx_pipeline.files.write",
"mircx_pipeline.log.warning",
"argparse.ArgumentParser",
"mircx_pipeline.headers.getval",
"numpy.seterr",
"numpy.argsort",
"mircx_pipeline.log.trace",
"mircx_pipeline.plot.compact",
"mircx_pipeline.plot.base_name",
"mircx_pipeline.setup.base_name",
"mircx_pipeline.l... | [((945, 1081), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description', 'epilog': 'epilog', 'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'add_help': '(True)'}), '(description=description, epilog=epilog,\n formatter_class=argparse.RawDescriptionHelpFormatter, add_help=Tr... |
#! /usr/bin/env python3
import os
import math
import h5py as h5
import numpy as np
import sharpy.utils.algebra as algebra
import sharpy.utils.generate_cases as gc
def generate(x_dict={}, case_name=None):
"""
"""
if case_name is None:
case_name = 'base'
route = os.path.dirname(os.path.realpath... | [
"os.remove",
"configobj.ConfigObj",
"numpy.ones",
"os.path.isfile",
"numpy.sin",
"numpy.diag",
"numpy.savetxt",
"numpy.linspace",
"sharpy.utils.generate_cases.LagrangeConstraint",
"h5py.File",
"math.ceil",
"os.path.realpath",
"sharpy.utils.generate_cases.BodyInformation",
"numpy.cos",
"s... | [((2546, 2583), 'numpy.zeros', 'np.zeros', (['(n_lumped_mass,)'], {'dtype': 'int'}), '((n_lumped_mass,), dtype=int)\n', (2554, 2583), True, 'import numpy as np\n'), ((2603, 2629), 'numpy.zeros', 'np.zeros', (['(n_lumped_mass,)'], {}), '((n_lumped_mass,))\n', (2611, 2629), True, 'import numpy as np\n'), ((2681, 2712), '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 19 16:37:20 2019
@author: wei
"""
import os
import sys
sys.path.append(os.getcwd()+'/models')
sys.path.append(os.getcwd()+'/datasets')
import cv2
import time
import torch
import random
import pprint
import datetime
import argparse
import numpy as np... | [
"datasets.dataset.ImageFolder",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"matplotlib.pyplot.get_cmap",
"os.getcwd",
"cv2.imwrite",
"torch.load",
"torchvision.transforms.Normalize",
"time.time",
"PIL.Image.open",
"cv2.rectangle",
"datetime.timedelta",
"pprint.pprint",
"torc... | [((566, 591), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (589, 591), False, 'import argparse\n'), ((831, 849), 'pprint.pprint', 'pprint.pprint', (['opt'], {}), '(opt)\n', (844, 849), False, 'import pprint\n'), ((850, 868), 'pprint.pprint', 'pprint.pprint', (['cfg'], {}), '(cfg)\n', (863, 86... |
import glob
import sys
from textwrap import wrap
import matplotlib.pyplot as plt
import numpy as np
import statistics
plt.figure(figsize=(8.5, 6.0))
plt.rcdefaults()
def main(data_filename, output_dir, hexcolour):
generation_values = list(range(1, 11))
x = np.arange(500)
generation_data = []
with o... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"textwrap.wrap",
"matplotlib.pyplot.rcdefaults",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"sys.exit"
] | [((121, 151), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8.5, 6.0)'}), '(figsize=(8.5, 6.0))\n', (131, 151), True, 'import matplotlib.pyplot as plt\n'), ((152, 168), 'matplotlib.pyplot.rcdefaults', 'plt.rcdefaults', ([], {}), '()\n', (166, 168), True, 'import matplotlib.pyplot as plt\n'), ((270, 284),... |
import csv
from abc import ABC
import numpy as np
from scipy import sparse
from typing import Tuple
def load_data(path, headers=True):
max_item = 0
max_user = 0
data = []
pairs = []
with open(path, 'rt') as file:
reader = csv.reader(file, delimiter=',', quotechar='"')
if headers:
... | [
"numpy.random.rand",
"numpy.dot",
"scipy.sparse.lil_matrix",
"csv.reader"
] | [((686, 725), 'scipy.sparse.lil_matrix', 'sparse.lil_matrix', (['(max_item, max_user)'], {}), '((max_item, max_user))\n', (703, 725), False, 'from scipy import sparse\n'), ((252, 298), 'csv.reader', 'csv.reader', (['file'], {'delimiter': '""","""', 'quotechar': '"""\\""""'}), '(file, delimiter=\',\', quotechar=\'"\')\n... |
# -*- coding: utf-8 -*=
import math
import random
import director.vtkAll as vtk
import numpy as np
from director.debugVis import DebugData
class RaySensor(object):
"""Ray sensor."""
def __init__(self, num_rays=20, radius=10, min_angle=-90, max_angle=90, z_distance=2.5, bottles=None):
"""Constructs... | [
"director.debugVis.DebugData",
"numpy.ceil",
"random.uniform",
"math.radians",
"director.vtkAll.mutable",
"numpy.zeros",
"math.sin",
"numpy.array",
"math.cos"
] | [((657, 680), 'math.radians', 'math.radians', (['min_angle'], {}), '(min_angle)\n', (669, 680), False, 'import math\n'), ((707, 730), 'math.radians', 'math.radians', (['max_angle'], {}), '(max_angle)\n', (719, 730), False, 'import math\n'), ((902, 926), 'numpy.zeros', 'np.zeros', (['self._num_rays'], {}), '(self._num_r... |
from itertools import chain
import glob
import torch
from PIL import Image
from os import path
from torch.utils.data import Dataset
import numpy as np
import math
class SegmentationDataset(Dataset):
_EXTENSIONS = ["*.jpg", "*.jpeg", "*.png"] # , "*.tif"
def __init__(self, in_dir, crop_h, crop_w, transform)... | [
"torch.stack",
"PIL.Image.open",
"numpy.random.randint",
"os.path.splitext",
"os.path.split",
"os.path.join"
] | [((2644, 2688), 'torch.stack', 'torch.stack', (["[item['img'] for item in items]"], {}), "([item['img'] for item in items])\n", (2655, 2688), False, 'import torch\n'), ((2702, 2748), 'torch.stack', 'torch.stack', (["[item['annot'] for item in items]"], {}), "([item['annot'] for item in items])\n", (2713, 2748), False, ... |
# coding:utf-8
import numpy as np
import category_encoders as ce
class XgboostDataPrepare(object):
def __init__(self, *, train_feature, train_label, test_feature):
self.__train_feature = train_feature.copy()
self.__train_label = train_label.copy()
self.__test_feature = test_feature.copy(... | [
"category_encoders.TargetEncoder",
"numpy.where"
] | [((1058, 1076), 'category_encoders.TargetEncoder', 'ce.TargetEncoder', ([], {}), '()\n', (1074, 1076), True, 'import category_encoders as ce\n'), ((573, 622), 'numpy.where', 'np.where', (["(self.__train_feature.dtypes == 'object')"], {}), "(self.__train_feature.dtypes == 'object')\n", (581, 622), True, 'import numpy as... |
# -*- coding: utf-8 -*-
from recurrent_controller import RecurrentController
from dnc.dnc import DNC
import tensorflow as tf
import numpy as np
import pickle
import sys
import os
def llprint(message):
"""
Flushes message to stdout
:param message: A string to print.
:return: None.
"""
sys.stdo... | [
"sys.stdout.write",
"tensorflow.nn.softmax",
"os.path.realpath",
"numpy.zeros",
"tensorflow.compat.v1.Session",
"sys.stdout.flush",
"numpy.array",
"tensorflow.Graph",
"numpy.reshape",
"numpy.squeeze",
"os.path.join"
] | [((312, 337), 'sys.stdout.write', 'sys.stdout.write', (['message'], {}), '(message)\n', (328, 337), False, 'import sys\n'), ((342, 360), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (358, 360), False, 'import sys\n'), ((885, 917), 'numpy.zeros', 'np.zeros', (['size'], {'dtype': 'np.float32'}), '(size, dtyp... |
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
def plot_the_graph(filename, data_for_plot):
# data_for_plot = data.T
deltaloc = 0.32
locations = []
for i in range(0,8,2):
locations.extend([i + 1 - deltaloc, i + 1 + deltaloc])
locations = range(8... | [
"numpy.genfromtxt",
"seaborn.swarmplot",
"numpy.isnan",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((3223, 3312), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data/galectin_data/MCF7-mAG-gal13.txt"""'], {'delimiter': '"""\t"""', 'skip_header': '(4)'}), "('data/galectin_data/MCF7-mAG-gal13.txt', delimiter='\\t',\n skip_header=4)\n", (3236, 3312), True, 'import numpy as np\n'), ((3505, 3596), 'numpy.genfromtxt', 'np... |
import numpy as np
import pandas as pd
from Discovery import logger
class SentimentTable(object):
"""List of sentiment words"""
def __init__(self, data=None):
self.positive = []
self.negative = []
self.original_data = []
self.y = []
if data is not None:
for... | [
"numpy.log2",
"numpy.round"
] | [((3482, 3510), 'numpy.log2', 'np.log2', (['(positive / negative)'], {}), '(positive / negative)\n', (3489, 3510), True, 'import numpy as np\n'), ((3694, 3713), 'numpy.round', 'np.round', (['rating', '(2)'], {}), '(rating, 2)\n', (3702, 3713), True, 'import numpy as np\n')] |
###############################################################################
# Loader, Resizer, PixelExtractor, DnnFeaturizer
import numpy as np
import pandas
from nimbusml import Pipeline
from nimbusml.datasets.image import get_RevolutionAnalyticslogo, get_Microsoftlogo
from nimbusml.feature_extraction.image import... | [
"nimbusml.datasets.image.get_Microsoftlogo",
"nimbusml.feature_extraction.image.Loader",
"nimbusml.linear_model.FastLinearBinaryClassifier",
"nimbusml.Pipeline",
"nimbusml.feature_extraction.image.Resizer",
"nimbusml.datasets.image.get_RevolutionAnalyticslogo",
"nimbusml.feature_extraction.image.PixelEx... | [((743, 785), 'nimbusml.feature_extraction.image.Resizer', 'Resizer', ([], {'image_width': '(227)', 'image_height': '(227)'}), '(image_width=227, image_height=227)\n', (750, 785), False, 'from nimbusml.feature_extraction.image import Resizer\n'), ((800, 816), 'nimbusml.feature_extraction.image.PixelExtractor', 'PixelEx... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 9 07:00:53 2021
@author: Bianca
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
from scipy import signal
fs = 1000 # frequência de amostragem
t = np.arange(0, 2, 1/fs)
# constantes dos sinais
a = 1
b = 0.8
c = 0.75
delta1 = 0.25
del... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.correlate",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplo... | [((233, 256), 'numpy.arange', 'np.arange', (['(0)', '(2)', '(1 / fs)'], {}), '(0, 2, 1 / fs)\n', (242, 256), True, 'import numpy as np\n'), ((774, 801), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (784, 801), True, 'import matplotlib.pyplot as plt\n'), ((804, 824), 'ma... |
#!/usr/bin/env python3
import yaml
import numpy as np
import cv2
import rospy
from std_msgs.msg import Float32MultiArray
def callback(data):
filepath="/home/soumil/catkin_ws/src/camera_pos_vec/src/scripts"
filename="untitled"
camera_parameters=open(f"{filepath+'/'+filename}.yaml")
camera_parameters=ya... | [
"yaml.load",
"rospy.Subscriber",
"cv2.solvePnP",
"numpy.array",
"numpy.reshape",
"rospy.init_node",
"rospy.spin"
] | [((318, 370), 'yaml.load', 'yaml.load', (['camera_parameters'], {'Loader': 'yaml.FullLoader'}), '(camera_parameters, Loader=yaml.FullLoader)\n', (327, 370), False, 'import yaml\n'), ((441, 472), 'numpy.array', 'np.array', (["camera_matrix['data']"], {}), "(camera_matrix['data'])\n", (449, 472), True, 'import numpy as n... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue May 9 16:44:16 2017
@author: fleischer
"""
import pandas as pd
import numpy as np
import seaborn as sns
from astral import *
def firstAndLastLight(data, threshold_list, resamp=False):
''' firstAndLastLight(data, threshold_list, resamp=False) appli... | [
"pandas.tseries.offsets.Day",
"numpy.logical_not",
"pandas.Timedelta"
] | [((1141, 1181), 'numpy.logical_not', 'np.logical_not', (["data['Off-Wrist Status']"], {}), "(data['Off-Wrist Status'])\n", (1155, 1181), True, 'import numpy as np\n'), ((1790, 1814), 'pandas.tseries.offsets.Day', 'pd.tseries.offsets.Day', ([], {}), '()\n', (1812, 1814), True, 'import pandas as pd\n'), ((2337, 2358), 'p... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numba import *
from numba.testing import test_support
import numpy
import unittest
# NOTE: See also numba.tests.ops.test_binary_ops
def maxstar1d(a, b):
M = a.shape[0]
res = numpy.empty(M)
for i in range(M):
... | [
"numpy.abs",
"numpy.empty",
"numpy.max",
"numpy.random.random",
"numba.testing.test_support.main"
] | [((281, 295), 'numpy.empty', 'numpy.empty', (['M'], {}), '(M)\n', (292, 295), False, 'import numpy\n'), ((848, 867), 'numba.testing.test_support.main', 'test_support.main', ([], {}), '()\n', (865, 867), False, 'from numba.testing import test_support\n'), ((577, 600), 'numpy.random.random', 'numpy.random.random', (['(10... |
import gensim
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from matplotlib.mlab import PCA
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
# Load Doc2Vec model
model= Doc2Vec.load("d2v.model")
# Names for tags
names = ['Admiral_Ackbar', 'Ahsoka_Tano', 'Aragorn',... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"gensim.models.doc2vec.Doc2Vec.load",
"matplotlib.pyplot.text",
"matplotlib.mlab.PCA",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((224, 249), 'gensim.models.doc2vec.Doc2Vec.load', 'Doc2Vec.load', (['"""d2v.model"""'], {}), "('d2v.model')\n", (236, 249), False, 'from gensim.models.doc2vec import Doc2Vec, TaggedDocument\n'), ((2378, 2392), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (2386, 2392), True, 'import numpy as np\n'), ((2402, ... |
# mixmodels.py - Parametric model mixer
# ---------------------------------------------------------------
# This file is a part of DeerLab. License is MIT (see LICENSE.md).
# Copyright(c) 2019-2021: <NAME>, <NAME> and other contributors.
import numpy as np
import types
def mixmodels(*models):
r"""
... | [
"numpy.trapz",
"numpy.asarray",
"numpy.arange",
"numpy.atleast_1d",
"numpy.all"
] | [((2373, 2398), 'numpy.asarray', 'np.asarray', (["Info['Lower']"], {}), "(Info['Lower'])\n", (2383, 2398), True, 'import numpy as np\n'), ((2420, 2445), 'numpy.asarray', 'np.asarray', (["Info['Upper']"], {}), "(Info['Upper'])\n", (2430, 2445), True, 'import numpy as np\n'), ((2467, 2492), 'numpy.asarray', 'np.asarray',... |
# /benchmark.py
#
# Script to benchmark agent performance.
#
# See /LICENCE.md for Copyright information
"""Script to benchmark agent performance."""
import argparse
import sys
import os
import re
import subprocess
import matplotlib
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from... | [
"subprocess.run",
"os.path.abspath",
"matplotlib.pyplot.show",
"os.makedirs",
"argparse.ArgumentParser",
"matplotlib.pyplot.subplots",
"numpy.array",
"matplotlib.pyplot.subplots_adjust",
"re.search",
"matplotlib.pyplot.savefig"
] | [((500, 537), 'subprocess.run', 'subprocess.run', (['argv', '*args'], {}), '(argv, *args, **kwargs)\n', (514, 537), False, 'import subprocess\n'), ((1162, 1225), 're.search', 're.search', (['"""The final score is (?P<score>\\\\d+)."""', 'result.stdout'], {}), "('The final score is (?P<score>\\\\d+).', result.stdout)\n"... |
import unittest
import numpy as np
from scipy.sparse import random as sp_random
import dislib as ds
from dislib.regression import LinearRegression
from dislib.data import random_array
import dislib.data.util.model as utilmodel
class LinearRegressionTest(unittest.TestCase):
def test_univariate(self):
""... | [
"unittest.main",
"dislib.regression.LinearRegression",
"numpy.random.seed",
"scipy.sparse.random",
"dislib.data.random_array",
"numpy.allclose",
"dislib.array",
"numpy.array"
] | [((10464, 10479), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10477, 10479), False, 'import unittest\n'), ((380, 405), 'numpy.array', 'np.array', (['[1, 2, 3, 4, 5]'], {}), '([1, 2, 3, 4, 5])\n', (388, 405), True, 'import numpy as np\n'), ((423, 450), 'numpy.array', 'np.array', (['[2, 1, 1, 2, 4.5]'], {}), '([... |
# -*- coding: utf-8 -*-
"""
Image input-output functions.
Created on Thu Apr 19 22:00:00 2018
Author: <NAME> | CVPRU-ISICAL (http://www.isical.ac.in/~cvpr)
GitHub: https://github.com/prasunroy/cvutils
"""
# imports
import cv2
import numpy
import os
import requests
from .validation import imvalidate
# reads an imag... | [
"cv2.waitKey",
"cv2.imwrite",
"numpy.asarray",
"cv2.imdecode",
"os.path.exists",
"cv2.imread",
"requests.get",
"cv2.destroyAllWindows"
] | [((1164, 1184), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1178, 1184), False, 'import os\n'), ((1206, 1228), 'cv2.imread', 'cv2.imread', (['path', 'flag'], {}), '(path, flag)\n', (1216, 1228), False, 'import cv2\n'), ((1321, 1356), 'numpy.asarray', 'numpy.asarray', (['image'], {'dtype': '"""uint8... |
import os
import random
import unittest
from itertools import product
from src.models.layers import conv2d_complex
import tensorflow as tf
import numpy as np
from numpy.random import seed
from scipy.ndimage import rotate
from scipy.signal import convolve2d
from src.models.layers import ECHConv2D, CHConv2DCompleteRad... | [
"tensorflow.random.set_seed",
"unittest.main",
"numpy.random.uniform",
"numpy.random.seed",
"numpy.sum",
"scipy.signal.convolve2d",
"numpy.zeros",
"numpy.imag",
"random.seed",
"numpy.reshape",
"numpy.real",
"tensorflow.keras.initializers.Constant"
] | [((360, 378), 'random.seed', 'random.seed', (['(12345)'], {}), '(12345)\n', (371, 378), False, 'import random\n'), ((379, 386), 'numpy.random.seed', 'seed', (['(1)'], {}), '(1)\n', (383, 386), False, 'from numpy.random import seed\n'), ((387, 408), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(2)'], {}), '(2)... |
# Copyright 2022 Google.
#
# 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, soft... | [
"absl.testing.absltest.main",
"unittest.mock.create_autospec",
"numpy.testing.assert_allclose",
"jax.numpy.ones",
"jax.numpy.zeros",
"unittest.mock.call",
"prompt_tuning.extended.train.multitask_prompts.MultiTaskPrompt"
] | [((2047, 2062), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (2060, 2062), False, 'from absl.testing import absltest\n'), ((1107, 1196), 'unittest.mock.create_autospec', 'mock.create_autospec', (['multitask_prompts.MultiTaskPrompt'], {'spec_set': '(True)', 'instance': '(True)'}), '(multitask_prompts... |
# -*- coding: utf-8 -*-
"""losses.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/10XqSVHkvHpf-XabH9bEXqDZsx-UxagV-
"""
import torch
import numpy as np
import torch.nn as nn
import pdb
from lifelines.utils import concordance_index
from surv_ci_i... | [
"torch.logsumexp",
"numpy.random.seed",
"torch.stack",
"numpy.log",
"torch.erf",
"torch.manual_seed",
"torch.nn.LogSoftmax",
"torch.cat",
"surv_ci_info.utilities.mmd2_lin",
"torch.exp",
"torch.nn.Softmax",
"surv_ci_info.utilities.lindisc",
"surv_ci_info.utilities.auc",
"torch.log",
"torc... | [((365, 385), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (379, 385), True, 'import numpy as np\n'), ((386, 414), 'torch.manual_seed', 'torch.manual_seed', ([], {'seed': '(1234)'}), '(seed=1234)\n', (403, 414), False, 'import torch\n'), ((1341, 1399), 'surv_ci_info.utilities.auc', 'auc', (['mod... |
from suspect.fitting import singlet
from suspect import basis, MRSData
import numpy
import pytest
import random
numpy.random.seed(1024)
@pytest.fixture
def fixed_fid():
time_axis = numpy.arange(0, 0.512, 5e-4)
fid = basis.gaussian(time_axis, 0, 0, 50.0) + 0.00001 * (numpy.random.rand(1024) - 0.5)
return... | [
"suspect.fitting.singlet.fit",
"numpy.random.seed",
"suspect.basis.gaussian",
"pytest.raises",
"numpy.arange",
"numpy.random.rand",
"numpy.testing.assert_allclose",
"suspect.MRSData"
] | [((114, 137), 'numpy.random.seed', 'numpy.random.seed', (['(1024)'], {}), '(1024)\n', (131, 137), False, 'import numpy\n'), ((189, 219), 'numpy.arange', 'numpy.arange', (['(0)', '(0.512)', '(0.0005)'], {}), '(0, 0.512, 0.0005)\n', (201, 219), False, 'import numpy\n'), ((381, 411), 'numpy.arange', 'numpy.arange', (['(0)... |
from __future__ import division, print_function
import os
import numpy as np
import pandas as pd
from pdb import set_trace
from metrics import rank_diff
from DataUtil import get_all_projects
from Model import train_prediction_model, train_transfer_model
def main(n_reps=30):
data_path = os.path.realpath("./data")... | [
"DataUtil.get_all_projects",
"pandas.DataFrame",
"numpy.median",
"Model.train_prediction_model",
"os.path.realpath",
"pandas.merge",
"pdb.set_trace",
"metrics.rank_diff",
"Model.train_transfer_model"
] | [((294, 320), 'os.path.realpath', 'os.path.realpath', (['"""./data"""'], {}), "('./data')\n", (310, 320), False, 'import os\n'), ((336, 363), 'DataUtil.get_all_projects', 'get_all_projects', (['data_path'], {}), '(data_path)\n', (352, 363), False, 'from DataUtil import get_all_projects\n'), ((2820, 2831), 'pdb.set_trac... |
import numpy as np
from polimorfo.utils import maskutils
import pytest
def test_mask_to_polygons():
mask = np.array(
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0],
[0, 0, 0, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, ... | [
"polimorfo.utils.maskutils.mask_to_polygon",
"polimorfo.utils.maskutils.area",
"pytest.raises",
"numpy.array",
"polimorfo.utils.maskutils.bbox"
] | [((113, 444), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, \n 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1,\n 1, 1, 0, 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1, 1, 1, 0,\n 0], [0, 0, 0, 0, 0, 1, 1, 1, 0, 0], [0,... |
import sys
import numpy as np
from mygrad.nnet.activations import sigmoid
from tests.wrappers.uber import backprop_test_factory, fwdprop_test_factory
@fwdprop_test_factory(
mygrad_func=sigmoid,
true_func=lambda x: 1 / (1 + np.exp(-x)),
num_arrays=1,
index_to_bnds={0: (-np.log(sys.float_info.max), No... | [
"numpy.log",
"numpy.exp"
] | [((235, 245), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (241, 245), True, 'import numpy as np\n'), ((290, 316), 'numpy.log', 'np.log', (['sys.float_info.max'], {}), '(sys.float_info.max)\n', (296, 316), True, 'import numpy as np\n'), ((445, 455), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (451, 455), True,... |
import numpy
# ========================== Some observation engine specifications
oracle_engine_specification = [
("turn_index", "all"),
("task_state", "all"),
("user_state", "all"),
("assistant_state", "all"),
("user_action", "all"),
("assistant_action", "all"),
]
blind_engine_specification ... | [
"numpy.zeros",
"numpy.random.multivariate_normal"
] | [((2203, 2226), 'numpy.zeros', 'numpy.zeros', (['_obs.shape'], {}), '(_obs.shape)\n', (2214, 2226), False, 'import numpy\n'), ((2363, 2414), 'numpy.random.multivariate_normal', 'numpy.random.multivariate_normal', (['mu', 'sigma'], {'size': '(1)'}), '(mu, sigma, size=1)\n', (2395, 2414), False, 'import numpy\n'), ((2277... |
import numpy as np
from scipy.spatial.distance import cdist
from pymoo.model.indicator import Indicator
from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting
class RMetric(Indicator):
def __init__(self, curr_pop, whole_pop, ref_points, problem, w=None):
"""
Parameters
---... | [
"scipy.spatial.distance.cdist",
"numpy.size",
"pymoo.performance_indicator.hv.HyperVolume",
"numpy.argmax",
"numpy.logical_not",
"numpy.ones",
"numpy.argmin",
"numpy.amax",
"pymoo.util.nds.non_dominated_sorting.NonDominatedSorting.get_non_dominated",
"numpy.where",
"numpy.array",
"numpy.tile",... | [((704, 728), 'pymoo.model.indicator.Indicator.__init__', 'Indicator.__init__', (['self'], {}), '(self)\n', (722, 728), False, 'from pymoo.model.indicator import Indicator\n'), ((1479, 1509), 'numpy.size', 'np.size', (['self.curr_pop'], {'axis': '(1)'}), '(self.curr_pop, axis=1)\n', (1486, 1509), True, 'import numpy as... |
import gym
import matplotlib.pyplot as plt
import numpy as np
import copy
class PushBall:
def __init__(self, args, rank):
self.args = args
self.rank = rank
self.initialization(args)
def random_start(self):
#return np.array([self.size // 2, self.size // 2])
#return np.array(np.random.randint(self.size //... | [
"copy.deepcopy",
"numpy.zeros",
"gym.spaces.Discrete",
"numpy.random.randint",
"numpy.array",
"gym.spaces.Box",
"numpy.eye",
"numpy.concatenate"
] | [((1036, 1068), 'numpy.zeros', 'np.zeros', (['[self.size, self.size]'], {}), '([self.size, self.size])\n', (1044, 1068), True, 'import numpy as np\n'), ((1555, 1572), 'numpy.eye', 'np.eye', (['self.size'], {}), '(self.size)\n', (1561, 1572), True, 'import numpy as np\n'), ((1587, 1596), 'numpy.eye', 'np.eye', (['(2)'],... |
'''
###################################
Modified from Mike's predict_acc.py
###################################
'''
import os
import sys
import random
import pickle
import numpy as np
import pandas as pd
from keras.utils import to_categorical
from keras.models import load_model
base_path = '/home/tyt/how2ml/mfcc4'
b... | [
"keras.models.load_model",
"pandas.DataFrame",
"numpy.load",
"os.makedirs",
"os.path.exists",
"numpy.array",
"os.path.join",
"numpy.concatenate"
] | [((336, 367), 'os.path.join', 'os.path.join', (['base_path', '"""data"""'], {}), "(base_path, 'data')\n", (348, 367), False, 'import os\n'), ((816, 827), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (824, 827), True, 'import numpy as np\n'), ((836, 847), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (844, 847), ... |
from abc import ABCMeta
import numpy as np
from torch.utils.data import ConcatDataset, Dataset, WeightedRandomSampler
from mmpose.datasets.builder import DATASETS
from .mesh_base_dataset import MeshBaseDataset
@DATASETS.register_module()
class MeshMixDataset(Dataset, metaclass=ABCMeta):
"""Mix Dataset for 3D hu... | [
"torch.utils.data.WeightedRandomSampler",
"torch.utils.data.ConcatDataset",
"mmpose.datasets.builder.DATASETS.register_module",
"numpy.concatenate"
] | [((215, 241), 'mmpose.datasets.builder.DATASETS.register_module', 'DATASETS.register_module', ([], {}), '()\n', (239, 241), False, 'from mmpose.datasets.builder import DATASETS\n'), ((2026, 2049), 'torch.utils.data.ConcatDataset', 'ConcatDataset', (['datasets'], {}), '(datasets)\n', (2039, 2049), False, 'from torch.uti... |
'''
quick_sigma_detect using numpy
given a window size and an array quick sigma can give you the densest (most 1s)
area of that array (the first most dense area)
given an array length (number of observations) and the desired sigma, quicksigma
can give you the lower and upper bound, considering a prior of 50% (fair co... | [
"numpy.ones",
"math.sqrt",
"numpy.argmax"
] | [((582, 600), 'numpy.argmax', 'np.argmax', (['density'], {}), '(density)\n', (591, 600), True, 'import numpy as np\n'), ((532, 554), 'numpy.ones', 'np.ones', (['[window_size]'], {}), '([window_size])\n', (539, 554), True, 'import numpy as np\n'), ((814, 854), 'math.sqrt', 'math.sqrt', (['(observation_count * 0.5 * 0.5)... |
import argparse
import numpy as np
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--images_dir", type=str)
parser.add_argument("--mats_dir", type=str)
parser.add_argument("--lands_dir", type=str)
parser.add_argument("--transform", action="store_true")
parser.add_argu... | [
"numpy.sum",
"argparse.ArgumentParser",
"numpy.zeros",
"numpy.exp",
"numpy.sqrt"
] | [((66, 91), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (89, 91), False, 'import argparse\n'), ((649, 671), 'numpy.zeros', 'np.zeros', (['(size, size)'], {}), '((size, size))\n', (657, 671), True, 'import numpy as np\n'), ((943, 954), 'numpy.sum', 'np.sum', (['img'], {}), '(img)\n', (949, 95... |
from __future__ import print_function
import logging
from copy import copy
import numpy as np
from ..IO.image_stack import ImageStack
from ..elements.b_splines import BSplineSurface
from ..elements.q4 import Q4
def make_grid_Q4(c1x, c1y, c2x, c2y, nx, ny, elm):
# type: (float, float, float, float, int, int, in... | [
"matplotlib.widgets.RectangleSelector",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ioff",
"matplotlib.pyplot.close",
"matplotlib.pyplot.subplot2grid",
"numpy.zeros",
"copy.copy",
"matplotlib.widgets.Button",
"numpy.around",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.arange",
"loggin... | [((2947, 2980), 'numpy.zeros', 'np.zeros', (['(nx * ny, 1)'], {'dtype': 'int'}), '((nx * ny, 1), dtype=int)\n', (2955, 2980), True, 'import numpy as np\n'), ((3001, 3030), 'numpy.arange', 'np.arange', (['(nx * ny)'], {'dtype': 'int'}), '(nx * ny, dtype=int)\n', (3010, 3030), True, 'import numpy as np\n'), ((1655, 1669)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 19:49:00 2019
@author: cdebezenac
"""
import numpy as np
import math
import pandas as pd
import geopandas as gdp
import matplotlib.pyplot as plt
from scipy.integrate import quad
import statsmodels.api as sm
import scipy.stats
import sys
class D... | [
"matplotlib.pyplot.subplot",
"numpy.sum",
"matplotlib.pyplot.text",
"matplotlib.pyplot.figure",
"numpy.array",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.savefig"
] | [((1720, 1758), 'numpy.sum', 'np.sum', (['self.population_matrix'], {'axis': '(1)'}), '(self.population_matrix, axis=1)\n', (1726, 1758), True, 'import numpy as np\n'), ((1828, 1866), 'numpy.sum', 'np.sum', (['self.population_matrix'], {'axis': '(0)'}), '(self.population_matrix, axis=0)\n', (1834, 1866), True, 'import ... |
"""
This module includes the two methods for baseline computation: stochastic
gradient descent and alternating least squares.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from six.moves import range
def baseline_als(self):
"""... | [
"numpy.zeros",
"six.moves.range"
] | [((808, 839), 'numpy.zeros', 'np.zeros', (['self.trainset.n_users'], {}), '(self.trainset.n_users)\n', (816, 839), True, 'import numpy as np\n'), ((849, 880), 'numpy.zeros', 'np.zeros', (['self.trainset.n_items'], {}), '(self.trainset.n_items)\n', (857, 880), True, 'import numpy as np\n'), ((1089, 1104), 'six.moves.ran... |
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ... | [
"onnx.helper.make_attribute",
"dragon.vm.onnx.helper.fetch_argument",
"numpy.array",
"dragon.vm.onnx.nodes.common.CommonONNXExporter"
] | [((1060, 1098), 'dragon.vm.onnx.nodes.common.CommonONNXExporter', 'CommonONNXExporter', (['op_def', 'shape_dict'], {}), '(op_def, shape_dict)\n', (1078, 1098), False, 'from dragon.vm.onnx.nodes.common import CommonONNXExporter\n'), ((2409, 2447), 'dragon.vm.onnx.nodes.common.CommonONNXExporter', 'CommonONNXExporter', (... |
# copan:DISCOUNT model integration and analysis script as used in:
#
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# and <NAME>, Taxonomies for structuring models for World-Earth system
# analysis of the Anthropocene: subsystems, their interactions and
# social-ecological feedback loops, Earth System Dynamics, in p... | [
"scipy.optimize.fsolve",
"numpy.random.binomial"
] | [((4922, 4941), 'scipy.optimize.fsolve', 'fsolve', (['target', '(2.6)'], {}), '(target, 2.6)\n', (4928, 4941), False, 'from scipy.optimize import fsolve\n'), ((2121, 2144), 'scipy.optimize.fsolve', 'fsolve', (['target', '(N * 1.0)'], {}), '(target, N * 1.0)\n', (2127, 2144), False, 'from scipy.optimize import fsolve\n'... |
import numpy as np
from ase.atoms import Atoms
from TB2J.utils import symbol_number
from collections import defaultdict
from scipy.linalg import eigh
class SislWrapper():
def __init__(self, sisl_hamiltonian, spin=None):
self.ham = sisl_hamiltonian
# k2Rfactor : H(k) = \int_R H(R) * e^(k2Rfactor * k... | [
"TB2J.utils.symbol_number",
"numpy.zeros",
"numpy.hstack",
"collections.defaultdict",
"numpy.array",
"ase.atoms.Atoms",
"scipy.linalg.eigh",
"numpy.vstack"
] | [((639, 663), 'collections.defaultdict', 'defaultdict', (['(lambda : [])'], {}), '(lambda : [])\n', (650, 663), False, 'from collections import defaultdict\n'), ((805, 824), 'numpy.array', 'np.array', (['g.sc.cell'], {}), '(g.sc.cell)\n', (813, 824), True, 'import numpy as np\n'), ((923, 994), 'ase.atoms.Atoms', 'Atoms... |
import os
import pytest
import numpy as np
import sys
#sys.path.append('/home/mts87985/ml-tomo/')
# Random seed to ensure that tests are repeatable
RANDOM_SEED = 23
np.random.seed(RANDOM_SEED)
def test_norm_disc():
from super_tomo_py.data_handeling.tools import normalise_discritise_data
img = np.random.rand... | [
"numpy.random.seed",
"numpy.zeros",
"numpy.max",
"numpy.random.randint",
"numpy.min",
"super_tomo_py.data_handeling.tools.normalise_discritise_data",
"numpy.unique"
] | [((167, 194), 'numpy.random.seed', 'np.random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (181, 194), True, 'import numpy as np\n'), ((306, 351), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)'], {'size': '(100, 100, 1)'}), '(0, 255, size=(100, 100, 1))\n', (323, 351), True, 'import numpy as np\n'), ... |
"""
Copyright (c) 2016, Granular, Inc.
All rights reserved.
License: BSD 3-Clause ("BSD New" or "BSD Simplified")
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 c... | [
"os.getcwd",
"os.path.dirname",
"numpy.argwhere",
"numpy.array",
"numpy.array_equal",
"numpy.bincount",
"pyspatial.raster.rasterize",
"os.path.join",
"os.chdir"
] | [((1691, 1702), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1700, 1702), False, 'import os\n'), ((1726, 1751), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1741, 1751), False, 'import os\n'), ((1783, 1812), 'os.path.join', 'os.path.join', (['base', '"""data"""', 'x'], {}), "(base, 'data',... |
#emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 noet:
__author__ = '<NAME>'
__copyright__ = 'Copyright (c) 2013 <NAME>'
__license__ = 'MIT'
import os
import shutil
from glob import glob
from os.path import exists, join as pjoin, dirname, basename
... | [
"vbench.api.BenchmarkRunner",
"os.unlink",
"os.path.basename",
"numpy.testing.assert_array_equal",
"vbench.reports.generate_rst_files",
"os.path.dirname",
"os.path.exists",
"nose.tools.eq_",
"shutil.rmtree",
"os.path.join"
] | [((619, 641), 'shutil.rmtree', 'shutil.rmtree', (['TMP_DIR'], {}), '(TMP_DIR)\n', (632, 641), False, 'import shutil\n'), ((649, 664), 'os.path.exists', 'exists', (['DB_PATH'], {}), '(DB_PATH)\n', (655, 664), False, 'from os.path import exists, join as pjoin, dirname, basename\n'), ((736, 938), 'vbench.api.BenchmarkRunn... |
"""This module contains code for the bias monitor Bokeh plots.
Author
------
- <NAME>
- <NAME>
Use
---
This module can be used from the command line as such:
::
from jwql.website.apps.jwql import monitor_pages
monitor_template = monitor_pages.BiasMonitor()
monitor_template... | [
"jwql.database.database_interface.session.close",
"jwql.database.database_interface.session.query",
"os.path.abspath",
"os.path.basename",
"datetime.datetime.strptime",
"numpy.array",
"datetime.timedelta",
"os.path.join"
] | [((727, 752), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (742, 752), False, 'import os\n'), ((1997, 2012), 'jwql.database.database_interface.session.close', 'session.close', ([], {}), '()\n', (2010, 2012), False, 'from jwql.database.database_interface import session, NIRCamBiasStats, NIRI... |
"""Defines utilities intended for internal use only, most notably
:class:`hyperparameter_hunter.space.space_core.Space`. These tools are used behind the scenes by
:class:`hyperparameter_hunter.optimization.protocol_core.BaseOptPro` to combine instances of
dimensions defined in :mod:`hyperparameter_hunter.space.dimensio... | [
"sklearn.utils.check_random_state",
"hyperparameter_hunter.utils.general_utils.short_repr",
"numpy.asarray",
"hyperparameter_hunter.space.dimensions.Real",
"hyperparameter_hunter.space.dimensions.Categorical",
"hyperparameter_hunter.space.dimensions.Integer"
] | [((3380, 3412), 'hyperparameter_hunter.space.dimensions.Categorical', 'Categorical', (['dimension'], {}), '(dimension, **kwargs)\n', (3391, 3412), False, 'from hyperparameter_hunter.space.dimensions import Dimension, Real, Integer, Categorical\n'), ((4220, 4252), 'hyperparameter_hunter.space.dimensions.Categorical', 'C... |
import numpy as np
from PIL import Image
import pdb
import os
data_path = '/home/datasets/prml/computervision/re-id/sysu-mm01/ori_data'
rgb_cameras = ['cam1','cam2','cam4','cam5']
ir_cameras = ['cam3','cam6']
# load id info
file_path_train = os.path.join(data_path,'exp/train_id.txt')
file_path_val = os.path.join(d... | [
"numpy.save",
"os.path.isdir",
"PIL.Image.open",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((245, 288), 'os.path.join', 'os.path.join', (['data_path', '"""exp/train_id.txt"""'], {}), "(data_path, 'exp/train_id.txt')\n", (257, 288), False, 'import os\n'), ((306, 347), 'os.path.join', 'os.path.join', (['data_path', '"""exp/val_id.txt"""'], {}), "(data_path, 'exp/val_id.txt')\n", (318, 347), False, 'import os\... |
import netCDF4 as nc
import numpy as np
dataset = nc.Dataset('ocean_dataset.nc', 'w')
dataset.createDimension('xu', size=3600)
dataset.createDimension('yu', size=2700)
dataset.createDimension('xt', size=3600)
dataset.createDimension('yt', size=2700)
dataset.createDimension('z', size=75)
dataset.createDimension('time'... | [
"netCDF4.Dataset",
"numpy.random.rand"
] | [((51, 86), 'netCDF4.Dataset', 'nc.Dataset', (['"""ocean_dataset.nc"""', '"""w"""'], {}), "('ocean_dataset.nc', 'w')\n", (61, 86), True, 'import netCDF4 as nc\n'), ((543, 573), 'numpy.random.rand', 'np.random.rand', (['(75)', '(2700)', '(3600)'], {}), '(75, 2700, 3600)\n', (557, 573), True, 'import numpy as np\n'), ((5... |
""" This is the package responsible for realizing the data handling process
for features and labels previously generated. """
import pandas as pd
import numpy as np
import pyCBPE.constants as consts
def load():
""" Load dataset from filepat and return it as a pandas dataframe. """
df_split_1 = pd.read_csv(con... | [
"pandas.read_csv",
"numpy.array",
"pandas.concat"
] | [((305, 391), 'pandas.read_csv', 'pd.read_csv', (['consts.FEATURES_AND_LABELS_DF_SPLIT_1_PATH'], {'index_col': '(False)', 'header': '(0)'}), '(consts.FEATURES_AND_LABELS_DF_SPLIT_1_PATH, index_col=False,\n header=0)\n', (316, 391), True, 'import pandas as pd\n'), ((405, 491), 'pandas.read_csv', 'pd.read_csv', (['con... |
#!/usr/bin/env python3
# coding: utf-8
import SimpleITK as sitk
import numpy as np
import copy
import glob
import pandas
import datetime
path="/home/alicja/"
def obtainDCEimages(pat_no="04",timept="1",path=path):
folder="PET_LAB_PROCESSED/WES_0"+pat_no+"/IMAGES/"
baseline_image=sitk.ReadImage(path+folder+"WE... | [
"copy.deepcopy",
"numpy.zeros_like",
"numpy.argmax",
"pandas.read_csv",
"SimpleITK.ReadImage",
"SimpleITK.GetArrayFromImage",
"numpy.max",
"datetime.datetime.strptime",
"SimpleITK.GetImageFromArray",
"glob.glob",
"SimpleITK.WriteImage",
"SimpleITK.Cast",
"numpy.unique"
] | [((290, 397), 'SimpleITK.ReadImage', 'sitk.ReadImage', (["(path + folder + 'WES_0' + pat_no + '_TIMEPOINT_' + timept +\n '_MRI_T1W_DCE_ACQ_0.nii.gz')"], {}), "(path + folder + 'WES_0' + pat_no + '_TIMEPOINT_' + timept +\n '_MRI_T1W_DCE_ACQ_0.nii.gz')\n", (304, 397), True, 'import SimpleITK as sitk\n'), ((401, 444... |
import os
import time
import numpy as np
# for shot in available_shots.iterkeys():
print("## perform experiments on aloi ##")
num_of_classes = 1000
leaf_example_multiplier = 4 # 8
shots = 100
lr = 0.001
bits = 29
alpha = 0.1 # 0.3
passes = 3 # 3 #5
use_oas = False
dream_at_update = 0
learn_at_leaf = True # turn o... | [
"numpy.log",
"os.path.exists",
"os.system",
"time.time"
] | [((1021, 1032), 'time.time', 'time.time', ([], {}), '()\n', (1030, 1032), False, 'import time\n'), ((1517, 1541), 'os.system', 'os.system', (['command_train'], {}), '(command_train)\n', (1526, 1541), False, 'import os\n'), ((1615, 1626), 'time.time', 'time.time', ([], {}), '()\n', (1624, 1626), False, 'import time\n'),... |
# modified from pyAudioAnalysis' audioSegmentation.py
import numpy as np
import scipy
import paa.audioFeatureExtraction as aF
import paa.audioTrainTest as aT
import paa.audioSegmentation as aS
import paa.audioBasicIO as audioBasicIO
from snippet import Snippet
def extractFeatures(x, Fs, shortTermSize, shortTermStep)... | [
"paa.audioFeatureExtraction.stFeatureExtraction",
"scipy.signal.convolve2d",
"numpy.copy",
"snippet.Snippet",
"paa.audioBasicIO.stereo2mono",
"numpy.min",
"numpy.max",
"paa.audioTrainTest.normalizeFeatures",
"numpy.eye",
"paa.audioSegmentation.selfSimilarityMatrix"
] | [((330, 357), 'paa.audioBasicIO.stereo2mono', 'audioBasicIO.stereo2mono', (['x'], {}), '(x)\n', (354, 357), True, 'import paa.audioBasicIO as audioBasicIO\n'), ((379, 448), 'paa.audioFeatureExtraction.stFeatureExtraction', 'aF.stFeatureExtraction', (['x', 'Fs', '(Fs * shortTermSize)', '(Fs * shortTermStep)'], {}), '(x,... |
import os
import numpy as np
import pandas as pd
from pypfopt import expected_returns
from pypfopt import risk_models
from pypfopt.efficient_frontier import (
EfficientFrontier,
EfficientSemivariance,
EfficientCVaR,
)
from pypfopt.cla import CLA
from pypfopt.expected_returns import returns_from_prices
de... | [
"pypfopt.risk_models.sample_cov",
"pypfopt.efficient_frontier.EfficientFrontier",
"os.path.dirname",
"numpy.zeros",
"numpy.ones",
"pypfopt.efficient_frontier.EfficientSemivariance",
"pypfopt.expected_returns.returns_from_prices",
"pypfopt.efficient_frontier.EfficientCVaR",
"numpy.linalg.inv",
"pyp... | [((1264, 1307), 'pypfopt.expected_returns.mean_historical_return', 'expected_returns.mean_historical_return', (['df'], {}), '(df)\n', (1303, 1307), False, 'from pypfopt import expected_returns\n'), ((1332, 1358), 'pypfopt.risk_models.sample_cov', 'risk_models.sample_cov', (['df'], {}), '(df)\n', (1354, 1358), False, 'f... |
from functools import partial, reduce
from itertools import zip_longest
import subprocess
import pytest
import os.path as op
import os
import sys
import re
import logging
import tempfile
from urllib.parse import quote
import shutil
import numpy as np
from numpy.testing import assert_array_equal
from pbcore.io import ... | [
"pbcore.data.getEmptyAlignedBam",
"os.remove",
"pbtestdata.get_file",
"os.path.islink",
"pbcore.data.getEmptyBam",
"pbcore.io.dataset.DataSetMetaTypes.InvalidDataSetIOError",
"shutil.rmtree",
"pytest.mark.skip",
"os.path.join",
"pbcore.data.datasets.getXml",
"subprocess.check_call",
"numpy.uni... | [((1207, 1234), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1224, 1234), False, 'import logging\n'), ((1381, 1401), 'os.path.basename', 'os.path.basename', (['fn'], {}), '(fn)\n', (1397, 1401), False, 'import os\n'), ((39435, 39475), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reas... |
import os
import numpy as np
from matplotlib import pyplot as plt, animation
from hyperverlet.energy import PendulumEnergy
from hyperverlet.plotting.grid_spec import gs_3_2_3, gs_line
from hyperverlet.plotting.phasespace import init_phasespace_plot, update_phasespace_plot
from hyperverlet.plotting.utils import save_a... | [
"hyperverlet.plotting.utils.create_gt_pred_legends",
"hyperverlet.utils.misc.load_pickle",
"matplotlib.pyplot.show",
"hyperverlet.plotting.utils.save_figure",
"hyperverlet.plotting.grid_spec.gs_3_2_3",
"hyperverlet.plotting.phasespace.update_phasespace_plot",
"hyperverlet.plotting.utils.save_animation",... | [((866, 882), 'hyperverlet.energy.PendulumEnergy', 'PendulumEnergy', ([], {}), '()\n', (880, 882), False, 'from hyperverlet.energy import PendulumEnergy\n'), ((1129, 1171), 'hyperverlet.utils.misc.format_path', 'format_path', (['config', "config['result_path']"], {}), "(config, config['result_path'])\n", (1140, 1171), ... |
import os
import numpy as np
from PIL import Image
from torch.utils import data
import dataset.transform as transform
from utils.func import recursive_glob
class Cityscapes(data.Dataset):
def __init__(self, root, distributed=False, train_transform=None, valid_transform=None):
self.root = root
se... | [
"torch.utils.data.Subset",
"dataset.transform.to_numpy",
"dataset.transform.to_tensor",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.utils.data.RandomSampler",
"PIL.Image.open",
"utils.func.recursive_glob",
"utils.vis.imshow",
"torch.utils.data.distributed.DistributedSampler",
"torch.ut... | [((8676, 8726), 'os.path.expanduser', 'os.path.expanduser', (['"""E:/pCloud/dataset/Cityscapes"""'], {}), "('E:/pCloud/dataset/Cityscapes')\n", (8694, 8726), False, 'import os\n'), ((1135, 1168), 'os.path.join', 'os.path.join', (['root', '"""leftImg8bit"""'], {}), "(root, 'leftImg8bit')\n", (1147, 1168), False, 'import... |
import numpy as np
from ..tools import contains_nan
class _CheckInputs:
def __init__(self, inputs, indep_test=None, reps=None):
self.inputs = inputs
self.reps = reps
self.indep_test = indep_test
def __call__(self):
self._check_ndarray_inputs()
for i in self.inputs:
... | [
"numpy.asarray",
"numpy.zeros",
"numpy.ones",
"numpy.vstack",
"numpy.var",
"numpy.concatenate",
"numpy.repeat"
] | [((3477, 3494), 'numpy.vstack', 'np.vstack', (['inputs'], {}), '(inputs)\n', (3486, 3494), True, 'import numpy as np\n'), ((3502, 3511), 'numpy.var', 'np.var', (['u'], {}), '(u)\n', (3508, 3511), True, 'import numpy as np\n'), ((3661, 3693), 'numpy.repeat', 'np.repeat', (['i', 'inputs[i].shape[0]'], {}), '(i, inputs[i]... |
#!/usr/bin/env python3
#
# Author: jon4hz
# Date: 17.03.2021
# Desc: Conways Game of Life, implemented with pygame
#
#######################################################################################################################
# disable support prompt
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide... | [
"pygame.quit",
"numpy.sum",
"argparse.ArgumentParser",
"numpy.copy",
"pygame.mouse.set_visible",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.Rect",
"pygame.draw.rect",
"pygame.init",
"pygame.time.wait",
"pygame.display.update",
"pygame.mouse.get_pos",
"pygame.display.set_caption... | [((757, 786), 'pygame.display.set_mode', 'pygame.display.set_mode', (['SIZE'], {}), '(SIZE)\n', (780, 786), False, 'import sys, pygame, argparse\n'), ((791, 824), 'pygame.display.set_caption', 'pygame.display.set_caption', (['TITLE'], {}), '(TITLE)\n', (817, 824), False, 'import sys, pygame, argparse\n'), ((852, 879), ... |
"""
This displays the user-based filtering page
"""
from ast import literal_eval
from collections import defaultdict
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
import ... | [
"grab_list.read_csv",
"dash_html_components.Button",
"pandas.read_csv",
"dash_html_components.Div",
"dash.dependencies.State",
"collections.defaultdict",
"dash.dependencies.Input",
"numpy.arange",
"dash_html_components.H1",
"dash.dependencies.Output"
] | [((513, 530), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (524, 530), False, 'from collections import defaultdict\n'), ((536, 659), 'pandas.read_csv', 'pd.read_csv', (['"""movies-dataset/source/collaborative_result.csv"""'], {'header': 'None', 'index_col': '(0)', 'converters': '{(1): literal_e... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import tensorflow as tf
import tensorflow.keras as keras
from .building_blocks import Conv3dAdaIn, Conv2dAdaIn, AdaIn
from ..confignet_utils import euler_angles_to_matrix, transform_3d_grid_tf
import numpy as np
class HologanGenerat... | [
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Reshape",
"tensorflow.reshape",
"tensorflow.keras.layers.UpSampling3D",
"tensorflow.keras.layers.Conv3D",
"tensorflow.constant",
"tensorflow.keras.layers.LeakyReLU",
"tensorflow.compat.v1.initializers.ones",
"tensorflow.shape",
"tensorflow... | [((2357, 2429), 'tensorflow.keras.layers.Conv2D', 'keras.layers.Conv2D', (['(512)', '(1)'], {'activation': 'tf.nn.leaky_relu', 'padding': '"""same"""'}), "(512, 1, activation=tf.nn.leaky_relu, padding='same')\n", (2376, 2429), True, 'import tensorflow.keras as keras\n'), ((4491, 4566), 'tensorflow.keras.layers.Conv2D',... |
import time
import numpy as np
import math
import numba as nb
from numba import cuda
from numba.cuda.random import create_xoroshiro128p_states,xoroshiro128p_uniform_float64,xoroshiro128p_normal_float64
import matplotlib.pyplot as mpl
################################################################################
spec... | [
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.max",
"math.cos",
"math.log",
"numba.cuda.random.xoroshiro128p_normal_float64",
"matplotlib.pyplot.show",
"math.sqrt",
"numba.jitclass",
"matplotlib.pyplot.legend",
"math.sin",
"numpy.min",
"numba.cuda.random.xoroshiro128p_unifor... | [((1193, 1210), 'numba.jitclass', 'nb.jitclass', (['spec'], {}), '(spec)\n', (1204, 1210), True, 'import numba as nb\n'), ((16417, 16428), 'time.time', 'time.time', ([], {}), '()\n', (16426, 16428), False, 'import time\n'), ((3361, 3386), 'numpy.zeros', 'np.zeros', (['(Pars.All_N, 3)'], {}), '((Pars.All_N, 3))\n', (336... |
"""
Version: 1.5
Summary: Automatic image brightness adjustment based on gamma correction method
Author: <NAME>
Author-email: <EMAIL>
USAGE:
python3 gamma_correction.py -p ~/plant-image-analysis/test/ -ft jpg
argument:
("-p", "--path", required = True, help="path to image file")
("-ft", "--filetype", required... | [
"PIL.ImageEnhance.Brightness",
"argparse.ArgumentParser",
"numpy.mean",
"numpy.arange",
"glob.glob",
"resource.getrusage",
"os.path.join",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.exists",
"numpy.max",
"cv2.LUT",
"cv2.split",
"PIL.ImageEnhance.Sharpness",
"cv2.createCLAHE",
"cv2.merge",... | [((880, 900), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (894, 900), False, 'import os, fnmatch\n'), ((1575, 1596), 'cv2.LUT', 'cv2.LUT', (['image', 'table'], {}), '(image, table)\n', (1582, 1596), False, 'import cv2\n'), ((1791, 1842), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(3.0... |
import argparse
import math
import os, sys
import random
import datetime
import time
from typing import List
import json
import numpy as np
from copy import deepcopy
import torch
import torch.nn as nn
import torch.nn.parallel
from torch.optim import lr_scheduler
import torch.backends.cudnn as cudnn
import torch.distri... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"models.aslloss.AsymmetricLossOptimized",
"torch.cuda.max_memory_allocated",
"torch.cat",
"os.path.isfile",
"torch.distributed.get_world_size",
"torch.nn.functional.sigmoid",
"torch.no_grad",
"os.path.join",
"torch.isnan",
"torch.cuda.amp.autocas... | [((21698, 21713), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (21711, 21713), False, 'import torch\n'), ((827, 893), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Query2Label MSCOCO Training"""'}), "(description='Query2Label MSCOCO Training')\n", (850, 893), False, 'import argpa... |
import os
import torch
import torch.utils.data as data
from PIL import Image
import numpy as np
from .utility import download_url, check_integrity
IMG_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif']
def pil_loader(path):
# open path as file to avoid ResourceWarning (https://github.com/pyt... | [
"os.path.expanduser",
"os.getcwd",
"os.path.isdir",
"os.walk",
"PIL.Image.open",
"numpy.where",
"numpy.array",
"os.chdir",
"os.path.join",
"os.listdir"
] | [((1468, 1491), 'os.path.expanduser', 'os.path.expanduser', (['dir'], {}), '(dir)\n', (1486, 1491), False, 'import os\n'), ((396, 409), 'PIL.Image.open', 'Image.open', (['f'], {}), '(f)\n', (406, 409), False, 'from PIL import Image\n'), ((1517, 1532), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (1527, 1532), ... |
"""
PySCeS - Python Simulator for Cellular Systems (http://sourceforge.net)
Copyright (C) 2004-2020 <NAME>, <NAME>, <NAME> all rights reserved,
<NAME> (<EMAIL>)
Triple-J Group for Molecular Cell Physiology
Stellenbosch University, South Africa.
Permission to use, modify, and distribute this software is given under t... | [
"unittest.main",
"os.makedirs",
"unittest.TextTestRunner",
"os.getcwd",
"numpy.testing.assert_array_equal",
"os.path.exists",
"unittest.makeSuite",
"scipy.optimize.fsolve",
"time.sleep",
"scipy.zeros",
"scipy.array",
"numpy.testing.assert_array_almost_equal",
"os.path.join",
"os.listdir"
] | [((1221, 1259), 'os.path.join', 'os.path.join', (['INSTALL_DIR', '"""pscmodels"""'], {}), "(INSTALL_DIR, 'pscmodels')\n", (1233, 1259), False, 'import os, sys, shutil\n'), ((1832, 1853), 'os.path.exists', 'os.path.exists', (['dirIn'], {}), '(dirIn)\n', (1846, 1853), False, 'import os, sys, shutil\n'), ((3445, 3477), 'o... |
from numpy.distutils.misc_util import Configuration
def configuration(parent_package='', top_path=None):
config = Configuration('special', parent_package, top_path)
config.add_data_dir('tests')
return config | [
"numpy.distutils.misc_util.Configuration"
] | [((119, 169), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""special"""', 'parent_package', 'top_path'], {}), "('special', parent_package, top_path)\n", (132, 169), False, 'from numpy.distutils.misc_util import Configuration\n')] |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2020 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | [
"numpy.concatenate",
"numpy.arange",
"improver.utilities.cube_manipulation.MergeCubes",
"improver.metadata.forecast_times.rebadge_forecasts_as_latest_cycle",
"numpy.unique"
] | [((2791, 2834), 'improver.metadata.forecast_times.rebadge_forecasts_as_latest_cycle', 'rebadge_forecasts_as_latest_cycle', (['cubelist'], {}), '(cubelist)\n', (2824, 2834), False, 'from improver.metadata.forecast_times import rebadge_forecasts_as_latest_cycle\n'), ((3037, 3069), 'numpy.concatenate', 'np.concatenate', (... |
import os
import sys
import time
import logging
import numpy as np
from datetime import datetime
import torch
import flags
import datacode
import worlds
import trainers
import agents
import teachers
from misc import util
def main():
config = configure()
datasets = datacode.load(config)
trainer = tra... | [
"teachers.load",
"os.makedirs",
"flags.make_config",
"torch.manual_seed",
"misc.util.config_logging",
"os.path.exists",
"numpy.random.RandomState",
"time.time",
"datacode.load",
"agents.load",
"logging.info",
"datetime.datetime.now",
"torch.device",
"torch.cuda.device",
"os.getenv",
"t... | [((280, 301), 'datacode.load', 'datacode.load', (['config'], {}), '(config)\n', (293, 301), False, 'import datacode\n'), ((317, 338), 'trainers.load', 'trainers.load', (['config'], {}), '(config)\n', (330, 338), False, 'import trainers\n'), ((354, 373), 'agents.load', 'agents.load', (['config'], {}), '(config)\n', (365... |
import netCDF4 as nc
import os
import re
import numpy as np
from matplotlib.patches import Ellipse, Circle
from matplotlib.collections import EllipseCollection
class nc_reader:
def __init__(self):
self._ncfile = None
# either a field or parcel file
self._nctype = None
def open(self, ... | [
"netCDF4.Dataset",
"numpy.arctan2",
"os.path.basename",
"os.path.dirname",
"os.path.exists",
"numpy.rad2deg",
"numpy.finfo",
"numpy.array",
"numpy.linalg.norm",
"numpy.sqrt",
"os.path.join",
"os.listdir",
"re.compile"
] | [((455, 495), 'netCDF4.Dataset', 'nc.Dataset', (['fname', '"""r"""'], {'format': '"""NETCDF4"""'}), "(fname, 'r', format='NETCDF4')\n", (465, 495), True, 'import netCDF4 as nc\n'), ((2431, 2469), 'numpy.array', 'np.array', (['self._ncfile.variables[name]'], {}), '(self._ncfile.variables[name])\n', (2439, 2469), True, '... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"pytest.importorskip",
"tvm.contrib.ethosu.cascader.EthosuPart",
"tvm.contrib.ethosu.cascader.TESubgraph",
"math.ceil",
"pytest.main",
"tvm.contrib.ethosu.cascader.Propagator",
"numpy.matmul",
"tvm.contrib.ethosu.cascader.EthosuDeviceConfig",
"tvm.contrib.ethosu.cascader.StripeConfig",
"pytest.mar... | [((800, 834), 'pytest.importorskip', 'pytest.importorskip', (['"""ethosu.vela"""'], {}), "('ethosu.vela')\n", (819, 834), False, 'import pytest\n'), ((946, 2182), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_id, op_type, activation, kernel, stride, dilation, padding, in_shape, out_shape"""', "[(0, '... |
import pyrender
import numpy as np
from matplotlib import pyplot
import math
# render settings
img_h = 480
img_w = 480
fx = 480.
fy = 480.
cx = 240
cy = 240
def model():
# note that xx is height here!
xx = -0.2
yy = -0.2
zz = -0.2
v000 = (xx, yy, zz) # 0
v001 = (xx, yy, zz + 0.4) # 1
v... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"math.sin",
"numpy.array",
"math.cos"
] | [((2071, 2094), 'matplotlib.pyplot.imshow', 'pyplot.imshow', (['depthmap'], {}), '(depthmap)\n', (2084, 2094), False, 'from matplotlib import pyplot\n'), ((2099, 2112), 'matplotlib.pyplot.show', 'pyplot.show', ([], {}), '()\n', (2110, 2112), False, 'from matplotlib import pyplot\n'), ((2117, 2135), 'matplotlib.pyplot.i... |
import numpy as np
FABRIC_WIDTH = 1000
FABRIC_HEIGHT = 1000
inputs = open('../input.txt', 'r')
data = inputs.readlines()
def parse_claim(current_claim):
[raw_id, _, raw_offset, raw_dimensions] = current_claim.split(' ')
claim_id = int(raw_id.lstrip('#'))
[x_offset_raw, y_offset_raw] = raw_offset.rstrip(... | [
"numpy.full",
"numpy.where",
"numpy.zeros"
] | [((1029, 1079), 'numpy.zeros', 'np.zeros', (['(FABRIC_WIDTH, FABRIC_HEIGHT)'], {'dtype': 'int'}), '((FABRIC_WIDTH, FABRIC_HEIGHT), dtype=int)\n', (1037, 1079), True, 'import numpy as np\n'), ((737, 785), 'numpy.full', 'np.full', (['claim_size', 'current_claim_id'], {'dtype': 'int'}), '(claim_size, current_claim_id, dty... |
import numpy as np
import tensorflow as tf
from tqdm.auto import trange
class EpochLoggerCallback(tf.keras.callbacks.Callback):
"""
Log the result every epoch instead of every step
"""
def __init__(self, keys, epochs, logger=None, decs='Training', decimal=2):
"""
Args:
ke... | [
"numpy.isnan",
"tqdm.auto.trange"
] | [((786, 833), 'tqdm.auto.trange', 'trange', (['self.epochs'], {'desc': 'self.decs', 'leave': '(True)'}), '(self.epochs, desc=self.decs, leave=True)\n', (792, 833), False, 'from tqdm.auto import trange\n'), ((1092, 1115), 'numpy.isnan', 'np.isnan', (['logs[log_key]'], {}), '(logs[log_key])\n', (1100, 1115), True, 'impor... |
import numpy as np
import torch
import matplotlib.pyplot as plt
import matplotlib.pylab as pl
from BoManifolds.Riemannian_utils.utils import rotation_matrix_from_axis_angle
from BoManifolds.plot_utils.manifolds_plots import plot_spd_cone
plt.rcParams['text.usetex'] = True
plt.rcParams['text.latex.preamble'] = r'\use... | [
"numpy.tril_indices",
"numpy.size",
"BoManifolds.plot_utils.manifolds_plots.plot_spd_cone",
"numpy.zeros",
"numpy.ones",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"torch.Tensor",
"numpy.sqrt",
"numpy.linalg.cholesky",
"torch.tensor",
"BoManifo... | [((1902, 1941), 'numpy.linspace', 'np.linspace', (['(0.0001)', '(2 * np.pi)', 'n_elems'], {}), '(0.0001, 2 * np.pi, n_elems)\n', (1913, 1941), True, 'import numpy as np\n'), ((1950, 1985), 'numpy.linspace', 'np.linspace', (['(0.0001)', 'np.pi', 'n_elems'], {}), '(0.0001, np.pi, n_elems)\n', (1961, 1985), True, 'import ... |
import numpy as np
try:
from sklearn.model_selection import cross_validate
from sklearn.model_selection import GridSearchCV
from ..api import (multinomial,
multinomial_lagrange,
multinomial_classifier,
multinomial_classifier_lagrange)
... | [
"sklearn.model_selection.GridSearchCV",
"numpy.zeros_like",
"numpy.argmax",
"sklearn.model_selection.cross_validate",
"numpy.ones",
"numpy.random.standard_normal",
"numpy.testing.assert_allclose",
"numpy.testing.dec.skipif"
] | [((463, 561), 'numpy.testing.dec.skipif', 'np.testing.dec.skipif', (['(True or not have_sklearn)'], {'msg': '"""multinomial not working on its own yet"""'}), "(True or not have_sklearn, msg=\n 'multinomial not working on its own yet')\n", (484, 561), True, 'import numpy as np\n'), ((636, 669), 'numpy.random.standard... |
import dlr
import cv2
import numpy as np
from dlr import DLRModel
label_map = {
0: 'brown_abnormal_chinese',
1: 'brown_abnormal_korean',
2: 'brown_normal_chinese',
3: 'brown_normal_korean',
4: 'no_box',
5: 'red_abnormal',
6: 'red_normal'
}
def softmax(x):
x_exp = np.exp(x - np.max(x... | [
"numpy.sum",
"cv2.cvtColor",
"numpy.asarray",
"numpy.transpose",
"numpy.expand_dims",
"dlr.DLRModel",
"cv2.imread",
"numpy.argsort",
"numpy.max",
"numpy.array",
"cv2.resize"
] | [((1403, 1446), 'cv2.imread', 'cv2.imread', (['"""sample_images/red_normal.jpeg"""'], {}), "('sample_images/red_normal.jpeg')\n", (1413, 1446), False, 'import cv2\n'), ((1460, 1503), 'cv2.cvtColor', 'cv2.cvtColor', (['image_data', 'cv2.COLOR_BGR2RGB'], {}), '(image_data, cv2.COLOR_BGR2RGB)\n', (1472, 1503), False, 'imp... |
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
m_dpi = 600
def create_font(fontname='Tahoma', fontsize=10):
"""
Create a font object to be used in matplotlib figures.
Parameters
----------
fontname : string
The desired font, i.e., Times N... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"numpy.sum",
"numpy.tanh",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.scatter",
"numpy.asarray",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.min",
"numpy.max",
"matplotlib.p... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""PDF"""'], {}), "('PDF')\n", (32, 39), False, 'import matplotlib\n'), ((1368, 1377), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (1375, 1377), True, 'import matplotlib.pyplot as plt\n'), ((1386, 1424), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsiz... |
import numpy as np
import itertools
import math
from tqdm import tqdm
import scipy
import functools
import operator
from sympy import primefactors, sieve
import random
from sympy import *
from itertools import combinations
from itertools import permutations
def forfor(a):
return [item for sublist in a for item i... | [
"math.pow",
"sympy.sieve.extend_to_no",
"itertools.combinations_with_replacement",
"itertools.combinations",
"sympy.sieve._reset",
"numpy.random.randint"
] | [((848, 872), 'itertools.combinations', 'combinations', (['numbers', '(3)'], {}), '(numbers, 3)\n', (860, 872), False, 'from itertools import combinations\n'), ((4624, 4672), 'itertools.combinations_with_replacement', 'itertools.combinations_with_replacement', (['rems', '(3)'], {}), '(rems, 3)\n', (4663, 4672), False, ... |
# core/_base.py
"""Abstract base classes for reduced-order models."""
__all__ = []
import abc
import numpy as np
from . import operators
_isparametricop = operators.is_parametric_operator
class _BaseROM(abc.ABC):
"""Base class for all rom_operator_inference reduced model classes."""
_MODELFORM_KEYS = "cAH... | [
"numpy.isscalar",
"numpy.allclose",
"numpy.zeros",
"numpy.shape",
"numpy.kron",
"numpy.eye"
] | [((19236, 19265), 'numpy.zeros', 'np.zeros', (['self.r'], {'dtype': 'float'}), '(self.r, dtype=float)\n', (19244, 19265), True, 'import numpy as np\n'), ((22697, 22717), 'numpy.shape', 'np.shape', (['parameters'], {}), '(parameters)\n', (22705, 22717), True, 'import numpy as np\n'), ((15045, 15076), 'numpy.kron', 'np.k... |
#File: setup.py
#!/usr/bin/python
from distutils.core import setup, Extension
# Third-party modules - we depend on numpy for everything
import numpy
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = numpy.get_include()
except AttributeError:
numpy_include = nu... | [
"distutils.core.Extension",
"numpy.get_numpy_include",
"numpy.get_include",
"distutils.core.setup"
] | [((362, 545), 'distutils.core.Extension', 'Extension', (['"""_bilateralfilter"""'], {'sources': "['bilateralfilter_wrap.cxx', 'bilateralfilter.cpp', 'permutohedral.cpp']", 'extra_compile_args': "['-fopenmp']", 'include_dirs': '[numpy_include]'}), "('_bilateralfilter', sources=['bilateralfilter_wrap.cxx',\n 'bilatera... |
import tensorflow as tf
import numpy as np
import os, json, uuid
from flask import jsonify
embedding_dim = 256
units = 512
max_length = 20
attention_features_shape = 64
data_dir = "/data"
images_dir = os.path.join(data_dir, "images")
# model_dir = os.path.join("model")
model_dir = "/app/model"
ckp_p... | [
"os.mkdir",
"tensorflow.reduce_sum",
"tensorflow.keras.layers.Dense",
"tensorflow.reshape",
"flask.jsonify",
"os.path.join",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.preprocessing.text.Tokenizer",
"tensorflow.nn.relu",
"tensorflow.train.Checkpoint",
"os.path.exi... | [((214, 246), 'os.path.join', 'os.path.join', (['data_dir', '"""images"""'], {}), "(data_dir, 'images')\n", (226, 246), False, 'import os, json, uuid\n'), ((326, 360), 'os.path.join', 'os.path.join', (['model_dir', '"""ckpt-58"""'], {}), "(model_dir, 'ckpt-58')\n", (338, 360), False, 'import os, json, uuid\n'), ((380, ... |
import os
import star
import numpy as np
import tables
from numpy.linalg import lstsq
from phd.thunderstorm import atmosphere
import matplotlib.pyplot as plt
def get_minimal_field(height = 0.0):
"""
:param height: meters
:return:
"""
material = star.electron.PredefinedMaterials.AIR_DRY_NEAR_SEA_L... | [
"os.mkdir",
"phd.thunderstorm.atmosphere.ISACalculator.density",
"numpy.linalg.lstsq",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"numpy.dtype",
"os.path.exists",
"numpy.cumsum",
"numpy.histogram",
"numpy.array",
"numpy.arange",
"star.electron.calculate_estar_table",
"matplotlib.py... | [((339, 379), 'phd.thunderstorm.atmosphere.ISACalculator.density', 'atmosphere.ISACalculator.density', (['height'], {}), '(height)\n', (371, 379), False, 'from phd.thunderstorm import atmosphere\n'), ((400, 445), 'star.electron.calculate_estar_table', 'star.electron.calculate_estar_table', (['material'], {}), '(materia... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pa
# local_conn = mu.get_conn()
# local_conn = create_engine('mysql+pymysql://root:root@localhost:3306/test?charset=utf8')
# 显示所有列
pa.set_option('display.max_columns', None)
# 显示所有行
pa.set_option('display.max_rows', None)
path = r'C:\Users\AL\Deskt... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"numpy.random.randn",
"pandas.read_csv",
"pandas.datetime.today",
"pandas.merge",
"pandas.to_datetime",
"pandas.set_option",
"pandas.concat"
] | [((202, 244), 'pandas.set_option', 'pa.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (215, 244), True, 'import pandas as pa\n'), ((253, 292), 'pandas.set_option', 'pa.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (266, 292), True, '... |
#!/usr/bin/env python3
# coding=utf-8
"""
A potential tutorial for GRUCell
https://towardsdatascience.com/encoder-decoder-model-for-multistep-time-series-forecasting-using-pytorch-5d54c6af6e60
"""
import copy
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from torch.nn import func... | [
"torch.ones",
"copy.deepcopy",
"torch.stack",
"torch.nn.utils.rnn.pad_sequence",
"torch.where",
"torch.nn.functional.mse_loss",
"torch.nn.functional.smooth_l1_loss",
"torch.cat",
"torch.exp",
"numpy.random.randint",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.utils.rnn.pack_padded_sequ... | [((1003, 1016), 'torch.nn.Identity', 'nn.Identity', ([], {}), '()\n', (1014, 1016), True, 'import torch.nn as nn\n'), ((4503, 4528), 'torch.stack', 'torch.stack', (['preds'], {'dim': '(1)'}), '(preds, dim=1)\n', (4514, 4528), False, 'import torch\n'), ((5430, 5450), 'copy.deepcopy', 'copy.deepcopy', (['batch'], {}), '(... |
# Authors: <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>
#
# Copyright (c) 2020. Johns Hopkins University - All rights reserved.
import os
import numpy as np
import torch.utils.data as data
from PIL import Image
from albumentations import Compose
from natsort import natsorted
from dataset.preprocess import augment, n... | [
"numpy.zeros_like",
"dataset.stereo_albumentation.RandomBrightnessContrastStereo",
"dataset.stereo_albumentation.random_crop",
"PIL.Image.open",
"dataset.preprocess.normalization",
"os.path.join",
"dataset.preprocess.augment",
"natsort.natsorted",
"dataset.stereo_albumentation.RGBShiftStereo"
] | [((5667, 5692), 'natsort.natsorted', 'natsorted', (['left_data_2015'], {}), '(left_data_2015)\n', (5676, 5692), False, 'from natsort import natsorted\n'), ((6224, 6249), 'natsort.natsorted', 'natsorted', (['left_data_2012'], {}), '(left_data_2012)\n', (6233, 6249), False, 'from natsort import natsorted\n'), ((6492, 653... |
from numpy import array, isclose, pi
from scipy.constants import epsilon_0
from ..egs import egs_force
def test_egs_force():
"""Test the calculation of the bare egs force."""
r = 2.0
alpha = 1.3616
lambda_p = 1.778757e-09
lambda_m = 4.546000e-09
charge = 1.440961e-09
c_const = charge**2 /... | [
"numpy.isclose",
"numpy.array"
] | [((358, 449), 'numpy.array', 'array', (['[c_const * 0.5, 1.0 + alpha, 1.0 - alpha, 1.0 / lambda_m, 1.0 / lambda_p, 1e-14\n ]'], {}), '([c_const * 0.5, 1.0 + alpha, 1.0 - alpha, 1.0 / lambda_m, 1.0 /\n lambda_p, 1e-14])\n', (363, 449), False, 'from numpy import array, isclose, pi\n'), ((506, 545), 'numpy.isclose',... |
"""Model size metrics
"""
import numpy as np
from . import nonzero, dtype2bits
def model_size(model, as_bits=False):
"""Returns absolute and nonzero model size
Arguments:
model {torch.nn.Module} -- Network to compute model size over
Keyword Arguments:
as_bits {bool} -- Whether to accoun... | [
"numpy.prod"
] | [((574, 595), 'numpy.prod', 'np.prod', (['tensor.shape'], {}), '(tensor.shape)\n', (581, 595), True, 'import numpy as np\n')] |
import random
import numpy as np
from collections import deque
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from memory import ReplayMemory
from model_noisy import *
from utils import *
from config import *
import pdb
device = torch.device("cuda:0... | [
"numpy.stack",
"memory.ReplayMemory",
"numpy.array",
"numpy.float32"
] | [((857, 871), 'memory.ReplayMemory', 'ReplayMemory', ([], {}), '()\n', (869, 871), False, 'from memory import ReplayMemory\n'), ((1978, 2009), 'numpy.stack', 'np.stack', (['mini_batch[0]'], {'axis': '(0)'}), '(mini_batch[0], axis=0)\n', (1986, 2009), True, 'import numpy as np\n'), ((2050, 2082), 'numpy.float32', 'np.fl... |
# Using chrisjmccormick's github for the basic word2vec import
from gensim import utils, matutils
from itertools import chain
import logging
from six import string_types
import numpy as np
import os
import sys
import pandas as pd
import time
from os.path import exists
from os import mkdir
from models import vocabula... | [
"pandas.DataFrame",
"os.mkdir",
"os.path.exists",
"time.strftime",
"models.load_model",
"numpy.array",
"numpy.dot",
"itertools.chain.from_iterable",
"os.listdir",
"logging.getLogger",
"gensim.utils.to_unicode"
] | [((2019, 2040), 'numpy.dot', 'np.dot', (['limited', 'mean'], {}), '(limited, mean)\n', (2025, 2040), True, 'import numpy as np\n'), ((2569, 2596), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2586, 2596), False, 'import logging\n'), ((11779, 11804), 'os.listdir', 'os.listdir', (['"""..... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | [
"oneflow.compatible.single_client.typing.ListNumpy.Placeholder",
"numpy.ones",
"oneflow.compatible.single_client.constant_initializer",
"oneflow.compatible.single_client.watch_diff",
"unittest.main",
"oneflow.compatible.single_client.FunctionConfig",
"oneflow.compatible.single_client.broadcast_to_compat... | [((4221, 4253), 'oneflow.compatible.single_client.unittest.skip_unless_1n1d', 'flow.unittest.skip_unless_1n1d', ([], {}), '()\n', (4251, 4253), True, 'from oneflow.compatible import single_client as flow\n'), ((973, 1001), 'oneflow.compatible.single_client.clear_default_session', 'flow.clear_default_session', ([], {}),... |
# Libraries for system and debug
from ast import Param
import sys
import pdb
import os
from datetime import datetime
# Class for converting sequences to tensors
from seq2tensor import s2t
# Libraries for neural network training
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.la... | [
"tqdm.tqdm",
"numpy.average",
"tensorflow.keras.layers.multiply",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Conv1D",
"tensorflow.keras.layers.GRU",
"tensorflow.config.list_logical_devices",
"tensorflow.keras.layers.MaxPooling1D",
"tensorflow.confi... | [((2014, 2026), 'seq2tensor.s2t', 's2t', (['use_emb'], {}), '(use_emb)\n', (2017, 2026), False, 'from seq2tensor import s2t\n'), ((4034, 4075), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(seq_size, dim)', 'name': '"""seq1"""'}), "(shape=(seq_size, dim), name='seq1')\n", (4039, 4075), False, 'from tensorf... |
#!/usr/bin/env python
import numpy as np, os, sys
from scipy.io import loadmat
from run_12ECG_classifier import load_12ECG_artifacts, run_12ECG_classifier
import tqdm
from os.path import join
from pathlib import Path
def load_challenge_data(filename):
x = loadmat(filename)
data = np.asarray(x['val'], dtype=n... | [
"os.mkdir",
"run_12ECG_classifier.run_12ECG_classifier",
"scipy.io.loadmat",
"os.path.isdir",
"numpy.asarray",
"pathlib.Path",
"os.path.splitext",
"run_12ECG_classifier.load_12ECG_artifacts",
"os.path.join",
"os.listdir"
] | [((263, 280), 'scipy.io.loadmat', 'loadmat', (['filename'], {}), '(filename)\n', (270, 280), False, 'from scipy.io import loadmat\n'), ((292, 330), 'numpy.asarray', 'np.asarray', (["x['val']"], {'dtype': 'np.float64'}), "(x['val'], dtype=np.float64)\n", (302, 330), True, 'import numpy as np, os, sys\n'), ((403, 425), '... |
import numpy as np
from attackgraph.gambit_analysis import do_gambit_analysis
cost = 0.5
ub_p = 10
discount = 0.5
bankrupt_threshold1 = -3
bankrupt_threshold2 = -3
bankrupt_penalty = -100
lb_q = 0
ub_q = 11
step_size = 0.5
mono_q = 9.5/2
mono_util = (9.5/2)**2
def bankrpt(u1, u2):
if u1 > bankrupt_threshold1 and... | [
"numpy.sum",
"numpy.maximum",
"numpy.random.seed",
"numpy.argmax",
"numpy.setdiff1d",
"numpy.zeros",
"numpy.shape",
"numpy.argsort",
"attackgraph.gambit_analysis.do_gambit_analysis",
"numpy.arange",
"numpy.array",
"numpy.random.choice"
] | [((969, 982), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (977, 982), True, 'import numpy as np\n'), ((1066, 1097), 'numpy.sum', 'np.sum', (['(p1_payoff * act)'], {'axis': '(1)'}), '(p1_payoff * act, axis=1)\n', (1072, 1097), True, 'import numpy as np\n'), ((1172, 1192), 'numpy.argmax', 'np.argmax', (['util_ve... |
"Layer visualization of Comics Net models"
import random
import matplotlib.pyplot as plt
import numpy as np
import torch
from IPython.display import clear_output
from torch import Tensor, tensor
def init_pixel_buf(size: int, cuda: bool = False, seed=None) -> Tensor:
"""Initialize a pixel buffer.
Args:
... | [
"numpy.random.seed",
"matplotlib.pyplot.show",
"numpy.maximum",
"torch.irfft",
"numpy.asarray",
"torch.empty",
"torch.sigmoid",
"torch.optim.Adam",
"numpy.fft.fftfreq",
"numpy.linalg.norm",
"numpy.random.normal",
"numpy.random.random",
"IPython.display.clear_output",
"torch.matmul",
"mat... | [((1966, 1992), 'numpy.sqrt', 'np.sqrt', (['(fx * fx + fy * fy)'], {}), '(fx * fx + fy * fy)\n', (1973, 1992), True, 'import numpy as np\n'), ((2259, 2315), 'torch.irfft', 'torch.irfft', (['t'], {'signal_ndim': '(2)', 'signal_sizes': '(size, size)'}), '(t, signal_ndim=2, signal_sizes=(size, size))\n', (2270, 2315), Fal... |
import json
import numpy as np
import os
import random
from tqdm import tqdm
RATIO1 = 0.8
RATIO2 = 0.9
weapon_index_dict = {}
def weapon2index(weapon_list):
# global w
global weapon_index_dict
res = []
for weapon in weapon_list:
if weapon in weapon_index_dict:
res.append(weapon_i... | [
"numpy.load",
"numpy.save",
"json.load",
"random.shuffle",
"numpy.asarray",
"random.seed",
"os.path.join",
"os.listdir"
] | [((9208, 9225), 'random.seed', 'random.seed', (['(4164)'], {}), '(4164)\n', (9219, 9225), False, 'import random\n'), ((9230, 9260), 'random.shuffle', 'random.shuffle', (['processed_data'], {}), '(processed_data)\n', (9244, 9260), False, 'import random\n'), ((9886, 9956), 'numpy.save', 'np.save', (["(dataset_dir + 'proc... |
# Author: <NAME>
# Date: 2020, November 1st
# Location: China Ningxia Yinchuan
import numpy as np
class Agent(object):
def __init__(self, alpha, gamma, epsilon = 0):
self.alpha = alpha
self.gamma = gamma
self.epsilon = epsilon
def optimal_states(self, state_options):
# state_options is a dictionary with:
... | [
"numpy.random.rand"
] | [((843, 859), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (857, 859), True, 'import numpy as np\n'), ((1855, 1871), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (1869, 1871), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import numpy as np
import os
from pprint import pprint
import pyopencl as cl
import sys
from lib.clip import *
os.environ['PYOPENCL_COMPILER_OUTPUT'] = '1'
def loadMakeImageProgram(width, height, pcount, colorDimensions, precision):
precisionMultiplier = int(10 ** precision)
# the ke... | [
"pyopencl.get_platforms",
"pyopencl.enqueue_copy",
"pyopencl.Context",
"numpy.zeros",
"pyopencl.CommandQueue",
"pyopencl.Buffer",
"pyopencl.Program",
"numpy.array"
] | [((8723, 8767), 'numpy.zeros', 'np.zeros', (['(width * height * 2)'], {'dtype': 'np.int32'}), '(width * height * 2, dtype=np.int32)\n', (8731, 8767), True, 'import numpy as np\n'), ((9176, 9196), 'pyopencl.CommandQueue', 'cl.CommandQueue', (['ctx'], {}), '(ctx)\n', (9191, 9196), True, 'import pyopencl as cl\n'), ((9234... |
import psycopg2
import numpy as np
from shutil import copyfile
import faiss as fs
import os
class Faisser:
def __init__(self, faiss_path):
if not os.path.exists(faiss_path):
message = {
'status': 'error',
'message': 'NO FAISS FILE FOUND, PLEASE CHECK LOC... | [
"faiss.write_index",
"faiss.read_index",
"os.path.exists",
"numpy.array",
"numpy.dot",
"numpy.fromstring"
] | [((160, 186), 'os.path.exists', 'os.path.exists', (['faiss_path'], {}), '(faiss_path)\n', (174, 186), False, 'import os\n'), ((430, 483), 'faiss.read_index', 'fs.read_index', (['faiss_path', 'fs.IO_FLAG_ONDISK_SAME_DIR'], {}), '(faiss_path, fs.IO_FLAG_ONDISK_SAME_DIR)\n', (443, 483), True, 'import faiss as fs\n'), ((11... |
#! /usr/env/python
"""
flow_director_mfd.py: provides the component FlowDirectorMFD.
This components finds the steepest single-path steepest descent flow
directions. It is equivalent to D4 method in the special case of a raster grid
in that it does not consider diagonal links between nodes. For that capability,
use F... | [
"numpy.unique",
"numpy.zeros",
"numpy.ones",
"numpy.hstack",
"numpy.logical_or",
"landlab.components.flow_director.flow_direction_mfd.flow_directions_mfd",
"doctest.testmod"
] | [((21834, 21851), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (21849, 21851), False, 'import doctest\n'), ((20934, 21145), 'landlab.components.flow_director.flow_direction_mfd.flow_directions_mfd', 'flow_direction_mfd.flow_directions_mfd', (['self.surface_values', 'neighbors_at_node', 'links_at_node', 'acti... |
# Lint as: python3
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"lingvo.compat.variable_scope",
"lingvo.core.gshard_layers.StateLayer.UpdateState",
"lingvo.compat.test.main",
"numpy.random.seed",
"lingvo.core.gshard_layers.CausalDepthwiseConv1DLayer.Params",
"lingvo.core.gshard_builder.MoEBuilder.Params",
"lingvo.compat.concat",
"lingvo.core.gshard_layers.StateLay... | [((4195, 4209), 'lingvo.compat.test.main', 'tf.test.main', ([], {}), '()\n', (4207, 4209), True, 'from lingvo import compat as tf\n'), ((1483, 1503), 'numpy.random.seed', 'np.random.seed', (['None'], {}), '(None)\n', (1497, 1503), True, 'import numpy as np\n'), ((2045, 2078), 'lingvo.compat.global_variables_initializer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.