forked from IPKM/nmreval
parent
d83e112515
commit
38a44047de
@ -29,10 +29,10 @@ jobs:
|
||||
env:
|
||||
GPG_KEYGRIP: ${{ vars.GPG_KEYGRIP }}
|
||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
||||
GO_PIPELINE_LABEL: ${{ env.YEAR }}.${{ gitea.run_number }}_${{ env.SHA_SHORT }}_bookworm
|
||||
GO_PIPELINE_LABEL: ${{ env.YEAR }}.${{ gitea.run_number }}_${{ env.SHA_SHORT }}
|
||||
- name: Upload AppImage
|
||||
run: ./tools/upload_gitea.sh
|
||||
env:
|
||||
GO_PIPELINE_LABEL: ${{ env.YEAR }}.${{ gitea.run_number }}_${{ env.SHA_SHORT }}_bookworm
|
||||
GO_PIPELINE_LABEL: ${{ env.YEAR }}.${{ gitea.run_number }}_${{ env.SHA_SHORT }}
|
||||
UPLOAD_TOKEN: ${{ secrets.UPLOAD_TOKEN }}
|
||||
UPLOAD_USER: ${{ vars.UPLOAD_USER }}
|
||||
|
@ -3,14 +3,21 @@ import numpy.polynomial.polynomial as poly
|
||||
from scipy import signal as signal
|
||||
|
||||
|
||||
__all__ = ['smooth', 'loess', 'savgol',
|
||||
'running_max', 'running_min',
|
||||
'running_var', 'running_std',
|
||||
'running_median', 'running_mean',
|
||||
'running_sum']
|
||||
__all__ = [
|
||||
'smooth',
|
||||
'loess',
|
||||
'savgol',
|
||||
'running_max',
|
||||
'running_min',
|
||||
'running_var',
|
||||
'running_std',
|
||||
'running_median',
|
||||
'running_mean',
|
||||
'running_sum',
|
||||
]
|
||||
|
||||
|
||||
def loess(x, y, window_size, it=0, deg=2):
|
||||
def loess(x, y, window_size: int, it: int = 0, deg: int = 2):
|
||||
# ULTRA LANGSAM !!!
|
||||
it = max(it, 0)
|
||||
|
||||
@ -81,19 +88,19 @@ def savgol(x, y, window_size: int, deg: int = 2, mode: str = 'mirror'):
|
||||
return new_y
|
||||
|
||||
|
||||
def running_mean(x, y, window_size):
|
||||
def running_mean(x, y, window_size: int):
|
||||
return _running_func(np.nanmean, x, y, window_size)
|
||||
|
||||
|
||||
def running_median(x, y, window_size):
|
||||
def running_median(x, y, window_size: int):
|
||||
return _running_func(np.nanmedian, x, y, window_size)
|
||||
|
||||
|
||||
def running_std(x, y, window_size):
|
||||
def running_std(x, y, window_size: int):
|
||||
return _running_func(np.nanstd, x, y, window_size)
|
||||
|
||||
|
||||
def running_var(x, y, window_size):
|
||||
def running_var(x, y, window_size: int):
|
||||
return _running_func(np.nanvar, x, y, window_size)
|
||||
|
||||
|
||||
@ -132,11 +139,27 @@ def _moving_window(arr, nn):
|
||||
return np.lib.stride_tricks.as_strided(arr, shapes, strides)
|
||||
|
||||
|
||||
_funcs = {'loess': loess, 'savgol': savgol, 'mean': running_mean, 'median': running_median,
|
||||
'std': running_std, 'var': running_var, 'max': running_max, 'min': running_min, 'sum': running_sum}
|
||||
_funcs = {
|
||||
'loess': loess,
|
||||
'savgol': savgol,
|
||||
'mean': running_mean,
|
||||
'median': running_median,
|
||||
'std': running_std,
|
||||
'var': running_var,
|
||||
'max': running_max,
|
||||
'min': running_min,
|
||||
'sum': running_sum,
|
||||
}
|
||||
|
||||
|
||||
def smooth(data, window_size, mode='mean', logx=False, logy=False, **kwargs):
|
||||
def smooth(
|
||||
data: 'Data',
|
||||
window_size: int,
|
||||
mode: str = 'mean',
|
||||
logx: bool = False,
|
||||
logy: bool = False,
|
||||
**kwargs
|
||||
):
|
||||
try:
|
||||
func = _funcs[mode]
|
||||
except KeyError:
|
||||
@ -162,6 +185,6 @@ def smooth(data, window_size, mode='mean', logx=False, logy=False, **kwargs):
|
||||
new_y = 10**new_y
|
||||
|
||||
new_data = data.copy()
|
||||
new_data.set_data(x=new_x, y=new_y, y_err=None)
|
||||
new_data.set_data(x=new_x, y=new_y, y_err=np.zeros_like(new_y))
|
||||
|
||||
return new_data
|
||||
|
Loading…
Reference in New Issue
Block a user