zeus21.sfrd =========== .. py:module:: zeus21.sfrd .. autoapi-nested-parse:: Bulk of the Zeus21 calculation. Compute SFRD from cosmology. 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 ------- .. autoapisummary:: zeus21.sfrd.Z_init zeus21.sfrd.SFRD_class zeus21.sfrd.PopIII_relvel Module Contents --------------- .. py:class:: Z_init(UserParams, CosmoParams) Initial redshift matrices for the calculation :param UserParams: :type UserParams: UserParams class :param CosmoParams: :type CosmoParams: CosmoParams class .. attribute:: dlogzint Set the log step for the redshift binning, based on the required input :type: array .. attribute:: zintegral Redshift array over which will be performed all integration and for which the output will be computed :type: array .. attribute:: zGreaterMatrix Redshift associated with the distance at radius R. Dimension (z, R) :type: matrix .. attribute:: zGreaterMatrix_nonan Redshift associated with the distance at radius R; when z > zmax_AstroBreak (50 by default in constants), we set z > 100 to prevent computing things where we don't trust the astrophysical model. Dimension (z, R) :type: matrix .. py:attribute:: dlogzint .. py:attribute:: zintegral .. py:attribute:: zGreaterMatrix .. py:attribute:: zGreaterMatrix_nonan .. py:class:: SFRD_class(UserParams, CosmoParams, AstroParams, HMFinterp, z_Init=None) Compute all quantities and methods associated with the star formation rate density and the astrophysical model :param UserParams: :type UserParams: UserParams class :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param z_Init: Initial redshift matrices for the calculation (see sfrd.py for details). Default is None. :type z_Init: Z_init class, optional .. attribute:: SFRD_II_interp Average SFRD for popII stars, interpolated over redshift. :type: interpolator .. attribute:: J_21_LW_II Lyman-Werner flux from popII stars, units of erg/s/cm^2/Hz/s, interpolated over redshift :type: interpolator .. attribute:: J21LW_interp_conv_avg Lyman-Werner flux iteratively computed to account for popIII contribution, interpolated over redshift :type: interpolator .. attribute:: SFRD_III_cnvg_interp Average SFRD for popIII stars, determines part-of and is affected by the LW flux; interpolated over redshift :type: : interpolator .. attribute:: J_21_LW_III Lyman-Werner flux, units of erg/s/cm^2/Hz/s from popIII stars, interpolated over redshift :type: interpolator .. attribute:: SFRD_II_avg Average SFRD for popII stars, units Msun/yr :type: array .. attribute:: SFRD_III_avg Average SFRD for popIII stars, units Msun/yr :type: array .. attribute:: SFRD_avg Total average SFRD, units Msun/yr :type: array .. attribute:: SFRDbar2D_II Average SFRD for popII computed at z corresponding to each shell :type: matrix .. attribute:: SFRDbar2D_III Average SFRD for popIII computed at z corresponding to each shell :type: matrix .. attribute:: fesctab_II Escape fraction for popII, z-independent, as function of the halo mass :type: array .. attribute:: fesctab_III Escape fraction for popIII, z-independent, as function of the halo mass :type: array .. attribute:: reio_integrand_II_interp Number of ionizing photons produced by popII, interpolated in redshift :type: integrand .. attribute:: reio_integrand_II_interp Number of ionizing photons produced by popIII, interpolated in redshift :type: integrand .. attribute:: niondot_avg_II Number of ionizing photons produced by popII computed at the redshifts of the analysis :type: array .. attribute:: niondot_avg_III Number of ionizing photons produced by popIII computed at the redshifts of the analysis :type: array .. attribute:: niondot_avg Number of ionizing photons produced at the redshifts of the analysis :type: array .. attribute:: sigmaofRtab Variance of the matter field on scales associated with the shells and at the observed rerdshift :type: matrix .. attribute:: Matom Minimum mass for atomic-cooling halos at given redshift :type: method .. attribute:: Mmol_0 Minimum mass for molecular halos without LW or VCB feedback :type: method .. attribute:: Mmol_vcb Minimum mass for molecular halos without LW feedback :type: method .. attribute:: Mmol_LW Minimum mass for molecular halos without VCB feedback :type: method .. attribute:: Mmol Minimum mass for molecular halos with LW and VCB feedback :type: method .. attribute:: dMh_dt Mass accretion rate, in units of M_sun/yr :type: method .. attribute:: fstar_ofz Star formation efficiency generative function :type: method .. attribute:: fduty Duty cycle to damp star formation in low- or high-mass halos or both :type: method .. attribute:: SFE_II Star formation efficiency for popII stars :type: method .. attribute:: SFE_III Star formation efficiency for popIII stars :type: method .. attribute:: SFE Total star formation efficiency :type: method .. attribute:: SFR Star formation rate :type: method .. attribute:: SRFD_integrand Integrand to compute the star formation rate density :type: method .. attribute:: J_LW_21 Mean cosmological LW background specific intensity :type: method .. attribute:: J_LW_Discrete Radial kernel of the LW specific intensity before R integration :type: method .. attribute:: dSFRDIII_dJ Response of the popIII star formation rate density to the LW background :type: method .. attribute:: fesc_II Escape fraction of ionizing photons in halos hosting popII stars :type: method .. attribute:: fesc_III Escape fraction of ionizing photons in halos hosting popIII stars :type: method .. attribute:: compute_sigmaR_nu Compute the local mass function conditioned over the environment :type: method .. attribute:: compute_gamma Compute linear and quadratic gamma exponents for the SFRD-delta (popII+popIII) and niondot-delta (only popII) lognormal approximations :type: method .. attribute:: gamma_II_index2D Linear gamma exponent for SFRD in popII :type: array .. attribute:: gamma2_II_index2D Quadratic gamma exponent for SFRD in popII :type: array .. attribute:: gamma_niondot_II_index2D Linear gamma exponent for niondot in popII :type: array .. attribute:: gamma2_niondot_II_index2D Quadratic gamma exponent for niondot in popII :type: array .. attribute:: gamma_III_index2D Linear gamma exponent for SFRD in popIII :type: array .. attribute:: gamma2_III_index2D Quadratic gamma exponent for SFRD in popIII :type: array .. attribute:: compute_numerical_der_gamma Compute first and second numerical derivatives of an array wrt the other (used for SFRD and niondot wrt delta) :type: method .. py:method:: light_init() :classmethod: .. py:attribute:: SFRD_II_interp .. py:attribute:: J_21_LW_II .. py:attribute:: SFRD_II_avg .. py:attribute:: SFRD_III_avg .. py:attribute:: SFRD_avg .. py:attribute:: SFRDbar2D_II .. py:attribute:: SFRDbar2D_III .. py:attribute:: fesctab_II .. py:attribute:: fesctab_III .. py:attribute:: reio_integrand_II_interp .. py:attribute:: reio_integrand_III_interp .. py:attribute:: niondot_avg_II .. py:attribute:: niondot_avg_III .. py:attribute:: niondot_avg .. py:method:: Matom(z) Compute minimum mass for atomic-cooling halos :param z: Redshift :type z: float :returns: **Matom** -- Minimum halo mass, in Msun :rtype: float .. py:method:: Mmol_0(z) Compute minimum mass for molecular-cooling halos without LW or VCB feedback :param z: Redshift :type z: float :returns: **Mmol_0** -- Minimum halo mass, in Msun :rtype: float .. py:method:: Mmol_vcb(CosmoParams, AstroParams, z, vCB) Compute minimum mass for molecular-cooling halos without LW feedback :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param z: Redshift :type z: float :param vCB: Baryon-DM relative velocity :type vCB: float :returns: **Mmol_vcb** -- Minimum halo mass, in Msun :rtype: float .. py:method:: Mmol_LW(AstroParams, J21LW_interp, z) Compute minimum mass for molecular halos without VCB feedback :param AstroParams: :type AstroParams: AstroParams class :param J21LWinterp: Interpolator of the LW flux, function of z :type J21LWinterp: interpolator :param z: Redshift :type z: float :returns: **Mmol_LW** -- Minimum halo mass, in Msun :rtype: float .. py:method:: Mmol(CosmoParams, AstroParams, J21LW_interp, z, vCB) Compute minimum mass for molecular halos with LW and VCB feedback :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param J21LWinterp: Interpolator of the LW flux, function of z. If False, no LW feedback. :type J21LWinterp: interpolator or False :param z: Redshift :type z: float :param vCB: Baryon-DM relative velocity. If False, no feedback from streaming velocitites. :type vCB: float or False :returns: **Mmol** -- Minimum halo mass, in Msun :rtype: float .. py:method:: dMh_dt(CosmoParams, AstroParams, HMFinterp, massVector, z) Compute halo mass accretion rate, in units of M_sun/yr :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: array :returns: **Mhdot** -- Halo mass accretion rate :rtype: array .. py:method:: fstar_ofz(CosmoParams, z, massVector, eps, dlog10eps, zpiv, Mc, alphastar, betastar, fstarmax) Compute star formation efficiency as function of z -- by changing the parameters, the user can run both popII and popIII :param CosmoParams: :type CosmoParams: CosmoParams class :param z: Redshift :type z: float :param massVector: Halo masses :type massVector: array :param eps: Star formation efficiency at pivot redshift and mass :type eps: float :param dlog10eps: Logaritmic redshift evolution :type dlog10eps: float :param zpiv: Pivot reference redshift :type zpiv: float :param Mc: Pivot reference halo mass :type Mc: float :param alphastar: Power-law coefficient :type alphastar: float :param betastar: Second power-law coefficient :type betastar: float :param fstarmax: Cap :type fstarmax: float :returns: **fstar** -- Star formation efficiency :rtype: array .. py:method:: fduty(CosmoParams, AstroParams, massVector, z, lower_cutoff=None, upper_cutoff=None, is_sharp_cutoff=False, vCB=None, J21LW_interp=None) Compute duty fraction to damp star formation :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: float :param lower_cutoff: Apply cutoff at the low-mass end; if None, no cutoff; if str == "Mmol" or "Matom", cutoff at the molecular/atomic-cooling limit respectively; if float, custom cutoff at user-provided value :type lower_cutoff: str or float or None :param upper_cutoff: Apply cutoff at the high-mass end; if None, no cutoff; if str == "Matom", cutoff at the atomic-cooling limit; if float, custom cutoff at user-provided value :type upper_cutoff: str or float or None :param is_sharp_cutoff: If true, apply sharp cutoff; exponential cutoff otherwise :type is_sharp_cutoff: bool :param vCB: Baryon-DM relative velocity (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type vCB: float or None :param J21LW_interp: Interpolator of the LW flux, function of z (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type J21LW_interp: interpolator or None :returns: **fduty** -- Duty cycle :rtype: array .. py:method:: SFE_II(CosmoParams, AstroParams, massVector, z) Star formation efficiency for popII stars :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: float :returns: **SFE** -- Star formation efficiency :rtype: array .. py:method:: SFE_III(CosmoParams, AstroParams, massVector, z, vCB, J21LW_interp) Star formation efficiency for popIII stars. By default, this computes a single main Pop III component with a low-mass cutoff at the molecular-cooling limit and a user-controlled high-mass cutoff Mup_III. Setting Mup_III="Matom" (default) in the AstroParams recovers standard minihalo-only behavior, with high-mass cutoff at the atomic-cooling limit. If AstroParams.DETACH_III_ACH is True, main component is forced to stop at the atomic-cooling limit and a detached atomic-cooling-halo component with independent parameters is added between Matom and Mup_III. :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: float :param vCB: Baryon-DM relative velocity :type vCB: float or None :param J21LW_interp: Interpolator of the LW flux, function of z :type J21LW_interp: interpolator or None :returns: **SFE_tot** -- Star formation efficiency :rtype: array .. py:method:: SFE(CosmoParams, AstroParams, massVector, z, pop, vCB=None, J21LW_interp=None) Total star formation efficiency :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: float :param pop: Which population (2 for popII or 3 for popIII) :type pop: int :param vCB: Baryon-DM relative velocity (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type vCB: float or None :param J21LW_interp: Interpolator of the LW flux, function of z (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type J21LW_interp: interpolator or None :returns: **SFE** -- Star formation efficiency for the input population :rtype: array .. py:method:: SFR(CosmoParams, AstroParams, HMFinterp, massVector, z, pop, vCB=None, J21LW_interp=None) Star formation rate in Msun/yr for given population :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: float :param pop: Which population (2 for popII or 3 for popIII) :type pop: int :param vCB: Baryon-DM relative velocity (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type vCB: float or None :param J21LW_interp: Interpolator of the LW flux, function of z (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type J21LW_interp: interpolator or None :returns: **SFR** -- Star formation rate :rtype: array .. py:method:: SFRD_integrand(CosmoParams, AstroParams, HMFinterp, massVector, z, pop, vCB=None, J21LW_interp=None) Integrand for the star formation rate density for a given population :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param massVector: Halo masses :type massVector: array :param z: Redshift :type z: float :param pop: Which population (2 for popII or 3 for popIII) :type pop: int :param vCB: Baryon-DM relative velocity (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type vCB: float or None :param J21LW_interp: Interpolator of the LW flux, function of z (None by default: only matters for molecular-cooling limit computation for Pop IIIs) :type J21LW_interp: interpolator or None :returns: **integrand** -- Integrand to be used in the main class :rtype: array .. py:method:: J_LW_21(CosmoParams, AstroParams, sfrdIter, z, pop) Mean background specific intensity, units of erg/s/cm^2/Hz/sr :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param sfrdIter: Star formation rate density :type sfrdIter: array :param z: Redshift :type z: float :param pop: Which population (2 for popII or 3 for popIII) :type pop: int :returns: **JW** -- LW specific intensity :rtype: array .. py:method:: J_LW_Discrete(CosmoParams, AstroParams, z, pop, rGreater, SFRD_interp_input) Radial kernel of the LW specific intensity before R integration, units of erg/s/cm^2/Hz/sr :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param z: Redshift :type z: float or array :param pop: Which population (2 for popII or 3 for popIII) :type pop: int :param rGreater: Radii :type rGreater: matrix :param SFRD_interp_input: Interpolator for the star formation rate density in redshift :type SFRD_interp_input: interpolator :returns: **RK** -- Radial kernel of the LW specific intensity :rtype: array .. py:method:: dSFRDIII_dJ(CosmoParams, AstroParams, HMFinterp, z, vCB, J21LW_interp) Response of the popIII star formation rate density to the LW background :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param z: Redshift :type z: float :param vCB: Include contribution from baryon-CDM relative velocity (popIII) or not (popII) :type vCB: bool :param J21LW_interp: Include contribution from LW feedback (popIII) or not (popII) :type J21LW_interp: bool :returns: **integral** -- Response integrated over the mass array :rtype: array .. py:method:: fesc_II(AstroParams, Mh) Escape fraction of ionizing photons in halos hosting popII stars :param AstroParams: :type AstroParams: AstroParams class :param Mh: Halo masses :type Mh: array :returns: **fesc** -- Escape fraction :rtype: array .. py:method:: fesc_III(AstroParams, Mh) Escape fraction of ionizing photons in halos hosting popIII stars :param AstroParams: :type AstroParams: AstroParams class :param Mh: Halo masses :type Mh: array :returns: **fesc** -- Escape fraction :rtype: array .. py:method:: compute_sigmaR_nu(CosmoParams, HMFinterp, z_array, R_array, Mh_array, dorv_array, dorv) Compute the local mass function conditioned over the environment :param CosmoParams: :type CosmoParams: CosmoParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param z_array: Redshifts :type z_array: array :param R_array: Shell radii :type R_array: array :param Mh_array: Halo masses :type Mh_array: array :param dorv_array: Input values of either the denisty or velocity field :type dorv_array: array :param dorv: Compute the output wrt the density field ("delta") or the velocity field ("vel") :type dorv: str :returns: * **HMF_corr** (*array*) -- Local HMF in Eulerian space * **mArray** (*array*) -- Halo masses, dimension (z,R,Mh,delta or v) * **zGreaterArray** (*array*) -- Redshifts of the sources, dimension (z,R,Mh,delta or v) * **out** (*array*) -- Either delta_R (if dorv == delta) or velocity, dimension (z,R,Mh,delta or v) .. py:method:: compute_gamma(CosmoParams, AstroParams, HMFinterp, z_array, R_array, Mh_array, input_sigmaofRtab, fesctab_II) Compute linear and quadratic gamma exponents for the SFRD-delta (popII+popIII) and niondot-delta (onlypopII) lognormal approximations :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param z_array: Redshifts :type z_array: array :param R_array: Shell radii :type R_array: array r :param Mh_array: Halo masses :type Mh_array: array :param input_sigmaofRtab: Variance of the matter field smoothed over R :type input_sigmaofRtab: array :param fesctab_II: Escape fraction for popII stars :rtype: Empty .. py:method:: compute_numerical_der_gamma(arr1, arr2, order) Compute first and second numerical derivatives of arr1 wrt arr2 :param arr1: Quantity to be derived :type arr1: array :param arr2: Quantity to perform the numerical derivative :type arr2: array :param order: Compute either first (1) or second (2) order derivative :type order: int :returns: **darr1_darr2** -- Numerical derivative :rtype: array .. py:class:: PopIII_relvel(UserParams, CosmoParams, AstroParams, HMFinterp, z_Init=None, SFRD_Init=None) Pre-compute velocity–dependent Pop III star formation suppression (see sec 4A in arXiv:2407.18294) :param UserParams: :type UserParams: UserParams class :param CosmoParams: :type CosmoParams: CosmoParams class :param AstroParams: :type AstroParams: AstroParams class :param HMFinterp: :type HMFinterp: HMFinterp class :param z_Init: Initial redshift matrices for the calculation (see sfrd.py for details). Default is None. :type z_Init: Z_init class, optional :param SFRD_Init: Initial star formation rate density for the calculation (see sfrd.py for details). Default is None. :type SFRD_Init: SFRD_class class, optional .. attribute:: vcb_expFitParams Coefficients to approximate SFRD(vCB) / SFRD :type: float