.. _physics-powerSpectrumWindowFunction: Power Spectrum Window Functions =============================== Class providing window functions :math:`W(k, M)` for filtering the matter power spectrum when computing the rms mass variance :math:`\sigma(M) = \int \mathrm{d}k\, k^2 P(k) |W(k,M)|^2`. The window function smooths the density field on the scale enclosing mass :math:`M`, and the choice of window (e.g.\ real-space top-hat, sharp :math:`k`-space, or Gaussian) affects the resulting mass function. Methods return the filter value at a given wavenumber and smoothing mass, and indicate the maximum relevant wavenumber and whether the amplitude is mass-independent. **Default implementation:** ``powerSpectrumWindowFunctionTopHat`` Methods ------- ``value`` → ``double precision`` Returns the window function for power spectrum variance computation at the specified ``wavenumber`` (in Mpc\ :math:`^{-1}`) for a given ``smoothingMass`` (in :math:`\mathrm{M}_\odot`). * ``double precision, intent(in ) :: wavenumber, smoothingMass, time`` ``wavenumberMaximum`` → ``double precision`` Returns the maximum wavenumber for which the window function for power spectrum variance computation is non-zero for a given ``smoothingMass`` (in :math:`\mathrm{M}_\odot`). * ``double precision, intent(in ) :: smoothingMass`` ``amplitudeIsMassIndependent`` → ``logical`` Should return true if, and only if, the amplitude of the window function below the maximum wavenumber is independent of the smoothing mass scale. .. _physics-powerSpectrumWindowFunctionETHOS: ``powerSpectrumWindowFunctionETHOS`` ------------------------------------ ETHOS window function for filtering of power spectra from :cite:t:`bohr_halo_2021`. This window function was chosen to give good matches to N-body halo mass functions derived from the ETHOS transfer functions. Specifically the window function is given by: .. math:: W(kR) = \frac{1}{1+\left(\frac{kR}{c_\mathrm{W}}\right)^\beta} with defaults of :math:`c_\mathrm{W} = 3.78062835`, :math:`\beta = 3.4638743`, where :math:`R` is related to :math:`M` via the standard relation :math:`M = \frac{4\pi}{3}\bar\rho_m R^3`. **Methods** * ``tabulate`` — Tabulate the virial density contrast as a function of mass and time. * ``restoreTable`` — Restore a tabulated solution from file. * ``storeTable`` — Store a tabulated solution to file. **Parameters** * ``[cW]`` (real; default ``3.78062835d0``) — The parameter :math:`c_\mathrm{W}` in the :cite:t:`bohr_halo_2021` power spectrum window function. * ``[beta]`` (real; default ``3.4638743d0``) — The parameter :math:`\beta` in the :cite:t:`bohr_halo_2021` power spectrum window function. .. _physics-powerSpectrumWindowFunctionETHOSExtended: ``powerSpectrumWindowFunctionETHOSExtended`` -------------------------------------------- A generalization of the ETHOS window function for filtering of power spectra from :cite:t:`bohr_halo_2021`. The window function has the same functional form .. math:: W(kR) = \left\{ \begin{array}{ll} 1 & \hbox{if } \frac{kR}{c_\mathrm{W}} < x_\mathrm{min} \\ \frac{1}{1+ \left(\frac{kR}{c_\mathrm{W}} - x_\mathrm{min}\right)^\beta} & \hbox{otherwise,} \end{array} \right. but the parameters :math:`c_\mathrm{W}` and :math:`\beta` are now scale dependent following .. math:: x = x_0 x_1^{n-n_0} where :math:`x` refers to either :math:`c_\mathrm{W}` or :math:`\beta`, :math:`n = \mathrm{d}\log P / \mathrm{d} \log k` is the logarithmic derivative of the linear theory power spectrum, and :math:`n_0 = -2.6` is a convenient zero-point. **Methods** * ``powerSpectrumSlopeSmoothed`` — Compute the slope of the smoothed power spectrum. **Parameters** * ``[cW0]`` (real; default ``3.78062835d0``) — The parameter :math:`c_\mathrm{W,0}` in the generalized ETHOS power spectrum window function. * ``[beta0]`` (real; default ``3.4638743d0``) — The parameter :math:`\beta_0` in the generalized ETHOS power spectrum window function. * ``[cW1]`` (real; default ``0.0d0``) — The parameter :math:`c_\mathrm{W,1}` in the generalized ETHOS power spectrum window function. * ``[beta1]`` (real; default ``0.0d0``) — The parameter :math:`\beta_1` in the generalized ETHOS power spectrum window function. * ``[wavenumberScaledMinimum]`` (real; default ``0.0d0``) — The parameter :math:`x_\mathrm{min}` in the generalized ETHOS power spectrum window function. * ``[powerSpectrumSmoothingWidth]`` (real; default ``1.0d0``) — The width (in natural logarithm of wavenumber) over which to smooth the power spectrum when estimating the power spectrum slope. * ``[cW]`` (real; default ``3.78062835d0``) — The parameter :math:`c_\mathrm{W}` in the :cite:t:`bohr_halo_2021` power spectrum window function. *(inherited from* ``powerSpectrumWindowFunctionETHOS``\ *)* * ``[beta]`` (real; default ``3.4638743d0``) — The parameter :math:`\beta` in the :cite:t:`bohr_halo_2021` power spectrum window function. *(inherited from* ``powerSpectrumWindowFunctionETHOS``\ *)* .. _physics-powerSpectrumWindowFunctionHyperbolicTangent: ``powerSpectrumWindowFunctionHyperbolicTangent`` ------------------------------------------------ A hyperbolic tangent window function for filtering of power spectra. The window function is given by: .. math:: W(k) = \tanh \left[ \frac{1}{(k R/c)^{\beta}} \right], where :math:`R` is related to :math:`M` via the standard relation :math:`M = \frac{4\pi}{3}\bar\rho_m R^3`. **Parameters** * ``[c]`` (real; default ``1.85d0``) — The parameter :math:`c` in the hyperbolic tangent power spectrum window function. * ``[beta]`` (real; default ``4.41d0``) — The parameter :math:`\beta` in the tangent power power spectrum window function. .. _physics-powerSpectrumWindowFunctionLagrangianChan2017: ``powerSpectrumWindowFunctionLagrangianChan2017`` ------------------------------------------------- A power spectrum window function class that implements the Lagrangian filter of :cite:t:`chan_effective_2017`, which provides a smoothed transition in Fourier space designed to match the effective filtering of matter fields in Lagrangian perturbation theory. The scale of the embedded Gaussian window is controlled by the parameter :math:`f` given by ``[f]``. **Parameters** * ``[f]`` (real; default ``1.0d0``) — The parameter ":math:`f`" which defines the scale of the Gaussian window. .. _physics-powerSpectrumWindowFunctionSharpKSpace: ``powerSpectrumWindowFunctionSharpKSpace`` ------------------------------------------ A sharp :math:`k`-space window function for filtering of power spectra. The window function is given by: .. math:: W(k) = \left\{ \begin{array}{ll} 1 & \hbox{if } k < k_\mathrm{s} \\ 0 & \hbox{if } k > k_\mathrm{s}, \end{array} \right. where if ``[normalization]``\ :math:`=`\ ``natural`` then :math:`k_\mathrm{s} = (6 \Pi^2 \bar{\rho} / M)^{1/3}` for a smoothing scale :math:`M` and mean matter density :math:`\bar{\rho}`. Otherwise, ``[normalization]`` must be set to a numerical value, :math:`\alpha`, in which case :math:`k_\mathrm{s} = \alpha / R_\mathrm{th}` with :math:`R_\mathrm{th}=3M/4\pi\bar{\rho}` for a smoothing scale :math:`M` and mean matter density :math:`\bar{\rho}`. **Parameters** * ``[normalization]`` (string; default ``natural``) — The parameter :math:`a` in the relation :math:`k_\mathrm{s} = a/r_\mathrm{s}`, where :math:`k_\mathrm{s}` is the cut-off wavenumber for the sharp :math:`k`-space window function and :math:`r_\mathrm{s}` is the radius of a sphere (in real-space) enclosing the requested smoothing mass. Alternatively, a value of ``natural`` will be supplied in which case the normalization is chosen such that, in real-space, :math:`W(r=0)=1`. This results in a contained mass of :math:`M=6 \pi^2 \bar{\rho} k_\mathrm{s}^{-3}`. .. _physics-powerSpectrumWindowFunctionSmoothKSpace: ``powerSpectrumWindowFunctionSmoothKSpace`` ------------------------------------------- A smooth window function for filtering of power spectra in wavenumber space, defined as :math:`W(kR) = 1/[1+(kR)^\beta]`, providing a tunable, sharp-but-smooth transition between large and small scales. The shape exponent :math:`\beta` and normalization relative to a top-hat filter are set by ``[beta]`` and ``[normalization]``. **Parameters** * ``[normalization]`` (real; default ``3.5d0``) — The parameter "normalization" is equivalent to the normalization for a sharp-:math:`k` filter. It serves as the ratio of mass scales of the object to the one in the spherical model: :math:`R/R_\mathrm{topHat}`. * ``[beta]`` (real; default ``3.7d0``) — The parameter "beta" is defined as the exponent of ":math:`kR`" in the denominator of the window function: :math:`W(kR)= 1/[1+(kR)^\beta]`. .. _physics-powerSpectrumWindowFunctionTopHat: ``powerSpectrumWindowFunctionTopHat`` ------------------------------------- A top-hat in real space window function for filtering of power spectra. The window function is given by: .. math:: W(k) = {3 (\sin(x)-x \cos(x)) \over x^3}, where :math:`x = k R` and :math:`R=(3M/4\pi\bar{\rho})^{1/3}` for a smoothing scale :math:`M` and mean matter density :math:`\bar{\rho}`. **(Default implementation)** .. _physics-powerSpectrumWindowFunctionTopHatGeneralized: ``powerSpectrumWindowFunctionTopHatGeneralized`` ------------------------------------------------ A generalized top-hat in real space window function for filtering of power spectra. The window function is given by :cite:p:`brown_towards_2022`: .. math:: W(k) = {3 (\sin(\mu_\mathrm{g} x)-\mu_\mathrm{g} x \cos(\mu_\mathrm{g} x)) \over \mu_\mathrm{g} x^3}, where :math:`x = k R` and :math:`R=(3M/4\pi\bar{\rho})^{1/3}` for a smoothing scale :math:`M` and mean matter density :math:`\bar{\rho}`, and :math:`\mu_\mathrm{g}` is a parameter. **Parameters** * ``[mu]`` (real) — The parameter :math:`\mu_\mathrm{g}` appearing in the generalized top-hat window function of :cite:t:`brown_towards_2022`. .. _physics-powerSpectrumWindowFunctionTopHatSharpKHybrid: ``powerSpectrumWindowFunctionTopHatSharpKHybrid`` ------------------------------------------------- A hybrid top-hat/sharp :math:`k`-space window function for filtering of power spectra. This class implements a convolution of a top-hat window function and sharp :math:`k`-space window function in :math:`k`-space: .. math:: W(k) = W_\mathrm{th}(k) W_\mathrm{s}(k), where .. math:: W(k) = {3 (\sin(x)-x \cos(x)) \over x^3}, where :math:`x = k R_\mathrm{th}`, and .. math:: W_\mathrm{s}(k) = \left\{ \begin{array}{ll} 1 & \hbox{if } k < k_\mathrm{s} \\ 0 & \hbox{if } k > k_\mathrm{s}, \end{array} \right. where :math:`k\mathrm{s} = \alpha / R_\mathrm{s}` if ``[normalization]`` is assigned a numerical value. Alternatively, if ``[normalization]``\ :math:`=`\ ``natural`` then the value of :math:`\alpha` is chosen such that :math:`k_\mathrm{s} = (6 \Pi^2 \bar{\rho}/M)^{1/3}` if :math:`R_\mathrm{s}=3M/4\pi\bar{\rho}`. The radii, :math:`R_\mathrm{th}` and :math:`R_\mathrm{s}`, are chosen such that: .. math:: R_\mathrm{th}^2 + R_\mathrm{s}^2 & = (3M/4\pi\bar{\rho})^{2/3} \\ R_\mathrm{s} & = \beta R_\mathrm{th}, where :math:`\beta=`\ ``[radiiRatio]``. **Methods** * ``radii`` — Set the radii of the components of the window function. **Parameters** * ``[normalization]`` (string; default ``natural``) — The parameter :math:`a` in the relation :math:`k_\mathrm{s} = a/r_\mathrm{s}`, where :math:`k_\mathrm{s}` is the cut-off wavenumber for the sharp :math:`k`-space window function and :math:`r_\mathrm{s}` is the radius of a sphere (in real-space) enclosing the requested smoothing mass. Alternatively, a value of ``natural`` will be supplied in which case the normalization is chosen such that, in real-space, :math:`W(r=0)=1`. This results in a contained mass of :math:`M=6 \pi^2 \bar{\rho} k_\mathrm{s}^{-3}`. * ``[radiiRatio]`` (real; default ``1.0d0``) — The parameter :math:`\beta` in the relation :math:`r_\mathrm{s}=\beta r_\mathrm{th}` between :math:`k`-space sharp and top-hat window function radii in the hybrid window function used for computing the variance in the power spectrum. .. _physics-powerSpectrumWindowFunctionTopHatSmoothed: ``powerSpectrumWindowFunctionTopHatSmoothed`` --------------------------------------------- A top-hat in real space window function for filtering of power spectra, smoothed with a Gaussian. The window function is given by: .. math:: W(k) = {3 (\sin(x)-x \cos(x)) \over x^3} \times \exp{-k^2\sigma^2 \over 2}, where :math:`x = k R` and :math:`R=(3M/4\pi\bar{\rho})^{1/3}` for a smoothing scale :math:`M` and mean matter density :math:`\bar{\rho}`. :math:`\sigma` is the width of the smoothing Gaussian in real space. This exponentially cuts off the window function at :math:`k \gg 1/\sigma`. **Parameters** * ``[sigma]`` (real; default ``3.0d0``) — The parameter ":math:`\sigma`" which defines the width of the smoothing Gaussian.