code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy as np import segyio import pyvds VDS_FILE = 'test_data/small.vds' SGY_FILE = 'test_data/small.sgy' def compare_inline_ordinal(vds_filename, sgy_filename, lines_to_test, tolerance): with pyvds.open(vds_filename) as vdsfile: with segyio.open(sgy_filename) as segyfile: for line_ordi...
[ "numpy.allclose", "pyvds.tools.dt", "segyio.tools.cube", "segyio.tools.dt", "pyvds.tools.cube", "numpy.asarray", "pyvds.open", "numpy.array_equal", "segyio.open" ]
[((5742, 5773), 'segyio.tools.cube', 'segyio.tools.cube', (['sgy_filename'], {}), '(sgy_filename)\n', (5759, 5773), False, 'import segyio\n'), ((5788, 5818), 'pyvds.tools.cube', 'pyvds.tools.cube', (['vds_filename'], {}), '(vds_filename)\n', (5804, 5818), False, 'import pyvds\n'), ((5830, 5875), 'numpy.allclose', 'np.a...
# -*- coding: utf-8 -*- """ Module of Lauetools project <NAME> Feb 2012 module to fit orientation and strain http://sourceforge.net/projects/lauetools/ """ __author__ = "<NAME>, CRG-IF BM32 @ ESRF" from scipy.optimize import leastsq, least_squares import numpy as np np.set_printoptions(precision=15) from scipy.li...
[ "numpy.sqrt", "numpy.hstack", "lauetoolsnn.lauetools.LaueGeometry.from_qunit_to_twchi", "numpy.array", "numpy.sin", "lauetoolsnn.lauetools.CrystalParameters.calc_B_RR", "numpy.arange", "scipy.linalg.qr", "numpy.mean", "scipy.optimize.least_squares", "numpy.where", "numpy.take", "scipy.optimi...
[((273, 306), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(15)'}), '(precision=15)\n', (292, 306), True, 'import numpy as np\n'), ((903, 912), 'numpy.eye', 'np.eye', (['(3)'], {}), '(3)\n', (909, 912), True, 'import numpy as np\n'), ((1054, 1080), 'numpy.zeros', 'np.zeros', (['nn'], {'dtype': '...
"""Action selector implementations. Action selectors are objects that when called return a desired action. These actions may be stochastically chosen (e.g. randomly chosen from a list of candidates) depending on the choice of `ActionSelector` implementation, and how it is configured. Examples include the following * ...
[ "numpy.array", "numpy.random.default_rng" ]
[((1845, 1880), 'numpy.random.default_rng', 'np.random.default_rng', (['random_state'], {}), '(random_state)\n', (1866, 1880), True, 'import numpy as np\n'), ((2706, 2741), 'numpy.random.default_rng', 'np.random.default_rng', (['random_state'], {}), '(random_state)\n', (2727, 2741), True, 'import numpy as np\n'), ((403...
import numpy as np from abc import ABC, abstractmethod # Defining base loss class class Loss(ABC): @abstractmethod def __call__(self, pred, target): pass @abstractmethod def gradient(self, *args, **kwargs): pass class MSELoss(Loss): def __call__(self, pred, target): re...
[ "numpy.maximum", "numpy.square" ]
[((325, 349), 'numpy.square', 'np.square', (['(pred - target)'], {}), '(pred - target)\n', (334, 349), True, 'import numpy as np\n'), ((538, 550), 'numpy.square', 'np.square', (['w'], {}), '(w)\n', (547, 550), True, 'import numpy as np\n'), ((734, 757), 'numpy.maximum', 'np.maximum', (['pred', '(1e-09)'], {}), '(pred, ...
import glob import xml.etree.ElementTree as ET from unittest import TestCase import numpy as np from kmeans import kmeans, avg_iou ANNOTATIONS_PATH = "Annotations" class TestVoc2007(TestCase): def __load_dataset(self): dataset = [] for xml_file in glob.glob("{}/*xml".format(ANNOTATIONS_PATH)): ...
[ "xml.etree.ElementTree.parse", "kmeans.avg_iou", "kmeans.kmeans", "numpy.array", "numpy.testing.assert_almost_equal" ]
[((850, 867), 'numpy.array', 'np.array', (['dataset'], {}), '(dataset)\n', (858, 867), True, 'import numpy as np\n'), ((953, 971), 'kmeans.kmeans', 'kmeans', (['dataset', '(5)'], {}), '(dataset, 5)\n', (959, 971), False, 'from kmeans import kmeans, avg_iou\n'), ((993, 1014), 'kmeans.avg_iou', 'avg_iou', (['dataset', 'o...
''' This example show how to perform a DMR topic model using tomotopy and visualize the topic distribution for each metadata Required Packages: matplotlib ''' import tomotopy as tp import numpy as np import matplotlib.pyplot as plt ''' You can get the sample data file from https://drive.google.com/file/d/1AUHdwa...
[ "tomotopy.utils.Corpus", "tomotopy.DMRModel", "matplotlib.pyplot.subplots", "numpy.arange", "matplotlib.pyplot.show" ]
[((380, 397), 'tomotopy.utils.Corpus', 'tp.utils.Corpus', ([], {}), '()\n', (395, 397), True, 'import tomotopy as tp\n'), ((652, 706), 'tomotopy.DMRModel', 'tp.DMRModel', ([], {'tw': 'tp.TermWeight.PMI', 'k': '(15)', 'corpus': 'corpus'}), '(tw=tp.TermWeight.PMI, k=15, corpus=corpus)\n', (663, 706), True, 'import tomoto...
""" Functions for making a consistent dataset with fixed and free variables as is expected in our dataset. """ import logging import sys from itertools import chain from pathlib import Path import numpy as np import pandas as pd import sympy from src.util import get_free_fluxes RT = 0.008314 * 298.15 logger = loggi...
[ "logging.getLogger", "numpy.identity", "numpy.flip", "numpy.linalg.solve", "numpy.ones", "pandas.read_csv", "pathlib.Path", "numpy.log", "sympy.Matrix", "sympy.symbols", "numpy.array", "numpy.zeros", "itertools.chain.from_iterable", "sys.exit", "numpy.full", "numpy.random.randn" ]
[((315, 342), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (332, 342), False, 'import logging\n'), ((813, 852), 'numpy.zeros', 'np.zeros', (['(n_rxns, n_exchange + n_mets)'], {}), '((n_rxns, n_exchange + n_mets))\n', (821, 852), True, 'import numpy as np\n'), ((889, 912), 'numpy.identit...
from numpy import matlib import matplotlib.pyplot as plt import numpy as np from scipy.sparse.linalg import svds from scipy.sparse import csc_matrix class ohmlr(object): def __init__(self, x_classes=None, y_classes=None, random_coeff=False): self.x_classes = x_classes self.y_classes = y_classes ...
[ "numpy.asmatrix", "numpy.log", "scipy.sparse.linalg.svds", "numpy.arange", "numpy.multiply", "numpy.sort", "numpy.asarray", "numpy.exp", "numpy.stack", "numpy.vstack", "numpy.random.normal", "numpy.ones", "numpy.matlib.zeros", "numpy.isclose", "numpy.unique", "numpy.power", "numpy.su...
[((1943, 1978), 'numpy.asarray', 'np.asarray', (['[u_map[ui] for ui in u]'], {}), '([u_map[ui] for ui in u])\n', (1953, 1978), True, 'import numpy as np\n'), ((2177, 2190), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (2187, 2190), True, 'import numpy as np\n'), ((2482, 2495), 'numpy.asarray', 'np.asarray', (['...
#!/usr/bin/env python # coding: utf-8 # In[1]: #move this notebook to folder above syndef to run from syndef import synfits #import synestia snapshot (impact database) import numpy as np import matplotlib.pyplot as plt test_rxy=np.linspace(7e6,60e6,100) #m test_z=np.linspace(0.001e6,30e6,50) #m rxy=np.log10(test_rx...
[ "numpy.log10", "matplotlib.pyplot.title", "matplotlib.pyplot.ylabel", "numpy.power", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "matplotlib.pyplot.colorbar", "matplotlib.pyplot.close", "numpy.linspace", "matplotlib.pyplot.figure", "matplotlib.pyplot.scatter", "numpy.meshgrid", "ma...
[((232, 271), 'numpy.linspace', 'np.linspace', (['(7000000.0)', '(60000000.0)', '(100)'], {}), '(7000000.0, 60000000.0, 100)\n', (243, 271), True, 'import numpy as np\n'), ((268, 303), 'numpy.linspace', 'np.linspace', (['(1000.0)', '(30000000.0)', '(50)'], {}), '(1000.0, 30000000.0, 50)\n', (279, 303), True, 'import nu...
from typing import List, Tuple, Optional import os import numpy as np import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.ticker as ticker from matplotlib import cm import matplotlib.colors as mplcolors from ramachandran.io import read_residue_torsion_collection_from_file def get...
[ "os.path.exists", "ramachandran.io.read_residue_torsion_collection_from_file", "os.makedirs", "matplotlib.use", "numpy.delete", "matplotlib.ticker.MultipleLocator", "os.path.join", "os.path.split", "matplotlib.pyplot.close", "numpy.array", "matplotlib.pyplot.figure", "matplotlib.colors.ListedC...
[((88, 109), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (102, 109), False, 'import matplotlib\n'), ((1247, 1271), 'numpy.array', 'np.array', (['phi_psi_angles'], {}), '(phi_psi_angles)\n', (1255, 1271), True, 'import numpy as np\n'), ((1365, 1393), 'matplotlib.pyplot.figure', 'plt.figure', ([...
# -*- coding: utf-8 -*- """ Created on Tue May 26 07:49:48 2020 @author: X202722 """ def make_parameter_BPT_fit (T_sim, T_exp, method, na, M): import numpy as np # fit if possible BPT guess to #nannoolal if method == 0: a = 0.6583 b= 1.6868 c= 84.3395 ...
[ "numpy.sqrt", "numpy.power", "numpy.log", "numpy.exp", "numpy.zeros", "numpy.isnan", "pandas.DataFrame" ]
[((6738, 6750), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (6746, 6750), True, 'import numpy as np\n'), ((7007, 7019), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (7015, 7019), True, 'import numpy as np\n'), ((4856, 4886), 'numpy.isnan', 'np.isnan', (['meta_real.iloc[p, 0]'], {}), '(meta_real.iloc[p,...
import numpy import pytest from testfixtures import LogCapture from matchms.filtering import add_losses from .builder_Spectrum import SpectrumBuilder @pytest.mark.parametrize("mz, loss_mz_to, expected_mz, expected_intensities", [ [numpy.array([100, 150, 200, 300], dtype="float"), 1000, numpy.array([145, 245, 295,...
[ "numpy.allclose", "matchms.filtering.add_losses", "numpy.array", "pytest.raises", "testfixtures.LogCapture" ]
[((759, 802), 'numpy.array', 'numpy.array', (['[700, 200, 100, 1000]', '"""float"""'], {}), "([700, 200, 100, 1000], 'float')\n", (770, 802), False, 'import numpy\n'), ((977, 1023), 'matchms.filtering.add_losses', 'add_losses', (['spectrum_in'], {'loss_mz_to': 'loss_mz_to'}), '(spectrum_in, loss_mz_to=loss_mz_to)\n', (...
# -*- coding: utf-8 -*- import imageio import matplotlib.pyplot as plt import numpy img = imageio.imread('Z:/DRPI/questoes_aula/sat_map3.tif') dim = img.shape col = dim[1] lin = dim[0] def histogram(img, s, rgb): """ Função que desenha os histogramas :param img: A imagem :param s: ...
[ "numpy.uint8", "numpy.histogram", "matplotlib.pyplot.axis", "numpy.max", "numpy.count_nonzero", "numpy.zeros", "matplotlib.pyplot.figure", "numpy.cumsum", "matplotlib.pyplot.interactive", "numpy.min", "imageio.imread", "matplotlib.pyplot.title", "matplotlib.pyplot.subplot", "matplotlib.pyp...
[((100, 152), 'imageio.imread', 'imageio.imread', (['"""Z:/DRPI/questoes_aula/sat_map3.tif"""'], {}), "('Z:/DRPI/questoes_aula/sat_map3.tif')\n", (114, 152), False, 'import imageio\n'), ((514, 539), 'matplotlib.pyplot.title', 'plt.title', (['s'], {'fontsize': '(10)'}), '(s, fontsize=10)\n', (523, 539), True, 'import ma...
__author__ = 'sibirrer' from astrofunc.LensingProfiles.nfw import NFW from astrofunc.LensingProfiles.nfw_ellipse import NFW_ELLIPSE import numpy as np import numpy.testing as npt import pytest class TestNFW(object): """ tests the Gaussian methods """ def setup(self): self.nfw = NFW() d...
[ "pytest.main", "astrofunc.LensingProfiles.nfw.NFW", "numpy.array", "numpy.testing.assert_almost_equal", "astrofunc.LensingProfiles.nfw_ellipse.NFW_ELLIPSE" ]
[((4080, 4093), 'pytest.main', 'pytest.main', ([], {}), '()\n', (4091, 4093), False, 'import pytest\n'), ((307, 312), 'astrofunc.LensingProfiles.nfw.NFW', 'NFW', ([], {}), '()\n', (310, 312), False, 'from astrofunc.LensingProfiles.nfw import NFW\n'), ((356, 369), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (36...
import os import curses import numpy as np from pathlib import Path ROOT = Path("terminal_dungeon") WALL_DIR = ROOT / "wall_textures" SPRITE_DIR = ROOT / "sprite_textures" def clamp(mi, val, ma): return max(min(ma, val), mi) class Renderer: """ Graphic engine. Casts rays. Casts sprites. Kicks ass. ...
[ "numpy.clip", "os.get_terminal_size", "pathlib.Path", "numpy.where", "numpy.heaviside", "numpy.array", "numpy.zeros", "numpy.linalg.inv", "numpy.sign", "curses.resizeterm", "numpy.full", "numpy.arange" ]
[((76, 100), 'pathlib.Path', 'Path', (['"""terminal_dungeon"""'], {}), "('terminal_dungeon')\n", (80, 100), False, 'from pathlib import Path\n'), ((1939, 1950), 'numpy.zeros', 'np.zeros', (['w'], {}), '(w)\n', (1947, 1950), True, 'import numpy as np\n'), ((1973, 1993), 'numpy.full', 'np.full', (['(h, w)', '""" """'], {...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import edward as ed from edward.models import Normal, Empirical from scipy.special import erf import importlib import utils importlib.reload(...
[ "numpy.mean", "numpy.atleast_2d", "numpy.sqrt", "numpy.reshape", "tensorflow.reshape", "tensorflow.ones", "tensorflow.placeholder", "numpy.square", "numpy.array", "numpy.random.randint", "tensorflow.name_scope", "tensorflow.matmul", "importlib.reload", "numpy.std", "numpy.matmul", "ten...
[((303, 326), 'importlib.reload', 'importlib.reload', (['utils'], {}), '(utils)\n', (319, 326), False, 'import importlib\n'), ((11730, 11747), 'numpy.array', 'np.array', (['y_preds'], {}), '(y_preds)\n', (11738, 11747), True, 'import numpy as np\n'), ((11763, 11787), 'numpy.mean', 'np.mean', (['y_preds'], {'axis': '(0)...
import pickle import xlsxwriter import numpy as np import os def load(filename): loaded_dict = pickle.load(open(filename, 'rb')) return dict def np_2darray_converter(matrix): if(type(matrix) == type({})): # making dictionary suitable for excel keys = list(matrix.keys()) value...
[ "numpy.array", "os.path.splitext", "xlsxwriter.Workbook" ]
[((468, 493), 'numpy.array', 'np.array', (['matrix'], {'ndmin': '(2)'}), '(matrix, ndmin=2)\n', (476, 493), True, 'import numpy as np\n'), ((1200, 1229), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', (['filename'], {}), '(filename)\n', (1219, 1229), False, 'import xlsxwriter\n'), ((1110, 1136), 'os.path.splitext', 'os....
import numpy as np wavelength = 626.34 constant = np.array([(3050+0.6*np.cos(np.pi*i/40.0))*(1/wavelength) for i in range(30)]) exactdata = constant*wavelength errorbar = 0.1*constant realdata = np.random.normal(exactdata,errorbar) runnumber = np.array(range(30))
[ "numpy.random.normal", "numpy.cos" ]
[((196, 233), 'numpy.random.normal', 'np.random.normal', (['exactdata', 'errorbar'], {}), '(exactdata, errorbar)\n', (212, 233), True, 'import numpy as np\n'), ((70, 94), 'numpy.cos', 'np.cos', (['(np.pi * i / 40.0)'], {}), '(np.pi * i / 40.0)\n', (76, 94), True, 'import numpy as np\n')]
# -*- coding: utf-8 -*- """ Created on Fri Mar 1 11:52:48 2019 This is the module for evaluation metrics @author: Cheng """ # -*- coding: utf-8 -*- """ Created on Sat Mar 2 21:31:32 2019 @author: cheng """ import numpy as np from scipy.spatial.distance import directed_hausdorff def get_classified_errors(test_pred...
[ "numpy.mean", "numpy.reshape", "numpy.amin", "scipy.spatial.distance.directed_hausdorff", "numpy.array_str", "numpy.linalg.norm", "numpy.arctan2", "numpy.vstack", "numpy.std" ]
[((569, 609), 'numpy.reshape', 'np.reshape', (['indexed_predictions', '[-1, 5]'], {}), '(indexed_predictions, [-1, 5])\n', (579, 609), True, 'import numpy as np\n'), ((630, 660), 'numpy.reshape', 'np.reshape', (['test_pred', '[-1, 5]'], {}), '(test_pred, [-1, 5])\n', (640, 660), True, 'import numpy as np\n'), ((972, 10...
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distribu...
[ "openfermion.chem.molecular_data.MolecularData", "numpy.allclose", "openfermion.ops.representations.doci_hamiltonian.DOCIHamiltonian.from_integrals", "openfermion.linalg.get_sparse_operator", "openfermion.ops.representations.doci_hamiltonian.get_doci_from_integrals", "os.path.join", "numpy.ix_", "nump...
[((1287, 1343), 'os.path.join', 'os.path.join', (['DATA_DIRECTORY', '"""H2_sto-3g_singlet_0.7414"""'], {}), "(DATA_DIRECTORY, 'H2_sto-3g_singlet_0.7414')\n", (1299, 1343), False, 'import os\n'), ((1368, 1456), 'openfermion.chem.molecular_data.MolecularData', 'MolecularData', (['self.geometry', 'self.basis', 'self.multi...
import numpy as np import torch from torch.utils.tensorboard import SummaryWriter from torch.utils.data import DataLoader from ProcessData.TrainingLoss import TrainingLoss from ProcessData.Utils import getX_full from typing import Tuple from HighFrequency.HighFrequency import HighFrequency from HighFrequency.Discrim...
[ "torch.utils.tensorboard.SummaryWriter", "HighFrequency.HighFrequency.HighFrequency", "torch.split", "torch.optim.lr_scheduler.LambdaLR", "HighFrequency.Vizualise.plotState", "HighFrequency.Discriminator.Discriminator", "HighFrequency.LossFunction.LossFunction", "torch.cuda.is_available", "numpy.cos...
[((2043, 2083), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', ([], {'log_dir': "('runs/' + runName)"}), "(log_dir='runs/' + runName)\n", (2056, 2083), False, 'from torch.utils.tensorboard import SummaryWriter\n'), ((2090, 2115), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2113, ...
""" Compute the entropy in bits of a list of probabilities. """ import numpy as np def entropy(ps): """ Compute the entropy in bits of a list of probabilities. The input list of probabilities must sum to one and no element should be larger than 1 or less than 0. :param list ps: list of probabil...
[ "numpy.sum", "numpy.log2", "numpy.isnan" ]
[((665, 676), 'numpy.log2', 'np.log2', (['ps'], {}), '(ps)\n', (672, 676), True, 'import numpy as np\n'), ((730, 744), 'numpy.isnan', 'np.isnan', (['item'], {}), '(item)\n', (738, 744), True, 'import numpy as np\n'), ((522, 532), 'numpy.sum', 'np.sum', (['ps'], {}), '(ps)\n', (528, 532), True, 'import numpy as np\n'), ...
# -*- coding: utf-8 -*- """ Created on Tue Feb 23 15:29:41 2021. @author: pielsticker """ import numpy as np import h5py from sklearn.utils import shuffle import seaborn as sns import matplotlib.pyplot as plt import matplotlib.colors as mcolors from .utils import ClassDistribution, SpectraPlot #%% class DataHandle...
[ "numpy.dstack", "numpy.mean", "numpy.hstack", "numpy.where", "sklearn.utils.shuffle", "numpy.argmax", "numpy.min", "h5py.File", "numpy.max", "numpy.array", "numpy.random.randint", "matplotlib.colors.CSS4_COLORS.keys", "numpy.random.seed", "numpy.around", "numpy.std", "matplotlib.pyplot...
[((40394, 40413), 'numpy.random.seed', 'np.random.seed', (['(502)'], {}), '(502)\n', (40408, 40413), True, 'import numpy as np\n'), ((22610, 22624), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (22618, 22624), True, 'import numpy as np\n'), ((30068, 30143), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {...
import os import cv2 import queue import random import threading import face_recognition import numpy as np from sklearn import svm import joblib q = queue.Queue() # 加载人脸图片并进行编码 def Encode(): print("Start Encoding") image_path = 'C:\\Users\\Administrator\\Desktop\\face_recognition-master\\examples\\knn_exam...
[ "cv2.rectangle", "face_recognition.face_locations", "os.listdir", "cv2.resize", "cv2.imshow", "cv2.putText", "cv2.waitKey", "face_recognition.face_encodings", "cv2.VideoCapture", "face_recognition.load_image_file", "joblib.load", "threading.Thread", "queue.Queue", "numpy.load", "joblib.d...
[((152, 165), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (163, 165), False, 'import queue\n'), ((352, 374), 'os.listdir', 'os.listdir', (['image_path'], {}), '(image_path)\n', (362, 374), False, 'import os\n'), ((1109, 1130), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (1119, 1130), False, 'i...
from numpy import array, compress, zeros import wx from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin from spacq.interface.list_columns import ListParser """ Embeddable, generic, virtual, tabular display. """ class VirtualListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin): """ A generic virtual list. """ ma...
[ "wx.BoxSizer", "wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin.__init__", "spacq.interface.list_columns.ListParser", "numpy.array", "wx.ListCtrl.__init__", "wx.Frame.__init__", "wx.Panel.__init__" ]
[((738, 860), 'wx.ListCtrl.__init__', 'wx.ListCtrl.__init__', (['self', 'parent', '*args'], {'style': '(wx.LC_REPORT | wx.LC_VIRTUAL | wx.LC_HRULES | wx.LC_VRULES)'}), '(self, parent, *args, style=wx.LC_REPORT | wx.\n LC_VIRTUAL | wx.LC_HRULES | wx.LC_VRULES, **kwargs)\n', (758, 860), False, 'import wx\n'), ((861, 8...
from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import torch as th from gym import spaces from stable_baselines3.common.buffers import BaseBuffer from stable_baselines3.common.preprocessing import get_obs_shape from stable_baselines3.common.type_aliases import EpisodicRolloutBufferSample...
[ "numpy.ones", "numpy.arange", "numpy.exp", "numpy.sum", "numpy.zeros", "stable_baselines3.common.preprocessing.get_obs_shape" ]
[((2994, 3031), 'stable_baselines3.common.preprocessing.get_obs_shape', 'get_obs_shape', (['self.observation_space'], {}), '(self.observation_space)\n', (3007, 3031), False, 'from stable_baselines3.common.preprocessing import get_obs_shape\n'), ((3193, 3235), 'numpy.zeros', 'np.zeros', (['self.nb_rollouts'], {'dtype': ...
#%% import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix from sklearn import preprocessing import random #%% df_train = pd.read_csv("data/train_ohe.csv") df_val = pd.read_csv("data/validation_ohe.csv") df_test = pd.read_csv("data/test_ohe.csv") print (df_train.click.va...
[ "sklearn.preprocessing.LabelEncoder", "sklearn.neural_network.MLPClassifier", "pandas.read_csv", "random.seed", "numpy.random.seed", "pandas.DataFrame", "pandas.concat", "sklearn.preprocessing.MinMaxScaler", "sklearn.metrics.confusion_matrix" ]
[((166, 199), 'pandas.read_csv', 'pd.read_csv', (['"""data/train_ohe.csv"""'], {}), "('data/train_ohe.csv')\n", (177, 199), True, 'import pandas as pd\n'), ((210, 248), 'pandas.read_csv', 'pd.read_csv', (['"""data/validation_ohe.csv"""'], {}), "('data/validation_ohe.csv')\n", (221, 248), True, 'import pandas as pd\n'),...
# -*- coding: utf-8 -*- # # Created on Tue Jan 16 09:32:22 2018 # # @author: hsauro # --------------------------------------------------------------------- # Plotting Utilities # --------------------------------------------------------------------- import tellurium as _te from mpl_toolkits.mplot3d import Axes3D as _...
[ "matplotlib.pyplot.grid", "teUtils.plotting.plotFluxControlIn3D", "matplotlib.pyplot.ylabel", "math.trunc", "matplotlib.pyplot.subplot2grid", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "teUtils.plotting.plotFluxControlHeatMap", "pandas.DataFrame", "numpy.meshgrid", "matplotlib.pyplot....
[((2939, 2983), 'matplotlib.pyplot.subplots', '_plt.subplots', (['ngrid', 'ngrid'], {'figsize': 'figsize'}), '(ngrid, ngrid, figsize=figsize)\n', (2952, 2983), True, 'import matplotlib.pyplot as _plt\n'), ((4915, 4951), 'matplotlib.pyplot.subplots', '_plt.subplots', (['n', 'n'], {'figsize': 'figsize'}), '(n, n, figsize...
import numpy as np def solution(N): shape=(N+1,N+1) steps = np.zeros(shape,int) steps[3][2] = steps[4][2] = 1 for y in range (5, N+1) : steps[y][2] = steps[y-2][2] + 1 for x in range (3, y + 1) : steps[y][x] = steps[y-x][x-1] ...
[ "numpy.sum", "numpy.zeros" ]
[((70, 90), 'numpy.zeros', 'np.zeros', (['shape', 'int'], {}), '(shape, int)\n', (78, 90), True, 'import numpy as np\n'), ((404, 420), 'numpy.sum', 'np.sum', (['steps[N]'], {}), '(steps[N])\n', (410, 420), True, 'import numpy as np\n')]
""" Tests shared for DatetimeIndex/TimedeltaIndex/PeriodIndex """ from datetime import datetime, timedelta import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, DatetimeIndex, Index, PeriodIndex, TimedeltaIndex, date_range, period_range...
[ "pandas.Series", "datetime.datetime", "pandas.DatetimeIndex", "datetime.timedelta", "pandas.Index", "pytest.mark.parametrize", "pandas._testing.assert_numpy_array_equal", "pandas.period_range", "pandas.PeriodIndex", "numpy.timedelta64", "pandas.TimedeltaIndex", "pandas.CategoricalIndex", "pa...
[((1516, 1559), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""freq"""', "['D', 'M']"], {}), "('freq', ['D', 'M'])\n", (1539, 1559), False, 'import pytest\n'), ((4712, 4755), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""freq"""', "['B', 'C']"], {}), "('freq', ['B', 'C'])\n", (4735, 4755), Fa...
import numpy as np from sklearn import model_selection from sklearn.metrics import confusion_matrix, mean_squared_error from sklearn import metrics from sklearn import model_selection, metrics #Additional sklearn functions from sklearn.metrics import accuracy_score,f1_score,roc_auc_score,log_loss from sklearn.metrics...
[ "numpy.mean", "sklearn.metrics.f1_score", "sklearn.metrics.median_absolute_error", "sklearn.metrics.mean_squared_error", "sklearn.metrics.roc_auc_score", "numpy.errstate", "numpy.lexsort", "sklearn.metrics.log_loss", "numpy.isnan", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score...
[((1194, 1255), 'sklearn.metrics.confusion_matrix', 'confusion_matrix', (['y_true', 'y_pred'], {'sample_weight': 'sample_weight'}), '(y_true, y_pred, sample_weight=sample_weight)\n', (1210, 1255), False, 'from sklearn.metrics import confusion_matrix\n'), ((1523, 1541), 'numpy.mean', 'np.mean', (['per_class'], {}), '(pe...
"""File containing links to data samples used (pointsource tracks). Path to local copy of point source tracks, downloaded from /data/ana .. /current with following README: This directory contains an update to version-002p02 which fixes the leap second bug for event MJDs in runs 120398 to 126377, inclusive. ...
[ "logging.getLogger", "flarestack.data.icecube.ic_season.IceCubeDataset", "numpy.radians", "flarestack.data.icecube.ps_tracks.get_ps_binning" ]
[((3990, 4017), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (4007, 4017), False, 'import logging\n'), ((4134, 4150), 'flarestack.data.icecube.ic_season.IceCubeDataset', 'IceCubeDataset', ([], {}), '()\n', (4148, 4150), False, 'from flarestack.data.icecube.ic_season import IceCubeDatase...
import collections import openmlpimp from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \ UniformIntegerHyperparameter, CategoricalHyperparameter from scipy.stats import gaussian_kde from sklearn.model_selection._search import BaseSearchCV from sklearn.model_selection._search import ParameterSam...
[ "sklearn.utils.validation.indexable", "math.ceil", "sklearn.externals.joblib.delayed", "numpy.average", "sklearn.base.clone", "sklearn.base.is_classifier", "numpy.flatnonzero", "sklearn.model_selection._search.ParameterSampler", "numpy.argsort", "numpy.array", "sklearn.utils.resample", "sklear...
[((1016, 1037), 'sklearn.base.clone', 'clone', (['self.estimator'], {}), '(self.estimator)\n', (1021, 1037), False, 'from sklearn.base import is_classifier, clone\n'), ((3683, 3736), 'numpy.array', 'np.array', (['test_sample_counts[:n_splits]'], {'dtype': 'np.int'}), '(test_sample_counts[:n_splits], dtype=np.int)\n', (...
import torch import torch.nn as nn import torch.nn.functional as F import math import numpy as np import scipy.ndimage from config import config class FlawDetector(nn.Module): """ The FC Discriminator proposed in paper: 'Guided Collaborative Training for Pixel-wise Semi-Supervised Learning' """ n...
[ "numpy.clip", "torch.nn.functional.mse_loss", "torch.nn.LeakyReLU", "math.floor", "torch.mean", "torch.nn.ReflectionPad2d", "torch.from_numpy", "torch.nn.InstanceNorm2d", "torch.nn.Conv2d", "numpy.exp", "numpy.zeros", "torch.nn.MaxPool2d", "torch.sum", "torch.nn.functional.interpolate", ...
[((478, 546), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'self.ndf'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(in_channels, self.ndf, kernel_size=4, stride=2, padding=1)\n', (487, 546), True, 'import torch.nn as nn\n'), ((628, 697), 'torch.nn.Conv2d', 'nn.Conv2d', (['self.ndf', '(self.ndf * 2...
""" Decoding module for a neural speaker (with attention capabilities). The MIT License (MIT) Originally created at 06/15/19, for Python 3.x Copyright (c) 2021 <NAME> (ai.stanford.edu/~optas) & Stanford Geometric Computing Lab """ import torch import random import time import warnings import tqdm import math import n...
[ "torch.nn.Dropout", "torch.LongTensor", "torch.exp", "numpy.argsort", "torch.log2", "numpy.array", "torch.softmax", "torch.sum", "torch.repeat_interleave", "torch.arange", "torch.nn.Sigmoid", "torch.unsqueeze", "torch.nn.Identity", "torch.zeros_like", "torch.argmax", "torch.nn.utils.rn...
[((14065, 14080), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (14078, 14080), False, 'import torch\n'), ((15238, 15253), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (15251, 15253), False, 'import torch\n'), ((16902, 16917), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (16915, 16917), False, 'impo...
import numpy as np from PIL import Image from typing import Tuple SQUARE_COLOR = (255, 0, 0, 255) # Let's make a red square ICON_SIZE = (512, 512) # The recommended minimum size from WordPress def generate_pixels(resolution: Tuple[int, int]) -> np.ndarray: """Generate pixels of an image with the provi...
[ "numpy.array", "PIL.Image.fromarray" ]
[((657, 689), 'numpy.array', 'np.array', (['pixels'], {'dtype': 'np.uint8'}), '(pixels, dtype=np.uint8)\n', (665, 689), True, 'import numpy as np\n'), ((969, 996), 'PIL.Image.fromarray', 'Image.fromarray', (['img_pixels'], {}), '(img_pixels)\n', (984, 996), False, 'from PIL import Image\n')]
import os from reinforcement_learning.crypto_market.comitee_trader_agent import ComiteeTraderAgent from reinforcement_learning.crypto_market.crypto_trader_agent import CryptoTraderAgent import sys sys.path.insert(0, '../../../etf_data') from etf_data_loader import load_all_data_from_file2 import numpy as np import ...
[ "sys.path.insert", "matplotlib.pyplot.plot", "numpy.warnings.filterwarnings", "reinforcement_learning.crypto_market.comitee_trader_agent.ComiteeTraderAgent", "etf_data_loader.load_all_data_from_file2", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((200, 239), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../../etf_data"""'], {}), "(0, '../../../etf_data')\n", (215, 239), False, 'import sys\n'), ((503, 588), 'etf_data_loader.load_all_data_from_file2', 'load_all_data_from_file2', (["(prefix + 'etf_data_adj_close.csv')", 'start_date', 'end_date'], {}), "(...
import threading import numpy as np import SimpleITK as sitk class NiftiGenerator2D_ExtraInput(object): def __init__(self, batch_size, image_locations, labels, image_size, extra_inputs, random_shuffle=True): self.n = len(image_locations) self.batch_size = batch_size self....
[ "threading.Lock", "SimpleITK.GetArrayFromImage", "numpy.zeros", "numpy.concatenate", "SimpleITK.ReadImage", "numpy.arange", "numpy.random.permutation" ]
[((392, 408), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (406, 408), False, 'import threading\n'), ((2264, 2334), 'numpy.zeros', 'np.zeros', (['(self.batch_size, self.image_size[0], self.image_size[1], 1)'], {}), '((self.batch_size, self.image_size[0], self.image_size[1], 1))\n', (2272, 2334), True, 'import ...
import control as c from control.xferfcn import clean_tf from control.statesp import clean_ss from control.timeresp import fival import numpy as np ci = 2 / np.sqrt(13) w = np.sqrt(13) Kq = -24 T02 = 1.4 V = 160 s = c.tf([1, 0], [1]) Hq = Kq * (1 + T02 * s) / (s ** 2 + 2 * ci * w * s + w ** 2) Htheta = Hq / s Hgamma =...
[ "control.timeresp.fival", "numpy.sqrt", "control.ss", "numpy.array", "control.tf" ]
[((174, 185), 'numpy.sqrt', 'np.sqrt', (['(13)'], {}), '(13)\n', (181, 185), True, 'import numpy as np\n'), ((217, 234), 'control.tf', 'c.tf', (['[1, 0]', '[1]'], {}), '([1, 0], [1])\n', (221, 234), True, 'import control as c\n'), ((389, 537), 'control.tf', 'c.tf', (['[[Hq.num[0][0], Htheta.num[0][0]], [Hgamma.num[0][0...
"""Replacement r2_score function for when sklearn is not available.""" import numpy as np #=============================================================================== # BSD 3-Clause License # Copyright (c) 2007-2021 The scikit-learn developers. # All rights reserved. # Redistribution and use in source and binary...
[ "numpy.ones", "numpy.average" ]
[((3741, 3767), 'numpy.ones', 'np.ones', (['[y_true.shape[1]]'], {}), '([y_true.shape[1]])\n', (3748, 3767), True, 'import numpy as np\n'), ((4103, 4128), 'numpy.average', 'np.average', (['output_scores'], {}), '(output_scores)\n', (4113, 4128), True, 'import numpy as np\n'), ((3516, 3542), 'numpy.average', 'np.average...
import numpy as np import random from sklearn.model_selection import train_test_split one_hot_conv = {"A": [1, 0, 0, 0], "T": [0, 0, 0, 1], "C": [0, 1, 0, 0], "G": [0, 0, 1, 0], "a": [1, 0, 0, 0], "t": [0, 0, 0, 1], "c": [0, 1, 0, 0], "g": [0, 0, 1, 0], "n...
[ "gzip.open", "numpy.array", "numpy.zeros", "numpy.random.randint", "random.randint" ]
[((552, 572), 'numpy.zeros', 'np.zeros', (['inpt.shape'], {}), '(inpt.shape)\n', (560, 572), True, 'import numpy as np\n'), ((587, 633), 'random.randint', 'random.randint', (['(len_seq - random_seed)', 'len_seq'], {}), '(len_seq - random_seed, len_seq)\n', (601, 633), False, 'import random\n'), ((896, 941), 'numpy.rand...
import numpy as np import matplotlib.pyplot as plt # 常量 pi = 3.1415926 # 声波属性 A = 0.01 u = 343 v = 40000 _lambda = u / v w = 2 * pi * v k = 2 * pi / _lambda T = 2 * pi / w rho = 1.293 # 悬浮物件的尺度 R = 0.005 # 两点换算为距离 def r(x0, y0, x1=0, y1=0): return np.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) # 波运算函数 def wave(x1...
[ "matplotlib.pyplot.contourf", "matplotlib.pyplot.quiver", "numpy.abs", "numpy.sqrt", "matplotlib.pyplot.colorbar", "numpy.square", "numpy.zeros", "numpy.cos", "numpy.sin", "matplotlib.pyplot.title", "numpy.gradient", "matplotlib.pyplot.show" ]
[((762, 780), 'numpy.zeros', 'np.zeros', (['(_W, _L)'], {}), '((_W, _L))\n', (770, 780), True, 'import numpy as np\n'), ((2273, 2291), 'numpy.sqrt', 'np.sqrt', (['array_p_2'], {}), '(array_p_2)\n', (2280, 2291), True, 'import numpy as np\n'), ((2415, 2435), 'numpy.gradient', 'np.gradient', (['array_U'], {}), '(array_U)...
# -*- coding: utf-8 -*- """DecisionTreeClassifier(Telco Dataset).ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1lSnAsYluPfeTR_sbPvf5qGcz1wBwhRNW """ import pandas as pd import numpy as np from google.colab import files uploaded = files.upload()...
[ "pandas.read_csv", "sklearn.model_selection.train_test_split", "sklearn.tree.DecisionTreeClassifier", "google.colab.files.upload", "pandas.set_option", "sklearn.tree.export_graphviz", "numpy.printoptions", "sklearn.externals.six.StringIO", "sklearn.metrics.accuracy_score", "sklearn.metrics.confusi...
[((306, 320), 'google.colab.files.upload', 'files.upload', ([], {}), '()\n', (318, 320), False, 'from google.colab import files\n'), ((332, 400), 'pandas.read_csv', 'pd.read_csv', (['"""WA_Fn-UseC_-Telco-Customer-Churn.csv"""'], {'index_col': '(False)'}), "('WA_Fn-UseC_-Telco-Customer-Churn.csv', index_col=False)\n", (...
# Authors: <NAME> <<EMAIL>> # <NAME> <<EMAIL>> # # License: BSD (3-clause) import math import numpy as np from scipy import linalg from scipy.fftpack import fft, ifft import six def _framing(a, L): shape = a.shape[:-1] + (a.shape[-1] - L + 1, L) strides = a.strides + (a.strides[-1],) return np.l...
[ "numpy.reshape", "scipy.fftpack.ifft", "numpy.asarray", "math.sqrt", "numpy.lib.stride_tricks.as_strided", "numpy.exp", "numpy.real", "numpy.zeros", "numpy.count_nonzero", "scipy.fftpack.fft", "numpy.cos", "scipy.linalg.norm", "numpy.sin", "numpy.arange" ]
[((529, 547), 'math.sqrt', 'math.sqrt', (['(2.0 / K)'], {}), '(2.0 / K)\n', (538, 547), False, 'import math\n'), ((664, 696), 'numpy.arange', 'np.arange', (['scale'], {'dtype': 'np.float'}), '(scale, dtype=np.float)\n', (673, 696), True, 'import numpy as np\n'), ((1305, 1334), 'numpy.asarray', 'np.asarray', (['x'], {'d...
from __future__ import absolute_import, division, print_function from __future__ import unicode_literals """Auxilary functions for group representations""" import numpy as np def sgn(s): """return (-1)**(s)""" return 1 - ((s & 1) << 1) def zero_vector(length, *data): """Return zero numpy vector of g...
[ "numpy.zeros" ]
[((364, 396), 'numpy.zeros', 'np.zeros', (['length'], {'dtype': 'np.int32'}), '(length, dtype=np.int32)\n', (372, 396), True, 'import numpy as np\n'), ((717, 749), 'numpy.zeros', 'np.zeros', (['(l, l)'], {'dtype': 'np.int32'}), '((l, l), dtype=np.int32)\n', (725, 749), True, 'import numpy as np\n'), ((1142, 1174), 'num...
from keras.models import Sequential, load_model from keras.layers import MaxPool2D, Flatten, Dense, Dropout, BatchNormalization from keras.losses import SparseCategoricalCrossentropy from keras.optimizers import RMSprop, Adam from keras.metrics import SparseCategoricalAccuracy import matplotlib.pyplot as plt import num...
[ "keras.optimizers.Adam", "keras.layers.Flatten", "keras.losses.SparseCategoricalCrossentropy", "numpy.argmax", "keras.models.Sequential", "keras.layers.Dense", "keras.layers.BatchNormalization", "keras.layers.Dropout", "matplotlib.pyplot.subplots", "keras.metrics.SparseCategoricalAccuracy", "mat...
[((470, 482), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (480, 482), False, 'from keras.models import Sequential, load_model\n'), ((3333, 3359), 'numpy.argmax', 'np.argmax', (['y_pred1'], {'axis': '(1)'}), '(y_pred1, axis=1)\n', (3342, 3359), True, 'import numpy as np\n'), ((3652, 3682), 'matplotlib.pyp...
## import os import numpy as np import argparse import shutil import torch import torch.nn as nn import torch.nn.functional as F from torch import optim import torch.utils.data as data_utils from dataset import Polygon3DSample from network import ImplicitNet, LossFunction from common_tools.utils import read_json, dra...
[ "common_tools.geometry.write_obj_file", "common_tools.utils.read_json", "torch.exp", "torch.cuda.is_available", "torch.sum", "os.path.exists", "argparse.ArgumentParser", "torch.randn", "torch.ones_like", "os.path.isfile", "torch.autograd.grad", "time.time", "network.ImplicitNet", "torch.ca...
[((2201, 2270), 'numpy.sum', 'np.sum', (['((np_points[:, None, :] - np_points[None, :, :]) ** 2)'], {'axis': '(-1)'}), '((np_points[:, None, :] - np_points[None, :, :]) ** 2, axis=-1)\n', (2207, 2270), True, 'import numpy as np\n'), ((2761, 2803), 'torch.exp', 'torch.exp', (['(-knn_sqdist * inv_sigma_spatial)'], {}), '...
# -*- coding: utf-8 -*- """ Created on Sat Jan 19 13:15:14 2019 @author: HP """ import cv2 import numpy as np from flask import Flask,render_template import json app= Flask(__name__) @app.route('/') def hello(): return render_template('index.html') hand_hist = None traverse_point = [] total_rectangle = 9 hand...
[ "flask.render_template", "cv2.rectangle", "cv2.normalize", "flask.Flask", "cv2.filter2D", "cv2.convexityDefects", "numpy.array", "cv2.destroyAllWindows", "cv2.calcHist", "cv2.calcBackProject", "cv2.threshold", "json.dumps", "cv2.contourArea", "cv2.waitKey", "cv2.add", "cv2.merge", "n...
[((170, 185), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (175, 185), False, 'from flask import Flask, render_template\n'), ((227, 256), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (242, 256), False, 'from flask import Flask, render_template\n'), ((574, 63...
from pathlib import Path from tempfile import TemporaryDirectory import numpy as np import torch from agent import DqnAgent from model import DqnModel from replay_buffer import ReplayBuffer from strategy import EpsilonGreedyStrategy from torch import nn import pytest BATCH_SIZE = 5 @pytest.fixture def agent(): ...
[ "tempfile.TemporaryDirectory", "model.DqnModel", "pathlib.Path", "replay_buffer.ReplayBuffer", "numpy.random.randint", "torch.nn.Linear", "strategy.EpsilonGreedyStrategy", "numpy.random.randn" ]
[((329, 345), 'torch.nn.Linear', 'nn.Linear', (['(10)', '(2)'], {}), '(10, 2)\n', (338, 345), False, 'from torch import nn\n'), ((359, 375), 'replay_buffer.ReplayBuffer', 'ReplayBuffer', (['(10)'], {}), '(10)\n', (371, 375), False, 'from replay_buffer import ReplayBuffer\n'), ((491, 522), 'numpy.random.randn', 'np.rand...
# Test the GalSim interface to a PixelMapCollection from __future__ import print_function import pixmappy import time import numpy as np import os import galsim def test_basic(): """Test basic operation of the GalSimWCS class """ # Check that building a GalSimWCS builds successfully and has some useful attrib...
[ "pixmappy.GalSimWCS", "galsim.config.ImportModules", "galsim.config.BuildWCS", "pickle.dumps", "numpy.testing.assert_allclose", "os.path.join", "numpy.testing.assert_raises", "galsim.PositionD", "numpy.array", "numpy.testing.assert_almost_equal", "pstats.Stats", "galsim.Image", "pickle.loads...
[((442, 453), 'time.time', 'time.time', ([], {}), '()\n', (451, 453), False, 'import time\n'), ((464, 542), 'pixmappy.GalSimWCS', 'pixmappy.GalSimWCS', ([], {'yaml_file': 'yaml_file', 'dir': 'input_dir', 'exp': 'exp', 'ccdnum': 'ccdnum'}), '(yaml_file=yaml_file, dir=input_dir, exp=exp, ccdnum=ccdnum)\n', (482, 542), Fa...
#%% First import numpy as np import json import os from numpy.lib.type_check import _asfarray_dispatcher import pandas as pd import requests from contextlib import closing import time from datetime import datetime import seaborn as sns from matplotlib import pyplot as plt abspath = os.path.abspath(__file__) dname = os...
[ "psycopg2.connect", "datetime.datetime.fromtimestamp", "numpy.unique", "pandas.DataFrame", "sqlalchemy.create_engine", "requests.get", "os.chdir", "os.path.dirname", "json.load", "numpy.array", "datetime.datetime.fromisoformat", "os.path.abspath", "json.dump" ]
[((284, 309), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (299, 309), False, 'import os\n'), ((318, 342), 'os.path.dirname', 'os.path.dirname', (['abspath'], {}), '(abspath)\n', (333, 342), False, 'import os\n'), ((343, 358), 'os.chdir', 'os.chdir', (['dname'], {}), '(dname)\n', (351, 358)...
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import shutil import math from glob import glob import cv2 import random import copy import numpy as np import imageio from skimage import measure import logging import subproc...
[ "numpy.clip", "logging.warn", "cv2.imencode", "subprocess.check_call", "cv2.erode", "os.path.join", "os.path.dirname", "numpy.zeros", "cv2.cvtColor", "cv2.dilate", "cv2.imread", "os.remove" ]
[((392, 418), 'os.path.join', 'os.path.join', (['ROOT', '"""data"""'], {}), "(ROOT, 'data')\n", (404, 418), False, 'import os\n'), ((2078, 2134), 'logging.warn', 'logging.warn', (['"""Importing images into PicPac database..."""'], {}), "('Importing images into PicPac database...')\n", (2090, 2134), False, 'import loggi...
import pyqtgraph as pg import numpy as np x = np.arange(1000) y = np.random.normal(size=(3, 1000)) plotWidget = pg.plot(title="Three plot curves") for i in range(3): plotWidget.plot(x, y[i], pen=(i,3)) ## setting pen=(i,3) automaticaly creates three different-colored pens
[ "numpy.random.normal", "pyqtgraph.plot", "numpy.arange" ]
[((46, 61), 'numpy.arange', 'np.arange', (['(1000)'], {}), '(1000)\n', (55, 61), True, 'import numpy as np\n'), ((66, 98), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(3, 1000)'}), '(size=(3, 1000))\n', (82, 98), True, 'import numpy as np\n'), ((112, 146), 'pyqtgraph.plot', 'pg.plot', ([], {'title': '"""T...
from easydict import EasyDict as edict import numpy as np import torch.nn as nn __C = edict() cfg = __C ### Define config flags here ### Some flags are dummy, would be removed later ### Name of the config __C.TAG = 'default' ### Training and validation __C.GT_DEPTH_DIR = None __C.TRAIN_SIZE = [256,512] __C...
[ "ast.literal_eval", "easydict.EasyDict", "numpy.array", "yaml.load" ]
[((87, 94), 'easydict.EasyDict', 'edict', ([], {}), '()\n', (92, 94), True, 'from easydict import EasyDict as edict\n'), ((5708, 5720), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (5717, 5720), False, 'import yaml\n'), ((7209, 7224), 'ast.literal_eval', 'literal_eval', (['v'], {}), '(v)\n', (7221, 7224), False, 'fr...
#!/usr/bin/env python3.5 import time e = time.time() import sys debug = False fileWrite = True if fileWrite: fWPath = "processed/" + sys.argv[1] + "-processed.jpg" displayProcessed = False import cv2 import numpy as np import pickle if debug: print ("imports: " + str(format(time.time() - e, '.5f'))) star...
[ "numpy.int32", "cv2.imshow", "numpy.array", "cv2.approxPolyDP", "cv2.destroyAllWindows", "cv2.contourArea", "cv2.waitKey", "cv2.add", "cv2.drawContours", "cv2.circle", "cv2.moments", "cv2.cvtColor", "cv2.resize", "cv2.GaussianBlur", "time.time", "cv2.imread", "cv2.convexHull", "cv2...
[((41, 52), 'time.time', 'time.time', ([], {}), '()\n', (50, 52), False, 'import time\n'), ((1569, 1664), 'cv2.imread', 'cv2.imread', (["('/home/solomon/frc/the-deal/pythonCV/RealFullField/' + sys.argv[1] + '.jpg')", '(1)'], {}), "('/home/solomon/frc/the-deal/pythonCV/RealFullField/' + sys.argv[\n 1] + '.jpg', 1)\n"...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest from cleverhans.attacks import Attack class TestAttackClassInitArguments(unittest.TestCase): def test_model(self): import tensorflow as tf ...
[ "tensorflow.Session", "tensorflow.placeholder", "numpy.asarray", "numpy.zeros", "unittest.main", "cleverhans.attacks.Attack" ]
[((2545, 2560), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2558, 2560), False, 'import unittest\n'), ((335, 347), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (345, 347), True, 'import tensorflow as tf\n'), ((1440, 1452), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (1450, 1452), True, 'impo...
# -*- coding: utf-8 -*- import numpy as np def solver_constrained_newton(f, x0, maxiter=10000, tol=1e-6, delta_step=0.9999, max_step=1.0, print_frequency=None): delta_step = 0.9999 control_value = 10**-200 x = x0.cop...
[ "numpy.abs", "numpy.linalg.solve", "numpy.min" ]
[((928, 941), 'numpy.min', 'np.min', (['step_'], {}), '(step_)\n', (934, 941), True, 'import numpy as np\n'), ((468, 494), 'numpy.linalg.solve', 'np.linalg.solve', (['jac', '(-res)'], {}), '(jac, -res)\n', (483, 494), True, 'import numpy as np\n'), ((671, 686), 'numpy.abs', 'np.abs', (['delta_x'], {}), '(delta_x)\n', (...
from keras.models import load_model import pandas as pd import numpy as np from sklearn.model_selection import KFold import pickle as pk import os from keras.utils import to_categorical ,Sequence import pandas as pd from sklearn.metrics import accuracy_score pd.options.mode.chained_assignment = None # default='...
[ "os.path.exists", "pandas.read_csv", "numpy.argmax", "os.mkdir", "pandas.DataFrame", "numpy.load", "sklearn.metrics.accuracy_score" ]
[((379, 414), 'pandas.read_csv', 'pd.read_csv', (['"""data/train_label.csv"""'], {}), "('data/train_label.csv')\n", (390, 414), True, 'import pandas as pd\n'), ((582, 610), 'os.path.exists', 'os.path.exists', (['predict_path'], {}), '(predict_path)\n', (596, 610), False, 'import os\n'), ((616, 638), 'os.mkdir', 'os.mkd...
""" Random walker segmentation algorithm from *Random walks for image segmentation*, <NAME>, IEEE Trans Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83. This code is mostly adapted from scikit-image 0.11.3 release. Location of file in scikit image: random_walker function and its supporting sub functions in skimage....
[ "numpy.hstack", "numpy.logical_not", "numpy.array", "numpy.arange", "numpy.asarray", "numpy.diff", "numpy.exp", "scipy.sparse.coo_matrix", "warnings.warn", "scipy.sparse.csr_matrix", "numpy.abs", "numpy.argmax", "numpy.any", "numpy.copy", "sklearn.utils.as_float_array", "numpy.unique",...
[((1475, 1523), 'numpy.hstack', 'np.hstack', (['(edges_deep, edges_right, edges_down)'], {}), '((edges_deep, edges_right, edges_down))\n', (1484, 1523), True, 'import numpy as np\n'), ((2049, 2067), 'numpy.exp', 'np.exp', (['(-gradients)'], {}), '(-gradients)\n', (2055, 2067), True, 'import numpy as np\n'), ((2537, 255...
from scipy import signal import numpy as np import pyqtgraph # Create the data fs = 10e3 N = 1e5 amp = 2 * np.sqrt(2) # noise_power = 0.01 * fs / 2 time = np.arange(N) / float(fs) mod = 500*np.cos(2*np.pi*0.25*time) carrier = amp * np.sin(2*np.pi*3e3*time + mod) # noise = np.random.normal(scale=np.sqrt(noise_power), s...
[ "pyqtgraph.Qt.QtGui.QApplication.instance", "numpy.sqrt", "scipy.signal.spectrogram", "pyqtgraph.HistogramLUTItem", "pyqtgraph.ImageItem", "numpy.min", "numpy.size", "pyqtgraph.setConfigOptions", "numpy.max", "pyqtgraph.mkQApp", "numpy.cos", "pyqtgraph.GraphicsLayoutWidget", "numpy.sin", "...
[((490, 521), 'scipy.signal.spectrogram', 'signal.spectrogram', (['carrier', 'fs'], {}), '(carrier, fs)\n', (508, 521), False, 'from scipy import signal\n'), ((580, 634), 'pyqtgraph.setConfigOptions', 'pyqtgraph.setConfigOptions', ([], {'imageAxisOrder': '"""row-major"""'}), "(imageAxisOrder='row-major')\n", (606, 634)...
import random import numpy as np import torch def set_seed(seed): random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) def cuda_if(torch_object, cuda): return torch_object.cuda() if cuda else torch_object def gae(rewards, masks, values, gamma, lambd): """ Generalized Advantage Estimatio...
[ "torch.manual_seed", "torch.zeros", "numpy.random.seed", "random.seed" ]
[((71, 88), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (82, 88), False, 'import random\n'), ((93, 113), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (107, 113), True, 'import numpy as np\n'), ((118, 141), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (135, 14...
import numpy as np def split(dataset, splits_p): splits = len(dataset)*np.array(splits_p) splits = [int(p) for p in list(splits)] return splits
[ "numpy.array" ]
[((76, 94), 'numpy.array', 'np.array', (['splits_p'], {}), '(splits_p)\n', (84, 94), True, 'import numpy as np\n')]
import gym import torch from collections import deque import numpy as np from torch.utils.tensorboard import SummaryWriter from ppo import PPOAgent from pathlib import Path from datetime import datetime import utils # create environment env = gym.make("Pendulum-v0") # set random seeds seed = 123456 torch.manual_seed...
[ "torch.manual_seed", "numpy.mean", "collections.deque", "pathlib.Path", "torch.tensor", "numpy.random.seed", "ppo.PPOAgent", "gym.make", "utils.load_agent" ]
[((245, 268), 'gym.make', 'gym.make', (['"""Pendulum-v0"""'], {}), "('Pendulum-v0')\n", (253, 268), False, 'import gym\n'), ((303, 326), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (320, 326), False, 'import torch\n'), ((342, 362), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)...
import os import abc import cv2 import numpy as np import tensorflow as tf class TFRecordGenerator(abc.ABC): def __init__(self, tfrecord_path, labels, dir_paths=None, file_paths=None): # tfrecord_path : record tfrecord_path # dir_paths : dir paths of different image sources # labels ...
[ "tensorflow.data.TFRecordDataset", "os.listdir", "tensorflow.io.parse_single_example", "tensorflow.compat.v1.data.make_one_shot_iterator", "tensorflow.io.TFRecordWriter", "os.path.join", "tensorflow.train.Features", "tensorflow.io.FixedLenFeature", "tensorflow.train.FloatList", "os.path.abspath", ...
[((3902, 3932), 'os.path.abspath', 'os.path.abspath', (['tfrecord_path'], {}), '(tfrecord_path)\n', (3917, 3932), False, 'import os\n'), ((4202, 4247), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['[self.tfrecord_path]'], {}), '([self.tfrecord_path])\n', (4225, 4247), True, 'import tensorflow as tf\n...
# -*- coding: utf-8 -*- # NeuralCorefRes main # # Author: <NAME> <<EMAIL>> # # For license information, see LICENSE import argparse import gc import os import pprint import re import sys from itertools import zip_longest from typing import List import nltk import numpy as np from nltk.corpus import stopwords from nlt...
[ "neuralcorefres.model.coreference_network.CoreferenceNetwork.custom_cluster_to_nn_input", "neuralcorefres.parsedata.preco_parser.PreCoParser.get_preco_data", "neuralcorefres.parsedata.preco_parser.PreCoParser.prep_for_nn", "pprint.pprint", "neuralcorefres.model.cluster_network.ClusterNetwork", "neuralcore...
[((1168, 1190), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (1188, 1190), False, 'import pprint\n'), ((1804, 1822), 'neuralcorefres.feature_extraction.gender_classifier.GenderClassifier', 'GenderClassifier', ([], {}), '()\n', (1820, 1822), False, 'from neuralcorefres.feature_extraction.gender_clas...
import numpy as np import sys import random import os import time import argparse import glob import matplotlib.pyplot as plt from functools import partial try: from mayavi import mlab as mayalab except: pass np.random.seed(2) # from contact_point_dataset_torch_multi_label import MyDataset from hang_dataset impor...
[ "numpy.mean", "argparse.ArgumentParser", "numpy.std", "os.path.join", "simple_dataset.MyDataset", "numpy.max", "numpy.array", "numpy.random.seed", "numpy.expand_dims", "numpy.min", "os.path.abspath", "numpy.load", "sys.path.append" ]
[((213, 230), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (227, 230), True, 'import numpy as np\n'), ((455, 481), 'sys.path.append', 'sys.path.append', (['UTILS_DIR'], {}), '(UTILS_DIR)\n', (470, 481), False, 'import sys\n'), ((361, 386), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__...
"""Main script for controlling the calculation of the IS spectrum. Calculate spectra from specified parameters as shown in the examples given in the class methods, create a new set-up with the `Reproduce` abstract base class in `reproduce.py` or use one of the pre-defined classes from `reproduce.py`. """ # The start ...
[ "isr_spectrum.plotting.reproduce.PlotSpectra", "matplotlib.rcParams.update", "isr_spectrum.plotting.hello_kitty.HelloKitty", "isr_spectrum.plotting.plot_class.PlotClass", "numpy.ndarray", "multiprocessing.set_start_method", "matplotlib.pyplot.show" ]
[((652, 679), 'multiprocessing.set_start_method', 'mp.set_start_method', (['"""fork"""'], {}), "('fork')\n", (671, 679), True, 'import multiprocessing as mp\n'), ((1041, 1176), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'text.usetex': True, 'font.family': 'serif', 'axes.unicode_minus': False,\n ...
from __future__ import print_function import unittest import numpy as np from openmdao.api import Problem, IndepVarComp, Group from openmdao.utils.assert_utils import assert_check_partials from CADRE.orbit_dymos.ori_comp import ORIComp class TestOrbitEOM(unittest.TestCase): @classmethod def setUpClass(cls...
[ "CADRE.orbit_dymos.ori_comp.ORIComp", "numpy.random.rand", "numpy.ones", "openmdao.utils.assert_utils.assert_check_partials", "openmdao.api.IndepVarComp", "openmdao.api.Group", "numpy.set_printoptions" ]
[((1121, 1172), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(1024)', 'edgeitems': '(1000)'}), '(linewidth=1024, edgeitems=1000)\n', (1140, 1172), True, 'import numpy as np\n'), ((1230, 1256), 'openmdao.utils.assert_utils.assert_check_partials', 'assert_check_partials', (['cpd'], {}), '(cpd)\n',...
# Slightly modified from original Lucid library # Copyright 2018 The Lucid 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/license...
[ "string.Template", "base64.b64encode", "lucent.misc.io.collapse_channels.collapse_channels", "numpy.concatenate", "lucent.misc.io.serialize_array.serialize_array" ]
[((1795, 1858), 'lucent.misc.io.serialize_array.serialize_array', 'serialize_array', (['array'], {'fmt': 'fmt', 'quality': 'quality', 'domain': 'domain'}), '(array, fmt=fmt, quality=quality, domain=domain)\n', (1810, 1858), False, 'from lucent.misc.io.serialize_array import serialize_array, array_to_jsbuffer\n'), ((116...
from keras.utils import Sequence from keras.preprocessing.sequence import pad_sequences import numpy as np import json from multiprocessing import Pool class DataGenerator(Sequence): def __init__(self, filepaths: str, encoded_labels: dict, max_length: int, batch_size: int=32, shuffle: bool=True, mp: bool=True): ...
[ "json.load", "numpy.array", "multiprocessing.Pool", "numpy.random.shuffle" ]
[((345, 364), 'numpy.array', 'np.array', (['filepaths'], {}), '(filepaths)\n', (353, 364), True, 'import numpy as np\n'), ((824, 855), 'numpy.random.shuffle', 'np.random.shuffle', (['self.indexes'], {}), '(self.indexes)\n', (841, 855), True, 'import numpy as np\n'), ((1224, 1241), 'json.load', 'json.load', (['infile'],...
#!/usr/bin/env python import numpy as np import scipy.stats as stats import itertools import matplotlib from matplotlib import cm from matplotlib.ticker import FuncFormatter matplotlib.use("Agg") import matplotlib.pyplot as plt import sklearn as sk import sklearn.linear_model from volcanic.helpers import bround from ...
[ "numpy.clip", "matplotlib.cm.colors.Normalize", "volcanic.tof.calc_tof", "numpy.hstack", "matplotlib.pyplot.ylabel", "numpy.array", "numpy.arange", "numpy.mean", "matplotlib.ticker.FuncFormatter", "matplotlib.pyplot.xlabel", "numpy.sort", "itertools.product", "numpy.linspace", "numpy.vstac...
[((176, 197), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (190, 197), False, 'import matplotlib\n'), ((1549, 1565), 'numpy.zeros_like', 'np.zeros_like', (['d'], {}), '(d)\n', (1562, 1565), True, 'import numpy as np\n'), ((5379, 5404), 'numpy.hstack', 'np.hstack', (['(d_refill, d2)'], {}), '((d...
import numpy as np from dnnv.properties.expressions import * from dnnv.properties.visitors import DetailsInference def test_Image_symbolic(): inference = DetailsInference() expr = Image(Symbol("path")) inference.visit(expr) assert not inference.shapes[expr].is_concrete assert not inference.type...
[ "numpy.random.rand", "numpy.save", "dnnv.properties.visitors.DetailsInference" ]
[((161, 179), 'dnnv.properties.visitors.DetailsInference', 'DetailsInference', ([], {}), '()\n', (177, 179), False, 'from dnnv.properties.visitors import DetailsInference\n'), ((393, 411), 'dnnv.properties.visitors.DetailsInference', 'DetailsInference', ([], {}), '()\n', (409, 411), False, 'from dnnv.properties.visitor...
import tensorflow as tf import numpy as np import scipy.io # layers = [ # 'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1', # 'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2', # 'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2', # 'conv3_3', 'relu3_3', 'conv3_4', 'relu3_4', 'pool3', # ...
[ "tensorflow.nn.conv2d", "tensorflow.nn.max_pool", "tensorflow.variable_scope", "tensorflow.nn.relu", "tensorflow.Variable", "numpy.array", "numpy.transpose", "tensorflow.nn.bias_add" ]
[((1803, 1839), 'numpy.array', 'np.array', (['[123.68, 116.779, 103.939]'], {}), '([123.68, 116.779, 103.939])\n', (1811, 1839), True, 'import numpy as np\n'), ((1915, 1951), 'numpy.array', 'np.array', (['[123.68, 116.779, 103.939]'], {}), '([123.68, 116.779, 103.939])\n', (1923, 1951), True, 'import numpy as np\n'), (...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import pathlib import pickle import warnings from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Unio...
[ "numpy.prod", "torch.ones_like", "mbrl.util.lifelong_learning.separate_observations_and_task_ids", "torch.nn.functional.mse_loss", "torch.broadcast_to", "torch.no_grad", "torch.zeros_like", "gtimer.stamp", "torch.cat" ]
[((2833, 2898), 'mbrl.util.lifelong_learning.separate_observations_and_task_ids', 'separate_observations_and_task_ids', (['observations', 'self._num_tasks'], {}), '(observations, self._num_tasks)\n', (2867, 2898), False, 'from mbrl.util.lifelong_learning import separate_observations_and_task_ids\n'), ((3612, 3645), 'gt...
import numpy as np import cv2 mydata = {} def detectShape(c): shape = 'unknown' # calculate perimeter using peri = cv2.arcLength(c, True) # apply contour approximation and store the result in vertices vertices = cv2.approxPolyDP(c, 0.04 * peri, True) # If the shape it triangle...
[ "numpy.median", "cv2.drawContours", "cv2.arcLength", "cv2.minEnclosingCircle", "cv2.approxPolyDP", "cv2.cvtColor", "cv2.moments", "cv2.findContours", "cv2.Canny", "cv2.imread", "cv2.boundingRect" ]
[((141, 163), 'cv2.arcLength', 'cv2.arcLength', (['c', '(True)'], {}), '(c, True)\n', (154, 163), False, 'import cv2\n'), ((248, 286), 'cv2.approxPolyDP', 'cv2.approxPolyDP', (['c', '(0.04 * peri)', '(True)'], {}), '(c, 0.04 * peri, True)\n', (264, 286), False, 'import cv2\n'), ((1840, 1859), 'cv2.imread', 'cv2.imread'...
import warnings import argparse import torch import numpy as np from rich import print from constants import DPAC_ATT_CAT_COUNT from dataloader import load_data from models.base import MultiOutputModel # from loss import MultiTaskLoss_DPAC from sklearn.metrics import precision_score, f1_score, recall_score, accuracy_...
[ "sklearn.metrics.f1_score", "argparse.ArgumentParser", "models.base.MultiOutputModel", "torch.load", "warnings.catch_warnings", "numpy.asarray", "sklearn.metrics.precision_score", "sklearn.metrics.recall_score", "torch.cuda.is_available", "dataloader.load_data", "warnings.simplefilter", "torch...
[((3127, 3281), 'models.base.MultiOutputModel', 'MultiOutputModel', (['device'], {'n_age_cat': "DPAC_ATT_CAT_COUNT['age']", 'n_gender_cat': "DPAC_ATT_CAT_COUNT['gender']", 'n_emotion_cat': "DPAC_ATT_CAT_COUNT['emotion']"}), "(device, n_age_cat=DPAC_ATT_CAT_COUNT['age'], n_gender_cat=\n DPAC_ATT_CAT_COUNT['gender'], ...
# -*- coding: utf-8 -*- import sys, os sys.path.insert(0, os.path.abspath('..')) import ga, optimization, numpy, struct def binary(num): return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in struct.pack('!f', num)) class RastriginFloatIndividualFactory(ga.IndividualFactory): def __init__(self,...
[ "optimization.XSquareBinaryFitnessEvaluator", "numpy.put", "optimization.RastriginBinaryFitnessEvaluator", "optimization.XSquareFloatFitnessEvaluator", "optimization.XAbsoluteSquareFloatFitnessEvaluator", "optimization.SineXSquareRootFloatFitnessEvaluator", "optimization.SineXSquareRootBinaryFitnessEval...
[((1508, 1570), 'ga.IndividualFactory.register', 'ga.IndividualFactory.register', (['RastriginFloatIndividualFactory'], {}), '(RastriginFloatIndividualFactory)\n', (1537, 1570), False, 'import ga, optimization, numpy, struct\n'), ((2892, 2955), 'ga.IndividualFactory.register', 'ga.IndividualFactory.register', (['Rastri...
from pathlib import Path import numpy as np import pytest def pytest_addoption(parser): parser.addoption('--integration', action='store_true', default=False, dest='integration', help='enable integration tests') def pytest_collection_modifyitems(config, items): if not config.getoption('...
[ "numpy.log10", "pathlib.Path", "pytest.mark.skip", "numpy.ma.MaskedArray", "pytest.fixture", "numpy.load" ]
[((561, 592), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (575, 592), False, 'import pytest\n'), ((823, 854), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (837, 854), False, 'import pytest\n'), ((1039, 1070), 'pytest.fixtur...
""" polarAWB_noGT.py Copyright (c) 2022 Sony Group Corporation This software is released under the MIT License. http://opensource.org/licenses/mit-license.php """ import json from pathlib import Path import shutil import numpy as np from myutils.imageutils import MAX_16BIT, my_read_image, my_write_image, rgb_to_srgb...
[ "numpy.clip", "numpy.mean", "myutils.weighturils.rg_bg_sigmoid_weight_achromatic", "myutils.weighturils.rg_bg_sigmoid_weight_achromatic_phase", "pathlib.Path", "myutils.wbutils.polarAWB", "myutils.weighturils.valid_weight_fourPolar", "myutils.polarutils.calc_dolp_from_s0s1s2", "myutils.weighturils.r...
[((691, 734), 'shutil.copy', 'shutil.copy', (['"""parameters.json"""', 'result_path'], {}), "('parameters.json', result_path)\n", (702, 734), False, 'import shutil\n'), ((1374, 1431), 'myutils.polarutils.calc_s0s1s2_from_fourPolar', 'plutil.calc_s0s1s2_from_fourPolar', (['i000', 'i045', 'i090', 'i135'], {}), '(i000, i0...
from typing import Dict, List, Optional, Tuple import numpy as np import scipy import torch from tqdm import tqdm import datasets from fewie.data.datasets.generic.nway_kshot import NwayKshotDataset from fewie.encoders.encoder import Encoder from fewie.evaluation.classifiers.classifier import Classifier from fewie.eva...
[ "numpy.mean", "scipy.stats.t._ppf", "tqdm.tqdm", "numpy.array", "scipy.stats.sem", "numpy.concatenate", "torch.utils.data.DataLoader", "torch.no_grad", "fewie.evaluation.utils.get_metric" ]
[((929, 943), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (937, 943), True, 'import numpy as np\n'), ((4441, 4474), 'numpy.concatenate', 'np.concatenate', (['X_support'], {'axis': '(0)'}), '(X_support, axis=0)\n', (4455, 4474), True, 'import numpy as np\n'), ((4491, 4510), 'numpy.array', 'np.array', (['y_sup...
# This code is part of Qiskit. # # (C) Copyright IBM 2018, 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
[ "qiskit.ClassicalRegister", "numpy.sqrt", "qiskit.providers.aer.extensions.snapshot.Snapshot", "numpy.array", "qiskit.QuantumCircuit", "qiskit.QuantumRegister" ]
[((1084, 1111), 'qiskit.QuantumRegister', 'QuantumRegister', (['num_qubits'], {}), '(num_qubits)\n', (1099, 1111), False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), ((1121, 1150), 'qiskit.ClassicalRegister', 'ClassicalRegister', (['num_qubits'], {}), '(num_qubits)\n', (1138, 1150), Fals...
# Ported from the Synchrosqueezing Toolbox, authored by # <NAME>, <NAME> # (http://www.math.princeton.edu/~ebrevdo/) # (https://github.com/ebrevdo/synchrosqueezing/) import numpy as np from .utils import wfiltfn, padsignal, buffer from quadpy import quad as quadgk PI = np.pi EPS = np.finfo(np.float64).eps # ma...
[ "numpy.abs", "numpy.ceil", "numpy.sqrt", "numpy.arange", "numpy.fft.fft", "numpy.floor", "numpy.hamming", "numpy.diag", "numpy.sum", "numpy.linspace", "numpy.zeros", "numpy.isnan", "numpy.mod", "numpy.finfo", "numpy.fft.ifft", "numpy.imag", "numpy.round" ]
[((290, 310), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (298, 310), True, 'import numpy as np\n'), ((7841, 7863), 'numpy.floor', 'np.floor', (['((n1 - 1) / 2)'], {}), '((n1 - 1) / 2)\n', (7849, 7863), True, 'import numpy as np\n'), ((3366, 3403), 'numpy.linspace', 'np.linspace', (['(0)', '(1)',...
# python -m odf.mfs.collector import datetime import os import time from datetime import datetime from threading import Thread import cv2 import mss import pandas as pd import wave import pyaudio from odf.config import config from PIL import Image import numpy import json sensors = { # up to seven groups, each g...
[ "threading.Thread.__init__", "mss.mss", "os.makedirs", "json.dump", "os.path.join", "time.sleep", "datetime.datetime.now", "numpy.array", "cv2.VideoWriter_fourcc", "pandas.DataFrame", "pyaudio.PyAudio", "SimConnect.AircraftRequests", "SimConnect.SimConnect" ]
[((5928, 5966), 'os.path.join', 'os.path.join', (['config.DATA_PATH', 'folder'], {}), '(config.DATA_PATH, folder)\n', (5940, 5966), False, 'import os\n'), ((5985, 6004), 'os.makedirs', 'os.makedirs', (['folder'], {}), '(folder)\n', (5996, 6004), False, 'import os\n'), ((6662, 6679), 'pyaudio.PyAudio', 'pyaudio.PyAudio'...
import numpy as np from matplotlib import pyplot as plt import pickle as pkl import starry import celerite2.jax from celerite2.jax import terms as jax_terms from celerite2 import terms, GaussianProcess from exoplanet.distributions import estimate_inverse_gamma_parameters from matplotlib import colors import matplotli...
[ "numpy.clip", "numpy.sqrt", "numpy.array", "matplotlib.ticker.AutoMinorLocator", "numpy.arange", "matplotlib.colors.LogNorm", "numpy.mean", "numpy.diff", "numpy.exp", "numpy.linspace", "matplotlib.cm.ScalarMappable", "numpy.random.seed", "numpy.concatenate", "starry.Map", "pickle.load", ...
[((525, 543), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (539, 543), True, 'import numpy as np\n'), ((12516, 12536), 'numpy.arange', 'np.arange', (['(0)', '(60)', '(10)'], {}), '(0, 60, 10)\n', (12525, 12536), True, 'import numpy as np\n'), ((12565, 12583), 'numpy.arange', 'np.arange', (['(0)', '(...
# -*- coding: utf-8 -*- import numpy as np from scipy.linalg import block_diag class Network(object): """ Class for networks of boreholes with series, parallel, and mixed connections between the boreholes. Contains information regarding the physical dimensions and thermal characteristics of the p...
[ "numpy.tile", "numpy.eye", "numpy.linalg.solve", "numpy.abs", "numpy.isscalar", "numpy.all", "numpy.array", "numpy.zeros", "numpy.sum", "numpy.empty", "numpy.linalg.inv", "scipy.linalg.block_diag", "numpy.atleast_1d" ]
[((5461, 5477), 'numpy.isscalar', 'np.isscalar', (['T_b'], {}), '(T_b)\n', (5472, 5477), True, 'import numpy as np\n'), ((7051, 7067), 'numpy.isscalar', 'np.isscalar', (['T_b'], {}), '(T_b)\n', (7062, 7067), True, 'import numpy as np\n'), ((8583, 8599), 'numpy.isscalar', 'np.isscalar', (['T_b'], {}), '(T_b)\n', (8594, ...
import matplotlib.pyplot as pl import os import numpy as np from ticle.data.dataHandler import normalizeData,load_file from ticle.analysis.analysis import get_significant_periods pl.rc('xtick', labelsize='x-small') pl.rc('ytick', labelsize='x-small') pl.rc('font', family='serif') pl.rcParams.update({'font.size': 20})...
[ "os.makedirs", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.legend", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "ticle.data.dataHandler.load_file", "ticle.analysis.analysis.get_significant_periods", "os.getcwd", "ticle.data.dataHandler.normalizeData", "matplotlib.pyplot.rcParams.updat...
[((181, 216), 'matplotlib.pyplot.rc', 'pl.rc', (['"""xtick"""'], {'labelsize': '"""x-small"""'}), "('xtick', labelsize='x-small')\n", (186, 216), True, 'import matplotlib.pyplot as pl\n'), ((217, 252), 'matplotlib.pyplot.rc', 'pl.rc', (['"""ytick"""'], {'labelsize': '"""x-small"""'}), "('ytick', labelsize='x-small')\n"...
import os import sys sys.path.append("..") sys.path.append("../../") sys.path.append("../../../") from typing import Type, Union, Dict, List import numpy as np import torch.utils.data as data from PIL import Image from torchvision import transforms from yacs.config import CfgNode from datasets.augmentation import a...
[ "torchvision.transforms.ToTensor", "os.path.join", "datasets.augmentation.augmentation", "numpy.ascontiguousarray", "yacs.config.CfgNode", "torchvision.transforms.Resize", "lib.utils.base_utils.LoadImgs", "lib.datasets.make_datasets.make_dataset", "sys.path.append", "lib.utils.base_utils.GetImgFps...
[((22, 43), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (37, 43), False, 'import sys\n'), ((44, 69), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (59, 69), False, 'import sys\n'), ((70, 98), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('.....
import random import pubchem as pc import numpy as np import pandas as pd import sklearn as sk import utility import db.db as db from config import config as cc import sys from sets import Set import data RD = cc.exp['params']['data'] RP = cc.exp['params']['rnn'] # not entirely correct, in one partition can app...
[ "numpy.copy", "numpy.nanstd", "numpy.random.shuffle", "data.denormalize", "numpy.corrcoef", "numpy.absolute", "utility.equals", "sklearn.metrics.roc_auc_score", "utility.logloss", "numpy.nanmean", "numpy.zeros", "sklearn.metrics.log_loss", "numpy.concatenate", "sklearn.metrics.accuracy_sco...
[((1820, 1850), 'data.denormalize', 'data.denormalize', (['labels', 'meta'], {}), '(labels, meta)\n', (1836, 1850), False, 'import data\n'), ((4235, 4251), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (4243, 4251), True, 'import numpy as np\n'), ((5554, 5584), 'data.denormalize', 'data.denormalize', (['la...
from algos.custom_gym_loop import ReinforcementLearning from collections import deque import numpy as np import tensorflow as tf class Lagrangian( ReinforcementLearning ): """ Class that inherits from ReinforcementLearning to implements the REINFORCE algorithm, the original paper can be found here: https://procee...
[ "numpy.mean", "collections.deque", "tensorflow.random.set_seed", "numpy.where", "tensorflow.math.log", "tensorflow.keras.optimizers.Adam", "tensorflow.GradientTape", "numpy.array", "numpy.random.seed", "numpy.vstack", "tensorflow.reduce_mean", "tensorflow.gather_nd" ]
[((741, 765), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed'], {}), '(seed)\n', (759, 765), True, 'import tensorflow as tf\n'), ((770, 790), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (784, 790), True, 'import numpy as np\n'), ((929, 955), 'tensorflow.keras.optimizers.Adam', 'tf.ke...
from typing import Tuple import numpy as np from PyGenetic.crossover import CrossoverDecidor from PyGenetic.mutation import MutationDecidor class FactoryPopulation(): def __init__(self): self.crossover_decidor = CrossoverDecidor(self.crossover_type, self....
[ "PyGenetic.mutation.MutationDecidor", "numpy.argsort", "PyGenetic.crossover.CrossoverDecidor" ]
[((227, 278), 'PyGenetic.crossover.CrossoverDecidor', 'CrossoverDecidor', (['self.crossover_type', 'self.n_genes'], {}), '(self.crossover_type, self.n_genes)\n', (243, 278), False, 'from PyGenetic.crossover import CrossoverDecidor\n'), ((362, 481), 'PyGenetic.mutation.MutationDecidor', 'MutationDecidor', (['self.mutati...
import threading import requests from bs4 import BeautifulSoup import uuid, base64 import io import xlsxwriter from .tree import Tree from .webpage_classifier import WebpageClassifier from .steady_state_genetic import SteadyStateGenetic from .general_regression_neural_network import GeneralRegressionNeuralNetwork impor...
[ "threading.Thread", "numpy.mean", "xlsxwriter.Workbook", "numpy.std" ]
[((2669, 2721), 'threading.Thread', 'threading.Thread', ([], {'target': 'site.save_file', 'daemon': '(True)'}), '(target=site.save_file, daemon=True)\n', (2685, 2721), False, 'import threading\n'), ((6164, 6216), 'threading.Thread', 'threading.Thread', ([], {'target': 'site.save_file', 'daemon': '(True)'}), '(target=si...
import cards.CardUtils as CardUtils from players.Player import Player import numpy as np class PredictorPlayer(Player): def __init__(self, actionPredictor, stateValuePredictor): super().__init__() self.actionPredictor = actionPredictor self.stateValuePredictor = stateValuePredictor de...
[ "numpy.sum" ]
[((967, 986), 'numpy.sum', 'np.sum', (['predictions'], {}), '(predictions)\n', (973, 986), True, 'import numpy as np\n')]
import torch import numpy as np from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_aug_masks, multiclass_nms) from mmdet.core.bbox import bbox_mapping_back from .cascade_roi_head import CascadeRoIHead from ...
[ "mmdet.core.bbox_mapping", "torch.stack", "mmdet.core.bbox2roi", "mmdet.core.bbox.bbox_mapping_back", "mmdet.core.bbox2result", "mmdet.core.multiclass_nms", "numpy.argwhere" ]
[((3207, 3270), 'mmdet.core.bbox2result', 'bbox2result', (['_det_bboxes', 'det_labels', 'self.test_cfg.num_classes'], {}), '(_det_bboxes, det_labels, self.test_cfg.num_classes)\n', (3218, 3270), False, 'from mmdet.core import bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_au...
import sys import numpy as np from mpi4py import MPI comm = MPI.COMM_WORLD name = MPI.Get_processor_name() print("Hello world from processor {}, rank {} out of {} processors"\ .format(name, comm.rank, comm.size)) print("Now I will take up memory and waste computing power for demonstration purposes") sys.stdout.fl...
[ "sys.stdout.flush", "mpi4py.MPI.Get_processor_name", "numpy.zeros" ]
[((84, 108), 'mpi4py.MPI.Get_processor_name', 'MPI.Get_processor_name', ([], {}), '()\n', (106, 108), False, 'from mpi4py import MPI\n'), ((307, 325), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (323, 325), False, 'import sys\n'), ((334, 359), 'numpy.zeros', 'np.zeros', (['(500, 500, 500)'], {}), '((500, ...
import cv2 import numpy as np import os def noisy(noise_typ,image): if noise_typ == "gauss": row,col,ch= image.shape mean = 0 var = 0.1 sigma = var**0.5 gauss = np.random.normal(mean,sigma,(row,col,ch)) gauss = gauss.reshape(row,col,ch) noisy = image + gauss return n...
[ "cv2.normalize", "cv2.imshow", "os.path.exists", "os.listdir", "numpy.random.poisson", "os.mkdir", "numpy.random.normal", "cv2.merge", "cv2.warpAffine", "numpy.ceil", "cv2.cvtColor", "cv2.split", "numpy.log2", "cv2.GaussianBlur", "numpy.random.randn", "cv2.imread", "numpy.copy", "c...
[((1415, 1436), 'os.listdir', 'os.listdir', (['path_from'], {}), '(path_from)\n', (1425, 1436), False, 'import os\n'), ((1530, 1555), 'os.listdir', 'os.listdir', (['(path_from + i)'], {}), '(path_from + i)\n', (1540, 1555), False, 'import os\n'), ((196, 241), 'numpy.random.normal', 'np.random.normal', (['mean', 'sigma'...
# -*- coding: utf-8 -*- """ Created on Wed Jan 4 12:22:44 2017 @author: a.sancho.asensio """ import argparse import base64 import json import re, sys import os import glob import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import cv2 import math import pandas as pd ...
[ "numpy.mean", "numpy.roll", "argparse.ArgumentParser", "flask.Flask", "socketio.Server", "numpy.asarray", "socketio.Middleware", "eventlet.listen", "base64.b64decode", "numpy.zeros", "numpy.random.seed", "cv2.resize", "tensorflow.set_random_seed" ]
[((1637, 1666), 'numpy.zeros', 'np.zeros', (['(10)'], {'dtype': '"""float32"""'}), "(10, dtype='float32')\n", (1645, 1666), True, 'import numpy as np\n'), ((1726, 1743), 'socketio.Server', 'socketio.Server', ([], {}), '()\n', (1741, 1743), False, 'import socketio\n'), ((1751, 1766), 'flask.Flask', 'Flask', (['__name__'...
from __future__ import unicode_literals from __future__ import print_function import time import unittest import numpy as np from hartigan_diptest import dip class testModality(unittest.TestCase): def setUp(self): self.data = np.random.randn(1000) def test_hartigan_diptest(self): t0 = time...
[ "unittest.main", "hartigan_diptest.dip", "numpy.random.randn", "time.time" ]
[((462, 477), 'unittest.main', 'unittest.main', ([], {}), '()\n', (475, 477), False, 'import unittest\n'), ((243, 264), 'numpy.random.randn', 'np.random.randn', (['(1000)'], {}), '(1000)\n', (258, 264), True, 'import numpy as np\n'), ((316, 327), 'time.time', 'time.time', ([], {}), '()\n', (325, 327), False, 'import ti...
import cv2 import sys import numpy as np #rectangle in Python is a tuple of (x,y,w,h) #for rectangle def union(a, b): x = min(a[0], b[0]) y = min(a[1], b[1]) w = max(a[0]+a[2], b[0]+b[2]) - x h = max(a[1]+a[3], b[1]+b[3]) - y return (x, y, w, h) #for rectangle def intersection(a, b): x = max(a...
[ "cv2.rectangle", "cv2.imwrite", "numpy.delete", "cv2.imshow", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.cvtColor", "cv2.MSER_create", "cv2.resize", "cv2.imread" ]
[((1986, 2028), 'cv2.MSER_create', 'cv2.MSER_create', ([], {'_delta': '(10)', '_min_area': '(1000)'}), '(_delta=10, _min_area=1000)\n', (2001, 2028), False, 'import cv2\n'), ((2037, 2060), 'cv2.imread', 'cv2.imread', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (2047, 2060), False, 'import cv2\n'), ((2068, 2105), 'cv2.cvt...
import tensorflow as tf import datetime import numpy as np import zutils.tf_math_funcs as tmf from zutils.py_utils import * from scipy.io import savemat class OneEpochRunner: def __init__( self, data_module, output_list=None, net_func=None, batch_axis=0, num_samples=None, disp_time_interv...
[ "numpy.concatenate", "datetime.datetime.now", "scipy.io.savemat", "zutils.tf_math_funcs.is_tf_data" ]
[((4642, 4686), 'scipy.io.savemat', 'savemat', (["(self.output_fn + '.mat')", 'output_val'], {}), "(self.output_fn + '.mat', output_val)\n", (4649, 4686), False, 'from scipy.io import savemat\n'), ((4118, 4204), 'scipy.io.savemat', 'savemat', (["(self.output_fn + '_' + '%06d' % num_samples_finished + '.mat')", 'output_...
#!/user/bin/env python '''columnarStructureX.py Inheritance class of ColumnarStructure ''' __author__ = "<NAME>) Huang" __maintainer__ = "Mars (Shih-Cheng) Huang" __email__ = "<EMAIL>" __version__ = "0.2.0" __status__ = "Done" import numpy as np import sys from mmtfPyspark.utils import ColumnarStructure from sympy i...
[ "numpy.array", "mmtfPyspark.utils.ColumnarStructure.__init__" ]
[((696, 755), 'mmtfPyspark.utils.ColumnarStructure.__init__', 'ColumnarStructure.__init__', (['self', 'structure', 'firstModelOnly'], {}), '(self, structure, firstModelOnly)\n', (722, 755), False, 'from mmtfPyspark.utils import ColumnarStructure\n'), ((3669, 3697), 'numpy.array', 'np.array', (['calpha_coords_list'], {}...