text string |
|---|
<reponame>twinder36/CMS
import numpy as np
import scipy.signal as ssp
from scipy.signal import butter, lfilter, detrend
from ..core import cmslib
def nextpow2(n):
"""
Return the next power of 2 such that 2^p >= n.
:param n: Integer number of samples.
:return: p
"""
if np.any(n < 0):
... |
<reponame>uperetz/AstroTools
from numpy import hstack,pi
from scipy.integrate import trapz
from astropy.io import fits
from glob import glob
kA = 12.3984191
everg = 0.0000000000016022
kpcm = 3.0856776e+21
herg = 6.62607015e-27
evErg = 1.602177e-12
c = 2997924580000000000
def getArray(fname,*recs):
with f... |
<gh_stars>0
# Copyright 2022 The Scenic 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 applicable law or ag... |
<reponame>yarikoptic/dipy
''' FSL IO '''
import os
from os.path import join as pjoin
import numpy as np
import nibabel as nib
import numpy.linalg as npl
from scipy.ndimage import map_coordinates as mc
from numpy import newaxis
from subprocess import Popen,PIPE
_VAL_FMT = ' %e'
def write_bvals_bvecs(bvals, bvecs, o... |
# Implementation of between-class average dist over within-class average dist (ABW, derived by Aupetit)
# For more details on the measure, see <NAME>., <NAME>., & <NAME>. (2012).
# Human cluster evaluation and formal quality measures: A comparative study. In Proceedings of the Annual Meeting of the Cognitive Science S... |
<reponame>TangYiChing/PathDSP
"""
Return
1. Average RMSE, R2, PCC of 10-fold cross validation on test set (outter loop)
2. Average Feature Importance of 5-fold cv hyperparameter optimization on train set (inner loop)
Use Bayesian Optimization to find the best parameters
for xgboost regressor
1. learning_rate: (0.0... |
<gh_stars>0
from data_science_layer.random_distributions.abstractdistribution import AbstractDistribution
from scipy.stats import norm
class NormalDistribution(AbstractDistribution):
"""Class to help with fitting and creating normally distributed random feature examples"""
@classmethod
def generate_rando... |
<gh_stars>10-100
import numpy as np
import os
import os.path as osp
import torch
import torch_geometric
import torch_geometric.utils
from torch_geometric.data import Dataset, Data, Batch
import itertools
from glob import glob
import numba
from numpy.lib.recfunctions import append_fields
import pickle
import scipy
impo... |
<reponame>tozech/properscoring<gh_stars>100-1000
import functools
import unittest
import warnings
import numpy as np
from scipy import stats, special
from numpy.testing import assert_allclose
from properscoring import crps_ensemble, crps_quadrature, crps_gaussian
from properscoring._crps import (_crps_ensemble_vector... |
<reponame>dynaryu/vaws
'''
regress_poly - example of using SciPy polynomal regression technique
'''
from scipy import *
from pylab import *
n = 50
t = linspace(-5, 5, n)
a = -0.5; b = 0; c = 0
x = polyval([a,b,c],t)
xn = x + randn(n)
(ar,br,cr) = polyfit(t, xn, 2)
xr = polyval([ar,br,cr], t)
err = sqrt(sum((xr-x... |
##############################################################################
# Copyright 2017-2018 Rigetti Computing
#
# 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... |
<filename>sntd/mldata.py<gh_stars>0
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Convenience functions for microlensing data."""
from __future__ import division
from collections import OrderedDict
import copy
from scipy.interpolate import interp1d, interp2d
import numpy as np
from astropy.table ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 21 21:13:02 2017
@author: steff
"""
# Imports
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy import constants
import os
from uncertainties import ufloat
from uncertainties import unumpy
#directory t... |
import numpy as np
# import seaborn
from collections import namedtuple
from keras import backend as K
from keras.engine.topology import Layer
from scipy.interpolate import interp1d
## Loss functions
dice_smooth = 1.
def dice_coef(y_true, y_pred):
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
... |
<reponame>babyrobot-eu/core-modules<filename>babyrobot/src/emotion_engagement_recognition/forward_pass.py
#!/usr/bin/env python
import scipy.misc
import numpy as np
import matplotlib.pyplot as plt
from PoseNet3D import *
from utils.Camera import *
# VALUES YOU MIGHT WANT TO CHANGE
OPE_DEPTH = 1 # in [1, 5]; Number o... |
<filename>robocrys/featurize/adapter.py<gh_stars>0
"""
This module implements a class to resolve the symbolic references in condensed
structure data.
"""
import collections
from statistics import mean
from typing import Dict, Any, List, Optional, Union, Set
from robocrys.adapter import BaseAdapter
class FeaturizerAd... |
<filename>riccipy/metrics/datta_1.py<gh_stars>1-10
"""
Name: Datta
References:
- Datta, Nuovo Cim., v36, p109
- Stephani (11.60) p137
Coordinates: Cartesian
Notes: Type 1
"""
from sympy import diag, symbols
coords = symbols("t x y z", real=True)
variables = symbols("a b", constant=True)
functions = ()
t, x, y,... |
import random as r
import math
#import matplotlib.pyplot as plotter
import numpy
import scipy
from scipy import stats
# Rideshare service simulation model that includes rider choice
# Author: <NAME>
# SOURCES AND DERIVATIONS FROM V2:
# In 2019 and 2020, there were 5 million Uber drivers and 18.7 million trips per d... |
<filename>uspy/xps/models.py
"""Models for the peaks."""
# pylint: disable=invalid-name
# pylint: disable=abstract-method
# pylint: disable=too-many-arguments
import numpy as np
import scipy.special as ss
from lmfit.model import Model
from lmfit.models import guess_from_peak, update_param_vals
s2 = np.sqrt(2)
s2pi =... |
"""
This is focused on matching sources in the catalog to those detected in the cubes
"""
import numpy as np
from scipy.interpolate import interp2d, interp1d
import astropy.units as u
from astropy.table import Table, vstack
from astropy.coordinates import SkyCoord, Angle, SkyOffsetFrame, ICRS, Distance
from astropy.... |
<filename>imitator/pose_imitation/data_process/gen_random_traj.py
import os
import pickle
import argparse
from scipy.ndimage.filters import median_filter
# ..mk dir
def mkd(target_dir, get_parent=True):
# get parent path and create
if get_parent:
savedir = os.path.abspath(os.path.join(target... |
<filename>FDE-Tools/FDE.py
import pdb
import numpy as np
import scipy.stats
import scipy.sparse as sp
import scipy.sparse.csgraph as csgraph
from sklearn.model_selection import GridSearchCV
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
import collections
import math
from timeit impor... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 4 22:33:07 2018
@author: bruce
"""
import pandas as pd
import numpy as np
from scipy import fftpack
from scipy import signal
import matplotlib.pyplot as plt
import os
# set saving path
path_result_freq = "/home/bruce/Dropbox/Project/5.Result/5.R... |
<gh_stars>0
'''
Description:
Author: voicebeer
Date: 2020-09-08 07:00:34
LastEditTime: 2020-10-30 06:02:18
'''
# For SEED data loading
import os
import scipy.io as scio
# standard package
import numpy as np
import random
random.seed(0)
import copy
import pickle
# DL
import torch
from torch.utils.data import Dataset... |
import os
from scipy import spatial
import numpy as np
import gensim
import nltk
import sys
from keras.models import load_model
#import theano
#theano.config.optimizer="None"
if(len(sys.argv)!=2):
print("specify path to word2vec.bin folder")
sys.exit()
else:
path = sys.argv[1]
if (path[-1]) != "/":
... |
<filename>examples/newbedford_query.py
#!/usr/env/python
'''
The main file for creating and analyzing JetYak missions.
Maintainer: vpreston-at-{whoi, mit}-dot-edu
'''
import numpy as np
import jetyak
import jviz
import sensors
import shapefile
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
imp... |
<reponame>malsaadan/Sentiment-Analysis-updated
import training_classifier as tcl
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
import os.path
import pickle
from statistics import mode
from nltk.classify import ClassifierI
from nltk.metrics import BigramAssocMeasures
from nltk.collocations im... |
import numpy as np
import cv2
import skimage.io as io
from skimage.color import rgb2gray
from numba import vectorize, cuda
import matplotlib.pyplot as plt
from scipy import ndimage
from skimage.exposure import histogram
from skimage.measure import find_contours
from skimage.transform import rotate
from skimage.filters ... |
<gh_stars>0
from collections.abc import Iterable
from numbers import Integral, Real
import numpy as np
from scipy import sparse
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils import check_array, check_random_state, check_scalar
from sklearn.utils.validation import _num_features, _num_samp... |
#!/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... |
#!/usr/bin/env python
from numpy import *
from numpy import f2py # not part of import *
from scitools.StringFunction import StringFunction
import time, sys, os
# make sys.path so we can find Grid2D.py:
sys.path.insert(0, os.path.join(os.environ['scripting'],
'src','py','examples'))
fro... |
'''
07 - Hyperparameter tuning with RandomizedSearchCV
GridSearchCV can be computationally expensive, especially if you are searching over
a large hyperparameter space and dealing with multiple hyperparameters. A solution to
this is to use RandomizedSearchCV, in which not all hyperparameter values are tri... |
<filename>taskbank/tools/run_multi_img_task.py
from __future__ import absolute_import, division, print_function
import argparse
import importlib
import itertools
import math
import os
import pdb
import pickle
import random
import subprocess
import sys
import threading
import time
from multiprocessing import Pool
impo... |
from flask import make_response
from flask_math.calculation.common.STR import LATEX
from matplotlib.backends.backend_agg import FigureCanvasAgg
import matplotlib.pyplot as plt
from math import degrees
from sympy import *
import numpy as np
from io import BytesIO
def bode(formula, lower_end, upper_end):
s = symbol... |
from __future__ import division, print_function
import sys
import os.path
import itertools as it
# from http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html
from matplotlib.backends import qt_compat
use_pyside = qt_compat.QT_API == qt_compat.QT_API_PYSIDE
if use_pyside:
from PySide import QtGui, Q... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
# GammaEyes
#
# Created at: 2021.07.19
#
# A class for gamma spectrum
import numpy as np
import pywt
from statsmodels.robust import mad
from scipy import signal
import statsmodels.api as sm
class geFSA:
def LLS(self, spec_lib, cont_lib, spec):
pass
... |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue May 24 14:34:58 2016
@author: tvzyl
"""
import samplepoint
import mvn
import balloon
import mlloo
import visualise
import data
import partition
import cluster
import bayesian
import design
from pandas import DataFrame
import numpy as np
from numpy import mean, l... |
<filename>mGST/algorithm.py
import numpy as np
import time
from low_level_jit import *
from additional_fns import *
from optimization import *
from scipy.optimize import minimize
from scipy.optimize import minimize_scalar
from scipy.linalg import eigh
from scipy.linalg import eig
def A_B_SFN(K,A,B,... |
<reponame>KedoKudo/daxm_analyzer
#!/usr/bin/env python
from __future__ import print_function
import h5py
import numpy as np
import sys
from daxmexplorer.vecmath import normalize
from daxmexplorer.cxtallite import OrientationMatrix
class DAXMvoxel(object):
"""
DAXM voxel stores the crystallograhic information ... |
<gh_stars>0
"""
Stores the Image class, and its subclasses.
"""
from typing import List, Tuple
import numpy as np
from PIL import Image as PILImage
import pywt
from scipy.ndimage import uniform_filter, gaussian_filter
from sklearn.cluster import DBSCAN
from .cluster import Cluster
def _wavelet_freqs_below_length_s... |
<filename>pypower/qps_gurobi.py
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Quadratic Program Solver based on Gurobi.
"""
from sys import stderr
from numpy import Inf, ones, zeros, shape, finfo, abs
fro... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec # for unequal plot boxes
import scipy.optimize
# define function to calculate reduced chi-squared
def RedChiSqr(func, x, y, dy, params):
resids = y - func(x, *params)
chisq = ((resids/dy)**2).sum()
return chisq/float... |
# -*- coding: utf-8 -*-
#
# Time-frequency analysis based on a short-time Fourier transform
#
# Builtin/3rd party package imports
import numpy as np
from scipy import signal
# local imports
from .stft import stft
from ._norm_spec import _norm_taper
def mtmconvol(data_arr, samplerate, nperseg, noverlap=None, taper="... |
import math
import pandas as pd
import statistics
languagesAndFrameworks = ['C#', 'Java', 'Python', 'Swift', 'Kotlin', 'JavaScript', 'TypeScript',
'CSS', 'HTML', '.NET Core', '.NET 5', 'Golang', 'PHP', 'C++',
'Angular', 'Ionic', '.NET Framework', 'Spring Framework', 'React',
'Sp... |
import numpy as np
import argparse
from sklearn.cluster import AgglomerativeClustering
from scipy.stats import laplace
from scipy.cluster.hierarchy import dendrogram as set_link_color_palette, dendrogram
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['mathtext.fontset'] = 'cm'
colors = plt.rcPar... |
<gh_stars>1-10
import scanpy as sc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
from scipy.stats import gaussian_kde
from itertools import combinations, compress
from pathlib import Path
from typing import Union
from anndata._core.anndata im... |
<filename>Algorithms/Conditionals/Conditionals_Loops.py<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
def sum_loop(n):
"""Sum all the numbers between 0 and n using a for loop"""
sum = 0
for i in range(n):
if i % 2 == 1:
sum += i
return sum
def sum_range(n):
return sum(... |
<reponame>nicolaschristen/diagnostics_gs2<gh_stars>0
import numpy as np
from scipy.integrate import simps
from numpy import fft
from math import ceil
class timeobj:
def __init__(self, myout, twin):
print()
print('calculating time grid...',end='')
self.time = np.copy(myout['t'])
... |
<gh_stars>0
"""Convenience function to create a context for the built in error functions"""
import logging
import copy
import sympy
from pycalphad import variables as v
from pycalphad.codegen.callables import build_callables
from pycalphad.core.utils import instantiate_models
from espei.error_functions import get_zpf_... |
# run Bayesian ensembles on UCI benchmarks
import numpy as np
from numpy import linalg as LA
import torch
from tqdm import tqdm
from tqdm import trange
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import grad
from torch.autograd import Variable
import pickle
im... |
<filename>main.py
"""
Code modified from PyTorch DCGAN examples: https://github.com/pytorch/examples/tree/master/dcgan
"""
from __future__ import print_function
import argparse
import os
import scipy.io as scio
import numpy as np
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.bac... |
"""
THIS CODE IS UNDER THE BSD 2-Clause LICENSE. YOU CAN FIND THE COMPLETE
FILE AT THE SOURCE DIRECTORY.
Copyright (C) 2017 <NAME> - All rights reserved
@author : <EMAIL>
Publication:
A Novel Unsupervised Analysis of Electrophysiological
Signals Reveals New Sleep Sub-stages in Mice
... |
# coding=utf-8
# pylint:disable=too-many-locals,too-many-branches
"""
Module segmented volume class, to be used for
simulation of 2D segmented maps of a binary volume
"""
import json
import os
import numpy as np
import matplotlib.pyplot as plt
import pycuda.driver as drv
import pycuda.gpuarray as gpua
from pycuda.co... |
try:
import cupy as xp
GPU_AVAILABLE = True
except ImportError:
import numpy as xp
GPU_AVAILABLE = False
if GPU_AVAILABLE:
asnumpy = xp.asnumpy
from cupyx.scipy import fft as xp_fft
from cupyx.scipy import ndimage as xp_ndi
from cupy import linalg as xp_linalg
from cupy import ndarr... |
<reponame>GFleishman/greedypy
import numpy as np
from scipy.ndimage import zoom
import greedypy.metrics as metrics
import greedypy.regularizers as regularizers
import greedypy.transformer as transformer
class greedypy_registration_method:
"""
"""
def __init__(
self,
fixed, fixed_vox,
... |
<reponame>ramirezdiana/Forecast-with-fourier
import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
from scipy import signal
from sklearn.linear_model import LinearRegression
general = pd.read_excel (r'C:\Users\Diana\PAP\Data\Data1.xlsx')
special_days= pd.read_excel ... |
import numpy
import math
import random
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import numpy as np
import os
from scipy import interpolate
class Tour:
def __init__(self, gph):
# variables
self.graph = gph
self.vertexSequence = []
self.edgeSequence = []
... |
#!/usr/bin/env python
import os
import sys
import serial
import math, numpy as np
import roslib; roslib.load_manifest('hrl_fabric_based_tactile_sensor')
import hrl_lib.util as ut
#import hrl_fabric_based_tactile_sensor.adc_publisher_node as apn
import rospy
import matplotlib.pyplot as plt
plt.ion()
import time
from ... |
<filename>geodata/sketch94.py<gh_stars>1-10
#
import geodata as gd
import h5py as h5
from netCDF4 import Dataset
import numpy as np
import pystare as ps
import matplotlib as mpl
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import matplotlib.tri as tri
import cartopy.crs as ccrs
from scipy.stats i... |
import statistics
from math import sqrt, degrees
import pandas as pd
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
datalist = dict()
durationlist = dict()
directlist = dict()
start_velocity=[]
end_velocity=[]
start_velocity_list={}
end_velocity_list={}
start_velocity_label =[]
en... |
<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# $\newcommand{\mb}[1]{\mathbf{ #1 }}$
# $\newcommand{\bs}[1]{\boldsymbol{ #1 }}$
# $\newcommand{\bb}[1]{\mathbb{ #1 }}$
#
# $\newcommand{\R}{\bb{R}}$
#
# $\newcommand{\ip}[2]{\left\langle #1, #2 \right\rangle}$
# $\newcommand{\norm}[1]{\left\Vert #1 \right\Vert}$... |
<reponame>tahleen-rahman/all2friends
# Created by rahman at 14:41 2020-03-09 using PyCharm
import pandas as pd
import traceback, os
from gensim.models import word2vec
from joblib import Parallel, delayed
import numpy as np
import multiprocessing as mp
from scipy.spatial.distance import cosine, euclidean, correlation, c... |
import numpy as np
import scipy.sparse as sp
import torch
import os.path
import subprocess
import time
import sys
import random
# print full size of matrices
np.set_printoptions(threshold=np.inf)
# Print useful messages in different colors
class tcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\... |
<filename>hypothesis_tests.py
"""
This module is for your final hypothesis tests.
Each hypothesis test should tie to a specific analysis question.
Each test should print out the results in a legible sentence
return either "Reject the null hypothesis" or "Fail to reject the null hypothes
is" depending on the specified ... |
# Binomial Dist
#para atma problemi:
# p = olasilik = 0.5
# n = deneyin gerceklestirilme sayisi
# tura = p
# yazi = 1-p
'''para 6 kere atiliyorsa 3 tura cikmasi maksimum olasilik,
1 tura 5 yazi cikmasi minimum olasilik'''
from scipy.stats import binom
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
x... |
from sympy import symbols
import pytest
from qnet.algebra.core.abstract_algebra import substitute
from qnet.algebra.core.exceptions import BasisNotSetError
from qnet.algebra.core.matrix_algebra import Matrix
from qnet.algebra.core.operator_algebra import (
IdentityOperator, II, OperatorSymbol)
from qnet.algebra.li... |
<filename>cronjob/CAD_system.py
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 17 10:55:26 2022
@author: User
"""
import warnings, pdb, os, sys
from dotenv import load_dotenv
load_dotenv('../server/.env')
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarnin... |
# ======================================================================================================================
# KIV auxiliary functions: based on matlab codes of the authors
# https://github.com/r4hu1-5in9h/KIV
# ==============================================================================================... |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 21 13:32:56 2019
@author: Winham
data_preproc.py:用于人工标记后的文件整理
注意:由于下列代码中包含了对文件的删除,因此在原始人工标记后的文件中
仅能运行一次。建议运行前先将原始文件备份!!!若遇到错误可重新恢复并
重新执行。运行前先在同目录下新建一个文件夹119_SEG
"""
import os
import numpy as np
import scipy.io as sio
path = 'G:/ECG_UNet/119_MASK/' ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 27 15:31:24 2019
@author: wolkerst
"""
import matplotlib.pyplot as plt
import numpy as np
import sys
import warnings
import time
import pickle
import os
from scipy.signal import find_peaks, savgol_filter
if not sys.warnoptions:
warnings.simple... |
<reponame>SBC-Collaboration/NREcode<filename>NRE_runMCMC.py
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 10 20:02:18 2020
Code to run MCMC (with fast-burn in) for PICO NR study
parallelization done with python library Multiprocessing
Inputs are (in order):
- directory to find data in
- Period of MCMC run
- epoc... |
import numpy as np
import scipy.sparse
import os
import sys
import emcee
import copy
from astropy.cosmology import Planck15
from .class_utils import *
from .lensing import *
from .utils import *
from .calc_likelihood import calc_vis_lnlike
arcsec2rad = np.pi/180/3600
def LensModelMCMC(data,lens,source,
... |
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import gym
import scipy.signal
import time
def discounted_cumulative_sums(x, discount):
# Discounted cumulative sums of vectors for computing rewards-to-go and adventage estimates
return scipy.signal.... |
#!/usr/bin/env python
# Copyright (c) 2019-2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of co... |
<reponame>raoulbq/WaveBlocksND
"""The WaveBlocks Project
Use a symbolic exact formula for computing the inner product
between two semi-classical wavepackets. The formula is built
for Gaussian integrals and takes into account only the ground
states phi_0 of the 'bra' and the 'ket'.
@author: <NAME>
@copyright: Copyrigh... |
"""
Example call:
python -m padertorch.contrib.examples.wavenet.infer with exp_dir=/path/to/exp_dir
"""
import os
from pathlib import Path
import torch
from padertorch.contrib.examples.wavenet.train import get_datasets, get_model
from sacred import Experiment as Exp
from scipy.io import wavfile
nickname = 'wavenet-i... |
<gh_stars>10-100
import sys, os
import utils,json
import torch.nn as nn
import transform_layers as TL
import torch.nn.functional as F
import torchvision.transforms as tr
from tqdm import tqdm
from sklearn.metrics import roc_auc_score
import model_csi as C
from dataloader_es import *
from parser import *
#for kmeans++ ... |
<reponame>diegomarvid/obligatorio-sistemas-embebidos
# -*- coding: utf-8 -*
import RPi.GPIO as GPIO
import statistics
import math
import socketio
import smtplib
import time
from time import sleep
import datetime
from datetime import datetime
#-----Funcion para inicializar servidor smtp--------#
def init_smtp():
... |
"""
ImageSpace: image matrix, inc dimensions, voxel size, vox2world matrix and
inverse, of an image. Inherits most methods and properties from
regtricks.ImageSpace.
"""
import os.path as op
import copy
import warnings
import nibabel
import numpy as np
from scipy import sparse
from regtricks import ImageSpace as ... |
import numpy as np
import matplotlib.pyplot as plt
import ctypes as ct
#from Spline import Spline
from scipy.interpolate import InterpolatedUnivariateSpline
libspline = ct.CDLL("./libspline.so")
#define some dtypes
c_char_p = ct.c_char_p
c_bool = ct.c_bool
c_int = ct.c_int
c_float = ct.c_float
c_double = ct.c_double... |
import ciclope
import recon_utils as ru
from skimage import measure
from skimage.filters import threshold_otsu, gaussian
import napari
from scipy import ndimage
# resample factor
rf = 4
I = ru.read_tiff_stack('/home/gianthk/Data/TOMCAT/Kaya/D_single_h1h2_scale05/D_single_h1h2_scale050001.tif')
vs = [0.00325, 0.00325,... |
#!/usr/bin/env python
__all__ = ['sron_colors', 'sron_colours', 'sron_maps']
def ylorbr(x):
""" Eq. 1 of sron_colourschemes.pdf """
r = 1.0 - 0.392*(1.0 + erf((x - 0.869)/ 0.255))
g = 1.021 - 0.456*(1.0 + erf((x - 0.527)/ 0.376))
b = 1.0 - 0.493*(1.0 + erf((x - 0.272)/ 0.309))
return r, g, b
def ... |
<gh_stars>0
import numpy as np
from tqdm import trange
import scipy.stats as sps
import matplotlib.pyplot as plt
def MC_dispersion(x, y, xerr, yerr, bins, nsamps, method="std"):
"""
Calculate the dispersion in a set of bins, with Monte Carlo uncertainties.
Args:
x (array): The x-values.
y... |
<reponame>ToFeWe/q-learning-replication-code
"""
A module to calculate results for the section
in which in compare mixed markets.
"""
import json
import pickle
from scipy.stats import mannwhitneyu
from bld.project_paths import project_paths_join as ppj
def calculate_p_values(
super_group_level_data,
... |
<filename>energyPATHWAYS/util.py
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 08 10:12:52 2015
@author: <NAME> & <NAME>
Contains unclassified global functions
"""
import config as cfg
import pint
import pandas as pd
import os
import numpy as np
from time_series import TimeSeries
from collections import defaultdic... |
#!/usr/bin/env python
# Part of the psychopy_ext library
# Copyright 2010-2015 <NAME>
# The program is distributed under the terms of the GNU General Public License,
# either version 3 of the License, or (at your option) any later version.
"""
A library of simple models of vision
Simple usage::
import glob
... |
<reponame>snygt2007/Gita_Insight_Project2019
'''
This library is used to preprocess raw images (resizing, denoising) for semi-supervised learning.
The input for the library is relative path for raw image folder and resized image folder.
Ref : MSCN values are calculated based on https://www.learnopencv.com/image-qualit... |
"""Transformer wrapping utility classes and functions."""
import numpy as np
import pandas as pd
import scipy
from foreshadow.logging import logging
from foreshadow.utils import check_df, is_transformer
def pandas_wrap(transformer): # noqa
"""Wrap a scikit-learn transformer to support pandas DataFrames.
A... |
# @Author: yican, yelanlan
# @Date: 2020-07-07 14:48:03
# @Last Modified by: yican
# @Last Modified time: 2020-07-07 14:48:03
# Standard libraries
import os
import pytorch_lightning as pl
from pytorch_lightning.callbacks import EarlyStopping
# Third party libraries
import torch
from scipy.special import softmax
from... |
<reponame>lace/proximity<filename>proximity/mock_trimesh.py
import numpy as np
from polliwog.tri.functions import surface_normals
from scipy.spatial import cKDTree
from .vendor.triangles import bounds_tree
class MockTrimesh:
def __init__(self, vertices, faces):
self.vertices = vertices
self.faces ... |
"""
Code to study the result of sequence experiments, where a randomly chosen cell is repeateadly activated.
The main function to post-process simulation results is:
compute_sequence_details_batch
"""
import numpy as np
import pandas as pd
import scipy.stats as st
from pathlib import Path
from tqdm.auto import tq... |
#!/usr/bin/env python
r"""
Show numerical precision of $2 J_1(x)/x$.
"""
from __future__ import division, print_function
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import numpy as np
from numpy import pi, inf
import scipy.special
try:
from mpmath import... |
<reponame>teslakit/teslak
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# common
from datetime import datetime
# pip
import numpy as np
import xarray as xr
from scipy import stats
from scipy.spatial import distance_matrix
from sklearn.cluster import KMeans, MiniBatchKMeans
from sklearn import linear_model
def Persi... |
<filename>data/processing/generate_posmap.py<gh_stars>1-10
'''
Generate uv position map of 300W_LP.
'''
import os, sys
import numpy as np
import scipy.io as sio
from skimage import io
import skimage.transform
from time import time
import matplotlib.pyplot as plt
from pathlib import Path
from tqdm import tqdm
import pi... |
import sys
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import matplotlib as mpl
mpl.rcParams.update({ #'figure.figsize': (6.0,4.0),
'figure.facecolor': 'none', #(1,1,1,0), # play nicely with white background in the Qt and notebook
'axes.facecolor': 'none',
... |
<filename>conf_eval/utils.py
import pickle
import contextlib
import io
import os
import sys
import numpy as np
import scipy
import copy
import itertools
import collections
import warnings
import socket
from easydict import EasyDict as ezdict
from .VOC_metrics import VOC_mAP
def defaultdict(__default__, *args, **kwargs... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, print_function, unicode_literals
from __future__ import absolute_import
from pymatgen.analysis.elasticity.tensors import Tensor, \
voigt_map as vmap, TensorCollection
f... |
import pandas as pd
import numpy as np
from scipy import stats
housePrice = pd.read_csv('metroMelbHousePrices.csv',encoding = 'ISO-8859-1')
commute = pd.read_csv('metroMelbCommuteDistance.csv',encoding = 'ISO-8859-1')
df = pd.merge(commute,housePrice)
df = df.iloc[:,[2,3]]
df['zPrice'] = np.abs(stats.zscore(df['medP... |
<reponame>takuya-ki/wrs
import numpy as np
import copy
import math
import cv2
import time
import scipy.signal as ss
class Node(object):
def __init__(self, grid):
"""
:param grid: np.array nrow*ncolumn
author: weiwei
date: 20190828, 20200104
"""
self.grid = copy... |
import pandas as pd
from scipy.stats import pearsonr, spearmanr
from sklearn.base import RegressorMixin
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Ridge
import sources.behav_norms as behav_norms
import sources.cont_indep_models as cont_i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.