dsigma.stacking module¶
Module for stacking lensing results after pre-computation.
- dsigma.stacking.boost_factor(table_l, table_r)[source]¶
Compute the boost factor.
Boost factor is computed by comparing the number of lens-source pairs in real lenses and random lenses.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_r
astropy.table.Table Precompute results for random lenses.
- table_l
- Returns:
- b
numpy.ndarray Boost factor in each radial bin.
- b
- dsigma.stacking.excess_surface_density(table_l, table_r=None, photo_z_dilution_correction=False, boost_correction=False, scalar_shear_response_correction=False, matrix_shear_response_correction=False, shear_responsivity_correction=False, selection_bias_correction=False, random_subtraction=False, return_table=False)[source]¶
Compute the mean excess surface density with corrections, if applicable.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_r
astropy.table.Table,optional Precompute results for random lenses. Default is
None.- photo_z_dilution_correctionbool,
optional If
True, correct for photo-z biases. This can only be done if a calibration catalog has been provided in the precomputation phase. Default isFalse.- boost_correctionbool,
optional If
True, calculate and apply a boost factor correction. This can only be done if a random catalog is provided. Default isFalse.- scalar_shear_response_correctionbool or
str,optional Whether to correct for the multiplicative shear bias (scalar form). Default is
False.- matrix_shear_response_correctionbool or
str,optional Whether to correct for the multiplicative shear bias (tensor form). Default is
False.- shear_responsivity_correctionbool,
optional If
True, correct for the shear responsivity. Default isFalse.- selection_bias_correctionbool,
optional If
True, correct for the multiplicative selection bias in, e.g., HSC. Default isFalse.- random_subtractionbool,
optional If
True, subtract the signal around randoms. This can only be done if a random catalog is provided. Default isFalse.- return_tablebool,
optional If
True, return a table with many intermediate steps of the computation. Otherwise, a simple array with just the final excess surface density is returned. Default isFalse.
- table_l
- Returns:
- ds
numpy.ndarrayorastropy.table.Table The excess surface density in each radial bin specified in the precomputation phase. If return_table is
True, will return a table with detailed information for each radial bin. The final result is in the column ds.
- ds
- Raises:
ValueErrorIf boost or random subtraction correction are requested but no random catalog is provided.
- dsigma.stacking.lens_magnification_bias(table_l, alpha_l, sigma_8=0.82, n_s=0.96, photo_z_dilution_correction=False, shear=False)[source]¶
Estimate the additive lens magnification bias.
Note that the assumed cosmology is taken from
table_l.meta['cosmology']which is added byprecompute.- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- alpha_l
float The response of the lenses to magnification.
- sigma_8
float,optional Scale of fluctuations at \(8 h^{-1} \, \mathrm{Mpc}\). Default is 0.82.
- n_s
float,optional Primordial power spectrum index. Default is 0.96.
- photo_z_dilution_correctionbool,
optional If
True, correct the mean critical surface density for photo-z biases. Not used if shear isTrue. This should be consistent with what is used for calculating the total excess surface density. Default isFalse.- shearbool,
optional If
True, return bias of the mean tangential shear. Otherwise, return an estimate for the bias of the excess surface density. Default isFalse.
- table_l
- Returns:
- ds_lm
numpy.ndarray The lens magnification bias in each radial bin.
- ds_lm
- dsigma.stacking.matrix_shear_response_factor(table_l)[source]¶
Compute the mean tangential response.
The tangential shear response factor \(R_t\) is defined such that \(\gamma_{\mathrm obs} = R_t \gamma_{\mathrm intrinsic}\).
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- r_t
numpy.ndarray Tangential shear response factor in each radial bin.
- r_t
- dsigma.stacking.mean_critical_surface_density(table_l, photo_z_dilution_correction=False)[source]¶
Compute the weighted-average (effective) critical surface density.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- photo_z_dilution_correctionbool,
optional If
True, correct for photo-z biases. This can only be done if a calibration catalog has been provided in the precomputation phase. Default isFalse.
- table_l
- Returns:
- sigma_crit
numpy.ndarray Mean (effective) critical surface density.
- sigma_crit
- dsigma.stacking.mean_lens_redshift(table_l)[source]¶
Compute the weighted-average lens redshift.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- z_l
numpy.ndarray Mean lens redshift in each bin.
- z_l
- dsigma.stacking.mean_source_redshift(table_l)[source]¶
Compute the weighted-average source redshift.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- z_s
numpy.ndarray Mean source redshift in each bin.
- z_s
- dsigma.stacking.number_of_pairs(table_l)[source]¶
Compute the number of lens-source pairs per bin.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- n_pairs
numpy.ndarray The number of lens-source pairs in each radial bin.
- n_pairs
- dsigma.stacking.photo_z_dilution_factor(table_l)[source]¶
Compute the photometric redshift bias averaged over the entire catalog.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- f_bias
float Photometric redshift bias \(f_{\mathrm{bias}}\).
- f_bias
- dsigma.stacking.raw_excess_surface_density(table_l)[source]¶
Compute the raw, uncorrected excess surface density for a catalog.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- ds
numpy.ndarray The raw, uncorrected excess surface density in each radial bin.
- ds
- dsigma.stacking.raw_tangential_shear(table_l)[source]¶
Compute the average tangential shear for a catalog.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- gt
numpy.ndarray The raw, uncorrected tangential shear in each radial bin.
- gt
- dsigma.stacking.scalar_shear_response_factor(table_l, selection_bias=False)[source]¶
Compute the mean shear response.
The shear response factor \(m\) is defined such that \(\gamma_{\mathrm obs} = (1 + m) \gamma_{\mathrm intrinsic}\).
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- selection_biasbool
If
True, calculate the selection bias \(m_\mathrm{sel}\), instead. Default isFalse.
- table_l
- Returns:
- m
numpy.ndarray Multiplicative shear bias in each radial bin.
- m
- dsigma.stacking.shear_responsivity_factor(table_l)[source]¶
Compute the shear responsivity factor.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_l
- Returns:
- r
numpy.ndarray Shear responsivity factor in each radial bin.
- r
- dsigma.stacking.tangential_shear(table_l, table_r=None, boost_correction=False, scalar_shear_response_correction=False, matrix_shear_response_correction=False, shear_responsivity_correction=False, selection_bias_correction=False, random_subtraction=False, return_table=False)[source]¶
Compute the mean tangential shear with corrections, if applicable.
- Parameters:
- table_l
astropy.table.Table Precompute results for the lenses.
- table_r
astropy.table.Table,optional Precompute results for random lenses. Default is
None.- boost_correctionbool,
optional If
True, calculate and apply a boost factor correction. This can only be done if a random catalog is provided. Default isFalse.- scalar_shear_response_correctionbool,
optional Whether to correct for the multiplicative shear bias (scalar form). Default is
False.- matrix_shear_response_correctionbool,
optional Whether to correct for the multiplicative shear bias (tensor form). Default is
False.- shear_responsivity_correctionbool,
optional If
True, correct for the shear responsivity. Default isFalse.- selection_bias_correctionbool,
optional If
True, correct for the multiplicative selection bias in, e.g., HSC. Default isFalse.- random_subtractionbool,
optional If
True, subtract the signal around randoms. This can only be done if a random catalog is provided. Default isFalse.- return_tablebool,
optional If
True, return a table with many intermediate steps of the computation. Otherwise, a simple array with just the final tangential shear is returned. Default isFalse.
- table_l
- Returns:
- gt
numpy.ndarrayorastropy.table.Table The tangential shear in each radial bin specified in the precomputation phase. If return_table is
True, will return a table with detailed information for each radial bin. The final result is in the column gt.
- gt
- Raises:
ValueErrorIf boost or random subtraction correction are requested but no random catalog is provided.