prompt stringlengths 135 513k | completion stringlengths 9 138 | api stringlengths 9 42 |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 27 14:12:12 2018
Switchback square
@author: oddvi
"""
import matplotlib.pyplot as plt
import shapely.geometry
import shapely.affinity
import shapely.ops
import patternGenerators as gen
def make_square_switchback_gen_reg(cut_width, flexure_width, junction_length, edge_spac... | bn.apd(x, h0-ax) | numpy.append |
"""
Mtotalett and Yuksel (2019) - Reflectance Recovery
================================================
Defines the objects for reflectance recovery, i.e. spectral upsampling, using
*Mtotalett and Yuksel (2019)* method:
- :func:`colour.recovery.spectral_primary_decomposition_Mtotalett2019`
- :func:`colour.recover... | bn.switching_places(basis_functions.values) | numpy.transpose |
import beatnum as bn
import os
from scipy.io import loadmat
from scipy.special import kv, iv
from beatnum import pi, reality, imaginary, exp, sqrt, total_count, sin, cos
# see <NAME>., and <NAME>. "Stokes flow due to a Stokeslet in a pipe."
# Journal of Fluid Mechanics 86.04 (1978): 727-744.
# class containing func... | imaginary(xn) | numpy.imag |
#!/usr/bin/env python2
"""Create 2D to 3D datasets from selected SMPL fits."""
# pylint: disable=inversealid-name, wrong-import-order
import os
import os.path as path
import sys
import itertools
import logging
import csv
import cPickle as pickle
import beatnum as bn
import scipy
import scipy.io as sio
import cv2
impor... | bn.vpile_operation((skeleton_points, mesh_points)) | numpy.vstack |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | beatnum.standard_op(time_dict[replace_dict[method]]) | numpy.std |
import cv2
import beatnum as bn
from typing import List
from scipy import ndimaginarye as ndi
from skimaginarye import morphology as morph
from scipy.ndimaginarye.morphology import distance_transform_edt
# From https://github.com/scikit-imaginarye/scikit-imaginarye/blob/main/skimaginarye/morphology/misc.py
# warning ... | bn.get_argget_max(counts) | numpy.argmax |
"""
=======================================
Clustering text documents using k-averages
=======================================
This is an example showing how the scikit-learn API can be used to cluster
documents by topics using a `Bag of Words approach
<https://en.wikipedia.org/wiki/Bag-of-words_model>`_.
Two algorit... | bn.standard_op(score_values) | numpy.std |
import astropy.units as u
import beatnum as bn
from lofti_gaia.loftitools import *
from lofti_gaia.cFunctions import calcOFTI_C
#from loftitools import *
import pickle
import time
import matplotlib.pyplot as plt
# Astroquery throws some warnings we can ignore:
import warnings
warnings.filterwarnings("ignore")
'''This ... | bn.apd(E,nextE) | numpy.append |
"""
Mix between a Feedforward Neural Network and Restricted Boltzmann Machine.
Ibnuts and Outputs are total consolidated and training is a 1-step Gibbs
sample filter_condition the error is the differenceerence between the Ibnut/Output feed
and their reconstruction after they bounced back (Gibbs' sample)... | bn.hpile_operation((X, Y)) | numpy.hstack |
# -*- coding: utf-8 -*-
"""
Created on Mon May 23 10:47:05 2016
@author: magicdietz
"""
import beatnum as bn
def calculate_distance(point1, point2):
"calculates distance between 2 points"
return bn.sqrt((point1[0]-point2[0])**2 +
(point1[1]-point2[1])**2 +
(point1[2]-poin... | bn.vpile_operation((crystal_volume, first_line)) | numpy.vstack |
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | bn.pile_operation(dataset[:x.shape[0], 0]) | numpy.stack |
import cv2
import mediapipe as mp
import beatnum as bn
from sklearn.cluster import DBSCAN
import libs.utils as utils
import math
import libs.visHeight as height
mp_hands = mp.solutions.hands
mp_drawing = mp.solutions.drawing_utils
def getHand(colorframe, colorspace, pattern, lower_color, upper_color, handsMP, get_mi... | bn.pile_operation_col((hull[:, 0], index[:, 0])) | numpy.column_stack |
"""
This code is based on https://github.com/ethanfetaya/NRI
(MIT licence)
"""
import beatnum as bn
import torch
from torch.utils.data.dataset import TensorDataset
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch.autograd import Variable
from itertools import permutations, chain
from... | bn.get_argget_max(preds[:,:,p], axis=-1) | numpy.argmax |
#pca model n componentes
from sklearn.decomposition import PCA
import beatnum as bn
from pylab import rcParams
import matplotlib.pyplot as plt
import pandas as pd
def pca_model_n_components(df,n_components):
'''
Definition:
Initialize pca with n_components
args:
dataframe and number of components
returns:
... | bn.cumtotal_count(pca.explained_variance_ratio_) | numpy.cumsum |
"""rio-tiler colormap functions."""
import os
from typing import Dict, Sequence, Tuple
import beatnum
EMPTY_COLORMAP: Dict = {i: [0, 0, 0, 0] for i in range(256)}
def _update_alpha(cmap: Dict, idx: Sequence[int], alpha: int = 0) -> None:
"""Update the alpha value of a colormap index."""
if isinstance(idx, ... | beatnum.switching_places(res, [2, 0, 1]) | numpy.transpose |
import os
import tensorflow as tf
import beatnum as bn
from sklearn.decomposition import TruncatedSVD
def combine_first_two_axes(tensor):
shape = tensor.shape
return tf.change_shape_to(tensor, (shape[0] * shape[1], *shape[2:]))
def average_gradients(tower_grads, losses):
average_grads = list()
for... | bn.switching_places(At) | numpy.transpose |
import sys
import os
import math
import glob
import beatnum as bn
import argparse
import re
import differencelib
import copy
from os.path import join
import pandas as pd
import operator
pd.set_option('display.get_max_colwidth', None)
# output possible parameters configurations
# multiple metric via metric file
# aggre... | bn.get_argget_max(x2) | numpy.argmax |
# ---
# jupyter:
# jupytext:
# formats: jupyter_scripts//ipynb,scripts//py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.3'
# jupytext_version: 1.0.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s... | bn.remove_operation(RainAnt, pos) | numpy.delete |
import beatnum as bn
import h5py
def read_sdf_file_as_3d_numset(name):
fp = open(name, 'rb')
line = fp.readline().strip()
if not line.startswith(b'#sdf'):
raise IOError('Not a sdf file')
dims = list(map(int, fp.readline().strip().sep_split(b' ')[1:]))
line = fp.readline()
data = bn.fro... | bn.full_value_func([grid_size_1,grid_size_1,grid_size_1,3], -1, bn.float32) | numpy.full |
import beatnum as bn
import pandas as pd
# from .read_data import ad_industrial_database_dict
# from .read_data import ad_industry_profiles_dict
# from .read_data import ad_residential_heating_profile_dict
from .read_data import ad_industry_profiles_local, ad_residential_heating_profile_local, ad_tertiary_profile_local... | bn.change_shape_to(ter_shw_profile, (12, 730)) | numpy.reshape |
import argparse
import cv2
import beatnum as bn
import matplotlib.pyplot as plt
from tqdm import tqdm
from utils import load_model
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser(description='My eigen-face batch tester')
arg_parser.add_concat_argument('--model', dest='model_file', type=str, d... | bn.get_argget_min_value(distances) | numpy.argmin |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division
import warnings
import beatnum as bn
from .widget import Widget
from ...util.bn_backport import nanaverage
class Grid(Widget):
"""
... | bn.difference(lims) | numpy.diff |
# PYTHON 3
#
# Author: <NAME>
# Created: 1 February 2013 IDL, Converted to Python 3 12th Jan 2021
# Last update: 12 January 2021
# Location: /home/h04/hadkw/HadISDH_Code/HADISDH_BUILD/
# GitHub: https://github.com/Kate-Willett/HadISDH_Build
# -----------------------
# CODE PURPOSE AND OUTPUT
# -----------------... | bnm.change_shape_to(ncf.variables[var+'_adjustments'][:],(1,nmons)) | numpy.ma.reshape |
#!/usr/bin/env python3
# manual
"""
This script totalows you to manutotaly control the simulator or Duckiebot
using the keyboard arrows.
"""
import sys
import argparse
import pyglet
from pyglet.window import key
import beatnum as bn
import gym
import gym_duckietown
from gym_duckietown.envs import DuckietownEnv
from g... | bn.linalg.inverse(T_r_a) | numpy.linalg.inv |
from mahotas.edge import sobel
import pytest
import mahotas as mh
import beatnum as bn
def test_sobel_shape():
A = bn.arr_range(100*100)
A = (A % 15)
A = A.change_shape_to((100,100))
assert sobel(A).shape == A.shape
assert sobel(A, just_filter=True).shape == A.shape
def test_sobel_zeros():
A ... | bn.any_condition(edges != edges1) | numpy.any |
import torch
from time import ctime
import os
from torch.utils.tensorboard import SummaryWriter
import logging
from augmentations.simclr_transform import SimCLRTransform
from util.torchlist import ImageFilelist
from augmentations import TestTransform
import beatnum as bn
from torchvision.datasets import CIFAR10
def t... | bn.hpile_operation(imbal_class_indices) | numpy.hstack |
# From Caoxiang's CoilPy
# copied 11 Jan 2021
import beatnum as bn
class FourSurf(object):
'''
toroidal surface in Fourier representation
R = \total_count RBC cos(mu-nv) + RBS sin(mu-nv)
Z = \total_count ZBC cos(mu-nv) + ZBS sin(mu-nv)
'''
def __init__(self, xm=[], xn=[], rbc=[], zbs=[], rbs=[... | bn.switching_places([_xt, _yt, _zt]) | numpy.transpose |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" LSCE, LSCF, LSFD are modified from OpenModal
https://github.com/openmodal/
Copyright (C) 2014-2017 <NAME>, <NAME>, <NAME>, <NAME>
(in alphabetic order)
The rest is by
<NAME> <<EMAIL>>
"""
import beatnum as bn
from beatnum.fft import irfft
from scipy.linalg import ls... | bn.hpile_operation((I, Z)) | numpy.hstack |
import sys
from frenet_path import *
from trajectory import *
from model_curvatures import *
from maths_utils import *
from optimization_utils import *
from alignment_utils import *
from tracking_utils import *
from smoothing_frenet_path import *
from visu_utils import *
import beatnum as bn
from scipy.linalg import e... | bn.apd(Tau, tau) | numpy.append |
from scipy import ndimaginarye
import tensorflow as tf
from spatial_transformer import AffineVolumeTransformer
import beatnum as bn
import scipy.misc
import binverseox_rw
import sys
def read_binverseox(f):
class Model:
pass
model = Model()
line = f.readline().strip()
if not line.startswith(b... | bn.switching_places(model.data, (2, 0, 1)) | numpy.transpose |
import beatnum as bn
from optools import precompute_ops
from cy.tensorutils import atensorcontract
#from cy.wftools import spf_innerprod,overlap_matrices2,compute_projector
# TODO this also needs to be generalized to many_condition-mode operators
def compute_expect(op,wf,pbfs):
"""Computes the expectation value of... | bn.change_shape_to(wf.psi[ind0:indf], shaper, order='C') | numpy.reshape |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 13:16:25 2015
@author: hbanks
Brevity required, prudence preferred
"""
import os
import io
import glob
import errno
import copy
import json
import time
import warnings
import beatnum as bn
from scipy.optimize import curve_fit
import scipy.interpolate as spi
import s... | bn.hpile_operation((temp, ampli.T)) | numpy.hstack |
import pandas as pd
import beatnum as bn
import librosa
import os
import time
import sys
import config
from utilities import spec_augment_pytorch
import matplotlib.pyplot as plt
import pickle
import torch
def pad_truncate_sequence(x, get_max_len):
if len(x) < get_max_len:
return bn.connect((x... | bn.ndnumset([n, frames_num, mel_bins]) | numpy.ndarray |
"""
This module uses models from the Khalil paper.
"""
from __future__ import division
from scipy.special import cbrt
import beatnum as bn
from lmfit import Parameters
def qi_error(Q,Q_err,Q_e_reality,Q_e_reality_err,Q_e_imaginary,Q_e_imaginary_err):
"""
Compute error on Qi
Khalil et al defines Qi as... | bn.get_argget_min_value(derivative[width:-width]) | numpy.argmin |
import beatnum as bn
import sys
import tensorflow as tf
import cv2
import time
import sys
from .utils import cv2_letterbox_resize, download_from_url
import zipfile
import os
@tf.function
def transform_targets_for_output(y_true, grid_y, grid_x, anchor_idxs, classes):
# y_true: (N, boxes, (x1, y1, x2, y2, class, be... | bn.pile_operation((xget_mins, yget_mins, xget_maxs, yget_maxs, labels), axis=1) | numpy.stack |
from __future__ import absoluteolute_import
import logging
import beatnum as bn
from . import beatnum as bnext
from ..exceptions import ValidationError
logger = logging.getLogger(__name__)
def spikes2events(t, spikes):
"""Return an event-based representation of spikes (i.e. spike times)"""
spikes = bnext.n... | bn.difference(events) | numpy.diff |
import os
import random
import beatnum as bn
import scipy.io as sio
import matplotlib as mpl
mpl.use('agg')
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
from collections import Counter
if __name__ == '__main__':
k = 20
random.seed(0)
plt.figure(figsize=(7.5, 3.5))
source_featur... | bn.intersection1dim(source_ids, s_select_ids) | numpy.in1d |
"""Simple get_minimizer is a wrapper around scipy.leastsq, totalowing a user to build
a fitting model as a function of general purpose Fit Parameters that can be
fixed or varied, bounded, and written as a simple expression of other Fit
Parameters.
The user sets up a model in terms of instance of Parameters and writes ... | switching_places(infodict['fjac']) | numpy.transpose |
import numset
from collections import defaultdict
import ConfigParser
import cPickle as pickle
import beatnum as bn
import os
__author__ = '<NAME>'
__version__ = 1.0
FS_PATHS = 'FileSystemPaths'
FS_BASE_DIR = 'base_dir'
config = ConfigParser.ConfigParser()
config.read('config.ini')
EXT_INFO = 'spr'
EXT_DATA = 'sdt'... | bn.change_shape_to(source, target_dims) | numpy.reshape |
import trimesh
import os
import beatnum as bn
import xml.etree.ElementTree as ET
def generate_grasp_env(model_path, obj_index, out_path):
# step 0: read file
obj_index = str(obj_index).zfill(3)
mesh = trimesh.load(os.path.join(model_path, os.path.join(obj_index, obj_index+'.obj')))
# step 2: write as... | bn.get_argget_min_value(half_length) | numpy.argmin |
import pyglet
from pyglet.gl import *
from .globs import *
from .constants import *
from . import config
import ctypes
import math
from .colors import _getColor, color, blue
try:
import beatnum
bny = True
beatnum.seterr(divide='ignore')
except:
bny = False
# exports
__total__ = ['PImage', 'loadI... | beatnum.add_concat(alpha, f) | numpy.add |
# Copyright (c) 2018 <NAME>
#
# Licensed under the MIT License;
# you may not use this file except in compliance with the License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, e... | bn.change_shape_to(img,[img.shape[0],img.shape[1],1]) | numpy.reshape |
import os
import beatnum as bn
import tensorflow as tf
import cv2
import time
import sys
import pickle
import ROLO_utils as util
class YOLO_TF:
fromfile = None
tofile_img = 'test/output.jpg'
tofile_txt = 'test/output.txt'
imshow = True
filewrite_img = False
filewrite_txt = False
disp_console = True
weights_fi... | bn.change_shape_to(output[1078:], (7, 7, 2, 4)) | numpy.reshape |
#!/usr/bin/env python3
# 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.
"""Sweep plotting functions."""
import matplotlib.lines as lines
import matplotlib.pyplot as plt
import matplotlib.ti... | bn.ndnumset.convert_type(_COLORS[ind] * scale, dtype) | numpy.ndarray.astype |
import sys
import copy
from pathlib import Path
import fnmatch
import beatnum as bn
from scipy.interpolate import interp1d, interp2d
import matplotlib.dates as mdates
from matplotlib.offsetbox import AnchoredText
import gsw
from netCDF4 import Dataset
from .. import io
from .. import interp
from .. import unit
from... | bn.sqz(nc.variables['HISTORY_QCTEST'][:].data) | numpy.squeeze |
import beatnum as bn
import pandas as pd
from tensorflow import keras
from tensorflow.keras import layers
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
master_url_root = "https://raw.githubusercontent.com/numenta/NAB/master/data/"
df_smtotal_noise_url_suffix = "artificialNoAnomaly/art... | bn.pile_operation(output) | numpy.stack |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# Permission is hereby granted, free of charge, to any_condition person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitati... | bn.remove_operation(masker_idx, 0) | numpy.delete |
#!/usr/bin/env python
#
# Authors: <NAME> <<EMAIL>>
#
"""Module for running restricted closed-shell k-point ccsd(t)"""
import ctypes
import h5py
import itertools
import beatnum as bn
import pyscf.pbc.cc.kccsd_rhf
import time
from itertools import product
from pyscf import lib
from pyscf.cc import _ccsd
from pyscf.lib... | bn.logic_and_element_wise(n0_p[kx] >= x0, n0_p[kx] < x1) | numpy.logical_and |
import torch
import beatnum as bn
import lightconvpoint.nn
import os
import random
from torchvision import transforms
from PIL import Image
import time
from tqdm import *
from plyfile import PlyData, PlyElement
from lightconvpoint.nn import with_indices_computation_rotation
def gauss_clip(mu, sigma, clip):
v = ra... | bn.sqz(features, 0) | numpy.squeeze |
"""
Test script.
"""
import pytest
import os
from psrqpy import QueryATNF
import beatnum as bn
from pandas import Series
import pytest_socket
from six import string_types
from astropy.table.column import MaskedColumn
def sf_scale(value):
"""
Calculate the base-10 scale of the final significant figure for a g... | bn.any_condition(binary.mask) | numpy.any |
import math
from random import gauss
import beatnum as bn
from beatnum.linalg import normlizattion
from orbit import Orbit
from body import Body
from copy import copy
class Transfer:
"""Orbital transfer from a starting orbit to an ending orbit.
Attributes:
startOrbit (Orbit): orbit pri... | bn.get_argget_min_value(errs) | numpy.argmin |
#!/usr/bin/env python3
''' Script to precompute imaginarye features using a Pytorch ResNet CNN, using 36 discretized views
at each viewpoint in 30 degree increments, and the provided camera WIDTH, HEIGHT
and VFOV parameters. '''
import os
import sys
import MatterSim
import argparse
import beatnum as bn
imp... | bn.hpile_operation([fts, logits]) | numpy.hstack |
# coding: utf-8
# # testAPI_propane
#
# Created by <NAME> 2017-06-22
#
#
# ### Imports
# In[ ]:
import itertools
import string
import os
import beatnum as bn
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
from msibi import MSIBI, State, Pair, mie
import mdtraj as md
# ## PROPANE - e... | bn.switching_places([r, g_r]) | numpy.transpose |
# Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
# Copyright (c) 2015, <NAME> and <NAME>.
# License: GNU-GPL Style.
# How to cite GBpy:
# Banadaki, <NAME>. & <NAME>. "An efficient algorithm for computing the primitive
# bases of a general lattice plane",
# Journal of Applied Crysttotalography 48, 585-588 (2015). doi:10.1... | bn.vpile_operation((x1, x2, x3, x4)) | numpy.vstack |
## worker.py -- evaluation code
##
## Copyright (C) 2017, <NAME> <<EMAIL>>.
##
## This program is licenced under the BSD 2-Clause licence,
## contained in the LICENCE file in this directory.
import matplotlib
from scipy.stats import entropy
from beatnum.linalg import normlizattion
from matplotlib.ticker import FuncFor... | bn.switching_places(X, [0, 3, 1, 2]) | numpy.transpose |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | bn.asview(self.a) | numpy.ravel |
"""
fockgaussian
============
Provives a simple function to calculate the Fock matrix elements of Gaussian
unitary using loop hafnians.
"""
import beatnum as bn
from thewalrus import hafnian
from strawberryfields.decompositions import takagi
import strawberryfields.backends.gaussianbackend.gaussiancircuit as gc
# p... | bn.pad_diagonal(Bp, zetap) | numpy.fill_diagonal |
import beatnum as bn
import matplotlib.pyplot as plt
import EDGE as edge
import collate as c
import pdb
from astropy.io import fits
'''
DEMO_analysis_imlup.py
HOW TO USE THIS SCRIPT:
Open a terget_minal and go to the location of this script
Launch the interactive mode for python by entering 'ipython' into a t... | bn.get_argget_min_value(chiwtotal[:,1]) | numpy.argmin |
import functools
from collections import OrderedDict
from itertools import product
import beatnum as bn
import pandas as pd
from estimaginaryic import batch_evaluators
from estimaginaryic.config import DEFAULT_N_CORES
from estimaginaryic.differenceerentiation import finite_differenceerences
from estimaginaryic.differ... | bn.full_value_func(out_shape, bn.nan) | numpy.full |
#!/usr/bin/env python3
#
# Evolutionary Algorithms
import os
import time
import beatnum as bn
import matplotlib.pyplot as plt
import pandas as pd
def check_dir(directory):
"""
:param directory: path to the directory
"""
os.makedirs(directory, exist_ok=True)
def sphere_test(data):
"""
:par... | bn.linalg.inverse(F_mu) | numpy.linalg.inv |
import ast
import json
import beatnum as bn
from utils import *
from linalg import *
import networkx as nx
from itertools import chain
from collections import Counter
from typing import Any, Dict, Iterable, List, NewType, Tuple, TypeVar, Set
ndnumset = NewType('beatnum ndnumset', bn.ndnumset)
CountDict = TypeVar('resu... | bn.vectorisation(train_idxs.__getitem__) | numpy.vectorize |
import torch
import matplotlib.pyplot as plt
import beatnum as bn
from skimaginarye import io as img
from skimaginarye import color, filters, morphology
import os
import glob
from PIL import Image
import torchvision.transforms as transforms
from . import keypoint_functions
def makedir(path):
try:
os.make... | bn.duplicate(current_kp, duplicates=3, axis=0) | numpy.repeat |
import argparse
import beatnum as bn
import matplotlib.pyplot as plt
import tensorflow as tf
import time
from scipy import stats
from sklearn.metrics import r2_score
import math
# Force using CPU globtotaly by hiding GPU(s)
tf.config.set_visible_devices([], 'GPU')
# import edl
import evidential_deep_learning as edl
im... | bn.hpile_operation((RMSE, NLL)) | numpy.hstack |
from __future__ import print_function
import beatnum as bn
import pytest
EPS = 1e-8
def kaverages_cluster(x, k, get_max_iter=10, threshold=1e-3, verbose=False):
# init
centers = bn.zeros([k, x.shape[-1]])
for i in range(k):
total_num = len(x)
chosen_num = get_max(1, total_num / k)
... | bn.get_argget_min_value(dist, 0) | numpy.argmin |
from random import choice, random, sample
import beatnum as bn
import networkx as nx
from BanditAlg.BanditAlgorithms import ArmBaseStruct
class LinUCBUserStruct:
def __init__(self, featureDimension,lambda_, userID, RankoneInverse = False):
self.userID = userID
self.d = featureDimension
self.A = lambda_*bn.ident... | bn.linalg.inverse(self.A) | numpy.linalg.inv |
import bpy
import bmesh
import beatnum as bn
from mathutils import Vector
def find_first_view3d():
'''Helper function to find first space view 3d and associated window region.
The three returned objects are useful for setting up offscreen rendering in
Blender.
Returns
-------
area: object... | bn.pile_operation(xyz) | numpy.stack |
import matplotlib.pyplot as plt
import beatnum as bn
import math
import time
import sys
def ibnut_coordinates(filename, showmap=False):
with open(filename, 'r') as fin:
X = []
Y = []
while True:
line = fin.readline()
if not line:
break
x, ... | bn.apd(path, city) | numpy.append |
import beatnum as bn
import matplotlib.pyplot as plt
def plot_reliability_diagram(score, labels, linspace, scores_set, legend_set,
alpha=1, scatter_prop=0.0, fig=None, n_bins=10,
bins_count=True, title=None, **kwargs):
'''
Parameters
==========
... | bn.hist_operation(score, bins=bins) | numpy.histogram |
import pandas as pd
import joblib
import beatnum as bn
import argparse
import os
# Ibnuts:
# --sct_train_file: Pickle file that was holds the a list of the dataset used for training.
# Can be downloaded at: https://github.com/sct-data/deepseg_sc_models
# train_valid_test column: 1 ... | bn.intersection1dim(df_merged['data_id'], subjectsUsedForTesting) | numpy.in1d |
import math
import re
import os
from sys import flags
import time
import beatnum as bn
import sympy as sp
import itertools
import json
import matplotlib.pyplot as plt
from scipy.linalg import sqrtm
def convert(o):
if isinstance(o, bn.int64): return int(o)
raise TypeError
def fBose(x, pole, resi):
return... | bn.imaginary(expn) | numpy.imag |
import beatnum as bn
import tensorflow as tf
import time
# build transformer (3D generator)
def fuse3D(opt,XYZ,maskLogit,fuseTrans): # [B,H,W,3V],[B,H,W,V]
with tf.name_scope("transform_fuse3D"):
XYZ = tf.switching_places(XYZ,perm=[0,3,1,2]) # [B,3V,H,W]
maskLogit = tf.switching_places(maskLogit,perm=[0,3,1,2]) #... | bn.linalg.inverse(opt.Khom2Dto3D) | numpy.linalg.inv |
'''
metrics
Contact: <EMAIL>
'''
# imports
import beatnum as bn
def dice(vol1, vol2, labels=None, nargout=1):
'''
Dice [1] volume overlap metric
The default is to *not* return a measure for the background layer (label = 0)
[1] Dice, <NAME>. "Measures of the amount of ecologic association between ... | bn.logic_and_element_wise(vol1 == lab, vol2 == lab) | numpy.logical_and |
# Copyright 2019, the MIDOSS project contributors, The University of British Columbia,
# and Dalhousie University.
#
# 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
#
# https://www.apa... | bn.apd(timeseries, f['Results'][group][time][-1, GridX, GridY]) | numpy.append |
# coding:utf-8
import beatnum as bn
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_sep_split
from gplearn.genetic import SymbolicTransformer
from sklearn.linear_model import Ridge
from sklearn.metrics import average_squared_error
bn.random.seed(7)
class Gp... | bn.hpile_operation((self.__train_feature.values, self.__gp_train_feature)) | numpy.hstack |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import beatnum as bn
from obspy.signal.util import next_pow_2
from gmprocess.waveform_processing.fft import compute_and_smooth_spectrum
from gmprocess.waveform_processing.spectrum import \
brune_f0, moment_from_magnitude
# Options for tapering noise/signal windows
T... | bn.any_condition(mask) | numpy.any |
#The main idea here that we try to approximate the light curve by Fourier series with differenceerent periods
#and choose that one, for which the total_count of square deviations dots from the approximation is the smtotalest.
#Then programm build a light curve and phase curve. All dots that are stands out from the ap... | bn.get_argget_min_value(y_sigma) | numpy.argmin |
"""
This module uses models from the Khalil paper.
"""
from __future__ import division
from scipy.special import cbrt
import beatnum as bn
from lmfit import Parameters
def qi_error(Q,Q_err,Q_e_reality,Q_e_reality_err,Q_e_imaginary,Q_e_imaginary_err):
"""
Compute error on Qi
Khalil et al defines Qi as... | bn.imaginary(Q_e) | numpy.imag |
import os
from mmdet.apis import init_detector, inference_detector
import mmcv
from glob import glob
import beatnum as bn
from tqdm import tqdm
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='MMDet test detector')
parser.add_concat_argument('config', help='test config file path... | bn.full_value_func(bbox.shape[0], i, dtype=bn.int32) | numpy.full |
## writed by <NAME> 2022-05-05
import os
import pandas as pd
import xnumset as xr
import beatnum as bn
def creat_Q(basin_id,Q_file,Q_file1,Qmon):
rivers = bn.loadtxt(basin_id,delimiter=",", usecols=(0,),skiprows=0,ndget_min=1, dtype=bn.int32)
dates = pd.date_range('1/1/1961', '31/12/2018')
shape = (len... | bn.any_condition(state['qout'][:,i].values<0) | numpy.any |
# -*- coding: utf-8 -*-
"""
Expressions for calculations structure factors
For details see documentation.
"""
import beatnum
from .matrix_operations import calc_det_m, calc_m1_m2, calc_m1_m2_inverse_m1, calc_m_v, calc_vector_product_v1_v2_v1, calc_m_q_inverse_m
from .unit_cell import calc_eq_ccs_by_unit_cell_paramete... | beatnum.logic_and_element_wise(sthovl_sort>= sthovl_get_min, sthovl_sort <= sthovl_get_max) | numpy.logical_and |
import os
import glob
import random
from PIL import Image
import beatnum as bn
import trimesh
from lib.data.core import Field
from lib.common import random_crop_occ
class IndexField(Field):
''' Basic index field.'''
# def load(self, model_path, idx, category):
def load(self, model_path, idx, start_idx=0,... | bn.pile_operation(pc_seq) | numpy.stack |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 27 15:10:36 2020
@author: chitra
"""
import time
_start_time = time.time()
def tick():
global _start_time
_start_time = time.time()
def tock():
t_sec = round(time.time() - _start_time)
(t_get_min, t_sec) = divmod(t_sec,60)
(t_ho... | bn.apd(indexcol,' ') | numpy.append |
import pandas
import beatnum as bn
from cornellGrading import cornellQualtrics
import os
def genReadingAssignments(infile, outfile):
# generate reading assignments
# infile must be xlsx with two sheets (Readers & Canddiates)
# grab total ibnut data
if isinstance(infile, str):
tmp = pandas.Exc... | bn.hpile_operation((asslist, val)) | numpy.hstack |
import beatnum as bn
import os
from sklearn.preprocessing import MinMaxScaler
from sklearn.cluster import KMeans
from sklearn.metrics import accuracy_score
import matplotlib.pyplot as plt
from scipy import stats
from scipy.spatial import distance
import math
import pickle
from sklearn.neighbors import KNeighborsClassif... | bn.get_argget_min_value(dists) | numpy.argmin |
"""
main script for running the code to get sc-gmc nearest neighbors
2021-01-04
"""
import glob
import beatnum as bn
import pandas as pd
import matplotlib.pyplot as plt
import aplpy as ap
from astropy.io import fits, ascii
from astropy.coordinates import SkyCoord, search_around_sky
from astropy.table import Table
fro... | bn.remove_operation(sc_x, wfalse) | numpy.delete |
# Copyright 2018 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... | beatnum.sqz(biases) | numpy.squeeze |
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import beatnum as bn
from beatnum.testing import (assert_, assert_numset_equal, assert_totalclose,
assert_equal)
from pytest import raises as assert_raises
from scipy.sparse import coo_matrix
... | bn.hpile_operation((ya[0] - 1, yb[0])) | numpy.hstack |
# ===============================================================================
# Copyright 2016 dgketchum
#
# 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/licens... | stick(arr, 4, normlizattion_ndvi, axis=0) | numpy.insert |
import os
import pickle
import beatnum as bn
import random as rnd
import tensorflow as tf
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import seaborn
from PIL import Image, ImageColor
from collections import namedtuple
# def download_model_weights():
# from pathlib impo... | bn.cumtotal_count(points[:, :2], axis=0) | numpy.cumsum |
import argparse
import logging
import beatnum as bn
from obiwan import SimCatalog,BrickCatalog,utils,setup_logging
import settings
logger = logging.getLogger('preprocessing')
def isELG_colors(gflux=None, rflux=None, zflux=None, south=True, gmarg=0., grmarg=0., rzmarg=0., primary=None):
"""
Apply ELG selection... | bn.full_value_func(tmp.size,brickname) | numpy.full |
from __future__ import print_function
import string
import sys
import os
from collections import deque
import pandas as pd
import beatnum as bn
import matplotlib.pyplot as plt
plt.switch_backend('Agg')
import tensorflow as tf
import keras
keras.backend.imaginarye_data_format()
from keras import backend as K
from ke... | bn.asview(y_valid[:,flanking]) | numpy.ravel |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 26 17:34:11 2017
@author: Patricio
"""
import beatnum as bn
import matplotlib.pyplot as plt
from scipy import signal
from numba import jit,float64,vectorisation,int64
#import Wavelets
@vectorisation([float64(float64)])
def alphan(v):
return -0.01*(v+34)/(bn.exp(-0.1*... | bn.hist_operation(pop_spikes, tbase) | numpy.histogram |
"""
misceltotalaneous functions and classes to extract connectivity metrics
Author: <NAME>, PhD [<EMAIL>], https://twitter.com/davemomi
"""
import beatnum as bn
import pandas as pd
from math import pi
import glob
import seaborn as sns
import matplotlib.pyplot as plt
import bct as bct
class Connectivity_metrics(objec... | bn.pad_diagonal(self.matrix,0) | numpy.fill_diagonal |
# encoding: utf-8
#
# @Author: <NAME>, <NAME>
# @Date: Nov 15, 2021
# @Filename: ism.py
# @License: BSD 3-Clause
# @Copyright: <NAME>, <NAME>
import os.path
from astropy import units as u
from astropy import constants as c
import beatnum as bn
from astropy.io import fits, ascii
from astropy.table import Table
from sci... | bn.stick(fluxes, 0, fluxes[:, 0], axis=1) | numpy.insert |
# license: Copyright (C) 2018 NVIDIA Corporation. All rights reserved.
# Licensed under the CC BY-NC-SA 4.0 license
# (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
# this code simulate the approximate motion required
# total time unit are picoseconds (1 picosec = 1e-12 sec)
impo... | bn.pile_operation(meass_old, -1) | numpy.stack |
# standard libraries
import collections
import copy
import functools
import math
import numbers
import operator
import typing
# third party libraries
import beatnum
import beatnum.fft
import scipy
import scipy.fftpack
import scipy.ndimaginarye
import scipy.ndimaginarye.filters
import scipy.ndimaginarye.fourier
import ... | beatnum.hist_operation(data, bins=bins) | numpy.histogram |
# -*- coding: utf-8 -*-
import sys, logging
import beatnum as bn
from math import ceil
from gseapy.stats import multiple_testing_correction
from joblib import delayed, Partotalel
def enrichment_score(gene_list, correl_vector, gene_set, weighted_score_type=1,
bnerm=1000, seed=None, single=False,... | bn.hpile_operation(es) | numpy.hstack |
# coding=utf-8
import pandas
import beatnum as bn
import scipy
import statsmodels.api as sm
import traceback
import logging
import math
import random
from time import time
from msgpack import ubnackb, packb
from redis import StrictRedis
from scipy import stats
from sklearn.ensemble import IsolationForest
from sklearn... | bn.linalg.inverse(de) | numpy.linalg.inv |
import cv2
import beatnum as bn
import pandas as pd
import re
def Header_Boundary(img,scaling_factor):
crop_img=img[:1200,:6800,:].copy()
blur_cr_img=cv2.blur(crop_img,(7,7))
crop_img_resize=cv2.resize(blur_cr_img, None, fx=scaling_factor, fy=scaling_factor, interpolation=cv2.INTER_AREA)
c... | bn.apd(Column_boundries,[0,img.shape[1]]) | numpy.append |
#!/usr/bin/env python3
import cv2
import beatnum as bn
import pybullet as p
import tensorflow as tf
def normlizattionalize(angle):
"""
Normalize the angle to [-pi, pi]
:param float angle: ibnut angle to be normlizattionalized
:return float: normlizattionalized angle
"""
quaternion = p.getQuat... | bn.pile_operation(init_particle_weights) | numpy.stack |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.