@@ -14,108 +14,6 @@ from saqc.core.register import flagging
fromsaqc.lib.toolsimportcustomRoller
# todo should we mask `reference` even if the func fail if reference has NaNs
@flagging()
defflagPatternByWavelet(
data,
field,
flags,
reference,
widths=(1,2,4,8),
waveform="mexh",
flag=BAD,
**kwargs,
):
"""
Pattern recognition via wavelets.
The steps are:
1. work on chunks returned by a moving window
2. each chunk is compared to the given pattern, using the wavelet algorithm as
presented in [1]
3. if the compared chunk is equal to the given pattern it gets flagged
Parameters
----------
data : dios.DictOfSeries
A dictionary of pandas.Series, holding all the data.
field : str
The fieldname of the data column, you want to correct.
flags : saqc.Flags
The flags belonging to ``data``.
reference: str
The fieldname in ``data`' which holds the pattern.
widths: tuple of int
Widths for wavelet decomposition. [1] recommends a dyadic scale.
Default: (1,2,4,8)
waveform: str
Wavelet to be used for decomposition. Default: 'mexh'. See [2] for a list.
Returns
-------
data : dios.DictOfSeries
A dictionary of pandas.Series, holding all the data.
Data values may have changed relatively to the data input.
flags : saqc.Flags
The flags belongiong to `data`.
References
----------
The underlying pattern recognition algorithm using wavelets is documented here:
[1] Maharaj, E.A. (2002): Pattern Recognition of Time Series using Wavelets. In: Härdle W., Rönz B. (eds) Compstat. Physica, Heidelberg, 978-3-7908-1517-7.
The documentation of the python package used for the wavelt decomposition can be found here: