zeus21.bursty_sfh ================= .. py:module:: zeus21.bursty_sfh .. autoapi-nested-parse:: Compute Star Formation Histories with Burstiness. 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.bursty_sfh.SFH_class Module Contents --------------- .. py:class:: SFH_class(UserParams, CosmoParams, AstroParams, HMFinterp, tage, zobs, z_Init=None, SFRD_Init=None) Star formation histories (SFHs) with stochastic burstiness for Pop II galaxies. Computes the SFR(t) of a galaxy in a halo of mass Mh, including a power-spectral-density (PSD) model for log-normal SFR fluctuations (damped random walk in ln SFR). See 2601.07912 for the burstiness model. Only Pop II is currently supported; Pop III raises a ValueError. :param UserParams: Global run settings. :type UserParams: User_Parameters :param CosmoParams: Cosmological parameters, including tageofzMyr and zfoftageMyr. :type CosmoParams: Cosmo_Parameters :param AstroParams: Astrophysical parameters. Key attributes used here: - USE_POPIII : bool — if True, raises ValueError (not implemented). - FLAG_COMPARE_BAGPIPES : bool — use a toy exponential SFH for comparison with BAGPIPES fits instead of the full model. - FLAG_RENORMALIZE_AVG_SFH : bool — if True, boosts mean SFR by exp(σ²/2) to account for log-normal stochasticity (). - sigmaPSD, dsigmaPSDdlog10Mh : PSD amplitude and its mass slope. - tauPSD, dlog10tauPSDdlog10Mh : PSD timescale (Myr) and mass slope. - _minsigmaPSD, _maxsigmaPSD, _mintauPSD, _maxtauPSD : clamp limits. - _omegamin, _omegamax : frequency integration range (1/Myr). - _dt_FFT, _N_FFT : time resolution (Myr) and number of points for FFT. - epsstar, dlog10epsstardz, _zpivot, Mc, alphastar, betastar, fstarmax, mean_SFR_normalization : star-formation efficiency params. :type AstroParams: Astro_Parameters :param HMFinterp: Halo mass function interpolator; must expose Mhtab. :type HMFinterp: HMF_interpolator :param tage: Lookback time(s) in Myr at which to evaluate the SFH. :type tage: float or array-like :param zobs: Observed redshift. :type zobs: float :param z_Init: Initialisation redshift for the SFRD. Computed via Z_init if not given. :type z_Init: float, optional :param SFRD_Init: Pre-computed SFRD object. Constructed internally if not given. :type SFRD_Init: SFRD_class, optional .. attribute:: SFH_II Pop II star formation rate in M☉ yr⁻¹ as a function of halo mass and lookback time. :type: ndarray, shape (NMh, Ntage) .. py:attribute:: SFH_II .. py:method:: SFH(CosmoParams, AstroParams, HMFinterp, SFRD_Init, tage, zobs, pop) Compute the star formation history at a set of lookback times. Reconstructs halo mass history assuming exponential accretion, then multiplies the mass accretion rate by the stellar efficiency fstar(z, Mh). Optionally renormalises the mean SFR to account for log-normal scatter (see FLAG_RENORMALIZE_AVG_SFH). :param CosmoParams: :type CosmoParams: Cosmo_Parameters :param AstroParams: :type AstroParams: Astro_Parameters :param HMFinterp: :type HMFinterp: HMF_interpolator :param SFRD_Init: :type SFRD_Init: SFRD_class :param tage: Lookback times in Myr relative to zobs. :type tage: float or array-like :param zobs: Observed redshift. :type zobs: float :param pop: Stellar population. Only Pop II (2) is implemented. :type pop: {2} :returns: SFR in M☉ yr⁻¹ at each (halo mass, lookback time). :rtype: ndarray, shape (NMh, Ntage) .. py:method:: fstarofz_scaled_Mz(AstroParams, CosmoParams, SFRD_Init, z, Mhlist, pop) Factorized approximation to fstar(z, Mh) over a 2-D (Mh, z) grid. Computes fstar(Mh, z) ≈ fstar(Mh, z0) · (Mh / Mh0)^α, separating the mass and redshift dependences. This avoids evaluating fstar_ofz on the full NMh × Nz array; it is exact for Mh < Mc and any residual offset is absorbed into β*. Only valid under exponential accretion. Use with care if the accretion history deviates strongly from exponential. :param AstroParams: :type AstroParams: Astro_Parameters :param CosmoParams: :type CosmoParams: Cosmo_Parameters :param SFRD_Init: :type SFRD_Init: SFRD_class :param z: Redshift array (z[0] is used as the reference epoch). :type z: array-like, shape (Nz,) :param Mhlist: Halo mass grid at each redshift step. :type Mhlist: ndarray, shape (NMh, Nz) :param pop: Stellar population. :type pop: {2} :returns: Approximate fstar values over the full (Mh, z) grid. :rtype: ndarray, shape (NMh, Nz) .. py:method:: sigmaPSD_at_Mh(AstroParams, Mh) PSD amplitude σ(Mh) for the ln SFR damped random walk. Linear in log10(Mh), clamped to [_minsigmaPSD, _maxsigmaPSD]. To convert to log10(SFR) units, multiply by log(10). :param AstroParams: :type AstroParams: Astro_Parameters :param Mh: Halo mass(es) in M☉. :type Mh: float or array-like :returns: σ in units of ln SFR, same shape as Mh. :rtype: ndarray .. py:method:: tauPSD_at_Mh(AstroParams, Mh) PSD correlation timescale τ(Mh) for the ln SFR damped random walk. Power-law in Mh, clamped to [_mintauPSD, _maxtauPSD]. :param AstroParams: :type AstroParams: Astro_Parameters :param Mh: Halo mass(es) in M☉. :type Mh: float or array-like :returns: τ in Myr, same shape as Mh. :rtype: ndarray .. py:method:: PowerlnSFR(AstroParams, omega, Mh) Power spectrum of ln SFR under a damped (α=2) random walk model. P(ω, Mh) = σ²(Mh) · τ(Mh) / [1 + (ω τ)²] As in 2601.07912. Note that compared to other refs (eg 2410.21409) we do not have an implicit factor of 1 Myr in the amplitude; σ here is in ln SFR units; can convert by sigma->sigma*np.log(10) Index for random walk us alpha = 2 by default, can be enhanced to modify. :param AstroParams: :type AstroParams: Astro_Parameters :param omega: Angular frequency in Myr⁻¹. :type omega: float or array-like, shape (Nω,) :param Mh: Halo mass(es) in M☉. :type Mh: float or array-like, shape (NMh,) :returns: Power spectrum in (ln SFR)² Myr. :rtype: ndarray, shape (NMh, Nω) .. py:method:: Wink_TH(omega, T) Top-hat temporal window function in Fourier space. W(ω, T) = sinc(ωT/2) = sin(ωT/2) / (ωT/2) Used to compute the variance of ln SFR averaged over a timescale T. A small offset (1e-16) is added to the argument to avoid 0/0 at ω=0. :param omega: Angular frequency in Myr⁻¹. :type omega: array-like :param T: Averaging timescale in Myr. :type T: float :returns: Dimensionless window, same shape as omega. Equals 1 at ω→0. :rtype: ndarray .. py:method:: Variance_of_lnSFR(AstroParams, T, Mh) Variance of ln SFR averaged over a timescale T. Var[ln SFR]_T = (2/2π) ∫ P(ω) |W(ω,T)|² dω The factor 2/(2π) converts the one-sided integral over positive ω to the full two-sided variance. :param AstroParams: :type AstroParams: Astro_Parameters :param T: Averaging timescale in Myr. Use T=0 for the unsmoothed variance (integrates over all frequencies). :type T: float :param Mh: Halo mass(es) in M☉. :type Mh: float or array-like :returns: Variance in (ln SFR)², same shape as Mh. :rtype: ndarray .. py:method:: WindowFourier(CosmoParams, AstroParams, HMFinterp, SFRD_Init, GreensFunction, zobs, tage, pop) Fourier transform of the convolution G(t) * SFH(t). Computes W̃(ω, Mh) = FFT[ G(t) · SFH(t) ], where G is a Green's function (e.g. Greens_function_LUV) and SFH(t) is the star formation history. The result enters the luminosity power spectrum as P_L(ω) = |W̃(ω)|² · P_SFR(ω). :param CosmoParams: :type CosmoParams: Cosmo_Parameters :param AstroParams: Must expose: _dt_FFT, _N_FFT. :type AstroParams: Astro_Parameters :param HMFinterp: :type HMFinterp: HMF_interpolator :param SFRD_Init: :type SFRD_Init: SFRD_class :param GreensFunction: A function with signature ``G(AstroParams, tage_Myr, Mhtab)`` returning an array of shape (NMh, Nt) in erg s⁻¹ M☉⁻¹. Typically one of the Greens_function_L* functions from sed.py. :type GreensFunction: callable :param zobs: Observed redshift. :type zobs: float :param tage: Maximum lookback time in Myr (sets the FFT window). :type tage: float :param pop: Stellar population. :type pop: {2} :returns: * **omegalist** (*ndarray, shape (Nfft//2 + 1,)*) -- Angular frequencies in Myr⁻¹. * **windowFourier** (*ndarray, shape (NMh, Nfft//2 + 1)*) -- Complex Fourier transform of G·SFH in erg s⁻¹ M☉⁻¹ Myr. .. rubric:: Notes SFH is converted from M☉ yr⁻¹ to M☉ Myr⁻¹ (×10⁶) before the FFT so that the output is in consistent Myr-based units.