Likelihood API#

class CHIMERA.likelihood.hyperlikelihood(theta_gw_det: theta_pe_det, z_grids: Array, population: Module, selection_function: object | None = None, kind_p_gw3d: str | None = None, kernel: str = 'epan', bw_method: Number | None = None, cut_grid: Number = 2.0, binning: bool = True, num_bins: int = 200, pe_neff: Number = 2.0)#

Bases: object

A class for computing the cosmological/populationulation hyperlikelihood of gravitational wave (GW) events.

Parameters:
  • data_gw (Dict[str, jnp.ndarray]) – Dictionary containing GW posterior samples and pixelation metadata. - For pixelated data, it includes ‘pixels’, ‘gw_loc2d_pdf’, and related arrays. - For non-pixelated data, it contains direct event data.

  • pe_prior (jnp.ndarray) – Prior probability distribution from the parameter estimation (PE) of GW events.

  • population (object) – A CHIMERA.population instance.

  • sel_eff (Optional[object]) – A CHIMERA.sekection_effects object used to compute the bias function \(\xi(\lambda)\). Defaults to None.

  • kind_p_gw3d (Optional[str]) – Type of 3D GW probability computation. Options: ‘approximate’, ‘marginalized’, ‘full’. Used only for pixelated GW catalogs.

  • kernel (str) – Kernel type for KDE computations. Options: ‘epan’ (Epanechnikov kernel), ‘gauss’ (Gaussian kernel). Defaults to ‘epan’. Note: ‘epan’ is only available for ‘approximate’ or ‘marginalized’ cases and for non-pixelated data.

  • bw_method (Optional[Number]) – Bandwidth selection method for KDE computations. Defaults to None.

  • cut_grid (Number) – Cut-off grid size for KDE computations to limit numerical range. Defaults to 2.0.

  • binning (bool) – Whether to apply binning to the data for efficiency. Defaults to True. Available only for ‘approximate’ or ‘marginalized’ cases and for non-pixelated data.

  • num_bins (int) – Number of bins used for KDE binning. Defaults to 200.

  • positive_weights_thresh (Number) – Minimum threshold for effective positive weights in KDE. Defaults to 5.0.

  • pe_neff (Number) – Minimum effective sample size (Neff) required for valid events. Defaults to 5.0.

  • cosmo_prior (Optional[Dict[str, List[Number]]]) – Priors on cosmological parameters. Defaults to None.

  • z_conf_range (Union[Number, list]) – Confidence range for the redshift grid, used in redshift estimation. Defaults to 5.0.

  • z_int_res (int) – Resolution of the redshift grid for computations. Defaults to 300.

Class Attributes:
  • pixelated (bool): Indicates if the input data is pixelated (‘pixels’ key exists in data_gw).

  • nevents (int): Total number of GW events.

  • z_grids (jnp.ndarray): Precomputed redshift grids for each GW event.

Other Methods:
  • p_gw3d(**hyper_lambdas): wrapper for p_gw3dapprox, p_gw3dmarg, or p_gw3dfull depenging on kind_p_gw3d

  • compute_log_like_nums(**hyper_lambdas): compute the single-events contributions to the hyper-likelihood numerator.

compute_all(**hyper_lambdas)#
compute_log_hyperlike(**hyper_lambdas)#

Computes the of the log hyper-likelihood.

compute_log_likenum(pop_lambdas)#

Computes the numerator of the log hyper-likelihood.

p_gw1d(pop_lambdas)#

Computes \(p_gw(z | \lambda)\). Used for non-pixelated catalogs or when “king_p_gw3d=’approximate’”.

p_gw3dapprox(pop_lambdas)#

Computes \(p_gw(z, RA, Dec | \lambda)\) when “king_p_gw3d=’approximate’”.

p_gw3dfull(pop_lambdas)#

Computes \(p_gw(z, RA, Dec | \lambda)\) when “king_p_gw3d=’full’”.

p_gw3dmarg(pop_lambdas)#

Computes p_gw(z, RA, Dec | λ) when kind_p_gw3d=’marginalized’.