NFW Halo Shears
This is the “lensing engine” for calculating shears around an NFW halo.
- class galsim.NFWHalo(mass, conc, redshift, halo_pos=galsim.PositionD(x=0.0, y=0.0), omega_m=None, omega_lam=None, cosmo=None)[source]
Class describing NFW halos.
This class computes the lensing fields shear and convergence of a spherically symmetric NFW halo of given mass, concentration, redshift, assuming a particular cosmology. No mass-concentration relation is employed.
Based on Matthias Bartelmann’s libastro.
The cosmology to use can be set either by providing a
Cosmology
instance as cosmo, or by providing omega_m and/or omega_lam. If only one of the latter is provided, the other is taken to be one minus that. If no cosmology parameters are set, a defaultCosmology
is constructed.- Parameters:
mass – Mass defined using a spherical overdensity of 200 times the critical density of the universe, in units of M_solar/h.
conc – Concentration parameter, i.e., ratio of virial radius to NFW scale radius.
redshift – Redshift of the halo.
halo_pos –
Position
of halo center (in arcsec). [default: PositionD(0,0)]omega_m – Omega_matter to pass to
Cosmology
constructor. [default: None]omega_lam – Omega_lambda to pass to
Cosmology
constructor. [default: None]cosmo – A
Cosmology
instance. [default: None]
- _getShear(pos_x, pos_y, z_s, reduced=True)[source]
Equivalent to
getShear
, but without some sanity checks and the positions must be given aspos_x
,pos_y
in arcsec.- Parameters:
pos_x – x position in arcsec (either a scalar or a numpy array)
pos_y – y position in arcsec (either a scalar or a numpy array)
z_s – Source redshift(s).
reduced – Whether returned shear(s) should be reduced shears. [default: True]
- Returns:
the (possibly reduced) shears as a tuple (g1,g2) (either scalars or numpy arrays)
- _getConvergence(pos_x, pos_y, z_s)[source]
Equivalent to
getConvergence
, but without some sanity checks and the positions must be given aspos_x
,pos_y
in arcsec.- Parameters:
pos_x – x position in arcsec (either a scalar or a numpy array)
pos_y – y position in arcsec (either a scalar or a numpy array)
z_s – Source redshift(s).
- Returns:
the convergence as either a scalar or a numpy array
- _getMagnification(pos_x, pos_y, z_s)[source]
Equivalent to
getMagnification
, but without some sanity checks and the positions must be given aspos_x
,pos_y
in arcsec.- Parameters:
pos_x – x position in arcsec (either a scalar or a numpy array)
pos_y – y position in arcsec (either a scalar or a numpy array)
z_s – Source redshift(s).
- Returns:
the magnification as either a scalar or a numpy array
- _getLensing(pos_x, pos_y, z_s)[source]
Equivalent to
getLensing
, but without some sanity checks and the positions must be given aspos_x
,pos_y
in arcsec.- Parameters:
pos_x – x position in arcsec (either a scalar or a numpy array)
pos_y – y position in arcsec (either a scalar or a numpy array)
z_s – Source redshift(s).
- Returns:
the reduced shears and magnifications as a tuple (g1,g2,mu) (each being either a scalar or a numpy array)
- getConvergence(pos, z_s, units=coord.arcsec)[source]
Calculate convergence of halo at specified positions.
- Parameters:
- Returns:
the convergence, kappa
If the input
pos
is given a single position, kappa is the convergence value. If the inputpos
is given a list/array of positions, kappa is a NumPy array.
- getLensing(pos, z_s, units=coord.arcsec)[source]
Calculate lensing shear and magnification of halo at specified positions.
- Parameters:
- Returns:
the reduced shears and magnifications as a tuple (g1,g2,mu)
If the input
pos
is given a single position, the return values are the shear and magnification values at that position. If the inputpos
is given a list/array of positions, they are NumPy arrays.
- getMagnification(pos, z_s, units=coord.arcsec)[source]
Calculate magnification of halo at specified positions.
- Parameters:
- Returns:
the magnification mu
If the input
pos
is given a single position, mu is the magnification value. If the inputpos
is given a list/array of positions, mu is a NumPy array.
- getShear(pos, z_s, units=coord.arcsec, reduced=True)[source]
Calculate (reduced) shear of halo at specified positions.
- Parameters:
po –
Position(s) of the source(s), assumed to be post-lensing! Valid ways to input this:
z_s – Source redshift(s).
units – Angular units of coordinates. [default: galsim.arcsec]
reduced – Whether returned shear(s) should be reduced shears. [default: True]
- Returns:
the (possibly reduced) shears as a tuple (g1,g2)
If the input
pos
is given a single position, (g1,g2) are the two shear components. If the inputpos
is given a list/array of positions, they are NumPy arrays.
- class galsim.Cosmology(omega_m=0.3, omega_lam=0.7)[source]
Basic cosmology calculations.
Cosmology calculates expansion function E(a) and angular diameter distances Da(z) for a LambdaCDM universe. Radiation is assumed to be zero and Dark Energy constant with w = -1 (no quintessence), but curvature is arbitrary.
Based on Matthias Bartelmann’s libastro.
- Parameters:
omega_m – Present day energy density of matter relative to critical density. [default: 0.3]
omega_lam – Present day density of Dark Energy relative to critical density. [default: 0.7]