From 98eb08f706b0f3012d8d3bb73b819739db48c97e Mon Sep 17 00:00:00 2001 From: Nicolas Tessore Date: Tue, 19 Mar 2024 20:44:03 +0000 Subject: [PATCH 1/4] rebased onto current main --- glass/galaxies.py | 102 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/glass/galaxies.py b/glass/galaxies.py index 2d0bc244..c8128f5a 100644 --- a/glass/galaxies.py +++ b/glass/galaxies.py @@ -17,6 +17,11 @@ .. autofunction:: galaxy_shear .. autofunction:: gaussian_phz + +Intrinsic alignments +-------------------- +.. autofunction:: kappa_ia_nla + ''' from __future__ import annotations @@ -253,3 +258,100 @@ def gaussian_phz(z: ArrayLike, sigma_0: float | ArrayLike, *, trunc = trunc[(znew < lower) | (znew > upper)] return zphot + + +def kappa_ia_nla(delta, zeff, a_ia, cosmo, *, z0=0., eta=0., lbar=0., + l0=1e-9, beta=0.): + r'''Effective convergence from intrinsic alignments using the NLA + model. + + Parameters + ---------- + delta : array_like + Matter density contrast. + zeff : float + Effective redshift of the matter field. + a_ia : float + Intrinsic alignments amplitude. + cosmo : Cosmology + Cosmology instance. + + Returns + ------- + kappa_ia : array_like + Effective convergence due to intrinsic alignments. + + Other Parameters + ---------------- + z0 : float, optional + Reference redshift for the redshift dependence (default: 0). + eta : float, optional + Power of the redshift dependence (default: 0). + lbar : float, optional + Mean luminosity of the galaxy sample (default: 0). + l0 : float, optional + Reference luminosity for the luminosity dependence (default: + ``1e-09``). + beta : float, optional + Power of the luminosity dependence (default: 0). + + Notes + ----- + The Non-linear Alignments Model (NLA) describes an effective + convergence :math:`\kappa_{\rm IA}` that models the effect of + intrinsic alignments. It is computed from the matter density + contrast :math:`\delta` as [1]_ [3]_ + + .. math:: + + \kappa_{\rm IA} = f_{\rm NLA} \, \delta \;, + + where the NLA factor :math:`f_{\rm NLA}` is defined as [4]_ [5]_ + + .. math:: + + f_{\rm{NLA}} + = -A_{\rm IA} \, \frac{C_1 \, \bar{\rho}(z)}{D(z)} \, + \biggl(\frac{1+z}{1+z_0}\biggr)^\eta \, + \biggl(\frac{\bar{L}}{L_0}\biggr)^\beta \;, + + with + + * :math:`A_{\rm IA}` the intrinsic alignments amplitude, + * :math:`C_1` a normalisation constant [2]_, + * :math:`z` the effective redshift of the model, + * :math:`\bar{\rho}` the mean matter density, + * :math:`D` the growth factor, + * :math:`\eta` the power that describes the redshift-dependence with + respect to :math:`z_0`, + * :math:`\bar{L}` the mean luminosity of the galaxy sample, and + * :math:`\beta` the power that describes the luminosity-dependence + :math:`\bar{L}` with respect to :math:`L_0`. + + References + ---------- + .. [1] Catelan P., Kamionkowski M., Blandford R. D., 2001, MNRAS, + 320, L7. doi:10.1046/j.1365-8711.2001.04105.x + .. [2] Hirata C. M., Seljak U., 2004, PhRvD, 70, 063526. + doi:10.1103/PhysRevD.70.063526 + .. [3] Bridle S., King L., 2007, NJPh, 9, 444. + doi:10.1088/1367-2630/9/12/444 + .. [4] Jeffrey N., Alsing J., Lanusse F., 2021, MNRAS, 501, 954. + doi:10.1093/mnras/staa3594 + .. [5] Tessore, N., Loureiro, A., Joachimi, B., et al., 2023, + arXiv:2302.01942. doi:10.48550/arXiv.2302.01942 + + ''' + + c1 = 5e-14/cosmo.h**2 # Solar masses per cubic Mpc + rho_c1 = c1*cosmo.rho_c0 + + prefactor = - a_ia * rho_c1 * cosmo.Om + inverse_linear_growth = 1./cosmo.gf(zeff) + redshift_dependence = ((1+zeff)/(1+z0))**eta + luminosity_dependence = (lbar/l0)**beta + + f_nla = prefactor * inverse_linear_growth * redshift_dependence \ + * luminosity_dependence + + return delta * f_nla From 626bdc35fbead327864da6e6ecd45b07f085ed1f Mon Sep 17 00:00:00 2001 From: mwiet Date: Fri, 17 May 2024 17:13:26 +0100 Subject: [PATCH 2/4] Updated references --- glass/galaxies.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glass/galaxies.py b/glass/galaxies.py index c8128f5a..898e646c 100644 --- a/glass/galaxies.py +++ b/glass/galaxies.py @@ -336,10 +336,10 @@ def kappa_ia_nla(delta, zeff, a_ia, cosmo, *, z0=0., eta=0., lbar=0., doi:10.1103/PhysRevD.70.063526 .. [3] Bridle S., King L., 2007, NJPh, 9, 444. doi:10.1088/1367-2630/9/12/444 - .. [4] Jeffrey N., Alsing J., Lanusse F., 2021, MNRAS, 501, 954. - doi:10.1093/mnras/staa3594 + .. [4] Johnston, H., Georgiou, C., Joachimi, B., et al., 2019, + A&A, 624, A30. doi:10.1051/0004-6361/201834714 .. [5] Tessore, N., Loureiro, A., Joachimi, B., et al., 2023, - arXiv:2302.01942. doi:10.48550/arXiv.2302.01942 + OJAp, 6, 11. doi:10.21105/astro.2302.01942 ''' From 89645db510812834238a9dcd4c92892eb21d1bd8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:14:45 +0000 Subject: [PATCH 3/4] STY: pre-commit fixes --- glass/galaxies.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/glass/galaxies.py b/glass/galaxies.py index 9e75df13..e66a7baa 100644 --- a/glass/galaxies.py +++ b/glass/galaxies.py @@ -284,9 +284,11 @@ def gaussian_phz( return zphot -def kappa_ia_nla(delta, zeff, a_ia, cosmo, *, z0=0., eta=0., lbar=0., - l0=1e-9, beta=0.): - r'''Effective convergence from intrinsic alignments using the NLA +def kappa_ia_nla( + delta, zeff, a_ia, cosmo, *, z0=0.0, eta=0.0, lbar=0.0, l0=1e-9, beta=0.0 +): + r""" + Effective convergence from intrinsic alignments using the NLA model. Parameters @@ -365,17 +367,17 @@ def kappa_ia_nla(delta, zeff, a_ia, cosmo, *, z0=0., eta=0., lbar=0., .. [5] Tessore, N., Loureiro, A., Joachimi, B., et al., 2023, OJAp, 6, 11. doi:10.21105/astro.2302.01942 - ''' - - c1 = 5e-14/cosmo.h**2 # Solar masses per cubic Mpc - rho_c1 = c1*cosmo.rho_c0 + """ + c1 = 5e-14 / cosmo.h**2 # Solar masses per cubic Mpc + rho_c1 = c1 * cosmo.rho_c0 - prefactor = - a_ia * rho_c1 * cosmo.Om - inverse_linear_growth = 1./cosmo.gf(zeff) - redshift_dependence = ((1+zeff)/(1+z0))**eta - luminosity_dependence = (lbar/l0)**beta + prefactor = -a_ia * rho_c1 * cosmo.Om + inverse_linear_growth = 1.0 / cosmo.gf(zeff) + redshift_dependence = ((1 + zeff) / (1 + z0)) ** eta + luminosity_dependence = (lbar / l0) ** beta - f_nla = prefactor * inverse_linear_growth * redshift_dependence \ - * luminosity_dependence + f_nla = ( + prefactor * inverse_linear_growth * redshift_dependence * luminosity_dependence + ) return delta * f_nla From 89eaa5cd88768cd69df2251b1aed1bed38c985ee Mon Sep 17 00:00:00 2001 From: "Patrick J. Roddy" Date: Thu, 3 Oct 2024 14:35:30 +0100 Subject: [PATCH 4/4] Fixed linting --- glass/galaxies.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/glass/galaxies.py b/glass/galaxies.py index e66a7baa..a01bf19b 100644 --- a/glass/galaxies.py +++ b/glass/galaxies.py @@ -284,12 +284,11 @@ def gaussian_phz( return zphot -def kappa_ia_nla( +def kappa_ia_nla( # noqa: PLR0913 delta, zeff, a_ia, cosmo, *, z0=0.0, eta=0.0, lbar=0.0, l0=1e-9, beta=0.0 ): r""" - Effective convergence from intrinsic alignments using the NLA - model. + Effective convergence from intrinsic alignments using the NLA model. Parameters ---------- @@ -301,14 +300,6 @@ def kappa_ia_nla( Intrinsic alignments amplitude. cosmo : Cosmology Cosmology instance. - - Returns - ------- - kappa_ia : array_like - Effective convergence due to intrinsic alignments. - - Other Parameters - ---------------- z0 : float, optional Reference redshift for the redshift dependence (default: 0). eta : float, optional @@ -321,6 +312,11 @@ def kappa_ia_nla( beta : float, optional Power of the luminosity dependence (default: 0). + Returns + ------- + kappa_ia : array_like + Effective convergence due to intrinsic alignments. + Notes ----- The Non-linear Alignments Model (NLA) describes an effective