zeus21.LFs

Compute LFs given our SFR and HMF models.

Authors: zeus21 v2 collaboration - June 2026

Emily Bregou ; Hector Afonso G. Cruz ; Sarah Libanore ; Julian B. Muñoz ; Yonny Sklansky ; Emilie Thélie ; Alessandra Venditti

arXiv:2302.08506, arXiv:2306.09403, arXiv:2407.18294, Sklansky et al. (in prep)

Classes

LFbias_band_outputs

Output container for binned luminosity-function and bias results in one band.

LFbias_core_output

Output container for a single LF/bias component.

LF_class

Compute all quantities and methods associated with luminosity functions

Ha_UV_ratio

Compute the Halpha-to-UV luminosity ratio distribution.

Module Contents

class zeus21.LFs.LFbias_band_outputs(LF_Init, CosmoParams, AstroParams, HMFinterp, LFParams, which_band, vCB=None, J21LW_interp=None)[source]

Output container for binned luminosity-function and bias results in one band.

This class groups the luminosity-function outputs for a single observable band, either UV or Halpha. It stores the binning information for the selected band and the requested population components.

Parameters:
  • LF_Init (LF_class) – Parent LF object used to compute population-level LF and bias outputs.

  • CosmoParams (Cosmo_Parameters)

  • AstroParams (Astro_Parameters)

  • HMFinterp (HMF_interpolator)

  • LFParams (LF_Parameters)

  • which_band ({"UV", "Ha"}) – Which LF band to compute. “UV” uses LFParams.MUVcenters and LFParams.MUVwidths; “Ha” uses LFParams.log10LHacenters and LFParams.log10LHawidths.

  • vCB (float, None or False, optional) – Baryon-CDM relative streaming velocity used for Pop III SFR feedback. Only relevant for Pop III calculations.

  • J21LW_interp (interpolator, None or False, optional) – LW background interpolator used for Pop III SFR feedback. Only relevant for Pop III calculations.

bin_centers

Centers of the LF bins for the selected band.

Type:

array

bin_widths

Widths of the LF bins for the selected band.

Type:

array

pop2[source]

Pop II LF/bias output, if requested.

Type:

LFbias_core_output or None

pop3[source]

Pop III LF/bias output, if requested.

Type:

LFbias_core_output or None

tot[source]

Total LF/bias output, if requested.

Type:

LFbias_core_output or None

pop2 = None[source]
pop3 = None[source]
tot = None[source]
class zeus21.LFs.LFbias_core_output(LF=None, bias_num=None)[source]

Output container for a single LF/bias component.

This class stores the luminosity-function output and the corresponding bias numerator for a single component.

Parameters:
  • LF (array or None, optional) – Binned luminosity function, when computed.

  • bias_num (array or None, optional) – Numerator of the LF-weighted halo bias, when computed.

LF[source]

Binned luminosity function.

Type:

array or None

bias_num[source]

Numerator of the LF-weighted halo bias.

Type:

array or None

Properties
----------
bias[source]

LF-normalized average bias, computed as bias_num / LF. This property requires both LF and bias_num to be available.

Type:

array

Notes

Adding two LFbias_outputs objects returns a new LFbias_outputs object whose available fields are the sum of the corresponding fields. This is used to build total outputs from population-level outputs.

LF = None[source]
bias_num = None[source]
property bias[source]

Bias normalized by the LF. The raw ‘bias’ returned by the LF machinery is bias_num = b * LF.

class zeus21.LFs.LF_class(UserParams, CosmoParams, AstroParams, HMFinterp, LFParams, z_Init=None, SFRD_Init=None, SFH_Init=None, vCB=None, J21LW_interp=None)[source]

Compute all quantities and methods associated with luminosity functions

Parameters:
  • UserParams (User_Parameters)

  • CosmoParams (Cosmo_Parameters)

  • AstroParams (Astro_Parameters)

  • HMFinterp (HMF_interpolator)

  • LFParams (LF_Parameters)

  • z_Init (Z_init or None, optional) – Initial redshift matrices to be used in full-SFRD and PSD calculations. Only instantiated when a full SFRD object is required. If None (default), initialized internally.

  • SFRD_Init (SFRD_class or None, optional) – Precomputed SFRD object. Only instantiated when a full SFRD object is required i.e. for PSD calculations, and for Pop III non-PSD calculations when LW is not provided explicitly. If None (default), initialized internally.

  • SFH_Init (SFH_class or None, optional) – Precomputed SFH object to be used in PSD calculations. Only instantiated for PSD calculations. If None (default), initialized internally.

  • vCB (float, None or False, optional) – Baryon-CDM relative streaming velocity used for Pop III non-PSD SFR feedback. If None (default), cosmological mean from CosmoParams is used. False to fully disable streaming velocity feedback.

  • J21LW_interp (interpolator, None or False, optional) – LW background interpolator as a function of redshift used for Pop III SFR feedback. If None (default), the converged background from SFRD_Init is used. False to fully disable LW feedback.

z_Init

Initial redshift matrices used by full-SFRD and PSD calculations, when initialized.

Type:

Z_init class

SFRD_Init

Full or lightweight SFRD object used to evaluate SFRs and, when available, self-consistent LW backgrounds.

Type:

SFRD_class

SFH_Init

SFH object used for PSD-based observables.

Type:

SFH_class

DZ_TOINT

Redshift offsets, in units of LFParams.zwidth, used to average the HMF over the redshift bin.

Type:

array

WEIGHTS_TOINT[source]

Gaussian weights associated with DZ_TOINT.

Type:

array

biasM

Tinker halo bias evaluated at the redshift samples used for the LF bin. Only defined when bias is requested as an output in LFParams.

Type:

array

UV

UV luminosity-function and bias output containter object, when requested by LFParams.FLAG_COMPUTE_UVLF.

Type:

LFbias_band_outputs

Ha

Halpha luminosity-function and bias output container object, when requested by LFParams.FLAG_COMPUTE_HaLF.

Type:

LFbias_band_outputs

WEIGHTS_TOINT[source]
Hz_from_angstrom(wavelength=1500.0)[source]

Convert rest-frame wavelength in Angstrom to frequency in Hz.

Parameters:

wavelength (float, optional) – Rest-frame wavelength in Angstrom. Default is 1500.

Returns:

nu – Frequency in Hz.

Return type:

float

Mag_of_L_ergsHz(L)[source]

Convert specific luminosity in erg/s/Hz to AB absolute magnitude (from 1703.02913).

Parameters:

L (float or array) – Specific luminosity (L_nu) in erg/s/Hz.

Returns:

Mag – AB absolute magnitude.

Return type:

float or array

Mag_of_L_ergs(L, wavelength=1500.0)[source]

Convert specific luminosity in erg/s to AB absolute magnitude (from 1703.02913).

Parameters:
  • L (float or array) – Specific luminosity (nuL_nu) in erg/s.

  • wavelength (float, optional) – Rest-frame wavelength in Angstrom used to convert nuL_nu to L_nu. Default is 1500.

Returns:

Mag – AB absolute magnitude.

Return type:

float or array

L_ergsHz_of_Mag(Mag)[source]

Convert AB absolute magnitude to specific luminosity in erg/s/Hz (from 1703.02913).

Parameters:

Mag (float or array) – AB absolute magnitude.

Returns:

L – Specific luminosity (L_nu) in erg/s/Hz.

Return type:

float or array

L_ergs_of_Mag(Mag, wavelength=1500.0)[source]

Convert AB absolute magnitude to specific luminosity in erg/s (from 1703.02913).

Parameters:
  • Mag (float or array) – AB absolute magnitude.

  • wavelength (float, optional) – Rest-frame wavelength in Angstrom. Default is 1500.

Returns:

L – specific luminosity (nuL_nu) in erg/s.

Return type:

float or array

logorMag_of_L(L, which_band, renormalize_L, sigma=None)[source]

Convert luminosity to the LF observable coordinate (log-luminosity/magnitude). Mean luminosity can be shifted so that a lognormal scatter preserves the linear mean.

Parameters:
  • L (float or array) – Average luminosity. For which_band = “UV”, it is interpreted as specific luminosity in erg/s/Hz (L_nu). For which_band = “Ha”, it is intepreted as integrated line luminosity (L_Halpha) in erg/s.

  • which_band ({"UV", "Ha"}) – Observable band to compute.

  • renormalize_L (bool) – Whether to renormalize the linear luminosity before converting to the LF coordinate.

  • sigma (float or array, optional) – Scatter used for the renormalization. Required when renormalize_L is True.

Returns:

logL_or_mag – UV magnitude for which_band = “UV” or log10(L_Halpha) for which_band = “Ha”. Non-finite values are replaced by arbitrarily faint values.

Return type:

float or array

compute_pop_LFbias_binned(CosmoParams, AstroParams, HMFinterp, LFParams, which_band, pop, vCB=None, J21LW_interp=None)[source]

Compute a single population (Pop III or Pop II) contribution to a binned luminosity function.

Parameters:
  • CosmoParams (Cosmo_Parameters)

  • AstroParams (Astro_Parameters)

  • HMFinterp (HMF_interpolator)

  • LFParams (LF_Parameters)

  • which_band ({"UV", "Ha"}) – Which LF band to compute.

  • pop (int) – Stellar population, 2 for Pop II or 3 for Pop III.

  • vCB (float, None or False, optional) – Baryon-CDM relative streaming velocity used for Pop III non-PSD SFR feedback. If None (default), cosmological mean from CosmoParams is used. False to fully disable streaming velocity feedback.

  • J21LW_interp (interpolator, None or False, optional) – LW background interpolator as a function of redshift used for Pop III SFR feedback. If None (default), the converged background from SFRD_Init is used. False to fully disable LW feedback.

Returns:

outputs

Return type:

Same output type as returned by the core method compute_LFbias_binned_from_avgsigma

compute_LFbias_binned_from_SFRlist(SFRlist, HMFinterp, LFParams, zcenter, zwidth, logLcenters, logLwidths, kappa, sigma, renormalize_L, which_band, include_dust, computeLF, computeBias)[source]

Compute binned LF outputs from a precomputed SFR list.

Parameters:
  • SFRlist (array) – Star formation rate evaluated on HMFinterp.Mhtab.

  • HMFinterp (HMF_interpolator)

  • LFParams (LF_Parameters)

  • zcenter (float) – Redshift bin center and width.

  • zwidth (float) – Redshift bin center and width.

  • logLcenters (array) – LF bin centers and widths. These are UV magnitudes bins for which_band = “UV” and log10(L_Ha) bins for which_band = “Halpha”.

  • logLwidths (array) – LF bin centers and widths. These are UV magnitudes bins for which_band = “UV” and log10(L_Ha) bins for which_band = “Halpha”.

  • kappa (float) – SFR-to-luminosity conversion factor.

  • sigma (float or array) – Scatter in the LF observable coordinate.

  • renormalize_L (bool) – Whether to renormalize the luminosity before adding lognormal scatter to preserve the linear mean.

  • which_band ({"UV", "Ha"}) – Which LF band to compute.

  • include_dust (bool) – Whether to apply dust corrections.

  • computeLF (bool) – Select which output entries to compute.

  • computeBias (bool) – Select which output entries to compute.

Returns:

outputs

Return type:

Same output type as returned by the core method compute_LFbias_binned_from_avgsigma.

compute_LFbias_binned_from_PSD(CosmoParams, AstroParams, HMFinterp, LFParams, zcenter, zwidth, logLcenters, logLwidths, which_band, pop, include_dust, computeLF, computeBias)[source]

Compute binned LF outputs from PSD-derived observable statistics.

Parameters:
  • CosmoParams (Cosmo_Parameters)

  • AstroParams (Astro_Parameters)

  • HMFinterp (HMF_interpolator)

  • LFParams (LF_Parameters)

  • zcenter (float) – Redshift bin center and width.

  • zwidth (float) – Redshift bin center and width.

  • logLcenters (array) – LF bin centers and widths.

  • logLwidths (array) – LF bin centers and widths.

  • which_band ({"UV", "Ha"}) – Which LF band to compute.

  • pop (int) – Stellar population, 2 for Pop II or 3 for Pop III.

  • include_dust (bool) – Whether to apply dust corrections.

  • computeLF (bool) – Select which output entries to compute.

  • computeBias (bool) – Select which output entries to compute.

Returns:

outputs

Return type:

Same output type as returned by the core method compute_LFbias_binned_from_avgsigma.

compute_LFbias_binned_from_avgsigma(logL_avglist, sigma, HMFinterp, zcenter, zwidth, logLcenters, logLwidths, computeLF, computeBias)[source]

Compute LF and/or bias given the average log-luminosity/magnitude associated with each halo mass and its lognormal scatter. This is the common numerical core for LF computation, shared by the SFR-list and PSD branches: it convolves the mean LF coordinate at each halo mass with a Gaussian scatter and integrates over the HMF.

Parameters:
  • logL_avglist (array) – Mean LF coordinate (UV magnitude or log10(L_Halpha)) at each halo mass.

  • sigma (float or array) – Scatter in the same coordinate.

  • HMFinterp (HMF_interpolator)

  • zcenter (float) – Redshift bin center and width.

  • zwidth (float) – Redshift bin center and width.

  • logLcenters (array) – LF bin centers and widths.

  • logLwidths (array) – LF bin centers and widths.

  • computeLF (bool) – Select which output entries to compute.

  • computeBias (bool) – Select which output entries to compute.

Returns:

output – Output object containing LF and/or bias_num.

Return type:

LFbias_outputs

apply_dust_correction(LFParams, z, logL_or_mag, sigma, which_band)[source]

Apply dust attenuation to intrinsic LF coordinate(s) and scatter.

Parameters:
  • LFParams (LF_Parameters)

  • z (float) – Redshift.

  • logL_or_mag (array) – Intrinsic LF coordinate.

  • sigma (float or array) – Intrinsic scatter.

  • which_band ({"UV", "Ha"}) – Observable band.

Returns:

  • logL_or_mag_dust (array) – Dust-corrected observed coordinate(s).

  • sigma_dust (float or array) – Scatter after optional dust contribution.

dust_attenuation(LFParams, z, logL_or_mag, which_band)[source]

Return the mean attenuation for the requested observable. For UV, this is given as a function of OBSERVED z and magnitude. If using on theoretical intrinsice magnitudes, iterate until convergence. The LFParams.HIGH_Z_DUST flag controls whether to apply dust attenuation at higher z than 0 or set attenuation to 0. If true, fix betaUV for attenuation calculation at LFParams._zmaxdata redshift value. Halpha dust attenuation not currently implemented.

Parameters:
  • LFParams (LF_Parameters)

  • z (float) – Redshift.

  • logL_or_mag (array) – Observed LF coordinate to be dust attenuated.

  • which_band ({"UV", "Ha"}) – Observable band.

Returns:

Adust – Attenuation in magnitudes for UV. Halpha currently raises a ValueError because no calibrated model is implemented.

Return type:

array

betaUV_dust(LFParams, z, MUV)[source]

Compute the UV continuum slope used by the dust model, currently implementing Bowens+13,14 or Zhao+24 model.

Parameters:
  • LFParams (LF_Parameters)

  • z (float or array) – Redshift.

  • MUV (float or array) – UV absolute magnitude.

Returns:

beta – UV slope from the selected dust model.

Return type:

array

correct_AP_LF(z, Deltaz, CosmoParams_data, CosmoParams, logLormag_data, Phi_data, errPhi_data, errPhi_asy_data=None, which_band='UV')[source]

Corrects the observed LF from the assumed cosmology CosmoParams to another with CosmoParams_out. Note: no dust correction since it’s applied directly to theory->model

meanandsigma_observable_PSD(CosmoParams, AstroParams, HMFinterp, LFParams, GreensFunction, pop)[source]

Compute PSD-derived mean and scatter for a given observable (e.g. LUV, Ha, etc…) from the power spectrum of the SFRD.

Parameters:
Returns:

  • avgobs (array) – Mean observable at each halo mass.

  • sigmaobs (array) – Scatter of the observable at each halo mass.

sigma_MUV_from_meansandsigmas(LUV1mean, LUV2mean, sigmaLUV1, sigmaLUV2)[source]

Combine short- and long-timescale UV statistics into mean UV magnitudes and scatter. These components are considered mostly uncorrelated.

Parameters:
  • LUV1mean (array) – Mean UV luminosity components.

  • LUV2mean (array) – Mean UV luminosity components.

  • sigmaLUV1 (array) – Scatter of the UV luminosity components.

  • sigmaLUV2 (array) – Scatter of the UV luminosity components.

Returns:

  • MUV_avg (array) – Mean UV magnitude.

  • sigma_MUV (array) – UV-magnitude scatter.

class zeus21.LFs.Ha_UV_ratio(UserParams, CosmoParams, AstroParams, HMFinterp, LFParams, z_Init=None, SFRD_Init=None, SFH_Init=None, LF_Init=None)[source]

Compute the Halpha-to-UV luminosity ratio distribution.

This helper combines the UV luminosity function, Halpha luminosities and PSD-derived covariance terms to evaluate the probability distribution of log10(L_Ha / L_UV) or the equivalent xi_ion quantity.

Parameters:
PDF_log10HaUVratio(LUV_mean, LHa_mean, sigmaLHa, sigmasquaredcross, log10etavalues)[source]

Returns the PDF of log10(LHa/LUV) at fixed Mh (NOTE: integrated over all MUVs). Assumed dust corrected!

Parameters:

LUVmeanarray_like

The mean LUV value

LHa_meanarray_like

The mean LHa value

sigmaLHaarray_like

The sigma of LHa value

sigmasquaredcrossarray_like

The cross sigma squared (sigma^2) of LHa and LUV This is the covariance between LHa and LUV, computed from their window functions. From cross_sigma_squared_PSD.

Returns:

log10etavaluesndarray

The log10eta values (same for all input array elements)

PDFlog10etandarray

Array of shape (len(LUVmean), len(log10etavalues)) with PDFs

PDF_HaUV_ratio(CosmoParams, AstroParams, HMFinterp, LFParams, log10etavalues, FLAG_supersample_MUV=False)[source]

Returns Ha/UV ratio PDF, binned in MUV_bin_edges and log10eta bins, if provided.

Parameters:

AstroParams : Astro Parameters CosmoParams : Cosmo Parameters HMFinterp : HMFinterp zcenter, zwidth: the z where it is calculated (no width for now, ignored) log10etavalues: the log10(Ha/UV) ratios where the PDF is computed. Assigned by function if None FLAG_supersample_MUV : Whether to super-sample to integrate within MUV_bin_edges better. If =False then just computes at the center of each bin

Returns:

log10etavalues: bins of log10Ha/UV pdf_binned: the PDF(log10etavalues) in those log10etavalues bins, and the MUV bins chosen UVLFvalues: the UVLF at the MUV binned, so the user can sum stuff easily

log10eta_fromlog10xiion(log10xiion)[source]

Returns log10(LHa/LUV) [both in erg/s] given xiion

log10xiion_fromlog10eta(log10eta)[source]

Returns log10(xiion) [in Hz/erg] given log10(LHa/LUV) [both in erg/s]

cross_sigma_squared_PSD(GreensFunction1, GreensFunction2, CosmoParams, AstroParams, HMFinterp, LFParams)[source]

Returns the cross sigma squared of two observables, given their window functions and SFH