iterate_by_window#

openstef_beam.evaluation.window_iterators.iterate_by_window(index: DatetimeIndex, window: Window, sample_interval: timedelta, reference_date: datetime | None = None) Iterator[tuple[datetime, DatetimeIndex]][source]#

Yields fixed-size sliding windows over a time series index.

Guarantees:

  • Windows are aligned to the window stride

  • Windows cover the entire range from index.min() + window.size to index.max()

  • Each window has exactly the specified window size

  • Window indices include timestamps from (end - window.size) to end (exclusive)

Parameters:
  • index (DatetimeIndex) – DatetimeIndex to create windows from

  • window (Window) – Window specification with size, stride parameters

  • sample_interval (timedelta) – Time interval between consecutive samples

  • reference_date (datetime | None) – Reference date for single window evaluation. When provided, yields a single window based on the reference date instead of all available windows.

  • index

  • window

  • sample_interval

  • reference_date

Yields:

Iterator of (window end time, window DatetimeIndex) tuples

Return type:

Iterator[tuple[datetime, DatetimeIndex]]