prompt
stringlengths
19
879k
completion
stringlengths
3
53.8k
api
stringlengths
8
59
""" Parsers for several prediction tool outputs. """ import numpy as np max_solvent_acc = {'A': 106.0, 'C': 135.0, 'D': 163.0, 'E': 194.0, 'F': 197.0, 'G': 84.0, 'H': 184.0, 'I': 169.0, 'K': 205.0, 'L': 164.0, 'M': 188.0, 'N': 157.0, 'P': 136....
np.array([result])
numpy.array
import numpy as np from gym.spaces import Box import pyflex from softgym.envs.fluid_env import FluidEnv import copy from softgym.utils.misc import rotate_rigid_object, quatFromAxisAngle from shapely.geometry import Polygon import random, math class PourWaterPosControlEnv(FluidEnv): def __init__(self,...
np.array([0, 0, -1])
numpy.array
# pre/test_shift_scale.py """Tests for rom_operator_inference.pre._shift_scale.py.""" import os import h5py import pytest import itertools import numpy as np import rom_operator_inference as opinf # Data preprocessing: shifting and MinMax scaling / unscaling ================= def test_shift(set_up_basis_data): ...
np.random.randint(0, 100, (120,32))
numpy.random.randint
import numpy as np import matplotlib.pyplot as plt ### Command Sequence for Main Odometry Scenario ### main_sequence_commands = np.array([[0.5, 0, 0], [1.0, 0, 0], [1, 0, 0.785], [1, 0, 1.57], [0, 1, -0.785], [1, 0, 0], [1, 0 , -0.785], [0, -3, 1.57], [0.5, 0, 0], [1.0, 0, 0], [1, ...
np.sin(pose[2] + rotation[0])
numpy.sin
""" Linear dynamical system model for the AP text dataset. Each document is modeled as a draw from an LDS with categorical observations. """ import os import gzip import time import pickle import collections import numpy as np from scipy.misc import logsumexp from sklearn.feature_extraction.text import CountVectorizer...
np.cumsum(times)
numpy.cumsum
# -*- coding: utf-8 -*- """ Created on Fri Oct 8 14:36:04 2021 @author: sgboakes """ import numpy as np import matplotlib.pyplot as plt from pysatellite import Transformations, Functions, Filters import pysatellite.config as cfg import pandas as pd if __name__ == "__main__": plt.close('all') ...
np.identity(3)
numpy.identity
""" Recent upgrade of keras versions in TF 2.5+, keras has been moved to tf.keras This has resulted in certain exceptions when keras models are attacked in parallel This script fixes this behavior by adding an official hotfix for this situation detailed here: https://github.com/tensorflow/tensorflow/issues/34697 All mo...
np.zeros((NUM_WORDS,))
numpy.zeros
import pandas as pd import numpy as np from pylab import rcParams import glob from natsort import natsorted import re from numpy import linalg as LA import matplotlib.pyplot as plt import datetime import os import matplotlib.gridspec as gridspec import seaborn as sns def dir_check(now_time): if not os.path.exists(...
np.array(path)
numpy.array
#!/usr/bin/env python from mpi4py import MPI import sys sys.path.append( '../stochastic') from st_utils.coords import * import vtk import numpy as np class Args(object): pass def transform_back(pt,pd): #The reconstructed surface is transformed back to where the #original points are. (Hopefully) it is only a simil...
np.array(self.values)
numpy.array
from time import sleep import numpy as np from scipy.fft import fft from scipy.integrate import simps NUM_SAMPLES = 1024 SAMPLING_RATE = 44100. MAX_FREQ = SAMPLING_RATE / 2 FREQ_SAMPLES = NUM_SAMPLES / 8 TIMESLICE = 100 # ms NUM_BINS = 16 data = {'values': None} try: import pyaudio def update_audio_data()...
np.random.randn()
numpy.random.randn
# -*- coding: utf-8 -*- """ Copyright (c) 2016 <NAME>, <NAME>, and <NAME> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy...
np.argsort(dist_vect)
numpy.argsort
import numpy as np import cv2 from scipy.ndimage import label from .vistools import norm_atten_map import torch.nn.functional as F def get_topk_boxes(logits, cam_map, im_file, input_size, crop_size, topk=(1, ), threshold=0.2, mode='union', gt=None): maxk = max(topk) maxk_cls =
np.argsort(logits)
numpy.argsort
import tensorflow as tf from keras.layers import Dense, Flatten, Lambda, Activation, MaxPooling2D from keras.layers.convolutional import Convolution2D from keras.models import Sequential from keras.optimizers import Adam import os, sys import errno import json import cv2 import matplotlib.pyplot as plt import numpy a...
np.max(data)
numpy.max
import OpenEXR import Imath import numpy as np import time import data.util_exr as exr_utils import os def _crop(img, pos, size): ow, oh = img.shape[0], img.shape[1] x1, y1 = pos tw = th = size if (ow > tw or oh > th): # return img.crop((x1, y1, x1 + tw, y1 + th)) #CHANGED ret...
np.zeros((128,128,3))
numpy.zeros
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ PyDDSBB @ GT - DDPSE @author: JianyuanZhai """ import numpy as np from PyDDSBB._utilis import LHS import PyDDSBB._problem as _problem import PyDDSBB._underestimators import time from PyDDSBB._node import Node from PyDDSBB._splitter import Splitter from PyDDSBB._mach...
np.concatenate((self.X, Xnew), axis=0)
numpy.concatenate
import os import numpy as np from numpy.core.fromnumeric import ptp import raisimpy as raisim import time import sys import datetime import matplotlib import matplotlib.pyplot as plt from xbox360controller import Xbox360Controller xbox = Xbox360Controller(0, axis_threshold=0.02) # v_ref = xbox.trigger_r.value * (-4) -...
np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
numpy.array
"""Tools for Loop-detection analysis.""" from multiprocessing import Pool from typing import Tuple, Sequence, Iterator from dataclasses import dataclass import numpy as np import pandas as pd from scipy import ndimage, stats, sparse from sklearn.cluster import DBSCAN from statsmodels.stats import multitest from .util...
np.where(dbscan.labels_ == cluster_id)
numpy.where
import scipy import scipy.misc import numpy as np def load(path): img = scipy.misc.imread(path) ## TODO check what is the possible returned shapes if img.shape[-1] == 1: # grey image img = np.array([img, img, img]) elif img.shape[-1] == 4: # alpha component img = img[:,:,:3] return im...
np.clip(img, 0, 255)
numpy.clip
# pylint: disable=E1101 """ Generic classes and utility functions """ from datetime import timedelta import numpy as np class FlopyBinaryData: """ The FlopyBinaryData class is a class to that defines the data types for integer, floating point, and character data in MODFLOW binary files. The FlopyBin...
np.fromfile(self.file, dtype, count)
numpy.fromfile
import datetime from dateutil.relativedelta import * from fuzzywuzzy import fuzz import argparse import glob import numpy as np import pandas as pd from scipy.stats import ttest_1samp import sys import xarray as xr from paths_bra import * sys.path.append('./..') from refuelplot import * setup() from utils import * ...
np.array(scores)
numpy.array
import itertools from typing import Union, Sequence, Optional import numpy as np _RealArraylike = Union[np.ndarray, float] def _single_qubit_unitary( theta: _RealArraylike, phi_d: _RealArraylike, phi_o: _RealArraylike ) -> np.ndarray: """Single qubit unitary matrix. Args: theta: cos(theta) is m...
np.einsum('...a,abc->...bc', vector, _kak_gens)
numpy.einsum
""" Created on June 6th, 2019. This script compares surface ozone data with hourly resolution from Summit (SUM) station in Greenland with Summit GC ethane and acetylene data. 'ozone.py' compares the ozone with the residual values The ozone data used here is courtesy of NOAA ESRL GMD. See the citation below. <NAME>., ...
np.nanmean(ozoneData['resid'][indices].values)
numpy.nanmean
# Client --> ./templates/index.html # -*- coding: utf-8 -*- # 导入常用的库 from flask import Flask, jsonify, render_template, request from utils import Config, Logger, CharsetMapper import torchvision.transforms as transforms from PIL import Image import torch.nn.functional as F import numpy as np import cv2 import PIL impor...
np.array(img)
numpy.array
import os from pathlib import Path import numpy as np from sklearn.ensemble import RandomForestClassifier print('hi') os.getpid() Path('/')
np.array([1, 2, 3])
numpy.array
import numpy as np import torch from L96sim.L96_base import f1, f2, pf2 def init_torch_device(): if torch.cuda.is_available(): print('using CUDA !') device = torch.device("cuda") torch.set_default_tensor_type("torch.cuda.FloatTensor") else: print("CUDA not available") de...
np.random.randn(K*(J+1),N_trials)
numpy.random.randn
# coding: utf-8 ''' from: examples/tutorial/fifth.cc to: fifth.py time: 20101110.1948. // // node 0 node 1 // +----------------+ +----------------+ // | ns-3 TCP | | ns-3 TCP | // +----------------+ +----------------+ // | 10.1.1.1 | | 10.1.1.2 |...
np.cumsum(y_counts)
numpy.cumsum
from .mcmcposteriorsamplernorm import fit from scipy.stats import norm import pandas as pd import numpy as np import pickle as pk from sklearn.cluster import KMeans from ..shared_functions import * class mcmcsamplernorm: """ Class for the mcmc sampler of the deconvolution gaussian model """ def __init...
np.sum(ids==i)
numpy.sum
import numpy import sys import math import logic from scipy.integrate import odeint import scipy.optimize as optim import NNEX_DEEP_NETWORK as NNEX import NNEX_DEEP_NETWORKY as NNEXY #import NNEX def DISCON(avrSWAP_py, from_SC_py, to_SC_py): if logic.counter == 0: import globalDISCON import OB...
numpy.delete(yawerrmeas.bl3_old, [inddel[0][:-2]], 0)
numpy.delete
import numpy as np import numpy.linalg as npl from dipy.core.triangle_subdivide import create_half_unit_sphere from dipy.reconst.dti import design_matrix, lower_triangular from nose.tools import assert_equal, assert_raises, assert_true, assert_false from numpy.testing import assert_array_equal, assert_array_almost_eq...
np.arange(10)
numpy.arange
#!/usr/bin/python # coding:utf-8 import numpy as np import random import string from requests import Request, Session from MyDecision import Decision from MyWord2Vec import Word2Vec PROXY = {'http': '127.0.0.1:8083'} # CredentialsTBLのカラム情報 str_col_credentialstbl = "site_id, " \ "...
np.argsort(nd_values)
numpy.argsort
import numpy as np import scipy from scipy import optimize as opt from sklearn.decomposition import PCA from utils import * from functools import partial class PNS(object): """ Fit nested_spheres to data. This is a python code to PNS matlab code See Sungkyu Jung et al, 2012 for the original PNS. For Kur...
np.cos(geodmean + res[0, :])
numpy.cos
# ****************************************************************************** # Copyright 2017-2021 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
np.int16(-12345)
numpy.int16
#!/usr/bin/env python # # Author: <NAME> <<EMAIL>> # ''' XC functional, the interface to xcfun (https://github.com/dftlibs/xcfun) U. Ekstrom et al, J. Chem. Theory Comput., 6, 1971 ''' import copy import ctypes import math import numpy from pyscf import lib _itrf = lib.load_library('libxcfun_itrf') XC = XC_CODES = ...
numpy.empty((ngrids,outlen))
numpy.empty
import skimage.feature import skimage.transform import skimage.filters import scipy.interpolate import scipy.ndimage import scipy.spatial import scipy.optimize import numpy as np import pandas import plot class ParticleFinder: def __init__(self, image): """ Class for finding circular particles ...
np.sin(t)
numpy.sin
from __future__ import division import torch import torch.nn.functional as F from utils import setup_logger from model import agentNET from torch.autograd import Variable from env import * import numpy as np import time import random S_INFO = 6 # bit_rate, buffer_size, next_chunk_size, bandwidth_measurement(throughpu...
np.max(VIDEO_BIT_RATE)
numpy.max
#Core Imports for experiments import shap import numpy as np import pandas as pd import math import matplotlib.pyplot as plt import seaborn as sns import random import itertools from statistics import mean from sklearn.datasets import make_blobs from sklearn.ensemble import IsolationForest from sklearn.preprocessing im...
np.array(orig_aws_l)
numpy.array
######################### ######################### # Need to account for limit in input period ######################### ######################### # Baseline M67 long script -- NO crowding # New script copied from quest - want to take p and ecc from each population (all, obs, rec) and put them into separate file # Do...
np.log10(Phs)
numpy.log10
import time import sys import json import argparse from tqdm import trange from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch import numpy as np from scipy.spatial.distance import jensenshannon import gym import matplotlib.pyplot as plt from matplotlib.axes import Axes fr...
np.sum(episode_true_rewards2)
numpy.sum
from ..meshio import form_mesh import numpy as np import logging def merge_meshes(input_meshes): """ Merge multiple meshes into a single mesh. Args: input_meshes (``list``): a list of input :class:`Mesh` objects. Returns: A :py:class:`Mesh` consists of all vertices, faces and...
np.vstack(voxels)
numpy.vstack
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ ====================================== Clustering by rotation of eigenvectors ====================================== cluster by rotating eigenvectors to align with the canonical coordinate system usage: nc = cluster_rotate(evecs, evals, group_num, method, verbose) Inpu...
np.argsort(mag)
numpy.argsort
import networkx as nx import numpy as np import pandas as pd import itertools from functools import reduce import operator as op import string # Returns product of all the element in a list/tuple def Prod(v): return reduce(op.mul, v, 1) # Transposes a list of lists def TransposeLists(l): return [list(x) for...
np.prod(dom_per_proc[:, :-1], axis=1)
numpy.prod
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 9 20:17:38 2021 @author: lucasmurtinho """ import numpy as np from ExKMC.Tree import Node import time import random from find_cut import get_distances def get_best_cut_makarychev(data, data_count, valid_data, centers, valid_centers, ...
np.argmax(valid_centers)
numpy.argmax
# # works with polynomial (linear) fit # """ functions: goFromTo: calculates the phase shift matrix """ __author__ = "<NAME>" __contact__ = "<EMAIL>" __copyright = "ESRF, 2012" import numpy, math #from scipy import stats import Shadow as sh import Shadow.ShadowTools as st def goFromTo(source,i...
numpy.abs(fieldComplexAmplitude)
numpy.abs
#!/usr/bin/env python import argparse, sys from argparse import RawTextHelpFormatter import numpy as np import scipy.optimize import scipy.sparse as sp from scipy.stats import multinomial from sklearn.preprocessing import quantile_transform from sklearn.model_selection import train_test_split from sklearn.model_selecti...
np.finfo(np.float32)
numpy.finfo
# -*- coding: utf-8 -*- """ The below functions can be used to import delimited data files into Numpy or Matlab database format. """ import argparse import copy import glob import math import os import re from enum import Enum import numpy as np import pkg_resources # pylint: disable=no-member import scipy.io cl...
np.append(current_step_end[0], [step_time.shape[0] - 1])
numpy.append
import numpy as np from scipy import ndimage as nd from .pyudwt import Denoise2D1DHardMRS b3spline =
np.array([1.,4.,6.,4.,1.])
numpy.array
# -*- coding: utf-8 -*- # # # lssa.py # # purpose: Tutorial on lssa # author: <NAME> # e-mail: <EMAIL> # web: http://ocefpaf.tiddlyspot.com/ # created: 16-Jul-2012 # modified: Fri 27 Jul 2012 05:32:29 PM BRT # # obs: Least-squares spectral analysis # http://en.wikipedia.org/wiki/Least-squares_spectral_analy...
np.cos(2 * np.pi * f1 * ager)
numpy.cos
import numpy as np # we build some distributions and load them into a dict mu, sigma = 0, 0.5 normal = np.random.normal(mu, sigma, 1000) lognormal =
np.random.lognormal(mu, sigma, 1000)
numpy.random.lognormal
import random import numpy as np import torch import torch.utils.data from io import BytesIO from google.cloud import storage client = storage.Client() bucket = client.bucket('your-bucket-name') class VocalRemoverCloudDataset(torch.utils.data.Dataset): def __init__(self, dataset, vocal_dataset, num_training_item...
np.abs(X)
numpy.abs
#!/usr/bin/env python # # __init__.py - # # Author: <NAME> <<EMAIL>> # import os import os.path as op import gc import re import sys import time import shlex import shutil import logging import tempfile import ...
np.loadtxt(infile)
numpy.loadtxt
import torch import torch.nn as nn import numpy as np from lib.config import cfg import lib.utils.kitti_utils as kitti_utils import lib.utils.roipool3d.roipool3d_utils as roipool3d_utils import lib.utils.iou3d.iou3d_utils as iou3d_utils class ProposalTargetLayer(nn.Module): def __init__(self): super().__i...
np.random.permutation(fg_num_rois)
numpy.random.permutation
import pytest import numpy as np from PythonLinearNonlinearControl.models.two_wheeled import TwoWheeledModel from PythonLinearNonlinearControl.configs.two_wheeled \ import TwoWheeledConfigModule class TestTwoWheeledModel(): """ """ def test_step(self): config = TwoWheeledConfigModule() ...
np.ones((1, config.STATE_SIZE))
numpy.ones
# Part of the psychopy.iohub library. # Copyright (C) 2012-2016 iSolver Software Solutions # Distributed under the terms of the GNU General Public License (GPL). from __future__ import division """ ioHub Eye Tracker Online Sample Event Parser WORK IN PROGRESS - VERY EXPERIMENTAL Copyright (C) 2012-2014 iSolver Softw...
np.arctan(yDiff, xDiff)
numpy.arctan
import numpy as np import joblib from .rbm import RBM from .utils import sigmoid # TODO(anna): add sparsity constraint # TODO(anna): add entroty loss term # TODO(anna): add monitoring kl divergence (and reverse kl divergence) # TODO(anna): run on the paper examples again # TODO(anna): try unit test case? say in a 3x3...
np.sign(self.W)
numpy.sign
#!/usr/bin/env python # -*- coding: utf-8 -*- """ project: https://github.com/charnley/rmsd license: https://github.com/charnley/rmsd/blob/master/LICENSE """ import os import sys import unittest import numpy as np from contextlib import contextmanager try: from StringIO import StringIO except ImportError: fr...
np.array([-22.018, 17.551, 26.0], dtype=float)
numpy.array
from __future__ import division, print_function, absolute_import __usage__ = """ To run tests locally: python tests/test_arpack.py [-l<int>] [-v<int>] """ import warnings import numpy as np from numpy.testing import assert_allclose, \ assert_array_almost_equal_nulp, TestCase, run_module_suite, dec, \ ...
np.dot(b, evec)
numpy.dot
import numpy as np from ..tools import n_ball_volume, n_sphere_area, delay_coordinates, lstsqr from ..tools.nd_utils import nd_function from .math_utils import _lstsqr_design_matrix from scipy.special import gamma from nolds.measures import poly_fit from tqdm import tqdm from typing import Union import plotly.graph_ob...
np.log(log_base)
numpy.log
# -*- coding: utf-8 -*- # # Copyright (C) 2019 Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG), # acting on behalf of its Max Planck Institute for Intelligent Systems and the # Max Planck Institute for Biological Cybernetics. All rights reserved. # # Max-Planck-Gesellschaft zur Förderung der Wissens...
np.zeros((batch_size, 1 * 3))
numpy.zeros
import numpy as np import segyio as so from scipy.signal import butter, sosfilt import time # Simple timer with message def timer(start, message): end = time.time() hours, rem = divmod(end-start, 3600) minutes, seconds = divmod(rem, 60) info('{}: {:d}:{:02d}:{:02d}'.format(message, int(hours), int(min...
np.zeros(1, dtype='int')
numpy.zeros
import numpy as np import attr_dict import cfg import yaml from contextlib import contextmanager import tactics_utils class Player: def __init__(self, pos=None, angle=0, label='', role=''): self.pos = np.array(pos) self.angle = int(angle) self.label = label self.role = role @p...
np.array([self.pos[0], self.pos[1], 1])
numpy.array
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Plots plotrange, Btau, Ctau, ellipse, SUE plotool: set_clib, set_fig, set_ax, reset_handles, append_handles, get_handles, set_legend, plot, eplot, save, show, close pplot(plotool): add_plot, add_legend """ import warnin...
np.isscalar(sigmay)
numpy.isscalar
"""Filter design. """ from __future__ import division, print_function, absolute_import import warnings import numpy from numpy import (atleast_1d, poly, polyval, roots, real, asarray, allclose, resize, pi, absolute, logspace, r_, sqrt, tan, log10, arctan, arcsinh, sin, e...
np.delete(z, z1_idx)
numpy.delete
import numpy as np import HyperUtils as hu check_eps = 0.3 check_sig = 2.0 check_alp = np.array([0.2, 0.18, 0.16, 0.14]) check_chi = np.array([0.9, 1.0, 1.1, 1.2]) file = "h1epmk_nest" name = "1D Linear Elastic-Plastic with Multisurface Kinematic Hardening - Nested" mode = 0 ndim = 1 const = [100.0, 4, 0....
np.zeros(n_int)
numpy.zeros
''' Implementation of long-time intensity autocorrelation analysis according to Houel et al. ACS Nano 2015, 9, 1, 886–893 Fitting Eq. 3 therein to long-time-scale (> milliseconds) autocorrelation which for simple two-level dots gives a measure related to the power law exponent of switching Autocorrelations are obta...
np.concatenate((timestamps_chA_bin, timestamps_chB_bin))
numpy.concatenate
import matplotlib.pyplot as plt import h5py, argparse import numpy as np from matplotlib import cm from matplotlib.colors import ListedColormap, LinearSegmentedColormap import matplotlib.colors as colors from matplotlib.backends.backend_pdf import PdfPages from matplotlib.ticker import MultipleLocator, FormatStrFormatt...
np.arange(limits_mu-3*limits_sigma, limits_mu+3*limits_sigma, 0.1)
numpy.arange
import sys import tensorflow as tf import numpy as np import librosa from python_speech_features import fbank,delta import scipy.io.wavfile as wave from tensorflow.python.client import device_lib def _parse_function(example_proto): ''' Function to parse tfrecords file ''' feature = {'data': tf.VarLenFeature(tf...
np.hanning(x)
numpy.hanning
import numpy as np from datayoink.coordconverter import get_axis_info, get_step, get_x_scale, pixel_to_coords, closest,\ unify_x, get_pixels_2d, create_pixel_dict, create_coordinate_dict, get_start_end def test_get_axis_info(): """ Tests the get_axis_info function """ ...
np.diff(unified_x)
numpy.diff
""" This module contains the implementation of block norms, i.e. l1/l*, linf/l* norms. These are used in multiresponse LASSOs. """ from __future__ import print_function, division, absolute_import import warnings from copy import copy import numpy as np from . import seminorms from ..identity_quadratic import identi...
np.maximum(norms - l2_weight, 0)
numpy.maximum
# <NAME> import argparse, sys, os import numpy as np import pylab as plt from glob import glob from spectral.io import envi from scipy.stats import norm from scipy.linalg import solve, inv from astropy import modeling from sklearn.linear_model import RANSACRegressor from scipy.optimize import minimize from scipy.interp...
np.isnan(evec)
numpy.isnan
# Python 3.5 # Script written by <NAME> (<EMAIL>), <NAME> (<EMAIL>), and <NAME> (<EMAIL>) # VERSION 0.1 - JUNE 2020 #--------TURN OFF MAGMASAT WARNING--------# import warnings warnings.filterwarnings("ignore", message="rubicon.objc.ctypes_patch has only been tested ") warnings.filterwarnings("ignore", message="The han...
np.shape(Px_new)
numpy.shape
import pytest import numpy as np from functools import reduce from myml.dl import Tensor def test_add(): a = Tensor([[1, 2], [3, 4]]) b = Tensor([[0, -1], [-1, 0]]) assert ((a + b).array == a.array + b.array).all() assert ((b + 2).array == b.array + 2).all() assert ((2 + b).array == b.array + 2)...
np.array([0, 1])
numpy.array
import math as mt import numpy as np import byxtal.find_csl_dsc as fcd import byxtal.integer_manipulations as iman import byxtal.bp_basis as bpb import byxtal.pick_fz_bpl as pfb import numpy.linalg as nla import ovito.data as ovd from ovito.pipeline import StaticSource, Pipeline import ovito.modifiers as ovm from ovit...
np.shape(Y)
numpy.shape
import numpy as np from torch.utils.data import Dataset class GridSampler(Dataset): """ Adapted from NiftyNet """ def __init__(self, data, window_size, border): self.array = data self.locations = self.grid_spatial_coordinates( self.array, window_size, ...
np.any(location < 0)
numpy.any
import os import numpy as np import pandas as pd import yaml from . import model as model_lib from . import training, tensorize, io_local def main(): #Turn off warnings: os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" ###Load training data - Put the path to your own data here training_data_path = "/root/trai...
np.sqrt(iRT_raw_var)
numpy.sqrt
# -*- coding: utf-8 -*- """ This module is used for calculations of the orthonormalization matrix for the boundary wavelets. The boundary_wavelets.py package is licensed under the MIT "Expat" license. Copyright (c) 2019: <NAME> and <NAME>. """ # ========================================================================...
np.linalg.cholesky(ML)
numpy.linalg.cholesky
import cvxpy as cp import matplotlib.pyplot as matplt from utils import * from test_ddpg import * from ddpg_alg_spinup import ddpg import tensorflow as tf from env_mra import ResourceEnv import numpy as np import time import pickle import scipy.io from parameters import * from functions import * import multiprocessing ...
np.clip(z - u, Rmin, Rmax)
numpy.clip
import joblib from sklearn.gaussian_process.kernels import Matern, WhiteKernel from utils.bayesian_optimization import Bayesian_Optimization, UtilityFunction from utils.utils import plot_gp, posterior from sklearn.preprocessing import normalize import numpy as np import matplotlib.pyplot as plt plt.rcParams['font.fami...
np.array([res["target"] for res in optimizer_ls[2].res[:4]])
numpy.array
#List of functions : # colorsGraphs(df, feature, genderConfidence = 1, nbToRemove = 1) # text_normalizer(s) # compute_bag_of_words(text) # print_most_frequent(bow, vocab, gender, n=20) # model_test(model,X_train,y_train,X_test,y_test, full_voc, displayResults = True, displayColors = False) # predictors(df,...
np.arange(20)
numpy.arange
""" Created on Mon Jun 24 10:52:25 2019 Reads a wav file with SDR IQ capture of FM stations located in : https://mega.nz/#F!3UUUnSiD!WLhWZ3ff4f4Pi7Ko_zcodQ Also: https://drive.google.com/open?id=1itb_ePcPeDRXrVBIVL-1Y3wrt8yvpW28 Also generates IQ stream sampled at 2.4Msps to simulate a ...
np.zeros(N)
numpy.zeros
# pylint: disable=invalid-name,too-many-lines """Density estimation functions for ArviZ.""" import warnings import numpy as np from scipy.fftpack import fft from scipy.optimize import brentq from scipy.signal import convolve, convolve2d, gaussian # pylint: disable=no-name-in-module from scipy.sparse import coo_matrix...
np.arange(x_min, x_max + width + 1, width)
numpy.arange
# -*- coding: utf-8 -*- """ pmutt.empirical.nasa Operations related to Nasa polynomials """ import inspect from copy import copy from warnings import warn import numpy as np from scipy.optimize import Bounds, LinearConstraint, minimize, minimize_scalar from pmutt import (_apply_numpy_operation, _get_R_adj, _is_iter...
np.array(T)
numpy.array
from recsys.preprocess import * from sklearn import model_selection import numpy as np from recsys.utility import * RANDOM_STATE = 42 np.random.seed(RANDOM_STATE) train = get_train() target_playlist = get_target_playlists() target_tracks = get_target_tracks() # Uncomment if you want to test # train, test, target_pla...
np.array(pred)
numpy.array
""" Mask R-CNN Train on the Paper dataset and implement warp and threshold. ------------------------------------------------------------ Usage: import the module (see Jupyter notebooks for examples), or run from the command line as such: # Train a new model starting from pre-trained COCO weights pytho...
np.concatenate([[0], m, [0]])
numpy.concatenate
""" FuelMap file building tools """ import sys import os from math import pow, sqrt from shutil import copy2 import numpy as np import pkg_resources import yaml from netCDF4 import Dataset import f90nml from .fuels import ( _ROSMODEL_FUELCLASS_REGISTER, _ROSMODEL_NB_PROPERTIES, BalbiFuel, ) from .patch i...
np.intc(4)
numpy.intc
import copy from logging import getLogger from collections import deque import os import gym import numpy as np import cv2 from pfrl.wrappers import ContinuingTimeLimit, RandomizeAction, Monitor from pfrl.wrappers.atari_wrappers import ScaledFloatFrame, LazyFrames cv2.ocl.setUseOpenCL(False) logger = getLogger(__nam...
np.concatenate([obs, inventory_channel], axis=-1)
numpy.concatenate
# DMD algorithms by <NAME>. # # TODO: # - Should we create an ABC interface for DMD? # - __init__.py and separate files # import numpy as np from numpy.linalg import svd, pinv, eig from scipy.linalg import expm from .process import _threshold_svd, dag class DMD: def __init__(self, X2, X1, ts, **kwargs): ...
eig(self.Atilde)
numpy.linalg.eig
# Copyright 2016 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
np.random.RandomState(self.rand_seed)
numpy.random.RandomState
#!/usr/bin/python3 from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import numpy as np import torch from torch.utils.data import Dataset from scipy.sparse import coo_matrix class TrainTestDataset(Dataset): def __init__(self, triples, nre...
np.array(edges_list)
numpy.array
#! /usr/bin/Python from gensim.models.keyedvectors import KeyedVectors from scipy import spatial from numpy import linalg import argparse import sys vector_file = sys.argv[1] if len(sys.argv) != 6: print('arguments wrong!') print(len(sys.argv)) exit() else: words = [sys.argv[2], sys.argv[3], sys.arg...
linalg.norm(w1)
numpy.linalg.norm
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
np.array([image['id']])
numpy.array
""" Copyright 2019 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to i...
np.unique(Y)
numpy.unique
import numpy as np def arrow(headHeight, headRadius, shaftRadius, ns=8): profile = np.array([[0, 0, 0], [0, shaftRadius, 0], [1 - headHeight, shaftRadius, 0], [1 - headHeight, headRadius, 0], [1, 0, 0]], dtype=np.float32) coneNormal = np.array([headRadius, headHeight, 0]) coneNormal /= np.linalg.norm(coneN...
np.zeros_like(angles)
numpy.zeros_like
import numpy as np from baselines.ecbp.agents.buffer.ps_learning_process import PSLearningProcess # from baselines.ecbp.agents.graph.build_graph_mer_attention import * from baselines.ecbp.agents.graph.build_graph_mer_bvae_attention import * import logging from multiprocessing import Pipe import os from baselines.ecbp....
np.isnan(value_tar)
numpy.isnan
''' Climatological mean ''' import sys from glob import glob import h5py import numpy as np import numba as nb import pandas as pd from datetime import datetime, timedelta sys.path.insert(0, '/glade/u/home/ksha/WORKSPACE/utils/') sys.path.insert(0, '/glade/u/home/ksha/WORKSPACE/QC_OBS/') sys.path.insert(0, '/glade/...
np.empty((12, N_grids))
numpy.empty
""" pyart.testing.sample_objects ============================ Functions for creating sample Radar and Grid objects. .. autosummary:: :toctree: generated/ make_empty_ppi_radar make_target_radar make_velocity_aliased_radar make_single_ray_radar make_empty_grid make_target_grid """ import ...
np.zeros((2, 400, 320), dtype='float32')
numpy.zeros
import numpy as np def scan(X,Y): ''' Calculates the solution for the constrained regression called SCAN given in the publication: Maag et al. "SCAN: Multi-Hop Calibration for Mobile Sensor Arrays". In particuluar it solves: min_B trace( (Y-BX)(Y-BX)^T ) subject to BXX^TB^T = YY^T Inputs: ...
np.transpose(Vx)
numpy.transpose
import os, sys import numpy as np import csv,argparse import collections from pyAudioAnalysis import audioSegmentation as aS def read_segmentation_gt(gt_file): """ This function reads a segmentation ground truth file, following a simple CSV format with the following columns: <segment start>,<segment ...
np.array([])
numpy.array
import os import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from torch.utils.data import RandomSampler, BatchSampler from .utils import calculate_accuracy from .trainer import Trainer from .utils import EarlyStopping class CPCTrainer(Trainer): # TODO: Make it work for all modes...
np.mean(step_accuracies[i])
numpy.mean
import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 from pathlib import Path from moviepy.editor import VideoFileClip from line_class import Line def test_functions(path,foo=None,cmap=None): """ Function to test a function (foo) with a folder of imgs (path) All im...
np.zeros_like(img)
numpy.zeros_like
import time as tm import numpy as np from pylab import * def Jacobi(A, b, x, eps=1e-4, xs=None): x = x.copy() cnt = 0 while True: cnt += 1 x_old = x.copy() for i in range(b.shape[0]): x[i] += (b[i] - A[i].dot(x_old)) / A[i, i] if abs(x_old - x).max() < eps: return x, cnt def GS(A, b, x, eps=1e-4, xs...
np.arange(0 + h, 1 + h, h)
numpy.arange