code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
# gates.py import numpy as np def NAND(x1, x2): x = np.array([x1, x2]) w = np.array([-0.5, -0.5]) b = 0.7 return 1 if np.sum(w*x) + b > 0 else 0 def AND(a, b): return NAND(NAND(a, b), NAND(a, b)) def OR(a, b): return NAND(NAND(a, a), NAND(b, b)) def XOR(x1, x2): return AND(NAND(x1, x2)...
[ "numpy.array", "numpy.sum" ]
[((58, 76), 'numpy.array', 'np.array', (['[x1, x2]'], {}), '([x1, x2])\n', (66, 76), True, 'import numpy as np\n'), ((85, 107), 'numpy.array', 'np.array', (['[-0.5, -0.5]'], {}), '([-0.5, -0.5])\n', (93, 107), True, 'import numpy as np\n'), ((137, 150), 'numpy.sum', 'np.sum', (['(w * x)'], {}), '(w * x)\n', (143, 150),...
import numpy as np print('load vectors') data = np.loadtxt('../data/all_users_normalized.tsv') print(data.shape) print('save npy') np.save('../data/all_users_normalized.npy', data)
[ "numpy.save", "numpy.loadtxt" ]
[((49, 95), 'numpy.loadtxt', 'np.loadtxt', (['"""../data/all_users_normalized.tsv"""'], {}), "('../data/all_users_normalized.tsv')\n", (59, 95), True, 'import numpy as np\n'), ((134, 183), 'numpy.save', 'np.save', (['"""../data/all_users_normalized.npy"""', 'data'], {}), "('../data/all_users_normalized.npy', data)\n", ...
import numpy as np from pathlib import Path from edges_io.io import S1P def test_s1p_read(datadir: Path): fl = ( datadir / "Receiver01_25C_2019_11_26_040_to_200MHz/S11/Ambient01/External01.s1p" ) s1p = S1P(fl) assert np.all(np.iscomplex(s1p.s11)) assert len(s1p.s11) == len(s1p.freq) de...
[ "edges_io.io.S1P", "numpy.iscomplex" ]
[((225, 232), 'edges_io.io.S1P', 'S1P', (['fl'], {}), '(fl)\n', (228, 232), False, 'from edges_io.io import S1P\n'), ((396, 403), 'edges_io.io.S1P', 'S1P', (['fl'], {}), '(fl)\n', (399, 403), False, 'from edges_io.io import S1P\n'), ((252, 273), 'numpy.iscomplex', 'np.iscomplex', (['s1p.s11'], {}), '(s1p.s11)\n', (264,...
import matplotlib.pyplot as plt import numpy as np from collections import defaultdict from datetime import datetime from scipy.stats import ortho_group from methods import FrankWolfe from methods import ContrNewton from oracles import create_log_sum_exp_oracle def RunExperiment(n, m, mu, fw_iters, cn_iters, cn_inne...
[ "matplotlib.pyplot.title", "numpy.random.seed", "matplotlib.pyplot.figure", "methods.ContrNewton", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.semilogy", "datetime.datetime.now", "methods.FrankWolfe", "matplotlib.pyplot.legend", "numpy.min", "matplotlib.pyplot.ylabel", "matplotlib.pyp...
[((531, 552), 'numpy.random.seed', 'np.random.seed', (['(31415)'], {}), '(31415)\n', (545, 552), True, 'import numpy as np\n'), ((638, 675), 'oracles.create_log_sum_exp_oracle', 'create_log_sum_exp_oracle', (['A.T', 'b', 'mu'], {}), '(A.T, b, mu)\n', (663, 675), False, 'from oracles import create_log_sum_exp_oracle\n')...
import pathlib import numpy as np from scipy.constants import e as qe, c as c_light, m_p from scipy.signal import hilbert from scipy.stats import linregress from PyHEADTAIL.impedances import wakes from PyHEADTAIL.machines.synchrotron import Synchrotron from PyHEADTAIL.particles.slicing import UniformBinSlicer from Py...
[ "numpy.log", "PyHEADTAIL.impedances.wakes.WakeTable", "numpy.zeros", "numpy.isclose", "pathlib.Path", "PyHEADTAIL.particles.slicing.UniformBinSlicer", "PyHEADTAIL.impedances.wakes.WakeField", "PyHEADTAIL.particles.particles.Particles", "numpy.arange", "scipy.signal.hilbert", "PyHEADTAIL.machines...
[((817, 840), 'numpy.sqrt', 'np.sqrt', (['(gamma ** 2 - 1)'], {}), '(gamma ** 2 - 1)\n', (824, 840), True, 'import numpy as np\n'), ((1265, 1609), 'PyHEADTAIL.machines.synchrotron.Synchrotron', 'Synchrotron', ([], {'optics_mode': '"""smooth"""', 'circumference': 'circumference', 'n_segments': '(1)', 'beta_x': 'beta_x',...
''' Author: <NAME> Date: 8/17/2018 Description: Creates a dataframe with moving averages and MACD oscillator ''' import matplotlib.pyplot as plt import numpy as np import pandas as pd from datetime import datetime, timedelta from iexfinance import get_historical_data moving_avg1 = 10 moving_avg2 = 20 ticker = "BABA" ...
[ "numpy.where", "datetime.datetime.now", "datetime.timedelta", "iexfinance.get_historical_data" ]
[((326, 340), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (338, 340), False, 'from datetime import datetime, timedelta\n'), ((379, 452), 'iexfinance.get_historical_data', 'get_historical_data', (['ticker'], {'start': 'start', 'end': 'now', 'output_format': '"""pandas"""'}), "(ticker, start=start, end=now...
import numpy as np from scipy import interpolate import astropy.units as u import astropy.constants as const from nexoclom.atomicdata import atomicmass from nexoclom.modelcode.surface_temperature import surface_temperature # from nexoclom.math.distributions import MaxwellianDist def surface_interaction_setup(inputs): ...
[ "numpy.meshgrid", "nexoclom.atomicdata.atomicmass", "numpy.max", "scipy.interpolate.RectBivariateSpline", "numpy.arange", "numpy.linspace", "numpy.interp", "numpy.ndarray" ]
[((536, 568), 'numpy.meshgrid', 'np.meshgrid', (['longitude', 'latitude'], {}), '(longitude, latitude)\n', (547, 568), True, 'import numpy as np\n'), ((971, 995), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', 'nprob'], {}), '(0, 1, nprob)\n', (982, 995), True, 'import numpy as np\n'), ((1015, 1038), 'numpy.ndarray',...
import numpy as np from copy import copy from elisa import const as c, BinarySystem from elisa.binary_system.model import ( potential_value_primary, potential_value_secondary, pre_calculate_for_potential_value_primary, pre_calculate_for_potential_value_secondary ) from elisa.binary_system.radius import ...
[ "numpy.full", "numpy.abs", "elisa.binary_system.model.potential_value_secondary", "elisa.binary_system.model.potential_value_primary", "elisa.binary_system.model.pre_calculate_for_potential_value_primary", "numpy.isscalar", "copy.copy", "elisa.binary_system.model.pre_calculate_for_potential_value_seco...
[((819, 889), 'elisa.binary_system.model.pre_calculate_for_potential_value_primary', 'pre_calculate_for_potential_value_primary', (['*args'], {'return_as_tuple': '(True)'}), '(*args, return_as_tuple=True)\n', (860, 889), False, 'from elisa.binary_system.model import potential_value_primary, potential_value_secondary, p...
import numpy as np import pandas as pd; # python list data = [1,2,3,4,5]; # numpy ndata = np.array(data); # pandas pdata = pd.Series(data); print(pdata[0]); print(pdata.values); print(pdata.index); pdata2 = pd.Series(data, index=['A','B','C','D','E']); print(pdata2); print(pdata2['C']); # dic data2 = {'name':'kim'...
[ "numpy.array", "pandas.Series" ]
[((92, 106), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (100, 106), True, 'import numpy as np\n'), ((126, 141), 'pandas.Series', 'pd.Series', (['data'], {}), '(data)\n', (135, 141), True, 'import pandas as pd\n'), ((211, 259), 'pandas.Series', 'pd.Series', (['data'], {'index': "['A', 'B', 'C', 'D', 'E']"}),...
import os import time import torch import queue import argparse import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from utils.drivers import train, test, get_dataloader from model.MobileNetV2 import MobileNetV2, InvertedResidual from pruner.fp_mbnetv2 import FilterPrun...
[ "argparse.ArgumentParser", "numpy.argmin", "numpy.mean", "numpy.random.normal", "numpy.std", "torch.load", "os.path.exists", "utils.drivers.test", "numpy.loadtxt", "numpy.random.choice", "torch.zeros", "numpy.min", "utils.drivers.train", "queue.Queue", "os.makedirs", "torch.nn.CrossEnt...
[((11236, 11261), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (11259, 11261), False, 'import argparse\n'), ((14228, 14250), 'torch.load', 'torch.load', (['args.model'], {}), '(args.model)\n', (14238, 14250), False, 'import torch\n'), ((991, 1064), 'utils.drivers.get_dataloader', 'get_dataloa...
from niscv_v2.experiments.garch_truth import garch_model from niscv_v2.basics.qtl import Qtl import numpy as np import multiprocessing import os from functools import partial from datetime import datetime as dt import pickle def experiment(D, alpha, size_est, show, size_kn, ratio): target, statistic, proposal = g...
[ "functools.partial", "niscv_v2.experiments.garch_truth.garch_model", "pickle.dump", "numpy.random.seed", "niscv_v2.basics.qtl.Qtl", "numpy.arange", "multiprocessing.Pool", "datetime.datetime.now" ]
[((319, 333), 'niscv_v2.experiments.garch_truth.garch_model', 'garch_model', (['D'], {}), '(D)\n', (330, 333), False, 'from niscv_v2.experiments.garch_truth import garch_model\n'), ((344, 420), 'niscv_v2.basics.qtl.Qtl', 'Qtl', (['(D + 3)', 'target', 'statistic', 'alpha', 'proposal'], {'size_est': 'size_est', 'show': '...
import argparse from pathlib import Path import cv2 import matplotlib import numpy as np import torch from tqdm import tqdm from data.datasets import get_dataloaders from utils.conf import Conf from utils.saver import Saver matplotlib.use('Agg') from matplotlib import pyplot as plt from torch.nn.functional import ad...
[ "argparse.ArgumentParser", "numpy.clip", "matplotlib.pyplot.figure", "pathlib.Path", "torch.no_grad", "matplotlib.pyplot.close", "torch.nn.functional.adaptive_avg_pool2d", "utils.conf.Conf", "matplotlib.pyplot.Axes", "cv2.resize", "tqdm.tqdm", "matplotlib.use", "torch.max", "torch.sum", ...
[((227, 248), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (241, 248), False, 'import matplotlib\n'), ((676, 739), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train img to video model"""'}), "(description='Train img to video model')\n", (699, 739), False, 'imp...
from keras import layers from keras.models import Sequential import numpy as np import pickle as pkl from keras.layers import Conv1D, GlobalMaxPooling1D, Dense, Dropout, Flatten, MaxPooling1D, Input, Concatenate from keras.utils import np_utils from keras.optimizers import RMSprop train_vec = np.load('./data...
[ "numpy.load", "numpy.save", "keras.utils.np_utils.to_categorical", "keras.layers.Dense", "keras.models.Sequential", "keras.optimizers.RMSprop" ]
[((305, 341), 'numpy.load', 'np.load', (['"""./datasets/train_bert.npy"""'], {}), "('./datasets/train_bert.npy')\n", (312, 341), True, 'import numpy as np\n'), ((357, 394), 'numpy.load', 'np.load', (['"""./datasets/train_label.npy"""'], {}), "('./datasets/train_label.npy')\n", (364, 394), True, 'import numpy as np\n'),...
""" Takes an input NIST file and a Propellant, and creates polynomials for all the \ relevant variables """ from numpy import polyfit, poly1d from phase import Phase import numpy as np import os.path import warnings import csv warnings.simplefilter('ignore', np.RankWarning) POLY_DEG = 10 def get_data(filename): ...
[ "numpy.poly1d", "csv.reader", "warnings.simplefilter", "numpy.polyfit" ]
[((228, 275), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'np.RankWarning'], {}), "('ignore', np.RankWarning)\n", (249, 275), False, 'import warnings\n'), ((1186, 1200), 'numpy.poly1d', 'poly1d', (['coeffs'], {}), '(coeffs)\n', (1192, 1200), False, 'from numpy import polyfit, poly1d\n'), ((1136,...
import numpy as np import cv2 import g2o from threading import Lock, Thread from queue import Queue from enum import Enum from collections import defaultdict from .covisibility import GraphKeyFrame from .covisibility import GraphMapPoint from .covisibility import GraphMeasurement class Camera(object): def __...
[ "threading.Thread", "numpy.sum", "numpy.logical_and", "numpy.asarray", "enum.Enum", "numpy.transpose", "numpy.identity", "numpy.zeros", "numpy.logical_and.reduce", "threading.Lock", "collections.defaultdict", "numpy.array", "numpy.linalg.norm", "numpy.arccos", "queue.Queue" ]
[((10908, 10914), 'threading.Lock', 'Lock', ([], {}), '()\n', (10912, 10914), False, 'from threading import Lock, Thread\n'), ((12172, 12178), 'threading.Lock', 'Lock', ([], {}), '()\n', (12176, 12178), False, 'from threading import Lock, Thread\n'), ((13791, 13858), 'enum.Enum', 'Enum', (['"""Measurement.Source"""', "...
import unittest from setup.settings import * from numpy.testing import * import numpy as np import dolphindb_numpy as dnp import pandas as pd import orca class TopicOnesZerosTest(unittest.TestCase): @classmethod def setUpClass(cls): # connect to a DolphinDB server orca.connect(HOST, PORT, "ad...
[ "unittest.main", "numpy.asarray", "dolphindb_numpy.asarray", "orca.connect" ]
[((519, 534), 'unittest.main', 'unittest.main', ([], {}), '()\n', (532, 534), False, 'import unittest\n'), ((292, 335), 'orca.connect', 'orca.connect', (['HOST', 'PORT', '"""admin"""', '"""123456"""'], {}), "(HOST, PORT, 'admin', '123456')\n", (304, 335), False, 'import orca\n'), ((410, 423), 'numpy.asarray', 'np.asarr...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import (division, print_function, absolute_import, unicode_literals) """ Utilities for observation planning """ import numpy as np import matplotlib import matplotlib.pyplot as plt import pandas as pd import logging from astropy.c...
[ "matplotlib.pyplot.MultipleLocator", "numpy.sqrt" ]
[((841, 869), 'numpy.sqrt', 'np.sqrt', (['(count_rate_B * texp)'], {}), '(count_rate_B * texp)\n', (848, 869), True, 'import numpy as np\n'), ((973, 1001), 'numpy.sqrt', 'np.sqrt', (['(count_rate_R * texp)'], {}), '(count_rate_R * texp)\n', (980, 1001), True, 'import numpy as np\n'), ((1866, 1889), 'matplotlib.pyplot.M...
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
[ "ctypes.c_int64", "numpy.zeros", "numpy.require", "ctypes.POINTER" ]
[((787, 803), 'ctypes.POINTER', 'POINTER', (['c_int64'], {}), '(c_int64)\n', (794, 803), False, 'from ctypes import POINTER, c_double, c_int64\n'), ((818, 835), 'ctypes.POINTER', 'POINTER', (['c_double'], {}), '(c_double)\n', (825, 835), False, 'from ctypes import POINTER, c_double, c_int64\n'), ((848, 864), 'ctypes.PO...
import os import numpy as np import matplotlib matplotlib.use('Qt5Agg') from matplotlib import pyplot as plt from qtpy.QtWidgets import QWidget, QVBoxLayout, QCheckBox from glue.config import qt_client from glue.core.data_combo_helper import ComponentIDComboHelper from glue.external.echo import CallbackProperty, Sel...
[ "matplotlib.pyplot.subplot", "qtpy.QtWidgets.QCheckBox", "glue.external.echo.CallbackProperty", "glue.external.echo.SelectionCallbackProperty", "glue.external.echo.qt.autoconnect_callbacks_to_qt", "numpy.nanmax", "os.path.dirname", "qtpy.QtWidgets.QVBoxLayout", "numpy.nanmin", "matplotlib.use", ...
[((48, 72), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (62, 72), False, 'import matplotlib\n'), ((4912, 4945), 'glue.config.qt_client.add', 'qt_client.add', (['TutorialDataViewer'], {}), '(TutorialDataViewer)\n', (4925, 4945), False, 'from glue.config import qt_client\n'), ((736, 809), ...
################# INSTRUCTIONS ########################## ######################################################### # it returns output as a tuple containing two elements (integers). # first element - if 0 then it doesn't contain a pothole. # if 1 then it contains a pothole. # second element - if 1 t...
[ "numpy.asarray", "keras.models.model_from_json", "keras.backend.clear_session" ]
[((1866, 1881), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (1876, 1881), True, 'import numpy as np\n'), ((1608, 1642), 'keras.models.model_from_json', 'model_from_json', (['loaded_model_json'], {}), '(loaded_model_json)\n', (1623, 1642), False, 'from keras.models import model_from_json\n'), ((3227, 3244),...
# # Guess Manager Management # # <NAME>, August 10, 2021 # # From the 20 runs, extract all of the pickled seeds with # two, three, or four parts. Try to guess which part is # the manager by running many one-on-one competitions # between two parts. The part that wins the most competitions # is the best guess fo...
[ "model_functions.read_fusion_pickles", "numpy.multiply", "model_functions.score_management", "model_functions.extract_parts", "model_functions.growth_tensor", "numpy.amax", "model_functions.region_map" ]
[((1396, 1435), 'model_functions.read_fusion_pickles', 'mfunc.read_fusion_pickles', (['fusion_files'], {}), '(fusion_files)\n', (1421, 1435), True, 'import model_functions as mfunc\n'), ((2430, 2452), 'model_functions.region_map', 'mfunc.region_map', (['seed'], {}), '(seed)\n', (2446, 2452), True, 'import model_functio...
import numpy as np from ..utils import hist_vec_by_r from ..utils import hist_vec_by_r_cu def scatter_xy(x, y=None, x_range=None, r_cut=0.5, q_bin=0.1, q_max=6.3, zero_padding=1, expand=0, use_gpu=False): r"""Calculate static structure factor. :param x: np.ndarray, coordinates of component 1 :param y: np...
[ "numpy.asarray", "numpy.histogramdd", "numpy.fft.rfftn", "numpy.fft.fftfreq", "numpy.fft.fftshift", "numpy.arange", "numpy.array" ]
[((1020, 1057), 'numpy.asarray', 'np.asarray', (['(box / r_cut)'], {'dtype': 'np.int'}), '(box / r_cut, dtype=np.int)\n', (1030, 1057), True, 'import numpy as np\n'), ((1072, 1091), 'numpy.asarray', 'np.asarray', (['x_range'], {}), '(x_range)\n', (1082, 1091), True, 'import numpy as np\n'), ((1105, 1123), 'numpy.asarra...
import numpy as np import pandas as pd import time N_STATES = 6 # number of states ACTIONS = ['left','right'] MAX_EPISODES = 13 REFRESH_TIME = 0.3 LR = 0.1 # learning rate EPSILON = 0.9 # to select either using exploration or using exploitation GAMMA = 0.9 def build_q_table(states, actions): ''' @states : int...
[ "numpy.random.uniform", "numpy.random.choice", "time.sleep" ]
[((1336, 1360), 'time.sleep', 'time.sleep', (['REFRESH_TIME'], {}), '(REFRESH_TIME)\n', (1346, 1360), False, 'import time\n'), ((673, 698), 'numpy.random.choice', 'np.random.choice', (['ACTIONS'], {}), '(ACTIONS)\n', (689, 698), True, 'import numpy as np\n'), ((584, 603), 'numpy.random.uniform', 'np.random.uniform', ([...
import matplotlib.pyplot as plt import matplotlib.colors as colors import numpy as np import pandas as pd from os.path import join import os import matplotlib as mpl from scseirx import analysis_functions as af import matplotlib.gridspec as gridspec from matplotlib.lines import Line2D from matplotlib.patches import Rec...
[ "pandas.DataFrame", "matplotlib.colors.Normalize.__init__", "matplotlib.colors.LinearSegmentedColormap", "matplotlib.pyplot.get_cmap", "scseirx.analysis_functions.get_statistics", "matplotlib.patches.Rectangle", "numpy.isnan", "numpy.interp", "pandas.concat", "os.path.join", "os.listdir" ]
[((2167, 2237), 'matplotlib.colors.LinearSegmentedColormap', 'mpl.colors.LinearSegmentedColormap', (['"""my_cmp"""'], {'segmentdata': 'cdict', 'N': '(256)'}), "('my_cmp', segmentdata=cdict, N=256)\n", (2201, 2237), True, 'import matplotlib as mpl\n'), ((3231, 3245), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n',...
import numpy as np import pandas as pd from sklearn.metrics import roc_auc_score, auc, roc_curve, confusion_matrix, fbeta_score from imblearn.over_sampling import BorderlineSMOTE from collections import Counter import gc as gc from sklearn.feature_selection import RFE #------------------------------------------------...
[ "pandas.DataFrame", "sklearn.metrics.confusion_matrix", "pandas.notna", "numpy.argmax", "numpy.asarray", "pandas.merge", "numpy.zeros", "sklearn.feature_selection.RFE", "numpy.argmin", "sklearn.metrics.roc_auc_score", "imblearn.over_sampling.BorderlineSMOTE", "gc.collect", "numpy.arange", ...
[((2925, 2949), 'numpy.asarray', 'np.asarray', (['fold_results'], {}), '(fold_results)\n', (2935, 2949), True, 'import numpy as np\n'), ((4449, 4480), 'numpy.zeros', 'np.zeros', (['df_train_std.shape[0]'], {}), '(df_train_std.shape[0])\n', (4457, 4480), True, 'import numpy as np\n'), ((4500, 4529), 'numpy.zeros', 'np.z...
# Copyright 2021 Sony Group Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
[ "numpy.random.seed", "nnabla.get_parameters", "sgd_influence_utils.utils.save_to_csv", "sgd_influence_utils.utils.is_proto_graph", "os.path.join", "sgd_influence_utils.dataset.get_image_size", "sgd_influence_utils.dataset.get_batch_indices", "os.path.dirname", "sgd_influence_utils.infl.save_infl_for...
[((1724, 1813), 'os.path.join', 'os.path.join', (['save_dir', "('epoch%02d' % (target_epoch - 1))", '"""weights"""', 'final_model_name'], {}), "(save_dir, 'epoch%02d' % (target_epoch - 1), 'weights',\n final_model_name)\n", (1736, 1813), False, 'import os\n'), ((1840, 1883), 'os.path.dirname', 'os.path.dirname', (["...
import matplotlib from matplotlib import pyplot as plt import numpy as np import pandas as pd import statsmodels.api as sm from patsy import dmatrices from patsy import dmatrix from scipy.optimize import minimize, curve_fit import itertools from matplotlib.ticker import PercentFormatter import math # test function def...
[ "matplotlib.pyplot.title", "numpy.abs", "statsmodels.api.OLS", "matplotlib.pyplot.suptitle", "matplotlib.pyplot.tight_layout", "pandas.DataFrame", "patsy.dmatrices", "numpy.meshgrid", "numpy.zeros_like", "numpy.max", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show", "matplotlib.pyplot....
[((797, 821), 'scipy.optimize.curve_fit', 'curve_fit', (['fn', '[X, Y]', 'Z'], {}), '(fn, [X, Y], Z)\n', (806, 821), False, 'from scipy.optimize import minimize, curve_fit\n'), ((1092, 1131), 'numpy.meshgrid', 'np.meshgrid', (['model_x_data', 'model_y_data'], {}), '(model_x_data, model_y_data)\n', (1103, 1131), True, '...
import random import time import unittest import numpy as np def add_scalar(writer, mode, tag, num_steps, skip): with writer.mode(mode) as my_writer: scalar = my_writer.scalar(tag) for i in range(num_steps): if i % skip == 0: scalar.add_record(i, random.random()) def...
[ "random.random", "numpy.random.random", "numpy.random.normal", "numpy.ndarray.flatten" ]
[((805, 829), 'numpy.ndarray.flatten', 'np.ndarray.flatten', (['data'], {}), '(data)\n', (823, 829), True, 'import numpy as np\n'), ((1142, 1185), 'numpy.random.normal', 'np.random.normal', (['(0.1 + i * 0.01)'], {'size': '(1000)'}), '(0.1 + i * 0.01, size=1000)\n', (1158, 1185), True, 'import numpy as np\n'), ((298, 3...
# Lint as: python3 """Tests for epi_forecast_stat_mech.sparse_estimator.""" import functools from absl.testing import absltest from epi_forecast_stat_mech import sparse from epi_forecast_stat_mech import sparse_estimator from epi_forecast_stat_mech.tests import test_high_level import numpy as np class TestHighLev...
[ "absl.testing.absltest.main", "functools.partial", "numpy.log", "numpy.testing.assert_array_equal", "epi_forecast_stat_mech.tests.test_high_level.create_synthetic_dataset" ]
[((1502, 1517), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1515, 1517), False, 'from absl.testing import absltest\n'), ((581, 623), 'epi_forecast_stat_mech.tests.test_high_level.create_synthetic_dataset', 'test_high_level.create_synthetic_dataset', ([], {}), '()\n', (621, 623), False, 'from epi_f...
#!/usr/bin/env python3 import xlsxwriter import numpy as np import argparse import gemmi import yaml import glob import os import mdtraj as md from collections import OrderedDict from rdkit import Chem from . import analysis_engine _KJ_2_KCAL = 1./4.184 _NM_2_ANG = 10. _RAD_2_DEG = 180./np.pi _GASCONST_KCAL = 8.314...
[ "numpy.abs", "argparse.ArgumentParser", "numpy.argmax", "gemmi.cif.read", "numpy.isnan", "mdtraj.load", "numpy.mean", "yaml.safe_load", "glob.glob", "numpy.unique", "mdtraj.density", "gemmi.make_small_structure_from_block", "numpy.std", "numpy.max", "numpy.var", "numpy.isinf", "numpy...
[((392, 498), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Python script for merging simulation data for xtal MD project."""'}), "(description=\n 'Python script for merging simulation data for xtal MD project.')\n", (415, 498), False, 'import argparse\n'), ((863, 876), 'collections....
import sys import json import numpy as np import argparse from pathlib import Path import logging from logging.config import fileConfig import cv2 import pickle from deeptennis.vision.transforms import BoundingBox def dilate_image(image, thresh_low=180): resized = image gray = cv2.cvtColor(resized, cv2.COLO...
[ "pickle.dump", "json.load", "logging.debug", "argparse.ArgumentParser", "cv2.bitwise_and", "cv2.dilate", "cv2.cvtColor", "cv2.getStructuringElement", "cv2.threshold", "cv2.morphologyEx", "numpy.zeros", "pathlib.Path", "deeptennis.vision.transforms.BoundingBox.from_box", "sys.exit", "cv2....
[((290, 331), 'cv2.cvtColor', 'cv2.cvtColor', (['resized', 'cv2.COLOR_BGR2GRAY'], {}), '(resized, cv2.COLOR_BGR2GRAY)\n', (302, 331), False, 'import cv2\n'), ((345, 395), 'cv2.getStructuringElement', 'cv2.getStructuringElement', (['cv2.MORPH_CROSS', '(3, 3)'], {}), '(cv2.MORPH_CROSS, (3, 3))\n', (370, 395), False, 'imp...
# Copyright (c) 2021 PaddlePaddle 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 appli...
[ "paddle.incubate.optimizer.functional.bfgs_minimize", "paddle.stack", "paddle.incubate.optimizer.functional.bfgs_utils.vnorm_inf", "paddle.incubate.optimizer.functional.bfgs.verify_symmetric_positive_definite_matrix", "paddle.allclose", "paddle.cholesky", "paddle.rand", "unittest.main", "paddle.incu...
[((2495, 2511), 'paddle.no_grad', 'paddle.no_grad', ([], {}), '()\n', (2509, 2511), False, 'import paddle\n'), ((2790, 2818), 'paddle.eye', 'paddle.eye', (['dim'], {'dtype': 'dtype'}), '(dim, dtype=dtype)\n', (2800, 2818), False, 'import paddle\n'), ((2828, 2878), 'paddle.einsum', 'paddle.einsum', (['"""...ij,...i,...j...
from enum import Enum from types import SimpleNamespace import numpy as np from os.path import dirname, normpath import modelinter class Const(Enum): TRADING_YEAR = 252 # length of a trading year WHOLE_YEAR = 365 #length of an actual year ANNUALIZE = np.sqrt(TRADING_YEAR) # to ANNUALIZE daily volatility...
[ "os.path.dirname", "os.path.normpath", "numpy.sqrt" ]
[((908, 936), 'os.path.dirname', 'dirname', (['modelinter.__file__'], {}), '(modelinter.__file__)\n', (915, 936), False, 'from os.path import dirname, normpath\n'), ((266, 287), 'numpy.sqrt', 'np.sqrt', (['TRADING_YEAR'], {}), '(TRADING_YEAR)\n', (273, 287), True, 'import numpy as np\n'), ((971, 1018), 'os.path.normpat...
import numpy as np import torch class SpecAugment: def __init__(self, T=8, F=8, mT=8, mF=2): self.T = T self.F = F self.mT = mT self.mF = mF def __call__(self, x): width, height = x.shape[-2:] mask = torch.ones_like(x, requires_grad=False) for _ in ran...
[ "torch.ones_like", "numpy.random.randint" ]
[((259, 298), 'torch.ones_like', 'torch.ones_like', (['x'], {'requires_grad': '(False)'}), '(x, requires_grad=False)\n', (274, 298), False, 'import torch\n'), ((355, 392), 'numpy.random.randint', 'np.random.randint', ([], {'low': '(0)', 'high': 'self.T'}), '(low=0, high=self.T)\n', (372, 392), True, 'import numpy as np...
import numpy as np import pandas as pd from sklearn import metrics from glob import glob import sys subname1=sys.argv[1] subname2=sys.argv[2] def myauc(y,pred): fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=1) return metrics.auc(fpr, tpr) sub1=pd.read_csv(subname1,index_col=0) sub2=pd...
[ "sklearn.metrics.roc_curve", "pandas.read_csv", "sklearn.metrics.auc", "numpy.mean", "numpy.array", "pandas.concat" ]
[((278, 312), 'pandas.read_csv', 'pd.read_csv', (['subname1'], {'index_col': '(0)'}), '(subname1, index_col=0)\n', (289, 312), True, 'import pandas as pd\n'), ((318, 352), 'pandas.read_csv', 'pd.read_csv', (['subname2'], {'index_col': '(0)'}), '(subname2, index_col=0)\n', (329, 352), True, 'import pandas as pd\n'), ((6...
import cv2 import numpy as np import matplotlib.pyplot as plt import region_grow import get_boundary def extract_vein_by_region_grow(edges_canny, image, threshold_perimeter, threshold_kernel_boundary): """ edges_canny, image, threshold_perimeter, threshold_kernel_boundary -> vein, main_vein, vein_poi...
[ "cv2.Canny", "cv2.subtract", "numpy.sum", "region_grow.region_grow", "cv2.dilate", "cv2.bitwise_and", "cv2.getStructuringElement", "numpy.zeros", "cv2.fillPoly", "cv2.imread", "cv2.bitwise_or", "numpy.array", "get_boundary.get_boundary", "cv2.findContours" ]
[((724, 744), 'cv2.imread', 'cv2.imread', (['image', '(0)'], {}), '(image, 0)\n', (734, 744), False, 'import cv2\n'), ((785, 817), 'get_boundary.get_boundary', 'get_boundary.get_boundary', (['image'], {}), '(image)\n', (810, 817), False, 'import get_boundary\n'), ((841, 888), 'numpy.zeros', 'np.zeros', (['edges_canny.s...
#MDL_QUADCOPTER Dynamic parameters for a quadrotor. # # MDL_QUADCOPTER is a script creates the workspace variable quad which # describes the dynamic characterstics of a quadrotor flying robot. # # Properties:: # # This is a structure with the following elements: # # nrotors Number of rotors (1x1) # J Flyer ro...
[ "numpy.diag", "math.sqrt" ]
[((2020, 2044), 'numpy.diag', 'np.diag', (['[Ixx, Iyy, Izz]'], {}), '([Ixx, Iyy, Izz])\n', (2027, 2044), True, 'import numpy as np\n'), ((3387, 3412), 'math.sqrt', 'sqrt', (["(quadrotor['Ct'] / 2)"], {}), "(quadrotor['Ct'] / 2)\n", (3391, 3412), False, 'from math import pi, sqrt, inf\n')]
"""Data structures.""" from __future__ import annotations from abc import abstractmethod from dataclasses import asdict, dataclass, field, fields, is_dataclass from typing import ( Any, Dict, Generic, Iterator, List, Optional, Protocol, Tuple, TypeVar, Union, cast, overlo...
[ "numpy.stack", "ranzen.decorators.implements", "torch.stack", "ranzen.misc.gcopy", "typing.cast", "attr.define", "torch.cat", "numpy.expand_dims", "dataclasses.is_dataclass", "dataclasses.field", "dataclasses.fields", "typing.TypeVar", "dataclasses.asdict", "numpy.concatenate" ]
[((1868, 1898), 'typing.TypeVar', 'TypeVar', (['"""X"""'], {'bound': 'LoadedData'}), "('X', bound=LoadedData)\n", (1875, 1898), False, 'from typing import Any, Dict, Generic, Iterator, List, Optional, Protocol, Tuple, TypeVar, Union, cast, overload\n'), ((1906, 1955), 'typing.TypeVar', 'TypeVar', (['"""X_co"""'], {'bou...
# Copyright 2022 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.context.set_context", "mindspore.Tensor", "numpy.array", "pytest.mark.parametrize", "mindspore.ops.operations.LRN" ]
[((1938, 2000), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data_type"""', '[np.float32, np.float16]'], {}), "('data_type', [np.float32, np.float16])\n", (1961, 2000), False, 'import pytest\n'), ((2173, 2217), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE'}), ...
import math import numpy as np import numpy.linalg as la def point_from_angle(x, y, angle, length): """return the endpoint of a line starting in x,y using the given angle and length""" x = x + length * math.cos(angle) y = y + length * math.sin(angle) return x, y def distance(point_1, point_2): "...
[ "numpy.arctan2", "math.sqrt", "math.atan2", "numpy.cross", "math.sin", "math.cos", "numpy.dot" ]
[((366, 440), 'math.sqrt', 'math.sqrt', (['((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)'], {}), '((point_1[0] - point_2[0]) ** 2 + (point_1[1] - point_2[1]) ** 2)\n', (375, 440), False, 'import math\n'), ((772, 786), 'numpy.dot', 'np.dot', (['v1', 'v2'], {}), '(v1, v2)\n', (778, 786), True, 'import...
from keras.layers import Input, Dense from keras.models import Model from keras.datasets import mnist from keras import backend as K import numpy as np import matplotlib.pyplot as plt import pickle # Deep Autoencoder features_path = 'deep_autoe_features.pickle' labels_path = 'deep_autoe_labels.pickle' # this is the ...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.gray", "matplotlib.pyplot.show", "keras.datasets.mnist.load_data", "keras.models.Model", "numpy.prod", "matplotlib.pyplot.figure", "keras.layers.Dense", "keras.layers.Input", "keras.backend.clear_session" ]
[((509, 528), 'keras.layers.Input', 'Input', ([], {'shape': '(784,)'}), '(shape=(784,))\n', (514, 528), False, 'from keras.layers import Input, Dense\n'), ((1082, 1107), 'keras.models.Model', 'Model', (['input_img', 'decoded'], {}), '(input_img, decoded)\n', (1087, 1107), False, 'from keras.models import Model\n'), ((1...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import unittest import numpy as np from pytext.utils import label class LabelUtilTest(unittest.TestCase): def test_get_label_weights(self): vocab = {"foo": 0, "bar": 1} weights = {"foo": 3.2, "foobar": ...
[ "pytext.utils.label.get_normalized_cap_label_weights", "pytext.utils.label.get_auto_label_weights", "pytext.utils.label.get_label_weights", "numpy.array", "pytext.utils.label.get_normalized_sqrt_label_weights" ]
[((350, 389), 'pytext.utils.label.get_label_weights', 'label.get_label_weights', (['vocab', 'weights'], {}), '(vocab, weights)\n', (373, 389), False, 'from pytext.utils import label\n'), ((665, 719), 'pytext.utils.label.get_auto_label_weights', 'label.get_auto_label_weights', (['vocab_dict', 'label_counts'], {}), '(voc...
import tensorflow as tf import numpy as np # Add parent directory to path from mnist_util import ( load_pb_file, print_nodes, ) def get_predict_labels(model_file, input_node, output_node, input_data): # Load saved model tf.import_graph_def(load_pb_file(model_file)) print(f"predict labels - loade...
[ "argparse.ArgumentParser", "numpy.argmax", "tensorflow.compat.v1.get_default_graph", "mnist_util.load_pb_file", "tensorflow.compat.v1.Session", "mnist.example.x_test.reshape", "numpy.testing.assert_equal", "mnist_util.print_nodes", "tensorflow.compat.v1.global_variables_initializer" ]
[((358, 371), 'mnist_util.print_nodes', 'print_nodes', ([], {}), '()\n', (369, 371), False, 'from mnist_util import load_pb_file, print_nodes\n'), ((813, 840), 'numpy.argmax', 'np.argmax', (['predicted_labels'], {}), '(predicted_labels)\n', (822, 840), True, 'import numpy as np\n'), ((1033, 1058), 'argparse.ArgumentPar...
import neural_network_lyapunov.examples.car.unicycle as unicycle import neural_network_lyapunov.utils as utils import neural_network_lyapunov.gurobi_torch_mip as gurobi_torch_mip import unittest import numpy as np import torch import scipy.integrate import scipy.linalg import gurobipy class TestUnicycle(unittest.T...
[ "unittest.main", "neural_network_lyapunov.utils.setup_relu", "neural_network_lyapunov.gurobi_torch_mip.GurobiTorchMILP", "torch.eye", "neural_network_lyapunov.examples.car.unicycle.Unicycle", "torch.cos", "numpy.array", "torch.zeros", "numpy.testing.assert_allclose", "torch.sin", "torch.tensor",...
[((18962, 18977), 'unittest.main', 'unittest.main', ([], {}), '()\n', (18975, 18977), False, 'import unittest\n'), ((375, 407), 'neural_network_lyapunov.examples.car.unicycle.Unicycle', 'unicycle.Unicycle', (['torch.float64'], {}), '(torch.float64)\n', (392, 407), True, 'import neural_network_lyapunov.examples.car.unic...
from pathlib import Path import numpy as np import pandas as pd from pandas.core.base import PandasObject import geopandas as gpd FILE_TPL = 'hybas_as_lev{level:02}_v1c.shp' def load_hydrobasins_geodataframe(hydrobasins_dir, continent, levels=range(1, 13)): gdfs = [] for level in levels: print(f'Loa...
[ "numpy.zeros_like", "numpy.array", "pandas.concat" ]
[((970, 1030), 'numpy.array', 'np.array', (['(gdf_lev.HYBAS_ID == start_row.HYBAS_ID)'], {'dtype': 'bool'}), '(gdf_lev.HYBAS_ID == start_row.HYBAS_ID, dtype=bool)\n', (978, 1030), True, 'import numpy as np\n'), ((1566, 1633), 'numpy.array', 'np.array', (["(gdf_lev['NEXT_DOWN'] == start_row['HYBAS_ID'])"], {'dtype': 'bo...
import numpy as np import matplotlib.pyplot as plt import itertools def recursive_elm(): #Set seed for repeatibility np.random.seed(10) #Data and model constants num_total_features = 11 #These are the number of features to be ranked num_outputs = 2 #Number of outputs num_hidden_neu...
[ "numpy.random.seed", "numpy.sum", "matplotlib.pyplot.bar", "numpy.shape", "matplotlib.pyplot.figure", "numpy.sin", "numpy.arange", "numpy.random.normal", "numpy.linalg.pinv", "numpy.random.randn", "matplotlib.pyplot.xticks", "matplotlib.pyplot.show", "numpy.tanh", "numpy.asarray", "itert...
[((126, 144), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (140, 144), True, 'import numpy as np\n'), ((616, 690), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(num_samples + num_val_samples, num_total_features)'}), '(size=(num_samples + num_val_samples, num_total_features))\n', (632, 6...
from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize import numpy import os import re import sys import time print(time.ctime()) os.chdir(os.path.join( os.path.dirname(os.path.abspath(__file__)))) extra_compile_args = [] extra_link_args = [] if os.name ==...
[ "os.path.abspath", "os.walk", "time.ctime", "distutils.extension.Extension", "numpy.get_include", "os.path.join", "re.sub" ]
[((172, 184), 'time.ctime', 'time.ctime', ([], {}), '()\n', (182, 184), False, 'import time\n'), ((520, 532), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (527, 532), False, 'import os\n'), ((231, 256), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (246, 256), False, 'import os\n'), (...
#!/usr/bin/env python3 import argparse from ddsketch.ddsketch import LogCollapsingLowestDenseDDSketch import numpy as np import os def main(): parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('input', type=argparse.FileType('r')) parser.add_argument('output', type...
[ "argparse.ArgumentParser", "os.fsync", "ddsketch.ddsketch.LogCollapsingLowestDenseDDSketch", "numpy.linspace", "argparse.FileType" ]
[((158, 219), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process some integers."""'}), "(description='Process some integers.')\n", (181, 219), False, 'import argparse\n'), ((670, 762), 'ddsketch.ddsketch.LogCollapsingLowestDenseDDSketch', 'LogCollapsingLowestDenseDDSketch', ([], {'re...
import tensorflow as tf import numpy as np sess = tf.Session() my_array = np.array([[1., 3., 5., 7., 9.], [-2., 0., 2., 4., 6.], [-6., -3., 0., 3., 6.]]) x_vals = np.array([my_array, my_array + 1]) x_data = tf.placeholder(tf.float32, shape=(3, 5)) m1 = tf.constant([[1.],[0.],[-1.],[2.],[4.]]) m2 = tf.constant([[2.]...
[ "tensorflow.Session", "tensorflow.add", "tensorflow.constant", "tensorflow.placeholder", "tensorflow.matmul", "tensorflow.summary.FileWriter", "numpy.array" ]
[((51, 63), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (61, 63), True, 'import tensorflow as tf\n'), ((76, 175), 'numpy.array', 'np.array', (['[[1.0, 3.0, 5.0, 7.0, 9.0], [-2.0, 0.0, 2.0, 4.0, 6.0], [-6.0, -3.0, 0.0, \n 3.0, 6.0]]'], {}), '([[1.0, 3.0, 5.0, 7.0, 9.0], [-2.0, 0.0, 2.0, 4.0, 6.0], [-6.0, -\...
import unittest import numpy as np import math from edge.model.inference.symmetric7 import SymmetricMaternCosGP def get_gp(x, y): return SymmetricMaternCosGP( x, y, noise_prior=(1, 0.1), noise_constraint=(1e-3, 1e4), lengthscale_prior=(1.5, 0.1), lengthscale_constraint=(1e...
[ "edge.model.inference.symmetric7.SymmetricMaternCosGP", "unittest.main", "numpy.arange" ]
[((144, 475), 'edge.model.inference.symmetric7.SymmetricMaternCosGP', 'SymmetricMaternCosGP', (['x', 'y'], {'noise_prior': '(1, 0.1)', 'noise_constraint': '(0.001, 10000.0)', 'lengthscale_prior': '(1.5, 0.1)', 'lengthscale_constraint': '(0.001, 10)', 'outputscale_prior': '(1, 0.1)', 'outputscale_constraint': '(0.001, 1...
# Copyright 2020 The TensorFlow Probability Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
[ "discussion.fun_mcmc.call_transport_map_with_ldj", "numpy.log", "tensorflow.compat.v2.test.main", "tensorflow.compat.v2.enable_v2_behavior", "discussion.fun_mcmc.trace", "numpy.ones", "discussion.fun_mcmc.backend.set_backend", "numpy.array", "discussion.fun_mcmc.backend.util.inverse_fn" ]
[((1092, 1120), 'tensorflow.compat.v2.enable_v2_behavior', 'real_tf.enable_v2_behavior', ([], {}), '()\n', (1118, 1120), True, 'import tensorflow.compat.v2 as real_tf\n'), ((3528, 3547), 'tensorflow.compat.v2.test.main', 'real_tf.test.main', ([], {}), '()\n', (3545, 3547), True, 'import tensorflow.compat.v2 as real_tf\...
from __future__ import division import struct import numpy as np def unpack_floats(batch_labels): shape = batch_labels[..., 0].shape floats = np.empty(shape, np.float32) for index, _ in np.ndenumerate(floats): floats[index] = struct.unpack('f', batch_labels[index + (slice(0, 4),)])[0] retur...
[ "numpy.empty", "numpy.mean", "numpy.ndenumerate" ]
[((154, 181), 'numpy.empty', 'np.empty', (['shape', 'np.float32'], {}), '(shape, np.float32)\n', (162, 181), True, 'import numpy as np\n'), ((202, 224), 'numpy.ndenumerate', 'np.ndenumerate', (['floats'], {}), '(floats)\n', (216, 224), True, 'import numpy as np\n'), ((419, 446), 'numpy.empty', 'np.empty', (['shape', 'n...
#!/usr/bin/env python """ Batch output depth map images by <NAME>. Copyright 2019, <NAME>, HKUST. Depth map visualization. """ import numpy as np import cv2 import argparse import matplotlib.pyplot as plt from preprocess import load_pfm from depthfusion import read_gipuma_dmb import os, re if __name__ == '__main__':...
[ "depthfusion.read_gipuma_dmb", "numpy.load", "argparse.ArgumentParser", "matplotlib.pyplot.imshow", "numpy.ma.masked_equal", "re.match", "cv2.imread", "numpy.squeeze", "os.path.join", "os.listdir" ]
[((334, 359), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (357, 359), False, 'import argparse\n'), ((480, 501), 'os.listdir', 'os.listdir', (['depth_dir'], {}), '(depth_dir)\n', (490, 501), False, 'import os, re\n'), ((610, 643), 'os.path.join', 'os.path.join', (['depth_dir', 'filename'], {}...
from __future__ import print_function from __future__ import absolute_import from __future__ import unicode_literals from SimPEG import Mesh, Maps, SolverLU, Utils from SimPEG.Utils import ExtractCoreMesh import numpy as np from SimPEG.EM.Static import DC import matplotlib import matplotlib.pyplot as plt import matplo...
[ "numpy.maximum", "numpy.abs", "SimPEG.Utils.ExtractCoreMesh", "numpy.ones", "SimPEG.EM.Static.DC.Src.Pole", "ipywidgets.fixed", "matplotlib.colors.LogNorm", "numpy.arange", "numpy.sqrt", "numpy.unique", "matplotlib.colors.SymLogNorm", "SimPEG.EM.Static.DC.Rx.Pole_ky", "numpy.max", "SimPEG....
[((828, 859), 'SimPEG.Mesh.TensorMesh', 'Mesh.TensorMesh', (['[hx, hy]', '"""CN"""'], {}), "([hx, hy], 'CN')\n", (843, 859), False, 'from SimPEG import Mesh, Maps, SolverLU, Utils\n'), ((869, 886), 'SimPEG.Maps.ExpMap', 'Maps.ExpMap', (['mesh'], {}), '(mesh)\n', (880, 886), False, 'from SimPEG import Mesh, Maps, Solver...
import os from keras.preprocessing.image import ImageDataGenerator import numpy as np def get_stereo_image_generators(train_folder, img_rows=256, img_cols=832, batch_size=16, shuffle=True): train_imagegen = ImageDataGenerator(rescale=1.0 / 255.0, rotation_range=5, ...
[ "keras.preprocessing.image.ImageDataGenerator", "numpy.zeros", "numpy.concatenate" ]
[((213, 358), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255.0)', 'rotation_range': '(5)', 'shear_range': '(0.01)', 'zoom_range': '(0.01)', 'height_shift_range': '(0.01)', 'width_shift_range': '(0.01)'}), '(rescale=1.0 / 255.0, rotation_range=5, shear_range=0.01,\n ...
import itertools import numpy as np from scipy.stats import entropy from scipy.sparse import csc_matrix from scipy.special import logsumexp, digamma, betaln from .vireo_base import normalize, loglik_amplify, beta_entropy from .vireo_base import get_binom_coeff, logbincoeff __docformat__ = "restructuredtext en" class ...
[ "numpy.sum", "numpy.log", "scipy.stats.entropy", "numpy.zeros", "numpy.ones", "numpy.expand_dims", "numpy.append", "scipy.special.digamma", "scipy.sparse.csc_matrix", "numpy.mean", "numpy.linspace", "numpy.random.rand" ]
[((2735, 2746), 'numpy.zeros', 'np.zeros', (['(0)'], {}), '(0)\n', (2743, 2746), True, 'import numpy as np\n'), ((6403, 6431), 'numpy.zeros', 'np.zeros', (['self.beta_mu.shape'], {}), '(self.beta_mu.shape)\n', (6411, 6431), True, 'import numpy as np\n'), ((6452, 6480), 'numpy.zeros', 'np.zeros', (['self.beta_mu.shape']...
import h5py import numpy as np import silx.math.fit import silx.math.fit.peaks # fileRead = '/home/esrf/slim/data/ihme10/id15/TiC_Calib/ihme10_TiC_calib.h5' # filesave = '/home/esrf/slim/easistrain/easistrain/EDD/Results_ihme10_TiC_calib.h5' # sample = 'TiC_calib' # dataset = '0001' # scanNumber = '4' # horizontalDet...
[ "h5py.File", "numpy.size", "numpy.abs", "numpy.sum", "numpy.zeros", "numpy.transpose", "numpy.append", "numpy.array", "numpy.arange" ]
[((2043, 2067), 'h5py.File', 'h5py.File', (['fileSave', '"""a"""'], {}), "(fileSave, 'a')\n", (2052, 2067), False, 'import h5py\n'), ((2776, 2788), 'numpy.array', 'np.array', (['()'], {}), '(())\n', (2784, 2788), True, 'import numpy as np\n'), ((2807, 2819), 'numpy.array', 'np.array', (['()'], {}), '(())\n', (2815, 281...
# -*- coding: utf-8 -*- from __future__ import print_function import argparse import pandas as pd import numpy as np import os.path from scipy.io import FortranFile from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import glob from pybloomfilter import BloomFilter from multiprocessing import Pool...
[ "pandas.DataFrame", "tqdm.tqdm", "matplotlib.pyplot.show", "argparse.ArgumentParser", "pandas.read_csv", "pybloomfilter.BloomFilter.open", "tools.io.read_list_header", "pybloomfilter.BloomFilter", "matplotlib.pyplot.figure", "numpy.array", "multiprocessing.Pool", "scipy.io.FortranFile", "too...
[((539, 583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""FIXME"""'}), "(description='FIXME')\n", (562, 583), False, 'import argparse\n'), ((1569, 1597), 'scipy.io.FortranFile', 'FortranFile', (['tree_brick', '"""r"""'], {}), "(tree_brick, 'r')\n", (1580, 1597), False, 'from scipy.io ...
import numpy as np import matplotlib.pyplot as plt datos= np.genfromtxt("data.txt") plt.hist(datos,bins=100) plt.savefig("histograma.pdf")
[ "matplotlib.pyplot.savefig", "numpy.genfromtxt", "matplotlib.pyplot.hist" ]
[((59, 84), 'numpy.genfromtxt', 'np.genfromtxt', (['"""data.txt"""'], {}), "('data.txt')\n", (72, 84), True, 'import numpy as np\n'), ((85, 110), 'matplotlib.pyplot.hist', 'plt.hist', (['datos'], {'bins': '(100)'}), '(datos, bins=100)\n', (93, 110), True, 'import matplotlib.pyplot as plt\n'), ((110, 139), 'matplotlib.p...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 28 10:57:28 2018 @author: jack.lingheng.meng """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import os import glob import tensorflow as tf from tensorflow.contrib.tenso...
[ "tensorflow.layers.Dropout", "tensorflow.trainable_variables", "LASAgent.environment_model.multilayer_nn_env_model.MultilayerNNEnvModel", "tensorflow.get_collection", "LASAgent.replay_buffer.ReplayBuffer", "tensorflow.variables_initializer", "numpy.ones", "tensorflow.multiply", "tensorflow.contrib.t...
[((6233, 6304), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(None, self.s_dim)', 'name': '"""ActorInput"""'}), "(tf.float32, shape=(None, self.s_dim), name='ActorInput')\n", (6247, 6304), True, 'import tensorflow as tf\n'), ((9935, 9973), 'os.listdir', 'os.listdir', (['self.actor_model_save_...
import sys # GFX imports # from glfw import * import pygloo from pygloo import * # Math # from math import * import random import numpy as np from geometry import Geometry, mat4, _flatten_list gl = None test_model = None model_distance = 10 model_rotate_x = 0 model_rotate_y = 0 mouse_xpos = 0 mouse_ypos = 0 mou...
[ "geometry.mat4.identity", "pygloo.init", "geometry.Geometry.from_OBJ", "pygloo.c_array", "geometry.mat4.rotateX", "geometry.mat4.rotateY", "numpy.linalg.inv", "geometry.mat4.translate", "numpy.dot", "sys.exit" ]
[((4736, 4757), 'numpy.linalg.inv', 'np.linalg.inv', (['camera'], {}), '(camera)\n', (4749, 4757), True, 'import numpy as np\n'), ((5009, 5022), 'pygloo.init', 'pygloo.init', ([], {}), '()\n', (5020, 5022), False, 'import pygloo\n'), ((5524, 5566), 'geometry.Geometry.from_OBJ', 'Geometry.from_OBJ', (['gl', '"""assets/s...
# Copyright (c) 2019 <NAME> <<EMAIL>> # -*- coding: utf-8 -*- """ This standalone module is intended to launch independent of the main brain application with the purpose of reading the contents of connectome and visualizing various aspects. """ from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph.opengl as gl impor...
[ "pyqtgraph.glColor", "json.load", "pyqtgraph.Qt.QtGui.QApplication.instance", "pyqtgraph.opengl.GLGridItem", "time.sleep", "os.path.isfile", "pyqtgraph.Qt.QtCore.QTimer", "numpy.array", "os.path.getmtime", "pyqtgraph.opengl.GLViewWidget", "pyqtgraph.Qt.QtGui.QApplication" ]
[((802, 824), 'json.load', 'json.load', (['genome_file'], {}), '(genome_file)\n', (811, 824), False, 'import json\n'), ((3940, 3976), 'os.path.getmtime', 'os.path.getmtime', (['cortical_file_path'], {}), '(cortical_file_path)\n', (3956, 3976), False, 'import os\n'), ((1062, 1115), 'os.path.isfile', 'os.path.isfile', ([...
import os import cv2 import numpy as np # import printj # from annotation_utils.coco.structs import COCO_Dataset # from common_utils.common_types.segmentation import Segmentation from tqdm import tqdm def merge_categories(json_path :str, output_json_path :str, merge_from :list, merge_to :int = None): ""...
[ "tqdm.tqdm", "os.path.abspath", "os.makedirs", "numpy.zeros", "os.path.exists", "cv2.drawContours", "cv2.findContours" ]
[((823, 866), 'tqdm.tqdm', 'tqdm', (['coco_dataset.images'], {'colour': '"""#44aa44"""'}), "(coco_dataset.images, colour='#44aa44')\n", (827, 866), False, 'from tqdm import tqdm\n'), ((2127, 2168), 'os.path.abspath', 'os.path.abspath', (['f"""{output_json_path}/.."""'], {}), "(f'{output_json_path}/..')\n", (2142, 2168)...
# 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...
[ "src.models.load_ckpt", "src.ds_cnn.DSCNN", "numpy.random.uniform", "argparse.ArgumentParser", "mindspore.Tensor", "src.config.eval_config" ]
[((908, 933), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (931, 933), False, 'import argparse\n'), ((958, 977), 'src.config.eval_config', 'eval_config', (['parser'], {}), '(parser)\n', (969, 977), False, 'from src.config import eval_config\n'), ((988, 1031), 'src.ds_cnn.DSCNN', 'DSCNN', (['m...
import numpy as np import sklearn """ input: NxTxFxD tensor output: NxCxFxT tensor """ def from_embedding(embedding, n_channels, n_jobs=-1): embedding_dim = embedding.shape[-1] labels = sklearn.cluster.KMeans( n_clusters=n_channels, n_jobs=n_jobs ).fit( embedding.reshape(embedding.size // ...
[ "sklearn.cluster.KMeans", "numpy.eye" ]
[((196, 256), 'sklearn.cluster.KMeans', 'sklearn.cluster.KMeans', ([], {'n_clusters': 'n_channels', 'n_jobs': 'n_jobs'}), '(n_clusters=n_channels, n_jobs=n_jobs)\n', (218, 256), False, 'import sklearn\n'), ((375, 393), 'numpy.eye', 'np.eye', (['n_channels'], {}), '(n_channels)\n', (381, 393), True, 'import numpy as np\...
# 12. Create a four dimensions array get sum over the last two axis at once. import numpy as np np_array = np.random.random(16).reshape(2, 2, 2, 2) print(np_array) np.sum(np_array, axis=0)
[ "numpy.random.random", "numpy.sum" ]
[((166, 190), 'numpy.sum', 'np.sum', (['np_array'], {'axis': '(0)'}), '(np_array, axis=0)\n', (172, 190), True, 'import numpy as np\n'), ((109, 129), 'numpy.random.random', 'np.random.random', (['(16)'], {}), '(16)\n', (125, 129), True, 'import numpy as np\n')]
import json import warnings from collections import defaultdict from io import StringIO import numpy as np from .base import ( UniformCountScoringModelBase, DecayRateCountScoringModelBase, LogarithmicCountScoringModelBase, MassScalingCountScoringModel, ScoringFeatureBase) class ChargeStateDistr...
[ "json.dump", "io.StringIO", "json.load", "numpy.floor", "collections.defaultdict", "warnings.warn" ]
[((2641, 2764), 'warnings.warn', 'warnings.warn', (["('%f was not found for this charge state scoring model. Defaulting to uniform model'\n % neighborhood)"], {}), "(\n '%f was not found for this charge state scoring model. Defaulting to uniform model'\n % neighborhood)\n", (2654, 2764), False, 'import warni...
from functools import partial import numpy as np def _generate_jitted_eigsh_lanczos(jax): """ Helper function to generate jitted lanczos function used in JaxBackend.eigsh_lanczos. The function `jax_lanczos` returned by this higher-order function has the following call signature: ``` eigenvalues, eigen...
[ "functools.partial", "numpy.real" ]
[((1443, 1488), 'functools.partial', 'partial', (['jax.jit'], {'static_argnums': '(3, 4, 5, 6)'}), '(jax.jit, static_argnums=(3, 4, 5, 6))\n', (1450, 1488), False, 'from functools import partial\n'), ((9025, 9067), 'functools.partial', 'partial', (['jax.jit'], {'static_argnums': '(5, 6, 7)'}), '(jax.jit, static_argnums...
import numpy as np import lunarsky.tests as ltest from astropy.coordinates import ICRS, GCRS, EarthLocation, AltAz from astropy.time import Time from lunarsky import MoonLocation, SkyCoord, LunarTopo, MCMF # Check that the changes to SkyCoord don't cause unexpected behavior. def test_skycoord_transforms(): # ...
[ "astropy.coordinates.EarthLocation.from_geodetic", "numpy.random.uniform", "lunarsky.tests.get_catalog", "lunarsky.MoonLocation.from_selenodetic", "astropy.coordinates.GCRS", "astropy.coordinates.ICRS", "numpy.allclose", "astropy.time.Time.now", "lunarsky.SkyCoord" ]
[((414, 452), 'astropy.coordinates.EarthLocation.from_geodetic', 'EarthLocation.from_geodetic', (['(0.0)', '(10.0)'], {}), '(0.0, 10.0)\n', (441, 452), False, 'from astropy.coordinates import ICRS, GCRS, EarthLocation, AltAz\n'), ((466, 485), 'lunarsky.tests.get_catalog', 'ltest.get_catalog', ([], {}), '()\n', (483, 48...
from .models import NeuropowerModel from crispy_forms.layout import Submit, Layout, Field, Div, HTML, Fieldset, ButtonHolder from crispy_forms.bootstrap import PrependedAppendedText from crispy_forms.helper import FormHelper from django.core import exceptions from django import forms import numpy as np class Parameter...
[ "crispy_forms.layout.HTML", "django.forms.RadioSelect", "django.core.exceptions.ValidationError", "django.forms.IntegerField", "django.forms.URLInput", "crispy_forms.helper.FormHelper", "django.forms.TextInput", "crispy_forms.layout.Fieldset", "crispy_forms.layout.Field", "numpy.equal", "django....
[((6833, 6845), 'crispy_forms.helper.FormHelper', 'FormHelper', ([], {}), '()\n', (6843, 6845), False, 'from crispy_forms.helper import FormHelper\n'), ((8897, 8928), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(False)'}), '(required=False)\n', (8912, 8928), False, 'from django import forms\n'), ((8...
import numpy as np import matplotlib.pyplot as plt from skimage.draw import ellipse import sys from scipy.ndimage.measurements import center_of_mass from numpy import unravel_index import scipy from .core import mfi plt.close("all") plt.rcParams.update({'font.size': 18}) def find_nearest(array, value): array ...
[ "numpy.load", "numpy.abs", "matplotlib.pyplot.close", "numpy.asarray", "matplotlib.pyplot.rcParams.update", "numpy.arange" ]
[((219, 235), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (228, 235), True, 'import matplotlib.pyplot as plt\n'), ((237, 275), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 18}"], {}), "({'font.size': 18})\n", (256, 275), True, 'import matplotlib.pyplot as pl...
from rlkit.envs.remote import RemoteRolloutEnv from rlkit.misc import eval_util from rlkit.samplers.rollout_functions import rollout from rlkit.torch.core import PyTorchModule import rlkit.torch.pytorch_util as ptu import argparse import pickle import uuid from rlkit.core import logger import torch from sawyer_control....
[ "matplotlib.pyplot.title", "argparse.ArgumentParser", "matplotlib.pyplot.clf", "ipdb.set_trace", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "os.path.join", "cv2.warpPerspective", "matplotlib.pyplot.close", "matplotlib.pyplot.imshow", "torchvision.transforms.ToPILImage", "matplotlib.p...
[((881, 903), 'rlkit.torch.pytorch_util.set_gpu_mode', 'ptu.set_gpu_mode', (['(True)'], {}), '(True)\n', (897, 903), True, 'import rlkit.torch.pytorch_util as ptu\n'), ((914, 939), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (937, 939), False, 'import argparse\n'), ((2999, 3008), 'matplotlib...
import warnings from abc import ABC, abstractmethod from typing import Any, Dict, Generator, List, Optional, Union import numpy as np import torch as th from gym import spaces from stable_baselines3.common.preprocessing import get_action_dim, get_obs_shape from stable_baselines3.common.type_aliases import ( DictR...
[ "psutil.virtual_memory", "numpy.zeros", "stable_baselines3.common.preprocessing.get_obs_shape", "stable_baselines3.common.preprocessing.get_action_dim", "numpy.random.randint", "numpy.array", "numpy.random.permutation", "torch.as_tensor", "warnings.warn", "torch.tensor" ]
[((981, 1013), 'stable_baselines3.common.preprocessing.get_obs_shape', 'get_obs_shape', (['observation_space'], {}), '(observation_space)\n', (994, 1013), False, 'from stable_baselines3.common.preprocessing import get_action_dim, get_obs_shape\n'), ((1040, 1068), 'stable_baselines3.common.preprocessing.get_action_dim',...
import sys import os import time import progressbar import numpy as np import pickle import pandas as pd from joblib import Parallel, delayed def timeseries_as_many2one(d, nb_timesteps_in, columns, timelag=0): t = {c: d[c].values for c in columns} X = [] for i in range(len(d)-nb_timesteps_in-timelag): ...
[ "sys.stdout.write", "numpy.abs", "numpy.sum", "bz2.BZ2File", "os.path.isfile", "numpy.mean", "sys.stdout.flush", "pandas.Grouper", "numpy.unique", "pandas.DataFrame", "numpy.max", "bokeh.plotting.show", "pandas.Timedelta", "pandas.isna", "sys.stderr.flush", "datetime.datetime.now", "...
[((614, 690), 'pandas.DataFrame', 'pd.DataFrame', (['X'], {'index': 'd.index[nb_timesteps_in + timelag:]', 'columns': 'colnames'}), '(X, index=d.index[nb_timesteps_in + timelag:], columns=colnames)\n', (626, 690), True, 'import pandas as pd\n'), ((1883, 1901), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (...
import numpy as np import pandas as pd def angSepVincenty(ra1, dec1, ra2, dec2): """ Vincenty formula for distances on a sphere """ ra1_rad = np.radians(ra1) dec1_rad = np.radians(dec1) ra2_rad = np.radians(ra2) dec2_rad = np.radians(dec2) sin_dec1, cos_dec1 = np.sin(dec1_rad), np.cos(...
[ "numpy.radians", "numpy.degrees", "pandas.read_csv", "numpy.sin", "numpy.cos", "numpy.sqrt" ]
[((159, 174), 'numpy.radians', 'np.radians', (['ra1'], {}), '(ra1)\n', (169, 174), True, 'import numpy as np\n'), ((190, 206), 'numpy.radians', 'np.radians', (['dec1'], {}), '(dec1)\n', (200, 206), True, 'import numpy as np\n'), ((221, 236), 'numpy.radians', 'np.radians', (['ra2'], {}), '(ra2)\n', (231, 236), True, 'im...
import os from pyTSEB import TSEB from pyTSEB import MO_similarity as mo from pyTSEB import wind_profile as wind from pyTSEB import resistances as res from pyTSEB import energy_combination_ET as pet from pyTSEB import meteo_utils as met from pyTSEB import net_radiation as rad from pypro4sail import four_sail as fs impo...
[ "numpy.maximum", "numpy.sum", "pandas.read_csv", "pyTSEB.resistances.calc_R_A", "pyTSEB.wind_profile.calc_A_Goudriaan", "numpy.ones", "pyTSEB.wind_profile.calc_canopy_distribution", "matplotlib.pyplot.figure", "numpy.arange", "pyTSEB.meteo_utils.calc_vapor_pressure", "numpy.exp", "pyTSEB.wind_...
[((667, 690), 'numpy.seterr', 'np.seterr', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (676, 690), True, 'import numpy as np\n'), ((919, 973), 'os.path.join', 'os.path.join', (['INPUT_FOLDER', '"""meteo"""', '"""meteo_daily.csv"""'], {}), "(INPUT_FOLDER, 'meteo', 'meteo_daily.csv')\n", (931, 973), False, 'import...
import numpy as np class Data_Source( object ): def __init__( self, opts ): self.batch_size = opts.batch_size self.train_sample = None self.test_sample = None self.train_label = None self.test_label = None self.num_train = 0 self.num_test = 0 ...
[ "numpy.load", "numpy.arange", "numpy.concatenate", "numpy.random.shuffle" ]
[((2008, 2047), 'numpy.arange', 'np.arange', (['self.num_train'], {'dtype': 'np.int'}), '(self.num_train, dtype=np.int)\n', (2017, 2047), True, 'import numpy as np\n'), ((2060, 2084), 'numpy.random.shuffle', 'np.random.shuffle', (['index'], {}), '(index)\n', (2077, 2084), True, 'import numpy as np\n'), ((2212, 2250), '...
# -*- coding: utf-8 -*- """ @author: <NAME> Harmonize the features between the target and the source data so that: - same feature space is considered between the source and the target. - features are odered in the same way, avoiding permutation issue. """ import numpy as np import pandas as pd def harmonize_feature...
[ "pandas.read_csv", "numpy.isin", "numpy.intersect1d", "pandas.DataFrame" ]
[((631, 683), 'numpy.intersect1d', 'np.intersect1d', (['target_gene_names', 'source_gene_names'], {}), '(target_gene_names, source_gene_names)\n', (645, 683), True, 'import numpy as np\n'), ((1138, 1182), 'pandas.read_csv', 'pd.read_csv', (['gene_lookup_file'], {'delimiter': '""","""'}), "(gene_lookup_file, delimiter='...
from typing import List from abc import ABC, abstractmethod import numpy as np from nodes import * class Operation(Node, ABC): @abstractmethod def symbol(self): ... def __init__(self, input_nodes: List[Node] = None): super().__init__(input_nodes) for node in input_nodes: ...
[ "numpy.divide", "numpy.multiply", "numpy.subtract", "numpy.log", "numpy.power", "numpy.exp", "numpy.dot", "numpy.add" ]
[((887, 896), 'numpy.log', 'np.log', (['i'], {}), '(i)\n', (893, 896), True, 'import numpy as np\n'), ((1087, 1096), 'numpy.exp', 'np.exp', (['i'], {}), '(i)\n', (1093, 1096), True, 'import numpy as np\n'), ((1784, 1796), 'numpy.add', 'np.add', (['l', 'r'], {}), '(l, r)\n', (1790, 1796), True, 'import numpy as np\n'), ...
from superdifferentiator.forward.functions import X import numpy as np import math def bgfs(f, init_x, accuracy = 1e-8, alphas =[.00001,.00005,.0001,.0005,0.001,0.005,0.01,0.05,0.1,0.5,1,5], max_iter = 1000,verbose = False): x_current = [X(init_x[i],'x'+str(i)) for i in range(len(init_x))] B =...
[ "numpy.linalg.pinv", "numpy.linalg.norm" ]
[((1084, 1101), 'numpy.linalg.norm', 'np.linalg.norm', (['s'], {}), '(s)\n', (1098, 1101), True, 'import numpy as np\n'), ((462, 479), 'numpy.linalg.pinv', 'np.linalg.pinv', (['B'], {}), '(B)\n', (476, 479), True, 'import numpy as np\n')]
"""Defining a set of classes that represent causal functions/ mechanisms. Author: <NAME> Modified by <NAME>, July 24th 2019 .. MIT License .. .. Copyright (c) 2018 <NAME> .. .. Permission is hereby granted, free of charge, to any person obtaining a copy .. of this software and associated documentation files (the "Sof...
[ "numpy.sum", "random.sample", "numpy.random.exponential", "sklearn.mixture.GaussianMixture", "numpy.sin", "numpy.random.randint", "numpy.exp", "numpy.random.normal", "torch.empty_like", "torch.no_grad", "numpy.random.randn", "numpy.power", "sklearn.metrics.pairwise.euclidean_distances", "n...
[((22034, 22054), 'numpy.exp', 'np.exp', (['(-xnorm / 2.0)'], {}), '(-xnorm / 2.0)\n', (22040, 22054), True, 'import numpy as np\n'), ((28683, 28718), 'sklearn.mixture.GaussianMixture', 'GMM', (['k'], {'covariance_type': '"""spherical"""'}), "(k, covariance_type='spherical')\n", (28686, 28718), True, 'from sklearn.mixt...
import numpy as np import os from os.path import join import glob import matplotlib import matplotlib.pyplot as plt import torch import pandas as pd from random import randint import SimpleITK as sitk from torchio.transforms import RandomMotion, RandomSpike, RandomGhosting, RandomBiasField from medseg.common_utils.bas...
[ "medseg.common_utils.basic_operations.crop_or_pad", "numpy.zeros_like", "torchio.transforms.RandomMotion", "torchio.transforms.RandomGhosting", "medseg.common_utils.basic_operations.load_img_label_from_path", "os.unlink", "medseg.common_utils.basic_operations.rescale_intensity", "numpy.percentile", ...
[((653, 692), 'numpy.zeros_like', 'np.zeros_like', (['image'], {'dtype': 'image.dtype'}), '(image, dtype=image.dtype)\n', (666, 692), True, 'import numpy as np\n'), ((1505, 1530), 'os.path.join', 'join', (['dataset_root', 'frame'], {}), '(dataset_root, frame)\n', (1509, 1530), False, 'from os.path import join\n'), ((22...
import os import shutil import sys from pathlib import Path import matplotlib.pyplot as plt import numpy import numpy as np from keract import get_activations from tensorflow.keras import Input from tensorflow.keras.callbacks import Callback from tensorflow.keras.layers import Dense, Dropout, LSTM, Flatten, Conv1D fro...
[ "matplotlib.pyplot.title", "numpy.random.seed", "attention.Attention", "tensorflow.keras.layers.Dense", "pathlib.Path", "numpy.zeros_like", "numpy.testing.assert_almost_equal", "tensorflow.keras.Input", "keras.utils.vis_utils.plot_model", "matplotlib.pyplot.close", "tensorflow.keras.models.load_...
[((1689, 1732), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)', '(n, seq_length, 2)'], {}), '(0, 1, (n, seq_length, 2))\n', (1706, 1732), True, 'import numpy as np\n'), ((1740, 1762), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, 1)'}), '(shape=(n, 1))\n', (1748, 1762), True, 'import numpy as np\n'), ((22...
# Copyright 2017-2019 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
[ "textwrap.dedent", "numpy.pad", "argparse.ArgumentParser", "vezda.LinearSamplingClass.LinearSamplingProblem", "vezda.data_utils.load_impulse_responses", "scipy.linalg.norm", "vezda.data_utils.load_data", "numpy.savez", "sys.exit" ]
[((1138, 1163), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1161, 1163), False, 'import argparse\n'), ((11925, 11995), 'numpy.savez', 'np.savez', (["('solution' + extension)"], {'X': 'X', 'alpha': 'alpha', 'domain': 'args.domain'}), "('solution' + extension, X=X, alpha=alpha, domain=args.do...
import rospy import cv2 import cv2.aruco as aruco import sys import numpy as np import time class TrackByAruco: def __init__(self, imageSize): self.imageSize = imageSize self.ideatToTrack = 1 self.targetSize = None def setIdeaToTrack(self, ideatToTrack): self.ideatToTrack = i...
[ "cv2.line", "cv2.aruco.drawDetectedMarkers", "cv2.circle", "cv2.aruco.DetectorParameters_create", "cv2.cvtColor", "cv2.waitKey", "cv2.aruco.Dictionary_get", "cv2.aruco.detectMarkers", "numpy.array", "cv2.resizeWindow", "cv2.imshow", "cv2.namedWindow" ]
[((445, 484), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (457, 484), False, 'import cv2\n'), ((506, 546), 'cv2.aruco.Dictionary_get', 'aruco.Dictionary_get', (['aruco.DICT_4X4_100'], {}), '(aruco.DICT_4X4_100)\n', (526, 546), True, 'import cv2.aruco as aruco\...
import pyfere as pf import numpy as np import time def execute(BloomFilter, n, m, k, in_parallel=True): def get_data(n): return list(np.random.choice(2**63-1, n)) def benchmark(func, tag): start = time.time() result = func() end = time.time() print ("%ss (%s)" % (end...
[ "numpy.random.choice", "numpy.log", "time.time" ]
[((225, 236), 'time.time', 'time.time', ([], {}), '()\n', (234, 236), False, 'import time\n'), ((275, 286), 'time.time', 'time.time', ([], {}), '()\n', (284, 286), False, 'import time\n'), ((1058, 1067), 'numpy.log', 'np.log', (['(2)'], {}), '(2)\n', (1064, 1067), True, 'import numpy as np\n'), ((147, 179), 'numpy.rand...
import numpy as np import matplotlib.pyplot as plt x=np.arange(1,6) y=np.arange(2,11,2) fig = plt.figure() axes1=fig.add_axes([0.1,0.1,0.8,0.8]) axes1.plot(x,x**2,color="red",marker="o",markersize=20,markerfacecolor="black") plt.show()
[ "matplotlib.pyplot.figure", "numpy.arange", "matplotlib.pyplot.show" ]
[((54, 69), 'numpy.arange', 'np.arange', (['(1)', '(6)'], {}), '(1, 6)\n', (63, 69), True, 'import numpy as np\n'), ((71, 90), 'numpy.arange', 'np.arange', (['(2)', '(11)', '(2)'], {}), '(2, 11, 2)\n', (80, 90), True, 'import numpy as np\n'), ((96, 108), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (106,...
from typing import List, Dict import numpy as np from rlo import utils def by_rep(es): return utils.group_by( [e for e in es if "repetition" in e], lambda e: int(e["repetition"]) ) def filter_event_fields(events): return [ { k: v for k, v in e.items() ...
[ "numpy.allclose" ]
[((2609, 2640), 'numpy.allclose', 'np.allclose', (['v1', 'v2'], {'atol': '(1e-06)'}), '(v1, v2, atol=1e-06)\n', (2620, 2640), True, 'import numpy as np\n')]
""" This code implements a perceptron algorithm (PLA). First, we visualise the dataset which contains 2 features. We can see that the dataset can be clearly separated by drawing a straight line between them. The goal is to write an algorithm that finds that line and classifies all of these data points correctly. The ...
[ "pandas.DataFrame", "plotly.graph_objects.Scatter", "os.mkdir", "pandas.read_csv", "numpy.empty", "os.getcwd", "numpy.zeros", "os.path.exists", "numpy.insert", "numpy.asmatrix", "numpy.vstack" ]
[((1678, 1717), 'pandas.read_csv', 'pd.read_csv', (['input_path'], {'names': 'names_in'}), '(input_path, names=names_in)\n', (1689, 1717), True, 'import pandas as pd\n'), ((2185, 2217), 'numpy.asmatrix', 'np.asmatrix', (['df'], {'dtype': '"""float64"""'}), "(df, dtype='float64')\n", (2196, 2217), True, 'import numpy as...
from sklearn import svm, datasets from sklearn.model_selection import train_test_split import numpy as np iris = datasets.load_iris() X = iris.data y = iris.target # Add noisy features random_state = np.random.RandomState(0) n_samples, n_features = X.shape X = np.c_[X, random_state.randn(n_samples, 200 * n_features)]...
[ "sklearn.datasets.load_iris", "matplotlib.pyplot.xlim", "matplotlib.pyplot.ylim", "sklearn.model_selection.train_test_split", "matplotlib.pyplot.ylabel", "numpy.random.RandomState", "sklearn.metrics.precision_recall_curve", "matplotlib.pyplot.step", "inspect.signature", "sklearn.svm.LinearSVC", ...
[((114, 134), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (132, 134), False, 'from sklearn import svm, datasets\n'), ((202, 226), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)'], {}), '(0)\n', (223, 226), True, 'import numpy as np\n'), ((424, 502), 'sklearn.model_selection.train_...
from FICUS import MagnetReader as mr from FICUS import AnalyticForce as af import numpy as np import matplotlib.pyplot as plt import sys ''' This program reads the output of sample_fields.py and evaluates forces and torques from the magnetic field Exports a Mx30 .csv file head = 'Xn [m] (N face center), Yn [m], Z...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "FICUS.MagnetReader.Magnet_3D", "matplotlib.pyplot.show", "matplotlib.pyplot.suptitle", "numpy.cross", "matplotlib.pyplot.draw", "matplotlib.pyplot.figure", "numpy.mean", "numpy.array", "numpy.reshape", "numpy.max", "numpy.linalg.norm",...
[((1294, 1330), 'numpy.sqrt', 'np.sqrt', (['(bx * bx + by * by + bz * bz)'], {}), '(bx * bx + by * by + bz * bz)\n', (1301, 1330), True, 'import numpy as np\n'), ((1381, 1407), 'FICUS.MagnetReader.Magnet_3D', 'mr.Magnet_3D', (['(path + f_mag)'], {}), '(path + f_mag)\n', (1393, 1407), True, 'from FICUS import MagnetRead...
import time from tools.montecarlo_python import get_equity as py_get_equity import tools.nn_equity as nn_equity from gym_env.env import HoldemTable from tools.nn_equity import sample_cards import numpy as np import matplotlib.pyplot as plt import cppimport def test_model(get_equity_func, my_cards, cards_on_table, pla...
[ "gym_env.env.HoldemTable", "matplotlib.pyplot.show", "numpy.std", "cppimport.imp", "matplotlib.pyplot.close", "time.time", "numpy.mean", "tools.nn_equity.sample_cards", "numpy.random.choice", "tools.nn_equity.PredictEquity", "matplotlib.pyplot.subplots", "matplotlib.pyplot.savefig" ]
[((350, 361), 'time.time', 'time.time', ([], {}), '()\n', (359, 361), False, 'import time\n'), ((444, 455), 'time.time', 'time.time', ([], {}), '()\n', (453, 455), False, 'import time\n'), ((568, 581), 'gym_env.env.HoldemTable', 'HoldemTable', ([], {}), '()\n', (579, 581), False, 'from gym_env.env import HoldemTable\n'...
from __future__ import print_function """ mini_summary_plots.py Simple plots of data points for mini analysis from mini_analysis.py <NAME>, 3/2018 """ import os import sys import re import pickle import numpy as np from collections import OrderedDict from matplotlib import rc import matplotlib.pyplot as mpl import p...
[ "matplotlib.rc", "matplotlib.pyplot.show", "numpy.std", "pylibrary.plotting.plothelpers.formatTicks", "seaborn.swarmplot", "numpy.mean", "pickle.load", "seaborn.boxplot", "pandas.Categorical", "numpy.array", "collections.OrderedDict", "pylibrary.plotting.plothelpers.Plotter", "re.sub", "ma...
[((374, 398), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(False)'}), "('text', usetex=False)\n", (376, 398), False, 'from matplotlib import rc\n'), ((810, 825), 'pickle.load', 'pickle.load', (['fh'], {}), '(fh)\n', (821, 825), False, 'import pickle\n'), ((1297, 1309), 'numpy.mean', 'np.mean', (['tau'], {}), '(...
# Copyright 2020 Makani Technologies LLC # # 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...
[ "numpy.zeros", "collections.namedtuple" ]
[((2728, 2771), 'collections.namedtuple', 'collections.namedtuple', (["(name + 'Repr')", 'keys'], {}), "(name + 'Repr', keys)\n", (2750, 2771), False, 'import collections\n'), ((6259, 6293), 'collections.namedtuple', 'collections.namedtuple', (['name', 'keys'], {}), '(name, keys)\n', (6281, 6293), False, 'import collec...
import os import h5py import time import numpy as np from pathlib import Path from sklearn.model_selection import train_test_split import json import argparse def read_json(path): with open(path) as json_data: return json.load(json_data) # Add arguments to parser parser = argparse.ArgumentParser(descripti...
[ "json.load", "argparse.ArgumentParser", "numpy.argmax", "os.path.dirname", "time.perf_counter", "os.path.join" ]
[((287, 347), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate MLM entities"""'}), "(description='Generate MLM entities')\n", (310, 347), False, 'import argparse\n'), ((1164, 1183), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1181, 1183), False, 'import time\n'), ...
#!/home/wanghongwei/anaconda3/envs/tf114/bin/python # -*- coding: utf-8 -*- import numpy as np import cv2 def degree_compute(image, joints): base_vec = joints[0] - joints[5] l_edge_vec = joints[1] - joints[5] r_edge_vec = joints[2] - joints[5] arrow_vec = joints[4] - joints[5] base_len = np.sqrt(...
[ "numpy.dot", "cv2.putText", "numpy.sqrt" ]
[((312, 356), 'numpy.sqrt', 'np.sqrt', (['(base_vec[0] ** 2 + base_vec[1] ** 2)'], {}), '(base_vec[0] ** 2 + base_vec[1] ** 2)\n', (319, 356), True, 'import numpy as np\n'), ((370, 418), 'numpy.sqrt', 'np.sqrt', (['(l_edge_vec[0] ** 2 + l_edge_vec[1] ** 2)'], {}), '(l_edge_vec[0] ** 2 + l_edge_vec[1] ** 2)\n', (377, 41...
from colour import Color from mobject.mobject import Mobject from pytest import approx from unittest.mock import call from unittest.mock import create_autospec import camera.camera import constants as const import inspect import mobject.mobject import numpy as np import os import pytest SEED = 386735 np.random.seed(...
[ "unittest.mock.create_autospec", "numpy.random.seed", "numpy.allclose", "numpy.ones", "numpy.random.randint", "numpy.tile", "numpy.full", "numpy.transpose", "pytest.raises", "inspect.getsource", "mobject.mobject.Mobject", "numpy.dot", "pytest.approx", "colour.Color", "numpy.flip", "num...
[((305, 325), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (319, 325), True, 'import numpy as np\n'), ((388, 397), 'mobject.mobject.Mobject', 'Mobject', ([], {}), '()\n', (395, 397), False, 'from mobject.mobject import Mobject\n'), ((413, 442), 'numpy.random.rand', 'np.random.rand', (['num_points'...
from deap import base, creator, tools import random import numpy as np import statsmodels.api as sm import pandas as pd from tqdm import tqdm class Patient_opt: def __init__(self, patients, mutpb=0.05, copb=0.5, n_indviduals=100, n_gens=100): super().__init__() self.patients = patients ...
[ "numpy.sum", "statsmodels.api.duration.survdiff", "deap.base.Toolbox", "random.random", "deap.creator.create", "numpy.array" ]
[((459, 473), 'deap.base.Toolbox', 'base.Toolbox', ([], {}), '()\n', (471, 473), False, 'from deap import base, creator, tools\n'), ((483, 546), 'deap.creator.create', 'creator.create', (['"""FitnessMax"""', 'base.Fitness'], {'weights': '(1.0, -1.0)'}), "('FitnessMax', base.Fitness, weights=(1.0, -1.0))\n", (497, 546),...
# -*- coding: utf-8 -*- """ Created on Fri Feb 15 22:57:52 2019 @author: Kellin """ import numpy as np from scipy import optimize import matplotlib.pyplot as plt #parameters eta = 0.2 epsilon = 0.36 gamma = 0.7 beta = 0.96 delta = 0.1 theta = 1.0 alpha = 0.36 gridsize = 50 K = 2.5 #initial va...
[ "scipy.optimize.minimize", "numpy.sum", "numpy.zeros", "numpy.ones", "numpy.random.randint", "numpy.array", "numpy.tile", "numpy.linspace", "numpy.linalg.norm", "numpy.linalg.matrix_power", "matplotlib.pyplot.subplots" ]
[((1898, 1946), 'scipy.optimize.minimize', 'optimize.minimize', (['Kupdate', '(2.5)'], {'bounds': '[(2, 7)]'}), '(Kupdate, 2.5, bounds=[(2, 7)])\n', (1915, 1946), False, 'from scipy import optimize\n'), ((3667, 3695), 'numpy.linspace', 'np.linspace', (['(0)', '(20)', 'gridsize'], {}), '(0, 20, gridsize)\n', (3678, 3695...
import re from html_table_parser.parser import HTMLTableParser from lxml.html import fromstring, tostring from pandas import DataFrame from numpy import array import pandas as pd from data_utils import get_matches_info, get_players_data_from_matches_stats data = { 'hits_count_mult_success_percent': { 'Te...
[ "pandas.DataFrame", "html_table_parser.parser.HTMLTableParser", "numpy.array" ]
[((3331, 3348), 'html_table_parser.parser.HTMLTableParser', 'HTMLTableParser', ([], {}), '()\n', (3346, 3348), False, 'from html_table_parser.parser import HTMLTableParser\n'), ((3387, 3458), 'numpy.array', 'array', (['[table[1:] for table_group in p.tables for table in table_group]'], {}), '([table[1:] for table_group...