uvex_transients.transients.supernovae.ShockCoolingIIb.sample_event_redshift#

ShockCoolingIIb.sample_event_redshift(n_samples: int, *, rng: Generator | int | None = None) → NDArray[float64]#

Draw n_samples redshifts from the rate-weighted redshift distribution.

Uses inverse-transform sampling against the tabulated CDF built by _ensure_rate_table – see that method’s docstring for why the CDF is tabulated once and inverted, rather than treating event_rate as a ~uvex_transients.models.core.priors.Prior.

Parameters:
  • n_samples (int) – Number of redshifts to draw.

  • rng (numpy.random.Generator, int, or None, optional) – Random-number source; see uvex_transients.utils.get_rng. Unlike sample_event_count, this takes an already-materialized generator (not a root seed to split) since it’s meant to be handed one of the independent streams a caller has already spawned (see sample_events_on_healpix_grid).

Returns:

float64 array of shape (n_samples,).

Return type:

numpy.ndarray