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

bfx-es

parent 23236f65
No related branches found
No related tags found
1 merge request!256Filter funcs
Pipeline #22807 failed with stage
in 1 minute and 42 seconds
......@@ -21,4 +21,4 @@ class Noise(ModuleBase):
min_periods: PositiveInt = None,
flag: float = BAD
) -> SaQC:
return self.defer("flagByVarianceLowPass", locals())
return self.defer("flagByStatLowPass", locals())
......@@ -11,7 +11,7 @@ from saqc.lib.tools import statPass
@register(masking='field', module="noise")
def flagByLowPass(data: DictOfSeries,
def flagByStatLowPass(data: DictOfSeries,
field: ColumnName,
flags: Flags,
stat: Callable[[np.array, pd.Series], float],
......@@ -22,14 +22,44 @@ def flagByLowPass(data: DictOfSeries,
min_periods: PositiveInt = None,
flag: float = BAD,
**kwargs):
""""""
"""
Flag *chunks* of length, `wnsz`:
1. If they excexceed `thresh` with regard to `stat`:
2. If all (maybe overlapping) *sub-chunks* of *chunk*, with length `sub_wnsz`,
`excexceed `sub_thresh` with regard to `stat`:
Parameters
----------
data : dios.DictOfSeries
A dictionary of pandas.Series, holding all the data.
field : str
The fieldname of the column, holding the data-to-be-flagged.
flags : saqc.Flags
Container to store quality flags to data.
stat: Callable[[np.array, pd.Series], float]
Function to aggregate chunk contnent with.
wnsz: FreqString
Temporal extension of the chunks to test
thresh: PositiveFloat
Threshold, that triggers flagging, if exceeded by stat value.
sub_wnsz: FreqString, default None,
Window size of the sub chunks, that are additionally tested for exceeding
`sub_thresh` with respect to `stat`.
sub_thresh: PositiveFloat, default None
min_periods: PositiveInt, default None
Returns
-------
"""
datcol = data[field]
if not min_periods:
min_periods = 0
wnsz = pd.Timedelta(wnsz)
sub_wnsz = pd.Timedelta(sub_wnsz)
if sub_wnsz:
sub_wnsz = pd.Timedelta(sub_wnsz)
to_set = statPass(datcol, stat, wnsz, thresh, sub_wnsz, sub_thresh, min_periods, comparator='>')
flags[to_set[to_set].index, field] = flag
return data, flags
\ No newline at end of file
......@@ -617,8 +617,6 @@ def statPass(datcol: pd.Series,
exceeding_sub = oper(min_stat, sub_thresh)
exceeds = exceeding_sub & exceeds
exceeds = exceeding_sub & exceeds
to_set = pd.Series(False, index=exceeds.index)
for g in exceeds.groupby(by=exceeds.values):
......
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