calc_kcorr

sherpa.astro.ui.calc_kcorr(z, obslo, obshi, restlo=None, resthi=None, id=None, bkg_id=None)

Calculate the K correction for a model.

The K correction ([1], [2], [3], [4]) is the numeric factor applied to measured energy fluxes to convert values in an observed energy band to that they are in a rest-frame energy band (that is, correct for the change in spectral shape between the rest-frame and observed-frame bands). This is often used when converting a flux into a luminosity.

Parameters:
  • z (number or array, >= 0) – The redshift, or redshifts, of the source.
  • obslo (number) – The minimum energy of the observed band.
  • obshi (number) – The maximum energy of the observed band, which must be larger than obslo.
  • restlo (number or None) – The minimum energy of the rest-frame band. If None then use obslo.
  • restlo – The maximum energy of the rest-frame band. It must be larger than restlo. If None then use obshi.
  • id (int or str, optional) – Use the source expression associated with this data set. If not given then the default identifier is used, as returned by get_default_id.
  • bkg_id (int or str, optional) – If set, use the model associated with the given background component rather than the source model.
Returns:

kz

Return type:

number or array of numbers

See also

calc_energy_flux()
Integrate the source model over a pass band.
dataspace1d()
Create the independent axis for a 1D data set.

Notes

This is only defined when the analysis is in ‘energy’ units.

If the model contains a redshift parameter then it should be set to 0, rather than the source redshift.

If the source model is at zero redshift, the observed energy band is olo to ohi, and the rest frame band is rlo to rhi (which need not match the observed band), then the K correction at a redshift z can be calculated as:

frest = calc_energy_flux(rlo, rhi)
fobs  = calc_energy_flux(olo*(1+z), ohi*(1+z))
kz    = frest / fobs

The energy ranges used - rlo to rhi and olo*(1+z) to ohi*(1+z) - should be fully covered by the data grid, otherwise the flux calculation will be truncated at the grid boundaries, leading to incorrect results.

References

[1]“The K correction”, Hogg, D.W., et al. http://arxiv.org/abs/astro-ph/0210394
[2]Appendix B of Jones et al. 1998, ApJ, vol 495, p. 100-114. http://adsabs.harvard.edu/abs/1998ApJ...495..100J
[3]“K and evolutionary corrections from UV to IR”, Poggianti, B.M., A&AS, 1997, vol 122, p. 399-407. http://adsabs.harvard.edu/abs/1997A%26AS..122..399P
[4]“Galactic evolution and cosmology - Probing the cosmological deceleration parameter”, Yoshii, Y. & Takahara, F., ApJ, 1988, vol 326, p. 1-18. http://adsabs.harvard.edu/abs/1988ApJ...326....1Y

Examples

Calculate the K correction for an X-Spec apec model, with a source temperature of 6 keV and abundance of 0.3 solar, for the energy band of 0.5 to 2 keV:

>>> dataspace1d(0.01, 10, 0.01)
>>> set_source(xsapec.clus)
>>> clus.kt = 6
>>> clus.abundanc = 0.3
>>> calc_kcorr(0.5, 0.5, 2)
0.82799195070436793

Calculate the K correction for a range of redshifts (0 to 2) using an observed frame of 0. to 2 keV and a rest frame of 0.1 to 10 keV (the energy grid is set to ensure that it covers the full energy range; that is the rest-frame band and the observed frame band multiplied by the smallest and largest (1+z) terms):

>>> dataspace1d(0.01, 11, 0.01)
>>> zs = np.linspace(0, 2, 21)
>>> ks = calc_kcorr(zs, 0.5, 2, restlo=0.1, resthi=10)