dsigma.precompute module

Module for pre-computing lensing results.

dsigma.precompute.mean_photo_z_offset(z_l, table_c, cosmology, weighting=-2)[source]

Calculate the mean offset of source photometric redshifts.

Parameters:
z_lfloat or numpy.ndarray

Redshift(s) of the lens.

table_castropy.table.Table, optional

Photometric redshift calibration catalog.

cosmologyastropy.cosmology

Cosmology to assume for calculations.

weightingfloat, optional

The exponent of weighting of each lens-source pair by the critical surface density. A natural choice is -2 which minimizes shape noise. Default is -2.

Returns:
dzfloat or numpy.ndarray

The mean source redshift offset for the lens redshift(s).

dsigma.precompute.photo_z_dilution_factor(z_l, table_c, cosmology, weighting=-2)[source]

Calculate the photo-z delta sigma bias as a function of lens redshift.

Parameters:
z_lfloat or numpy.ndarray

Redshift(s) of the lens.

table_castropy.table.Table

Photometric redshift calibration catalog.

cosmologyastropy.cosmology

Cosmology to assume for calculations.

weightingfloat, optional

The exponent of weighting of each lens-source pair by the critical surface density. A natural choice is -2 which minimizes shape noise. Default is -2.

Returns:
f_biasfloat or numpy.ndarray

The photo-z bias factor, \(f_{\rm bias}\), for the lens redshift(s).

dsigma.precompute.precompute(table_l, table_s, bins, table_c=None, table_n=None, cosmology=None, comoving=True, weighting=-2, nside=256, n_jobs=1, progress_bar=False)[source]

For all lenses in the catalog, precompute the lensing statistics.

Parameters:
table_lastropy.table.Table

Catalog of lenses.

table_sastropy.table.Table

Catalog of sources.

binsnumpy.ndarray or astropy.units.quantity.Quantity

Bins in radius to use for the stacking. If a numpy array, bins are assumed to be in Mpc. If an astropy quantity, one can pass both length units, e.g. kpc and Mpc, as well as angular units, i.e. deg and rad.

table_castropy.table.Table, optional

Additional photometric redshift calibration catalog. If provided, this will be used to statistically correct the photometric source redshifts and critical surface densities. Default is None.

table_nastropy.table.Table, optional

Source redshift distributions. If provided, this will be used to compute mean source redshifts and critical surface densities. These mean quantities would be used instead the individual photometric redshift estimates. The table needs to have a z column giving the redshift and a n column with the \(n(z)\) for all samples. Default is None.

cosmologyastropy.cosmology or None, optional

Cosmology to assume for calculations. If None, use dsigma.default_cosmology. Default is None.

comovingbool, optional

Whether to use comoving or physical quantities for radial bins (if given in physical units) and the excess surface density. Default is True.

weightingfloat, optional

The exponent of weighting of each lens-source pair by the critical surface density. A natural choice is -2 which minimizes shape noise. Default is -2.

nsideint, optional

dsigma uses pixelization to group nearby lenses together and process them simultaneously. This parameter determines the number of pixels. It has to be a power of 2. May impact performance. Default is 256.

n_jobsint, optional

Number of jobs to run at the same time. Default is 1.

progress_barbool, option

Whether to show a progress bar for the main loop over lens pixels. Default is False.

Returns:
table_lastropy.table.Table

Lens catalog with the pre-computation results attached to the table.

Raises:
ValueError

If there are problems in the input.