Skip to content
Snippets Groups Projects
Commit c026c560 authored by Peter Lünenschloß's avatar Peter Lünenschloß
Browse files

progress with implementing flagPlateaus

parent 29f042f9
No related branches found
No related tags found
3 merge requests!193Release 1.4,!188Release 1.4,!138WIP: Detect and reset offset
Pipeline #8907 passed with stage
in 6 minutes and 23 seconds
......@@ -5,13 +5,14 @@ import pandas as pd
import numpy as np
from saqc.core.register import register
from saqc.lib.ts_operators import interpolateNANs, aggregate2Freq, shift2Freq, expModelFunc
from saqc.lib.tools import toSequence, mergeDios, dropper, mutateIndex
from saqc.lib.tools import toSequence, mergeDios, dropper, mutateIndex, detectDeviants
import dios
import functools
from scipy.optimize import curve_fit
from sklearn.linear_model import LinearRegression
from sklearn.utils import resample
ORIGINAL_SUFFIX = "_original"
METHOD2ARGS = {
......@@ -970,8 +971,13 @@ def proc_seefoExpDriftCorrecture(data, field, flagger, maint_data_field, cal_mea
@register(masking='all')
def proc_flagOffsets(data, field, flagger, stat, regime_cluster):
pass
def proc_flagOffsets(data, field, flagger, cluster_field, norm_spread, metric=lambda x,y: np.abs(np.nanmean(x) - np.nanmean(y)),
norm_frac=0.5):
clusterser = data[cluster_field]
cluster_num = clusterser.max() + 1
cluster_dios = dios.DictOfSeries({i : data[field][clusterser == i] for i in range(cluster_num)})
plateaus = detectDeviants(cluster_dios, metric, norm_spread, norm_frac)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment