uvex_transients.transients.supernovae.MagnetarSLSNe.sample_events_on_healpix_grid#

MagnetarSLSNe.sample_events_on_healpix_grid(nside: int, *, t_start: Time, t_end: Time | None = None, duration: Quantity | None = None, pixel_mask: NDArray[bool] | None = None, pixel_ids: NDArray[int64] | None = None, order: str = 'nested', jitter: bool = True, seed: SeedSequence | int | None = None, sampling_factor: float | None = None, n_events: int | None = None) → QTable#

Draw a Monte Carlo realization of events on a HEALPix grid, over a time window.

Each sampled event is placed uniformly at random within one of the selected HEALPix pixels (optionally jittered to a sub-pixel position; see jitter), assigned a redshift drawn from sample_event_redshift, an explosion time drawn uniformly across [t_start, t_start + duration), and a per-event parameter seed (see spawn_seeds) rather than fully-sampled physical parameters – those are meant to be regenerated lazily, on demand, from that seed (via SpectralModel.sample_parameters).

Parameters:
  • nside (int) – HEALPix resolution parameter of the sampling grid.

  • t_start (Time) – Start of the sampling window.

  • t_end (Time, optional) – End of the sampling window. Mutually exclusive with duration; see _resolve_duration.

  • duration (Quantity, optional) – Length of the sampling window. Mutually exclusive with t_end; see _resolve_duration.

  • pixel_mask (numpy.ndarray of bool, optional) – Boolean mask, shape (ah.nside_to_npix(nside),), selecting which pixels to sample events in. Mutually exclusive with pixel_ids. If neither is given, every pixel in the grid is eligible.

  • pixel_ids (numpy.ndarray of int, optional) – Explicit pixel indices to sample events in. Mutually exclusive with pixel_mask.

  • order (str, optional) – HEALPix pixel ordering scheme ("nested" or "ring"), consistent with whatever ordering pixel_mask/pixel_ids were defined against. The default is "nested".

  • jitter (bool, optional) – If True (the default), place each event at a random sub-pixel position. If False, place every event at its pixel’s center.

  • seed (numpy.random.SeedSequence, int, or None, optional) – Root seed for reproducibility. A single tree of children is spawned from this seed for every stochastic draw in this call – including the event count itself – so that no two draws (however many events end up being sampled) ever share a stream.

  • sampling_factor (float, optional) – Multiplier on the physical event rate, a positive number. The number of events is drawn from a Poisson distribution with mean sampling_factor times the expected number, so 0.05 draws about one event in twenty and 2 about twice as many. This is exactly thinning (or superposing) the Poisson process, so every event of a type stands for the same 1 / sampling_factor real events: the expected total divided by the number of events generated is the correct weight, however many events fall in any one window. Only the events that are drawn are built. The default is None, which is 1 (the physical rate).

  • n_events (int, optional) – Exact number of events to draw, in place of the Poisson count. The events are placed exactly as they would be otherwise, so this only fixes how many there are. It is the caller’s job to choose a count that keeps every event of a type at the same weight (see ~uvex_transients.simulation.core.SurveySimulator.sample_N_events). Mutually exclusive with sampling_factor. The default is None, which draws the count from the Poisson distribution.

Returns:

Event table with one row per sampled event; see _create_event_table_buffer for its columns. Empty (but still correctly typed) if zero events were sampled.

Return type:

astropy.table.QTable

Raises:
  • ValueError – If both n_events and sampling_factor are given, or n_events is negative.

  • TypeError – If n_events is not an integer.