woom.iters.gen_cycles

Contents

woom.iters.gen_cycles#

woom.iters.gen_cycles(begin_date, end_date=None, freq=None, ncycles=None, round=None, as_intervals=True, horizon=None)[source]#

Get a list of Cycle instances given time specifications

The first cycle has the Cycle.is_first attribute set to True. The last cycle has the Cycle.is_last attribute set to True. The cycles are related with one another thanks to the Cycle.prev and Cycle.next attributes.

Parameters:
  • begin_date (date-like) – First date

  • end_date (date_like, None) – Last date

  • freq (freq-like, None) – Difference of time between to dates

  • ncycles (int, None) – Number of cycles. This parameters takes precedence over freq.

  • round (freq_like, None) – Round dates to this precision

  • as_intervals (bool) – Consider dates as independant dates or intervals. When set to True, [date0, date1, date2] becomes [Cycle(date0, date1), Cycle(date1, date2)], else [Cycle(date0), Cycle(date1), Cycle(date2)].

  • horizon (timedelta-like, None) – Forecast horizon applied when as_intervals=False. Each cycle’s end_date is set to begin_date + horizon and duration to horizon, making cycle_end_date and cycle_duration available in templates. Ignored when as_intervals=True.