code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
import numpy import cv2 as cv from matplotlib import pyplot as plt from PyQt5.QtWidgets import QApplication from PyQt5.QtGui import QImage import win32gui import sys import time import win32api import win32print import win32con import os import keyboard import win32com.client import pythoncom base_dir = os.path.dirname...
[ "PyQt5.QtWidgets.QApplication.primaryScreen", "win32api.SetCursorPos", "PyQt5.QtWidgets.QApplication", "cv2.minMaxLoc", "win32gui.SetForegroundWindow", "win32api.mouse_event", "cv2.matchTemplate", "win32api.GetSystemMetrics", "os.path.abspath", "cv2.cvtColor", "time.clock", "pythoncom.CoInitia...
[((354, 376), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (366, 376), False, 'from PyQt5.QtWidgets import QApplication\n'), ((321, 346), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (336, 346), False, 'import os\n'), ((770, 805), 'cv2.cvtColor', 'cv.c...
import bmw import numpy as np problem = bmw.Problem.parse(filepath='../../data/3-refined') dat = np.load('../2-prod/test-0.npz') constellation = dat['constellation'] constellation_type_indices = dat['constellation_type_indices'] test_indices = np.argsort(problem.test_groups) for tindex2, tindex1 in enumerate(test_i...
[ "numpy.full", "numpy.load", "numpy.zeros", "numpy.argsort", "bmw.Problem.parse" ]
[((41, 91), 'bmw.Problem.parse', 'bmw.Problem.parse', ([], {'filepath': '"""../../data/3-refined"""'}), "(filepath='../../data/3-refined')\n", (58, 91), False, 'import bmw\n'), ((99, 130), 'numpy.load', 'np.load', (['"""../2-prod/test-0.npz"""'], {}), "('../2-prod/test-0.npz')\n", (106, 130), True, 'import numpy as np\...
# standard library imports import ctypes from enum import IntEnum import os import queue import re import warnings # 3rd party library imports import numpy as np # Local imports from ..config import glymur_config # The error messages queue EQ = queue.Queue() loader = ctypes.windll.LoadLibrary if os.name == 'nt' els...
[ "ctypes.byref", "numpy.zeros", "ctypes.create_string_buffer", "ctypes.CFUNCTYPE", "warnings.warn", "re.search", "queue.Queue", "ctypes.POINTER" ]
[((248, 261), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (259, 261), False, 'import queue\n'), ((6475, 6564), 'ctypes.CFUNCTYPE', 'ctypes.CFUNCTYPE', (['ctypes.c_void_p', 'ctypes.c_char_p', 'ctypes.c_char_p', 'ctypes.c_void_p'], {}), '(ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.\n c_void_p)\n', (...
import sys sys.path.append('../') from pathlib import Path import shutil import numpy as np import pickle from py_diff_pd.common.common import ndarray, create_folder from py_diff_pd.common.common import print_info, print_ok, print_error from py_diff_pd.common.hex_mesh import hex2obj_with_textures, filter_hex from py_...
[ "sys.path.append", "py_diff_pd.common.hex_mesh.hex2obj_with_textures", "py_diff_pd.common.hex_mesh.filter_hex", "py_diff_pd.common.common.create_folder", "numpy.floor", "numpy.zeros", "py_diff_pd.common.common.ndarray", "pathlib.Path", "py_diff_pd.core.py_diff_pd_core.HexMesh3d", "numpy.sin", "s...
[((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((567, 587), 'pathlib.Path', 'Path', (['"""quadruped_3d"""'], {}), "('quadruped_3d')\n", (571, 587), False, 'from pathlib import Path\n'), ((773, 1046), 'py_diff_pd.env.quadruped_env_3d.QuadrupedEnv3d',...
from segmentation_models import Unet, Nestnet, Xnet from data.load_data import load_data import numpy as np from PIL import Image from keras.callbacks import TensorBoard, ModelCheckpoint, ReduceLROnPlateau, EarlyStopping NCLASSES = 2 HEIGHT = 544 WIDTH = 544 def generate_arrays_from_file(lines, batch_size): # 获...
[ "keras.callbacks.ModelCheckpoint", "numpy.zeros", "PIL.Image.open", "segmentation_models.Xnet", "keras.callbacks.EarlyStopping", "numpy.array", "keras.callbacks.ReduceLROnPlateau", "numpy.random.shuffle" ]
[((1763, 1875), 'segmentation_models.Xnet', 'Xnet', ([], {'backbone_name': '"""resnet50"""', 'encoder_weights': '"""imagenet"""', 'decoder_block_type': '"""transpose"""', 'classes': 'NCLASSES'}), "(backbone_name='resnet50', encoder_weights='imagenet',\n decoder_block_type='transpose', classes=NCLASSES)\n", (1767, 18...
"""Flashed images perturbed with checkerboard""" import array import io import math # import matplotlib.pyplot as plt import numpy as np import os import scipy import scipy.interpolate import scipy.ndimage import tempfile import tqdm # from mpl_toolkits.axes_grid1 import make_axes_locatable from PIL.Image import from...
[ "numpy.random.seed", "numpy.iinfo", "numpy.ones", "os.path.isfile", "numpy.mean", "numpy.arange", "pystim.utils.handle_arguments_and_configurations", "os.path.join", "urllib.parse.urlparse", "numpy.meshgrid", "numpy.std", "scipy.ndimage.gaussian_filter", "pystim.utils.get_grey_frame", "url...
[((2915, 2943), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (2927, 2943), False, 'import os\n'), ((3289, 3309), 'io.BytesIO', 'io.BytesIO', (['resource'], {}), '(resource)\n', (3299, 3309), False, 'import io\n'), ((3322, 3338), 'PIL.Image.open', 'open_image', (['data'], {}), '(data...
import cv2 import torch import numpy as np import torch.nn as nn from config import cfg from utils.anchor import Anchors def get_subwindow(self, im, pos, model_sz, original_sz, avg_chans): """ args: im: bgr based image pos: center position model_sz: exemplar size ...
[ "utils.anchor.Anchors", "numpy.stack", "numpy.floor", "numpy.zeros", "numpy.exp", "numpy.tile", "numpy.array_equal", "cv2.resize", "torch.from_numpy" ]
[((597, 623), 'numpy.floor', 'np.floor', (['(pos[0] - c + 0.5)'], {}), '(pos[0] - c + 0.5)\n', (605, 623), True, 'import numpy as np\n'), ((726, 752), 'numpy.floor', 'np.floor', (['(pos[1] - c + 0.5)'], {}), '(pos[1] - c + 0.5)\n', (734, 752), True, 'import numpy as np\n'), ((2307, 2333), 'torch.from_numpy', 'torch.fro...
from PyQt5 import QtGui, Qt, QtCore, QtWidgets, uic import sys import time import os import errno import numpy as np import pyqtgraph as pg import math from Worker import Worker from set_to_user_friendly_QLineEdit import set_to_user_friendly_QLineEdit from outputs_parameters import outputs_parameters from catch_...
[ "PyQt5.QtCore.QCoreApplication.instance", "RP_PLL.RP_PLL_device", "pyqtgraph.setConfigOption", "numpy.sum", "PyQt5.QtWidgets.QFileDialog.getExistingDirectory", "os.getcwd", "Worker.Worker", "time.process_time", "PyQt5.QtCore.QThreadPool", "outputs_parameters.outputs_parameters", "os.path.exists"...
[((20405, 20431), 'RP_PLL.RP_PLL_device', 'RP_PLL.RP_PLL_device', (['None'], {}), '(None)\n', (20425, 20431), False, 'import RP_PLL\n'), ((20474, 20508), 'PyQt5.QtCore.QCoreApplication.instance', 'QtCore.QCoreApplication.instance', ([], {}), '()\n', (20506, 20508), False, 'from PyQt5 import QtGui, Qt, QtCore, QtWidgets...
# -*- coding: utf-8 -*- import numpy as np def newton_solver( _jacobian, _residual, _u0, _tol, _n_max ): it = 0 u_n = _u0 res = _residual( u_n ) res_norm = np.linalg.norm( res ) # print( 'Starting residual norm is %e' % res_norm ) while res_norm > _tol and it < _n_max: it...
[ "numpy.linalg.norm" ]
[((184, 203), 'numpy.linalg.norm', 'np.linalg.norm', (['res'], {}), '(res)\n', (198, 203), True, 'import numpy as np\n'), ((536, 555), 'numpy.linalg.norm', 'np.linalg.norm', (['res'], {}), '(res)\n', (550, 555), True, 'import numpy as np\n')]
import os from typing import Union import mlflow import numpy as np import pandas as pd import torch from ael import plot def predict(model, AEVC, loader, scaler=None, baseline=None, device=None): """ Binding affinity predictions. Parameters ---------- model: torch.nn.Module Neural netw...
[ "numpy.isin", "ael.utils.loadmodel", "mlflow.log_artifact", "ael.argparsers.predictparser", "numpy.argsort", "ael.utils.loadAEVC", "torch.device", "torch.no_grad", "os.path.join", "pandas.DataFrame", "mlflow.start_run", "mlflow.log_param", "torch.utils.data.DataLoader", "ael.utils.load_ama...
[((4906, 4927), 'pandas.DataFrame', 'pd.DataFrame', (['results'], {}), '(results)\n', (4918, 4927), True, 'import pandas as pd\n'), ((5109, 5146), 'os.path.join', 'os.path.join', (['outpath', 'f"""{stage}.csv"""'], {}), "(outpath, f'{stage}.csv')\n", (5121, 5146), False, 'import os\n'), ((5191, 5215), 'mlflow.log_artif...
import numpy as np from hyperopt import hp # required params: # - embedding_size # - lr # - batch_size # - max_iter # - neg_ratio # - contiguous_sampling # - valid_every: set it to 0 to enable early stopping param_space_TransE = { # "embedding_size": hp.quniform("embedding_size", 50, 200, 10), "embedding_size...
[ "numpy.log", "hyperopt.hp.quniform" ]
[((342, 376), 'hyperopt.hp.quniform', 'hp.quniform', (['"""margin"""', '(0.5)', '(5)', '(0.5)'], {}), "('margin', 0.5, 5, 0.5)\n", (353, 376), False, 'from hyperopt import hp\n'), ((710, 744), 'hyperopt.hp.quniform', 'hp.quniform', (['"""margin"""', '(0.5)', '(5)', '(0.5)'], {}), "('margin', 0.5, 5, 0.5)\n", (721, 744)...
# -*- coding: utf-8 -*- import os import threading import gc from time import time, sleep import numpy as np import cv2 import wx from slim_anywhere_v2 import SlimFace global_fps = 24 os.environ["UBUNTU_MENUPROXY"]="0" class ImagePanel(wx.Panel): def __init__(self, parent, size): super(ImagePanel, sel...
[ "wx.Menu", "os.mkdir", "wx.CallAfter", "wx.BufferedPaintDC", "gc.collect", "os.path.join", "cv2.cvtColor", "os.path.exists", "wx.Panel", "slim_anywhere_v2.SlimFace", "cv2.resize", "wx.MenuBar", "threading.Thread", "wx.BoxSizer", "os.path.basename", "wx.StaticText", "wx.App", "os.ge...
[((6479, 6487), 'wx.App', 'wx.App', ([], {}), '()\n', (6485, 6487), False, 'import wx\n'), ((427, 484), 'numpy.zeros', 'np.zeros', (['(self.size[1], self.size[0], 3)'], {'dtype': 'np.uint8'}), '((self.size[1], self.size[0], 3), dtype=np.uint8)\n', (435, 484), True, 'import numpy as np\n'), ((504, 555), 'wx.BitmapFromBu...
#!/usr/bin/env python """ Draws a random x-y lineplot and makes a tool which shows the closet point on the lineplot to the mouse position. """ #Major library imports from numpy.random import random_sample from numpy import arange #Enthought library imports from enable.api import Component, ComponentEditor, BaseTool fr...
[ "traits.api.Instance", "traits.api.Any", "numpy.random.random_sample", "traits.api.Int", "enable.api.ComponentEditor", "chaco.api.ArrayDataSource", "numpy.arange", "chaco.api.ArrayPlotData", "chaco.api.Plot" ]
[((1011, 1016), 'traits.api.Any', 'Any', ([], {}), '()\n', (1014, 1016), False, 'from traits.api import HasTraits, Instance, Any, Int\n'), ((1140, 1145), 'traits.api.Any', 'Any', ([], {}), '()\n', (1143, 1145), False, 'from traits.api import HasTraits, Instance, Any, Int\n'), ((1230, 1237), 'traits.api.Int', 'Int', (['...
# import tensorflow as tf import numpy as np from torchvision.transforms.transforms import CenterCrop import tqdm import torch.nn.functional as F # import sklearn import matplotlib.pyplot as plt import torch # import tensorflow_datasets as tfds import torchvision import torchvision.transforms as transforms import torch...
[ "numpy.load", "numpy.random.seed", "torchvision.datasets.CIFAR10", "os.path.isfile", "numpy.arange", "numpy.tile", "torch.utils.data.TensorDataset", "torchvision.datasets.CelebA", "torchvision.transforms.Normalize", "os.path.join", "torchvision.datasets.SVHN", "torch.utils.data.DataLoader", ...
[((1232, 1258), 'numpy.concatenate', 'np.concatenate', (['image_list'], {}), '(image_list)\n', (1246, 1258), True, 'import numpy as np\n'), ((3164, 3189), 'numpy.vstack', 'np.vstack', (['(idxs, labels)'], {}), '((idxs, labels))\n', (3173, 3189), True, 'import numpy as np\n'), ((4736, 4761), 'numpy.vstack', 'np.vstack',...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import math import time from datetime import datetime import os from pathlib import Path import numpy as np import tensorflow as tf import iris import iris_input from iris_flags import * def eval_once(save...
[ "tensorflow.gfile.Exists", "numpy.load", "numpy.sum", "iris.inference", "tensorflow.placeholder", "tensorflow.summary.FileWriter", "tensorflow.gfile.DeleteRecursively", "datetime.datetime.now", "tensorflow.app.run", "tensorflow.summary.merge_all", "tensorflow.train.get_checkpoint_state", "tens...
[((2177, 2208), 'tensorflow.gfile.Exists', 'tf.gfile.Exists', (['FLAGS.eval_dir'], {}), '(FLAGS.eval_dir)\n', (2192, 2208), True, 'import tensorflow as tf\n'), ((2265, 2298), 'tensorflow.gfile.MakeDirs', 'tf.gfile.MakeDirs', (['FLAGS.eval_dir'], {}), '(FLAGS.eval_dir)\n', (2282, 2298), True, 'import tensorflow as tf\n'...
"""Graphical user interface (:mod:`fluiddyn.util.gui`) ====================================================== """ try: # Python 3 import tkinter as tk from tkinter import N, W, E, S, END from tkinter import ttk from tkinter.scrolledtext import ScrolledText from tkinter.simpledialog import Simp...
[ "fluidlab.objects.rotatingobjects.DaemonRunningRotatingObject", "ttk.Label", "ScrolledText.ScrolledText", "tkFont.nametofont", "fluidlab.objects.rotatingobjects.create_rotating_objects_kepler", "Tkinter.Tk", "fluiddyn.load_exp", "ttk.Label.__init__", "datetime.datetime", "ttk.Frame.mainloop", "t...
[((7850, 7899), 'fluidlab.objects.rotatingobjects.create_rotating_objects_kepler', 'create_rotating_objects_kepler', (['Omega_i', 'R_i', 'R_o'], {}), '(Omega_i, R_i, R_o)\n', (7880, 7899), False, 'from fluidlab.objects.rotatingobjects import create_rotating_objects_kepler, DaemonRunningRotatingObject, RotatingObject\n'...
### model1: 3levels on CNN (4layers in each)(takes 4input) import numpy as np from keras.models import Model from keras.layers import Input from keras.layers import Dense from keras.layers import Flatten from keras.layers import Dropout from keras.layers.convolutional import Conv1D from keras.layers.convolutional imp...
[ "numpy.argmax", "keras.layers.merge.concatenate", "keras.layers.convolutional.MaxPooling1D", "keras.models.Model", "keras.layers.Flatten", "keras.layers.Dense", "keras.layers.convolutional.Conv1D", "keras.layers.Input" ]
[((656, 694), 'keras.layers.Input', 'Input', ([], {'shape': '(n_timesteps, n_features)'}), '(shape=(n_timesteps, n_features))\n', (661, 694), False, 'from keras.layers import Input\n'), ((840, 878), 'keras.layers.Input', 'Input', ([], {'shape': '(n_timesteps, n_features)'}), '(shape=(n_timesteps, n_features))\n', (845,...
#!/usr/bin/python import sys import numpy as np import pandas as pd from matplotlib import pyplot as plt def main(): if len(sys.argv)>1: file_name = str(sys.argv[1]) else: file_name = 'wyniki.csv' data = pd.read_csv(file_name,usecols=['graph_name','calculated_path_weight','defined_path_weig...
[ "pandas.read_csv", "numpy.array", "matplotlib.pyplot.subplots", "matplotlib.pyplot.show" ]
[((233, 349), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'usecols': "['graph_name', 'calculated_path_weight', 'defined_path_weight', 'time', 'alpha'\n ]"}), "(file_name, usecols=['graph_name', 'calculated_path_weight',\n 'defined_path_weight', 'time', 'alpha'])\n", (244, 349), True, 'import pandas as pd\n...
import os import sys import inspect import itertools import warnings import numpy as np from numpy import ma import pandas as pd import xarray as xr from datetime import datetime, timedelta from dateutil.parser import parse as parse_date from scipy import ndimage as ndi import argparse parser = argparse.ArgumentParse...
[ "tobac_flow.glm.regrid_glm", "numpy.sum", "argparse.ArgumentParser", "tobac_flow.io.get_goes_date", "tobac_flow.validation.get_min_dist_for_objects", "numpy.histogram", "tobac_flow.io.find_glm_files", "numpy.float64", "tobac_flow.validation.get_marker_distance", "os.path.join", "numpy.full", "...
[((298, 387), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Validate detected DCCs using GOES-16 GLM data"""'}), "(description=\n 'Validate detected DCCs using GOES-16 GLM data')\n", (321, 387), False, 'import argparse\n'), ((996, 1025), 'os.path.isdir', 'os.path.isdir', (['goes_data...
# -*- coding: utf-8 -*- import numpy as np from pandas import Index from xarray import Dataset, DataArray, set_options, concat from .. import fun as ff __all__ = ['apply_threshold', 'snht', 'adjust_mean', 'adjust_percentiles', 'adjust_percentiles_ref', 'adjust_reference_period', 'breakpoint_stat...
[ "numpy.size", "numpy.datetime_as_string", "numpy.apply_along_axis", "numpy.where", "numpy.arange", "xarray.set_options", "numpy.unique" ]
[((2283, 2345), 'numpy.apply_along_axis', 'np.apply_along_axis', (['test', 'axis', 'idata.values', 'window', 'missing'], {}), '(test, axis, idata.values, window, missing)\n', (2302, 2345), True, 'import numpy as np\n'), ((6311, 6341), 'numpy.where', 'np.where', (['(data.values >= value)'], {}), '(data.values >= value)\...
from __future__ import absolute_import, division, print_function from builtins import (bytes, str, open, super, range, zip, round, input, int, pow, object, map, zip) __author__ = "<NAME>" # Standard library # eg copy # absolute import rg:from copy import deepcopy # Dependencies # eg numpy #...
[ "matplotlib.pyplot.show", "mpld3.plugins.MousePosition", "numpy.column_stack", "numpy.zeros", "astropy.wcs.WCS", "matplotlib.use", "astropy.io.fits.open", "numpy.linspace", "numpy.exp", "mpld3.fig_to_dict", "numpy.log10", "matplotlib.pyplot.subplots", "astropy.coordinates.Angle" ]
[((433, 466), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {'warn': '(False)'}), "('Agg', warn=False)\n", (447, 466), False, 'import matplotlib\n'), ((1639, 1661), 'mpld3.fig_to_dict', 'mpld3.fig_to_dict', (['fig'], {}), '(fig)\n', (1656, 1661), False, 'import mpld3\n'), ((1714, 1741), 'astropy.io.fits.open', 'p...
import os import time import logging import sys import torch import numpy as np import random def adjust_learning_rate(optimizer, lr): for param_group in optimizer.param_groups: param_group['lr'] = lr def setup_logger(root_folder,exp_id): if not os.path.exists(root_folder): os.system(f"mkdir {...
[ "numpy.random.seed", "logging.FileHandler", "numpy.abs", "torch.manual_seed", "logging.StreamHandler", "os.path.exists", "os.system", "torch.cuda.manual_seed_all", "random.seed", "os.path.join", "logging.getLogger" ]
[((350, 383), 'os.path.join', 'os.path.join', (['root_folder', 'exp_id'], {}), '(root_folder, exp_id)\n', (362, 383), False, 'import os\n'), ((396, 423), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (413, 423), False, 'import logging\n'), ((486, 519), 'logging.StreamHandler', 'logging.S...
# Copyright 2019 The FastEstimator 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 appl...
[ "tensorflow.keras.datasets.boston_housing.load_data", "sklearn.preprocessing.StandardScaler", "tensorflow.keras.layers.Dropout", "tensorflow.keras.layers.Dense", "fastestimator.Estimator", "numpy.expand_dims", "fastestimator.op.tensorop.ModelOp", "tempfile.mkdtemp", "tensorflow.keras.Sequential", ...
[((1005, 1026), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', ([], {}), '()\n', (1024, 1026), True, 'import tensorflow as tf\n'), ((1476, 1494), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (1492, 1494), False, 'import tempfile\n'), ((1540, 1584), 'tensorflow.keras.datasets.boston_housing.load_data...
import numpy as np import torch from gym.spaces import Dict from rllab.misc.instrument import VariantGenerator import rlkit.torch.pytorch_util as ptu from rlkit.envs.wrappers import NormalizedBoxEnv from rlkit.launchers.launcher_util import setup_logger, set_seed from rlkit.torch.networks import MlpPolicy from rlkit...
[ "yaml.load", "argparse.ArgumentParser", "rlkit.torch.irl.encoders.trivial_encoder.TrivialNPEncoder", "rlkit.torch.pytorch_util.gpu_enabled", "rlkit.envs.get_meta_env", "rlkit.envs.get_meta_env_params_iters", "rlkit.launchers.launcher_util.set_seed", "time.sleep", "numpy.prod", "rlkit.torch.irl.enc...
[((1045, 1098), 'os.path.join', 'path.join', (['expert_dir', 'specific_run', '"""extra_data.pkl"""'], {}), "(expert_dir, specific_run, 'extra_data.pkl')\n", (1054, 1098), False, 'from os import path\n'), ((1116, 1141), 'joblib.load', 'joblib.load', (['file_to_load'], {}), '(file_to_load)\n', (1127, 1141), False, 'impor...
# Copyright 2013-2015 <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 writing, ...
[ "numpy.array", "numpy.zeros", "stella.intrinsics.python.zeros", "stella.wrap" ]
[((3469, 3488), 'stella.intrinsics.python.zeros', 'zeros', (['(5)'], {'dtype': 'int'}), '(5, dtype=int)\n', (3474, 3488), False, 'from stella.intrinsics.python import zeros\n'), ((3672, 3691), 'stella.intrinsics.python.zeros', 'zeros', (['l'], {'dtype': 'int'}), '(l, dtype=int)\n', (3677, 3691), False, 'from stella.int...
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst """ A "grab bag" of relatively small general-purpose utilities that don't have a clear module/package to live in. """ from __future__ import (absolute_import, division, print_function, unicode_literals) im...
[ "signal.__dict__.iteritems", "numpy.random.seed", "os.walk", "numpy.random.set_state", "sys.exc_info", "unicodedata.normalize", "os.path.abspath", "sys.getfilesystemencoding", "zlib.decompress", "ctypes.windll.kernel32.GetFileAttributesW", "json.JSONEncoder.default", "difflib.get_close_matches...
[((3789, 3811), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (3809, 3811), False, 'import inspect\n'), ((25253, 25321), 'os.walk', 'os.walk', (['top'], {'topdown': '(True)', 'onerror': 'onerror', 'followlinks': 'followlinks'}), '(top, topdown=True, onerror=onerror, followlinks=followlinks)\n', (252...
#%% import os import pickle import warnings from operator import itemgetter from pathlib import Path from timeit import default_timer as timer import leidenalg as la import colorcet as cc import community as cm import matplotlib.colors as mplc import matplotlib.pyplot as plt import networkx as nx import numpy as np imp...
[ "pandas.DataFrame", "src.graph.preprocess", "numpy.random.seed", "os.path.basename", "src.io.savefig", "matplotlib.pyplot.close", "src.io.saveskels", "numpy.geomspace", "src.block.run_leiden", "seaborn.set_context", "joblib.Parallel", "src.data.load_metagraph", "sklearn.model_selection.Param...
[((1117, 1140), 'numpy.random.seed', 'np.random.seed', (['(9812343)'], {}), '(9812343)\n', (1131, 1140), True, 'import numpy as np\n'), ((1141, 1164), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (1156, 1164), True, 'import seaborn as sns\n'), ((2853, 2874), 'numpy.random.seed', 'np.ran...
import numpy as np from fe import topology from timemachine.lib import potentials from timemachine.lib import LangevinIntegrator, custom_ops from ff.handlers import openmm_deserializer from ff import Forcefield def get_romol_conf(mol): """Coordinates of mol's 0th conformer, in nanometers""" conformer = mol....
[ "numpy.zeros_like", "ff.handlers.openmm_deserializer.deserialize_system", "fe.topology.HostGuestTopology", "timemachine.lib.custom_ops.Context", "timemachine.lib.LangevinIntegrator", "fe.topology.BaseTopology", "numpy.linspace", "numpy.concatenate" ]
[((1261, 1324), 'ff.handlers.openmm_deserializer.deserialize_system', 'openmm_deserializer.deserialize_system', (['host_system'], {'cutoff': '(1.2)'}), '(host_system, cutoff=1.2)\n', (1299, 1324), False, 'from ff.handlers import openmm_deserializer\n'), ((1443, 1487), 'numpy.concatenate', 'np.concatenate', (['[host_mas...
''' Quaternion based methods and objects ''' import numpy as np from math import sin, cos, asin, atan2, degrees, radians, acos import ctypes from auv_python_helpers import load_library quat_lib = load_library("libquat.so") quat_t = ctypes.c_double * 4 vect_t = ctypes.c_double * 3 double_t = ctypes.c_double ret_quat ...
[ "auv_python_helpers.load_library", "math.asin", "math.atan2", "numpy.empty", "math.sin", "math.acos", "numpy.array", "numpy.linalg.norm", "math.cos" ]
[((198, 224), 'auv_python_helpers.load_library', 'load_library', (['"""libquat.so"""'], {}), "('libquat.so')\n", (210, 224), False, 'from auv_python_helpers import load_library\n'), ((484, 500), 'math.sin', 'sin', (['(angle / 2.0)'], {}), '(angle / 2.0)\n', (487, 500), False, 'from math import sin, cos, asin, atan2, de...
import sys sys.path.append('util') import os import time import math import numpy as np import mnist_loader from sklearn.preprocessing import OneHotEncoder class NN: def __init__(self, file_name, retrain = False): self.file_name = file_name self.retrain = retrain #useful values ...
[ "numpy.load", "numpy.random.seed", "numpy.sum", "numpy.argmax", "mnist_loader.load_data_wrapper", "numpy.exp", "sys.path.append", "os.path.exists", "numpy.insert", "numpy.reshape", "numpy.size", "numpy.save", "sklearn.preprocessing.OneHotEncoder", "numpy.concatenate", "numpy.log", "tim...
[((12, 35), 'sys.path.append', 'sys.path.append', (['"""util"""'], {}), "('util')\n", (27, 35), False, 'import sys\n'), ((843, 860), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (857, 860), True, 'import numpy as np\n'), ((893, 923), 'os.path.exists', 'os.path.exists', (['self.file_name'], {}), '(self...
import math import numpy as np import pandas as pd from datetime import datetime, timedelta from sklearn.preprocessing import StandardScaler import cython class DataLoader(): def __init__(self, cols, testcols): self.cols = cols self.testcols = testcols def get_train_data(self, df, assetCode=N...
[ "numpy.where", "numpy.array", "sklearn.preprocessing.StandardScaler", "numpy.vstack" ]
[((1762, 1784), 'numpy.array', 'np.array', (['data_windows'], {}), '(data_windows)\n', (1770, 1784), True, 'import numpy as np\n'), ((2088, 2123), 'numpy.where', 'np.where', (['(window[-1, [0]] > 0)', '(1)', '(0)'], {}), '(window[-1, [0]] > 0, 1, 0)\n', (2096, 2123), True, 'import numpy as np\n'), ((2567, 2592), 'numpy...
import tensorflow as tf import train import numpy as np import pprint import copy flags = tf.app.flags flags.DEFINE_string("datafile", "data/cosmo_primary_64_1k_train.npy", "Input data file for cosmo") flags.DEFINE_integer("epoch", 1, "Epochs to train [1]") flags.DEFINE_float("learning_rate", 0.0002, "Learning rate of...
[ "pprint.PrettyPrinter", "numpy.load", "tensorflow.app.run", "numpy.expand_dims" ]
[((2633, 2672), 'numpy.load', 'np.load', (['config.datafile'], {'mmap_mode': '"""r"""'}), "(config.datafile, mmap_mode='r')\n", (2640, 2672), True, 'import numpy as np\n'), ((2868, 2880), 'tensorflow.app.run', 'tf.app.run', ([], {}), '()\n', (2878, 2880), True, 'import tensorflow as tf\n'), ((2726, 2755), 'numpy.expand...
# McDermott # 25 March 2021 # power_spectrum.py import sys # sys.path.append('<path to macfp-db>/macfp-db/Utilities/') sys.path.append('../../../../../../macfp-db/Utilities/') import macfp import importlib importlib.reload(macfp) import matplotlib.pyplot as plt from scipy import signal import pandas as pd import nump...
[ "sys.path.append", "pandas.read_csv", "macfp.plot_to_fig", "importlib.reload", "numpy.array", "scipy.signal.periodogram", "matplotlib.pyplot.savefig" ]
[((120, 176), 'sys.path.append', 'sys.path.append', (['"""../../../../../../macfp-db/Utilities/"""'], {}), "('../../../../../../macfp-db/Utilities/')\n", (135, 176), False, 'import sys\n'), ((208, 231), 'importlib.reload', 'importlib.reload', (['macfp'], {}), '(macfp)\n', (224, 231), False, 'import importlib\n'), ((445...
import os import numpy #This file is to run the MH test and Fisher's exact test. thres = 0.5 #quantile, threshold of success i0file = '/PATH/cldi0.txt' i1file = '/PATH/cldi1.txt' print('process start') #################################################### #read these files,get the count of success a...
[ "numpy.percentile" ]
[((2187, 2226), 'numpy.percentile', 'numpy.percentile', (['cldlistf', '(100 * thres)'], {}), '(cldlistf, 100 * thres)\n', (2203, 2226), False, 'import numpy\n')]
import tensorflow.keras as keras import numpy as np import pythia import pythia.learned import tensorflow as tf import unittest class TestLearnedBonds(unittest.TestCase): @classmethod def setUpClass(cls): tf.config.optimizer.set_jit(True) gpus = tf.config.experimental.list_physical_devices('GP...
[ "unittest.main", "tensorflow.config.optimizer.set_jit", "tensorflow.random.set_seed", "numpy.random.uniform", "numpy.random.seed", "tensorflow.keras.utils.to_categorical", "tensorflow.keras.layers.Dense", "tensorflow.config.experimental.set_memory_growth", "numpy.linalg.norm", "tensorflow.keras.mo...
[((1869, 1884), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1882, 1884), False, 'import unittest\n'), ((223, 256), 'tensorflow.config.optimizer.set_jit', 'tf.config.optimizer.set_jit', (['(True)'], {}), '(True)\n', (250, 256), True, 'import tensorflow as tf\n'), ((272, 323), 'tensorflow.config.experimental.lis...
# coding: utf-8 from PIL import Image, ImageDraw import numpy as np def Robert(img,threshold): pixel = img.load() img_new = Image.new(img.mode,img.size) array = np.zeros((img.width,img.height)) temp1 = 0 temp2 = 0 mask1 = np.array([[1,0], [0,-1]]) mask2 = np.array([[...
[ "numpy.array", "PIL.Image.new", "numpy.zeros", "PIL.Image.open" ]
[((9826, 9848), 'PIL.Image.open', 'Image.open', (['"""lena.bmp"""'], {}), "('lena.bmp')\n", (9836, 9848), False, 'from PIL import Image, ImageDraw\n'), ((135, 164), 'PIL.Image.new', 'Image.new', (['img.mode', 'img.size'], {}), '(img.mode, img.size)\n', (144, 164), False, 'from PIL import Image, ImageDraw\n'), ((176, 20...
import os, sys import copy import argparse import random import cv2 import pickle import numpy as np import torch import pygame from tqdm import tqdm from functools import partial import json dqgnn_path=os.path.dirname(os.path.abspath(__file__)) root_path=os.path.dirname(os.path.dirname(dqgnn_path)) sys.path.append(ro...
[ "os.mkdir", "numpy.random.seed", "argparse.ArgumentParser", "cv2.VideoWriter_fourcc", "examples.env_setting_kwargs.get_env_kwargs_dict", "examples.rl_dqgnn.nn_utils.get_nn_func", "pickle.load", "numpy.mean", "numpy.arange", "torch.no_grad", "os.path.join", "sys.path.append", "os.path.abspath...
[((302, 328), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (317, 328), False, 'import os, sys\n'), ((220, 245), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (235, 245), False, 'import os, sys\n'), ((273, 300), 'os.path.dirname', 'os.path.dirname', (['dqgnn_pat...
import math import numpy as np import torch import gpytorch from torch.optim import SGD, Adam from torch.optim.lr_scheduler import MultiStepLR from sklearn.metrics import roc_auc_score,accuracy_score from svdkl import (NeuralNetLayer, GaussianProcessLayer, DKLModel) """ Trainer c...
[ "sklearn.metrics.accuracy_score", "sklearn.metrics.roc_auc_score", "svdkl.NeuralNetLayer", "torch.cuda.is_available", "svdkl.DKLModel", "torch.no_grad", "gpytorch.likelihoods.BernoulliLikelihood", "numpy.concatenate", "torch.optim.lr_scheduler.MultiStepLR" ]
[((2273, 2400), 'torch.optim.lr_scheduler.MultiStepLR', 'MultiStepLR', (['self.optimizer'], {'gamma': '(0.1)', 'milestones': "[0.5 * self.hyper_params['epochs'], 0.75 * self.hyper_params['epochs']]"}), "(self.optimizer, gamma=0.1, milestones=[0.5 * self.hyper_params[\n 'epochs'], 0.75 * self.hyper_params['epochs']])...
import os import argparse import numpy as np import pickle as pkl import skimage.external.tifffile as tiffreader from PIL import Image class Downsample: def __init__(self, resize_by): self.resize_by = resize_by def execute(self, file_name): if file_name.endswith(".jpg"): image = I...
[ "os.makedirs", "skimage.external.tifffile.imread", "argparse.ArgumentParser", "os.path.exists", "PIL.Image.open", "numpy.array", "PIL.Image.fromarray", "os.path.join" ]
[((1066, 1087), 'numpy.array', 'np.array', (['image_stack'], {}), '(image_stack)\n', (1074, 1087), True, 'import numpy as np\n'), ((1324, 1393), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Transform the .tif images to a .pkl stack."""'], {}), "('Transform the .tif images to a .pkl stack.')\n", (1347, 13...
def scatterg(x,y,label,num_labels,x1_axis,x2_axis,ptitle): import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as palette label=np.asarray(label) label=label.astype(int) # Create palette palette = palette.rainbow(np.linspace(0,1,num_labels + 1)); colors = pale...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.scatter", "numpy.asarray", "matplotlib.pyplot.figure", "numpy.linspace", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((168, 185), 'numpy.asarray', 'np.asarray', (['label'], {}), '(label)\n', (178, 185), True, 'import numpy as np\n'), ((362, 374), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (372, 374), True, 'import matplotlib.pyplot as plt\n'), ((379, 406), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y'], {'c...
""" Normalization methods """ import numpy from math import sqrt from numpy import amin from numpy import amax class get_methods: def __new__(self, mtype = 'ALL', include_un = True): if(type(mtype) == list): return mtype elif(type(mtype) == str): if(mtype == 'ALL'): ...
[ "numpy.quantile", "numpy.amin", "math.sqrt", "numpy.tanh", "numpy.std", "numpy.median", "numpy.power", "numpy.zeros", "numpy.amax", "numpy.finfo", "numpy.mean", "numpy.exp", "numpy.sign", "numpy.sqrt" ]
[((1071, 1088), 'numpy.mean', 'numpy.mean', (['train'], {}), '(train)\n', (1081, 1088), False, 'import numpy\n'), ((1226, 1243), 'numpy.mean', 'numpy.mean', (['train'], {}), '(train)\n', (1236, 1243), False, 'import numpy\n'), ((1257, 1272), 'numpy.std', 'numpy.std', (['test'], {}), '(test)\n', (1266, 1272), False, 'im...
import unittest import numpy import chainer from chainer.backends import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr _backend_params = ( # CPU tests testing.product({ 'use_cuda': [False], 'use_ideep': ['ne...
[ "chainer.testing.product", "chainer.Variable", "chainer.gradient_check.check_backward", "numpy.random.uniform", "chainer.backends.cuda.to_cpu", "chainer.backends.cuda.to_gpu", "chainer.is_debug", "chainer.set_debug", "numpy.asarray", "chainer.backends.cuda.cupy.array", "numpy.array", "chainer....
[((611, 662), 'chainer.testing.inject_backend_tests', 'testing.inject_backend_tests', (['None', '_backend_params'], {}), '(None, _backend_params)\n', (639, 662), False, 'from chainer import testing\n'), ((2586, 2637), 'chainer.testing.inject_backend_tests', 'testing.inject_backend_tests', (['None', '_backend_params'], ...
from __future__ import print_function import sys import os,sys,inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) sys.path.insert(0,parentdir) from Game import Game from othello.OthelloLogic import Board import numpy as np from time im...
[ "numpy.sum", "numpy.copy", "os.path.dirname", "numpy.zeros", "sys.path.insert", "numpy.fliplr", "numpy.rot90", "numpy.array", "numpy.reshape", "inspect.currentframe", "numpy.argwhere", "othello.OthelloLogic.Board" ]
[((170, 197), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (185, 197), False, 'import os, sys, inspect\n'), ((198, 227), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (213, 227), False, 'import os, sys, inspect\n'), ((678, 691), 'othello.OthelloLo...
# Code from Chapter 17 of Machine Learning: An Algorithmic Perspective (2nd Edition) # by <NAME> (http://stephenmonika.net) # You are free to use, change, or redistribute the code in any way you wish for # non-commercial purposes, but please maintain the name of the original author. # This code comes with no warranty ...
[ "pylab.ion", "pylab.show", "pylab.title", "hopfield.hopfield", "scipy.io.loadmat", "pylab.axis", "numpy.sum", "numpy.zeros", "numpy.ones", "numpy.shape", "pylab.subplot", "numpy.where", "numpy.arange", "pylab.suptitle", "numpy.array", "pylab.figure", "numpy.random.shuffle" ]
[((2196, 2204), 'pylab.ion', 'pl.ion', ([], {}), '()\n', (2202, 2204), True, 'import pylab as pl\n'), ((2239, 2252), 'numpy.arange', 'np.arange', (['(20)'], {}), '(20)\n', (2248, 2252), True, 'import numpy as np\n'), ((2408, 2442), 'scipy.io.loadmat', 'sio.loadmat', (['"""binaryalphadigs.mat"""'], {}), "('binaryalphadi...
# -*- coding: utf-8 -*- """ Created on Sun May 19 10:29:08 2019 @author: Darin """ import numpy as np class Interpolation: """ Base class for interpolation, handles the maximum feature length aspect """ def __init__(self, P, R, vdmin, p, q, minStiff=1e-10): """ Base class to handle max features ...
[ "numpy.zeros_like", "numpy.minimum", "numpy.ones_like", "numpy.ones", "numpy.append" ]
[((1593, 1618), 'numpy.minimum', 'np.minimum', (['(self.P * x)', '(1)'], {}), '(self.P * x, 1)\n', (1603, 1618), True, 'import numpy as np\n'), ((3598, 3616), 'numpy.ones', 'np.ones', (['rho.shape'], {}), '(rho.shape)\n', (3605, 3616), True, 'import numpy as np\n'), ((5409, 5427), 'numpy.ones', 'np.ones', (['rho.shape'...
#testing script for the basic elements to training a convolutional variational #autoencoder for the time series masks. #the architecture is based on that for the MNIST by debuggercafe: #https://debuggercafe.com/convolutional-variational-autoencoder-in-pytorch-on-mnist-dataset/ #############################...
[ "numpy.load", "matplotlib.style.use", "matplotlib.pyplot.figure", "numpy.linalg.norm", "engine.validate", "torchvision.datasets.DatasetFolder", "torch.nn.BCELoss", "torch.utils.data.DataLoader", "model.parameters", "engine.train", "matplotlib.pyplot.rcParams.update", "matplotlib.pyplot.show", ...
[((1200, 1230), 'matplotlib.style.use', 'matplotlib.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (1220, 1230), False, 'import matplotlib\n'), ((1232, 1270), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 25}"], {}), "({'font.size': 25})\n", (1251, 1270), True, 'import matplotlib.pyp...
__author__ = 'igor' import pickle import matplotlib.pyplot as plt import numpy as np from loadData import * with open("data/net1.pickle", 'rb') as f1: net1 = pickle.load(f1) f1.close() with open("data/net2.pickle", 'rb') as f2: net2 = pickle.load(f2) f2.close() # net1保存了训练中的结果 train_loss1 = np.array([i["trai...
[ "matplotlib.pyplot.yscale", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "pickle.load", "numpy.array", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.grid" ]
[((303, 359), 'numpy.array', 'np.array', (["[i['train_loss'] for i in net1.train_history_]"], {}), "([i['train_loss'] for i in net1.train_history_])\n", (311, 359), True, 'import numpy as np\n'), ((374, 430), 'numpy.array', 'np.array', (["[i['valid_loss'] for i in net1.train_history_]"], {}), "([i['valid_loss'] for i i...
#!/usr/bin/env python # PyQT4 imports from PyQt4 import QtGui, QtCore, QtOpenGL from PyQt4.QtOpenGL import QGLWidget # PyOpenGL imports import OpenGL.GL as gl import OpenGL.arrays.vbo as glvbo class GLPlotWidget(QGLWidget): # default window size width, height = 600, 600 def set_data(self, data): "...
[ "OpenGL.GL.glViewport", "OpenGL.GL.glMatrixMode", "OpenGL.arrays.vbo.VBO", "numpy.random.randn", "OpenGL.GL.glOrtho", "PyQt4.QtGui.QApplication", "OpenGL.GL.glEnableClientState", "OpenGL.GL.glColor", "OpenGL.GL.glClearColor", "OpenGL.GL.glVertexPointer", "OpenGL.GL.glDrawArrays", "OpenGL.GL.gl...
[((2817, 2845), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (2835, 2845), False, 'from PyQt4 import QtGui, QtCore, QtOpenGL\n'), ((570, 597), 'OpenGL.GL.glClearColor', 'gl.glClearColor', (['(0)', '(0)', '(0)', '(0)'], {}), '(0, 0, 0, 0)\n', (585, 597), True, 'import OpenGL.GL a...
from typing import NoReturn from ...base import BaseEstimator import numpy as np class GaussianNaiveBayes(BaseEstimator): """ Gaussian Naive-Bayes classifier """ def __init__(self): """ Instantiate a Gaussian Naive Bayes classifier Attributes ---------- self.c...
[ "numpy.sum", "numpy.log", "numpy.square", "numpy.zeros", "numpy.array", "numpy.unique", "numpy.sqrt" ]
[((1444, 1456), 'numpy.unique', 'np.unique', (['y'], {}), '(y)\n', (1453, 1456), True, 'import numpy as np\n'), ((1721, 1732), 'numpy.zeros', 'np.zeros', (['K'], {}), '(K)\n', (1729, 1732), True, 'import numpy as np\n'), ((2267, 2281), 'numpy.array', 'np.array', (['vars'], {}), '(vars)\n', (2275, 2281), True, 'import n...
import asyncio import time from asyncio import coroutine import numpy as np from openvpp_agents.core.observer.monitoring import Monitoring import psutil class PerformanceMonitoring(Monitoring): def __init__(self, dbfile): super().__init__(dbfile) self._stop_monitor_run = True self._tas...
[ "psutil.virtual_memory", "psutil.Process", "asyncio.get_event_loop", "numpy.dtype", "time.sleep", "time.monotonic", "numpy.array" ]
[((362, 386), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (384, 386), False, 'import asyncio\n'), ((2106, 2191), 'numpy.dtype', 'np.dtype', (["[('t', 'float64'), ('cpu_percent', 'float32'), ('mem_bytes', 'uint64')]"], {}), "([('t', 'float64'), ('cpu_percent', 'float32'), ('mem_bytes',\n 'ui...
# class for RANS ContinuityEquationWithFavrianDilatation # import numpy as np import sys from scipy import integrate import matplotlib.pyplot as plt from UTILS.Calculus import Calculus from UTILS.SetAxisLimit import SetAxisLimit from UTILS.Tools import Tools from UTILS.Errors import Errors # Theoretical background h...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.axvline", "matplotlib.pyplot.savefig", "matplotlib.pyplot.show", "numpy.log", "matplotlib.pyplot.plot", "matplotlib.pyplot.ylim", "matplotlib.pyplot.legend", "matplotlib.pyplot.figure", "matplotlib.pyplot.gca", "matplotlib.pyplot.ylabel", "matplotl...
[((3413, 3439), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(7, 6)'}), '(figsize=(7, 6))\n', (3423, 3439), True, 'import matplotlib.pyplot as plt\n'), ((3713, 3733), 'matplotlib.pyplot.title', 'plt.title', (['"""density"""'], {}), "('density')\n", (3722, 3733), True, 'import matplotlib.pyplot as plt\n')...
from collections import OrderedDict, namedtuple from typing import Union, Tuple, MutableMapping, Optional from numbers import Number import numpy as np import torch import torch.optim as optim from rlkit.core.loss import LossFunction from torch.distributions import Bernoulli from torch.distributions.kl import kl_diver...
[ "rlkit.torch.pytorch_util.soft_update_from_to", "torch.distributions.Bernoulli", "torch.nn.MSELoss", "rlkit.torch.pytorch_util.zeros", "rlkit.torch.pytorch_util.get_numpy", "numpy.log", "rlkit.misc.ml_util.ConstantSchedule", "torch.sigmoid", "torch.clamp", "numpy.array", "collections.namedtuple"...
[((627, 694), 'collections.namedtuple', 'namedtuple', (['"""SACLosses"""', '"""policy_loss qf1_loss qf2_loss alpha_loss"""'], {}), "('SACLosses', 'policy_loss qf1_loss qf2_loss alpha_loss')\n", (637, 694), False, 'from collections import OrderedDict, namedtuple\n'), ((6114, 6126), 'torch.nn.MSELoss', 'nn.MSELoss', ([],...
import numpy as np import torch from debugq.algos import sampling_fqi import debugq.pytorch_util as ptu from rlutil.envs.tabular import q_iteration import random from rlutil.logging import logger PROB_EPS = 1e-8 class ReplayBufferFQI(sampling_fqi.PolicySamplingFQI): def __init__(self, env, network, replay_buffe...
[ "numpy.zeros_like", "numpy.sum", "debugq.algos.sampling_fqi.compute_weights", "rlutil.envs.tabular.q_iteration.logsumexp", "numpy.zeros", "numpy.ones", "rlutil.logging.logger.record_tabular", "numpy.where", "rlutil.envs.tabular.q_iteration.compute_visitation" ]
[((1084, 1108), 'numpy.ones', 'np.ones', (['self.batch_size'], {}), '(self.batch_size)\n', (1091, 1108), True, 'import numpy as np\n'), ((1375, 1436), 'rlutil.envs.tabular.q_iteration.logsumexp', 'q_iteration.logsumexp', (['self.ground_truth_q'], {'alpha': 'self.ent_wt'}), '(self.ground_truth_q, alpha=self.ent_wt)\n', ...
import numpy import thinkdsp import thinkplot import matplotlib.pyplot as plt import wave import sys import librosa from functools import reduce from scipy import signal as sig numpy.set_printoptions(threshold=numpy.inf) #numpy.set_printoptions(threshold=10) #short_pop = thinkdsp.read_wave('short_pops.wav') #open wave...
[ "numpy.full", "scipy.signal.lfilter_zi", "wave.open", "numpy.set_printoptions", "numpy.fft.rfft", "matplotlib.pyplot.title", "scipy.signal.filtfilt", "matplotlib.pyplot.plot", "scipy.signal.lfilter", "matplotlib.pyplot.show", "matplotlib.pyplot.figure", "numpy.fromstring", "librosa.load", ...
[((177, 220), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'threshold': 'numpy.inf'}), '(threshold=numpy.inf)\n', (199, 220), False, 'import numpy\n'), ((353, 385), 'wave.open', 'wave.open', (['"""short_pops.wav"""', '"""r"""'], {}), "('short_pops.wav', 'r')\n", (362, 385), False, 'import wave\n'), ((392, ...
import numpy as np import matplotlib.pyplot as plt import pickle optimizer = "kfac" cache_fname = f"/home/mscherbela/tmp/data_shared_vs_indep_{optimizer}.pkl" with open(cache_fname, 'rb') as f: full_plot_data = pickle.load(f) plot_data = full_plot_data['Ethene'] colors = dict(Indep='C0', ReuseIndep='C0', ReuseSha...
[ "matplotlib.pyplot.close", "pickle.load", "matplotlib.pyplot.subplots", "numpy.arange" ]
[((992, 1008), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (1001, 1008), True, 'import matplotlib.pyplot as plt\n'), ((1019, 1062), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(7, 4)', 'dpi': '(200)'}), '(1, 1, figsize=(7, 4), dpi=200)\n', (1031, 1062), True...
'''Tests for model fitting.''' import model_fitting import lmfit import numpy as np ############ CONSTANTS ############# IS_PLOT = False NROWS = 10 NROWS_SUBSET = 5 NCOLS = 3 LENGTH = NROWS*NCOLS INDICES = range(NROWS) # Set to values used in model_fitting.MODEL TEST_PARAMETERS = lmfit.Parameters() TEST_PARAMETERS.a...
[ "numpy.abs", "model_fitting.calcRsq", "numpy.shape", "numpy.isclose", "model_fitting.runSimulation", "numpy.random.normal", "model_fitting.makeAverageParameters", "lmfit.Parameters", "numpy.reshape", "model_fitting.crossValidate", "numpy.var", "model_fitting.makeParameters", "model_fitting.a...
[((284, 302), 'lmfit.Parameters', 'lmfit.Parameters', ([], {}), '()\n', (300, 302), False, 'import lmfit\n'), ((789, 821), 'numpy.reshape', 'np.reshape', (['data', '(nrows, ncols)'], {}), '(data, (nrows, ncols))\n', (799, 821), True, 'import numpy as np\n'), ((1156, 1212), 'model_fitting.arrayDifference', 'model_fittin...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd import cplane_np import sys import cmath import csv from cplane_np import ArrayComplexPlane ### # Name: <NAME>, <NAME> # Student ID: 01932978 , # Email: <EMAIL> , <EMAIL> # Course: CS510 Fall 2017 # Assignment: Homework 06 ### d...
[ "csv.reader", "numpy.vectorize", "csv.writer", "cplane_np.ArrayComplexPlane.__init__" ]
[((639, 654), 'numpy.vectorize', 'np.vectorize', (['f'], {}), '(f)\n', (651, 654), True, 'import numpy as np\n'), ((775, 833), 'cplane_np.ArrayComplexPlane.__init__', 'ArrayComplexPlane.__init__', (['self', '(-2)', '(2)', '(1000)', '(-2)', '(2)', '(1000)'], {}), '(self, -2, 2, 1000, -2, 2, 1000)\n', (801, 833), False, ...
import logging from operator import itemgetter import pandas as pd from scipy.stats import hypergeom import numpy as np class ScoringFunction(): def __init__(self): pass def calc_hypergeom(self, aligned_peaks, theoretical_spectrum, experimental_spectrum, num_bins, log10_transform=True): num_alig...
[ "scipy.stats.hypergeom", "numpy.arange" ]
[((452, 503), 'scipy.stats.hypergeom', 'hypergeom', (['num_bins', 'num_theor_peaks', 'num_exp_peaks'], {}), '(num_bins, num_theor_peaks, num_exp_peaks)\n', (461, 503), False, 'from scipy.stats import hypergeom\n'), ((619, 654), 'numpy.arange', 'np.arange', (['(0)', '(num_aligned_peaks + 1)'], {}), '(0, num_aligned_peak...
import logging import secrets import numpy as np from .. import util from ..util.errors import NumericalPrecisionError class Coreset(object): def __init__(self, initial_wts_sz=1000): self.alg_name = self.__class__.__name__ + '-' + secrets.token_hex(3) self.log = logging.LoggerAdapter(logging.get...
[ "numpy.atleast_1d", "numpy.zeros", "secrets.token_hex", "numpy.issubdtype", "numpy.any", "numpy.arange", "numpy.intersect1d", "logging.getLogger" ]
[((478, 502), 'numpy.zeros', 'np.zeros', (['initial_wts_sz'], {}), '(initial_wts_sz)\n', (486, 502), True, 'import numpy as np\n'), ((524, 564), 'numpy.zeros', 'np.zeros', (['initial_wts_sz'], {'dtype': 'np.int64'}), '(initial_wts_sz, dtype=np.int64)\n', (532, 564), True, 'import numpy as np\n'), ((1529, 1550), 'numpy....
import torch import numpy as np from scipy.io import wavfile from torch_pitch_shift import * # read an audio file SAMPLE_RATE, sample = wavfile.read("./wavs/test.wav") # convert to tensor of shape (batch_size, channels, samples) dtype = sample.dtype sample = torch.tensor( [np.swapaxes(sample, 0, 1)], # (samples,...
[ "torch.cuda.is_available", "numpy.swapaxes", "scipy.io.wavfile.read" ]
[((137, 168), 'scipy.io.wavfile.read', 'wavfile.read', (['"""./wavs/test.wav"""'], {}), "('./wavs/test.wav')\n", (149, 168), False, 'from scipy.io import wavfile\n'), ((280, 305), 'numpy.swapaxes', 'np.swapaxes', (['sample', '(0)', '(1)'], {}), '(sample, 0, 1)\n', (291, 305), True, 'import numpy as np\n'), ((401, 426),...
# Gmsh - Copyright (C) 1997-2019 <NAME>, <NAME> # # See the LICENSE.txt file for license information. Please report all # issues on https://gitlab.onelab.info/gmsh/gmsh/issues. # This file defines the Gmsh Python API (v4.4). # # Do not edit it directly: it is automatically generated by `api/gen.py'. # # By design, the...
[ "ctypes.util.find_library", "os.path.realpath", "numpy.ascontiguousarray", "os.path.exists", "numpy.ctypeslib.as_array", "platform.system", "signal.signal", "backports.weakref.finalize", "os.path.join" ]
[((708, 752), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal.SIG_DFL'], {}), '(signal.SIGINT, signal.SIG_DFL)\n', (721, 752), False, 'import signal\n'), ((778, 804), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (794, 804), False, 'import os\n'), ((809, 826), 'platform.system...
import numpy as np from scipy.linalg import solve import sympy import random import binascii import time #Creating Hadamard Matrices H2 = np.array([[1,1], [1,-1]]) H4 = np.kron(H2,H2) H8 = np.kron(H4,H2) # H16 = np.kron(H4,H4) #Creating codeword matrix C8 = np.concatenate((H8,-H8)) C8[C8 == -1] = 0 #A...
[ "numpy.zeros", "numpy.transpose", "numpy.all", "sympy.Matrix", "random.random", "numpy.array", "numpy.kron", "numpy.dot", "numpy.concatenate" ]
[((140, 167), 'numpy.array', 'np.array', (['[[1, 1], [1, -1]]'], {}), '([[1, 1], [1, -1]])\n', (148, 167), True, 'import numpy as np\n'), ((185, 200), 'numpy.kron', 'np.kron', (['H2', 'H2'], {}), '(H2, H2)\n', (192, 200), True, 'import numpy as np\n'), ((205, 220), 'numpy.kron', 'np.kron', (['H4', 'H2'], {}), '(H4, H2)...
import argparse from typing import Sequence, Union import torch from torch.nn import functional as F import numpy as np import wandb import albumentations as A import cv2 import pytorch_lightning as pl from . import data from .dep.unet import ResNetUNet from .dep.siren import Siren from .data.obj import Obj from .dat...
[ "albumentations.ColorJitter", "albumentations.ISONoise", "torch.randn_like", "albumentations.GaussNoise", "albumentations.CoarseDropout", "torch.nn.functional.cross_entropy", "torch.cat", "torch.sigmoid", "albumentations.GaussianBlur", "numpy.arange", "torch.arange", "wandb.Image", "torch.ze...
[((9040, 9055), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (9053, 9055), False, 'import torch\n'), ((10172, 10187), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (10185, 10187), False, 'import torch\n'), ((6112, 6136), 'torch.sigmoid', 'torch.sigmoid', (['mask_lgts'], {}), '(mask_lgts)\n', (6125, 6136), ...
import numpy as np import math import torch import torch.nn as nn import time from torch.autograd import Variable import pandas as pd import argparse import os os.environ['KMP_DUPLICATE_LIB_OK']=True # For MAC MKL Optimization np.random.seed(0) torch.manual_seed(0) device = torch.device("cuda:0" if torch.cuda.is_availa...
[ "numpy.random.seed", "argparse.ArgumentParser", "pandas.read_csv", "torch.mm", "torch.exp", "torch.Tensor", "numpy.loadtxt", "torch.nn.Linear", "math.log", "torch.logsumexp", "torch.nn.BCEWithLogitsLoss", "torch.randn_like", "torch.manual_seed", "torch.autograd.Variable", "torch.clamp", ...
[((227, 244), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (241, 244), True, 'import numpy as np\n'), ((245, 265), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (262, 265), False, 'import torch\n'), ((1436, 1498), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descrip...
import image_emotion_gender_demo import sys import os, time import cv2 import time import numpy as np from utils.inference import load_image import matplotlib.pyplot as plt dir_path = os.path.dirname(os.path.realpath(__file__)) pipe_path = dir_path + "/../term_sig/end" print(dir_path) if not os.path.exists(pipe_path)...
[ "matplotlib.pyplot.title", "os.open", "matplotlib.pyplot.show", "matplotlib.pyplot.bar", "matplotlib.pyplot.legend", "os.path.realpath", "os.path.exists", "time.sleep", "cv2.VideoCapture", "numpy.arange", "matplotlib.pyplot.xticks", "os.mkfifo", "os.fdopen", "matplotlib.pyplot.ylabel", "...
[((348, 379), 'cv2.namedWindow', 'cv2.namedWindow', (['"""window_frame"""'], {}), "('window_frame')\n", (363, 379), False, 'import cv2\n'), ((396, 415), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (412, 415), False, 'import cv2\n'), ((500, 547), 'os.open', 'os.open', (['pipe_path', '(os.O_RDONLY | o...
import numpy as np import os import util.knn as knn def make_train(train_path, paths): # list all files in base directory and normalize their path name selected = [os.path.join(str(i), f.split('.')[0]) for i in range(10) for f in os.listdir(os.path.join(train_path, str(i)))] return [np.w...
[ "numpy.load", "util.knn.KNearestNeighborsTrainTest", "argparse.ArgumentParser", "numpy.where" ]
[((415, 433), 'numpy.load', 'np.load', (['dist_path'], {}), '(dist_path)\n', (422, 433), True, 'import numpy as np\n'), ((602, 670), 'util.knn.KNearestNeighborsTrainTest', 'knn.KNearestNeighborsTrainTest', (['distances', 'train_labels', 'test_labels'], {}), '(distances, train_labels, test_labels)\n', (632, 670), True, ...
""" Modified by <NAME> <<EMAIL>> based on <https://github.com/riannevdberg/sylvester-flows/blob/master/models/flows.py>. Collection of flow strategies """ from __future__ import print_function import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F #from models.laye...
[ "torch.ones_like", "torch.ones", "torch.bmm", "torch.eye", "torch.nn.Sequential", "torch.nn.Tanh", "torch.autograd.Variable", "torch.nn.Softplus", "numpy.ones", "torch.cuda.is_available", "torch.nn.ParameterList", "torch.arange", "torch.sum", "torch.tensor" ]
[((719, 728), 'torch.nn.Tanh', 'nn.Tanh', ([], {}), '()\n', (726, 728), True, 'import torch.nn as nn\n'), ((753, 766), 'torch.nn.Softplus', 'nn.Softplus', ([], {}), '()\n', (764, 766), True, 'import torch.nn as nn\n'), ((1543, 1558), 'torch.bmm', 'torch.bmm', (['w', 'u'], {}), '(w, u)\n', (1552, 1558), False, 'import t...
import argparse import gzip import json import logging import os import statistics from collections import defaultdict from time import time import bcolz as bz import numpy as np import pyBigWig import pysam from functions import * def get_chr_len(bam_file, chrom): with pysam.AlignmentFile(bam_file, 'rb') as ba...
[ "numpy.load", "argparse.ArgumentParser", "os.makedirs", "bcolz.carray", "logging.basicConfig", "pysam.AlignmentFile", "numpy.zeros", "time.time", "collections.defaultdict", "logging.info", "os.path.isfile", "numpy.arange", "gzip.GzipFile", "os.path.join" ]
[((1132, 1149), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (1143, 1149), False, 'from collections import defaultdict\n'), ((3816, 3870), 'numpy.zeros', 'np.zeros', ([], {'shape': '(chrlen, n_channels)', 'dtype': 'np.float64'}), '(shape=(chrlen, n_channels), dtype=np.float64)\n', (3824, 3870),...
''' File name: nonMaxSup.py Author: <NAME> Date created: Dec. 8, 2019 ''' import numpy as np from helpers import get_edge_angle ''' File clarification: Find local maximum edge pixel using NMS along the line of the gradient - Input Mag: H x W matrix represents the magnitude of derivatives - Input O...
[ "helpers.get_edge_angle", "numpy.copy" ]
[((748, 760), 'numpy.copy', 'np.copy', (['Mag'], {}), '(Mag)\n', (755, 760), True, 'import numpy as np\n'), ((940, 965), 'helpers.get_edge_angle', 'get_edge_angle', (['Ori[i, j]'], {}), '(Ori[i, j])\n', (954, 965), False, 'from helpers import get_edge_angle\n')]
#!/usr/bin/env python import numpy as np import pandas as pd import os import utils_snpko as utils logger = utils.logger def parse_knockoff_results(args, df_uncorrected=None): if df_uncorrected is None: df_uncorrected = pd.read_csv(os.path.join( args.results_dir, 'uncorrected.csv')) gro...
[ "pandas.DataFrame", "utils_snpko.parse_arguments", "numpy.argmax", "utils_snpko.initialize_logger", "utils_snpko.safe_mkdir", "os.path.join" ]
[((1774, 2013), 'pandas.DataFrame', 'pd.DataFrame', (["{'label': label_list, 'fdr_type': fdr_type_list, 'SNP': SNP_list,\n 'obs_freq': obs_freq_list, 'uncorrected_p_value':\n uncorrected_p_value_list, 'uncorrected_odds_ratio':\n uncorrected_odds_ratio_list, 'fdr': fdr_list}"], {}), "({'label': label_list, 'fdr...
# This script computes the matter Pk in real- and redshift-space. It takes as input # the first and last number of the wanted realizations, the cosmology and the snapnum # In redshift-space it computes the power spectrum along the 3 different axes. import argparse from mpi4py import MPI import numpy as np import sys,o...
[ "numpy.load", "argparse.ArgumentParser", "os.path.exists", "os.system", "numpy.transpose", "numpy.arange", "Pk_library.Pk_plane" ]
[((644, 718), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script computes the bispectrum"""'}), "(description='This script computes the bispectrum')\n", (667, 718), False, 'import argparse\n'), ((1656, 1703), 'os.system', 'os.system', (["('mkdir %s/%s/' % (folder_out, cosmo))"], ...
import torch from PIL import Image import torchvision.transforms as transforms import numpy as np import cv2 import random # generating random text effects on the distance map # grayimg1, gratimg2: two distance maps to be colorized using the same text effects # maxcolornum: determine the richness of color def coloriz...
[ "cv2.GaussianBlur", "random.randint", "numpy.empty", "numpy.transpose", "torchvision.transforms.ToPILImage", "numpy.max", "numpy.random.randint", "cv2.LUT", "numpy.linspace", "numpy.round", "torch.tensor", "torchvision.transforms.ToTensor" ]
[((825, 869), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '(colornum + 1, 3)'], {}), '(0, 255, (colornum + 1, 3))\n', (842, 869), True, 'import numpy as np\n'), ((927, 951), 'numpy.empty', 'np.empty', ([], {'shape': '(256, 3)'}), '(shape=(256, 3))\n', (935, 951), True, 'import numpy as np\n'), ((1347...
from PIL import Image import base64 import io import cv2 import numpy as np def b64_img(base64img): base64_decoded = base64.b64decode(base64img) image = Image.open(io.BytesIO(base64_decoded)) image_np = np.array(image) return image_np def img_b64(img): cv2.imwrite('./test.jpg', img) wit...
[ "io.BytesIO", "cv2.waitKey", "cv2.imwrite", "base64.b64decode", "cv2.imread", "numpy.array", "cv2.imshow" ]
[((123, 150), 'base64.b64decode', 'base64.b64decode', (['base64img'], {}), '(base64img)\n', (139, 150), False, 'import base64\n'), ((217, 232), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (225, 232), True, 'import numpy as np\n'), ((277, 307), 'cv2.imwrite', 'cv2.imwrite', (['"""./test.jpg"""', 'img'], {})...
import numpy as np from .activation import ActivationFunc class ReLU(ActivationFunc): """Relu activation function """ def __init__(self): super().__init__() def forward(self, x): """forward pass """ out = np.maximum(0, x) self.f_val = out return out ...
[ "numpy.maximum" ]
[((258, 274), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (268, 274), True, 'import numpy as np\n')]
# Copyright 2021 ETH Zurich and the NPBench authors. All rights reserved. import numpy as np def initialize(N, datatype=np.int32): seq = np.fromfunction(lambda i: (i + 1) % 4, (N, ), dtype=datatype) return seq
[ "numpy.fromfunction" ]
[((144, 204), 'numpy.fromfunction', 'np.fromfunction', (['(lambda i: (i + 1) % 4)', '(N,)'], {'dtype': 'datatype'}), '(lambda i: (i + 1) % 4, (N,), dtype=datatype)\n', (159, 204), True, 'import numpy as np\n')]
""" CEASIOMpy: Conceptual Aircraft Design Software Developed for CFS ENGINEERING, 1015 Lausanne, Switzerland Center_of_gravity evaluation for unconventional aircraft with fuselage. Function to evaluate the Center of Gravity of the aircraft. | Works with Python 2.7 | Author : <NAME> | Date of creation: 2018-10-12 | ...
[ "numpy.sum", "numpy.concatenate", "numpy.zeros", "numpy.amax", "numpy.all" ]
[((3507, 3536), 'numpy.zeros', 'np.zeros', (['(max_seg_n, tot_nb)'], {}), '((max_seg_n, tot_nb))\n', (3515, 3536), True, 'import numpy as np\n'), ((6628, 6701), 'numpy.concatenate', 'np.concatenate', (['(afg.fuse_center_seg_point, awg.wing_center_seg_point)', '(1)'], {}), '((afg.fuse_center_seg_point, awg.wing_center_s...
import unittest import sys if sys.path[0].endswith("dummies"): sys.path = sys.path[1:] import vlogging class BasicTestCase(unittest.TestCase): def test_nothing(self): s = str(vlogging.VisualRecord()) self.assertTrue("<hr/>" in s) def test_text_only(self): s = str(vlogging.Visua...
[ "matplotlib.pyplot.plot", "PIL.Image.open", "cv2.imread", "matplotlib.pyplot.figure", "numpy.arange", "vlogging.VisualRecord" ]
[((1288, 1326), 'PIL.Image.open', 'Image.open', (['"""vlogging/tests/lenna.jpg"""'], {}), "('vlogging/tests/lenna.jpg')\n", (1298, 1326), False, 'from PIL import Image\n'), ((2166, 2204), 'cv2.imread', 'cv2.imread', (['"""vlogging/tests/lenna.jpg"""'], {}), "('vlogging/tests/lenna.jpg')\n", (2176, 2204), False, 'import...
# Copyright (c) Alibaba Inc. All rights reserved. import argparse import cv2 import numpy as np import os import shutil # Parse command line arguments. parser = argparse.ArgumentParser(description='Resize HPatches sequence images.') parser.add_argument('--input_dir', type=str, default='./hpatches-sequences-release', ...
[ "os.makedirs", "argparse.ArgumentParser", "cv2.imwrite", "numpy.savetxt", "os.path.exists", "cv2.imread", "numpy.loadtxt", "shutil.rmtree", "os.path.join", "os.listdir" ]
[((163, 234), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Resize HPatches sequence images."""'}), "(description='Resize HPatches sequence images.')\n", (186, 234), False, 'import argparse\n'), ((879, 900), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir)\n', (889, 900), F...
import numpy as np import pandas as pd from astropy.io import fits from astropy.wcs import WCS from skimage.draw import polygon if __name__ == '__main__': import sys det = sys.argv[1] if (len(sys.argv) > 1) else 'all' df = pd.read_csv('../header_info.csv', index_col=0) if det != 'all': df = df...
[ "skimage.draw.polygon", "pandas.read_csv", "astropy.io.fits.PrimaryHDU", "numpy.zeros", "astropy.wcs.WCS", "astropy.io.fits.HDUList" ]
[((237, 283), 'pandas.read_csv', 'pd.read_csv', (['"""../header_info.csv"""'], {'index_col': '(0)'}), "('../header_info.csv', index_col=0)\n", (248, 283), True, 'import pandas as pd\n'), ((359, 387), 'astropy.wcs.WCS', 'WCS', (['"""data/M33_SDSS9_r.fits"""'], {}), "('data/M33_SDSS9_r.fits')\n", (362, 387), False, 'from...
# **************************************************************** # library import block # **************************************************************** import numpy as np import tensorflow as tf import pandas as pd import os import logging import time import sys from scipy.cluster.vq import kmeans import pickle im...
[ "gpflow.transforms.Log1pe", "numpy.abs", "tensorflow.trainable_variables", "tensorflow.reset_default_graph", "tensorflow.reshape", "time.strftime", "numpy.ones", "numpy.argsort", "tensorflow.multiply", "tensorflow.matmul", "numpy.mean", "numpy.arange", "tensorflow.InteractiveSession", "ten...
[((375, 400), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (393, 400), True, 'import matplotlib.pyplot as plt\n'), ((535, 559), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (557, 559), True, 'import tensorflow as tf\n'), ((622, 648), 'sys.p...
""" Module providing JSON serialization and de-serialization just like the `json` module, but with support for more data types (e.g., NumPy arrays). """ import base64 import fractions import io import json import warnings # NumPy is optional (used in the extended JSON encoder/decoder) try: import numpy as np ...
[ "json.dump", "io.BytesIO", "json.load", "numpy.save", "json.loads", "json.dumps", "base64.b64encode", "fractions.Fraction" ]
[((3387, 3413), 'json.dump', 'json.dump', (['*args'], {}), '(*args, **kwargs)\n', (3396, 3413), False, 'import json\n'), ((3576, 3603), 'json.dumps', 'json.dumps', (['*args'], {}), '(*args, **kwargs)\n', (3586, 3603), False, 'import json\n'), ((3750, 3776), 'json.load', 'json.load', (['*args'], {}), '(*args, **kwargs)\...
import os import argparse import importlib from natsort import natsorted from tqdm import tqdm, trange from collections import Counter import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from lib.config import config, update_config, infer_exp_...
[ "argparse.ArgumentParser", "importlib.import_module", "lib.config.config.dataset.valid_kwargs.update", "torch.utils.data.DataLoader", "lib.config.update_config", "lib.config.infer_exp_id", "os.makedirs", "torch.load", "matplotlib.pyplot.get_cmap", "numpy.array", "os.path.splitext", "numpy.aran...
[((416, 495), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (439, 495), False, 'import argparse\n'), ((965, 992), 'lib.config.update_config', 'update_config', (['config', 'args'], {...
"""Utility functions to support other modules.""" import numpy as np def check_distance_matrix(distances): """Perform all tests to check if the distance matrix is correct. Check if the distances matrix provided respects all constraints a distance matrix must have. Parameters ---------- dist...
[ "numpy.random.shuffle", "numpy.allclose", "numpy.identity", "numpy.arange", "numpy.all" ]
[((1264, 1315), 'numpy.allclose', 'np.allclose', (['matrix', 'matrix.T'], {'rtol': 'rtol', 'atol': 'atol'}), '(matrix, matrix.T, rtol=rtol, atol=atol)\n', (1275, 1315), True, 'import numpy as np\n'), ((1649, 1666), 'numpy.identity', 'np.identity', (['size'], {}), '(size)\n', (1660, 1666), True, 'import numpy as np\n'),...
"""Implementations of various coupling layers.""" import warnings import numpy as np import torch from nflows.transforms import splines from nflows.transforms.base import Transform from nflows.transforms.nonlinearities import ( PiecewiseCubicCDF, PiecewiseLinearCDF, PiecewiseQuadraticCDF, PiecewiseRat...
[ "warnings.warn", "nflows.transforms.nonlinearities.PiecewiseRationalQuadraticCDF", "torch.cat", "numpy.sqrt" ]
[((2480, 2574), 'torch.cat', 'torch.cat', (['[unnormalized_derivatives, unnormalized_derivatives[..., 0][..., None]]'], {'dim': '(-1)'}), '([unnormalized_derivatives, unnormalized_derivatives[..., 0][...,\n None]], dim=-1)\n', (2489, 2574), False, 'import torch\n'), ((2676, 2719), 'numpy.sqrt', 'np.sqrt', (['self.tr...
import argparse import numpy as np import tkinter as tk from matplotlib.figure import Figure from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) parser = argparse.ArgumentParser( description="Configure your configuration settings.")...
[ "argparse.ArgumentParser", "tkinter.Entry", "matplotlib.figure.Figure", "numpy.arange", "tkinter.Label", "tkinter.Tk", "matplotlib.backends.backend_tkagg.FigureCanvasTkAgg" ]
[((238, 315), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Configure your configuration settings."""'}), "(description='Configure your configuration settings.')\n", (261, 315), False, 'import argparse\n'), ((477, 484), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (482, 484), True, 'import ...
# PyVot Python Variational Optimal Transportation # Author: <NAME> <<EMAIL>> # Date: April 28th 2020 # Licence: MIT import os import sys import time import numpy as np import sklearn.datasets import matplotlib.pyplot as plt sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from vot_numpy imp...
[ "matplotlib.pyplot.title", "numpy.radians", "matplotlib.pyplot.subplot", "matplotlib.pyplot.xlim", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.show", "os.path.abspath", "matplotlib.pyplot.ylim", "matplotlib.pyplot.scatter", "time.time", "numpy.append", "matplotlib.pyplot.figure", "n...
[((605, 619), 'numpy.radians', 'np.radians', (['(45)'], {}), '(45)\n', (615, 619), True, 'import numpy as np\n'), ((660, 687), 'numpy.array', 'np.array', (['((c, -s), (s, c))'], {}), '(((c, -s), (s, c)))\n', (668, 687), True, 'import numpy as np\n'), ((914, 971), 'numpy.array', 'np.array', (['(utils.COLOR_LIGHT_BLUE, u...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Description: Using a two-layer network to predict the ozone layer thickness from data above Palmerston North in New Zealand between 1996 and 2004. """ from pylab import * import numpy as np #numerical package for scientific computing import mlpcn #ozone layer thickn...
[ "numpy.array", "numpy.shape", "numpy.zeros", "mlpcn.mlpcn" ]
[((898, 922), 'numpy.zeros', 'np.zeros', (['(lastPoint, k)'], {}), '((lastPoint, k))\n', (906, 922), True, 'import numpy as np\n'), ((932, 956), 'numpy.zeros', 'np.zeros', (['(lastPoint, 1)'], {}), '((lastPoint, 1))\n', (940, 956), True, 'import numpy as np\n'), ((1779, 1837), 'mlpcn.mlpcn', 'mlpcn.mlpcn', (['train', '...
# Taken from https://github.com/psclklnk/spdl # Copy of the license at TeachMyAgent/teachers/LICENSES/SPDL from TeachMyAgent.teachers.utils.torch import get_gradient, zero_grad import numpy as np import torch def _fisher_vector_product_t(p, kl_fun, param_fun, cg_damping): kl = kl_fun() grads = torch.autograd...
[ "torch.from_numpy", "numpy.zeros_like", "torch.isinf", "numpy.isinf", "numpy.isnan", "numpy.linalg.norm", "torch.sum", "torch.isnan", "numpy.sqrt" ]
[((457, 484), 'torch.sum', 'torch.sum', (['(flat_grad_kl * p)'], {}), '(flat_grad_kl * p)\n', (466, 484), False, 'import torch\n'), ((808, 827), 'torch.from_numpy', 'torch.from_numpy', (['p'], {}), '(p)\n', (824, 827), False, 'import torch\n'), ((1139, 1155), 'numpy.zeros_like', 'np.zeros_like', (['p'], {}), '(p)\n', (...
import librosa import os import numpy as np import scipy.io.wavfile as wavfile RANGE = (0,2000) if(not os.path.isdir('norm_audio_train')): os.mkdir('norm_audio_train') for num in range(RANGE[0],RANGE[1]): path = 'audio_train/trim_audio_train%s.wav'% num norm_path = 'norm_audio_train/trim_audio_train%s.wa...
[ "os.mkdir", "numpy.divide", "numpy.abs", "os.path.isdir", "os.path.exists", "scipy.io.wavfile.write", "librosa.load" ]
[((105, 138), 'os.path.isdir', 'os.path.isdir', (['"""norm_audio_train"""'], {}), "('norm_audio_train')\n", (118, 138), False, 'import os\n'), ((145, 173), 'os.mkdir', 'os.mkdir', (['"""norm_audio_train"""'], {}), "('norm_audio_train')\n", (153, 173), False, 'import os\n'), ((336, 356), 'os.path.exists', 'os.path.exist...
from __future__ import print_function import baker import logging import core.io from core.cascade import group_offsets def truncate_data(x, y, qid, docno, k): """Truncate each ranked list down to at most k documents""" import numpy as np idx = np.concatenate([np.arange(a, min(a + k, b)) for a, b in gr...
[ "numpy.concatenate", "logging.basicConfig", "pandas.read_csv", "pandas.merge", "itertools.count", "baker.run", "core.cascade.group_offsets", "numpy.unique" ]
[((2157, 2179), 'numpy.concatenate', 'np.concatenate', (['y_list'], {}), '(y_list)\n', (2171, 2179), True, 'import numpy as np\n'), ((2235, 2259), 'numpy.concatenate', 'np.concatenate', (['qid_list'], {}), '(qid_list)\n', (2249, 2259), True, 'import numpy as np\n'), ((2323, 2349), 'numpy.concatenate', 'np.concatenate',...
import glob import os import random import sys import argparse import numpy as np from config import BabiConfig, BabiConfigJoint from train_test import train, train_linear_start, test from util import parse_babi_task, build_model seed_val = 42 random.seed(seed_val) np.random.seed(seed_val) # for reproducing def r...
[ "util.parse_babi_task", "config.BabiConfig", "numpy.random.seed", "argparse.ArgumentParser", "train_test.train", "config.BabiConfigJoint", "os.path.exists", "util.build_model", "random.seed", "train_test.test", "glob.glob", "train_test.train_linear_start", "sys.exit" ]
[((247, 268), 'random.seed', 'random.seed', (['seed_val'], {}), '(seed_val)\n', (258, 268), False, 'import random\n'), ((269, 293), 'numpy.random.seed', 'np.random.seed', (['seed_val'], {}), '(seed_val)\n', (283, 293), True, 'import numpy as np\n'), ((487, 541), 'glob.glob', 'glob.glob', (["('%s/qa%d_*_train.txt' % (da...
import os import cv2 import numpy as np FROM = "/home/pallab/gestures-cnn/raw-data/thumb" TO = "/home/pallab/gestures-cnn/images/resized/" i = 0 os.chdir(FROM) for image in os.listdir(".")[:300]: im = cv2.imread(image, 0) crop = im[200:920, 0:720] rows, cols = crop.shape blur = cv2.GaussianBlur(crop, (...
[ "cv2.GaussianBlur", "numpy.random.uniform", "cv2.getRotationMatrix2D", "cv2.dilate", "cv2.medianBlur", "numpy.float32", "cv2.imread", "cv2.warpAffine", "os.chdir", "numpy.random.normal", "cv2.erode", "os.listdir" ]
[((146, 160), 'os.chdir', 'os.chdir', (['FROM'], {}), '(FROM)\n', (154, 160), False, 'import os\n'), ((174, 189), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (184, 189), False, 'import os\n'), ((206, 226), 'cv2.imread', 'cv2.imread', (['image', '(0)'], {}), '(image, 0)\n', (216, 226), False, 'import cv2\n...
from sklearn.base import BaseEstimator import numpy as np from sklearn.ensemble import RandomForestClassifier from sklearn.preprocessing import KBinsDiscretizer np.random.seed(7) EPSILON = 1e-10 # This kit will create a sort of discretized distribution, by using # non overlapping uniform distribution class Generativ...
[ "sklearn.ensemble.RandomForestClassifier", "numpy.random.seed", "numpy.sum", "numpy.array", "sklearn.preprocessing.KBinsDiscretizer" ]
[((162, 179), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (176, 179), True, 'import numpy as np\n'), ((447, 502), 'sklearn.preprocessing.KBinsDiscretizer', 'KBinsDiscretizer', ([], {'n_bins': 'self.nb_bins', 'encode': '"""ordinal"""'}), "(n_bins=self.nb_bins, encode='ordinal')\n", (463, 502), False, ...
"""Implementations of the non-parametric bootstrap and the Bayesian bootstrap for sampling distribution estimation. References ---------- <NAME>. "Bootstrap Methods: Another Look at the Jackknife". The Annals of Statistics, Volume 7, Number 1 (1979), 1--26. doi:10.1214/aos/1176344552 <NAME>. "The Bayesian bootstra...
[ "scipy.stats.norm", "numpy.empty", "numpy.asarray", "numpy.random.RandomState", "numpy.percentile", "numpy.repeat" ]
[((2145, 2180), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (2166, 2180), True, 'import numpy as np\n'), ((2245, 2283), 'numpy.empty', 'np.empty', (['((n_boot,) + samples[i].shape)'], {}), '((n_boot,) + samples[i].shape)\n', (2253, 2283), True, 'import numpy as np\n'...
if '__file__' in globals(): import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import numpy as np from dezero import Variable, Model from dezero import setup_variable from dezero.utils import plot_dot_graph import dezero.functions as F from dezero imp...
[ "dezero.optimizers.MomentumSGD", "numpy.random.seed", "dezero.models.MLP", "os.path.dirname", "numpy.sin", "dezero.optimizers.SGD", "numpy.random.rand", "dezero.functions.mean_squared_error", "dezero.setup_variable" ]
[((371, 387), 'dezero.setup_variable', 'setup_variable', ([], {}), '()\n', (385, 387), False, 'from dezero import setup_variable\n'), ((388, 405), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (402, 405), True, 'import numpy as np\n'), ((490, 512), 'numpy.random.rand', 'np.random.rand', (['(100)', '(1)...
import cv2 import numpy as np def nothing(x): pass canvas = np.zeros((512, 512, 3), dtype=np.uint8) + 255 cv2.namedWindow("image") cv2.createTrackbar("R", "image", 0, 255, nothing) cv2.createTrackbar("G", "image", 0, 255, nothing) cv2.createTrackbar("B", "image", 0, 255, nothing) switch = "0:OFF, 1:ON" cv2.cre...
[ "cv2.createTrackbar", "cv2.waitKey", "cv2.destroyAllWindows", "numpy.zeros", "cv2.getTrackbarPos", "cv2.imshow", "cv2.namedWindow" ]
[((114, 138), 'cv2.namedWindow', 'cv2.namedWindow', (['"""image"""'], {}), "('image')\n", (129, 138), False, 'import cv2\n'), ((140, 189), 'cv2.createTrackbar', 'cv2.createTrackbar', (['"""R"""', '"""image"""', '(0)', '(255)', 'nothing'], {}), "('R', 'image', 0, 255, nothing)\n", (158, 189), False, 'import cv2\n'), ((1...
""" Module responsible for importing raw RNA-seq per-gene counts and pulling out statistically significantly different genes. Ideally calls of hits should be done by other methods, but in their absence raw call (RpMbp) can be used to perform intergoupt calls here. """ from collections import defaultdict from csv import...
[ "numpy.sum", "csv.reader", "bioflow.utils.log_behavior.get_logger", "collections.defaultdict", "pprint.PrettyPrinter", "numpy.min", "numpy.max", "numpy.array", "numpy.mean", "numpy.fabs", "numpy.sort", "bioflow.utils.io_routines.dump_object", "numpy.any", "numpy.var", "numpy.sqrt" ]
[((606, 626), 'bioflow.utils.log_behavior.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (616, 626), False, 'from bioflow.utils.log_behavior import get_logger\n'), ((851, 874), 'collections.defaultdict', 'defaultdict', (['(lambda : 1)'], {}), '(lambda : 1)\n', (862, 874), False, 'from collections import...
#! /usr/bin/env python3 import numpy as np import random import cv2 # render a go board into a matrix. # state should be a string of 9x9, 13x13, 19x19. # size is the dimensions of the resulting image. def render_board(state, size=500): margin = size // 10 r = np.zeros((size,size,3), np.uint8) r[:] = (163,...
[ "cv2.waitKey", "cv2.imshow", "numpy.zeros", "random.choice", "cv2.destroyAllWindows" ]
[((270, 305), 'numpy.zeros', 'np.zeros', (['(size, size, 3)', 'np.uint8'], {}), '((size, size, 3), np.uint8)\n', (278, 305), True, 'import numpy as np\n'), ((3523, 3545), 'cv2.imshow', 'cv2.imshow', (['"""board"""', 'x'], {}), "('board', x)\n", (3533, 3545), False, 'import cv2\n'), ((3387, 3427), 'random.choice', 'rand...
#!/usr/bin/envv python import glob import os import subprocess import click import numpy as np import sh from loguru import logger from mpi4py import MPI comm = MPI.COMM_WORLD size = comm.Get_size() rank = comm.Get_rank() logger.add("process_seed.log", format="{time} {level} {message}", filter="process_se...
[ "os.putenv", "sh.mv", "sh.cd", "loguru.logger.add", "sh.sac", "sh.rdseed", "loguru.logger.error", "subprocess.check_output", "click.option", "sh.pwd", "os.path.exists", "click.command", "loguru.logger.info", "sh.rm", "loguru.logger.success", "glob.glob", "numpy.array_split" ]
[((225, 332), 'loguru.logger.add', 'logger.add', (['"""process_seed.log"""'], {'format': '"""{time} {level} {message}"""', 'filter': '"""process_seed"""', 'level': '"""INFO"""'}), "('process_seed.log', format='{time} {level} {message}', filter=\n 'process_seed', level='INFO')\n", (235, 332), False, 'from loguru impo...
import gym import numpy as np from gym import spaces from gym.utils import seeding class BanditEnv(gym.Env): """ Bandit environment base Attributes ---------- arms: int Number of arms """ def __init__(self, arms: int): self.arms = arms self.action_space = spaces.D...
[ "gym.spaces.Discrete", "numpy.argmax", "gym.utils.seeding.np_random" ]
[((312, 338), 'gym.spaces.Discrete', 'spaces.Discrete', (['self.arms'], {}), '(self.arms)\n', (327, 338), False, 'from gym import spaces\n'), ((372, 390), 'gym.spaces.Discrete', 'spaces.Discrete', (['(1)'], {}), '(1)\n', (387, 390), False, 'from gym import spaces\n'), ((525, 548), 'gym.utils.seeding.np_random', 'seedin...