Redshift distributions

Warning

This module is in active development. The API may change without notice and no validation suite exists yet.

The sum_stat.nz module provides simple n(z) estimators (histogram and KDE) used internally to characterise lens and source redshift distributions.

Redshift distribution estimators.

sum_stat.nz.nz_histogram(cat, z_bins)[source]

Weighted histogram estimate of the redshift PDF n(z).

Normalizes the distribution so that sum(nz * dz) = 1.

Parameters:
  • cat (GalaxyCatalogue) – Galaxy catalogue with redshift and weight arrays.

  • z_bins (array_like, shape (n_bins+1,)) – Bin edges in redshift.

Returns:

  • z_centres (ndarray, shape (n_bins,)) – Redshift bin centres.

  • nz (ndarray, shape (n_bins,)) – Normalized redshift PDF [dz^-1]. Satisfies sum(nz * dz) = 1.

  • nz_err (ndarray, shape (n_bins,)) – Poisson-like uncertainty [dz^-1]: sqrt(sum w_i^2) / (W_total * dz).

Parameters:
Return type:

tuple[ndarray, ndarray, ndarray]

References

Sánchez et al. (2014), MNRAS 441, 2725.

sum_stat.nz.nz_kde(cat, z_grid, bandwidth=None)[source]

Weighted Gaussian KDE estimate of the redshift PDF n(z).

Parameters:
  • cat (GalaxyCatalogue) – Galaxy catalogue with redshift and weight arrays.

  • z_grid (array_like, shape (M,)) – Redshift values at which to evaluate n(z).

  • bandwidth (float, optional) – Gaussian kernel bandwidth in redshift units. Defaults to the weighted Silverman rule-of-thumb: h = 1.06 * sigma_w * N_eff^{-1/5}.

Returns:

  • z_grid (ndarray, shape (M,)) – Same redshift grid as input.

  • nz (ndarray, shape (M,)) – KDE estimate of n(z) [dz^-1]. Integrates approximately to 1 over the full redshift range of the catalogue.

Parameters:
Return type:

tuple[ndarray, ndarray]

References

Silverman (1986), Density Estimation for Statistics and Data Analysis, §3.4.2.