casacore
|
A class with static functions to help deal with FITS spectral axes. More...
#include <FITSSpectralUtil.h>
Static Public Member Functions | |
static Bool | fromFITSHeader (Int &spectralAxis, Double &referenceChannel, Double &referenceFrequency, Double &deltaFrequency, Vector< Double > &frequencies, MFrequency::Types &refFrame, MDoppler::Types &velocityPreference, Double &restFrequency, LogIO &logger, const RecordInterface &header, char prefix= 'c', Bool oneRelative=True) |
Get information about the spectral axis from a record containing the FITS axis information. More... | |
static Bool | toFITSHeader (String &ctype, Double &crval, Double &cdelt, Double &crpix, String &cunit, Bool &haveAlt, Double &altrval, Double &altrpix, Int &velref, Double &restfreq, String &specsys, LogIO &logger, Double refFrequency, Double refChannel, Double freqIncrement, MFrequency::Types referenceFrame, Bool preferVelocity=True, MDoppler::Types velocityPreference=MDoppler::OPTICAL, Bool preferWavelength=False, Bool airWavelength=False, Bool useDeprecatedCtypes=False) |
Nearly the inverse of fromFITSHeader. More... | |
static Bool | frameFromTag (MFrequency::Types &referenceFrame, const String &tag, Int velref=-1) |
Convert a reference frame tag (typically found as the characters after the first 4 characters in a ctype string for the frequency-like axis) to a MFrequency::Types value. More... | |
static Bool | tagFromFrame (String &tag, Int &velref, MFrequency::Types referenceFrame) |
Construct a reference frame tag from the given referenceFrame An appropriate velref value is also constructed (this may need to be adjusted by +256 if the velocity definition is radio before being used in a FITS file). More... | |
static Bool | specsysFromFrame (String &specsys, MFrequency::Types referenceFrame) |
Construct a SPECSYS keyword value from the given referenceFrame This returns False if the reference frame is not recognized. More... | |
static Bool | frameFromSpecsys (MFrequency::Types &refFrame, String &specsys) |
static Double | refractiveIndex (const Double &lambda_um) |
The refractive index of air (argument can be vacuum wavelength or airwavelength) according to Greisen et al., 2006, A&A, 464, 746. More... | |
A class with static functions to help deal with FITS spectral axes.
Public interface
This is a collection of static utility functions for use with FITS spectral axes.
This class provides functions to extract information from a FITS header about the spectral axis, to setup a FITS header with appropriate information for the spectral axis, and to translate to and from the MFrequency reference frame codes and their FITS equivalents. It is never necessary to construct a FITSSpectralUtil, just use the static functions to help handle FITS Spectral axes.
This is designed to be used after the keywords have been extracted from the FITS file using the FITSKeywordUtil class. Extracting spectral axis and related information requires detailed knowledge of FITS conventions that this class strives to encapsulize.
Definition at line 103 of file FITSSpectralUtil.h.
|
static |
|
static |
Convert a reference frame tag (typically found as the characters after the first 4 characters in a ctype string for the frequency-like axis) to a MFrequency::Types value.
A velref value (used in AIPS images to alternatively record the velocity reference frame) may also optionally be supplied. If tag is empty, velref will be used if it is >= 0. This function returns False if:
The default value (set when the return value is False) is TOPO.
|
static |
Get information about the spectral axis from a record containing the FITS axis information.
Usually this will be from a FITS header using, for example, the FITSKeywordUtil::getKeywords method. referenceFrequency and deltaFrequency give the best possible linear frequency scale. prefix is the first character in the set of keywords describing the axes (e.g. crpix, crval, ctype - the prefix is 'c'). If oneRelative is False, the returned referenceChannel is decrimented from that found in header by 1. The naxis keywords are used to determine the output length of the freqs vector. This method returns False if:
The refractive index of air (argument can be vacuum wavelength or airwavelength) according to Greisen et al., 2006, A&A, 464, 746.
If vacuum wavelength is used there is an error of the order of 1E-9. Argument must be in micrometers!
|
static |
Construct a SPECSYS keyword value from the given referenceFrame This returns False if the reference frame is not recognized.
The value of tag defaults to "TOPOCENT".
|
static |
Construct a reference frame tag from the given referenceFrame An appropriate velref value is also constructed (this may need to be adjusted by +256 if the velocity definition is radio before being used in a FITS file).
This returns False if the reference frame is not recognized. The value of tag defaults to "-OBS".
|
static |
Nearly the inverse of fromFITSHeader.
This returns parameters which could be used in filling in a header record with appropriate values for the spectral axis given the arguments after the logger. The alternate axis description values are set when sufficient information is available. If they have been set, haveAlt will be set to True.
If preferVelocity is True, the axis description parameters will be set to those appropriate for a velocity axis given the referenceFrame, and velocityPreference if possible. If preferWavelength is True, the axis description parameters will be set to those appropriate for a wavelength axis given the referenceFrame if possible. The two preferences cannot be True at the same time. If airWavelength is True, the axis description parameters will be set to those appropriate for an air wavelength axis given the referenceFrame if possible. This parameter has an effect only if preferWavelength is True.
This method always returns True.