uvex_transients.simulation.core.SurveySimulator.sample_N_events#
- SurveySimulator.sample_N_events(count: int | Mapping[str, int], time_bins: Time | int, nside: int | None = None, order: str | None = None) EventCatalog[source]#
Sample a fixed number of events of every registered transient type over a time grid.
The fixed-count counterpart of
generate_events(), with the same (dilated) footprint. The count is divided among the time bins in proportion to each bin’s effective exposure \(\mathcal E_k = F(t_k, t_{k+1}+\tau)\,(t_{k+1}-t_k)\) (see compute_effective_exposure), by a single multinomial draw per type:\[(N_1, \dots, N_K) \sim \mathrm{Multinomial}\left(N, \mathcal E_k / \sum_j \mathcal E_j\right).\]Because the rate is constant in time, \(\mathcal E_k\) is proportional to the expected number of events in bin \(k\), so the events are independent draws from the footprint-weighted population and every event of a type stands for the same
expected_events[type] / count[type]real events.- Parameters:
count (
intorMappingofstrtoint) – The number of events to sample. Either a single count applied to every registered transient type, or a{type key: count}mapping naming every registered type. Each count must be a positive integer.time_bins (
Timeorint) – Same semantics as generate_events.nside (
int, optional) – Same semantics as generate_events.order (
str, optional) – Same semantics as generate_events.
- Returns:
One row per sampled event, across every registered transient type and time bin, with the same columns as generate_events. Its
pre_cut_countsare count and itssampling_factoris None, since the count was fixed instead of scaled.- Return type:
EventCatalog- Raises:
ValueError – If count is a mapping that names an unknown transient type or leaves a registered one out, any count is not a positive integer, or a transient type has no survey exposure over time_bins to place its events in.