filter_away_flatline_chunks#

openstef_beam.benchmarking.target_provider.filter_away_flatline_chunks(measurement_series: Series, min_length: int = 96, threshold: float = 1.0) → Series[source]#

Mask long flatline segments in a target series.

Detects contiguous segments where the standard deviation inside both centered and right-aligned windows falls below threshold times the global standard deviation for at least min_length samples. Values inside those segments are replaced with NaN so downstream logic can drop them and derive a clean evaluation mask.

Parameters:
  • measurement_series (Series) – Time-indexed series containing the target observations.

  • min_length (int) – Minimum length (in samples) for a chunk to be treated as a flatline.

  • threshold (float) – Multiplier on the global standard deviation to define the flatline cutoff.

  • measurement_series

  • min_length

  • threshold

Returns:

A copy of measurement_series with flatline chunks set to NaN.

Return type:

Series