clmm.galaxycluster module
@file galaxycluster.py The GalaxyCluster class
- class clmm.galaxycluster.GalaxyCluster(*args, validate_input=True, **kwargs)[source]
Bases:
object
Object that contains the galaxy cluster metadata and background galaxy data
- Variables:
unique_id (int or string) -- Unique identifier of the galaxy cluster
ra (float) -- Right ascension of galaxy cluster center (in degrees)
dec (float) -- Declination of galaxy cluster center (in degrees)
z (float) -- Redshift of galaxy cluster center
galcat (GCData) -- Table of background galaxy data containing at least galaxy_id, ra, dec, e1, e2, z
validate_input (bool) -- Validade each input argument
- add_critical_surface_density(cosmo, use_pdz=False, force=False)[source]
Computes the critical surface density for each galaxy in galcat. It only runs if input cosmo != galcat cosmo or if sigma_c not in galcat.
- Parameters:
cosmo (clmm.Cosmology object) -- CLMM Cosmology object
use_pdz (bool) -- Flag to specify the use of the photoz pdf. If False (default), sigma_c is computed using the redshift point estimates of the z column of the galcat table. If True, sigma_c is computed as 1/<1/Sigma_crit>, where the average is performed using the individual galaxy redshift pdf. In that case, the galcat table should have pzbins` and pzpdf columns.
force (bool) -- Force recomputation of sigma_c.
- Return type:
None
- compute_background_probability(use_pdz=False, add=True, p_background_name='p_background')[source]
Probability for being a background galaxy
- Parameters:
use_pdz (bool) -- If True, computes the probability using the photoz pdf
add (bool) -- If True, add background probability columns to the galcat table
p_background_name (str, optional) -- User-defined name for the background probability column to be stored in the galcat table (i.e., if add=True)
- Returns:
p_background -- Probability for being a background galaxy
- Return type:
array
- compute_galaxy_weights(use_pdz=False, use_shape_noise=False, shape_component1='e1', shape_component2='e2', use_shape_error=False, shape_component1_err='e1_err', shape_component2_err='e2_err', weight_name='w_ls', cosmo=None, is_deltasigma=False, add=True)[source]
Computes the individual lens-source pair weights
- Parameters:
use_pdz (bool) -- True for computing photometric weights
use_shape_noise (bool) -- True for considering shapenoise in the weight computation
shape_component1 (string) -- column name : The measured shear (or reduced shear or ellipticity) of the source galaxies
shape_component2 (array) -- column name : The measured shear (or reduced shear or ellipticity) of the source galaxies
use_shape_error (bool) -- True for considering measured shape error in the weight computation
shape_component1_err (array) -- column name : The measurement error on the 1st-component of ellipticity of the source galaxies
shape_component2_err (array) -- column name : The measurement error on the 2nd-component of ellipticity of the source galaxies
weight_name (string) -- Name of the new column for the weak lensing weights in the galcat table
cosmo (clmm.Comology object, None) -- CLMM Cosmology object.
is_deltasigma (bool) -- Indicates whether it is the excess surface density or the tangential shear
add (bool) -- If True, add weight column to the galcat table
- Returns:
w_ls -- the individual lens source pair weights
- Return type:
array
- compute_tangential_and_cross_components(shape_component1='e1', shape_component2='e2', tan_component='et', cross_component='ex', geometry='curve', is_deltasigma=False, use_pdz=False, cosmo=None, add=True)[source]
Adds a tangential- and cross- components for shear or ellipticity to self
Calls clmm.dataops.compute_tangential_and_cross_components with the following arguments: ra_lens: cluster Ra dec_lens: cluster Dec ra_source: galcat Ra dec_source: galcat Dec shear1: galcat shape_component1 shear2: galcat shape_component2 geometry: input geometry is_deltasigma: input is_deltasigma
- Parameters:
shape_component1 (string, optional) -- Name of the column in the galcat astropy table of the cluster object that contains the shape or shear measurement along the first axis. Default: e1
shape_component1 -- Name of the column in the galcat astropy table of the cluster object that contains the shape or shear measurement along the second axis. Default: e2
tan_component (string, optional) -- Name of the column to be added to the galcat astropy table that will contain the tangential component computed from columns shape_component1 and shape_component2. Default: et
cross_component (string, optional) -- Name of the column to be added to the galcat astropy table that will contain the cross component computed from columns shape_component1 and shape_component2. Default: ex
geometry (str, optional) -- Sky geometry to compute angular separation. Options are curve (uses astropy) or flat.
is_deltasigma (bool) -- If True, the tangential and cross components returned are multiplied by Sigma_crit. Results in units of \(M_\odot\ Mpc^{-2}\)
cosmo (astropy cosmology object) -- Specifying a cosmology is required if is_deltasigma is True
add (bool) -- If True, adds the computed shears to the galcat
- Returns:
angsep (array_like) -- Angular separation between lens and each source galaxy in radians
tangential_component (array_like) -- Tangential shear (or assimilated quantity) for each source galaxy
cross_component (array_like) -- Cross shear (or assimilated quantity) for each source galaxy
- draw_gal_z_from_pdz(zcol_out='z', overwrite=False, nobj=1, xmin=None, xmax=None)[source]
Draw random redshifts from the photoz pdf for each galaxy of the galcat table.
- Parameters:
zcol_out (string) -- Name of the column of the galcat table where the random redshifts are to be stored. Default='z'
overwrite (bool) -- If True and if zcol_out already exists in the table, the column will be overwritten by the new random values
nobj (int, optional) -- Number of random samples to generate. Default is 1.
xmin (float) -- Lower bound to draw redshift. Default is the min(x_tab)
xmax (float) -- Upper bound to draw redshift. Default is the max(x_tab)
- Returns:
samples -- Random points following the pdf_tab distribution
- Return type:
ndarray
- make_radial_profile(bin_units, bins=10, error_model='ste', cosmo=None, tan_component_in='et', cross_component_in='ex', tan_component_out='gt', cross_component_out='gx', tan_component_in_err=None, cross_component_in_err=None, include_empty_bins=False, gal_ids_in_bins=False, add=True, table_name='profile', overwrite=True, use_weights=False, weights_in='w_ls', weights_out='W_l')[source]
Compute the shear or ellipticity profile of the cluster
We assume that the cluster object contains information on the cross and tangential shears or ellipticities and angular separation of the source galaxies
Calls clmm.dataops.make_radial_profile with the following arguments: components: galcat components (tan_component_in, cross_component_in, z) angsep: galcat theta angsep_units: 'radians' bin_units: input bin_units bins: input bins include_empty_bins: input include_empty_bins cosmo: input cosmo z_lens: cluster z
- Parameters:
bin_units (str) -- Units to use for the radial bins of the shear profile Allowed Options = ["radians", "deg", "arcmin", "arcsec", "kpc", "Mpc"] (letter case independent)
bins (array_like, optional) -- User defined bins to use for the shear profile. If a list is provided, use that as the bin edges. If a scalar is provided, create that many equally spaced bins between the minimum and maximum angular separations in bin_units. If nothing is provided, default to 10 equally spaced bins.
error_model (str, optional) --
Statistical error model to use for y uncertainties. (letter case independent)
ste - Standard error [=std/sqrt(n) in unweighted computation] (Default).
std - Standard deviation.
cosmo (clmm.Comology object, None) -- CLMM Cosmology object, used to convert angular separations to physical distances
tan_component_in (string, optional) -- Name of the tangential component column in galcat to be binned. Default: 'et'
cross_component_in (string, optional) -- Name of the cross component column in galcat to be binned. Default: 'ex'
tan_component_out (string, optional) -- Name of the tangetial component binned column to be added in profile table. Default: 'gt'
cross_component_out (string, optional) -- Name of the cross component binned profile column to be added in profile table. Default: 'gx'
tan_component_in_err (string, None, optional) -- Name of the tangential component error column in galcat to be binned. Default: None
cross_component_in_err (string, None, optional) -- Name of the cross component error column in galcat to be binned. Default: None
include_empty_bins (bool, optional) -- Also include empty bins in the returned table
gal_ids_in_bins (bool, optional) -- Also include the list of galaxies ID belonging to each bin in the returned table
add (bool, optional) -- Attach the profile to the cluster object
table_name (str, optional) -- Name of the profile table to be add as cluster.table_name. Default 'profile'
overwrite (bool, optional) -- Overwrite profile table. Default True
use_weights (bool, optional) -- If True, use the column weights_in in galcat as the weights Default: False
weights_in (str, optional) -- Name of the weights column in galcat Default: 'w_ls'
- Returns:
profile -- Output table containing the radius grid points, the tangential and cross shear profiles on that grid, and the errors in the two shear profiles. The errors are defined as the standard errors in each bin.
- Return type:
- plot_profiles(tangential_component='gt', tangential_component_error='gt_err', cross_component='gx', cross_component_error='gx_err', table_name='profile', xscale='linear', yscale='linear')[source]
Plot shear profiles using plotting.plot_profiles function
- Parameters:
tangential_component (str, optional) -- Name of the column in the galcat Table corresponding to the tangential component of the shear or reduced shear (Delta Sigma not yet implemented). Default: 'gt'
tangential_component_error (str, optional) -- Name of the column in the galcat Table corresponding to the uncertainty in tangential component of the shear or reduced shear. Default: 'gt_err'
cross_component (str, optional) -- Name of the column in the galcat Table corresponding to the cross component of the shear or reduced shear. Default: 'gx'
cross_component_error (str, optional) -- Name of the column in the galcat Table corresponding to the uncertainty in the cross component of the shear or reduced shear. Default: 'gx_err'
table_name (str, optional) -- Name of the GalaxyCluster() .profile attribute. Default: 'profile'
xscale -- matplotlib.pyplot.xscale parameter to set x-axis scale (e.g. to logarithmic axis)
yscale -- matplotlib.pyplot.yscale parameter to set y-axis scale (e.g. to logarithmic axis)
- Returns:
fig -- The matplotlib figure object that has been plotted to.
axes -- The matplotlib axes object that has been plotted to.