forked from IPKM/nmreval
parent
d83e112515
commit
38a44047de
@ -29,10 +29,10 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GPG_KEYGRIP: ${{ vars.GPG_KEYGRIP }}
|
GPG_KEYGRIP: ${{ vars.GPG_KEYGRIP }}
|
||||||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
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
|
- name: Upload AppImage
|
||||||
run: ./tools/upload_gitea.sh
|
run: ./tools/upload_gitea.sh
|
||||||
env:
|
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_TOKEN: ${{ secrets.UPLOAD_TOKEN }}
|
||||||
UPLOAD_USER: ${{ vars.UPLOAD_USER }}
|
UPLOAD_USER: ${{ vars.UPLOAD_USER }}
|
||||||
|
@ -3,14 +3,21 @@ import numpy.polynomial.polynomial as poly
|
|||||||
from scipy import signal as signal
|
from scipy import signal as signal
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['smooth', 'loess', 'savgol',
|
__all__ = [
|
||||||
'running_max', 'running_min',
|
'smooth',
|
||||||
'running_var', 'running_std',
|
'loess',
|
||||||
'running_median', 'running_mean',
|
'savgol',
|
||||||
'running_sum']
|
'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 !!!
|
# ULTRA LANGSAM !!!
|
||||||
it = max(it, 0)
|
it = max(it, 0)
|
||||||
|
|
||||||
@ -81,19 +88,19 @@ def savgol(x, y, window_size: int, deg: int = 2, mode: str = 'mirror'):
|
|||||||
return new_y
|
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)
|
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)
|
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)
|
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)
|
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)
|
return np.lib.stride_tricks.as_strided(arr, shapes, strides)
|
||||||
|
|
||||||
|
|
||||||
_funcs = {'loess': loess, 'savgol': savgol, 'mean': running_mean, 'median': running_median,
|
_funcs = {
|
||||||
'std': running_std, 'var': running_var, 'max': running_max, 'min': running_min, 'sum': running_sum}
|
'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:
|
try:
|
||||||
func = _funcs[mode]
|
func = _funcs[mode]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -162,6 +185,6 @@ def smooth(data, window_size, mode='mean', logx=False, logy=False, **kwargs):
|
|||||||
new_y = 10**new_y
|
new_y = 10**new_y
|
||||||
|
|
||||||
new_data = data.copy()
|
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
|
return new_data
|
||||||
|
Loading…
Reference in New Issue
Block a user