code stringlengths 31 1.05M | apis list | extract_api stringlengths 97 1.91M |
|---|---|---|
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2017 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
import numpy as np
import pytest
from pymor.core.pickle import dumps, loads
from pymor.functions.... | [
"pymortests.pickling.assert_picklable_without_dumps_function",
"pymortests.fixtures.function.function_argument",
"pymor.core.pickle.dumps",
"numpy.ones",
"pymortests.fixtures.parameter.parameters_of_type",
"numpy.linspace",
"pymor.functions.basic.ConstantFunction",
"pytest.raises",
"numpy.zeros",
... | [((1045, 1087), 'pymortests.fixtures.parameter.parameters_of_type', 'parameters_of_type', (['f.parameter_type', '(4711)'], {}), '(f.parameter_type, 4711)\n', (1063, 1087), False, 'from pymortests.fixtures.parameter import parameters_of_type\n'), ((2526, 2552), 'pymortests.pickling.assert_picklable', 'assert_picklable',... |
import numpy as np
from scipy.interpolate import interp1d
from pyTools import *
################################################################################
#~~~~~~~~~Log ops
################################################################################
def logPolyVal(p,x):
ord = p.order()
logs = []
... | [
"numpy.abs",
"numpy.ones_like",
"numpy.ones",
"numpy.log",
"scipy.interpolate.interp1d",
"numpy.array",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.meshgrid",
"numpy.zeros_like"
] | [((804, 836), 'scipy.interpolate.interp1d', 'interp1d', (['x', 'y'], {'kind': 'interp_type'}), '(x, y, kind=interp_type)\n', (812, 836), False, 'from scipy.interpolate import interp1d\n'), ((1129, 1158), 'numpy.linspace', 'np.linspace', (['(0)', 'np.pi', 'ntheta'], {}), '(0, np.pi, ntheta)\n', (1140, 1158), True, 'impo... |
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#New record
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
data.shape
cenus=np.concatenate((new_record,data),axis=0)
cenus.... | [
"numpy.mean",
"numpy.concatenate",
"numpy.std",
"numpy.genfromtxt",
"warnings.filterwarnings"
] | [((82, 115), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (105, 115), False, 'import warnings\n'), ((203, 252), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (216, 252), True, 'i... |
# Copyright (C) 2018 <NAME>, <NAME>
# All rights reserved.
#
# This file is part of yambopy
#
from __future__ import print_function
from builtins import range
from yambopy import *
from qepy import *
import json
import matplotlib.pyplot as plt
import numpy as np
import sys
import argparse
import operator
def analyse_b... | [
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.savetxt",
"sys.exit",
"json.load",
"operator.itemgetter",
"matplotlib.pyplot.NullLocator",
"matplotlib.pyplot.legend"
] | [((4633, 4730), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Study convergence on BS calculations using ypp calls."""'}), "(description=\n 'Study convergence on BS calculations using ypp calls.')\n", (4656, 4730), False, 'import argparse\n'), ((3281, 3293), 'json.load', 'json.load',... |
# -*- coding: utf-8 -*-
import time
from datetime import datetime
import warnings
from textwrap import dedent, fill
import numpy as np
import pandas as pd
from numpy.linalg import norm, inv
from scipy.linalg import solve as spsolve, LinAlgError
from scipy.integrate import trapz
from scipy import stats
from lifelines.... | [
"lifelines.utils.normalize",
"lifelines.plotting.set_kwargs_drawstyle",
"numpy.clip",
"lifelines.statistics.proportional_hazard_test",
"lifelines.utils.check_complete_separation",
"numpy.sqrt",
"lifelines.utils.check_low_var",
"lifelines.utils.string_justify",
"numpy.log",
"numpy.warnings.catch_wa... | [((10197, 10226), 'lifelines.utils.coalesce', 'coalesce', (['strata', 'self.strata'], {}), '(strata, self.strata)\n', (10205, 10226), False, 'from lifelines.utils import _get_index, _to_list, _to_tuple, _to_1d_array, inv_normal_cdf, normalize, qth_survival_times, coalesce, check_for_numeric_dtypes_or_raise, check_low_v... |
import numpy as np
import random
import sys
chainlength = int(sys.argv[1])
dfname = sys.argv[2]
outfl = 'result.data'
cluster_size = int(sys.argv[3])
def readsize(dfname):
with open(dfname, 'r') as df:
lines = df.readlines()
for line in lines:
content = line.split()
if content and cont... | [
"numpy.sqrt",
"numpy.ones",
"numpy.sort",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"numpy.around",
"random.random"
] | [((6414, 6442), 'numpy.array', 'np.array', (['[size, size, size]'], {}), '([size, size, size])\n', (6422, 6442), True, 'import numpy as np\n'), ((1052, 1063), 'numpy.array', 'np.array', (['M'], {}), '(M)\n', (1060, 1063), True, 'import numpy as np\n'), ((1155, 1192), 'numpy.empty', 'np.empty', (['(n, k)'], {'dtype': 'd... |
"""
This module provides helper functions to support exercises during AM1
with outliers, robust regression and template regression in the CORE
data analytics workshop series, week 4.
"""
import numpy as np
import pandas as pd
import math
from collections import namedtuple
def recovery_sulphur_dataframe_wit... | [
"numpy.random.normal",
"collections.namedtuple",
"numpy.ones",
"math.sqrt",
"math.log",
"numpy.zeros",
"numpy.linspace",
"pandas.DataFrame",
"numpy.zeros_like",
"numpy.random.RandomState"
] | [((1701, 1804), 'pandas.DataFrame', 'pd.DataFrame', (["{'metal_recovery_percent': recovery_percent, 'feed_sulphur_percent':\n sulphur_percent}"], {}), "({'metal_recovery_percent': recovery_percent,\n 'feed_sulphur_percent': sulphur_percent})\n", (1713, 1804), True, 'import pandas as pd\n'), ((1910, 1937), 'numpy.... |
import numpy as np
from fixtrack.frontend.pickable_base import PickableBase
from vispy import scene
class PickableMarkers(PickableBase):
"""
Markers that can highlight on hover and be selected
"""
class State(PickableBase.State):
def __init__(self, **kwargs):
super(PickableMarker... | [
"numpy.full",
"numpy.zeros",
"vispy.scene.visuals.Markers"
] | [((790, 806), 'numpy.zeros', 'np.zeros', (['(0, 3)'], {}), '((0, 3))\n', (798, 806), True, 'import numpy as np\n'), ((1818, 1859), 'numpy.full', 'np.full', (['(n,)', "self._cfg.vis_args['size']"], {}), "((n,), self._cfg.vis_args['size'])\n", (1825, 1859), True, 'import numpy as np\n'), ((896, 942), 'vispy.scene.visuals... |
import matplotlib.pyplot as plt
import numpy as np
from photonpy.cpp.context import Context
import photonpy.cpp.gaussian as gaussian
from photonpy.smlm.util import imshow_hstack
from photonpy.cpp.estimator import Estimator
def CheckDeriv(psf:Estimator, theta):
nderiv,ev=psf.NumDeriv(theta,eps=1e-6)
deriv,ev=p... | [
"matplotlib.pyplot.imshow",
"photonpy.cpp.context.Context",
"numpy.abs",
"photonpy.cpp.gaussian.Gaussian",
"numpy.random.poisson",
"photonpy.smlm.util.imshow_hstack",
"numpy.max",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.set_cmap"
] | [((508, 520), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (518, 520), True, 'import matplotlib.pyplot as plt\n'), ((525, 560), 'photonpy.smlm.util.imshow_hstack', 'imshow_hstack', (['(deriv[0] - nderiv[0])'], {}), '(deriv[0] - nderiv[0])\n', (538, 560), False, 'from photonpy.smlm.util import imshow_hsta... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 13:38:35 2021
GROUND INVASION! The Game
@author: <NAME> (<EMAIL>)
"""
# Packages used:
import numpy as np
import pandas as pd
import random as rng
from termcolor import colored
# Defining starting forces
## Defenders:
def_force = 1250
def_reserves = ... | [
"numpy.random.normal",
"termcolor.colored",
"random.choice"
] | [((799, 871), 'termcolor.colored', 'colored', (['"""########## INTELLIGENCE REPORT ##########"""'], {'on_color': '"""on_cyan"""'}), "('########## INTELLIGENCE REPORT ##########', on_color='on_cyan')\n", (806, 871), False, 'from termcolor import colored\n'), ((1906, 1978), 'termcolor.colored', 'colored', (['"""#########... |
from collections import deque, defaultdict
import os
import sys
import logging
import time
import json
import gym
import torch.nn as nn
import torch
import numpy as np
import matplotlib.pyplot as plt
from model import RL_Policy, Semantic_Mapping
from utils.storage import GlobalRolloutStorage
from envs import make_vec_... | [
"numpy.random.rand",
"torch.from_numpy",
"logging.info",
"os.path.exists",
"numpy.mean",
"collections.deque",
"torch.set_num_threads",
"numpy.max",
"numpy.random.seed",
"numpy.min",
"arguments.get_args",
"model.Semantic_Mapping",
"envs.make_vec_envs",
"time.time",
"time.gmtime",
"torch... | [((430, 440), 'arguments.get_args', 'get_args', ([], {}), '()\n', (438, 440), False, 'from arguments import get_args\n'), ((446, 471), 'numpy.random.seed', 'np.random.seed', (['args.seed'], {}), '(args.seed)\n', (460, 471), True, 'import numpy as np\n'), ((476, 504), 'torch.manual_seed', 'torch.manual_seed', (['args.se... |
import pickle
import numpy as np
import os
def _analyze_query_point_assignment(
query_data_dict: dict,
init_Rdata_dict: dict,
init_Edata_dict: dict,
num_R: int,
query_point_assignment_array: np.ndarray,
root: str,
n_points_to_copy=50,
):
"""
Analyzes and visualizes qDCA results.
... | [
"os.path.exists",
"pickle.dump",
"numpy.where",
"os.path.join",
"pickle.load",
"numpy.array",
"numpy.empty",
"os.mkdir",
"numpy.concatenate"
] | [((4090, 4146), 'os.path.join', 'os.path.join', (['root', '"""visualization"""', '"""same_label_images"""'], {}), "(root, 'visualization', 'same_label_images')\n", (4102, 4146), False, 'import os\n'), ((4176, 4233), 'os.path.join', 'os.path.join', (['root', '"""visualization"""', '"""wrong_label_images"""'], {}), "(roo... |
import numpy as np
from keras.models import Sequential
from keras.layers import LSTM, Dense, Dropout
def visualize_training_results(results):
"""
Plots the loss and accuracy for the training and testing data
"""
history = results.history
plt.figure(figsize=(12,4))
plt.plot(history['val_loss'])
... | [
"numpy.array",
"keras.layers.LSTM",
"keras.layers.Dropout",
"keras.models.Sequential"
] | [((1429, 1441), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1439, 1441), False, 'from keras.models import Sequential\n'), ((1144, 1155), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1152, 1155), True, 'import numpy as np\n'), ((1157, 1168), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1165, 11... |
"""This module contains helper functions and utilities for nelpy."""
__all__ = ['spatial_information',
'frange',
'swap_cols',
'swap_rows',
'pairwise',
'is_sorted',
'linear_merge',
'PrettyDuration',
'ddt_asa',
'get_contig... | [
"numpy.prod",
"logging.warnings",
"numpy.hstack",
"math.floor",
"numpy.log",
"numpy.asanyarray",
"numpy.array",
"copy.deepcopy",
"numpy.linalg.norm",
"operator.itemgetter",
"numpy.gradient",
"numpy.arange",
"numpy.mean",
"numpy.atleast_2d",
"numpy.searchsorted",
"numpy.where",
"numpy... | [((1683, 1708), 'numpy.array', 'np.array', (['(n_elem * [None])'], {}), '(n_elem * [None])\n', (1691, 1708), True, 'import numpy as np\n'), ((2313, 2339), 'numpy.array', 'np.array', (['indices'], {'ndmin': '(2)'}), '(indices, ndmin=2)\n', (2321, 2339), True, 'import numpy as np\n'), ((2790, 2845), 'numpy.linspace', 'np... |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function # Python 2/3 compatibility
__doc__ = """
Examples of design matrices specification and and computation (event-related
design, FIR design, etc)
Re... | [
"numpy.ones",
"numpy.arange",
"nipy.modalities.fmri.experimental_paradigm.BlockParadigm",
"numpy.linspace",
"matplotlib.pyplot.figure",
"nipy.modalities.fmri.design_matrix.make_dmtx",
"numpy.random.randn",
"nipy.modalities.fmri.experimental_paradigm.EventRelatedParadigm",
"matplotlib.pyplot.subplot"... | [((791, 832), 'numpy.linspace', 'np.linspace', (['(0)', '((nscans - 1) * tr)', 'nscans'], {}), '(0, (nscans - 1) * tr, nscans)\n', (802, 832), True, 'import numpy as np\n'), ((1138, 1178), 'nipy.modalities.fmri.experimental_paradigm.EventRelatedParadigm', 'EventRelatedParadigm', (['conditions', 'onsets'], {}), '(condit... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, German Neuroinformatics Node (G-Node)
# <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of t... | [
"mock.Mock",
"nixio.Value",
"quantities.Quantity",
"neo.core.Event",
"numpy.array_split",
"neo.core.Unit",
"numpy.array",
"neo.io.nixio.NixIO",
"neo.core.AnalogSignal",
"neo.core.SpikeTrain",
"numpy.arange",
"os.remove",
"numpy.random.random",
"numpy.float64",
"numpy.testing.assert_almos... | [((1013, 1058), 'unittest.skipUnless', 'unittest.skipUnless', (['HAVE_NIX', '"""Requires NIX"""'], {}), "(HAVE_NIX, 'Requires NIX')\n", (1032, 1058), False, 'import unittest\n'), ((45446, 45491), 'unittest.skipUnless', 'unittest.skipUnless', (['HAVE_NIX', '"""Requires NIX"""'], {}), "(HAVE_NIX, 'Requires NIX')\n", (454... |
"""
=========
filtering.py
=========
This module provides more granular filtering for captures.
You can customize your own filters too.
"""
from __future__ import annotations
import re
from abc import ABC, ABCMeta, abstractmethod
from dataclasses import dataclass
from json import JSONEncoder
from pathlib import Posi... | [
"numpy.mean",
"numpy.abs",
"numpy.median",
"numpy.logical_and",
"pathlib.PosixPath",
"dataclasses.dataclass",
"numpy.min",
"typing.NewType",
"numpy.max",
"numpy.tanh",
"numpy.std"
] | [((1019, 1046), 'typing.NewType', 'NewType', (['"""FilterSetId"""', 'str'], {}), "('FilterSetId', str)\n", (1026, 1046), False, 'from typing import Any, Dict, Iterable, Mapping, NewType, Optional, Protocol, Type, TypedDict, Union\n'), ((1124, 1150), 'typing.NewType', 'NewType', (['"""FilterName"""', 'str'], {}), "('Fil... |
# Helper code to plot binary losses.
#
# <NAME> (http://eli.thegreenplace.net)
# This code is in the public domain
from __future__ import print_function
import matplotlib.pyplot as plt
import numpy as np
if __name__ == '__main__':
fig, ax = plt.subplots()
fig.set_tight_layout(True)
xs = np.linspace(-2, 2... | [
"numpy.ones_like",
"numpy.linspace",
"matplotlib.pyplot.ylim",
"numpy.zeros_like",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((247, 261), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (259, 261), True, 'import matplotlib.pyplot as plt\n'), ((303, 326), 'numpy.linspace', 'np.linspace', (['(-2)', '(2)', '(500)'], {}), '(-2, 2, 500)\n', (314, 326), True, 'import numpy as np\n'), ((717, 734), 'matplotlib.pyplot.ylim', 'plt.yli... |
import numpy as np
import cv2
#define a canvas of size 300x300 px, with 3 channels (R,G,B) and data type as 8 bit unsigned integer
canvas = np.zeros((300,300,3), dtype ="uint8")
#define color
#draw a circle
#arguments are canvas/image, midpoint, radius, color, thickness(optional)
#display in cv2 window
green = (0,255... | [
"cv2.imshow",
"cv2.circle",
"numpy.zeros",
"numpy.random.randint",
"cv2.waitKey"
] | [((141, 179), 'numpy.zeros', 'np.zeros', (['(300, 300, 3)'], {'dtype': '"""uint8"""'}), "((300, 300, 3), dtype='uint8')\n", (149, 179), True, 'import numpy as np\n'), ((324, 365), 'cv2.circle', 'cv2.circle', (['canvas', '(100, 100)', '(10)', 'green'], {}), '(canvas, (100, 100), 10, green)\n', (334, 365), False, 'import... |
""" Bifurcation point classes. Each class locates and processes bifurcation points.
* _BranchPointFold is a version based on BranchPoint location algorithms
* BranchPoint: Branch process is broken (can't find alternate branch -- see MATCONT notes)
<NAME>, March 2006
"""
from __future__ import absolute_i... | [
"scipy.optimize.fsolve",
"numpy.average",
"numpy.conjugate",
"PyDSTool.common.args",
"numpy.real",
"scipy.linalg.eig",
"numpy.zeros",
"numpy.dot",
"numpy.nonzero",
"scipy.linalg.norm",
"numpy.transpose",
"numpy.imag"
] | [((1323, 1329), 'PyDSTool.common.args', 'args', ([], {}), '()\n', (1327, 1329), False, 'from PyDSTool.common import args\n'), ((1932, 1982), 'numpy.average', 'average', (['[point[0] for point in pointlist]'], {'axis': '(0)'}), '([point[0] for point in pointlist], axis=0)\n', (1939, 1982), False, 'from numpy import Inf,... |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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... | [
"skopt.plots.plot_convergence",
"io.BytesIO",
"skopt.plots.plot_regret",
"matplotlib.pyplot.figure",
"skopt.utils.dump",
"skopt.plots.plot_evaluations",
"numpy.min",
"warnings.warn",
"neptunecontrib.monitoring.utils.expect_not_a_run",
"matplotlib.pyplot.subplots",
"skopt.plots.plot_objective"
] | [((4317, 4339), 'neptunecontrib.monitoring.utils.expect_not_a_run', 'expect_not_a_run', (['_exp'], {}), '(_exp)\n', (4333, 4339), False, 'from neptunecontrib.monitoring.utils import axes2fig, expect_not_a_run\n'), ((4825, 4847), 'warnings.warn', 'warnings.warn', (['message'], {}), '(message)\n', (4838, 4847), False, 'i... |
import numpy as np
import astropy.modeling.blackbody as bb
import astropy.constants as const
from astropy.io import fits
from scipy.interpolate import interp2d
class FaiglerMazehFit():
def __init__(self, P_orb, inc, R_star, M_star, T_star, A_ellip=False, A_beam=False,
R_p=False, a=False, u=False, g=0.65, logg=... | [
"numpy.mean",
"numpy.log10",
"astropy.modeling.blackbody.blackbody_lambda",
"numpy.sin",
"numpy.genfromtxt"
] | [((8484, 8553), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': 'delimiter', 'usecols': '(0, 1)', 'unpack': '(True)'}), '(file, delimiter=delimiter, usecols=(0, 1), unpack=True)\n', (8497, 8553), True, 'import numpy as np\n'), ((6992, 7078), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../claret_ldc.dat"""'... |
import legacy_code.tf_cnn_siamese.configurations as conf
import tensorflow as tf
import numpy as np
def construct_cnn(x, conv_weights, conv_biases, fc_weights, fc_biases,
dropout = False):
"""
constructs the convolution graph for one image
:param x: input node
:param conv_weights: convolutio... | [
"tensorflow.nn.conv2d",
"numpy.prod",
"tensorflow.nn.max_pool",
"tensorflow.Variable",
"tensorflow.squared_difference",
"tensorflow.nn.l2_loss",
"tensorflow.nn.sigmoid",
"tensorflow.name_scope",
"tensorflow.nn.dropout",
"tensorflow.matmul",
"tensorflow.reshape",
"tensorflow.nn.sigmoid_cross_en... | [((1327, 1348), 'tensorflow.reshape', 'tf.reshape', (['x', '[n, m]'], {}), '(x, [n, m])\n', (1337, 1348), True, 'import tensorflow as tf\n'), ((2472, 2509), 'tensorflow.squared_difference', 'tf.squared_difference', (['twin_1', 'twin_2'], {}), '(twin_1, twin_2)\n', (2493, 2509), True, 'import tensorflow as tf\n'), ((325... |
def us_choropleth(t):
import matplotlib.cm
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
from matplotlib.colors import Normalize
import shapefile
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import numpy as np
im... | [
"matplotlib.pyplot.gca",
"matplotlib.pyplot.colorbar",
"matplotlib.collections.PatchCollection",
"collections.Counter",
"numpy.array",
"mpl_toolkits.basemap.Basemap",
"matplotlib.colors.Normalize",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.patches.Polygon",
"matplotlib.pyplot.ge... | [((397, 426), 'matplotlib.pyplot.title', 'plt.title', (['"""NER"""'], {'fontsize': '(12)'}), "('NER', fontsize=12)\n", (406, 426), True, 'import matplotlib.pyplot as plt\n'), ((451, 577), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'resolution': '"""l"""', 'llcrnrlon': '(-128.94)', 'llcrnrlat': '(23.52)', 'urcrnrl... |
import pandas as pd
import numpy as np
import swifter
def money_precision_at_k(y_pred: pd.Series, y_true: pd.Series, item_price, k=5):
y_pred = y_pred.swifter.progress_bar(False).apply(pd.Series)
user_filter = ~(y_true.swifter.progress_bar(False).apply(len) < k)
y_pred = y_pred.loc[user_filter]
y_tru... | [
"numpy.array"
] | [((558, 571), 'numpy.array', 'np.array', (['row'], {}), '(row)\n', (566, 571), True, 'import numpy as np\n')] |
import inspect
import numpy as np
class TypeCheck(object):
"""
Decorator that performs a typecheck on the input to a function
"""
def __init__(self, accepted_structures, arg_name):
"""
When initialized, include list of accepted datatypes and the
arg_name to enforce the check on.... | [
"numpy.power",
"numpy.max",
"inspect.getargspec",
"numpy.array",
"numpy.min",
"numpy.vectorize"
] | [((2604, 2633), 'numpy.power', 'np.power', (['array', 'distribution'], {}), '(array, distribution)\n', (2612, 2633), True, 'import numpy as np\n'), ((2753, 2766), 'numpy.max', 'np.max', (['array'], {}), '(array)\n', (2759, 2766), True, 'import numpy as np\n'), ((2768, 2781), 'numpy.min', 'np.min', (['array'], {}), '(ar... |
from __future__ import print_function, division
import os
import numpy as np
import h5py
def dict_2_h5(fname, dic, append=False):
'''Writes a dictionary to a hdf5 file with given filename
It will use lzf compression for all numpy arrays
Args:
fname (str): filename to write to
dic (dic... | [
"os.makedirs",
"os.path.join",
"h5py.File",
"os.path.isdir",
"numpy.loadtxt"
] | [((1075, 1094), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (1088, 1094), False, 'import os\n'), ((3009, 3068), 'os.path.join', 'os.path.join', (['finesse_directory', '"""F_post_equal_weights.dat"""'], {}), "(finesse_directory, 'F_post_equal_weights.dat')\n", (3021, 3068), False, 'import os\n'), ((308... |
# Imports
import numpy as np
import pandas as pd
import sys
import tqdm
import warnings
import time
import ternary
from ternary.helpers import simplex_iterator
import multiprocessing as mp
warnings.simplefilter("ignore")
if sys.platform == "darwin":
sys.path.append("/Users/aymericvie/Documents/GitHub/evology/evol... | [
"pandas.DataFrame",
"tqdm.tqdm",
"numpy.array",
"main.main",
"numpy.random.seed",
"multiprocessing.Pool",
"time.time",
"warnings.simplefilter",
"sys.path.append",
"ternary.helpers.simplex_iterator"
] | [((190, 221), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (211, 221), False, 'import warnings\n'), ((529, 540), 'time.time', 'time.time', ([], {}), '()\n', (538, 540), False, 'import time\n'), ((256, 330), 'sys.path.append', 'sys.path.append', (['"""/Users/aymericvie/Docume... |
import numpy as np
import requests
from django.db.models import Q
from api.models import Photo, User
from api.util import logger
from ownphotos.settings import IMAGE_SIMILARITY_SERVER
def search_similar_embedding(user, emb, result_count=100, threshold=27):
if type(user) == int:
user_id = user
else:
... | [
"numpy.array",
"django.db.models.Q",
"requests.post"
] | [((368, 399), 'numpy.array', 'np.array', (['emb'], {'dtype': 'np.float32'}), '(emb, dtype=np.float32)\n', (376, 399), True, 'import numpy as np\n'), ((575, 642), 'requests.post', 'requests.post', (["(IMAGE_SIMILARITY_SERVER + '/search/')"], {'json': 'post_data'}), "(IMAGE_SIMILARITY_SERVER + '/search/', json=post_data)... |
""" Linear solvers that are used to solve for the gradient of an OpenMDAO System.
(Not to be confused with the OpenMDAO Solver classes.)
"""
# pylint: disable=E0611, F0401
import numpy as np
from scipy.sparse.linalg import gmres, LinearOperator
from openmdao.main.mpiwrap import MPI
from openmdao.util.graph import fix... | [
"scipy.sparse.linalg.LinearOperator",
"scipy.sparse.linalg.gmres",
"petsc4py.PETSc.KSP",
"petsc4py.PETSc.Vec",
"petsc4py.PETSc.Mat",
"numpy.sum",
"numpy.zeros",
"openmdao.util.graph.fix_single_tuple",
"openmdao.util.log.logger.error",
"numpy.linalg.norm"
] | [((1524, 1543), 'numpy.zeros', 'np.zeros', (['(n_edge,)'], {}), '((n_edge,))\n', (1532, 1543), True, 'import numpy as np\n'), ((1570, 1589), 'numpy.zeros', 'np.zeros', (['(n_edge,)'], {}), '((n_edge,))\n', (1578, 1589), True, 'import numpy as np\n'), ((1608, 1671), 'scipy.sparse.linalg.LinearOperator', 'LinearOperator'... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, unicode_literals, print_function)
__all__ = ['MultiLayerPerceptronBackend']
import os
import sys
import math
import time
import types
import logging
import itertools
log = logging.getLogger('sknn')
import numpy
import theano
import sklearn.... | [
"logging.getLogger",
"sys.stdout.flush",
"theano.tensor.exp",
"theano.function",
"theano.tensor.matrix",
"theano.tensor.vector",
"sys.stdout.write",
"numpy.zeros",
"theano.tensor.scalar",
"theano.tensor.tensor4",
"numpy.transpose",
"numpy.arange",
"numpy.random.shuffle"
] | [((250, 275), 'logging.getLogger', 'logging.getLogger', (['"""sknn"""'], {}), "('sknn')\n", (267, 275), False, 'import logging\n'), ((3608, 3772), 'theano.function', 'theano.function', (['[self.data_input, self.data_output, self.data_mask]', 'cost'], {'updates': 'self._learning_rule', 'on_unused_input': '"""ignore"""',... |
# Copyright 2018 The AI Safety Gridworlds 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 b... | [
"numpy.where",
"absl.flags.DEFINE_integer",
"absl.app.run",
"absl.flags.DEFINE_boolean",
"numpy.array",
"ai_safety_gridworlds.environments.shared.safety_game.add_hidden_reward",
"ai_safety_gridworlds.environments.shared.safety_game.terminate_episode",
"numpy.sum",
"pycolab.rendering.ObservationChara... | [((1882, 1943), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""level"""', '(0)', '"""Which game level to play."""'], {}), "('level', 0, 'Which game level to play.')\n", (1902, 1943), False, 'from absl import flags\n'), ((1946, 2035), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""noops"""', '(Fa... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 30 12:17:04 2021
@author: Oli
"""
import pytest
import pandas as pd
import numpy as np
import netCDF4 as nc
import os
from copy import deepcopy
os.chdir(os.path.dirname(os.path.realpath(__file__)))
wd = os.getcwd().replace('\\', '/')
exec(open("test_set... | [
"model_interface.wham.WHAM",
"os.getcwd",
"os.chdir",
"os.path.realpath",
"numpy.nanmean",
"numpy.nanquantile",
"copy.deepcopy",
"numpy.nansum"
] | [((339, 378), 'os.chdir', 'os.chdir', (["(wd[0:-6] + '/src/data_import')"], {}), "(wd[0:-6] + '/src/data_import')\n", (347, 378), False, 'import os\n'), ((3057, 3073), 'model_interface.wham.WHAM', 'WHAM', (['parameters'], {}), '(parameters)\n', (3061, 3073), False, 'from model_interface.wham import WHAM\n'), ((3136, 31... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 10:37:04 2021
@author: <NAME>
"""
#calculates trajectory of small mass positioned close to L4 Lagrange point
#creates gif as output
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, PillowWriter
Distan... | [
"matplotlib.pyplot.plot",
"math.sqrt",
"math.cos",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.animation.PillowWriter",
"numpy.vectorize",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((495, 528), 'math.sqrt', 'math.sqrt', (['(G * (M1 + M2) / a ** 3)'], {}), '(G * (M1 + M2) / a ** 3)\n', (504, 528), False, 'import math\n'), ((1949, 1966), 'numpy.vectorize', 'np.vectorize', (['pot'], {}), '(pot)\n', (1961, 1966), True, 'import numpy as np\n'), ((2170, 2195), 'numpy.linspace', 'np.linspace', (['(0)',... |
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
def seasonality_model(thetas, t, device):
p = thetas.size()[-1]
assert p < 10, 'thetas_dim is too big.'
p1, p2 = (p // 2, p // 2) if p % 2 == 0 else (p // 2, p // 2 + 1)
s1 = torch.tensor([np.cos(2 * np.pi * i * ... | [
"numpy.linspace",
"numpy.cos",
"torch.nn.Linear",
"numpy.sin",
"torch.nn.ParameterList",
"torch.cat"
] | [((447, 466), 'torch.cat', 'torch.cat', (['[s1, s2]'], {}), '([s1, s2])\n', (456, 466), False, 'import torch\n'), ((768, 853), 'numpy.linspace', 'np.linspace', (['(-backcast_length)', 'forecast_length', '(backcast_length + forecast_length)'], {}), '(-backcast_length, forecast_length, backcast_length +\n forecast_len... |
import unittest
import os
from pyxdsm.XDSM import XDSM, __file__
from numpy.distutils.exec_command import find_executable
def filter_lines(lns):
# Empty lines are excluded.
# Leading and trailing whitespaces are removed
# Comments are removed.
return [ln.strip() for ln in lns if ln.strip() and not ln.... | [
"pyxdsm.XDSM.XDSM",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.isfile",
"os.path.isdir",
"tempfile.mkdtemp",
"numpy.distutils.exec_command.find_executable",
"shutil.rmtree",
"unittest.main",
"os.system",
"os.path.abspath"
] | [((10690, 10705), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10703, 10705), False, 'import unittest\n'), ((470, 481), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (479, 481), False, 'import os\n'), ((505, 540), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""testdir-"""'}), "(prefix='testdir-')\n",... |
# -*- coding: utf-8 -*-
import numpy as np
import torch
from torch import nn
from kbcr.kernels import GaussianKernel
from kbcr.smart import NeuralKB
import pytest
@pytest.mark.light
def test_smart_v1():
embedding_size = 50
rs = np.random.RandomState(0)
for _ in range(32):
with torch.no_grad(... | [
"numpy.random.RandomState",
"torch.LongTensor",
"pytest.main",
"kbcr.smart.NeuralKB",
"numpy.array",
"kbcr.kernels.GaussianKernel",
"torch.no_grad",
"torch.nn.Embedding"
] | [((243, 267), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (264, 267), True, 'import numpy as np\n'), ((3032, 3055), 'pytest.main', 'pytest.main', (['[__file__]'], {}), '([__file__])\n', (3043, 3055), False, 'import pytest\n'), ((306, 321), 'torch.no_grad', 'torch.no_grad', ([], {}), '()... |
# -*- coding: utf8 -*-
import os
from utensor_cgen.utils import save_consts, save_graph, save_idx
import numpy as np
import tensorflow as tf
def generate():
test_dir = os.path.dirname(__file__)
graph = tf.Graph()
with graph.as_default():
x = tf.constant(np.random.randn(10),
dtype=tf.floa... | [
"tensorflow.Graph",
"utensor_cgen.utils.save_graph",
"utensor_cgen.utils.save_consts",
"tensorflow.Session",
"os.path.join",
"os.path.dirname",
"tensorflow.reshape",
"numpy.random.randn"
] | [((172, 197), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (187, 197), False, 'import os\n'), ((208, 218), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (216, 218), True, 'import tensorflow as tf\n'), ((370, 408), 'tensorflow.reshape', 'tf.reshape', (['x', '[5, 2]'], {'name': '"""output... |
from __future__ import division
from collections import defaultdict
import numpy as np
from time import time
import random
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
# import tensorflow as tf
class DataModule():
def __init__(self, conf, filename):
self.conf = conf
self.data_dict = ... | [
"numpy.reshape",
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.sqrt",
"numpy.array",
"numpy.random.randint",
"collections.defaultdict"
] | [((157, 181), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (179, 181), True, 'import tensorflow.compat.v1 as tf\n'), ((3493, 3509), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (3504, 3509), False, 'from collections import defaultdict\n'), ((3831, 3847),... |
import os
import timeit
from typing import List
import numpy as np
from numpy.random import RandomState
from numpy.testing import assert_allclose, assert_almost_equal
import pytest
from scipy.special import gamma
import arch.univariate.recursions_python as recpy
CYTHON_COVERAGE = os.environ.get("ARCH_CYTHON_COVERAGE... | [
"pytest.mark.filterwarnings",
"numpy.sqrt",
"arch.univariate.recursions_python.figarch_recursion",
"arch.univariate.recursions_python.figarch_recursion_python",
"numpy.log",
"arch.univariate.recursions_python.harch_recursion",
"arch.univariate.recursions_python.egarch_recursion_python",
"numpy.array",... | [((674, 748), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore::arch.compat.numba.PerformanceWarning"""'], {}), "('ignore::arch.compat.numba.PerformanceWarning')\n", (700, 748), False, 'import pytest\n'), ((284, 327), 'os.environ.get', 'os.environ.get', (['"""ARCH_CYTHON_COVERAGE"""', '"""0"""']... |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g... | [
"numpy.flip",
"Base.Evaluation.Evaluator.EvaluatorHoldout",
"scipy.sparse.diags",
"pandas.read_csv",
"numpy.ediff1d",
"Data_manager.split_functions.split_train_validation_random_holdout.split_train_in_two_percentage_global_sample",
"HybridRecommender.HybridRecommender",
"numpy.log",
"numpy.argsort",... | [((384, 421), 'pandas.read_csv', 'pd.read_csv', (['"""./input/data_train.csv"""'], {}), "('./input/data_train.csv')\n", (395, 421), True, 'import pandas as pd\n'), ((429, 478), 'pandas.read_csv', 'pd.read_csv', (['"""./input/data_target_users_test.csv"""'], {}), "('./input/data_target_users_test.csv')\n", (440, 478), T... |
import os
import numpy as np
import scipy.io as sio
import tifffile
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
#Load dataset
def loadData(name,data_path):
if name == 'IP':
data = sio.loadmat(os.path.join(data_path, 'Indian_pines_corrected.mat'))['indian_pin... | [
"numpy.reshape",
"sklearn.decomposition.PCA",
"sklearn.model_selection.train_test_split",
"os.path.join",
"numpy.zeros"
] | [((2943, 2974), 'numpy.reshape', 'np.reshape', (['X', '(-1, X.shape[2])'], {}), '(X, (-1, X.shape[2]))\n', (2953, 2974), True, 'import numpy as np\n'), ((2985, 3029), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'numComponents', 'whiten': '(True)'}), '(n_components=numComponents, whiten=True)\n', (2988, 30... |
import pprint
from typing import Optional, List, Tuple, Set, Dict
import numpy as np
from overrides import overrides
from python.handwritten_baseline.pipeline.data.base import Dataset
from python.handwritten_baseline.pipeline.model.feature_extr import DEBUG_EXTR
from python.handwritten_baseline.pipeline.model.feature... | [
"numpy.transpose",
"pprint.pformat",
"numpy.hstack"
] | [((1616, 1659), 'numpy.hstack', 'np.hstack', (['[zero_features, random_features]'], {}), '([zero_features, random_features])\n', (1625, 1659), True, 'import numpy as np\n'), ((2342, 2364), 'pprint.pformat', 'pprint.pformat', (['config'], {}), '(config)\n', (2356, 2364), False, 'import pprint\n'), ((1690, 1718), 'numpy.... |
import logging
logging.disable(logging.CRITICAL)
import math
from tabulate import tabulate
from mjrl.utils.make_train_plots import make_train_plots
from mjrl.utils.gym_env import GymEnv
from mjrl.samplers.core import sample_paths
import numpy as np
import torch
import pickle
import imageio
import time as timer
import o... | [
"math.floor",
"math.cos",
"copy.deepcopy",
"os.path.exists",
"exptools.logging.logger.dump_data",
"numpy.asarray",
"matplotlib.pyplot.close",
"mjrl.utils.gym_env.GymEnv",
"os.path.isdir",
"numpy.empty",
"numpy.random.seed",
"os.mkdir",
"logging.disable",
"tabulate.tabulate",
"exptools.lo... | [((15, 48), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (30, 48), False, 'import logging\n'), ((659, 684), 'os.path.isdir', 'os.path.isdir', (['policy_dir'], {}), '(policy_dir)\n', (672, 684), False, 'import os\n'), ((713, 736), 'os.path.isdir', 'os.path.isdir', (['logs_dir... |
import six
import chainer
import numpy as np
import chainer.links as L
import chainer.functions as F
import nutszebra_chainer
import functools
from collections import defaultdict
class Conv(nutszebra_chainer.Model):
def __init__(self, in_channel, out_channel, filter_size=(3, 3), stride=(1, 1), pad=(1, 1)):
... | [
"chainer.functions.softmax_cross_entropy",
"functools.reduce",
"chainer.functions.concat",
"numpy.argmax",
"chainer.functions.average_pooling_2d",
"numpy.zeros",
"collections.defaultdict",
"chainer.links.Convolution2D",
"chainer.links.BatchNormalization"
] | [((746, 806), 'functools.reduce', 'functools.reduce', (['(lambda a, b: a * b)', 'self.conv.W.data.shape'], {}), '(lambda a, b: a * b, self.conv.W.data.shape)\n', (762, 806), False, 'import functools\n'), ((1473, 1533), 'functools.reduce', 'functools.reduce', (['(lambda a, b: a * b)', 'self.conv.W.data.shape'], {}), '(l... |
import numpy as np
class LinearRegression:
def __init__(self, num_features):
self.num_features = num_features
self.W = np.zeros((self.num_features, 1))
def train(self, x, y, epochs, batch_size, lr, optim):
final_loss = None # loss of final epoch
# Training should b... | [
"numpy.array",
"numpy.zeros",
"numpy.transpose"
] | [((145, 177), 'numpy.zeros', 'np.zeros', (['(self.num_features, 1)'], {}), '((self.num_features, 1))\n', (153, 177), True, 'import numpy as np\n'), ((1880, 1895), 'numpy.array', 'np.array', (['ylist'], {}), '(ylist)\n', (1888, 1895), True, 'import numpy as np\n'), ((1227, 1259), 'numpy.zeros', 'np.zeros', (['(self.num_... |
import os
import gc
import random
import numpy as np
import torch
def seed_everything(seed):
os.environ['PYTHONHASHSEED'] = str(seed)
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.be... | [
"torch.manual_seed",
"random.seed",
"torch.is_tensor",
"numpy.random.seed",
"gc.collect",
"torch.cuda.manual_seed",
"gc.get_objects",
"torch.cuda.empty_cache"
] | [((143, 160), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (154, 160), False, 'import random\n'), ((165, 185), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (179, 185), True, 'import numpy as np\n'), ((190, 213), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (20... |
import tensorflow as tf
import numpy as np
from graphsage.models import FCPartition
from graphsage.partition_train import construct_placeholders
from graphsage.utils import load_graph_data, load_embedded_data, load_embedded_idmap
flags = tf.app.flags
FLAGS = flags.FLAGS
# flags.DEFINE_integer('dim_1', ... | [
"numpy.insert",
"graphsage.partition_train.construct_placeholders",
"graphsage.utils.load_embedded_idmap",
"graphsage.utils.load_embedded_data",
"tensorflow.Session",
"graphsage.models.FCPartition",
"numpy.expand_dims",
"numpy.save"
] | [((744, 779), 'graphsage.partition_train.construct_placeholders', 'construct_placeholders', (['num_classes'], {}), '(num_classes)\n', (766, 779), False, 'from graphsage.partition_train import construct_placeholders\n'), ((1132, 1162), 'graphsage.models.FCPartition', 'FCPartition', (['placeholders', 'dim'], {}), '(place... |
# Kontsioti, Maskell, Dutta & Pirmohamed, A reference set of clinically relevant
# adverse drug-drug interactions (2021)
# Code to extract single-drug side effect data from the BNF website
from bs4 import BeautifulSoup
import urllib
import os, csv
import numpy as np
import pandas as pd
import re
from tqdm i... | [
"re.compile",
"numpy.where",
"bs4.BeautifulSoup",
"pandas.DataFrame",
"pandas.concat",
"urllib.request.urlopen"
] | [((548, 572), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r', '"""lxml"""'], {}), "(r, 'lxml')\n", (561, 572), False, 'from bs4 import BeautifulSoup\n'), ((3904, 3973), 'pandas.DataFrame', 'pd.DataFrame', (['API_to_drugclass'], {'columns': "['API', 'Drug_Class', 'Link']"}), "(API_to_drugclass, columns=['API', 'Drug_Class'... |
"""
Fortuna
Python project to visualize uncertatinty in probabilistic exploration models.
Created on 09/06/2018
@authors: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
"""
# Import libraries
import numpy as np
import glob
from matplotlib import pyplot as plt
import pandas as pd
import xarray as xr
import pyproj a... | [
"matplotlib.pyplot.imshow",
"numpy.random.normal",
"numpy.ma.masked_equal",
"numpy.unique",
"pandas.read_csv",
"numpy.arange",
"numpy.where",
"numpy.ma.log2",
"xarray.Dataset",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"numpy.loadtxt",
"numpy.load",
"numpy.zeros_like",
"glob.glob",... | [((1237, 1249), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (1247, 1249), True, 'import xarray as xr\n'), ((1733, 1749), 'glob.glob', 'glob.glob', (['files'], {}), '(files)\n', (1742, 1749), False, 'import glob\n'), ((2295, 2373), 'pandas.read_csv', 'pd.read_csv', (['"""data/Hackaton/VolumeDistribution/Volumes"""... |
import argparse
import sys
import cv2
import os
import os.path as osp
import numpy as np
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
parser = argparse.ArgumentParser(
description='Single Shot MultiBox Detector ... | [
"os.path.join",
"numpy.array",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser"
] | [((240, 335), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Single Shot MultiBox Detector Training With Pytorch"""'}), "(description=\n 'Single Shot MultiBox Detector Training With Pytorch')\n", (263, 335), False, 'import argparse\n'), ((765, 794), 'xml.etree.ElementTree.parse', 'ET.... |
import numpy as np
import pandas as pd
from scipy.stats import spearmanr
from sklearn.metrics import f1_score, precision_score, recall_score
from IPython.display import display, clear_output
from sklearn.metrics import confusion_matrix
import scipy.stats as st
def continuous_to_categorical_with_quantiles(data: np.nda... | [
"sklearn.metrics.f1_score",
"scipy.stats.scoreatpercentile",
"numpy.where",
"numpy.delete",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"IPython.display.clear_output",
"numpy.zeros",
"numpy.quantile",
"numpy.isnan",
"scipy.stats.spearmanr",
"sklearn.metrics.confusion_mat... | [((1345, 1369), 'numpy.zeros', 'np.zeros', (['(n_lat, n_lon)'], {}), '((n_lat, n_lon))\n', (1353, 1369), True, 'import numpy as np\n'), ((1814, 1838), 'numpy.zeros', 'np.zeros', (['(n_lat, n_lon)'], {}), '((n_lat, n_lon))\n', (1822, 1838), True, 'import numpy as np\n'), ((4224, 4259), 'numpy.zeros', 'np.zeros', (['(n_c... |
from itertools import product
import numpy as np
import pandas as pd
import pytest
from sklearn.metrics import matthews_corrcoef as sk_matthews_corrcoef
from evalml.objectives import (
F1,
MAPE,
MSE,
AccuracyBinary,
AccuracyMulticlass,
BalancedAccuracyBinary,
BalancedAccuracyMulticlass,
... | [
"evalml.objectives.PrecisionWeighted",
"numpy.sqrt",
"evalml.objectives.F1Micro",
"evalml.objectives.PrecisionMicro",
"evalml.objectives.F1Macro",
"evalml.objectives.MCCBinary",
"evalml.objectives.RecallMacro",
"sklearn.metrics.matthews_corrcoef",
"numpy.array",
"evalml.objectives.RootMeanSquaredE... | [((843, 865), 'evalml.objectives.utils._all_objectives_dict', '_all_objectives_dict', ([], {}), '()\n', (863, 865), False, 'from evalml.objectives.utils import _all_objectives_dict, get_non_core_objectives\n'), ((1051, 1075), 'numpy.array', 'np.array', (['[np.nan, 0, 0]'], {}), '([np.nan, 0, 0])\n', (1059, 1075), True,... |
from planning_framework import path
import cv2 as cv
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description="Path Planning Visualisation")
parser.add_argument(
"-n",
"--n_heuristic",
default=2,
help="Heuristic for A* Algorithm (default = 2). 0 f... | [
"cv2.setMouseCallback",
"matplotlib.pyplot.imshow",
"cv2.rectangle",
"numpy.ones",
"argparse.ArgumentParser",
"planning_framework.path",
"cv2.imshow",
"numpy.array",
"numpy.zeros",
"cv2.circle",
"cv2.destroyAllWindows",
"cv2.getWindowProperty",
"cv2.resize",
"cv2.waitKey",
"cv2.namedWind... | [((130, 196), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Path Planning Visualisation"""'}), "(description='Path Planning Visualisation')\n", (153, 196), False, 'import argparse\n'), ((1313, 1346), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uin... |
# -*- coding: utf-8 -*-
"""
Complementary Filter
====================
Attitude quaternion obtained with gyroscope and accelerometer-magnetometer
measurements, via complementary filter.
First, the current orientation is estimated at time :math:`t`, from a previous
orientation at time :math:`t-1`, and a given ... | [
"numpy.array",
"numpy.zeros",
"numpy.sqrt",
"numpy.linalg.norm"
] | [((7766, 7792), 'numpy.zeros', 'np.zeros', (['(num_samples, 4)'], {}), '((num_samples, 4))\n', (7774, 7792), True, 'import numpy as np\n'), ((9157, 9278), 'numpy.array', 'np.array', (['[[1.0, -w[0], -w[1], -w[2]], [w[0], 1.0, w[2], -w[1]], [w[1], -w[2], 1.0, w\n [0]], [w[2], w[1], -w[0], 1.0]]'], {}), '([[1.0, -w[0]... |
import numpy as np
import hexy as hx
def test_get_hex_line():
expected = [
[-3, 3, 0],
[-2, 2, 0],
[-1, 2, -1],
[0, 2, -2],
[1, 1, -2],
]
start = np.array([-3, 3, 0])
end = np.array([1, 1, -2])
print(hx.get_hex_line(start, end))
... | [
"numpy.array",
"hexy.get_hex_line"
] | [((227, 247), 'numpy.array', 'np.array', (['[-3, 3, 0]'], {}), '([-3, 3, 0])\n', (235, 247), True, 'import numpy as np\n'), ((258, 278), 'numpy.array', 'np.array', (['[1, 1, -2]'], {}), '([1, 1, -2])\n', (266, 278), True, 'import numpy as np\n'), ((289, 316), 'hexy.get_hex_line', 'hx.get_hex_line', (['start', 'end'], {... |
from django.shortcuts import render,redirect
from .forms import usernameForm,DateForm,UsernameAndDateForm, DateForm_2
from django.contrib import messages
from django.contrib.auth.models import User
import cv2
import dlib
import imutils
from imutils import face_utils
from imutils.video import VideoStream
from imutils.fa... | [
"cv2.rectangle",
"sklearn.preprocessing.LabelEncoder",
"users.models.Time",
"django.contrib.messages.warning",
"users.models.Time.objects.filter",
"cv2.imshow",
"django.contrib.auth.models.User.objects.filter",
"numpy.array",
"face_recognition.face_encodings",
"cv2.destroyAllWindows",
"face_reco... | [((1205, 1219), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (1212, 1219), True, 'import matplotlib as mpl\n'), ((1771, 1803), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (1801, 1803), False, 'import dlib\n'), ((1817, 1905), 'dlib.shape_predictor', 'dlib.shape... |
import pybullet as p
import pybullet_data
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from math import sqrt
import random
import time
import math
import cv2
import torch
import os
def random_crop(imgs, out):
"""
args:
imgs: shape (B,C,H,W)
... | [
"pybullet_data.getDataPath",
"math.sqrt",
"pybullet.computeViewMatrixFromYawPitchRoll",
"pybullet.setGravity",
"time.sleep",
"numpy.array",
"pybullet.disconnect",
"gym.utils.seeding.np_random",
"pybullet.connect",
"pybullet.addUserDebugLine",
"pybullet.getNumJoints",
"pybullet.getCameraImage",... | [((431, 464), 'numpy.random.randint', 'np.random.randint', (['(0)', 'crop_max', 'n'], {}), '(0, crop_max, n)\n', (448, 464), True, 'import numpy as np\n'), ((475, 508), 'numpy.random.randint', 'np.random.randint', (['(0)', 'crop_max', 'n'], {}), '(0, crop_max, n)\n', (492, 508), True, 'import numpy as np\n'), ((524, 56... |
import os
import pdb
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
import torch.optim as optim
import dataloaders
from utils.utils import AverageMeter
from utils.loss import build_criterion
from utils.metrics import Evaluator
from utils.step_... | [
"retrain_model.build_autodeeplab.Retrain_Autodeeplab",
"torch.load",
"os.path.join",
"torch.nn.DataParallel",
"numpy.argmax",
"dataloaders.make_data_loader",
"os.path.isfile",
"torch.cuda.is_available",
"os.path.isdir",
"os.mkdir",
"utils.utils.AverageMeter",
"pdb.set_trace",
"torch.no_grad"... | [((518, 551), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (541, 551), False, 'import warnings\n'), ((563, 588), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (586, 588), False, 'import torch\n'), ((642, 675), 'config_utils.re_train_autodeeplab.... |
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne import pick_types
from mne.datasets import testing
from mne.io.tests.test_raw import _test_raw_reader
from mne.io.cnt import rea... | [
"mne.datasets.testing.data_path",
"mne.pick_types",
"mne.io.cnt.read_raw_cnt",
"os.path.join",
"mne.io.tests.test_raw._test_raw_reader",
"pytest.warns",
"numpy.array",
"numpy.testing.assert_array_equal",
"mne.annotations.read_annotations"
] | [((388, 421), 'mne.datasets.testing.data_path', 'testing.data_path', ([], {'download': '(False)'}), '(download=False)\n', (405, 421), False, 'from mne.datasets import testing\n'), ((430, 475), 'os.path.join', 'op.join', (['data_path', '"""CNT"""', '"""scan41_short.cnt"""'], {}), "(data_path, 'CNT', 'scan41_short.cnt')\... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 20 16:15:37 2021
@author: em42363
"""
# In[1]: Import functions
'''
CatBoost is a high-performance open source library for gradient boosting
on decision trees
'''
from catboost import CatBoostRegressor
from sklearn.model_selection import train_test_split
import pandas a... | [
"numpy.mean",
"sys.path.insert",
"numpy.sqrt",
"UTuning.scorer.Precision",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"UTuning.scorer.Accuracy",
"numpy.asarray",
"UTuning.plots.error_accuracy_plot",
"catboost.CatBoostRegressor",
"os.path.dirname",
"numpy.linspace",
"UTuni... | [((425, 487), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\eduar\\\\OneDrive\\\\PhD\\\\UTuning"""'], {}), "(0, 'C:\\\\Users\\\\eduar\\\\OneDrive\\\\PhD\\\\UTuning')\n", (440, 487), False, 'import sys\n'), ((484, 548), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\em42363\\\\OneD... |
import os
from tensorflow.contrib.learn.python.learn.datasets import base
import numpy as np
import IPython
from subprocess import call
from keras.preprocessing import image
from influence.dataset import DataSet
from influence.inception_v3 import preprocess_input
BASE_DIR = 'data' # TODO: change
def fill(X, Y, id... | [
"keras.preprocessing.image.img_to_array",
"numpy.arange",
"influence.inception_v3.preprocess_input",
"os.path.exists",
"numpy.savez",
"os.listdir",
"numpy.reshape",
"subprocess.call",
"numpy.random.seed",
"numpy.concatenate",
"numpy.savez_compressed",
"os.rename",
"tensorflow.contrib.learn.p... | [((361, 419), 'keras.preprocessing.image.load_img', 'image.load_img', (['img_path'], {'target_size': '(img_side, img_side)'}), '(img_path, target_size=(img_side, img_side))\n', (375, 419), False, 'from keras.preprocessing import image\n'), ((428, 451), 'keras.preprocessing.image.img_to_array', 'image.img_to_array', (['... |
import OpenPNM
import numpy as np
import OpenPNM.Physics.models as pm
class GenericLinearTransportTest:
def setup_class(self):
self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5])
self.phase = OpenPNM.Phases.GenericPhase(network=self.net)
Ps = self.net.Ps
Ts = self.net.Ts
self... | [
"OpenPNM.Physics.GenericPhysics",
"numpy.ones",
"OpenPNM.Algorithms.GenericLinearTransport",
"numpy.absolute",
"numpy.size",
"OpenPNM.Network.Cubic",
"numpy.sum",
"numpy.zeros",
"OpenPNM.Phases.GenericPhase",
"numpy.array",
"numpy.isnan",
"numpy.concatenate",
"numpy.all",
"numpy.arange"
] | [((152, 190), 'OpenPNM.Network.Cubic', 'OpenPNM.Network.Cubic', ([], {'shape': '[5, 5, 5]'}), '(shape=[5, 5, 5])\n', (173, 190), False, 'import OpenPNM\n'), ((212, 257), 'OpenPNM.Phases.GenericPhase', 'OpenPNM.Phases.GenericPhase', ([], {'network': 'self.net'}), '(network=self.net)\n', (239, 257), False, 'import OpenPN... |
# define custom R2 metrics for Keras backend
from keras import backend as K
def r2_keras(y_true, y_pred):
SS_res = K.sum(K.square( y_true - y_pred ))
SS_tot = K.sum(K.square( y_true - K.mean(y_true) ) )
return ( 1 - SS_res/(SS_tot + K.epsilon()) )
# base model architecture definition
def model():
... | [
"pandas.read_csv",
"keras.layers.GlobalMaxPooling1D",
"numpy.array",
"keras.layers.Activation",
"keras.layers.Dense",
"keras.preprocessing.sequence.pad_sequences",
"sklearn.decomposition.FastICA",
"sklearn.model_selection.KFold",
"xgboost.sklearn.XGBRegressor",
"sklearn.metrics.r2_score",
"numpy... | [((1722, 1755), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (1733, 1755), True, 'import pandas as pd\n'), ((1763, 1795), 'pandas.read_csv', 'pd.read_csv', (['"""../input/test.csv"""'], {}), "('../input/test.csv')\n", (1774, 1795), True, 'import pandas as pd\n'), ((1... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.common.api._cell_graph_executor.compile",
"numpy.ones",
"mindspore.ops.operations.Mul",
"mindspore.nn.TrainOneStepCell",
"mindspore.ops.operations.MatMul",
"mindspore.ops.operations.Reshape",
"mindspore.context.reset_auto_parallel_context",
"pytest.raises",
"mindspore.common.initializer.i... | [((2366, 2381), 'numpy.ones', 'np.ones', (['[8, 8]'], {}), '([8, 8])\n', (2373, 2381), True, 'import numpy as np\n'), ((2411, 2427), 'numpy.ones', 'np.ones', (['[64, 8]'], {}), '([64, 8])\n', (2418, 2427), True, 'import numpy as np\n'), ((2569, 2601), 'mindspore.nn.TrainOneStepCell', 'TrainOneStepCell', (['net', 'optim... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 10:59:00 2020
@author: user
"""
import numpy as np
import multiprocessing as mp
import matplotlib.pyplot as plt
import time
import itertools
import ctypes
def formfactor(args):
# with AL_dist_flat_glo.get_lock:
AL_dist_flat_glo_r = np.frombuffer(AL_dist_flat_... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.show",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"multiprocessing.Value",
"numpy.subtract",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.figure",
"numpy.array",
"multiprocessin... | [((1464, 1493), 'numpy.load', 'np.load', (['"""./AL_dist_flat.npy"""'], {}), "('./AL_dist_flat.npy')\n", (1471, 1493), True, 'import numpy as np\n'), ((1582, 1605), 'numpy.logspace', 'np.logspace', (['(-2)', '(3)', '(100)'], {}), '(-2, 3, 100)\n', (1593, 1605), True, 'import numpy as np\n'), ((1782, 1807), 'multiproces... |
#@contact <NAME> (<EMAIL>), Georgia Institute of Technology
#@version 1.0
#@date 2021-08-17
#Influence-guided Data Augmentation for Neural Tensor Completion (DAIN)
#This software is free of charge under research purposes.
#For commercial purposes, please contact the main author.
import torch
from torch imp... | [
"torch.mul",
"model.MLP",
"torch.from_numpy",
"torch.pow",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.sum",
"copy.deepcopy",
"numpy.arange",
"os.path.exists",
"argparse.ArgumentParser",
"os.mkdir",
"sklearn.model_selection.train_test_split",
"torch.empty",
"torch.cuda.empty_ca... | [((636, 708), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run DAIN for the MLP architecture"""'}), "(description='Run DAIN for the MLP architecture')\n", (659, 708), False, 'import argparse\n'), ((2034, 2046), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (2044, 2046), False, 'f... |
import os
import sys
import numpy as np
import pandas as pd
def get_columns_percent_dataframe(df: pd.DataFrame, totals_column=None, percent_names=True) -> pd.DataFrame:
""" @param totals_column: (default = use sum of columns)
@param percent_names: Rename names from 'col' => 'col %'
Return a dataframe... | [
"pandas.read_csv",
"numpy.isnan",
"pandas.DataFrame",
"os.stat",
"pandas.notnull"
] | [((407, 435), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'df.index'}), '(index=df.index)\n', (419, 435), True, 'import pandas as pd\n'), ((1630, 1643), 'numpy.isnan', 'np.isnan', (['val'], {}), '(val)\n', (1638, 1643), True, 'import numpy as np\n'), ((1756, 1770), 'pandas.notnull', 'pd.notnull', (['df'], {}), '... |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import shellmodelutilities as smutil
# Set bin width and range
bin_width = 0.20
Emax = 14
Nbins = int(np.ceil(Emax/bin_width))
Emax_adjusted = bin_width*Nbins # Trick to get an integer number of bins
bins = np.linspace(0,Emax_adjust... | [
"shellmodelutilities.read_energy_levels",
"numpy.ceil",
"numpy.floor",
"numpy.linspace",
"matplotlib.pyplot.FuncFormatter",
"matplotlib.colors.LogNorm",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((295, 335), 'numpy.linspace', 'np.linspace', (['(0)', 'Emax_adjusted', '(Nbins + 1)'], {}), '(0, Emax_adjusted, Nbins + 1)\n', (306, 335), True, 'import numpy as np\n'), ((498, 516), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (510, 516), True, 'import matplotlib.pyplot as plt\n'),... |
"""Subdivided icosahedral mesh generation"""
from __future__ import print_function
import numpy as np
# following: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html
# hierarchy:
# Icosphere -> Triangle -> Point
class IcoSphere:
"""
Usage: IcoSphere(level)
Maximum supported level =... | [
"numpy.sqrt",
"numpy.asarray",
"numpy.arcsin",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.arctan2",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((7381, 7414), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2 + z ** 2)'], {}), '(x ** 2 + y ** 2 + z ** 2)\n', (7388, 7414), True, 'import numpy as np\n'), ((5460, 5472), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5470, 5472), True, 'import matplotlib.pyplot as plt\n'), ((5538, 5580), 'numpy.asarray',... |
# This allows for running the example when the repo has been cloned
import sys
from os.path import abspath
sys.path.extend([abspath(".")])
# Example code follows
import logging
import numpy as np
import matplotlib.pyplot as plt
import muDIC.vlab as vlab
import muDIC as dic
"""
This example case runs an experiment whe... | [
"matplotlib.pyplot.ylabel",
"muDIC.vlab.SyntheticImageGenerator",
"numpy.array",
"muDIC.ImageStack",
"muDIC.Mesher",
"matplotlib.pyplot.xlabel",
"muDIC.DICAnalysis",
"matplotlib.pyplot.title",
"muDIC.vlab.rosta_speckle",
"muDIC.DICInput",
"matplotlib.pyplot.show",
"logging.basicConfig",
"mat... | [((679, 768), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(name)s:%(levelname)s:%(message)s"""', 'level': 'logging.INFO'}), "(format='%(name)s:%(levelname)s:%(message)s', level=\n logging.INFO)\n", (698, 768), False, 'import logging\n'), ((998, 1076), 'muDIC.vlab.rosta_speckle', 'vlab.rosta_sp... |
import numpy as np
from sawyer.mujoco.tasks.base import ComposableTask
class TransitionTask(ComposableTask):
"""
Task to pick up an object with the robot gripper.
Success condition:
- Object is grasped and has been lifted above the table
"""
def __init__(self):
pass
def compute_... | [
"numpy.array",
"numpy.linalg.norm"
] | [((1431, 1470), 'numpy.linalg.norm', 'np.linalg.norm', (['(box_pos - goal)'], {'axis': '(-1)'}), '(box_pos - goal, axis=-1)\n', (1445, 1470), True, 'import numpy as np\n'), ((1369, 1391), 'numpy.array', 'np.array', (['[0, 0, 0.04]'], {}), '([0, 0, 0.04])\n', (1377, 1391), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..events import events_plot
from ..stats import standardize as nk_standardize
def signal_plot(
signal, sampling_rate=None, subplots=False, standardize=False, labels=None, **kwargs
):
"""Plot signal with events... | [
"matplotlib.pyplot.xlabel",
"numpy.diff",
"numpy.array",
"pandas.DataFrame",
"pandas.concat",
"matplotlib.pyplot.legend"
] | [((5581, 5606), 'matplotlib.pyplot.legend', 'plt.legend', (['labels'], {'loc': '(1)'}), '(labels, loc=1)\n', (5591, 5606), True, 'import matplotlib.pyplot as plt\n'), ((2079, 2093), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2091, 2093), True, 'import pandas as pd\n'), ((2599, 2631), 'pandas.DataFrame', 'pd... |
from __future__ import print_function
from __future__ import division
import os
import gym
import numpy as np
from skimage.transform import resize
from skimage.color import rgb2gray
class Atari(object):
s_dim = [84, 84, 1]
a_dim = 3
def __init__(self, args, record_video=False):
self.env = gym.m... | [
"os.path.exists",
"skimage.color.rgb2gray",
"numpy.reshape",
"os.makedirs",
"os.path.join",
"numpy.append",
"numpy.random.randint",
"gym.wrappers.Monitor",
"gym.make"
] | [((315, 349), 'gym.make', 'gym.make', (['"""BreakoutNoFrameskip-v4"""'], {}), "('BreakoutNoFrameskip-v4')\n", (323, 349), False, 'import gym\n'), ((2046, 2097), 'numpy.reshape', 'np.reshape', (['observ'], {'newshape': '(self.screen_size + [1])'}), '(observ, newshape=self.screen_size + [1])\n', (2056, 2097), True, 'impo... |
import numpy as np
import numpy.random as npr
import scipy.optimize as spo
import tomo_challenge.metrics as tcm
# custom data type, could be replaced with/tie in to tree.py class
# cut_vals is (nfeat, nbins - 1) numpy array, float
# tree_ids is ((nbins,) * nfeat) numpy array, int
TreePars = namedtuple('TreePars', ['cu... | [
"numpy.unique",
"tomo_challenge.metrics.metric",
"numpy.random.random_integers",
"scipy.optimize.minimize",
"numpy.linspace",
"numpy.concatenate",
"numpy.flatten",
"numpy.shape"
] | [((529, 558), 'numpy.flatten', 'np.flatten', (['treepars.cut_vals'], {}), '(treepars.cut_vals)\n', (539, 558), True, 'import numpy as np\n'), ((569, 598), 'numpy.flatten', 'np.flatten', (['treepars.tree_ids'], {}), '(treepars.tree_ids)\n', (579, 598), True, 'import numpy as np\n'), ((609, 636), 'numpy.concatenate', 'np... |
import glob
import numpy as np
X = np.empty((0, 193))
y = np.empty((0, 10))
groups = np.empty((0, 1))
npz_files = glob.glob('./urban_sound_?.npz')
for fn in npz_files:
print(fn)
data = np.load(fn)
X = np.append(X, data['X'], axis=0)
y = np.append(y, data['y'], axis=0)
groups = np.append(groups, dat... | [
"numpy.savez",
"numpy.append",
"numpy.sum",
"numpy.empty",
"numpy.load",
"glob.glob"
] | [((36, 54), 'numpy.empty', 'np.empty', (['(0, 193)'], {}), '((0, 193))\n', (44, 54), True, 'import numpy as np\n'), ((59, 76), 'numpy.empty', 'np.empty', (['(0, 10)'], {}), '((0, 10))\n', (67, 76), True, 'import numpy as np\n'), ((86, 102), 'numpy.empty', 'np.empty', (['(0, 1)'], {}), '((0, 1))\n', (94, 102), True, 'im... |
# python 3.7
"""Predicts the scene category, attribute."""
import numpy as np
from PIL import Image
import torch
import torch.nn.functional as F
import torchvision.transforms as transforms
from .base_predictor import BasePredictor
from .scene_wideresnet import resnet18
__all__ = ['ScenePredictor']
N... | [
"torch.nn.functional.softmax",
"PIL.Image.fromarray",
"torch.load",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"numpy.load",
"torch.cuda.empty_cache",
"torch.cat"
] | [((1996, 2067), 'torch.load', 'torch.load', (['self.weight_path'], {'map_location': '(lambda storage, loc: storage)'}), '(self.weight_path, map_location=lambda storage, loc: storage)\n', (2006, 2067), False, 'import torch\n'), ((2492, 2538), 'numpy.load', 'np.load', (['self.attribute_additional_weight_path'], {}), '(se... |
import numpy as np
import torch
from torch.nn import functional as F
from rltoolkit.acm.off_policy import AcMOffPolicy
from rltoolkit.algorithms import DDPG
from rltoolkit.algorithms.ddpg.models import Actor, Critic
class DDPG_AcM(AcMOffPolicy, DDPG):
def __init__(
self, unbiased_update: bool = False, cu... | [
"torch.nn.functional.mse_loss",
"rltoolkit.algorithms.ddpg.models.Critic",
"rltoolkit.algorithms.ddpg.models.Actor",
"torch.mean",
"torch.Tensor",
"numpy.exp",
"torch.tensor",
"torch.nn.functional.softplus",
"torch.sum",
"rltoolkit.algorithms.DDPG.save_model",
"torch.no_grad",
"torch.randn",
... | [((1132, 1206), 'rltoolkit.algorithms.ddpg.models.Actor', 'Actor', (['self.ob_dim'], {'ac_lim': 'self.actor_ac_lim', 'ac_dim': 'self.actor_output_dim'}), '(self.ob_dim, ac_lim=self.actor_ac_lim, ac_dim=self.actor_output_dim)\n', (1137, 1206), False, 'from rltoolkit.algorithms.ddpg.models import Actor, Critic\n'), ((601... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import cv2
import numpy as np
import os
import math
from PIL import Image, ImageDraw, ImageFont
from caffe2.python import workspace
from detectron.core.config import cf... | [
"cv2.rectangle",
"os.path.exists",
"cv2.imwrite",
"numpy.abs",
"os.makedirs",
"math.floor",
"numpy.where",
"detectron.core.config.get_output_dir",
"os.path.join",
"PIL.ImageFont.truetype",
"numpy.asarray",
"cv2.putText",
"numpy.argsort",
"numpy.sum",
"PIL.ImageDraw.Draw",
"numpy.true_d... | [((602, 651), 'detectron.core.config.get_output_dir', 'get_output_dir', (['cfg.TRAIN.DATASETS'], {'training': '(True)'}), '(cfg.TRAIN.DATASETS, training=True)\n', (616, 651), False, 'from detectron.core.config import get_output_dir\n'), ((669, 709), 'os.path.join', 'os.path.join', (['output_dir', '"""webly_sample"""'],... |
import sys
from matplotlib import image as mpimg
import numpy as np
import os
DIPHA_CONST = 8067171840
DIPHA_IMAGE_TYPE_CONST = 1
DIM = 3
input_dir = os.path.join(os.getcwd(), sys.argv[1])
dipha_output_filename = sys.argv[2]
vert_filename = sys.argv[3]
input_filenames = [name
for nam... | [
"os.listdir",
"numpy.int64",
"numpy.float64",
"matplotlib.image.imread",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"numpy.zeros",
"sys.stdout.flush"
] | [((638, 660), 'numpy.zeros', 'np.zeros', (['[nx, ny, nz]'], {}), '([nx, ny, nz])\n', (646, 660), True, 'import numpy as np\n'), ((174, 185), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (183, 185), False, 'import os\n'), ((488, 531), 'os.path.join', 'os.path.join', (['input_dir', 'input_filenames[0]'], {}), '(input_dir,... |
import numpy as np
import matplotlib.pyplot as plt
import math
def normal(mu,sigma,x): #normal distribution
return 1/(math.pi*2)**0.5/sigma*np.exp(-(x-mu)**2/2/sigma**2)
def eval(x):
return normal(-4,1,x) + normal(4,1,x)
#return 0.3*np.exp(-0.2*x**2)+0.7*np.exp(-0.2*(x-10)**2)
def ref(x_star,x): #normal... | [
"numpy.random.normal",
"matplotlib.pyplot.savefig",
"numpy.random.rand",
"numpy.hstack",
"numpy.exp",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((396, 408), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (406, 408), True, 'import matplotlib.pyplot as plt\n'), ((1126, 1170), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""MetropolisNormal.png"""'], {'dpi': '(100)'}), "('MetropolisNormal.png', dpi=100)\n", (1137, 1170), True, 'import matplotlib.p... |
import json
import os
from collections import OrderedDict
from copy import deepcopy
import SimpleITK as sitk
from batchgenerators.augmentations.utils import resize_segmentation # resize_softmax_output
from skimage.transform import resize
from torch.optim import lr_scheduler
from torch import nn
import numpy as np
impor... | [
"numpy.prod",
"torch.nn.init.constant_",
"torch.exp",
"numpy.array",
"copy.deepcopy",
"torch.nn.Sigmoid",
"os.listdir",
"numpy.where",
"torch.nn.ModuleList",
"torch.nn.init.kaiming_normal_",
"SimpleITK.GetArrayFromImage",
"batchgenerators.augmentations.utils.resize_segmentation",
"numpy.max"... | [((4533, 4572), 'numpy.pad', 'np.pad', (['image', 'pad_list', 'mode'], {}), '(image, pad_list, mode, **kwargs)\n', (4539, 4572), True, 'import numpy as np\n'), ((13081, 13101), 'torch.exp', 'torch.exp', (['(x - x_max)'], {}), '(x - x_max)\n', (13090, 13101), False, 'import torch\n'), ((16372, 16387), 'numpy.unique', 'n... |
# -*- coding: utf-8 -*-
# vispy: gallery 10
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import sys
import numpy as np
from vispy import app, gloo, visuals
from vispy.visuals.filters import Clipper, ColorFilter
from vispy.visual... | [
"vispy.app.Canvas",
"numpy.random.normal",
"vispy.gloo.VertexBuffer",
"vispy.visuals.CompoundVisual.__init__",
"vispy.visuals.filters.Clipper",
"vispy.visuals.Visual.__init__",
"vispy.scene.SceneCanvas",
"vispy.scene.visuals.create_visual_node",
"numpy.exp",
"vispy.visuals.shaders.MultiProgram",
... | [((5805, 5891), 'vispy.app.Canvas', 'app.Canvas', ([], {'keys': '"""interactive"""', 'size': '(900, 600)', 'show': '(True)', 'title': '"""Visual Canvas"""'}), "(keys='interactive', size=(900, 600), show=True, title=\n 'Visual Canvas')\n", (5815, 5891), False, 'from vispy import app, gloo, visuals\n'), ((6096, 6141),... |
from unittest import TestCase
from datetime import datetime
import pyarrow as pa
import numpy as np
import pandas as pd
from h1st.schema import SchemaInferrer
class SchemaInferrerTestCase(TestCase):
def test_infer_python(self):
inferrer = SchemaInferrer()
self.assertEqual(inferrer.infer_schema(1)... | [
"pandas.Series",
"pyarrow.date64",
"pyarrow.string",
"numpy.random.random",
"pyarrow.binary",
"h1st.schema.SchemaInferrer",
"numpy.array",
"datetime.datetime.now",
"pyarrow.int64",
"pandas.DataFrame",
"pyarrow.array",
"pyarrow.float64"
] | [((253, 269), 'h1st.schema.SchemaInferrer', 'SchemaInferrer', ([], {}), '()\n', (267, 269), False, 'from h1st.schema import SchemaInferrer\n'), ((1286, 1302), 'h1st.schema.SchemaInferrer', 'SchemaInferrer', ([], {}), '()\n', (1300, 1302), False, 'from h1st.schema import SchemaInferrer\n'), ((1708, 1724), 'h1st.schema.S... |
"""Auxiliary methods."""
import os
import json
from errno import EEXIST
import numpy as np
import seaborn as sns
import cPickle as pickle
import matplotlib.pyplot as plt
sns.set()
DEFAULT_LOG_DIR = 'log'
ATOB_WEIGHTS_FILE = 'atob_weights.h5'
D_WEIGHTS_FILE = 'd_weights.h5'
class MyDict(dict):
"""
Dictionar... | [
"matplotlib.pyplot.imshow",
"seaborn.set",
"numpy.repeat",
"os.makedirs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"os.path.join",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.zeros",
"os.path.isdir",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"matplo... | [((172, 181), 'seaborn.set', 'sns.set', ([], {}), '()\n', (179, 181), True, 'import seaborn as sns\n'), ((1798, 1822), 'numpy.zeros', 'np.zeros', (['(h, 2 * w, ch)'], {}), '((h, 2 * w, ch))\n', (1806, 1822), True, 'import numpy as np\n'), ((2920, 2946), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 4)... |
# ---------------------------------
# Prepare the data etc.
# ----------------------------------
import numpy as np
import pandas as pd
# train_x is the training data, train_y is the target values, and test_x is the test data
# stored in pandas DataFrames and Series (numpy arrays also used)
train = pd.read_csv('../in... | [
"numpy.clip",
"pandas.read_csv",
"sklearn.model_selection.TimeSeriesSplit"
] | [((302, 360), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sample-data/train_preprocessed.csv"""'], {}), "('../input/sample-data/train_preprocessed.csv')\n", (313, 360), True, 'import pandas as pd\n'), ((437, 494), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sample-data/test_preprocessed.csv"""'], {}), "('../i... |
#!/usr/bin/env python
"""
Info: This script loads the model trained in the cnn-asl.py script and enables the user to use it for classifying unseen ASL letters. It also visualizes the feature map of the last convolutional layer of the network to enable the user to get an insight into exactly which parts of the original ... | [
"numpy.uint8",
"tensorflow.multiply",
"tensorflow.GradientTape",
"os.listdir",
"tensorflow.keras.backend.mean",
"argparse.ArgumentParser",
"numpy.max",
"tensorflow.keras.models.Model",
"numpy.maximum",
"tensorflow.keras.preprocessing.image.img_to_array",
"tensorflow.keras.preprocessing.image.loa... | [((960, 978), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (972, 978), False, 'import os\n'), ((1486, 1511), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1509, 1511), False, 'import argparse\n'), ((2663, 2737), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""', '"... |
from astropy import coordinates as coord
from astropy import wcs
from astropy.io import fits
from astropy import units as u
from misc import bcolors
import numpy as np
import os
def convert_hms_dd(RA, DEC):
'''
Convert HMS to DD system
'''
if (':' in RA) and (':' in DEC):
Coord_dd = coord.SkyCoord(RA, DEC... | [
"astropy.io.fits.getheader",
"astropy.coordinates.SkyCoord",
"numpy.array",
"os.popen",
"astropy.io.fits.open",
"os.system",
"astropy.wcs.WCS",
"astropy.wcs.utils.proj_plane_pixel_scales"
] | [((736, 756), 'astropy.io.fits.getheader', 'fits.getheader', (['FILE'], {}), '(FILE)\n', (750, 756), False, 'from astropy.io import fits\n'), ((841, 856), 'astropy.io.fits.open', 'fits.open', (['FITS'], {}), '(FITS)\n', (850, 856), False, 'from astropy.io import fits\n'), ((999, 1014), 'astropy.wcs.WCS', 'wcs.WCS', (['... |
import copy
import numpy as np
import pybullet as p
from igibson.metrics.metric_base import MetricBase
class BehaviorRobotMetric(MetricBase):
def __init__(self):
self.initialized = False
self.state_cache = {}
self.next_state_cache = {}
self.agent_pos = {part: [] for part in ["l... | [
"numpy.clip",
"numpy.abs",
"pybullet.getContactPoints",
"copy.deepcopy",
"pybullet.getConstraintState",
"numpy.array",
"numpy.linalg.norm"
] | [((3877, 3913), 'copy.deepcopy', 'copy.deepcopy', (['self.next_state_cache'], {}), '(self.next_state_cache)\n', (3890, 3913), False, 'import copy\n'), ((5886, 5903), 'numpy.abs', 'np.abs', (['delta_pos'], {}), '(delta_pos)\n', (5892, 5903), True, 'import numpy as np\n'), ((6072, 6179), 'numpy.linalg.norm', 'np.linalg.n... |
"""
Ocropus's magic PIL-numpy array conversion routines. They express slightly
different behavior from PIL.Image.toarray().
"""
import unicodedata
import numpy as np
from PIL import Image
__all__ = ['pil2array', 'array2pil']
def pil2array(im: Image.Image, alpha: int = 0) -> np.array:
if im.mode == '1':
... | [
"unicodedata.name",
"numpy.array",
"numpy.dtype",
"unicodedata.category"
] | [((364, 376), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (372, 376), True, 'import numpy as np\n'), ((434, 447), 'numpy.dtype', 'np.dtype', (['"""B"""'], {}), "('B')\n", (442, 447), True, 'import numpy as np\n'), ((1891, 1917), 'unicodedata.category', 'unicodedata.category', (['char'], {}), '(char)\n', (1911, 1... |
# @Time : 2020/11/14
# @Author : <NAME>, <NAME>
# @Email : <EMAIL>
# UPDATE:
# @Time : 2020/12/2, 2020/11/27, 2020/12/3, 2020/12/26
# @Author : <NAME>, <NAME>, <NAME>, <NAME>
# @Email : <EMAIL>, <EMAIL>, <EMAIL>, <EMAIL>
r"""
textbox.trainer.trainer
################################
"""
import os
import torch
i... | [
"logging.getLogger",
"textbox.utils.early_stopping",
"torch.nn.CrossEntropyLoss",
"matplotlib.pyplot.ylabel",
"textbox.evaluator.TranslationEvaluator",
"copy.deepcopy",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
"torch.optim.RMSprop",
"textbox.evaluator.SummarizationEvalu... | [((14204, 14219), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (14217, 14219), False, 'import torch\n'), ((32618, 32633), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (32631, 32633), False, 'import torch\n'), ((2571, 2582), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (2580, 2582), False, 'from log... |
"""Computation of ensemble anomalies based on a desired value."""
import os
import numpy as np
from scipy import stats
# User-defined packages
from read_netcdf import read_iris, save_n_2d_fields
from sel_season_area import sel_area, sel_season
def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso... | [
"numpy.mean",
"numpy.nanstd",
"numpy.nanpercentile",
"sel_season_area.sel_area",
"read_netcdf.save_n_2d_fields",
"numpy.array",
"numpy.nanmean",
"read_netcdf.read_iris",
"numpy.nanmax",
"numpy.empty",
"sel_season_area.sel_season"
] | [((3510, 3534), 'numpy.array', 'np.array', (['varextreme_ens'], {}), '(varextreme_ens)\n', (3518, 3534), True, 'import numpy as np\n'), ((4015, 4092), 'read_netcdf.save_n_2d_fields', 'save_n_2d_fields', (['lat_area', 'lon_area', 'ens_anomalies', 'varsave', 'varunits', 'ofile'], {}), '(lat_area, lon_area, ens_anomalies,... |
# Copyright 2019 BDL Benchmarks 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 applica... | [
"tensorflow_datasets.as_numpy",
"os.listdir",
"zipfile.ZipFile",
"tqdm.tqdm",
"numpy.asarray",
"os.path.join",
"inspect.isgenerator",
"absl.logging.info",
"numpy.argsort",
"numpy.zeros",
"numpy.empty_like",
"numpy.concatenate",
"tempfile.NamedTemporaryFile",
"tensorflow_datasets.download.k... | [((1435, 1514), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""downloads"""', '"""manual"""', '"""diabetic_retinopathy_diagnosis"""'], {}), "(DATA_DIR, 'downloads', 'manual', 'diabetic_retinopathy_diagnosis')\n", (1447, 1514), False, 'import os\n'), ((3842, 3855), 'tqdm.tqdm', 'tqdm.tqdm', (['ds'], {}), '(ds)\n', (3... |
# -*- coding: utf-8 -*-
"""
@date Created on Thu Dec 18 13:56:33 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.MagnetType11 import... | [
"pyleecan.Methods.Machine.Magnet.comp_surface.comp_surface",
"pyleecan.Classes.LamSlotMag.LamSlotMag",
"numpy.angle",
"numpy.exp",
"pyleecan.Classes.Segment.Segment",
"ddt.data",
"pyleecan.Classes.SlotMPolar.SlotMPolar",
"pyleecan.Classes.MagnetType11.MagnetType11"
] | [((598, 636), 'pyleecan.Classes.LamSlotMag.LamSlotMag', 'LamSlotMag', ([], {'is_internal': '(True)', 'Rext': '(0.5)'}), '(is_internal=True, Rext=0.5)\n', (608, 636), False, 'from pyleecan.Classes.LamSlotMag import LamSlotMag\n'), ((648, 681), 'pyleecan.Classes.SlotMPolar.SlotMPolar', 'SlotMPolar', ([], {'H0': '(0)', 'W... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
from operator import mod
from tomo_encoders.misc.voxel_processing import modified_autocontrast, TimerGPU
from tomo_encoders.reconstruction.recon import recon_patches_3d
import cupy as cp
import numpy as np
from skimage.filters import threshold_otsu
from tomo_en... | [
"cupy.zeros_like",
"numpy.clip",
"numpy.prod",
"tomo_encoders.misc.voxel_processing.TimerGPU",
"tomo_encoders.Grid",
"cupy.cuda.get_elapsed_time",
"cupy.repeat",
"numpy.sum",
"tomo_encoders.reconstruction.recon.recon_patches_3d",
"cupy.sqrt",
"cupy.meshgrid",
"numpy.std",
"cupy.cuda.Event",
... | [((688, 724), 'cupy.meshgrid', 'cp.meshgrid', (['pts', 'pts'], {'indexing': '"""ij"""'}), "(pts, pts, indexing='ij')\n", (699, 724), True, 'import cupy as cp\n'), ((850, 882), 'cupy.repeat', 'cp.repeat', (['circ', 'shape_z'], {'axis': '(0)'}), '(circ, shape_z, axis=0)\n', (859, 882), True, 'import cupy as cp\n'), ((127... |
import numpy as np
class DataGenerator:
def __init__(self, inputs, shuffle=True, batch_size=32):
assert len(inputs) > 0
self.inputs = inputs
self.idx = np.arange(len(inputs[0]))
self.shuffle = shuffle
self.batch_size = batch_size
self.on_epoch_end()
def data_le... | [
"numpy.random.shuffle"
] | [((831, 858), 'numpy.random.shuffle', 'np.random.shuffle', (['self.idx'], {}), '(self.idx)\n', (848, 858), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
""" Function that implement Complement the Complementary Cumulative
Distribution Function (CCDF).
"""
#
# written by <NAME> <<EMAIL>>
import numpy as np
import pandas as pd
def ccdf(s):
"""
Parameters:
`s`, series, the values of s should be variable to be handled
Return:
... | [
"pandas.Series",
"numpy.inner"
] | [((946, 982), 'pandas.Series', 'pd.Series', (['cumulative'], {'index': 's.index'}), '(cumulative, index=s.index)\n', (955, 982), True, 'import pandas as pd\n'), ((1463, 1499), 'pandas.Series', 'pd.Series', (['cumulative'], {'index': 's.index'}), '(cumulative, index=s.index)\n', (1472, 1499), True, 'import pandas as pd\... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import pandas as pd
from lifelines.fitters import UnivariateFitter
from lifelines.utils import _preprocess_inputs, _additive_estimate, StatError, inv_normal_cdf,\
median_survival_times
from lifelines.plotting import plot_loglogs
cla... | [
"lifelines.utils._additive_estimate",
"numpy.sqrt",
"numpy.log",
"lifelines.utils._preprocess_inputs",
"lifelines.utils.StatError",
"numpy.exp",
"lifelines.utils.inv_normal_cdf",
"pandas.DataFrame",
"numpy.seterr",
"lifelines.utils.median_survival_times",
"lifelines.plotting.plot_loglogs"
] | [((2218, 2280), 'lifelines.utils._preprocess_inputs', '_preprocess_inputs', (['durations', 'event_observed', 'timeline', 'entry'], {}), '(durations, event_observed, timeline, entry)\n', (2236, 2280), False, 'from lifelines.utils import _preprocess_inputs, _additive_estimate, StatError, inv_normal_cdf, median_survival_t... |
import numpy as np
from pydmfet import tools
from .fermi import find_efermi, entropy_corr
from pyscf import ao2mo, gto, scf, dft, lib
from pydmfet.qcwrap import fermi
import time
from functools import reduce
def scf_oei( OEI, Norb, Nelec, smear_sigma = 0.0):
OEI = 0.5*(OEI.T + OEI)
eigenvals, eigenvecs = np.l... | [
"time.clock",
"numpy.einsum",
"pyscf.ao2mo.restore",
"pydmfet.tools.op_ao2sub",
"pydmfet.tools.timer",
"numpy.asarray",
"numpy.dot",
"pydmfet.tools.dm_sub2ao",
"numpy.linalg.eigh",
"pyscf.dft.rks.prune_small_rho_grids_",
"pyscf.scf.RKS",
"numpy.eye",
"time.time",
"numpy.set_printoptions",
... | [((316, 335), 'numpy.linalg.eigh', 'np.linalg.eigh', (['OEI'], {}), '(OEI)\n', (330, 335), True, 'import numpy as np\n'), ((686, 700), 'numpy.zeros', 'np.zeros', (['Norb'], {}), '(Norb)\n', (694, 700), True, 'import numpy as np\n'), ((1036, 1068), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)... |
import cv2
import numpy as np
def process_core(image):
'''
Returns an inverted preprocessed binary image, with noise
reduction achieved with greyscaling, Gaussian Blur, Otsu's Threshold, and
an open morph.
'''
#apply greyscaling, Gaussian Blur, and Otsu's Threshold
greyscale = cv2.cvtColor... | [
"cv2.HoughLinesP",
"cv2.threshold",
"cv2.arcLength",
"cv2.line",
"numpy.diff",
"cv2.contourArea",
"cv2.morphologyEx",
"numpy.zeros",
"cv2.cvtColor",
"cv2.findContours",
"cv2.GaussianBlur",
"cv2.getStructuringElement"
] | [((308, 347), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (320, 347), False, 'import cv2\n'), ((359, 397), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['greyscale', '(3, 3)', '(0)'], {}), '(greyscale, (3, 3), 0)\n', (375, 397), False, 'import cv2\n'), ((561, 610)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.