uvex_transients.models.core.detection_horizon.effective_peak_grid#
- uvex_transients.models.core.detection_horizon.effective_peak_grid(sed: SpectralModel, z_grid: NumericalInput, bandpasses: Mapping[str, SpectralElement] | Sequence[SpectralElement], *, t_rest: Quantity | None = None, t_min: Quantity | None = None, t_max: Quantity | None = None, n_time: int = 200, criterion: Literal['any', 'all', 'k_of_n'] = 'any', k: int | None = None, n_samples: int = 1000, cosmology: FLRW | None = None, chunk_size: int | None = None, progress: bool = True, rng: RNGInput = None) EffectivePeakGrid[source]#
Evaluate a sampled population’s effective peak magnitude at every redshift of a grid.
Draws n_samples parameter sets from the SED’s priors and evaluates each at every redshift: its light curve is computed on a rest-frame time grid in each band, reduced to its brightest point, and the bands are combined by criterion. The SED is evaluated once per draw, and every redshift and band is then a weighted sum over frequency (see uvex_transients.utils.phot_utils), so the cost is set by
n_samples * n_time.- Parameters:
sed (
SpectralModel) – The model whose priors are sampled.z_grid (
array-like) – Redshifts, shape(Z,), strictly increasing and positive. The grid has to reach past the horizon, or the horizon cannot be bracketed.bandpasses (
Mapping[str,SpectralElement]orsequenceofSpectralElement) – The bands, for exampledetector.bandpasses. A sequence is namedband0,band1, and so on.t_rest (
Quantity, optional) – Rest-frame times since explosion. Rest-frame times are the right choice because time dilation moves the peak in observed time but does not change its magnitude, so any observing cadence is irrelevant.t_min (
Quantity, optional) – If t_rest is omitted, the ends of a logarithmic grid of n_time points. A model has no notion of its own duration, so one of the two ways of giving the times is required.t_max (
Quantity, optional) – If t_rest is omitted, the ends of a logarithmic grid of n_time points. A model has no notion of its own duration, so one of the two ways of giving the times is required.n_time (
int, optional) – Number of points of the logarithmic grid. It must resolve the peak: a grid that misses it makes events look fainter than they are, and so puts the horizon too close.criterion (
{"any", "all", "k_of_n"}, optional) – How bands combine; see reduce_bands. The default is"any".k (
int, optional) – The number of bands required for"k_of_n".n_samples (
int, optional) – Number of draws,M. observability_curve needs at least 299 for 95% confidence at 1% tolerance.cosmology (
FLRW, optional) – For the luminosity distances. Defaults to the configured cosmology.chunk_size (
int, optional) – Draws evaluated per step. By default the largest intermediate array is about 32 MB. It does not change the result.progress (
bool, optional) – Whether to show a progress bar. The default is True.rng (
numpy.random.Generator,intorNone, optional) – Random-number source for the draws.
- Returns:
The
(n_samples, Z)effective peak magnitudes with the grids and the parameters that produced them.- Return type:
- Raises:
ValueError – If z_grid is not a 1-d, strictly increasing array of positive redshifts, if no time grid is given, or if criterion and k are inconsistent.
Notes
The redshift is a grid every draw is evaluated on, not a random draw: a draw has a horizon only if it is followed across redshift. The time of the peak is found separately at each redshift, because the K-correction changes which epoch is brightest in a band. Zero is not allowed in z_grid, where the luminosity distance vanishes.