hydromass package
Submodules
hydromass.constants module
hydromass.delta module
hydromass.deproject module
- class hydromass.deproject.MyDeprojVol(radin, radot)[source]
Bases:
objectCompute the projection volumes in spherical symmetry following Kriss et al. (1983)
- Parameters
radin (class:numpy.ndarray) – Array of inner radii of the bins
radout (class:numpy.ndarray) – Array of outer radii of the bins
- hydromass.deproject.calc_density_operator(rad, pars, kpcp, withbkg=True)[source]
Compute linear operator to transform a parameter vector into a gas density profile
\[n_e(r) = \sum_{i=1}^P \alpha_i f_i(r)\]with \(\alpha_i\) the parameter values and \(f_i(r)\) the profiles of each basis function, i.e. the indices of the output matrix
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
pars (numpy.ndarray) – List of beta model parameters obtained through
hydromass.deproject.list_params_density()kpcp (float) – Kiloparsec equivalent of 1 arcmin at the redshift of the source
withbkg (bool) – Set whether the background is fitted jointly (True) or subtracted (False). Defaults to True.
- Returns
Linear operator for gas density
- Return type
numpy.ndarray
- hydromass.deproject.calc_density_operator_pm(rad, pars, elong, kpcp)[source]
Compute linear operator to transform a parameter vector into a gas density profile
\[n_e(r) = \sum_{i=1}^P \alpha_i f_i(r)\]with \(\alpha_i\) the parameter values and \(f_i(r)\) the profiles of each basis function, i.e. the indices of the output matrix
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
pars (numpy.ndarray) – List of beta model parameters obtained through
hydromass.deproject.list_params_density()kpcp (float) – Kiloparsec equivalent of 1 arcmin at the redshift of the source
withbkg (bool) – Set whether the background is fitted jointly (True) or subtracted (False). Defaults to True.
- Returns
Linear operator for gas density
- Return type
numpy.ndarray
- hydromass.deproject.calc_grad_operator(rad, pars, kpcp, withbkg=True)[source]
Compute a linear operator transforming a parameter vector into a density gradient profile
\[\frac{\partial \log n_e}{\partial \log r} = \sum_{i=1}^P \alpha_i g_i(r)\]with \(\alpha_i\) the parameter values and \(g_i(r)\) the log gradients of each basis functions, i.e. the indices of the output matrix
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
pars (numpy.ndarray) – List of beta model parameters obtained through
hydromass.deproject.list_params_density()kpcp (float) – Kiloparsec equivalent of 1 arcmin at the redshift of the source
withbkg (bool) – Set whether the background is fitted jointly (True) or subtracted (False). Defaults to True.
- Returns
Linear operator for gas density
- Return type
numpy.ndarray
- hydromass.deproject.calc_int_operator(a, b, pars)[source]
Compute a linear operator to integrate analytically the basis functions within some radial range and return count rate and luminosities
\[CR = \sum_{i=1}^P \alpha_i (F_i(b) - F_i(a))\]with a,b the inner and outer radii of the chosen radial range, \(\alpha_i\) the parameter values and \(F_i(a), F_i(b)\) the analytic integral of the basis functions, i.e. the indices of the output matrix
- Parameters
a (float) – Lower integration boundary
b (float) – Upper integration boundary
pars (numpy.ndarray) – List of beta model parameters obtained through list_params
- Returns
Linear integration operator
- Return type
numpy.ndarray
- hydromass.deproject.calc_linear_operator(rad, sourcereg, pars, area, expo, psf)[source]
Function to calculate a linear operator transforming parameter vector into predicted model counts
\[C(r) = \sum_{i=1}^P \alpha_i C_i(r)\]with \(\alpha_i\) the parameter values and \(C_i(r)\) the count profiles of each basis function, i.e. the indices of the output matrix
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
sourcereg (numpy.ndarray) – Selection array for the source region
pars (numpy.ndarray) – List of beta model parameters obtained through
hydromass.deproject.list_params()area (numpy.ndarray) – Bin area in arcmin^2
expo (numpy.ndarray) – Bin effective exposure in s
psf (numpy.ndarray) – PSF mixing matrix
- Returns
Linear projection and PSF mixing operator
- Return type
numpy.ndarray
- hydromass.deproject.calc_sb_operator(rad, sourcereg, pars, withbkg=True)[source]
Function to calculate a linear operator transforming a parameter vector into a model surface brightness profile
\[S_X(r) = \sum_{i=1}^P \alpha_i S_i(r)\]with \(\alpha_i\) the parameter values and \(S_i(r)\) the brightness profiles of each basis functions, i.e. the indices of the output matrix
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
sourcereg (numpy.ndarray) – Selection array for the source region
pars (numpy.ndarray) – List of beta model parameters obtained through list_params
withbkg (bool) – Set whether the background is fitted jointly (True) or subtracted (False). Defaults to True.
- Returns
Linear projection operator
- Return type
numpy.ndarray
- hydromass.deproject.calc_sb_operator_psf(rad, sourcereg, pars, area, expo, psf, withbkg=False)[source]
Same as
hydromass.deproject.calc_sb_operator()but convolving the model surface brightness with the PSF model- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
sourcereg (numpy.ndarray) – Selection array for the source region
pars (numpy.ndarray) – List of beta model parameters obtained through list_params
area (numpy.ndarray) – Bin area in arcmin^2
expo (numpy.ndarray) – Bin effective exposure in s
psf (numpy.ndarray) – PSF mixing matrix
withbkg (bool) – Set whether the background is fitted jointly (True) or subtracted (False). Defaults to False.
- Returns
Linear projection and PSF mixing operator
- Return type
numpy.ndarray
- hydromass.deproject.elongation_correction(profile_values, r_values, ev, elongation)[source]
Theano function to apply elongation correction to a given spherically averaged profile to recover plane of the sky projected profile.
Parameters: - profile_values: tensor-like, profile values to correct (e.g., y profile or shear profile). - r_values: tensor-like, radius values. - ev: int or array-like of int, indices of the points to correct. - elongation: scalar, elongation factor to apply.
Returns: - corrected_profile: tensor-like, profile values after elongation correction.
- hydromass.deproject.elongation_correction_np(profile_values, r_values, ev, elongation)[source]
Numpy function to apply elongation correction to a given spherically averaged profile to recover plane of the sky projected profile. In addition to the thenao function, this function also accepts numpy arrays as input in order to treat the posterior chains.
Parameters: - profile_values: numpy.ndarray, shape (M, n), profile values to correct (e.g., y profile or shear profile). - r_values: numpy.ndarray, shape (M,), radius values corresponding to the profiles. - ev: numpy.ndarray, shape (m,), indices of the radial points to correct. - elongation: numpy.ndarray, shape (n,), elongation values for each MCMC sample.
Returns: - corrected_profile: numpy.ndarray, shape (m, n), profile values after elongation correction.
- hydromass.deproject.list_params(rad, sourcereg, nrc=None, nbetas=6, min_beta=0.6)[source]
Define a list of parameters to define the dictionary of basis functions
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
sourcereg (numpy.ndarray) – Selection array for the source region
nrc (int) – Number of core radii. If nrc=None (default), the number of core radiis will be defined adaptively as one per each set of 4 data points
nbetas (int) – Number of beta values. Defaults to 6
min_beta (float) – Minimum value of beta. Defaults to 0.6
- Returns
Array containing sets of values to set up the function dictionary
- Return type
numpy.ndarray
- hydromass.deproject.list_params_density(rad, sourcereg, kpcp, nrc=None, nbetas=6, min_beta=0.6)[source]
Define a list of parameters to transform the basis functions into gas density profiles
- Parameters
rad (numpy.ndarray) – Array of input radii in arcmin
sourcereg (numpy.ndarray) – Selection array for the source region
z (float) – Source redshift
nrc (int) – Number of core radii. If nrc=None (default), the number of core radiis will be defined adaptively as one per each set of 4 data points.
nbetas (int) – Number of beta values. Defaults to 6
min_beta (float) – Minimum value of beta. Defaults to 0.6
- Returns
Array containing sets of values to set up the function dictionary
- Return type
numpy.ndarray
hydromass.emissivity module
- hydromass.emissivity.calc_emissivity(cosmo, z, nh, kt, rmf, abund='aspl', Z=0.3, elow=0.5, ehigh=2.0, unit='cr', lum_elow=0.5, lum_ehigh=2.0, arf=None)[source]
Function calc_emissivity, computes scaling factor between count rate and APEC/MEKAL norm using XSPEC. The tool performs an XSPEC simulation of an absorbed APEC model with parameters set by the user, and computes the expected count rate in the band of interest corresponding to an APEC normalization of unity. The corresponding number is then used as conversion between count rate and emission measure for the hydrostatic mass reconstruction step. Note that since the computed count rates are corrected for vignetting through the exposure map, the provided ARF should correspond to the on-axis (unvignetted) effective area. Requires that XSPEC be in path
- Parameters
cosmo (class:astropy.cosmology) – Astropy cosmology object containing the definition of the used cosmology.
z (float) – Source redshift
nh (float) – Source NH in units of 1e22 cm**(-2)
kt (float) – Source temperature in keV
rmf (str) – Path to response file (RMF/RSP)
abund (str) – Solar abundance table in XSPEC format. Defaults to “aspl” (Asplund et al. 2009)
Z (float) – Metallicity with respect to solar. Defaults to 0.3
elow (float) – Low-energy bound of the input image in keV. Defaults to 0.5
ehigh (float) – High-energy bound of the input image in keV. Defaults to 2.0
arf (str) – Path to on-axis ARF (optional, in case response file is RMF)
unit (str) – Specify whether the exposure map is in units of sec (unit=’cr’) or photon flux (unit=’photon’). By default unit=’cr’.
lum_elow (float) – Low energy bound (rest frame) for luminosity calculation. Defaults to 0.5
lum_ehigh (float) – High energy bound (rest frame) for luminosity calculation. Defaults to 2.0
- Returns
Conversion factor
- Return type
float
- hydromass.emissivity.medsmooth(prof)[source]
Smooth a given profile by taking the median value of surrounding points instead of the initial value
- Parameters
prof (numpy.ndarray) – Input profile to be smoothed
- Returns
Smoothd profile
- Return type
numpy.ndarray
- hydromass.emissivity.variable_ccf(Mhyd, cosmo, z, nh, rmf, method='interp', abund='aspl', elow=0.5, ehigh=2.0, unit='cr', lum_elow=0.5, lum_ehigh=2.0, arf=None, outz=None, outkt=None)[source]
- Parameters
Mhyd (
hydromass.mhyd.Mhyd) – Hydromass objectcosmo (class:astropy.cosmology) – Astropy cosmology object containing the definition of the used cosmology.
z (float) – Source redshift
nh (float) – Source NH in units of 1e22 cm**(-2)
rmf (str) – Path to response file (RMF/RSP)
method (str) – Choose whether the temperature profile will be interpolated (method=’interp’) or fitted with a parametric function (method=’fit’). Defaults to ‘interp’.
abund (str) – Solar abundance table in XSPEC format. “aspl” (Asplund et al. 2009)
elow (float) – Low-energy bound of the input image in keV. Defaults to 0.5
ehigh (float) – High-energy bound of the input image in keV. Defaults to 2.0
arf (str) – Path to on-axis ARF (optional, in case response file is RMF)
outz (str) – Name of output file including the fit to the metal abundance profile. If None, it is ignored. Defaults to None.
outkt (str) – Name of output file including the fit to the temperature profile. If None, it is ignored. Defaults to None.
- Returns
Conversion factor
- Return type
float
hydromass.forward module
hydromass.functions module
- class hydromass.functions.ArcTan[source]
Bases:
OpTheano arctan class
- grad(inputs, g)[source]
Construct a graph for the gradient with respect to each input variable.
Each returned Variable represents the gradient with respect to that input computed based on the symbolic gradients with respect to each output. If the output is not differentiable with respect to an input, then this method should return an instance of type NullType for that input.
Using the reverse-mode AD characterization given in [1]_, for a \(C = f(A, B)\) representing the function implemented by the Op and its two arguments \(A\) and \(B\), given by the Variables in inputs, the values returned by Op.grad represent the quantities \(\bar{A} \equiv \frac{\partial S_O}{A}\) and \(\bar{B}\), for some scalar output term \(S_O\) of \(C\) in
\[\operatorname{Tr}\left(\bar{C}^\top dC\right) = \operatorname{Tr}\left(\bar{A}^\top dA\right) + \operatorname{Tr}\left(\bar{B}^\top dB\right)\]- Parameters
inputs – The input variables.
output_grads – The gradients of the output variables.
- Returns
The gradients with respect to each Variable in inputs.
- Return type
grads
References
- 1
Giles, Mike. 2008. “An Extended Collection of Matrix Derivative Results for Forward and Reverse Mode Automatic Differentiation.”
- itypes: Sequence['Type'] | None = [TensorType(float64, shape=(None,))]
- otypes: Sequence['Type'] | None = [TensorType(float64, shape=(None,))]
- perform(node, inputs, outputs)[source]
Calculate the function on the inputs and put the variables in the output storage.
- Parameters
node – The symbolic Apply node that represents this computation.
inputs – Immutable sequence of non-symbolic/numeric inputs. These are the values of each Variable in
node.inputs.output_storage – List of mutable single-element lists (do not change the length of these lists). Each sub-list corresponds to value of each Variable in
node.outputs. The primary purpose of this method is to set the values of these sub-lists.
Notes
The output_storage list might contain data. If an element of output_storage is not
None, it has to be of the right type, for instance, for a TensorVariable, it has to be a NumPyndarraywith the right number of dimensions and the correct dtype. Its shape and stride pattern can be arbitrary. It is not guaranteed that such pre-set values were produced by a previous call to thisOp.perform(); they could’ve been allocated by another Op’s perform method. An Op is free to reuse output_storage as it sees fit, or to discard it and allocate new memory.
- class hydromass.functions.EinastoFx[source]
Bases:
OpTheano class implementing the 2-parameter Einasto model with fixed mu=5.0
- grad(inputs, g)[source]
Construct a graph for the gradient with respect to each input variable.
Each returned Variable represents the gradient with respect to that input computed based on the symbolic gradients with respect to each output. If the output is not differentiable with respect to an input, then this method should return an instance of type NullType for that input.
Using the reverse-mode AD characterization given in [1]_, for a \(C = f(A, B)\) representing the function implemented by the Op and its two arguments \(A\) and \(B\), given by the Variables in inputs, the values returned by Op.grad represent the quantities \(\bar{A} \equiv \frac{\partial S_O}{A}\) and \(\bar{B}\), for some scalar output term \(S_O\) of \(C\) in
\[\operatorname{Tr}\left(\bar{C}^\top dC\right) = \operatorname{Tr}\left(\bar{A}^\top dA\right) + \operatorname{Tr}\left(\bar{B}^\top dB\right)\]- Parameters
inputs – The input variables.
output_grads – The gradients of the output variables.
- Returns
The gradients with respect to each Variable in inputs.
- Return type
grads
References
- 1
Giles, Mike. 2008. “An Extended Collection of Matrix Derivative Results for Forward and Reverse Mode Automatic Differentiation.”
- itypes: Sequence['Type'] | None = [TensorType(float64, shape=(None,))]
- otypes: Sequence['Type'] | None = [TensorType(float64, shape=(None,))]
- perform(node, inputs, outputs)[source]
Calculate the function on the inputs and put the variables in the output storage.
- Parameters
node – The symbolic Apply node that represents this computation.
inputs – Immutable sequence of non-symbolic/numeric inputs. These are the values of each Variable in
node.inputs.output_storage – List of mutable single-element lists (do not change the length of these lists). Each sub-list corresponds to value of each Variable in
node.outputs. The primary purpose of this method is to set the values of these sub-lists.
Notes
The output_storage list might contain data. If an element of output_storage is not
None, it has to be of the right type, for instance, for a TensorVariable, it has to be a NumPyndarraywith the right number of dimensions and the correct dtype. Its shape and stride pattern can be arbitrary. It is not guaranteed that such pre-set values were produced by a previous call to thisOp.perform(); they could’ve been allocated by another Op’s perform method. An Op is free to reuse output_storage as it sees fit, or to discard it and allocate new memory.
- class hydromass.functions.Model(massmod, delta=200.0, start=None, sd=None, limits=None, fix=None)[source]
Bases:
objectClass defining mass models to be passed to the hydromass
hydromass.mhyd.Mhydclass for optimization.- Parameters
massmod (str) –
- Name of the chosen mass model. Currently available mass models are:
’NFW’: Navarro-Frenk-White (1996) model,
hydromass.functions.f_nfw_pm()’EIN2’: Analytic 2-parameter Einasto (1965) model with \(\alpha=0.2\) (Mamon & Lokas 2005),
hydromass.functions.f_ein2_pm()’EIN3’: Numerically integrated 3-parameter Einasto (1965) model with free \(lpha\),
hydromass.functions.f_ein3_pm()’HER’: Hernquist (1990) model,
hydromass.functions.f_her_pm()’ISO’: Cored isothermal sphere model (King 1962),
hydromass.functions.f_iso_pm()’BUR’: Salucci & Burkert (2000) model,
hydromass.functions.f_bur_pm()
delta (float) – Chosen fit overdensity. Defaults to 200
start (numpy.ndarray) – 1D array containing the central values of the Gaussian prior on the model parameters. If None, the priors are set automatically to “sensible” values (for the galaxy cluster case…)
sd (numpy.ndarray) – 1D array containing the standard deviations of the Gaussian prior on the model parameters. If None, weak priors are set automatically to remain within “sensible” values
limits (numpy.ndarray) – 2D array including the upper and lower boundaries of the parameter values. If None, the boundaries are set automatically to remain within “sensible” values
fix (numpy.ndarray) – 1D array setting whether each parameter of the mass model is fitted (False) or fixed (True). If None, all the parameters are free to vary.
- hydromass.functions.f_bur_np(xout, pars, delta=200.0)[source]
Numpy function for the Burkert mass profile (Salucci & Burkert 2000), see
hydromass.functions.f_bur_pm()- Parameters
xout (numpy.ndarray) – Radius
pars (numpy.ndarray) – 2D array with the chains of parameters of the mass model (cdelta, rs, and mu)
delta (float) – Overdensity
- Returns
Enclosed mass
- Return type
numpy.ndarray
- hydromass.functions.f_bur_pm(xout, c200, r200, delta=200.0)[source]
Theano function for the Burkert mass profile (Salucci & Burkert 2000),
\[M(r) = f_c R_{\Delta}^3 \left[ \ln(1+x^2) + 2\ln(1+x) -2\arctan(x) \right]\]with \(x=r/R_{\Delta}\) and
\[f_c = \frac{\Delta}{3} \frac{c^3}{\ln(1+c)- c/(1+c)}\]- Parameters
xout – Radius
c200 – concentration
r200 – Scale radius
delta – Overdensity
- Returns
Enclosed mass
- hydromass.functions.f_ein2_np(xout, pars, delta=200.0)[source]
Numpy function for the Einasto 2-parameter model
\[\rho(r) = \rho_s \exp \left[ -2\mu \left( \left( \frac{r}{r_s} \right) ^ {1 /\mu} - 1 \right) \right]\]with :math:mu=5.0
- Parameters
xout (numpy.ndarray) – Radius
pars (numpy.ndarray) – Model parameters (cdelta and rs)
delta (float) – Overdensity
- Returns
Enclosed mass
- Return type
numpy.ndarray
- hydromass.functions.f_ein2_pm(xout, c200, r200, delta=200.0)[source]
Theano function returning the 2-parameter Einasto model for a given set of parameters.
\[\rho(r) = \rho_s \exp \left[ -2\mu \left( \left( \frac{r}{r_s} \right) ^ {1 /\mu} - 1 \right) \right]\]with :math:mu=5.0
- Parameters
xout – Radius
c200 – concentration
r200 – Scale radius
delta – Overdensity
- Returns
Enclosed mass
- hydromass.functions.f_ein3_np(xout, pars, delta=200.0)[source]
Numpy function for the numerically integrated 3-parameter Einasto mass model (see
hydromass.functions.f_ein3_pm())- Parameters
xout (numpy.ndarray) – Radius
pars (numpy.ndarray) – 2D array with the chains of parameters of the mass model (cdelta, rs, and mu)
delta (float) – Overdensity
- Returns
Enclosed mass
- Return type
numpy.ndarray
- hydromass.functions.f_ein3_pm(xout, c200, r200, mu, delta=200.0)[source]
Theano function for the 3-parameter Einasto mass model,
\[M(r) = f_c R_{\Delta}^3 \int_{0}^{r} 4 \pi r^2 \rho(r) dr\]with
\[\rho(x) = \exp \left[ -2\mu \left( \left( \frac{r}{R_{\Delta}} \right) ^ {1 /\mu} - 1 \right) \right]\]and
\[f_c = \frac{\Delta}{3} \frac{c^3}{\ln(1+c)- c/(1+c)}\]- Parameters
xout – Radius
c200 – concentration
r200 – Scale radius
mu – Einasto mu
delta – Overdensity
- Returns
Enclosed mass
- hydromass.functions.f_ein_mu(x, mu)[source]
Einasto mass model as a function of \(\mu=1/\alpha\) (Mamon & Lokas 2005)
- Parameters
x (float) – Scaled radius
mu (float) – Einasto mu
- Returns
Scaled mass profile
- Return type
float
- hydromass.functions.f_ein_mu_der(x, mu)[source]
Analytical derivative of the Einasto mass profile
- Parameters
x (float) – Scaled radius
mu (float) – Einasto mu
- Returns
Derivative of the scaled mass profile
- Return type
float
- hydromass.functions.f_her_np(xout, pars, delta=200.0)[source]
Numpy function for the Hernquist (1990) mass profile (see
hydromass.functions.f_her_pm())- Parameters
xout (numpy.ndarray) – Radius
pars (numpy.ndarray) – 2D array with the chains of parameters of the mass model (cdelta, rs, and mu)
delta (float) – Overdensity
- Returns
Enclosed mass
- Return type
numpy.ndarray
- hydromass.functions.f_her_pm(xout, c200, r200, delta=200.0)[source]
Theano function for the Hernquist (1990) mass profile,
\[M(r) = f_c R_{\Delta}^3 \frac{x^2}{(x+1)^2}\]with \(x=r/R_{\Delta}\) and
\[f_c = \frac{\Delta}{3} \frac{c^3}{\ln(1+c)- c/(1+c)}\]- Parameters
xout – Radius
c200 – concentration
r200 – Scale radius
delta – Overdensity
- Returns
Enclosed mass
- hydromass.functions.f_iso_np(xout, pars, delta=200.0)[source]
Numpy function for the cored isothermal sphere mass profile (see
hydromass.functions.f_iso_pm())- Parameters
xout (numpy.ndarray) – Radius
pars (numpy.ndarray) – 2D array with the chains of parameters of the mass model (cdelta, rs, and mu)
delta (float) – Overdensity
- Returns
Enclosed mass
- Return type
numpy.ndarray
- hydromass.functions.f_iso_pm(xout, c200, r200, delta=200.0)[source]
Theano function for the cored isothermal sphere mass profile (King 1962)
\[M(r) = f_c R_{\Delta}^3 \left[ \ln(x + \sqrt{1+x^2}) - \frac{x}{\sqrt{1+x^2}} \right]\]with \(x=r/R_{\Delta}\) and
\[f_c = \frac{\Delta}{3} \frac{c^3}{\ln(1+c)- c/(1+c)}\]- Parameters
xout – Radius
c200 – concentration
r200 – Scale radius
delta – Overdensity
- Returns
Enclosed mass
- hydromass.functions.f_nfw_np(xout, pars, delta=200.0)[source]
Numpy function for the NFW profile (see
hydromass.functions.f_nfw_pm())- Parameters
xout (numpy.ndarray) – Radius
pars (numpy.ndarray) – 2D array with the chains of parameters of the mass model (cdelta, rs, and mu)
delta (float) – Overdensity
- Returns
Enclosed mass
- Return type
numpy.ndarray
- hydromass.functions.f_nfw_pm(xout, c200, r200, delta=200.0)[source]
Theano function for the Navarro-Frenk-White mass profile (Navarro et al. 1996)
\[M(r) = f_c R_{\Delta}^3 \left[ \ln(1 + x) - \frac{x}{1+x}\right]\]with \(x=r/R_{\Delta}\) and
\[f_c = \frac{\Delta}{3} \frac{c^3}{\ln(1+c)- c/(1+c)}\]- Parameters
xout – Radius
c200 – concentration
r200 – Scale radius
delta – Overdensity
- Returns
Enclosed mass
hydromass.mhyd module
hydromass.nonparametric module
hydromass.plots module
hydromass.pnt module
hydromass.polytropic module
hydromass.save module
hydromass.tpdata module
- class hydromass.tpdata.SZData(redshift, sz_data=None, rin=None, rout=None, psz=None, y_sz=None, covmat_sz=None, cosmo=None)[source]
Bases:
objectContainer class to load a SZ pressure profile and its covariance matrix. The data can either be passed all at once by reading a FITS table file or directly as numpy arrays.
- Parameters
redshift (float) – Source redshift
sz_data (str) – Link to a FITS file containing the SZ pressure profile to be read. If None, the values should be passed directly as numpy arrays through the rin, rout, kt, err_kt_low, and err_kt_high arguments. Defaults to None
rin (numpy.ndarray) – 1-D array including the inner boundary definition of the SZ bins (in kpc). If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
rout – 1-D array including the outer boundary definition of the SZ bins (in kpc). If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
psz (numpy.ndarray) – 1-D array containing the SZ pressure profile (in keV cm^-3). If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
covmat_sz (numpy.ndarray) – 2-D array containing the covariance matrix on the SZ pressure profile. If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
cosmo (astropy.cosmology) – Astropy cosmology object including the cosmology definition
- PSF(pixsize, psffunc=None, psffile=None, psfimage=None, psfpixsize=None, sourcemodel=None, psfmin=1e-07)[source]
Compute a point spread function (PSF) mixing matrix for the loaded SZ data. Each row of the PSF mixing matrix corresponding to a given annulus is computed by defining a normalized image into the annulus and zeros elsewhere. The image is then convolved with the PSF model using FFT. See Eckert et al. 2020 for details.
The PSF model can be provided either in the form of a one-dimensional radial function or of an image.
- Parameters
pixsize (float) – Pixel size in arcmin
psffunc (func) – 1D function transforming an array of radii into the PSF model value. If None, an image should be provided. Defaults to None.
psffile (str) – FITS file containing the model PSF image. If None, the PSF should be provided either as a 1D function or a 2D array. Defaults to None.
psfimage (numpy.ndarray) – 2-D array containing an image of the PSF. The pixel size should be passed through the “psfpixsize” argument. If None, the PSF should be provided either as a 1D function or a FITS image. Defaults to None.
psfpixsize (float) – Image pixel size (in arcmin) in case a PSF image is provided.
sourcemodel (pyproffit.models.model) – A pyproffit model describing the radial dependence of the emissivity distribution. If provided, the PSF at each point is weighted by the radial model to take the emissivity gradient across the bins into account when computing the PSF mixing matrix. If None, a flat distribution is assumed. Defaults to None.
psfmin (float) – Minimum PSF value (relative to the maximum) below which the effect of the PSF is neglected. Increasing psfmin speeds up the computation at the cost of a lower precision.
- class hydromass.tpdata.SpecData(redshift, spec_data=None, rin=None, rout=None, kt=None, err_kt_low=None, err_kt_high=None, cosmo=None, Z=None, Z_low=None, Z_high=None, norm=None, norm_lo=None, norm_high=None)[source]
Bases:
objectContainer class to load a spectroscopic temperature profile and its uncertainties. The data can either be passed all at once by reading a FITS table file or directly as numpy arrays.
- Parameters
redshift (float) – Source redshift
spec_data (str) – Link to a FITS file containing the spectroscopic temperature profile to be read. The FITS table should contain the following fields: ‘RIN’, ‘ROUT’, ‘KT’, ‘KT_LO’, and ‘KT_HI’ (see the description below). If None, the values should be passed directly as numpy arrays through the rin, rout, kt, err_kt_low, and err_kt_high arguments. Defaults to None
rin (numpy.ndarray) – 1-D array including the inner boundary definition of the spectroscopic bins (in arcmin). If None, the data should be passed as a FITS file using the spec_data argument. Defaults to None
rout – 1-D array including the outer boundary definition of the spectroscopic bins (in arcmin). If None, the data should be passed as a FITS file using the spec_data argument. Defaults to None
kt (numpy.ndarray) – 1-D array containing the fitted spectroscopic temperature (in keV). If None, the data should be passed as a FITS file using the spec_data argument. Defaults to None
err_kt_low (numpy.ndarray) – 1-D array containing the lower 1-sigma error on the fitted spectroscopic temperature (in keV). If None, the data should be passed as a FITS file using the spec_data argument. Defaults to None
err_kt_high (numpy.ndarray) – 1-D array containing the upper 1-sigma error on the fitted spectroscopic temperature (in keV). If None, the data should be passed as a FITS file using the spec_data argument. Defaults to None
cosmo (astropy.cosmology) – Astropy cosmology object including the cosmology definition
- PSF(pixsize, psffunc=None, psffile=None, psfimage=None, psfpixsize=None, sourcemodel=None, psfmin=1e-07)[source]
Compute a point spread function (PSF) mixing matrix for the loaded spectroscopic data. Each row of the PSF mixing matrix corresponding to a given annulus is computed by defining a normalized image into the annulus and zeros elsewhere. The image is then convolved with the PSF model using FFT. See Eckert et al. 2020 for details.
The PSF model can be provided either in the form of a one-dimensional radial function or of an image.
- Parameters
pixsize (float) – Pixel size in arcmin
psffunc (func) – 1D function transforming an array of radii into the PSF model value. If None, an image should be provided. Defaults to None.
psffile (str) – FITS file containing the model PSF image. If None, the PSF should be provided either as a 1D function or a 2D array. Defaults to None.
psfimage (numpy.ndarray) – 2-D array containing an image of the PSF. The pixel size should be passed through the “psfpixsize” argument. If None, the PSF should be provided either as a 1D function or a FITS image. Defaults to None.
psfpixsize (float) – Image pixel size (in arcmin) in case a PSF image is provided.
sourcemodel (pyproffit.models.model) – A pyproffit model describing the radial dependence of the emissivity distribution. If provided, the PSF at each point is weighted by the radial model to take the emissivity gradient across the bins into account when computing the PSF mixing matrix. If None, a flat distribution is assumed. Defaults to None.
psfmin (float) – Minimum PSF value (relative to the maximum) below which the effect of the PSF is neglected. Increasing psfmin speeds up the computation at the cost of a lower precision.
- class hydromass.tpdata.VelocityData(redshift, rin, rout, vbulk, vbulk_error, vdisp=None, vdisp_error=None, cosmo=None)[source]
Bases:
object
- class hydromass.tpdata.WLData(redshift, rin=None, rout=None, gplus=None, err_gplus=None, covmat=None, sigmacrit_inv=None, fl=None, cosmo=None)[source]
Bases:
objectContainer class to load a weak lensing shear profile and its covariance matrix. The data can either be passed all at once by reading a FITS table file or directly as numpy arrays.
- Parameters
redshift (float) – Source redshift
sz_data (str) – Link to a FITS file containing the SZ pressure profile to be read. If None, the values should be passed directly as numpy arrays through the rin, rout, kt, err_kt_low, and err_kt_high arguments. Defaults to None
rin (numpy.ndarray) – 1-D array including the inner boundary definition of the SZ bins (in kpc). If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
rout – 1-D array including the outer boundary definition of the SZ bins (in kpc). If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
psz (numpy.ndarray) – 1-D array containing the SZ pressure profile (in keV cm^-3). If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
covmat_sz (numpy.ndarray) – 2-D array containing the covariance matrix on the SZ pressure profile. If None, the data should be passed as a FITS file using the sz_data argument. Defaults to None
cosmo (astropy.cosmology) – Astropy cosmology object including the cosmology definition