casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions
casa::FITSCoordinateUtil Class Reference

#include <FITSCoordinateUtil.h>

List of all members.

Public Member Functions

 FITSCoordinateUtil ()
 Constructor.
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.
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.

Static Public Member Functions

static Vector< StringcTypeFromDirection (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.

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.
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.
Bool addDirectionCoordinate (CoordinateSystem &cSys, Vector< Int > &axes, const wcsprm &wcs, LogIO &os) const
 Look for Coordinate type and add to CS.
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.
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.
void setWCS (wcsprm &wcs) const
 Call wcsset.
Bool getCDFromHeader (Matrix< Double > &cd, uInt n, const RecordInterface &header)
 Decode CD cards from FITS file header (Record interface)
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)
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.
void fixCoordinate (Coordinate &c, LogIO &os) const
 Fix up Coordinate for zero increments and the like Possibly the wcs FITS parser could do this.

Detailed Description

Intended use:

Public interface

Prerequisite

Synopsis

Helper functions to inter-converft between a CoordinateSystem and FITS headers.


Caution:

Example

Motivation

I hate FITS

Thrown Exceptions

Definition at line 89 of file FITSCoordinateUtil.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 94 of file FITSCoordinateUtil.h.


Member Function Documentation

Bool casa::FITSCoordinateUtil::addDirectionCoordinate ( CoordinateSystem cSys,
Vector< Int > &  axes,
const wcsprm &  wcs,
LogIO os 
) const [private]

Look for Coordinate type and add to CS.

Bool casa::FITSCoordinateUtil::addLinearCoordinate ( CoordinateSystem cSys,
Vector< Int > &  axes,
const wcsprm &  wcs,
LogIO os 
) const [private]
Bool casa::FITSCoordinateUtil::addSpectralCoordinate ( CoordinateSystem cSys,
Int axis,
const wcsprm &  wcs,
const IPosition shape,
LogIO os 
) const [private]
Bool casa::FITSCoordinateUtil::addStokesCoordinate ( CoordinateSystem cSys,
Int axis,
Int stokesFITSValue,
const wcsprm &  wcs,
const IPosition shape,
LogIO os 
) const [private]
void casa::FITSCoordinateUtil::cardsToRecord ( LogIO os,
RecordInterface rec,
char *  pHeader 
) const [private]

Helper function to convert a wcs structure holding FITS keywords into a Record for later consumption.

static Vector<String> casa::FITSCoordinateUtil::cTypeFromDirection ( Bool isNCP,
const Projection proj,
const Vector< String > &  axisNames,
Double  refLat,
Bool  printError 
) [static]

Helper function to create a FITS style CTYPE vector from the axis names from a DirectionCoordinate.

Bool casa::FITSCoordinateUtil::directionSystemFromWCS ( LogIO os,
MDirection::Types type,
String errMsg,
const wcsprm &  wcs 
) const [private]

Decode values from WCS structures which are generated via the wcs FITS parser.

void casa::FITSCoordinateUtil::fixCoordinate ( Coordinate c,
LogIO os 
) const [private]

Fix up Coordinate for zero increments and the like Possibly the wcs FITS parser could do this.

Bool casa::FITSCoordinateUtil::frequencySystemFromWCS ( LogIO os,
MFrequency::Types type,
String errMsg,
const wcsprm &  wcs 
) const [private]
Bool casa::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.

Bool casa::FITSCoordinateUtil::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 [private]

Generate actual FITS keywords.

Parameters:
pvi_maVector<Double>& crota, Vector<Double>& projp,
Bool casa::FITSCoordinateUtil::getCDFromHeader ( Matrix< Double > &  cd,
uInt  n,
const RecordInterface header 
) [private]

Decode CD cards from FITS file header (Record interface)

ObsInfo casa::FITSCoordinateUtil::getObsInfo ( LogIO os,
RecordInterface header,
const wcsprm &  wcs 
) const [private]

Decode ObsInfo from wcs structure.

void casa::FITSCoordinateUtil::getPCFromHeader ( LogIO os,
Int rotationAxis,
Matrix< Double > &  pc,
uInt  n,
const RecordInterface header,
const String sprefix 
) [private]

Decode PC matrix from FITS header (Record interface)

void casa::FITSCoordinateUtil::setWCS ( wcsprm &  wcs) const [private]

Call wcsset.

Bool casa::FITSCoordinateUtil::stokesCoordinateFromWCS ( LogIO os,
StokesCoordinate coord,
Int stokesFITSValue,
String errMSg,
const wcsprm &  wcs,
uInt  shape,
Bool  warnStokes 
) const [private]
Bool casa::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.

Bool casa::FITSCoordinateUtil::toFITSHeaderStokes ( Vector< Double > &  crval,
Vector< Double > &  crpix,
Vector< Double > &  cdelt,
LogIO os,
const CoordinateSystem coordsys,
Int  stokesAxis,
Int  stokesCoord 
) const [private]

Special Stokes processing for conversion to FITS header.


The documentation for this class was generated from the following file: