π API Reference#
This page documents the public API of euclidlib.
euclidlib#
euclidlib.phz β Photometric Redshift products#
- euclidlib.phz.redshift_distributions(path: str | PathLike[str], *, ext: str | int | None = None, hist: bool = False) tuple[NDArray[Any], Mapping[int, NDArray[Any]]]#
Read redshift distributions in Euclid format.
- Parameters:
path (str) β Path to a FITS file in Euclid format.
ext (str or int or None, optional) β The FITS extension to read. If
None, the first extension with data is used.hist (bool, optional) β By default, the histograms are converted to distributions. If true, return the redshift histograms unmodified.
- Returns:
z (ndarray) β Redshift values.
nz (dict of int and ndarray) β Dictionary where keys are tomographic bin IDs and values are the redshift distributions.
euclidlib.le3 β LE3 pipeline products#
euclidlib.le3.pk_wl β Weak-lensing products in harmonic space#
- euclidlib.le3.pk_wl.angular_power_spectra(path: str | PathLike[str]) dict[str | int | tuple[_DictKey, ...], cosmolib.data.AngularPowerSpectrum]#
Read angular power spectra results from a FITS file.
- Parameters:
path (str or PathLike) β Path to the FITS file.
- Returns:
spectra β Dictionary of angular power spectra dataclass objects.
- Return type:
dict
- euclidlib.le3.pk_wl.mixing_matrices(path: str | PathLike[str]) dict[str | int | tuple[_DictKey, ...], cosmolib.data.AngularPowerSpectrum]#
Read mixing matrices from a FITS file.
- Parameters:
path (str or PathLike) β Path to the FITS file.
- Returns:
matrices β Dictionary of mixing matrix dataclass objects.
- Return type:
dict
- euclidlib.le3.pk_wl.normalize_result_axis(axis: tuple[int, ...] | int | None, result: ndarray[tuple[int, ...], dtype[Any]], ell: tuple[ndarray[tuple[int, ...], dtype[Any]], ...] | ndarray[tuple[int, ...], dtype[Any]] | None) tuple[int, ...]#
Normalize the axis used to store results.
- Parameters:
axis (tuple of int, int, or None) β Axis or axes over which the result is computed.
result (NDArray) β The result array.
ell (tuple of NDArray, NDArray, or None) β Associated ell values.
- Returns:
axis β Normalized tuple of axes.
- Return type:
tuple of int
- euclidlib.le3.pk_wl.read(path: str | PathLike[str]) dict[str | int | tuple[_DictKey, ...], cosmolib.data.AngularPowerSpectrum]#
Read a dictionary of results from a FITS file.
- Parameters:
path (str or PathLike) β Path to the FITS file.
- Returns:
results β Dictionary mapping decoded keys to dataclass objects.
- Return type:
dict
euclidlib.le3.pk_gc β Galaxy-clustering products in harmonic space#
- euclidlib.le3.pk_gc.power_spectrum_multipole_covariance(path: str | PathLike[str], *redshifts: str, include_BAO: bool = False) dict[_DictKey, PowerSpectrumMultipolesCovariance | None]#
Reads the covariance matrix of the power spectrum Legendre multipoles from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
include_BAO (bool) β Flag to include or not auto-BAO and cross FS-BAO covariance.
- Returns:
results β Dictionary containing the covariance matrix of the power spectrum multipoles for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipolesCovariance instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[PowerSpectrumMultipolesCovariance]]
- euclidlib.le3.pk_gc.power_spectrum_multipole_mixing_matrix(path: str | PathLike[str], *redshifts: str) dict[_DictKey, PowerSpectrumMultipolesMixingMatrix | None]#
Reads the mixing matrix of the power spectrum Legendre multipoles from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
- Returns:
results β Dictionary containing the mixing matrix of the power spectrum multipoles for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipolesMixingMatrix instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[PowerSpectrumMultipolesMixingMatrix]]
- euclidlib.le3.pk_gc.power_spectrum_multipoles(path: str | PathLike[str], *redshifts: str) dict[_DictKey, PowerSpectrumMultipoles | None]#
Reads the power spectrum Legendre multipoles from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
- Returns:
results β Dictionary containing the power spectrum multipoles for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipoles instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[PowerSpectrumMultipoles]]
euclidlib.le3.twopcf_wl β Weak-lensing products in real space#
- euclidlib.le3.twopcf_wl.bandpowers(path: str | PathLike[str]) dict[tuple[str, str, int, int], ndarray[tuple[int, ...], dtype[Any]]]#
[SOON TO BE DEPRECATED] Read Euclid 2D bandpowers from a FITS product.
- Parameters:
path (str or PathLike) β Path to the FITS file containing the bandpower data.
- Returns:
Mapping from decoded EXTNAME keys to NumPy structured arrays containing the bandpower data.
- Return type:
dict[_DictKey, numpy.ndarray]
Notes
Only HDUs whose EXTNAME contains
'2D'are read.- Column names are normalized to Euclid conventions:
POSβPOS β (L, CL)
POSβSHE β (L, CL_E, CL_B)
SHEβSHE β (L, CL_E, CL_B)
- euclidlib.le3.twopcf_wl.correlation_functions(path: str | PathLike[str]) dict[tuple[str, str, int, int], cosmolib.data.TwoPointCorrelationFunction]#
Read Euclid 2D two-point correlation functions from a FITS file.
- Parameters:
path (str or PathLike) β Path to the FITS file containing the correlation-function data.
- Returns:
A dictionary mapping keys of the form
(TYPE1, TYPE2, BIN1, BIN2)toTwoPointCorrelationFunctionobjects.- Return type:
dict[_DictKey, TwoPointCorrelationFunction]
Notes
Only HDUs whose EXTNAME contains
'2D'are read.- The mapping of FITS columns to TPCF components follows the official Euclid naming conventions:
SHEβSHE β (XI_P, XI_M, XI_X)
POSβSHE β (GAMMA_T, GAMMA_X)
POSβPOS β (WTHETA)
- euclidlib.le3.twopcf_wl.cosebis(path: str | PathLike[str]) dict[tuple[str, str, int, int], cosmolib.data.COSEBI]#
Read Euclid COSEBI bandpowers from a FITS product.
- Parameters:
path (str or PathLike) β The path to the FITS file containing the COSEBI data product.
- Returns:
Mapping from decoded EXTNAME keys to
COSEBIdataclass instances.- Return type:
dict[_DictKey, COSEBI]
Notes
- The PRIMARY HDU is expected to contain:
THMIN,THMAX,NMODES.
- Each extension HDU must have EXTNAME formatted as:
SHEARSHEAR2D_COSEBI_j_k.
Columns read: MODE, EE, EB, BB (Euclid ordering).
euclidlib.le3.twopcf_gc β Galaxy-clustering products in real space#
- euclidlib.le3.twopcf_gc.twopoint_correlation_cartesian(path: str | PathLike[str], *redshifts: str) dict[_DictKey, TwoPointCorrelationCartesian | None]#
Reads the 2-dimensional cartesian 2PCF from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
- Returns:
results β Dictionary containing the 2d cartesian 2PCF for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipoles instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[TwoPointCorrelationCartesian]]
- euclidlib.le3.twopcf_gc.twopoint_correlation_multipole_covariance(path: str | PathLike[str], *redshifts: str, include_BAO: bool = False) dict[_DictKey, TwoPointCorrelationMultipolesCovariance | None]#
Reads the covariance matrix of the 2PCF Legendre multipoles from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
include_BAO (bool) β Flag to include or not auto-BAO and cross FS-BAO covariance.
- Returns:
results β Dictionary containing the covariance matrix of the 2PCF multipoles for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipoles instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[TwoPointCorrelationMultipolesCovariance]]
- euclidlib.le3.twopcf_gc.twopoint_correlation_multipoles(path: str | PathLike[str], *redshifts: str) dict[_DictKey, TwoPointCorrelationMultipoles]#
Reads the 2PCF Legendre multipoles from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
- Returns:
results β Dictionary containing the 2PCF multipoles for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipoles instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[TwoPointCorrelationMultipoles]]
- euclidlib.le3.twopcf_gc.twopoint_correlation_polar(path: str | PathLike[str], *redshifts: str) dict[_DictKey, TwoPointCorrelationPolar | None]#
Reads the 2-dimensional polar 2PCF from a LE3-format fits file and returns it as a cosmolib data structure.
- Parameters:
path (str or PathLike) β Path to the input FITS file. If the string contains a {} placeholder, it will be formatted using the provided redshift labels.
*redshifts (str) β Redshift labels used to format the input file name. Each value replaces the {} placeholder in path, generating one input file per redshift. If no labels are provided, path is assumed to be already complete.
- Returns:
results β Dictionary containing the 2d polar 2PCF for each redshift bin pair. Keys are tuples of the form
("SPE", "SPE", i, j). For diagonal pairs (i == j) the value is a PowerSpectrumMultipoles instance read from the corresponding FITS file, while off-diagonal entries are set toNone.- Return type:
dict[_DictKey, Optional[TwoPointCorrelationPolar]]
euclidlib._util β Internal utilities#
Module for internal utility functions.
- euclidlib._util.writer(func: Any) Callable[[AnyT], AnyT]#
Decorator for writer functions.