Catalog API#

Catalog Module#

class CHIMERA.catalog.catalog.empty_catalog(p_bkg='dVdz')#

Bases: object

A class to handle the computation of the probability of having a galaxy at z in the case of an empty galaxy catalog.

Parameters:
  • p_bkg (eqx.Module) – type of bkg

  • completeness (object) – A CHIMERA.completeness handling the completeness computation.

- precompute_p_cat

Precompute the p_cat term and its completeness P_compl

p_gal(cosmo_lambdas: Module, z: Array)#

Compute the p_gal term over the given redshift grids.

class CHIMERA.catalog.catalog.pixelated_catalog(completeness: object, gal_cat_file: str | None = None, cosmo: Module | None = None, z_grids: Array | None = None, fname_data_gal: str | None = None, data_gw_pixelated: theta_pe_det | None = None, z_err: Number = 1, weights: Array | None = None, mask_gal=None, sumgauss: str = 'dVdz', reshuffle: bool = False, out_file: str | None = None)#

Bases: object

A class to handle the computation of the probability of having a galaxy at z in the case of a pixelated galaxy catalog.

Parameters:
  • fname_data_gal (str) – Filename of the .h5 file containing galaxy properties (z, RA, DEC).

  • data_gw_pixelated (Dict[str, jnp.ndarray]) – Dictionary containing a pixelated GW catalog. Should be the output of CHIMERA.data.load_pixelated_gw_catalog().

  • cosmo (eqx.Module) – A CHIMERA.cosmo object describing cosmological parameters.

  • completeness (object) – A CHIMERA.completeness handling the completeness computation.

  • fname_interp (str) – Name of the .pkl file containing the catalog interpolator to load (or save).

  • z_err (Number) – Redshift error to assign to each galaxy to be multiplied by (1+z).

  • weights (jnp.ndarray) – Host galaxy weights.

Class Attributes:
  • fname_data_gal (str): Filename of the .h5 file containing galaxy properties (z, RA, DEC).

  • data_gw_pixelated (Dict[str, jnp.ndarray]): Dictionary containing a pixelated GW catalog.

  • cosmo (eqx.Module): A CHIMERA.cosmo object describing cosmological parameters.

  • completeness (object): A CHIMERA.completeness handling the completeness computation.

  • fname_interp (str): Name of the .pkl file containing the catalog interpolator.

  • z_err (Number): Redshift error to assign to each galaxy to be multiplied by (1+z).

  • weights (jnp.ndarray): Host galaxy weights.

Likelihood functions:
  • precompute_p_cat: Precompute the p_cat term and its completeness P_compl

p_gal(cosmo_lambdas: Module, z: Array)#

Compute the background galaxy distribution for selection effects estimation.

precompute_p_cat(zgrids)#

Store the p_cat, Ngal, and P_compl terms computed over the given redshift grids.

Completeness Module#

class CHIMERA.catalog.completeness.dVdz_completeness(z_range: List[Number] | Array = [0.073, 1.3], kind: str = 'step', z_sig: Number | None = None)#

Bases: object

A class to compute the completeness of the luminosity-complete UCV sub-sample of MICE.

Parameters:
  • cosmo (CHIMERA.cosmo.flrw or CHIMERA.cosmo.mg_flrw) – an instance of a cosmology object containing cosmological parameters.

  • z_range (jax.ndarray) – a 2-element JAX array specifying the redshift range within which the catalog is complete.

  • kind (str) – The type of completeness to compute. Options are: - ‘step’: Step function completeness. - ‘step_smooth’: Smooth step function completeness.

  • z_sig (Optional[Number], default=None) – Sigma parameter controlling the smoothness of the completeness step in the ‘step_smooth’ mode.

P_compl(zgrids)#

Computes the completeness probability P_compl over the given redshift grid.

fR(cosmo_lambdas, normalized=False)#

Computes the completeness normalization factor f_R.

p_bkg(cosmo_lambdas: Module, theta_src: Module)#
p_bkg(self, cosmo_lambdas: equinox._module._module.Module, z: jax.Array)#
Noindex:

class CHIMERA.catalog.completeness.homogeneous_completeness(z_gal: Array, theory_density_func: object, cosmo_lambdas: Module, sky_area_deg2: Number = 58.0, z_range: Array | None = None, smooth: Number | None = None, Nz_to_bin: Number | None = 50, Nz_interp: Number | None = 1000, resample: Number | None = None, weights: Array | None = None)#

Bases: object

A class to compute the completeness of a galaxy catalog as a density fraction w.r.t. a theoretical function.

P_compl(z_grids)#

Compute P_compl(z) on analysis z_grids for all the GW events. Approx.: P_compl is cosmology independent (true for H0).

compute_completeness_interpolants()#

Compute completeness over self.z_int_grid for each mask.

Sets:

self.completeness (jnp.ndarray): Completeness for each mask.

fR(cosmo_lambdas)#

Compute fR = ∫ P_compl * p_bkg dz for all masks with a given cosmology. Called within MCMC when cosmology changes.

Parameters:
  • cosmo_lambdas – Cosmological parameters for this iteration

  • pix_gw (jnp.ndarray) – Pixelization of the GW event

  • nside (jnp.ndarray) – HEALPix nside parameter.

  • nside_gw – Nside of the GW event

  • nest_gw – Whether the GW event is in nested pixelization

Returns:

Array of shape (nmasks,) with fR values

get_completeness_interpolant(dir_compl)#

Get completeness interpolant.

Parameters:

dir_compl (str) – Path to load/save completeness interpolant.

Returns:

Function to get completeness for any mask at any redshift

p_bkg(cosmo_lambdas: Module, theta_src: Module)#

Compute background probability on arbitrary z_grid, normalized over the range defined by self.z_int_grid.

Parameters:
  • cosmo – Cosmology object

  • z – Redshift value(s) where to evaluate the function

Returns:

Normalized probability values at z points

p_bkg(self, cosmo_lambdas: equinox._module._module.Module, z: jax.Array)
class CHIMERA.catalog.completeness.mask_completeness(cosmo_lambdas: Module, n_gal_theo: object, mask_file: str | None = None, z_gal: Array = None, ra_gal: Array = None, dec_gal: Array = None, weights_gal: Array = None, mask_and_gal: Array = None, nmasks: int = 6, nside: int = 32, nest: bool = False, Nz_to_bin: int = 50, resample: int = None, smooth: float = None, z_int_range: list = [0.0, 10.0], z_int_res: int = 1000, z_min: float = 0.0, z_max: float = inf, out_file: str | None = None)#

Bases: object

Compact implementation of a masked completeness class.

P_compl(z_grids)#

Compute P_compl(z) on analysis z_grids for all the GW events. Approx.: P_compl is cosmology independent (true for H0).

compute_completeness_interpolants()#

Compute completeness over self.z_int_grid for each mask.

Sets:

self.completeness (jnp.ndarray): Completeness for each mask.

compute_masks(ra_gal, dec_gal, nmasks, nside, nest=False)#

Compute completeness masks by clustering pixels based on number of galaxies inside them. :param ra_gal: Right ascension of galaxies in radians. :type ra_gal: jnp.ndarray :param dec_gal: Declination of galaxies in radians. :type dec_gal: jnp.ndarray :param nmasks: Number of masks to create. :type nmasks: int :param nside: HEALPix nside parameter. :type nside: int :param nest: Whether to use nested pixelization. :type nest: bool :param mask_and_gal: Boolean array for an additional galaxy mask (& logic will be used). :type mask_and_gal: jnp.ndarray, optional

Sets:

self.nmasks (int): Number of masks. self.nside (int): HEALPix nside parameter. self.nest (bool): Whether to use nested pixelization. self.npix (int): Number of pixels. self.pixarea (float): Area of each pixel in steradians. self.ngal_pix (jnp.ndarray): Number of galaxies per pixel. self.kbins (jnp.ndarray): Bin edges for k-means clustering. self.healpix2mask (jnp.ndarray): Mapping from pixels to masks. self.mask_gal (jnp.ndarray): Mapping from galaxies to masks. self.npix_mask (jnp.ndarray): Number of pixels in each mask. self.ngal_mask (jnp.ndarray): Number of galaxies in each mask. self.sky_area_mask (jnp.ndarray): Sky area of each mask in steradians.

fR(cosmo_lambdas)#

Compute fR = ∫ P_compl * p_bkg dz for all masks with a given cosmology. This function is called within MCMC iterations when cosmology changes.

Parameters:
  • cosmo – Cosmological parameters for this iteration

  • pix_gw (jnp.ndarray) – Pixelization of the GW event

  • nside (jnp.ndarray) – HEALPix nside parameter.

  • nside_gw – Nside of the GW event

  • nest_gw – Whether the GW event is in nested pixelization

Returns:

Array of shape (nmasks,) with fR values

p_bkg(cosmo_lambdas: Module, theta_src: Module)#

Compute background probability on arbitrary z_grid, normalized over the range defined by self.z_int_grid.

Parameters:
  • cosmo – Cosmology object

  • z – Redshift value(s) where to evaluate the function

Returns:

Normalized probability values at z points

p_bkg(self, cosmo_lambdas: equinox._module._module.Module, z: jax.Array)
set_gw_mask_idxs(pix_gw, nside_gw, nest_gw)#

Set the GW mask indices for the given pixelization. Convert GW to completeness pixelization and get corresponding mask inde