Data API#
- CHIMERA.data.compute_localization_areas(theta, phi, percentile=0.9, unit='deg2')#
Compute the localization area of each event in the dataset.
- Parameters:
theta – Polar angle samples for each event
phi – Azimuthal angle samples for each event
percentile – Confidence level for localization area (0-100)
unit – Output unit for area (‘deg2’ or ‘rad2’)
- Returns:
Array of localization areas for each event
- CHIMERA.data.compute_localization_volumes(theta, phi, dL, cosmo_params_min, cosmo_param_max, percentile=90)#
Compute the localization volume of each event in the dataset.
- Parameters:
theta – Polar angle samples for each event
phi – Azimuthal angle samples for each event
dL – Luminosity distance samples for each event
cosmo_params_min – Cosmological parameters for minimum distance bound
cosmo_param_max – Cosmological parameters for maximum distance bound
percentile – Confidence level for localization volume (0-100)
- Returns:
Array of localization volumes for each event in Gpc^3
- CHIMERA.data.compute_sky_conf_event(healpix_pe, sky_conf, nside)#
Return all the Healpix pixel indices where the probability of an event is above a given threshold.
- Parameters:
healpix_pe (ndarray) – Healpix index of PE for a particular events and nside
event (int) – number of the event
nside (int) – nside parameter for Healpix
- Returns:
Healpix indices of the skymap where the probability of an event is above a given threshold.
- CHIMERA.data.load_galaxy_catalog(file_path, parameters=['ra_gal', 'dec_gal', 'z_cgal'], units='rad', backend='numpy')#
Load galaxy catalog data with optional unit conversion.
- Parameters:
file_path – Path to HDF5 file containing galaxy data
parameters – List of parameters to load (default: [‘ra_gal’, ‘dec_gal’, ‘z_cgal’])
units – Output units for angular coordinates (‘rad’ or ‘deg’)
backend – Array backend (‘numpy’ or ‘jax’)
- Returns:
Dictionary with ‘ra’ (right ascension), ‘dec’ (declination), ‘z’ (redshift).
- CHIMERA.data.load_gw_pe_samples(file_ev_pe, parameters=['dL', 'm1det', 'm2det', 'phi', 'theta'], group='posteriors', nevents=None, nsamples=None, return_struct=True)#
Load GW parameter estimation samples with flexible selection.
- Parameters:
file_ev_pe – Path to HDF5 file with PE samples
parameters – List of parameters to load
group – HDF5 group containing the data
nevents – Number/indices of events to select
nsamples – Number of samples per event to select
return_struct – Return theta_pe_det struct if True, else dict
- Returns:
theta_pe_det struct or dictionary of arrays
- CHIMERA.data.load_injection_data(file_inj, snr_cut=None, ninj=None, group=None, key_mapping=None, return_struct=True)#
Load injection data with SNR cut and optional downsampling.
- Parameters:
file_inj – Path to injection file
snr_cut – Minimum SNR threshold
ninj – Number/indices of injections to select
group – HDF5 group containing data
key_mapping – Dictionary for custom key names
return_struct – Return theta_inj_det if True, else tuple (data, prior)
- Returns:
theta_inj_det or tuple of (data dictionary, prior array)
- CHIMERA.data.load_pixelated_gw_catalog(fname)#
Load pixelated GW catalog into a theta_pe_det struct
- CHIMERA.data.pixelize_gw_catalog(theta_gw, nside_list, mean_npixels_event, sky_conf, nest=False, prefix=None, ret_datastruct=True)#
Pre-compute columns of corresponding Healpix indices for all the provided nside_list pixelization parameters.
- Parameters:
theta_gw – struct with the detector frame PE of the GW catalog
nside_list – list of nside parameters for Healpix
mean_npixels_event – approximate number of desired pixels per event
sky_conf – percentage of the GW are to pixelize
nest – if the healpy map is nested or not
prefix – if provided is the prefix of the h5 file to save with the pixelated gw catalog
- Returns:
Instance of theta_pe_det with all pixelization fields
- class CHIMERA.data.theta_inj_det(m1det: jax.Array | None = None, m2det: jax.Array | None = None, dL: jax.Array | None = None, p_draw: jax.Array | None = None)#
Bases:
theta_generic- dL: Array | None = None#
- m1det: Array | None = None#
- m2det: Array | None = None#
- p_draw: Array | None = None#
- class CHIMERA.data.theta_pe_det(m1det: jax.Array | None = None, m2det: jax.Array | None = None, dL: jax.Array | None = None, phi: jax.Array | None = None, theta: jax.Array | None = None, ra: jax.Array | None = None, dec: jax.Array | None = None, pe_prior: jax.Array | None = None, pixels_pe_all_nsides: Dict[str, jax.Array] | None = None, opt_nsides: jax.Array | None = None, pixels_opt_nsides: jax.Array | None = None, ra_pix: jax.Array | None = None, dec_pix: jax.Array | None = None, gw_loc2d_pdf: jax.Array | None = None, pixels_pe_opt_nside: jax.Array | None = None)#
Bases:
theta_generic- dL: Array | None = None#
- dec: Array | None = None#
- dec_pix: Array | None = None#
- gw_loc2d_pdf: Array | None = None#
- m1det: Array | None = None#
- m2det: Array | None = None#
- opt_nsides: Array | None = None#
- pe_prior: Array | None = None#
- phi: Array | None = None#
- pixels_opt_nsides: Array | None = None#
- pixels_pe_all_nsides: Dict[str, Array] | None = None#
- pixels_pe_opt_nside: Array | None = None#
- ra: Array | None = None#
- ra_pix: Array | None = None#
- theta: Array | None = None#
- class CHIMERA.data.theta_src(m1src: jax.Array | None = None, m2src: jax.Array | None = None, z: jax.Array | None = None, original_distances: jax.Array | None = None)#
Bases:
theta_generic- m1src: Array | None = None#
- m2src: Array | None = None#
- original_distances: Array | None = None#
- z: Array | None = None#