Last modified: December 2022

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/calc_kcorr.html
AHELP for CIAO 4.15 Sherpa

calc_kcorr

Context: utilities

Synopsis

Calculate the K correction for a model.

Syntax

calc_kcorr(z, obslo, obshi, restlo=None, resthi=None, id=None,
bkg_id=None)

z - number or array, >= 0
obslo - number
obshi - number
restlo - number or none
resthi - number or none
id - int or str, optional
bkg_id - int or str, optional

Description

The K correction ( [1] , [2] , [3] , [4] ) is the numeric factor applied to measured energy fluxes in an observed energy band to estimate the flux in a given rest-frame energy band. It accounts for the change in spectral energy distribution between the desired rest-frame band and the rest-frame band corresponding to the observed band. This is often used when converting a flux into a luminosity.


Examples

Example 1

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

Example 2

Calculate the K correction for a range of redshifts (0 to 2) using an observed frame of 0.5 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)

Example 3

Calculate the k correction for the background dataset bkg_id=2 for a redshift of 0.5 over the energy range 0.5 to 2 keV with rest-frame energy limits of 2 to 10 keV.

>>> calc_kcorr(0.5, 0.5, 2, 2, 10, bkg_id=2)

PARAMETERS

The parameters for this function are:

Parameter Definition
z The redshift, or redshifts, of the source.
obslo The minimum energy of the observed band.
obshi The maximum energy of the observed band, which must be larger than obslo .
restlo The minimum energy of the rest-frame band. If none then use obslo .
resthi The maximum energy of the rest-frame band. It must be larger than restlo . If none then use obshi .
id 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 If set, use the model associated with the given background component rather than the source model.

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


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

data
copy_data, dataspace1d, dataspace2d, datastack, delete_data, fake, get_axes, get_bkg_chisqr_plot, get_bkg_delchi_plot, get_bkg_fit_plot, get_bkg_model_plot, get_bkg_plot, get_bkg_ratio_plot, get_bkg_resid_plot, get_bkg_source_plot, get_counts, get_data, get_data_contour, get_data_contour_prefs, get_data_image, get_data_plot, get_data_plot_prefs, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group, group_adapt, group_adapt_snr, group_bins, group_counts, group_snr, group_width, load_ascii, load_data, load_grouping, load_quality, set_data, set_quality, ungroup, unpack_ascii, unpack_data
filtering
get_filter, load_filter, set_filter
info
get_default_id, list_data_ids, list_response_ids
modeling
clean
plotting
plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
saving
save_error, save_filter, save_grouping, save_quality, save_staterror, save_syserror
utilities
calc_data_sum, calc_data_sum2d, calc_ftest, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate
visualization
contour, contour_data, contour_ratio, histogram1d, histogram2d, image_data, rebin