code
stringlengths
31
1.05M
apis
list
extract_api
stringlengths
97
1.91M
"""Functions for implementing conceptors""" import numpy as np def loading_ridge_regression(X, X_, B, regularizer: float = 1e-4): """Solving reservoir loading problem with ridge regression. :param X: state trajectory, shape (T, N) :param X_: state trajectory, time-shifted by -1 :param B: bias (T, 1) ...
[ "numpy.arctanh", "numpy.sum", "numpy.eye", "numpy.dot", "numpy.diag" ]
[((960, 974), 'numpy.dot', 'np.dot', (['X.T', 'X'], {}), '(X.T, X)\n', (966, 974), True, 'import numpy as np\n'), ((1881, 1891), 'numpy.diag', 'np.diag', (['C'], {}), '(C)\n', (1888, 1891), True, 'import numpy as np\n'), ((1358, 1372), 'numpy.dot', 'np.dot', (['X.T', 'X'], {}), '(X.T, X)\n', (1364, 1372), True, 'import...
from __future__ import division import mdtraj as md from mdtraj.core.element import get_by_symbol from mdtraj.geometry.order import _compute_director import numpy as np from scipy.integrate import simps from scipy.stats import binned_statistic_2d from atools.fileio import read_ndx def calc_nematic_order(traj_filenam...
[ "numpy.sum", "numpy.arctan2", "scipy.stats.binned_statistic_2d", "mdtraj.core.element.get_by_symbol", "numpy.argmax", "numpy.argmin", "mdtraj.load", "numpy.histogram", "numpy.mean", "numpy.arange", "numpy.linalg.norm", "mdtraj.compute_center_of_mass", "atools.fileio.read_ndx", "numpy.std",...
[((1090, 1112), 'atools.fileio.read_ndx', 'read_ndx', (['ndx_filename'], {}), '(ndx_filename)\n', (1098, 1112), False, 'from atools.fileio import read_ndx\n'), ((2750, 2790), 'mdtraj.load', 'md.load', (['traj_filename'], {'top': 'top_filename'}), '(traj_filename, top=top_filename)\n', (2757, 2790), True, 'import mdtraj...
''' Comparing TAD Simple Average to TAD Weighted Average. Comparing the densities of anomalous sections of the videos generated by both TAD versions. ''' import os import sys import argparse import numpy as np import matplotlib.pyplot as plt import seaborn as sns import matplotlib.ticker as mtick from tqdm...
[ "numpy.load", "matplotlib.pyplot.show", "argparse.ArgumentParser", "matplotlib.pylab.subplot", "numpy.sum", "numpy.std", "numpy.empty", "matplotlib.pylab.hist", "numpy.mean", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.gcf", "os.listdir", "matplotlib.pylab.figure" ]
[((1212, 1241), 'os.listdir', 'os.listdir', (['path_to_directory'], {}), '(path_to_directory)\n', (1222, 1241), False, 'import os\n'), ((653, 806), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""This script calculates the densities of anomalous sections of the videos generated by both TA...
''' This program implements the idea present in SoundWave: Using the Doppler Effect to Sense Gestures : https://dl.acm.org/doi/pdf/10.1145/2207676.2208331 It implements a doppler radar : A sonar to find the velocity of a moving entity w.r.t the computer's mic/speaker when the speaker and lic are placed near each othe...
[ "wave.open", "matplotlib.pyplot.specgram", "matplotlib.pyplot.show", "numpy.fft.fft", "numpy.zeros", "math.sin", "time.sleep", "pyaudio.PyAudio", "matplotlib.pyplot.ylabel", "numpy.copyto", "matplotlib.pyplot.xlabel", "numpy.fromstring" ]
[((2573, 2590), 'pyaudio.PyAudio', 'pyaudio.PyAudio', ([], {}), '()\n', (2588, 2590), False, 'import pyaudio\n'), ((2770, 2815), 'numpy.zeros', 'np.zeros', (['(chunk_length, 1)'], {'dtype': 'np.float32'}), '((chunk_length, 1), dtype=np.float32)\n', (2778, 2815), True, 'import numpy as np\n'), ((2821, 2858), 'numpy.zero...
import functools import sys import matplotlib as mpl import numpy as np def to_premultiplied_rgba8888(buf): """Convert a buffer from premultipled ARGB32 to premultiplied RGBA8888.""" # Using .take() instead of indexing ensures C-contiguity of the result. return buf.take( [2, 1, 0, 3] if sys.byteo...
[ "IPython.get_ipython", "functools.lru_cache", "IPython.core.pylabtools.backend2gui.update", "numpy.rollaxis" ]
[((819, 841), 'functools.lru_cache', 'functools.lru_cache', (['(1)'], {}), '(1)\n', (838, 841), False, 'import functools\n'), ((659, 679), 'numpy.rollaxis', 'np.rollaxis', (['rgb', '(-1)'], {}), '(rgb, -1)\n', (670, 679), True, 'import numpy as np\n'), ((1211, 1232), 'IPython.get_ipython', 'IPython.get_ipython', ([], {...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 21 15:52:25 2017 - v1.0 Finalised Fri Apr 13 @author: michaelhodge """ #A script to calculate the along-strike scarp height, width and slope for #a fault using an semi-automated algorithm approach #Loads packages required import pickle import pand...
[ "matplotlib.pyplot.title", "pickle.dump", "numpy.isnan", "matplotlib.pyplot.figure", "numpy.arange", "numpy.nanmean", "matplotlib.pyplot.yticks", "numpy.int", "matplotlib.pyplot.xticks", "numpy.size", "numpy.hstack", "matplotlib.pyplot.subplots_adjust", "matplotlib.pyplot.ylabel", "matplot...
[((1249, 1342), 'Algorithm.algorithm', 'algorithm', (['prof_distance', 'prof_height', 'nump', 'iterations', 'method', 'bin_size', 'theta_T', 'phi_T'], {}), '(prof_distance, prof_height, nump, iterations, method, bin_size,\n theta_T, phi_T)\n', (1258, 1342), False, 'from Algorithm import algorithm\n'), ((1440, 1452),...
import tensorflow as tf from tqdm import tqdm import numpy as np from scipy.interpolate import interp2d from sklearn.preprocessing import MinMaxScaler import joblib import os, pickle import pandas as pd class CNN_3d_predict(): def __init__(self, static_data, rated, cluster_dir): self.static_data = static_d...
[ "tensorflow.keras.layers.Dense", "tensorflow.reshape", "tensorflow.matmul", "tensorflow.Variable", "os.path.join", "tensorflow.compat.v1.global_variables_initializer", "tensorflow.compat.v1.placeholder", "tensorflow.keras.layers.AveragePooling3D", "tensorflow.compat.v1.Session", "tensorflow.name_s...
[((381, 410), 'os.path.basename', 'os.path.basename', (['cluster_dir'], {}), '(cluster_dir)\n', (397, 410), False, 'import os, pickle\n'), ((442, 477), 'os.path.join', 'os.path.join', (['cluster_dir', '"""CNN_3d"""'], {}), "(cluster_dir, 'CNN_3d')\n", (454, 477), False, 'import os, pickle\n'), ((503, 546), 'os.path.joi...
""" *Script creates animations for early LENS LSTFRZ cases and produces 2m temperature plots* """ import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap ### Read in LSTFRZ Historical hdamagevalues = np.genfromtxt('/volumes/eas-shared/ault/ecrl/spring-in...
[ "matplotlib.pyplot.title", "netCDF4.Dataset", "numpy.meshgrid", "numpy.asarray", "numpy.genfromtxt", "cesmcontrol_avet.climoMarch", "matplotlib.pyplot.figure", "numpy.where", "numpy.arange", "numpy.reshape", "numpy.squeeze", "mpl_toolkits.basemap.Basemap", "matplotlib.pyplot.savefig" ]
[((266, 401), 'numpy.genfromtxt', 'np.genfromtxt', (['"""/volumes/eas-shared/ault/ecrl/spring-indices/LENS_springonset/data/damagevalues_1920-2005.txt"""'], {'delimiter': '""","""'}), "(\n '/volumes/eas-shared/ault/ecrl/spring-indices/LENS_springonset/data/damagevalues_1920-2005.txt'\n , delimiter=',')\n", (279, ...
import numpy as np from . import normalize class Nchannel2RGB(object): """Convert nchannel array to rgb by PCA. Parameters ---------- pca: sklearn.decomposition.PCA PCA. """ def __init__(self, pca=None): self._pca = pca # for uint8 self._min_max_value = (No...
[ "numpy.nanmin", "numpy.nanmax", "numpy.issubdtype" ]
[((955, 997), 'numpy.issubdtype', 'np.issubdtype', (['nchannel.dtype', 'np.floating'], {}), '(nchannel.dtype, np.floating)\n', (968, 997), True, 'import numpy as np\n'), ((1850, 1883), 'numpy.issubdtype', 'np.issubdtype', (['dtype', 'np.floating'], {}), '(dtype, np.floating)\n', (1863, 1883), True, 'import numpy as np\...
import numpy as np import unicodedata import os class OneHot(object): def __init__(self, be, nclasses): self.be = be self.output = be.iobuf(nclasses, parallelism='Data') def transform(self, t): self.output[:] = self.be.onehot(t, axis=0) return self.output def image_reshape(i...
[ "os.mkdir", "unicodedata.normalize", "unicodedata.category", "numpy.zeros", "os.path.exists", "numpy.transpose", "numpy.float", "numpy.unique" ]
[((884, 905), 'numpy.transpose', 'np.transpose', (['img', 'df'], {}), '(img, df)\n', (896, 905), True, 'import numpy as np\n'), ((3525, 3537), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (3533, 3537), True, 'import numpy as np\n'), ((3613, 3645), 'numpy.unique', 'np.unique', (['t'], {'return_counts': '(True)'}...
import numpy as np import pytest from pytetris.tetrimino import Tetrimino def test_tetrimino_init_1(): cell = np.ones((4, 4)) tetrimino = Tetrimino(cell) assert (tetrimino.cell == cell).all() def test_tetrimino_init_2(): cell = np.array([[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 1], [1, 0, 1, 0]]) t...
[ "numpy.full", "numpy.zeros", "numpy.ones", "pytest.raises", "numpy.random.randint", "numpy.array", "numpy.rot90", "pytetris.tetrimino.Tetrimino" ]
[((116, 131), 'numpy.ones', 'np.ones', (['(4, 4)'], {}), '((4, 4))\n', (123, 131), True, 'import numpy as np\n'), ((148, 163), 'pytetris.tetrimino.Tetrimino', 'Tetrimino', (['cell'], {}), '(cell)\n', (157, 163), False, 'from pytetris.tetrimino import Tetrimino\n'), ((248, 314), 'numpy.array', 'np.array', (['[[0, 1, 0, ...
# -*- coding: utf-8 -*- # file: data_utils.py # author: songyouwei <<EMAIL>> # Copyright (C) 2018. All Rights Reserved. import os import pickle import numpy as np from torch.utils.data import Dataset def load_word_vec(path, word2idx=None): fin = open(path, 'r', encoding='utf-8', newline='\n', errors='ignore') ...
[ "numpy.asarray", "os.path.exists", "numpy.ones" ]
[((708, 750), 'os.path.exists', 'os.path.exists', (['embedding_matrix_file_name'], {}), '(embedding_matrix_file_name)\n', (722, 750), False, 'import os\n'), ((2536, 2566), 'numpy.asarray', 'np.asarray', (['trunc'], {'dtype': 'dtype'}), '(trunc, dtype=dtype)\n', (2546, 2566), True, 'import numpy as np\n'), ((3238, 3259)...
#import # ============================================================================= # ============================================================================= from math import acos,fabs,radians,trunc,degrees,cos import os import sys import numpy as np import ctypes import multiprocessing as mp import time ...
[ "argparse.ArgumentParser", "matplotlib.cm.get_cmap", "matplotlib.pyplot.figure", "numpy.histogram", "numpy.linalg.norm", "matplotlib.pyplot.gca", "numpy.round", "os.path.join", "matplotlib.pyplot.MultipleLocator", "multiprocessing.cpu_count", "os.path.abspath", "os.path.dirname", "matplotlib...
[((355, 378), 'math.fabs', 'fabs', (['(atomi.x - atomj.x)'], {}), '(atomi.x - atomj.x)\n', (359, 378), False, 'from math import acos, fabs, radians, trunc, degrees, cos\n'), ((386, 409), 'math.fabs', 'fabs', (['(atomi.y - atomj.y)'], {}), '(atomi.y - atomj.y)\n', (390, 409), False, 'from math import acos, fabs, radians...
""" Helper functions that are called in the RLlib's callback. """ import numpy as np def store_eps_hist_data(episode, key): """ Called in episode_end """ data = episode.user_data[key] #data[0] = 0 if data[0] is None else data[0] episode.custom_metrics[key] = np.mean(data) episode.hist_data...
[ "numpy.mean" ]
[((285, 298), 'numpy.mean', 'np.mean', (['data'], {}), '(data)\n', (292, 298), True, 'import numpy as np\n')]
import os from PIL import Image import numpy as np from torch.utils.data import Dataset class DriveDataset(Dataset): def __init__(self, root: str, train: bool, transforms=None): super(DriveDataset, self).__init__() data_root = os.path.join(root, "DRIVE", "training" if train else "test") as...
[ "os.path.exists", "numpy.clip", "PIL.Image.open", "numpy.array", "PIL.Image.fromarray", "os.path.join" ]
[((249, 309), 'os.path.join', 'os.path.join', (['root', '"""DRIVE"""', "('training' if train else 'test')"], {}), "(root, 'DRIVE', 'training' if train else 'test')\n", (261, 309), False, 'import os\n'), ((325, 350), 'os.path.exists', 'os.path.exists', (['data_root'], {}), '(data_root)\n', (339, 350), False, 'import os\...
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt # In[2]: dataset=pd.read_csv(r"C:\Users\hp\Desktop\Stock Predictor\trainset.xls",index_col="Date",parse_dates=True) # In[3]: dataset.head() # In[4]: dataset['Open'].plot(figsize=(20,8)) ...
[ "pandas.DataFrame", "matplotlib.pyplot.title", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "pandas.read_csv", "keras.layers.LSTM", "matplotlib.pyplot.legend", "sklearn.preprocessing.MinMaxScaler", "matplotlib.pyplot.ylabel", "keras.layers.Dropout", "keras.layers.Dense", "numpy.array", ...
[((142, 250), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\Users\\\\hp\\\\Desktop\\\\Stock Predictor\\\\trainset.xls"""'], {'index_col': '"""Date"""', 'parse_dates': '(True)'}), "('C:\\\\Users\\\\hp\\\\Desktop\\\\Stock Predictor\\\\trainset.xls',\n index_col='Date', parse_dates=True)\n", (153, 250), True, 'import p...
import random from typing import List, Dict, Optional import numpy as np import math import matplotlib.pyplot as plt import scipy.stats as st max_pop1 = 50 # max_pop1 = 100 # max_pop2 = 150 # parent_percent = 0.1 # parent_percent = 0.2 # parent_percent = 0.4 # parent_percent = 0.5 # parent_percent = 0.6 parent_percent...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.show", "random.randint", "matplotlib.pyplot.plot", "math.ceil", "random.uniform", "random.sample", "matplotlib.pyplot.legend", "random.shuffle", "random.choice", "numpy.exp", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel" ]
[((22437, 22566), 'matplotlib.pyplot.plot', 'plt.plot', (['generations', 'averaged_best_ind_fit'], {'marker': '"""o"""', 'linestyle': '"""--"""', 'color': '"""r"""', 'label': '"""Averaged Best Individual Fitness"""'}), "(generations, averaged_best_ind_fit, marker='o', linestyle='--',\n color='r', label='Averaged Bes...
__all__ = ["convert"] # standard library from pathlib import Path from typing import Optional, Sequence, Union, cast # third-party packages import numpy as np import pandas as pd import xarray as xr from dask.diagnostics import ProgressBar # constants CSV_COLS = "time", "wind_speed", "wind_direction" JST_HOURS = ...
[ "pandas.read_csv", "dask.diagnostics.ProgressBar", "numpy.timedelta64", "pandas.Index" ]
[((320, 342), 'numpy.timedelta64', 'np.timedelta64', (['(9)', '"""h"""'], {}), "(9, 'h')\n", (334, 342), True, 'import numpy as np\n'), ((1800, 1864), 'pandas.read_csv', 'pd.read_csv', (['path'], {'names': 'CSV_COLS', 'index_col': '(0)', 'parse_dates': '(True)'}), '(path, names=CSV_COLS, index_col=0, parse_dates=True)\...
# The following code is based on the ProcHarvester implementation # See https://github.com/IAIK/ProcHarvester/tree/master/code/analysis%20tool import pandas as pd import numpy as np import config import math import distance_computation def init_dist_matrices(file_contents): dist_matrices = [] for fileContent...
[ "math.isnan", "pandas.unique", "numpy.argsort", "numpy.append", "numpy.array", "pandas.Series", "distance_computation.dtw" ]
[((3047, 3074), 'pandas.Series', 'pd.Series', (['k_nearest_labels'], {}), '(k_nearest_labels)\n', (3056, 3074), True, 'import pandas as pd\n'), ((3392, 3419), 'pandas.unique', 'pd.unique', (['k_nearest_labels'], {}), '(k_nearest_labels)\n', (3401, 3419), True, 'import pandas as pd\n'), ((4473, 4495), 'pandas.Series', '...
from tempfile import NamedTemporaryFile import numpy import pytest import theano from decorator import contextmanager from lasagne.utils import floatX from .data import DataSet, cifar, cifar_lee14, mnist, mnist_distractor, \ svhn, svhn_huang16 def identical_dataset(set1, set2, max_bs=500): lenght = len(set1...
[ "tempfile.NamedTemporaryFile", "numpy.random.uniform", "numpy.allclose", "numpy.dtype", "lasagne.utils.floatX", "numpy.all", "pytest.skip", "numpy.min", "numpy.max", "pytest.raises", "numpy.concatenate" ]
[((684, 721), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', ([], {'suffix': 'f""".{frmt}"""'}), "(suffix=f'.{frmt}')\n", (702, 721), False, 'from tempfile import NamedTemporaryFile\n'), ((530, 552), 'numpy.allclose', 'numpy.allclose', (['x1', 'x2'], {}), '(x1, x2)\n', (544, 552), False, 'import numpy\n'), ((568,...
import numpy as np import cv2 # Identify pixels above and below a threshold # If you specify no upper threshold, it will assume none (255,255,255) def color_thresh(img, lower_thresh=(160,160,160), upper_thresh=(255,255,255)): # Create an array of zeros same xy size as img, but single channel color_select = np....
[ "cv2.warpPerspective", "numpy.zeros_like", "numpy.arctan2", "numpy.int_", "cv2.getPerspectiveTransform", "numpy.float32", "numpy.where", "numpy.sin", "numpy.cos", "numpy.sqrt" ]
[((317, 344), 'numpy.zeros_like', 'np.zeros_like', (['img[:, :, 0]'], {}), '(img[:, :, 0])\n', (330, 344), True, 'import numpy as np\n'), ((1612, 1648), 'numpy.sqrt', 'np.sqrt', (['(x_pixel ** 2 + y_pixel ** 2)'], {}), '(x_pixel ** 2 + y_pixel ** 2)\n', (1619, 1648), True, 'import numpy as np\n'), ((1714, 1742), 'numpy...
# -*- coding:utf-8 -*- # import numpy as np def quantize_weight_2d(weight, bitwise): weight_scale = [] weight_zero_point = [] kernel = np.shape(weight)[0] for k in range(kernel): weight_c = weight[k, :, :, :] max_weight_c = np.max(weight_c) min_weight_c = np.min(weight_c) ...
[ "numpy.shape", "numpy.max", "numpy.abs", "numpy.min" ]
[((149, 165), 'numpy.shape', 'np.shape', (['weight'], {}), '(weight)\n', (157, 165), True, 'import numpy as np\n'), ((258, 274), 'numpy.max', 'np.max', (['weight_c'], {}), '(weight_c)\n', (264, 274), True, 'import numpy as np\n'), ((298, 314), 'numpy.min', 'np.min', (['weight_c'], {}), '(weight_c)\n', (304, 314), True,...
#! /usr/bin/env python # The script calculates the tilting angles of coordinated octohedra. import crystmorph as cmor import parsetta as ps import numpy as np from pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder import LocalGeometryFinder from pymatgen.analysis.chemenv.coord...
[ "crystmorph.structure.PerovskiteParser", "pymatgen.analysis.chemenv.coordination_environments.coordination_geometry_finder.LocalGeometryFinder", "pymatgen.analysis.chemenv.coordination_environments.structure_environments.LightStructureEnvironments.from_structure_environments", "pymatgen.analysis.chemenv.coord...
[((569, 588), 'numpy.array', 'np.array', (['[1, 0, 0]'], {}), '([1, 0, 0])\n', (577, 588), True, 'import numpy as np\n'), ((597, 616), 'numpy.array', 'np.array', (['[0, 1, 0]'], {}), '([0, 1, 0])\n', (605, 616), True, 'import numpy as np\n'), ((625, 644), 'numpy.array', 'np.array', (['[0, 0, 1]'], {}), '([0, 0, 1])\n',...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import getpass import pathlib import numpy as np import pandas as pd import heyhi.gsheets import heyhi.run import run THIS_FI...
[ "pandas.DataFrame", "getpass.getuser", "numpy.log", "argparse.ArgumentParser", "json.loads", "pathlib.Path" ]
[((2345, 2363), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {}), '(data)\n', (2357, 2363), True, 'import pandas as pd\n'), ((4270, 4295), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4293, 4295), False, 'import argparse\n'), ((325, 347), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}),...
# coding: utf-8 import numpy as np a = 1.0 b = 4.0 c = - 4.0 print('Los coeficientes son a = '), print(a), print(', b = '), print(b), print(' y c = '), print(c) x1 = (-b + np.sqrt(b**2-4*a*c))/(2*a) print('La raiz x1 = '), print(x1) test_x1 = a*x1**2 + b*x1 + c print('La raiz x1 en a*x1**2 + b*x1 + c = '), print(test_x...
[ "numpy.sqrt" ]
[((172, 199), 'numpy.sqrt', 'np.sqrt', (['(b ** 2 - 4 * a * c)'], {}), '(b ** 2 - 4 * a * c)\n', (179, 199), True, 'import numpy as np\n'), ((334, 361), 'numpy.sqrt', 'np.sqrt', (['(b ** 2 - 4 * a * c)'], {}), '(b ** 2 - 4 * a * c)\n', (341, 361), True, 'import numpy as np\n')]
import tensorflow as tf import argparse import pickle import os import re import sys, traceback import numpy as np import time import datetime from matplotlib.pyplot import figure, ylabel, tight_layout, plot, savefig, tick_params, xlabel, subplot, title, close from model import Model import parameters as param import o...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.figure", "pickle.load", "tensorflow.global_variables", "matplotlib.pyplot.tick_params", "matplotlib.pyplot.tight_layout", "traceback.print_exc", "os.path.exists", "datetime.datetime.now", "tensorflow.train.get_checkpoint_state", "numpy.average", "v...
[((2331, 2342), 'time.time', 'time.time', ([], {}), '()\n', (2340, 2342), False, 'import time\n'), ((3088, 3111), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3109, 3111), False, 'import datetime\n'), ((21410, 21419), 'matplotlib.pyplot.figure', 'figure', (['(1)'], {}), '(1)\n', (21416, 21419), ...
import os, subprocess import numpy as np import simtk.unit as unit from statistics import mean from scipy.stats import linregress from scipy import spatial import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from cg_openmm.utilities.random_builder import * from cg_openmm.utilities.iotoo...
[ "matplotlib.pyplot.title", "matplotlib.backends.backend_pdf.PdfPages", "numpy.sum", "matplotlib.pyplot.suptitle", "numpy.floor", "numpy.argmin", "mdtraj.load", "numpy.shape", "matplotlib.pyplot.figure", "pymbar.MBAR", "numpy.mean", "numpy.random.randint", "openmmtools.multistate.MultiStateRe...
[((8616, 8627), 'numpy.zeros', 'np.zeros', (['(5)'], {}), '(5)\n', (8624, 8627), True, 'import numpy as np\n'), ((13721, 13761), 'pymbar.utils.kln_to_kn', 'pymbar.utils.kln_to_kn', (['replica_energies'], {}), '(replica_energies)\n', (13743, 13761), False, 'import pymbar\n'), ((14345, 14386), 'numpy.zeros', 'np.zeros', ...
""" Please contact the author(s) of this library if you have any questions. Authors: <NAME> ( <EMAIL> ) This module implements an environment considering the 2D point object dynamics. This environemnt is roughly the same as the basic version of `zermelo_show.py`, but this environment has a grid of cells (used for ta...
[ "numpy.random.uniform", "numpy.random.seed", "numpy.abs", "numpy.copy", "utils.utils.state_to_index", "numpy.float32", "numpy.zeros", "gym.spaces.Discrete", "numpy.argmin", "numpy.array", "utils.utils.nearest_real_grid_point", "numpy.linalg.norm", "numpy.linspace" ]
[((637, 666), 'numpy.array', 'np.array', (['[[-2, 2], [-2, 10]]'], {}), '([[-2, 2], [-2, 10]])\n', (645, 666), True, 'import numpy as np\n'), ((987, 1045), 'numpy.array', 'np.array', (['[-self.horizontal_rate, 0, self.horizontal_rate]'], {}), '([-self.horizontal_rate, 0, self.horizontal_rate])\n', (995, 1045), True, 'i...
import numpy as np import sys # command line argument can provide seed, otw set seed to 1 if len(sys.argv) < 2: np.random.seed(1) else: np.random.seed(int(sys.argv[1])) # generate 100 random tip times between 0-10. tipDates=np.random.uniform(0, 10, 101) with open('randomTipTimes.txt', 'w') as text_file: ...
[ "numpy.random.uniform", "numpy.random.seed" ]
[((235, 264), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(10)', '(101)'], {}), '(0, 10, 101)\n', (252, 264), True, 'import numpy as np\n'), ((117, 134), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (131, 134), True, 'import numpy as np\n')]
import numpy as np from calculate_contraction_dynamics import calculate_contraction_dynamics from plotting import plot_tip_displacement_and_velocity, plot_transmitted_and_dissipated_power, plot_peak_velocities, \ plot_final_forces from auxiliaries import discretize_curve, velos_numerical # first we analyse the co...
[ "calculate_contraction_dynamics.calculate_contraction_dynamics", "plotting.plot_peak_velocities", "numpy.asarray", "plotting.plot_tip_displacement_and_velocity", "numpy.max", "plotting.plot_transmitted_and_dissipated_power", "plotting.plot_final_forces", "auxiliaries.discretize_curve" ]
[((524, 628), 'calculate_contraction_dynamics.calculate_contraction_dynamics', 'calculate_contraction_dynamics', (['"""full model"""', '"""./parameter_full_model.txt"""', '(210.0)', 'pillar_stiffness'], {}), "('full model', './parameter_full_model.txt', \n 210.0, pillar_stiffness)\n", (554, 628), False, 'from calcul...
import numpy as np import matplotlib.pyplot as plt import os # To initialize boundary conditions and grid points def initialize_grid(N): grid_points = np.linspace(-1,1,N) delta_x = 1/(N-1) u_values = np.zeros(N) for i in range(N): if abs(grid_points[i]) < 0.5: u_values[i] = np.cos(np.pi*grid_points[i])**2 r...
[ "matplotlib.pyplot.title", "os.mkdir", "matplotlib.pyplot.plot", "matplotlib.pyplot.clf", "numpy.zeros", "os.path.exists", "numpy.array", "numpy.linspace", "numpy.cos", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.pause", "matplotlib.pyplot.savefig" ]
[((2193, 2224), 'matplotlib.pyplot.plot', 'plt.plot', (['grid_points', 'u_values'], {}), '(grid_points, u_values)\n', (2201, 2224), True, 'import matplotlib.pyplot as plt\n'), ((2225, 2265), 'matplotlib.pyplot.title', 'plt.title', (['"""Initial Boundary Conditions"""'], {}), "('Initial Boundary Conditions')\n", (2234, ...
import numpy as np from tree.optimized_train.statistics_utils import ScoreEstimate, estimate_expectancy_of_sum_of_normal, \ estimate_expectancy_of_sum_of_non_normal class ScoresCalculator: def __init__(self, bins: np.ndarray, y: np.ndarray): assert bins.shape[0] == y.shape[0] assert bins.ndim...
[ "numpy.nanargmin", "numpy.average", "numpy.square", "numpy.isfinite", "numpy.cumsum", "tree.optimized_train.statistics_utils.ScoreEstimate", "numpy.bincount" ]
[((454, 466), 'numpy.square', 'np.square', (['y'], {}), '(y)\n', (463, 466), True, 'import numpy as np\n'), ((749, 783), 'tree.optimized_train.statistics_utils.ScoreEstimate', 'ScoreEstimate', (['score', 'score', 'score'], {}), '(score, score, score)\n', (762, 783), False, 'from tree.optimized_train.statistics_utils im...
""" Techniques for manipulating benchmarking data stored in a Pandas DataFrame. """ #*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 w...
[ "numpy.log", "numpy.argmax", "numpy.nanmin", "numpy.isnan", "numpy.max", "scipy.stats.chi2.cdf", "numpy.nanmax" ]
[((1550, 1576), 'numpy.max', '_np.max', (['[v, lower_cutoff]'], {}), '([v, lower_cutoff])\n', (1557, 1576), True, 'import numpy as _np\n'), ((4331, 4350), 'numpy.max', '_np.max', (['[p, 1e-10]'], {}), '([p, 1e-10])\n', (4338, 4350), True, 'import numpy as _np\n'), ((1094, 1106), 'numpy.isnan', '_np.isnan', (['x'], {}),...
import shapefile import numpy as np grid_count = 64 file_path = "Datasets/GeneratedData/" input_weighted_file_name = file_path + "PBLH_grid64_64.txt" output_file_name = file_path + "PBLH_grid64_64" w = shapefile.Writer(output_file_name, shapefile.POLYGON) #this is how to add a polygon ''' w.poly([ [[0.,0.],[0.,1.],...
[ "shapefile.Writer", "numpy.zeros" ]
[((205, 258), 'shapefile.Writer', 'shapefile.Writer', (['output_file_name', 'shapefile.POLYGON'], {}), '(output_file_name, shapefile.POLYGON)\n', (221, 258), False, 'import shapefile\n'), ((1166, 1200), 'numpy.zeros', 'np.zeros', (['(grid_count, grid_count)'], {}), '((grid_count, grid_count))\n', (1174, 1200), True, 'i...
#!/usr/bin/python # # Simulates an MDP-Strategy import math import os import sys, code import resource import copy import itertools import random from PIL import Image import os, pygame, pygame.locals from pybrain3.rl.environments import Environment from pybrain3.rl.environments import Task from pybrain3.rl.agents imp...
[ "sys.stdout.write", "argparse.ArgumentParser", "pygame.event.get", "pygame.display.Info", "numpy.set_printoptions", "math.pow", "pygame.display.set_mode", "my_pybrain.my_learner.SARSA", "pygame.transform.scale", "pybrain3.rl.environments.Task.__init__", "pybrain3.rl.experiments.Experiment._oneIn...
[((906, 943), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (925, 943), True, 'import numpy as np\n'), ((971, 1019), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Simulator"""'}), "(description='Simulator')\n", (994, 1019), False...
import pytest import numpy as np import pandas as pd from keras_batchflow.base.batch_shapers.numpy_encoder_adaptor import NumpyEncoderAdaptor class TestNumpyEncoderAdaptor: def test_init(self): nea = NumpyEncoderAdaptor() def test_transform(self): data = pd.Series([1, 2, 4, 5]) nea ...
[ "pytest.raises", "numpy.array", "pandas.Series", "keras_batchflow.base.batch_shapers.numpy_encoder_adaptor.NumpyEncoderAdaptor", "numpy.issubdtype" ]
[((216, 237), 'keras_batchflow.base.batch_shapers.numpy_encoder_adaptor.NumpyEncoderAdaptor', 'NumpyEncoderAdaptor', ([], {}), '()\n', (235, 237), False, 'from keras_batchflow.base.batch_shapers.numpy_encoder_adaptor import NumpyEncoderAdaptor\n'), ((284, 307), 'pandas.Series', 'pd.Series', (['[1, 2, 4, 5]'], {}), '([1...
import tkinter from tkbuilder.panel_templates.pyplot_panel.pyplot_panel import PyplotPanel from tkbuilder.example_apps.plot_demo.panels.plot_demo_button_panel import ButtonPanel from tkbuilder.panel_templates.widget_panel.widget_panel import AbstractWidgetPanel import numpy as np class PlotDemo(AbstractWidgetPanel): ...
[ "tkbuilder.panel_templates.widget_panel.widget_panel.AbstractWidgetPanel.__init__", "numpy.zeros", "numpy.shape", "numpy.sinc", "numpy.sin", "numpy.linspace", "tkinter.Frame", "tkinter.Tk" ]
[((3889, 3901), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (3899, 3901), False, 'import tkinter\n'), ((523, 544), 'tkinter.Frame', 'tkinter.Frame', (['master'], {}), '(master)\n', (536, 544), False, 'import tkinter\n'), ((553, 601), 'tkbuilder.panel_templates.widget_panel.widget_panel.AbstractWidgetPanel.__init__', ...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.utils.data as data from torch.autograd import Variable import numpy as np import scipy.io as sio import numpy.matlib import os import csv import math, random import pandas as pd from scipy.stats import itemfreq ...
[ "sklearn.preprocessing.StandardScaler", "scipy.io.loadmat", "numpy.ravel", "random.shuffle", "numpy.ones", "numpy.mean", "os.path.join", "numpy.unique", "random.randint", "torch.utils.data.transpose", "scipy.stats.itemfreq", "numpy.std", "numpy.append", "numpy.max", "numpy.reshape", "c...
[((732, 751), 'numpy.zeros', 'np.zeros', (['(K, N, D)'], {}), '((K, N, D))\n', (740, 751), True, 'import numpy as np\n'), ((3010, 3031), 'os.listdir', 'os.listdir', (['data_path'], {}), '(data_path)\n', (3020, 3031), False, 'import os\n'), ((4743, 4768), 'numpy.ones', 'np.ones', (['all_labels.shape'], {}), '(all_labels...
#! /usr/bin/env python """ Incremental full-frame PCA for big (larger than available memory) cubes. """ from __future__ import division, print_function __author__ = '<NAME>' __all__ = ['pca_incremental'] import numpy as np from astropy.io import fits from sklearn.decomposition import IncrementalPCA from ..preproc i...
[ "numpy.median", "sklearn.decomposition.IncrementalPCA", "numpy.array", "astropy.io.fits.open", "numpy.dot" ]
[((2899, 2935), 'astropy.io.fits.open', 'fits.open', (['fitsfilename'], {'memmap': '(True)'}), '(fitsfilename, memmap=True)\n', (2908, 2935), False, 'from astropy.io import fits\n'), ((3515, 3549), 'sklearn.decomposition.IncrementalPCA', 'IncrementalPCA', ([], {'n_components': 'ncomp'}), '(n_components=ncomp)\n', (3529...
from numpy import random from sequence.components.interferometer import Interferometer from sequence.components.photon import Photon from sequence.kernel.timeline import Timeline from sequence.utils.encoding import time_bin random.seed(0) NUM_TRIALS = int(10e3) def create_intf(quantum_state): class Receiver(): ...
[ "sequence.components.interferometer.Interferometer", "numpy.random.seed", "sequence.kernel.timeline.Timeline" ]
[((225, 239), 'numpy.random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (236, 239), False, 'from numpy import random\n'), ((538, 548), 'sequence.kernel.timeline.Timeline', 'Timeline', ([], {}), '()\n', (546, 548), False, 'from sequence.kernel.timeline import Timeline\n'), ((561, 625), 'sequence.components.interferome...
import torch.utils.data as data from avi_r import AVIReader from PIL import Image import os import torch import numpy as np from numpy.random import randint import cv2 import json import decord from decord import VideoReader from decord import cpu, gpu import torchvision import gc decord.bridge.set_bridge('torch') # ...
[ "torch.stack", "numpy.zeros", "numpy.random.randint", "numpy.array", "numpy.linspace", "decord.bridge.set_bridge", "os.path.join" ]
[((283, 316), 'decord.bridge.set_bridge', 'decord.bridge.set_bridge', (['"""torch"""'], {}), "('torch')\n", (307, 316), False, 'import decord\n'), ((2061, 2094), 'os.path.join', 'os.path.join', (['root_path', 'vid_name'], {}), '(root_path, vid_name)\n', (2073, 2094), False, 'import os\n'), ((9091, 9117), 'torch.stack',...
import os from skimage.io import imread, imsave import numpy as np from numpy.random import choice, permutation import cv2 from math import ceil import tensorflow as tf from tensorflow.data import Dataset, TextLineDataset from tensorflow.contrib.data import shuffle_and_repeat from time import gmtime, strftime from sk...
[ "numpy.random.uniform", "cv2.warpPerspective", "numpy.minimum", "tensorflow.py_func", "cv2.getPerspectiveTransform", "numpy.expand_dims", "PIL.Image.open", "cv2.imread", "numpy.array", "numpy.loadtxt", "tensorflow.data.Dataset.zip", "numpy.random.choice", "numpy.random.rand", "tensorflow.n...
[((555, 590), 'cv2.imread', 'cv2.imread', (['fname', 'cv2.IMREAD_COLOR'], {}), '(fname, cv2.IMREAD_COLOR)\n', (565, 590), False, 'import cv2\n'), ((1255, 1282), 'numpy.expand_dims', 'np.expand_dims', (['img'], {'axis': '(2)'}), '(img, axis=2)\n', (1269, 1282), True, 'import numpy as np\n'), ((1341, 1373), 'numpy.loadtx...
# -*- coding: utf-8 -*- #!/usr/bin/env python3 ''' This code implements the high level Delay aware MPC controller for following higher level trajectory from motion planner ''' from __future__ import print_function from __future__ import division from yaml import error # Imports if True : from adap...
[ "sys.path.append", "math.sqrt", "math.atan2", "os.path.realpath", "live_plotter.LivePlotter", "rospy.Publisher", "numpy.ones", "numpy.zeros", "math.sin", "beginner_tutorials.msg.custom_msg", "numpy.sin", "numpy.array", "rospy.init_node", "numpy.loadtxt", "numpy.matmul", "numpy.random.r...
[((10178, 10219), 'sys.path.append', 'sys_path.append', (["(file_path + '/../../../')"], {}), "(file_path + '/../../../')\n", (10193, 10219), True, 'from sys import path as sys_path\n'), ((1755, 1809), 'numpy.array', 'np.array', (['[[22, -18], [22, -10], [32, -10], [32, -18]]'], {}), '([[22, -18], [22, -10], [32, -10],...
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import PyTorchDisentanglement.modules.losses as losses from PyTorchDisentanglement.models.base import BaseModel from PyTorchDisentanglement.modules.activations import lca_threshold class Lca(BaseModel): def setup_model(self): ...
[ "torch.eye", "PyTorchDisentanglement.modules.activations.lca_threshold", "torch.sum", "PyTorchDisentanglement.modules.losses.l1_norm", "torch.randn", "torch.zeros", "torch.matmul", "numpy.round", "PyTorchDisentanglement.modules.losses.half_squared_l2", "torch.transpose" ]
[((747, 781), 'torch.matmul', 'torch.matmul', (['input_tensor', 'self.w'], {}), '(input_tensor, self.w)\n', (759, 781), False, 'import torch\n'), ((1090, 1214), 'PyTorchDisentanglement.modules.activations.lca_threshold', 'lca_threshold', (['u_in', 'self.params.thresh_type', 'self.params.rectify_a', 'self.params.sparse_...
"""Derivatives of the neutron-star `observables` `M`, `R`, and `k_2` as functions of fixed central pressures `Pc` (chosen so that the masses are equally space) and the EoS parameters `param`. The derivatives are scaled by the observable values and the parameter values so as to be dimens...
[ "numpy.linspace" ]
[((844, 871), 'numpy.linspace', 'np.linspace', (['(0.9)', '(2.09)', '(120)'], {}), '(0.9, 2.09, 120)\n', (855, 871), True, 'import numpy as np\n')]
import cv2 import numpy as np import tensorflow as tf from models.facenet import FaceNet from models.util import utils print("Using gpu: {0}".format(tf.test.is_gpu_available(cuda_only=False, min_cuda_compute_capability=None))) class MaskDetector: def __init__(self): self.fac...
[ "models.facenet.FaceNet", "numpy.random.seed", "cv2.dnn.NMSBoxes", "cv2.putText", "numpy.argmax", "cv2.dnn.blobFromImage", "cv2.dnn.readNetFromDarknet", "numpy.array", "cv2.rectangle", "tensorflow.test.is_gpu_available", "models.util.utils.get_file_path" ]
[((152, 227), 'tensorflow.test.is_gpu_available', 'tf.test.is_gpu_available', ([], {'cuda_only': '(False)', 'min_cuda_compute_capability': 'None'}), '(cuda_only=False, min_cuda_compute_capability=None)\n', (176, 227), True, 'import tensorflow as tf\n'), ((327, 336), 'models.facenet.FaceNet', 'FaceNet', ([], {}), '()\n'...
""" Copyright (c) Facebook, Inc. and its affiliates. """ import numpy as np MAX_MAP_SIZE = 4097 MAP_INIT_SIZE = 1025 BIG_I = MAX_MAP_SIZE BIG_J = MAX_MAP_SIZE def no_y_l1(self, xyz, k): """ returns the l1 distance between two standard coordinates""" return np.linalg.norm(np.asarray([xyz[0], xyz[2]]) - np.as...
[ "numpy.asarray", "numpy.ones" ]
[((284, 312), 'numpy.asarray', 'np.asarray', (['[xyz[0], xyz[2]]'], {}), '([xyz[0], xyz[2]])\n', (294, 312), True, 'import numpy as np\n'), ((315, 339), 'numpy.asarray', 'np.asarray', (['[k[0], k[2]]'], {}), '([k[0], k[2]])\n', (325, 339), True, 'import numpy as np\n'), ((10055, 10078), 'numpy.ones', 'np.ones', (['(new...
from urllib import request import nltk import numpy as np #nltk.download('punkt') - uncomment this if 'punkt doesn't exist' error, usually necessary if it's your first exposure to toolkit class ScrapeAndAnalyze(object): def url(self): """ :return: targetUrl - full url location of text to be mine...
[ "numpy.mean", "urllib.request.urlopen", "nltk.word_tokenize" ]
[((604, 624), 'urllib.request.urlopen', 'request.urlopen', (['url'], {}), '(url)\n', (619, 624), False, 'from urllib import request\n'), ((1054, 1082), 'nltk.word_tokenize', 'nltk.word_tokenize', (['fullText'], {}), '(fullText)\n', (1072, 1082), False, 'import nltk\n'), ((2958, 2971), 'numpy.mean', 'np.mean', (['lens']...
import numpy as np a = np.array([[12,15], [10, 1]]) arr = np.sort(a, axis = 0) a = np.array([[10, 15], [12, 1]]) arr2 = np.sort(a, axis = -1) print ("\nAlong first axis : \n", arr2) a = np.array([[12, 15], [10, 1]]) arr3 = np.sort(a, axis = None) print ("\nAlong none axis : \n", arr1)
[ "numpy.sort", "numpy.array" ]
[((24, 53), 'numpy.array', 'np.array', (['[[12, 15], [10, 1]]'], {}), '([[12, 15], [10, 1]])\n', (32, 53), True, 'import numpy as np\n'), ((59, 77), 'numpy.sort', 'np.sort', (['a'], {'axis': '(0)'}), '(a, axis=0)\n', (66, 77), True, 'import numpy as np\n'), ((85, 114), 'numpy.array', 'np.array', (['[[10, 15], [12, 1]]'...
import numpy as np class stablesoftmax: def forward(self, input): return np.exp(input - np.max(input)) / np.sum(np.exp(input - np.max(input))) def backward(self, input): equation = np.vectorize(self.equationforderivative, otypes=[float]) return equation(input, np.sum(np.exp(input))) def equatio...
[ "numpy.max", "numpy.vectorize", "numpy.exp" ]
[((195, 251), 'numpy.vectorize', 'np.vectorize', (['self.equationforderivative'], {'otypes': '[float]'}), '(self.equationforderivative, otypes=[float])\n', (207, 251), True, 'import numpy as np\n'), ((286, 299), 'numpy.exp', 'np.exp', (['input'], {}), '(input)\n', (292, 299), True, 'import numpy as np\n'), ((376, 389),...
import numpy as np import cosmogenic.na as na import cosmogenic.util as util def positions(m, ts): a = -9.81 v0 = m[0:2] p0 = m[2:4] pos = np.empty((ts.size, 2), dtype=float) for i, t in enumerate(ts): pos[i, :] = 0.5 * a * t ** 2 + v0 * t + p0 return pos conf = { "description"...
[ "numpy.empty", "cosmogenic.na.search", "cosmogenic.util.pickle", "numpy.array", "numpy.linspace" ]
[((708, 732), 'numpy.linspace', 'np.linspace', (['(2)', '(20)', '(1000)'], {}), '(2, 20, 1000)\n', (719, 732), True, 'import numpy as np\n'), ((159, 194), 'numpy.empty', 'np.empty', (['(ts.size, 2)'], {'dtype': 'float'}), '((ts.size, 2), dtype=float)\n', (167, 194), True, 'import numpy as np\n'), ((440, 480), 'numpy.ar...
import os import re import time import utils import mail import json import requests import collections import pandas as pd from utils import log from datetime import datetime from bs4 import BeautifulSoup from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.su...
[ "pandas.DataFrame", "selenium.webdriver.support.ui.WebDriverWait", "selenium.webdriver.support.expected_conditions.presence_of_element_located", "re.split", "json.loads", "selenium.webdriver.Firefox", "numpy.random.rand", "time.sleep", "urllib3.disable_warnings", "mail.send_email", "requests.get...
[((537, 563), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (561, 563), False, 'import urllib3\n'), ((4053, 4067), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4065, 4067), True, 'import pandas as pd\n'), ((4374, 4409), 'bs4.BeautifulSoup', 'BeautifulSoup', (['resp.content', '"""lx...
#!/home/iflyings/VSCode/venv/tensorflow-venv python # -*- coding:utf-8 -*- # Author: iflyings import os import numpy as np import tensorflow as tf class ImageRes: def __init__(self, path, image_width = 100, image_height = 100, batch_size = 20, num_epochs = 100): self.path = path self.image_width = ...
[ "tensorflow.image.resize_with_crop_or_pad", "os.listdir", "tensorflow.global_variables_initializer", "tensorflow.data.Dataset.from_tensor_slices", "tensorflow.cast", "numpy.arange", "tensorflow.image.per_image_standardization", "tensorflow.InteractiveSession", "tensorflow.io.read_file", "os.path.j...
[((2870, 2893), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (2891, 2893), True, 'import tensorflow as tf\n'), ((1102, 1132), 'numpy.random.shuffle', 'np.random.shuffle', (['image_infos'], {}), '(image_infos)\n', (1119, 1132), True, 'import numpy as np\n'), ((1921, 1986), 'tensorflow.cast...
# Databricks notebook source # MAGIC %md # MAGIC # Creating features for ML # MAGIC # MAGIC Return to <a href="$../../../_index">index page</a> # MAGIC # MAGIC In this notebook we preprocess the data for modelling purposes. # COMMAND ---------- # MAGIC %run ../../../app/bootstrap # COMMAND ---------- # MAGIC %run...
[ "pyspark.sql.Window.partitionBy", "daipecore.widgets.get_widget_value.get_widget_value", "pyspark.sql.functions.lit", "datetime.date.today", "pyspark.ml.feature.Bucketizer", "pyspark.sql.functions.datediff", "pyspark.sql.functions.max", "pyspark.sql.functions.lag", "datetime.datetime.strptime", "p...
[((4394, 4426), 'daipecore.widgets.get_widget_value.get_widget_value', 'get_widget_value', (['"""default_days"""'], {}), "('default_days')\n", (4410, 4426), False, 'from daipecore.widgets.get_widget_value import get_widget_value\n'), ((4428, 4466), 'daipecore.widgets.get_widget_value.get_widget_value', 'get_widget_valu...
from collections import defaultdict from datetime import datetime import pickle import random import re import numpy as np import torch def balanced_split(f_test, final_genomes, taxid_to_tnum): """ Create a train-test split that is phylogenetically balanced at the phylum level Arguments: f_test (int) -- propor...
[ "pandas.read_csv", "random.sample", "torch.load", "numpy.zeros", "random.choice", "re.match", "collections.defaultdict", "pickle.load", "random.seed", "numpy.array", "datetime.datetime.now", "torch.tensor" ]
[((590, 607), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (601, 607), False, 'from collections import defaultdict\n'), ((6901, 6939), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n_genomes, n_kos_tot)'}), '(shape=(n_genomes, n_kos_tot))\n', (6909, 6939), True, 'import numpy as np\n'), ((7170, 7...
#!/usr/bin/env python3 def pi_calc_base(samples=100_000_000): import random import math count_inside = 0 for count in range(samples): d = math.hypot(random.random(), random.random()) if d < 1: count_inside += 1 return 4.0 * count_inside / samples def pi_calc_numpy(samp...
[ "numpy.random.rand", "random.random" ]
[((174, 189), 'random.random', 'random.random', ([], {}), '()\n', (187, 189), False, 'import random\n'), ((191, 206), 'random.random', 'random.random', ([], {}), '()\n', (204, 206), False, 'import random\n'), ((437, 453), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (451, 453), True, 'import numpy as np\n')...
# * Author : <NAME> # * Copyright (c) 2021 Careless Dev Squad All rights reserved. # * Import required Library # * Import Numpy to create 2D array import numpy as np # * Import random to simulate True Random import random # * Import opencv for image work import cv2 # * Import Tqdm for progress bar from tqdm i...
[ "numpy.full", "cv2.imwrite", "imageio.imread", "numpy.zeros", "random.choice", "imageio.mimwrite", "numpy.hstack", "cv2.imread", "numpy.max", "numpy.min", "numpy.array", "numpy.vstack" ]
[((1250, 1302), 'numpy.full', 'np.full', (['(self.image_height, self.image_width)', 'None'], {}), '((self.image_height, self.image_width), None)\n', (1257, 1302), True, 'import numpy as np\n'), ((2677, 2694), 'numpy.vstack', 'np.vstack', (['height'], {}), '(height)\n', (2686, 2694), True, 'import numpy as np\n'), ((271...
import numpy as np from scipy.integrate import quad def print_time(t): ms = round(1000*t) y, ms = divmod(ms, 1000*60*60*24*365) d, ms = divmod(ms, 1000*60*60*24) h, ms = divmod(ms, 1000*60*60) m, ms = divmod(ms, 1000*60) s, ms = divmod(ms, 1000) print( "{0:>6}".format(y), 'yr,',...
[ "numpy.log10", "numpy.average" ]
[((1159, 1175), 'numpy.log10', 'np.log10', (['self.v'], {}), '(self.v)\n', (1167, 1175), True, 'import numpy as np\n'), ((2348, 2439), 'numpy.average', 'np.average', (["[self.sol_stack[-2]['u'], self.sol_stack[-1]['u']]"], {'axis': '(0)', 'weights': 'weights'}), "([self.sol_stack[-2]['u'], self.sol_stack[-1]['u']], axi...
import gym from gym import error, spaces from gym import utils from gym.utils import seeding from typing import Dict, Optional, List from evogym import * import random import math import pkg_resources import numpy as np import os class EvoGymBase(gym.Env): """ Base class for all Evolution Gym environments. ...
[ "numpy.zeros", "numpy.clip", "numpy.max", "numpy.mean", "numpy.array", "numpy.min", "os.path.join" ]
[((7507, 7541), 'numpy.mean', 'np.mean', (['object_points_pos'], {'axis': '(1)'}), '(object_points_pos, axis=1)\n', (7514, 7541), True, 'import numpy as np\n'), ((7557, 7605), 'numpy.array', 'np.array', (['[object_pos_com[0], object_pos_com[1]]'], {}), '([object_pos_com[0], object_pos_com[1]])\n', (7565, 7605), True, '...
import torch.nn.functional as F import os import torch import time import random from skimage import io, transform, color, data, img_as_float from skimage.metrics import structural_similarity as ssim import numpy as np import matplotlib.pyplot as plt from torch import nn, optim from torch.utils.data import Dataset, Dat...
[ "matplotlib.pyplot.title", "torch.cat", "matplotlib.pyplot.figure", "numpy.mean", "torch.set_num_threads", "skimage.transform.resize", "torch.device", "skimage.io.imread_collection", "os.path.join", "torch.nn.BCELoss", "torch.utils.data.DataLoader", "torch.nn.functional.avg_pool2d", "numpy.t...
[((11416, 11440), 'torch.nn.functional.avg_pool2d', 'F.avg_pool2d', (['x', '(3)', '(1)', '(1)'], {}), '(x, 3, 1, 1)\n', (11428, 11440), True, 'import torch.nn.functional as F\n'), ((11452, 11476), 'torch.nn.functional.avg_pool2d', 'F.avg_pool2d', (['y', '(3)', '(1)', '(1)'], {}), '(y, 3, 1, 1)\n', (11464, 11476), True,...
import numpy as np from cuml import SVR from cuml import RandomForestRegressor from cuml import NearestNeighbors,KMeans,UMAP,Ridge,ElasticNet import cupy as cp from sklearn.model_selection import KFold def my_metric(y_true, y_pred): return np.mean(np.sum(np.abs(y_true - y_pred), axis=0)/np.sum(y_true, axis=0)) d...
[ "cuml.SVR", "cuml.ElasticNet", "numpy.sum", "numpy.abs", "numpy.zeros", "sklearn.model_selection.KFold", "cupy.asnumpy", "numpy.round" ]
[((938, 993), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'NUM_FOLDS', 'shuffle': '(True)', 'random_state': '(0)'}), '(n_splits=NUM_FOLDS, shuffle=True, random_state=0)\n', (943, 993), False, 'from sklearn.model_selection import KFold\n'), ((1189, 1210), 'numpy.zeros', 'np.zeros', (['df.shape[0]'], {}),...
import os import json import re import numpy as np import altair as alt from codemetrics.vega import vis_ages from codemetrics.vega import vis_hot_spots IGNORE_PATHS = ('.', 'docs', 'doc', 'tests', 'test', 'notebooks') IGNORE_LANGS = ('reStructuredText', 'Markdown', 'make') IGNORE_EXTS = ('geo', 'xmf', 'xdmf', 'h5',...
[ "os.path.abspath", "json.load", "os.path.join", "altair.Y", "altair.vconcat", "altair.Chart", "codemetrics.vega.vis_ages", "json.dumps", "altair.X", "altair.EncodingSortField", "numpy.array", "altair.Scale", "codemetrics.vega.vis_hot_spots", "re.sub" ]
[((1733, 1757), 'altair.vconcat', 'alt.vconcat', (['top', 'bottom'], {}), '(top, bottom)\n', (1744, 1757), True, 'import altair as alt\n'), ((1928, 1983), 'codemetrics.vega.vis_ages', 'vis_ages', (['ages_df'], {'height': 'height', 'width': 'width'}), '(ages_df, height=height, width=width, **kwargs)\n', (1936, 1983), Fa...
import os from flask import request, Flask, jsonify, render_template, g import math import tensorflow as tf import numpy as np from PIL import Image import cv2 import base64 from im2txt import configuration from im2txt import inference_wrapper from im2txt.inference_utils import caption_generator fr...
[ "os.remove", "urllib.request.Request", "im2txt.inference_utils.caption_generator.CaptionGenerator", "cv2.imdecode", "tensorflow.logging.set_verbosity", "base64.b64decode", "flask.jsonify", "cv2.imencode", "flask.request.get_json", "cv2.cvtColor", "os.path.exists", "urllib.request.urlopen", "...
[((544, 585), 'tensorflow.logging.set_verbosity', 'tf.logging.set_verbosity', (['tf.logging.INFO'], {}), '(tf.logging.INFO)\n', (568, 585), True, 'import tensorflow as tf\n'), ((623, 633), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (631, 633), True, 'import tensorflow as tf\n'), ((795, 807), 'flask.g.finalize', ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 15 21:24:08 2019 @author: Ivywang """ import numpy as np import sys sys.path.append('../') from ADKit.AutoDiff import Ad_Var, rAd_Var def test_setters(): a = Ad_Var(1,-3) a.set_val(2) a.set_ders(2) assert a.get_val() == 2 ass...
[ "ADKit.AutoDiff.Ad_Var.tan", "ADKit.AutoDiff.Ad_Var.arcsin", "ADKit.AutoDiff.Ad_Var", "ADKit.AutoDiff.Ad_Var.sinh", "numpy.sin", "numpy.exp", "ADKit.AutoDiff.Ad_Var.cosh", "ADKit.AutoDiff.Ad_Var.logistic", "sys.path.append", "ADKit.AutoDiff.Ad_Var.sin", "numpy.arcsin", "numpy.tan", "numpy.ar...
[((141, 163), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (156, 163), False, 'import sys\n'), ((237, 250), 'ADKit.AutoDiff.Ad_Var', 'Ad_Var', (['(1)', '(-3)'], {}), '(1, -3)\n', (243, 250), False, 'from ADKit.AutoDiff import Ad_Var, rAd_Var\n'), ((392, 405), 'ADKit.AutoDiff.Ad_Var', 'Ad_Var'...
"""Plot Milky Way spiral arm models.""" import numpy as np import matplotlib.pyplot as plt from astropy.units import Quantity from gammapy.astro.population.spatial import ValleeSpiral, FaucherSpiral fig = plt.figure(figsize=(7, 8)) rect = [0.12, 0.12, 0.85, 0.85] ax_cartesian = fig.add_axes(rect) ax_cartesian.set_aspe...
[ "matplotlib.pyplot.show", "gammapy.astro.population.spatial.ValleeSpiral", "matplotlib.pyplot.figure", "numpy.arange", "gammapy.astro.population.spatial.FaucherSpiral", "matplotlib.pyplot.grid" ]
[((206, 232), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(7, 8)'}), '(figsize=(7, 8))\n', (216, 232), True, 'import matplotlib.pyplot as plt\n'), ((349, 363), 'gammapy.astro.population.spatial.ValleeSpiral', 'ValleeSpiral', ([], {}), '()\n', (361, 363), False, 'from gammapy.astro.population.spatial imp...
#!/usr/bin/env python # -*- coding: iso-8859-15 -*- ######################## -*- coding: utf-8 -*- # simple script to generate p-coordinate specific input from standard experiment # but unfortunately this script does not reproduce the values in # tutorial_global_oce_in_p, yet import numpy as np import sys, os # requi...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.figure", "numpy.arange", "os.path.join", "numpy.prod", "numpy.copy", "MITgcmutils.rdmds", "matplotlib.pyplot.colorbar", "numpy.cumsum", "MITgcmutils.jmd95.dens", "matplotlib.pyplot.show", "numpy.ma.masked_where", "numpy.asarray", "matplotlib.py...
[((3296, 3319), 'MITgcmutils.rdmds', 'mit.rdmds', (['"""../run/RAC"""'], {}), "('../run/RAC')\n", (3305, 3319), True, 'import MITgcmutils as mit\n'), ((3382, 3502), 'numpy.asarray', 'np.asarray', (['[50.0, 70.0, 100.0, 140.0, 190.0, 240.0, 290.0, 340.0, 390.0, 440.0, 490.0,\n 540.0, 590.0, 640.0, 690.0]'], {}), '([5...
import gym import tensorflow as tf from tensorflow.keras import layers import numpy as np import matplotlib.pyplot as plt import Actor import Critic class Buffer: def __init__(self, num_states, num_actions, buffer_capacity=100000, batch_size=64): # Number of "experiences" to store at max self.buffer_cap...
[ "tensorflow.math.reduce_mean", "tensorflow.convert_to_tensor", "numpy.zeros", "tensorflow.cast", "numpy.random.choice", "tensorflow.math.square", "tensorflow.GradientTape" ]
[((653, 697), 'numpy.zeros', 'np.zeros', (['(self.buffer_capacity, num_states)'], {}), '((self.buffer_capacity, num_states))\n', (661, 697), True, 'import numpy as np\n'), ((729, 774), 'numpy.zeros', 'np.zeros', (['(self.buffer_capacity, num_actions)'], {}), '((self.buffer_capacity, num_actions))\n', (737, 774), True, ...
""" @author: <NAME> - github.com/RocaPiedra """ import os import numpy as np from PIL import Image, ImageFilter import matplotlib.cm as mpl_color_map import torch from torch.autograd import Variable from torchvision import models from misc_functions import apply_colormap_on_image, save_image import parameters import...
[ "torchvision.models.resnet18", "subprocess.Popen", "torch.autograd.Variable", "numpy.float32", "torchvision.models.alexnet", "os.path.dirname", "urllib.request.urlopen", "time.sleep", "numpy.argpartition", "torchvision.models.resnet50", "pickle.load", "PIL.Image.fromarray", "torch.hub.load",...
[((1232, 1250), 'numpy.float32', 'np.float32', (['pil_im'], {}), '(pil_im)\n', (1242, 1250), True, 'import numpy as np\n'), ((1748, 1787), 'torch.autograd.Variable', 'Variable', (['im_as_ten'], {'requires_grad': '(True)'}), '(im_as_ten, requires_grad=True)\n', (1756, 1787), False, 'from torch.autograd import Variable\n...
# -*- coding: utf-8 -*- """ @author:XuMing(<EMAIL>) @description: Test evaluate methods """ import unittest import numpy as np import numpy.testing as np_test from numpy.random import RandomState from rater.metrics.rating import RMSE class TestRMSE(unittest.TestCase): def test_rmse_same_input(self): rs...
[ "numpy.random.randn", "numpy.zeros", "numpy.ones", "numpy.random.RandomState", "rater.metrics.rating.RMSE", "numpy.random.rand", "numpy.sqrt" ]
[((323, 337), 'numpy.random.RandomState', 'RandomState', (['(0)'], {}), '(0)\n', (334, 337), False, 'from numpy.random import RandomState\n'), ((653, 674), 'numpy.random.randn', 'np.random.randn', (['(2)', '(4)'], {}), '(2, 4)\n', (668, 674), True, 'import numpy as np\n'), ((734, 754), 'numpy.random.rand', 'np.random.r...
import mknn import numpy as np import matplotlib.pyplot as plt import nrrd # Read the files energy_raw, header = nrrd.read('19495691_150518_abd_original_glcm_JointEnergy.nrrd') entropy_raw, header = nrrd.read('19495691_150518_abd_original_glcm_JointEntropy.nrrd') contrast_raw, header = nrrd.read('19495691_150518_abd_o...
[ "nrrd.read", "mknn.Filtration", "numpy.isnan", "numpy.column_stack" ]
[((114, 177), 'nrrd.read', 'nrrd.read', (['"""19495691_150518_abd_original_glcm_JointEnergy.nrrd"""'], {}), "('19495691_150518_abd_original_glcm_JointEnergy.nrrd')\n", (123, 177), False, 'import nrrd\n'), ((200, 264), 'nrrd.read', 'nrrd.read', (['"""19495691_150518_abd_original_glcm_JointEntropy.nrrd"""'], {}), "('1949...
import os import sys import subprocess import traceback import numpy as np def reorder_list(lst, val_list): for element in reversed(val_list): if element in lst: lst.remove(element) lst.insert(0, element) return lst def round_up_to_odd(f): #Round to add as blocksize has...
[ "numpy.ceil", "numpy.dtype", "subprocess.call", "traceback.format_exc", "os.path.splitext", "os.path.join", "os.startfile" ]
[((2108, 2135), 'os.path.splitext', 'os.path.splitext', (['file_name'], {}), '(file_name)\n', (2124, 2135), False, 'import os\n'), ((2259, 2312), 'os.path.join', 'os.path.join', (['output_path', '(final_basename + extension)'], {}), '(output_path, final_basename + extension)\n', (2271, 2312), False, 'import os\n'), ((2...
"""Calibre (Adaptive Ensemble) with flat model structure. """ import os import sys import pathlib import pickle as pk import pandas as pd import numpy as np import tensorflow as tf import tensorflow_probability as tfp from tensorflow_probability import edward2 as ed import gpflowSlim as gpf sys.path.extend([os.get...
[ "pickle.dump", "calibre.model.adaptive_ensemble.sample_posterior_weight_flat", "pathlib.Path", "numpy.mean", "pickle.load", "tensorflow_probability.edward2.make_log_joint_fn", "tensorflow_probability.mcmc.sample_chain", "os.path.join", "tensorflow.get_variable", "numpy.nanmean", "matplotlib.pypl...
[((1201, 1389), 'calibre.util.experiment_data.generate_data_1d', 'experiment_util.generate_data_1d', ([], {'N_train': '(20)', 'N_test': '(20)', 'N_valid': '(500)', 'noise_sd': '(0.03)', 'data_range': '(0.0, 1.0)', 'valid_range': '(-0.5, 1.5)', 'seed_train': '(1000)', 'seed_test': '(1500)', 'seed_calib': '(100)'}), '(N_...
import pandas as pd import numpy as np from progressbar import progressbar import sanalytics.algorithms.utils as sau import sanalytics.estimators.pu_estimators as pu import sanalytics.evaluation.utils as seu X_train = pd.read_parquet("datasets/rq3_data/sec1.0R100_train.parquet") X_train = np.array_split(X_train, 300) ...
[ "numpy.array_split", "pandas.read_parquet" ]
[((219, 280), 'pandas.read_parquet', 'pd.read_parquet', (['"""datasets/rq3_data/sec1.0R100_train.parquet"""'], {}), "('datasets/rq3_data/sec1.0R100_train.parquet')\n", (234, 280), True, 'import pandas as pd\n'), ((291, 319), 'numpy.array_split', 'np.array_split', (['X_train', '(300)'], {}), '(X_train, 300)\n', (305, 31...
import sys sys.path.append('..') import parameters as param from utils import load_data import argparse import os import sys, logging import time from datetime import datetime import pytz import numpy as np import random import shutil import warnings warnings.filterwarnings("ignore") from keras import backend as K i...
[ "sys.path.append", "keras.models.load_model", "numpy.load", "utils.load_data", "os.makedirs", "warnings.filterwarnings", "numpy.argmax", "logging.StreamHandler", "os.path.exists", "datetime.datetime.utcnow", "numpy.array", "pytz.timezone", "numpy.exp", "os.path.join", "logging.getLogger"...
[((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys, logging\n'), ((253, 286), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (276, 286), False, 'import warnings\n'), ((2060, 2114), 'os.makedirs', 'os.makedirs', ([...
# -*- coding: utf-8 -*- # Copyright 2011 <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 i...
[ "numpy.log", "numpy.asarray", "numpy.zeros", "numpy.identity", "numpy.linalg.inv", "numpy.array", "math.log" ]
[((1810, 1847), 'numpy.array', 'numpy.array', (['loc'], {'dtype': 'numpy.float32'}), '(loc, dtype=numpy.float32)\n', (1821, 1847), False, 'import numpy\n'), ((1972, 2011), 'numpy.array', 'numpy.array', (['scale'], {'dtype': 'numpy.float32'}), '(scale, dtype=numpy.float32)\n', (1983, 2011), False, 'import numpy\n'), ((2...
from pathlib import Path import cv2 import matplotlib.pyplot as plt import numpy as np from user_input import get_user_input IMG_DIR = 'images' LABELED_DATA_FILE = "labeled_data.csv" IMG_WIDTH = 600 IMG_HEIGHT = 1000 IMG_FORMAT = 'png' def _print_finish_msg(): print("\n******************************") print...
[ "cv2.cvtColor", "numpy.zeros", "matplotlib.pyplot.ion", "cv2.imread", "pathlib.Path", "user_input.get_user_input", "matplotlib.pyplot.pause" ]
[((547, 556), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (554, 556), True, 'import matplotlib.pyplot as plt\n'), ((579, 612), 'numpy.zeros', 'np.zeros', (['(IMG_HEIGHT, IMG_WIDTH)'], {}), '((IMG_HEIGHT, IMG_WIDTH))\n', (587, 612), True, 'import numpy as np\n'), ((814, 830), 'cv2.imread', 'cv2.imread', (['pat...
import numpy as np from utility1 import sigmoid,dsigmoid,preprocess, get_parent_detail, get_child_no import Global def weight_update(w1, w2, dw1, dw2, neta, regu, epnum1, epnum2, wpresent=None): for i in wpresent: if epnum1[i] != 0: w1[i] = w1[i] - neta[0]*(dw1[i].transpose()/epnum1[i] - regu[0...
[ "utility1.sigmoid", "utility1.preprocess", "numpy.power", "numpy.square", "numpy.dot", "utility1.dsigmoid", "numpy.sqrt" ]
[((3483, 3497), 'utility1.sigmoid', 'sigmoid', (['temp1'], {}), '(temp1)\n', (3490, 3497), False, 'from utility1 import sigmoid, dsigmoid, preprocess, get_parent_detail, get_child_no\n'), ((3548, 3566), 'numpy.dot', 'np.dot', (['w2', 'temp12'], {}), '(w2, temp12)\n', (3554, 3566), True, 'import numpy as np\n'), ((3625,...
import cv2 import os import glob from skimage import feature import numpy as np from sklearn.svm import SVC from sklearn.model_selection import GridSearchCV class LocalBinaryPatterns: def __init__(self, numPoints, radius): # store the number of points and radius self.numPoints = numPoints ...
[ "skimage.feature.local_binary_pattern", "cv2.cvtColor", "cv2.waitKey", "cv2.imshow", "cv2.VideoCapture", "cv2.imread", "cv2.rectangle", "numpy.arange", "numpy.array", "sklearn.svm.SVC", "cv2.CascadeClassifier", "cv2.destroyAllWindows", "os.path.join", "os.listdir", "numpy.vstack" ]
[((1174, 1196), 'os.listdir', 'os.listdir', (['img_folder'], {}), '(img_folder)\n', (1184, 1196), False, 'import os\n'), ((1978, 1997), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (1994, 1997), False, 'import cv2\n'), ((2868, 2891), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n',...
''' This file contains the functions to generate, store, and plot interdependenct random and scale free networks <NAME> - Last updated: 03/08/2018 ''' import numpy as np import networkx as nx import matplotlib.pyplot as plt import collections import math import random from itertools import combinations, product '''...
[ "matplotlib.pyplot.title", "matplotlib.pyplot.loglog", "matplotlib.pyplot.axes", "matplotlib.pyplot.bar", "networkx.algorithms.planarity.check_planarity", "networkx.draw_networkx_nodes", "networkx.connected_component_subgraphs", "networkx.erdos_renyi_graph", "networkx.scale_free_graph", "itertools...
[((434, 456), 'itertools.combinations', 'combinations', (['lists', '(2)'], {}), '(lists, 2)\n', (446, 456), False, 'from itertools import combinations, product\n'), ((799, 825), 'networkx.erdos_renyi_graph', 'nx.erdos_renyi_graph', (['n', 'p'], {}), '(n, p)\n', (819, 825), True, 'import networkx as nx\n'), ((909, 928),...
""" Copyright 2021 Tsinghua University Apache 2.0. Author: <NAME> 2021 <NAME> 2021 This script implements multi/cross-lingual related functions originally written by <NAME>, which is latter refactored by <NAME>. """ import json import numpy as np from collections import OrderedDict import torch import tor...
[ "torch.nn.Parameter", "numpy.load", "json.load", "torch.Tensor", "torch.nn.Linear", "collections.OrderedDict" ]
[((509, 522), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (520, 522), False, 'from collections import OrderedDict\n'), ((1211, 1223), 'numpy.load', 'np.load', (['fin'], {}), '(fin)\n', (1218, 1223), True, 'import numpy as np\n'), ((1233, 1249), 'torch.Tensor', 'torch.Tensor', (['pv'], {}), '(pv)\n', (12...
import argparse import numpy as np import os from dagbldr.datasets import fetch_fer from dagbldr.utils import load_checkpoint, interpolate_between_points, make_gif parser = argparse.ArgumentParser() parser.add_argument("saved_functions_file", help="Saved pickle file from vae training") parser.add_...
[ "argparse.ArgumentParser", "matplotlib.pyplot.close", "os.path.exists", "numpy.random.RandomState", "dagbldr.utils.make_gif", "matplotlib.use", "numpy.exp", "dagbldr.utils.load_checkpoint", "dagbldr.datasets.fetch_fer", "numpy.dot", "matplotlib.pyplot.subplots", "dagbldr.utils.interpolate_betw...
[((175, 200), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (198, 200), False, 'import argparse\n'), ((638, 680), 'dagbldr.utils.load_checkpoint', 'load_checkpoint', (['args.saved_functions_file'], {}), '(args.saved_functions_file)\n', (653, 680), False, 'from dagbldr.utils import load_checkpo...
#!/usr/bin/env python3 import cv2 import numpy as np import depthai as dai from time import sleep import datetime import argparse from pathlib import Path datasetDefault = str((Path(__file__).parent / Path('models/dataset')).resolve().absolute()) parser = argparse.ArgumentParser() parser.add_argument('-dataset', narg...
[ "depthai.Pipeline", "argparse.ArgumentParser", "depthai.Device", "pathlib.Path", "cv2.normalize", "cv2.imshow", "datetime.timedelta", "cv2.setTrackbarPos", "depthai.StereoDepthConfig", "cv2.createTrackbar", "cv2.equalizeHist", "cv2.waitKey", "time.sleep", "cv2.applyColorMap", "cv2.flip",...
[((258, 283), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (281, 283), False, 'import argparse\n'), ((932, 955), 'depthai.StereoDepthConfig', 'dai.StereoDepthConfig', ([], {}), '()\n', (953, 955), True, 'import depthai as dai\n'), ((4299, 4313), 'depthai.Pipeline', 'dai.Pipeline', ([], {}), '...
import contextlib import csv import hashlib import random import shutil import tempfile from collections import OrderedDict from copy import copy from distutils.util import strtobool from os import path from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union, cast import numpy as np import torc...
[ "torch.backends.cudnn.is_available", "numpy.random.seed", "torch.hub._get_torch_home", "typing.cast", "pystiche.image.make_batched_image", "shutil.rmtree", "pystiche.image.is_single_image", "os.path.join", "torch.load", "hashlib.sha256", "tempfile.mkdtemp", "random.seed", "torch.hub.load_sta...
[((1631, 1653), 'pystiche.image.is_single_image', 'is_single_image', (['image'], {}), '(image)\n', (1646, 1653), False, 'from pystiche.image import extract_batch_size, is_single_image, make_batched_image\n'), ((3103, 3137), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '(**mkdtemp_kwargs)\n', (3119, 3137), False, '...
''' MFEM example 22 See c++ version in the MFEM library for more detail ''' import os import mfem.ser as mfem from mfem.ser import intArray from os.path import expanduser, join, dirname import numpy as np from numpy import sin, cos, exp, sqrt, pi def run(mesh_file="", order=1, ref_levels=0, ...
[ "mfem.ser.RT_FECollection", "mfem.common.arg_parser.ArgParser", "mfem.ser.intArray", "mfem.ser.Vector", "mfem.ser.BilinearForm", "mfem.ser.OperatorJacobiSmoother", "numpy.sin", "numpy.exp", "mfem.ser.GMRESSolver", "mfem.ser.ND_FECollection", "mfem.ser.ConstantCoefficient", "os.path.dirname", ...
[((1044, 1063), 'mfem.ser.Device', 'mfem.Device', (['device'], {}), '(device)\n', (1055, 1063), True, 'import mfem.ser as mfem\n'), ((1274, 1300), 'mfem.ser.Mesh', 'mfem.Mesh', (['mesh_file', '(1)', '(1)'], {}), '(mesh_file, 1, 1)\n', (1283, 1300), True, 'import mfem.ser as mfem\n'), ((2164, 2198), 'mfem.ser.FiniteElem...
from flask import Flask, render_template, request, redirect, url_for, session, jsonify import joblib from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure import matplotlib.pyplot as plt from matplotlib.style import use import numpy as np from sqlalchemy import...
[ "application.forms.NamerForm", "flask.jsonify", "flask.url_for", "application.user_metrics.UserMetrics.deadlift.desc", "matplotlib.pyplot.tight_layout", "application.user_metrics.UserMetrics.date.asc", "matplotlib.backends.backend_agg.FigureCanvasAgg", "dateutil.relativedelta.relativedelta", "matplo...
[((930, 955), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""Agg"""'], {}), "('Agg')\n", (948, 955), True, 'import matplotlib.pyplot as plt\n'), ((2973, 3020), 'joblib.load', 'joblib.load', (['f"""models{os.path.sep}bench_scaler"""'], {}), "(f'models{os.path.sep}bench_scaler')\n", (2984, 3020), False, ...
import numpy as np def compute_euclidean_distance(point, centroid): return np.sqrt(np.sum((point - centroid) ** 2)) def assign_label_cluster(distance, data_point, centroids): index_of_minimum = min(distance, key=distance.get) return [index_of_minimum, data_point, centroids[index_of_minimum]] def compute...
[ "numpy.sum", "numpy.array", "numpy.genfromtxt" ]
[((1561, 1579), 'numpy.array', 'np.array', (['[[x, y]]'], {}), '([[x, y]])\n', (1569, 1579), True, 'import numpy as np\n'), ((1676, 1714), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': '""","""'}), "(filename, delimiter=',')\n", (1689, 1714), True, 'import numpy as np\n'), ((87, 118), 'numpy.sum', '...
import unittest import openmesh import numpy as np class Python(unittest.TestCase): def setUp(self): self.mesh = openmesh.TriMesh() # Add some vertices self.vhandle = [] self.vhandle.append(self.mesh.add_vertex(np.array([0, 1, 0]))) self.vhandle.append(self.mesh.add_vert...
[ "unittest.TextTestRunner", "openmesh.TriMesh", "numpy.array", "unittest.TestLoader" ]
[((128, 146), 'openmesh.TriMesh', 'openmesh.TriMesh', ([], {}), '()\n', (144, 146), False, 'import openmesh\n'), ((1750, 1771), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (1769, 1771), False, 'import unittest\n'), ((1806, 1842), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity...
import numpy as np import torch import os import pickle as pkl import sys import re import scipy.io from Bio import SeqIO from Bio.PDB.DSSP import DSSP from Bio.PDB import PDBParser from prospr.nn import INPUT_DIM, CROP_SIZE def seq_to_mat(seq): """Convert a sequence into Nx21 matrix for input vector""" aa_or...
[ "numpy.transpose", "numpy.zeros", "numpy.arange", "numpy.repeat", "torch.zeros", "numpy.eye", "torch.from_numpy" ]
[((1008, 1047), 'numpy.zeros', 'np.zeros', (['(INPUT_DIM, i_range, j_range)'], {}), '((INPUT_DIM, i_range, j_range))\n', (1016, 1047), True, 'import numpy as np\n'), ((1246, 1282), 'numpy.transpose', 'np.transpose', (['j_crop'], {'axes': '(2, 0, 1)'}), '(j_crop, axes=(2, 0, 1))\n', (1258, 1282), True, 'import numpy as ...
import numpy as np import xarray def saveDraws(beta_samples, u_samples, global_effects_names, random_effects_dims, random_effects_names, coords_dict={}): all_coords = {} assert beta_samples.shape[0] == len(global_effects_names) beta_xr = xarray.DataArray(beta_samples, dims=('cov','draw'), ...
[ "numpy.arange", "xarray.Dataset" ]
[((1262, 1299), 'xarray.Dataset', 'xarray.Dataset', (['data_vars', 'all_coords'], {}), '(data_vars, all_coords)\n', (1276, 1299), False, 'import xarray\n'), ((544, 583), 'numpy.arange', 'np.arange', (['(1)', '(beta_samples.shape[1] + 1)'], {}), '(1, beta_samples.shape[1] + 1)\n', (553, 583), True, 'import numpy as np\n...
#!/usr/bin/env python # coding: utf-8 import time import numpy as np import sklearn.datasets import nnet def run(): # Fetch data mnist = sklearn.datasets.fetch_mldata('MNIST original', data_home='./data') split = 60000 X_train = mnist.data[:split]/255.0 y_train = mnist.target[:split] X_test =...
[ "nnet.Linear", "nnet.Activation", "time.time", "nnet.LogRegression", "numpy.random.random_integers", "numpy.unique" ]
[((497, 553), 'numpy.random.random_integers', 'np.random.random_integers', (['(0)', '(split - 1)', 'n_train_samples'], {}), '(0, split - 1, n_train_samples)\n', (522, 553), True, 'import numpy as np\n'), ((1291, 1302), 'time.time', 'time.time', ([], {}), '()\n', (1300, 1302), False, 'import time\n'), ((1387, 1398), 'ti...
#%% """ <NAME> 2/2/2021 :bold:`Example Script` Time-independent Exterior Complex Scaling (ECS) FEM-DVR example Temkin-Poet (s-wave limit) or colinear model of a two-electron atom: H- anion or He bound and autoionizing states Uses femdvr.py class library, updated Jan 2021 with 2D routines Fi...
[ "os.mkdir", "numpy.abs", "os.getcwd", "numpy.empty", "click.option", "os.path.exists", "scipy.linalg.eig", "click.command", "scipy.linalg.inv", "numpy.argsort", "numpy.imag", "quantumgrid.potential.Potential", "numpy.exp", "numpy.real", "quantumgrid.femdvr.FEM_DVR", "numpy.sqrt" ]
[((2468, 2589), 'click.option', 'click.option', (['"""--want_to_plot"""'], {'type': 'click.BOOL', 'default': '"""False"""', 'help': '"""Set to True if you want to turn on plotting"""'}), "('--want_to_plot', type=click.BOOL, default='False', help=\n 'Set to True if you want to turn on plotting')\n", (2480, 2589), Fal...
#!/usr/bin/ python3 # from matplotlib import gridspec # from matplotlib import rc # rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) # rc('text',usetex=True) # from pylab import * import yoda import numpy as np # from decimal import Decimal # # from termcolor import colorescolors[2] # import math impor...
[ "matplotlib.pyplot.subplot", "matplotlib.pyplot.figaspect", "numpy.sum", "os.makedirs", "matplotlib.pyplot.suptitle", "os.path.exists", "yoda.read", "numpy.append", "numpy.array", "matplotlib.gridspec.GridSpec", "matplotlib.pyplot.tight_layout", "matplotlib.pyplot.savefig" ]
[((665, 692), 'yoda.read', 'yoda.read', (['"""SM_WZ_dib.yoda"""'], {}), "('SM_WZ_dib.yoda')\n", (674, 692), False, 'import yoda\n'), ((938, 964), 'yoda.read', 'yoda.read', (['"""WZ_ATLAS.yoda"""'], {}), "('WZ_ATLAS.yoda')\n", (947, 964), False, 'import yoda\n'), ((1186, 1220), 'yoda.read', 'yoda.read', (['"""cW_WZ_dib_...
import os import time from collections import deque import ipywidgets import jpy_canvas import numpy as np from ipywidgets import IntSlider, VBox, HBox, Checkbox, Output, Text, RadioButtons, Tab from numpy import array import flatland.utils.rendertools as rt from flatland.core.grid.grid4_utils import mirror from flat...
[ "numpy.abs", "numpy.floor", "ipywidgets.Text", "ipywidgets.Output", "flatland.envs.observations.TreeObsForRailEnv", "flatland.envs.agent_utils.EnvAgent", "collections.deque", "jpy_canvas.Canvas", "ipywidgets.Button", "numpy.copy", "flatland.envs.rail_generators.empty_rail_generator", "os.path....
[((1897, 1919), 'jpy_canvas.Canvas', 'jpy_canvas.Canvas', (['img'], {}), '(img)\n', (1914, 1919), False, 'import jpy_canvas\n'), ((1997, 2022), 'numpy.copy', 'np.copy', (['self.wImage.data'], {}), '(self.wImage.data)\n', (2004, 2022), True, 'import numpy as np\n'), ((2410, 2450), 'ipywidgets.Checkbox', 'ipywidgets.Chec...
import time import unittest import numpy as np import tensorflow as tf from model import PolicyGradient from pprint import pprint class TestModel(unittest.TestCase): @classmethod def setUpClass(cls): cls.ob_dim = 5 cls.ac_dim = 5 cls.model = PolicyGradient( ob_dim=cls.ob_...
[ "tensorflow.trainable_variables", "time.time", "numpy.random.random", "pprint.pprint", "model.PolicyGradient" ]
[((278, 409), 'model.PolicyGradient', 'PolicyGradient', ([], {'ob_dim': 'cls.ob_dim', 'ac_dim': 'cls.ac_dim', 'discrete': '(False)', 'n_layers': '(2)', 'size': '(32)', 'learning_rate': '(0.05)', 'nn_baseline': '(True)'}), '(ob_dim=cls.ob_dim, ac_dim=cls.ac_dim, discrete=False,\n n_layers=2, size=32, learning_rate=0....
from sklearn.feature_extraction.text import TfidfVectorizer import pandas as pd import numpy as np import gensim import gensim.downloader as api import pickle def dummy_fun(doc): return doc ''' Abstract class for that wraps around vectorizers. ''' class VectorizerClassBase(): model = None default_pickle_...
[ "pandas.DataFrame", "sklearn.feature_extraction.text.TfidfVectorizer", "gensim.downloader.load", "numpy.mean", "gensim.models.KeyedVectors.load_word2vec_format" ]
[((2796, 2825), 'numpy.mean', 'np.mean', (['word_vectors'], {'axis': '(0)'}), '(word_vectors, axis=0)\n', (2803, 2825), True, 'import numpy as np\n'), ((2896, 2950), 'gensim.downloader.load', 'api.load', (['"""word2vec-google-news-300"""'], {'return_path': '(True)'}), "('word2vec-google-news-300', return_path=True)\n",...
"""----------------------------------------------------------------------------- bidsArchive.py Implements interacting with an on-disk BIDS Archive. -----------------------------------------------------------------------------""" import functools import json import logging import os import re from typing import List...
[ "nibabel.Nifti1Image", "os.path.abspath", "bids.layout.BIDSLayout", "rtCommon.errors.DimensionError", "numpy.allclose", "rtCommon.errors.StateError", "json.dumps", "bids.layout.writing.write_to_file", "rtCommon.bidsCommon.getNiftiData", "numpy.expand_dims", "bids.exceptions.NoMatchError", "rtC...
[((966, 1010), 'bids.config.set_option', 'bc_set_option', (['"""extension_initial_dot"""', '(True)'], {}), "('extension_initial_dot', True)\n", (979, 1010), True, 'from bids.config import set_option as bc_set_option\n'), ((1021, 1048), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1038,...
import numpy as np import matplotlib.pyplot as plt def main(): result_single = np.load("./single.npy") plt.plot(result_single, label="Single") result_multi = np.load("./multi.npy") plt.plot(result_multi, label="Multi") #result_multi_rs = np.load("./multi_rs.npy") #plt.plot(result_multi_rs, l...
[ "numpy.load", "matplotlib.pyplot.show", "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.gcf", "matplotlib.pyplot.savefig" ]
[((85, 108), 'numpy.load', 'np.load', (['"""./single.npy"""'], {}), "('./single.npy')\n", (92, 108), True, 'import numpy as np\n'), ((113, 152), 'matplotlib.pyplot.plot', 'plt.plot', (['result_single'], {'label': '"""Single"""'}), "(result_single, label='Single')\n", (121, 152), True, 'import matplotlib.pyplot as plt\n...
r"""Reverse Polish Notation calculator. Exceptions ---------- * :class:`StackUnderflowError` Classes ------- * :class:`Expression` * :class:`Token` * :class:`Literal` * :class:`Variable` * :class:`Operator` Functions --------- * :func:`token` Constants --------- ============== ================= Keyword ...
[ "numpy.absolute", "numpy.moveaxis", "astropy.convolution.convolve", "numpy.maximum", "numpy.arctan2", "numpy.ravel", "typing.cast", "numpy.floor", "numpy.isnan", "numpy.arccosh", "numpy.shape", "numpy.sin", "numpy.exp", "numpy.bitwise_or", "numpy.round", "numpy.arctanh", "numpy.copy"...
[((26670, 26684), 'numpy.absolute', 'np.absolute', (['x'], {}), '(x)\n', (26681, 26684), True, 'import numpy as np\n'), ((27364, 27374), 'numpy.sqrt', 'np.sqrt', (['x'], {}), '(x)\n', (27371, 27374), True, 'import numpy as np\n'), ((27711, 27723), 'numpy.square', 'np.square', (['x'], {}), '(x)\n', (27720, 27723), True,...
from __future__ import (division, print_function, absolute_import, unicode_literals) __all__ = ["make_summary_plot"] import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from matplotlib.ticker import MultipleLocator, ScalarFormatter import os import loggi...
[ "os.path.abspath", "matplotlib.pyplot.matplotlib.ticker.ScalarFormatter", "os.path.exists", "numpy.argsort", "matplotlib.pyplot.figure", "numpy.array", "matplotlib.pyplot.Line2D", "matplotlib.ticker.MultipleLocator", "matplotlib.gridspec.GridSpec", "matplotlib.ticker.ScalarFormatter", "logging.g...
[((388, 415), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (405, 415), False, 'import logging\n'), ((2689, 2703), 'matplotlib.gridspec.GridSpec', 'GridSpec', (['(4)', '(2)'], {}), '(4, 2)\n', (2697, 2703), False, 'from matplotlib.gridspec import GridSpec\n'), ((2208, 2229), 'os.path.exi...
'''You can use functions and lists in this module to generate data for cases. ''' import numpy as np from .utils import ( bits_to_dtype_uint, factor_lmul ) def vector_mask_array_random( vl ): '''Function used to generate random mask bits for rvv instructions. Args: vl (int): vl register val...
[ "numpy.random.uniform", "numpy.ceil", "numpy.packbits", "numpy.ones", "numpy.random.randint", "numpy.array", "numpy.unpackbits", "numpy.linspace", "numpy.concatenate" ]
[((745, 781), 'numpy.packbits', 'np.packbits', (['mask'], {'bitorder': '"""little"""'}), "(mask, bitorder='little')\n", (756, 781), True, 'import numpy as np\n'), ((1721, 1748), 'numpy.ones', 'np.ones', (['vl'], {'dtype': 'np.uint8'}), '(vl, dtype=np.uint8)\n', (1728, 1748), True, 'import numpy as np\n'), ((1778, 1814)...