uvex_transients.simulation.core.event_boundaries#

uvex_transients.simulation.core.event_boundaries(event_id) → tuple[ndarray, ndarray][source]#

Locate each event’s block of rows in an array grouped by event.

SurveySimulator.iter_epochs sorts every chunk by (event_id, t_obs), so each event’s rows are contiguous. The offsets returned here turn that into per-event reductions without a Python loop over rows, for example with numpy.minimum.reduceat(values, starts).

Parameters:

event_id (array-like of int) – A chunk’s event_id column, or any array whose equal values are contiguous.

Returns:

  • starts (numpy.ndarray) – Index of each event’s first row, in order of appearance. Empty for empty input.

  • stops (numpy.ndarray) – One past the index of each event’s last row, so that event’s rows are chunk[starts[i]:stops[i]].