diff --git a/clmm/__init__.py b/clmm/__init__.py index f1a42f5ef..adb901357 100644 --- a/clmm/__init__.py +++ b/clmm/__init__.py @@ -27,4 +27,4 @@ ) from .utils import compute_radial_averages, convert_units, make_bins -__version__ = "1.16.10" +__version__ = "1.17.0" diff --git a/clmm/galaxycluster.py b/clmm/galaxycluster.py index a162804fe..4cb52d00a 100644 --- a/clmm/galaxycluster.py +++ b/clmm/galaxycluster.py @@ -448,8 +448,8 @@ def draw_gal_z_from_pdz(self, zcol_out="z", overwrite=False, nobj=1, xmin=None, if zcol_out in self.galcat.columns and overwrite is False: raise TypeError( - f"Column {zcol_out} already exists in galcat. \ - Set overwrite=True to overwrite or use other column name" + f"Column {zcol_out} already exists in galcat. " + "Set overwrite=True to overwrite or use other column name" ) zdata = self._get_input_galdata({"pzpdf": "pzpdf", "pzbins": "pzbins"}) diff --git a/clmm/theory/func_layer.py b/clmm/theory/func_layer.py index 5d570cbed..9373d675c 100644 --- a/clmm/theory/func_layer.py +++ b/clmm/theory/func_layer.py @@ -44,26 +44,26 @@ def compute_3d_density( Galaxy cluster concentration z_cl: float Redshift of the cluster - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition; defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) @@ -140,26 +140,26 @@ def compute_surface_density( Galaxy cluster concentration z_cl: float Redshift of the cluster - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition; defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) @@ -240,26 +240,26 @@ def compute_mean_surface_density( Galaxy cluster concentration z_cl: float Redshift of the cluster - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition; defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. Option only + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo backend r_mis : float, optional Projected miscenter distance in :math:`M\!pc` @@ -332,26 +332,26 @@ def compute_excess_surface_density( Galaxy cluster concentration z_cl: float Redshift of the cluster - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition; defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) @@ -420,7 +420,7 @@ def compute_excess_surface_density_2h( Projected radial position from the cluster center in :math:`M\!pc`. z_cl: float Redshift of the cluster - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object halobias : float, optional Value of the halo bias @@ -487,7 +487,7 @@ def compute_surface_density_2h( Projected radial position from the cluster center in :math:`M\!pc`. z_cl: float Redshift of the cluster - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object halobias : float, optional Value of the halo bias @@ -540,7 +540,7 @@ def compute_critical_surface_density_eff(cosmo, z_cluster, pzbins, pzpdf, valida Parameters ---------- - cosmo : clmm.cosmology.Cosmology object + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object z_cluster : float Galaxy cluster redshift @@ -604,43 +604,43 @@ def compute_tangential_shear( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). - cosmo : clmm.cosmology.Cosmology object + ``z_src_info`` (see below). + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition. Defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an array - or all sources are at the same redshift when `z_src` is a float. + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an array + or all sources are at the same redshift when ``z_src`` is a float. - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimensional function. + * ``distrubution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimensional function. - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -729,43 +729,43 @@ def compute_convergence( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). - cosmo : clmm.cosmology.Cosmology object + ``z_src_info`` (see below). + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition. Defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an array - or all sources are at the same redshift when `z_src` is a float. + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an array + or all sources are at the same redshift when ``z_src`` is a float. - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimensional function. + * ``distrubution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimensional function. - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -847,44 +847,44 @@ def compute_reduced_tangential_shear( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). - cosmo : clmm.cosmology.Cosmology object + ``z_src_info`` (see below). + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition. Defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default); - * 'critical' - not in cluster_toolkit; - * 'virial' - not in cluster_toolkit; + * ``mean`` (default); + * ``critical`` - not in cluster_toolkit; + * ``virial`` - not in cluster_toolkit; alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an array - or all sources are at the same redshift when `z_src` is a float - (Used for `approx=None`). + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an array + or all sources are at the same redshift when ``z_src`` is a float + (Used for ``approx=None``). - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimensional function (Used when `approx=None`). + * ``distrubution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimensional function (Used when ``approx=None``). - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -900,10 +900,10 @@ def compute_reduced_tangential_shear( approx : str, optional Type of computation to be made for reduced tangential shears, options are: - * None (default): Requires `z_src_info` to be 'discrete' or 'distribution'. - If `z_src_info='discrete'`, full computation is made for each - `r_proj, z_src` pair individually. If `z_src_info='distribution'`, reduced - tangential shear at each value of `r_proj` is calculated as + * None (default): Requires ``z_src_info`` to be ``discrete`` or ``distribution``. + If ``z_src_info='discrete'``, full computation is made for each + ``r_proj, z_src`` pair individually. If ``z_src_info='distribution'``, reduced + tangential shear at each value of ``r_proj`` is calculated as .. math:: g_t @@ -912,38 +912,40 @@ def compute_reduced_tangential_shear( {1-\beta_s(z)\kappa_{\infty}}N(z)\text{d}z} {\int_{z_{min}}^{z_{max}} N(z)\text{d}z} - * 'order1' : Same approach as in Weighing the Giants - III (equation 6 in - Applegate et al. 2014; https://arxiv.org/abs/1208.0605). - `z_src_info` must be 'beta': + * ``type1`` : First order expansion, the approach of Weighing the Giants - III (Eq. 6 + in `Applegate et al. 2014 `_, + Eq. A2.4 from `Seitz & Schneider 1997 + `_). .. math:: - g_t\approx\frac{\left<\beta_s\right>\gamma_{\infty}} - {1-\left<\beta_s\right>\kappa_{\infty}} + g_t\approx\frac{\langle\beta_s\rangle\gamma_\infty} + {1-\frac{\langle\beta_s^2\rangle}{\langle\beta_s\rangle}\kappa_\infty} - * 'order2' : Same approach as in Cluster Mass Calibration at High - Redshift (equation 12 in Schrabback et al. 2017; - https://arxiv.org/abs/1611.03866). - `z_src_info` must be 'beta': + * ``type2`` : Same approach as in Cluster Mass Calibration at High + Redshift (Eq. 12 in `Schrabback et al. 2017 `_, + Eq. 7 in `Hoekstra et al 1998 `_). .. math:: g_t\approx\frac{\left<\beta_s\right>\gamma_{\infty}} {1-\left<\beta_s\right>\kappa_{\infty}} - \left(1+\left(\frac{\left<\beta_s^2\right>} - {\left<\beta_s\right>^2}-1\right)\left<\beta_s\right>\kappa_{\infty}\right) + \left[1+\left(\frac{\left<\beta_s^2\right>} + {\left<\beta_s\right>^2}-1\right)\left<\beta_s\right>\kappa_{\infty}\right] + + **Note**: if ``approx='type#'``, ``z_src_info`` must be ``beta``. integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that ``zmin = z_cl + delta_z_cut``. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) @@ -959,6 +961,17 @@ def compute_reduced_tangential_shear( Reduced tangential shear """ + + # There is a type0 option for approx that does not really have a scientific application, + # but it is implemented (and hidden from the main documentation). + # We have to decide if it is going to be removed. + # * ``type0`` : approach with all sources at the same redshift (Eq. 5 in + # `Hoekstra et al 1998 `_). + # + # .. math:: + # g_t\approx\frac{\left<\beta_s\right>\gamma_{\infty}} + # {1-\left<\beta_s\right>\kappa_{\infty}} + _modeling_object.validate_input = validate_input _modeling_object.set_cosmo(cosmo) _modeling_object.set_halo_density_profile( @@ -1017,44 +1030,44 @@ def compute_magnification( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). - cosmo : clmm.cosmology.Cosmology object + ``z_src_info`` (see below). + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition. Defaults to 200. halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an array - or all sources are at the same redshift when `z_src` is a float - (Used for `approx=None`). + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an array + or all sources are at the same redshift when ``z_src`` is a float + (Used for ``approx=None``). - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimensional function (Used when `approx=None`). + * ``distrubution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimensional function (Used when ``approx=None``). - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -1070,10 +1083,10 @@ def compute_magnification( approx : str, optional Type of computation to be made for magnifications, options are: - * None (default): Requires `z_src_info` to be 'discrete' or 'distribution'. - If `z_src_info='discrete'`, full computation is made for each - `r_proj, z_src` pair individually. If `z_src_info='distribution'`, magnification - at each value of `r_proj` is calculated as + * None (default): Requires ``z_src_info`` to be ``discrete`` or ``distribution``. + If ``z_src_info='discrete'``, full computation is made for each + ``r_proj, z_src`` pair individually. If ``z_src_info='distribution'``, magnification + at each value of ``r_proj`` is calculated as .. math:: \mu @@ -1084,32 +1097,32 @@ def compute_magnification( -\left(\beta_s(z)\gamma_{\infty}\right)^2}} {\int_{z_{min}}^{z_{max}} N(z)\text{d}z} - * 'order1' : Uses the weak lensing approximation of the magnification with up to - first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type1`` : Uses the weak lensing approximation of the magnification with up to + first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu \approx 1 + 2 \left<\beta_s\right>\kappa_{\infty} - * 'order2' : Uses the weak lensing approximation of the magnification with up to - second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type2`` : Uses the weak lensing approximation of the magnification with up to + second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu \approx 1 + 2 \left<\beta_s\right>\kappa_{\infty} + 3 \left<\beta_s^2\right>\kappa_{\infty}^2 + \left<\beta_s^2\right>\gamma_{\infty}^2 + **Note**: if ``approx='type#'``, ``z_src_info`` must be ``beta``. + integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that ``zmin = z_cl + delta_z_cut``. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) verbose : bool, optional If True, the Einasto slope (alpha_ein) is printed out. Only availble for the NC and CCL @@ -1199,44 +1212,44 @@ def compute_magnification_bias( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). - cosmo : clmm.cosmology.Cosmology object + ``z_src_info`` (see below). + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` CLMM Cosmology object delta_mdef : int, optional Mass overdensity definition. Defaults to 200. alpha_ein : float, None, optional - If `halo_profile_model=='einasto'`, set the value of the Einasto slope. + If ``halo_profile_model=='einasto'``, set the value of the Einasto slope. Option only available for the NumCosmo and CCL backends. If None, use the default value of the backend. (0.25 for the NumCosmo backend and a cosmology-dependent value for the CCL backend.) halo_profile_model : str, optional Profile model parameterization (letter case independent): - * 'nfw' (default) - * 'einasto' - not in cluster_toolkit - * 'hernquist' - not in cluster_toolkit + * ``nfw`` (default) + * ``einasto`` - not in cluster_toolkit + * ``hernquist`` - not in cluster_toolkit massdef : str, optional Profile mass definition, with the following supported options (letter case independent): - * 'mean' (default) - * 'critical' - * 'virial' + * ``mean`` (default) + * ``critical`` + * ``virial`` z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an array - or all sources are at the same redshift when `z_src` is a float - (Used for `approx=None`). + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an array + or all sources are at the same redshift when ``z_src`` is a float + (Used for ``approx=None``). - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimensional function (Used when `approx=None`). + * ``distrubution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimensional function (Used when ``approx=None``). - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -1252,10 +1265,10 @@ def compute_magnification_bias( approx : str, optional Type of computation to be made for magnification biases, options are: - * None (default): Requires `z_src_info` to be 'discrete' or 'distribution'. - If `z_src_info='discrete'`, full computation is made for each - `r_proj, z_src` pair individually. If `z_src_info='distribution'`, magnification - bias at each value of `r_proj` is calculated as + * ``None`` (default): Requires ``z_src_info`` to be ``discrete`` or ``distribution``. + If ``z_src_info='discrete'``, full computation is made for each + ``r_proj, z_src`` pair individually. If ``z_src_info='distribution'``, magnification + bias at each value of ``r_proj`` is calculated as .. math:: \mu^{\alpha-1} @@ -1267,17 +1280,15 @@ def compute_magnification_bias( -\left(\beta_s(z)\gamma_{\infty}\right)^2\right)^{\alpha-1}}} {\int_{z_{min}}^{z_{max}} N(z)\text{d}z} - * 'order1' : Uses the weak lensing approximation of the magnification bias with up - to first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type1`` : Uses the weak lensing approximation of the magnification bias with up + to first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu^{\alpha-1} \approx 1 + \left(\alpha-1\right)\left(2 \left<\beta_s\right>\kappa_{\infty}\right) - * 'order2' : Uses the weak lensing approximation of the magnification bias with up - to second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - `z_src_info` must be 'beta': + * ``type2`` : Uses the weak lensing approximation of the magnification bias with up + to second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu^{\alpha-1} \approx @@ -1288,16 +1299,18 @@ def compute_magnification_bias( &+ \left(2\alpha-1\right)\left(\alpha-1\right) \left(\left<\beta_s^2\right>\kappa_{\infty}^2\right) + **Note**: if ``approx='type#'``, ``z_src_info`` must be ``beta``. + integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that ``zmin = z_cl + delta_z_cut``. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) validate_input : bool, optional If True (default), the types of the arguments are checked before proceeding. diff --git a/clmm/theory/generic.py b/clmm/theory/generic.py index c4118f747..0124f6c56 100644 --- a/clmm/theory/generic.py +++ b/clmm/theory/generic.py @@ -66,8 +66,8 @@ def compute_magnification_bias_from_magnification(magnification, alpha): """ if np.any(np.array(magnification) < 0): warnings.warn( - "Magnification is negative for certain radii, \ - returning nan for magnification bias in this case." + "Magnification is negative for certain radii, " + "returning nan for magnification bias in this case." ) return np.array(magnification) ** (np.array([alpha]).T - 1) diff --git a/clmm/theory/parent_class.py b/clmm/theory/parent_class.py index a2870b12d..f7b8e6097 100644 --- a/clmm/theory/parent_class.py +++ b/clmm/theory/parent_class.py @@ -47,7 +47,7 @@ class CLMModeling: Mass overdensity definition. halo_profile_model : str Profile model parameterization ("nfw", "einasto", "hernquist" - letter case independent) - cosmo: Cosmology + cosmo : :class:`~clmm.cosmology.parent_class.CLMMCosmology` Cosmology object hdpm: Object Backend object with halo profiles @@ -509,13 +509,13 @@ def set_halo_density_profile(self, halo_profile_model="nfw", massdef="mean", del Parameters ---------- halo_profile_model: str - Halo mass profile, supported options are 'nfw', 'einasto', 'hernquist' + Halo mass profile, supported options are ``nfw``, ``einasto``, ``hernquist`` (letter case independent) massdef: str - Mass definition, supported options are 'mean', 'critical', 'virial' + Mass definition, supported options are ``mean``, ``critical``, ``virial`` (letter case independent) delta_mdef: int - Overdensity number. No effect if massdef='virial'. + Overdensity number. No effect if ``massdef='virial'``. """ # make case independent validate_argument(locals(), "massdef", str) @@ -618,7 +618,7 @@ def eval_3d_density(self, r3d, z_cl, verbose=False): return self._eval_3d_density(r3d=r3d, z_cl=z_cl) def eval_critical_surface_density_eff(self, z_len, pzbins, pzpdf): - r"""Computes the 'effective critical surface density' + r"""Computes the effective critical surface density .. math:: \langle \Sigma_{\rm crit}^{-1}\rangle^{-1} = @@ -699,7 +699,7 @@ def eval_surface_density(self, r_proj, z_cl, r_mis=None, mis_from_backend=False, def eval_mean_surface_density( self, r_proj, z_cl, r_mis=None, mis_from_backend=False, verbose=False ): - r"""Computes the mean value of surface density inside radius `r_proj` + r"""Computes the mean value of surface density inside radius ``r_proj`` Parameters ---------- @@ -896,17 +896,17 @@ def eval_tangential_shear(self, r_proj, z_cl, z_src, z_src_info="discrete", verb Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). + ``z_src_info`` (see below). z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an - array or all sources are at the same redshift when `z_src` is a float. + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an + array or all sources are at the same redshift when ``z_src`` is a float. - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -920,7 +920,7 @@ def eval_tangential_shear(self, r_proj, z_cl, z_src, z_src_info="discrete", verb {D_S}\frac{D_\infty}{D_{L,\infty}}\right)^2 \right\rangle verbose : bool, optional - If True, the Einasto slope (alpha_ein) is printed out. Only availble for the NC and + If True, the Einasto slope (``alpha_ein``) is printed out. Only availble for the NC and CCL backends. Returns @@ -984,17 +984,17 @@ def eval_convergence(self, r_proj, z_cl, z_src, z_src_info="discrete", verbose=F Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). + ``z_src_info`` (see below). z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an - array or all sources are at the same redshift when `z_src` is a float. + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an + array or all sources are at the same redshift when ``z_src`` is a float. - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -1065,14 +1065,14 @@ def _pdz_weighted_avg(self, core, pdz_func, r_proj, z_cl, integ_kwargs=None): Galaxy cluster redshift integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that ``zmin = z_cl + delta_z_cut``. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) Returns ------- @@ -1141,21 +1141,21 @@ def eval_reduced_tangential_shear( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). + ``z_src_info`` (see below). z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an - array or all sources are at the same redshift when `z_src` is a float - (Used for `approx=None`). + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an + array or all sources are at the same redshift when ``z_src`` is a float + (Used for ``approx=None``). - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimentional function (Used when `approx=None`). + * ``distribution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimentional function (Used when ``approx=None``). - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -1171,10 +1171,10 @@ def eval_reduced_tangential_shear( approx : str, optional Type of computation to be made for reduced tangential shears, options are: - * None (default): Requires `z_src_info` to be 'discrete' or 'distribution'. - If `z_src_info='discrete'`, full computation is made for each - `r_proj, z_src` pair individually. If `z_src_info='distribution'`, reduced - tangential shear at each value of `r_proj` is calculated as + * None (default): Requires ``z_src_info`` to be ``discrete`` or ``distribution``. + If ``z_src_info='discrete'``, full computation is made for each + ``r_proj, z_src`` pair individually. If ``z_src_info='distribution'``, reduced + tangential shear at each value of ``r_proj`` is calculated as .. math:: g_t @@ -1183,35 +1183,37 @@ def eval_reduced_tangential_shear( {1-\beta_s(z)\kappa_{\infty}}N(z)\text{d}z} {\int_{z_{min}}^{z_{max}} N(z)\text{d}z} - * 'order1' : Same approach as in Weighing the Giants - III (equation 6 in - Applegate et al. 2014; https://arxiv.org/abs/1208.0605). `z_src_info` must be - 'beta': + * ``type1`` : First order expansion, the approach of Weighing the Giants - III (Eq. + 6 in `Applegate et al. 2014 `_, + Eq. A2.4 from `Seitz & Schneider 1997 + `_). .. math:: - g_t\approx\frac{\left<\beta_s\right>\gamma_{\infty}} - {1-\left<\beta_s\right>\kappa_{\infty}} + g_t\approx\frac{\langle\beta_s\rangle\gamma_\infty} + {1-\frac{\langle\beta_s^2\rangle}{\langle\beta_s\rangle}\kappa_\infty} - * 'order2' : Same approach as in Cluster Mass Calibration at High - Redshift (equation 12 in Schrabback et al. 2017; - https://arxiv.org/abs/1611.03866). - `z_src_info` must be 'beta': + * ``type2`` : Same approach as in Cluster Mass Calibration at High Redshift + (Eq. 12 in `Schrabback et al. 2017 `_, Eq. + 7 in `Hoekstra et al 1998 `_). .. math:: g_t\approx\frac{\left<\beta_s\right>\gamma_{\infty}} {1-\left<\beta_s\right>\kappa_{\infty}} - \left(1+\left(\frac{\left<\beta_s^2\right>} - {\left<\beta_s\right>^2}-1\right)\left<\beta_s\right>\kappa_{\infty}\right) + \left[1+\left(\frac{\left<\beta_s^2\right>} + {\left<\beta_s\right>^2}-1\right)\left<\beta_s\right>\kappa_{\infty}\right] + + **Note**: if ``approx='type#'``, ``z_src_info`` must be ``beta``. integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) verbose : bool, optional If True, the Einasto slope (alpha_ein) is printed out. Only availble for the NC and @@ -1231,15 +1233,24 @@ def eval_reduced_tangential_shear( validate_argument(locals(), "z_cl", float, argmin=0) validate_argument(locals(), "z_src_info", str) validate_argument(locals(), "approx", str, none_ok=True) - self._validate_approx_z_src_info(locals()) + self._validate_approx_z_src_info(locals(), valid_approx=("type0", "type1", "type2")) self._validate_z_src(locals()) if self.halo_profile_model == "einasto" and verbose: print(f"Einasto alpha = {self._get_einasto_alpha(z_cl=z_cl)}") + # There is a type0 option for approx that does not really have a scientific application, + # but it is implemented (and hidden from the main documentation). + # We have to decide if it is going to be removed. + # * ``type0`` : approach with all sources at the same redshift (Eq. 5 in + # `Hoekstra et al 1998 `_). + # + # .. math:: + # g_t\approx\frac{\left<\beta_s\right>\gamma_{\infty}} + # {1-\left<\beta_s\right>\kappa_{\infty}} + # functions _validate_z_src, _validate_approx_z_src_info already safekeeps from this error: # pylint: disable=possibly-used-before-assignment - if approx is None: if z_src_info == "distribution": gt = self._pdz_weighted_avg( @@ -1264,16 +1275,19 @@ def eval_reduced_tangential_shear( "z_src", r_proj, ) - elif approx in ("order1", "order2"): - beta_s_mean = z_src[0] + elif approx in ("type0", "type1", "type2"): gammat_inf = self._eval_tangential_shear_core(r_proj, z_cl, z_src=self.z_inf) kappa_inf = self._eval_convergence_core(r_proj, z_cl, z_src=self.z_inf) - gt = beta_s_mean * gammat_inf / (1.0 - beta_s_mean * kappa_inf) + beta_s_mean = z_src[0] + beta_s_square_mean = z_src[1] - if approx == "order2": - beta_s_square_mean = z_src[1] + if approx == "type1": + gt = beta_s_mean * gammat_inf / (1.0 - beta_s_square_mean / beta_s_mean * kappa_inf) + else: # for type0 and type2 + gt = beta_s_mean * gammat_inf / (1.0 - beta_s_mean * kappa_inf) + if approx == "type2": gt *= ( 1.0 + (beta_s_square_mean / (beta_s_mean * beta_s_mean) - 1.0) @@ -1306,21 +1320,21 @@ def eval_magnification( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). + ``z_src_info`` (see below). z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an - array or all sources are at the same redshift when `z_src` is a float - (Used for `approx=None`). + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an + array or all sources are at the same redshift when ``z_src`` is a float + (Used for ``approx=None``). - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimentional function (Used when `approx=None`). + * ``distribution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimentional function (Used when ``approx=None``). - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -1336,10 +1350,10 @@ def eval_magnification( approx : str, optional Type of computation to be made for magnifications, options are: - * None (default): Requires `z_src_info` to be 'discrete' or 'distribution'. - If `z_src_info='discrete'`, full computation is made for each - `r_proj, z_src` pair individually. If `z_src_info='distribution'`, magnification - at each value of `r_proj` is calculated as + * ``None`` (default): Requires ``z_src_info`` to be ``discrete`` or + ``distribution``. If ``z_src_info='discrete'``, full computation is made for each + ``r_proj, z_src`` pair individually. If ``z_src_info='distribution'``, + magnification at each value of ``r_proj`` is calculated as .. math:: \mu @@ -1350,32 +1364,32 @@ def eval_magnification( -\left(\beta_s(z)\gamma_{\infty}\right)^2}} {\int_{z_{min}}^{z_{max}} N(z)\text{d}z} - * 'order1' : Uses the weak lensing approximation of the magnification with up to - first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type1`` : Uses the weak lensing approximation of the magnification with up to + first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu \approx 1 + 2 \left<\beta_s\right>\kappa_{\infty} - * 'order2' : Uses the weak lensing approximation of the magnification with up to - second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type2`` : Uses the weak lensing approximation of the magnification with up to + second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu \approx 1 + 2 \left<\beta_s\right>\kappa_{\infty} + 3 \left<\beta_s^2\right>\kappa_{\infty}^2 + \left<\beta_s^2\right>\gamma_{\infty}^2 + **Note**: if ``approx='type#'``, ``z_src_info`` must be ``beta``. + integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy - when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy + when performing the sum. (default=``None``) + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that ``zmin = z_cl + delta_z_cut``. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) verbose : bool, optional If True, the Einasto slope (alpha_ein) is printed out. Only availble for the NC and @@ -1425,7 +1439,7 @@ def eval_magnification( "z_src", r_proj, ) - elif approx in ("order1", "order2"): + elif approx in ("type1", "type2"): beta_s_mean = z_src[0] kappa_inf = self._eval_convergence_core(r_proj, z_cl, z_src=self.z_inf) @@ -1433,7 +1447,7 @@ def eval_magnification( mu = 1 + 2 * beta_s_mean * kappa_inf - if approx == "order2": + if approx == "type2": beta_s_square_mean = z_src[1] # Taylor expansion with up to second-order terms mu += 3 * beta_s_square_mean * kappa_inf**2 + beta_s_square_mean * gammat_inf**2 @@ -1464,23 +1478,23 @@ def eval_magnification_bias( Galaxy cluster redshift z_src : array_like, float, function Information on the background source galaxy redshift(s). Value required depends on - `z_src_info` (see below). + ``z_src_info`` (see below). alpha : float Slope of the cummulative number count of background sources at a given magnitude z_src_info : str, optional - Type of redshift information provided by the `z_src` argument. + Type of redshift information provided by the ``z_src`` argument. The following supported options are: - * 'discrete' (default) : The redshift of sources is provided by `z_src`. - It can be individual redshifts for each source galaxy when `z_src` is an - array or all sources are at the same redshift when `z_src` is a float - (Used for `approx=None`). + * ``discrete`` (default) : The redshift of sources is provided by ``z_src``. + It can be individual redshifts for each source galaxy when ``z_src`` is an + array or all sources are at the same redshift when ``z_src`` is a float + (Used for ``approx=None``). - * 'distribution' : A redshift distribution function is provided by `z_src`. - `z_src` must be a one dimentional function (Used when `approx=None`). + * ``distribution`` : A redshift distribution function is provided by ``z_src``. + ``z_src`` must be a one dimentional function (Used when ``approx=None``). - * 'beta' : The averaged lensing efficiency is provided by `z_src`. - `z_src` must be a tuple containing + * ``beta`` : The averaged lensing efficiency is provided by ``z_src``. + ``z_src`` must be a tuple containing ( :math:`\langle \beta_s \rangle, \langle \beta_s^2 \rangle`), the lensing efficiency and square of the lensing efficiency averaged over the galaxy redshift distribution repectively. @@ -1496,10 +1510,10 @@ def eval_magnification_bias( approx : str, optional Type of computation to be made for magnification biases, options are: - * None (default): Requires `z_src_info` to be 'discrete' or 'distribution'. - If `z_src_info='discrete'`, full computation is made for each - `r_proj, z_src` pair individually. If `z_src_info='distribution'`, magnification - bias at each value of `r_proj` is calculated as + * ``None`` (default): Requires ``z_src_info`` to be ``discrete`` or + ``distribution``. If ``z_src_info='discrete'``, full computation is made for each + ``r_proj, z_src`` pair individually. If ``z_src_info='distribution'``, + magnification bias at each value of ``r_proj`` is calculated as .. math:: \mu^{\alpha-1} @@ -1511,17 +1525,15 @@ def eval_magnification_bias( -\left(\beta_s(z)\gamma_{\infty}\right)^2\right)^{\alpha-1}}} {\int_{z_{min}}^{z_{max}} N(z)\text{d}z} - * 'order1' : Uses the weak lensing approximation of the magnification bias with up - to first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type1`` : Uses the weak lensing approximation of the magnification bias with up + to first-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu^{\alpha-1} \approx 1 + \left(\alpha-1\right)\left(2 \left<\beta_s\right>\kappa_{\infty}\right) - * 'order2' : Uses the weak lensing approximation of the magnification bias with up - to second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}` - (`z_src_info` must be 'beta'): + * ``type2`` : Uses the weak lensing approximation of the magnification bias with up + to second-order terms in :math:`\kappa_{\infty}` or :math:`\gamma_{\infty}`: .. math:: \mu^{\alpha-1} \approx @@ -1532,16 +1544,18 @@ def eval_magnification_bias( &+ \left(2\alpha-1\right)\left(\alpha-1\right) \left(\left<\beta_s^2\right>\kappa_{\infty}^2\right) + **Note**: if ``approx='type#'``, ``z_src_info`` must be ``beta``. + integ_kwargs: None, dict Extra arguments for the redshift integration (when - `approx=None, z_src_info='distribution'`). Possible keys are: + ``approx=None, z_src_info='distribution'``). Possible keys are: - * 'zmin' (None, float) : Minimum redshift to be set as the source of the galaxy + * ``zmin`` (None, float) : Minimum redshift to be set as the source of the galaxy when performing the sum. (default=None) - * 'zmax' (float) : Maximum redshift to be set as the source of the galaxy + * ``zmax`` (float) : Maximum redshift to be set as the source of the galaxy when performing the sum. (default=10.0) - * 'delta_z_cut' (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. - `delta_z_cut` is ignored if `z_min` is already provided. (default=0.1) + * ``delta_z_cut`` (float) : Redshift cut so that `zmin` = `z_cl` + `delta_z_cut`. + ``delta_z_cut`` is ignored if ``zmin`` is already provided. (default=0.1) verbose : bool, optional If True, the Einasto slope (alpha_ein) is printed out. Only availble for the NC and @@ -1595,7 +1609,7 @@ def eval_magnification_bias( alpha=alpha, ) - elif approx in ("order1", "order2"): + elif approx in ("type1", "type2"): beta_s_mean = z_src[0] kappa_inf = self._eval_convergence_core(r_proj, z_cl, z_src=self.z_inf) @@ -1603,7 +1617,7 @@ def eval_magnification_bias( mu_bias = 1 + (alpha - 1) * (2 * beta_s_mean * kappa_inf) - if approx == "order2": + if approx == "type2": beta_s_square_mean = z_src[1] # Taylor expansion with up to second-order terms mu_bias += (alpha - 1) * (beta_s_square_mean * gammat_inf**2) + ( @@ -1638,8 +1652,8 @@ def eval_mass_in_radius(self, r3d, z_cl, verbose=False): The mass is calculated as .. math:: - M(<\text{r3d}) = M_{\Delta}\; - \frac{f\left(\frac{\text{r3d}}{r_{\Delta}/c_{\Delta}}\right)}{f(c_{\Delta})}, + M(