`flagConstants` with integer `window` flags valid data

Summary

flagConstants with integer window flags constants but still valid data at the beginning of data series.

Reproducible Example

import pandas as pd
from saqc import SaQC

df = pd.DataFrame(
    data={"x": [0, 0, 0, 0, 0, 1]},
    index=pd.to_datetime(["2022-01-01 00:00", "2022-01-01 00:10", "2022-01-01 00:20", "2022-01-01 00:30", "2022-01-01 00:40", "2022-01-01 00:50"])
)
qc = SaQC(data=df)
qc = qc.flagConstants(field="x", window=100, thresh=0)

What is the current bug behavior?

>>> qc.flags["x"]
2020-01-01 00:00:00    255.0
2022-01-01 00:10:00    255.0
2022-01-01 00:20:00    255.0
2022-01-01 00:30:00    255.0
2020-01-01 00:40:00    255.0
2022-01-01 00:50:00     -inf
dtype: float64

flagConstants flagged the first 5 values of the series, they are constant, but the constant course is way less then 100 values long.

What is the expected correct behavior?

>>> qc.flags["x"]
2022-01-01 00:00:00   -inf
2022-01-01 00:10:00   -inf
2022-01-01 00:20:00   -inf
2022-01-01 00:30:00   -inf
2022-01-01 00:40:00   -inf
2022-01-01 00:50:00   -inf
dtype: float64

BTW, this is the behavior of flagConstans with an offset string window.

Stacktrace

Possible fixes

The issue seems to be in customRoller, that's why I assigned @palmb.

Edited by David Schäfer