casacore
|
#include <FITSCoordinateUtil.h>
Public Member Functions | |
FITSCoordinateUtil () | |
Constructor. More... | |
Bool | toFITSHeader (RecordInterface &header, IPosition &shape, const CoordinateSystem &cSys, Bool oneRelative, Char prefix='c', Bool writeWCS=True, Bool preferVelocity=True, Bool opticalVelocity=True, Bool preferWavelength=False, Bool airWavelength=False) const |
Convert CoordinateSystem to a FITS header. More... | |
Bool | fromFITSHeader (Int &stokesFITSValue, CoordinateSystem &coordsys, RecordInterface &recHeader, const Vector< String > &header, const IPosition &shape, uInt which=0) const |
Probably even if we return False we should set up the best linear coordinate that we can. More... | |
Static Public Member Functions | |
static Vector< String > | cTypeFromDirection (Bool &isNCP, const Projection &proj, const Vector< String > &axisNames, Double refLat, Bool printError) |
Helper function to create a FITS style CTYPE vector from the axis names from a DirectionCoordinate. More... | |
static Vector< String > | cTypeFromDirection (const Projection &proj, const Vector< String > &axisNames, Bool printError) |
Private Member Functions | |
Bool | generateFITSKeywords (LogIO &os, Bool &isNCP, Double &longPole, Double &latPole, Vector< Double > &crval, Vector< Double > &crpix, Vector< Double > &cdelt, Vector< Double > &pvi_ma, Vector< String > &ctype, Vector< String > &cunit, Matrix< Double > &pc, const CoordinateSystem &cSys, Int skyCoord, Int longAxis, Int latAxis, Int specAxis, Int stokesAxis, Bool writeWCS, Double offset, const String &sprefix) const |
Generate actual FITS keywords. More... | |
Bool | toFITSHeaderStokes (Vector< Double > &crval, Vector< Double > &crpix, Vector< Double > &cdelt, LogIO &os, const CoordinateSystem &coordsys, Int stokesAxis, Int stokesCoord) const |
Special Stokes processing for conversion to FITS header. More... | |
Bool | addDirectionCoordinate (CoordinateSystem &cSys, Vector< Int > &axes, const wcsprm &wcs, LogIO &os) const |
Look for Coordinate type and add to CS. More... | |
Bool | addSpectralCoordinate (CoordinateSystem &cSys, Int &axis, const wcsprm &wcs, const IPosition &shape, LogIO &os) const |
Bool | addStokesCoordinate (CoordinateSystem &cSys, Int &axis, Int &stokesFITSValue, const wcsprm &wcs, const IPosition &shape, LogIO &os) const |
Bool | addLinearCoordinate (CoordinateSystem &cSys, Vector< Int > &axes, const wcsprm &wcs, LogIO &os) const |
Bool | directionSystemFromWCS (LogIO &os, MDirection::Types &type, String &errMsg, const wcsprm &wcs) const |
Decode values from WCS structures which are generated via the wcs FITS parser. More... | |
Bool | frequencySystemFromWCS (LogIO &os, MFrequency::Types &type, String &errMsg, const wcsprm &wcs) const |
Bool | stokesCoordinateFromWCS (LogIO &os, StokesCoordinate &coord, Int &stokesFITSValue, String &errMSg, const wcsprm &wcs, uInt shape, Bool warnStokes) const |
ObsInfo | getObsInfo (LogIO &os, RecordInterface &header, const wcsprm &wcs) const |
Decode ObsInfo from wcs structure. More... | |
void | setWCS (wcsprm &wcs) const |
Call wcsset. More... | |
Bool | getCDFromHeader (Matrix< Double > &cd, uInt n, const RecordInterface &header) |
Decode CD cards from FITS file header (Record interface) More... | |
void | getPCFromHeader (LogIO &os, Int &rotationAxis, Matrix< Double > &pc, uInt n, const RecordInterface &header, const String &sprefix) |
Decode PC matrix from FITS header (Record interface) More... | |
void | cardsToRecord (LogIO &os, RecordInterface &rec, char *pHeader) const |
Helper function to convert a wcs structure holding FITS keywords into a Record for later consumption. More... | |
void | fixCoordinate (Coordinate &c, LogIO &os) const |
Fix up Coordinate for zero increments and the like Possibly the wcs FITS parser could do this. More... | |
Static Private Member Functions | |
static void | wcsInit (::wcsprm &wcsDest) |
Initialize the wcsprm struct. More... | |
Public interface
Helper functions to inter-converft between a CoordinateSystem and FITS headers.
Caution:
I hate FITS
Definition at line 89 of file FITSCoordinateUtil.h.
|
inline |
Constructor.
Definition at line 94 of file FITSCoordinateUtil.h.
|
private |
Look for Coordinate type and add to CS.
|
private |
|
private |
|
private |
|
private |
|
static |
Helper function to create a FITS style CTYPE vector from the axis names from a DirectionCoordinate.
|
static |
|
private |
Decode values from WCS structures which are generated via the wcs FITS parser.
|
private |
Fix up Coordinate for zero increments and the like Possibly the wcs FITS parser could do this.
|
private |
Bool casacore::FITSCoordinateUtil::fromFITSHeader | ( | Int & | stokesFITSValue, |
CoordinateSystem & | coordsys, | ||
RecordInterface & | recHeader, | ||
const Vector< String > & | header, | ||
const IPosition & | shape, | ||
uInt | which = 0 |
||
) | const |
Probably even if we return False we should set up the best linear coordinate that we can.
On output, stokesFITSValue
holds the FITS value of any unofficial Stokes (beam, optical depth, spectral index) for the last unofficial value accessed (-1 if none). The idea is that if the Stokes axis is of length one and holds an unofficial value, you should drop the STokes axis and convert that value to ImageInfo::ImageTypes
with ImageInfo::imageTypeFromFITSValue
. If on input, stokesFITSValue
is positive, then a warning is issued if any unofficial values are encountered. Otherwise no warning is issued.
|
private |
Generate actual FITS keywords.
|
private |
|
private |
Decode ObsInfo from wcs structure.
|
private |
Call wcsset.
|
private |
Bool casacore::FITSCoordinateUtil::toFITSHeader | ( | RecordInterface & | header, |
IPosition & | shape, | ||
const CoordinateSystem & | cSys, | ||
Bool | oneRelative, | ||
Char | prefix = 'c' , |
||
Bool | writeWCS = True , |
||
Bool | preferVelocity = True , |
||
Bool | opticalVelocity = True , |
||
Bool | preferWavelength = False , |
||
Bool | airWavelength = False |
||
) | const |
Convert CoordinateSystem to a FITS header.
In the record the keywords are vectors, it is expected that the actual FITS code will split them into scalars and upcase the names. Returns False if one of the keywords is already taken.
If writeWCS is True, attempt to write the WCS convention (Greisen and Calabretta "Representation of celestial coordinates in FITS") as approved in version 3.0 of the FITS standard. Use oneRelative=True
to convert zero-relative pixel coordinates to one-relative FITS coordinates.
prefix gives the prefix for the FITS keywords. E.g., if prefix="c" then crval, cdelt etc. if prefix="d" then drval, ddelt etc.
|
staticprivate |
Initialize the wcsprm struct.
It sets the flag to -1, but furthermore it clears the err pointers because wcslib-4.8 (shipped with Ubuntu) sometimes fails to do so.